Similarly the AC_LANG_PROGRAM arguments ought to be double-quoted. Here, I did not find a bug. But it's better to be consistent, in order to avoid bugs in future autoconf macros.
2020-08-16 Bruno Haible <br...@clisp.org> Fix quoting of AC_LANG_PROGRAM arguments. * m4/fdopendir.m4 (gl_FUNC_FDOPENDIR): Quote the AC_LANG_PROGRAM arguments through [[...]]. * m4/fpending.m4 (gl_FUNC_FPENDING): Likewise. * m4/fpurge.m4 (gl_FUNC_FPURGE): Likewise. * m4/fseeko.m4 (gl_FUNC_FSEEKO): Likewise. * m4/ld-output-def.m4 (gl_LD_OUTPUT_DEF): Likewise. * m4/ld-version-script.m4 (gl_LD_VERSION_SCRIPT): Likewise. * m4/linkat.m4 (gl_FUNC_LINKAT): Likewise. * m4/mountlist.m4 (gl_MOUNTLIST): Likewise. * m4/sys_ioctl_h.m4 (gl_SYS_IOCTL_H): Likewise. * m4/ungetc.m4 (gl_FUNC_UNGETC_WORKS): Likewise. * m4/warn-on-use.m4 (gl_WARN_ON_USE_PREPARE): Likewise. * m4/warnings.m4 (gl_COMPILER_OPTION_IF): Likewise. * m4/wcstok.m4 (gl_FUNC_WCSTOK): Likewise. * m4/wctype_h.m4 (gl_WCTYPE_H): Likewise. diff --git a/m4/fdopendir.m4 b/m4/fdopendir.m4 index 454e9ad..9937a74 100644 --- a/m4/fdopendir.m4 +++ b/m4/fdopendir.m4 @@ -1,4 +1,4 @@ -# serial 13 +# serial 14 # See if we need to provide fdopendir. dnl Copyright (C) 2009-2020 Free Software Foundation, Inc. @@ -25,7 +25,8 @@ AC_DEFUN([gl_FUNC_FDOPENDIR], else AC_CACHE_CHECK([whether fdopendir works], [gl_cv_func_fdopendir_works], - [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM([[ #include <dirent.h> #include <fcntl.h> #include <unistd.h> @@ -37,12 +38,14 @@ extern # endif DIR *fdopendir (int); #endif -]], [int result = 0; - int fd = open ("conftest.c", O_RDONLY); - if (fd < 0) result |= 1; - if (fdopendir (fd)) result |= 2; - if (close (fd)) result |= 4; - return result;])], +]], + [[int result = 0; + int fd = open ("conftest.c", O_RDONLY); + if (fd < 0) result |= 1; + if (fdopendir (fd)) result |= 2; + if (close (fd)) result |= 4; + return result; + ]])], [gl_cv_func_fdopendir_works=yes], [gl_cv_func_fdopendir_works=no], [case "$host_os" in diff --git a/m4/fpending.m4 b/m4/fpending.m4 index ea9725e..edabcec 100644 --- a/m4/fpending.m4 +++ b/m4/fpending.m4 @@ -1,4 +1,4 @@ -# serial 22 +# serial 23 # Copyright (C) 2000-2001, 2004-2020 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -25,7 +25,7 @@ AC_DEFUN([gl_FUNC_FPENDING], AC_CACHE_CHECK([for __fpending], [gl_cv_func___fpending], [ AC_LINK_IFELSE( - [AC_LANG_PROGRAM([$fp_headers], + [AC_LANG_PROGRAM([[$fp_headers]], [[return ! __fpending (stdin);]])], [gl_cv_func___fpending=yes], [gl_cv_func___fpending=no]) diff --git a/m4/fpurge.m4 b/m4/fpurge.m4 index 890c3e7..0796a6f 100644 --- a/m4/fpurge.m4 +++ b/m4/fpurge.m4 @@ -1,4 +1,4 @@ -# fpurge.m4 serial 10 +# fpurge.m4 serial 11 dnl Copyright (C) 2007, 2009-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -19,36 +19,36 @@ AC_DEFUN([gl_FUNC_FPURGE], [AC_LANG_PROGRAM( [[#include <stdio.h> ]], - [FILE *f = fopen ("conftest.txt", "w+"); - if (!f) - return 1; - if (fputc ('a', f) != 'a') - { fclose (f); return 2; } - rewind (f); - if (fgetc (f) != 'a') - { fclose (f); return 3; } - if (fgetc (f) != EOF) - { fclose (f); return 4; } - if (fpurge (f) != 0) - { fclose (f); return 5; } - if (putc ('b', f) != 'b') - { fclose (f); return 6; } - if (fclose (f) != 0) - return 7; - if ((f = fopen ("conftest.txt", "r")) == NULL) - return 8; - if (fgetc (f) != 'a') - { fclose (f); return 9; } - if (fgetc (f) != 'b') - { fclose (f); return 10; } - if (fgetc (f) != EOF) - { fclose (f); return 11; } - if (fclose (f) != 0) - return 12; - if (remove ("conftest.txt") != 0) - return 13; - return 0; - ])], + [[FILE *f = fopen ("conftest.txt", "w+"); + if (!f) + return 1; + if (fputc ('a', f) != 'a') + { fclose (f); return 2; } + rewind (f); + if (fgetc (f) != 'a') + { fclose (f); return 3; } + if (fgetc (f) != EOF) + { fclose (f); return 4; } + if (fpurge (f) != 0) + { fclose (f); return 5; } + if (putc ('b', f) != 'b') + { fclose (f); return 6; } + if (fclose (f) != 0) + return 7; + if ((f = fopen ("conftest.txt", "r")) == NULL) + return 8; + if (fgetc (f) != 'a') + { fclose (f); return 9; } + if (fgetc (f) != 'b') + { fclose (f); return 10; } + if (fgetc (f) != EOF) + { fclose (f); return 11; } + if (fclose (f) != 0) + return 12; + if (remove ("conftest.txt") != 0) + return 13; + return 0; + ]])], [gl_cv_func_fpurge_works=yes], [gl_cv_func_fpurge_works=no], [case "$host_os" in diff --git a/m4/fseeko.m4 b/m4/fseeko.m4 index 1a10515..a64e640 100644 --- a/m4/fseeko.m4 +++ b/m4/fseeko.m4 @@ -1,4 +1,4 @@ -# fseeko.m4 serial 19 +# fseeko.m4 serial 20 dnl Copyright (C) 2007-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -17,7 +17,7 @@ AC_DEFUN([gl_FUNC_FSEEKO], AC_CACHE_CHECK([for fseeko], [gl_cv_func_fseeko], [ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h> -]], [fseeko (stdin, 0, 0);])], +]], [[fseeko (stdin, 0, 0);]])], [gl_cv_func_fseeko=yes], [gl_cv_func_fseeko=no]) ]) diff --git a/m4/ld-output-def.m4 b/m4/ld-output-def.m4 index 150788a..af80b4b 100644 --- a/m4/ld-output-def.m4 +++ b/m4/ld-output-def.m4 @@ -1,4 +1,4 @@ -# ld-output-def.m4 serial 2 +# ld-output-def.m4 serial 3 dnl Copyright (C) 2008-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -19,7 +19,7 @@ AC_DEFUN([gl_LD_OUTPUT_DEF], else gl_ldflags_save=$LDFLAGS LDFLAGS="-Wl,--output-def,conftest.def" - AC_LINK_IFELSE([AC_LANG_PROGRAM([])], + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]])], [gl_cv_ld_output_def=yes], [gl_cv_ld_output_def=no]) rm -f conftest.def diff --git a/m4/ld-version-script.m4 b/m4/ld-version-script.m4 index 98366e9..c51c813 100644 --- a/m4/ld-version-script.m4 +++ b/m4/ld-version-script.m4 @@ -1,4 +1,4 @@ -# ld-version-script.m4 serial 4 +# ld-version-script.m4 serial 5 dnl Copyright (C) 2008-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -27,7 +27,7 @@ AC_DEFUN([gl_LD_VERSION_SCRIPT], save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map" echo foo >conftest.map - AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [], [cat > conftest.map <<EOF VERS_1 { @@ -38,7 +38,7 @@ VERS_2 { global: sym; } VERS_1; EOF - AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [gl_cv_sys_ld_version_script=yes])]) rm -f conftest.map LDFLAGS=$save_LDFLAGS]) diff --git a/m4/linkat.m4 b/m4/linkat.m4 index de1bf28..e9b3d82 100644 --- a/m4/linkat.m4 +++ b/m4/linkat.m4 @@ -1,4 +1,4 @@ -# serial 12 +# serial 13 # See if we need to provide linkat replacement. dnl Copyright (C) 2009-2020 Free Software Foundation, Inc. @@ -32,9 +32,9 @@ AC_DEFUN([gl_FUNC_LINKAT], [[#include <fcntl.h> #include <unistd.h> ]], - [return linkat (AT_FDCWD, "conftest.l1", AT_FDCWD, - "conftest.l2", 0); - ])], + [[return linkat (AT_FDCWD, "conftest.l1", AT_FDCWD, + "conftest.l2", 0); + ]])], [gl_cv_func_linkat_nofollow=yes], [gl_cv_func_linkat_nofollow=no], [case "$host_os" in diff --git a/m4/mountlist.m4 b/m4/mountlist.m4 index 68276ff..7756955 100644 --- a/m4/mountlist.m4 +++ b/m4/mountlist.m4 @@ -1,4 +1,4 @@ -# serial 13 +# serial 14 dnl Copyright (C) 2002-2006, 2009-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -244,7 +244,7 @@ extern "C" #endif int getmntinfo (struct statfs **, int); - ]], [])], + ]], [[]])], [fu_cv_sys_mounted_getmntinfo2=no], [fu_cv_sys_mounted_getmntinfo2=yes]) ]) diff --git a/m4/sys_ioctl_h.m4 b/m4/sys_ioctl_h.m4 index cd2735e..98d24e8 100644 --- a/m4/sys_ioctl_h.m4 +++ b/m4/sys_ioctl_h.m4 @@ -1,4 +1,4 @@ -# sys_ioctl_h.m4 serial 11 +# sys_ioctl_h.m4 serial 12 dnl Copyright (C) 2008-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -23,7 +23,7 @@ AC_DEFUN([gl_SYS_IOCTL_H], AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include <sys/ioctl.h>]], - [(void) ioctl;])], + [[(void) ioctl;]])], [gl_cv_decl_ioctl_in_sys_ioctl_h=yes], [gl_cv_decl_ioctl_in_sys_ioctl_h=no]) ]) diff --git a/m4/ungetc.m4 b/m4/ungetc.m4 index 66492af..ce74706 100644 --- a/m4/ungetc.m4 +++ b/m4/ungetc.m4 @@ -1,4 +1,4 @@ -# ungetc.m4 serial 8 +# ungetc.m4 serial 9 dnl Copyright (C) 2009-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -13,32 +13,33 @@ AC_DEFUN_ONCE([gl_FUNC_UNGETC_WORKS], [gl_cv_func_ungetc_works], [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> - ]], [FILE *f; - if (!(f = fopen ("conftest.tmp", "w+"))) - return 1; - if (fputs ("abc", f) < 0) - { fclose (f); return 2; } - rewind (f); - if (fgetc (f) != 'a') - { fclose (f); return 3; } - if (fgetc (f) != 'b') - { fclose (f); return 4; } - if (ungetc ('d', f) != 'd') - { fclose (f); return 5; } - if (ftell (f) != 1) - { fclose (f); return 6; } - if (fgetc (f) != 'd') - { fclose (f); return 7; } - if (ftell (f) != 2) - { fclose (f); return 8; } - if (fseek (f, 0, SEEK_CUR) != 0) - { fclose (f); return 9; } - if (ftell (f) != 2) - { fclose (f); return 10; } - if (fgetc (f) != 'c') - { fclose (f); return 11; } - fclose (f); - remove ("conftest.tmp");])], + ]], [[FILE *f; + if (!(f = fopen ("conftest.tmp", "w+"))) + return 1; + if (fputs ("abc", f) < 0) + { fclose (f); return 2; } + rewind (f); + if (fgetc (f) != 'a') + { fclose (f); return 3; } + if (fgetc (f) != 'b') + { fclose (f); return 4; } + if (ungetc ('d', f) != 'd') + { fclose (f); return 5; } + if (ftell (f) != 1) + { fclose (f); return 6; } + if (fgetc (f) != 'd') + { fclose (f); return 7; } + if (ftell (f) != 2) + { fclose (f); return 8; } + if (fseek (f, 0, SEEK_CUR) != 0) + { fclose (f); return 9; } + if (ftell (f) != 2) + { fclose (f); return 10; } + if (fgetc (f) != 'c') + { fclose (f); return 11; } + fclose (f); + remove ("conftest.tmp"); + ]])], [gl_cv_func_ungetc_works=yes], [gl_cv_func_ungetc_works=no], [case "$host_os" in # Guess yes on glibc systems. diff --git a/m4/warn-on-use.m4 b/m4/warn-on-use.m4 index f36551c..3a692c7 100644 --- a/m4/warn-on-use.m4 +++ b/m4/warn-on-use.m4 @@ -1,4 +1,4 @@ -# warn-on-use.m4 serial 7 +# warn-on-use.m4 serial 8 dnl Copyright (C) 2010-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -35,8 +35,8 @@ AC_DEFUN([gl_WARN_ON_USE_PREPARE], AC_CACHE_CHECK([whether $gl_func is declared without a macro], [gl_Symbol], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$1], -[@%:@undef $gl_func - (void) $gl_func;])], +[[@%:@undef $gl_func + (void) $gl_func;]])], [AS_VAR_SET([gl_Symbol], [yes])], [AS_VAR_SET([gl_Symbol], [no])])]) AS_VAR_IF([gl_Symbol], [yes], [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_RAW_DECL_$gl_func]), [1]) diff --git a/m4/warnings.m4 b/m4/warnings.m4 index e01dc6c..d4e4b07 100644 --- a/m4/warnings.m4 +++ b/m4/warnings.m4 @@ -1,4 +1,4 @@ -# warnings.m4 serial 15 +# warnings.m4 serial 16 dnl Copyright (C) 2008-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -36,7 +36,7 @@ AC_CACHE_CHECK([whether _AC_LANG compiler handles $1], [gl_Warn], [ gl_save_compiler_FLAGS="$gl_Flags" gl_AS_VAR_APPEND(m4_defn([gl_Flags]), [" $gl_unknown_warnings_are_errors ]m4_defn([gl_Positive])["]) - AC_LINK_IFELSE([m4_default([$4], [AC_LANG_PROGRAM([])])], + AC_LINK_IFELSE([m4_default([$4], [AC_LANG_PROGRAM([[]])])], [AS_VAR_SET([gl_Warn], [yes])], [AS_VAR_SET([gl_Warn], [no])]) gl_Flags="$gl_save_compiler_FLAGS" diff --git a/m4/wcstok.m4 b/m4/wcstok.m4 index f5f7f83..d61d387 100644 --- a/m4/wcstok.m4 +++ b/m4/wcstok.m4 @@ -1,4 +1,4 @@ -# wcstok.m4 serial 4 +# wcstok.m4 serial 5 dnl Copyright (C) 2011-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -36,7 +36,7 @@ AC_DEFUN([gl_FUNC_WCSTOK], #include <wchar.h> wchar_t *wcstok (wchar_t *, const wchar_t *, wchar_t **); ]], - [])], + [[]])], [gl_cv_func_wcstok_posix_signature=yes], [gl_cv_func_wcstok_posix_signature=no]) ]) diff --git a/m4/wctype_h.m4 b/m4/wctype_h.m4 index 5c844b6..a3cfc83 100644 --- a/m4/wctype_h.m4 +++ b/m4/wctype_h.m4 @@ -1,4 +1,4 @@ -# wctype_h.m4 serial 24 +# wctype_h.m4 serial 25 dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it. @@ -57,7 +57,7 @@ AC_DEFUN([gl_WCTYPE_H], AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h> #if __GNU_LIBRARY__ == 1 Linux libc5 i18n is broken. - #endif]], [])], + #endif]], [[]])], [gl_cv_func_iswcntrl_works="guessing yes"], [gl_cv_func_iswcntrl_works="guessing no"]) ])