3 dnl File name: configure.in
5 dnl Author: Till Riedel (??)
9 dnl Copyright: (c) 2002-2003 Universität Karlsruhe
10 dnl Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
16 AC_INIT(libfirm,1.3.0)
19 dnl if other files should be generated just add them to ac_output_files
20 ac_output_file="Makefile MakeRules ir/Makefile ir/adt/Makefile ir/debug/Makefile \
21 ir/tv/Makefile ir/common/Makefile ir/ident/Makefile ir/ir/Makefile \
22 ir/ana/Makefile ir/tr/Makefile ir/ana2/Makefile ir/stat/Makefile \
23 ir/opt/Makefile ir/external/Makefile ir/config/Makefile \
24 ir/arch/Makefile ir/lower/Makefile \
25 testprograms/Makefile firmjni/Makefile firmjni/testprograms/Makefile \
28 dnl generate the config header file
29 AC_CONFIG_HEADER(config.h)
31 dnl keep track of the environment set by the user
32 libfirm_conf_env="${CC+CC='$CC'} ${CFLAGS+CFLAGS='$CFLAGS'} ${CPP+CPP='$CPP'} ${CPPFLAGS+CPPFLAGS='$CPPFLAGS'} ${LDFLAGS+LDFLAGS='$LDFLAGS'} ${LIBS+LIBS='$LIBS'}"
33 AC_SUBST(libfirm_conf_env)
35 dnl where is the configure file
36 CONF_DIR_NAME=`dirname $0`
41 dnl enabled external libFirm plugins
43 AC_MSG_CHECKING([for external libfirm plugins])
45 [ --with-plugins=list include external libfirm plugins list (space separated)],
47 plugin_subdirs=$withval
49 for i in $withval ; do
50 plugin_files="$i/Makefile $plugin_files"
52 ac_output_file="$ac_output_file $plugin_files"
58 AC_SUBST(plugin_subdirs)
59 if test "$plugin_subdirs" == ""; then
60 AC_MSG_RESULT([disabled])
62 AC_MSG_RESULT([$plugin_subdirs])
65 dnl check for additional include dirs
66 AC_ARG_WITH(includedir, [ --with-includedir=add colon seperated list of directories to include search path],
67 CPPFLAGS=$CPPFLAGS" -I"`echo $withval|sed 's;\:; -I;g'`)
69 dnl check for additional library dirs
70 AC_ARG_WITH(libdir, [ --with-libdir=add colon seperated list of directories to linker search path],
71 LDFLAGS=$LDFLAGS" -L"`echo $withval|sed 's;\:; -L;g'`)
73 dnl check for libxml2 library installation dir
74 dnl AC_ARG_WITH(libxml2, [ --with-libxml2=prefix installation prefix of libxml2 (IPD: --with-libxml2=/usr/public/libxml2)],
75 dnl LDFLAGS=$LDFLAGS" -L"$withval"/lib";
76 dnl CPPFLAGS=$CPPFLAGS" -I"$withval"/include/libxml2")
78 dnl check for libxml2 library installation dir
79 AC_CHECK_PROG(XML2CONFIG, xml2-config, "xml2-config", "echo")
80 if test "$XML2CONFIG" != "xml2-config"; then
81 AC_MSG_ERROR(xml2-config for detecting libxml2 not found)
84 LDFLAGS=$LDFLAGS" -L/usr/lib `$XML2CONFIG --libs`";
85 CPPFLAGS=$CPPFLAGS" `$XML2CONFIG --cflags`";
90 [ --enable-debug enable assertions and additional debugging routines],
91 [if test "$enableval" = yes; then
92 AC_DEFINE(DEBUG_libfirm)
96 AC_SUBST(enable_debug_libfirm)
100 AC_ARG_ENABLE(inlining,
101 [ --disable-inlining disable inline C-extension],
102 [if test "$enableval" = yes; then
103 AC_DEFINE(USE_INLINING)
105 AC_DEFINE(USE_INLINING)
110 AC_ARG_ENABLE(profile,
111 [ --enable-profile enable profiling],
112 [if test "$enableval"=yes; then
113 enable_profile_libfirm=yes
115 [enable_profile_libfirm=no])
116 AC_SUBST(enable_profile_libfirm)
118 dnl set auto documentation
119 dnl ----------------------
120 AC_ARG_ENABLE(autodoc,
121 [ --enable-autodoc enable auto documentation],
122 [if test "$enableval"=yes; then
123 enable_auto_documentation=yes
125 [enable_auto_documentation=no])
126 AC_SUBST(enable_auto_documentation)
131 AC_ARG_ENABLE(firmjni,
132 [ --enable-firmjni check for tools necesarry to construct a java native interface for Firm],
133 [if test "$enableval"=yes; then
136 [enable_firm_jni=no])
137 AC_SUBST(enable_firm_jni)
139 dnl set heap analyses support
140 dnl -------------------------
141 AC_MSG_CHECKING([for heapanalysis])
142 AC_ARG_ENABLE(heapanalysis, [ --enable-heapanalysis Compile with heap analysis.],
143 [enable_heapanalysis=$enableval], [enable_heapanalysis="no"])
144 if test "$enable_heapanalysis" = "no"; then
145 AC_MSG_RESULT([disabled])
147 AC_DEFINE(DO_HEAPANALYSIS)
148 AC_MSG_RESULT([enabled])
150 AC_SUBST(enable_heapanalysis)
152 dnl disable linking of libiberty parts (xmalloc, xprintf, obstack, ...)
153 dnl ----------------------
154 AC_ARG_ENABLE(libiberty,
155 [ --disable-libiberty disable own libiberty parts],
156 [if test "$enableval"=yes; then
157 disable_libiberty=yes
159 [disable_libiberty=no])
160 AC_SUBST(disable_libiberty)
162 dnl enable Firm hooks
165 [ --disable-hooks disable Firm hooks],
166 [if test "$enableval" = yes; then
167 AC_DEFINE(FIRM_ENABLE_HOOKS)
169 AC_DEFINE(FIRM_ENABLE_HOOKS)
172 dnl enable Firm statistics
174 AC_ARG_ENABLE(statistics,
175 [ --enable-statistics enable Firm statistics],
176 [if test "$enableval"=yes; then
177 AC_DEFINE(FIRM_STATISTICS)
179 AC_SUBST(enable_statistics)
181 dnl enable libcore debugging support
182 dnl --------------------------------
183 AC_ARG_ENABLE(libcore,
184 [ --enable-libcore enable libcore debugging],
185 [if test "$enableval"=yes; then
186 AC_DEFINE(WITH_LIBCORE)
188 AC_SUBST(enable_libcore)
190 dnl enable ILP solver support
191 dnl --------------------------------
193 [ --enable-ilp enable ilp solver],
194 [if test "$enableval"=yes; then
200 dnl enable wchar_t support for identifiers
201 dnl --------------------------------
202 AC_ARG_ENABLE(wchar_support,
203 [ --enable-wchar-support enable wchar_t support for identifiers (needed for java)],
204 [if test "$enableval"=yes; then
205 AC_DEFINE(FIRM_ENABLE_WCHAR)
207 AC_SUBST(enable_wchar_support)
210 dnl disable external effects in XML
211 dnl -------------------------------
212 AC_MSG_CHECKING([for using external effects in xml2])
213 AC_ARG_ENABLE(external-effects,
214 [ --disable-external-effects disable descriptions of external effects in XML],
215 [if test "$enableval"="no"; then
216 enable_external_effects=no
218 [enable_external_effects=yes])
219 AC_SUBST(enable_external_effects)
220 if test "$enable_external_effects" == no; then
221 AC_MSG_RESULT([disabled])
223 AC_MSG_RESULT([enabled])
225 dnl check for header and library below
227 dnl Checks for programs.
228 dnl ====================
230 dnl check for a C compiler
231 dnl ----------------------
238 dnl check for prelinkable linker
239 dnl ----------------------------
241 if test "$libfirm_cv_prog_ld_r" != "yes"; then
242 AC_MSG_ERROR(need a prelinkcapable linker)
247 AC_CHECK_PROG(AR, ar, "ar", "")
248 if test "$AR" != "ar"; then
249 AC_MSG_ERROR(need ar for creating archives)
254 AC_CHECK_PROG(TAR, tar, "tar", "")
255 if test "$TAR" != "tar"; then
256 AC_MSG_ERROR(need tar for creating archives in distribution)
259 dnl check whether ar can handle option -s
260 dnl if not then ranlib is needed
261 dnl for simpliticity we use ranlib every time
267 touch tmp-install.a tmp-install.b
268 if eval "$INSTALL tmp-install.a tmp-install.b" ; then
271 rm tmp-install.a tmp-install.b
276 dnl check for doxygen if enabled
277 dnl ----------------------------
278 if test "$enable_auto_documentation" = yes; then
279 AC_CHECK_PROG(DOXYGEN, doxygen, "doxygen", "")
280 if test "$DOXYGEN" != "doxygen"; then
281 AC_MSG_ERROR(need doxygen for auto documentation)
283 AC_CHECK_PROG(DOT, dot, "dot", "")
284 if test "$DOT" != "dot"; then
285 AC_MSG_ERROR(need dot for doxygen documentation (for class graphs) (IPD: module add Graphviz))
289 dnl check for availability of a jdk
290 dnl -------------------------------
291 if test "$enable_firm_jni" = yes; then
292 AC_CHECK_PROG(JAVAC, javac, "javac", "")
293 if test "$JAVAC" != "javac"; then
294 AC_MSG_ERROR(need java compiler javac to generate jni (IPD: module add jdk-1.3.1-sun))
296 AC_CHECK_PROG(JAVAH, javah, "javah", "")
297 if test "$JAVAH" != "javah"; then
298 AC_MSG_ERROR(need javah to generate jni headers (IPD: module add jdk-1.3.1-sun))
303 dnl Checks for header files.
304 dnl ========================
308 dnl check for the math header file
310 AC_CHECK_HEADERS(math.h, ac_math_headers="yes", ac_math_headers="no")
311 if test "$ac_math_headers" != yes; then
312 dnl math header not found.
313 AC_MSG_ERROR("math header file not found")
317 #dnl check for the gnu multiprecission (gmp) header file
319 #AC_CHECK_HEADERS(gmp.h, ac_gmp_headers="yes", ac_gmp_headers="no")
320 #if test "$ac_gmp_headers" != yes; then
321 # dnl gmp header not found.
322 # AC_MSG_ERROR("GNU multiprecission gmp header file not found")
326 dnl check for the obstack header file
327 dnl does not work with:
332 AC_CHECK_HEADERS(obstack.h, ac_obstack_headers="yes", ac_obstack_headers="no")
333 if test "$ac_obstack_headers" != yes; then
334 dnl obstack header not found.
335 AC_MSG_ERROR("obstack.h not found")
339 AC_CHECK_HEADERS(alloca.h, ac_alloca_headers="yes", ac_alloca_headers="no")
340 if test "$ac_alloca_headers" = "yes"; then
341 AC_DEFINE(HAVE_ALLOCA_H)
343 if test "$ac_cv_header_stdc" = "no"; then
344 AC_MSG_ERROR("alloca.h and stdlib.h not found")
349 dnl check for jni header files
351 if test "$enable_firm_jni" = yes; then
352 AC_CHECK_HEADERS(jni.h, ac_jni_headers="yes", ac_jni_headers="no")
353 if test "$ac_jni_headers" != yes; then
354 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))
359 if test "$enable_external_effects" == "yes"; then
360 AC_CHECK_HEADERS(libxml/parser.h, ac_xml_headers="yes", ac_xml_headers="no")
361 if test "$ac_xml_headers" != yes; then
362 AC_MSG_ERROR(xml header files not found. (IPD: add --with-includedir=/usr/public/libxml2/include/libxml2/ to configure flags))
366 dnl Checks for libraries.
367 dnl =====================
369 #dnl check for the gnu multiprecission (gmp) library
371 #AC_CHECK_LIB(gmp, main, ac_gmp_library="yes", ac_gmp_library="no")
372 #if test "$ac_gmp_library" != yes; then
373 # dnl gmp library not found.
374 # AC_MSG_ERROR("GNU multiprecission gmp library not found")
378 AC_CHECK_LIB(m, main, ac_m_library="yes", ac_m_library="no")
379 if test "$ac_m_library" != yes; then
380 dnl std math library not found.
381 AC_MSG_ERROR("standard math library not found")
385 if test "$enable_external_effects" == "yes"; then
386 AC_CHECK_LIB(xml2, xmlParseFile, ac_xml_library="yes", ac_xml_library="no")
387 if test "$ac_m_library" != yes; then
388 AC_MSG_ERROR("xml2 library not found (IPD: add --with-libdir=/usr/public/libxml2/lib/ to configure flags)")
394 dnl Checks for typedefs, structures, and compiler characteristics.
395 dnl ==============================================================
402 dnl Checks for library functions.
403 dnl =============================
405 dnl check for strerror
407 AC_CHECK_FUNC(strerror,,
408 AC_MSG_ERROR("need strerror function")
416 AC_OUTPUT($ac_output_file,[ touch stamp-h ])
418 dnl snip the lower part of config.h and put it to ir/config/firm_config.h
419 $AWK -f $CONF_DIR_NAME/filter.awk < config.h | sed -f $CONF_DIR_NAME/filter.sed > ir/config/firm_config.h