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