changeset 39733:552d3be1619c

wchar: fix bug when checking for ‘inline’ I discovered this when looking into using the regex module with Emacs. * m4/wchar_h.m4 (gl_WCHAR_H_INLINE_OK): Fix bug introduced in 2016-08-17T23:09:38Z!skunk@iSKUNK.ORG; the code compiled conftest1.c and conftest2.c but these files were not created. As far as I can see, this check never worked and nobody reported it until now, which is a bit worrisome.
author Paul Eggert <eggert@cs.ucla.edu>
date Sun, 01 Jul 2018 18:57:01 -0700
parents c3122105e7e7
children 5c732297134c
files ChangeLog m4/wchar_h.m4
diffstat 2 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Jul 01 18:00:52 2018 -0400
+++ b/ChangeLog	Sun Jul 01 18:57:01 2018 -0700
@@ -1,3 +1,14 @@
+2018-07-01  Paul Eggert  <eggert@cs.ucla.edu>
+
+	wchar: fix bug when checking for ‘inline’
+	I discovered this when looking into using the regex module
+	with Emacs.
+	* m4/wchar_h.m4 (gl_WCHAR_H_INLINE_OK): Fix bug introduced in
+	2016-08-17T23:09:38Z!skunk@iSKUNK.ORG; the code compiled
+	conftest1.c and conftest2.c but these files were not created.
+	As far as I can see, this check never worked and nobody reported
+	it until now, which is a bit worrisome.
+
 2018-06-30  Jim Meyering  <meyering@fb.com>
 
 	bootstrap: s/--option val/--option=val/
--- a/m4/wchar_h.m4	Sun Jul 01 18:00:52 2018 -0400
+++ b/m4/wchar_h.m4	Sun Jul 01 18:57:01 2018 -0700
@@ -7,7 +7,7 @@
 
 dnl Written by Eric Blake.
 
-# wchar_h.m4 serial 42
+# wchar_h.m4 serial 43
 
 AC_DEFUN([gl_WCHAR_H],
 [
@@ -90,7 +90,8 @@
      dnl that the object file has the latter name from the start.
      save_ac_compile="$ac_compile"
      ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest1/`
-     if AC_TRY_EVAL([ac_compile]); then
+     if echo '#include "conftest.c"' >conftest1.c &&
+        AC_TRY_EVAL([ac_compile]); then
        AC_LANG_CONFTEST([
          AC_LANG_SOURCE([[#define wcstod renamed_wcstod
 /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
@@ -105,7 +106,8 @@
 ]])])
        dnl See note above about renaming object files.
        ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest2/`
-       if AC_TRY_EVAL([ac_compile]); then
+       if echo '#include "conftest.c"' >conftest2.c &&
+          AC_TRY_EVAL([ac_compile]); then
          if $CC -o conftest$ac_exeext $CFLAGS $LDFLAGS conftest1.$ac_objext conftest2.$ac_objext $LIBS >&AS_MESSAGE_LOG_FD 2>&1; then
            :
          else
@@ -114,7 +116,7 @@
        fi
      fi
      ac_compile="$save_ac_compile"
-     rm -f conftest1.$ac_objext conftest2.$ac_objext conftest$ac_exeext
+     rm -f conftest[12].c conftest[12].$ac_objext conftest$ac_exeext
     ])
   if test $gl_cv_header_wchar_h_correct_inline = no; then
     AC_MSG_ERROR([<wchar.h> cannot be used with this compiler ($CC $CFLAGS $CPPFLAGS).