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.
22 if test "x$GCC" = "xyes"
24 CFLAGS="$CFLAGS -std=c99"
27 AC_DEFINE([_ISOC99_SOURCE], [1], [Define to use C99])
28 AC_DEFINE([_POSIX_C_SOURCE], [200809L], [Set to desired POSIX version])
29 AC_DEFINE([_XOPEN_SOURCE], [700], [Set to desired X/Open version])
31 # TODO: Write check for libpopulation
32 #AC_CHECK_LIB([population], [main])
34 # Checks for header files.
36 AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h stdint.h])
38 # Checks for typedefs, structures, and compiler characteristics.
44 # Checks for library functions.
47 AC_CHECK_FUNCS([memmove memset strcasecmp strchr strdup strtol])
49 AC_ARG_VAR([LIBPOPULATION_CPPFLAGS], [C preprocessor flags required to build with libpopulation])
50 AC_ARG_VAR([LIBPOPULATION_LDFLAGS], [Linker flags required to build with libpopulation])
51 AC_ARG_VAR([LIBPOPULATION_LIBS], [Other libraries required to link against libpopulation])
53 # --with-libpopulation {{{
54 LIBPOPULATION_CPPFLAGS="$LIBPOPULATION_CPPFLAGS"
55 LIBPOPULATION_LDFLAGS="$LIBPOPULATION_LDFLAGS"
56 LIBPOPULATION_LIBS="$LIBPOPULATION_LIBS"
57 AC_ARG_WITH(libpopulation, [AS_HELP_STRING([--with-libpopulation@<:@=PREFIX@:>@], [Path to libpopulation.])],
59 if test "x$withval" = "xyes" || test "x$withval" = "xno"
61 with_libpopulation="$withval"
63 LIBPOPULATION_CPPFLAGS="$LIBPOPULATION_CPPFLAGS -I$withval/include"
64 LIBPOPULATION_LDFLAGS="$LIBPOPULATION_LDFLAGS -L$withval/lib"
65 with_libpopulation="yes"
69 with_libpopulation="yes"
72 SAVE_CPPFLAGS="$CPPFLAGS"
73 SAVE_LDFLAGS="$LDFLAGS"
74 CPPFLAGS="$CPPFLAGS $LIBPOPULATION_CPPFLAGS"
75 LDFLAGS="$LDFLAGS $LIBPOPULATION_LDFLAGS"
77 if test "x$with_libpopulation" = "xyes"
79 AC_CHECK_HEADERS(population.h,
80 [with_libpopulation="yes"],
81 [with_libpopulation="no"])
84 if test "x$with_libpopulation" = "xyes"
86 if test "x$LIBPOPULATION_LIBS" = "x"
88 LIBPOPULATION_LIBS="-lpthread"
91 AC_CHECK_LIB(population, population_create,
92 [with_libpopulation="yes"],
93 [with_libpopulation="no"],
94 [$LIBPOPULATION_LIBS])
95 LIBPOPULATION_LIBS="-lpopulation $LIBPOPULATION_LIBS"
98 CPPFLAGS="$SAVE_CPPFLAGS"
99 LDFLAGS="$SAVE_LDFLAGS"
101 if test "x$with_libpopulation" = "xyes"
103 AC_DEFINE(HAVE_LIBPOPULATION, 1, [Define to 1 if you have the population library (-lpopulation).])
106 AC_SUBST(LIBPOPULATION_CPPFLAGS)
107 AC_SUBST(LIBPOPULATION_LDFLAGS)
108 AC_SUBST(LIBPOPULATION_LIBS)
109 AM_CONDITIONAL(BUILD_WITH_LIBPOPULATION, test "x$with_libpopulation" = "xyes")
110 # }}} --with-libpopulation
112 PKG_CHECK_MODULES([glib], [glib-2.0],
113 [have_libglib="yes"],
116 AC_CONFIG_FILES([Makefile src/Makefile])
119 # vim: set fdm=marker :