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