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 AC_INIT([libfirm], [1.10.0], [firm@ipd.info.uni-karlsruhe.de])
13 AC_CONFIG_SRCDIR([ir/common/firm.c])
14 AM_INIT_AUTOMAKE([foreign dist-bzip2 1.9])
16 # see libtool manual on what version numbers mean!
18 AC_SUBST([LT_VERSION])
20 dnl generate the config header file
21 AC_CONFIG_HEADER([config.h])
32 /* Firm statistics need hooks */
33 #ifdef FIRM_STATISTICS
34 #ifndef FIRM_ENABLE_HOOKS
35 #define FIRM_ENABLE_HOOKS
40 dnl keep track of the environment set by the user
41 libfirm_conf_env="${CC+CC='$CC'} ${CFLAGS+CFLAGS='$CFLAGS'} ${CPP+CPP='$CPP'} ${CPPFLAGS+CPPFLAGS='$CPPFLAGS'} ${LDFLAGS+LDFLAGS='$LDFLAGS'} ${LIBS+LIBS='$LIBS'}"
42 AC_SUBST(libfirm_conf_env)
47 dnl check for additional include dirs
48 AC_ARG_WITH(includedir, [ --with-includedir=add colon seperated list of directories to include search path],
49 CPPFLAGS=$CPPFLAGS" -I"`echo $withval|sed 's;\:; -I;g'`)
51 dnl check for additional library dirs
52 AC_ARG_WITH(libdir, [ --with-libdir=add colon seperated list of directories to linker search path],
53 LDFLAGS=$LDFLAGS" -L"`echo $withval|sed 's;\:; -L;g'`)
57 AC_ARG_ENABLE([debug],
58 [AS_HELP_STRING([--disable-debug], [disable verifiers and additional debugging routines])],
59 [enable_debug_libfirm="$enableval"], [enable_debug_libfirm="yes"])
60 if test "$enable_debug_libfirm" = yes; then
61 AC_DEFINE([DEBUG_libfirm], [], [define to enable debugging stuff])
63 AC_SUBST([enable_debug_libfirm])
65 AC_ARG_ENABLE([assert],
66 [AS_HELP_STRING([--disable-assert], [disable assertions])],
67 [enable_assert="$enableval"], [enable_assert="yes"])
68 if test "$enable_assert" = no; then
69 AC_DEFINE([NDEBUG], [], [define to disable asserts])
71 AC_SUBST([enable_assert])
75 AC_ARG_ENABLE([inlining],
76 [AS_HELP_STRING([--disable-inlining], [disable inline C-extension])],
77 [enable_inlining="$enableval"], [enable_inlining="yes"])
79 if test "$enable_inlining" = yes; then
80 AC_DEFINE([USE_INLINING], [], [use inlining])
82 AC_SUBST([enable_inlining])
86 AC_ARG_ENABLE([profile],
87 [AS_HELP_STRING([--enable-profile], [enable profiling])],
88 [enable_profile_libfirm="$enableval"], [enable_profile_libfirm="no"])
90 AC_SUBST([enable_profile_libfirm])
92 dnl set auto documentation
93 dnl ----------------------
94 AC_ARG_ENABLE([autodoc],
95 [AS_HELP_STRING([--enable-autodoc], [enable auto documentation])],
96 [enable_auto_documentation="$enableval"], [enable_auto_documentation="no"])
98 AC_SUBST([enable_auto_documentation])
102 AC_ARG_ENABLE([firmjni],
103 [AS_HELP_STRING([--enable-firmjni], [check for tools necesarry to construct a java native interface for Firm])],
104 [enable_firm_jni="$enableval"], [enable_firm_jni="no"])
106 AC_SUBST(enable_firm_jni)
108 dnl set heap analyses support
109 dnl -------------------------
110 AC_ARG_ENABLE([heapanalysis],
111 [AS_HELP_STRING([--enable-heapanalysis], [Compile with heap analysis.])],
112 [enable_heapanalysis=$enableval], [enable_heapanalysis="no"])
114 if test "$enable_heapanalysis" = "yes"; then
115 AC_DEFINE([DO_HEAPANALYSIS], [], [enable heap analysis])
117 AC_SUBST([enable_heapanalysis])
119 dnl enable Firm hooks
121 AC_ARG_ENABLE([hooks],
122 [AS_HELP_STRING([--disable-hooks], [disable Firm hooks])],
123 [enable_hooks="$enableval"], [enable_hooks="yes"])
125 if test "$enable_hooks" = yes; then
126 AC_DEFINE([FIRM_ENABLE_HOOKS], [], [enable firm hooks])
129 dnl enable Firm statistics
131 AC_ARG_ENABLE([statistics],
132 [AS_HELP_STRING([--enable-statistics], [enable Firm statistics])],
133 [enable_statistics="$enableval"], [enable_statistics="no"])
135 if test "$enable_statistics" = yes; then
136 AC_DEFINE([FIRM_STATISTICS], [], [enable statistics code])
138 AC_SUBST([enable_statistics])
140 dnl enable libcore support
141 dnl --------------------------------
142 AC_ARG_ENABLE([libcore],
143 [AS_HELP_STRING([--disable-libcore], [disable libcore support])],
144 [enable_libcore="$enableval"],[enable_libcore="yes"])
146 AC_SUBST([enable_libcore])
148 dnl enable ILP solver support
149 dnl --------------------------------
151 [AS_HELP_STRING([--enable-ilp], [enable ilp solver])],
152 [enable_ilp="$enableval"], [enable_ilp="no"])
154 if test "$enable_ilp" = yes; then
155 AC_DEFINE([WITH_ILP], [], [compile with ilp solver support])
159 dnl enable JVM calling from Firm
160 dnl --------------------------------
162 [AS_HELP_STRING([--enable-jvm], [enable to call the jvm])],
163 [enable_jvm="$enableval"], [enable_jvm="no"])
165 if test "$enable_jvm" = yes; then
166 AC_DEFINE([WITH_JVM], [], [compile with jvm support])
170 dnl enable wchar_t support for identifiers
171 dnl --------------------------------
172 AC_ARG_ENABLE([wchar_support],
173 [AS_HELP_STRING([--enable-wchar-support], [enable wchar_t support for identifiers (needed for java)])],
174 [enable_wchar_support="$enableval"], [enable_wchar_support="no"])
176 if test "$enable_wchar_support" = yes; then
177 AC_DEFINE([FIRM_ENABLE_WCHAR], [], [enable wchar_t support for identifiers])
179 AC_SUBST([enable_wchar_support])
181 dnl disable external effects in XML
182 dnl -------------------------------
183 AC_ARG_ENABLE([external-effects],
184 [AS_HELP_STRING([--enable-external-effects], [enable reading of descriptions of external effects in XML])],
185 [enable_external_effects="$enableval"], [enable_external_effects="no"])
187 AC_SUBST(enable_external_effects)
191 AC_ARG_ENABLE([backend],
192 [AS_HELP_STRING([--disable-backend], [disable backends])],
193 [enable_backend="$enableval"], [enable_backend="yes"])
195 AC_SUBST(enable_backend)
197 dnl Checks for programs.
198 dnl ====================
200 dnl check for a C compiler
201 dnl ----------------------
205 AC_PATH_PROGS(PERL, perl perl5)
211 dnl check for doxygen if enabled
212 dnl ----------------------------
213 if test "$enable_auto_documentation" = yes; then
214 AC_CHECK_PROG(DOXYGEN, doxygen, "doxygen", "")
215 if test "$DOXYGEN" != "doxygen"; then
216 AC_MSG_ERROR(need doxygen for auto documentation)
218 AC_CHECK_PROG(DOT, dot, "dot", "")
219 if test "$DOT" != "dot"; then
220 AC_MSG_ERROR(need dot for doxygen documentation (for class graphs) (IPD: module add Graphviz))
224 dnl check for availability of a jdk
225 dnl -------------------------------
226 if test "$enable_firm_jni" = yes; then
227 AC_CHECK_PROG(JAVAC, javac, "javac", "")
228 if test "$JAVAC" != "javac"; then
229 AC_MSG_ERROR(need java compiler javac to generate jni (IPD: module add jdk-1.3.1-sun))
231 AC_CHECK_PROG(JAVAH, javah, "javah", "")
232 if test "$JAVAH" != "javah"; then
233 AC_MSG_ERROR(need javah to generate jni headers (IPD: module add jdk-1.3.1-sun))
237 dnl check for availability of pkg-config
241 dnl Checks for header files.
242 dnl ========================
246 dnl check for the math header file
248 AC_CHECK_HEADERS(math.h, ac_math_headers="yes", ac_math_headers="no")
249 if test "$ac_math_headers" != yes; then
250 dnl math header not found.
251 AC_MSG_ERROR("math header file not found")
255 dnl check for the obstack header file
256 dnl does not work with:
261 AC_CHECK_HEADERS(obstack.h, ac_obstack_headers="yes", ac_obstack_headers="no")
262 if test "$ac_obstack_headers" != yes; then
263 dnl obstack header not found.
264 AC_MSG_ERROR("obstack.h not found")
268 AC_CHECK_HEADERS(alloca.h, ac_alloca_headers="yes", ac_alloca_headers="no")
269 if test "$ac_alloca_headers" = "yes"; then
270 AC_DEFINE(HAVE_ALLOCA_H)
272 if test "$ac_cv_header_stdc" = "no"; then
273 AC_MSG_ERROR("alloca.h and stdlib.h not found")
278 dnl check for jni header files
280 if test "$enable_firm_jni" = yes; then
281 AC_CHECK_HEADERS(jni.h, ac_jni_headers="yes", ac_jni_headers="no")
282 if test "$ac_jni_headers" != yes; then
283 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))
288 if test "$enable_external_effects" == "yes"; then
289 dnl check for libxml2 library installation dir
290 AC_CHECK_PROG(XML2CONFIG, xml2-config, "xml2-config", "echo")
291 if test "$XML2CONFIG" != "xml2-config"; then
292 AC_MSG_ERROR(xml2-config for detecting libxml2 not found)
295 LDFLAGS=$LDFLAGS" -L/usr/lib `$XML2CONFIG --libs`";
296 CPPFLAGS=$CPPFLAGS" `$XML2CONFIG --cflags`";
298 AC_CHECK_HEADERS(libxml/parser.h, ac_xml_headers="yes", ac_xml_headers="no")
299 if test "$ac_xml_headers" != yes; then
300 AC_MSG_ERROR(xml header files not found. (IPD: add --with-includedir=/usr/public/libxml2/include/libxml2/ to configure flags))
304 dnl Checks for libraries.
305 dnl =====================
307 AC_CHECK_LIB(m, main, ac_m_library="yes", ac_m_library="no")
308 if test "$ac_m_library" != yes; then
309 dnl std math library not found.
310 AC_MSG_ERROR("standard math library not found")
314 if test "$enable_external_effects" == "yes"; then
315 AC_CHECK_LIB(xml2, xmlParseFile, ac_xml_library="yes", ac_xml_library="no")
316 if test "$ac_m_library" != yes; then
317 AC_MSG_ERROR("xml2 library not found (IPD: add --with-libdir=/usr/public/libxml2/lib/ to configure flags)")
323 if test "$enable_libcore" == "yes"; then
324 PKG_CHECK_MODULES([LIBCORE], [libcore])
325 AC_DEFINE([WITH_LIBCORE], [], [define to 1 to use the libcore])
328 dnl Checks for typedefs, structures, and compiler characteristics.
329 dnl ==============================================================
336 dnl Checks for library functions.
337 dnl =============================
339 dnl check for strerror
341 AC_CHECK_FUNC(strerror,,
342 AC_MSG_ERROR("need strerror function")
345 dnl we use the gnu extension obstack_printf
346 AC_DEFINE([_GNU_SOURCE], [], [we use gnu extensions])
347 AC_CHECK_FUNC(strerror,,
348 AC_MSG_ERROR("need obstack_printf function")
359 include/libfirm/Makefile
362 AC_CONFIG_COMMANDS([stamp-h], [touch stamp-h])
363 dnl snip the lower part of config.h and put it to firm_config.h
364 AC_CONFIG_COMMANDS([firm_config.h],
365 [awk -f ${ac_top_srcdir}/filter.awk < ${ac_top_builddir}config.h > ${ac_top_builddir}firm_config.h])
368 #if test "$enable_backend" == yes; then
369 # BACKENDS="arm ia32 mips ppc32"
371 #AC_SUBST([BACKENDS])
373 #if test "$BACKENDS"; then
374 # for backend in $BACKENDS; do
375 # AC_CONFIG_FILES([ir/be/$backend/Makefile])
381 dnl output summary of firm configuration
383 echo "firm configuration summary:"
384 echo " backends $BACKENDS"
385 echo " profiling $enable_profile_libfirm"
386 echo " debug/verifiers $enable_debug_libfirm"
387 echo " assertions $enable_assert"
388 echo " hooks $enable_hooks"
389 echo " statistics $enable_statistics"
390 echo " libcore $enable_libcore"
391 echo " ilp $enable_ilp"
392 echo " jvm $enable_jvm"
393 echo " wide char support $enable_wchar_support"
394 echo " external effects xml $enable_external_effects"