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 testprograms/Makefile firmjni/Makefile firmjni/testprograms/Makefile \
27 dnl generate the config header file
28 AC_CONFIG_HEADER(config.h)
30 dnl keep track of the environment set by the user
31 libfirm_conf_env="${CC+CC='$CC'} ${CFLAGS+CFLAGS='$CFLAGS'} ${CPP+CPP='$CPP'} ${CPPFLAGS+CPPFLAGS='$CPPFLAGS'} ${LDFLAGS+LDFLAGS='$LDFLAGS'} ${LIBS+LIBS='$LIBS'}"
32 AC_SUBST(libfirm_conf_env)
34 dnl check for additional include dirs
35 AC_ARG_WITH(includedir, [ --with-includedir=add colon seperated list of directories to include search path],
36 CPPFLAGS=$CPPFLAGS" -I"`echo $withval|sed 's;\:; -I;g'`, T_FLAG="")
38 AC_ARG_WITH(libdir, [ --with-libdir=add colon seperated list of directories to linker search path],
39 LDFLAGS=$LDFLAGS" -L"`echo $withval|sed 's;\:; -L;g'`, T_FLAG="")
47 [ --enable-debug enable assertions and additional debugging routines],
48 [if test "$enableval" = yes; then
49 AC_DEFINE(DEBUG_libfirm)
53 AC_SUBST(enable_debug_libfirm)
57 AC_ARG_ENABLE(inlining,
58 [ --disable-inlining disable inline C-extension],
59 [if test "$enableval" = yes; then
60 AC_DEFINE(USE_INLINING)
62 AC_DEFINE(USE_INLINING)
67 AC_ARG_ENABLE(profile,
68 [ --enable-profile enable profiling],
69 [if test "$enableval"=yes; then
70 enable_profile_libfirm=yes
72 [enable_profile_libfirm=no])
73 AC_SUBST(enable_profile_libfirm)
75 dnl set auto documentation
76 dnl ----------------------
77 AC_ARG_ENABLE(autodoc,
78 [ --enable-autodoc enable auto documentation],
79 [if test "$enableval"=yes; then
80 enable_auto_documentation=yes
82 [enable_auto_documentation=no])
83 AC_SUBST(enable_auto_documentation)
88 AC_ARG_ENABLE(firmjni,
89 [ --enable-firmjni check for tools necesarry to construct a java native interface for Firm],
90 [if test "$enableval"=yes; then
94 AC_SUBST(enable_firm_jni)
96 dnl set heap analyses support
97 dnl -------------------------
98 AC_ARG_ENABLE(heapanalysis, [ --enable-heapanalysis Compile with heap analysis.],
99 [enable_heapanalysis=$enableval], [enable_heapanalysis="no"])
100 if test "$enable_heapanalysis" = "no"; then
101 AC_MSG_RESULT([heapanalysis disabled])
103 AC_DEFINE(DO_HEAPANALYSIS)
104 AC_MSG_RESULT([heapanalysis enabled])
106 AC_SUBST(enable_heapanalysis)
108 dnl disable linking of libiberty parts (xmalloc, xprintf, obstack, ...)
109 dnl ----------------------
110 AC_ARG_ENABLE(libiberty,
111 [ --disable-libiberty disable own libiberty parts],
112 [if test "$enableval"=yes; then
113 disable_libiberty_=yes
115 [disable_libiberty=no])
116 AC_SUBST(disable_libiberty)
118 dnl enable Firm statistics
120 AC_ARG_ENABLE(statistics,
121 [ --enable-statistics enable Firm statistics],
122 [if test "$enableval"=yes; then
123 AC_DEFINE(FIRM_STATISTICS)
125 AC_SUBST(enable_statistics)
127 dnl Checks for programs.
128 dnl ====================
130 dnl check for a C compiler
131 dnl ----------------------
134 dnl check for prelinkable linker
135 dnl ----------------------------
137 if test "$libfirm_cv_prog_ld_r" != "yes"; then
138 AC_MSG_ERROR(need a prelinkcapable linker)
143 AC_CHECK_PROG(AR, ar, "ar", "")
144 if test "$AR" != "ar"; then
145 AC_MSG_ERROR(need ar for creating archives)
150 AC_CHECK_PROG(TAR, tar, "tar", "")
151 if test "$TAR" != "tar"; then
152 AC_MSG_ERROR(need tar for creating archives in distribution)
155 dnl check whether ar can handle option -s
156 dnl if not then ranlib is needed
157 dnl for simpliticity we use ranlib every time
163 touch tmp-install.a tmp-install.b
164 if eval "$INSTALL -C tmp-install.a tmp-install.b" ; then
165 INSTALL="$INSTALL -C"
167 rm tmp-install.a tmp-install.b
172 dnl check for doxygen if enabled
173 dnl ----------------------------
174 if test "$enable_auto_documentation" = yes; then
175 AC_CHECK_PROG(DOXYGEN, doxygen, "doxygen", "")
176 if test "$DOXYGEN" != "doxygen"; then
177 AC_MSG_ERROR(need doxygen for auto documentation)
179 AC_CHECK_PROG(DOT, dot, "dot", "")
180 if test "$DOT" != "dot"; then
181 AC_MSG_ERROR(need dot for doxygen documentation (for class graphs) (IPD: module add Graphviz))
185 dnl check for availability of a jdk
186 dnl -------------------------------
187 if test "$enable_firm_jni" = yes; then
188 AC_CHECK_PROG(JAVAC, javac, "javac", "")
189 if test "$JAVAC" != "javac"; then
190 AC_MSG_ERROR(need java compiler javac to generate jni (IPD: module add jdk-1.3.1-sun))
192 AC_CHECK_PROG(JAVAH, javah, "javah", "")
193 if test "$JAVAH" != "javah"; then
194 AC_MSG_ERROR(need javah to generate jni headers (IPD: module add jdk-1.3.1-sun))
199 dnl Checks for header files.
200 dnl ========================
204 dnl check for the math header file
206 AC_CHECK_HEADERS(math.h, ac_math_headers="yes", ac_math_headers="no")
207 if test "$ac_math_headers" != yes; then
208 dnl math header not found.
209 AC_MSG_ERROR("math header file not found")
213 #dnl check for the gnu multiprecission (gmp) header file
215 #AC_CHECK_HEADERS(gmp.h, ac_gmp_headers="yes", ac_gmp_headers="no")
216 #if test "$ac_gmp_headers" != yes; then
217 # dnl gmp header not found.
218 # AC_MSG_ERROR("GNU multiprecission gmp header file not found")
222 dnl check for the obstack header file
223 dnl does not work with:
228 AC_CHECK_HEADERS(obstack.h, ac_obstack_headers="yes", ac_obstack_headers="no")
229 if test "$ac_obstack_headers" != yes; then
230 dnl obstack header not found.
231 AC_MSG_ERROR("obstack.h not found")
235 AC_CHECK_HEADERS(alloca.h, ac_alloca_headers="yes", ac_alloca_headers="no")
236 if test "$ac_alloca_headers" = "yes"; then
237 AC_DEFINE(HAVE_ALLOCA_H)
239 if test "$ac_cv_header_stdc" = "no"; then
240 AC_MSG_ERROR("alloca.h and stdlib.h not found")
245 dnl check for jni header files
247 if test "$enable_firm_jni" = yes; then
248 AC_CHECK_HEADERS(jni.h, ac_jni_headers="yes", ac_jni_headers="no")
249 if test "$ac_jni_headers" != yes; then
250 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))
255 dnl Checks for libraries.
256 dnl =====================
258 #dnl check for the gnu multiprecission (gmp) library
260 #AC_CHECK_LIB(gmp, main, ac_gmp_library="yes", ac_gmp_library="no")
261 #if test "$ac_gmp_library" != yes; then
262 # dnl gmp library not found.
263 # AC_MSG_ERROR("GNU multiprecission gmp library not found")
267 AC_CHECK_LIB(m, main, ac_m_library="yes", ac_m_library="no")
268 if test "$ac_m_library" != yes; then
269 dnl std math library not found.
270 AC_MSG_ERROR("standard math library not found")
274 dnl Checks for typedefs, structures, and compiler characteristics.
275 dnl ==============================================================
282 dnl Checks for library functions.
283 dnl =============================
285 dnl check for strerror
287 AC_CHECK_FUNC(strerror,,
288 AC_MSG_ERROR("need strerror function")
296 AC_OUTPUT($ac_output_file,[ touch stamp-h ])