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