configure.ac: fix cut-and-paste error in original commit
[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.01)
5 AC_SUBST(versioninfo)
6 versioninfo=1:0:0
7
8 AC_PROG_CC
9
10 AX_CC_MAXOPT
11
12 AC_PROG_LIBTOOL
13
14 AC_CHECK_PROG(PERL, perl, perl, [])
15 AC_CHECK_PROG(PDFLATEX, pdflatex, pdflatex, [])
16 AC_CHECK_PROG(POD2HTML, pod2html, pod2html, [])
17
18 AM_CONDITIONAL(GENERATE_DOC, test -n "$PERL" -a -n "$PDFLATEX" -a -n "$POD2HTML")
19
20 AX_CREATE_STDINT_H(include/isl_stdint.h)
21
22 AX_SUBMODULE(gmp,system,system)
23
24 AC_SUBST(GMP_CPPFLAGS)
25 AC_SUBST(GMP_LDFLAGS)
26 if test "x$with_gmp_prefix" != "x"; then
27         isl_configure_args="$isl_configure_args --with-gmp=$with_gmp_prefix"
28         GMP_CPPFLAGS="-I$with_gmp_prefix/include"
29         GMP_LDFLAGS="-L$with_gmp_prefix/lib"
30 fi
31 SAVE_CPPFLAGS="$CPPFLAGS"
32 CPPFLAGS="$GMP_CPPFLAGS $CPPFLAGS"
33 need_get_memory_functions=false
34 AC_CHECK_DECLS(mp_get_memory_functions,[],[
35         need_get_memory_functions=true
36 ],[#include <gmp.h>])
37 CPPFLAGS="$SAVE_CPPFLAGS"
38 AM_CONDITIONAL(NEED_GET_MEMORY_FUNCTIONS, test x$need_get_memory_functions = xtrue)
39
40 AX_SUBMODULE(polylib,no|system|build,no)
41
42 have_polylib=false
43 AC_SUBST(POLYLIB_CPPFLAGS)
44 AC_SUBST(POLYLIB_LDFLAGS)
45 AC_SUBST(POLYLIB_LIBS)
46 case "$with_polylib" in
47         build)
48                 polylibs=`echo @polylibs@ | $with_polylib_builddir/config.status --file=-`
49                 AC_MSG_NOTICE(Configured polylibs: $polylibs)
50                 isl_cv_polylib=missing
51                 for bits in $polylibs; do
52                         if test "$bits" = "libpolylibgmp.la"; then
53                                 isl_cv_polylib=ok
54                         fi
55                 done
56                 if test "$isl_cv_polylib" = "missing"; then
57                         AC_MSG_ERROR(no gmp polylib configured)
58                 fi
59                 POLYLIB_CPPFLAGS="-I$with_polylib_builddir/include -I$polylib_srcdir/include"
60                 POLYLIB_LIBS="$with_polylib_builddir/libpolylibgmp.la"
61         ;;
62         system)
63                 POLYLIB_LIBS="-lpolylibgmp"
64                 if test "x$with_polylib_prefix" != "x"; then
65                         POLYLIB_CPPFLAGS="-I$with_polylib_prefix/include"
66                         POLYLIB_LDFLAGS="-L$with_polylib_prefix/lib"
67                 fi
68                 SAVE_CPPFLAGS="$CPPFLAGS"
69                 SAVE_LDFLAGS="$LDFLAGS"
70                 CPPFLAGS="$POLYLIB_CPPFLAGS $CPPFLAGS"
71                 LDFLAGS="$POLYLIB_LDFLAGS $LDFLAGS"
72                 AC_CHECK_LIB(polylibgmp, PolyhedronTSort,[ true ],[
73                         AC_MSG_ERROR(Need polylib)
74                 ])
75                 CPPFLAGS="$SAVE_CPPFLAGS"
76                 LDFLAGS="$SAVE_LDFLAGS"
77         ;;
78         no)
79         ;;
80         *)
81                 AC_MSG_ERROR(unsupported)
82         ;;
83 esac
84 if test "$with_polylib" != "no"; then
85         AC_DEFINE(ISL_POLYLIB,,polylib is available)
86         have_polylib=true
87 fi
88 AM_CONDITIONAL(HAVE_POLYLIB, test x$have_polylib = xtrue)
89
90 AX_SUBMODULE(piplib,no|system|build|bundled,no)
91
92 have_piplib=false
93 AC_SUBST(PIPLIB_CPPFLAGS)
94 AC_SUBST(PIPLIB_LDFLAGS)
95 AC_SUBST(PIPLIB_LIBS)
96 case "$with_piplib" in
97         bundled)
98                 PIPLIB_CPPFLAGS="-I$srcdir/piplib/include"
99                 isl_configure_args="$isl_configure_args --with-bits=gmp"
100         ;;
101         build)
102                 PIPLIB_CPPFLAGS="-I$piplib_srcdir/include"
103                 PIPLIB_LIBS="$with_piplib_builddir/libpiplibMP.la"
104         ;;
105         system)
106                 PIPLIB_LIBS="-lpiplibMP"
107                 if test "x$with_piplib_prefix" != "x"; then
108                         PIPLIB_CPPFLAGS="-I$with_piplib_prefix/include"
109                         PIPLIB_LDFLAGS="-L$with_piplib_prefix/lib"
110                 fi
111                 SAVE_CPPFLAGS="$CPPFLAGS"
112                 SAVE_LDFLAGS="$LDFLAGS"
113                 CPPFLAGS="$PIPLIB_CPPFLAGS $CPPFLAGS"
114                 LDFLAGS="$PIPLIB_LDFLAGS $LDFLAGS"
115                 AC_CHECK_LIB(piplibMP, pip_solve,[
116                         AC_CHECK_MEMBER(PipOptions.Urs_parms, [], [
117                                 AC_MSG_ERROR([Piplib too old; please install version 1.3.6 or newer])
118                         ],[#include <piplib/piplibMP.h>])
119                 ],[
120                         AC_MSG_ERROR([Piplib not found])
121                 ])
122                 CPPFLAGS="$SAVE_CPPFLAGS"
123                 LDFLAGS="$SAVE_LDFLAGS"
124         ;;
125         no)
126         ;;
127         *)
128                 AC_MSG_ERROR(unsupported)
129         ;;
130 esac
131 if test "$with_piplib" != "no"; then
132         AC_DEFINE(ISL_PIPLIB,,piplib is available)
133         have_piplib=true
134 fi
135 AM_CONDITIONAL(HAVE_PIPLIB, test x$have_piplib = xtrue)
136 AM_CONDITIONAL(BUNDLED_PIPLIB, test $with_piplib = bundled)
137
138 PACKAGE_CFLAGS="-I$prefix/include/isl"
139 AX_CREATE_PKGCONFIG_INFO
140
141 AC_CONFIG_HEADERS(config.h)
142 AC_CONFIG_HEADERS(include/isl_libs.h)
143 AC_CONFIG_FILES(Makefile)
144 AC_CONFIG_FILES(doc/Makefile)
145 if test $with_piplib = bundled; then
146         AC_CONFIG_SUBDIRS(piplib)
147 fi
148 AC_CONFIG_COMMANDS_POST([
149         dnl pass on arguments to subdir configures, but don't
150         dnl add them to config.status
151         ac_configure_args="$ac_configure_args $isl_configure_args"
152 ])
153 AC_OUTPUT