summaryrefslogtreecommitdiff
path: root/lib/autoconf/functions.m4
Commit message (Collapse)AuthorAgeFilesLines
* Improve AC_FUNC_MMAP commentsHEADmasterPaul Eggert2023-05-171-0/+2
| | | | * lib/autoconf/functions.m4 (AC_FUNC_MMAP): Add comment.
* Fix port of AC_FUNC_MMAPPaul Eggert2023-05-101-5/+36
| | | | | | | | | | Problem reported by Matt Turner in: https://lists.gnu.org/r/bug-autoconf/2023-05/msg00005.html * lib/autoconf/functions.m4 (AC_FUNC_MMAP): Go back to getting the page size, since the zero-fill test needs this after all. However, prefer sysconf (_SC_PAGESIZE) or sysconf (_SC_PAGE_SIZE) to getpagesize (), and use ‘long’ not ‘int’ to store the page size. Also, declare getpagesize if it is used as a function.
* Port AC_FUNC_MMAP to more-modern systemsPaul Eggert2023-05-101-39/+5
| | | | | | | | | | * lib/autoconf/functions.m4 (AC_FUNC_MMAP): Don’t call getpagesize, as it’s tricky to configure, modern POSIX doesn’t require it, and calling it without including <unistd.h> provokes a compile-time error on modern systems. Instead, rework the test to not need getpagesize. Add a FIXME comment for unnecessary tests; I don't want to remove them now as we're too close to a release. Remove long-obsolete comment about GNU grep.
* Remove the last few internal uses of AC_EGREP_CPP.Zack Weinberg2023-04-021-5/+5
| | | | | | | | | | | | | | | | Most of the remaining uses were converted to AC_COMPILE_IFELSE. The use in AC_FUNC_LOADAVG becomes an AC_PREPROC_IFELSE because we can’t be sure getloadavg.c can be _compiled_ at this point in the build. The use in AC_C_VARARRAYS could be either _PREPROC_ or _COMPILE_; we use _COMPILE_ because, _PREPROC_ is never used, then we don’t have to do the “checking how to run the C preprocessor” test. * lib/autoconf/c.m4 (AC_C_VARARRAYS): Use AC_COMPILE_IFELSE instead of AC_EGREP_CPP. * lib/autoconf/headers.m4 (_AC_HEADER_TIOCGWINSZ_IN_TERMIOS_H) (_AC_HEADER_TIOCGWINSZ_IN_SYS_IOCTL_H): Likewise. * lib/autoconf/functions.m4 (AC_FUNC_GETLOADAVG): Use AC_PREPROC_IFELSE instead of AC_EGREP_CPP.
* Overhaul AC_TYPE_GETGROUPS and AC_FUNC_GETGROUPS.Zack Weinberg2023-04-021-31/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AC_TYPE_GETGROUPS is the last remaining use of AC_EGREP_HEADER in stock Autoconf macros. It uses it only when cross compiling, as a fallback from an AC_RUN_IFELSE check, testing for a bug in system headers from the late 1980s or early 1990s, where gid_t *existed* but the second argument to getgroups needed to be an array of int, and this didn’t cause a compile error (i.e. the system headers declare getgroups with no prototype or an incorrect prototype). AC_FUNC_GETGROUPS also uses AC_RUN_IFELSE to test for obscure problems specific to long-obsolete Unixes. The downsides of AC_RUN_IFELSE and AC_EGREP_HEADER seem more severe than the chances of someone compiling a current-generation program, that uses getgroups, on an OS old enough to have one of the really nasty bugs. Accordingly, this patch changes AC_FUNC_GETGROUPS to use a host_os-based *blacklist* both in native and cross compilation. This is limited to the two host_os values for which either our old code, or Gnulib, documented a serious bug: ultrix* and nextstep*. Currently it does not try to pin down the exact version ranges subject to the bugs — that would require research by someone with access to the full history of these OSes. An incorrect guess by this blacklist can be overridden by setting ac_cv_func_getgroups_works in config.site. AC_TYPE_GETGROUPS, for its part, now does a series of regular old AC_COMPILE_IFELSE checks to probe the prototype of getgroups, and considers that good enough. While I was in there I noticed that AC_FUNC_GETGROUPS does not AC_SUBST a documented output variable, and that the name of this variable is misspelled in the manual. * lib/autoconf/functions.m4 (AC_FUNC_GETGROUPS): Use AC_SEARCH_LIBS to probe for getgroups. Use an AC_CANONICAL_HOST-based blacklist for bug detection, not AC_RUN_IFELSE. AC_SUBST the GETGROUPS_LIB output variable. * lib/autoconf/types.m4 (AC_TYPE_GETGROUPS): Check only the prototype of getgroups, using AC_COMPILE_IFELSE; do not use either AC_RUN_IFELSE or AC_EGREP_HEADER. * doc/autoconf.texi: Update to match. Correct misspelling of GETGROUPS_LIB. * tests.local.at (_AT_CHECK_ENV): Allow GETGROUPS_LIB output variable.
* spelling fixesPaul Eggert2023-01-211-1/+1
|
* make update-copyrightPaul Eggert2023-01-201-1/+1
|
* AC_SYS_LARGEFILE: Don’t enlarge time_t by defaultZack Weinberg2022-12-251-22/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Having AC_SYS_LARGEFILE enlarge time_t means that any program that has already requested large file support will be abruptly migrated to 64-bit time_t (on 32-bit systems) as soon as its configure script is regenerated with a sufficiently new Autoconf. We’ve received reports of several widely used programs and libraries that are not prepared for this migration, with breakage ranging from annoying (garbage timestamps in messages) through serious (binary compatibility break in security-critical shared library) to catastrophic (on-disk data corruption). Partially revert f6657256a37da44c987c04bf9cd75575dfca3b60: in the absence of AC_SYS_YEAR2038, AC_SYS_LARGEFILE will now only add an --enable-year2038 command line option to configure. If this option is used, time_t will be enlarged, allowing people to experiment with the migration without needing to *edit* the configure script in question, only regenerate it. In the process, AC_SYS_LARGEFILE and AC_SYS_YEAR2038 were drastically overhauled for modularity; it should now be much easier to add support for platforms that offer large off_t / time_t but not with the standard feature selection macros. Also, new macros AC_SYS_LARGEFILE_REQUIRED and AC_SYS_YEAR2038_REQUIRED can be used by programs for which large off_t / time_t are essential. The implementation is a little messy because it needs to gracefully handle the case where AC_SYS_LARGEFILE and AC_SYS_LARGEFILE_REQUIRED are both used in the same configure script — or, probably more common, AC_SYS_LARGEFILE (which invokes _AC_SYS_YEAR2038_OPT_IN) followed by AC_SYS_YEAR2038 — but if macro B is invoked after macro A, there’s no way for B to change *what macro A expanded to*. The best kludge I managed to find is to AC_CONFIG_COMMANDS_PRE as a m4-level hook that sets shell variables in an early diversion. * lib/autoconf/functions.m4 (AC_FUNC_FSEEKO): Rewrite to avoid dependency on internal subroutines of AC_SYS_LARGEFILE. * lib/autoconf/specific.m4 (_AC_SYS_YEAR2038_TEST_INCLUDES): Renamed to _AC_SYS_YEAR2038_TEST_CODE. (_AC_SYS_YEAR2038): Refactor into subroutines: _AC_SYS_YEAR2038_OPTIONS, _AC_SYS_YEAR2038_PROBE, _AC_SYS_YEAR2038_ENABLE. (AC_SYS_YEAR2038): Update for refactoring. (_AC_SYS_YEAR2038_OPT_IN): New sorta-top-level macro, for use by AC_SYS_LARGEFILE, that probes for large time_t only if the --enable-year2038 option is given. (AC_SYS_YEAR2038_REQUIRED): New top-level macro that insists on support for large time_t. (_AC_SYS_LARGEFILE_TEST_INCLUDES): Renamed to _AC_SYS_LARGEFILE_TEST_CODE. (_AC_SYS_LARGEFILE_MACRO_VALUE, AC_SYS_LARGEFILE): Refactor along same lines as above: _AC_SYS_LARGEFILE_OPTIONS, _AC_SYS_LARGEFILE_PROBE, _AC_SYS_LARGEFILE_ENABLE. Invoke _AC_SYS_YEAR2038_OPT_IN at end of _AC_SYS_LARGEFILE_PROBE. MinGW-specific logic moved to YEAR2038 macros as it has nothing to do with large file support. (AC_SYS_LARGEFILE_REQUIRED): New top-level macro that insists on support for large off_t. * tests/local.at (_AT_CHECK_ENV): Also allow changes in CPPFLAGS, enableval, enable_*, withval, with_*. * doc/autoconf.texi, NEWS: Update documentation to match above changes. Fix typo in definition of @dvarv.
* Use UTF-8 and spell "François" correctlyPaul Eggert2022-12-241-2/+2
|
* More fixes for compilers that reject K&R function definitions.Zack Weinberg2022-11-101-3/+3
| | | | | | | | | | | | | | | This fixes all of the remaining failures exposed by running the testsuite with GCC 12 and CC='cc -Wimplicit-function-declaration -Wold-style-definition -Wimplicit-int -Werror' . * lib/autoconf/c.m4 (_AC_C_C89_TEST_GLOBALS): Don’t use K&R function definitions. * lib/autoconf/specific.m4 (AC_SYS_RESTARTABLE_SYSCALLS): Likewise. (AC_FUNC_MKTIME): Declare functions taking no arguments as ‘fn (void)’ not ‘fn ()’. * lib/autoconf/c.m4 (_AC_C_C99_TEST_GLOBALS): Declare free().
* Port to compilers that moan about K&R func declsPaul Eggert2022-09-021-3/+0
| | | | | | | | | | * lib/autoconf/c.m4 (AC_LANG_CALL, AC_LANG_FUNC_LINK_TRY): Use '(void)' rather than '()' in function prototypes, as the latter provokes fatal errors in some compilers nowadays. * lib/autoconf/functions.m4 (AC_FUNC_STRTOD): * tests/fortran.at (AC_F77_DUMMY_MAIN usage): * tests/semantics.at (AC_CHECK_DECLS): Don’t use () in a function decl.
* Fix compilation errors in 32-bit C++ mode on HP-UX 11/ia64Paul Eggert2022-08-091-1/+7
| | | | | | | This should render unnecessary Gnulib’s gl_SET_LARGEFILE_SOURCE hack https://lists.gnu.org/r/bug-gnulib/2019-12/msg00046.html * lib/autoconf/functions.m4 (AC_FUNC_FSEEKO): On that platform, simply set _LARGEFILE_SOURCE.
* Refactor recent AC_FUNC_ALLOCA fixPaul Eggert2022-06-281-9/+4
| | | | | | * lib/autoconf/functions.m4 (AC_FUNC_ALLOCA): Simplify and use AS_IF. Had I done it this way originally I would have avoided the bug that Jim just fixed.
* AC_FUNC_ALLOCA: fix a misplaced (now fatal) closing "fi"Jim Meyering2022-06-271-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "autoconf quoting is a pain" * lib/autoconf/functions.m4 (AC_FUNC_ALLOCA): Its AC_CACHE_CHECK contains an if/else block, but the closing "fi" lay just after its ")". Before, this error didn't trigger any failure because the if/else code was in the "else" block of AC_CACHE_CHECK's AS_IF invocation and AS_IF was also implemented using an if..fi block. So the ostensibly-"outer" "fi" provided by AS_IF matched the inner "if/else", and that stray-after-end "fi" served to close the AS_IF block. However, when AS_IF switched from if..fi to case..esac, this became a nesting error: no matching "fi". Initially-harmless error introduced by v2.69-52-gfd29dbd7 in 2012. Error exposed by v2.72a-30-gc8d6d6eb. * tests/mktests.pl (scan_m4_files): Do not elide direct test of AC_FUNC_ALLOCA. FTR, here's the list of macros whose direct tests were being suppressed: AC_CANONICAL_BUILD AC_CANONICAL_HOST AC_CANONICAL_TARGET AC_CHECK_INCLUDES_DEFAULT AC_DISABLE_OPTION_CHECKING AC_ERLANG_NEED_ERL AC_ERLANG_NEED_ERLC AC_ERLANG_SUBST_ERTS_VER AC_ERLANG_SUBST_INSTALL_LIB_DIR AC_ERLANG_SUBST_LIB_DIR AC_F77_DUMMY_MAIN AC_F77_LIBRARY_LDFLAGS AC_FC_DUMMY_MAIN AC_FC_LIBRARY_LDFLAGS AC_FUNC_ALLOCA AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK AC_GNU_SOURCE AC_HEADER_DIRENT AC_HEADER_SYS_WAIT AC_PATH_X AC_PROG_CPP AC_PROG_CXX AC_PROG_CXXCPP AC_PROG_F77 AC_PROG_FC AC_PROG_GO AC_PROG_GREP AC_PROG_OBJC AC_PROG_OBJCPP AC_PROG_OBJCXX AC_PROG_OBJCXXCPP AC_STRUCT_TM AC_TYPE_GETGROUPS AC_TYPE_LONG_LONG_INT AC_TYPE_MBSTATE_T AC_TYPE_PID_T AC_TYPE_SIZE_T AC_TYPE_UID_T AC_TYPE_UNSIGNED_LONG_LONG_INT AC_USE_SYSTEM_EXTENSIONS
* make update-copyrightPaul Eggert2022-05-191-1/+1
|
* Autoconf now quotes 'like this' instead of `like this'Paul Eggert2021-07-201-46/+46
| | | | | | | Autoconf’s diagnostics now follow current GNU coding standards, which say that diagnostics in the C locale should quote 'like this' with plain apostrophes instead of the older GNU style `like this' with grave accent and apostrophe.
* make update-copyrightZack Weinberg2021-01-281-1/+1
|
* Port minor AC_FUNC_ALLOCA fixes from GnulibPaul Eggert2020-12-111-5/+5
| | | | | | | * lib/autoconf/functions.m4 (_AC_LIBOBJ_ALLOCA, AC_FUNC_ALLOCA): Use ' not ` in generated comments, as per current GNU coding style. (_AC_LIBOBJ_ALLOCA): Use plain # instead of unnecessary quadrigraph. This patch is adapted from Gnulib.
* AC_FUNC_SETPGRP: Don’t depend on the return type of setpgrp.Zack Weinberg2020-11-301-9/+8
| | | | | | | | | | | | | | | | | | | | | | | AC_FUNC_SETPGRP determines whether you have the historic BSD setpgrp, which takes two arguments and returns int, or the historic POSIX setpgrp, which takes no arguments and returns int. Solaris has yet a third variant, which takes no arguments and returns a pid_t (the new process group ID). This difference causes AC_FUNC_SETPGRP’s test program to fail to compile under AC_LANG([C++]), which in turn causes the macro to report that setpgrp does take arguments, which is wrong. It is not worth adding a new result #define for this variant, since *all* forms of setpgrp are deprecated in favor of setpgid, which is old enough that it can be used unconditionally. However, it is worth documenting that this variant exists, and fixing AC_FUNC_SETPGRP to produce the right value for its existing result #define on Solaris with C++. * lib/autoconf/functions.m4 (AC_FUNC_SETPGRP): Redesign test program to not depend on the return type of setpgrp. * doc/autoconf.texi (AC_FUNC_SETPGRP): Mention that the macro does not check for the Solaris variant of setpgrp that returns pid_t. Change programming advice to recommend use of setpgid.
* AC_FUNC_STRERROR_R: Include string.h in test program.Zack Weinberg2020-11-051-1/+1
| | | | | | | | | | | | I misremembered how AC_LANG_PROGRAM works. We don’t need to invoke AC_INCLUDES_DEFAULT here but we *do* need to explicitly include string.h. Unfortunately we have no good way of testing for this regression with the testsuite as it is today. * lib/autoconf/functions.m4 (AC_FUNC_STRERROR_R): Include string.h in test program.
* Treat msys(2) the same as cygwin when looking at host_os.Jannick2020-10-281-2/+2
| | | | | | | | | | | | | | | In most cases, checks depending on the value of $host_os should treat *-*-cygwin*, *-*-msys*, and *-*-mingw* all the same. * lib/autoconf/fortran.m4 (_AC_FC_LIBRARY_LDFLAGS): Discard -lkernel32 on msys* as well. When not discarding -lkernel32, deduplicate it, like other -l options. * lib/autoconf/functions.m4 (AC_FUNC_MALLOC, AC_FUNC_REALLOC): msys* also guarantee to return nonnull for malloc(0)/realloc(0). * tests/local.at (at_check_env): Also ignore MSYS as an environment variable.
* Fix regressions when using the C++ compiler to perform tests.Zack Weinberg2020-10-101-41/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Debian project has done an archive rebuild using autoconf 2.69c, which found several serious regressions from 2.69 where test programs used to be accepted by a C++ compiler, but are now rejected. Part of the problem is that newer C++ compilers are more likely to reject “traditional” sloppy C, but part of it is that bug fixes since 2.69 did not consider the possibility of test macros being used with AC_LANG([C++]) in effect. I’m still working on test suite improvements that will catch these regressions in the future, but I don’t see any reason to delay the actual bugfixes. (I’ve gotten far enough on the test suite changes that I know they _will_ catch the bugs.) * NEWS: Document that AC_FUNC_STRERROR_R no longer tries to detect a strerror_r that exists in the C library but isn’t declared by string.h. * lib/autoconf/c.m4 (AC_LANG_CALL(C++)): New macro. Use a more robust technique for avoiding a type conflict with any intrinsic prototype. (AC_LANG_CALL(C)): Remove #ifdef __cplusplus, this macro is no longer used to generate C++ code. * lib/autoconf/functions.m4 (AC_FUNC_CLOSEDIR_VOID): Rely on <dirent.h> to declare closedir. Simplify test program. Use AC_COMPILE_IFELSE, not AC_RUN_IFELSE. (_AC_FUNC_MALLOC_IF, _AC_FUNC_REALLOC_IF): Use void *, not char *, for variable holding a value returned by malloc/realloc respectively. (AC_FUNC_STRERROR_R): Don’t AC_CHECK_FUNCS_ONCE strerror_r. AC_DEFINE HAVE_STRERROR_R if and only if we are also going to define HAVE_DECL_STRERROR_R. Remove AC_RUN_IFELSE fallback when strerror_r is not declared. * lib/autoconf/headers.m4 (AC_USG): Use "", not 0, for the first argument to rindex.
* Autoupdate AC_{DIAGNOSE,FATAL,OBSOLETE,WARNING} and _AC_COMPUTE_INT.Zack Weinberg2020-09-221-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While working on the previous patches I noticed that all of these macros are officially obsolete, but autoupdate doesn’t replace them. _AC_COMPUTE_INT is easy to autoupdate. AC_{DIAGNOSE,FATAL,WARNING} require a little special handling because their replacements are m4sugar macros, and autoupdate normally expands m4sugar macros as it goes. Fortunately, the same workaround as is used for AC_FOREACH can be applied. AC_OBSOLETE also needs that workaround, and cannot be fully replaced automatically. The bulk of the patch is removing internal uses of AC_DIAGNOSE. * lib/autoconf/autoupdate.m4 * lib/autoconf/c.m4 * lib/autoconf/functions.m4 * lib/autoconf/general.m4 * lib/autoconf/headers.m4 * lib/autoconf/lang.m4 * lib/autoconf/status.m4 * lib/autoconf/types.m4 * tests/local.at * tests/tools.at: Use, and/or refer to, m4_warn instead of AC_DIAGNOSE. * lib/autoconf/general.m4 (_AC_COMPUTE_INT): Define using AU_DEFUN. (AC_DIAGNOSE, AC_FATAL, AC_WARNING): Autoupdate to m4_warn, m4_fatal, and m4_warn([syntax], [$1]) respectively, using the same paired AU_DEFUN/AC_DEFUN trick that is used for AC_FOREACH. (AC_OBSOLETE): Autoupdate to m4_warn([obsolete], [$1]) and advise hand-conversion to AU_DEFUN. * lib/autoconf/autoupdate.m4 (AU_DEFUN): Tweak quoting so m4_warn([$3]) is emitted into the edited configure.ac instead of being expanded at autoupdate time. * tests/tools.at (autoupdating AC_FOREACH): Adjust grep expressions. (autoupdating AC_DIAGNOSE and AC_WARNING): New test. (autoupdating AC_FATAL): New test. (autoupdating AC_OBSOLETE): New test. * tests/mktests.sh (ac_exclude_list, au_exclude_list): Exclude AC_DIAGNOSE, AC_FATAL, AC_FOREACH, AC_OBSOLETE, and AC_WARNING if not already excluded.
* Remove obsolete Cray supportPaul Eggert2020-07-301-20/+0
| | | | | | | | | Gnulib removed this recently, and we should be consistent. * doc/autoconf.texi (Autoheader Macros): Use a more up-to-date example. * lib/autoconf/functions.m4 (CRAY_STACKSEG_END): Remove. This is backported from the following Gnulib patch: https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=41a2d446c7984f8f39e3eeca40c6d30630969c10
* Fix ${VAR-NONWORD} bugsPaul Eggert2020-07-161-3/+2
| | | | | | | * lib/autoconf/functions.m4 (AC_FUNC_SELECT_ARGTYPES): * lib/autoconf/programs.m4 (AC_FUNC_SELECT_ARGTYPES): * lib/autotest/general.m4 (AT_INIT): Rewrite to avoid ${VAR-VALUE} where VALUE is not a shell word.
* Consistently expand macros in whitespace-separated lists.Zack Weinberg2020-06-291-11/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Several of the most commonly used Autoconf macros (starting with AC_CHECK_FUNCS and AC_CHECK_HEADERS) take a whitespace-separated list of symbols as their primary argument. It would abstractly be best if this list were _not_ subject to M4 macro expansion, in case there’s a collision between a M4 macro name and something to be looked for. However, we have historically not been careful about this, and there’s been reports of configure scripts using ‘dnl’ to write comments inside the list. The AS_LITERAL_IF optimizations added to AC_CHECK_FUNCS and AC_CHECK_HEADERS since 2.69 broke some of those scripts with bizarre shell syntax errors. Also, the macro expansion behavior is not consistent among all of the macros that take whitespace-separated lists, nor is it consistent between autoconf and autoheader. Address this by introducing a new m4sugar macro, currently called ‘m4_validate_w’ (I’m open to suggestions for better names). Here’s its documentation comment: | m4_validate_w(STRING): Expands into m4_normalize(m4_expand([STRING])), | but if that is not the same as just m4_normalize([STRING]), | issue a warning. The text of the warning is | configure.ac:N: warning: whitespace-separated-list contains macros; | configure.ac:N: in a future version of Autoconf they will not be expanded If the unexpanded form of the string contains the token ‘dnl’ then there’s an additional line: | configure.ac:N: note: ‘dnl’ is a macro All of the public macros that take a whitespace-separated list of symbols are changed to pass that argument through m4_validate_w before doing anything else with it, and the test suite is updated to verify consistent behavior for every last one of them. This addresses Savannah issues #110210 and #110211, and the harmless but annoying autoheader behavior described at https://lists.gnu.org/archive/html/bug-autoconf/2018-02/msg00005.html . In order to avoid expanding relatively expensive m4sugar macros multiple times per top-level macro invocation, several of the affected Autoconf macros are restructured along the same lines as I did for AC_REPLACE_FUNCS in the previous patch. * lib/m4sugar/m4sugar.m4 (m4_validate_w): New macro. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS, AC_CHECK_FUNCS_ONCE) (AC_REPLACE_FUNCS) * lib/autoconf/general.m4 (AC_CONFIG_MACRO_DIRS, AC_CHECK_FILES) * lib/autoconf/headers.m4 (AC_CHECK_HEADERS, AC_CHECK_HEADERS_ONCE) * lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS): Pass $1 through m4_validate_w before use. * lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Refactor with helpers _AC_CHECK_HEADERS_ONE_U, _AC_CHECK_HEADERS_ONE_S, _AC_CHECK_HEADERS_ONE_C. (AC_CHECK_HEADERS_ONCE): Eliminate _AC_CHECK_HEADERS_ONCE. (AC_CHECK_INCLUDES_DEFAULT): Don’t use _AC_CHECK_HEADERS_ONCE. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Refactor with helpers _AC_CHECK_FUNCS_ONE_U, _AC_CHECK_FUNCS_ONE_S, _AC_CHECK_FUNCS_ONE_C. * lib/autoconf/status.m4 (_AC_CONFIG_SUBDIRS): No need to use m4_normalize. * tests/semantics.at: Add tests for expansion of M4 macros in whitespace-separated list arguments to all of the above.
* AC_REPLACE_FUNCS: invoke _AH_CHECK_FUNC and AC_LIBSOURCE unconditionally.Zack Weinberg2020-06-291-10/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While investigating something else, I noticed that AC_REPLACE_FUNCS calls _AH_CHECK_FUNC and AC_LIBSOURCE in the success branch of an AC_CHECK_FUNC. This doesn’t work; both of those are marker macros that need to be expanded unconditionally at m4 time so that traces (placed by autoheader and automake, respectively) will fire. In order to fix this while keeping the code readable, I would up doing a major refactor. There are now four internal macros implementing AC_REPLACE_FUNCS. _AC_REPLACE_FUNC_U is called unconditionally for every shell word in the list passed to AC_REPLACE_FUNCS, and does _AH_CHECK_FUNC + AC_LIBSOURCE if it can, or issues a warning if it can’t. (It could make sense to make this a public function, if we think shell variables in the AC_REPLACE_FUNCS list need to be supported long-term. I dunno if there’s a use case that can’t be handled by AC_REPLACE_FUNCS inside a shell conditional just as well.) _AC_REPLACE_FUNC_L and _AC_REPLACE_FUNC_NL implement the actual test performed for each function to be replaced; the difference is that _L (for literal) can only be used on a function whose name is known at m4 expansion time, _NL (nonliteral) works regardless. _AC_REPLACE_FUNCS, which already existed, handles looping either at m4 time or shell time as appropriate. AC_REPLACE_FUNCS remains a thin wrapper that runs _AC_REPLACE_FUNCS(m4_flatten([$1])). The _bulk_ of the patch is changes to the testsuite so that it notices the original bug. Specifically, AT_CHECK_AUTOHEADER now takes an argument which is a whitespace-separated list of preprocessor macro names that ought to appear in the generated config.h.in. This can be set to ‘ignore’ to skip the test, and unfortunately that’s what the “trivial” per-macro tests have to do (AT_CHECK_MACRO and friends), so coverage is not ideal, but it’s better than what we had. Also, AT_CHECK_M4 now normalizes the backtrace lines that appear in the output of an AC_DIAGNOSE, e.g. configure.ac:6: warning: The macro `AC_LANG_SAVE' is obsolete. configure.ac:6: You should run autoupdate. ../../lib/autoconf/lang.m4:125: AC_LANG_SAVE is expanded from... configure.ac:6: the top level becomes configure.ac:6: warning: The macro `AC_LANG_SAVE' is obsolete. configure.ac:6: You should run autoupdate. lang.m4: AC_LANG_SAVE is expanded from... configure.ac:6: the top level This allows us to write tests for these diagnostics that don’t depend on the relationship between the source and build directories, and won’t break when unrelated patches change the line number of a macro definition. * lib/autoconf/functions.m4 (AC_REPLACE_FUNCS, _AC_REPLACE_FUNCS) (_AC_REPLACE_FUNC): Refactor into AC_REPLACE_FUNCS, _AC_REPLACE_FUNCS, _AC_REPLACE_FUNC_U, _AC_REPLACE_FUNC_L, _AC_REPLACE_FUNC_NL. Ensure that _AH_CHECK_FUNC and AC_LIBSOURCE are invoked unconditionally at m4 expansion time for each literal function name in the argument to AC_CHECK_FUNCS. Issue warnings about non-literal names. * tests/local.at (AT_CHECK_M4): Normalize backtrace lines from the output of AC_DIAGNOSE / m4_warn. (AT_CHECK_AUTOHEADER): Add arg EXPECTED-TMPLS giving a list of preprocessor macro names that should appear in the generated config.h.in. Use AT_CHECK_M4 to invoke autoheader. (_AT_CHECK_AC_MACRO, AT_CHECK_MACRO, AT_CHECK_AU_MACRO): Update uses of AT_CHECK_AUTOHEADER. * tests/fortran.at, tests/semantics.at, tests/tools.at * tests/torture.at: Update all uses of AT_CHECK_AUTOHEADER. * tests/semantics.at (AC_REPLACE_FUNCS test): Make somewhat more thorough, using new functionality of AT_CHECK_M4 and AT_CHECK_AUTOHEADER. Signed-off-by: Zack Weinberg <zackw@panix.com>
* maint: make update-copyrightJim Meyering2020-01-011-1/+1
|
* Prefer HTTPS to FTP and HTTPPaul Eggert2017-09-161-1/+1
|
* maint: update copyright dates for 2017Jim Meyering2017-01-011-1/+1
| | | | | * all files: Run "make update-copyright". * doc/autoconf.texi: Update manually.
* autoconf: prefer an unrolled loop for trivial AC_CHECK_FUNCSPaolo Bonzini2016-12-211-4/+9
| | | | | | | | | | | | | | | An unrolled loop avoids the cost of spawning sed in AS_TR_SH and AS_TR_CPP. Prefer it if there is nothing in the second and third argument of AC_CHECK_FUNCS and the first argument is a literal. * lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Unroll loop if safe. (_AC_CHECK_FUNCS): Move basic implementation here. Signed-off-by: Paolo Bonzini <bonzini@gnu.org> Message-Id: <1477933688-4884-2-git-send-email-bonzini@gnu.org> [eblake: perform AC_CHECK_FUNCS_ONCE changes separately, use dnl to reduce generated blank lines] Signed-off-by: Eric Blake <eblake@redhat.com>
* AC_CHECK_FUNCS_ONCE: hoist cache name computation to m4 timeEric Blake2016-12-211-7/+17
| | | | | | | | | | | | | | | | | | | | | | | Rather than perform a sed script on each element of the $ac_func_c_list to compute the corresponding cache name, we can inline enough of AC_CHECK_FUNC to bypass the normal polymorphic code, and instead directly use the literal function name that we are consuming from the list. While at it, we can use echo instead of cat to append to confdefs.h, for another process shaved. The resulting configure script is roughly unchanged in size, but performs slightly faster. * lib/autoconf/functions.m4 (AC_CHECK_FUNC): Split out shell function registration... (_AC_CHECK_FUNC_FN): ...to here. (_AC_FUNCS_EXPANSION): Use it to inline enough of AC_CHECK_FUNC to operate on a literal rather than a shell variable, for fewer sed calls. Signed-off-by: Eric Blake <eblake@redhat.com>
* AC_CHECK_FUNCS_ONCE: hoist CPP name computation to m4 timeEric Blake2016-12-211-3/+13
| | | | | | | | | | | | | | | | | | | | | Rather than perform a sed script on each element of the $ac_func_c_list to compute the corresponding CPP name, we can make the list store a series of pairs of function names and CPP names all computed at m4 time. The resulting configure script is slightly larger based on how many function names are checked once, but also performs slightly faster. There is still a sed call in AC_CHECK_FUNC for computing the cache variable name; that will be dealt with next. * lib/autoconf/functions.m4 (_AC_CHECK_FUNC_ONCE): Track the CPP name in the list... (_AC_FUNCS_EXPANSION): ...and rewrite the list walk to parse off pairs of arguments, for fewer sed calls. Signed-off-by: Eric Blake <eblake@redhat.com>
* AC_CHECK_FUNCS_ONCE: honor current AC_LANGEric Blake2016-12-201-8/+9
| | | | | | | | | | | | | | | | | | | | | | Previously, AC_CHECK_FUNCS_ONCE collected a list of function names to check, but ran the checks using the AC_LANG that was active during the first encounter of the macro. In practice, this is usually the C language, and we haven't had actual reports of projects attempting to use AC_CHECK_FUNCS_ONCE across multiple languages, rather this was discovered by code inspection. With this patch, the code now tracks a separate per-language list of names to check. Note, however, that it is only possible to check for a given function name in one language; attempting to add a name again under AC_CHECK_FUNCS_ONCE while a different language is active is a no-op (this still makes sense because the side-effect of defining the CPP macro HAVE_FUNC does not include a language prefix). * lib/autoconf/functions.m4 (_AC_CHECK_FUNC_ONCE) (_AC_FUNCS_EXPANSION): * NEWS: Mention it. Signed-off-by: Eric Blake <eblake@redhat.com>
* maint: make update-copyrightPaul Eggert2016-02-061-1/+1
|
* Port better to gcc -fsanitize=addressPaul Eggert2016-02-061-2/+8
| | | | | * lib/autoconf/functions.m4 (_AC_FUNC_MALLOC_IF, _AC_FUNC_REALLOC_IF): Free heap-allocated storage before exiting.
* Fix memory leak in AC_FUNC_MMAPPaul Eggert2016-02-051-0/+2
| | | | | * lib/autoconf/functions.m4 (AC_FUNC_MMAP): Fix memory leak in test case, found by configuring with gcc -fsanitize=address.
* maint: bump copyright to 2015Paul Eggert2015-01-021-1/+1
| | | | * all files: Run 'make update-copyright'.
* Change main () to main (void) for C/C++Vincent Lefevre2014-02-131-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | This patch changes "main ()" to "main (void)" for C/C++. See: http://lists.gnu.org/archive/html/bug-autoconf/2014-01/msg00005.html On my machine, before this patch, 3 tests were failing: 38: tools.at:1329 autom4te cache locking 218: autotest.at:1893 C unit tests ac_config_testdir at_tested autotest 219: autotest.at:1948 C unit tests (EXEEXT) ac_config_testdir at_tested autotest With this patch, 2 tests were failing: 218: autotest.at:1893 C unit tests ac_config_testdir at_tested autotest 219: autotest.at:1948 C unit tests (EXEEXT) ac_config_testdir at_tested autotest (I suspect that 38 is unrelated.) Signed-off-by: Vincent Lefevre <vincent@vinc17.net> Copyright-paperwork-exempt: Yes
* maint: bump copyright to 2014Eric Blake2014-01-011-1/+1
| | | | | | | Done via 'make update-copyright', since all files are effectively modified and distributed this year via public version control. * all files: Update copyright year.
* Use AC_CHECK_{DECLS,FUNCS,HEADERS}_ONCE more in specific-check macros.Zack Weinberg2013-09-211-17/+15
| | | | | | | | | | | | | | | | | * lib/autoconf/functions.m4 (AC_FUNC_CHOWN): No need to check for unistd.h. (_AC_LIBOBJ_FNMATCH): Use AC_CHECK_DECLS_ONCE and AC_CHECK_FUNCS_ONCE. (_AC_LIBOBJ_GETLOADAVG): Use AC_CHECK_FUNCS_ONCE for setlocale. (AC_FUNC_MMAP): Use AC_CHECK_FUNCS_ONCE for getpagesize. (AC_FUNC_SELECT_ARGTYPES): Use AC_CHECK_HEADERS_ONCE for sys/select.h and sys/socket.h. (AC_FUNC_STRERROR_R): Use AC_CHECK_DECLS_ONCE + AC_CHECK_FUNCS_ONCE for strerror_r. (AC_FUNC_UTIME_NULL): Use AC_CHECK_HEADERS_ONCE for utime.h. (AC_FUNC_FORK): Use AC_CHECK_HEADERS_ONCE and AC_CHECK_FUNCS_ONCE. (AC_FUNC_VPRINTF): Use AC_CHECK_FUNCS_ONCE for vprintf (but not _doprnt). * lib/autoconf/headers.m4 (AC_HEADER_TIME, AC_MEMORY_H): Use AC_CHECK_HEADERS_ONCE.
* Modernize AC_INCLUDES_DEFAULT and friends.Zack Weinberg2013-09-211-37/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/autoconf/headers.m4 (_AC_INCLUDES_DEFAULT_REQUIREMENTS): Include stddef.h, stdlib.h, and string.h unconditionally. Don't include memory.h at all. Don't use AC_HEADER_STDC. Don't check for stddef.h, stdlib.h, string.h, or memory.h. For compatibility, unconditionally define STDC_HEADERS, HAVE_STDLIB_H, and HAVE_STRING_H. (AN_HEADER list): Remove C89 headers, and memory.h from list. (AC_HEADER_STDC, AC_UNISTD_H): AU_DEFUN to trigger _AC_INCLUDES_DEFAULT_REQUIREMENTS if it hasn't already happened, and do nothing else. (AC_HEADER_TIME): AU_DEFUN, and define TIME_WITH_SYS_TIME unconditionally as long as sys/time.h is present. (AC_USG, AC_MEMORY_H): Assume existence of string.h. * lib/autoconf/functions.m4 (_AC_FUNC_MALLOC_IF, _AC_FUNC_REALLOC_IF): Don't use AC_HEADER_STDC. Assume stdlib.h exists. (AC_FUNC_MKTIME): Don't use AC_HEADER_TIME. Assume time.h exists. (AC_FUNC_ALLOCA): Assume stdlib.h exists. (_AC_LIBOBJ_FNMATCH): Assume wchar.h and wctype.h exist. (_AC_LIBOBJ_GETLOADAVG): Assume locale.h exists. (AC_FUNC_MMAP): Assume stdlib.h exists. * tests/tools.at: Use AC_WORDS_BIGENDIAN instead of AC_STDC_HEADERS in autoupdate test. * NEWS, doc/autoconf.texi: Document changes. Remove obsolete advice.
* * lib/autoconf/functions.m4 (HAVE_DOPRNT): Fix missing-comma typo.Paul Eggert2013-06-211-1/+1
| | | | | Reported by Peter Breitenlohner in: http://lists.gnu.org/archive/html/autoconf-patches/2013-06/msg00007.html
* AC_PROG_CC etc: avoid warnings when removing conftest* on OS XPaul Eggert2013-03-081-1/+1
| | | | | | | | | Reported by Nobuyoshi Nakada in: http://lists.gnu.org/archive/html/autoconf-patches/2013-03/msg00003.html * lib/autoconf/c.m4 (AC_PROG_CC, AC_PROG_CC_C_O, AC_PROG_CXX_C_O): * lib/autoconf/fortran.m4 (_AC_PROG_FC_C_O): * lib/autoconf/functions.m4 (AC_FUNC_SELECT_ARGTYPES): Use rm -rf, not just rm -f, when removing conftest*.
* AC_FUNC_SETPGRP: work even when cross-compilingPaul Eggert2013-02-131-9/+7
| | | | | | | * lib/autoconf/functions.m4 (AC_FUNC_SETPGRP): Use AC_COMPILE_IFELSE rather than AC_RUN_IFELSE. Problem reported by Alvaro Soliverez in <http://lists.gnu.org/archive/html/bug-autoconf/2013-02/msg00002.html>.
* maint: bump copyright to 2013Eric Blake2013-01-031-1/+1
| | | | | | | Done via 'make update-copyright', since all files are effectively modified and distributed this year via public version control. * all files: Update copyright year.
* AC_FUNC_ALLOCA: port to recent BSDs and remove obsolete AIXPaul Eggert2012-12-201-17/+17
| | | | | | | | | | | | | | | | | | | * doc/autoconf.texi (Particular Functions): Remove the AIX case from the recommended code, as the most recent version of the AIX compiler that IBM still supports (V10.1 as of this writing) has <alloca.h> and thus longer needs this, and the old suggestion wasn't completely working anyway. Remove obsolete discussion of SVR3 libPW alloca and of SVR4 libucb alloca. * lib/autoconf/functions.m4 (AC_FUNC_ALLOCA): Rework to match documentation, including abovementioned AIX change. Inconsistency with documentation reported by Steven G. Johnson in <http://lists.gnu.org/archive/html/autoconf/2003-03/msg00179.html>. As this adds stdlib.h, it should also fix the problems on recent BSD platforms noted by Patrick Welche in http://lists.gnu.org/archive/html/autoconf-patches/2012-12/msg00009.html though the fix differs from NetBSD's current workaround. Also, don't bother checking for alloca if <alloca.h> works, as the latter implies the former.
* maint: fix the comment at the end of _AC_FUNC_REALLOC_IFAdrian Bunk2012-09-251-1/+1
| | | | | | * lib/autoconf/functions.m4: fix the comment at the end of _AC_FUNC_REALLOC_IF Copyright-paperwork-exempt: yes
* AC_FUNC_VFORK: check for Solaris 2.4 signal-handling bugPaul Eggert2012-09-161-4/+20
| | | | | | * NEWS: * doc/autoconf.texi (Particular Functions): Document this. * lib/autoconf/functions.m4 (_AC_FUNC_VFORK): Check for the bug.
* functions: add Bitrig defaultsDavid Hill2012-06-181-2/+2
| | | | | | | | Cater to the Bitrig OS, an OpenBSD fork. config.guess and config.sub have been updated upstream. * lib/autoconf/functions.m4 (_AC_FUNC_MALLOC_IF) (_AC_FUNC_REALLOC_IF): Bitrig inherits from BSD.