Added support for libcore
[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/ana2/Makefile ir/stat/Makefile \
24                 ir/opt/Makefile ir/external/Makefile ir/config/Makefile \
25                 testprograms/Makefile firmjni/Makefile firmjni/testprograms/Makefile \
26                 ir/be/Makefile \
27                 libfirm.doxygen"
28
29 dnl generate the config header file
30 AC_CONFIG_HEADER(config.h)
31
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)
35
36 dnl where is the configure file
37 CONF_DIR_NAME=`dirname $0`
38
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'`)
42
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'`)
46
47 dnl check for libxml2 library installation dir
48 AC_ARG_WITH(libxml2, [  --with-libxml2=installation prefix of libxml2 (IPD: --with-libxml2=/usr/public/libxml2)],
49     LDFLAGS=$LDFLAGS" -L"$withval"/lib";
50         CPPFLAGS=$CPPFLAGS" -I"$withval"/include/libxml2")
51
52 dnl Package options
53 dnl ===============
54
55 dnl set debugging
56 dnl -------------
57 AC_ARG_ENABLE(debug,
58 [  --enable-debug          enable assertions and additional debugging routines],
59 [if test "$enableval" = yes; then
60   AC_DEFINE(DEBUG_libfirm)
61 else
62   AC_DEFINE(NDEBUG)
63 fi])
64 AC_SUBST(enable_debug_libfirm)
65
66 dnl disable inlining
67 dnl ----------------
68 AC_ARG_ENABLE(inlining,
69 [  --disable-inlining      disable inline C-extension],
70 [if test "$enableval" = yes; then
71   AC_DEFINE(USE_INLINING)
72 fi],
73 AC_DEFINE(USE_INLINING)
74 )
75
76 dnl set profiling
77 dnl -------------
78 AC_ARG_ENABLE(profile,
79 [  --enable-profile        enable profiling],
80 [if test "$enableval"=yes; then
81   enable_profile_libfirm=yes
82 fi],
83 [enable_profile_libfirm=no])
84 AC_SUBST(enable_profile_libfirm)
85
86 dnl set auto documentation
87 dnl ----------------------
88 AC_ARG_ENABLE(autodoc,
89 [  --enable-autodoc        enable auto documentation],
90 [if test "$enableval"=yes; then
91   enable_auto_documentation=yes
92 fi],
93 [enable_auto_documentation=no])
94 AC_SUBST(enable_auto_documentation)
95
96
97 dnl set firm jni
98 dnl ------------
99 AC_ARG_ENABLE(firmjni,
100 [  --enable-firmjni        check for tools necesarry to construct a java native interface for Firm],
101 [if test "$enableval"=yes; then
102   enable_firm_jni=yes
103 fi],
104 [enable_firm_jni=no])
105 AC_SUBST(enable_firm_jni)
106
107 dnl set heap analyses support
108 dnl -------------------------
109 AC_MSG_CHECKING([for heapanalysis])
110 AC_ARG_ENABLE(heapanalysis, [  --enable-heapanalysis   Compile with heap analysis.],
111         [enable_heapanalysis=$enableval], [enable_heapanalysis="no"])
112 if test "$enable_heapanalysis" = "no"; then
113   AC_MSG_RESULT([disabled])
114 else
115   AC_DEFINE(DO_HEAPANALYSIS)
116   AC_MSG_RESULT([enabled])
117 fi
118 AC_SUBST(enable_heapanalysis)
119
120 dnl set backend support
121 dnl -------------------------
122 AC_ARG_ENABLE(backend, [  --enable-backend        Compile with backend facility.],
123 [if test "$enableval" = "yes"; then
124   AC_DEFINE(FIRM_BACKEND)
125 fi], [enable_backend="yes"])
126 AC_SUBST(enable_backend)
127
128 dnl disable linking of libiberty parts (xmalloc, xprintf, obstack, ...)
129 dnl ----------------------
130 AC_ARG_ENABLE(libiberty,
131 [  --disable-libiberty     disable own libiberty parts],
132 [if test "$enableval"=yes; then
133   disable_libiberty_=yes
134 fi],
135 [disable_libiberty=no])
136 AC_SUBST(disable_libiberty)
137
138 dnl enable Firm hooks
139 dnl -------------
140 AC_ARG_ENABLE(hooks,
141 [  --disable-hooks         disable Firm hooks],
142 [if test "$enableval" = yes; then
143   AC_DEFINE(FIRM_ENABLE_HOOKS)
144 fi],
145 AC_DEFINE(FIRM_ENABLE_HOOKS)
146 )
147
148 dnl enable Firm statistics
149 dnl -------------
150 AC_ARG_ENABLE(statistics,
151 [  --enable-statistics     enable Firm statistics],
152 [if test "$enableval"=yes; then
153   AC_DEFINE(FIRM_STATISTICS)
154 fi])
155 AC_SUBST(enable_statistics)
156
157 dnl enable libcore debugging support
158 dnl --------------------------------
159 AC_ARG_ENABLE(libcore,
160 [  --enable-libcore        enable libcore debugging],
161 [if test "$enableval"=yes; then
162   AC_DEFINE(WITH_LIBCORE)
163 fi])
164 AC_SUBST(enable_libcore)
165
166 dnl disable external effects in XML
167 dnl -------------------------------
168 AC_MSG_CHECKING([for using external effects in xml2])
169 AC_ARG_ENABLE(external-effects,
170 [  --disable-external-effects  disable descriptions of external effects in XML],
171 [if test "$enableval"="no"; then
172   enable_external_effects=no
173 fi],
174 [enable_external_effects=yes])
175 AC_SUBST(enable_external_effects)
176 if test "$enable_external_effects" == no; then
177   AC_MSG_RESULT([disabled])
178 else
179   AC_MSG_RESULT([enabled])
180 fi
181 dnl check for header and library below
182
183 dnl Checks for programs.
184 dnl ====================
185
186 dnl check for a C compiler
187 dnl ----------------------
188 AC_PROG_CC
189
190 dnl check for prelinkable linker
191 dnl ----------------------------
192 LIBFIRM_PROG_LD_R
193 if test "$libfirm_cv_prog_ld_r" != "yes"; then
194   AC_MSG_ERROR(need a prelinkcapable linker)
195 fi
196
197 dnl check for ar
198 dnl ------------
199 AC_CHECK_PROG(AR, ar, "ar", "")
200 if test "$AR" != "ar"; then
201   AC_MSG_ERROR(need ar for creating archives)
202 fi
203
204 dnl check for tar
205 dnl -------------
206 AC_CHECK_PROG(TAR, tar, "tar", "")
207 if test "$TAR" != "tar"; then
208   AC_MSG_ERROR(need tar for creating archives in distribution)
209 fi
210
211 dnl check whether ar can handle option -s
212 dnl if not then ranlib is needed
213 dnl for simpliticity we use ranlib every time
214
215 AC_PROG_RANLIB
216
217 AC_PROG_INSTALL
218
219 touch tmp-install.a tmp-install.b
220 if eval "$INSTALL tmp-install.a tmp-install.b" ; then
221     INSTALL="$INSTALL"
222 fi
223 rm tmp-install.a tmp-install.b
224
225
226 AC_PROG_LN_S
227
228 dnl check for doxygen if enabled
229 dnl ----------------------------
230 if test "$enable_auto_documentation" = yes; then
231   AC_CHECK_PROG(DOXYGEN, doxygen, "doxygen", "")
232   if test "$DOXYGEN" != "doxygen"; then
233     AC_MSG_ERROR(need doxygen for auto documentation)
234   fi
235   AC_CHECK_PROG(DOT, dot, "dot", "")
236   if test "$DOT" != "dot"; then
237     AC_MSG_ERROR(need dot for doxygen documentation (for class graphs) (IPD: module add Graphviz))
238   fi
239 fi
240
241 dnl check for availability of a jdk
242 dnl -------------------------------
243 if test "$enable_firm_jni" = yes; then
244   AC_CHECK_PROG(JAVAC, javac, "javac", "")
245   if test "$JAVAC" != "javac"; then
246     AC_MSG_ERROR(need java compiler javac to generate jni (IPD: module add jdk-1.3.1-sun))
247   fi
248   AC_CHECK_PROG(JAVAH, javah, "javah", "")
249   if test "$JAVAH" != "javah"; then
250     AC_MSG_ERROR(need javah to generate jni headers (IPD: module add jdk-1.3.1-sun))
251   fi
252 fi
253
254
255 dnl Checks for header files.
256 dnl ========================
257
258 AC_HEADER_STDC
259
260 dnl check for the math header file
261
262 AC_CHECK_HEADERS(math.h, ac_math_headers="yes", ac_math_headers="no")
263 if test "$ac_math_headers" != yes; then
264   dnl math header not found.
265   AC_MSG_ERROR("math header file not found")
266 fi
267
268
269 #dnl check for the gnu multiprecission (gmp) header file
270
271 #AC_CHECK_HEADERS(gmp.h, ac_gmp_headers="yes", ac_gmp_headers="no")
272 #if test "$ac_gmp_headers" != yes; then
273 #  dnl gmp header not found.
274 #  AC_MSG_ERROR("GNU multiprecission gmp header file not found")
275 #fi
276
277
278 dnl check for the obstack header file
279 dnl does not work with:
280 dnl  - cygwin
281 dnl  - MacOSX
282 #AC_FUNC_OBSTACK
283
284 AC_CHECK_HEADERS(obstack.h, ac_obstack_headers="yes", ac_obstack_headers="no")
285 if test "$ac_obstack_headers" != yes; then
286   dnl obstack header not found.
287   AC_MSG_ERROR("obstack.h not found")
288 fi
289
290
291 AC_CHECK_HEADERS(alloca.h, ac_alloca_headers="yes", ac_alloca_headers="no")
292 if test "$ac_alloca_headers" = "yes"; then
293     AC_DEFINE(HAVE_ALLOCA_H)
294 else
295   if test "$ac_cv_header_stdc" = "no"; then
296     AC_MSG_ERROR("alloca.h and stdlib.h not found")
297   fi
298 fi
299
300
301 dnl check for jni header files
302
303 if test "$enable_firm_jni" = yes; then
304   AC_CHECK_HEADERS(jni.h, ac_jni_headers="yes", ac_jni_headers="no")
305   if test "$ac_jni_headers" != yes; then
306     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))
307   fi
308 fi
309
310
311 if test "$enable_external_effects" == "yes"; then
312   AC_CHECK_HEADERS(libxml/parser.h, ac_xml_headers="yes", ac_xml_headers="no")
313   if test "$ac_xml_headers" != yes; then
314     AC_MSG_ERROR(xml header files not found. (IPD: add --with-includedir=/usr/public/libxml2/include/libxml2/ to configure flags))
315   fi
316 fi
317
318 dnl Checks for libraries.
319 dnl =====================
320
321 #dnl check for the gnu multiprecission (gmp) library
322
323 #AC_CHECK_LIB(gmp, main, ac_gmp_library="yes", ac_gmp_library="no")
324 #if test "$ac_gmp_library" != yes; then
325 #  dnl gmp library not found.
326 #  AC_MSG_ERROR("GNU multiprecission gmp library not found")
327 #fi
328
329
330 AC_CHECK_LIB(m, main, ac_m_library="yes", ac_m_library="no")
331 if test "$ac_m_library" != yes; then
332   dnl std math library not found.
333   AC_MSG_ERROR("standard math library not found")
334 fi
335
336
337 if test "$enable_external_effects" == "yes"; then
338   AC_CHECK_LIB(xml2, xmlParseFile, ac_xml_library="yes", ac_xml_library="no")
339   if test "$ac_m_library" != yes; then
340     AC_MSG_ERROR("xml2 library not found (IPD: add --with-libdir=/usr/public/libxml2/lib/ to configure flags)")
341   else
342     LIBS=$LIBS" -lxml2"
343   fi
344 fi
345
346 dnl Checks for typedefs, structures, and compiler characteristics.
347 dnl ==============================================================
348 AC_C_CONST
349 AC_C_VOLATILE
350 AC_C_INLINE
351 AC_C_BIGENDIAN(,,,)
352 AC_C_LONG_DOUBLE
353
354 dnl Checks for library functions.
355 dnl =============================
356
357 dnl check for strerror
358
359 AC_CHECK_FUNC(strerror,,
360   AC_MSG_ERROR("need strerror function")
361 )
362
363
364 dnl Error messaging
365 dnl ===============
366
367
368 AC_OUTPUT($ac_output_file,[ touch stamp-h ])
369
370 dnl snip the lower prt of config.h and put it to ir/config/firm_config.h
371 gawk -f $CONF_DIR_NAME/filter.awk < config.h | sed -f $CONF_DIR_NAME/filter.sed > ir/config/firm_config.h