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