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