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.6)
49 AC_CONFIG_AUX_DIR([.])
50 AM_INIT_AUTOMAKE([gnu])
51 AC_CONFIG_SRCDIR(include/polylib/polylib.h.in)
52 AC_CONFIG_MACRO_DIR([m4])
59 if test "x$prefix" != "xNONE"; then
60 prefix_wd=`cd $prefix && pwd`
61 srcdir_wd=`cd $srcdir && pwd`
63 if test "x$prefix_wd" = "x$srcdir_wd"; then
64 AC_MSG_ERROR(Installation in source directory not supported)
66 if test "x$prefix_wd" = "x$wd"; then
67 AC_MSG_ERROR(Installation in build directory not supported)
71 dnl Checks for programs.
79 dnl Checks for typedefs, structures, and compiler characteristics.
82 dnl Checks for header files.
84 AC_CHECK_HEADERS(limits.h unistd.h)
85 AC_CHECK_HEADERS(getopt.h)
88 dnl /*****************************************************************************/
89 dnl See if the only goal is to create an 'int', 'longint', or 'longlongint' library
91 AC_CHECK_SIZEOF(int,1)
92 AC_CHECK_SIZEOF(long int,1)
93 AC_CHECK_SIZEOF(long long int,1)
95 AC_SUBST(polylib32_defs)
96 AC_SUBST(polylib64_defs)
97 AC_SUBST(polylib128_defs)
99 for type in long_long_int long_int int; do
102 bits=`expr $ac_cv_sizeof_int \* 8`
103 defs="#define LINEAR_VALUE_IS_INT"
106 bits=`expr $ac_cv_sizeof_long_int \* 8`
107 defs="#define LINEAR_VALUE_IS_LONG
108 #define LINEAR_VALUE_PROTECT_MULTIPLY"
111 bits=`expr $ac_cv_sizeof_long_long_int \* 8`
112 defs="#define LINEAR_VALUE_IS_LONGLONG
113 #define LINEAR_VALUE_PROTECT_MULTIPLY
114 #define LINEAR_VALUE_ASSUME_SOFTWARE_IDIV"
125 polylib128_defs=$defs
134 AC_ARG_ENABLE(int-lib,
135 [ --enable-int-lib Build an int library],
137 bits=`expr $ac_cv_sizeof_int \* 8`
138 polylibs="libpolylib$bits.la $polylibs"
139 ALL_BITS=" $bits $ALL_BITS"
141 AC_ARG_ENABLE(longint-lib,
142 [ --enable-longint-lib Build a long int library],
144 bits=`expr $ac_cv_sizeof_long_int \* 8`
147 *) polylibs="libpolylib$bits.la $polylibs"
148 ALL_BITS=" $bits $ALL_BITS" ;;
151 AC_ARG_ENABLE(longlongint-lib,
152 [ --enable-longlongint-lib Build a long long int library],
153 [lib_type=longlongint
154 bits=`expr $ac_cv_sizeof_long_long_int \* 8`
157 *) polylibs="libpolylib$bits.la $polylibs"
158 ALL_BITS=" $bits $ALL_BITS" ;;
162 dnl Check for GMP library
163 AC_MSG_CHECKING(whether to use GMP)
165 [ --with-libgmp DIR Location of the GMP Distribution],
166 gmp_package=$withval, gmp_package=no)
167 if test "x$gmp_package" = "xno"; then
171 if test "x$gmp_package" != "xyes"; then
173 if test ! -d "$GMP_DIR"; then
174 AC_ERROR(Directory given for GMP Distribution is not a directory)
176 CPPFLAGS="-I$GMP_DIR/include $CPPFLAGS"
177 LDFLAGS="-L$GMP_DIR/lib $LDFLAGS"
179 AC_CHECK_HEADER(gmp.h,
180 [AC_CHECK_LIB(gmp,main,
181 [poly_cv_gmpfatal="no"],
182 [poly_cv_gmpfatal="yes"])],
183 [poly_cv_gmpfatal="yes"])
184 if test "$poly_cv_gmpfatal" = "yes"; then
185 AC_MSG_ERROR([GMP not found])
187 AC_CHECK_DECLS(mp_get_memory_functions,[],[
188 AC_LIBOBJ(mp_get_memory_functions)
189 ],[#include <gmp.h>])
195 polylibs="libpolylib$BITS.la $polylibs"
196 ALL_BITS="$BITS $ALL_BITS"
199 if test "X$lib_type" = "X"; then
200 AC_MSG_CHECKING(what the LONG representation is)
201 if test "$ac_cv_sizeof_long_long_int" -gt "$ac_cv_sizeof_int"; then
202 AC_MSG_RESULT([long long int])
204 bits=`expr $ac_cv_sizeof_long_long_int \* 8`
205 polylibs="libpolylib$bits.la $polylibs"
206 ALL_BITS="$bits $ALL_BITS"
207 elif test "$ac_cv_sizeof_long_int" -gt "$ac_cv_sizeof_int"; then
208 AC_MSG_RESULT([long int])
210 bits=`expr $ac_cv_sizeof_long_int \* 8`
211 polylibs="libpolylib$bits.la $polylibs"
212 ALL_BITS="$bits $ALL_BITS"
214 AC_MSG_RESULT([NONE!])
216 bits=`expr $ac_cv_sizeof_int \* 8`
217 polylibs="libpolylib$bits.la $polylibs"
218 ALL_BITS="$bits $ALL_BITS"
224 BITS=`expr $ac_cv_sizeof_int \* 8`
227 BITS=`expr $ac_cv_sizeof_long_int \* 8`
230 BITS=`expr $ac_cv_sizeof_long_long_int \* 8`
236 polylib="libpolylib$BITS.la"
238 dnl extra indirection to avoid automake getting confused
239 AC_SUBST(multi_bin_programs)
240 AC_SUBST(multi_noinst_programs)
241 for pl_bit in $ALL_BITS ; do
242 multi_bin_programs="$multi_bin_programs \$(multi_bin_programs_${pl_bit})"
243 multi_noinst_programs="$multi_noinst_programs \$(no_inst_programs_${pl_bit})"
246 dnl /*****************************************************************************/
247 AC_ARG_ENABLE(extra-suffix,
248 [ --enable-extra-suffix Add bits size suffix to executables],
249 [ if test "$enableval" = yes; then
250 program_transform_name="s/\$\$/$BITS/;$program_transform_name"
253 dnl /********************************************************************/
254 dnl Check for DOXYGEN package
255 AC_ARG_WITH(doxygen, [ --with-doxygen DIR Location of the Doxygen Distribution (http://www.doxygen.org)], doxygen_package=$withval)
257 dnl AC_MSG_CHECKING(for Doxygen program)
258 AC_CHECK_PROG(DOXYGEN,doxygen,doxygen,test,[$PATH:$doxygen_package/bin:/usr/local/bin])
259 dnl AC_MSG_RESULT($DOXYGEN)
262 dnl AC_CHECK_LIB(pthread, pthread_create)
264 AC_ARG_ENABLE(threadsafe,
265 [ --enable-threadsafe threadsafe polylib (enabled by default if a threading library is found))],
267 if test "$enable_threadsafe" = "yes" -a "X$PTHREAD_CC" = "X"; then
268 AC_MSG_ERROR([pthread library not found])
272 if test "X$PTHREAD_CC" = "X" ; then
273 AC_MSG_WARN([No pthread library found, PolyLib will not be threadsafe])
274 elif test "X$PTHREAD_CC" != "X" ; then
275 LIBS="$LIBS $PTHREAD_LIBS"
276 CFLAGS="$CFLAGS $PTHREAD_CFLAGS -DTHREAD_SAFE_POLYLIB"
278 AC_MSG_NOTICE([Will build a threadsafe library])
285 dnl long/int bits and compilation flags
288 dnl Used with doxygen
291 dnl Currently, we only create one .pc file
292 dnl Creating one for each configured version is a bit complicated
293 PACKAGE_NAME=polylib$BITS
294 AX_CREATE_PKGCONFIG_INFO
296 AC_CONFIG_HEADERS(config.h)
299 include/polylib/Makefile
300 include/polylib/polylib.h
302 Test/Zpolytest/Makefile
303 Test/ehrhart/Makefile
304 Test/ehrhart_union/Makefile
305 Test/ranking/Makefile
306 Test/general/Makefile
312 echo "---------------------------------------------------"
313 echo "Polylib will be built with " $ALL_BITS "integer size(s)"
314 echo "You can proceed with:"
315 echo "make :to build the libs and the executables"
316 echo "make tests :to test the library"
317 echo "make install :to install them (to $prefix)"
318 echo "---------------------------------------------------"