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 AC_ARG_WITH(libdir, [ --with-libdir=add colon seperated list of directories to linker search path],
40 LDFLAGS=$LDFLAGS" -L"`echo $withval|sed 's;\:; -L;g'`, T_FLAG="")
48 [ --enable-debug enable assertions and additional debugging routines],
49 [if test "$enableval" = yes; then
50 AC_DEFINE(DEBUG_libfirm)
54 AC_SUBST(enable_debug_libfirm)
58 AC_ARG_ENABLE(inlining,
59 [ --disable-inlining disable inline C-extension],
60 [if test "$enableval" = yes; then
61 AC_DEFINE(USE_INLINING)
63 AC_DEFINE(USE_INLINING)
68 AC_ARG_ENABLE(profile,
69 [ --enable-profile enable profiling],
70 [if test "$enableval"=yes; then
71 enable_profile_libfirm=yes
73 [enable_profile_libfirm=no])
74 AC_SUBST(enable_profile_libfirm)
76 dnl set auto documentation
77 dnl ----------------------
78 AC_ARG_ENABLE(autodoc,
79 [ --enable-autodoc enable auto documentation],
80 [if test "$enableval"=yes; then
81 enable_auto_documentation=yes
83 [enable_auto_documentation=no])
84 AC_SUBST(enable_auto_documentation)
89 AC_ARG_ENABLE(firmjni,
90 [ --enable-firmjni check for tools necesarry to construct a java native interface for Firm],
91 [if test "$enableval"=yes; then
95 AC_SUBST(enable_firm_jni)
97 dnl set heap analyses support
98 dnl -------------------------
99 AC_ARG_ENABLE(heapanalysis, [ --enable-heapanalysis Compile with heap analysis.],
100 [enable_heapanalysis=$enableval], [enable_heapanalysis="no"])
101 if test "$enable_heapanalysis" = "no"; then
102 AC_MSG_RESULT([heapanalysis disabled])
104 AC_DEFINE(DO_HEAPANALYSIS)
105 AC_MSG_RESULT([heapanalysis enabled])
107 AC_SUBST(enable_heapanalysis)
109 dnl disable linking of libiberty parts (xmalloc, xprintf, obstack, ...)
110 dnl ----------------------
111 AC_ARG_ENABLE(libiberty,
112 [ --disable-libiberty disable own libiberty parts],
113 [if test "$enableval"=yes; then
114 disable_libiberty_=yes
116 [disable_libiberty=no])
117 AC_SUBST(disable_libiberty)
119 dnl enable Firm statistics
121 AC_ARG_ENABLE(statistics,
122 [ --enable-statistics enable Firm statistics],
123 [if test "$enableval"=yes; then
124 AC_DEFINE(FIRM_STATISTICS)
126 AC_SUBST(enable_statistics)
128 dnl Checks for programs.
129 dnl ====================
131 dnl check for a C compiler
132 dnl ----------------------
135 dnl check for prelinkable linker
136 dnl ----------------------------
138 if test "$libfirm_cv_prog_ld_r" != "yes"; then
139 AC_MSG_ERROR(need a prelinkcapable linker)
144 AC_CHECK_PROG(AR, ar, "ar", "")
145 if test "$AR" != "ar"; then
146 AC_MSG_ERROR(need ar for creating archives)
151 AC_CHECK_PROG(TAR, tar, "tar", "")
152 if test "$TAR" != "tar"; then
153 AC_MSG_ERROR(need tar for creating archives in distribution)
156 dnl check whether ar can handle option -s
157 dnl if not then ranlib is needed
158 dnl for simpliticity we use ranlib every time
164 touch tmp-install.a tmp-install.b
165 if eval "$INSTALL -C tmp-install.a tmp-install.b" ; then
166 INSTALL="$INSTALL -C"
168 rm tmp-install.a tmp-install.b
173 dnl check for doxygen if enabled
174 dnl ----------------------------
175 if test "$enable_auto_documentation" = yes; then
176 AC_CHECK_PROG(DOXYGEN, doxygen, "doxygen", "")
177 if test "$DOXYGEN" != "doxygen"; then
178 AC_MSG_ERROR(need doxygen for auto documentation)
180 AC_CHECK_PROG(DOT, dot, "dot", "")
181 if test "$DOT" != "dot"; then
182 AC_MSG_ERROR(need dot for doxygen documentation (for class graphs) (IPD: module add Graphviz))
186 dnl check for availability of a jdk
187 dnl -------------------------------
188 if test "$enable_firm_jni" = yes; then
189 AC_CHECK_PROG(JAVAC, javac, "javac", "")
190 if test "$JAVAC" != "javac"; then
191 AC_MSG_ERROR(need java compiler javac to generate jni (IPD: module add jdk-1.3.1-sun))
193 AC_CHECK_PROG(JAVAH, javah, "javah", "")
194 if test "$JAVAH" != "javah"; then
195 AC_MSG_ERROR(need javah to generate jni headers (IPD: module add jdk-1.3.1-sun))
200 dnl Checks for header files.
201 dnl ========================
205 dnl check for the math header file
207 AC_CHECK_HEADERS(math.h, ac_math_headers="yes", ac_math_headers="no")
208 if test "$ac_math_headers" != yes; then
209 dnl math header not found.
210 AC_MSG_ERROR("math header file not found")
214 #dnl check for the gnu multiprecission (gmp) header file
216 #AC_CHECK_HEADERS(gmp.h, ac_gmp_headers="yes", ac_gmp_headers="no")
217 #if test "$ac_gmp_headers" != yes; then
218 # dnl gmp header not found.
219 # AC_MSG_ERROR("GNU multiprecission gmp header file not found")
223 dnl check for the obstack header file
224 dnl does not work with:
229 AC_CHECK_HEADERS(obstack.h, ac_obstack_headers="yes", ac_obstack_headers="no")
230 if test "$ac_obstack_headers" != yes; then
231 dnl obstack header not found.
232 AC_MSG_ERROR("obstack.h not found")
236 AC_CHECK_HEADERS(alloca.h, ac_alloca_headers="yes", ac_alloca_headers="no")
237 if test "$ac_alloca_headers" = "yes"; then
238 AC_DEFINE(HAVE_ALLOCA_H)
240 if test "$ac_cv_header_stdc" = "no"; then
241 AC_MSG_ERROR("alloca.h and stdlib.h not found")
246 dnl check for jni header files
248 if test "$enable_firm_jni" = yes; then
249 AC_CHECK_HEADERS(jni.h, ac_jni_headers="yes", ac_jni_headers="no")
250 if test "$ac_jni_headers" != yes; then
251 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))
256 dnl Checks for libraries.
257 dnl =====================
259 #dnl check for the gnu multiprecission (gmp) library
261 #AC_CHECK_LIB(gmp, main, ac_gmp_library="yes", ac_gmp_library="no")
262 #if test "$ac_gmp_library" != yes; then
263 # dnl gmp library not found.
264 # AC_MSG_ERROR("GNU multiprecission gmp library not found")
268 AC_CHECK_LIB(m, main, ac_m_library="yes", ac_m_library="no")
269 if test "$ac_m_library" != yes; then
270 dnl std math library not found.
271 AC_MSG_ERROR("standard math library not found")
275 dnl Checks for typedefs, structures, and compiler characteristics.
276 dnl ==============================================================
283 dnl Checks for library functions.
284 dnl =============================
286 dnl check for strerror
288 AC_CHECK_FUNC(strerror,,
289 AC_MSG_ERROR("need strerror function")
297 AC_OUTPUT($ac_output_file,[ touch stamp-h ])