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.
14 AC_INIT(./source/piplib.c)
21 dnl /**************************************************************************
23 dnl **************************************************************************/
26 dnl Checks for typedefs, structures, and compiler characteristics.
29 dnl Checks for programs.
35 dnl Configure needs an empty install.sh file with this, i HATE that...
38 dnl Checks for typedefs, structures, and compiler characteristics.
43 dnl Checks for libraries.
44 dnl Replace `main' with a function in -lc:
45 dnl AC_CHECK_LIB(c, main)
48 dnl Checks for header files.
52 dnl Set some system dependant values.
57 EXTRA_FLAGS="-DCYGWIN"
58 EXTRA_LIBS="-lcygwin -lkernel32"
61 INSTALL_PIPLIB="install_piplibstatic" ;;
67 PIPLIB="piplibshared piplibstatic"
68 INSTALL_PIPLIB="install_piplibshared install_piplibstatic" ;;
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 INSTALL_PIP="install_pip"
85 INT_BITS=`expr $ac_cv_sizeof_int \* 8`
86 INT_DFLAGS=-DLINEAR_VALUE_IS_INT
87 LONG_BITS=`expr $ac_cv_sizeof_long_long_int \* 8`
88 LONG_DFLAGS=-DLINEAR_VALUE_IS_LONGLONG
90 MP_DFLAGS=-DLINEAR_VALUE_IS_MP
92 GMP_INC="/usr/local/include"
93 GMP_LIB="/usr/local/lib"
96 dnl --with-pip=yes, --with-pip=no ou --without-pip
97 dnl --with-lib=yes, --with-lib=no ou --without-lib
99 [ --without-pip disable the compilation of pip],
100 [ echo "Package pip : $withval" &&
101 if test "$withval"="no" ; then
107 [ --without-lib disable the compilation of libs],
108 [ echo "Package lib : $withval" &&
109 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" &&
139 if test "$enableval"="no" ; then
145 AC_ARG_ENABLE(llint-version,
146 [ --enable-llint-version Only 'long long int' version is built],
147 [ echo "Package long long int : $enableval" &&
148 if test "$enableval"="no" ; then
154 AC_ARG_ENABLE(mp-version,
155 [ --enable-mp-version Only 'MP' version is built],
156 [ echo "Package mp : $enableval" &&
157 if test "$enableval"="no" ; then
164 dnl Packages to build.
165 PACKAGES="$PIPLIB $PIP"
166 TO_INSTALL="$INSTALL_PIPLIB $INSTALL_PIP"
169 dnl /**************************************************************************
170 dnl * Where is GMP? *
171 dnl **************************************************************************/
175 AC_MSG_CHECKING(whether gmp works)
176 if test "$gmp_package" = "no"; then
180 if test "$NEED_MP" = "no"; then
181 echo "Mode normal GMP"
182 AC_CHECK_HEADER(gmp.h,
185 [EXTRA_LIBS="-lgmp $EXTRA_LIBS"],
186 [echo "Can't find gmp library." &&
187 echo "MP version will not be builded." &&
189 [echo "Can't find gmp headers." &&
190 echo "MP version will not be builded." &&
193 if test "$gmp_package" = "yes" ; then
194 AC_CHECK_HEADER(gmp.h,
196 [AC_MSG_ERROR(Can't find gmp headers.)])
199 [EXTRA_LIBS="-lgmp $EXTRA_LIBS"],
200 [AC_MSG_ERROR(Can't find gmp library.)])
202 if test ! -d "$GMP_INC" ; then
203 AC_MSG_ERROR(Directory given for gmp include does not exist.)
205 if test ! -d "$GMP_LIB" ; then
206 AC_MSG_ERROR(Directory given for gmp library does not exist.)
209 if test ! -f $GMP_INC/gmp.h; then
210 AC_MSG_ERROR(Can't find $GMP_INC/gmp.h)
212 if test -f $GMP_LIB/libgmp.so -o -f $GMP_LIB/libgmp.a ; then
213 EXTRA_INC="-I$GMP_INC"
214 EXTRA_LIBS="-L$GMP_LIB -lgmp $EXTRA_LIBS"
215 TO_BUILD="$TO_BUILD MP"
218 AC_MSG_ERROR(Can't find $GMP_LIB/libgmp{.so or .a})
226 dnl /**************************************************************************
227 dnl * Packages to actually build *
228 dnl **************************************************************************/
231 TO_BUILD="$TO_BUILD_32 $TO_BUILD_64 $TO_BUILD_MP"
234 dnl /**************************************************************************
235 dnl * Substitutions *
236 dnl **************************************************************************/
239 dnl Substitutions to do in Makefile.in.
247 AC_SUBST(EXEC_SUFFIX)
248 AC_SUBST(EXTRA_FLAGS)
252 dnl int/long bits and compilation flags
256 AC_SUBST(LONG_DFLAGS)
261 AC_SUBST(exec_prefix)
266 dnl Makefile creation.
270 echo " /*-----------------------------------------------*"
271 echo " * PIP/PipLib configuration is OK *"
272 echo " *-----------------------------------------------*/"
273 echo "It appears that your system is OK to start PIP/PipLib compilation. You"
274 echo "need now to type \"make uninstall\" if your are upgrading an old version."
275 echo "Next, type \"make\" to build the program. Lastly type \"make install\" to"
276 echo "install it on your system (log as root if necessary)."