Fix missing matrix.h in generated tarball.
[cloog-ppl.git] / configure.in
blob95107471a1e2cfa3aae23a5eb2aa897c287caf7b
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)
45 dnl Every other copy of the package version number gets its value from here.
46 AM_INIT_AUTOMAKE(cloog, 0.15)
48 dnl default version
49 BITS="64"
51 AC_SUBST(VERSION)
53 # Version number machinery.
54 changequote(<<, >>)dnl
55 if test -n "`expr $VERSION : '\([0-9]*\)\.[0-9]*\.[0-9]*'`"
56 then
57   CLOOG_VERSION_MAJOR=`expr $VERSION : '\([0-9]*\)\.[0-9]*\.[0-9]*'`
58   CLOOG_VERSION_MINOR=`expr $VERSION : '[0-9]*\.\([0-9]*\)\.[0-9]*'`
59   CLOOG_VERSION_REVISION=`expr $VERSION : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
60   CLOOG_VERSION_BETA=`expr $VERSION : '[0-9]*\.[0-9]*\.[0-9]*pre\([0-9]*\)'`
61 else
62   CLOOG_VERSION_MAJOR=`expr $VERSION : '\([0-9]*\)\.[0-9]*'`
63   CLOOG_VERSION_MINOR=`expr $VERSION : '[0-9]*\.\([0-9]*\)'`
64   CLOOG_VERSION_REVISION=0
65   CLOOG_VERSION_BETA=`expr $VERSION : '[0-9]*\.[0-9]*pre\([0-9]*\)'`
67 if test -z "$CLOOG_VERSION_BETA"
68 then
69   CLOOG_VERSION_BETA=0
71 changequote([, ])dnl
72 AC_SUBST(CLOOG_VERSION_MAJOR)
73 AC_SUBST(CLOOG_VERSION_MINOR)
74 AC_SUBST(CLOOG_VERSION_REVISION)
75 AC_SUBST(CLOOG_VERSION_BETA)
78 dnl /**************************************************************************
79 dnl  *                              Checking                                  *
80 dnl  **************************************************************************/
82 dnl Checks for programs.
83 AC_PROG_CC
84 AC_PROG_LN_S
85 AC_PROG_MAKE_SET
86 AC_CHECK_PROG(CD, cd)
87 dnl Configure needs an empty install.sh file with this, i HATE that...
88 AC_PROG_INSTALL
89 AC_PROG_LIBTOOL
92 dnl Checks for typedefs, structures, and compiler characteristics.
93 AC_C_CONST
94 AC_TYPE_SIZE_T
98 dnl Checks for header files.
99 AC_HEADER_STDC
102 dnl Checks for library functions.
103 AC_CHECK_FUNCS(strtol)
106 dnl /**************************************************************************
107 dnl  *                             Option setting                             *
108 dnl  **************************************************************************/
110 dnl Some default values cause I'm not sure whether autoconf set them, while
111 dnl documentation says it does...
112 gmp_package="yes"
113 gmp_include_package="yes"
114 gmp_library_package="yes"
116 MP_BITS="MP"
117 MP_DFLAGS=-DLINEAR_VALUE_IS_MP
118 NEED_MP="no"
120 dnl --with-ppl=ppl-path
121 AC_ARG_WITH(ppl,
122             [AS_HELP_STRING([--with-ppl=DIR],
123                             [Prefix of Parma Polyhedral Library installation])])
125 dnl --with-polylib=polylib-path
126 AC_ARG_WITH(polylib_prefix,
127             [AS_HELP_STRING([--with-polylib-prefix=DIR],
128                             [Prefix of PolyLib installation])])
129 AC_ARG_WITH(polylib_exec_prefix,
130             [AS_HELP_STRING([--with-polylib-exec-prefix=DIR],
131                             [Exec prefix of PolyLib installation])])
132 AC_ARG_WITH(polylib_builddir,
133             [AS_HELP_STRING([--with-polylib-builddir=DIR],
134                             [Location of PolyLib builddir])])
135 AC_ARG_WITH(bits,
136             [  --with-bits=32|64|gmp   PolyLib library type to use],
137             [ echo "polylib$withval"; BITS=$withval ])
139 dnl --with-gmp=gmp-path
140 AC_ARG_WITH(gmp,
141         [  --with-gmp=DIR          DIR where the gmp package is installed],
142         [ echo "Package gmp : $withval" &&
143           gmp_package=$withval &&
144           GMP_INC=$gmp_package/include &&
145           GMP_LIB=$gmp_package/lib &&
146           NEED_MP="yes"])
148 AC_ARG_WITH(gmp-include,
149         [  --with-gmp-include=DIR  DIR where gmp.h is installed],
150         [ echo "Package gmp-include : $withval" &&
151           gmp_include_package=$withval &&
152           GMP_INC=$gmp_include_package &&
153           NEED_MP="yes"])
155 AC_ARG_WITH(gmp-library,
156         [  --with-gmp-library=DIR  DIR where the gmp library is installed],
157         [ echo "Package gmp-library : $withval" &&
158           gmp_library_package=$withval &&
159           GMP_LIB=$gmp_library_package &&
160           NEED_MP="yes"])
163 dnl /**************************************************************************
164 dnl  *                            Where is GMP?                               *
165 dnl  **************************************************************************/
168 dnl Checking for gmp
169 AC_MSG_CHECKING(whether gmp works)
170 if test "$gmp_package" = "no"; then
171   echo "GMP package not defined"
172   AC_MSG_RESULT(no)
173   TO_BUILD_MP=""
174 else
175   if test "$NEED_MP" = "no"; then
176     echo "Mode normal GMP"
177     TO_BUILD="$TO_BUILD MP"
178     AC_CHECK_HEADER(gmp.h,
179                     [AC_CHECK_LIB(gmp,
180                                   __gmpz_init,
181                                   [LIBS="$LIBS -lgmp"],
182                                   [echo "Can't find gmp library." &&
183                                    echo "MP version will not be builded." &&
184                                    TO_BUILD_MP=""])],
185                     [echo "Can't find gmp headers." &&
186                      echo "MP version will not be builded." &&
187                      TO_BUILD_MP=""])
188   else
189     dnl Default given by --with-X is "yes", --without-X is "no". We also
190     dnl initialized manually all gmp_package* variables to "yes" (thus they are
191     dnl supposed to be "yes" except if the user set them himself).
192     
193     if test "$gmp_package" != "yes" ; then
194       echo "(GMP path has been set by user)"
195       GMP_DIR=$gmp_package
196       dnl Useful for AC_CHECK_X to find what we want.
197       CPPFLAGS="-I$GMP_DIR/include $CPPFLAGS"
198       LDFLAGS="-L$GMP_DIR/lib $LDFLAGS"
199     fi
200     
201     if test "$gmp_include_package" != "yes" ; then
202       CPPFLAGS="-I$GMP_INC $CPPFLAGS"
203     fi
204     
205     if test "$gmp_library_package" != "yes" ; then
206       LDFLAGS="-L$GMP_LIB $LDFLAGS"
207     fi
208      
209     AC_CHECK_HEADER(gmp.h,
210                     [],
211                     [AC_MSG_ERROR(Can't find gmp headers.)])
212     AC_CHECK_LIB(gmp,
213                  __gmpz_init,
214                  [LIBS="$LIBS -lgmp"],
215                  [AC_MSG_ERROR(Can't find gmp library.)])
216     
217     AC_MSG_RESULT(yes)
218   fi
221 dnl /**************************************************************************
222 dnl  *                          Where is PolyLib?                             *
223 dnl  **************************************************************************/
225 polylibs="64 32"
226 case "$BITS" in
227     32|64|gmp)
228         polylibs=$BITS
229     ;;
230 esac
232 dnl Checking for PolyLib
233 AC_SUBST(cl_cv_polylib)
234 AC_SUBST(POLYLIB_CPPFLAGS)
235 AC_SUBST(POLYLIB_LDFLAGS)
236 AC_SUBST(POLYLIB_LIBS)
238 if test "x$with_polylib_prefix" != "x" -a "x$with_polylib_exec_prefix" = "x"
239 then
240         with_polylib_exec_prefix=$with_polylib_prefix
242 if test "x$with_polylib_prefix" != "x" -a "x$with_polylib_builddir" != "x"; then
243         AC_MSG_ERROR(
244         [--with-polylib-prefix and --with-polylib-builddir are mutually exclusive])
247 AC_MSG_CHECKING(for location of PolyLib)
248 if test "x$with_polylib_builddir" != "x"; then
249         AC_MSG_RESULT(built in $with_polylib_builddir)
250         polylib_srcdir=`echo @srcdir@ | $with_polylib_builddir/config.status --file=-`
251         AC_MSG_NOTICE(PolyLib sources in $polylib_srcdir)
252         polylib_polylibs=`echo @polylibs@ | $with_polylib_builddir/config.status --file=-`
253         AC_MSG_NOTICE(Configured polylibs: $polylib_polylibs)
254         CPPFLAGS="-I$with_polylib_builddir/include -I$polylib_srcdir/include $CPPFLAGS"
255         for BITS in $polylibs; do
256                 cl_cv_polylib=missing
257                 for PL in $polylib_polylibs; do
258                         if test "libpolylib$BITS.la" = $PL; then
259                                 cl_cv_polylib="polylib$BITS"
260                                 break;
261                         fi
262                 done
263                 if test "$cl_cv_polylib" != "missing"; then
264                         LIBS="$with_polylib_builddir/lib$cl_cv_polylib.la $LIBS"
265                         break;
266                 fi
267         done
268 else
269         if test "x$with_polylib_prefix" != "x"; then
270                 AC_MSG_RESULT(installed in $with_polylib_exec_prefix)
271                 CPPFLAGS="-I$with_polylib_prefix/include $CPPFLAGS"
272                 LDFLAGS="-L$with_polylib_exec_prefix/lib $LDFLAGS"
273                 LD_LIBRARY_PATH="$with_polylib_exec_prefix/lib:$LD_LIBRARY_PATH"
274                 export LD_LIBRARY_PATH
275         else
276                 AC_MSG_RESULT(installed in standard location)
277         fi
278         for BITS in $polylibs; do
279                 cl_cv_polylib="polylib$BITS"
280                 AC_CHECK_LIB($cl_cv_polylib,PolyhedronTSort,[
281                         LIBS="-l$cl_cv_polylib $LIBS"
282                         break
283                 ])
284                 cl_cv_polylib=missing
285         done
287 if test "$cl_cv_polylib" = "missing"; then
288         AC_MSG_RESULT(Can't find PolyLib.)
289 else
290         AC_CHECK_HEADER(polylib/$cl_cv_polylib.h,[],
291                         [AC_MSG_ERROR(Can't find PolyLib headers.)])
294 AC_SUBST(GIT_INDEX)
295 if test -f $srcdir/.git/HEAD; then
296         GIT_INDEX="\$(top_srcdir)/.git/index"
300 dnl /**************************************************************************
301 dnl  *                     Where is Parma Polyhedral Library?                 *
302 dnl  **************************************************************************/
304 # The default back-end for polyhedral operations is PolyLib, unless
305 # -with-ppl is used.
306 AC_SUBST(POLYHEDRAL_BACKEND)
307 POLYHEDRAL_BACKEND=polylib
309 dnl Checking for PPL
310 ppl_major_version=0
311 ppl_minor_version=10
312 AC_SUBST(PPL_CPPFLAGS)
313 AC_SUBST(PPL_LDFLAGS)
314 AC_SUBST(PPL_LIBS)
316 AC_MSG_CHECKING(for Parma Polyhedral Library (PPL))
317 if test "x$with_ppl" != "x"; then
319         if test "x$with_polylib_prefix" != "x" -o "x$with_polylib_exec_prefix" != "x" -o "x$with_polylib_builddir" != "x"; then
320                 AC_MSG_ERROR([--with-polylib and --with-ppl are mutually exclusive])
321         fi
323         AC_MSG_RESULT(installed in $with_ppl)
324         POLYHEDRAL_BACKEND=ppl
325         CPPFLAGS="-I$with_ppl/include -DCLOOG_PPL_BACKEND $CPPFLAGS"
326         LDFLAGS="-L$with_ppl/lib $LDFLAGS"
327         LD_LIBRARY_PATH="$with_ppl/lib:$LD_LIBRARY_PATH"
328         export LD_LIBRARY_PATH
330         AC_CHECK_HEADER(ppl_c.h,[],
331                         [AC_MSG_ERROR(Can't find PPL headers.)])
333         AC_MSG_CHECKING([for version $ppl_major_version.$ppl_minor_version of PPL])
334         AC_TRY_COMPILE([#include "ppl_c.h"],[
335         #if PPL_VERSION_MAJOR != $ppl_major_version || PPL_VERSION_MINOR != $ppl_minor_version
336         choke me
337         #endif
338         ], [AC_MSG_RESULT([yes])], [AC_MSG_ERROR(Can't find correct version of PPL.) ])
340         LIBS="$LIBS -lppl_c -lppl -lgmpxx"
342 else
343         AC_MSG_RESULT(not using PPL)
346 dnl /**************************************************************************
347 dnl  *                            Substitutions                               *
348 dnl  **************************************************************************/
351 dnl Substitutions to do in Makefile.in.
352 AC_SUBST(target)
353 AC_SUBST(CC)
354 AC_SUBST(LN_S)
355 AC_SUBST(SHEXT)
357 AC_SUBST(prefix)
358 AC_SUBST(exec_prefix)
359 AC_SUBST(INSTALL)
361 AC_SUBST(BITS)
363 AC_CONFIG_FILES(Makefile test/Makefile include/cloog/cloog.h autoconf/Doxyfile)
364 AC_CONFIG_FILES(doc/Makefile)
365 dnl AC_CONFIG_FILES(include/cloog/version.h)
366 AC_CONFIG_FILES([genversion.sh], [chmod +x genversion.sh])
367 AC_CONFIG_COMMANDS([version.h],
368         [echo '#define CLOOG_HEAD "'`./genversion.sh`'"' > version.h])
369 AC_CONFIG_COMMANDS([doc/gitversion.texi],
370         [echo '@set VERSION '`./genversion.sh`'' > doc/gitversion.texi])
371 AC_OUTPUT
374 echo "             /*-----------------------------------------------*"
375 echo "              *           CLooG configuration is OK           *"
376 echo "              *-----------------------------------------------*/"
377 echo "It appears that your system is OK to start CLooG compilation. You need"
378 echo "now to type \"make\". After compilation, you should check CLooG by typing"
379 echo "\"make check\". If no problem occur, you can type \"make uninstall\" if"
380 echo "you are upgrading an old version. Lastly type \"make install\" to install"
381 echo "CLooG on your system (log as root if necessary)."