input/output test in make check
[openscop.git] / configure.in
blob19ab7a074ca63b43108dbe34b97e0279f8f32935
1 dnl
2 dnl  /*+------------------------------------------------------------------**
3 dnl   **                       OpenScop Library                           **
4 dnl   **------------------------------------------------------------------**
5 dnl   **                         configure.in                             **
6 dnl   **------------------------------------------------------------------**
7 dnl   **                   First version: 30/04/2008                      **
8 dnl   **------------------------------------------------------------------**
9 dnl
10 dnl
11 dnl **************************************************************************
12 dnl * OpenScop: Structures and formats for polyhedral tools to talk together *
13 dnl **************************************************************************
14 dnl *   ,___,,_,__,,__,,__,,__,,_,__,,_,__,,__,,___,_,__,,_,__,              *
15 dnl *   /   / /  //  //  //  // /   / /  //  //   / /  // /  /|,_,           *
16 dnl *  /   / /  //  //  //  // /   / /  //  //   / /  // /  / / /\           *
17 dnl * |~~~|~|~~~|~~~|~~~|~~~|~|~~~|~|~~~|~~~|~~~|~|~~~|~|~~~|/_/  \          *
18 dnl * | G |C| P | = | L | P |=| = |C| = | = | = |=| = |=| C |\  \ /\         *
19 dnl * | R |l| o | = | e | l |=| = |a| = | = | = |=| = |=| L | \# \ /\        *
20 dnl * | A |a| l | = | t | u |=| = |n| = | = | = |=| = |=| o | |\# \  \       *
21 dnl * | P |n| l | = | s | t |=| = |d| = | = | = | |   |=| o | | \# \  \      *
22 dnl * | H | | y |   | e | o | | = |l|   |   | = | |   | | G | |  \  \  \     *
23 dnl * | I | |   |   | e |   | |   | |   |   |   | |   | |   | |   \  \  \    *
24 dnl * | T | |   |   |   |   | |   | |   |   |   | |   | |   | |    \  \  \   *
25 dnl * | E | |   |   |   |   | |   | |   |   |   | |   | |   | |     \  \  \  *
26 dnl * | * |*| * | * | * | * |*| * |*| * | * | * |*| * |*| * | /      \* \  \ *
27 dnl * | O |p| e | n | S | c |o| p |-| L | i | b |r| a |r| y |/        \  \ / *
28 dnl * '---'-'---'---'---'---'-'---'-'---'---'---'-'---'-'---'          '--'  *
29 dnl *                                                                        *
30 dnl * Copyright (C) 2008 University Paris-Sud 11 and INRIA                   *
31 dnl *                                                                        *
32 dnl * (3-clause BSD license)                                                 *
33 dnl * Redistribution and use in source  and binary forms, with or without    *
34 dnl * modification, are permitted provided that the following conditions     *
35 dnl * are met:                                                               *
36 dnl *                                                                        *
37 dnl * 1. Redistributions of source code must retain the above copyright      *
38 dnl *    notice, this list of conditions and the following disclaimer.       *
39 dnl * 2. Redistributions in binary form must reproduce the above copyright   *
40 dnl *    notice, this list of conditions and the following disclaimer in the *
41 dnl *    documentation and/or other materials provided with the distribution.*
42 dnl * 3. The name of the author may not be used to endorse or promote        *
43 dnl *    products derived from this software without specific prior written  *
44 dnl *    permission.                                                         *
45 dnl *                                                                        *
46 dnl * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR   *
47 dnl * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED         *
48 dnl * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
49 dnl * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,     *
50 dnl * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES     *
51 dnl * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR     *
52 dnl * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)     *
53 dnl * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,    *
54 dnl * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING  *
55 dnl * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE     *
56 dnl * POSSIBILITY OF SUCH DAMAGE.                                            *
57 dnl *                                                                        *
58 dnl * OpenScop Library, a library to manipulate OpenScop formats and data    *
59 dnl * structures. Written by:                                                *
60 dnl * Cedric Bastoul     <Cedric.Bastoul@u-psud.fr> and                      *
61 dnl * Louis-Noel Pouchet <Louis-Noel.pouchet@inria.fr>                       *
62 dnl *                                                                        *
63 dnl **************************************************************************/
64 dnl
65 dnl Input file for autoconf to build a configuration shellscript.
68 AC_PREREQ(2.13)
69 dnl Fill here the @bug email adress.
70 AC_INIT([openscop], [0.3.0], [cedric.bastoul@u-psud.fr,pouchet@cse.ohio-state.edu])
71 dnl A common file, which serve as a test.
72 AC_CONFIG_SRCDIR([include/openscop/macros.h])
73 dnl Put as most as possible configuration files to an auxialiry
74 dnl directory.
75 AC_CONFIG_AUX_DIR([autoconf])
76 dnl Initialize automake. Here, a special tar version that enables
77 dnl (very) long filenames.
78 AM_INIT_AUTOMAKE([1.9 tar-ustar no-define foreign dist-bzip2])
81 dnl default version
82 BITS="64"
83 OPENSCOP_INT_T=OPENSCOP_INT_T_IS_LONGLONG
86 dnl /**************************************************************************
87 dnl  *                              Checking                                  *
88 dnl  **************************************************************************/
91 dnl Checks for programs.
92 AC_PROG_CC
93 AC_PROG_LN_S
94 AC_PROG_MAKE_SET
95 AC_CHECK_PROG(CD, cd)
96 AC_PROG_LIBTOOL
97 AC_CHECK_PROGS(DOXYGEN,doxygen,doxygen)
99 dnl Checks for typedefs, structures, and compiler characteristics.
100 AC_C_CONST
101 AC_TYPE_SIZE_T
103 dnl Checks for header files.
104 AC_HEADER_STDC
105 AC_CHECK_HEADERS([errno.h stddef.h stdlib.h string.h strings.h unistd.h])
107 dnl Checks for library functions.
108 AC_CHECK_FUNCS(strtol)
111 dnl /**************************************************************************
112 dnl  *                             Option setting                             *
113 dnl  **************************************************************************/
115 dnl Some default values cause I'm not sure whether autoconf set them, while
116 dnl documentation says it does...
117 gmp_package="yes"
118 gmp_include_package="yes"
119 gmp_library_package="yes"
121 NEED_MP="no"
123 dnl --with-gmp=gmp-path
124 AC_ARG_WITH(gmp,
125         [  --with-gmp=DIR          DIR where the gmp package is installed],
126         [ echo "Package gmp : $withval" &&
127           gmp_package=$withval &&
128           GMP_INC=$gmp_package/include &&
129           GMP_LIB=$gmp_package/lib &&
130           OPENSCOP_INT_T=OPENSCOP_INT_T_IS_MP &&
131           NEED_MP="yes"])
133 AC_ARG_WITH(gmp-include,
134         [  --with-gmp-include=DIR  DIR where gmp.h is installed],
135         [ echo "Package gmp-include : $withval" &&
136           gmp_include_package=$withval &&
137           GMP_INC=$gmp_include_package &&
138           OPENSCOP_INT_T=OPENSCOP_INT_T_IS_MP &&
139           NEED_MP="yes"])
141 AC_ARG_WITH(gmp-library,
142         [  --with-gmp-library=DIR  DIR where the gmp library is installed],
143         [ echo "Package gmp-library : $withval" &&
144           gmp_library_package=$withval &&
145           GMP_LIB=$gmp_library_package &&
146           OPENSCOP_INT_T=OPENSCOP_INT_T_IS_MP &&
147           NEED_MP="yes"])
149 AC_ARG_ENABLE(int-version,
150         [  --enable-int-version    'int' (32 bits) version is built],
151         [ echo "Package int : $enableval" &&
152           BITS="32" &&
153           OPENSCOP_INT_T=OPENSCOP_INT_T_IS_LONG])
155 AC_ARG_ENABLE(llint-version,
156         [  --enable-llint-version  'long long int' (64 bits) version is built],
157         [ echo "Package long long int : $enableval" &&
158           BITS="64" &&
159           OPENSCOP_INT_T=OPENSCOP_INT_T_IS_LONGLONG])
161 AC_ARG_ENABLE(mp-version,
162         [  --enable-mp-version     'MP' (multiple precision) version is built],
163         [ echo "Package mp : $enableval" &&
164           BITS="MP" &&
165           OPENSCOP_INT_T=OPENSCOP_INT_T_IS_MP &&
166           CPPFLAGS="$CPPFLAGS -DLINEAR_VALUE_IS_MP"
167           NEED_MP="yes"])
169 dnl FIXME: should be removed...
170 CPPFLAGS="$CPPFLAGS -D$OPENSCOP_INT_T"
172 dnl /**************************************************************************
173 dnl  *                            Where is GMP?                               *
174 dnl  **************************************************************************/
177 dnl Checking for gmp
178 AC_MSG_CHECKING(whether gmp works)
179 if test "$gmp_package" = "no"; then
180   echo "GMP package not defined"
181   AC_MSG_RESULT(no)
182   TO_BUILD_MP=""
183 else
184   if test "$NEED_MP" = "no"; then
185     echo "Mode normal GMP"
186     TO_BUILD="$TO_BUILD MP"
187     AC_CHECK_HEADER(gmp.h,
188                     [AC_CHECK_LIB(gmp,
189                                   __gmpz_init,
190                                   [LIBS="$LIBS -lgmp"],
191                                   [echo "Can't find gmp library." &&
192                                    echo "MP version will not be builded." &&
193                                    TO_BUILD_MP=""])],
194                     [echo "Can't find gmp headers." &&
195                      echo "MP version will not be builded." &&
196                      TO_BUILD_MP=""])
197   else
198     dnl Default given by --with-X is "yes", --without-X is "no". We also
199     dnl initialized manually all gmp_package* variables to "yes" (thus they are
200     dnl supposed to be "yes" except if the user set them himself).
202     if test "$gmp_package" != "yes" ; then
203       echo "(GMP path has been set by user)"
204       GMP_DIR=$gmp_package
205       dnl Useful for AC_CHECK_X to find what we want.
206       CPPFLAGS="-I$GMP_DIR/include $CPPFLAGS"
207       LDFLAGS="-L$GMP_DIR/lib $LDFLAGS"
208     fi
210     if test "$gmp_include_package" != "yes" ; then
211       CPPFLAGS="-I$GMP_INC $CPPFLAGS"
212     fi
214     if test "$gmp_library_package" != "yes" ; then
215       LDFLAGS="-L$GMP_LIB $LDFLAGS"
216     fi
218     AC_CHECK_HEADER(gmp.h,
219                     [],
220                     [AC_MSG_ERROR(Can't find gmp headers.)])
221     AC_CHECK_LIB(gmp,
222                  __gmpz_init,
223                  [LIBS="$LIBS -lgmp"],
224                  [AC_MSG_ERROR(Can't find gmp library.)])
226     AC_MSG_RESULT(yes)
227   fi
231 dnl /**************************************************************************
232 dnl  *                            Substitutions                               *
233 dnl  **************************************************************************/
236 dnl Substitutions to do.
237 AC_SUBST(BITS)
238 AC_SUBST(OPENSCOP_INT_T)
239 AC_SUBST(ac_aux_dir)
241 dnl Configure Makefiles.
242 AC_CONFIG_FILES([
243         Makefile
244         doc/Makefile
245         doc/Doxyfile
246         include/Makefile
247         include/openscop/scop.h
248         source/Makefile
249         tests/Makefile
250         ],
251         [test -z "$CONFIG_HEADERS" || echo timestamp > source/stamp-h.in])
253 AC_OUTPUT
256 echo "             /*-----------------------------------------------*"
257 echo "              *      OpenScop Library configuration is OK     *"
258 echo "              *-----------------------------------------------*/"
259 echo "It appears that your system is OK to start the OpenScop Library compilation."
260 echo "You need now to type \"make\". Then type \"make install\" to install it on your"
261 echo "system (log as root if necessary)."