[PATCH] lex: failure to find library for linking is a fatal error now (was: AC_PROG_LEX does not diagnose failure to find lex library)
On Sunday 15 May 2011, Stefano Lattarini wrote: Hello autoconfers. It seems that AC_PROG_LEX does not diagnose a failure to find the lex library required to link lex-generated programs; on the contrary, when all the link attempts (i.e., with `-ll' and `-lfl') fail, configure uncorrectly declares that no lex library is needed (!), and happily proceeds with the configuration process -- only to then have `make' fail at build time. This seems wrong to me, and is certainly definitely against the autoconf philosophy. (JFTR, I've found this problem while trying to run the Automake testsuite on Debian using a Linux-MinGW cross compiler). Here are the details: $ dpkg -l *mingw* ii gcc-mingw32 4.4.4-0.1+b2 The GNU Compiler Collection (cross compiler for MingW32 / ii mingw-w64 0~20100125-3 Minimalist GNU w64 (cross) runtime ii mingw32-binutils 2.20-0.1 Minimalist GNU win32 (cross) binutils ii mingw32-runtime 3.13-1Minimalist GNU win32 (cross) runtime $ cat Makefile.am 'END' bin_PROGRAMS = foo foo_SOURCES = foo.l END $ cat configure.ac 'END' AC_INIT([foo], [1.0]) AM_INIT_AUTOMAKE([foreign -Wall -Werror]) AC_PROG_LEX AC_CONFIG_FILES([Makefile]) AC_OUTPUT END $ autoreconf -vi autoreconf: Entering directory `.' autoreconf: configure.ac: not using Gettext autoreconf: running: aclocal autoreconf: configure.ac: tracing autoreconf: configure.ac: not using Libtool autoreconf: running: /usr/bin/autoconf autoreconf: configure.ac: not using Autoheader autoreconf: running: automake --add-missing --copy --no-force configure.ac:2: installing `./install-sh' configure.ac:2: installing `./missing' Makefile.am: installing `./depcomp' configure.ac: installing `./ylwrap' autoreconf: Leaving directory `.' $ ./configure --host i586-mingw32msvc configure: WARNING: if you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for i586-mingw32msvc-strip... i586-mingw32msvc-strip checking for a thread-safe mkdir -p... /bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking for style of include used by make... GNU checking for i586-mingw32msvc-gcc... i586-mingw32msvc-gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.exe checking for suffix of executables... .exe checking whether we are cross compiling... yes checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether i586-mingw32msvc-gcc accepts -g... yes checking for i586-mingw32msvc-gcc option to accept ISO C89... none needed checking dependency style of i586-mingw32msvc-gcc... gcc3 checking for flex... flex checking lex output file root... lex.yy checking lex library... none needed # this is wrong; link failure will ensue checking whether yytext is a pointer... no configure: creating ./config.status config.status: creating Makefile config.status: executing depfiles commands $ make /bin/sh ./ylwrap foo.l lex.yy.c foo.c -- flex i586-mingw32msvc-gcc -DPACKAGE_NAME=\foo\ -DPACKAGE_TARNAME=\foo\ \ -DPACKAGE_VERSION=\1.0\ -DPACKAGE_STRING=\foo\ 1.0\ \ -DPACKAGE_BUGREPORT=\\ -DPACKAGE_URL=\\ \ -DPACKAGE=\foo\ -DVERSION=\1.0\ -I. -g -O2 \ -MT foo.o -MD -MP -MF .deps/foo.Tpo -c -o foo.o foo.c mv -f .deps/foo.Tpo .deps/foo.Po i586-mingw32msvc-gcc -g -O2 -o foo.exe foo.o foo.o: In function `yylex': /home/stefano/tmp/lex-cross-compile-autoconf-bug/foo.c:826: undefined reference to `_yywrap' collect2: ld returned 1 exit status make: *** [foo.exe] Error 1 Attached is the config.log resulting from the above `configure' run. Regards, Stefano The attached patch solves the problem for me. Note that it still lacks a testsuite addition, because I couldn't find a proper place where to add it (it seems that the *only* place in the testsuite AC_PROG_LEX is checked is in the file `tests/acprograms.at', using `AT_CHECK_MACRO'). If the patch is not rejected, I'll try to amend it to include a testcase. Regards, Stefano From 04b8af63fdee0eab513389a374af06a11a2e2045 Mon Sep 17 00:00:00 2001 Message-Id: 04b8af63fdee0eab513389a374af06a11a2e2045.1305740301.git.stefano.lattar...@gmail.com From: Stefano Lattarini stefano.lattar...@gmail.com Date: Wed, 18 May 2011 19:38:06 +0200 Subject: [PATCH] lex: failure to find library for linking is a fatal error now * lib/autoconf/programs.m4 (_AC_PROG_LEX_YYTEXT_DECL): Abort configure (with exit status `77') if the library required to link programs generated by Lex is not found. The previous behaviour was to simply assume that no library was needed,
wacky warning in 2.68...
Recently I've started getting odd warnings from autoconf, and I'm not sure how to shut them up... e.g., from the following configure.ac file: AC_INIT([barf], [0.1], [Miles Bader mi...@gnu.org]) AC_PROG_CXX AC_LANG(C++) AC_DEFUN([BARF_CHECK_CXX_FLAG], [ AC_LANG_ASSERT(C++) _SAVED_CXXFLAGS=$CXXFLAGS OPT=$2 CXXFLAGS=$CXXFLAGS $OPT case $OPT in *' '*) S=s;; *) S=;; esac AC_MSG_CHECKING([whether C++ compiler accepts $OPT option$S]) AC_COMPILE_IFELSE(AC_LANG_SOURCE([int x;]), [opt_ok=yes], [opt_ok=no]) AC_MSG_RESULT([$opt_ok]) if test $opt_ok = yes; then AC_SUBST([$1], [$OPT]) fi CXXFLAGS=$_SAVED_CXXFLAGS ]) BARF_CHECK_CXX_FLAG([BARF], -march=native) I get the following warnings from running autoconf: configure.ac:24: warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body ../../lib/autoconf/lang.m4:194: AC_LANG_CONFTEST is expanded from... ../../lib/autoconf/general.m4:2591: _AC_COMPILE_IFELSE is expanded from... ../../lib/autoconf/general.m4:2607: AC_COMPILE_IFELSE is expanded from... configure.ac:7: BARF_CHECK_CXX_FLAG is expanded from... configure.ac:24: the top level AFAICS, I _am_ using AC_LANG_SOURCE, so ... I dunno why it's complaining... Thanks, -Miles -- Non-combatant, n. A dead Quaker. ___ Autoconf mailing list Autoconf@gnu.org https://lists.gnu.org/mailman/listinfo/autoconf
Re: wacky warning in 2.68...
Miles Bader mi...@gnu.org writes: Recently I've started getting odd warnings from autoconf, and I'm not sure how to shut them up... e.g., from the following configure.ac file: [...] AC_COMPILE_IFELSE(AC_LANG_SOURCE([int x;]), [opt_ok=yes], [opt_ok=no]) [...] I get the following warnings from running autoconf: configure.ac:24: warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body ../../lib/autoconf/lang.m4:194: AC_LANG_CONFTEST is expanded from... ../../lib/autoconf/general.m4:2591: _AC_COMPILE_IFELSE is expanded from... ../../lib/autoconf/general.m4:2607: AC_COMPILE_IFELSE is expanded from... configure.ac:7: BARF_CHECK_CXX_FLAG is expanded from... configure.ac:24: the top level AFAICS, I _am_ using AC_LANG_SOURCE, so ... I dunno why it's complaining... You're missing a level of quoting. That should be: AC_COMPILE_IFELSE([AC_LANG_SOURCE([int x;])], [opt_ok=yes], [opt_ok=no]) -- Russ Allbery (r...@stanford.edu) http://www.eyrie.org/~eagle/ ___ Autoconf mailing list Autoconf@gnu.org https://lists.gnu.org/mailman/listinfo/autoconf
Re: wacky warning in 2.68...
Russ Allbery r...@stanford.edu writes: AFAICS, I _am_ using AC_LANG_SOURCE, so ... I dunno why it's complaining... You're missing a level of quoting. That should be: AC_COMPILE_IFELSE([AC_LANG_SOURCE([int x;])], [opt_ok=yes], [opt_ok=no]) Hmm, ok. [I'm not sure if I'm _ever_ going to really have any intuitive sense for quoting in autoconf] Thanks, -Miles -- Bigot, n. One who is obstinately and zealously attached to an opinion that you do not entertain. ___ Autoconf mailing list Autoconf@gnu.org https://lists.gnu.org/mailman/listinfo/autoconf
Re: wacky warning in 2.68...
Miles Bader mi...@gnu.org writes: Russ Allbery r...@stanford.edu writes: You're missing a level of quoting. That should be: AC_COMPILE_IFELSE([AC_LANG_SOURCE([int x;])], [opt_ok=yes], [opt_ok=no]) Hmm, ok. [I'm not sure if I'm _ever_ going to really have any intuitive sense for quoting in autoconf] This one was a little weird, and the only reason why I know it off the top of my head is that it's been a frequent report. I think there was an explanation on the list a while back about how that error message pops out of the internals with that problem. But in general you're not going to go wrong by just single-quoting every argument of every Autoconf macro always. Once I started doing that, most of these odd problems went away, since the legacy stuff that didn't work properly with quoting is mostly gone now. The only exception is that sometimes I double-quote with [[ ]] for literal text with [] in it. Once in a blue moon there's some sort of bug with overquoting. But nearly all the weird problems people run into with Autoconf understanding its input are from underquoting some macro argument somewhere. -- Russ Allbery (r...@stanford.edu) http://www.eyrie.org/~eagle/ ___ Autoconf mailing list Autoconf@gnu.org https://lists.gnu.org/mailman/listinfo/autoconf
[PATCH] lex: failure to find library for linking is a fatal error now (was: AC_PROG_LEX does not diagnose failure to find lex library)
On Sunday 15 May 2011, Stefano Lattarini wrote: Hello autoconfers. It seems that AC_PROG_LEX does not diagnose a failure to find the lex library required to link lex-generated programs; on the contrary, when all the link attempts (i.e., with `-ll' and `-lfl') fail, configure uncorrectly declares that no lex library is needed (!), and happily proceeds with the configuration process -- only to then have `make' fail at build time. This seems wrong to me, and is certainly definitely against the autoconf philosophy. (JFTR, I've found this problem while trying to run the Automake testsuite on Debian using a Linux-MinGW cross compiler). Here are the details: $ dpkg -l *mingw* ii gcc-mingw32 4.4.4-0.1+b2 The GNU Compiler Collection (cross compiler for MingW32 / ii mingw-w64 0~20100125-3 Minimalist GNU w64 (cross) runtime ii mingw32-binutils 2.20-0.1 Minimalist GNU win32 (cross) binutils ii mingw32-runtime 3.13-1Minimalist GNU win32 (cross) runtime $ cat Makefile.am 'END' bin_PROGRAMS = foo foo_SOURCES = foo.l END $ cat configure.ac 'END' AC_INIT([foo], [1.0]) AM_INIT_AUTOMAKE([foreign -Wall -Werror]) AC_PROG_LEX AC_CONFIG_FILES([Makefile]) AC_OUTPUT END $ autoreconf -vi autoreconf: Entering directory `.' autoreconf: configure.ac: not using Gettext autoreconf: running: aclocal autoreconf: configure.ac: tracing autoreconf: configure.ac: not using Libtool autoreconf: running: /usr/bin/autoconf autoreconf: configure.ac: not using Autoheader autoreconf: running: automake --add-missing --copy --no-force configure.ac:2: installing `./install-sh' configure.ac:2: installing `./missing' Makefile.am: installing `./depcomp' configure.ac: installing `./ylwrap' autoreconf: Leaving directory `.' $ ./configure --host i586-mingw32msvc configure: WARNING: if you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for i586-mingw32msvc-strip... i586-mingw32msvc-strip checking for a thread-safe mkdir -p... /bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking for style of include used by make... GNU checking for i586-mingw32msvc-gcc... i586-mingw32msvc-gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.exe checking for suffix of executables... .exe checking whether we are cross compiling... yes checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether i586-mingw32msvc-gcc accepts -g... yes checking for i586-mingw32msvc-gcc option to accept ISO C89... none needed checking dependency style of i586-mingw32msvc-gcc... gcc3 checking for flex... flex checking lex output file root... lex.yy checking lex library... none needed # this is wrong; link failure will ensue checking whether yytext is a pointer... no configure: creating ./config.status config.status: creating Makefile config.status: executing depfiles commands $ make /bin/sh ./ylwrap foo.l lex.yy.c foo.c -- flex i586-mingw32msvc-gcc -DPACKAGE_NAME=\foo\ -DPACKAGE_TARNAME=\foo\ \ -DPACKAGE_VERSION=\1.0\ -DPACKAGE_STRING=\foo\ 1.0\ \ -DPACKAGE_BUGREPORT=\\ -DPACKAGE_URL=\\ \ -DPACKAGE=\foo\ -DVERSION=\1.0\ -I. -g -O2 \ -MT foo.o -MD -MP -MF .deps/foo.Tpo -c -o foo.o foo.c mv -f .deps/foo.Tpo .deps/foo.Po i586-mingw32msvc-gcc -g -O2 -o foo.exe foo.o foo.o: In function `yylex': /home/stefano/tmp/lex-cross-compile-autoconf-bug/foo.c:826: undefined reference to `_yywrap' collect2: ld returned 1 exit status make: *** [foo.exe] Error 1 Attached is the config.log resulting from the above `configure' run. Regards, Stefano The attached patch solves the problem for me. Note that it still lacks a testsuite addition, because I couldn't find a proper place where to add it (it seems that the *only* place in the testsuite AC_PROG_LEX is checked is in the file `tests/acprograms.at', using `AT_CHECK_MACRO'). If the patch is not rejected, I'll try to amend it to include a testcase. Regards, Stefano From 04b8af63fdee0eab513389a374af06a11a2e2045 Mon Sep 17 00:00:00 2001 Message-Id: 04b8af63fdee0eab513389a374af06a11a2e2045.1305740301.git.stefano.lattar...@gmail.com From: Stefano Lattarini stefano.lattar...@gmail.com Date: Wed, 18 May 2011 19:38:06 +0200 Subject: [PATCH] lex: failure to find library for linking is a fatal error now * lib/autoconf/programs.m4 (_AC_PROG_LEX_YYTEXT_DECL): Abort configure (with exit status `77') if the library required to link programs generated by Lex is not found. The previous behaviour was to simply assume that no library was needed,