1 dnl This file is an input file used by the GNU "autoconf" program to
2 dnl generate the file "configure", which is run to configure the
3 dnl Makefile in this directory.
5 # This file is part of PolyLib.
7 # PolyLib is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # PolyLib is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with PolyLib. If not, see <http://www.gnu.org/licenses/>.
20 # Authors: Bart Kienhuis, Vincent Loechner, T. Risset
21 # Copyright (c) 2000 The Regents of the University of California.
22 # All rights reserved.
24 # Permission is hereby granted, without written agreement and without
25 # license or royalty fees, to use, copy, modify, and distribute this
26 # software and its documentation for any purpose, provided that the
27 # above copyright notice and the following two paragraphs appear in all
28 # copies of this software.
30 # IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
31 # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
32 # ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
33 # THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
36 # THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
37 # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
38 # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
39 # PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
40 # CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
41 # ENHANCEMENTS, OR MODIFICATIONS.
43 # PT_COPYRIGHT_VERSION_2
46 dnl Process this file with autoconf to produce a configure script.
48 AC_INIT(polylib, 5.22.5)
49 AM_INIT_AUTOMAKE([gnu])
50 AC_CONFIG_SRCDIR(include/polylib/polylib.h.in)
51 AC_CONFIG_MACRO_DIR([m4])
58 if test "x$prefix" != "xNONE"; then
59 prefix_wd=`cd $prefix && pwd`
60 srcdir_wd=`cd $srcdir && pwd`
62 if test "x$prefix_wd" = "x$srcdir_wd"; then
63 AC_MSG_ERROR(Installation in source directory not supported)
65 if test "x$prefix_wd" = "x$wd"; then
66 AC_MSG_ERROR(Installation in build directory not supported)
70 dnl Checks for programs.
77 dnl Checks for typedefs, structures, and compiler characteristics.
80 dnl Checks for header files.
82 AC_CHECK_HEADERS(limits.h unistd.h)
83 AC_CHECK_HEADERS(getopt.h)
86 dnl /*****************************************************************************/
87 dnl See if the only goal is to create an 'int', 'longint', or 'longlongint' library
89 AC_CHECK_SIZEOF(int,1)
90 AC_CHECK_SIZEOF(long int,1)
91 AC_CHECK_SIZEOF(long long int,1)
93 AC_SUBST(polylib32_defs)
94 AC_SUBST(polylib64_defs)
95 AC_SUBST(polylib128_defs)
97 for type in long_long_int long_int int; do
100 bits=`expr $ac_cv_sizeof_int \* 8`
101 defs="#define LINEAR_VALUE_IS_INT"
104 bits=`expr $ac_cv_sizeof_long_int \* 8`
105 defs="#define LINEAR_VALUE_IS_LONG
106 #define LINEAR_VALUE_PROTECT_MULTIPLY"
109 bits=`expr $ac_cv_sizeof_long_long_int \* 8`
110 defs="#define LINEAR_VALUE_IS_LONGLONG
111 #define LINEAR_VALUE_PROTECT_MULTIPLY
112 #define LINEAR_VALUE_ASSUME_SOFTWARE_IDIV"
123 polylib128_defs=$defs
132 AC_ARG_ENABLE(int-lib,
133 [ --enable-int-lib Build an int library],
135 bits=`expr $ac_cv_sizeof_int \* 8`
136 polylibs="libpolylib$bits.la $polylibs"
137 ALL_BITS="$bits $ALL_BITS"
139 AC_ARG_ENABLE(longint-lib,
140 [ --enable-longint-lib Build a long int library],
142 bits=`expr $ac_cv_sizeof_long_int \* 8`
143 polylibs="libpolylib$bits.la $polylibs"
144 ALL_BITS="$bits $ALL_BITS"
146 AC_ARG_ENABLE(longlongint-lib,
147 [ --enable-longlongint-lib Build a long long int library],
148 [lib_type=longlongint
149 bits=`expr $ac_cv_sizeof_long_long_int \* 8`
150 polylibs="libpolylib$bits.la $polylibs"
151 ALL_BITS="$bits $ALL_BITS"
154 dnl Check for GMP library
155 AC_MSG_CHECKING(whether to use GMP)
157 [ --with-libgmp DIR Location of the GMP Distribution],
158 gmp_package=$withval, gmp_package=no)
159 if test "x$gmp_package" = "xno"; then
163 if test "x$gmp_package" != "xyes"; then
165 if test ! -d "$GMP_DIR"; then
166 AC_ERROR(Directory given for GMP Distribution is not a directory)
168 CPPFLAGS="-I$GMP_DIR/include $CPPFLAGS"
169 LDFLAGS="-L$GMP_DIR/lib $LDFLAGS"
171 AC_CHECK_HEADER(gmp.h,
172 [AC_CHECK_LIB(gmp,main,
173 [poly_cv_gmpfatal="no"],
174 [poly_cv_gmpfatal="yes"])],
175 [poly_cv_gmpfatal="yes"])
176 if test "$poly_cv_gmpfatal" = "yes"; then
177 AC_MSG_ERROR([GMP not found])
179 AC_CHECK_DECLS(mp_get_memory_functions,[],[
180 AC_LIBOBJ(mp_get_memory_functions)
181 ],[#include <gmp.h>])
187 polylibs="libpolylib$BITS.la $polylibs"
188 ALL_BITS="$BITS $ALL_BITS"
191 if test "X$lib_type" = "X"; then
192 AC_MSG_CHECKING(what the LONG representation is)
193 if test "$ac_cv_sizeof_long_long_int" -gt "$ac_cv_sizeof_int"; then
194 AC_MSG_RESULT([long long int])
196 bits=`expr $ac_cv_sizeof_long_long_int \* 8`
197 polylibs="libpolylib$bits.la $polylibs"
198 ALL_BITS="$bits $ALL_BITS"
199 elif test "$ac_cv_sizeof_long_int" -gt "$ac_cv_sizeof_int"; then
200 AC_MSG_RESULT([long int])
202 bits=`expr $ac_cv_sizeof_long_int \* 8`
203 polylibs="libpolylib$bits.la $polylibs"
204 ALL_BITS="$bits $ALL_BITS"
206 AC_MSG_RESULT([NONE!])
208 bits=`expr $ac_cv_sizeof_int \* 8`
209 polylibs="libpolylib$bits.la $polylibs"
210 ALL_BITS="$bits $ALL_BITS"
216 BITS=`expr $ac_cv_sizeof_int \* 8`
219 BITS=`expr $ac_cv_sizeof_long_int \* 8`
222 BITS=`expr $ac_cv_sizeof_long_long_int \* 8`
228 polylib="libpolylib$BITS.la"
230 dnl extra indirection to avoid automake getting confused
231 AC_SUBST(multi_bin_programs)
232 AC_SUBST(multi_noinst_programs)
233 for pl_bit in $ALL_BITS ; do
234 multi_bin_programs="$multi_bin_programs \$(multi_bin_programs_${pl_bit})"
235 multi_noinst_programs="$multi_noinst_programs \$(no_inst_programs_${pl_bit})"
238 dnl /*****************************************************************************/
239 AC_ARG_ENABLE(extra-suffix,
240 [ --enable-extra-suffix Add bits size suffix to executables],
241 [ if test "$enableval" = yes; then
242 program_transform_name="s/\$\$/$BITS/;$program_transform_name"
245 dnl /********************************************************************/
246 dnl Check for DOXYGEN package
247 AC_ARG_WITH(doxygen, [ --with-doxygen DIR Location of the Doxygen Distribution (http://www.doxygen.org)], doxygen_package=$withval)
249 dnl AC_MSG_CHECKING(for Doxygen program)
250 AC_CHECK_PROG(DOXYGEN,doxygen,doxygen,test,[$PATH:$doxygen_package/bin:/usr/local/bin])
251 dnl AC_MSG_RESULT($DOXYGEN)
256 dnl long/int bits and compilation flags
259 dnl Used with doxygen
262 dnl Currently, we only create one .pc file
263 dnl Creating one for each configured version is a bit complicated
264 PACKAGE_NAME=polylib$BITS
265 AX_CREATE_PKGCONFIG_INFO
267 AC_CONFIG_HEADERS(config.h)
270 include/polylib/Makefile
271 include/polylib/polylib.h
273 Test/Zpolytest/Makefile
274 Test/ehrhart/Makefile
275 Test/ehrhart_union/Makefile
276 Test/ranking/Makefile
277 Test/general/Makefile
283 echo "Polylib will be built with " $ALL_BITS "integer size(s)"
284 echo "---------------------------------------------------"
285 echo "You can proceed with:"
286 echo "make :to build the libs and the executables"
287 echo "make tests :to test the library"
288 echo "make install :to install them (to $prefix)"
289 echo "---------------------------------------------------"