First commit : 0.14.0 version (with roadmap in doc instead of
[cloog/uuh.git] / autoconf / configure.in
blob2f3a9e9f9d751e1ba5aaf383965b657e3ce332c8
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 RELEASE="0.14.0"
45 dnl default version
46 VERSION="64"
48 dnl /**************************************************************************
49 dnl  *                              Checking                                  *
50 dnl  **************************************************************************/
53 dnl Checks for typedefs, structures, and compiler characteristics.
54 AC_CANONICAL_SYSTEM 
57 dnl Checks for programs.
58 AC_PROG_CC
59 AC_PROG_LN_S
60 AC_PROG_RANLIB
61 AC_PROG_MAKE_SET
62 AC_CHECK_PROG(CD, cd)
63 dnl Configure needs an empty install.sh file with this, i HATE that...
64 AC_PROG_INSTALL
67 dnl Checks for typedefs, structures, and compiler characteristics.
68 AC_C_CONST
69 AC_TYPE_SIZE_T
72 dnl Checks for libraries.
73 dnl Replace `main' with a function in -lc:
74 AC_CHECK_LIB(c,main)
77 dnl Checks for header files.
78 AC_HEADER_STDC
81 dnl Checks for library functions.
82 AC_CHECK_FUNCS(strtol)
85 dnl Set some system dependant values.
86 case "$target" in
87   i*-pc-cygwin)
88         SHEXT="dll"
89         EXEC_SUFFIX=".exe"      
90         EXTRA_FLAGS="-DCYGWIN"
91         EXTRA_LIBS="-lcygwin -lkernel32"
92         CLOOGLIB="cloogstaticlib"
93         INSTALL_CLOOGLIB="install_cloogstaticlib" ;;
94   *)
95         SHEXT="so"
96         EXEC_SUFFIX=""
97         EXTRA_FLAGS=""
98         EXTRA_LIBS=""
99         CLOOGLIB="cloogsharedlib cloogstaticlib"
100         INSTALL_CLOOGLIB="install_cloogsharedlib install_cloogstaticlib" ;;
101 esac
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)
108 SOLARIS_LD=no
109 case $target_os in
110     solaris*)
111         case `which ld` in
112            /usr/ccs/bin/ld|/usr/ucb/ld)
113                SOLARIS_LD=yes
114                ;;
115            *)
116                ld -shared 2>&1 | grep 'fatal: option -h'
117                if test "$?" = "0"; then
118                    SOLARIS_LD=yes
119                fi
120                ;;
121         esac
122         ;;
123     *)
124         ;;
125 esac
126 SOLARIS_LDFLAGS=''
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.
137 CLOOG="cloog"
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...
142 gmp_package="yes"
143 gmp_include_package="yes"
144 gmp_library_package="yes"
146 MP_BITS="MP"
147 MP_DFLAGS=-DLINEAR_VALUE_IS_MP
148 NEED_MP="no"
149 GMP_INC="/usr/local/include"
150 GMP_LIB="/usr/local/lib"
153 dnl Options.
154 dnl --with-cloog=yes, --with-cloog=no ou --without-cloog
155 AC_ARG_WITH(cloog,
156             [  --without-cloog         disable the compilation of cloog],
157             [ echo "Package cloog : $withval" &&
158               if test "$withval"="no" ; then    
159                 CLOOG=""
160                 INSTALL_CLOOG=""
161               fi ])
163 dnl --with-lib=yes,   --with-lib=no   ou --without-lib
164 AC_ARG_WITH(lib,
165             [  --without-lib           disable the compilation of cloog's lib],
166             [ echo "Package clooglib : $withval" &&
167               if test "$withval"="no" ; then    
168                 CLOOGLIB=""
169                 INSTALL_CLOOGLIB=""
170               fi ])
172 dnl --with-polylib=polylib-path
173 AC_ARG_WITH(polylib,
174             [  --with-polylib=DIR      DIR Location of the PolyLib],
175             [ echo "Package polylib : $withval" && polylib_package=$withval],
176             [ polylib_package=yes ])
177 AC_ARG_WITH(bits,
178             [  --with-bits=32|64|gmp   PolyLib library type to use],
179             [ echo "polylib$withval"; VERSION=$withval ])
181 dnl --with-gmp=gmp-path
182 AC_ARG_WITH(gmp,
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 &&
188           NEED_MP="yes"])
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 &&
195           NEED_MP="yes"])
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 &&
202           NEED_MP="yes"])
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  **************************************************************************/
213 polylibs="64 32"
214 case "$VERSION" in
215     32|64|gmp)
216         polylibs=$VERSION
217     ;;
218 esac
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
224   AC_MSG_RESULT(no)
225   AC_MSG_ERROR(Can't find PolyLib.)
226 else
227   AC_MSG_RESULT()
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"
233   fi
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
238   done
239   if test "$cl_cv_polylib" = "missing"; then
240     AC_MSG_ERROR(Can't find PolyLib.)
241   else
242     LIBS="-l$cl_cv_polylib $LIBS"
243   fi
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  **************************************************************************/
254 dnl Checking for gmp
255 AC_MSG_CHECKING(whether gmp works)
256 if test "$gmp_package" = "no"; then
257   echo "GMP package not defined"
258   AC_MSG_RESULT(no)
259   TO_BUILD_MP=""
260 else
261   if test "$NEED_MP" = "no"; then
262     echo "Mode normal GMP"
263     TO_BUILD="$TO_BUILD MP"
264     AC_CHECK_HEADER(gmp.h,
265                     [AC_CHECK_LIB(gmp,
266                                   __gmpz_init,
267                                   [EXTRA_LIBS="$EXTRA_LIBS -lgmp"],
268                                   [echo "Can't find gmp library." &&
269                                    echo "MP version will not be builded." &&
270                                    TO_BUILD_MP=""])],
271                     [echo "Can't find gmp headers." &&
272                      echo "MP version will not be builded." &&
273                      TO_BUILD_MP=""])
274   else
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).
278     
279     if test "$gmp_package" != "yes" ; then
280       echo "(GMP path has been set by user)"
281       GMP_DIR=$gmp_package
282       GMP_LIB=$GMP_DIR/lib
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"
289     fi
290     
291     if test "$gmp_include_package" != "yes" ; then
292       CPPFLAGS="-I$GMP_DIR/include $CPPFLAGS"
293       EXTRA_INC="-I$GMP_INC"
294     fi
295     
296     if test "$gmp_library_package" != "yes" ; then
297       EXTRA_LIBS="$EXTRA_LIBS -L$GMP_LIB"
298       LDFLAGS="-L$GMP_DIR/lib $LDFLAGS"
299     fi
300      
301     AC_CHECK_HEADER(gmp.h,
302                     [],
303                     [AC_MSG_ERROR(Can't find gmp headers.)])
304     AC_CHECK_LIB(gmp,
305                  __gmpz_init,
306                  [EXTRA_LIBS="$EXTRA_LIBS -lgmp"],
307                  [AC_MSG_ERROR(Can't find gmp library.)])
308     
309     AC_MSG_RESULT(yes)
310   fi
314 dnl /**************************************************************************
315 dnl  *                            Substitutions                               *
316 dnl  **************************************************************************/
319 dnl Substitutions to do in Makefile.in.
320 AC_SUBST(RELEASE)
321 AC_SUBST(target)
322 AC_SUBST(CC)
323 AC_SUBST(LN_S)
324 AC_SUBST(RANLIB)
325 AC_SUBST(SHEXT)
326 AC_SUBST(EXEC_SUFFIX)
327 AC_SUBST(EXTRA_FLAGS)
328 AC_SUBST(EXTRA_LIBS)
330 AC_SUBST(POLYLIB_LIB)
331 AC_SUBST(prefix)
332 AC_SUBST(exec_prefix)
333 AC_SUBST(INSTALL)
334 AC_SUBST(PACKAGES)
335 AC_SUBST(INSTALL_PACKAGES)
337 AC_SUBST(VERSION)
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)."