From: haible@ma2s2.mathematik.uni-karlsruhe.de (Bruno Haible)
Newsgroups: gnu.utils.bug
Subject: autoconf 1.3
Date: 26 Jan 1993 21:59:05 -0500
Organization: GNUs Not Usenet
Distribution: gnu

I had some problems when switching from autoconf 1.2 to autoconf 1.3.


1)
Autoconf 1.3 claims to "require GNU m4". In fact, it requires
GNU m4 1.0.3. An older version of GNU m4 (no version number, but contains the
string "Copyright (C) 1989, 1990, 1991 Free Software Foundation") dumps core
when autoconf 1.3 is called.


2)
When my config.h.in contains a default like
#define FEATURE
(an empty definition!) which is to be overriden by AC_DEFINE(FEATURE,something)
the sed commands from config.status fail to change this to
#define FEATURE something

Here is a simple patch for it:

diff -c3 -r ./acgeneral.m4 /usr/local/lib/acgeneral.m4
*** ./acgeneral.m4	Tue Jan 19 18:16:09 1993
--- /usr/local/lib/acgeneral.m4	Mon Jan 25 00:28:47 1993
***************
*** 242,260 ****
  dnl
  dnl Don't compare $2 to a blank, so we can support "-Dfoo=".
  dnl If creating a configuration header file, we add
! dnl commands to SEDDEFS to define the variable.  SED[due][ABCD]
  dnl get defined in config.status.  Here we just insert the
  dnl variable parts of the string: the variable name to define
  dnl and the value to give it.
  define(AC_DEFINE,
  [ifelse($#, 2, ifelse(regexp($2, \W), -1, DEFS="$DEFS -D$1=$2", DEFS="$DEFS -D'$1=$2'"), DEFS="$DEFS -D$1=1")ifdef([AC_CONFIG_NAME],
  [
  ifelse($#, 2, [SEDDEFS="${SEDDEFS}\${SEDdA}$1\${SEDdB}$1\${SEDdC}$2\${SEDdD}
  \${SEDuA}$1\${SEDuB}$1\${SEDuC}$2\${SEDuD}
  \${SEDeA}$1\${SEDeB}$1\${SEDeC}$2\${SEDeD}
  "], [SEDDEFS="${SEDDEFS}\${SEDdA}$1\${SEDdB}$1\${SEDdC}1\${SEDdD}
  \${SEDuA}$1\${SEDuB}$1\${SEDuC}1\${SEDuD}
  \${SEDeA}$1\${SEDeB}$1\${SEDeC}1\${SEDeD}
  "])])])dnl
  dnl
  define(AC_BEFORE,
--- 242,262 ----
  dnl
  dnl Don't compare $2 to a blank, so we can support "-Dfoo=".
  dnl If creating a configuration header file, we add
! dnl commands to SEDDEFS to define the variable.  SED[duef][ABCD]
  dnl get defined in config.status.  Here we just insert the
  dnl variable parts of the string: the variable name to define
  dnl and the value to give it.
  define(AC_DEFINE,
  [ifelse($#, 2, ifelse(regexp($2, \W), -1, DEFS="$DEFS -D$1=$2", DEFS="$DEFS -D'$1=$2'"), DEFS="$DEFS -D$1=1")ifdef([AC_CONFIG_NAME],
  [
  ifelse($#, 2, [SEDDEFS="${SEDDEFS}\${SEDdA}$1\${SEDdB}$1\${SEDdC}$2\${SEDdD}
  \${SEDuA}$1\${SEDuB}$1\${SEDuC}$2\${SEDuD}
  \${SEDeA}$1\${SEDeB}$1\${SEDeC}$2\${SEDeD}
+ \${SEDfA}$1\${SEDfB}$1\${SEDfC}$2\${SEDfD}
  "], [SEDDEFS="${SEDDEFS}\${SEDdA}$1\${SEDdB}$1\${SEDdC}1\${SEDdD}
  \${SEDuA}$1\${SEDuB}$1\${SEDuC}1\${SEDuD}
  \${SEDeA}$1\${SEDeB}$1\${SEDeC}1\${SEDeD}
+ \${SEDfA}$1\${SEDfB}$1\${SEDfC}1\${SEDfD}
  "])])])dnl
  dnl
  define(AC_BEFORE,
***************
*** 564,569 ****
--- 572,582 ----
  SEDeB='<<$>>@\1#\2define\3'
  SEDeC=' '
  SEDeD='@g'
+ # SEDf turns "#define NAME" without trailing blanks into "#define NAME VALUE".
+ SEDfA='s@^\([ 	]*\)#\([ 	]*\)define\([ 	][ 	]*\)'
+ SEDfB='<<$>>@\1#\2define\3'
+ SEDfC=' '
+ SEDfD='@g'
  changequote([,])dnl
  rm -f conftest.sed
  cat > conftest.sed <<CONFEOF


3)
A spurious #endif should be removed:

diff -c3 -r ./acgeneral.m4 /usr/local/lib/acgeneral.m4
*** ./acgeneral.m4	Tue Jan 19 18:16:09 1993
--- /usr/local/lib/acgeneral.m4	Mon Jan 25 00:28:47 1993
***************
*** 410,416 ****
  #endif
  ],
  $2, $3)])dnl
- #endif
  ])dnl
  dnl
  define(AC_HAVE_FUNCS,
--- 412,417 ----


4)
What was the purpose of removing "-O" from the CC options when
the compiler is known to be GCC?

diff -c3 -r ./acspecific.m4 /usr/local/lib/acspecific.m4
*** ./acspecific.m4	Thu Jan 14 21:59:13 1993
--- /usr/local/lib/acspecific.m4	Sun Jan 24 01:36:15 1993
***************
*** 34,39 ****
--- 34,40 ----
  ${CC-cc} -E conftest.c > conftest.out 2>&1
  if egrep yes conftest.out >/dev/null 2>&1; then
    GCC=1 # For later tests.
+   CC="$CC -O"
  fi
  rm -f conftest*
  ])dnl


5)
Defining RANLIB as '@:' is a Makefile usually produces a syntax error.
Defining it as '\#' avoids this (at least with some shells).

diff -c3 -r ./acspecific.m4 /usr/local/lib/acspecific.m4
*** ./acspecific.m4	Thu Jan 14 21:59:13 1993
--- /usr/local/lib/acspecific.m4	Sun Jan 24 01:36:15 1993
***************
*** 68,74 ****
  rm -f conftest*
  ])dnl
  dnl
