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/st/Makefile ir/stat/Makefile \
24 ir/opt/Makefile ir/external/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 check for additional include dirs
36 AC_ARG_WITH(includedir, [ --with-includedir=add colon seperated list of directories to include search path],
37 CPPFLAGS=$CPPFLAGS" -I"`echo $withval|sed 's;\:; -I;g'`, T_FLAG="")
39 dnl check for additional library dirs
40 AC_ARG_WITH(libdir, [ --with-libdir=add colon seperated list of directories to linker search path],
41 LDFLAGS=$LDFLAGS" -L"`echo $withval|sed 's;\:; -L;g'`, T_FLAG="")
49 [ --enable-debug enable assertions and additional debugging routines],
50 [if test "$enableval" = yes; then
51 AC_DEFINE(DEBUG_libfirm)
55 AC_SUBST(enable_debug_libfirm)
59 AC_ARG_ENABLE(inlining,
60 [ --disable-inlining disable inline C-extension],
61 [if test "$enableval" = yes; then
62 AC_DEFINE(USE_INLINING)
64 AC_DEFINE(USE_INLINING)
69 AC_ARG_ENABLE(profile,
70 [ --enable-profile enable profiling],
71 [if test "$enableval"=yes; then
72 enable_profile_libfirm=yes
74 [enable_profile_libfirm=no])
75 AC_SUBST(enable_profile_libfirm)
77 dnl set auto documentation
78 dnl ----------------------
79 AC_ARG_ENABLE(autodoc,
80 [ --enable-autodoc enable auto documentation],
81 [if test "$enableval"=yes; then
82 enable_auto_documentation=yes
84 [enable_auto_documentation=no])
85 AC_SUBST(enable_auto_documentation)
90 AC_ARG_ENABLE(firmjni,
91 [ --enable-firmjni check for tools necesarry to construct a java native interface for Firm],
92 [if test "$enableval"=yes; then
96 AC_SUBST(enable_firm_jni)
98 dnl set heap analyses support
99 dnl -------------------------
100 AC_ARG_ENABLE(heapanalysis, [ --enable-heapanalysis Compile with heap analysis.],
101 [enable_heapanalysis=$enableval], [enable_heapanalysis="no"])
102 if test "$enable_heapanalysis" = "no"; then
103 AC_MSG_RESULT([heapanalysis disabled])
105 AC_DEFINE(DO_HEAPANALYSIS)
106 AC_MSG_RESULT([heapanalysis enabled])
108 AC_SUBST(enable_heapanalysis)
110 dnl disable linking of libiberty parts (xmalloc, xprintf, obstack, ...)
111 dnl ----------------------
112 AC_ARG_ENABLE(libiberty,
113 [ --disable-libiberty disable own libiberty parts],
114 [if test "$enableval"=yes; then
115 disable_libiberty_=yes
117 [disable_libiberty=no])
118 AC_SUBST(disable_libiberty)
120 dnl enable Firm statistics
122 AC_ARG_ENABLE(statistics,
123 [ --enable-statistics enable Firm statistics],
124 [if test "$enableval"=yes; then
125 AC_DEFINE(FIRM_STATISTICS)
127 AC_SUBST(enable_statistics)
129 dnl Checks for programs.
130 dnl ====================
132 dnl check for a C compiler
133 dnl ----------------------
136 dnl check for prelinkable linker
137 dnl ----------------------------
139 if test "$libfirm_cv_prog_ld_r" != "yes"; then
140 AC_MSG_ERROR(need a prelinkcapable linker)
145 AC_CHECK_PROG(AR, ar, "ar", "")
146 if test "$AR" != "ar"; then
147 AC_MSG_ERROR(need ar for creating archives)
152 AC_CHECK_PROG(TAR, tar, "tar", "")
153 if test "$TAR" != "tar"; then
154 AC_MSG_ERROR(need tar for creating archives in distribution)
157 dnl check whether ar can handle option -s
158 dnl if not then ranlib is needed
159 dnl for simpliticity we use ranlib every time
165 touch tmp-install.a tmp-install.b
166 if eval "$INSTALL -C tmp-install.a tmp-install.b" ; then
167 INSTALL="$INSTALL -C"
169 rm tmp-install.a tmp-install.b
174 dnl check for doxygen if enabled
175 dnl ----------------------------
176 if test "$enable_auto_documentation" = yes; then
177 AC_CHECK_PROG(DOXYGEN, doxygen, "doxygen", "")
178 if test "$DOXYGEN" != "doxygen"; then
179 AC_MSG_ERROR(need doxygen for auto documentation)
181 AC_CHECK_PROG(DOT, dot, "dot", "")
182 if test "$DOT" != "dot"; then
183 AC_MSG_ERROR(need dot for doxygen documentation (for class graphs) (IPD: module add Graphviz))
187 dnl check for availability of a jdk
188 dnl -------------------------------
189 if test "$enable_firm_jni" = yes; then
190 AC_CHECK_PROG(JAVAC, javac, "javac", "")
191 if test "$JAVAC" != "javac"; then
192 AC_MSG_ERROR(need java compiler javac to generate jni (IPD: module add jdk-1.3.1-sun))
194 AC_CHECK_PROG(JAVAH, javah, "javah", "")
195 if test "$JAVAH" != "javah"; then
196 AC_MSG_ERROR(need javah to generate jni headers (IPD: module add jdk-1.3.1-sun))
201 dnl Checks for header files.
202 dnl ========================
206 dnl check for the math header file
208 AC_CHECK_HEADERS(math.h, ac_math_headers="yes", ac_math_headers="no")
209 if test "$ac_math_headers" != yes; then
210 dnl math header not found.
211 AC_MSG_ERROR("math header file not found")
215 #dnl check for the gnu multiprecission (gmp) header file
217 #AC_CHECK_HEADERS(gmp.h, ac_gmp_headers="yes", ac_gmp_headers="no")
218 #if test "$ac_gmp_headers" != yes; then
219 # dnl gmp header not found.
220 # AC_MSG_ERROR("GNU multiprecission gmp header file not found")
224 dnl check for the obstack header file
225 dnl does not work with:
230 AC_CHECK_HEADERS(obstack.h, ac_obstack_headers="yes", ac_obstack_headers="no")
231 if test "$ac_obstack_headers" != yes; then
232 dnl obstack header not found.
233 AC_MSG_ERROR("obstack.h not found")
237 AC_CHECK_HEADERS(alloca.h, ac_alloca_headers="yes", ac_alloca_headers="no")
238 if test "$ac_alloca_headers" = "yes"; then
239 AC_DEFINE(HAVE_ALLOCA_H)
241 if test "$ac_cv_header_stdc" = "no"; then
242 AC_MSG_ERROR("alloca.h and stdlib.h not found")
247 dnl check for jni header files
249 if test "$enable_firm_jni" = yes; then
250 AC_CHECK_HEADERS(jni.h, ac_jni_headers="yes", ac_jni_headers="no")
251 if test "$ac_jni_headers" != yes; then
252 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))
257 dnl Checks for libraries.
258 dnl =====================
260 #dnl check for the gnu multiprecission (gmp) library
262 #AC_CHECK_LIB(gmp, main, ac_gmp_library="yes", ac_gmp_library="no")
263 #if test "$ac_gmp_library" != yes; then
264 # dnl gmp library not found.
265 # AC_MSG_ERROR("GNU multiprecission gmp library not found")
269 AC_CHECK_LIB(m, main, ac_m_library="yes", ac_m_library="no")
270 if test "$ac_m_library" != yes; then
271 dnl std math library not found.
272 AC_MSG_ERROR("standard math library not found")
276 dnl Checks for typedefs, structures, and compiler characteristics.
277 dnl ==============================================================
284 dnl Checks for library functions.
285 dnl =============================
287 dnl check for strerror
289 AC_CHECK_FUNC(strerror,,
290 AC_MSG_ERROR("need strerror function")
298 AC_OUTPUT($ac_output_file,[ touch stamp-h ])