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)
44 AM_INIT_AUTOMAKE(cloog, 0.14.0)
48 dnl /**************************************************************************
50 dnl **************************************************************************/
52 dnl Checks for programs.
57 dnl Configure needs an empty install.sh file with this, i HATE that...
62 dnl Checks for typedefs, structures, and compiler characteristics.
68 dnl Checks for header files.
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...
83 gmp_include_package="yes"
84 gmp_library_package="yes"
87 MP_DFLAGS=-DLINEAR_VALUE_IS_MP
90 dnl --with-polylib=polylib-path
91 AC_ARG_WITH(polylib_prefix,
92 [AS_HELP_STRING([--with-polylib-prefix=DIR],
93 [Prefix of PolyLib installation])])
94 AC_ARG_WITH(polylib_exec_prefix,
95 [AS_HELP_STRING([--with-polylib-exec-prefix=DIR],
96 [Exec prefix of PolyLib installation])])
97 AC_ARG_WITH(polylib_builddir,
98 [AS_HELP_STRING([--with-polylib-builddir=DIR],
99 [Location of PolyLib builddir])])
101 [ --with-bits=32|64|gmp PolyLib library type to use],
102 [ echo "polylib$withval"; BITS=$withval ])
104 dnl --with-gmp=gmp-path
106 [ --with-gmp=DIR DIR where the gmp package is installed],
107 [ echo "Package gmp : $withval" &&
108 gmp_package=$withval &&
109 GMP_INC=$gmp_package/include &&
110 GMP_LIB=$gmp_package/lib &&
113 AC_ARG_WITH(gmp-include,
114 [ --with-gmp-include=DIR DIR where gmp.h is installed],
115 [ echo "Package gmp-include : $withval" &&
116 gmp_include_package=$withval &&
117 GMP_INC=$gmp_include_package &&
120 AC_ARG_WITH(gmp-library,
121 [ --with-gmp-library=DIR DIR where the gmp library is installed],
122 [ echo "Package gmp-library : $withval" &&
123 gmp_library_package=$withval &&
124 GMP_LIB=$gmp_library_package &&
128 dnl /**************************************************************************
129 dnl * Where is GMP? *
130 dnl **************************************************************************/
134 AC_MSG_CHECKING(whether gmp works)
135 if test "$gmp_package" = "no"; then
136 echo "GMP package not defined"
140 if test "$NEED_MP" = "no"; then
141 echo "Mode normal GMP"
142 TO_BUILD="$TO_BUILD MP"
143 AC_CHECK_HEADER(gmp.h,
146 [LIBS="$LIBS -lgmp"],
147 [echo "Can't find gmp library." &&
148 echo "MP version will not be builded." &&
150 [echo "Can't find gmp headers." &&
151 echo "MP version will not be builded." &&
154 dnl Default given by --with-X is "yes", --without-X is "no". We also
155 dnl initialized manually all gmp_package* variables to "yes" (thus they are
156 dnl supposed to be "yes" except if the user set them himself).
158 if test "$gmp_package" != "yes" ; then
159 echo "(GMP path has been set by user)"
161 dnl Useful for AC_CHECK_X to find what we want.
162 CPPFLAGS="-I$GMP_DIR/include $CPPFLAGS"
163 LDFLAGS="-L$GMP_DIR/lib $LDFLAGS"
166 if test "$gmp_include_package" != "yes" ; then
167 CPPFLAGS="-I$GMP_INC $CPPFLAGS"
170 if test "$gmp_library_package" != "yes" ; then
171 LDFLAGS="-L$GMP_LIB $LDFLAGS"
174 AC_CHECK_HEADER(gmp.h,
176 [AC_MSG_ERROR(Can't find gmp headers.)])
179 [LIBS="$LIBS -lgmp"],
180 [AC_MSG_ERROR(Can't find gmp library.)])
187 dnl /**************************************************************************
188 dnl * Where is PolyLib? *
189 dnl **************************************************************************/
198 dnl Checking for PolyLib
199 AC_SUBST(cl_cv_polylib)
200 AC_SUBST(POLYLIB_CPPFLAGS)
201 AC_SUBST(POLYLIB_LDFLAGS)
202 AC_SUBST(POLYLIB_LIBS)
204 if test "x$with_polylib_prefix" != "x" -a "x$with_polylib_exec_prefix" = "x"
206 with_polylib_exec_prefix=$with_polylib_prefix
208 if test "x$with_polylib_prefix" != "x" -a "x$with_polylib_builddir" != "x"; then
210 [--with-polylib-prefix and --with-polylib-builddir are mutually exclusive])
213 AC_MSG_CHECKING(for location of PolyLib)
214 if test "x$with_polylib_builddir" != "x"; then
215 AC_MSG_RESULT(built in $with_polylib_builddir)
216 polylib_srcdir=`echo @srcdir@ | $with_polylib_builddir/config.status --file=-`
217 AC_MSG_NOTICE(PolyLib sources in $polylib_srcdir)
218 polylib_polylibs=`echo @polylibs@ | $with_polylib_builddir/config.status --file=-`
219 AC_MSG_NOTICE(Configured polylibs: $polylib_polylibs)
220 CPPFLAGS="-I$with_polylib_builddir/include -I$polylib_srcdir/include $CPPFLAGS"
221 for BITS in $polylibs; do
222 cl_cv_polylib=missing
223 for PL in $polylib_polylibs; do
224 if test "libpolylib$BITS.la" = $PL; then
225 cl_cv_polylib="polylib$BITS"
229 if test "$cl_cv_polylib" != "missing"; then
230 LIBS="$with_polylib_builddir/lib$cl_cv_polylib.la $LIBS"
235 if test "x$with_polylib_prefix" != "x"; then
236 AC_MSG_RESULT(installed in $with_polylib_exec_prefix)
237 CPPFLAGS="-I$with_polylib_prefix/include $CPPFLAGS"
238 LDFLAGS="-L$with_polylib_exec_prefix/lib $LDFLAGS"
239 LD_LIBRARY_PATH="$with_polylib_exec_prefix/lib:$LD_LIBRARY_PATH"
240 export LD_LIBRARY_PATH
242 AC_MSG_RESULT(installed in standard location)
244 for BITS in $polylibs; do
245 cl_cv_polylib="polylib$BITS"
246 AC_CHECK_LIB($cl_cv_polylib,PolyhedronTSort,[
247 LIBS="-l$cl_cv_polylib $LIBS"
250 cl_cv_polylib=missing
253 if test "$cl_cv_polylib" = "missing"; then
254 AC_MSG_ERROR(Can't find PolyLib.)
256 AC_CHECK_HEADER(polylib/$cl_cv_polylib.h,[],
257 [AC_MSG_ERROR(Can't find PolyLib headers.)])
260 if test -f $srcdir/.git/HEAD; then
261 GIT_INDEX="\$(top_srcdir)/.git/index"
265 dnl /**************************************************************************
266 dnl * Substitutions *
267 dnl **************************************************************************/
270 dnl Substitutions to do in Makefile.in.
277 AC_SUBST(exec_prefix)
282 AC_CONFIG_FILES(Makefile test/Makefile include/cloog/cloog.h autoconf/Doxyfile)
283 AC_CONFIG_FILES(doc/Makefile)
284 AC_CONFIG_FILES(source/version.c)
285 AC_CONFIG_FILES([genversion.sh], [chmod +x genversion.sh])
286 AC_CONFIG_COMMANDS([version.h],
287 [echo '#define CLOOG_HEAD "'`./genversion.sh`'"' > version.h])
288 AC_CONFIG_COMMANDS([doc/gitversion.texi],
289 [echo '@set VERSION '`./genversion.sh`'' > doc/gitversion.texi])
293 echo " /*-----------------------------------------------*"
294 echo " * CLooG configuration is OK *"
295 echo " *-----------------------------------------------*/"
296 echo "It appears that your system is OK to start CLooG compilation. You need"
297 echo "now to type \"make\". After compilation, you should check CLooG by typing"
298 echo "\"make check\". If no problem occur, you can type \"make uninstall\" if"
299 echo "you are upgrading an old version. Lastly type \"make install\" to install"
300 echo "CLooG on your system (log as root if necessary)."