Add --with-host-libstdcxx configure switch.
[cloog-ppl.git] / configure.in
blob1908a1fb904419251e069b183a7e1d312e7d6a96
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)
47 AC_CONFIG_HEADER(include/cloog/cloog-config.h)
49 dnl default version
50 BITS="64"
52 AC_SUBST(VERSION)
54 # Version number machinery.
55 changequote(<<, >>)dnl
56 if test -n "`expr $VERSION : '\([0-9]*\)\.[0-9]*\.[0-9]*'`"
57 then
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]*\)'`
62 else
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"
69 then
70   CLOOG_VERSION_BETA=0
72 changequote([, ])dnl
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 /**************************************************************************
80 dnl  *                              Checking                                  *
81 dnl  **************************************************************************/
83 dnl Checks for programs.
84 AC_PROG_CC
85 AC_PROG_LN_S
86 AC_PROG_MAKE_SET
87 AC_CHECK_PROG(CD, cd)
88 dnl Configure needs an empty install.sh file with this, i HATE that...
89 AC_PROG_INSTALL
90 AC_PROG_LIBTOOL
93 dnl Checks for typedefs, structures, and compiler characteristics.
94 AC_C_CONST
95 AC_TYPE_SIZE_T
99 dnl Checks for header files.
100 AC_HEADER_STDC
103 dnl Checks for library functions.
104 AC_CHECK_FUNCS(strtol)
106 AC_CHECK_HEADER(sys/resource.h,[AC_DEFINE([HAS_SYS_RESOURCE_H],1,[presence of 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...
115 gmp_package="yes"
116 gmp_include_package="yes"
117 gmp_library_package="yes"
119 MP_BITS="MP"
120 AC_DEFINE([LINEAR_VALUE_IS_MP], 1, [Empty comment])
121 NEED_MP="no"
123 # Allow host libstdc++ to be specified for static linking with PPL.
124 AC_ARG_WITH(host-libstdcxx, [  --with-host-libstdcxx=L Use linker arguments L to link with libstdc++
125                           when linking with PPL])
127 case $with_host_libstdcxx in
128   no|yes) AC_MSG_ERROR([-with-host-libstdcxx needs an argument]) ;;
129   *) LIBS="$LIBS $with_host_libstdcxx" ;;
130 esac
132 dnl --with-ppl=ppl-path
133 AC_ARG_WITH(ppl,
134             [AS_HELP_STRING([--with-ppl=DIR],
135                             [Prefix of Parma Polyhedral Library installation])])
137 dnl --with-polylib=polylib-path
138 AC_ARG_WITH(polylib_prefix,
139             [AS_HELP_STRING([--with-polylib-prefix=DIR],
140                             [Prefix of PolyLib installation])])
141 AC_ARG_WITH(polylib_exec_prefix,
142             [AS_HELP_STRING([--with-polylib-exec-prefix=DIR],
143                             [Exec prefix of PolyLib installation])])
144 AC_ARG_WITH(polylib_builddir,
145             [AS_HELP_STRING([--with-polylib-builddir=DIR],
146                             [Location of PolyLib builddir])])
147 AC_ARG_WITH(bits,
148             [  --with-bits=32|64|gmp   PolyLib library type to use],
149             [ echo "polylib$withval"; BITS=$withval ])
151 dnl --with-gmp=gmp-path
152 AC_ARG_WITH(gmp,
153         [  --with-gmp=DIR          DIR where the gmp package is installed],
154         [ echo "Package gmp : $withval" &&
155           gmp_package=$withval &&
156           GMP_INC=$gmp_package/include &&
157           GMP_LIB=$gmp_package/lib &&
158           NEED_MP="yes"])
160 AC_ARG_WITH(gmp-include,
161         [  --with-gmp-include=DIR  DIR where gmp.h is installed],
162         [ echo "Package gmp-include : $withval" &&
163           gmp_include_package=$withval &&
164           GMP_INC=$gmp_include_package &&
165           NEED_MP="yes"])
167 AC_ARG_WITH(gmp-library,
168         [  --with-gmp-library=DIR  DIR where the gmp library is installed],
169         [ echo "Package gmp-library : $withval" &&
170           gmp_library_package=$withval &&
171           GMP_LIB=$gmp_library_package &&
172           NEED_MP="yes"])
175 dnl /**************************************************************************
176 dnl  *                            Where is GMP?                               *
177 dnl  **************************************************************************/
180 dnl Checking for gmp
181 AC_MSG_CHECKING(whether gmp works)
182 if test "$gmp_package" = "no"; then
183   echo "GMP package not defined"
184   AC_MSG_RESULT(no)
185   TO_BUILD_MP=""
186 else
187   if test "$NEED_MP" = "no"; then
188     echo "Mode normal GMP"
189     TO_BUILD="$TO_BUILD MP"
190     AC_CHECK_HEADER(gmp.h,
191                     [AC_CHECK_LIB(gmp,
192                                   __gmpz_init,
193                                   [LIBS="$LIBS -lgmp"],
194                                   [echo "Can't find gmp library." &&
195                                    echo "MP version will not be builded." &&
196                                    TO_BUILD_MP=""])],
197                     [echo "Can't find gmp headers." &&
198                      echo "MP version will not be builded." &&
199                      TO_BUILD_MP=""])
200   else
201     dnl Default given by --with-X is "yes", --without-X is "no". We also
202     dnl initialized manually all gmp_package* variables to "yes" (thus they are
203     dnl supposed to be "yes" except if the user set them himself).
204     
205     if test "$gmp_package" != "yes" ; then
206       echo "(GMP path has been set by user)"
207       GMP_DIR=$gmp_package
208       dnl Useful for AC_CHECK_X to find what we want.
209       CPPFLAGS="-I$GMP_DIR/include $CPPFLAGS"
210       LDFLAGS="-L$GMP_DIR/lib $LDFLAGS"
211     fi
212     
213     if test "$gmp_include_package" != "yes" ; then
214       CPPFLAGS="-I$GMP_INC $CPPFLAGS"
215     fi
216     
217     if test "$gmp_library_package" != "yes" ; then
218       LDFLAGS="-L$GMP_LIB $LDFLAGS"
219     fi
220      
221     AC_CHECK_HEADER(gmp.h,
222                     [],
223                     [AC_MSG_ERROR(Can't find gmp headers.)])
224     AC_CHECK_LIB(gmp,
225                  __gmpz_init,
226                  [LIBS="$LIBS -lgmp"],
227                  [AC_MSG_ERROR(Can't find gmp library.)])
228     
229     AC_MSG_RESULT(yes)
230   fi
233 dnl /**************************************************************************
234 dnl  *                          Where is PolyLib?                             *
235 dnl  **************************************************************************/
237 polylibs="64 32"
238 case "$BITS" in
239     32|64|gmp)
240         polylibs=$BITS
241     ;;
242 esac
244 dnl Checking for PolyLib
245 AC_SUBST(cl_cv_polylib)
246 AC_SUBST(POLYLIB_CPPFLAGS)
247 AC_SUBST(POLYLIB_LDFLAGS)
248 AC_SUBST(POLYLIB_LIBS)
250 if test "x$with_polylib_prefix" != "x" -a "x$with_polylib_exec_prefix" = "x"
251 then
252         with_polylib_exec_prefix=$with_polylib_prefix
254 if test "x$with_polylib_prefix" != "x" -a "x$with_polylib_builddir" != "x"; then
255         AC_MSG_ERROR(
256         [--with-polylib-prefix and --with-polylib-builddir are mutually exclusive])
259 AC_MSG_CHECKING(for location of PolyLib)
260 if test "x$with_polylib_builddir" != "x"; then
261         AC_MSG_RESULT(built in $with_polylib_builddir)
262         polylib_srcdir=`echo @srcdir@ | $with_polylib_builddir/config.status --file=-`
263         AC_MSG_NOTICE(PolyLib sources in $polylib_srcdir)
264         polylib_polylibs=`echo @polylibs@ | $with_polylib_builddir/config.status --file=-`
265         AC_MSG_NOTICE(Configured polylibs: $polylib_polylibs)
266         CPPFLAGS="-I$with_polylib_builddir/include -I$polylib_srcdir/include $CPPFLAGS"
267         for BITS in $polylibs; do
268                 cl_cv_polylib=missing
269                 for PL in $polylib_polylibs; do
270                         if test "libpolylib$BITS.la" = $PL; then
271                                 cl_cv_polylib="polylib$BITS"
272                                 break;
273                         fi
274                 done
275                 if test "$cl_cv_polylib" != "missing"; then
276                         LIBS="$with_polylib_builddir/lib$cl_cv_polylib.la $LIBS"
277                         break;
278                 fi
279         done
280 else
281         if test "x$with_polylib_prefix" != "x"; then
282                 AC_MSG_RESULT(installed in $with_polylib_exec_prefix)
283                 CPPFLAGS="-I$with_polylib_prefix/include $CPPFLAGS"
284                 LDFLAGS="-L$with_polylib_exec_prefix/lib $LDFLAGS"
285                 LD_LIBRARY_PATH="$with_polylib_exec_prefix/lib:$LD_LIBRARY_PATH"
286                 export LD_LIBRARY_PATH
287         else
288                 AC_MSG_RESULT(installed in standard location)
289         fi
290         for BITS in $polylibs; do
291                 cl_cv_polylib="polylib$BITS"
292                 AC_CHECK_LIB($cl_cv_polylib,PolyhedronTSort,[
293                         LIBS="-l$cl_cv_polylib $LIBS"
294                         break
295                 ])
296                 cl_cv_polylib=missing
297         done
299 if test "$cl_cv_polylib" = "missing"; then
300         AC_MSG_RESULT(Can't find PolyLib.)
301 else
302         AC_CHECK_HEADER(polylib/$cl_cv_polylib.h,[],
303                         [AC_MSG_ERROR(Can't find PolyLib headers.)])
306 AC_SUBST(GIT_INDEX)
307 if test -f $srcdir/.git/HEAD; then
308         GIT_INDEX="\$(top_srcdir)/.git/index"
312 dnl /**************************************************************************
313 dnl  *                     Where is Parma Polyhedral Library?                 *
314 dnl  **************************************************************************/
316 # The default back-end for polyhedral operations is PolyLib, unless
317 # -with-ppl is used.
318 AC_SUBST(POLYHEDRAL_BACKEND)
319 POLYHEDRAL_BACKEND=polylib
321 dnl Checking for PPL
322 ppl_major_version=0
323 ppl_minor_version=10
324 AC_SUBST(PPL_CPPFLAGS)
325 AC_SUBST(PPL_LDFLAGS)
326 AC_SUBST(PPL_LIBS)
328 AC_MSG_CHECKING(for Parma Polyhedral Library (PPL))
329 if test "x$with_ppl" != "x" -a "x$with_ppl" != "xno"; then
331         if test "x$with_polylib_prefix" != "x" -o "x$with_polylib_exec_prefix" != "x" -o "x$with_polylib_builddir" != "x"; then
332                 AC_MSG_ERROR([--with-polylib and --with-ppl are mutually exclusive])
333         fi
335         if test "x$with_ppl" != "xyes" ; then
336             ppl_prefix=$with_ppl
337             AC_MSG_RESULT(installed in $ppl_prefix)
338             CPPFLAGS="-I$ppl_prefix/include $CPPFLAGS"
339             LDFLAGS="-L$ppl_prefix/lib $LDFLAGS"
340             LD_LIBRARY_PATH="$ppl_prefix/lib:$LD_LIBRARY_PATH"
341             export LD_LIBRARY_PATH
342         else
343             AC_MSG_RESULT(installed at system prefix)
344         fi
345         POLYHEDRAL_BACKEND=ppl
347         AC_CHECK_HEADER(ppl_c.h,[],
348                         [AC_MSG_ERROR(Can't find PPL headers.)])
350         AC_MSG_CHECKING([for version $ppl_major_version.$ppl_minor_version of PPL])
351         AC_TRY_COMPILE([#include "ppl_c.h"],[
352         #if PPL_VERSION_MAJOR != $ppl_major_version || PPL_VERSION_MINOR != $ppl_minor_version
353         choke me
354         #endif
355         ], [AC_MSG_RESULT([yes])], [AC_MSG_ERROR(Can't find correct version of PPL.) ])
357         LIBS="$LIBS -lppl_c -lppl -lgmpxx"
358         AC_DEFINE([CLOOG_PPL_BACKEND], 1, [Use the PPL backend])
360 else
361         AC_MSG_RESULT(not using PPL)
364 dnl /**************************************************************************
365 dnl  *                            Substitutions                               *
366 dnl  **************************************************************************/
369 dnl Substitutions to do in Makefile.in.
370 AC_SUBST(target)
371 AC_SUBST(CC)
372 AC_SUBST(LN_S)
373 AC_SUBST(SHEXT)
375 AC_SUBST(prefix)
376 AC_SUBST(exec_prefix)
377 AC_SUBST(INSTALL)
379 AC_SUBST(BITS)
381 AC_CONFIG_FILES(Makefile test/Makefile include/cloog/cloog.h autoconf/Doxyfile)
382 AC_CONFIG_FILES(doc/Makefile)
383 dnl AC_CONFIG_FILES(include/cloog/version.h)
384 AC_CONFIG_FILES([genversion.sh], [chmod +x genversion.sh])
385 AC_CONFIG_COMMANDS([version.h],
386         [echo '#define CLOOG_HEAD "'`./genversion.sh`'"' > version.h])
387 AC_CONFIG_COMMANDS([doc/gitversion.texi],
388         [echo '@set VERSION '`./genversion.sh`'' > doc/gitversion.texi])
389 AC_OUTPUT
392 echo "             /*-----------------------------------------------*"
393 echo "              *           CLooG configuration is OK           *"
394 echo "              *-----------------------------------------------*/"
395 echo "It appears that your system is OK to start CLooG compilation. You need"
396 echo "now to type \"make\". After compilation, you should check CLooG by typing"
397 echo "\"make check\". If no problem occur, you can type \"make uninstall\" if"
398 echo "you are upgrading an old version. Lastly type \"make install\" to install"
399 echo "CLooG on your system (log as root if necessary)."