update cloog-core to version 0.16.3
[cloog-polylib.git] / configure.ac
blobeffd3d1c6d351db767ec445a499fb27778fc6d4b
1 AC_PREREQ(2.13)
2 AC_INIT(source/backend.c)
3 AC_CONFIG_AUX_DIR(autoconf)
4 AC_CONFIG_MACRO_DIR([m4])
5 AM_INIT_AUTOMAKE(cloog-polylib, 0.16.3)
6 AC_SUBST(versioninfo)
7 versioninfo=2:0:0
8 dnl default version
9 BITS="64"
11 AC_PROG_CC
12 AC_PROG_LN_S
13 AC_PROG_MAKE_SET
14 AC_CHECK_PROG(CD, cd)
15 AC_PROG_INSTALL
16 AC_PROG_LIBTOOL
18 AX_CC_MAXOPT
19 AC_SUBST(CFLAGS_WARN)
20 AX_CFLAGS_WARN_ALL(CFLAGS_WARN)
22 dnl Checks for typedefs, structures, and compiler characteristics.
23 AC_C_CONST
24 AC_TYPE_SIZE_T
26 dnl Checks for header files.
27 AC_HEADER_STDC
29 AC_ARG_WITH(bits,
30             [AS_HELP_STRING([--with-bits=32|64|gmp],
31                             [integer type to use])],
32             [ BITS=$withval ])
34 AX_SUBMODULE(cloog,build|bundled,bundled)
36 dnl /**************************************************************************
37 dnl  *                            Where is GMP?                               *
38 dnl  **************************************************************************/
40 gmp_module_default=no
41 if test "$BITS" = "gmp"; then
42         gmp_module_default=system
44 AX_SUBMODULE(gmp,no|system,$gmp_module_default)
46 case "$with_gmp" in
47 system)
48     if test "x$with_gmp_prefix" != "x"; then
49         CPPFLAGS="-I$with_gmp_prefix/include $CPPFLAGS"
50     fi
51     
52     if test "$with_gmp_exec_prefix" != "yes" ; then
53         LDFLAGS="-L$with_gmp_exec_prefix/lib $LDFLAGS"
54     fi
55      
56     AC_CHECK_HEADER(gmp.h,
57                     [],
58                     [AC_MSG_ERROR(Can't find gmp headers.)])
59     AC_CHECK_LIB(gmp,
60                  __gmpz_init,
61                  [LIBS="$LIBS -lgmp"],
62                  [AC_MSG_ERROR(Can't find gmp library.)])
63     AC_CHECK_DECLS(mp_get_memory_functions,[],[
64             need_get_memory_functions=true
65     ],[#include <gmp.h>])
66     ;;
67 esac
68 AM_CONDITIONAL(NEED_GET_MEMORY_FUNCTIONS,
69                 test x$need_get_memory_functions = xtrue)
71 dnl /**************************************************************************
72 dnl  *                          Where is PolyLib?                             *
73 dnl  **************************************************************************/
75 AX_SUBMODULE(polylib,system|build,system)
77 polylibs="64 32"
78 case "$BITS" in
79     32|64|gmp)
80         polylibs=$BITS
81     ;;
82 esac
84 dnl Checking for PolyLib
85 AC_SUBST(cl_cv_polylib)
86 AC_SUBST(POLYLIB_CPPFLAGS)
87 AC_SUBST(POLYLIB_LDFLAGS)
88 AC_SUBST(POLYLIB_LIBS)
90 AC_MSG_CHECKING(for location of PolyLib)
91 if test "x$with_polylib_builddir" != "x"; then
92         with_polylib_builddir=`cd $with_polylib_builddir; pwd`
93         AC_MSG_RESULT(built in $with_polylib_builddir)
94         polylib_polylibs=`echo @polylibs@ | $with_polylib_builddir/config.status --file=-`
95         AC_MSG_NOTICE(Configured polylibs: $polylib_polylibs)
96         POLYLIB_CPPFLAGS="-I$with_polylib_builddir/include -I$polylib_srcdir/include"
97         for BITS in $polylibs; do
98                 cl_cv_polylib=missing
99                 for PL in $polylib_polylibs; do
100                         if test "libpolylib$BITS.la" = $PL; then
101                                 cl_cv_polylib="polylib$BITS"
102                                 break;
103                         fi
104                 done
105                 if test "$cl_cv_polylib" != "missing"; then
106                         POLYLIB_LIBS="$with_polylib_builddir/lib$cl_cv_polylib.la"
107                         break;
108                 fi
109         done
110 elif test "$with_polylib" != "no"; then
111         if test "x$with_polylib_prefix" != "x"; then
112                 with_polylib_prefix=`cd $with_polylib_prefix; pwd`
113                 AC_MSG_RESULT(installed in $with_polylib_exec_prefix)
114                 POLYLIB_CPPFLAGS="-I$with_polylib_prefix/include"
115                 POLYLIB_LDFLAGS="-L$with_polylib_exec_prefix/lib"
116                 LD_LIBRARY_PATH="$with_polylib_exec_prefix/lib:$LD_LIBRARY_PATH"
117                 export LD_LIBRARY_PATH
118         else
119                 AC_MSG_RESULT(installed in standard location)
120         fi
121         SAVE_CPPFLAGS="$CPPFLAGS"
122         SAVE_LDFLAGS="$LDFLAGS"
123         CPPFLAGS="$POLYLIB_CPPFLAGS $CPPFLAGS"
124         LDFLAGS="$POLYLIB_LDFLAGS $LDFLAGS"
125         for BITS in $polylibs; do
126                 cl_cv_polylib="polylib$BITS"
127                 AC_CHECK_HEADER(polylib/$cl_cv_polylib.h,[
128                         AC_CHECK_LIB($cl_cv_polylib,PolyhedronTSort,[
129                                 POLYLIB_LIBS="-l$cl_cv_polylib"
130                                 break
131                         ])
132                 ])
133                 cl_cv_polylib=missing
134         done
135         CPPFLAGS="$SAVE_CPPFLAGS"
136         LDFLAGS="$SAVE_LDFLAGS"
138 case "$cl_cv_polylib" in
139 missing)
140         AC_MSG_ERROR(Can't find PolyLib.)
141         ;;
142 esac
144 dnl /**************************************************************************
145 dnl  *                          Where is CLooG?                               *
146 dnl  **************************************************************************/
148 AC_SUBST(CLOOG_SRCDIR)
149 AC_SUBST(CLOOG_BUILDDIR)
150 AC_SUBST(CLOOG_CPPFLAGS)
151 case "$with_cloog" in
152 bundled)
153         CLOOG_SRCDIR="\$(top_srcdir)/cloog-core"
154         CLOOG_BUILDDIR="\$(top_builddir)/cloog-core"
156         ;;
157 build)
158         case "$cloog_srcdir" in
159         /*)
160                 CLOOG_SRCDIR=$cloog_srcdir
161                 ;;
162         *)
163                 CLOOG_SRCDIR="\$(top_srcdir)/$cloog_srcdir"
164         esac
165         case "$with_cloog_builddir" in
166         /*)
167                 CLOOG_BUILDDIR=$with_cloog_builddir
168                 ;;
169         *)
170                 CLOOG_BUILDDIR="\$(top_builddir)/$with_cloog_builddir"
171         esac
172         ;;
173 esac
174 CLOOG_CPPFLAGS="-I$CLOOG_SRCDIR/include -I$CLOOG_BUILDDIR -I$CLOOG_BUILDDIR/include"
175 AM_CONDITIONAL(BUNDLED_CLOOG, test $with_cloog = bundled)
178 case "$BITS" in
179         gmp)
180                 cl_cv_int_type=gmp
181                 ;;
182         32|64)
183                 AC_CHECK_SIZEOF(int,1)
184                 AC_CHECK_SIZEOF(long,1)
185                 AC_CHECK_SIZEOF(long long,1)
186                 for cl_cv_int_type in int long long_long; do
187                         eval "bits=\`expr \$ac_cv_sizeof_$cl_cv_int_type \* 8\`"
188                         if test "$bits" = "$BITS"; then
189                                 break
190                         fi
191                 done
192                 ;;
193 esac
194 AH_TEMPLATE(CLOOG_INT_INT)
195 AH_TEMPLATE(CLOOG_INT_LONG)
196 AH_TEMPLATE(CLOOG_INT_LONG_LONG)
197 AH_TEMPLATE(CLOOG_INT_GMP)
198 cloog_int_macro=AS_TR_CPP(CLOOG_INT_$cl_cv_int_type)
199 AC_DEFINE_UNQUOTED($cloog_int_macro)
202 dnl /**************************************************************************
203 dnl  *                            Substitutions                               *
204 dnl  **************************************************************************/
207 dnl Substitutions to do in Makefile.in.
208 AC_SUBST(CC)
209 AC_SUBST(LN_S)
211 AC_SUBST(prefix)
212 AC_SUBST(exec_prefix)
213 AC_SUBST(INSTALL)
215 AC_SUBST(BITS)
217 PACKAGE_NAME="cloog-polylib"
218 PACKAGE_CFLAGS="-D$cloog_int_macro=1"
219 AX_CREATE_PKGCONFIG_INFO
221 AC_CONFIG_FILES(Makefile test/Makefile include/cloog/polylib/backend.h)
222 if test $with_cloog = bundled; then
223         AC_CONFIG_SUBDIRS(cloog-core)
225 AC_CONFIG_COMMANDS_POST([
226         old_args=""
227         for arg in $ac_configure_args; do
228                 case arg in
229                 --with-polylib*|--with-isl*)
230                         ;;
231                 *)
232                         old_args="$old_args $arg"
233                         ;;
234                 esac
235         done
236         ac_configure_args="$old_args --without-isl"
238 AC_OUTPUT
241 echo "             /*-----------------------------------------------*"
242 echo "              *           CLooG configuration is OK           *"
243 echo "              *-----------------------------------------------*/"
244 echo "It appears that your system is OK to start CLooG compilation. You need"
245 echo "now to type \"make\". After compilation, you should check CLooG by typing"
246 echo "\"make check\". If no problem occur, you can type \"make uninstall\" if"
247 echo "you are upgrading an old version. Lastly type \"make install\" to install"
248 echo "CLooG on your system (log as root if necessary)."