remove cloog_util
[ppn.git] / configure.in
blobb855b41a60de67c66c178cc5f3203bc37554975a
1 AC_INIT
2 AC_CONFIG_MACRO_DIR([m4])
3 AM_INIT_AUTOMAKE(isa, 0.11)
4 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
5 AC_PROG_CC
7 AC_PROG_LIBTOOL
9 AC_PROG_CXX
11 AC_REPLACE_FUNCS(strndup)
13 use_size_simulate=false
14 AC_CHECK_HEADER([sys/wait.h],[
15         AC_CHECK_HEADER([dlfcn.h], [
16                 use_size_simulate=true
17                 AC_DEFINE(USE_SIZE_SIMULATE, [],
18                  [use simulation based size computation (requires dynamic loading)])
19         ])])
20 AM_CONDITIONAL(USE_SIZE_SIMULATE, test x$use_size_simulate = xtrue)
22 AX_SUBMODULE(libyaml,system,system)
23 AC_SUBST(LIBYAML_CPPFLAGS)
24 AC_SUBST(LIBYAML_LDFLAGS)
25 if test "x$with_libyaml_prefix" != "x"; then
26         LIBYAML_CPPFLAGS="-I$with_libyaml_prefix/include"
28 if test "x$with_libyaml_exec_prefix" != "x"; then
29         LIBYAML_LDFLAGS="-L$with_libyaml_exec_prefix/lib"
32 AC_LANG(C++)
34 AC_ARG_WITH(syck,
35         [  --with-syck=DIR   ])
37 AC_SUBST(syck_CFLAGS)
38 AC_SUBST(syck_LIBS)
39 syck_LIBS="-lsyck"
40 if test "x$with_syck" != "x"; then
41         syck_CFLAGS="-I$with_syck/include"
42         syck_LDFLAGS="-L$with_syck/lib"
43         syck_LIBS="$syck_LDFLAGS -lsyck"
45 CPPFLAGS="$CPPFLAGS $syck_CFLAGS"
47 SAVE_LDFLAGS="$LDFLAGS"
48 LDFLAGS="$syck_LDFLAGS $LDFLAGS"
49 AC_CHECK_HEADER(syck.h,[],[AC_MSG_ERROR(Can't find syck headers.)])
50 AC_CHECK_LIB(syck,syck_parser_bad_anchor_handler,[ true ],[AC_MSG_ERROR(Can't find appropriate syck.)])
51 LDFLAGS="$SAVE_LDFLAGS"
53 AC_ARG_WITH(gmp_prefix,
54         [AS_HELP_STRING([--with-gmp-prefix=DIR],
55                         [Location of GMP installation])])
57 if test "x$with_gmp_prefix" != "x"; then
58         isa_configure_args="$isa_configure_args --with-libgmp=$with_gmp_prefix"
59 else
60         isa_configure_args="$isa_configure_args --with-libgmp"
63 # ISA_SUBMODULE(SUBMODULE)
64 AC_DEFUN([_ISA_SUBMODULE_OPTIONS],[
65         AC_ARG_WITH($2,
66                 [AS_HELP_STRING([--with-$1=bundled|system],
67                                 [Which $1 to use])])
68         AC_ARG_WITH($2_prefix,
69                 [AS_HELP_STRING([--with-$1-prefix=DIR],
70                                 [Location of system $1])])
71         if test "x$with_$2_prefix" != "x"; then
72                 if test "x$with_$2" != "x" -a "x$with_$2" != "xsystem"; then
73                         AC_MSG_ERROR([Setting $with_$2_prefix implies use of system $1])
74                 fi
75                 with_$2="system"
76         fi
77         if test "x$3" != "x"; then
78                 if test "x$with_$3" = "xsystem"; then
79                         with_$2="system"
80                 fi
81                 if test "x$with_$2" = "xbundled"; then
82                         with_$3="bundled"
83                 fi
84         fi
86 AC_DEFUN([ISA_SUBMODULE_OPTIONS],[
87         _ISA_SUBMODULE_OPTIONS($1, m4_bpatsubst([$1],
88                         [[^_abcdefghijklmnopqrstuvwxyz0123456789]],[_]), $2)
90 AC_DEFUN([_ISA_SUBMODULE],[
91         case "$with_$2" in
92         no)
93                 AC_MSG_ERROR(Need $1)
94                 ;;
95         bundled|system)
96                 ;;
97         *)
98                 if test -d $srcdir/$3/.git -a \
99                         ! -d $srcdir/$3/$1/.git; then
100                         AC_MSG_WARN(
101 [git repo detected, but submodule $1 not initialized])
102                         AC_MSG_WARN([You may want to run])
103                         AC_MSG_WARN([   git submodule init])
104                         AC_MSG_WARN([   git submodule update])
105                         AC_MSG_WARN([   sh autogen.sh])
106                 fi
107                 if test -f $srcdir/$3/$1/configure; then
108                         with_$2="bundled"
109                 else
110                         with_$2="system"
111                 fi
112                 ;;
113         esac
115 AC_DEFUN([ISA_SUBMODULE],[
116         _ISA_SUBMODULE($1, m4_bpatsubst([$1],
117                         [[^_abcdefghijklmnopqrstuvwxyz0123456789]],[_]), $2)
120 ISA_SUBMODULE_OPTIONS(barvinok)
122 ISA_SUBMODULE(barvinok,.)
123 AC_MSG_CHECKING([which barvinok to use])
124 AC_MSG_RESULT($with_barvinok)
126 ISA_SUBMODULE_OPTIONS(isl)
127 ISA_SUBMODULE(isl,.)
128 AC_MSG_CHECKING([which isl to use])
129 AC_MSG_RESULT($with_isl)
131 ISA_SUBMODULE_OPTIONS(cloog)
132 ISA_SUBMODULE(cloog,.)
133 AC_MSG_CHECKING([which CLooG to use])
134 AC_MSG_RESULT($with_cloog)
136 have_cloog=false
137 AC_SUBST(CLOOG_CPPFLAGS)
138 AC_SUBST(CLOOG_LDFLAGS)
139 AC_SUBST(CLOOG_LIBS)
140 CLOOG_CPPFLAGS="-DCLOOG_INT_GMP=1"
141 if test "$with_cloog" = "bundled"; then
142         CLOOG_CPPFLAGS="$CLOOG_CPPFLAGS -Icloog/include -I$srcdir/cloog/include"
143         isa_configure_args="$isa_configure_args --with-cloog-builddir=../cloog"
144         have_cloog=true
145 elif test "x$with_cloog" != "xno"; then
146         CLOOG_LIBS="-lcloog-isl"
147         if test "x$with_cloog_prefix" != "x"; then
148                 CLOOG_CPPFLAGS="$CLOOG_CPPFLAGS -I$with_cloog_prefix/include"
149                 CLOOG_LDFLAGS="-L$with_cloog_prefix/lib"
150         fi
151         SAVE_CPPFLAGS="$CPPFLAGS"
152         SAVE_LDFLAGS="$LDFLAGS"
153         CPPFLAGS="$CLOOG_CPPFLAGS $CPPFLAGS"
154         LDFLAGS="$CLOOG_LDFLAGS $LDFLAGS"
155         AC_CHECK_HEADER(cloog/cloog.h,[
156             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <cloog/cloog.h>],
157                                                [cloog_clast_create(NULL,NULL)])],[
158                 AC_CHECK_MEMBER(CloogOptions.sh, [
159                     have_cloog=true
160                 ],[],[#include <cloog/cloog.h>])
161             ])
162         ])
163         CPPFLAGS="$SAVE_CPPFLAGS"
164         LDFLAGS="$SAVE_LDFLAGS"
165         if test "$have_cloog" = "false"; then
166                 AC_MSG_WARN([CLooG not found or too old])
167         fi
168         isa_configure_args="$isa_configure_args --with-cloog=system"
171 AM_CONDITIONAL(BUNDLED_CLOOG, test $with_cloog = bundled)
173 AX_SUBMODULE(pet,bundled|system|no,bundled)
174 AM_CONDITIONAL(BUNDLED_PET, test $with_pet = bundled)
176 AC_SUBST(PET_CFLAGS)
177 AC_SUBST(PET_LIBS)
178 case "$with_pet" in
179 bundled)
180         PET_CFLAGS="$PET_CFLAGS -I\$(top_srcdir)/pet/include"
181         isa_configure_args="$isa_configure_args --with-pet-builddir=../pet"
182         AC_DEFINE(HAVE_PET,[],[use Pet])
183         ;;
184 system)
185         PKG_CHECK_MODULES([PET], [pet])
186         AC_DEFINE(HAVE_PET,[],[use Pet])
187 esac
189 if test "x$with_pet" != "xno"; then
190         extra_bin_programs="$extra_bin_programs c2pdg\$(EXEEXT)"
193 AC_ARG_WITH(suif,
194         [  --with-suif=DIR   ])
196 have_suif=false
197 if test "x$with_suif" != "xno"; then
198         if test "x$with_suif" != "x"; then
199                 suifdir=$with_suif
200         elif test "x$SUIFHOME" != "x"; then
201                 suifdir=$SUIFHOME
202         fi;
203         if test "x$MACHDIR" != "x"; then
204                 platform="$MACHDIR"
205         else
206                 suifhost=`$SHELL "$suifdir/config.guess"`
207                 platform="$suifdir/$suifhost"
208         fi
210         AC_SUBST(SUIFPLATFORM)
211         abs_platform=`cd $platform; pwd`
212         SUIFPLATFORM=$abs_platform
213         AC_SUBST(ver_create_start_sty_cc)
214         AC_SUBST(ver_create_ver_cc)
215         AC_SUBST(SUIFLDFLAGS)
216         SUIFLDFLAGS="-L$platform/solib -L$platform/lib -rpath $abs_platform/solib"
217         CPPFLAGS="-I$platform/include $CPPFLAGS"
218         LDFLAGS="$LDFLAGS"
219         ver_create_start_sty_cc="AUTOINITDIR=$platform/auto_init_libs $platform/bin/ver_create_start_sty_cc"
220         ver_create_ver_cc="SUIFHOME=$suifdir $platform/bin/ver_create_ver_cc"
221         AC_CHECK_HEADER(suif1.h,[have_suif=true],
222                                 [AC_MSG_WARN(Can't find suif headers.)])
225 AX_SUBMODULE(omega-plus,no|system,no)
226 AC_SUBST(OMEGA_PLUS_CFLAGS)
227 AC_SUBST(OMEGA_PLUS_LDFLAGS)
228 AC_SUBST(OMEGA_PLUS_LIBS)
229 have_omega_plus=false
230 case "$with_omega_plus" in
231 system)
232         if test "x$with_omega_plus_prefix" != "x"; then
233                 OMEGA_PLUS_CFLAGS="-I$with_omega_plus_prefix/include/omega"
234                 OMEGA_PLUS_LDFLAGS="-L$with_omega_plus_prefix/lib"
235         fi
236         OMEGA_PLUS_LIBS="-lomega"
237         AC_DEFINE(HAVE_OMEGA_PLUS,[],[use Omega+])
238         have_omega_plus=true
239         ;;
240 esac
242 AC_SUBST(extra_bin_programs)
243 AC_SUBST(extra_noinst_programs)
244 AC_SUBST(extra_test)
246 AC_SUBST(NTL_CPPFLAGS)
247 AC_ARG_WITH(ntl_prefix,
248         [AS_HELP_STRING([--with-ntl-prefix=DIR],[Installation prefix of NTL])])
249 if test "x$with_ntl_prefix" != "x"; then
250         NTL_CPPFLAGS="-I$with_ntl_prefix/include"
251         isa_configure_args="$isa_configure_args --with-ntl=$with_ntl_prefix"
254 AX_SUBMODULE(vcsn,system|no,system)
255 AC_SUBST(VCSN_CFLAGS)
256 AC_SUBST(VCSN_LDFLAGS)
257 if test "x$with_vcsn_prefix" != "x"; then
258         VCSN_CFLAGS="-I$with_vcsn_prefix/include"
259         VCSN_LDFLAGS="-L$with_vcsn_prefix/lib"
261 if test "x$with_vcsn" != "xno"; then
262         SAVE_LDFLAGS="$LDFLAGS"
263         LDFLAGS="$VCSN_LDFLAGS $LDFLAGS"
264         AC_CHECK_LIB(vcsn-common, main, [with_vcsn=yes])
265         LDFLAGS="$SAVE_LDFLAGS"
268 if test "$with_vcsn" = "yes"; then
269     extra_noinst_programs="$extra_noinst_programs eqv2\$(EXEEXT)"
272 if test "$with_barvinok" = "bundled"; then
273         barvinok_CFLAGS="-I\$(top_builddir)/barvinok/ -I\$(top_srcdir)/barvinok"
274 else
275         if test "x$with_barvinok_prefix" != "x"; then
276                 export PKG_CONFIG_PATH="$with_barvinok_prefix/lib/pkgconfig${PKG_CONFIG_PATH+:$PKG_CONFIG_PATH}"
277         fi
278         PKG_PROG_PKG_CONFIG
279         PKG_CHECK_MODULES([barvinok], [barvinok])
281 AM_CONDITIONAL(BUNDLED_BARVINOK, test $with_barvinok = bundled)
283 if test "$have_suif" = "true" -a "$have_omega_plus" = true; then
284     extra_bin_programs="$extra_bin_programs pers\$(EXEEXT)"
287 if test "$have_suif" = true -a "$have_omega_plus" = true; then
288     extra_bin_programs="$extra_bin_programs sloog\$(EXEEXT)"
291 AC_SUBST(ISL_CPPFLAGS)
292 AC_SUBST(ISL_LIBS)
293 if test "$with_isl" = "bundled"; then
294         ISL_CPPFLAGS="-I\$(top_srcdir)/isl/include -I\$(top_builddir)/isl/include"
295         isa_configure_args="$isa_configure_args --with-isl-builddir=../isl"
296 else
297         ISL_LIBS="-lisl"
298         if test "x$with_isl_prefix" != "x"; then
299                 ISL_CPPFLAGS="$CPPFLAGS -I$with_isl_prefix/include"
300                 LDFLAGS="$LDFLAGS -L$with_isl_prefix/lib"
301         fi
302         isa_configure_args="$isa_configure_args --with-isl=system"
304 AM_CONDITIONAL(BUNDLED_ISL, test $with_isl = bundled)
306 AC_ARG_WITH(libxml2,
307         [  --with-libxml2=DIR   ])
309 if test "x$with_libxml2" != "x"; then
310         export PKG_CONFIG_PATH="$with_libxml2/lib/pkgconfig${PKG_CONFIG_PATH+:$PKG_CONFIG_PATH}"
313 if test "x$with_libxml2" != "xno"; then
314         PKG_PROG_PKG_CONFIG
315         PKG_CHECK_MODULES(libxml2, libxml-2.0)
316         extra_bin_programs="$extra_bin_programs pn2adg\$(EXEEXT)"
317         if test "x$with_pet" != "xno"; then
318                 extra_test="$extra_test pn2adg\$(EXEEXT)"
319         fi
322 AC_SUBST(GIT_HEAD_ID)
323 AC_SUBST(GIT_HEAD)
324 AC_SUBST(GIT_HEAD_VERSION)
325 if test -f $srcdir/.git/HEAD; then
326     GIT_HEAD="$srcdir/.git/index"
327     GIT_REPO="$srcdir/.git"
328     GIT_HEAD_ID=`GIT_DIR=$GIT_REPO git describe`
329 elif test -f $srcdir/GIT_HEAD_ID; then
330     GIT_HEAD_ID=`cat $srcdir/GIT_HEAD_ID`
331 else
332     mysrcdir=`(cd $srcdir; pwd)`
333     head=`basename $mysrcdir | sed -e 's/.*-//'`
334     head2=`echo $head | sed -e 's/[^0-9a-f]//'`
335     head3=`echo $head2 | sed -e 's/........................................//'`
336     if test "x$head3" = "x" -a "x$head" = "x$head2"; then
337         GIT_HEAD_ID="$head"
338     else
339         GIT_HEAD_ID="UNKNOWN"
340     fi
342 if test -z "$GIT_REPO" ; then
343     GIT_HEAD_VERSION="$GIT_HEAD_ID"
344 else
345     GIT_HEAD_VERSION="\`GIT_DIR=$GIT_REPO git describe\`"
347 echo '#define GIT_HEAD_ID "'$GIT_HEAD_ID'"' > gitversion.h
349 AC_CONFIG_HEADERS(config.h)
350 AC_CONFIG_FILES(Makefile tests/Makefile)
351 AC_CONFIG_FILES([c2pdg_suif], [chmod +x c2pdg_suif])
352 if test $with_isl = bundled; then
353     AC_CONFIG_SUBDIRS(isl)
355 if test $with_pet = bundled; then
356     AC_CONFIG_SUBDIRS(pet)
358 if test $with_cloog = bundled; then
359     AC_CONFIG_SUBDIRS(cloog)
361 if test $with_barvinok = bundled; then
362     AC_CONFIG_SUBDIRS(barvinok)
364 AC_CONFIG_COMMANDS_POST([
365         dnl pass on arguments to subdir configures, but don't
366         dnl add them to config.status
367         ac_configure_args="$ac_configure_args $isa_configure_args --with-bits=gmp --without-piplib"
369 AC_OUTPUT