1
2dnl /**-------------------------------------------------------------------**
3dnl  **                              CLooG                                **
4dnl  **-------------------------------------------------------------------**
5dnl  **                           configure.ac                            **
6dnl  **-------------------------------------------------------------------**
7dnl  **                   First version: august 7th 2002                  **
8dnl  **-------------------------------------------------------------------**/
9dnl
10dnl Input file for autoconf to build a configuration shellscript.
11dnl To build the configure script from the CLooG's top-level directory, use
12dnl autoconf -l autoconf autoconf/configure.in > configure
13dnl if it doesn't work (invalid option -l) try -I instead
14dnl autoconf -I autoconf autoconf/configure.in > configure
15
16dnl /**************************************************************************
17dnl *               CLooG : the Chunky Loop Generator (experimental)          *
18dnl ***************************************************************************
19dnl *                                                                         *
20dnl * Copyright (C) 2001 Cedric Bastoul                                       *
21dnl *                                                                         *
22dnl * This library is free software; you can redistribute it and/or           *
23dnl * modify it under the terms of the GNU Lesser General Public              *
24dnl * License as published by the Free Software Foundation; either            *
25dnl * version 2.1 of the License, or (at your option) any later version.      *
26dnl *                                                                         *
27dnl * This library is distributed in the hope that it will be useful,         *
28dnl * but WITHOUT ANY WARRANTY; without even the implied warranty of          *
29dnl * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU       *
30dnl * Lesser General Public License for more details.                         *
31dnl *                                                                         *
32dnl * You should have received a copy of the GNU Lesser General Public        *
33dnl * License along with this library; if not, write to the Free Software     *
34dnl * Foundation, Inc., 51 Franklin Street, Fifth Floor,                      *
35dnl * Boston, MA  02110-1301  USA                                             *
36dnl *                                                                         *
37dnl * CLooG, the Chunky Loop Generator                                        *
38dnl * Written by Cedric Bastoul, Cedric.Bastoul@inria.fr                      *
39dnl *                                                                         *
40dnl ***************************************************************************/
41
42m4_define([version_major], [0])
43m4_define([version_minor], [18])
44m4_define([version_revision], [0])
45
46AC_PREREQ(2.53)
47AC_INIT([cloog], [version_major.version_minor.version_revision],
48	[cloog-development@googlegroups.com])
49AC_CONFIG_SRCDIR(source/cloog.c)
50AC_CONFIG_AUX_DIR(autoconf)
51AC_CONFIG_MACRO_DIR([m4])
52
53VERSION_MAJOR=version_major
54VERSION_MINOR=version_minor
55VERSION_REVISION=version_revision
56AC_SUBST(versioninfo)
57versioninfo=4:0:0
58
59AM_INIT_AUTOMAKE([foreign])
60m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
61
62dnl /**************************************************************************
63dnl  *                              Checking                                  *
64dnl  **************************************************************************/
65
66dnl Checks for programs.
67AC_PROG_CC
68AC_PROG_LN_S
69AC_PROG_MAKE_SET
70AC_CHECK_PROG(CD, cd)
71dnl Configure needs an empty install.sh file with this, i HATE that...
72AC_PROG_INSTALL
73AC_PROG_LIBTOOL
74AC_CHECK_PROG(TEXI2DVI, texi2dvi, texi2dvi, [])
75AM_CONDITIONAL(HAVE_TEXI2DVI, test -n "$TEXI2DVI")
76
77AX_CC_MAXOPT
78AC_SUBST(CFLAGS_WARN)
79AX_CFLAGS_WARN_ALL(CFLAGS_WARN)
80
81dnl Checks for typedefs, structures, and compiler characteristics.
82AC_C_CONST
83AC_TYPE_SIZE_T
84
85
86
87dnl Checks for header files.
88AC_HEADER_STDC
89
90
91dnl Checks for library functions.
92AC_CHECK_FUNCS(strtol)
93
94
95dnl /**************************************************************************
96dnl  *                             Option setting                             *
97dnl  **************************************************************************/
98
99AC_CHECK_FUNCS([getrusage],
100	[AC_DEFINE([CLOOG_RUSAGE], [], [Print time required to generate code])])
101
102AX_SUBMODULE(isl,no|system|build|bundled,bundled)
103BITS="gmp"
104
105dnl /**************************************************************************
106dnl  *                            Where is GMP?                               *
107dnl  **************************************************************************/
108
109AX_SUBMODULE(gmp,system|build,system)
110
111need_get_memory_functions=false
112case "$with_gmp" in
113build)
114    CPPFLAGS="-I$with_gmp_builddir $CPPFLAGS"
115    LDFLAGS="-L$with_gmp_builddir/$lt_cv_objdir $LDFLAGS"
116    ;;
117system)
118    if test "x$with_gmp_prefix" != "x"; then
119	CPPFLAGS="-I$with_gmp_prefix/include $CPPFLAGS"
120    fi
121    
122    if test "$with_gmp_exec_prefix" != "yes" ; then
123	LDFLAGS="-L$with_gmp_exec_prefix/lib $LDFLAGS"
124    fi
125    ;;
126esac
127case "$with_gmp" in
128build|system)
129    AC_CHECK_HEADER(gmp.h,
130                    [],
131                    [AC_MSG_ERROR(Can't find gmp headers.)])
132    AC_CHECK_LIB(gmp,
133                 __gmpz_init,
134                 [LIBS="$LIBS -lgmp"],
135                 [AC_MSG_ERROR(Can't find gmp library.)])
136    AC_CHECK_DECLS(mp_get_memory_functions,[],[
137	    need_get_memory_functions=true
138    ],[#include <gmp.h>])
139    ;;
140esac
141AM_CONDITIONAL(NEED_GET_MEMORY_FUNCTIONS,
142		test x$need_get_memory_functions = xtrue)
143
144dnl /**************************************************************************
145dnl  *                          Where is isl?                                 *
146dnl  **************************************************************************/
147
148AC_SUBST(ISL_CPPFLAGS)
149AC_SUBST(ISL_LDFLAGS)
150AC_SUBST(ISL_LIBS)
151case "$with_isl" in
152bundled)
153	ISL_CPPFLAGS="-I$srcdir/isl/include -Iisl/include"
154	;;
155build)
156	ISL_CPPFLAGS="-I$isl_srcdir/include -I$with_isl_builddir/include"
157	ISL_LIBS="$with_isl_builddir/libisl.la"
158	;;
159system)
160	if test "x$with_isl_prefix" != "x"; then
161		ISL_CPPFLAGS="-I$with_isl_prefix/include"
162	fi
163	if test "x$with_isl_exec_prefix" != "x"; then
164		ISL_LDFLAGS="-L$with_isl_exec_prefix/lib"
165	fi
166	ISL_LIBS="-lisl"
167esac
168AM_CONDITIONAL(BUNDLED_ISL, test $with_isl = bundled)
169AM_CONDITIONAL(NO_ISL, test $with_isl = no)
170
171
172dnl /**************************************************************************
173dnl  *                   Where is the OpenScop Library?                       *
174dnl  **************************************************************************/
175
176AX_SUBMODULE(osl,no|system|build|bundled,no)
177osl_flag="OSL_SUPPORT"
178
179AC_SUBST(OSL_CPPFLAGS)
180AC_SUBST(OSL_LDFLAGS)
181AC_SUBST(OSL_LIBS)
182case "$with_osl" in
183bundled)
184	OSL_CPPFLAGS="-D$osl_flag -I$srcdir/osl/include -Iosl/include"
185	;;
186build)
187	OSL_CPPFLAGS="-D$osl_flag -I$osl_srcdir/include -I$with_osl_builddir/include"
188	OSL_LIBS="$with_osl_builddir/libosl.la"
189	;;
190system)
191	if test "x$with_osl_prefix" != "x"; then
192		OSL_CPPFLAGS="-D$osl_flag -I$with_osl_prefix/include"
193	fi
194	if test "x$with_osl_exec_prefix" != "x"; then
195		OSL_LDFLAGS="-L$with_osl_exec_prefix/lib"
196	fi
197	OSL_LIBS="-losl"
198esac
199AM_CONDITIONAL(BUNDLED_OSL, test $with_osl = bundled)
200AM_CONDITIONAL(NO_OSL, test $with_osl = no)
201
202
203AC_DEFINE([CLOOG_INT_GMP], 1, [Use arbitrary precision integers])
204
205AC_SUBST(GIT_INDEX)
206if test -f $srcdir/.git/HEAD; then
207	GIT_INDEX="\$(top_srcdir)/.git/index"
208fi
209
210
211dnl /**************************************************************************
212dnl  *                            Substitutions                               *
213dnl  **************************************************************************/
214
215
216dnl Substitutions to do in Makefile.in.
217AC_SUBST(CC)
218AC_SUBST(LN_S)
219
220AC_SUBST(prefix)
221AC_SUBST(exec_prefix)
222AC_SUBST(INSTALL)
223
224AC_SUBST(BITS)
225
226AC_SUBST(VERSION_MAJOR)
227AC_SUBST(VERSION_MINOR)
228AC_SUBST(VERSION_REVISION)
229
230PACKAGE_NAME="cloog-isl"
231PACKAGE_CFLAGS="-DCLOOG_INT_GMP=1"
232AX_CREATE_PKGCONFIG_INFO
233
234AC_CONFIG_FILES(Makefile test/Makefile)
235AC_CONFIG_FILES(autoconf/Doxyfile)
236AC_CONFIG_FILES(doc/Makefile)
237AC_CONFIG_FILES(source/version.c)
238AC_CONFIG_FILES(include/cloog/version.h)
239AC_CONFIG_FILES([genversion.sh], [chmod +x genversion.sh])
240AC_CONFIG_COMMANDS([version.h],
241	[echo '#define CLOOG_HEAD "'`./genversion.sh`'"' > version.h])
242AC_CONFIG_COMMANDS([doc/gitversion.texi],
243	[echo '@set VERSION '`./genversion.sh`'' > doc/gitversion.texi])
244if test $with_isl = bundled; then
245	AC_CONFIG_SUBDIRS(isl)
246fi
247if test $with_osl = bundled; then
248	AC_CONFIG_SUBDIRS(osl)
249fi
250AC_CONFIG_COMMANDS_POST([
251	ac_configure_args="$ac_configure_args $cloog_configure_args"
252])
253AC_OUTPUT
254
255
256echo "             /*-----------------------------------------------*"
257echo "              *           CLooG configuration is OK           *"
258echo "              *-----------------------------------------------*/"
259echo "It appears that your system is OK to start CLooG compilation. You need"
260echo "now to type \"make\". After compilation, you should check CLooG by typing"
261echo "\"make check\". If no problem occur, you can type \"make uninstall\" if"
262echo "you are upgrading an old version. Lastly type \"make install\" to install"
263echo "CLooG on your system (log as root if necessary)."
264