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.
19 LT_CONFIG_LTDL_DIR([libltdl])
23 if test "x$GCC" = "xyes"
25 CFLAGS="$CFLAGS -std=c99"
28 AC_DEFINE([_ISOC99_SOURCE], [1], [Define to use C99])
29 AC_DEFINE([_POSIX_C_SOURCE], [200809L], [Set to desired POSIX version])
30 AC_DEFINE([_XOPEN_SOURCE], [700], [Set to desired X/Open version])
32 # TODO: Write check for libpopulation
33 #AC_CHECK_LIB([population], [main])
35 # Checks for header files.
37 AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h stdint.h])
39 # Checks for typedefs, structures, and compiler characteristics.
45 # Checks for library functions.
48 AC_CHECK_FUNCS([memmove memset strcasecmp strchr strdup strtol])
50 AC_ARG_VAR([LIBPOPULATION_CPPFLAGS], [C preprocessor flags required to build with libpopulation])
51 AC_ARG_VAR([LIBPOPULATION_LDFLAGS], [Linker flags required to build with libpopulation])
52 AC_ARG_VAR([LIBPOPULATION_LIBS], [Other libraries required to link against libpopulation])
54 # --with-libpopulation {{{
55 LIBPOPULATION_CPPFLAGS="$LIBPOPULATION_CPPFLAGS"
56 LIBPOPULATION_LDFLAGS="$LIBPOPULATION_LDFLAGS"
57 LIBPOPULATION_LIBS="$LIBPOPULATION_LIBS"
58 AC_ARG_WITH(libpopulation, [AS_HELP_STRING([--with-libpopulation@<:@=PREFIX@:>@], [Path to libpopulation.])],
60 if test "x$withval" = "xyes" || test "x$withval" = "xno"
62 with_libpopulation="$withval"
64 LIBPOPULATION_CPPFLAGS="$LIBPOPULATION_CPPFLAGS -I$withval/include"
65 LIBPOPULATION_LDFLAGS="$LIBPOPULATION_LDFLAGS -L$withval/lib"
66 with_libpopulation="yes"
70 with_libpopulation="yes"
73 SAVE_CPPFLAGS="$CPPFLAGS"
74 SAVE_LDFLAGS="$LDFLAGS"
75 CPPFLAGS="$CPPFLAGS $LIBPOPULATION_CPPFLAGS"
76 LDFLAGS="$LDFLAGS $LIBPOPULATION_LDFLAGS"
78 if test "x$with_libpopulation" = "xyes"
80 AC_CHECK_HEADERS(population.h,
81 [with_libpopulation="yes"],
82 [with_libpopulation="no"])
85 if test "x$with_libpopulation" = "xyes"
87 if test "x$LIBPOPULATION_LIBS" = "x"
89 LIBPOPULATION_LIBS="-lpthread"
92 AC_CHECK_LIB(population, population_create,
93 [with_libpopulation="yes"],
94 [with_libpopulation="no"],
95 [$LIBPOPULATION_LIBS])
96 LIBPOPULATION_LIBS="-lpopulation $LIBPOPULATION_LIBS"
99 CPPFLAGS="$SAVE_CPPFLAGS"
100 LDFLAGS="$SAVE_LDFLAGS"
102 if test "x$with_libpopulation" = "xyes"
104 AC_DEFINE(HAVE_LIBPOPULATION, 1, [Define to 1 if you have the population library (-lpopulation).])
107 AC_SUBST(LIBPOPULATION_CPPFLAGS)
108 AC_SUBST(LIBPOPULATION_LDFLAGS)
109 AC_SUBST(LIBPOPULATION_LIBS)
110 AM_CONDITIONAL(BUILD_WITH_LIBPOPULATION, test "x$with_libpopulation" = "xyes")
111 # }}} --with-libpopulation
113 AC_CONFIG_FILES([Makefile src/Makefile])
116 # vim: set fdm=marker :