Merge pull request #3 from ftynse/master
[clay.git] / configure.ac
blobebfe1d9abf05e05d8fa752dda11ac4ac62e94665
1 dnl
2 dnl   /*------------------------------------------------------------------+
3 dnl    |                             Clay                                 |
4 dnl    |------------------------------------------------------------------|
5 dnl    |                          autoconf.ac                             |
6 dnl    |------------------------------------------------------------------|
7 dnl    |                   First version: 03/04/2012                      |
8 dnl    +------------------------------------------------------------------+
9 dnl
10 dnl +------------------------------------------------------------------------+
11 dnl |  / __)(  )    /__\ ( \/ )                                              |
12 dnl | ( (__  )(__  /(__)\ \  /        Chunky Loop Alteration wizardrY        |
13 dnl |  \___)(____)(__)(__)(__)                                               |
14 dnl +------------------------------------------------------------------------+
15 dnl | Copyright (C) 2012 University of Paris-Sud                             |
16 dnl |                                                                        |
17 dnl | This library is free software; you can redistribute it and/or modify   |
18 dnl | it under the terms of the GNU Lesser General Public License as         |
19 dnl | published by the Free Software Foundation; either version 2.1 of the   |
20 dnl | License, or (at your option) any later version.                        |
21 dnl |                                                                        |
22 dnl | This library is distributed in the hope that it will be useful but     |
23 dnl | WITHOUT ANY WARRANTY; without even the implied warranty of             |
24 dnl | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU       |
25 dnl | Lesser General Public License for more details.                        |
26 dnl |                                                                        |
27 dnl | You should have received a copy of the GNU Lesser General Public       |
28 dnl | License along with this software; if not, write to the Free Software   |
29 dnl | Foundation, Inc., 51 Franklin Street, Fifth Floor,                     |
30 dnl | Boston, MA  02110-1301  USA                                            |
31 dnl |                                                                        |
32 dnl | Clay, the Chunky Loop Alteration wizardrY                              |
33 dnl | Written by Cedric Bastoul, Cedric.Bastoul@u-psud.fr                    |
34 dnl +------------------------------------------------------------------------*/
35 dnl
36 dnl Input file for autoconf to build a configuration shellscript.
38 m4_define([version_major], [0])
39 m4_define([version_minor], [0])
40 m4_define([version_revision], [1])
42 AC_PREREQ(2.53)
43 dnl Fill here the @bug email adress.
44 AC_INIT([clay], [version_major.version_minor.version_revision],
45         [cedric.bastoul@u-psud.fr])
46 dnl A common file, which serve as a test.
47 AC_CONFIG_SRCDIR([include/clay/clay.h])
48 dnl Put as most as possible configuration files to an auxialiry
49 dnl directory.
50 AC_CONFIG_AUX_DIR(autoconf)
51 AC_CONFIG_MACRO_DIR([m4])
53 dnl Initialize automake.
54 AM_INIT_AUTOMAKE([foreign])
55 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
57 dnl /**************************************************************************
58 dnl  *                              Checking                                  *
59 dnl  **************************************************************************/
62 dnl Checks for programs.
63 AC_PROG_CC
64 AC_PROG_LN_S
65 AC_PROG_MAKE_SET
66 AC_CHECK_PROG(CD, cd)
67 AC_PROG_INSTALL
68 AC_PROG_LIBTOOL
69 AC_PROG_LEX
70 AC_PROG_YACC
71 AC_CHECK_PROGS(DOXYGEN,doxygen,doxygen)
72   
73 AX_CC_MAXOPT
74 AC_SUBST(CFLAGS_WARN)
75 AX_CFLAGS_WARN_ALL(CFLAGS_WARN)
77 dnl Checks for typedefs, structures, and compiler characteristics.
78 AC_C_CONST
79 AC_TYPE_SIZE_T
81 dnl Checks for header files.
82 AC_HEADER_STDC
83 AC_CHECK_HEADERS([errno.h stddef.h stdlib.h string.h strings.h unistd.h])
85 dnl Checks for library functions.
86 AC_CHECK_FUNCS(strtol)
89 dnl /**************************************************************************
90 dnl  *                             Option setting                             *
91 dnl  **************************************************************************/
93 dnl /**************************************************************************
94 dnl  *                   Where is the OpenScop Library?                       *
95 dnl  **************************************************************************/
97 AX_SUBMODULE(osl,system|build|bundled,system)
99 AC_SUBST(OSL_CPPFLAGS)
100 AC_SUBST(OSL_LDFLAGS)
101 AC_SUBST(OSL_LIBS)
102 case "$with_osl" in
103 bundled)
104         OSL_CPPFLAGS="-I$srcdir/osl/include -Iosl/include"
105         OSL_LIBS="$srcdir/osl/libosl.la"
106         ;;
107 build)
108         OSL_CPPFLAGS="-I$osl_srcdir/include -I$with_osl_builddir/include"
109         OSL_LIBS="$with_osl_builddir/libosl.la"
110         ;;
111 system)
112   OSL_CPPFLAGS="-I$with_osl_prefix/include"
113         OSL_LIBS="$with_osl_prefix/lib/libosl.la -losl"
114 #if test "x$with_osl_exec_prefix" != "x"; then
115 #               OSL_LDFLAGS="-L$with_osl_exec_prefix/lib"
116 #       fi
117 esac
118 AM_CONDITIONAL(BUNDLED_OSL, test $with_osl = bundled)
121 dnl /**************************************************************************
122 dnl  *                   Where is Clan ?                                      *
123 dnl  **************************************************************************/
125 AX_SUBMODULE(clan,system|build|bundled|no,no)
127 AC_SUBST(CLAN_CPPFLAGS)
128 AC_SUBST(CLAN_LDFLAGS)
129 AC_SUBST(CLAN_LIBS)
130 case "$with_clan" in
131 bundled)
132         CLAN_CPPFLAGS="-I$srcdir/clan/include -Iclan/include -DCLAN_LINKED"
133         CLAN_LIBS="$srcdir/clan/libclan.la"
134         ;;
135 build)
136         CLAN_CPPFLAGS="-I$clan_srcdir/include -I$with_clan_builddir/include -DCLAN_LINKED"
137         CLAN_LIBS="$with_clan_builddir/libclan.la"
138         ;;
139 system)
140   CLAN_CPPFLAGS="-I$with_clan_prefix/include -DCLAN_LINKED"
141         CLAN_LIBS="$with_clan_prefix/lib/libclan.la -lclan"
142 #       if test "x$with_clan_exec_prefix" != "x"; then
143 #               CLAN_LDFLAGS="-L$with_clan_exec_prefix/lib"
144 #       fi
145 esac
146 AM_CONDITIONAL(BUNDLED_CLAN, test $with_clan = bundled)
149 dnl /**************************************************************************
150 dnl  *                   Where is Cloog ?                                     *
151 dnl  **************************************************************************/
153 AX_SUBMODULE(cloog,system|build|bundled|no,no)
155 AC_SUBST(CLOOG_CPPFLAGS)
156 AC_SUBST(CLOOG_LDFLAGS)
157 AC_SUBST(CLOOG_LIBS)
158 case "$with_cloog" in
159 bundled)
160         CLOOG_CPPFLAGS="-I$srcdir/cloog/include -Icloog/include -DCLOOG_LINKED"
161   CLOOG_LIBS="$srcdir/cloog/libcloog-isl.la"
162         ;;
163 build)
164         CLOOG_CPPFLAGS="-I$cloog_srcdir/include -I$with_cloog_builddir/include -DCLOOG_LINKED"
165         CLOOG_LIBS="$with_cloog_builddir/libcloog-isl.la"
166         ;;
167 system)
168   CLOOG_CPPFLAGS="-I$with_cloog_prefix/include -DCLOOG_LINKED"
169         CLOOG_LIBS="$with_cloog_prefix/lib/libcloog-isl.la -lcloog-isl"
170 #       if test "x$with_cloog_exec_prefix" != "x"; then
171 #               CLOOG_LDFLAGS="-L$with_cloog_exec_prefix/lib"
172 #       fi
173 esac
174 AM_CONDITIONAL(BUNDLED_CLOOG, test $with_cloog = bundled)
177 dnl /**************************************************************************
178 dnl  *                         Where is Candl ?                               *
179 dnl  **************************************************************************/
181 AX_SUBMODULE(candl,system|build|bundled|no,no)
183 AC_SUBST(CANDL_CPPFLAGS)
184 AC_SUBST(CANDL_LDFLAGS)
185 AC_SUBST(CANDL_LIBS)
186 case "$with_candl" in
187 bundled)
188         CANDL_CPPFLAGS="-I$srcdir/candl/include -Icandl/include -DCANDL_LINKED"
189   CANDL_LIBS="$srcdir/candl/libcandl.la"
190         ;;
191 build)
192         CANDL_CPPFLAGS="-I$candl_srcdir/include -I$with_candl_builddir/include -DCANDL_LINKED"
193         CANDL_LIBS="$with_candl_builddir/libcandl.la"
194         ;;
195 system)
196   CANDL_CPPFLAGS="-I$with_candl_prefix/include -DCANDL_LINKED"
197         CANDL_LIBS="$with_candl_prefix/lib/libcandl.la -lcandl"
198 #       if test "x$with_candl_exec_prefix" != "x"; then
199 #               CANDL_LDFLAGS="-L$with_candl_exec_prefix/lib"
200 #       fi
201 esac
202 AM_CONDITIONAL(BUNDLED_CANDL, test $with_candl = bundled)
205 dnl /**************************************************************************
206 dnl  *                            Substitutions                               *
207 dnl  **************************************************************************/
210 dnl Substitutions to do.
211 AC_SUBST(ac_aux_dir)
212 AC_SUBST(abs_top_srcdir)
214 AC_SUBST(VERSION_MAJOR)
215 AC_SUBST(VERSION_MINOR)
216 AC_SUBST(VERSION_REVISION)
218 dnl Configure Makefiles.
219 AC_CONFIG_FILES([
220         Makefile
221         doc/Makefile
222         doc/Doxyfile
223         include/clay/macros.h
224         tests/Makefile
225         ],
226         [test -z "$CONFIG_HEADERS" || echo timestamp > source/stamp-h.in])
228 if test $with_osl = bundled; then
229         AC_CONFIG_SUBDIRS(osl)
232 if test $with_clan = bundled; then
233         AC_CONFIG_SUBDIRS(clan)
236 if test $with_cloog = bundled; then
237         AC_CONFIG_SUBDIRS(cloog)
240 if test $with_candl = bundled; then
241         AC_CONFIG_SUBDIRS(candl)
244 AC_OUTPUT
246 echo "             /*-----------------------------------------------+"
247 echo "              |           Clay configuration is OK            |"
248 echo "              +-----------------------------------------------*/"
249 echo "It appears that your system is OK to start Clay compilation. You need"
250 echo "now to type \"make\". Lastly type \"make install\" to install Clay on"
251 echo "your system (log as root if necessary)."