update isl for plug for isl_map_simple_hull memory leak
[cloog.git] / configure.in
blobc73762a40c20337e3ca01205c62e7fd71717dcf9
2 dnl /**-------------------------------------------------------------------**
3 dnl  **                              CLooG                                **
4 dnl  **-------------------------------------------------------------------**
5 dnl  **                           configure.in                            **
6 dnl  **-------------------------------------------------------------------**
7 dnl  **                   First version: august 7th 2002                  **
8 dnl  **-------------------------------------------------------------------**/
9 dnl
10 dnl Input file for autoconf to build a configuration shellscript.
11 dnl To build the configure script from the CLooG's top-level directory, use
12 dnl autoconf -l autoconf autoconf/configure.in > configure
13 dnl if it doesn't work (invalid option -l) try -I instead
14 dnl autoconf -I autoconf autoconf/configure.in > configure
16 dnl /**************************************************************************
17 dnl *               CLooG : the Chunky Loop Generator (experimental)          *
18 dnl ***************************************************************************
19 dnl *                                                                         *
20 dnl * Copyright (C) 2001 Cedric Bastoul                                       *
21 dnl *                                                                         *
22 dnl * This is free software; you can redistribute it and/or modify it under   *
23 dnl * the terms of the GNU General Public License as published by the Free    *
24 dnl * Software Foundation; either version 2 of the License, or (at your       *
25 dnl * option) any later version.                                              *
26 dnl *                                                                         *
27 dnl * This software is distributed in the hope that it will be useful, but    *
28 dnl * WITHOUT ANY WARRANTY; without even the implied warranty of              *
29 dnl * MERCHANTABILITYor FITNESS FOR A PARTICULAR PURPOSE.  See the GNU        *
30 dnl * General Public License for more details.                                *
31 dnl *                                                                         *
32 dnl * You should have received a copy of the GNU General Public License along *
33 dnl * with software; if not, write to the Free Software Foundation, Inc.,     *
34 dnl * 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA                  *
35 dnl *                                                                         *
36 dnl * CLooG, the Chunky Loop Generator                                        *
37 dnl * Written by Cedric Bastoul, Cedric.Bastoul@inria.fr                      *
38 dnl *                                                                         *
39 dnl ***************************************************************************/
41 AC_PREREQ(2.13)
42 AC_INIT(source/cloog.c)
43 AC_CONFIG_AUX_DIR(autoconf)
44 AM_INIT_AUTOMAKE(cloog, 0.14.0)
45 dnl default version
46 BITS="64"
48 dnl /**************************************************************************
49 dnl  *                              Checking                                  *
50 dnl  **************************************************************************/
52 dnl Checks for programs.
53 AC_PROG_CC
54 AC_PROG_LN_S
55 AC_PROG_MAKE_SET
56 AC_CHECK_PROG(CD, cd)
57 dnl Configure needs an empty install.sh file with this, i HATE that...
58 AC_PROG_INSTALL
59 AC_PROG_LIBTOOL
60 AC_CHECK_PROG(TEXI2DVI, texi2dvi, texi2dvi, [])
61 AM_CONDITIONAL(HAVE_TEXI2DVI, test -n "$TEXI2DVI")
63 CFLAGS="-fomit-frame-pointer"
65 dnl Checks for typedefs, structures, and compiler characteristics.
66 AC_C_CONST
67 AC_TYPE_SIZE_T
71 dnl Checks for header files.
72 AC_HEADER_STDC
75 dnl Checks for library functions.
76 AC_CHECK_FUNCS(strtol)
79 dnl /**************************************************************************
80 dnl  *                             Option setting                             *
81 dnl  **************************************************************************/
83 MP_BITS="MP"
84 MP_DFLAGS=-DLINEAR_VALUE_IS_MP
86 AC_ARG_WITH(bits,
87             [AS_HELP_STRING([--with-bits=32|64|gmp],
88                             [integer type to use])],
89             [ BITS=$withval ])
91 AX_SUBMODULE(isl,no|system|build|bundled,no)
92 if test "$with_isl" != "no"; then
93         BITS="gmp"
96 dnl /**************************************************************************
97 dnl  *                            Where is GMP?                               *
98 dnl  **************************************************************************/
100 gmp_module_default=no
101 if test "$BITS" = "gmp"; then
102         gmp_module_default=system
104 AX_SUBMODULE(gmp,no|system,$gmp_module_default)
106 need_get_memory_functions=false
107 case "$with_gmp" in
108 system)
109     if test "x$with_gmp_prefix" != "x"; then
110         CPPFLAGS="-I$with_gmp_prefix/include $CPPFLAGS"
111     fi
112     
113     if test "$with_gmp_exec_prefix" != "yes" ; then
114         LDFLAGS="-L$with_gmp_exec_prefix/lib $LDFLAGS"
115     fi
116      
117     AC_CHECK_HEADER(gmp.h,
118                     [],
119                     [AC_MSG_ERROR(Can't find gmp headers.)])
120     AC_CHECK_LIB(gmp,
121                  __gmpz_init,
122                  [LIBS="$LIBS -lgmp"],
123                  [AC_MSG_ERROR(Can't find gmp library.)])
124     AC_CHECK_DECLS(mp_get_memory_functions,[],[
125             need_get_memory_functions=true
126     ],[#include <gmp.h>])
127     ;;
128 esac
129 AM_CONDITIONAL(NEED_GET_MEMORY_FUNCTIONS,
130                 test x$need_get_memory_functions = xtrue)
132 # all compiled libraries
133 CLOOG_LIBRARIES=""
134 AC_SUBST(CLOOG_LIBRARIES)
135 # backend used by executables
136 BACKEND=""
137 AC_SUBST(BACKEND)
139 dnl /**************************************************************************
140 dnl  *                          Where is PolyLib?                             *
141 dnl  **************************************************************************/
143 AX_SUBMODULE(polylib,no|system|build,system)
145 polylibs="64 32"
146 case "$BITS" in
147     32|64|gmp)
148         polylibs=$BITS
149     ;;
150 esac
152 dnl Checking for PolyLib
153 AC_SUBST(cl_cv_polylib)
154 AC_SUBST(POLYLIB_CPPFLAGS)
155 AC_SUBST(POLYLIB_LDFLAGS)
156 AC_SUBST(POLYLIB_LIBS)
158 AC_MSG_CHECKING(for location of PolyLib)
159 if test "x$with_polylib_builddir" != "x"; then
160         with_polylib_builddir=`cd $with_polylib_builddir; pwd`
161         AC_MSG_RESULT(built in $with_polylib_builddir)
162         polylib_polylibs=`echo @polylibs@ | $with_polylib_builddir/config.status --file=-`
163         AC_MSG_NOTICE(Configured polylibs: $polylib_polylibs)
164         POLYLIB_CPPFLAGS="-I$with_polylib_builddir/include -I$polylib_srcdir/include"
165         for BITS in $polylibs; do
166                 cl_cv_polylib=missing
167                 for PL in $polylib_polylibs; do
168                         if test "libpolylib$BITS.la" = $PL; then
169                                 cl_cv_polylib="polylib$BITS"
170                                 break;
171                         fi
172                 done
173                 if test "$cl_cv_polylib" != "missing"; then
174                         POLYLIB_LIBS="$with_polylib_builddir/lib$cl_cv_polylib.la"
175                         break;
176                 fi
177         done
178 else
179         if test "x$with_polylib_prefix" != "x"; then
180                 with_polylib_prefix=`cd $with_polylib_prefix; pwd`
181                 AC_MSG_RESULT(installed in $with_polylib_exec_prefix)
182                 POLYLIB_CPPFLAGS="-I$with_polylib_prefix/include"
183                 POLYLIB_LDFLAGS="-L$with_polylib_exec_prefix/lib"
184                 LD_LIBRARY_PATH="$with_polylib_exec_prefix/lib:$LD_LIBRARY_PATH"
185                 export LD_LIBRARY_PATH
186         else
187                 AC_MSG_RESULT(installed in standard location)
188         fi
189         SAVE_CPPFLAGS="$CPPFLAGS"
190         SAVE_LDFLAGS="$LDFLAGS"
191         CPPFLAGS="$POLYLIB_CPPFLAGS $CPPFLAGS"
192         LDFLAGS="$POLYLIB_LDFLAGS $LDFLAGS"
193         for BITS in $polylibs; do
194                 cl_cv_polylib="polylib$BITS"
195                 AC_CHECK_HEADER(polylib/$cl_cv_polylib.h,[
196                         AC_CHECK_LIB($cl_cv_polylib,PolyhedronTSort,[
197                                 POLYLIB_LIBS="-l$cl_cv_polylib"
198                                 break
199                         ])
200                 ])
201                 cl_cv_polylib=missing
202         done
203         CPPFLAGS="$SAVE_CPPFLAGS"
204         LDFLAGS="$SAVE_LDFLAGS"
206 if test "$cl_cv_polylib" = "missing"; then
207         AC_MSG_WARN(Can't find PolyLib.)
208 else
209         CLOOG_LIBRARIES="$CLOOG_LIBRARIES libcloog-polylib.la"
210         BACKEND="polylib"
213 dnl /**************************************************************************
214 dnl  *                          Where is isl?                                 *
215 dnl  **************************************************************************/
217 AC_SUBST(ISL_CPPFLAGS)
218 AC_SUBST(ISL_LDFLAGS)
219 AC_SUBST(ISL_LIBS)
220 case "$with_isl" in
221 bundled)
222         ISL_CPPFLAGS="-I$srcdir/isl/include -Iisl/include"
223         ;;
224 build)
225         ISL_CPPFLAGS="-I$isl_srcdir/include -I$with_isl_builddir/include"
226         ISL_LIBS="$with_isl_builddir/libisl.la"
227         ;;
228 system)
229         if test "x$with_isl_prefix" != "x"; then
230                 ISL_CPPFLAGS="-I$with_isl_prefix/include"
231         fi
232         if test "x$with_isl_exec_prefix" != "x"; then
233                 ISL_LDFLAGS="-L$with_isl_exec_prefix/lib"
234         fi
235         ISL_LIBS="-lisl"
236 esac
237 if test "$with_isl" != "no"; then
238         CLOOG_LIBRARIES="$CLOOG_LIBRARIES libcloog-isl.la"
239         BACKEND="isl"
241 AM_CONDITIONAL(BUNDLED_ISL, test $with_isl = bundled)
243 if test -z "$BACKEND"; then
244         AC_MSG_ERROR(No backend specified or found.)
248 case "$BITS" in
249         gmp)
250                 cl_cv_int_type=gmp
251                 ;;
252         32|64)
253                 AC_CHECK_SIZEOF(int,1)
254                 AC_CHECK_SIZEOF(long,1)
255                 AC_CHECK_SIZEOF(long long,1)
256                 for cl_cv_int_type in int long long_long; do
257                         eval "bits=\`expr \$ac_cv_sizeof_$cl_cv_int_type \* 8\`"
258                         if test "$bits" = "$BITS"; then
259                                 break
260                         fi
261                 done
262                 ;;
263 esac
264 AC_DEFINE_UNQUOTED(AS_TR_CPP(CLOOG_INT_$cl_cv_int_type))
266 AC_SUBST(GIT_INDEX)
267 if test -f $srcdir/.git/HEAD; then
268         GIT_INDEX="\$(top_srcdir)/.git/index"
272 dnl /**************************************************************************
273 dnl  *                            Substitutions                               *
274 dnl  **************************************************************************/
277 dnl Substitutions to do in Makefile.in.
278 AC_SUBST(target)
279 AC_SUBST(CC)
280 AC_SUBST(LN_S)
281 AC_SUBST(SHEXT)
283 AC_SUBST(prefix)
284 AC_SUBST(exec_prefix)
285 AC_SUBST(INSTALL)
287 AC_SUBST(BITS)
289 AC_CONFIG_HEADERS(config.h)
290 AC_CONFIG_HEADERS(include/cloog/int.h)
291 AC_CONFIG_FILES(Makefile test/Makefile include/cloog/polylib/backend.h)
292 AC_CONFIG_FILES(autoconf/Doxyfile)
293 AC_CONFIG_FILES(doc/Makefile)
294 AC_CONFIG_FILES(source/version.c)
295 AC_CONFIG_FILES([genversion.sh], [chmod +x genversion.sh])
296 AC_CONFIG_COMMANDS([version.h],
297         [echo '#define CLOOG_HEAD "'`./genversion.sh`'"' > version.h])
298 AC_CONFIG_COMMANDS([doc/gitversion.texi],
299         [echo '@set VERSION '`./genversion.sh`'' > doc/gitversion.texi])
300 if test $with_isl = bundled; then
301         AC_CONFIG_SUBDIRS(isl)
303 AC_CONFIG_COMMANDS_POST([
304         old_args=""
305         for arg in $ac_configure_args; do
306                 case arg in
307                 --with-polylib*)
308                         ;;
309                 *)
310                         old_args="$old_args $arg"
311                         ;;
312                 esac
313         done
314         ac_configure_args="$old_args $cloog_configure_args"
316 AC_OUTPUT
319 echo "             /*-----------------------------------------------*"
320 echo "              *           CLooG configuration is OK           *"
321 echo "              *-----------------------------------------------*/"
322 echo "It appears that your system is OK to start CLooG compilation. You need"
323 echo "now to type \"make\". After compilation, you should check CLooG by typing"
324 echo "\"make check\". If no problem occur, you can type \"make uninstall\" if"
325 echo "you are upgrading an old version. Lastly type \"make install\" to install"
326 echo "CLooG on your system (log as root if necessary)."