added configure support for heap analyses
[libfirm] / configure.in
1 dnl
2 dnl Project:     libFIRM
3 dnl File name:   configure.in
4 dnl Purpose:
5 dnl Author:      Till Riedel (??)
6 dnl Modified by:
7 dnl Created:
8 dnl CVS-ID:      $Id$
9 dnl Copyright:   (c) 2002-2003 Universität Karlsruhe
10 dnl Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
11 dnl
12
13
14 AC_REVISION($Id$)
15
16
17
18 AC_INIT(libfirm,0.3.0)
19 AC_PREREQ(2.50)
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 \
25                 libfirm.doxygen"
26
27 dnl generate the config header file
28 AC_CONFIG_HEADER(config.h)
29
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)
33
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="")
37
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="")
40
41 dnl Package options
42 dnl ===============
43
44 dnl set debugging
45 dnl -------------
46 AC_ARG_ENABLE(debug,
47 [  --enable-debug          enable assertions and additional debugging routines],
48 [if test "$enableval" = yes; then
49   AC_DEFINE(DEBUG_libfirm)
50 else
51   AC_DEFINE(NDEBUG)
52 fi])
53 AC_SUBST(enable_debug_libfirm)
54
55 dnl disable inlining
56 dnl ----------------
57 AC_ARG_ENABLE(inlining,
58 [  --disable-inlining      disable inline C-extension],
59 [if test "$enableval" = yes; then
60   AC_DEFINE(USE_INLINING)
61 fi],
62 AC_DEFINE(USE_INLINING)
63 )
64
65 dnl set profiling
66 dnl -------------
67 AC_ARG_ENABLE(profile,
68 [  --enable-profile        enable profiling],
69 [if test "$enableval"=yes; then
70   enable_profile_libfirm=yes
71 fi],
72 [enable_profile_libfirm=no])
73 AC_SUBST(enable_profile_libfirm)
74
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
81 fi],
82 [enable_auto_documentation=no])
83 AC_SUBST(enable_auto_documentation)
84
85
86 dnl set firm jni
87 dnl ------------
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
91   enable_firm_jni=yes
92 fi],
93 [enable_firm_jni=no])
94 AC_SUBST(enable_firm_jni)
95
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_DEFINE(DO_HEAPANALYSIS, 0, [Don't compile with heap analysis])
102   AC_MSG_RESULT([heapanalysis disabled])
103 else
104   AC_DEFINE(DO_HEAPANALYSIS, 1, [Compile with heap analysis])
105   AC_MSG_RESULT([heapanalysis enabled])
106 fi
107 AC_SUBST(enable_heapanalysis)
108
109 dnl to be used!! AM_CONDITIONAL(FIRM_HEAPANALYSIS, test "$enable_heapanalysis" != "no")
110
111 dnl disable linking of libiberty parts (xmalloc, xprintf, obstack, ...)
112 dnl ----------------------
113 AC_ARG_ENABLE(libiberty,
114 [  --disable-libiberty     disable own libiberty parts],
115 [if test "$enableval"=yes; then
116   disable_libiberty_=yes
117 fi],
118 [disable_libiberty=no])
119 AC_SUBST(disable_libiberty)
120
121 dnl enable Firm statistics
122 dnl -------------
123 AC_ARG_ENABLE(statistics,
124 [  --enable-statistics     enable Firm statistics],
125 [if test "$enableval"=yes; then
126   AC_DEFINE(FIRM_STATISTICS)
127 fi])
128 AC_SUBST(enable_statistics)
129
130 dnl Checks for programs.
131 dnl ====================
132
133 dnl check for a C compiler
134 dnl ----------------------
135 AC_PROG_CC
136
137 dnl check for prelinkable linker
138 dnl ----------------------------
139 LIBFIRM_PROG_LD_R
140 if test "$libfirm_cv_prog_ld_r" != "yes"; then
141   AC_MSG_ERROR(need a prelinkcapable linker)
142 fi
143
144 dnl check for ar
145 dnl ------------
146 AC_CHECK_PROG(AR, ar, "ar", "")
147 if test "$AR" != "ar"; then
148   AC_MSG_ERROR(need ar for creating archives)
149 fi
150
151 dnl check for tar
152 dnl -------------
153 AC_CHECK_PROG(TAR, tar, "tar", "")
154 if test "$TAR" != "tar"; then
155   AC_MSG_ERROR(need tar for creating archives in distribution)
156 fi
157
158 dnl check whether ar can handle option -s
159 dnl if not then ranlib is needed
160 dnl for simpliticity we use ranlib every time
161
162 AC_PROG_RANLIB
163
164 AC_PROG_INSTALL
165
166 touch tmp-install.a tmp-install.b
167 if eval "$INSTALL -C tmp-install.a tmp-install.b" ; then
168     INSTALL="$INSTALL -C"
169 fi
170 rm tmp-install.a tmp-install.b
171
172
173 AC_PROG_LN_S
174
175 dnl check for doxygen if enabled
176 dnl ----------------------------
177 if test "$enable_auto_documentation" = yes; then
178   AC_CHECK_PROG(DOXYGEN, doxygen, "doxygen", "")
179   if test "$DOXYGEN" != "doxygen"; then
180     AC_MSG_ERROR(need doxygen for auto documentation)
181   fi
182   AC_CHECK_PROG(DOT, dot, "dot", "")
183   if test "$DOT" != "dot"; then
184     AC_MSG_ERROR(need dot for doxygen documentation (for class graphs) (IPD: module add Graphviz))
185   fi
186 fi
187
188 dnl check for availability of a jdk
189 dnl -------------------------------
190 if test "$enable_firm_jni" = yes; then
191   AC_CHECK_PROG(JAVAC, javac, "javac", "")
192   if test "$JAVAC" != "javac"; then
193     AC_MSG_ERROR(need java compiler javac to generate jni (IPD: module add jdk-1.3.1-sun))
194   fi
195   AC_CHECK_PROG(JAVAH, javah, "javah", "")
196   if test "$JAVAH" != "javah"; then
197     AC_MSG_ERROR(need javah to generate jni headers (IPD: module add jdk-1.3.1-sun))
198   fi
199 fi
200
201
202 dnl Checks for header files.
203 dnl ========================
204
205 AC_HEADER_STDC
206
207 dnl check for the math header file
208
209 AC_CHECK_HEADERS(math.h, ac_math_headers="yes", ac_math_headers="no")
210 if test "$ac_math_headers" != yes; then
211   dnl math header not found.
212   AC_MSG_ERROR("math header file not found")
213 fi
214
215
216 #dnl check for the gnu multiprecission (gmp) header file
217
218 #AC_CHECK_HEADERS(gmp.h, ac_gmp_headers="yes", ac_gmp_headers="no")
219 #if test "$ac_gmp_headers" != yes; then
220 #  dnl gmp header not found.
221 #  AC_MSG_ERROR("GNU multiprecission gmp header file not found")
222 #fi
223
224
225 dnl check for the obstack header file
226 dnl does not work with:
227 dnl  - cygwin
228 dnl  - MacOSX
229 #AC_FUNC_OBSTACK
230
231 AC_CHECK_HEADERS(obstack.h, ac_obstack_headers="yes", ac_obstack_headers="no")
232 if test "$ac_obstack_headers" != yes; then
233   dnl obstack header not found.
234   AC_MSG_ERROR("obstack.h not found")
235 fi
236
237
238 AC_CHECK_HEADERS(alloca.h, ac_alloca_headers="yes", ac_alloca_headers="no")
239 if test "$ac_alloca_headers" = "yes"; then
240     AC_DEFINE(HAVE_ALLOCA_H)
241 else
242   if test "$ac_cv_header_stdc" = "no"; then
243     AC_MSG_ERROR("alloca.h and stdlib.h not found")
244   fi
245 fi
246
247
248 dnl check for jni header files
249
250 if test "$enable_firm_jni" = yes; then
251   AC_CHECK_HEADERS(jni.h, ac_jni_headers="yes", ac_jni_headers="no")
252   if test "$ac_jni_headers" != yes; then
253     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))
254   fi
255 fi
256
257
258 dnl Checks for libraries.
259 dnl =====================
260
261 #dnl check for the gnu multiprecission (gmp) library
262
263 #AC_CHECK_LIB(gmp, main, ac_gmp_library="yes", ac_gmp_library="no")
264 #if test "$ac_gmp_library" != yes; then
265 #  dnl gmp library not found.
266 #  AC_MSG_ERROR("GNU multiprecission gmp library not found")
267 #fi
268
269
270 AC_CHECK_LIB(m, main, ac_m_library="yes", ac_m_library="no")
271 if test "$ac_m_library" != yes; then
272   dnl std math library not found.
273   AC_MSG_ERROR("standard math library not found")
274 fi
275
276
277 dnl Checks for typedefs, structures, and compiler characteristics.
278 dnl ==============================================================
279 AC_C_CONST
280 AC_C_VOLATILE
281 AC_C_INLINE
282 AC_C_BIGENDIAN(,,,)
283 AC_C_LONG_DOUBLE
284
285 dnl Checks for library functions.
286 dnl =============================
287
288 dnl check for strerror
289
290 AC_CHECK_FUNC(strerror,,
291   AC_MSG_ERROR("need strerror function")
292 )
293
294
295 dnl Error messaging
296 dnl ===============
297
298
299 AC_OUTPUT($ac_output_file,[ touch stamp-h ])