- copy libcore into libfirm
[libfirm] / configure.ac
1 dnl
2 dnl Project:     libFIRM
3 dnl File name:   configure.in
4 dnl Purpose:
5 dnl Author:      Matthias Braun
6 dnl CVS-ID:      $Id$
7 dnl Copyright:   (c) 2002-2007 University of Karlsruhe
8 dnl Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
9 dnl
10 AC_PREREQ([2.54])
11 AC_REVISION([$Id$])
12 m4_define([firm_major_version], [1])
13 m4_define([firm_minor_version], [12])
14 m4_define([firm_micro_version], [0])
15 m4_define([firm_version],
16           [firm_major_version.firm_minor_version.firm_micro_version])
17 AC_INIT([libfirm], [firm_version], [firm@ipd.info.uni-karlsruhe.de])
18 AC_CONFIG_SRCDIR([ir/common/firm.c])
19 AM_INIT_AUTOMAKE([foreign dist-bzip2 1.9])
20
21 # see libtool manual on what version numbers mean!
22 LT_VERSION=0:0:0
23 AC_SUBST([LT_VERSION])
24
25 AC_DEFINE([libfirm_VERSION_MAJOR], [firm_major_version], [Firms major version number])
26 AC_DEFINE([libfirm_VERSION_MINOR], [firm_minor_version], [Firms minor version number])
27 AC_DEFINE([libfirm_VERSION_MICRO], [firm_micro_version], [Firms micro version number])
28
29 dnl generate the config header file
30 AC_CONFIG_HEADER([config.h])
31
32 dnl keep track of the environment set by the user
33 libfirm_conf_env="${CC+CC='$CC'} ${CFLAGS+CFLAGS='$CFLAGS'} ${CPP+CPP='$CPP'} ${CPPFLAGS+CPPFLAGS='$CPPFLAGS'} ${LDFLAGS+LDFLAGS='$LDFLAGS'} ${LIBS+LIBS='$LIBS'}"
34 AC_SUBST(libfirm_conf_env)
35
36 dnl Package options
37 dnl ===============
38
39 dnl check for additional include dirs
40 AC_ARG_WITH(includedir, [  --with-includedir=add   colon seperated list of directories to include search path],
41     CPPFLAGS=$CPPFLAGS" -I"`echo $withval|sed 's;\:; -I;g'`)
42
43 dnl check for additional library dirs
44 AC_ARG_WITH(libdir, [  --with-libdir=add       colon seperated list of directories to linker search path],
45     LDFLAGS=$LDFLAGS" -L"`echo $withval|sed 's;\:; -L;g'`)
46
47 dnl set debugging
48 dnl -------------
49 AC_ARG_ENABLE([debug],
50 [AS_HELP_STRING([--disable-debug], [disable verifiers and additional debugging routines])],
51 [enable_debug_libfirm="$enableval"], [enable_debug_libfirm="yes"])
52 if test "$enable_debug_libfirm" = yes; then
53         FIRMCONFIG_DEBUG_libfirm="#define DEBUG_libfirm"
54 fi
55 AC_SUBST([FIRMCONFIG_DEBUG_libfirm])
56 AC_SUBST([enable_debug_libfirm])
57
58 AC_ARG_ENABLE([assert],
59 [AS_HELP_STRING([--disable-assert], [disable assertions])],
60 [enable_assert="$enableval"], [enable_assert="yes"])
61 if test "$enable_assert" = no; then
62   AC_DEFINE([NDEBUG], [], [define to disable asserts])
63 fi
64 AC_SUBST([enable_assert])
65
66 dnl disable inlining
67 dnl ----------------
68 AC_ARG_ENABLE([inlining],
69 [AS_HELP_STRING([--disable-inlining], [disable inline C-extension])],
70 [enable_inlining="$enableval"], [enable_inlining="yes"])
71
72 if test "$enable_inlining" = yes; then
73   FIRMCONFIG_USE_INLINING="#define USE_INLINING"
74 fi
75 AC_SUBST([FIRMCONFIG_USE_INLINING])
76 AC_SUBST([enable_inlining])
77
78 dnl set profiling
79 dnl -------------
80 AC_ARG_ENABLE([profile],
81 [AS_HELP_STRING([--enable-profile], [enable profiling])],
82 [enable_profile_libfirm="$enableval"], [enable_profile_libfirm="no"])
83
84 AC_SUBST([enable_profile_libfirm])
85
86 dnl set heap analyses support
87 dnl -------------------------
88 AC_ARG_ENABLE([heapanalysis],
89 [AS_HELP_STRING([--enable-heapanalysis], [Compile with heap analysis.])],
90 [enable_heapanalysis=$enableval], [enable_heapanalysis="no"])
91
92 if test "$enable_heapanalysis" = "yes"; then
93         FIRMCONFIG_DO_HEAPANALYSIS="#define DO_HEAPANALYSIS"
94 fi
95 AC_SUBST([FIRMCONFIG_DO_HEAPANALYSIS])
96 AC_SUBST([enable_heapanalysis])
97
98 dnl enable Firm hooks
99 dnl -------------
100 AC_ARG_ENABLE([hooks],
101 [AS_HELP_STRING([--disable-hooks], [disable Firm hooks])],
102 [enable_hooks="$enableval"], [enable_hooks="yes"])
103
104 if test "$enable_hooks" = yes; then
105         FIRMCONFIG_FIRM_ENABLE_HOOKS="#define FIRM_ENABLE_HOOKS"
106 fi
107 AC_SUBST([FIRMCONFIG_FIRM_ENABLE_HOOKS])
108
109 dnl enable Firm statistics
110 dnl -------------
111 AC_ARG_ENABLE([statistics],
112 [AS_HELP_STRING([--enable-statistics], [enable Firm statistics])],
113 [enable_statistics="$enableval"], [enable_statistics="yes"])
114
115 if test "$enable_statistics" = yes; then
116         FIRMCONFIG_FIRM_STATISTICS="#define FIRMCONFIG_FIRM_STATISTICS"
117 fi
118 AC_SUBST([FIRMCONFIG_FIRM_STATISTICS])
119 AC_SUBST([enable_statistics])
120
121 dnl enable ILP solver support
122 dnl --------------------------------
123 AC_ARG_ENABLE([ilp],
124 [AS_HELP_STRING([--enable-ilp], [enable ilp solver])],
125 [enable_ilp="$enableval"], [enable_ilp="no"])
126
127 if test "$enable_ilp" = yes; then
128   FIRMCONFIG_WITH_ILP="#define FIRMCONFIG_WITH_ILP"
129 fi
130 AC_SUBST([FIRMCONFIG_WITH_ILP])
131 AC_SUBST(enable_ilp)
132
133 dnl enable JVM calling from Firm
134 dnl --------------------------------
135 AC_ARG_ENABLE([jvm],
136 [AS_HELP_STRING([--enable-jvm], [enable to call the jvm])],
137 [enable_jvm="$enableval"], [enable_jvm="no"])
138
139 if test "$enable_jvm" = yes; then
140   FIRMCONFIG_WITH_JVM="#define FIRMCONFIG_WITH_JVM"
141 fi
142 AC_SUBST([FIRMCONFIG_WITH_JVM])
143 AC_SUBST(enable_jvm)
144
145 dnl enable wchar_t support for identifiers
146 dnl --------------------------------
147 AC_ARG_ENABLE([wchar_support],
148 [AS_HELP_STRING([--enable-wchar-support], [enable wchar_t support for identifiers (needed for java)])],
149 [enable_wchar_support="$enableval"], [enable_wchar_support="no"])
150
151 if test "$enable_wchar_support" = yes; then
152   FIRMCONFIG_FIRM_ENABLE_WCHAR="#define FIRM_ENABLE_WCHAR"
153 fi
154 AC_SUBST([FIRMCONFIG_FIRM_ENABLE_WCHAR])
155 AC_SUBST([enable_wchar_support])
156
157 dnl disable backend
158 dnl ---------------
159 AC_ARG_ENABLE([backend],
160 [AS_HELP_STRING([--disable-backend], [disable backends])],
161 [enable_backend="$enableval"], [enable_backend="yes"])
162
163 AC_SUBST(enable_backend)
164
165 dnl Checks for programs.
166 dnl ====================
167
168 dnl check for a C compiler
169 dnl ----------------------
170 AC_PROG_CC
171 AC_PROG_LIBTOOL
172
173 AC_PATH_PROGS(PERL, perl perl5)
174
175 dnl check for awk
176 dnl -------------
177 AC_PROG_AWK
178
179 dnl Checks for header files.
180 dnl ========================
181
182 AC_HEADER_STDC
183 AC_CHECK_HEADERS([math.h], , AC_MSG_ERROR("math header file not found"))
184
185 dnl Checks for libraries.
186 dnl =====================
187
188 AC_CHECK_LIB(m, main, ac_m_library="yes", ac_m_library="no")
189 if test "$ac_m_library" != yes; then
190   dnl std math library not found.
191   AC_MSG_ERROR("standard math library not found")
192 fi
193
194 dnl Checks for typedefs, structures, and compiler characteristics.
195 dnl ==============================================================
196 AC_C_CONST
197 AC_C_VOLATILE
198 AC_C_INLINE
199 AC_C_BIGENDIAN(,,,)
200 AC_C_LONG_DOUBLE
201
202 dnl Checks for library functions.
203 dnl =============================
204
205 dnl check for strerror
206
207 AC_CHECK_FUNC(strerror,,
208   AC_MSG_ERROR("need strerror function")
209 )
210
211 dnl we use the gnu extension obstack_printf
212 AC_DEFINE([_GNU_SOURCE], [], [we use gnu extensions])
213 AC_CHECK_FUNC(strerror,,
214   AC_MSG_ERROR("need obstack_printf function")
215 )
216
217 dnl Error messaging
218 dnl ===============
219
220
221 dnl Output results
222 AC_CONFIG_FILES([
223         firm_config.h
224         Makefile
225         ir/Makefile
226         include/libfirm/Makefile
227         libfirm.pc
228 ])
229
230 BACKENDS=""
231 if test "$enable_backend" == yes; then
232         BACKENDS="arm ia32 mips ppc32"
233 fi
234 AC_SUBST([BACKENDS])
235
236 AC_OUTPUT
237
238 dnl output summary of firm configuration
239 echo ""
240 echo "firm configuration summary:"
241 echo "     backends              $BACKENDS"
242 echo "     profiling             $enable_profile_libfirm"
243 echo "     debug/verifiers       $enable_debug_libfirm"
244 echo "     assertions            $enable_assert"
245 echo "     hooks                 $enable_hooks"
246 echo "     statistics            $enable_statistics"
247 echo "     ilp                   $enable_ilp"
248 echo "     jvm                   $enable_jvm"
249 echo "     wide char support     $enable_wchar_support"
250 echo ""