3 dnl File name: configure.in
5 dnl Author: Till Riedel (??)
9 dnl Copyright: (c) 2002-2003 Universität Karlsruhe
10 dnl Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
18 AC_INIT(libfirm,0.3.0)
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 testprograms/Makefile \
24 firmjni/Makefile firmjni/testprograms/Makefile libfirm.doxygen"
26 dnl generate the config header file
27 AC_CONFIG_HEADER(config.h)
29 dnl keep track of the environment set by the user
30 libfirm_conf_env="${CC+CC='$CC'} ${CFLAGS+CFLAGS='$CFLAGS'} ${CPP+CPP='$CPP'} ${CPPFLAGS+CPPFLAGS='$CPPFLAGS'} ${LDFLAGS+LDFLAGS='$LDFLAGS'} ${LIBS+LIBS='$LIBS'}"
31 AC_SUBST(libfirm_conf_env)
33 dnl check for additional include dirs
34 AC_ARG_WITH(includedir, [ --with-includedir=add colon seperated list of directories to include search path],
35 CPPFLAGS=$CPPFLAGS" -I"`echo $withval|sed 's;\:; -I;g'`, T_FLAG="")
37 AC_ARG_WITH(libdir, [ --with-libdir=add colon seperated list of directories to linker search path],
38 LDFLAGS=$LDFLAGS" -L"`echo $withval|sed 's;\:; -L;g'`, T_FLAG="")
47 [ --enable-debug enable assertions and additional debugging routines],
48 [if test "$enableval" = yes; then
49 AC_DEFINE(DEBUG_libfirm)
53 AC_SUBST(enable_debug_libfirm)
55 AC_ARG_ENABLE(gcc_inline,
56 [ --enable-gcc_inline enable gcc inline C-extension],
57 [if test "$enableval" = yes; then
58 AC_DEFINE(USE_GCC_INLINE)
60 AC_SUBST(enable_gcc_inline)
65 AC_ARG_ENABLE(profile,
66 [ --enable-profile enable profiling],
67 [if test "$enableval"=yes; then
68 enable_profile_libfirm=yes
70 [enable_profile_libfirm=no])
71 AC_SUBST(enable_profile_libfirm)
73 dnl set auto documentation
74 dnl ----------------------
75 AC_ARG_ENABLE(autodoc,
76 [ --enable-autodoc enable auto documentation],
77 [if test "$enableval"=yes; then
78 enable_auto_documentation=yes
80 [enable_auto_documentation=no])
81 AC_SUBST(enable_auto_documentation)
86 AC_ARG_ENABLE(firmjni,
87 [ --enable-firmjni check for tools necesarry to construct a java native interface for Firm],
88 [if test "$enableval"=yes; then
92 AC_SUBST(enable_firm_jni)
94 dnl disable linking of libiberty parts (xmalloc, xprintf, obstack, ...)
95 dnl ----------------------
96 AC_ARG_ENABLE(libiberty,
97 [ --disable-libiberty disable own libiberty parts],
98 [if test "$enableval"=yes; then
99 disable_libiberty_=yes
101 [disable_libiberty=no])
102 AC_SUBST(disable_libiberty)
105 dnl Checks for programs.
106 dnl ====================
108 dnl check for a C compiler
109 dnl ----------------------
112 dnl check for prelinkable linker
113 dnl ----------------------------
115 if test "$libfirm_cv_prog_ld_r" != "yes"; then
116 AC_MSG_ERROR(need a prelinkcapable linker)
121 AC_CHECK_PROG(AR, ar, "ar", "")
122 if test "$AR" != "ar"; then
123 AC_MSG_ERROR(need ar for creating archives)
128 AC_CHECK_PROG(TAR, tar, "tar", "")
129 if test "$TAR" != "tar"; then
130 AC_MSG_ERROR(need tar for creating archives in distribution)
133 dnl check whether ar can handle option -s
134 dnl if not then ranlib is needed
135 dnl for simpliticity we use ranlib every time
141 touch tmp-install.a tmp-install.b
142 if eval "$INSTALL -C tmp-install.a tmp-install.b" ; then
143 INSTALL="$INSTALL -C"
145 rm tmp-install.a tmp-install.b
150 dnl check for doxygen if enabled
151 dnl ----------------------------
152 if test "$enable_auto_documentation" = yes; then
153 AC_CHECK_PROG(DOXYGEN, doxygen, "doxygen", "")
154 if test "$DOXYGEN" != "doxygen"; then
155 AC_MSG_ERROR(need doxygen for auto documentation)
157 AC_CHECK_PROG(DOT, dot, "dot", "")
158 if test "$DOT" != "dot"; then
159 AC_MSG_ERROR(need dot for doxygen documentation (for class graphs) (IPD: module add Graphviz))
163 dnl check for availability of a jdk
164 dnl -------------------------------
165 if test "$enable_firm_jni" = yes; then
166 AC_CHECK_PROG(JAVAC, javac, "javac", "")
167 if test "$JAVAC" != "javac"; then
168 AC_MSG_ERROR(need java compiler javac to generate jni (IPD: module add jdk-1.3.1-sun))
170 AC_CHECK_PROG(JAVAH, javah, "javah", "")
171 if test "$JAVAH" != "javah"; then
172 AC_MSG_ERROR(need javah to generate jni headers (IPD: module add jdk-1.3.1-sun))
177 dnl Checks for header files.
178 dnl ========================
182 dnl check for the math header file
184 AC_CHECK_HEADERS(math.h, ac_math_headers="yes", ac_math_headers="no")
185 if test "$ac_math_headers" != yes; then
186 dnl math header not found.
187 AC_MSG_ERROR("math header file not found")
191 #dnl check for the gnu multiprecission (gmp) header file
193 #AC_CHECK_HEADERS(gmp.h, ac_gmp_headers="yes", ac_gmp_headers="no")
194 #if test "$ac_gmp_headers" != yes; then
195 # dnl gmp header not found.
196 # AC_MSG_ERROR("GNU multiprecission gmp header file not found")
200 dnl check for the obstack header file
201 dnl does not work with:
206 AC_CHECK_HEADERS(obstack.h, ac_obstack_headers="yes", ac_obstack_headers="no")
207 if test "$ac_obstack_headers" != yes; then
208 dnl obstack header not found.
209 AC_MSG_ERROR("obstack.h not found")
213 AC_CHECK_HEADERS(alloca.h, ac_alloca_headers="yes", ac_alloca_headers="no")
214 if test "$ac_alloca_headers" != yes; then
215 if test "$ac_cv_header_stdc" == no; then
216 AC_MSG_ERROR("alloca.h and stdlib.h not found")
218 AC_DEFINE(HAVE_ALLOCA_H)
223 dnl check for jni header files
225 if test "$enable_firm_jni" = yes; then
226 AC_CHECK_HEADERS(jni.h, ac_jni_headers="yes", ac_jni_headers="no")
227 if test "$ac_jni_headers" != yes; then
228 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))
233 dnl Checks for libraries.
234 dnl =====================
236 #dnl check for the gnu multiprecission (gmp) library
238 #AC_CHECK_LIB(gmp, main, ac_gmp_library="yes", ac_gmp_library="no")
239 #if test "$ac_gmp_library" != yes; then
240 # dnl gmp library not found.
241 # AC_MSG_ERROR("GNU multiprecission gmp library not found")
245 AC_CHECK_LIB(m, main, ac_m_library="yes", ac_m_library="no")
246 if test "$ac_m_library" != yes; then
247 dnl std math library not found.
248 AC_MSG_ERROR("standard math library not found")
252 dnl Checks for typedefs, structures, and compiler characteristics.
253 dnl ==============================================================
257 dnl Checks for library functions.
258 dnl =============================
260 dnl check for strerror
262 AC_CHECK_FUNC(strerror,,
263 AC_MSG_ERROR("need strerror function")
271 AC_OUTPUT($ac_output_file,[ touch stamp-h ])