! define(AC_PROG_RANLIB, [AC_PROGRAM_CHECK(RANLIB, ranlib, ranlib, @:)])dnl
  dnl
  define(AC_PROG_AWK, [AC_PROGRAMS_CHECK(AWK, mawk gawk nawk awk,)])dnl
  dnl
--- 69,75 ----
  rm -f conftest*
  ])dnl
  dnl
! define(AC_PROG_RANLIB, [AC_PROGRAM_CHECK(RANLIB, ranlib, ranlib, [\\\#])])dnl
  dnl
  define(AC_PROG_AWK, [AC_PROGRAMS_CHECK(AWK, mawk gawk nawk awk,)])dnl
  dnl


6)
An AC_DEFINE(FEATURE,void*) or AC_DEFINE(FEATURE,[void*]) results in
-D'FEATURE=void*' being added to DEFS. Even gcc 2.3.3 complains about such
an option. -DFEATURE=void* works, probably because no wildcard expansion
takes place.

diff -c3 -r ./acgeneral.m4 /usr/local/lib/acgeneral.m4
*** ./acgeneral.m4	Tue Jan 19 18:16:09 1993
--- /usr/local/lib/acgeneral.m4	Mon Jan 25 00:28:47 1993
***************
*** 242,256 ****
  dnl
  dnl Don't compare $2 to a blank, so we can support "-Dfoo=".
  dnl If creating a configuration header file, we add
  dnl commands to SEDDEFS to define the variable.  SED[due][ABCD]
  dnl get defined in config.status.  Here we just insert the
  dnl variable parts of the string: the variable name to define
  dnl and the value to give it.
  define(AC_DEFINE,
! [ifelse($#, 2, ifelse(regexp($2, \W), -1, DEFS="$DEFS -D$1=$2", DEFS="$DEFS -D'$1=$2'"), DEFS="$DEFS -D$1=1")ifdef([AC_CONFIG_NAME],
  [
  ifelse($#, 2, [SEDDEFS="${SEDDEFS}\${SEDdA}$1\${SEDdB}$1\${SEDdC}$2\${SEDdD}
  \${SEDuA}$1\${SEDuB}$1\${SEDuC}$2\${SEDuD}
  \${SEDeA}$1\${SEDeB}$1\${SEDeC}$2\${SEDeD}
--- 242,254 ----
  dnl
  dnl Don't compare $2 to a blank, so we can support "-Dfoo=".
  dnl If creating a configuration header file, we add
  dnl commands to SEDDEFS to define the variable.  SED[due][ABCD]
  dnl get defined in config.status.  Here we just insert the
  dnl variable parts of the string: the variable name to define
  dnl and the value to give it.
  define(AC_DEFINE,
! [ifelse($#, 2, DEFS="$DEFS -D$1=$2", DEFS="$DEFS -D$1=1")ifdef([AC_CONFIG_NAME],
  [
  ifelse($#, 2, [SEDDEFS="${SEDDEFS}\${SEDdA}$1\${SEDdB}$1\${SEDdC}$2\${SEDdD}
  \${SEDuA}$1\${SEDuB}$1\${SEDuC}$2\${SEDuD}
  \${SEDeA}$1\${SEDeB}$1\${SEDeC}$2\${SEDeD}


In any case, now I am happy with autoconf 1.3, especially since it removes the
dependence on awk. Consensys' awk didn't succeed in building a correct config.h.


Regards,
                 Bruno Haible
                 haible@ma2s2.mathematik.uni-karlsruhe.de