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.4.0)
26 dnl /**************************************************************************
28 dnl **************************************************************************/
31 if test "x$prefix" != "xNONE"; then
32 prefix_wd=`cd $prefix && pwd`
33 srcdir_wd=`cd $srcdir && pwd`
35 if test "x$prefix_wd" = "x$srcdir_wd"; then
36 AC_MSG_ERROR(Installation in source directory not supported)
38 if test "x$prefix_wd" = "x$wd"; then
39 AC_MSG_ERROR(Installation in build directory not supported)
43 dnl Checks for programs.
48 dnl Configure needs an empty install.sh file with this, i HATE that...
52 AC_CHECK_PROG(TEXI2DVI, texi2dvi, texi2dvi, [])
53 AM_CONDITIONAL(HAVE_TEXI2DVI, test -n "$TEXI2DVI")
57 dnl Checks for typedefs, structures, and compiler characteristics.
62 dnl Checks for libraries.
63 dnl Replace `main' with a function in -lc:
64 dnl AC_CHECK_LIB(c, main)
67 dnl Checks for header files.
71 dnl Checks sizeof the two supported cases.
72 AC_CHECK_SIZEOF(int,1)
73 AC_CHECK_SIZEOF(long long int,1)
76 dnl /**************************************************************************
77 dnl * Option setting *
78 dnl **************************************************************************/
81 dnl The different packages that can be built and installed.
83 INT_BITS=`expr $ac_cv_sizeof_int \* 8`
84 eval DFLAGS$INT_BITS=-DLINEAR_VALUE_IS_INT
85 LONG_BITS=`expr $ac_cv_sizeof_long_long_int \* 8`
86 eval DFLAGS$LONG_BITS=-DLINEAR_VALUE_IS_LONGLONG
88 MP_DFLAGS=-DLINEAR_VALUE_IS_MP
93 dnl --with-pip=yes, --with-pip=no or --without-pip
95 [ --without-pip disable the compilation of pip],
96 [ echo "Package pip : $withval" &&
97 if test "$withval"="no" ; then
102 [AS_HELP_STRING([--with-gmp],
103 [Build gmp version])])
104 if test "x$with_gmp" = "x"; then
107 AC_ARG_WITH(gmp_prefix,
108 [AS_HELP_STRING([--with-gmp-prefix=DIR],
109 [Prefix of gmp installation])])
110 AC_ARG_WITH(gmp_exec_prefix,
111 [AS_HELP_STRING([--with-gmp-exec-prefix=DIR],
112 [Exec prefix of gmp installation])])
114 if test "x$with_gmp_prefix" != "x" -o "x$with_gmp_exec_prefix" != "x"; then
118 if test "x$with_gmp" = "xyes"; then
122 if test "x$with_gmp_prefix" != "x" -a "x$with_gmp_exec_prefix" = "x"; then
123 with_gmp_exec_prefix=$with_gmp_prefix
127 [AS_HELP_STRING([--with-bits=32,64,gmp,all],
128 [integer type version(s) to build (default is all)])])
139 case "$with_bits" in *32*) TO_BUILD="$TO_BUILD 32" ;; esac
140 case "$with_bits" in *64*) TO_BUILD="$TO_BUILD 64" ;; esac
141 case "$with_bits" in *gmp*) TEST_MP="yes"; NEED_MP="yes" ;; esac
146 dnl /**************************************************************************
147 dnl * Where is GMP? *
148 dnl **************************************************************************/
152 if test "$with_gmp" = "no"; then
153 echo "GMP package not defined"
155 if test "$TEST_MP" != "no"; then
156 if test "x$with_gmp_prefix" != "x" ; then
157 CPPFLAGS="-I$with_gmp_prefix/include $CPPFLAGS"
160 if test "x$with_gmp_exec_prefix" != "x" ; then
161 EXTRA_LIBS="$EXTRA_LIBS -L$with_gmp_exec_prefix/lib"
162 LDFLAGS="-L$with_gmp_exec_prefix/lib $LDFLAGS"
166 AC_CHECK_HEADER(gmp.h, [
167 AC_CHECK_LIB(gmp, __gmpz_init,
169 [AC_MSG_WARN(Can't find gmp library.)])
170 ], [AC_MSG_WARN(Can't find gmp headers.)])
171 if test $gmp_found = yes; then
172 EXTRA_LIBS="$EXTRA_LIBS -lgmp"
173 TO_BUILD="$TO_BUILD MP"
175 if test $NEED_MP = yes; then
176 AC_MSG_ERROR([gmp not found])
180 AC_MSG_CHECKING(whether gmp works)
181 AC_MSG_RESULT($gmp_found)
186 dnl /**************************************************************************
187 dnl * Packages to actually build *
188 dnl **************************************************************************/
191 for tb in $TO_BUILD; do
192 piplibs="$piplibs libpiplib$tb.la"
193 if test "x$PIP" != "x"; then
194 pips="$pips pip$tb\$(EXEEXT)"
196 examples="$examples example$tb\$(EXEEXT)"
200 if test -f $srcdir/.git/HEAD; then
201 GIT_INDEX="\$(top_srcdir)/.git/index"
204 dnl /**************************************************************************
205 dnl * Substitutions *
206 dnl **************************************************************************/
209 dnl Substitutions to do in Makefile.in.
215 dnl compilation flags
220 AC_CONFIG_FILES(Makefile example/Makefile test/Makefile doc/Makefile)
221 AC_CONFIG_FILES([genversion.sh], [chmod +x genversion.sh])
222 AC_CONFIG_COMMANDS([version.h],
223 [echo '#define PIPLIB_HEAD "'`./genversion.sh`'"' > version.h])
227 echo " /*-----------------------------------------------*"
228 echo " * PIP/PipLib configuration is OK *"
229 echo " *-----------------------------------------------*/"
230 echo "It appears that your system is OK to start PIP/PipLib compilation. You"
231 echo "need now to type \"make uninstall\" if your are upgrading an old version."
232 echo "Next, type \"make\" to build the program. Lastly type \"make install\" to"
233 echo "install it on your system (log as root if necessary)."