2 dnl /**-------------------------------------------------------------------**
4 dnl **-------------------------------------------------------------------**
6 dnl **-------------------------------------------------------------------**
7 dnl ** First version: august 7th 2002 **
8 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 ***************************************************************************
20 dnl * Copyright (C) 2001 Cedric Bastoul *
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. *
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. *
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 *
36 dnl * CLooG, the Chunky Loop Generator *
37 dnl * Written by Cedric Bastoul, Cedric.Bastoul@inria.fr *
39 dnl ***************************************************************************/
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)
47 AC_CONFIG_HEADER(include/cloog/cloog-config.h)
54 # Version number machinery.
55 changequote(<<, >>)dnl
56 if test -n "`expr $VERSION : '\([0-9]*\)\.[0-9]*\.[0-9]*'`"
58 CLOOG_VERSION_MAJOR=`expr $VERSION : '\([0-9]*\)\.[0-9]*\.[0-9]*'`
59 CLOOG_VERSION_MINOR=`expr $VERSION : '[0-9]*\.\([0-9]*\)\.[0-9]*'`
60 CLOOG_VERSION_REVISION=`expr $VERSION : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
61 CLOOG_VERSION_BETA=`expr $VERSION : '[0-9]*\.[0-9]*\.[0-9]*pre\([0-9]*\)'`
63 CLOOG_VERSION_MAJOR=`expr $VERSION : '\([0-9]*\)\.[0-9]*'`
64 CLOOG_VERSION_MINOR=`expr $VERSION : '[0-9]*\.\([0-9]*\)'`
65 CLOOG_VERSION_REVISION=0
66 CLOOG_VERSION_BETA=`expr $VERSION : '[0-9]*\.[0-9]*pre\([0-9]*\)'`
68 if test -z "$CLOOG_VERSION_BETA"
73 AC_SUBST(CLOOG_VERSION_MAJOR)
74 AC_SUBST(CLOOG_VERSION_MINOR)
75 AC_SUBST(CLOOG_VERSION_REVISION)
76 AC_SUBST(CLOOG_VERSION_BETA)
79 dnl /**************************************************************************
81 dnl **************************************************************************/
83 dnl Checks for programs.
88 dnl Configure needs an empty install.sh file with this, i HATE that...
93 dnl Checks for typedefs, structures, and compiler characteristics.
99 dnl Checks for header files.
103 dnl Checks for library functions.
104 AC_CHECK_FUNCS(strtol)
106 AC_CHECK_HEADER(sys/resource.h,[AC_DEFINE(HAS_SYS_RESOURCE_H)],
107 [AC_MSG_RESULT([no])])
109 dnl /**************************************************************************
110 dnl * Option setting *
111 dnl **************************************************************************/
113 dnl Some default values cause I'm not sure whether autoconf set them, while
114 dnl documentation says it does...
116 gmp_include_package="yes"
117 gmp_library_package="yes"
120 AC_DEFINE([LINEAR_VALUE_IS_MP], 1, [Empty comment])
123 dnl --with-ppl=ppl-path
125 [AS_HELP_STRING([--with-ppl=DIR],
126 [Prefix of Parma Polyhedral Library installation])])
128 dnl --with-polylib=polylib-path
129 AC_ARG_WITH(polylib_prefix,
130 [AS_HELP_STRING([--with-polylib-prefix=DIR],
131 [Prefix of PolyLib installation])])
132 AC_ARG_WITH(polylib_exec_prefix,
133 [AS_HELP_STRING([--with-polylib-exec-prefix=DIR],
134 [Exec prefix of PolyLib installation])])
135 AC_ARG_WITH(polylib_builddir,
136 [AS_HELP_STRING([--with-polylib-builddir=DIR],
137 [Location of PolyLib builddir])])
139 [ --with-bits=32|64|gmp PolyLib library type to use],
140 [ echo "polylib$withval"; BITS=$withval ])
142 dnl --with-gmp=gmp-path
144 [ --with-gmp=DIR DIR where the gmp package is installed],
145 [ echo "Package gmp : $withval" &&
146 gmp_package=$withval &&
147 GMP_INC=$gmp_package/include &&
148 GMP_LIB=$gmp_package/lib &&
151 AC_ARG_WITH(gmp-include,
152 [ --with-gmp-include=DIR DIR where gmp.h is installed],
153 [ echo "Package gmp-include : $withval" &&
154 gmp_include_package=$withval &&
155 GMP_INC=$gmp_include_package &&
158 AC_ARG_WITH(gmp-library,
159 [ --with-gmp-library=DIR DIR where the gmp library is installed],
160 [ echo "Package gmp-library : $withval" &&
161 gmp_library_package=$withval &&
162 GMP_LIB=$gmp_library_package &&
166 dnl /**************************************************************************
167 dnl * Where is GMP? *
168 dnl **************************************************************************/
172 AC_MSG_CHECKING(whether gmp works)
173 if test "$gmp_package" = "no"; then
174 echo "GMP package not defined"
178 if test "$NEED_MP" = "no"; then
179 echo "Mode normal GMP"
180 TO_BUILD="$TO_BUILD MP"
181 AC_CHECK_HEADER(gmp.h,
184 [LIBS="$LIBS -lgmp"],
185 [echo "Can't find gmp library." &&
186 echo "MP version will not be builded." &&
188 [echo "Can't find gmp headers." &&
189 echo "MP version will not be builded." &&
192 dnl Default given by --with-X is "yes", --without-X is "no". We also
193 dnl initialized manually all gmp_package* variables to "yes" (thus they are
194 dnl supposed to be "yes" except if the user set them himself).
196 if test "$gmp_package" != "yes" ; then
197 echo "(GMP path has been set by user)"
199 dnl Useful for AC_CHECK_X to find what we want.
200 CPPFLAGS="-I$GMP_DIR/include $CPPFLAGS"
201 LDFLAGS="-L$GMP_DIR/lib $LDFLAGS"
204 if test "$gmp_include_package" != "yes" ; then
205 CPPFLAGS="-I$GMP_INC $CPPFLAGS"
208 if test "$gmp_library_package" != "yes" ; then
209 LDFLAGS="-L$GMP_LIB $LDFLAGS"
212 AC_CHECK_HEADER(gmp.h,
214 [AC_MSG_ERROR(Can't find gmp headers.)])
217 [LIBS="$LIBS -lgmp"],
218 [AC_MSG_ERROR(Can't find gmp library.)])
224 dnl /**************************************************************************
225 dnl * Where is PolyLib? *
226 dnl **************************************************************************/
235 dnl Checking for PolyLib
236 AC_SUBST(cl_cv_polylib)
237 AC_SUBST(POLYLIB_CPPFLAGS)
238 AC_SUBST(POLYLIB_LDFLAGS)
239 AC_SUBST(POLYLIB_LIBS)
241 if test "x$with_polylib_prefix" != "x" -a "x$with_polylib_exec_prefix" = "x"
243 with_polylib_exec_prefix=$with_polylib_prefix
245 if test "x$with_polylib_prefix" != "x" -a "x$with_polylib_builddir" != "x"; then
247 [--with-polylib-prefix and --with-polylib-builddir are mutually exclusive])
250 AC_MSG_CHECKING(for location of PolyLib)
251 if test "x$with_polylib_builddir" != "x"; then
252 AC_MSG_RESULT(built in $with_polylib_builddir)
253 polylib_srcdir=`echo @srcdir@ | $with_polylib_builddir/config.status --file=-`
254 AC_MSG_NOTICE(PolyLib sources in $polylib_srcdir)
255 polylib_polylibs=`echo @polylibs@ | $with_polylib_builddir/config.status --file=-`
256 AC_MSG_NOTICE(Configured polylibs: $polylib_polylibs)
257 CPPFLAGS="-I$with_polylib_builddir/include -I$polylib_srcdir/include $CPPFLAGS"
258 for BITS in $polylibs; do
259 cl_cv_polylib=missing
260 for PL in $polylib_polylibs; do
261 if test "libpolylib$BITS.la" = $PL; then
262 cl_cv_polylib="polylib$BITS"
266 if test "$cl_cv_polylib" != "missing"; then
267 LIBS="$with_polylib_builddir/lib$cl_cv_polylib.la $LIBS"
272 if test "x$with_polylib_prefix" != "x"; then
273 AC_MSG_RESULT(installed in $with_polylib_exec_prefix)
274 CPPFLAGS="-I$with_polylib_prefix/include $CPPFLAGS"
275 LDFLAGS="-L$with_polylib_exec_prefix/lib $LDFLAGS"
276 LD_LIBRARY_PATH="$with_polylib_exec_prefix/lib:$LD_LIBRARY_PATH"
277 export LD_LIBRARY_PATH
279 AC_MSG_RESULT(installed in standard location)
281 for BITS in $polylibs; do
282 cl_cv_polylib="polylib$BITS"
283 AC_CHECK_LIB($cl_cv_polylib,PolyhedronTSort,[
284 LIBS="-l$cl_cv_polylib $LIBS"
287 cl_cv_polylib=missing
290 if test "$cl_cv_polylib" = "missing"; then
291 AC_MSG_RESULT(Can't find PolyLib.)
293 AC_CHECK_HEADER(polylib/$cl_cv_polylib.h,[],
294 [AC_MSG_ERROR(Can't find PolyLib headers.)])
298 if test -f $srcdir/.git/HEAD; then
299 GIT_INDEX="\$(top_srcdir)/.git/index"
303 dnl /**************************************************************************
304 dnl * Where is Parma Polyhedral Library? *
305 dnl **************************************************************************/
307 # The default back-end for polyhedral operations is PolyLib, unless
309 AC_SUBST(POLYHEDRAL_BACKEND)
310 POLYHEDRAL_BACKEND=polylib
315 AC_SUBST(PPL_CPPFLAGS)
316 AC_SUBST(PPL_LDFLAGS)
319 AC_MSG_CHECKING(for Parma Polyhedral Library (PPL))
320 if test "x$with_ppl" != "x"; then
322 if test "x$with_polylib_prefix" != "x" -o "x$with_polylib_exec_prefix" != "x" -o "x$with_polylib_builddir" != "x"; then
323 AC_MSG_ERROR([--with-polylib and --with-ppl are mutually exclusive])
326 AC_MSG_RESULT(installed in $with_ppl)
327 POLYHEDRAL_BACKEND=ppl
328 CPPFLAGS="-I$with_ppl/include $CPPFLAGS"
329 LDFLAGS="-L$with_ppl/lib $LDFLAGS"
330 LD_LIBRARY_PATH="$with_ppl/lib:$LD_LIBRARY_PATH"
331 export LD_LIBRARY_PATH
333 AC_CHECK_HEADER(ppl_c.h,[],
334 [AC_MSG_ERROR(Can't find PPL headers.)])
336 AC_MSG_CHECKING([for version $ppl_major_version.$ppl_minor_version of PPL])
337 AC_TRY_COMPILE([#include "ppl_c.h"],[
338 #if PPL_VERSION_MAJOR != $ppl_major_version || PPL_VERSION_MINOR != $ppl_minor_version
341 ], [AC_MSG_RESULT([yes])], [AC_MSG_ERROR(Can't find correct version of PPL.) ])
343 LIBS="$LIBS -lppl_c -lppl -lgmpxx"
344 AC_DEFINE([CLOOG_PPL_BACKEND], 1, [Use the PPL backend])
347 AC_MSG_RESULT(not using PPL)
350 dnl /**************************************************************************
351 dnl * Substitutions *
352 dnl **************************************************************************/
355 dnl Substitutions to do in Makefile.in.
362 AC_SUBST(exec_prefix)
367 AC_CONFIG_FILES(Makefile test/Makefile include/cloog/cloog.h autoconf/Doxyfile)
368 AC_CONFIG_FILES(doc/Makefile)
369 dnl AC_CONFIG_FILES(include/cloog/version.h)
370 AC_CONFIG_FILES([genversion.sh], [chmod +x genversion.sh])
371 AC_CONFIG_COMMANDS([version.h],
372 [echo '#define CLOOG_HEAD "'`./genversion.sh`'"' > version.h])
373 AC_CONFIG_COMMANDS([doc/gitversion.texi],
374 [echo '@set VERSION '`./genversion.sh`'' > doc/gitversion.texi])
378 echo " /*-----------------------------------------------*"
379 echo " * CLooG configuration is OK *"
380 echo " *-----------------------------------------------*/"
381 echo "It appears that your system is OK to start CLooG compilation. You need"
382 echo "now to type \"make\". After compilation, you should check CLooG by typing"
383 echo "\"make check\". If no problem occur, you can type \"make uninstall\" if"
384 echo "you are upgrading an old version. Lastly type \"make install\" to install"
385 echo "CLooG on your system (log as root if necessary)."