Fix empty osl_strings_t reading
[openscop.git] / configure.in
blob425efe9ac814c6a4c2850e548d5f3bc3b100e03d
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([osl], [0.8.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/osl/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 /**************************************************************************
82 dnl  *                              Checking                                  *
83 dnl  **************************************************************************/
86 dnl Checks for programs.
87 AC_PROG_CC
88 AC_PROG_LN_S
89 AC_PROG_MAKE_SET
90 AC_CHECK_PROG(CD, cd)
91 AC_PROG_LIBTOOL
92 AC_CHECK_PROGS(DOXYGEN,doxygen,doxygen)
94 dnl Checks for typedefs, structures, and compiler characteristics.
95 AC_C_CONST
96 AC_TYPE_SIZE_T
98 dnl Checks for header files.
99 AC_HEADER_STDC
100 AC_CHECK_HEADERS([errno.h stddef.h stdlib.h string.h strings.h unistd.h])
102 dnl Checks for library functions.
103 AC_CHECK_FUNCS(strtol)
106 dnl /**************************************************************************
107 dnl  *                             Option setting                             *
108 dnl  **************************************************************************/
110 dnl Some default values cause I'm not sure whether autoconf set them, while
111 dnl documentation says it does...
112 gmp_package="yes"
113 gmp_include_package="yes"
114 gmp_library_package="yes"
115 gmp_flag="OSL_GMP_IS_HERE"
117 ASKED_FOR_GMP="no"
119 dnl --with-gmp=gmp-path
120 AC_ARG_WITH(gmp,
121         [  --with-gmp=DIR          DIR where the gmp package is installed],
122         [ echo "Package gmp : $withval" &&
123           gmp_package=$withval &&
124           GMP_INC=$gmp_package/include &&
125           GMP_LIB=$gmp_package/lib &&
126           ASKED_FOR_GMP="yes"])
128 AC_ARG_WITH(gmp-include,
129         [  --with-gmp-include=DIR  DIR where gmp.h is installed],
130         [ echo "Package gmp-include : $withval" &&
131           gmp_include_package=$withval &&
132           GMP_INC=$gmp_include_package &&
133           ASKED_FOR_GMP="yes"])
135 AC_ARG_WITH(gmp-library,
136         [  --with-gmp-library=DIR  DIR where the gmp library is installed],
137         [ echo "Package gmp-library : $withval" &&
138           gmp_library_package=$withval &&
139           GMP_LIB=$gmp_library_package &&
140           ASKED_FOR_GMP="yes"])
143 dnl /**************************************************************************
144 dnl  *                            Where is GMP?                               *
145 dnl  **************************************************************************/
148 dnl Checking for gmp
149 AC_MSG_CHECKING(whether gmp works)
150 if test "$gmp_package" = "no"; then
151   echo "GMP package not defined"
152   AC_MSG_RESULT(no)
153 else
154   if test "$ASKED_FOR_GMP" = "no"; then
155     echo "Mode normal GMP"
156     AC_CHECK_HEADER(gmp.h,
157                     [AC_CHECK_LIB(gmp,
158                                   __gmpz_init,
159                                   [LIBS="$LIBS -lgmp" &&
160                                    CPPFLAGS="-D$gmp_flag $CPPFLAGS"],
161                                   [echo "Cannot find gmp library." &&
162                                    echo "MP precision will not be supported."])],
163                     [echo "Can't find gmp headers." &&
164                      echo "MP precision will not be supported."])
165   else
166     dnl Default given by --with-X is "yes", --without-X is "no". We also
167     dnl initialized manually all gmp_package* variables to "yes" (thus they are
168     dnl supposed to be "yes" except if the user set them himself).
170     if test "$gmp_package" != "yes" ; then
171       echo "(GMP path has been set by user)"
172       GMP_DIR=$gmp_package
173       CPPFLAGS="-I$GMP_DIR/include $CPPFLAGS"
174       LDFLAGS="-L$GMP_DIR/lib $LDFLAGS"
175     fi
177     if test "$gmp_include_package" != "yes" ; then
178       CPPFLAGS="-I$GMP_INC $CPPFLAGS"
179     fi
181     if test "$gmp_library_package" != "yes" ; then
182       LDFLAGS="-L$GMP_LIB $LDFLAGS"
183     fi
185     AC_CHECK_HEADER(gmp.h,
186                     [],
187                     [AC_MSG_ERROR("Cannot find gmp headers.")])
188     AC_CHECK_LIB(gmp,
189                  __gmpz_init,
190                  [LIBS="$LIBS -lgmp" &&
191                   CPPFLAGS="-D$gmp_flag $CPPFLAGS"],
192                  [AC_MSG_ERROR("Cannot find gmp library.")])
194     AC_MSG_RESULT(yes)
195   fi
199 dnl /**************************************************************************
200 dnl  *                            Substitutions                               *
201 dnl  **************************************************************************/
204 dnl Substitutions to do.
205 AC_SUBST(ac_aux_dir)
207 dnl Configure Makefiles.
208 AC_CONFIG_FILES([
209         Makefile
210         doc/Makefile
211         doc/Doxyfile
212         include/Makefile
213         include/osl/scop.h
214         source/Makefile
215         tests/Makefile
216         ],
217         [test -z "$CONFIG_HEADERS" || echo timestamp > source/stamp-h.in])
219 AC_OUTPUT
222 echo "             /*-----------------------------------------------*"
223 echo "              *      OpenScop Library configuration is OK     *"
224 echo "              *-----------------------------------------------*/"
225 echo "It appears that your system is OK to start the OpenScop Library compilation."
226 echo "You need now to type \"make\". Then type \"make install\" to install it on your"
227 echo "system (log as root if necessary)."