don't use memory tracking for matrix alloc
[cloog-ppl.git] / configure.in
blob698d9f6094a03f21e5bfd39f2401f188e503cb2b
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
62 dnl Checks for typedefs, structures, and compiler characteristics.
63 AC_C_CONST
64 AC_TYPE_SIZE_T
68 dnl Checks for header files.
69 AC_HEADER_STDC
72 dnl Checks for library functions.
73 AC_CHECK_FUNCS(strtol)
76 dnl /**************************************************************************
77 dnl  *                             Option setting                             *
78 dnl  **************************************************************************/
80 dnl Some default values cause I'm not sure whether autoconf set them, while
81 dnl documentation says it does...
82 gmp_package="yes"
83 gmp_include_package="yes"
84 gmp_library_package="yes"
86 MP_BITS="MP"
87 MP_DFLAGS=-DLINEAR_VALUE_IS_MP
88 NEED_MP="no"
90 dnl --with-ppl=ppl-path
91 AC_ARG_WITH(ppl,
92             [AS_HELP_STRING([--with-ppl=DIR],
93                             [Prefix of Parma Polyhedral Library installation])])
95 dnl --with-polylib=polylib-path
96 AC_ARG_WITH(polylib_prefix,
97             [AS_HELP_STRING([--with-polylib-prefix=DIR],
98                             [Prefix of PolyLib installation])])
99 AC_ARG_WITH(polylib_exec_prefix,
100             [AS_HELP_STRING([--with-polylib-exec-prefix=DIR],
101                             [Exec prefix of PolyLib installation])])
102 AC_ARG_WITH(polylib_builddir,
103             [AS_HELP_STRING([--with-polylib-builddir=DIR],
104                             [Location of PolyLib builddir])])
105 AC_ARG_WITH(bits,
106             [  --with-bits=32|64|gmp   PolyLib library type to use],
107             [ echo "polylib$withval"; BITS=$withval ])
109 dnl --with-gmp=gmp-path
110 AC_ARG_WITH(gmp,
111         [  --with-gmp=DIR          DIR where the gmp package is installed],
112         [ echo "Package gmp : $withval" &&
113           gmp_package=$withval &&
114           GMP_INC=$gmp_package/include &&
115           GMP_LIB=$gmp_package/lib &&
116           NEED_MP="yes"])
118 AC_ARG_WITH(gmp-include,
119         [  --with-gmp-include=DIR  DIR where gmp.h is installed],
120         [ echo "Package gmp-include : $withval" &&
121           gmp_include_package=$withval &&
122           GMP_INC=$gmp_include_package &&
123           NEED_MP="yes"])
125 AC_ARG_WITH(gmp-library,
126         [  --with-gmp-library=DIR  DIR where the gmp library is installed],
127         [ echo "Package gmp-library : $withval" &&
128           gmp_library_package=$withval &&
129           GMP_LIB=$gmp_library_package &&
130           NEED_MP="yes"])
133 dnl /**************************************************************************
134 dnl  *                            Where is GMP?                               *
135 dnl  **************************************************************************/
138 dnl Checking for gmp
139 AC_MSG_CHECKING(whether gmp works)
140 if test "$gmp_package" = "no"; then
141   echo "GMP package not defined"
142   AC_MSG_RESULT(no)
143   TO_BUILD_MP=""
144 else
145   if test "$NEED_MP" = "no"; then
146     echo "Mode normal GMP"
147     TO_BUILD="$TO_BUILD MP"
148     AC_CHECK_HEADER(gmp.h,
149                     [AC_CHECK_LIB(gmp,
150                                   __gmpz_init,
151                                   [LIBS="$LIBS -lgmp"],
152                                   [echo "Can't find gmp library." &&
153                                    echo "MP version will not be builded." &&
154                                    TO_BUILD_MP=""])],
155                     [echo "Can't find gmp headers." &&
156                      echo "MP version will not be builded." &&
157                      TO_BUILD_MP=""])
158   else
159     dnl Default given by --with-X is "yes", --without-X is "no". We also
160     dnl initialized manually all gmp_package* variables to "yes" (thus they are
161     dnl supposed to be "yes" except if the user set them himself).
162     
163     if test "$gmp_package" != "yes" ; then
164       echo "(GMP path has been set by user)"
165       GMP_DIR=$gmp_package
166       dnl Useful for AC_CHECK_X to find what we want.
167       CPPFLAGS="-I$GMP_DIR/include $CPPFLAGS"
168       LDFLAGS="-L$GMP_DIR/lib $LDFLAGS"
169     fi
170     
171     if test "$gmp_include_package" != "yes" ; then
172       CPPFLAGS="-I$GMP_INC $CPPFLAGS"
173     fi
174     
175     if test "$gmp_library_package" != "yes" ; then
176       LDFLAGS="-L$GMP_LIB $LDFLAGS"
177     fi
178      
179     AC_CHECK_HEADER(gmp.h,
180                     [],
181                     [AC_MSG_ERROR(Can't find gmp headers.)])
182     AC_CHECK_LIB(gmp,
183                  __gmpz_init,
184                  [LIBS="$LIBS -lgmp"],
185                  [AC_MSG_ERROR(Can't find gmp library.)])
186     
187     AC_MSG_RESULT(yes)
188   fi
191 dnl /**************************************************************************
192 dnl  *                          Where is PolyLib?                             *
193 dnl  **************************************************************************/
195 polylibs="64 32"
196 case "$BITS" in
197     32|64|gmp)
198         polylibs=$BITS
199     ;;
200 esac
202 dnl Checking for PolyLib
203 AC_SUBST(cl_cv_polylib)
204 AC_SUBST(POLYLIB_CPPFLAGS)
205 AC_SUBST(POLYLIB_LDFLAGS)
206 AC_SUBST(POLYLIB_LIBS)
208 if test "x$with_polylib_prefix" != "x" -a "x$with_polylib_exec_prefix" = "x"
209 then
210         with_polylib_exec_prefix=$with_polylib_prefix
212 if test "x$with_polylib_prefix" != "x" -a "x$with_polylib_builddir" != "x"; then
213         AC_MSG_ERROR(
214         [--with-polylib-prefix and --with-polylib-builddir are mutually exclusive])
217 AC_MSG_CHECKING(for location of PolyLib)
218 if test "x$with_polylib_builddir" != "x"; then
219         AC_MSG_RESULT(built in $with_polylib_builddir)
220         polylib_srcdir=`echo @srcdir@ | $with_polylib_builddir/config.status --file=-`
221         AC_MSG_NOTICE(PolyLib sources in $polylib_srcdir)
222         polylib_polylibs=`echo @polylibs@ | $with_polylib_builddir/config.status --file=-`
223         AC_MSG_NOTICE(Configured polylibs: $polylib_polylibs)
224         CPPFLAGS="-I$with_polylib_builddir/include -I$polylib_srcdir/include $CPPFLAGS"
225         for BITS in $polylibs; do
226                 cl_cv_polylib=missing
227                 for PL in $polylib_polylibs; do
228                         if test "libpolylib$BITS.la" = $PL; then
229                                 cl_cv_polylib="polylib$BITS"
230                                 break;
231                         fi
232                 done
233                 if test "$cl_cv_polylib" != "missing"; then
234                         LIBS="$with_polylib_builddir/lib$cl_cv_polylib.la $LIBS"
235                         break;
236                 fi
237         done
238 else
239         if test "x$with_polylib_prefix" != "x"; then
240                 AC_MSG_RESULT(installed in $with_polylib_exec_prefix)
241                 CPPFLAGS="-I$with_polylib_prefix/include $CPPFLAGS"
242                 LDFLAGS="-L$with_polylib_exec_prefix/lib $LDFLAGS"
243                 LD_LIBRARY_PATH="$with_polylib_exec_prefix/lib:$LD_LIBRARY_PATH"
244                 export LD_LIBRARY_PATH
245         else
246                 AC_MSG_RESULT(installed in standard location)
247         fi
248         for BITS in $polylibs; do
249                 cl_cv_polylib="polylib$BITS"
250                 AC_CHECK_LIB($cl_cv_polylib,PolyhedronTSort,[
251                         LIBS="-l$cl_cv_polylib $LIBS"
252                         break
253                 ])
254                 cl_cv_polylib=missing
255         done
257 if test "$cl_cv_polylib" = "missing"; then
258         AC_MSG_RESULT(Can't find PolyLib.)
259 else
260         AC_CHECK_HEADER(polylib/$cl_cv_polylib.h,[],
261                         [AC_MSG_ERROR(Can't find PolyLib headers.)])
264 AC_SUBST(GIT_INDEX)
265 if test -f $srcdir/.git/HEAD; then
266         GIT_INDEX="\$(top_srcdir)/.git/index"
270 dnl /**************************************************************************
271 dnl  *                     Where is Parma Polyhedral Library?                 *
272 dnl  **************************************************************************/
274 # The default back-end for polyhedral operations is PolyLib, unless
275 # -with-ppl is used.
276 AC_SUBST(POLYHEDRAL_BACKEND)
277 POLYHEDRAL_BACKEND=polylib
279 dnl Checking for PPL
280 AC_SUBST(PPL_CPPFLAGS)
281 AC_SUBST(PPL_LDFLAGS)
282 AC_SUBST(PPL_LIBS)
285 AC_MSG_CHECKING(for Parma Polyhedral Library (PPL))
286 if test "x$with_ppl" != "x"; then
288         if test "x$with_polylib_prefix" != "x" -o "x$with_polylib_exec_prefix" != "x" -o "x$with_polylib_builddir" != "x"; then
289                 AC_MSG_ERROR([--with-polylib and --with-ppl are mutually exclusive])
290         fi
292         AC_MSG_RESULT(installed in $with_ppl)
293         POLYHEDRAL_BACKEND=ppl
294         CPPFLAGS="-I$with_ppl/include -DCLOOG_PPL_BACKEND $CPPFLAGS"
295         LDFLAGS="-L$with_ppl/lib $LDFLAGS"
296         LD_LIBRARY_PATH="$with_ppl/lib:$LD_LIBRARY_PATH"
297         export LD_LIBRARY_PATH
298         AC_CHECK_HEADER(ppl_c.h,[],
299                         [AC_MSG_ERROR(Can't find PPL headers.)])
300         LIBS="$LIBS -lppl_c -lppl -lgmpxx"
302         dnl FIXME: Temporarily for PPL porting, ask for a GMP Polylib.
303         cl_cv_polylib="polylibgmp"
304         LIBS="-l$cl_cv_polylib $LIBS"
305 else
306         AC_MSG_RESULT(not using PPL)
309 dnl /**************************************************************************
310 dnl  *                            Substitutions                               *
311 dnl  **************************************************************************/
314 dnl Substitutions to do in Makefile.in.
315 AC_SUBST(target)
316 AC_SUBST(CC)
317 AC_SUBST(LN_S)
318 AC_SUBST(SHEXT)
320 AC_SUBST(prefix)
321 AC_SUBST(exec_prefix)
322 AC_SUBST(INSTALL)
324 AC_SUBST(BITS)
326 AC_CONFIG_FILES(Makefile test/Makefile include/cloog/cloog.h autoconf/Doxyfile)
327 AC_CONFIG_FILES(doc/Makefile)
328 AC_CONFIG_FILES(source/version.c)
329 AC_CONFIG_FILES([genversion.sh], [chmod +x genversion.sh])
330 AC_CONFIG_COMMANDS([version.h],
331         [echo '#define CLOOG_HEAD "'`./genversion.sh`'"' > version.h])
332 AC_CONFIG_COMMANDS([doc/gitversion.texi],
333         [echo '@set VERSION '`./genversion.sh`'' > doc/gitversion.texi])
334 AC_OUTPUT
337 echo "             /*-----------------------------------------------*"
338 echo "              *           CLooG configuration is OK           *"
339 echo "              *-----------------------------------------------*/"
340 echo "It appears that your system is OK to start CLooG compilation. You need"
341 echo "now to type \"make\". After compilation, you should check CLooG by typing"
342 echo "\"make check\". If no problem occur, you can type \"make uninstall\" if"
343 echo "you are upgrading an old version. Lastly type \"make install\" to install"
344 echo "CLooG on your system (log as root if necessary)."