Merge commit 'isl-0.05.1'
[platform/upstream/isl.git] / configure.ac
1 AC_INIT
2 AC_CONFIG_AUX_DIR([.])
3 AC_CONFIG_MACRO_DIR([m4])
4 AM_INIT_AUTOMAKE(isl, 0.05.1)
5 AC_SUBST(versioninfo)
6 versioninfo=5:1:0
7
8 AC_PROG_CC
9
10 AX_CC_MAXOPT
11 AX_GCC_WARN_UNUSED_RESULT
12
13 AC_PROG_LIBTOOL
14
15 AC_CHECK_PROG(PERL, perl, perl, [])
16 AC_CHECK_PROG(PDFLATEX, pdflatex, pdflatex, [])
17 AC_CHECK_PROG(POD2HTML, pod2html, pod2html, [])
18
19 AM_CONDITIONAL(GENERATE_DOC, test -n "$PERL" -a -n "$PDFLATEX" -a -n "$POD2HTML")
20
21 AX_CREATE_STDINT_H(include/isl/stdint.h)
22
23 AX_SUBMODULE(gmp,system,system)
24
25 AC_SUBST(GMP_CPPFLAGS)
26 AC_SUBST(GMP_LDFLAGS)
27 if test "x$with_gmp_prefix" != "x"; then
28         isl_configure_args="$isl_configure_args --with-gmp=$with_gmp_prefix"
29         GMP_CPPFLAGS="-I$with_gmp_prefix/include"
30         GMP_LDFLAGS="-L$with_gmp_prefix/lib"
31 fi
32 SAVE_CPPFLAGS="$CPPFLAGS"
33 CPPFLAGS="$GMP_CPPFLAGS $CPPFLAGS"
34 need_get_memory_functions=false
35 AC_CHECK_DECLS(mp_get_memory_functions,[],[
36         need_get_memory_functions=true
37 ],[#include <gmp.h>])
38 CPPFLAGS="$SAVE_CPPFLAGS"
39 AM_CONDITIONAL(NEED_GET_MEMORY_FUNCTIONS, test x$need_get_memory_functions = xtrue)
40
41 AX_SUBMODULE(piplib,no|system|build,no)
42
43 have_piplib=false
44 AC_SUBST(PIPLIB_CPPFLAGS)
45 AC_SUBST(PIPLIB_LDFLAGS)
46 AC_SUBST(PIPLIB_LIBS)
47 case "$with_piplib" in
48         build)
49                 PIPLIB_CPPFLAGS="-I$piplib_srcdir/include"
50                 PIPLIB_LIBS="$with_piplib_builddir/libpiplibMP.la"
51         ;;
52         system)
53                 PIPLIB_LIBS="-lpiplibMP"
54                 if test "x$with_piplib_prefix" != "x"; then
55                         PIPLIB_CPPFLAGS="-I$with_piplib_prefix/include"
56                         PIPLIB_LDFLAGS="-L$with_piplib_prefix/lib"
57                 fi
58                 SAVE_CPPFLAGS="$CPPFLAGS"
59                 SAVE_LDFLAGS="$LDFLAGS"
60                 CPPFLAGS="$PIPLIB_CPPFLAGS $CPPFLAGS"
61                 LDFLAGS="$PIPLIB_LDFLAGS $LDFLAGS"
62                 AC_CHECK_LIB(piplibMP, pip_solve,[
63                         AC_CHECK_MEMBER(PipOptions.Urs_parms, [], [
64                                 AC_MSG_ERROR([Piplib too old; please install version 1.3.6 or newer])
65                         ],[#include <piplib/piplibMP.h>])
66                 ],[
67                         AC_MSG_ERROR([Piplib not found])
68                 ])
69                 CPPFLAGS="$SAVE_CPPFLAGS"
70                 LDFLAGS="$SAVE_LDFLAGS"
71         ;;
72         no)
73         ;;
74         *)
75                 AC_MSG_ERROR(unsupported)
76         ;;
77 esac
78 if test "$with_piplib" != "no"; then
79         AC_DEFINE(ISL_PIPLIB,,piplib is available)
80         have_piplib=true
81 fi
82 AM_CONDITIONAL(HAVE_PIPLIB, test x$have_piplib = xtrue)
83
84 AX_CREATE_PKGCONFIG_INFO
85
86 AX_DETECT_GIT_HEAD
87 echo '#define GIT_HEAD_ID "'$GIT_HEAD_ID'"' > gitversion.h
88
89 AC_CONFIG_HEADERS(isl_config.h)
90 AC_CONFIG_HEADERS(include/isl/config.h)
91 AC_CONFIG_FILES(Makefile)
92 AC_CONFIG_FILES(doc/Makefile)
93 AC_CONFIG_COMMANDS_POST([
94         dnl pass on arguments to subdir configures, but don't
95         dnl add them to config.status
96         ac_configure_args="$ac_configure_args $isl_configure_args"
97 ])
98 AC_OUTPUT