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 # Authors: Bart Kienhuis, Vincent Loechner, T. Risset
6 # Copyright (c) 2000 The Regents of the University of California.
9 # Permission is hereby granted, without written agreement and without
10 # license or royalty fees, to use, copy, modify, and distribute this
11 # software and its documentation for any purpose, provided that the
12 # above copyright notice and the following two paragraphs appear in all
13 # copies of this software.
15 # IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
16 # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
17 # ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
18 # THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
21 # THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
22 # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
23 # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
24 # PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
25 # CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
26 # ENHANCEMENTS, OR MODIFICATIONS.
28 # PT_COPYRIGHT_VERSION_2
31 dnl Process this file with autoconf to produce a configure script.
32 define([AC_CACHE_LOAD], )dnl
33 define([AC_CACHE_SAVE], )dnl
34 AC_INIT(include/polylib/polylib.h)
38 dnl Checks for typedefs, structures, and compiler characteristics.
41 dnl Checks for programs.
47 dnl Checks for typedefs, structures, and compiler characteristics.
50 dnl Checks for header files.
52 AC_CHECK_HEADERS(limits.h unistd.h)
60 SHAREDLIB_FLAG="-Wl,-B,immediate,-B,nonfatal,-B,verbose";
62 INSTALL_LIB="install-static install-shared" ;;
67 SHAREDLIB_FLAG="-shared"
69 INSTALL_LIB="install-static install-shared" ;;
77 INSTALL_LIB="install-static" ;;
84 INSTALL_LIB="install-static" ;;
89 LIBS="$LIBS -lcygwin -lkernel32 -lcrtdll"
93 EXTRA_FLAGS="-DCYGWIN"
94 INSTALL_LIB="install-static" ;;
95 *) AC_MSG_ERROR([ARCH "$target" is not supported]) ;;
99 dnl /*****************************************************************************/
100 dnl See if the only goal is to create an 'int', 'longint', or 'longlongint' library
102 AC_CHECK_SIZEOF(int,1)
108 AC_CHECK_SIZEOF(long int,1)
112 ac_cv_sizeof_long_int=4;;
114 AC_CHECK_SIZEOF(long long int,1)
118 ac_cv_sizeof_long_long_int=8;;
122 AC_ARG_ENABLE(int-lib,[ --enable-int-lib Enable that only an int library is constructed], only_int_lib=$enableval,only_int_lib=no)
123 AC_ARG_ENABLE(longint-lib,[ --enable-longint-lib Enable that only a long int library is constructed (default)], only_longint_lib=$enableval,only_longint_lib=no)
124 AC_ARG_ENABLE(longlongint-lib,[ --enable-longlongint-lib Enable that only a long long int library is constructed], only_longlongint_lib=$enableval,only_longlongint_lib=no)
125 AC_ARG_ENABLE(gmpint-lib,[ --enable-gmpint-lib Enable that only a gmp int library is constructued], only_gmpint_lib=$enableval,only_gmpint_lib=no)
126 AC_ARG_ENABLE(allint-lib,[ --enable-allint-lib Enable that 32, 64 and gmp int library is constructued], allint_lib=$enableval,allint_lib=no)
128 INT_BITS=`expr $ac_cv_sizeof_int \* 8`
129 INT_AFLAGS=-DLINEAR_VALUE_IS_INT
131 LONG_BITS=`expr $ac_cv_sizeof_long_long_int \* 8`
132 LONG_AFLAGS="-DLINEAR_VALUE_IS_LONGLONG -DLINEAR_VALUE_PROTECT_MULTIPLY\
133 -DLINEAR_VALUE_ASSUME_SOFTWARE_IDIV"
139 if test "$only_int_lib" = "yes"; then
141 elif test "$only_longint_lib" = "yes"; then
142 dnl /* type "long int" is built using INT_AFLAGS.
143 INT_BITS=`expr $ac_cv_sizeof_long_int \* 8`
144 INT_AFLAGS="-DLINEAR_VALUE_IS_LONG -DLINEAR_VALUE_PROTECT_MULTIPLY\
145 -DLINEAR_VALUE_ASSUME_SOFTWARE_IDIV"
147 elif test "$only_longlongint_lib" = "yes"; then
149 elif test "$only_gmpint_lib" = "yes"; then
153 dnl /******************************************************************/
154 dnl Check the size of the int's.
155 dnl three sizes library can be constructed: size = INT, LONG, or GMP.
156 dnl have to compute [size]BITS and [size]AFLAGS
158 AC_MSG_CHECKING(what the LONG representation is)
160 if test "$ac_cv_sizeof_long_long_int" -gt "$ac_cv_sizeof_int"; then
161 LONG_BITS=`expr $ac_cv_sizeof_long_long_int \* 8`
162 AC_MSG_RESULT([long long int, $LONG_BITS bits])
163 elif test "$ac_cv_sizeof_long_int" -gt "$ac_cv_sizeof_int"; then
164 LONG_BITS=`expr $ac_cv_sizeof_long_int \* 8`
165 AC_MSG_RESULT([long int, $LONG_BITS bits])
167 AC_MSG_RESULT([NONE!])
177 if test "$no_long" = "yes"; then
178 LIBS_TO_BUILD=$INT_BITS
179 EXEC_TO_BUILD=$INT_BITS
180 DEFAULT_INT_BITS=$INT_BITS
181 DEFAULT_AFLAGS=$INT_AFLAGS
182 elif test "$only_longlongint_lib" = "yes"; then
183 LIBS_TO_BUILD=$LONG_BITS
184 EXEC_TO_BUILD=$LONG_BITS
185 DEFAULT_INT_BITS=$LONG_BITS
186 DEFAULT_AFLAGS=$LONG_AFLAGS
187 elif test "$only_gmpint_lib" = "yes"; then
188 LIBS_TO_BUILD=$GMP_BITS
189 EXEC_TO_BUILD=$GMP_BITS
190 DEFAULT_INT_BITS=$GMP_BITS
191 DEFAULT_AFLAGS=$GMP_AFLAGS
193 elif test "$allint_lib" = "yes"; then
194 LIBS_TO_BUILD="$INT_BITS $LONG_BITS $GMP_BITS"
195 EXEC_TO_BUILD="$LONG_BITS"
196 DEFAULT_INT_BITS=$INT_BITS
197 DEFAULT_AFLAGS=$INT_AFLAGS
200 LIBS_TO_BUILD="$LONG_BITS"
201 EXEC_TO_BUILD="$LONG_BITS"
202 DEFAULT_INT_BITS=$LONG_BITS
203 DEFAULT_AFLAGS=$LONG_AFLAGS
206 AC_ARG_ENABLE(short-exec,[ --enable-short-exec Enable that the int library is used by the executables (by default, the long library is used if built)],[ if test "$enableval" = yes; then
207 EXEC_TO_BUILD=$INT_BITS
208 DEFAULT_INT_BITS=$INT_BITS
209 DEFAULT_AFLAGS=$INT_AFLAGS
213 dnl /*****************************************************************************/
214 EXEC_EXTRA_SUFFIX=$EXEC_SUFFIX
215 AC_ARG_ENABLE(extra-suffix,[ --enable-extra-suffix Enable that the executables take an extra suffix depending on the library size],[ if test "$enableval" = yes; then
216 EXEC_EXTRA_SUFFIX="\$(BITS)$EXEC_SUFFIX"
218 AC_ARG_ENABLE(all-exec,[ --enable-all-exec Enable that all sized libraries are used to build the executables of each, which take an extra suffix depending on the library (by default, only the long library is used)],[ if test "$enableval" = yes; then
219 EXEC_TO_BUILD="$LIBS_TO_BUILD"
220 DEFAULT_INT_BITS=$INT_BITS
221 DEFAULT_AFLAGS=$INT_AFLAGS
222 EXEC_EXTRA_SUFFIX="\$(BITS)$EXEC_SUFFIX"
225 dnl /*****************************************************************************/
226 dnl install static/shared/none libraries (default : see below)
227 EXEC_EXTRA_LIBS="-lpolylib\$(BITS)"
228 dnl See if the only goal is to create a shared library
229 AC_ARG_ENABLE(onlyshared,[ --enable-onlyshared Enable that only a shared library is constructued], only_shared=$enableval,only_shared=no)
230 if test "$only_shared" = "yes"; then
231 INSTALL_LIB="install-shared"
233 dnl See if the only goal is to create a static library
234 AC_ARG_ENABLE(onlystatic,[ --enable-onlystatic Enable that only a static library is constructued], only_static=$enableval,only_static=no)
235 if test "$only_static" = "yes"; then
236 INSTALL_LIB="install-static"
238 dnl See if the user does not want to create any library
239 AC_ARG_ENABLE(install-lib,[ --disable-install-lib Disable installation of the library],
240 [if test "$enableval" = "no"; then
242 EXEC_EXTRA_LIBS="-L\$(OBJ_DIR) $EXEC_EXTRA_LIBS"
243 fi], EXEC_EXTRA_LIBS="-L$libdir $EXEC_EXTRA_LIBS" )
245 AC_ARG_WITH(ldconfig-cache, [ --with-ldconfig-cache=FILE Run ldconfig -C <FILE>],
246 [if test "x$LDCONFIG" = "xldconfig"; then
247 LDCONFIG="$LDCONFIG -C $withval"
251 dnl /*****************************************************************************/
252 dnl Check for GMP library
253 AC_ARG_WITH(libgmp, [ --with-libgmp DIR Location of the GMP Distribution], gmp_package=$withval,gmp_package=yes)
258 dnl if test "x$usegmp" = "xyes"; then
259 AC_MSG_CHECKING(for GMP)
260 if test "x$gmp_package" = "xno"; then
263 if test "x$gmp_package" = "xyes"; then
264 AC_CHECK_HEADER(gmp.h,
265 AC_CHECK_LIB(gmp,main,
266 [ EXTRA_LIBS="-lgmp $EXTRA_LIBS"]))
268 dnl Check if the GMP directory is a valid location
270 if test ! -d "$GMP_DIR"; then
271 AC_ERROR(Directory given for GMP Distribution is not a directory)
273 GMP_INC=$GMP_DIR/include
275 if test ! -f $GMP_INC/gmp.h; then
276 AC_ERROR(Can't find $GMP_INC/gmp.h)
277 elif test -f $GMP_LIB/libgmp.so -o -f $GMP_LIB/libgmp.a -o -f $GMP_LIB/libgmp.$SHEXT; then
278 EXTRA_INCLUDES="-I$GMP_INC"
279 EXTRA_LIBS="-L$GMP_LIB -lgmp $EXTRA_LIBS"
282 AC_ERROR(Can't find $GMP_LIB/libgmp.so nor $GMP_LIB/libgmp.a nor $GMP_LIB/libgmp.$SHEXT)
289 echo "Polylib will be built with " $LIBS_TO_BUILD "integer size"
290 echo "---------------------------------------------------"
291 echo "You can choose either:"
292 echo "make: to build the libs, and build the executables"
293 echo "make libs: to build only the libraries"
294 echo "make install-libs: to install them somewhere (default /usr/local)"
295 echo "make install: to build and install everything somewhere (default /usr/local)"
296 echo "---------------------------------------------------"
303 AC_SUBST(SHAREDLIB_FLAG)
305 AC_SUBST(INSTALL_LIB)
308 dnl define variants of polylib to build
309 AC_SUBST(LIBS_TO_BUILD)
310 AC_SUBST(EXEC_TO_BUILD)
312 dnl long/int bits and compilation flags
316 AC_SUBST(LONG_AFLAGS)
320 AC_SUBST(DEFAULT_INT_BITS)
321 AC_SUBST(DEFAULT_AFLAGS)
323 dnl Used with GMP is selected
324 AC_SUBST(EXTRA_INCLUDES)
327 AC_SUBST(EXEC_EXTRA_SUFFIX)
328 AC_SUBST(EXEC_EXTRA_LIBS)
330 dnl Used with CYGWIN platform
331 AC_SUBST(EXTRA_FLAGS)