summaryrefslogtreecommitdiff
path: root/doc
Commit message (Collapse)AuthorAgeFilesLines
* Overhaul AC_TYPE_GETGROUPS and AC_FUNC_GETGROUPS.Zack Weinberg2023-04-021-8/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Make AC_PROG_GCC_TRADITIONAL a compatibility alias for AC_PROG_CC.Zack Weinberg2023-04-021-15/+14
| | | | | | | | | | | | | | This macro is one of the last remaining internal uses of AC_EGREP_CPP. It has only ever done anything useful with GCC, and GCC dropped support for ‘traditional’ compilation in version 3.3 (released 2003) so I do not think it is worth trying to preserve. * lib/autoconf/c.m4 (AC_PROG_GCC_TRADITIONAL): Make into a compatibility alias for AC_PROG_CC, similar to AC_PROG_CC_STDC. * lib/autoconf/general.m4 (AC_EGREP_CPP): Remove stale comment. * doc/autoconf.texi, NEWS: Document this change. * tests/mktests.pl: Exclude AC_PROG_GCC_TRADITIONAL from autoupdate tests.
* Fix ‘make syntax-check’ complaints.Zack Weinberg2023-03-121-1/+1
| | | | | | | | | | | | | | * cfg.mk (local-checks-to-skip): Add sc_unportable_grep_q, which has too many false positives to bother with; for instance, it triggers on autoconf.texi’s discussion of why grep -q is unportable, and on the code in maint.mk that implements the check! (old_NEWS_hash): Update for commit b751bf49496ea3f0054533cfd63f977640abb07a, which fixed spelling errors in old NEWS. * doc/autoconf.texi: Remove a doubled word. * lib/autoconf/programs.m4: Remove a space immediately before a tab. * lib/m4sugar/m4sh.m4 (_AS_IF): Rephrase documentation to avoid saying “if IF-FALSE” which triggers the prohibit_doubled_word check.
* doc: improve AS_IF docPaul Eggert2023-02-061-102/+137
| | | | | | * doc/autoconf.texi: Improve documentation of AS_IF, AS_CASE, etc. Clarify the advice about when AS_IF is needed, and follow that advice in examples.
* Update doc slightly for C23.Paul Eggert2023-02-051-8/+9
|
* Improve year-2038 documentationPaul Eggert2023-02-021-79/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * NEWS, doc/autoconf.texi (System Services): Improve documentation for behavior of largefile and year-2038 support. Say that in the current implementation, year-2038 support requires largefile support. Say that year-2038 support matters only for GNU/Linux glibc 2.34+ on 32-bit x86 and ARM. Prefer brevity when this does not hurt understandability; for example, prefer active to passive voice. Prefer “wider” to “larger” when talking about the number of bits in an integer, as this terminology is more standard. Tone down the wording in warnings about enabling year-2038 support, use similar wording in warnings about enabling largefile support, and warn also about disabling largefile and year-2038 support. No need for @emph. Also mention rlim_t. Be a bit more careful about saying “2 GiB” rather than “2 GB”. Mention that a future version of Autoconf might change AC_SYS_LARGEFILE to default to --enable-year2038, since something has gotta happen before 2038. Coalesce descriptions of --enable-largefile and --enable-year2038 to simplify documentation. Mention that the only system where AC_SYS_LARGEFILE changes CC is IRIX and that these systems are obsolete. Say that ‘stat’ can fail due to time_t overflow. Say that you can’t portably print time_t with %ld. Say that binary compatibilty problems also can occur when one library is linking to amother; it’s not just apps vs libraries. Mention the possibility of modifying libraries to support both 32- and 64-bit interfaces. Warn more consistently about ABI compatibility issues, but put the bulk of this text in one location that the other locations refer to.
* spelling fixesPaul Eggert2023-01-211-7/+7
|
* make update-copyrightPaul Eggert2023-01-203-3/+3
|
* make fetchPaul Eggert2023-01-202-3/+3
|
* Restore *_REQUIRED macrosPaul Eggert2022-12-281-81/+104
| | | | | As per: https://lists.gnu.org/r/autoconf-patches/2022-12/msg00004.html
* Omit just-added *_REQUIRED macrosPaul Eggert2022-12-251-104/+81
| | | | | | | | | | | | They are not needed for Gnulib, and users have an easy way to get their effect, so for now omit them and just document the easy way. Also, redo documentation to make it clear that AC_YEAR_2038 is like AC_SYS_LARGEFILE except with a different year-2038 default. * NEWS, doc/autoconf.texi: Document the above. * lib/autoconf/specific.m4 (AC_SYS_YEAR2038_REQUIRED): (AC_SYS_LARGEFILE_REQUIRED): Remove. Remove some support code. Perhaps further simplification could be done but I quit while I was ahead.
* AC_SYS_LARGEFILE: Don’t enlarge time_t by defaultZack Weinberg2022-12-251-53/+112
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Document C23 <stdckdint.h>Paul Eggert2022-12-241-23/+9
|
* Use UTF-8 and spell "François" correctlyPaul Eggert2022-12-241-9/+10
|
* AC_USE_SYSTEM_EXTENSIONS now enables C23 Annex FPaul Eggert2022-12-241-1/+4
| | | | | * lib/autoconf/specific.m4 (AC_USE_SYSTEM_EXTENSIONS): Also define __STDC_WANT_IEC_60559_EXT__, for C23.
* Modernize and regularize doc for C89 etc.Paul Eggert2022-11-111-110/+49
| | | | | | | | In documentation and comments, prefer the more-common “C89” to the equivalent “C90”, and use 2-digit years for C standards as that’s common usage. Remove some confusing old doc for pre-C89 systems, as Autoconf assumes C89 or later. Mention C17 and C23 briefly. Improve doc for malloc, realloc.
* Warn about TMPDIRPaul Eggert2022-10-281-0/+4
| | | | | | * doc/autoconf.texi (Initialization Macros): Warn about setting TMPDIR, following up on this Paul Smith remark: https://lists.gnu.org/r/autoconf/2022-10/msg00024.html
* MKDIR_P now falls back on mkdir -pPaul Eggert2022-10-121-42/+14
| | | | | | | * lib/autoconf/programs.m4 (AC_PROG_MKDIR_P): Fall back on mkdir -p instead of on a relative path to install-sh, as the latter now seems to be more of a problem than the former.
* Update M4 version numbers in documentationPaul Eggert2022-10-051-3/+4
|
* Port to compilers that moan about K&R func declsPaul Eggert2022-09-021-4/+2
| | | | | | | | | | * 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.
* Remove obsolete Solaris info from manualPaul Eggert2022-08-251-112/+22
| | | | | | Don't mention anything about Solaris 9 or older, as Oracle no longer supports those old versions and the obsolete info merely clutters the manual.
* Improve doc for AC_SYS_LARGEFILE etc.Paul Eggert2022-08-181-5/+13
|
* Port AC_CHECK_HEADER_STDBOOL to C23Paul Eggert2022-08-131-4/+17
| | | | | | Modernize the bool documentation a bit too. * lib/autoconf/headers.m4 (AC_CHECK_HEADER_STDBOOL): Allow C23 too.
* AC_SYS_LARGEFILE now widens time_t if possiblePaul Eggert2022-08-091-3/+30
| | | | | | | | | | | This change is taken from Gnulib, and is needed for apps like GDB. * lib/autoconf/specific.m4 (_AC_SYS_YEAR2038_TEST_INCLUDES) (_AC_SYS_YEAR2038, AC_SYS_YEAR2038): New macros, taken (with renaming) from Gnulib. (_AC_SYS_LARGEFILE_MACRO_VALUE): #undef before #define. (AC_SYS_LARGEFILE): Prefer AS_IF and AS_CASE to doing it by hand. Widen time_t if possible, too. Define __MINGW_USE_VC2005_COMPAT early if needed.
* basename and dirname are portable nowPaul Eggert2022-07-211-6/+15
| | | | | * doc/autoconf.texi (Limitations of Usual Tools): basename and dirname are portable shell commands now.
* make fetchZack Weinberg2022-07-102-21/+36
| | | | | Our local patches to lib/Autom4te/FileUtils.pm and maint.mk were manually reapplied.
* Improve regex documentationPaul Eggert2022-06-221-6/+17
| | | | | | * doc/autoconf.texi (Running the Preprocessor) (Limitations of Usual Tools): Improve comments on limitations of regular expressions.
* make update-copyrightPaul Eggert2022-05-193-3/+3
|
* Document AC_RUN_IFELSE([], ...) etc.Paul Eggert2022-05-101-0/+12
| | | | | | | * doc/autoconf.texi (Running the Preprocessor) (Running the Compiler, Running the Linker, Runtime): Document that the _IFELSE macros reuse an existing input file if their input is empty.
* Clarify documentation of number formatPaul Eggert2022-02-121-11/+25
| | | | | Problem reported by Mike Frysinger in: https://lists.gnu.org/r/autoconf-patches/2022-02/msg00007.html
* add new AC_PROG_AR helperMike Frysinger2022-01-241-0/+9
| | | | | | | | | | | | | | This mirrors the existing RANLIB and related toolchain macros that autoconf already exports. Some projects assume `ar` is available which isn't always safe, so provide a macro that probes the full toolchain settings. This also makes it easier to use AC_REQUIRE with the macro instead of duplicating the AC_CHECK_TOOL call in projects. * lib/autoconf/programs.m4 (AC_PROG_AR): New macro. * doc/autoconf.texi: Document it. * tests/local.at (_AT_CHECK_ENV): Allow $AR output variable.
* doc: Document how to deal with missing 'join'.Bruno Haible2022-01-121-0/+6
| | | | | * doc/autoconf.texi (Limitations of Usual Tools): Mention that 'join' is missing in BusyBox.
* doc: document BusyBox sed w bugPaul Eggert2022-01-011-0/+24
|
* doc: update ‘find’ infoPaul Eggert2021-10-091-4/+9
| | | | | | * doc/autoconf.texi (Limitations of Usual Tools): Mention a few more GNU ‘find’ options that are not portable. Modernize a bit.
* fix a typoJim Meyering2021-09-011-1/+1
| | | | * doc/autoconf.texi (Integer Overflow): Fix typo: s/many/may/
* Modernize discussion of integer overflowPaul Eggert2021-08-311-78/+95
| | | | | | | * doc/autoconf.texi (Integer Overflow, Integer Overflow Basics) (Signed Overflow Examples, Optimization and Wraparound): Modernize discussion to take current compiler and Gnulib technology into account.
* Fortran Cray pointer macro supportMarshall Ward2021-08-161-0/+22
| | | | | | | | | | | | | | | | | | | This patch adds the AC_F77_CRAY_POINTERS and AC_FC_CRAY_POINTERS macros, which test if the Fortran compiler supports Cray pointers. The macros are written such that the tests share a common backend (_AC_FC_CRAY_POINTERS) which works on both F77 and FC compilers. Wrappers are provided to address any future potential compatibility issues. The macros include additional tests for particular flags required by GFortran and PGI compilers. The current set of flags is sparse, but can be extended for other compilers if needed. Documentation and a minimal test of the macro have been included. Two minor variable name typos (@EXEEXT@ as @EEXEXT@) were also fixed in two of the other Fortran tests.
* Autoconf now quotes 'like this' instead of `like this'Paul Eggert2021-07-201-19/+19
| | | | | | | 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.
* Document unquoted here-documents betterPaul Eggert2021-07-181-36/+34
| | | | | | | | | | | | | | | | | | | Problem reported by Bruno Haible (sr #110518). * doc/autoconf.texi (Generating Sources) (Running the Preprocessor, Running the Compiler) (Running the Linker, Runtime): Briefly mention that the program snippets are expanded as unquoted here-documents. (Here-Documents): Document escaping needed in unquoted here-documents. Remove mention of \" glitch in OpenBSD 2.7 sh; that old system has not been supported for many years. Remove advice that every \ must be quoted, as that sort of quoting (though harmless) is not needed and is rarely done. * lib/autoconf/c.m4 (AC_C_BIGENDIAN, _AC_LANG_OPENMP(Fortran 77)): * lib/autoconf/types.m4 (AC_TYPE_LONG_LONG_INT): Properly quote code snippets. The backslash-newline typos were harmless, and the backslash-$ typo has unspecified behavior as per POSIX though the typo is harmless on all shells I know of. However, Autoconf should follow its own quoting advice.
* doc: fix typo in variable nameEmanuele Giaquinta2021-06-301-1/+1
| | | | | Message-Id: <YJ4Tm3WEkv86L/YV@FSAPPLE2215.fi.f-secure.com> (tiny change)
* make fetchZack Weinberg2021-01-281-1/+1
|
* make update-copyrightZack Weinberg2021-01-283-6/+6
|
* doc: Document another portability problem of 'od'.Bruno Haible2020-12-301-2/+21
| | | | | * doc/autoconf.texi (Limitations of Usual Tools): Document that decimal output is not portable.
* doc: modernize grep discussionPaul Eggert2020-12-301-6/+6
|
* Restore compatibility with older std-gnu11.m4.Zack Weinberg2020-12-231-27/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Gnulib’s std-gnu11.m4 backports C11 and C++11 detection to autoconf 2.69. It does this by replacing the definitions of AC_PROC_CC and AC_PROG_CXX and most of their subroutines. In particular, it replaces the definitions of _AC_PROG_CC_C11, _AC_PROG_CC_C99, and _AC_C_STD_TRY, but it does *not* replace the definition of _AC_PROG_CC_C89. Autoconf commit 131d8c69f31dc6fc8dc93abe1096d52d1fe19fd3 changed the calling convention of _AC_C_STD_TRY, and changed the internal definitions of _AC_PROG_CC_C{11,99,89} to match. If std-gnu11.m4 is in use, our _AC_PROG_CC_C89 calls their _AC_C_STD_TRY with the new calling convention, and this produces a syntactically invalid configure script. (This is is fortunate: it could easily have been a runtime malfunction that only manifested with compilers that only implement C89, and then we might not have noticed the problem for years.) Gnulib commit a3b3fc85e3e632374811b27cb2111e50fa177e36 makes std-gnu11.m4 do nothing when used with autoconf >=2.70, but older versions of the file will circulate for years to come, so this patch works around the problem in autoconf. It does this by renaming all of the internal macros involved with C and C++ standard edition detection, *except* _AC_PROG_CC_C89. AC_PROG_CC now calls _AC_PROG_CC_STDC_EDITION, which loops over all supported editions calling _AC_PROG_CC_STDC_EDITION_TRY, which uses the data provided by the existing _AC_C_C${edition}_TEST_PROGRAM macros and a new set of macros called _AC_C_C${edition}_OPTIONS to perform the test for that edition of the standard. Similarly, AC_PROG_CXX calls _AC_PROG_CXX_STDCXX_EDITION, which loops calling _AC_PROG_CXX_STDCXX_EDITION_TRY, which uses data from _AC_CXX_CXX${edition}_TEST_PROGRAM and _AC_CXX_CXX${edition}_OPTIONS. _AC_PROG_CC_C89 is the only macro from the old set that we still define, and its definition is reverted to what std-gnu11.m4 expects it to be. Nothing in Autoconf proper uses it anymore. foreign.at grows a test to verify that the compatibility stub version of _AC_PROG_CC_C89 does its job. Since this is now the third test involving an embedded copy of a third-party macro, I broke them all out of foreign.at to separate files in test/data/. In addition to fixing the breakage, this patch should make it easier to extend C / C++ standard edition detection in the future, by getting rid of the if-else chains in AC_PROG_CC/CXX and by disentangling the lists of command-line options to test from the logic. I also changed the manual to suggest people refer to the variables ‘ac_prog_cc_stdc’ and ‘ac_prog_cxx_stdcxx’ to learn which edition of the C and C++ standards are selected; these are much easier to work with than the ac_cv_prog_cc_cNN cache variables. * lib/autoconf/c.m4 (_AC_C_STD_TRY, _AC_PROG_CC_C99, _AC_PROG_CC_C11) (_AC_CXX_STD_TRY, _AC_PROG_CXX_CXX98, _AC_PROG_CXX_CXX11): Remove macro. (_AC_C_C89_OPTIONS, _AC_C_C99_OPTIONS, _AC_C_C11_OPTIONS) (_AC_PROG_CC_STDC_EDITION, _AC_PROG_CC_STDC_EDITION_TRY) (_AC_CXX_CXX98_OPTIONS, _AC_CXX_CXX11_OPTIONS) (_AC_PROG_CXX_STDCXX_EDITION, _AC_PROG_CXX_STDCXX_EDITION_TRY): New macros. (_AC_PROG_CC_C89): Convert to compatibility stub for std-gnu11.m4. (AC_PROG_CC): Use _AC_PROG_CC_STDC_EDITION. (AC_PROG_CXX): Use _AC_PROG_CXX_STDCXX_EDITION. * tests/data/ax_prog_cc_for_build_v18.m4 * tests/data/ax_prog_cxx_for_build_v3.m4 * tests/data/gnulib_std_gnu11_2020_08_17.m4: New files. * tests/foreign.at (AX_PROG_CC_FOR_BUILD, AX_PROG_CXX_FOR_BUILD): Remove embedded copy of ax_prog_cc_for_build_v18.m4, ax_prog_cxx_for_build_v3.m4 respectively. (gnulib-std-gnu11.m4): New test. * tests/local.mk: Distribute tests/data/*.m4. * doc/autoconf.texi (AC_PROG_CC, AC_PROG_CXX): Document use of ac_prog_cc_stdc / ac_prog_cxx_stdcxx, respectively, to tell which edition of the C / C++ standards are selected, instead of looking through a series of cache variables with awkward definitions.
* Use -fno-builtin, not -Werror, in AC_CHECK_DECLS (#110400)Zack Weinberg2020-12-231-12/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | clang issues only a warning, not an error, when an undeclared identifier that names a built-in function is used: for instance char *(*p)(const char *, int) = strchr; (with no `#include <string.h>`) is an error with most compilers, a warning with clang. This broke the 2.69 implementation of AC_CHECK_DECL. In commit 82ef7805faffa151e724aa76c245ec590d174580, we tried to work around this quirk by using -Werror, but that put us at risk of being tripped up by other warnings. Bug 110400 reports, for instance, that this fragment (which is roughly what you get, after preprocessing, when AC_CHECK_DECL is applied to a function that *is* properly declared) extern void ac_decl (int, char *); int main (void) { (void) ac_decl; ; return 0; } provokes a warning from clang (and thus an error) when -Wextra-semi-stmt has been added to CFLAGS earlier in the configure script. The extra semicolon comes from AC_LANG_PROGRAM, and we can’t get rid of it because we have no way of telling reliably when someone wrote something like AC_LANG_PROGRAM([[#include <stdio.h>]], [[puts("hello world")]]) with no semicolon at the end of the statement; this has been acceptable for decades. Besides, that’s just one warning, who knows what compilers will start complaining about tomorrow? So: change AC_CHECK_DECL to compile its programs with -fno-builtin, instead, when the default compilation mode fails to detect an undeclared strchr. The code is restructured so that we can try other options as well, if we find another compiler with the same quirk but different command-line syntax. (All of this logic is very C-family specific, but it appears to me that AC_CHECK_DECL has never worked with other languages, so we can continue to live with that for now.) Fixes bug 110400; partially reverts 82ef7805faffa151e724aa76c245ec590d174580. * lib/autoconf/general.m4 (_AC_UNDECLARED_WARNING): Rename to _AC_UNDECLARED_BUILTIN. Instead of looking at diagnostic output, loop trying to find a command-line option that makes the compiler error out on undeclared builtins. (_AC_CHECK_DECL_BODY): Don’t AC_REQUIRE anything here. Make shell code language-agnostic, except for the actual test program. Add arguments to the shell function for additional compiler options to use. (AC_CHECK_DECL): AC_REQUIRE _AC_UNDECLARED_BUILTIN here. Supply $ac_{AC_LANG_ABBREV}_undeclared_builtin_options to ac_fn_check_decl. * tests/local.at (AT_CONFIG_CMP): Update list of variables to ignore when comparing C and C++ configure runs. * tests/semantics.at (AC_CHECK_DECLS): Add memcpy and strchr to AC_CHECK_DECLS call for functions that may be known to the compiler. * doc/autoconf.texi (AC_CHECK_DECL, AC_CHECK_DECLS): Remove note about compiler warnings.
* Update documentation of AC_USE_SYSTEM_EXTENSIONS.Zack Weinberg2020-12-071-28/+47
| | | | | | | | | | | | | | | | | | | | | | | The list of macros documented as being defined by AC_USE_SYSTEM_EXTENSIONS had gotten out of sync with the actual list. Update it thoroughly. Also, I introduced an error into the commentary when I merged Julien ÉLIE’s patch to define _NETBSD_SOURCE and _OPENBSD_SOURCE in AC_USE_SYSTEM_EXTENSIONS. _OPENBSD_SOURCE does something on NetBSD and *doesn’t* do anything on OpenBSD. This is corrected. Clean up the code in AC_USE_SYSTEM_EXTENSIONS a bit while I’m in there; we now had a redundant definition of _NETBSD_SOURCE (one unconditional and one conditional on minix/config.h existing). Reorganize the macro to make it easier to catch problems like this in the future. * lib/autoconf/specific.m4 (AC_USE_SYSTEM_EXTENSIONS): Reorganize; remove redundant AC_DEFINE of _NETBSD_SOURCE; add some missing AC_BEFOREs; use _AC_CHECK_HEADER_ONCE for header checks; revise all commentary. * doc/autoconf.texi (AC_USE_SYSTEM_EXTENSIONS): Update.
* Revise documentation of AT_CHECK.Zack Weinberg2020-12-071-42/+58
| | | | Patch originally by Jannick but then about 10x more words added by me.
* Revise documentation of AC_PROG_CC and comments on conformance checks.Zack Weinberg2020-12-071-46/+64
| | | | | | | | | | | | | Makes the documentation of AC_PROG_CC consistent with the documentation of AC_PROG_CXX. Also removes a bunch of redundant text from c.m4 and adds lists of the headers that *can* be used in the conformance tests, so future hackers don’t have to look them up. * doc/autoconf.texi (AC_PROG_CC): Make description consistent with description of AC_PROG_CXX. * lib/autoconf/c.m4: Clean up some outdated or repetitive commentary and add lists of the freestanding headers above the code that needs to avoid using non-freestanding headers.
* AC_INCLUDES_DEFAULT: Check for presence of C90 hosted headers (#110393)Zack Weinberg2020-12-061-15/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since 1993, Autoconf has been assuming that it is safe to include any of the headers defined by ISO C90 without checking for them; this is inaccurate, since only a subset are necessarily available in a C90 *freestanding* environment. It is OK to assume the presence of a header in a macro that checks specifically for something declared by that header (if the header is not present, we will think the specific declaration is unavailable, which is probably accurate for modern embedded environments). It is also OK to continue recommending that user code use these headers unconditionally—anyone working with a freestanding environment knows it. But it is not OK for very generic code within Autoconf itself, such as AC_INCLUDES_DEFAULT, to make this assumption. Note that the set of headers that are not always available includes stdio.h, which we have been assuming can be included unconditionally for even longer. In AC_INCLUDES_DEFAULT, revert to checking for string.h and stdlib.h before including them. Also revert to defining STDC_HEADERS only when string.h and stdlib.h are available (but do not check for float.h and stdarg.h, as these are part of the freestanding set). Add a new check for stdio.h. Sort the inclusion list by standard (C90 freestanding; C90 hosted; C99; POSIX) and alphabetically within each group. Revise all the documentation and update the testsuite. This partially reverts commit 86c213d0e355296f026a36e3203c0813041aae89 and is a partial fix for bug #110393. * lib/autoconf/headers.m4 (AC_CHECK_INCLUDES_DEFAULT): Check for stdio.h, stdlib.h, and string.h before including them. Define STDC_HEADERS only when string.h and stdlib.h are both available. Organize includes list by standard, then alphabetically. * doc/autoconf.texi, NEWS: Update to match. * tests/local.at (AT_CHECK_DEFINES): Make regexes more specific. Also expect a definition of HAVE_STDIO_H. * tests/c.at, tests/semantics.at, tests/tools.at: Use <float.h>, not <stdio.h>, as a header that we expect always to exist. Add HAVE_STDIO_H to various lists of macros that are expected to appear in config.h.