From: Akim Demaille Date: Mon, 18 Jun 2001 17:41:03 +0000 (+0000) Subject: * acfunctions.m4 (AC_FUNC_CHOWN, AC_FUNC_CLOSEDIR_VOID) X-Git-Tag: AUTOCONF-2.50a~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=49297a91ed6f14e539cc73fc94fc52dc330eb225;p=thirdparty%2Fautoconf.git * acfunctions.m4 (AC_FUNC_CHOWN, AC_FUNC_CLOSEDIR_VOID) (AC_FUNC_GETPGRP, AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK) (AC_FUNC_MMAP, AC_FUNC_SELECT_ARGTYPES, _AC_FUNC_STAT) (AC_FUNC_UTIME_NULL): Use AC_INCLUDES_DEFAULT. Don't use AC_TRY_RUN, which double quotes, prefer AC_RUN_IFELSE, and either AC_LANG_SOURCE or AC_LANG_PROGRAM. (AC_FUNC_CLOSEDIR_VOID): Protect C++ from `int closedir ();' (or the converse). --- diff --git a/ChangeLog b/ChangeLog index 101dff1fd..3d6fcc642 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2001-06-18 Akim Demaille + + * acfunctions.m4 (AC_FUNC_CHOWN, AC_FUNC_CLOSEDIR_VOID) + (AC_FUNC_GETPGRP, AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK) + (AC_FUNC_MMAP, AC_FUNC_SELECT_ARGTYPES, _AC_FUNC_STAT) + (AC_FUNC_UTIME_NULL): Use AC_INCLUDES_DEFAULT. + Don't use AC_TRY_RUN, which double quotes, prefer AC_RUN_IFELSE, + and either AC_LANG_SOURCE or AC_LANG_PROGRAM. + (AC_FUNC_CLOSEDIR_VOID): Protect C++ from `int closedir ();' (or + the converse). + 2001-06-18 Akim Demaille * doc/autoconf.texi (ms): New index. diff --git a/acfunctions.m4 b/acfunctions.m4 index 6ef1462bd..3a66ef96e 100644 --- a/acfunctions.m4 +++ b/acfunctions.m4 @@ -257,17 +257,10 @@ AC_DEFUN([AC_FUNC_CHOWN], [AC_REQUIRE([AC_TYPE_UID_T])dnl AC_CHECK_HEADERS(unistd.h) AC_CACHE_CHECK([for working chown], ac_cv_func_chown_works, -[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include -#include +[AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT #include -#ifdef HAVE_UNISTD_H -# include -#endif - -int -main () -{ - char *f = "conftest.chown"; +], +[[ char *f = "conftest.chown"; struct stat before, after; if (creat (f, 0600) < 0) @@ -280,7 +273,7 @@ main () exit (1); exit ((before.st_uid == after.st_uid && before.st_gid == after.st_gid) ? 0 : 1); -}]])], +]])], [ac_cv_func_chown_works=yes], [ac_cv_func_chown_works=no], [ac_cv_func_chown_works=no]) @@ -301,16 +294,13 @@ AC_DEFUN([AC_FUNC_CLOSEDIR_VOID], [AC_REQUIRE([AC_HEADER_DIRENT])dnl AC_CACHE_CHECK([whether closedir returns void], [ac_cv_func_closedir_void], -[AC_RUN_IFELSE([AC_LANG_SOURCE( -[#include +[AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT #include <$ac_header_dirent> - +#ifndef __cplusplus int closedir (); -int -main () -{ - exit (closedir (opendir (".")) != 0); -}])], +#endif +], + [[exit (closedir (opendir (".")) != 0);]])], [ac_cv_func_closedir_void=no], [ac_cv_func_closedir_void=yes], [ac_cv_func_closedir_void=yes])]) @@ -600,15 +590,14 @@ AC_CHECK_FUNC(getmntent, # --------------- AC_DEFUN([AC_FUNC_GETPGRP], [AC_CACHE_CHECK(whether getpgrp takes no argument, ac_cv_func_getpgrp_void, -[AC_RUN_IFELSE([AC_LANG_SOURCE([[ +[AC_RUN_IFELSE([AC_LANG_SOURCE([AC_INCLUDES_DEFAULT] +[[ /* * 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; @@ -673,8 +662,7 @@ AC_DEFUN([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK], [rm -f conftest.sym conftest.file echo >conftest.file if ln -s conftest.file conftest.sym; then - AC_RUN_IFELSE([AC_LANG_PROGRAM([@%:@include -@%:@include ], + AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], [struct stat sbuf; /* Linux will dereference the symlink and fail. That is better in the sense that it means we will not @@ -939,7 +927,7 @@ AC_DEFUN([AC_FUNC_MMAP], [AC_CHECK_HEADERS(stdlib.h unistd.h) AC_CHECK_FUNCS(getpagesize) AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap_fixed_mapped, -[AC_RUN_IFELSE([AC_LANG_SOURCE( +[AC_RUN_IFELSE([AC_LANG_SOURCE([AC_INCLUDES_DEFAULT] [[/* Thanks to Mike Haertel and Jim Avera for this test. Here is a matrix of mmap possibilities: mmap private not fixed @@ -961,19 +949,13 @@ AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap_fixed_mapped, The main things grep needs to know about mmap are: * does it exist and is it safe to write into the mmap'd area * how to use it (BSD variants) */ -#include + #include #include -#if STDC_HEADERS || HAVE_STDLIB_H -# include -#else +#if !STDC_HEADERS && !HAVE_STDLIB_H char *malloc (); #endif -#if HAVE_UNISTD_H -# include -#endif -#include /* This mess was copied from the GNU getpagesize.h. */ #if !HAVE_GETPAGESIZE @@ -1121,18 +1103,19 @@ AC_CACHE_CHECK([types of arguments for select], [for ac_arg234 in 'fd_set *' 'int *' 'void *'; do for ac_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do for ac_arg5 in 'struct timeval *' 'const struct timeval *'; do - AC_COMPILE_IFELSE([AC_LANG_PROGRAM( -[#include -#if HAVE_SYS_TIME_H -# include -#endif + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( +[AC_INCLUDES_DEFAULT #if HAVE_SYS_SELECT_H # include #endif #if HAVE_SYS_SOCKET_H # include #endif -extern int select ($ac_arg1,$ac_arg234,$ac_arg234,$ac_arg234,$ac_arg5);])], +], + [extern int select ($ac_arg1, + $ac_arg234, $ac_arg234, $ac_arg234, + $ac_arg5);])], [ac_cv_func_select_args="$ac_arg1,$ac_arg234,$ac_arg5"; break 3]) done done @@ -1190,16 +1173,9 @@ m4_define([_AC_FUNC_STAT], [AC_REQUIRE([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])dnl AC_CACHE_CHECK([whether $1 accepts an empty string], [ac_cv_func_$1_empty_string_bug], -[AC_TRY_RUN( -[#include -#include - -int -main () -{ - struct stat sbuf; - exit ($1 ("", &sbuf) ? 1 : 0); -}], +[AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], +[[struct stat sbuf; + exit ($1 ("", &sbuf) ? 1 : 0);]])], [ac_cv_func_$1_empty_string_bug=yes], [ac_cv_func_$1_empty_string_bug=no], [ac_cv_func_$1_empty_string_bug=yes])]) @@ -1414,20 +1390,16 @@ AC_DEFUN([AC_FUNC_UTIME_NULL], [AC_CACHE_CHECK(whether utime accepts a null argument, ac_cv_func_utime_null, [rm -f conftest.data; >conftest.data # Sequent interprets utime(file, 0) to mean use start of epoch. Wrong. -AC_TRY_RUN( -[#include -#include -int -main () -{ - struct stat s, t; +AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], +[[struct stat s, t; exit (!(stat ("conftest.data", &s) == 0 && utime ("conftest.data", (long *)0) == 0 && stat ("conftest.data", &t) == 0 && t.st_mtime >= s.st_mtime - && t.st_mtime - s.st_mtime < 120)); -}], ac_cv_func_utime_null=yes, ac_cv_func_utime_null=no, - ac_cv_func_utime_null=no) + && t.st_mtime - s.st_mtime < 120));]])], + ac_cv_func_utime_null=yes, + ac_cv_func_utime_null=no, + ac_cv_func_utime_null=no) rm -f core core.* *.core]) if test $ac_cv_func_utime_null = yes; then AC_DEFINE(HAVE_UTIME_NULL, 1, diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4 index 6ef1462bd..3a66ef96e 100644 --- a/lib/autoconf/functions.m4 +++ b/lib/autoconf/functions.m4 @@ -257,17 +257,10 @@ AC_DEFUN([AC_FUNC_CHOWN], [AC_REQUIRE([AC_TYPE_UID_T])dnl AC_CHECK_HEADERS(unistd.h) AC_CACHE_CHECK([for working chown], ac_cv_func_chown_works, -[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include -#include +[AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT #include -#ifdef HAVE_UNISTD_H -# include -#endif - -int -main () -{ - char *f = "conftest.chown"; +], +[[ char *f = "conftest.chown"; struct stat before, after; if (creat (f, 0600) < 0) @@ -280,7 +273,7 @@ main () exit (1); exit ((before.st_uid == after.st_uid && before.st_gid == after.st_gid) ? 0 : 1); -}]])], +]])], [ac_cv_func_chown_works=yes], [ac_cv_func_chown_works=no], [ac_cv_func_chown_works=no]) @@ -301,16 +294,13 @@ AC_DEFUN([AC_FUNC_CLOSEDIR_VOID], [AC_REQUIRE([AC_HEADER_DIRENT])dnl AC_CACHE_CHECK([whether closedir returns void], [ac_cv_func_closedir_void], -[AC_RUN_IFELSE([AC_LANG_SOURCE( -[#include +[AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT #include <$ac_header_dirent> - +#ifndef __cplusplus int closedir (); -int -main () -{ - exit (closedir (opendir (".")) != 0); -}])], +#endif +], + [[exit (closedir (opendir (".")) != 0);]])], [ac_cv_func_closedir_void=no], [ac_cv_func_closedir_void=yes], [ac_cv_func_closedir_void=yes])]) @@ -600,15 +590,14 @@ AC_CHECK_FUNC(getmntent, # --------------- AC_DEFUN([AC_FUNC_GETPGRP], [AC_CACHE_CHECK(whether getpgrp takes no argument, ac_cv_func_getpgrp_void, -[AC_RUN_IFELSE([AC_LANG_SOURCE([[ +[AC_RUN_IFELSE([AC_LANG_SOURCE([AC_INCLUDES_DEFAULT] +[[ /* * 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; @@ -673,8 +662,7 @@ AC_DEFUN([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK], [rm -f conftest.sym conftest.file echo >conftest.file if ln -s conftest.file conftest.sym; then - AC_RUN_IFELSE([AC_LANG_PROGRAM([@%:@include -@%:@include ], + AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], [struct stat sbuf; /* Linux will dereference the symlink and fail. That is better in the sense that it means we will not @@ -939,7 +927,7 @@ AC_DEFUN([AC_FUNC_MMAP], [AC_CHECK_HEADERS(stdlib.h unistd.h) AC_CHECK_FUNCS(getpagesize) AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap_fixed_mapped, -[AC_RUN_IFELSE([AC_LANG_SOURCE( +[AC_RUN_IFELSE([AC_LANG_SOURCE([AC_INCLUDES_DEFAULT] [[/* Thanks to Mike Haertel and Jim Avera for this test. Here is a matrix of mmap possibilities: mmap private not fixed @@ -961,19 +949,13 @@ AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap_fixed_mapped, The main things grep needs to know about mmap are: * does it exist and is it safe to write into the mmap'd area * how to use it (BSD variants) */ -#include + #include #include -#if STDC_HEADERS || HAVE_STDLIB_H -# include -#else +#if !STDC_HEADERS && !HAVE_STDLIB_H char *malloc (); #endif -#if HAVE_UNISTD_H -# include -#endif -#include /* This mess was copied from the GNU getpagesize.h. */ #if !HAVE_GETPAGESIZE @@ -1121,18 +1103,19 @@ AC_CACHE_CHECK([types of arguments for select], [for ac_arg234 in 'fd_set *' 'int *' 'void *'; do for ac_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do for ac_arg5 in 'struct timeval *' 'const struct timeval *'; do - AC_COMPILE_IFELSE([AC_LANG_PROGRAM( -[#include -#if HAVE_SYS_TIME_H -# include -#endif + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( +[AC_INCLUDES_DEFAULT #if HAVE_SYS_SELECT_H # include #endif #if HAVE_SYS_SOCKET_H # include #endif -extern int select ($ac_arg1,$ac_arg234,$ac_arg234,$ac_arg234,$ac_arg5);])], +], + [extern int select ($ac_arg1, + $ac_arg234, $ac_arg234, $ac_arg234, + $ac_arg5);])], [ac_cv_func_select_args="$ac_arg1,$ac_arg234,$ac_arg5"; break 3]) done done @@ -1190,16 +1173,9 @@ m4_define([_AC_FUNC_STAT], [AC_REQUIRE([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])dnl AC_CACHE_CHECK([whether $1 accepts an empty string], [ac_cv_func_$1_empty_string_bug], -[AC_TRY_RUN( -[#include -#include - -int -main () -{ - struct stat sbuf; - exit ($1 ("", &sbuf) ? 1 : 0); -}], +[AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], +[[struct stat sbuf; + exit ($1 ("", &sbuf) ? 1 : 0);]])], [ac_cv_func_$1_empty_string_bug=yes], [ac_cv_func_$1_empty_string_bug=no], [ac_cv_func_$1_empty_string_bug=yes])]) @@ -1414,20 +1390,16 @@ AC_DEFUN([AC_FUNC_UTIME_NULL], [AC_CACHE_CHECK(whether utime accepts a null argument, ac_cv_func_utime_null, [rm -f conftest.data; >conftest.data # Sequent interprets utime(file, 0) to mean use start of epoch. Wrong. -AC_TRY_RUN( -[#include -#include -int -main () -{ - struct stat s, t; +AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], +[[struct stat s, t; exit (!(stat ("conftest.data", &s) == 0 && utime ("conftest.data", (long *)0) == 0 && stat ("conftest.data", &t) == 0 && t.st_mtime >= s.st_mtime - && t.st_mtime - s.st_mtime < 120)); -}], ac_cv_func_utime_null=yes, ac_cv_func_utime_null=no, - ac_cv_func_utime_null=no) + && t.st_mtime - s.st_mtime < 120));]])], + ac_cv_func_utime_null=yes, + ac_cv_func_utime_null=no, + ac_cv_func_utime_null=no) rm -f core core.* *.core]) if test $ac_cv_func_utime_null = yes; then AC_DEFINE(HAVE_UTIME_NULL, 1,