Ethereal-dev: [Ethereal-dev] Rewrite of acinclude.m4 library check autoconf macros
Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.
From: "Olivier Biot" <ethereal@xxxxxxxxxx>
Date: Wed, 17 Mar 2004 23:30:44 +0100
Hi list, Below you'll find a first attempt at rewriting an autoconf macro in top level acinclude.m4 file for testing the PCRE library. The new approach is that we don't automatically add every library to the CFLAGS/CPPFLAGS/LDFLAGS and LIBS as the PCRE library may not be relevant for all targets. Instead all Makefile.am files will use @PCRE_CFLAGS@, @PCRE_CPPFLAGS@, @PCRE_LDFLAGS@ and @PCRE_LIBS@ for those targets requiring libpcre. If this approach is OK, then I'd like to implement it for all relevant macros in acinclude.m4. Fire your comments! Regards, Olivier # # AC_ETHEREAL_LIBPCRE_CHECK # # Test the presence and usability of the PCRE library. # The code in configure.in ensures $want_pcre is either "yes", "no" # or "ifpresent". # AC_DEFUN(AC_ETHEREAL_LIBPCRE_CHECK, [ if test "x$pcre_dir" != "x" then # # The user specified a directory in which libpcre resides, # so add the "include" subdirectory of that directory to # the include file search path and the "lib" subdirectory # of that directory to the library search path. # # XXX - if there's also a libpcre in a directory that's # already in CFLAGS, CPPFLAGS, or LDFLAGS, this won't # make us find the version in the specified directory, # as the compiler and/or linker will search that other # directory before it searches the specified directory. # PCRE_CFLAGS=" -I$pcre_dir/include" PCRE_CPPFLAGS=" -I$pcre_dir/include" PCRE_LDFLAGS=" -L$pcre_dir/lib" PCRE_LIBS="$PCRE_LDFLAGS -lpcre" else # # The user did not specify a directory in which libpcre resides. # Assume it is installed in the default location. # PCRE_CFLAGS= PCRE_CPPFLAGS= PCRE_LDFLAGS= PCRE_LIBS=" -lpcre" fi save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS$PCRE_CFLAGS" save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS$PCRE_CPPFLAGS" save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS$PCRE_LDFLAGS" save_LIBS="$LIBS" LIBS="$LIBS$PCRE_LIBS" # # Make sure we have "pcre.h". If we don't, it means we probably # don't have libpcre, so don't use it. # AC_CHECK_HEADER(pcre.h,, [ # # Unable to find the pcre.h header. # if test "x$pcre_dir" != "x" then # # The user used "--with-pcre=DIR" to specify a directory # containing libpcre, but we didn't find the header file # there; that either means they didn't specify the # right directory or are confused about whether libpcre # is, in fact, installed. Report the error and give up. # AC_MSG_WARN([dnl *** Header file pcre.h not found in directory $pcre_dir *** specified in --with-pcre=DIR. *** Either libpcre is not installed, or the specified directory is incorrect. *** Support for libpcre will be disabled.]) else # # The user did not specify a directory containing libpcre. # We did not find libpcre in the default location. # if test "x$want_pcre" = "xyes" then # # The user tried to force us to use the library, but we couldn't # find the header file; warn user that libpcre won't be used. # AC_MSG_WARN([dnl *** Header file pcre.h not found. *** Either libpcre is not installed, or you must specify its location *** with the --with-pcre=DIR option. *** Support for libpcre will be disabled.]) fi # # The case where $want_pcre equals "ifpresent" would be the "else" # clause, in which nothing will happen (silently ignore the absence # of libpcre). # fi want_pcre=no ]) if test "x$want_pcre" != "xno" then # # Well, we at least have the pcre header file. # # We're only using standard functions from libpcre, # so we don't need to perform extra checks. # AC_CHECK_LIB(pcre, pcre_compile, [ AC_DEFINE(HAVE_LIBPCRE, 1, [Define to use libpcre library]) ],[ if test "x$want_pcre" = "xyes" then AC_MSG_WARN([dnl *** Unable to find pcre_compile() in libpcre, or unable to link a test program *** with libpcre. Maybe the library is too old or not correctly installed. *** Support for libpcre will be disabled.]) want_pcre=no fi ]) fi # # Restore the versions of CFLAGS, CPPFLAGS, LDFLAGS and LIBS # Use PCRE_XXX in the Makefile.am files for targets requiring libpcre. # CFLAGS="$save_CFLAGS" CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" if test "x$want_pcre" = "xno" then # # We didn't find a working libpcre installation. # PCRE_CFLAGS= PCRE_CPPFLAGS= PCRE_LDFLAGS= PCRE_LIBS= fi AC_SUBST(PCRE_CFLAGS) AC_SUBST(PCRE_CPPFLAGS) AC_SUBST(PCRE_LDFLAGS) AC_SUBST(PCRE_LIBS) ])
- Prev by Date: Re: [Ethereal-dev] First attempt at getting rid of epan/configure
- Next by Date: Re: [Ethereal-dev] Compiling on cygwin does not work anymore
- Previous by thread: RE: [Ethereal-dev] Can't make on Windows with Visual C++ on latest CVS
- Next by thread: [Ethereal-dev] problems installing ethereal
- Index(es):