Re: Possible regressions with trunk autoconf (vs 2.71)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello again,

One more failure analysis, this time for Wine.
They have the following code in their aclocal.m4{,.cross} files:

dnl **** Check whether we need to define a symbol on the compiler command
line ****
dnl
dnl Usage: WINE_CHECK_DEFINE(name),[action-if-yes,[action-if-no]])
dnl
AC_DEFUN([WINE_CHECK_DEFINE],
[AS_VAR_PUSHDEF([ac_var],[ac_cv_cpp_def_$1])dnl
AC_CACHE_CHECK([whether we need to define $1],ac_var,
    AC_EGREP_CPP(yes,[#ifndef $1
yes
#endif],
    [AS_VAR_SET(ac_var,yes)],[AS_VAR_SET(ac_var,no)]))
AS_VAR_IF([ac_var],[yes],
      [CFLAGS="$CFLAGS -D$1"
  LINTFLAGS="$LINTFLAGS -D$1"])dnl
AS_VAR_POPDEF([ac_var])])

Which leads to a malformed configure script with Autoconf 2.72. While
looking further,
I found out that the failure is somehow related to
_AC_PROG_EGREP_TRADITIONAL
function, but I can't really figure out why.
Adding quotes around the "AC_EGREP_CPP" call fixes the failure, but again,
I don't
know if that's a valid fix or not. There may be something wrong with the
new function.

Below is the diff of the generated configure, without (old) and with (new)
the quotes:

--- configure.old 2022-11-17 13:36:01.612861069 +0100
+++ configure.new 2022-11-17 13:29:53.044676264 +0100
@@ -21715,17 +21715,11 @@

 fi


 case $host_cpu in
-  *i[3456789]86*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking
whether we need to define __i386__" >&5
-printf %s "checking whether we need to define __i386__... " >&6; }
-if test ${ac_cv_cpp_def___i386__+y}
-then :
-  printf %s "(cached) " >&6
-else case e in #(
-  e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep -e"
>&5
+  *i[3456789]86*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking
for egrep -e" >&5
 printf %s "checking for egrep -e... " >&6; }
 if test ${ac_cv_path_EGREP_TRADITIONAL+y}
 then :
   printf %s "(cached) " >&6
 else case e in #(
@@ -21735,15 +21729,11 @@
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
 do
   IFS=$as_save_IFS
   case $as_dir in #(((
-    '' ;;
-esac
-fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result:
$ac_cv_cpp_def___i386__" >&5
-printf "%s\n" "$ac_cv_cpp_def___i386__" >&6; } as_dir=./ ;;
+    '') as_dir=./ ;;
     */) ;;
     *) as_dir=$as_dir/ ;;
   esac
     for ac_prog in grep ggrep
    do
@@ -21857,11 +21847,17 @@
 fi
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result:
$ac_cv_path_EGREP_TRADITIONAL" >&5
 printf "%s\n" "$ac_cv_path_EGREP_TRADITIONAL" >&6; }
  EGREP_TRADITIONAL=$ac_cv_path_EGREP_TRADITIONAL

-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we need to
define __i386__" >&5
+printf %s "checking whether we need to define __i386__... " >&6; }
+if test ${ac_cv_cpp_def___i386__+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #ifndef __i386__
 yes
 #endif

@@ -21873,11 +21869,15 @@
 else case e in #(
   e) ac_cv_cpp_def___i386__=no ;;
 esac
 fi
 rm -rf conftest*
-)
+ ;;
+esac
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result:
$ac_cv_cpp_def___i386__" >&5
+printf "%s\n" "$ac_cv_cpp_def___i386__" >&6; }
 if test "x$ac_cv_cpp_def___i386__" = xyes
 then :
   CFLAGS="$CFLAGS -D__i386__"
   LINTFLAGS="$LINTFLAGS -D__i386__"
 fi ;;


On Wed, Nov 16, 2022 at 7:42 PM Zack Weinberg <zack@xxxxxxxxxxxx> wrote:

> On Wed, Nov 16, 2022, at 4:06 AM, Frederic Berat wrote:
> > Hello again,
> >
> > Some progress on this, it looks like, at least for libpng, there is at
> one
> > place where the "Port AC_LANG_CALL" seems to be the culprit.
> > Specifically, the "," in the C comment, is interpreted by M4 as argument
> > split which in turn leads to the syntax error.
> > I made a small test where I  "overquote" the snippet, which seems to work
> > around the problem for this package at least, but there may be better
> > solutions:
> ...
> >  m4_define([AC_LANG_CALL(C)],
> >  [AC_LANG_PROGRAM([$1
> >  m4_if([$2], [main], ,
> > -[/* Override any GCC internal prototype to avoid an error.
> > +[[/* Override any GCC internal prototype to avoid an error.
> ...
>
> Double quotation of the arguments to AC_LANG_PROGRAM is the documented way
> to
> avoid this kind of problem, see
> https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.71/html_node/Quotation-Rule-Of-Thumb.html
>
> Since the code here is doing something more complicated than just passing
> literal code fragments to AC_LANG_PROGRAM, I will need to dig into exactly
> what it's doing before applying your patch or something like it (and I
> won't have time to do that until the weekend) but you're on the right track.
>
> (Anyone wanna write up some improvements to the documentation of
> AC_LANG_PROGRAM itself?  The need for double quotation is mentioned in one
> sentence near the top of
> https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.71/html_node/Generating-Sources.html
> but it's easy to miss.)
>
> zw
>
>



[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux