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.
18 AC_INIT(libfirm,0.3.0)
20 dnl if other files should be generated just add them to ac_output_files
21 ac_output_file="Makefile MakeRules ir/Makefile ir/adt/Makefile ir/debug/Makefile \
22 ir/tv/Makefile ir/common/Makefile ir/ident/Makefile ir/ir/Makefile \
23 ir/ana/Makefile ir/tr/Makefile ir/ana2/Makefile ir/stat/Makefile \
24 ir/opt/Makefile ir/external/Makefile ir/config/Makefile \
25 testprograms/Makefile firmjni/Makefile firmjni/testprograms/Makefile \
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)
36 dnl where is the configure file
37 CONF_DIR_NAME=`dirname $0`
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'`)
53 [ --enable-debug enable assertions and additional debugging routines],
54 [if test "$enableval" = yes; then
55 AC_DEFINE(DEBUG_libfirm)
59 AC_SUBST(enable_debug_libfirm)
63 AC_ARG_ENABLE(inlining,
64 [ --disable-inlining disable inline C-extension],
65 [if test "$enableval" = yes; then
66 AC_DEFINE(USE_INLINING)
68 AC_DEFINE(USE_INLINING)
73 AC_ARG_ENABLE(profile,
74 [ --enable-profile enable profiling],
75 [if test "$enableval"=yes; then
76 enable_profile_libfirm=yes
78 [enable_profile_libfirm=no])
79 AC_SUBST(enable_profile_libfirm)
81 dnl set auto documentation
82 dnl ----------------------
83 AC_ARG_ENABLE(autodoc,
84 [ --enable-autodoc enable auto documentation],
85 [if test "$enableval"=yes; then
86 enable_auto_documentation=yes
88 [enable_auto_documentation=no])
89 AC_SUBST(enable_auto_documentation)
94 AC_ARG_ENABLE(firmjni,
95 [ --enable-firmjni check for tools necesarry to construct a java native interface for Firm],
96 [if test "$enableval"=yes; then
100 AC_SUBST(enable_firm_jni)
102 dnl set heap analyses support
103 dnl -------------------------
104 AC_MSG_CHECKING([for heapanalysis])
105 AC_ARG_ENABLE(heapanalysis, [ --enable-heapanalysis Compile with heap analysis.],
106 [enable_heapanalysis=$enableval], [enable_heapanalysis="no"])
107 if test "$enable_heapanalysis" = "no"; then
108 AC_MSG_RESULT([disabled])
110 AC_DEFINE(DO_HEAPANALYSIS)
111 AC_MSG_RESULT([enabled])
113 AC_SUBST(enable_heapanalysis)
115 dnl set backend support
116 dnl -------------------------
117 AC_ARG_ENABLE(backend, [ --enable-backend Compile with backend facility.],
118 [if test "$enableval" = "yes"; then
119 AC_DEFINE(FIRM_BACKEND)
120 fi], [enable_backend="yes"])
121 AC_SUBST(enable_backend)
123 dnl disable linking of libiberty parts (xmalloc, xprintf, obstack, ...)
124 dnl ----------------------
125 AC_ARG_ENABLE(libiberty,
126 [ --disable-libiberty disable own libiberty parts],
127 [if test "$enableval"=yes; then
128 disable_libiberty_=yes
130 [disable_libiberty=no])
131 AC_SUBST(disable_libiberty)
133 dnl enable Firm hooks
136 [ --disable-hooks disable Firm hooks],
137 [if test "$enableval" = yes; then
138 AC_DEFINE(FIRM_ENABLE_HOOKS)
140 AC_DEFINE(FIRM_ENABLE_HOOKS)
143 dnl enable Firm statistics
145 AC_ARG_ENABLE(statistics,
146 [ --enable-statistics enable Firm statistics],
147 [if test "$enableval"=yes; then
148 AC_DEFINE(FIRM_STATISTICS)
150 AC_SUBST(enable_statistics)
152 dnl disable external effects in XML
153 dnl -------------------------------
154 AC_MSG_CHECKING([for using external effects in xml2])
155 AC_ARG_ENABLE(external-effects,
156 [ --disable-external-effects disable descriptions of external effects in XML],
157 [if test "$enableval"="no"; then
158 enable_external_effects=no
160 [enable_external_effects=yes])
161 AC_SUBST(enable_external_effects)
162 if test "$enable_external_effects" == no; then
163 AC_MSG_RESULT([disabled])
165 AC_MSG_RESULT([enabled])
167 dnl check for header and library below
169 dnl Checks for programs.
170 dnl ====================
172 dnl check for a C compiler
173 dnl ----------------------
176 dnl check for prelinkable linker
177 dnl ----------------------------
179 if test "$libfirm_cv_prog_ld_r" != "yes"; then
180 AC_MSG_ERROR(need a prelinkcapable linker)
185 AC_CHECK_PROG(AR, ar, "ar", "")
186 if test "$AR" != "ar"; then
187 AC_MSG_ERROR(need ar for creating archives)
192 AC_CHECK_PROG(TAR, tar, "tar", "")
193 if test "$TAR" != "tar"; then
194 AC_MSG_ERROR(need tar for creating archives in distribution)
197 dnl check whether ar can handle option -s
198 dnl if not then ranlib is needed
199 dnl for simpliticity we use ranlib every time
205 touch tmp-install.a tmp-install.b
206 if eval "$INSTALL tmp-install.a tmp-install.b" ; then
209 rm tmp-install.a tmp-install.b
214 dnl check for doxygen if enabled
215 dnl ----------------------------
216 if test "$enable_auto_documentation" = yes; then
217 AC_CHECK_PROG(DOXYGEN, doxygen, "doxygen", "")
218 if test "$DOXYGEN" != "doxygen"; then
219 AC_MSG_ERROR(need doxygen for auto documentation)
221 AC_CHECK_PROG(DOT, dot, "dot", "")
222 if test "$DOT" != "dot"; then
223 AC_MSG_ERROR(need dot for doxygen documentation (for class graphs) (IPD: module add Graphviz))
227 dnl check for availability of a jdk
228 dnl -------------------------------
229 if test "$enable_firm_jni" = yes; then
230 AC_CHECK_PROG(JAVAC, javac, "javac", "")
231 if test "$JAVAC" != "javac"; then
232 AC_MSG_ERROR(need java compiler javac to generate jni (IPD: module add jdk-1.3.1-sun))
234 AC_CHECK_PROG(JAVAH, javah, "javah", "")
235 if test "$JAVAH" != "javah"; then
236 AC_MSG_ERROR(need javah to generate jni headers (IPD: module add jdk-1.3.1-sun))
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 gnu multiprecission (gmp) header file
257 #AC_CHECK_HEADERS(gmp.h, ac_gmp_headers="yes", ac_gmp_headers="no")
258 #if test "$ac_gmp_headers" != yes; then
259 # dnl gmp header not found.
260 # AC_MSG_ERROR("GNU multiprecission gmp 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 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 #dnl check for the gnu multiprecission (gmp) library
309 #AC_CHECK_LIB(gmp, main, ac_gmp_library="yes", ac_gmp_library="no")
310 #if test "$ac_gmp_library" != yes; then
311 # dnl gmp library not found.
312 # AC_MSG_ERROR("GNU multiprecission gmp library not found")
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 dnl Checks for typedefs, structures, and compiler characteristics.
333 dnl ==============================================================
340 dnl Checks for library functions.
341 dnl =============================
343 dnl check for strerror
345 AC_CHECK_FUNC(strerror,,
346 AC_MSG_ERROR("need strerror function")
354 AC_OUTPUT($ac_output_file,[ touch stamp-h ])
356 dnl snip the lower prt of config.h and put it to ir/config/firm_config.h
357 gawk -f $CONF_DIR_NAME/filter.awk < config.h | sed -f $CONF_DIR_NAME/filter.sed > ir/config/firm_config.h