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 AM_INIT_AUTOMAKE(piplib, 1.3.6)
29 dnl /**************************************************************************
31 dnl **************************************************************************/
34 if test "x$prefix" != "xNONE"; then
35 prefix_wd=`cd $prefix && pwd`
36 srcdir_wd=`cd $srcdir && pwd`
38 if test "x$prefix_wd" = "x$srcdir_wd"; then
39 AC_MSG_ERROR(Installation in source directory not supported)
41 if test "x$prefix_wd" = "x$wd"; then
42 AC_MSG_ERROR(Installation in build directory not supported)
46 dnl Checks for programs.
51 dnl Configure needs an empty install.sh file with this, i HATE that...
56 CFLAGS="-fomit-frame-pointer -O2"
58 dnl Checks for typedefs, structures, and compiler characteristics.
63 dnl Checks for libraries.
64 dnl Replace `main' with a function in -lc:
65 dnl AC_CHECK_LIB(c, main)
68 dnl Checks for header files.
72 dnl Checks sizeof the two supported cases.
73 AC_CHECK_SIZEOF(int,1)
74 AC_CHECK_SIZEOF(long long int,1)
77 dnl /**************************************************************************
78 dnl * Option setting *
79 dnl **************************************************************************/
82 dnl The different packages that can be built and installed.
84 INT_BITS=`expr $ac_cv_sizeof_int \* 8`
85 eval DFLAGS$INT_BITS=-DLINEAR_VALUE_IS_INT
86 LONG_BITS=`expr $ac_cv_sizeof_long_long_int \* 8`
87 eval DFLAGS$LONG_BITS=-DLINEAR_VALUE_IS_LONGLONG
89 MP_DFLAGS=-DLINEAR_VALUE_IS_MP
91 GMP_INC="/usr/local/include"
92 GMP_LIB="/usr/local/lib"
95 dnl Some default values cause I'm not sure whether autoconf set them, while
96 dnl documentation says it does...
98 gmp_include_package="yes"
99 gmp_library_package="yes"
103 dnl --with-pip=yes, --with-pip=no or --without-pip
105 [ --without-pip disable the compilation of pip],
106 [ echo "Package pip : $withval" &&
107 if test "$withval"="no" ; then
112 [ --with-gmp=DIR DIR where the gmp package is installed],
113 [ echo "Package gmp : $withval" &&
114 gmp_package=$withval &&
115 GMP_INC=$gmp_package/include &&
116 GMP_LIB=$gmp_package/lib &&
119 AC_ARG_WITH(gmp_include,
120 [ --with-gmp-include=DIR DIR where gmp.h is installed],
121 [ echo "Package gmp-include : $withval" &&
122 gmp_include_package=$withval &&
123 GMP_INC=$gmp_include_package &&
126 AC_ARG_WITH(gmp_library,
127 [ --with-gmp-library=DIR DIR where the gmp library is installed],
128 [ echo "Package gmp-library : $withval" &&
129 gmp_library_package=$withval &&
130 GMP_LIB=$gmp_library_package &&
133 AC_ARG_ENABLE(int-version,
134 [ --enable-int-version Only 'int' version is built],
135 [ echo "Package int : $enableval" &&
140 AC_ARG_ENABLE(llint-version,
141 [ --enable-llint-version Only 'long long int' version is built],
142 [ echo "Package long long int : $enableval" &&
147 AC_ARG_ENABLE(mp-version,
148 [ --enable-mp-version Only 'MP' version is built],
149 [ echo "Package mp : $enableval" &&
156 dnl /**************************************************************************
157 dnl * Where is GMP? *
158 dnl **************************************************************************/
162 AC_MSG_CHECKING(whether gmp works)
163 if test "$gmp_package" = "no"; then
164 echo "GMP package not defined"
168 if test "$NEED_MP" = "no"; then
169 echo "Mode normal GMP"
170 AC_CHECK_HEADER(gmp.h,
173 [EXTRA_LIBS="$EXTRA_LIBS -lgmp"],
174 [echo "Can't find gmp library." &&
175 echo "MP version will not be builded." &&
177 [echo "Can't find gmp headers." &&
178 echo "MP version will not be builded." &&
181 dnl Default given by --with-X is "yes", --without-X is "no".
182 if test "$gmp_package" != "yes" ; then
183 echo "(GMP path has been set by user)"
186 GMP_INC=$GMP_DIR/include
187 EXTRA_LIBS="$EXTRA_LIBS -L$GMP_LIB"
188 dnl Useful for AC_CHECK_X to find what we want.
189 CPPFLAGS="-I$GMP_DIR/include $CPPFLAGS"
190 LDFLAGS="-L$GMP_DIR/lib $LDFLAGS"
193 if test "$gmp_include_package" != "yes" ; then
194 CPPFLAGS="-I$GMP_DIR/include $CPPFLAGS"
197 if test "$gmp_library_package" != "yes" ; then
198 EXTRA_LIBS="$EXTRA_LIBS -L$GMP_LIB"
199 LDFLAGS="-L$GMP_DIR/lib $LDFLAGS"
202 AC_CHECK_HEADER(gmp.h,
204 [AC_MSG_ERROR(Can't find gmp headers.)])
207 [EXTRA_LIBS="$EXTRA_LIBS -lgmp"],
208 [AC_MSG_ERROR(Can't find gmp library.)])
215 dnl /**************************************************************************
216 dnl * Packages to actually build *
217 dnl **************************************************************************/
220 TO_BUILD="$TO_BUILD_32 $TO_BUILD_64 $TO_BUILD_MP"
221 for tb in $TO_BUILD; do
222 piplibs="$piplibs libpiplib$tb.la"
223 if test "x$PIP" != "x"; then
224 pips="$pips pip$tb\$(EXEEXT)"
226 examples="$examples example$tb\$(EXEEXT)"
230 dnl /**************************************************************************
231 dnl * Substitutions *
232 dnl **************************************************************************/
235 dnl Substitutions to do in Makefile.in.
241 dnl compilation flags
246 AC_OUTPUT(Makefile example/Makefile test/Makefile)
249 echo " /*-----------------------------------------------*"
250 echo " * PIP/PipLib configuration is OK *"
251 echo " *-----------------------------------------------*/"
252 echo "It appears that your system is OK to start PIP/PipLib compilation. You"
253 echo "need now to type \"make uninstall\" if your are upgrading an old version."
254 echo "Next, type \"make\" to build the program. Lastly type \"make install\" to"
255 echo "install it on your system (log as root if necessary)."