2 dnl /**-------------------------------------------------------------------**
4 dnl **-------------------------------------------------------------------**
6 dnl **-------------------------------------------------------------------**
7 dnl ** First version: august 11th 2001 **
8 dnl **-------------------------------------------------------------------**/
10 dnl Input file for autoconf to build a configuration shellscript.
11 dnl To build the configure script from the PipLib's top-level directory, use
12 dnl autoconf -I autoconf -o configure autoconf/configure.in
13 dnl for older versions of autoconf use -l instead
14 dnl autoconf -l autoconf autoconf/configure.in > configure
15 dnl chmod +x configure
19 AC_INIT(source/piplib.c)
20 AC_CONFIG_AUX_DIR(autoconf)
21 AC_CONFIG_MACRO_DIR([m4])
22 AM_INIT_AUTOMAKE(piplib, 1.3.6)
30 dnl /**************************************************************************
32 dnl **************************************************************************/
35 if test "x$prefix" != "xNONE"; then
36 prefix_wd=`cd $prefix && pwd`
37 srcdir_wd=`cd $srcdir && pwd`
39 if test "x$prefix_wd" = "x$srcdir_wd"; then
40 AC_MSG_ERROR(Installation in source directory not supported)
42 if test "x$prefix_wd" = "x$wd"; then
43 AC_MSG_ERROR(Installation in build directory not supported)
47 dnl Checks for programs.
52 dnl Configure needs an empty install.sh file with this, i HATE that...
56 AC_CHECK_PROG(TEXI2DVI, texi2dvi, texi2dvi, [])
57 AM_CONDITIONAL(HAVE_TEXI2DVI, test -n "$TEXI2DVI")
61 dnl Checks for typedefs, structures, and compiler characteristics.
66 dnl Checks for libraries.
67 dnl Replace `main' with a function in -lc:
68 dnl AC_CHECK_LIB(c, main)
71 dnl Checks for header files.
75 dnl Checks sizeof the two supported cases.
76 AC_CHECK_SIZEOF(int,1)
77 AC_CHECK_SIZEOF(long long int,1)
80 dnl /**************************************************************************
81 dnl * Option setting *
82 dnl **************************************************************************/
85 dnl The different packages that can be built and installed.
87 INT_BITS=`expr $ac_cv_sizeof_int \* 8`
88 eval DFLAGS$INT_BITS=-DLINEAR_VALUE_IS_INT
89 LONG_BITS=`expr $ac_cv_sizeof_long_long_int \* 8`
90 eval DFLAGS$LONG_BITS=-DLINEAR_VALUE_IS_LONGLONG
92 MP_DFLAGS=-DLINEAR_VALUE_IS_MP
94 GMP_INC="/usr/local/include"
95 GMP_LIB="/usr/local/lib"
98 dnl Some default values cause I'm not sure whether autoconf set them, while
99 dnl documentation says it does...
101 gmp_include_package="yes"
102 gmp_library_package="yes"
106 dnl --with-pip=yes, --with-pip=no or --without-pip
108 [ --without-pip disable the compilation of pip],
109 [ echo "Package pip : $withval" &&
110 if test "$withval"="no" ; then
115 [ --with-gmp=DIR DIR where the gmp package is installed],
116 [ echo "Package gmp : $withval" &&
117 gmp_package=$withval &&
118 GMP_INC=$gmp_package/include &&
119 GMP_LIB=$gmp_package/lib &&
122 AC_ARG_WITH(gmp_include,
123 [ --with-gmp-include=DIR DIR where gmp.h is installed],
124 [ echo "Package gmp-include : $withval" &&
125 gmp_include_package=$withval &&
126 GMP_INC=$gmp_include_package &&
129 AC_ARG_WITH(gmp_library,
130 [ --with-gmp-library=DIR DIR where the gmp library is installed],
131 [ echo "Package gmp-library : $withval" &&
132 gmp_library_package=$withval &&
133 GMP_LIB=$gmp_library_package &&
136 AC_ARG_ENABLE(int-version,
137 [ --enable-int-version Only 'int' version is built],
138 [ echo "Package int : $enableval" &&
143 AC_ARG_ENABLE(llint-version,
144 [ --enable-llint-version Only 'long long int' version is built],
145 [ echo "Package long long int : $enableval" &&
150 AC_ARG_ENABLE(mp-version,
151 [ --enable-mp-version Only 'MP' version is built],
152 [ echo "Package mp : $enableval" &&
159 dnl /**************************************************************************
160 dnl * Where is GMP? *
161 dnl **************************************************************************/
165 AC_MSG_CHECKING(whether gmp works)
166 if test "$gmp_package" = "no"; then
167 echo "GMP package not defined"
171 if test "$NEED_MP" = "no"; then
172 echo "Mode normal GMP"
173 AC_CHECK_HEADER(gmp.h,
176 [EXTRA_LIBS="$EXTRA_LIBS -lgmp"],
177 [echo "Can't find gmp library." &&
178 echo "MP version will not be builded." &&
180 [echo "Can't find gmp headers." &&
181 echo "MP version will not be builded." &&
184 dnl Default given by --with-X is "yes", --without-X is "no".
185 if test "$gmp_package" != "yes" ; then
186 echo "(GMP path has been set by user)"
189 GMP_INC=$GMP_DIR/include
190 EXTRA_LIBS="$EXTRA_LIBS -L$GMP_LIB"
191 dnl Useful for AC_CHECK_X to find what we want.
192 CPPFLAGS="-I$GMP_DIR/include $CPPFLAGS"
193 LDFLAGS="-L$GMP_DIR/lib $LDFLAGS"
196 if test "$gmp_include_package" != "yes" ; then
197 CPPFLAGS="-I$GMP_DIR/include $CPPFLAGS"
200 if test "$gmp_library_package" != "yes" ; then
201 EXTRA_LIBS="$EXTRA_LIBS -L$GMP_LIB"
202 LDFLAGS="-L$GMP_DIR/lib $LDFLAGS"
205 AC_CHECK_HEADER(gmp.h,
207 [AC_MSG_ERROR(Can't find gmp headers.)])
210 [EXTRA_LIBS="$EXTRA_LIBS -lgmp"],
211 [AC_MSG_ERROR(Can't find gmp library.)])
218 dnl /**************************************************************************
219 dnl * Packages to actually build *
220 dnl **************************************************************************/
223 TO_BUILD="$TO_BUILD_32 $TO_BUILD_64 $TO_BUILD_MP"
224 for tb in $TO_BUILD; do
225 piplibs="$piplibs libpiplib$tb.la"
226 if test "x$PIP" != "x"; then
227 pips="$pips pip$tb\$(EXEEXT)"
229 examples="$examples example$tb\$(EXEEXT)"
233 if test -f $srcdir/.git/HEAD; then
234 GIT_INDEX="$srcdir/.git/index"
237 dnl /**************************************************************************
238 dnl * Substitutions *
239 dnl **************************************************************************/
242 dnl Substitutions to do in Makefile.in.
248 dnl compilation flags
253 AC_CONFIG_FILES(Makefile example/Makefile test/Makefile doc/Makefile)
254 AC_CONFIG_FILES([genversion.sh], [chmod +x genversion.sh])
255 AC_CONFIG_COMMANDS([version.h],
256 [echo '#define PIPLIB_HEAD "'`./genversion.sh`'"' > version.h])
260 echo " /*-----------------------------------------------*"
261 echo " * PIP/PipLib configuration is OK *"
262 echo " *-----------------------------------------------*/"
263 echo "It appears that your system is OK to start PIP/PipLib compilation. You"
264 echo "need now to type \"make uninstall\" if your are upgrading an old version."
265 echo "Next, type \"make\" to build the program. Lastly type \"make install\" to"
266 echo "install it on your system (log as root if necessary)."