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