integrer.c: add_parm: avoid extra copy of new constraints
[piplib.git] / configure.in
blobb999631770877d76769978579bcb0d830e6ec490
2 dnl /**-------------------------------------------------------------------**
3 dnl  **                              PIPLIB                               **
4 dnl  **-------------------------------------------------------------------**
5 dnl  **                           configure.in                            **
6 dnl  **-------------------------------------------------------------------**
7 dnl  **                   First version: august 11th  2001                **
8 dnl  **-------------------------------------------------------------------**/
9 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
18 AC_PREREQ(2.13)
19 AC_INIT(source/piplib.c)
20 AC_CONFIG_AUX_DIR(autoconf)
21 AM_INIT_AUTOMAKE(piplib, 1.3.6)
22 AC_SUBST(versioninfo)
23 versioninfo=2:0:0
25 TO_BUILD_32="32"
26 TO_BUILD_64="64"
27 TO_BUILD_MP="MP"
29 dnl /**************************************************************************
30 dnl  *                              Checking                                  *
31 dnl  **************************************************************************/
34 if test "x$prefix" != "xNONE"; then
35     prefix_wd=`cd $prefix && pwd`
36     srcdir_wd=`cd $srcdir && pwd`
37     wd=`pwd`
38     if test "x$prefix_wd" = "x$srcdir_wd"; then
39         AC_MSG_ERROR(Installation in source directory not supported)
40     fi
41     if test "x$prefix_wd" = "x$wd"; then
42         AC_MSG_ERROR(Installation in build directory not supported)
43     fi
46 dnl Checks for programs.
47 AC_PROG_CC
48 AC_PROG_LN_S
49 AC_PROG_MAKE_SET
50 AC_CHECK_PROG(CD, cd)
51 dnl Configure needs an empty install.sh file with this, i HATE that...
52 AC_PROG_INSTALL
53 AC_CANONICAL_HOST
54 AC_PROG_LIBTOOL
56 CFLAGS="-fomit-frame-pointer -O2"
58 dnl Checks for typedefs, structures, and compiler characteristics.
59 AC_C_CONST
60 AC_TYPE_SIZE_T
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.
69 AC_HEADER_STDC
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.
83 PIP="pip"
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
88 MP_BITS="MP"
89 MP_DFLAGS=-DLINEAR_VALUE_IS_MP
90 NEED_MP="no"
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...
97 gmp_package="yes"
98 gmp_include_package="yes"
99 gmp_library_package="yes"
102 dnl Options.
103 dnl --with-pip=yes, --with-pip=no or --without-pip
104 AC_ARG_WITH(pip,
105         [  --without-pip           disable the compilation of pip],
106         [ echo "Package pip : $withval" &&
107           if test "$withval"="no" ; then        
108                 PIP=""
109           fi ])
111 AC_ARG_WITH(gmp,
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 &&
117           NEED_MP="yes"])
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 &&
124           NEED_MP="yes"])
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 &&
131           NEED_MP="yes"])
133 AC_ARG_ENABLE(int-version,
134         [  --enable-int-version    Only 'int' version is built],
135         [ echo "Package int : $enableval" &&
136           TO_BUILD_32="32" &&
137           TO_BUILD_64="" &&
138           TO_BUILD_MP=""])
140 AC_ARG_ENABLE(llint-version,
141         [  --enable-llint-version  Only 'long long int' version is built],
142         [ echo "Package long long int : $enableval" &&
143           TO_BUILD_32="" &&
144           TO_BUILD_64="64" &&
145           TO_BUILD_MP=""])
147 AC_ARG_ENABLE(mp-version,
148         [  --enable-mp-version     Only 'MP' version is built],
149         [ echo "Package mp : $enableval" &&
150           TO_BUILD_32="" &&
151           TO_BUILD_64="" &&
152           TO_BUILD_MP="MP" &&
153           NEED_MP="yes"])
156 dnl /**************************************************************************
157 dnl  *                            Where is GMP?                               *
158 dnl  **************************************************************************/
161 dnl Checking for gmp
162 AC_MSG_CHECKING(whether gmp works)
163 if test "$gmp_package" = "no"; then
164   echo "GMP package not defined"
165   AC_MSG_RESULT(no)
166   TO_BUILD_MP=""
167 else
168   if test "$NEED_MP" = "no"; then
169     echo "Mode normal GMP"
170     AC_CHECK_HEADER(gmp.h,
171                     [AC_CHECK_LIB(gmp,
172                                   __gmpz_init,
173                                   [EXTRA_LIBS="$EXTRA_LIBS -lgmp"],
174                                   [echo "Can't find gmp library." &&
175                                    echo "MP version will not be builded." &&
176                                    TO_BUILD_MP=""])],
177                     [echo "Can't find gmp headers." &&
178                      echo "MP version will not be builded." &&
179                      TO_BUILD_MP=""])
180   else
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)"
184       GMP_DIR=$gmp_package
185       GMP_LIB=$GMP_DIR/lib
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"
191     fi
192     
193     if test "$gmp_include_package" != "yes" ; then
194       CPPFLAGS="-I$GMP_DIR/include $CPPFLAGS"
195     fi
196     
197     if test "$gmp_library_package" != "yes" ; then
198       EXTRA_LIBS="$EXTRA_LIBS -L$GMP_LIB"
199       LDFLAGS="-L$GMP_DIR/lib $LDFLAGS"
200     fi
201      
202     AC_CHECK_HEADER(gmp.h,
203                     [],
204                     [AC_MSG_ERROR(Can't find gmp headers.)])
205     AC_CHECK_LIB(gmp,
206                  __gmpz_init,
207                  [EXTRA_LIBS="$EXTRA_LIBS -lgmp"],
208                  [AC_MSG_ERROR(Can't find gmp library.)])
209     
210     AC_MSG_RESULT(yes)
211   fi
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)"
225     fi
226     examples="$examples example$tb\$(EXEEXT)"
227 done
230 dnl /**************************************************************************
231 dnl  *                            Substitutions                               *
232 dnl  **************************************************************************/
235 dnl Substitutions to do in Makefile.in.
236 AC_SUBST(examples)
237 AC_SUBST(piplibs)
238 AC_SUBST(pips)
239 AC_SUBST(EXTRA_LIBS)
241 dnl compilation flags
242 AC_SUBST(DFLAGS32)
243 AC_SUBST(DFLAGS64)
244 AC_SUBST(MP_DFLAGS)
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)."