From: Eric Blake Date: Wed, 14 May 2008 00:07:46 +0000 (+0200) Subject: Reduce number of forks required during autoconf. X-Git-Tag: v0.1~7404 X-Git-Url: http://erislabs.net/gitweb/?a=commitdiff_plain;h=71bbf08d68da961804990928e7c298e743ae88c5;p=gnulib.git Reduce number of forks required during autoconf. --- diff --git a/ChangeLog b/ChangeLog index 0f71c90fd..147ea6140 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,16 @@ 2008-05-13 Eric Blake + Bruno Haible + + Reduce number of forks required during autoconf. + * gnulib-tool (func_emit_initmacro_start): Prepare gl_LIBSOURCES_LIST + and gl_LIBSOURCES_DIR. + (func_emit_initmacro_end): Use them here in a single m4_syscmd... + (func_emit_initmacro_done) : ...rather than in one + m4_syscmd per file. + : Move... + * m4/gnulib-common.m4 (m4_foreach_w): ...here. + +2008-05-13 Eric Blake * gnulib-tool: Fix various comment typos. diff --git a/gnulib-tool b/gnulib-tool index a6447171b..ecba67e81 100755 --- a/gnulib-tool +++ b/gnulib-tool @@ -2046,6 +2046,14 @@ func_emit_initmacro_start () # We let automake know about the files to be distributed through the # EXTRA_lib_SOURCES variable. echo " m4_pushdef([AC_LIBSOURCES], m4_defn([${macro_prefix_arg}_LIBSOURCES]))" + # Create data variables for checking the presence of files that are mentioned + # as AC_LIBSOURCES arguments. These are m4 variables, not shell variables, + # because we want the check to happen when the configure file is created, + # not when it is run. ${macro_prefix_arg}_LIBSOURCES_LIST is the list of + # files to check for. ${macro_prefix_arg}_LIBSOURCES_DIR is the subdirectory + # in which to expect them. + echo " m4_pushdef([${macro_prefix_arg}_LIBSOURCES_LIST], [])" + echo " m4_pushdef([${macro_prefix_arg}_LIBSOURCES_DIR], [])" echo " gl_COMMON" } @@ -2055,6 +2063,23 @@ func_emit_initmacro_start () func_emit_initmacro_end () { macro_prefix_arg="$1" + # Check the presence of files that are mentioned as AC_LIBSOURCES arguments. + # The check is performed only when autoconf is run from the directory where + # the configure.ac resides; if it is run from a different directory, the + # check is skipped. + echo " m4_ifval([${macro_prefix_arg}_LIBSOURCES_LIST], [" + echo " m4_syscmd([test ! -d ]${macro_prefix_arg}_LIBSOURCES_DIR[ ||" + echo " for gl_file in ]${macro_prefix_arg}_LIBSOURCES_LIST[ ; do" + echo " if test ! -r ]${macro_prefix_arg}_LIBSOURCES_DIR[/\$gl_file ; then" + echo " echo \"missing file ]${macro_prefix_arg}_LIBSOURCES_DIR[/\$gl_file\" >&2" + echo " exit 1" + echo " fi" + echo " done])dnl" + echo " m4_if(m4_sysval, [0], []," + echo " [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])])" + echo " ])" + echo " m4_popdef([${macro_prefix_arg}_LIBSOURCES_DIR])" + echo " m4_popdef([${macro_prefix_arg}_LIBSOURCES_LIST])" echo " m4_popdef([AC_LIBSOURCES])" echo " m4_popdef([AC_REPLACE_FUNCS])" echo " m4_popdef([AC_LIBOBJ])" @@ -2090,13 +2115,6 @@ func_emit_initmacro_done () echo " ${macro_prefix_arg}_LIBOBJS=\"\$${macro_prefix_arg}_LIBOBJS \$1.\$ac_objext\"" echo "])" echo - echo "# m4_foreach_w is provided by autoconf-2.59c and later." - echo "# This definition is to accommodate developers using versions" - echo "# of autoconf older than that." - echo "m4_ifndef([m4_foreach_w]," - echo " [m4_define([m4_foreach_w]," - echo " [m4_foreach([\$1], m4_split(m4_normalize([\$2]), [ ]), [\$3])])])" - echo echo "# Like AC_REPLACE_FUNCS, except that the module name goes" echo "# into ${macro_prefix_arg}_LIBOBJS instead of into LIBOBJS." echo "AC_DEFUN([${macro_prefix_arg}_REPLACE_FUNCS], [" @@ -2111,9 +2129,8 @@ func_emit_initmacro_done () echo "AC_DEFUN([${macro_prefix_arg}_LIBSOURCES], [" echo " m4_foreach([_gl_NAME], [\$1], [" echo " m4_if(_gl_NAME, [alloca.c], [], [" - echo " m4_syscmd([test -r $sourcebase_arg/]_gl_NAME[ || test ! -d $sourcebase_arg])dnl" - echo " m4_if(m4_sysval, [0], []," - echo " [AC_FATAL([missing $sourcebase_arg/]_gl_NAME)])" + echo " m4_define([${macro_prefix_arg}_LIBSOURCES_DIR], [$sourcebase_arg])" + echo " m4_append_uniq([${macro_prefix_arg}_LIBSOURCES_LIST], _gl_NAME, [ ])" echo " ])" echo " ])" echo "])" diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4 index 3edfc120f..34d91c728 100644 --- a/m4/gnulib-common.m4 +++ b/m4/gnulib-common.m4 @@ -1,4 +1,4 @@ -# gnulib-common.m4 serial 4 +# gnulib-common.m4 serial 5 dnl Copyright (C) 2007-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -31,6 +31,13 @@ AC_DEFUN([gl_MODULE_INDICATOR], [Define to 1 when using the gnulib module ]$1[.]) ]) +# m4_foreach_w +# is a backport of autoconf-2.59c's m4_foreach_w. +# Remove this macro when we can assume autoconf >= 2.60. +m4_ifndef([m4_foreach_w], + [m4_define([m4_foreach_w], + [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])]) + # AC_PROG_MKDIR_P # is a backport of autoconf-2.60's AC_PROG_MKDIR_P. # Remove this macro when we can assume autoconf >= 2.60.