X-Git-Url: https://git.octo.it/?p=sort-networks.git;a=blobdiff_plain;f=configure.ac;h=11b9f599028eb0238f50ca9b4f6398efb9965afe;hp=25c2b3e9b20a7e77472e8b95999e9001c9b4dd3f;hb=7f5611eaa2e099c4422c49a8c47fd437b291dfb4;hpb=b8325bf3d7fa12253101f10f3b501a8a6df90984 diff --git a/configure.ac b/configure.ac index 25c2b3e..11b9f59 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_PREREQ([2.65]) +AC_PREREQ([2.61]) AC_INIT([libsortnetwork], [1.0.0], [ff@octo.it]) AC_CONFIG_SRCDIR([src/sn_network.c]) AC_CONFIG_HEADERS([src/config.h]) @@ -14,30 +14,106 @@ AC_PROG_INSTALL AM_PROG_CC_C_O AC_DISABLE_STATIC AC_PROG_LIBTOOL +PKG_PROG_PKG_CONFIG # Libtool stuff -LT_CONFIG_LTDL_DIR([libltdl]) LT_INIT -LTDL_INIT -# Checks for libraries. -AC_CHECK_LIB([m], [powl]) -# FIXME: Replace `main' with a function in `-lpopulation': +if test "x$GCC" = "xyes" +then + CFLAGS="$CFLAGS -std=c99" +fi + +AC_DEFINE([_ISOC99_SOURCE], [1], [Define to use C99]) +AC_DEFINE([_POSIX_C_SOURCE], [200809L], [Set to desired POSIX version]) +AC_DEFINE([_XOPEN_SOURCE], [700], [Set to desired X/Open version]) + +# TODO: Write check for libpopulation #AC_CHECK_LIB([population], [main]) # Checks for header files. -AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h stdint.h stdlib.h string.h strings.h unistd.h]) +AC_HEADER_STDC +AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h stdint.h]) # Checks for typedefs, structures, and compiler characteristics. -AC_TYPE_INT64_T -AC_TYPE_SIZE_T -AC_TYPE_UINT32_T -AC_TYPE_UINT64_T +#AC_TYPE_INT64_T +#AC_TYPE_SIZE_T +#AC_TYPE_UINT32_T +#AC_TYPE_UINT64_T # Checks for library functions. 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"]) +fi + +if test "x$with_libpopulation" = "xyes" +then + if test "x$LIBPOPULATION_LIBS" = "x" + then + LIBPOPULATION_LIBS="-lpthread" + fi + + 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 + +PKG_CHECK_MODULES([glib], [glib-2.0], + [have_libglib="yes"], + [have_libglib="no"]) + AC_CONFIG_FILES([Makefile src/Makefile]) AC_OUTPUT + +# vim: set fdm=marker :