From db7017455fa3804559584c706c20897794e0b1c2 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Mon, 10 May 2010 12:10:39 +0200 Subject: [PATCH] configure.ac: Added check for libpopulation. --- configure.ac | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/configure.ac b/configure.ac index b8d6e6b..680d432 100644 --- a/configure.ac +++ b/configure.ac @@ -47,5 +47,66 @@ AC_FUNC_MALLOC AC_FUNC_REALLOC AC_CHECK_FUNCS([memmove memset strcasecmp strchr strdup strtol]) +AC_ARG_VAR([LIBPOPULATION_CPPFLAGS], [C preprocessor flags required to build with libpopulation]) +AC_ARG_VAR([LIBPOPULATION_LDFLAGS], [Linker flags required to build with libpopulation]) +AC_ARG_VAR([LIBPOPULATION_LIBS], [Other libraries required to link against libpopulation]) + +# --with-libpopulation {{{ +LIBPOPULATION_CPPFLAGS="$LIBPOPULATION_CPPFLAGS" +LIBPOPULATION_LDFLAGS="$LIBPOPULATION_LDFLAGS" +LIBPOPULATION_LIBS="$LIBPOPULATION_LIBS" +AC_ARG_WITH(libpopulation, [AS_HELP_STRING([--with-libpopulation@<:@=PREFIX@:>@], [Path to libpopulation.])], +[ + if test "x$withval" = "xyes" || test "x$withval" = "xno" + then + with_libpopulation="$withval" + else + LIBPOPULATION_CPPFLAGS="$LIBPOPULATION_CPPFLAGS -I$withval/include" + LIBPOPULATION_LDFLAGS="$LIBPOPULATION_LDFLAGS -L$withval/lib" + with_libpopulation="yes" + fi +], +[ + with_libpopulation="yes" +]) + +SAVE_CPPFLAGS="$CPPFLAGS" +SAVE_LDFLAGS="$LDFLAGS" +CPPFLAGS="$CPPFLAGS $LIBPOPULATION_CPPFLAGS" +LDFLAGS="$LDFLAGS $LIBPOPULATION_LDFLAGS" + +if test "x$with_libpopulation" = "xyes" +then + AC_CHECK_HEADERS(population.h, + [with_libpopulation="yes"], + [with_libpopulation="no"]) + echo "with_libpopulation = $with_libpopulation" +fi + +if test "x$with_libpopulation" = "xyes" +then + AC_CHECK_LIB(population, population_create, + [with_libpopulation="yes"], + [with_libpopulation="no"], + [$LIBPOPULATION_LIBS]) + LIBPOPULATION_LIBS="-lpopulation $LIBPOPULATION_LIBS" +fi + +CPPFLAGS="$SAVE_CPPFLAGS" +LDFLAGS="$SAVE_LDFLAGS" + +if test "x$with_libpopulation" = "xyes" +then + AC_DEFINE(HAVE_LIBPOPULATION, 1, [Define to 1 if you have the population library (-lpopulation).]) +fi + +AC_SUBST(LIBPOPULATION_CPPFLAGS) +AC_SUBST(LIBPOPULATION_LDFLAGS) +AC_SUBST(LIBPOPULATION_LIBS) +AM_CONDITIONAL(BUILD_WITH_LIBPOPULATION, test "x$with_libpopulation" = "xyes") +# }}} --with-libpopulation + AC_CONFIG_FILES([Makefile src/Makefile]) AC_OUTPUT + +# vim: set fdm=marker : -- 2.11.0