create backend (PolyLib) specific library
[cloog/uuh.git] / configure.in
blobf02807283de4efa5d4f04d8e04dec3b2f8ec3a76
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)
44 AM_INIT_AUTOMAKE(cloog, 0.14.0)
45 dnl default version
46 BITS="64"
48 dnl /**************************************************************************
49 dnl  *                              Checking                                  *
50 dnl  **************************************************************************/
52 dnl Checks for programs.
53 AC_PROG_CC
54 AC_PROG_LN_S
55 AC_PROG_MAKE_SET
56 AC_CHECK_PROG(CD, cd)
57 dnl Configure needs an empty install.sh file with this, i HATE that...
58 AC_PROG_INSTALL
59 AC_PROG_LIBTOOL
60 AC_CHECK_PROG(TEXI2DVI, texi2dvi, texi2dvi, [])
61 AM_CONDITIONAL(HAVE_TEXI2DVI, test -n "$TEXI2DVI")
63 CFLAGS="-fomit-frame-pointer"
65 dnl Checks for typedefs, structures, and compiler characteristics.
66 AC_C_CONST
67 AC_TYPE_SIZE_T
71 dnl Checks for header files.
72 AC_HEADER_STDC
75 dnl Checks for library functions.
76 AC_CHECK_FUNCS(strtol)
79 dnl /**************************************************************************
80 dnl  *                             Option setting                             *
81 dnl  **************************************************************************/
83 dnl Some default values cause I'm not sure whether autoconf set them, while
84 dnl documentation says it does...
85 gmp_package="yes"
86 gmp_include_package="yes"
87 gmp_library_package="yes"
89 MP_BITS="MP"
90 MP_DFLAGS=-DLINEAR_VALUE_IS_MP
91 NEED_MP="no"
93 dnl --with-polylib=polylib-path
94 AC_ARG_WITH(polylib_prefix,
95             [AS_HELP_STRING([--with-polylib-prefix=DIR],
96                             [Prefix of PolyLib installation])])
97 AC_ARG_WITH(polylib_exec_prefix,
98             [AS_HELP_STRING([--with-polylib-exec-prefix=DIR],
99                             [Exec prefix of PolyLib installation])])
100 AC_ARG_WITH(polylib_builddir,
101             [AS_HELP_STRING([--with-polylib-builddir=DIR],
102                             [Location of PolyLib builddir])])
103 AC_ARG_WITH(bits,
104             [  --with-bits=32|64|gmp   PolyLib library type to use],
105             [ echo "polylib$withval"; BITS=$withval ])
107 dnl --with-gmp=gmp-path
108 AC_ARG_WITH(gmp,
109         [  --with-gmp=DIR          DIR where the gmp package is installed],
110         [ echo "Package gmp : $withval" &&
111           gmp_package=$withval &&
112           GMP_INC=$gmp_package/include &&
113           GMP_LIB=$gmp_package/lib &&
114           NEED_MP="yes"])
116 AC_ARG_WITH(gmp-include,
117         [  --with-gmp-include=DIR  DIR where gmp.h is installed],
118         [ echo "Package gmp-include : $withval" &&
119           gmp_include_package=$withval &&
120           GMP_INC=$gmp_include_package &&
121           NEED_MP="yes"])
123 AC_ARG_WITH(gmp-library,
124         [  --with-gmp-library=DIR  DIR where the gmp library is installed],
125         [ echo "Package gmp-library : $withval" &&
126           gmp_library_package=$withval &&
127           GMP_LIB=$gmp_library_package &&
128           NEED_MP="yes"])
131 dnl /**************************************************************************
132 dnl  *                            Where is GMP?                               *
133 dnl  **************************************************************************/
136 dnl Checking for gmp
137 AC_MSG_CHECKING(whether gmp works)
138 if test "$gmp_package" = "no"; then
139   echo "GMP package not defined"
140   AC_MSG_RESULT(no)
141   TO_BUILD_MP=""
142 else
143   if test "$NEED_MP" = "no"; then
144     echo "Mode normal GMP"
145     TO_BUILD="$TO_BUILD MP"
146     AC_CHECK_HEADER(gmp.h,
147                     [AC_CHECK_LIB(gmp,
148                                   __gmpz_init,
149                                   [LIBS="$LIBS -lgmp"],
150                                   [echo "Can't find gmp library." &&
151                                    echo "MP version will not be builded." &&
152                                    TO_BUILD_MP=""])],
153                     [echo "Can't find gmp headers." &&
154                      echo "MP version will not be builded." &&
155                      TO_BUILD_MP=""])
156   else
157     dnl Default given by --with-X is "yes", --without-X is "no". We also
158     dnl initialized manually all gmp_package* variables to "yes" (thus they are
159     dnl supposed to be "yes" except if the user set them himself).
160     
161     if test "$gmp_package" != "yes" ; then
162       echo "(GMP path has been set by user)"
163       GMP_DIR=$gmp_package
164       dnl Useful for AC_CHECK_X to find what we want.
165       CPPFLAGS="-I$GMP_DIR/include $CPPFLAGS"
166       LDFLAGS="-L$GMP_DIR/lib $LDFLAGS"
167     fi
168     
169     if test "$gmp_include_package" != "yes" ; then
170       CPPFLAGS="-I$GMP_INC $CPPFLAGS"
171     fi
172     
173     if test "$gmp_library_package" != "yes" ; then
174       LDFLAGS="-L$GMP_LIB $LDFLAGS"
175     fi
176      
177     AC_CHECK_HEADER(gmp.h,
178                     [],
179                     [AC_MSG_ERROR(Can't find gmp headers.)])
180     AC_CHECK_LIB(gmp,
181                  __gmpz_init,
182                  [LIBS="$LIBS -lgmp"],
183                  [AC_MSG_ERROR(Can't find gmp library.)])
184     
185     AC_MSG_RESULT(yes)
186   fi
189 # all compiled libraries
190 CLOOG_LIBRARIES=""
191 AC_SUBST(CLOOG_LIBRARIES)
192 # backend used by executables
193 BACKEND=""
194 AC_SUBST(BACKEND)
196 dnl /**************************************************************************
197 dnl  *                          Where is PolyLib?                             *
198 dnl  **************************************************************************/
200 polylibs="64 32"
201 case "$BITS" in
202     32|64|gmp)
203         polylibs=$BITS
204     ;;
205 esac
207 dnl Checking for PolyLib
208 AC_SUBST(cl_cv_polylib)
209 AC_SUBST(POLYLIB_CPPFLAGS)
210 AC_SUBST(POLYLIB_LDFLAGS)
211 AC_SUBST(POLYLIB_LIBS)
213 if test "x$with_polylib_prefix" != "x" -a "x$with_polylib_exec_prefix" = "x"
214 then
215         with_polylib_exec_prefix=$with_polylib_prefix
217 if test "x$with_polylib_prefix" != "x" -a "x$with_polylib_builddir" != "x"; then
218         AC_MSG_ERROR(
219         [--with-polylib-prefix and --with-polylib-builddir are mutually exclusive])
222 AC_MSG_CHECKING(for location of PolyLib)
223 if test "x$with_polylib_builddir" != "x"; then
224         AC_MSG_RESULT(built in $with_polylib_builddir)
225         polylib_srcdir=`echo @abs_srcdir@ | $with_polylib_builddir/config.status --file=-`
226         AC_MSG_NOTICE(PolyLib sources in $polylib_srcdir)
227         polylib_polylibs=`echo @polylibs@ | $with_polylib_builddir/config.status --file=-`
228         AC_MSG_NOTICE(Configured polylibs: $polylib_polylibs)
229         CPPFLAGS="-I$with_polylib_builddir/include -I$polylib_srcdir/include $CPPFLAGS"
230         for BITS in $polylibs; do
231                 cl_cv_polylib=missing
232                 for PL in $polylib_polylibs; do
233                         if test "libpolylib$BITS.la" = $PL; then
234                                 cl_cv_polylib="polylib$BITS"
235                                 break;
236                         fi
237                 done
238                 if test "$cl_cv_polylib" != "missing"; then
239                         LIBS="$with_polylib_builddir/lib$cl_cv_polylib.la $LIBS"
240                         break;
241                 fi
242         done
243 else
244         if test "x$with_polylib_prefix" != "x"; then
245                 AC_MSG_RESULT(installed in $with_polylib_exec_prefix)
246                 CPPFLAGS="-I$with_polylib_prefix/include $CPPFLAGS"
247                 LDFLAGS="-L$with_polylib_exec_prefix/lib $LDFLAGS"
248                 LD_LIBRARY_PATH="$with_polylib_exec_prefix/lib:$LD_LIBRARY_PATH"
249                 export LD_LIBRARY_PATH
250         else
251                 AC_MSG_RESULT(installed in standard location)
252         fi
253         for BITS in $polylibs; do
254                 cl_cv_polylib="polylib$BITS"
255                 AC_CHECK_HEADER(polylib/$cl_cv_polylib.h,[
256                         AC_CHECK_LIB($cl_cv_polylib,PolyhedronTSort,[
257                                 LIBS="-l$cl_cv_polylib $LIBS"
258                                 break
259                         ])
260                 ])
261                 cl_cv_polylib=missing
262         done
264 if test "$cl_cv_polylib" = "missing"; then
265         AC_MSG_ERROR(Can't find PolyLib.)
266 else
267         CLOOG_LIBRARIES="$CLOOG_LIBRARIES libcloog-polylib.la"
268         BACKEND="polylib"
270 case "$BITS" in
271         gmp)
272                 cl_cv_int_type=gmp
273                 ;;
274         32|64)
275                 AC_CHECK_SIZEOF(int,1)
276                 AC_CHECK_SIZEOF(long,1)
277                 AC_CHECK_SIZEOF(long long,1)
278                 for cl_cv_int_type in int long long_long; do
279                         eval "bits=\`expr \$ac_cv_sizeof_$cl_cv_int_type \* 8\`"
280                         if test "$bits" = "$BITS"; then
281                                 break
282                         fi
283                 done
284                 ;;
285 esac
286 AC_DEFINE_UNQUOTED(AS_TR_CPP(CLOOG_INT_$cl_cv_int_type))
288 AC_SUBST(GIT_INDEX)
289 if test -f $srcdir/.git/HEAD; then
290         GIT_INDEX="\$(top_srcdir)/.git/index"
294 dnl /**************************************************************************
295 dnl  *                            Substitutions                               *
296 dnl  **************************************************************************/
299 dnl Substitutions to do in Makefile.in.
300 AC_SUBST(target)
301 AC_SUBST(CC)
302 AC_SUBST(LN_S)
303 AC_SUBST(SHEXT)
305 AC_SUBST(prefix)
306 AC_SUBST(exec_prefix)
307 AC_SUBST(INSTALL)
309 AC_SUBST(BITS)
311 AC_CONFIG_HEADERS(config.h)
312 AC_CONFIG_HEADERS(include/cloog/int.h)
313 AC_CONFIG_FILES(Makefile test/Makefile include/cloog/polylib/cloog.h)
314 AC_CONFIG_FILES(autoconf/Doxyfile)
315 AC_CONFIG_FILES(doc/Makefile)
316 AC_CONFIG_FILES(source/version.c)
317 AC_CONFIG_FILES([genversion.sh], [chmod +x genversion.sh])
318 AC_CONFIG_COMMANDS([version.h],
319         [echo '#define CLOOG_HEAD "'`./genversion.sh`'"' > version.h])
320 AC_CONFIG_COMMANDS([doc/gitversion.texi],
321         [echo '@set VERSION '`./genversion.sh`'' > doc/gitversion.texi])
322 AC_OUTPUT
325 echo "             /*-----------------------------------------------*"
326 echo "              *           CLooG configuration is OK           *"
327 echo "              *-----------------------------------------------*/"
328 echo "It appears that your system is OK to start CLooG compilation. You need"
329 echo "now to type \"make\". After compilation, you should check CLooG by typing"
330 echo "\"make check\". If no problem occur, you can type \"make uninstall\" if"
331 echo "you are upgrading an old version. Lastly type \"make install\" to install"
332 echo "CLooG on your system (log as root if necessary)."