make installed header files independent of configure options
[cloog/uuh.git] / configure.in
blob7d243b472cdc4cc538deb63950af92fbf70c76e4
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 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.      *
26 dnl *                                                                         *
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.                         *
31 dnl *                                                                         *
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                                             *
36 dnl *                                                                         *
37 dnl * CLooG, the Chunky Loop Generator                                        *
38 dnl * Written by Cedric Bastoul, Cedric.Bastoul@inria.fr                      *
39 dnl *                                                                         *
40 dnl ***************************************************************************/
42 AC_PREREQ(2.13)
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)
47 dnl default version
48 BITS="64"
50 dnl /**************************************************************************
51 dnl  *                              Checking                                  *
52 dnl  **************************************************************************/
54 dnl Checks for programs.
55 AC_PROG_CC
56 AC_PROG_LN_S
57 AC_PROG_MAKE_SET
58 AC_CHECK_PROG(CD, cd)
59 dnl Configure needs an empty install.sh file with this, i HATE that...
60 AC_PROG_INSTALL
61 AC_PROG_LIBTOOL
62 AC_CHECK_PROG(TEXI2DVI, texi2dvi, texi2dvi, [])
63 AM_CONDITIONAL(HAVE_TEXI2DVI, test -n "$TEXI2DVI")
65 AX_CC_MAXOPT
66 AC_SUBST(CFLAGS_WARN)
67 AX_CFLAGS_WARN_ALL(CFLAGS_WARN)
69 dnl Checks for typedefs, structures, and compiler characteristics.
70 AC_C_CONST
71 AC_TYPE_SIZE_T
75 dnl Checks for header files.
76 AC_HEADER_STDC
79 dnl Checks for library functions.
80 AC_CHECK_FUNCS(strtol)
83 dnl /**************************************************************************
84 dnl  *                             Option setting                             *
85 dnl  **************************************************************************/
87 MP_BITS="MP"
88 MP_DFLAGS=-DLINEAR_VALUE_IS_MP
90 AC_CHECK_HEADERS([sys/resource.h],
91         [AC_DEFINE([CLOOG_RUSAGE], [], [Print time required to generate code])])
93 AC_ARG_WITH(bits,
94             [AS_HELP_STRING([--with-bits=32|64|gmp],
95                             [integer type to use])],
96             [ BITS=$withval ])
98 AX_SUBMODULE(isl,no|system|build|bundled,bundled)
99 if test "$with_isl" != "no"; then
100         BITS="gmp"
103 dnl /**************************************************************************
104 dnl  *                            Where is GMP?                               *
105 dnl  **************************************************************************/
107 gmp_module_default=no
108 if test "$BITS" = "gmp"; then
109         gmp_module_default=system
111 AX_SUBMODULE(gmp,no|system,$gmp_module_default)
113 need_get_memory_functions=false
114 case "$with_gmp" in
115 system)
116     if test "x$with_gmp_prefix" != "x"; then
117         CPPFLAGS="-I$with_gmp_prefix/include $CPPFLAGS"
118     fi
119     
120     if test "$with_gmp_exec_prefix" != "yes" ; then
121         LDFLAGS="-L$with_gmp_exec_prefix/lib $LDFLAGS"
122     fi
123      
124     AC_CHECK_HEADER(gmp.h,
125                     [],
126                     [AC_MSG_ERROR(Can't find gmp headers.)])
127     AC_CHECK_LIB(gmp,
128                  __gmpz_init,
129                  [LIBS="$LIBS -lgmp"],
130                  [AC_MSG_ERROR(Can't find gmp library.)])
131     AC_CHECK_DECLS(mp_get_memory_functions,[],[
132             need_get_memory_functions=true
133     ],[#include <gmp.h>])
134     ;;
135 esac
136 AM_CONDITIONAL(NEED_GET_MEMORY_FUNCTIONS,
137                 test x$need_get_memory_functions = xtrue)
139 # all compiled libraries
140 CLOOG_LIBRARIES=""
141 AC_SUBST(CLOOG_LIBRARIES)
142 # backend used by executables
143 BACKEND=""
144 AC_SUBST(BACKEND)
146 dnl /**************************************************************************
147 dnl  *                          Where is PolyLib?                             *
148 dnl  **************************************************************************/
150 AX_SUBMODULE(polylib,no|system|build,system)
152 polylibs="64 32"
153 case "$BITS" in
154     32|64|gmp)
155         polylibs=$BITS
156     ;;
157 esac
159 dnl Checking for PolyLib
160 AC_SUBST(cl_cv_polylib)
161 AC_SUBST(POLYLIB_CPPFLAGS)
162 AC_SUBST(POLYLIB_LDFLAGS)
163 AC_SUBST(POLYLIB_LIBS)
165 AC_MSG_CHECKING(for location of PolyLib)
166 if test "x$with_polylib_builddir" != "x"; then
167         with_polylib_builddir=`cd $with_polylib_builddir; pwd`
168         AC_MSG_RESULT(built in $with_polylib_builddir)
169         polylib_polylibs=`echo @polylibs@ | $with_polylib_builddir/config.status --file=-`
170         AC_MSG_NOTICE(Configured polylibs: $polylib_polylibs)
171         POLYLIB_CPPFLAGS="-I$with_polylib_builddir/include -I$polylib_srcdir/include"
172         for BITS in $polylibs; do
173                 cl_cv_polylib=missing
174                 for PL in $polylib_polylibs; do
175                         if test "libpolylib$BITS.la" = $PL; then
176                                 cl_cv_polylib="polylib$BITS"
177                                 break;
178                         fi
179                 done
180                 if test "$cl_cv_polylib" != "missing"; then
181                         POLYLIB_LIBS="$with_polylib_builddir/lib$cl_cv_polylib.la"
182                         break;
183                 fi
184         done
185 elif test "$with_polylib" != "no"; then
186         if test "x$with_polylib_prefix" != "x"; then
187                 with_polylib_prefix=`cd $with_polylib_prefix; pwd`
188                 AC_MSG_RESULT(installed in $with_polylib_exec_prefix)
189                 POLYLIB_CPPFLAGS="-I$with_polylib_prefix/include"
190                 POLYLIB_LDFLAGS="-L$with_polylib_exec_prefix/lib"
191                 LD_LIBRARY_PATH="$with_polylib_exec_prefix/lib:$LD_LIBRARY_PATH"
192                 export LD_LIBRARY_PATH
193         else
194                 AC_MSG_RESULT(installed in standard location)
195         fi
196         SAVE_CPPFLAGS="$CPPFLAGS"
197         SAVE_LDFLAGS="$LDFLAGS"
198         CPPFLAGS="$POLYLIB_CPPFLAGS $CPPFLAGS"
199         LDFLAGS="$POLYLIB_LDFLAGS $LDFLAGS"
200         for BITS in $polylibs; do
201                 cl_cv_polylib="polylib$BITS"
202                 AC_CHECK_HEADER(polylib/$cl_cv_polylib.h,[
203                         AC_CHECK_LIB($cl_cv_polylib,PolyhedronTSort,[
204                                 POLYLIB_LIBS="-l$cl_cv_polylib"
205                                 break
206                         ])
207                 ])
208                 cl_cv_polylib=missing
209         done
210         CPPFLAGS="$SAVE_CPPFLAGS"
211         LDFLAGS="$SAVE_LDFLAGS"
213 case "$cl_cv_polylib" in
214 missing)
215         AC_MSG_WARN(Can't find PolyLib.)
216         ;;
217 polylib*)
218         CLOOG_LIBRARIES="$CLOOG_LIBRARIES libcloog-polylib.la"
219         BACKEND="polylib"
220         ;;
221 esac
223 dnl /**************************************************************************
224 dnl  *                          Where is isl?                                 *
225 dnl  **************************************************************************/
227 AC_SUBST(ISL_CPPFLAGS)
228 AC_SUBST(ISL_LDFLAGS)
229 AC_SUBST(ISL_LIBS)
230 case "$with_isl" in
231 bundled)
232         ISL_CPPFLAGS="-I$srcdir/isl/include -Iisl/include"
233         ;;
234 build)
235         ISL_CPPFLAGS="-I$isl_srcdir/include -I$with_isl_builddir/include"
236         ISL_LIBS="$with_isl_builddir/libisl.la"
237         ;;
238 system)
239         if test "x$with_isl_prefix" != "x"; then
240                 ISL_CPPFLAGS="-I$with_isl_prefix/include"
241         fi
242         if test "x$with_isl_exec_prefix" != "x"; then
243                 ISL_LDFLAGS="-L$with_isl_exec_prefix/lib"
244         fi
245         ISL_LIBS="-lisl"
246 esac
247 if test "$with_isl" != "no"; then
248         CLOOG_LIBRARIES="$CLOOG_LIBRARIES libcloog-isl.la"
249         BACKEND="isl"
251 AM_CONDITIONAL(BUNDLED_ISL, test $with_isl = bundled)
253 if test -z "$BACKEND"; then
254         AC_MSG_ERROR(No backend specified or found.)
258 case "$BITS" in
259         gmp)
260                 cl_cv_int_type=gmp
261                 ;;
262         32|64)
263                 AC_CHECK_SIZEOF(int,1)
264                 AC_CHECK_SIZEOF(long,1)
265                 AC_CHECK_SIZEOF(long long,1)
266                 for cl_cv_int_type in int long long_long; do
267                         eval "bits=\`expr \$ac_cv_sizeof_$cl_cv_int_type \* 8\`"
268                         if test "$bits" = "$BITS"; then
269                                 break
270                         fi
271                 done
272                 ;;
273 esac
274 AH_TEMPLATE(CLOOG_INT_INT)
275 AH_TEMPLATE(CLOOG_INT_LONG)
276 AH_TEMPLATE(CLOOG_INT_LONG_LONG)
277 AH_TEMPLATE(CLOOG_INT_GMP)
278 AC_DEFINE_UNQUOTED(AS_TR_CPP(CLOOG_INT_$cl_cv_int_type))
280 AC_SUBST(GIT_INDEX)
281 if test -f $srcdir/.git/HEAD; then
282         GIT_INDEX="\$(top_srcdir)/.git/index"
286 dnl /**************************************************************************
287 dnl  *                            Substitutions                               *
288 dnl  **************************************************************************/
291 dnl Substitutions to do in Makefile.in.
292 AC_SUBST(target)
293 AC_SUBST(CC)
294 AC_SUBST(LN_S)
295 AC_SUBST(SHEXT)
297 AC_SUBST(prefix)
298 AC_SUBST(exec_prefix)
299 AC_SUBST(INSTALL)
301 AC_SUBST(BITS)
303 AC_CONFIG_FILES(Makefile test/Makefile include/cloog/polylib/backend.h)
304 AC_CONFIG_FILES(autoconf/Doxyfile)
305 AC_CONFIG_FILES(doc/Makefile)
306 AC_CONFIG_FILES(source/version.c)
307 AC_CONFIG_FILES([genversion.sh], [chmod +x genversion.sh])
308 AC_CONFIG_COMMANDS([version.h],
309         [echo '#define CLOOG_HEAD "'`./genversion.sh`'"' > version.h])
310 AC_CONFIG_COMMANDS([doc/gitversion.texi],
311         [echo '@set VERSION '`./genversion.sh`'' > doc/gitversion.texi])
312 if test $with_isl = bundled; then
313         AC_CONFIG_SUBDIRS(isl)
315 AC_CONFIG_COMMANDS_POST([
316         old_args=""
317         for arg in $ac_configure_args; do
318                 case arg in
319                 --with-polylib*)
320                         ;;
321                 *)
322                         old_args="$old_args $arg"
323                         ;;
324                 esac
325         done
326         ac_configure_args="$old_args $cloog_configure_args"
328 AC_OUTPUT
331 echo "             /*-----------------------------------------------*"
332 echo "              *           CLooG configuration is OK           *"
333 echo "              *-----------------------------------------------*/"
334 echo "It appears that your system is OK to start CLooG compilation. You need"
335 echo "now to type \"make\". After compilation, you should check CLooG by typing"
336 echo "\"make check\". If no problem occur, you can type \"make uninstall\" if"
337 echo "you are upgrading an old version. Lastly type \"make install\" to install"
338 echo "CLooG on your system (log as root if necessary)."