sn-evolution-cut: Add new evolutionary algorithm for optimizing cuts through networks.
[sort-networks.git] / configure.ac
1 AC_PREREQ([2.65])
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)
6 AC_LANG(C)
7
8 AC_PREFIX_DEFAULT("/opt/libsortnetwork")
9
10 # Checks for programs.
11 AC_PROG_CC
12 AC_PROG_CPP
13 AC_PROG_INSTALL
14 AM_PROG_CC_C_O
15 AC_DISABLE_STATIC
16 AC_PROG_LIBTOOL
17
18 # Libtool stuff
19 LT_CONFIG_LTDL_DIR([libltdl])
20 LT_INIT
21 LTDL_INIT
22
23 if test "x$GCC" = "xyes"
24 then
25         CFLAGS="$CFLAGS -std=c99"
26 fi
27
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])
31
32 # TODO: Write check for libpopulation
33 #AC_CHECK_LIB([population], [main])
34
35 # Checks for header files.
36 AC_HEADER_STDC
37 AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h stdint.h])
38
39 # Checks for typedefs, structures, and compiler characteristics.
40 #AC_TYPE_INT64_T
41 #AC_TYPE_SIZE_T
42 #AC_TYPE_UINT32_T
43 #AC_TYPE_UINT64_T
44
45 # Checks for library functions.
46 AC_FUNC_MALLOC
47 AC_FUNC_REALLOC
48 AC_CHECK_FUNCS([memmove memset strcasecmp strchr strdup strtol])
49
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])
53
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.])],
59 [
60         if test "x$withval" = "xyes" || test "x$withval" = "xno"
61         then
62                 with_libpopulation="$withval"
63         else
64                 LIBPOPULATION_CPPFLAGS="$LIBPOPULATION_CPPFLAGS -I$withval/include"
65                 LIBPOPULATION_LDFLAGS="$LIBPOPULATION_LDFLAGS -L$withval/lib"
66                 with_libpopulation="yes"
67         fi
68 ],
69 [
70         with_libpopulation="yes"
71 ])
72
73 SAVE_CPPFLAGS="$CPPFLAGS"
74 SAVE_LDFLAGS="$LDFLAGS"
75 CPPFLAGS="$CPPFLAGS $LIBPOPULATION_CPPFLAGS"
76 LDFLAGS="$LDFLAGS $LIBPOPULATION_LDFLAGS"
77
78 if test "x$with_libpopulation" = "xyes"
79 then
80         AC_CHECK_HEADERS(population.h,
81                          [with_libpopulation="yes"],
82                          [with_libpopulation="no"])
83 fi
84
85 if test "x$with_libpopulation" = "xyes"
86 then    
87         if test "x$LIBPOPULATION_LIBS" = "x"
88         then
89                 LIBPOPULATION_LIBS="-lpthread"
90         fi
91
92         AC_CHECK_LIB(population, population_create,
93                      [with_libpopulation="yes"],
94                      [with_libpopulation="no"],
95                      [$LIBPOPULATION_LIBS])
96         LIBPOPULATION_LIBS="-lpopulation $LIBPOPULATION_LIBS"
97 fi      
98
99 CPPFLAGS="$SAVE_CPPFLAGS"
100 LDFLAGS="$SAVE_LDFLAGS"
101
102 if test "x$with_libpopulation" = "xyes"
103 then
104         AC_DEFINE(HAVE_LIBPOPULATION, 1, [Define to 1 if you have the population library (-lpopulation).])
105 fi
106
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
112
113 AC_CONFIG_FILES([Makefile src/Makefile])
114 AC_OUTPUT
115
116 # vim: set fdm=marker :