From fe0c91cce702525cc26669b382d3d8a234b7e65f Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Sat, 21 Sep 2019 14:35:44 +0100 Subject: [PATCH] configure.in, conffile.fl: Remove dependency on `libfl.a'. The `libfl' library contains two functions: * `main', which basically just calls `yylex' a lot, as an easy way to write simple programs in lex(1); and * `yywap', which lets a lex(1)-generated lexer know what to do when it encounters end-of-file. Specifically, it can return nonzero to say `that's it, we're done', or zero to say `there's more: I've set up ``yyin'' so that you can read more stuff'. The library doesn't do anything very sensible for `yywrap': it just always returns 1. (If you wanted to do something more complicated, you should just write `yywrap' yourself.) Secnet has its own `main' function which is fine. It wants `yywrap', though. This causes trouble with upstream `flex', which nowadays builds a shared `libfl.so' library. This contains /both/ `yywrap' /and/ `main', which breaks the `configure' test: what happens is that the test program requires `yywrap', which brings in `libfl.so', which brings in its `main', which refers to an undefined symbol `yylex' that's not defined in the test program. This doesn't go wrong in Debian, because Debian replaces the shared-library `libfl.so' with a linker script which says `oh, no, you don't want this: you want that ``libfl_pic.a'' over there'. The latter is a traditional archive, and ld(1) can pick `yywrap' out of it without pulling in the bogus `main' and its dependency on `yylex'. Anyway, this is all more trouble than it's worth. Define our own `yywrap' in `conffile.fl', and delete the `configure' machinery. Signed-off-by: Mark Wooding --- conffile.fl | 3 +++ config.h.in | 3 --- configure | 48 ------------------------------------------------ configure.in | 4 ---- 4 files changed, 3 insertions(+), 55 deletions(-) diff --git a/conffile.fl b/conffile.fl index 2ceb01b..77c1e2c 100644 --- a/conffile.fl +++ b/conffile.fl @@ -170,3 +170,6 @@ include BEGIN(incl); /* Return all unclaimed single characters to the parser */ . return *yytext; +%% + +int yywrap(void) { return 1; } diff --git a/config.h.in b/config.h.in index ebd8574..4df92ec 100644 --- a/config.h.in +++ b/config.h.in @@ -17,9 +17,6 @@ /* Define to 1 if you have the `adns' library (-ladns). */ #undef HAVE_LIBADNS -/* Define to 1 if you have the `fl' library (-lfl). */ -#undef HAVE_LIBFL - /* Define to 1 if you have the `gmp' library (-lgmp). */ #undef HAVE_LIBGMP diff --git a/configure b/configure index d98277a..698cc7a 100755 --- a/configure +++ b/configure @@ -4486,54 +4486,6 @@ else fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for yywrap in -lfl" >&5 -$as_echo_n "checking for yywrap in -lfl... " >&6; } -if ${ac_cv_lib_fl_yywrap+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lfl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char yywrap (); -int -main () -{ -return yywrap (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_fl_yywrap=yes -else - ac_cv_lib_fl_yywrap=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_fl_yywrap" >&5 -$as_echo "$ac_cv_lib_fl_yywrap" >&6; } -if test "x$ac_cv_lib_fl_yywrap" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBFL 1 -_ACEOF - - LIBS="-lfl $LIBS" - -fi - -if test "$ac_cv_lib_fl_yywrap" != yes; then - as_fn_error $? "A compatible libfl is required" "$LINENO" 5 -fi ac_fn_c_check_func "$LINENO" "inet_ntoa" "ac_cv_func_inet_ntoa" diff --git a/configure.in b/configure.in index 2e37df7..ca81407 100644 --- a/configure.in +++ b/configure.in @@ -77,10 +77,6 @@ AC_CHECK_LIB(gmp2,mpz_init_set_str) AC_CHECK_LIB(gmp,__gmpz_init_set_str) REQUIRE_HEADER([gmp.h]) dnl Would love to barf if no gmp was found, but how to test? Requiring the header will do for now. -AC_CHECK_LIB(fl,yywrap) -if test "$ac_cv_lib_fl_yywrap" != yes; then - AC_MSG_ERROR([A compatible libfl is required]) -fi SECNET_C_GETFUNC(inet_ntoa,nsl) AC_CHECK_LIB(socket,socket) SECNET_C_GETFUNC(inet_aton,resolv) -- 2.11.0