Look for include files in standard locations for building out of the source tree
[cloog-ppl.git] / configure.in
blob4b3f4c3f050b4aa38079e01b176aedfd04e30a9e
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
62 dnl Checks for typedefs, structures, and compiler characteristics.
63 AC_C_CONST
64 AC_TYPE_SIZE_T
68 dnl Checks for header files.
69 AC_HEADER_STDC
72 dnl Checks for library functions.
73 AC_CHECK_FUNCS(strtol)
76 dnl /**************************************************************************
77 dnl  *                             Option setting                             *
78 dnl  **************************************************************************/
80 dnl Some default values cause I'm not sure whether autoconf set them, while
81 dnl documentation says it does...
82 gmp_package="yes"
83 gmp_include_package="yes"
84 gmp_library_package="yes"
86 MP_BITS="MP"
87 MP_DFLAGS=-DLINEAR_VALUE_IS_MP
88 NEED_MP="no"
90 dnl --with-polylib=polylib-path
91 AC_ARG_WITH(polylib,
92             [  --with-polylib=DIR      DIR Location of the PolyLib],
93             [ echo "Package polylib : $withval" && polylib_package=$withval],
94             [ polylib_package=yes ])
95 AC_ARG_WITH(bits,
96             [  --with-bits=32|64|gmp   PolyLib library type to use],
97             [ echo "polylib$withval"; BITS=$withval ])
99 dnl --with-gmp=gmp-path
100 AC_ARG_WITH(gmp,
101         [  --with-gmp=DIR          DIR where the gmp package is installed],
102         [ echo "Package gmp : $withval" &&
103           gmp_package=$withval &&
104           GMP_INC=$gmp_package/include &&
105           GMP_LIB=$gmp_package/lib &&
106           NEED_MP="yes"])
108 AC_ARG_WITH(gmp-include,
109         [  --with-gmp-include=DIR  DIR where gmp.h is installed],
110         [ echo "Package gmp-include : $withval" &&
111           gmp_include_package=$withval &&
112           GMP_INC=$gmp_include_package &&
113           NEED_MP="yes"])
115 AC_ARG_WITH(gmp-library,
116         [  --with-gmp-library=DIR  DIR where the gmp library is installed],
117         [ echo "Package gmp-library : $withval" &&
118           gmp_library_package=$withval &&
119           GMP_LIB=$gmp_library_package &&
120           NEED_MP="yes"])
123 dnl /**************************************************************************
124 dnl  *                          Where is PolyLib?                             *
125 dnl  **************************************************************************/
127 polylibs="64 32"
128 case "$BITS" in
129     32|64|gmp)
130         polylibs=$BITS
131     ;;
132 esac
134 dnl Checking for PolyLib
135 AC_SUBST(cl_cv_polylib)
136 AC_MSG_CHECKING(whether PolyLib works)
137 if test "$polylib_package" = "no"; then
138   AC_MSG_RESULT(no)
139   AC_MSG_ERROR(Can't find PolyLib.)
140 else
141   AC_MSG_RESULT()
142   if test "$polylib_package" != "yes"; then
143     POLYLIB_DIR=$polylib_package
144     POLYLIB_LIB=$POLYLIB_DIR/lib
145     CPPFLAGS="-I$POLYLIB_DIR/include $CPPFLAGS"
146     LDFLAGS="-L$POLYLIB_DIR/lib $LDFLAGS"
147   fi
148   for BITS in $polylibs; do
149     cl_cv_polylib="polylib$BITS"
150     AC_CHECK_LIB($cl_cv_polylib,PolyhedronTSort,[break])
151     cl_cv_polylib=missing
152   done
153   if test "$cl_cv_polylib" = "missing"; then
154     AC_MSG_ERROR(Can't find PolyLib.)
155   else
156     LIBS="-l$cl_cv_polylib $LIBS"
157   fi
158   AC_CHECK_HEADER(polylib/$cl_cv_polylib.h,[],
159                [AC_MSG_ERROR(Can't find PolyLib headers.)])
163 dnl /**************************************************************************
164 dnl  *                            Where is GMP?                               *
165 dnl  **************************************************************************/
168 dnl Checking for gmp
169 AC_MSG_CHECKING(whether gmp works)
170 if test "$gmp_package" = "no"; then
171   echo "GMP package not defined"
172   AC_MSG_RESULT(no)
173   TO_BUILD_MP=""
174 else
175   if test "$NEED_MP" = "no"; then
176     echo "Mode normal GMP"
177     TO_BUILD="$TO_BUILD MP"
178     AC_CHECK_HEADER(gmp.h,
179                     [AC_CHECK_LIB(gmp,
180                                   __gmpz_init,
181                                   [LIBS="$LIBS -lgmp"],
182                                   [echo "Can't find gmp library." &&
183                                    echo "MP version will not be builded." &&
184                                    TO_BUILD_MP=""])],
185                     [echo "Can't find gmp headers." &&
186                      echo "MP version will not be builded." &&
187                      TO_BUILD_MP=""])
188   else
189     dnl Default given by --with-X is "yes", --without-X is "no". We also
190     dnl initialized manually all gmp_package* variables to "yes" (thus they are
191     dnl supposed to be "yes" except if the user set them himself).
192     
193     if test "$gmp_package" != "yes" ; then
194       echo "(GMP path has been set by user)"
195       GMP_DIR=$gmp_package
196       dnl Useful for AC_CHECK_X to find what we want.
197       CPPFLAGS="-I$GMP_DIR/include $CPPFLAGS"
198       LDFLAGS="-L$GMP_DIR/lib $LDFLAGS"
199     fi
200     
201     if test "$gmp_include_package" != "yes" ; then
202       CPPFLAGS="-I$GMP_INC $CPPFLAGS"
203     fi
204     
205     if test "$gmp_library_package" != "yes" ; then
206       LDFLAGS="-L$GMP_LIB $LDFLAGS"
207     fi
208      
209     AC_CHECK_HEADER(gmp.h,
210                     [],
211                     [AC_MSG_ERROR(Can't find gmp headers.)])
212     AC_CHECK_LIB(gmp,
213                  __gmpz_init,
214                  [LIBS="$LIBS -lgmp"],
215                  [AC_MSG_ERROR(Can't find gmp library.)])
216     
217     AC_MSG_RESULT(yes)
218   fi
222 dnl /**************************************************************************
223 dnl  *                            Substitutions                               *
224 dnl  **************************************************************************/
227 dnl Substitutions to do in Makefile.in.
228 AC_SUBST(target)
229 AC_SUBST(CC)
230 AC_SUBST(LN_S)
231 AC_SUBST(SHEXT)
233 AC_SUBST(prefix)
234 AC_SUBST(exec_prefix)
235 AC_SUBST(INSTALL)
237 AC_SUBST(BITS)
239 AC_OUTPUT(Makefile test/Makefile include/cloog/cloog.h autoconf/Doxyfile)
242 echo "             /*-----------------------------------------------*"
243 echo "              *           CLooG configuration is OK           *"
244 echo "              *-----------------------------------------------*/"
245 echo "It appears that your system is OK to start CLooG compilation. You need"
246 echo "now to type \"make\". After compilation, you should check CLooG by typing"
247 echo "\"make check\". If no problem occur, you can type \"make uninstall\" if"
248 echo "you are upgrading an old version. Lastly type \"make install\" to install"
249 echo "CLooG on your system (log as root if necessary)."