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)
48 dnl /**************************************************************************
50 dnl **************************************************************************/
53 dnl Checks for typedefs, structures, and compiler characteristics.
57 dnl Checks for programs.
63 dnl Configure needs an empty install.sh file with this, i HATE that...
67 dnl Checks for typedefs, structures, and compiler characteristics.
72 dnl Checks for libraries.
73 dnl Replace `main' with a function in -lc:
77 dnl Checks for header files.
81 dnl Checks for library functions.
82 AC_CHECK_FUNCS(strtol)
85 dnl Set some system dependant values.
90 EXTRA_FLAGS="-DCYGWIN"
91 EXTRA_LIBS="-lcygwin -lkernel32"
92 CLOOGLIB="cloogstaticlib"
93 INSTALL_CLOOGLIB="install_cloogstaticlib" ;;
99 CLOOGLIB="cloogsharedlib cloogstaticlib"
100 INSTALL_CLOOGLIB="install_cloogsharedlib install_cloogstaticlib" ;;
103 dnl Test whether we are using SUN's ld rather than Solaris ld
104 dnl If so, we need to add -G -Bdynamic to the linking options
105 dnl This is a hack to avoid having to hack the piplib makefiles
106 dnl and configure scripts. (by Allen Leung)
112 /usr/ccs/bin/ld|/usr/ucb/ld)
116 ld -shared 2>&1 | grep 'fatal: option -h'
117 if test "$?" = "0"; then
127 if test "$SOLARIS_LD" = "yes"; then
128 SOLARIS_LDFLAGS='-G -Bdynamic'
131 dnl /**************************************************************************
132 dnl * Option setting *
133 dnl **************************************************************************/
136 dnl The two different packages that can be built and installed.
138 INSTALL_CLOOG="install_cloog"
140 dnl Some default values cause I'm not sure whether autoconf set them, while
141 dnl documentation says it does...
143 gmp_include_package="yes"
144 gmp_library_package="yes"
147 MP_DFLAGS=-DLINEAR_VALUE_IS_MP
149 GMP_INC="/usr/local/include"
150 GMP_LIB="/usr/local/lib"
154 dnl --with-cloog=yes, --with-cloog=no ou --without-cloog
156 [ --without-cloog disable the compilation of cloog],
157 [ echo "Package cloog : $withval" &&
158 if test "$withval"="no" ; then
163 dnl --with-lib=yes, --with-lib=no ou --without-lib
165 [ --without-lib disable the compilation of cloog's lib],
166 [ echo "Package clooglib : $withval" &&
167 if test "$withval"="no" ; then
172 dnl --with-polylib=polylib-path
174 [ --with-polylib=DIR DIR Location of the PolyLib],
175 [ echo "Package polylib : $withval" && polylib_package=$withval],
176 [ polylib_package=yes ])
178 [ --with-bits=32|64|gmp PolyLib library type to use],
179 [ echo "polylib$withval"; VERSION=$withval ])
181 dnl --with-gmp=gmp-path
183 [ --with-gmp=DIR DIR where the gmp package is installed],
184 [ echo "Package gmp : $withval" &&
185 gmp_package=$withval &&
186 GMP_INC=$gmp_package/include &&
187 GMP_LIB=$gmp_package/lib &&
190 AC_ARG_WITH(gmp_include,
191 [ --with-gmp-include=DIR DIR where gmp.h is installed],
192 [ echo "Package gmp-include : $withval" &&
193 gmp_include_package=$withval &&
194 GMP_INC=$gmp_include_package &&
197 AC_ARG_WITH(gmp_library,
198 [ --with-gmp-library=DIR DIR where the gmp library is installed],
199 [ echo "Package gmp-library : $withval" &&
200 gmp_library_package=$withval &&
201 GMP_LIB=$gmp_library_package &&
204 dnl Packages to build.
205 PACKAGES="$CLOOGLIB $CLOOG"
206 INSTALL_PACKAGES="$INSTALL_CLOOGLIB $INSTALL_CLOOG"
209 dnl /**************************************************************************
210 dnl * Where is PolyLib? *
211 dnl **************************************************************************/
220 dnl Checking for PolyLib
221 AC_SUBST(cl_cv_polylib)
222 AC_MSG_CHECKING(whether PolyLib works)
223 if test "$polylib_package" = "no"; then
225 AC_MSG_ERROR(Can't find PolyLib.)
228 if test "$polylib_package" != "yes"; then
229 POLYLIB_DIR=$polylib_package
230 POLYLIB_LIB=$POLYLIB_DIR/lib
231 CPPFLAGS="-I$POLYLIB_DIR/include $CPPFLAGS"
232 LDFLAGS="-L$POLYLIB_DIR/lib $LDFLAGS"
234 for VERSION in $polylibs; do
235 cl_cv_polylib="polylib$VERSION"
236 AC_CHECK_LIB($cl_cv_polylib,PolyhedronTSort,[break])
237 cl_cv_polylib=missing
239 if test "$cl_cv_polylib" = "missing"; then
240 AC_MSG_ERROR(Can't find PolyLib.)
242 LIBS="-l$cl_cv_polylib $LIBS"
244 AC_CHECK_HEADER(polylib/$cl_cv_polylib.h,[],
245 [AC_MSG_ERROR(Can't find PolyLib headers.)])
249 dnl /**************************************************************************
250 dnl * Where is GMP? *
251 dnl **************************************************************************/
255 AC_MSG_CHECKING(whether gmp works)
256 if test "$gmp_package" = "no"; then
257 echo "GMP package not defined"
261 if test "$NEED_MP" = "no"; then
262 echo "Mode normal GMP"
263 TO_BUILD="$TO_BUILD MP"
264 AC_CHECK_HEADER(gmp.h,
267 [EXTRA_LIBS="$EXTRA_LIBS -lgmp"],
268 [echo "Can't find gmp library." &&
269 echo "MP version will not be builded." &&
271 [echo "Can't find gmp headers." &&
272 echo "MP version will not be builded." &&
275 dnl Default given by --with-X is "yes", --without-X is "no". We also
276 dnl initialized manually all gmp_package* variables to "yes" (thus they are
277 dnl supposed to be "yes" except if the user set them himself).
279 if test "$gmp_package" != "yes" ; then
280 echo "(GMP path has been set by user)"
283 GMP_INC=$GMP_DIR/include
284 EXTRA_INC="-I$GMP_INC"
285 EXTRA_LIBS="$EXTRA_LIBS -L$GMP_LIB"
286 dnl Useful for AC_CHECK_X to find what we want.
287 CPPFLAGS="-I$GMP_DIR/include $CPPFLAGS"
288 LDFLAGS="-L$GMP_DIR/lib $LDFLAGS"
291 if test "$gmp_include_package" != "yes" ; then
292 CPPFLAGS="-I$GMP_DIR/include $CPPFLAGS"
293 EXTRA_INC="-I$GMP_INC"
296 if test "$gmp_library_package" != "yes" ; then
297 EXTRA_LIBS="$EXTRA_LIBS -L$GMP_LIB"
298 LDFLAGS="-L$GMP_DIR/lib $LDFLAGS"
301 AC_CHECK_HEADER(gmp.h,
303 [AC_MSG_ERROR(Can't find gmp headers.)])
306 [EXTRA_LIBS="$EXTRA_LIBS -lgmp"],
307 [AC_MSG_ERROR(Can't find gmp library.)])
314 dnl /**************************************************************************
315 dnl * Substitutions *
316 dnl **************************************************************************/
319 dnl Substitutions to do in Makefile.in.
326 AC_SUBST(EXEC_SUFFIX)
327 AC_SUBST(EXTRA_FLAGS)
330 AC_SUBST(POLYLIB_LIB)
332 AC_SUBST(exec_prefix)
335 AC_SUBST(INSTALL_PACKAGES)
339 dnl Makefile creation (Allen Leung's fix).
340 AC_OUTPUT(makefile:autoconf/makefile.in include/cloog/cloog.h autoconf/Doxyfile)
343 echo " /*-----------------------------------------------*"
344 echo " * CLooG configuration is OK *"
345 echo " *-----------------------------------------------*/"
346 echo "It appears that your system is OK to start CLooG compilation. You need"
347 echo "now to type \"make\". After compilation, you should check CLooG by typing"
348 echo "\"make check\". If no problem occur, you can type \"make uninstall\" if"
349 echo "you are upgrading an old version. Lastly type \"make install\" to install"
350 echo "CLooG on your system (log as root if necessary)."