2 AC_INIT([libsortnetwork], [1.0.0], [ff@octo.it])
3 AC_CONFIG_SRCDIR([src/sn_network.c])
4 AC_CONFIG_HEADERS([src/config.h])
5 AM_INIT_AUTOMAKE(dist-bzip2)
8 AC_PREFIX_DEFAULT("/opt/libsortnetwork")
10 # Checks for programs.
21 if test "x$GCC" = "xyes"
23 CFLAGS="$CFLAGS -std=c99"
26 AC_DEFINE([_ISOC99_SOURCE], [1], [Define to use C99])
27 AC_DEFINE([_POSIX_C_SOURCE], [200809L], [Set to desired POSIX version])
28 AC_DEFINE([_XOPEN_SOURCE], [700], [Set to desired X/Open version])
30 # TODO: Write check for libpopulation
31 #AC_CHECK_LIB([population], [main])
33 # Checks for header files.
35 AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h stdint.h])
37 # Checks for typedefs, structures, and compiler characteristics.
43 # Checks for library functions.
46 AC_CHECK_FUNCS([memmove memset strcasecmp strchr strdup strtol])
48 AC_ARG_VAR([LIBPOPULATION_CPPFLAGS], [C preprocessor flags required to build with libpopulation])
49 AC_ARG_VAR([LIBPOPULATION_LDFLAGS], [Linker flags required to build with libpopulation])
50 AC_ARG_VAR([LIBPOPULATION_LIBS], [Other libraries required to link against libpopulation])
52 # --with-libpopulation {{{
53 LIBPOPULATION_CPPFLAGS="$LIBPOPULATION_CPPFLAGS"
54 LIBPOPULATION_LDFLAGS="$LIBPOPULATION_LDFLAGS"
55 LIBPOPULATION_LIBS="$LIBPOPULATION_LIBS"
56 AC_ARG_WITH(libpopulation, [AS_HELP_STRING([--with-libpopulation@<:@=PREFIX@:>@], [Path to libpopulation.])],
58 if test "x$withval" = "xyes" || test "x$withval" = "xno"
60 with_libpopulation="$withval"
62 LIBPOPULATION_CPPFLAGS="$LIBPOPULATION_CPPFLAGS -I$withval/include"
63 LIBPOPULATION_LDFLAGS="$LIBPOPULATION_LDFLAGS -L$withval/lib"
64 with_libpopulation="yes"
68 with_libpopulation="yes"
71 SAVE_CPPFLAGS="$CPPFLAGS"
72 SAVE_LDFLAGS="$LDFLAGS"
73 CPPFLAGS="$CPPFLAGS $LIBPOPULATION_CPPFLAGS"
74 LDFLAGS="$LDFLAGS $LIBPOPULATION_LDFLAGS"
76 if test "x$with_libpopulation" = "xyes"
78 AC_CHECK_HEADERS(population.h,
79 [with_libpopulation="yes"],
80 [with_libpopulation="no"])
83 if test "x$with_libpopulation" = "xyes"
85 if test "x$LIBPOPULATION_LIBS" = "x"
87 LIBPOPULATION_LIBS="-lpthread"
90 AC_CHECK_LIB(population, population_create,
91 [with_libpopulation="yes"],
92 [with_libpopulation="no"],
93 [$LIBPOPULATION_LIBS])
94 LIBPOPULATION_LIBS="-lpopulation $LIBPOPULATION_LIBS"
97 CPPFLAGS="$SAVE_CPPFLAGS"
98 LDFLAGS="$SAVE_LDFLAGS"
100 if test "x$with_libpopulation" = "xyes"
102 AC_DEFINE(HAVE_LIBPOPULATION, 1, [Define to 1 if you have the population library (-lpopulation).])
105 AC_SUBST(LIBPOPULATION_CPPFLAGS)
106 AC_SUBST(LIBPOPULATION_LDFLAGS)
107 AC_SUBST(LIBPOPULATION_LIBS)
108 AM_CONDITIONAL(BUILD_WITH_LIBPOPULATION, test "x$with_libpopulation" = "xyes")
109 # }}} --with-libpopulation
111 AC_CONFIG_FILES([Makefile src/Makefile])
114 # vim: set fdm=marker :