Merge branch 'master' of github.com:periscop/openscop
[openscop.git] / configure.ac
blobb9b22b3d921452cb785285a5ef1192aff6490baa
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.
67 m4_define([version_major], [0])
68 m4_define([version_minor], [9])
69 m4_define([version_revision], [0])
71 AC_PREREQ(2.53)
72 dnl Fill here the @bug email adress.
73 AC_INIT([osl], [version_major.version_minor.version_revision],
74         [cedric.bastoul@u-psud.fr,pouchet@cse.ohio-state.edu])
75 dnl A common file, which serve as a test.
76 AC_CONFIG_SRCDIR([include/osl/macros.h])
77 dnl Put as most as possible configuration files to an auxialiry
78 dnl directory.
79 AC_CONFIG_AUX_DIR([autoconf])
80 AC_CONFIG_MACRO_DIR([m4])
82 dnl Initialize automake.
83 AM_INIT_AUTOMAKE([foreign])
84 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
87 dnl /**************************************************************************
88 dnl  *                              Checking                                  *
89 dnl  **************************************************************************/
92 dnl Checks for programs.
93 AC_PROG_CC
94 AC_PROG_LN_S
95 AC_PROG_MAKE_SET
96 AC_CHECK_PROG(CD, cd)
97 AC_PROG_INSTALL
98 AC_PROG_LIBTOOL
100 AC_CHECK_PROGS(DOXYGEN, doxygen, doxygen, [])
101 AC_CHECK_PROGS(TEXI2PDF, texi2pdf, texi2pdf, [])
102 AM_CONDITIONAL(GENERATE_DOC, test -n "$TEXI2PDF" -a -n "$DOXYGEN")
103   
104 AX_CC_MAXOPT
105 AC_SUBST(CFLAGS_WARN)
106 AX_CFLAGS_WARN_ALL(CFLAGS_WARN)
108 dnl Checks for typedefs, structures, and compiler characteristics.
109 AC_C_CONST
110 AC_TYPE_SIZE_T
112 dnl Checks for header files.
113 AC_HEADER_STDC
114 AC_CHECK_HEADERS([errno.h stddef.h stdlib.h string.h strings.h unistd.h])
116 dnl Checks for library functions.
117 AC_CHECK_FUNCS(strtol)
120 dnl /**************************************************************************
121 dnl  *                             Option setting                             *
122 dnl  **************************************************************************/
124 dnl /**************************************************************************
125 dnl  *                            Where is GMP?                               *
126 dnl  **************************************************************************/
128 gmp_flag="OSL_GMP_IS_HERE"
129 AX_SUBMODULE(gmp,no|system|build,system)
131 case "$with_gmp" in
132 build)
133     CPPFLAGS="-D$gmp_flag -I$gmp_srcdir -I$with_gmp_builddir $CPPFLAGS"
134     LIBS="$with_gmp_builddir/libgmp.la $LIBS"
135     LDFLAGS="-L$with_gmp_builddir $LDFLAGS"
136     ;;
137 system)
138     CPPFLAGS="-D$gmp_flag $CPPFLAGS"
139     LIBS="-lgmp $LIBS"
140     if test "x$with_gmp_prefix" != "x"; then
141         CPPFLAGS="-I$with_gmp_prefix/include $CPPFLAGS"
142         LDFLAGS="-L$with_gmp_prefix/lib $LDFLAGS"
143     fi
144     dnl AC_CHECK_LIB doesn't use LDFLAGS --> not suitable for the build case.
145     AC_CHECK_LIB(gmp,
146                  __gmpz_init,
147                  [],
148                  [AC_MSG_ERROR("Can't find gmp library.")])
149     ;;
150 esac
151 case "$with_gmp" in
152 build|system)
153     AC_CHECK_HEADER(gmp.h,
154                     [],
155                     [AC_MSG_ERROR("Can't find gmp headers.")])
156     ;;
157 esac
160 dnl /**************************************************************************
161 dnl  *                            Substitutions                               *
162 dnl  **************************************************************************/
165 dnl Substitutions to do.
166 AC_SUBST(ac_aux_dir)
167 AC_SUBST(abs_top_srcdir)
169 AC_SUBST(VERSION_MAJOR)
170 AC_SUBST(VERSION_MINOR)
171 AC_SUBST(VERSION_REVISION)
173 dnl Configure Makefiles.
174 AC_CONFIG_FILES([
175         Makefile
176         doc/Makefile
177         doc/Doxyfile
178         include/osl/scop.h
179         tests/Makefile
180         ],
181         [test -z "$CONFIG_HEADERS" || echo timestamp > source/stamp-h.in])
183 AC_OUTPUT
186 echo "             /*-----------------------------------------------*"
187 echo "              *      OpenScop Library configuration is OK     *"
188 echo "              *-----------------------------------------------*/"
189 echo "It appears that your system is OK to start the OpenScop Library compilation."
190 echo "You need now to type \"make\". Then type \"make install\" to install it on your"
191 echo "system (log as root if necessary)."