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 library is free software; you can redistribute it and/or *
23 dnl * modify it under the terms of the GNU Lesser General Public *
24 dnl * License as published by the Free Software Foundation; either *
25 dnl * version 2.1 of the License, or (at your option) any later version. *
27 dnl * This library is distributed in the hope that it will be useful, *
28 dnl * but WITHOUT ANY WARRANTY; without even the implied warranty of *
29 dnl * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
30 dnl * Lesser General Public License for more details. *
32 dnl * You should have received a copy of the GNU Lesser General Public *
33 dnl * License along with this library; if not, write to the Free Software *
34 dnl * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
35 dnl * Boston, MA 02110-1301 USA *
37 dnl * CLooG, the Chunky Loop Generator *
38 dnl * Written by Cedric Bastoul, Cedric.Bastoul@inria.fr *
40 dnl ***************************************************************************/
43 AC_INIT(source/cloog.c)
44 AC_CONFIG_AUX_DIR(autoconf)
45 AC_CONFIG_MACRO_DIR([m4])
46 AM_INIT_AUTOMAKE(cloog, 0.14.0)
50 dnl /**************************************************************************
52 dnl **************************************************************************/
54 dnl Checks for programs.
59 dnl Configure needs an empty install.sh file with this, i HATE that...
62 AC_CHECK_PROG(TEXI2DVI, texi2dvi, texi2dvi, [])
63 AM_CONDITIONAL(HAVE_TEXI2DVI, test -n "$TEXI2DVI")
65 CFLAGS="-fomit-frame-pointer"
67 dnl Checks for typedefs, structures, and compiler characteristics.
73 dnl Checks for header files.
77 dnl Checks for library functions.
78 AC_CHECK_FUNCS(strtol)
81 dnl /**************************************************************************
82 dnl * Option setting *
83 dnl **************************************************************************/
86 MP_DFLAGS=-DLINEAR_VALUE_IS_MP
88 AC_CHECK_HEADERS([sys/resource.h],
89 [AC_DEFINE([CLOOG_RUSAGE], [], [Print time required to generate code])])
92 [AS_HELP_STRING([--with-bits=32|64|gmp],
93 [integer type to use])],
96 AX_SUBMODULE(isl,no|system|build|bundled,bundled)
97 if test "$with_isl" != "no"; then
101 dnl /**************************************************************************
102 dnl * Where is GMP? *
103 dnl **************************************************************************/
105 gmp_module_default=no
106 if test "$BITS" = "gmp"; then
107 gmp_module_default=system
109 AX_SUBMODULE(gmp,no|system,$gmp_module_default)
111 need_get_memory_functions=false
114 if test "x$with_gmp_prefix" != "x"; then
115 CPPFLAGS="-I$with_gmp_prefix/include $CPPFLAGS"
118 if test "$with_gmp_exec_prefix" != "yes" ; then
119 LDFLAGS="-L$with_gmp_exec_prefix/lib $LDFLAGS"
122 AC_CHECK_HEADER(gmp.h,
124 [AC_MSG_ERROR(Can't find gmp headers.)])
127 [LIBS="$LIBS -lgmp"],
128 [AC_MSG_ERROR(Can't find gmp library.)])
129 AC_CHECK_DECLS(mp_get_memory_functions,[],[
130 need_get_memory_functions=true
131 ],[#include <gmp.h>])
134 AM_CONDITIONAL(NEED_GET_MEMORY_FUNCTIONS,
135 test x$need_get_memory_functions = xtrue)
137 # all compiled libraries
139 AC_SUBST(CLOOG_LIBRARIES)
140 # backend used by executables
144 dnl /**************************************************************************
145 dnl * Where is PolyLib? *
146 dnl **************************************************************************/
148 AX_SUBMODULE(polylib,no|system|build,system)
157 dnl Checking for PolyLib
158 AC_SUBST(cl_cv_polylib)
159 AC_SUBST(POLYLIB_CPPFLAGS)
160 AC_SUBST(POLYLIB_LDFLAGS)
161 AC_SUBST(POLYLIB_LIBS)
163 AC_MSG_CHECKING(for location of PolyLib)
164 if test "x$with_polylib_builddir" != "x"; then
165 with_polylib_builddir=`cd $with_polylib_builddir; pwd`
166 AC_MSG_RESULT(built in $with_polylib_builddir)
167 polylib_polylibs=`echo @polylibs@ | $with_polylib_builddir/config.status --file=-`
168 AC_MSG_NOTICE(Configured polylibs: $polylib_polylibs)
169 POLYLIB_CPPFLAGS="-I$with_polylib_builddir/include -I$polylib_srcdir/include"
170 for BITS in $polylibs; do
171 cl_cv_polylib=missing
172 for PL in $polylib_polylibs; do
173 if test "libpolylib$BITS.la" = $PL; then
174 cl_cv_polylib="polylib$BITS"
178 if test "$cl_cv_polylib" != "missing"; then
179 POLYLIB_LIBS="$with_polylib_builddir/lib$cl_cv_polylib.la"
183 elif test "$with_polylib" != "no"; then
184 if test "x$with_polylib_prefix" != "x"; then
185 with_polylib_prefix=`cd $with_polylib_prefix; pwd`
186 AC_MSG_RESULT(installed in $with_polylib_exec_prefix)
187 POLYLIB_CPPFLAGS="-I$with_polylib_prefix/include"
188 POLYLIB_LDFLAGS="-L$with_polylib_exec_prefix/lib"
189 LD_LIBRARY_PATH="$with_polylib_exec_prefix/lib:$LD_LIBRARY_PATH"
190 export LD_LIBRARY_PATH
192 AC_MSG_RESULT(installed in standard location)
194 SAVE_CPPFLAGS="$CPPFLAGS"
195 SAVE_LDFLAGS="$LDFLAGS"
196 CPPFLAGS="$POLYLIB_CPPFLAGS $CPPFLAGS"
197 LDFLAGS="$POLYLIB_LDFLAGS $LDFLAGS"
198 for BITS in $polylibs; do
199 cl_cv_polylib="polylib$BITS"
200 AC_CHECK_HEADER(polylib/$cl_cv_polylib.h,[
201 AC_CHECK_LIB($cl_cv_polylib,PolyhedronTSort,[
202 POLYLIB_LIBS="-l$cl_cv_polylib"
206 cl_cv_polylib=missing
208 CPPFLAGS="$SAVE_CPPFLAGS"
209 LDFLAGS="$SAVE_LDFLAGS"
211 case "$cl_cv_polylib" in
213 AC_MSG_WARN(Can't find PolyLib.)
216 CLOOG_LIBRARIES="$CLOOG_LIBRARIES libcloog-polylib.la"
221 dnl /**************************************************************************
222 dnl * Where is isl? *
223 dnl **************************************************************************/
225 AC_SUBST(ISL_CPPFLAGS)
226 AC_SUBST(ISL_LDFLAGS)
230 ISL_CPPFLAGS="-I$srcdir/isl/include -Iisl/include"
233 ISL_CPPFLAGS="-I$isl_srcdir/include -I$with_isl_builddir/include"
234 ISL_LIBS="$with_isl_builddir/libisl.la"
237 if test "x$with_isl_prefix" != "x"; then
238 ISL_CPPFLAGS="-I$with_isl_prefix/include"
240 if test "x$with_isl_exec_prefix" != "x"; then
241 ISL_LDFLAGS="-L$with_isl_exec_prefix/lib"
245 if test "$with_isl" != "no"; then
246 CLOOG_LIBRARIES="$CLOOG_LIBRARIES libcloog-isl.la"
249 AM_CONDITIONAL(BUNDLED_ISL, test $with_isl = bundled)
251 if test -z "$BACKEND"; then
252 AC_MSG_ERROR(No backend specified or found.)
261 AC_CHECK_SIZEOF(int,1)
262 AC_CHECK_SIZEOF(long,1)
263 AC_CHECK_SIZEOF(long long,1)
264 for cl_cv_int_type in int long long_long; do
265 eval "bits=\`expr \$ac_cv_sizeof_$cl_cv_int_type \* 8\`"
266 if test "$bits" = "$BITS"; then
272 AC_DEFINE_UNQUOTED(AS_TR_CPP(CLOOG_INT_$cl_cv_int_type))
275 if test -f $srcdir/.git/HEAD; then
276 GIT_INDEX="\$(top_srcdir)/.git/index"
280 dnl /**************************************************************************
281 dnl * Substitutions *
282 dnl **************************************************************************/
285 dnl Substitutions to do in Makefile.in.
292 AC_SUBST(exec_prefix)
297 AC_CONFIG_HEADERS(config.h)
298 AC_CONFIG_HEADERS(include/cloog/int.h)
299 AC_CONFIG_HEADERS(include/cloog/options.h)
300 AC_CONFIG_FILES(Makefile test/Makefile include/cloog/polylib/backend.h)
301 AC_CONFIG_FILES(autoconf/Doxyfile)
302 AC_CONFIG_FILES(doc/Makefile)
303 AC_CONFIG_FILES(source/version.c)
304 AC_CONFIG_FILES([genversion.sh], [chmod +x genversion.sh])
305 AC_CONFIG_COMMANDS([version.h],
306 [echo '#define CLOOG_HEAD "'`./genversion.sh`'"' > version.h])
307 AC_CONFIG_COMMANDS([doc/gitversion.texi],
308 [echo '@set VERSION '`./genversion.sh`'' > doc/gitversion.texi])
309 if test $with_isl = bundled; then
310 AC_CONFIG_SUBDIRS(isl)
312 AC_CONFIG_COMMANDS_POST([
314 for arg in $ac_configure_args; do
319 old_args="$old_args $arg"
323 ac_configure_args="$old_args $cloog_configure_args"
328 echo " /*-----------------------------------------------*"
329 echo " * CLooG configuration is OK *"
330 echo " *-----------------------------------------------*/"
331 echo "It appears that your system is OK to start CLooG compilation. You need"
332 echo "now to type \"make\". After compilation, you should check CLooG by typing"
333 echo "\"make check\". If no problem occur, you can type \"make uninstall\" if"
334 echo "you are upgrading an old version. Lastly type \"make install\" to install"
335 echo "CLooG on your system (log as root if necessary)."