README: rename
[ppn.git] / configure.ac
blob735c9943b45439ff8330ef5b67924b0c5150b782
1 AC_INIT
2 AC_CONFIG_MACRO_DIR([m4])
3 AM_INIT_AUTOMAKE(isa, 0.13)
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(memrchr)
12 AC_REPLACE_FUNCS(strndup)
14 use_size_simulate=false
15 AC_CHECK_HEADER([sys/wait.h],[
16         AC_CHECK_HEADER([dlfcn.h], [
17                 use_size_simulate=true
18                 AC_DEFINE(USE_SIZE_SIMULATE, [],
19                  [use simulation based size computation (requires dynamic loading)])
20         ])])
21 AM_CONDITIONAL(USE_SIZE_SIMULATE, test x$use_size_simulate = xtrue)
23 AX_SUBMODULE(libyaml,system,system)
24 AC_SUBST(LIBYAML_CPPFLAGS)
25 AC_SUBST(LIBYAML_LDFLAGS)
26 if test "x$with_libyaml_prefix" != "x"; then
27         LIBYAML_CPPFLAGS="-I$with_libyaml_prefix/include"
29 if test "x$with_libyaml_exec_prefix" != "x"; then
30         LIBYAML_LDFLAGS="-L$with_libyaml_exec_prefix/lib"
33 AC_LANG(C++)
35 AC_ARG_WITH(syck,
36         [  --with-syck=DIR   ])
38 AC_SUBST(syck_CFLAGS)
39 AC_SUBST(syck_LIBS)
40 syck_LIBS="-lsyck"
41 if test "x$with_syck" != "x"; then
42         syck_CFLAGS="-I$with_syck/include"
43         syck_LDFLAGS="-L$with_syck/lib"
44         syck_LIBS="$syck_LDFLAGS -lsyck"
46 CPPFLAGS="$CPPFLAGS $syck_CFLAGS"
48 SAVE_LDFLAGS="$LDFLAGS"
49 LDFLAGS="$syck_LDFLAGS $LDFLAGS"
50 AC_CHECK_HEADER(syck.h,[],[AC_MSG_ERROR(Can't find syck headers.)])
51 AC_CHECK_LIB(syck,syck_parser_bad_anchor_handler,[ true ],[AC_MSG_ERROR(Can't find appropriate syck.)])
52 LDFLAGS="$SAVE_LDFLAGS"
54 AX_SUBMODULE(barvinok,bundled|system,bundled)
56 AX_SUBMODULE(isl,bundled|system,bundled)
58 AX_SUBMODULE(pet,bundled|system|no,bundled)
59 AM_CONDITIONAL(BUNDLED_PET, test $with_pet = bundled)
61 AC_SUBST(PET_CFLAGS)
62 AC_SUBST(PET_LIBS)
63 case "$with_pet" in
64 bundled)
65         PET_CFLAGS="$PET_CFLAGS -I\$(top_srcdir)/pet/include"
66         isa_configure_args="$isa_configure_args --with-pet-builddir=../pet"
67         isa_configure_args="$isa_configure_args --with-clang=system"
68         AC_DEFINE(HAVE_PET,[],[use Pet])
69         ;;
70 system)
71         PKG_CHECK_MODULES([PET], [pet])
72         AC_DEFINE(HAVE_PET,[],[use Pet])
73 esac
75 if test "x$with_pet" != "xno"; then
76         extra_bin_programs="$extra_bin_programs c2pdg\$(EXEEXT) pdg2c\$(EXEEXT)"
79 AX_SUBMODULE(omega-plus,no|system,no)
80 AC_SUBST(OMEGA_PLUS_CFLAGS)
81 AC_SUBST(OMEGA_PLUS_LDFLAGS)
82 AC_SUBST(OMEGA_PLUS_LIBS)
83 have_omega_plus=false
84 case "$with_omega_plus" in
85 system)
86         if test "x$with_omega_plus_prefix" != "x"; then
87                 OMEGA_PLUS_CFLAGS="-I$with_omega_plus_prefix/include/omega"
88                 OMEGA_PLUS_LDFLAGS="-L$with_omega_plus_prefix/lib"
89         fi
90         OMEGA_PLUS_LIBS="-lomega"
91         AC_DEFINE(HAVE_OMEGA_PLUS,[],[use Omega+])
92         have_omega_plus=true
93         ;;
94 esac
96 AC_SUBST(extra_bin_programs)
97 AC_SUBST(extra_noinst_programs)
98 AC_SUBST(extra_test)
100 AC_SUBST(NTL_CPPFLAGS)
101 AC_ARG_WITH(ntl_prefix,
102         [AS_HELP_STRING([--with-ntl-prefix=DIR],[Installation prefix of NTL])])
103 if test "x$with_ntl_prefix" != "x"; then
104         NTL_CPPFLAGS="-I$with_ntl_prefix/include"
105         isa_configure_args="$isa_configure_args --with-ntl=$with_ntl_prefix"
108 AX_SUBMODULE(vcsn,system|no,system)
109 AC_SUBST(VCSN_CFLAGS)
110 AC_SUBST(VCSN_LDFLAGS)
111 if test "x$with_vcsn_prefix" != "x"; then
112         VCSN_CFLAGS="-I$with_vcsn_prefix/include"
113         VCSN_LDFLAGS="-L$with_vcsn_prefix/lib"
115 if test "x$with_vcsn" != "xno"; then
116         SAVE_LDFLAGS="$LDFLAGS"
117         LDFLAGS="$VCSN_LDFLAGS $LDFLAGS"
118         AC_CHECK_LIB(vcsn-common, main, [with_vcsn=yes])
119         LDFLAGS="$SAVE_LDFLAGS"
122 if test "$with_vcsn" = "yes"; then
123     extra_noinst_programs="$extra_noinst_programs eqv2\$(EXEEXT)"
126 if test "$with_barvinok" = "bundled"; then
127         barvinok_CFLAGS="-I\$(top_builddir)/barvinok/ -I\$(top_srcdir)/barvinok"
128 else
129         if test "x$with_barvinok_prefix" != "x"; then
130                 export PKG_CONFIG_PATH="$with_barvinok_prefix/lib/pkgconfig${PKG_CONFIG_PATH+:$PKG_CONFIG_PATH}"
131         fi
132         PKG_PROG_PKG_CONFIG
133         PKG_CHECK_MODULES([barvinok], [barvinok])
135 AM_CONDITIONAL(BUNDLED_BARVINOK, test $with_barvinok = bundled)
137 AC_SUBST(ISL_CPPFLAGS)
138 AC_SUBST(ISL_LIBS)
139 if test "$with_isl" = "bundled"; then
140         ISL_CPPFLAGS="-I\$(top_srcdir)/isl/include -I\$(top_builddir)/isl/include"
141         isa_configure_args="$isa_configure_args --with-isl-builddir=../isl"
142 else
143         ISL_LIBS="-lisl"
144         if test "x$with_isl_prefix" != "x"; then
145                 ISL_CPPFLAGS="$CPPFLAGS -I$with_isl_prefix/include"
146                 LDFLAGS="$LDFLAGS -L$with_isl_prefix/lib"
147         fi
148         isa_configure_args="$isa_configure_args --with-isl=system"
150 ISL_CPPFLAGS="$ISL_CPPFLAGS"
151 AM_CONDITIONAL(BUNDLED_ISL, test $with_isl = bundled)
153 AC_ARG_WITH(libxml2,
154         [  --with-libxml2=DIR   ])
156 if test "x$with_libxml2" != "x"; then
157         export PKG_CONFIG_PATH="$with_libxml2/lib/pkgconfig${PKG_CONFIG_PATH+:$PKG_CONFIG_PATH}"
160 if test "x$with_libxml2" != "xno"; then
161         PKG_PROG_PKG_CONFIG
162         PKG_CHECK_MODULES(libxml2, libxml-2.0)
163         extra_bin_programs="$extra_bin_programs pn2adg\$(EXEEXT)"
164         if test "x$with_pet" != "xno"; then
165                 extra_test="$extra_test pn2adg.test\$(EXEEXT)"
166         fi
169 AC_SUBST(GIT_HEAD_ID)
170 AC_SUBST(GIT_HEAD)
171 AC_SUBST(GIT_HEAD_VERSION)
172 if test -f $srcdir/.git/HEAD; then
173     GIT_HEAD="$srcdir/.git/index"
174     GIT_REPO="$srcdir/.git"
175     GIT_HEAD_ID=`GIT_DIR=$GIT_REPO git describe`
176 elif test -f $srcdir/GIT_HEAD_ID; then
177     GIT_HEAD_ID=`cat $srcdir/GIT_HEAD_ID`
178 else
179     mysrcdir=`(cd $srcdir; pwd)`
180     head=`basename $mysrcdir | sed -e 's/.*-//'`
181     head2=`echo $head | sed -e 's/[^0-9a-f]//'`
182     head3=`echo $head2 | sed -e 's/........................................//'`
183     if test "x$head3" = "x" -a "x$head" = "x$head2"; then
184         GIT_HEAD_ID="$head"
185     else
186         GIT_HEAD_ID="UNKNOWN"
187     fi
189 if test -z "$GIT_REPO" ; then
190     GIT_HEAD_VERSION="$GIT_HEAD_ID"
191 else
192     GIT_HEAD_VERSION="\`GIT_DIR=$GIT_REPO git describe\`"
194 echo '#define GIT_HEAD_ID "'$GIT_HEAD_ID'"' > gitversion.h
196 AC_CONFIG_HEADERS(config.h)
197 AC_CONFIG_FILES(Makefile tests/Makefile)
198 if test $with_isl = bundled; then
199     AC_CONFIG_SUBDIRS(isl)
201 if test $with_pet = bundled; then
202     AC_CONFIG_SUBDIRS(pet)
204 if test $with_barvinok = bundled; then
205     AC_CONFIG_SUBDIRS(barvinok)
207 AC_CONFIG_COMMANDS_POST([
208         dnl pass on arguments to subdir configures, but don't
209         dnl add them to config.status
210         ac_configure_args="$ac_configure_args $isa_configure_args"
212 AC_OUTPUT