From: Hans U. N. <hu...@us...> - 2005-04-16 01:48:45
|
Update of /cvsroot/libexif/gexif In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23417/src/gexif Modified Files: autogen.sh Log Message: autogen.sh 0.4.0: - properly handle recursion - add --dry-run mode Index: autogen.sh =================================================================== RCS file: /cvsroot/libexif/gexif/autogen.sh,v retrieving revision 1.16 retrieving revision 1.17 diff -u -p -d -r1.16 -r1.17 --- autogen.sh 9 Apr 2005 19:52:27 -0000 1.16 +++ autogen.sh 16 Apr 2005 01:48:36 -0000 1.17 @@ -15,32 +15,32 @@ fi ######################################################################## # Constant and initial values -debug=false +debug="false" +recursive="false" +dryrun="false" self="$(basename "$0")" -autogen_version="0.3.2" +autogen_version="0.4.0" ######################################################################## # Print help message print_help() { - cat<<EOF -$self - initialize automake/autoconf/gettext/libtool based build system + cat<<__HELP_EOF__ +${self} - initialize automake/autoconf/gettext/libtool based build system Usage: - $self [<command>...] [<directory>...] + ${self} [<command>|<flag>|...] [<directory>...] Runs given command sequence on all given directories, in sequence. If there is no command given, --init is assumed. -If there is no directory given, the location of $self is assumed. +If there is no directory given, the location of ${self} is assumed. Commands: --help Print this help text --version Print the tool versions - --verbose - Verbose output --clean Clean all files and directories generated by "$self --init" @@ -49,12 +49,22 @@ Commands: can be processed further by running the classic ./configure && make && make install -$self depends on automake, autoconf, libtool and gettext. +Flags: + --verbose + Verbose output + --dry-run + Only print the commands to be run, not actually execute + them. + --recursive + Used internally. Do everything which doesn't recurse on + its own. + +${self} depends on automake, autoconf, libtool and gettext. You may want to set AUTOCONF, AUTOHEADER, AUTOMAKE, ACLOCAL, AUTOPOINT, LIBTOOLIZE to use specific version of these tools, and AUTORECONF_OPTS to add options to the call to autoreconf. -EOF +__HELP_EOF__ } @@ -103,12 +113,21 @@ init_vars() { fi fi - echo -n "Initializing variables for \`${dir}'..." + "$debug" && echo -n "Initializing variables for \`${dir}'..." # FIXME: Just getting those directories and cleaning them isn't enough. # OK, the "init" part is done recursively by autopoint, so that is easy. # But the cleaning should also work recursively, but that is difficult # with the current structure of the script. AG_SUBDIRS="$(for k in $(sed -n 's/^[[:space:]]*AC_CONFIG_SUBDIRS(\[\{0,1\}\([^])]*\).*/\1/p' "$CONFIGURE_AC"); do echo "${dir}/${k}"; done)" + AG_LIBLTDL_DIR="$(sed -n 's/^[[:space:]]*AC_LIBLTDL_\(INSTALLABLE\|CONVENIENCE\)(\[\{0,1\}\([^])]*\).*/\2/p' < "$CONFIGURE_AC")" + if test "x$AG_LIBLTDL_DIR" = "x"; then + tmp="$(sed -n 's/^[[:space:]]*\(AC_LIBLTDL_\)\(INSTALLABLE\|CONVENIENCE\)(\[\{0,1\}\([^])]*\).*/\1/p' < "$CONFIGURE_AC")" + if test "x$tmp" = "xAC_LIBLTDL_"; then + AG_LIBLTDL_DIR="libltdl" + else + AG_LIBLTDL_DIR="" + fi + fi AG_AUX="$(sed -n 's/^AC_CONFIG_AUX_DIR(\[\{0,1\}\([^])]*\).*/\1/p' < "$CONFIGURE_AC")" if test "x$AG_AUX" = "x"; then AG_AUX="." @@ -133,103 +152,113 @@ init_vars() { done AG_GEN_ACAM="aclocal.m4 configure $AG_AUX/config.guess $AG_AUX/config.sub $AG_AUX/compile" AG_GEN_RECONF="$AG_AUX/install-sh $AG_AUX/missing $AG_AUX/depcomp" + AG_GEN_LIBTOOL="$AG_AUX/ltmain.sh libtool" + while read file; do + AG_GEN_LIBTOOL="${AG_GEN_LIBTOOL} ${AG_LIBLTDL_DIR}/${file}" + done <<EOF +aclocal.m4 +config.guess +config-h.in +config.sub +configure +configure.ac +COPYING.LIB +install-sh +ltdl.c +ltdl.h +ltmain.sh +Makefile.am +Makefile.in +missing +README +EOF AG_GEN_GETTEXT="$AG_AUX/mkinstalldirs $AG_AUX/config.rpath ABOUT-NLS" while read file; do - AG_GEN_GETTEXT="${AG_GEN_GETTEXT} ${file}" + AG_GEN_GETTEXT="${AG_GEN_GETTEXT} m4/${file} m4m/${file}" done <<EOF -m4/codeset.m4 -m4/gettext.m4 -m4/glibc21.m4 -m4/iconv.m4 -m4/intdiv0.m4 -m4/intmax.m4 -m4/inttypes-pri.m4 -m4/inttypes.m4 -m4/inttypes_h.m4 -m4/isc-posix.m4 -m4/lcmessage.m4 -m4/lib-ld.m4 -m4/lib-link.m4 -m4/lib-prefix.m4 -m4/longdouble.m4 -m4/longlong.m4 -m4/nls.m4 -m4/po.m4 -m4/printf-posix.m4 -m4/progtest.m4 -m4/signed.m4 -m4/size_max.m4 -m4/stdint_h.m4 -m4/uintmax_t.m4 -m4/ulonglong.m4 -m4/wchar_t.m4 -m4/wint_t.m4 -m4/xsize.m4 -m4m/codeset.m4 -m4m/gettext.m4 -m4m/glibc21.m4 -m4m/iconv.m4 -m4m/intdiv0.m4 -m4m/intmax.m4 -m4m/inttypes-pri.m4 -m4m/inttypes.m4 -m4m/inttypes_h.m4 -m4m/isc-posix.m4 -m4m/lcmessage.m4 -m4m/lib-ld.m4 -m4m/lib-link.m4 -m4m/lib-prefix.m4 -m4m/longdouble.m4 -m4m/longlong.m4 -m4m/nls.m4 -m4m/po.m4 -m4m/printf-posix.m4 -m4m/progtest.m4 -m4m/signed.m4 -m4m/size_max.m4 -m4m/stdint_h.m4 -m4m/uintmax_t.m4 -m4m/ulonglong.m4 -m4m/wchar_t.m4 -m4m/wint_t.m4 -m4m/xsize.m4 -po/Makefile.in.in -po/Makevars.template -po/Rules-quot -po/boldquot.sed -po/en@boldquot.header -po/en@quot.header -po/insert-header.sin -po/quot.sed -po/remove-potcdate.sin -po/stamp-po +codeset.m4 +gettext.m4 +glibc21.m4 +iconv.m4 +intdiv0.m4 +intmax.m4 +inttypes-pri.m4 +inttypes.m4 +inttypes_h.m4 +isc-posix.m4 +lcmessage.m4 +lib-ld.m4 +lib-link.m4 +lib-prefix.m4 +longdouble.m4 +longlong.m4 +nls.m4 +po.m4 +printf-posix.m4 +progtest.m4 +signed.m4 +size_max.m4 +stdint_h.m4 +uintmax_t.m4 +ulonglong.m4 +wchar_t.m4 +wint_t.m4 +xsize.m4 +EOF + while read file; do + AG_GEN_GETTEXT="${AG_GEN_GETTEXT} po/${file}" + done <<EOF +Makefile.in.in +Makevars.template +Rules-quot +boldquot.sed +en@boldquot.header +en@quot.header +insert-header.sin +quot.sed +remove-potcdate.sin +stamp-po EOF AG_GEN_CONF="config.status config.log" - AG_GEN_LIBTOOL="$AG_AUX/ltmain.sh libtool" AG_GEN_FILES="$AG_GEN_ACAM $AG_GEN_RECONF $AG_GEN_GETTEXT" AG_GEN_FILES="$AG_GEN_FILES $AG_GEN_CONFIG_H $AG_GEN_CONF $AG_GEN_LIBTOOL" - AG_GEN_DIRS="autom4te.cache" - echo " done." + AG_GEN_DIRS="autom4te.cache ${AG_LIBLTDL_DIR}/autom4te.cache ${AG_LIBLTDL_DIR}" + "$debug" && echo " done." if "$debug"; then set | grep '^AG_'; fi + dryrun_param="" + if "$dryrun"; then dryrun_param="--dry-run"; fi +} + + +######################################################################## +# Print command to be executed and, if not dryrun, actually execute it. + +execute_command() { + if "$dryrun" || "$debug"; then + echo "Running <<" "$@" ">>" + fi + if "$dryrun"; then :; else + "$@" + fi } ######################################################################## # Clean generated files from $* directories -clean() { +command_clean() { if test "x$AG_GEN_FILES" = "x"; then echo "Internal error"; exit 2; fi dir="$1" - while test "$dir"; do + #while test "$dir"; do echo "$self:clean: Entering directory \`${dir}'" ( if cd "$dir"; then echo -n "Cleaning autogen generated files..." - rm -rf ${AG_GEN_DIRS} - rm -f ${AG_GEN_FILES} + execute_command rm -rf ${AG_GEN_DIRS} + execute_command rm -f ${AG_GEN_FILES} echo " done." - if test -h INSTALL; then rm -f INSTALL; fi + if test -h INSTALL; then execute_command rm -f INSTALL; fi echo -n "Cleaning generated Makefile, Makefile.in files..." if "$debug"; then echo; fi find . -type f -name 'Makefile.am' -print | \ @@ -241,39 +270,58 @@ clean() { if "$debug"; then echo -e " Removing files created from ${file}" fi - rm -f "${base}" "${base}.in" + execute_command rm -f "${base}" "${base}.in" done if "$debug"; then :; else echo " done."; fi echo -n "Removing *~ backup files..." - find . -type f -name '*~' -exec rm -f {} \; + find . -type f -name '*~' -print | while read fname; do + execute_command rm -f "$fname" + done echo " done." + if test -n "${AG_SUBDIRS}"; then + "$0" --clean ${dryrun_param} --recursive ${AG_SUBDIRS} + fi fi ) echo "$self:clean: Left directory \`${dir}'" - shift - dir="$1" - done + #shift + #dir="$1" + #done } ######################################################################## # Initialize build system in $1 directory -init() { +command_init() { dir="$1" if test "x$AG_GEN_FILES" = "x"; then echo "Internal error"; exit 2; fi echo "$self:init: Entering directory \`${dir}'" ( if cd "${dir}"; then - echo "Running <<" autoreconf --install --symlink ${AUTORECONF_OPTS} ">>" - if autoreconf --install --symlink ${AUTORECONF_OPTS}; then - :; else - status="$?" - echo "autoreconf quit with exit code $status, aborting." - exit "$status" - fi - echo "You may run ./configure now in \`${dir}'." - echo "Run as \"./configure --help\" to find out about config options." + if test "x$AG_LIBLTDL_DIR" != "x"; then + # We have to run libtoolize --ltdl ourselves because + # - autoreconf doesn't run it at all + execute_command "${LIBTOOLIZE-"libtoolize"}" --ltdl + # And we have to clean up the generated files after libtoolize because + # - we still want symlinks for the files + # - but we want to (implicitly) AC_CONFIG_SUBDIR and that writes to + # these files. + (cd "${AG_LIBLTDL_DIR}" && execute_command rm -f aclocal.m4 config.guess config.sub configure install-sh ltmain.sh Makefile.in missing) + fi + if test -n "${AG_SUBDIRS}"; then + "$0" --init ${dryrun_param} --recursive ${AG_SUBDIRS} + fi + if "$recursive"; then :; else + if execute_command autoreconf --install --symlink ${AUTORECONF_OPTS}; then + :; else + status="$?" + echo "autoreconf quit with exit code $status, aborting." + exit "$status" + fi + echo "You may run ./configure now in \`${dir}'." + echo "Run as \"./configure --help\" to find out about config options." + fi else exit "$?" fi @@ -309,7 +357,13 @@ for param in $@; do check_versions=: ;; --verbose) - debug="true" + debug=: + ;; + --dry-run) + dryrun=: + ;; + --recursive) + recursive=: ;; --version) print_versions @@ -346,6 +400,7 @@ if "$check_versions"; then " while read tool minversion; do version="$("$tool" --version | sed 's/^.*(.*) *\(.*\)$/\1/g;1q')" + # compare version and minversion first="$(echo "$version$lf$minversion" | sort -n | sed '1q')" if test "x$minversion" != "x$first" && test "x$version" = "x$first"; then echo "Version \`$version' of \`$tool' not sufficient. At least \`$minversion' required." @@ -371,13 +426,13 @@ fi # Actually run the commands for dir in ${dirs}; do - echo "Running commands on directory \`${dir}'" + "$debug" && echo "Running commands on directory \`${dir}'" if test ! -d "$dir"; then echo "Could not find directory \`${dir}'" fi init_vars "$dir" for command in ${commands}; do - "$command" "$dir" ${AG_SUBDIRS} + "command_$command" "$dir" done done |