Clean checking system and add valcheck (check with Valgrind)
[candl.git] / configure.ac
blob03c9ce41333f87ae73a23b08e20465b5bf51041d
1 dnl /**-------------------------------------------------------------------**
2 dnl  **                              CAnDL                                **
3 dnl  **-------------------------------------------------------------------**
4 dnl  **                           configure.in                            **
5 dnl  **-------------------------------------------------------------------**
6 dnl  **                 First version: september 8th 2003                 **
7 dnl  **-------------------------------------------------------------------**/
8 dnl 
9 dnl /**************************************************************************
10 dnl *   CAnDL : the Chunky Analyser for Dependences in Loops (experimental)   *
11 dnl ***************************************************************************
12 dnl *                                                                         *
13 dnl * Copyright (C) 2003-2008 Cedric Bastoul                                  *
14 dnl *                                                                         *
15 dnl * This is free software; you can redistribute it and/or modify it under   *
16 dnl * the terms of the GNU General Public License as published by the Free    *
17 dnl * Software Foundation; either version 2 of the License, or (at your       *
18 dnl * option) any later version.                                              *
19 dnl *                                                                         *
20 dnl * This software is distributed in the hope that it will be useful, but    *
21 dnl * WITHOUT ANY WARRANTY; without even the implied warranty of              *
22 dnl * MERCHANTABILITYor FITNESS FOR A PARTICULAR PURPOSE.  See the GNU        *
23 dnl * General Public License for more details.                                *
24 dnl *                                                                         *
25 dnl * You should have received a copy of the GNU General Public License along *
26 dnl * with software; if not, write to the Free Software Foundation, Inc.,     *
27 dnl * 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA                  *
28 dnl *                                                                         *
29 dnl * CAnDL, the Chunky Dependence Analyser                                   *
30 dnl * Written by Cedric Bastoul, Cedric.Bastoul@inria.fr                      *
31 dnl *                                                                         *
32 dnl ***************************************************************************/
34 m4_define([version_major], [0])
35 m4_define([version_minor], [0])
36 m4_define([version_revision], [1])
38 AC_PREREQ(2.53)
40 dnl Fill here the @bug email adress.
41 AC_INIT([candl], [0.6.2], [cedric.bastoul@inria.fr,pouchet@cse.ohio-state.edu])
43 AC_CONFIG_SRCDIR([include/candl/candl.h])
45 dnl Put as most as possible configuration files to an auxialiry
46 dnl directory.
47 AC_CONFIG_AUX_DIR(autoconf)
48 AC_CONFIG_MACRO_DIR([m4])
50 dnl Initialize automake. Here, a special tar version that enables
51 dnl (very) long filenames.
52 #AM_INIT_AUTOMAKE([1.9 tar-ustar no-define foreign dist-bzip2])
53 AM_INIT_AUTOMAKE([foreign])
54 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
56 dnl default version
57 BITS="MP"
58 CPPFLAGS=-DCANDL_LINEAR_VALUE_IS_MP
61 dnl /**************************************************************************
62 dnl  *                              Checking                                  *
63 dnl  **************************************************************************/
66 dnl Checks for programs.
67 AC_PROG_CC
68 AC_PROG_LN_S
69 AC_PROG_MAKE_SET
70 AC_CHECK_PROG(CD, cd)
71 AC_PROG_INSTALL
72 AC_PROG_LIBTOOL
73 AC_CHECK_PROGS(DOXYGEN,doxygen,doxygen)
75 AX_CC_MAXOPT
76 AC_SUBST(CFLAGS_WARN)
77 AX_CFLAGS_WARN_ALL(CFLAGS_WARN)
79 dnl Checks for typedefs, structures, and compiler characteristics.
80 AC_C_CONST
81 AC_TYPE_SIZE_T
83 dnl Checks for header files.
84 AC_HEADER_STDC
85 AC_CHECK_HEADERS([errno.h stddef.h stdlib.h string.h strings.h unistd.h])
87 dnl Checks for library functions.
88 AC_CHECK_FUNCS(strtol)
91 dnl /**************************************************************************
92 dnl  *                             Option setting                             *
93 dnl  **************************************************************************/
95 dnl /**************************************************************************
96 dnl  *                   Where is the OpenScop Library?                       *
97 dnl  **************************************************************************/
99 AX_SUBMODULE(osl,system|build|bundled,system)
101 AC_SUBST(OSL_CPPFLAGS)
102 AC_SUBST(OSL_LDFLAGS)
103 AC_SUBST(OSL_LIBS)
104 case "$with_osl" in
105 bundled)
106   OSL_CPPFLAGS="-I$srcdir/osl/include -Iosl/include"
107   OSL_LIBS="$srcdir/osl/libosl.la"
108   ;;
109 build)
110   OSL_CPPFLAGS="-I$osl_srcdir/include -I$with_osl_builddir/include"
111   OSL_LIBS="$with_osl_builddir/libosl.la"
112   ;;
113 system)
114   if test "x$with_osl_prefix" != "x"; then
115     OSL_CPPFLAGS="-I$with_osl_prefix/include"
116   fi
117   if test "x$with_osl_exec_prefix" != "x"; then
118     OSL_LDFLAGS="-L$with_osl_exec_prefix/lib"
119   fi
120   OSL_LIBS="$with_osl_prefix/lib/libosl.la -losl"
121 esac
122 AM_CONDITIONAL(BUNDLED_OSL, test $with_osl = bundled)
126 dnl GMP
128 dnl Some default values cause I'm not sure whether autoconf set them, while
129 dnl documentation says it does...
130 gmp_package="yes"
131 gmp_include_package="yes"
132 gmp_library_package="yes"
134 NEED_MP="no"
136 dnl --with-gmp=gmp-path
137 AC_ARG_WITH(gmp,
138         [  --with-gmp=DIR          DIR where the gmp package is installed],
139   [ echo "Package gmp : $withval" &&
140     gmp_package=$withval &&
141           GMP_INC=$gmp_package/include &&
142           GMP_LIB=$gmp_package/lib &&
143           CPPFLAGS=-DCANDL_LINEAR_VALUE_IS_MP &&
144           NEED_MP="yes"])
146 AC_ARG_WITH(gmp-include,
147         [  --with-gmp-include=DIR  DIR where gmp.h is installed],
148   [ echo "Package gmp-include : $withval" &&
149     gmp_include_package=$withval &&
150           GMP_INC=$gmp_include_package &&
151           CPPFLAGS=-DCANDL_LINEAR_VALUE_IS_MP &&
152     NEED_MP="yes"])
154 AC_ARG_WITH(gmp-library,
155         [  --with-gmp-library=DIR  DIR where the gmp library is installed],
156   [ echo "Package gmp-library : $withval" &&
157     gmp_library_package=$withval &&
158           GMP_LIB=$gmp_library_package &&
159           CPPFLAGS=-DCANDL_LINEAR_VALUE_IS_MP &&
160     NEED_MP="yes"])
162 AC_ARG_ENABLE(int-version,
163   [  --enable-int-version    'int' (32 bits) version is built],
164   [ echo "Package int : $enableval" &&
165     BITS="32" &&
166           CPPFLAGS=-DCANDL_LINEAR_VALUE_IS_LONG])
168 AC_ARG_ENABLE(llint-version,
169   [  --enable-llint-version  'long long int' (64 bits) version is built],
170   [ echo "Package long long int : $enableval" &&
171     BITS="64" &&
172           CPPFLAGS=-DCANDL_LINEAR_VALUE_IS_LONGLONG])
174 AC_ARG_ENABLE(mp-version,
175   [  --enable-mp-version     'MP' (multiple precision) version is built],
176   [ echo "Package mp : $enableval" &&
177     BITS="MP" &&
178           CPPFLAGS=-DCANDL_LINEAR_VALUE_IS_MP &&
179           NEED_MP="yes"])
181 AC_ARG_ENABLE(piplib-hybrid,
182   [  --enable-piplib-hybrid   Link with piplib-hybrid],
183   [ echo "Piplib-hybrid support : $enableval" &&
184           if test "x$enableval" = "xyes"; then 
185             CPPFLAGS=-DCANDL_HAS_PIPLIB_HYBRID
186           fi])
189 dnl /**************************************************************************
190 dnl  *                   Where is the PipLib Library?                         *
191 dnl  **************************************************************************/
193 AX_SUBMODULE(piplib,system|build|bundled,system)
195 AC_SUBST(PIPLIB_CPPFLAGS)
196 AC_SUBST(PIPLIB_LDFLAGS)
197 AC_SUBST(PIPLIB_LIBS)
198 case "$with_piplib" in
199 bundled)
200   PIPLIB_CPPFLAGS="-I$srcdir/piplib/include -Ipiplib/include"
201   PIPLIB_LIBS="$srcdir/piplib/libpiplib$BITS.la"
202   ;;
203 build)
204   PIPLIB_CPPFLAGS="-I$piplib_srcdir/include -I$with_piplib_builddir/include"
205   PIPLIB_LIBS="$with_piplib_builddir/libpiplib$BITS.la"
206   ;;
207 system)
208   if test "x$with_piplib_prefix" != "x"; then
209     PIPLIB_CPPFLAGS="-I$with_piplib_prefix/include"
210   fi
211   if test "x$with_piplib_exec_prefix" != "x"; then
212     PIPLIB_LDFLAGS="-L$with_piplib_exec_prefix/lib"
213   fi
214   PIPLIB_LIBS="$with_piplib_prefix/lib/libpiplib$BITS.la -lpiplib$BITS"
215 esac
216 AM_CONDITIONAL(BUNDLED_PIPLIB, test $with_piplib = bundled)
220 dnl /**************************************************************************
221 dnl  *                            Where is GMP?                               *
222 dnl  **************************************************************************/
225 dnl Checking for gmp
226 AC_MSG_CHECKING(whether gmp works)
227 if test "$gmp_package" = "no"; then
228   echo "GMP package not defined"
229   AC_MSG_RESULT(no)
230   TO_BUILD_MP=""
231 else
232   if test "$NEED_MP" = "no"; then
233     echo "Mode normal GMP"
234     TO_BUILD="$TO_BUILD MP"
235     AC_CHECK_HEADER(gmp.h,
236                     [AC_SEARCH_LIBS([__gmpz_init], [gmp],
237                       [LIBS="$LIBS -lgmp"],
238           [echo "Can't find gmp library." &&
239            echo "MP version will not be built." &&
240            TO_BUILD_MP=""])],
241         [echo "Can't find gmp headers." &&
242          echo "MP version will not be built." &&
243          TO_BUILD_MP=""])
244   else
245     dnl Default given by --with-X is "yes", --without-X is "no". We also
246     dnl initialized manually all gmp_package* variables to "yes" (thus they are
247     dnl supposed to be "yes" except if the user set them himself).
248     if test "$gmp_package" != "yes" ; then
249       echo "(GMP path has been set by user)"
250       GMP_DIR=$gmp_package
251       dnl Useful for AC_CHECK_X to find what we want.
252       CPPFLAGS="-I$GMP_DIR/include $CPPFLAGS"
253       LDFLAGS="-L$GMP_DIR/lib $LDFLAGS"
254     fi
256     if test "$gmp_include_package" != "yes" ; then
257       CPPFLAGS="-I$GMP_INC $CPPFLAGS"
258     fi
260     if test "$gmp_library_package" != "yes" ; then
261       LDFLAGS="-L$GMP_LIB $LDFLAGS"
262     fi
264     AC_CHECK_HEADER(gmp.h,
265                     [],
266                     [AC_MSG_ERROR(Can't find gmp headers.)])
267     AC_SEARCH_LIBS([__gmpz_init], [gmp],
268                  [LIBS="$LIBS -lgmp"],
269                  [AC_MSG_ERROR(Can't find gmp library.)])
271     AC_MSG_RESULT(yes)
272   fi
275 dnl /**************************************************************************
276 dnl  *                            Substitutions                               *
277 dnl  **************************************************************************/
280 dnl Substitutions to do.
281 AC_SUBST(BITS)
282 AC_SUBST(DEFINE_HAS_ISL_LIB)
283 AC_SUBST(ac_aux_dir)
284 AC_SUBST(abs_top_srcdir)
287 dnl Configure Makefiles.
288 AC_CONFIG_FILES([
289   Makefile
290   doc/Makefile
291   doc/Doxyfile
292   include/candl/macros.h
293   include/candl/piplib.h
294   tests/Makefile
295   ],
296   [test -z "$CONFIG_HEADERS" || echo timestamp > source/stamp-h.in])
298 #if test $with_piplib = system; then
299 #  AC_CONFIG_SUBDIRS(piplib)
301 if test $with_osl = bundled; then
302   AC_CONFIG_SUBDIRS(osl)
305 dnl forcing candl to use local libcandl.la
306 dnl if --prefix is not specified
307 CANDL_LIBS="$srcdir/libcandl.la -lcandl"
308 AC_SUBST(CANDL_LIBS)
312 AC_OUTPUT
314 echo "             /*-----------------------------------------------*"
315 echo "              *          Candl configuration is OK            *"
316 echo "              *-----------------------------------------------*/"
317 echo "It appears that your system is OK to start Candl compilation. You need"
318 echo "now to type \"make\". Lastly type \"make install\" to install Candl on"
319 echo "your system (log as root if necessary)."