3 dnl File name: configure.in
5 dnl Author: Matthias Braun
7 dnl Copyright: (c) 2002-2007 University of Karlsruhe
8 dnl Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
12 m4_define([firm_major_version], [1])
13 m4_define([firm_minor_version], [10])
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])
21 # see libtool manual on what version numbers mean!
23 AC_SUBST([LT_VERSION])
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])
29 dnl generate the config header file
30 AC_CONFIG_HEADER([config.h])
41 /* Firm statistics need hooks */
42 #ifdef FIRM_STATISTICS
43 #ifndef FIRM_ENABLE_HOOKS
44 #define FIRM_ENABLE_HOOKS
49 dnl keep track of the environment set by the user
50 libfirm_conf_env="${CC+CC='$CC'} ${CFLAGS+CFLAGS='$CFLAGS'} ${CPP+CPP='$CPP'} ${CPPFLAGS+CPPFLAGS='$CPPFLAGS'} ${LDFLAGS+LDFLAGS='$LDFLAGS'} ${LIBS+LIBS='$LIBS'}"
51 AC_SUBST(libfirm_conf_env)
56 dnl check for additional include dirs
57 AC_ARG_WITH(includedir, [ --with-includedir=add colon seperated list of directories to include search path],
58 CPPFLAGS=$CPPFLAGS" -I"`echo $withval|sed 's;\:; -I;g'`)
60 dnl check for additional library dirs
61 AC_ARG_WITH(libdir, [ --with-libdir=add colon seperated list of directories to linker search path],
62 LDFLAGS=$LDFLAGS" -L"`echo $withval|sed 's;\:; -L;g'`)
66 AC_ARG_ENABLE([debug],
67 [AS_HELP_STRING([--disable-debug], [disable verifiers and additional debugging routines])],
68 [enable_debug_libfirm="$enableval"], [enable_debug_libfirm="yes"])
69 if test "$enable_debug_libfirm" = yes; then
70 AC_DEFINE([DEBUG_libfirm], [], [define to enable debugging stuff])
72 AC_SUBST([enable_debug_libfirm])
74 AC_ARG_ENABLE([assert],
75 [AS_HELP_STRING([--disable-assert], [disable assertions])],
76 [enable_assert="$enableval"], [enable_assert="yes"])
77 if test "$enable_assert" = no; then
78 AC_DEFINE([NDEBUG], [], [define to disable asserts])
80 AC_SUBST([enable_assert])
84 AC_ARG_ENABLE([inlining],
85 [AS_HELP_STRING([--disable-inlining], [disable inline C-extension])],
86 [enable_inlining="$enableval"], [enable_inlining="yes"])
88 if test "$enable_inlining" = yes; then
89 AC_DEFINE([USE_INLINING], [], [use inlining])
91 AC_SUBST([enable_inlining])
95 AC_ARG_ENABLE([profile],
96 [AS_HELP_STRING([--enable-profile], [enable profiling])],
97 [enable_profile_libfirm="$enableval"], [enable_profile_libfirm="no"])
99 AC_SUBST([enable_profile_libfirm])
101 dnl set auto documentation
102 dnl ----------------------
103 AC_ARG_ENABLE([autodoc],
104 [AS_HELP_STRING([--enable-autodoc], [enable auto documentation])],
105 [enable_auto_documentation="$enableval"], [enable_auto_documentation="no"])
107 AC_SUBST([enable_auto_documentation])
111 AC_ARG_ENABLE([firmjni],
112 [AS_HELP_STRING([--enable-firmjni], [check for tools necesarry to construct a java native interface for Firm])],
113 [enable_firm_jni="$enableval"], [enable_firm_jni="no"])
115 AC_SUBST(enable_firm_jni)
117 dnl set heap analyses support
118 dnl -------------------------
119 AC_ARG_ENABLE([heapanalysis],
120 [AS_HELP_STRING([--enable-heapanalysis], [Compile with heap analysis.])],
121 [enable_heapanalysis=$enableval], [enable_heapanalysis="no"])
123 if test "$enable_heapanalysis" = "yes"; then
124 AC_DEFINE([DO_HEAPANALYSIS], [], [enable heap analysis])
126 AC_SUBST([enable_heapanalysis])
128 dnl enable Firm hooks
130 AC_ARG_ENABLE([hooks],
131 [AS_HELP_STRING([--disable-hooks], [disable Firm hooks])],
132 [enable_hooks="$enableval"], [enable_hooks="yes"])
134 if test "$enable_hooks" = yes; then
135 AC_DEFINE([FIRM_ENABLE_HOOKS], [], [enable firm hooks])
138 dnl enable Firm statistics
140 AC_ARG_ENABLE([statistics],
141 [AS_HELP_STRING([--enable-statistics], [enable Firm statistics])],
142 [enable_statistics="$enableval"], [enable_statistics="no"])
144 if test "$enable_statistics" = yes; then
145 AC_DEFINE([FIRM_STATISTICS], [], [enable statistics code])
147 AC_SUBST([enable_statistics])
149 dnl enable libcore support
150 dnl --------------------------------
151 AC_ARG_ENABLE([libcore],
152 [AS_HELP_STRING([--disable-libcore], [disable libcore support])],
153 [enable_libcore="$enableval"],[enable_libcore="yes"])
155 AC_SUBST([enable_libcore])
157 dnl enable ILP solver support
158 dnl --------------------------------
160 [AS_HELP_STRING([--enable-ilp], [enable ilp solver])],
161 [enable_ilp="$enableval"], [enable_ilp="no"])
163 if test "$enable_ilp" = yes; then
164 AC_DEFINE([WITH_ILP], [], [compile with ilp solver support])
168 dnl enable JVM calling from Firm
169 dnl --------------------------------
171 [AS_HELP_STRING([--enable-jvm], [enable to call the jvm])],
172 [enable_jvm="$enableval"], [enable_jvm="no"])
174 if test "$enable_jvm" = yes; then
175 AC_DEFINE([WITH_JVM], [], [compile with jvm support])
179 dnl enable wchar_t support for identifiers
180 dnl --------------------------------
181 AC_ARG_ENABLE([wchar_support],
182 [AS_HELP_STRING([--enable-wchar-support], [enable wchar_t support for identifiers (needed for java)])],
183 [enable_wchar_support="$enableval"], [enable_wchar_support="no"])
185 if test "$enable_wchar_support" = yes; then
186 AC_DEFINE([FIRM_ENABLE_WCHAR], [], [enable wchar_t support for identifiers])
188 AC_SUBST([enable_wchar_support])
190 dnl disable external effects in XML
191 dnl -------------------------------
192 dnl AC_ARG_ENABLE([external-effects],
193 dnl [AS_HELP_STRING([--enable-external-effects], [enable reading of descriptions of external effects in XML])],
194 dnl [enable_external_effects="$enableval"], [enable_external_effects="no"])
196 dnl AC_SUBST(enable_external_effects)
200 AC_ARG_ENABLE([backend],
201 [AS_HELP_STRING([--disable-backend], [disable backends])],
202 [enable_backend="$enableval"], [enable_backend="yes"])
204 AC_SUBST(enable_backend)
206 dnl Checks for programs.
207 dnl ====================
209 dnl check for a C compiler
210 dnl ----------------------
214 AC_PATH_PROGS(PERL, perl perl5)
220 dnl check for doxygen if enabled
221 dnl ----------------------------
222 if test "$enable_auto_documentation" = yes; then
223 AC_CHECK_PROG(DOXYGEN, doxygen, "doxygen", "")
224 if test "$DOXYGEN" != "doxygen"; then
225 AC_MSG_ERROR(need doxygen for auto documentation)
227 AC_CHECK_PROG(DOT, dot, "dot", "")
228 if test "$DOT" != "dot"; then
229 AC_MSG_ERROR(need dot for doxygen documentation (for class graphs) (IPD: module add Graphviz))
233 dnl check for availability of a jdk
234 dnl -------------------------------
235 if test "$enable_firm_jni" = yes; then
236 AC_CHECK_PROG(JAVAC, javac, "javac", "")
237 if test "$JAVAC" != "javac"; then
238 AC_MSG_ERROR(need java compiler javac to generate jni (IPD: module add jdk-1.3.1-sun))
240 AC_CHECK_PROG(JAVAH, javah, "javah", "")
241 if test "$JAVAH" != "javah"; then
242 AC_MSG_ERROR(need javah to generate jni headers (IPD: module add jdk-1.3.1-sun))
246 dnl check for availability of pkg-config
250 dnl Checks for header files.
251 dnl ========================
255 dnl check for the math header file
257 AC_CHECK_HEADERS(math.h, ac_math_headers="yes", ac_math_headers="no")
258 if test "$ac_math_headers" != yes; then
259 dnl math header not found.
260 AC_MSG_ERROR("math header file not found")
264 dnl check for the obstack header file
265 dnl does not work with:
270 AC_CHECK_HEADERS(obstack.h, ac_obstack_headers="yes", ac_obstack_headers="no")
271 if test "$ac_obstack_headers" != yes; then
272 dnl obstack header not found.
273 AC_MSG_ERROR("obstack.h not found")
277 AC_CHECK_HEADERS(alloca.h, ac_alloca_headers="yes", ac_alloca_headers="no")
278 if test "$ac_alloca_headers" = "yes"; then
279 AC_DEFINE(HAVE_ALLOCA_H)
281 if test "$ac_cv_header_stdc" = "no"; then
282 AC_MSG_ERROR("alloca.h and stdlib.h not found")
287 dnl check for jni header files
289 if test "$enable_firm_jni" = yes; then
290 AC_CHECK_HEADERS(jni.h, ac_jni_headers="yes", ac_jni_headers="no")
291 if test "$ac_jni_headers" != yes; then
292 AC_MSG_ERROR(jni header file not found. (IPD: add --with-includedir=/usr/public2/java/jdk1.3.1-sun/include/:/usr/public2/java/jdk1.3.1-sun/include/linux/ to configure flags))
297 if test "$enable_external_effects" == "yes"; then
298 dnl check for libxml2 library installation dir
299 AC_CHECK_PROG(XML2CONFIG, xml2-config, "xml2-config", "echo")
300 if test "$XML2CONFIG" != "xml2-config"; then
301 AC_MSG_ERROR(xml2-config for detecting libxml2 not found)
304 LDFLAGS=$LDFLAGS" -L/usr/lib `$XML2CONFIG --libs`";
305 CPPFLAGS=$CPPFLAGS" `$XML2CONFIG --cflags`";
307 AC_CHECK_HEADERS(libxml/parser.h, ac_xml_headers="yes", ac_xml_headers="no")
308 if test "$ac_xml_headers" != yes; then
309 AC_MSG_ERROR(xml header files not found. (IPD: add --with-includedir=/usr/public/libxml2/include/libxml2/ to configure flags))
313 dnl Checks for libraries.
314 dnl =====================
316 AC_CHECK_LIB(m, main, ac_m_library="yes", ac_m_library="no")
317 if test "$ac_m_library" != yes; then
318 dnl std math library not found.
319 AC_MSG_ERROR("standard math library not found")
323 if test "$enable_external_effects" == "yes"; then
324 AC_CHECK_LIB(xml2, xmlParseFile, ac_xml_library="yes", ac_xml_library="no")
325 if test "$ac_m_library" != yes; then
326 AC_MSG_ERROR("xml2 library not found (IPD: add --with-libdir=/usr/public/libxml2/lib/ to configure flags)")
332 if test "$enable_libcore" == "yes"; then
333 PKG_CHECK_MODULES([LIBCORE], [libcore])
334 AC_DEFINE([WITH_LIBCORE], [], [define to 1 to use the libcore])
337 dnl Checks for typedefs, structures, and compiler characteristics.
338 dnl ==============================================================
345 dnl Checks for library functions.
346 dnl =============================
348 dnl check for strerror
350 AC_CHECK_FUNC(strerror,,
351 AC_MSG_ERROR("need strerror function")
354 dnl we use the gnu extension obstack_printf
355 AC_DEFINE([_GNU_SOURCE], [], [we use gnu extensions])
356 AC_CHECK_FUNC(strerror,,
357 AC_MSG_ERROR("need obstack_printf function")
368 include/libfirm/Makefile
371 AC_CONFIG_COMMANDS([stamp-h], [touch stamp-h])
372 dnl snip the lower part of config.h and put it to firm_config.h
373 AC_CONFIG_COMMANDS([firm_config.h],
374 [awk -f ${ac_top_srcdir}/filter.awk < ${ac_top_builddir}config.h > ${ac_top_builddir}firm_config.h])
377 if test "$enable_backend" == yes; then
378 BACKENDS="arm ia32 mips ppc32"
382 #if test "$BACKENDS"; then
383 # for backend in $BACKENDS; do
384 # AC_CONFIG_FILES([ir/be/$backend/Makefile])
390 dnl output summary of firm configuration
392 echo "firm configuration summary:"
393 echo " backends $BACKENDS"
394 echo " profiling $enable_profile_libfirm"
395 echo " debug/verifiers $enable_debug_libfirm"
396 echo " assertions $enable_assert"
397 echo " hooks $enable_hooks"
398 echo " statistics $enable_statistics"
399 echo " libcore $enable_libcore"
400 echo " ilp $enable_ilp"
401 echo " jvm $enable_jvm"
402 echo " wide char support $enable_wchar_support"
403 dnl echo " external effects xml $enable_external_effects"