[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] lex: failure to find library for linking is a fatal error now (w
From: |
Stefano Lattarini |
Subject: |
[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) |
Date: |
Wed, 18 May 2011 19:40:18 +0200 |
User-agent: |
KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; ) |
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-1 Minimalist 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: <address@hidden>
From: Stefano Lattarini <address@hidden>
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, and
proceed with the configuration.
---
ChangeLog | 9 +++++++++
lib/autoconf/programs.m4 | 8 ++++++--
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 1fca7bb..4cb6767 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2011-05-18 Stefano Lattarini <address@hidden>
+
+ 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, and
+ proceed with the configuration.
+
2011-05-05 Eric Blake <address@hidden>
doc: document dash bug with positional parameters
diff --git a/lib/autoconf/programs.m4 b/lib/autoconf/programs.m4
index fb3d8b9..1d87445 100644
--- a/lib/autoconf/programs.m4
+++ b/lib/autoconf/programs.m4
@@ -752,15 +752,19 @@ AC_SUBST([LEX_OUTPUT_ROOT], [$ac_cv_prog_lex_root])dnl
if test -z "${LEXLIB+set}"; then
AC_CACHE_CHECK([lex library], [ac_cv_lib_lex], [
ac_save_LIBS=$LIBS
- ac_cv_lib_lex='none needed'
+ ac_cv_lib_lex="none found"
for ac_lib in '' -lfl -ll; do
LIBS="$ac_lib $ac_save_LIBS"
AC_LINK_IFELSE([AC_LANG_DEFINES_PROVIDED[`cat $LEX_OUTPUT_ROOT.c`]],
[ac_cv_lib_lex=$ac_lib])
- test "$ac_cv_lib_lex" != 'none needed' && break
+ test x"$ac_cv_lib_lex" = x && ac_cv_lib_lex="none needed"
+ test x"$ac_cv_lib_lex" != x"none found" && break
done
LIBS=$ac_save_LIBS
])
+ if test x"$ac_cv_lib_lex" = x"none found"; then
+ AC_MSG_FAILURE([cannot find library for $LEX; giving up], [77])
+ fi
test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex
fi
AC_SUBST(LEXLIB)
--
1.7.2.3
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [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),
Stefano Lattarini <=