diff --git a/Makefile.in b/Makefile.in index ce18e5a1..b5bb2765 100644 --- a/Makefile.in +++ b/Makefile.in @@ -26,6 +26,7 @@ INSTALL_DATA = @INSTALL_DATA@ MAKEINFO = makeinfo TEXI2DVI = texi2dvi M4 = @M4@ +AWK = @AWK@ PERL = @PERL@ # Programs that are always installed. @@ -70,7 +71,8 @@ DISTFILES = COPYING ChangeLog ChangeLog.1 INSTALL \ testsuite/lib/*.exp testsuite/autoconf.[gs]/*.exp \ standards.texi make-stds.texi standards.info* -editsh = sed -e 's,@''datadir''@,$(acdatadir),g' -e 's,@''M4''@,$(M4),g' +editsh = sed -e 's,@''datadir''@,$(acdatadir),g' -e \ + 's,@''M4''@,$(M4),g' -e 's,@''AWK''@,$(AWK),g' editpl = sed -e 's,@''datadir''@,$(acdatadir),g' -e 's,@''PERL''@,$(PERL),g' all: ${SCRIPTS} diff --git a/NEWS b/NEWS index d5d135ee..7633e21b 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,11 @@ Major changes in release 2.2: +* The ifnames utility is much faster but requires a "new awk" interpreter. +* AC_CHECK_LIB and AC_HAVE_LIBRARY check and add the new + library before existing libs, not after, in case it uses them. +* New macros: AC_FUNC_GETPGRP, AC_CHECK_TOOL. +* Many additions to the TODO file :-) +* Lots of bug fixes. Major changes in release 2.1: diff --git a/TODO b/TODO index 311b5bae..7660d4c9 100644 --- a/TODO +++ b/TODO @@ -116,13 +116,8 @@ Have AC_CANONICAL_* cache the host/build/target types. ------------------------------------------------------------------------------ Look at contributions: - ifnames rewrite using nawk (Paul Eggert) ac_include (Karl Berry) - tool_prefix (Roland McGrath) aclocal.h tom@basil.icce.rug.NL (Tom R.Hageman) - inline rewrite (Jim Avera) - getpgrp and stringize (Arnold Robbins) - caching AC_DECL_YYTEXT (Karl Berry, John something) ------------------------------------------------------------------------------ @@ -203,11 +198,6 @@ From: "Randall S. Winchester" ------------------------------------------------------------------------------ -Handle trailing slashes in PATH elements in AC_CHECK_PROG, -AC_PATH_PROG, AC_PROG_INSTALL. - ------------------------------------------------------------------------------- - In libc and make in aclocal.m4 I have AC_CHECK_SYMBOL, which checks for sys_siglist et al. Using AC_CHECK_FUNC doesn't work on some system that winds up caring that you reference it as a function and it is really a @@ -215,16 +205,7 @@ variable. My version always declares the symbol as a char *[]; if that ends up a bad idea, we can have it take an arg with the C decl, but that is a bit verbose to write if it's actually superfluous. From Roland McGrath. - ------------------------------------------------------------------------------- - -In /gd4/gnu/hurd/aclocal.m4 I wrote AC_CHECK_TOOL, which is a boon when -doing a lot of cross compilation, and I think a good thing to use -generically (AC_PROG_{CC,RANLIB} should use it). I want this merged so I -can convert mach4's configure.in to stop using local hack macros, and -finally get a configure.in up for hurd (and then rewrite its makefiles -again). -From Roland McGrath. +[I'd call it AC_CHECK_VAR, I think. -djm] ------------------------------------------------------------------------------ diff --git a/acconfig.h b/acconfig.h index a97b1080..abbb6424 100644 --- a/acconfig.h +++ b/acconfig.h @@ -52,6 +52,9 @@ /* Define if the `getloadavg' function needs to be run setuid or setgid. */ #undef GETLOADAVG_PRIVILEGED +/* Define if the `getpgrp' function takes no argument. */ +#undef GETPGRP_VOID + /* Define to `int' if doesn't define. */ #undef gid_t diff --git a/acgeneral.m4 b/acgeneral.m4 index 8debae20..c4d3245d 100644 --- a/acgeneral.m4 +++ b/acgeneral.m4 @@ -755,7 +755,8 @@ AC_CANONICAL_TARGET AC_CANONICAL_BUILD test "$host_alias" != "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ - NONENONEs,x,x, && program_prefix=${target_alias}- + NONENONEs,x,x, && + program_prefix=${target_alias}- ]) dnl Subroutines of AC_CANONICAL_SYSTEM. @@ -770,6 +771,7 @@ fi AC_MSG_CHECKING(host system type) +dnl Set host_alias. host_alias=$host case "$host_alias" in NONE) @@ -782,6 +784,7 @@ NONE) esac ;; esac +dnl Set the other host vars. host=`$ac_config_sub $host_alias` host_cpu=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` host_vendor=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` @@ -799,6 +802,7 @@ AC_DEFUN(AC_CANONICAL_TARGET, [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_MSG_CHECKING(target system type) +dnl Set target_alias. target_alias=$target case "$target_alias" in NONE) @@ -808,6 +812,7 @@ NONE) esac ;; esac +dnl Set the other target vars. target=`$ac_config_sub $target_alias` target_cpu=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` target_vendor=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` @@ -825,6 +830,7 @@ AC_DEFUN(AC_CANONICAL_BUILD, [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_MSG_CHECKING(build system type) +dnl Set build_alias. build_alias=$build case "$build_alias" in NONE) @@ -834,6 +840,7 @@ NONE) esac ;; esac +dnl Set the other build vars. build=`$ac_config_sub $build_alias` build_cpu=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` build_vendor=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` @@ -1151,6 +1158,22 @@ done ifelse([$3], , , [test -n "[$]$1" || $1="$3" ])]) +dnl Internal subroutine. +AC_DEFUN(AC_CHECK_TOOL_PREFIX, +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +if test $host != $build; then + ac_tool_prefix=${host_alias}- +else + ac_tool_prefix= +fi +]) + +dnl AC_CHECK_TOOL(VARIABLE, PROG-TO-CHECK-FOR) +AC_DEFUN(AC_CHECK_TOOL, +[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl +AC_CHECK_PROG($1, ${ac_tool_prefix}$2, ${ac_tool_prefix}$2, $2) +]) + dnl Guess the value for the `prefix' variable by looking for dnl the argument program along PATH and taking its parent. dnl Example: if the argument is `gcc' and we find /usr/local/gnu/bin/gcc, @@ -1168,7 +1191,7 @@ AC_MSG_CHECKING([for prefix by ]) AC_PATH_PROG(AC_VAR_NAME, $1) changequote(<<, >>)dnl if test -n "$ac_cv_path_<<>>AC_VAR_NAME"; then - prefix=`echo $ac_cv_path_<<>>AC_VAR_NAME|sed 's%/[^/][^/]*/[^/][^/]*$%%'` + prefix=`echo $ac_cv_path_<<>>AC_VAR_NAME|sed 's%/[^/][^/]*//*[^/][^/]*$%%'` changequote([, ])dnl fi fi diff --git a/acspecific.m4 b/acspecific.m4 index 17f6dd96..03cab495 100644 --- a/acspecific.m4 +++ b/acspecific.m4 @@ -250,7 +250,7 @@ AC_SUBST([SET_MAKE])dnl AC_DEFUN(AC_PROG_RANLIB, [AC_CHECK_PROG(RANLIB, ranlib, ranlib, :)]) -dnl Check for mawk first since it's said to be faster. +dnl Check for mawk first since it's generally faster. AC_DEFUN(AC_PROG_AWK, [AC_CHECK_PROGS(AWK, mawk gawk nawk awk, )]) @@ -317,27 +317,34 @@ then fi AC_SUBST(LEXLIB)]) +dnl Check if lex declares yytext as a char * by default, not a char[]. +undefine([AC_DECL_YYTEXT]) AC_DEFUN(AC_DECL_YYTEXT, [AC_REQUIRE_CPP()dnl AC_REQUIRE([AC_PROG_LEX])dnl +AC_MSG_CHECKING(lex output file root) +AC_CACHE_VAL(ac_cv_prog_lex_root, +[# The minimal lex program is just a single line: %%. But some broken lexes +# (Solaris, I think it was) want two %% lines, so accommodate them. +echo '%% +%%' | $LEX +if test -f lex.yy.c; then + ac_cv_prog_lex_root=lex.yy +elif test -f lexyy.c; then + ac_cv_prog_lex_root=lexyy +else + AC_MSG_ERROR(cannot find output from $LEX; giving up) +fi])dnl +LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root +AC_MSG_RESULT($ac_cv_prog_lex_root) +AC_SUBST(LEX_OUTPUT_ROOT)dnl + AC_MSG_CHECKING(whether yytext is a pointer) AC_CACHE_VAL(ac_cv_prog_lex_yytext_pointer, [# POSIX says lex can declare yytext either as a pointer or an array; the # default is implementation-dependent. Figure out which it is, since # not all implementations provide the %pointer and %array declarations. -# -# The minimal lex program is just a single line: %%. But some broken lexes -# (Solaris, I think it was) want two %% lines, so accommodate them. ac_cv_prog_lex_yytext_pointer=no - echo '%% -%%' | $LEX -if test -f lex.yy.c; then - LEX_OUTPUT_ROOT=lex.yy -elif test -f lexyy.c; then - LEX_OUTPUT_ROOT=lexyy -else - AC_MSG_ERROR([cannot find output from $LEX, giving up]) -fi echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c ac_save_LIBS="$LIBS" LIBS="$LIBS $LEXLIB" @@ -348,7 +355,6 @@ AC_MSG_RESULT($ac_cv_prog_lex_yytext_pointer) if test $ac_cv_prog_lex_yytext_pointer = yes; then AC_DEFINE(YYTEXT_POINTER) fi -AC_SUBST(LEX_OUTPUT_ROOT)dnl ]) AC_DEFUN(AC_PROG_INSTALL, @@ -368,8 +374,9 @@ if test -z "$INSTALL"; then AC_CACHE_VAL(ac_cv_path_install, [ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" for ac_dir in $PATH; do - case "$ac_dir" in - ''|.|/etc|/usr/sbin|/usr/etc|/sbin|/usr/afsws/bin|/usr/ucb) ;; + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. for ac_prog in ginstall installbsd scoinst install; do @@ -838,6 +845,69 @@ if test $ac_cv_func_mmap = yes; then fi ]) +AC_DEFUN(AC_FUNC_GETPGRP, +[AC_MSG_CHECKING(whether getpgrp takes no argument) +AC_CACHE_VAL(ac_cv_func_getpgrp_void, +[AC_TRY_RUN([ +/* + * If this system has a BSD-style getpgrp(), + * which takes a pid argument, exit unsuccessfully. + * + * Snarfed from Chet Ramey's bash pgrp.c test program + */ +#include +#include + +int pid; +int pg1, pg2, pg3, pg4; +int ng, np, s, child; + +main() +{ + pid = getpid(); + pg1 = getpgrp(0); + pg2 = getpgrp(); + pg3 = getpgrp(pid); + pg4 = getpgrp(1); + + /* + * If all of these values are the same, it's pretty sure that + * we're on a system that ignores getpgrp's first argument. + */ + if (pg2 == pg4 && pg1 == pg3 && pg2 == pg3) + exit(0); + + child = fork(); + if (child < 0) + exit(1); + else if (child == 0) { + np = getpid(); + /* + * If this is Sys V, this will not work; pgrp will be + * set to np because setpgrp just changes a pgrp to be + * the same as the pid. + */ + setpgrp(np, pg1); + ng = getpgrp(0); /* Same result for Sys V and BSD */ + if (ng == pg1) { + exit(1); + } else { + exit(0); + } + } else { + wait(&s); + exit(s>>8); + } +} +], ac_cv_func_getpgrp_void=yes, ac_cv_func_getpgrp_void=no, + AC_MSG_ERROR(cannot check getpgrp if cross compiling)) +]) +AC_MSG_RESULT($ac_cv_func_getpgrp_void) +if test $ac_cv_func_getpgrp_void = yes; then + AC_DEFINE(GETPGRP_VOID) +fi +]) + AC_DEFUN(AC_FUNC_VPRINTF, [AC_CHECK_FUNC(vprintf, AC_DEFINE(HAVE_VPRINTF)) if test "$ac_cv_func_vprintf" != yes; then @@ -1460,18 +1530,23 @@ if test $ac_cv_c_bigendian = yes; then fi ]) +dnl Do nothing if the compiler accepts the inline keyword. +dnl Otherwise define inline to __inline__ or __inline if one of those work, +dnl otherwise define inline to be empty. AC_DEFUN(AC_C_INLINE, [AC_MSG_CHECKING([for inline]) AC_CACHE_VAL(ac_cv_c_inline, -[if test "$GCC" = yes; then -AC_TRY_COMPILE(, [} inline foo() {], ac_cv_c_inline=yes, ac_cv_c_inline=no) -else - ac_cv_c_inline=no -fi])dnl +[ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + AC_TRY_COMPILE(, [} $ac_kw foo() {], [ac_cv_c_inline=$ac_kw; break]) +done +])dnl AC_MSG_RESULT($ac_cv_c_inline) -if test $ac_cv_c_inline = no; then - AC_DEFINE(inline, __inline) -fi +case "$ac_cv_c_inline" in + inline | yes) ;; + no) AC_DEFINE(inline, ) ;; + *) AC_DEFINE_UNQUOTED(inline, $ac_cv_c_inline) ;; +esac ]) AC_DEFUN(AC_C_CONST, diff --git a/autoconf.texi b/autoconf.texi index c43141b2..bfef816d 100644 --- a/autoconf.texi +++ b/autoconf.texi @@ -1606,6 +1606,20 @@ list are found, set @var{variable} to @var{value-if-not-found}; if is not changed. Calls @code{AC_SUBST} for @var{variable}. @end defmac +@defmac AC_CHECK_TOOL (@var{variable}, @var{prog-to-check-for}) +@maindex CHECK_TOOL +Like @code{AC_CHECK_PROG}, but first looks for @var{prog-to-check-for} +with a prefix of the host type as determined by @code{AC_CANONICAL_HOST}, +followed by a dash (@pxref{Canonicalizing}). For example, if the user +runs @samp{configure --host=i386-gnu}, then this call: +@example +AC_CHECK_TOOL(AR, ar) +@end example +@noindent +sets @code{AR} to @file{i386-gnu-ar} if that program exists in +@code{PATH}, or to @samp{ar} if not. +@end defmac + @defmac AC_PATH_PROG (@var{variable}, @var{prog-to-check-for} @r{[}, @var{value-if-not-found}@r{]}) @maindex PATH_PROG Like @code{AC_CHECK_PROG}, but set @var{variable} to the entire @@ -1789,11 +1803,21 @@ to the name of the group that should own the installed program. @defmac AC_FUNC_GETMNTENT @maindex FUNC_GETMNTENT @cvindex HAVE_GETMNTENT -Check for the @code{getmntent} in the @file{sun} and @file{seq} +Check for @code{getmntent} in the @file{sun} and @file{seq} libraries, for Irix 4 and PTX, respectively. Then, if @code{getmntent} is available, define @code{HAVE_GETMNTENT}. @end defmac +@defmac AC_FUNC_GETPGRP +@maindex FUNC_GETPGRP +@cvindex GETPGRP_VOID +If @code{getpgrp} takes no argument (the POSIX.1 version), define +@code{GETPGRP_VOID}. Otherwise, it is the BSD version, which takes a +process ID as an argument. This macro does not check whether +@code{getpgrp} exists at all; if you need to work in that situation, +first call @code{AC_CHECK_FUNC} for @code{getpgrp}. +@end defmac + @defmac AC_FUNC_MEMCMP @maindex FUNC_MEMCMP @ovindex LIBOBJS @@ -2403,9 +2427,9 @@ it as empty. @defmac AC_C_INLINE @maindex C_INLINE @cvindex inline -If the C compiler is a version of GCC that supports the keyword -@code{__inline} but not @code{inline} (such as some NeXT versions), -define @code{inline} to be @code{__inline}. +If the C compiler supports the keyword @code{inline}, do nothing. +Otherwise define @code{inline} to @code{__inline__} or @code{__inline} +if it accepts one of those, otherwise define @code{inline} to be empty. @end defmac @defmac AC_C_CHAR_UNSIGNED @@ -3677,8 +3701,8 @@ a suggestion for what to use instead of @var{this-macro-name}. A few kinds of features can't be guessed automatically by running test programs. For example, the details of the object file format, or -special options that need to be passed to the compiler or linker. It is -possible to check for such features using ad-hoc means, such as having +special options that need to be passed to the compiler or linker. You +can check for such features using ad-hoc means, such as having @code{configure} check the output of the @code{uname} program, or looking for libraries that are unique to particular systems. However, Autoconf provides a uniform method for handling unguessable features. @@ -3843,6 +3867,10 @@ creates in the current directory @file{host.h}, which is a link to to @file{@var{srcdir}/config/$@{obj_format@}.h}. @end defmac +You can also use the host system type to find cross-compilation tools. +@xref{Generic Programs}, for information about the @code{AC_CHECK_TOOL} +macro which does that. + @node Site Configuration, Invoking configure, Manual Configuration, Top @chapter Site Configuration diff --git a/bin/ifnames.in b/bin/ifnames.in index 72620d45..2d642544 100644 --- a/bin/ifnames.in +++ b/bin/ifnames.in @@ -56,7 +56,7 @@ if test $show_version = yes; then exit 0 fi -mawk ' +@AWK@ ' # Record that sym was found in FILENAME. function file_sym(sym, i, fs) { if (sym ~ /^[A-Za-z_]/) { diff --git a/configure.in b/configure.in index 7fd871e0..f1a89865 100644 --- a/configure.in +++ b/configure.in @@ -8,6 +8,7 @@ dnl their path, the installer can configure with a path that has GNU m4 dnl first and get that path embedded in the installed autoconf and dnl autoheader scripts. AC_PATH_PROGS(M4, gm4 gnum4 m4, m4) +AC_PROG_AWK dnl We use a path for perl so the #! line in autoscan will work. AC_PATH_PROG(PERL, perl, no) diff --git a/doc/Makefile.in b/doc/Makefile.in index ce18e5a1..b5bb2765 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -26,6 +26,7 @@ INSTALL_DATA = @INSTALL_DATA@ MAKEINFO = makeinfo TEXI2DVI = texi2dvi M4 = @M4@ +AWK = @AWK@ PERL = @PERL@ # Programs that are always installed. @@ -70,7 +71,8 @@ DISTFILES = COPYING ChangeLog ChangeLog.1 INSTALL \ testsuite/lib/*.exp testsuite/autoconf.[gs]/*.exp \ standards.texi make-stds.texi standards.info* -editsh = sed -e 's,@''datadir''@,$(acdatadir),g' -e 's,@''M4''@,$(M4),g' +editsh = sed -e 's,@''datadir''@,$(acdatadir),g' -e \ + 's,@''M4''@,$(M4),g' -e 's,@''AWK''@,$(AWK),g' editpl = sed -e 's,@''datadir''@,$(acdatadir),g' -e 's,@''PERL''@,$(PERL),g' all: ${SCRIPTS} diff --git a/doc/autoconf.texi b/doc/autoconf.texi index c43141b2..bfef816d 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -1606,6 +1606,20 @@ list are found, set @var{variable} to @var{value-if-not-found}; if is not changed. Calls @code{AC_SUBST} for @var{variable}. @end defmac +@defmac AC_CHECK_TOOL (@var{variable}, @var{prog-to-check-for}) +@maindex CHECK_TOOL +Like @code{AC_CHECK_PROG}, but first looks for @var{prog-to-check-for} +with a prefix of the host type as determined by @code{AC_CANONICAL_HOST}, +followed by a dash (@pxref{Canonicalizing}). For example, if the user +runs @samp{configure --host=i386-gnu}, then this call: +@example +AC_CHECK_TOOL(AR, ar) +@end example +@noindent +sets @code{AR} to @file{i386-gnu-ar} if that program exists in +@code{PATH}, or to @samp{ar} if not. +@end defmac + @defmac AC_PATH_PROG (@var{variable}, @var{prog-to-check-for} @r{[}, @var{value-if-not-found}@r{]}) @maindex PATH_PROG Like @code{AC_CHECK_PROG}, but set @var{variable} to the entire @@ -1789,11 +1803,21 @@ to the name of the group that should own the installed program. @defmac AC_FUNC_GETMNTENT @maindex FUNC_GETMNTENT @cvindex HAVE_GETMNTENT -Check for the @code{getmntent} in the @file{sun} and @file{seq} +Check for @code{getmntent} in the @file{sun} and @file{seq} libraries, for Irix 4 and PTX, respectively. Then, if @code{getmntent} is available, define @code{HAVE_GETMNTENT}. @end defmac +@defmac AC_FUNC_GETPGRP +@maindex FUNC_GETPGRP +@cvindex GETPGRP_VOID +If @code{getpgrp} takes no argument (the POSIX.1 version), define +@code{GETPGRP_VOID}. Otherwise, it is the BSD version, which takes a +process ID as an argument. This macro does not check whether +@code{getpgrp} exists at all; if you need to work in that situation, +first call @code{AC_CHECK_FUNC} for @code{getpgrp}. +@end defmac + @defmac AC_FUNC_MEMCMP @maindex FUNC_MEMCMP @ovindex LIBOBJS @@ -2403,9 +2427,9 @@ it as empty. @defmac AC_C_INLINE @maindex C_INLINE @cvindex inline -If the C compiler is a version of GCC that supports the keyword -@code{__inline} but not @code{inline} (such as some NeXT versions), -define @code{inline} to be @code{__inline}. +If the C compiler supports the keyword @code{inline}, do nothing. +Otherwise define @code{inline} to @code{__inline__} or @code{__inline} +if it accepts one of those, otherwise define @code{inline} to be empty. @end defmac @defmac AC_C_CHAR_UNSIGNED @@ -3677,8 +3701,8 @@ a suggestion for what to use instead of @var{this-macro-name}. A few kinds of features can't be guessed automatically by running test programs. For example, the details of the object file format, or -special options that need to be passed to the compiler or linker. It is -possible to check for such features using ad-hoc means, such as having +special options that need to be passed to the compiler or linker. You +can check for such features using ad-hoc means, such as having @code{configure} check the output of the @code{uname} program, or looking for libraries that are unique to particular systems. However, Autoconf provides a uniform method for handling unguessable features. @@ -3843,6 +3867,10 @@ creates in the current directory @file{host.h}, which is a link to to @file{@var{srcdir}/config/$@{obj_format@}.h}. @end defmac +You can also use the host system type to find cross-compilation tools. +@xref{Generic Programs}, for information about the @code{AC_CHECK_TOOL} +macro which does that. + @node Site Configuration, Invoking configure, Manual Configuration, Top @chapter Site Configuration diff --git a/ifnames.in b/ifnames.in index 72620d45..2d642544 100644 --- a/ifnames.in +++ b/ifnames.in @@ -56,7 +56,7 @@ if test $show_version = yes; then exit 0 fi -mawk ' +@AWK@ ' # Record that sym was found in FILENAME. function file_sym(sym, i, fs) { if (sym ~ /^[A-Za-z_]/) { diff --git a/ifnames.sh b/ifnames.sh index 72620d45..2d642544 100644 --- a/ifnames.sh +++ b/ifnames.sh @@ -56,7 +56,7 @@ if test $show_version = yes; then exit 0 fi -mawk ' +@AWK@ ' # Record that sym was found in FILENAME. function file_sym(sym, i, fs) { if (sym ~ /^[A-Za-z_]/) { diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index 8debae20..c4d3245d 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -755,7 +755,8 @@ AC_CANONICAL_TARGET AC_CANONICAL_BUILD test "$host_alias" != "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ - NONENONEs,x,x, && program_prefix=${target_alias}- + NONENONEs,x,x, && + program_prefix=${target_alias}- ]) dnl Subroutines of AC_CANONICAL_SYSTEM. @@ -770,6 +771,7 @@ fi AC_MSG_CHECKING(host system type) +dnl Set host_alias. host_alias=$host case "$host_alias" in NONE) @@ -782,6 +784,7 @@ NONE) esac ;; esac +dnl Set the other host vars. host=`$ac_config_sub $host_alias` host_cpu=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` host_vendor=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` @@ -799,6 +802,7 @@ AC_DEFUN(AC_CANONICAL_TARGET, [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_MSG_CHECKING(target system type) +dnl Set target_alias. target_alias=$target case "$target_alias" in NONE) @@ -808,6 +812,7 @@ NONE) esac ;; esac +dnl Set the other target vars. target=`$ac_config_sub $target_alias` target_cpu=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` target_vendor=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` @@ -825,6 +830,7 @@ AC_DEFUN(AC_CANONICAL_BUILD, [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_MSG_CHECKING(build system type) +dnl Set build_alias. build_alias=$build case "$build_alias" in NONE) @@ -834,6 +840,7 @@ NONE) esac ;; esac +dnl Set the other build vars. build=`$ac_config_sub $build_alias` build_cpu=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` build_vendor=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` @@ -1151,6 +1158,22 @@ done ifelse([$3], , , [test -n "[$]$1" || $1="$3" ])]) +dnl Internal subroutine. +AC_DEFUN(AC_CHECK_TOOL_PREFIX, +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +if test $host != $build; then + ac_tool_prefix=${host_alias}- +else + ac_tool_prefix= +fi +]) + +dnl AC_CHECK_TOOL(VARIABLE, PROG-TO-CHECK-FOR) +AC_DEFUN(AC_CHECK_TOOL, +[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl +AC_CHECK_PROG($1, ${ac_tool_prefix}$2, ${ac_tool_prefix}$2, $2) +]) + dnl Guess the value for the `prefix' variable by looking for dnl the argument program along PATH and taking its parent. dnl Example: if the argument is `gcc' and we find /usr/local/gnu/bin/gcc, @@ -1168,7 +1191,7 @@ AC_MSG_CHECKING([for prefix by ]) AC_PATH_PROG(AC_VAR_NAME, $1) changequote(<<, >>)dnl if test -n "$ac_cv_path_<<>>AC_VAR_NAME"; then - prefix=`echo $ac_cv_path_<<>>AC_VAR_NAME|sed 's%/[^/][^/]*/[^/][^/]*$%%'` + prefix=`echo $ac_cv_path_<<>>AC_VAR_NAME|sed 's%/[^/][^/]*//*[^/][^/]*$%%'` changequote([, ])dnl fi fi diff --git a/lib/autoconf/specific.m4 b/lib/autoconf/specific.m4 index 17f6dd96..03cab495 100644 --- a/lib/autoconf/specific.m4 +++ b/lib/autoconf/specific.m4 @@ -250,7 +250,7 @@ AC_SUBST([SET_MAKE])dnl AC_DEFUN(AC_PROG_RANLIB, [AC_CHECK_PROG(RANLIB, ranlib, ranlib, :)]) -dnl Check for mawk first since it's said to be faster. +dnl Check for mawk first since it's generally faster. AC_DEFUN(AC_PROG_AWK, [AC_CHECK_PROGS(AWK, mawk gawk nawk awk, )]) @@ -317,27 +317,34 @@ then fi AC_SUBST(LEXLIB)]) +dnl Check if lex declares yytext as a char * by default, not a char[]. +undefine([AC_DECL_YYTEXT]) AC_DEFUN(AC_DECL_YYTEXT, [AC_REQUIRE_CPP()dnl AC_REQUIRE([AC_PROG_LEX])dnl +AC_MSG_CHECKING(lex output file root) +AC_CACHE_VAL(ac_cv_prog_lex_root, +[# The minimal lex program is just a single line: %%. But some broken lexes +# (Solaris, I think it was) want two %% lines, so accommodate them. +echo '%% +%%' | $LEX +if test -f lex.yy.c; then + ac_cv_prog_lex_root=lex.yy +elif test -f lexyy.c; then + ac_cv_prog_lex_root=lexyy +else + AC_MSG_ERROR(cannot find output from $LEX; giving up) +fi])dnl +LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root +AC_MSG_RESULT($ac_cv_prog_lex_root) +AC_SUBST(LEX_OUTPUT_ROOT)dnl + AC_MSG_CHECKING(whether yytext is a pointer) AC_CACHE_VAL(ac_cv_prog_lex_yytext_pointer, [# POSIX says lex can declare yytext either as a pointer or an array; the # default is implementation-dependent. Figure out which it is, since # not all implementations provide the %pointer and %array declarations. -# -# The minimal lex program is just a single line: %%. But some broken lexes -# (Solaris, I think it was) want two %% lines, so accommodate them. ac_cv_prog_lex_yytext_pointer=no - echo '%% -%%' | $LEX -if test -f lex.yy.c; then - LEX_OUTPUT_ROOT=lex.yy -elif test -f lexyy.c; then - LEX_OUTPUT_ROOT=lexyy -else - AC_MSG_ERROR([cannot find output from $LEX, giving up]) -fi echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c ac_save_LIBS="$LIBS" LIBS="$LIBS $LEXLIB" @@ -348,7 +355,6 @@ AC_MSG_RESULT($ac_cv_prog_lex_yytext_pointer) if test $ac_cv_prog_lex_yytext_pointer = yes; then AC_DEFINE(YYTEXT_POINTER) fi -AC_SUBST(LEX_OUTPUT_ROOT)dnl ]) AC_DEFUN(AC_PROG_INSTALL, @@ -368,8 +374,9 @@ if test -z "$INSTALL"; then AC_CACHE_VAL(ac_cv_path_install, [ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" for ac_dir in $PATH; do - case "$ac_dir" in - ''|.|/etc|/usr/sbin|/usr/etc|/sbin|/usr/afsws/bin|/usr/ucb) ;; + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. for ac_prog in ginstall installbsd scoinst install; do @@ -838,6 +845,69 @@ if test $ac_cv_func_mmap = yes; then fi ]) +AC_DEFUN(AC_FUNC_GETPGRP, +[AC_MSG_CHECKING(whether getpgrp takes no argument) +AC_CACHE_VAL(ac_cv_func_getpgrp_void, +[AC_TRY_RUN([ +/* + * If this system has a BSD-style getpgrp(), + * which takes a pid argument, exit unsuccessfully. + * + * Snarfed from Chet Ramey's bash pgrp.c test program + */ +#include +#include + +int pid; +int pg1, pg2, pg3, pg4; +int ng, np, s, child; + +main() +{ + pid = getpid(); + pg1 = getpgrp(0); + pg2 = getpgrp(); + pg3 = getpgrp(pid); + pg4 = getpgrp(1); + + /* + * If all of these values are the same, it's pretty sure that + * we're on a system that ignores getpgrp's first argument. + */ + if (pg2 == pg4 && pg1 == pg3 && pg2 == pg3) + exit(0); + + child = fork(); + if (child < 0) + exit(1); + else if (child == 0) { + np = getpid(); + /* + * If this is Sys V, this will not work; pgrp will be + * set to np because setpgrp just changes a pgrp to be + * the same as the pid. + */ + setpgrp(np, pg1); + ng = getpgrp(0); /* Same result for Sys V and BSD */ + if (ng == pg1) { + exit(1); + } else { + exit(0); + } + } else { + wait(&s); + exit(s>>8); + } +} +], ac_cv_func_getpgrp_void=yes, ac_cv_func_getpgrp_void=no, + AC_MSG_ERROR(cannot check getpgrp if cross compiling)) +]) +AC_MSG_RESULT($ac_cv_func_getpgrp_void) +if test $ac_cv_func_getpgrp_void = yes; then + AC_DEFINE(GETPGRP_VOID) +fi +]) + AC_DEFUN(AC_FUNC_VPRINTF, [AC_CHECK_FUNC(vprintf, AC_DEFINE(HAVE_VPRINTF)) if test "$ac_cv_func_vprintf" != yes; then @@ -1460,18 +1530,23 @@ if test $ac_cv_c_bigendian = yes; then fi ]) +dnl Do nothing if the compiler accepts the inline keyword. +dnl Otherwise define inline to __inline__ or __inline if one of those work, +dnl otherwise define inline to be empty. AC_DEFUN(AC_C_INLINE, [AC_MSG_CHECKING([for inline]) AC_CACHE_VAL(ac_cv_c_inline, -[if test "$GCC" = yes; then -AC_TRY_COMPILE(, [} inline foo() {], ac_cv_c_inline=yes, ac_cv_c_inline=no) -else - ac_cv_c_inline=no -fi])dnl +[ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + AC_TRY_COMPILE(, [} $ac_kw foo() {], [ac_cv_c_inline=$ac_kw; break]) +done +])dnl AC_MSG_RESULT($ac_cv_c_inline) -if test $ac_cv_c_inline = no; then - AC_DEFINE(inline, __inline) -fi +case "$ac_cv_c_inline" in + inline | yes) ;; + no) AC_DEFINE(inline, ) ;; + *) AC_DEFINE_UNQUOTED(inline, $ac_cv_c_inline) ;; +esac ]) AC_DEFUN(AC_C_CONST,