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], [11])
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])
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)
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'`)
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'`)
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"
55 AC_SUBST([FIRMCONFIG_DEBUG_libfirm])
56 AC_SUBST([enable_debug_libfirm])
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])
64 AC_SUBST([enable_assert])
68 AC_ARG_ENABLE([inlining],
69 [AS_HELP_STRING([--disable-inlining], [disable inline C-extension])],
70 [enable_inlining="$enableval"], [enable_inlining="yes"])
72 if test "$enable_inlining" = yes; then
73 FIRMCONFIG_USE_INLINING="#define USE_INLINING"
75 AC_SUBST([FIRMCONFIG_USE_INLINING])
76 AC_SUBST([enable_inlining])
80 AC_ARG_ENABLE([profile],
81 [AS_HELP_STRING([--enable-profile], [enable profiling])],
82 [enable_profile_libfirm="$enableval"], [enable_profile_libfirm="no"])
84 AC_SUBST([enable_profile_libfirm])
86 dnl set auto documentation
87 dnl ----------------------
88 AC_ARG_ENABLE([autodoc],
89 [AS_HELP_STRING([--enable-autodoc], [enable auto documentation])],
90 [enable_auto_documentation="$enableval"], [enable_auto_documentation="no"])
92 AC_SUBST([enable_auto_documentation])
96 AC_ARG_ENABLE([firmjni],
97 [AS_HELP_STRING([--enable-firmjni], [check for tools necesarry to construct a java native interface for Firm])],
98 [enable_firm_jni="$enableval"], [enable_firm_jni="no"])
100 AC_SUBST(enable_firm_jni)
102 dnl set heap analyses support
103 dnl -------------------------
104 AC_ARG_ENABLE([heapanalysis],
105 [AS_HELP_STRING([--enable-heapanalysis], [Compile with heap analysis.])],
106 [enable_heapanalysis=$enableval], [enable_heapanalysis="no"])
108 if test "$enable_heapanalysis" = "yes"; then
109 FIRMCONFIG_DO_HEAPANALYSIS="#define DO_HEAPANALYSIS"
111 AC_SUBST([FIRMCONFIG_DO_HEAPANALYSIS])
112 AC_SUBST([enable_heapanalysis])
114 dnl enable Firm hooks
116 AC_ARG_ENABLE([hooks],
117 [AS_HELP_STRING([--disable-hooks], [disable Firm hooks])],
118 [enable_hooks="$enableval"], [enable_hooks="yes"])
120 if test "$enable_hooks" = yes; then
121 FIRMCONFIG_FIRM_ENABLE_HOOKS="#define FIRM_ENABLE_HOOKS"
123 AC_SUBST([FIRMCONFIG_FIRM_ENABLE_HOOKS])
125 dnl enable Firm statistics
127 AC_ARG_ENABLE([statistics],
128 [AS_HELP_STRING([--enable-statistics], [enable Firm statistics])],
129 [enable_statistics="$enableval"], [enable_statistics="no"])
131 if test "$enable_statistics" = yes; then
132 FIRMCONFIG_FIRM_STATISTICS="#define FIRMCONFIG_FIRM_STATISTICS"
134 AC_SUBST([FIRMCONFIG_FIRM_STATISTICS])
135 AC_SUBST([enable_statistics])
137 dnl enable libcore support
138 dnl --------------------------------
139 AC_ARG_ENABLE([libcore],
140 [AS_HELP_STRING([--disable-libcore], [disable libcore support])],
141 [enable_libcore="$enableval"],[enable_libcore="yes"])
143 AC_SUBST([enable_libcore])
145 dnl enable ILP solver support
146 dnl --------------------------------
148 [AS_HELP_STRING([--enable-ilp], [enable ilp solver])],
149 [enable_ilp="$enableval"], [enable_ilp="no"])
151 if test "$enable_ilp" = yes; then
152 FIRMCONFIG_WITH_ILP="#define FIRMCONFIG_WITH_ILP"
154 AC_SUBST([FIRMCONFIG_WITH_ILP])
157 dnl enable JVM calling from Firm
158 dnl --------------------------------
160 [AS_HELP_STRING([--enable-jvm], [enable to call the jvm])],
161 [enable_jvm="$enableval"], [enable_jvm="no"])
163 if test "$enable_jvm" = yes; then
164 FIRMCONFIG_WITH_JVM="#define FIRMCONFIG_WITH_JVM"
166 AC_SUBST([FIRMCONFIG_WITH_JVM])
169 dnl enable wchar_t support for identifiers
170 dnl --------------------------------
171 AC_ARG_ENABLE([wchar_support],
172 [AS_HELP_STRING([--enable-wchar-support], [enable wchar_t support for identifiers (needed for java)])],
173 [enable_wchar_support="$enableval"], [enable_wchar_support="no"])
175 if test "$enable_wchar_support" = yes; then
176 FIRMCONFIG_FIRM_ENABLE_WCHAR="#define FIRM_ENABLE_WCHAR"
178 AC_SUBST([FIRMCONFIG_FIRM_ENABLE_WCHAR])
179 AC_SUBST([enable_wchar_support])
181 dnl disable external effects in XML
182 dnl -------------------------------
183 dnl AC_ARG_ENABLE([external-effects],
184 dnl [AS_HELP_STRING([--enable-external-effects], [enable reading of descriptions of external effects in XML])],
185 dnl [enable_external_effects="$enableval"], [enable_external_effects="no"])
187 dnl 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 FIRMCONFIG_WITH_LIBCORE="#define WITH_LIBCORE"
327 AC_SUBST([FIRMCONFIG_WITH_LIBCORE])
329 dnl Checks for typedefs, structures, and compiler characteristics.
330 dnl ==============================================================
337 dnl Checks for library functions.
338 dnl =============================
340 dnl check for strerror
342 AC_CHECK_FUNC(strerror,,
343 AC_MSG_ERROR("need strerror function")
346 dnl we use the gnu extension obstack_printf
347 AC_DEFINE([_GNU_SOURCE], [], [we use gnu extensions])
348 AC_CHECK_FUNC(strerror,,
349 AC_MSG_ERROR("need obstack_printf function")
361 include/libfirm/Makefile
366 if test "$enable_backend" == yes; then
367 BACKENDS="arm ia32 mips ppc32"
371 #if test "$BACKENDS"; then
372 # for backend in $BACKENDS; do
373 # AC_CONFIG_FILES([ir/be/$backend/Makefile])
379 dnl output summary of firm configuration
381 echo "firm configuration summary:"
382 echo " backends $BACKENDS"
383 echo " profiling $enable_profile_libfirm"
384 echo " debug/verifiers $enable_debug_libfirm"
385 echo " assertions $enable_assert"
386 echo " hooks $enable_hooks"
387 echo " statistics $enable_statistics"
388 echo " libcore $enable_libcore"
389 echo " ilp $enable_ilp"
390 echo " jvm $enable_jvm"
391 echo " wide char support $enable_wchar_support"
392 dnl echo " external effects xml $enable_external_effects"