1 dnl Process this file withautoconf to produce a configure script.
2 dnl Copyright (c) 2001 IPD, Universität Karlsruhe (TH)
11 AC_INIT(libfirm,0.3.0)
13 dnl if other files should be generated just add them to ac_output_files
14 ac_output_file="Makefile MakeRules ir/Makefile ir/adt/Makefile ir/debug/Makefile \
15 ir/tv/Makefile ir/common/Makefile ir/ident/Makefile ir/ir/Makefile \
16 ir/ana/Makefile ir/tr/Makefile ir/st/Makefile testprograms/Makefile \
17 firmjni/Makefile firmjni/build_firm_jni firmjni/testprograms/Makefile"
19 dnl generate the config header file
20 AC_CONFIG_HEADER(config.h)
22 dnl keep track of the environment set by the user
23 libfirm_conf_env="${CC+CC='$CC'} ${CFLAGS+CFLAGS='$CFLAGS'} ${CPP+CPP='$CPP'} ${CPPFLAGS+CPPFLAGS='$CPPFLAGS'} ${LDFLAGS+LDFLAGS='$LDFLAGS'} ${LIBS+LIBS='$LIBS'}"
24 AC_SUBST(libfirm_conf_env)
26 dnl check for additional include dirs
27 AC_ARG_WITH(includedir, [ --with-includedir=add colon seperated list of directories to include search path],
28 CPPFLAGS=$CPPFLAGS" -I"`echo $withval|sed 's;\:; -I;g'`, T_FLAG="")
36 [ --enable-debug enable assertions and additional debugging routines],
37 [if test "$enableval" = yes; then
38 AC_DEFINE(DEBUG_libfirm)
42 AC_SUBST(enable_debug_libfirm)
44 AC_ARG_ENABLE(gcc_inline,
45 [ --enable-gcc_inline enable gcc inline C-extension],
46 [if test "$enableval" = yes; then
47 AC_DEFINE(USE_GCC_INLINE)
49 AC_SUBST(enable_gcc_inline)
54 AC_ARG_ENABLE(profile,
55 [ --enable-profile enable profiling],
56 [if test "$enableval"=yes; then
57 enable_profile_libfirm=yes
59 [enable_profile_libfirm=no])
60 AC_SUBST(enable_profile_libfirm)
62 dnl set auto documentation
63 dnl ----------------------
64 AC_ARG_ENABLE(autodoc,
65 [ --enable-autodoc enable auto documentation],
66 [if test "$enableval"=yes; then
67 enable_auto_documentation=yes
69 [enable_auto_documentation=no])
70 AC_SUBST(enable_auto_documentation)
75 AC_ARG_ENABLE(firmjni,
76 [ --enable-firmjni check for tools necesarry to construct a java native interface for Firm],
77 [if test "$enableval"=yes; then
81 AC_SUBST(enable_firm_jni)
83 dnl disable linking of libiberty parts (xmalloc, xprintf, obstack, ...)
84 dnl ----------------------
85 AC_ARG_ENABLE(libiberty,
86 [ --disable-libiberty disable own libiberty parts],
87 [if test "$enableval"=yes; then
88 disable_libiberty_=yes
90 [disable_libiberty=no])
91 AC_SUBST(disable_libiberty)
94 dnl Checks for programs.
95 dnl ====================
97 dnl check for a C compiler
98 dnl ----------------------
101 dnl check for prelinkable linker
102 dnl ----------------------------
104 if test "$libfirm_cv_prog_ld_r" != "yes"; then
105 AC_MSG_ERROR(need a prelinkcapable linker)
110 AC_CHECK_PROG(AR, ar, "ar", "")
111 if test "$AR" != "ar"; then
112 AC_MSG_ERROR(need ar for creating archives)
117 AC_CHECK_PROG(TAR, tar, "tar", "")
118 if test "$TAR" != "tar"; then
119 AC_MSG_ERROR(need tar for creating archives in distribution)
122 dnl check whether ar can handle option -s
123 dnl if not then ranlib is needed
124 dnl for simpliticity we use ranlib every time
130 touch tmp-install.a tmp-install.b
131 if eval "$INSTALL -C tmp-install.a tmp-install.b" ; then
132 INSTALL="$INSTALL -C"
134 rm tmp-install.a tmp-install.b
139 dnl check for doxygen if enabled
140 dnl ----------------------------
141 if test "$enable_auto_documentation" = yes; then
142 AC_CHECK_PROG(DOXYGEN, doxygen, "doxygen", "")
143 if test "$DOXYGEN" != "doxygen"; then
144 AC_MSG_ERROR(need doxygen for auto documentation)
146 AC_CHECK_PROG(DOT, dot, "dot", "")
147 if test "$DOT" != "dot"; then
148 AC_MSG_ERROR(need dot for doxygen documentation (for class graphs) (IPD: module add Graphviz))
152 dnl check for availability of a jdk
153 dnl -------------------------------
154 if test "$enable_firm_jni" = yes; then
155 AC_CHECK_PROG(JAVAC, javac, "javac", "")
156 if test "$JAVAC" != "javac"; then
157 AC_MSG_ERROR(need java compiler javac to generate jni (IPD: module add jdk-1.3.1-sun))
159 AC_CHECK_PROG(JAVAH, javah, "javah", "")
160 if test "$JAVAH" != "javah"; then
161 AC_MSG_ERROR(need javah to generate jni headers (IPD: module add jdk-1.3.1-sun))
166 dnl Checks for header files.
167 dnl ========================
171 dnl check for the math header file
173 AC_CHECK_HEADERS(math.h, ac_math_headers="yes", ac_math_headers="no")
174 if test "$ac_math_headers" != yes; then
175 dnl math header not found.
176 AC_MSG_ERROR("math header file not found")
180 #dnl check for the gnu multiprecission (gmp) header file
182 #AC_CHECK_HEADERS(gmp.h, ac_gmp_headers="yes", ac_gmp_headers="no")
183 #if test "$ac_gmp_headers" != yes; then
184 # dnl gmp header not found.
185 # AC_MSG_ERROR("GNU multiprecission gmp header file not found")
189 dnl check for the obstack header file
192 #AC_CHECK_HEADERS(obstack.h, ac_obstack_headers="yes", ac_obstack_headers="no")
193 #if test "$ac_obstack_headers" != yes; then
194 if test "$ac_cv_func_obstack" != "yes"; then
195 dnl obstack header not found.
196 AC_MSG_ERROR("no obstack support")
200 dnl check for jni header files
202 if test "$enable_firm_jni" = yes; then
203 AC_CHECK_HEADERS(jni.h, ac_jni_headers="yes", ac_jni_headers="no")
204 if test "$ac_jni_headers" != yes; then
205 AC_MSG_ERROR(jni header file not found. (IPD: add -I/usr/public2/java/jdk1.3.1-sun/include/ -I/usr/public2/java/jdk1.3.1-sun/include/linux/ to CPPFLAGS))
210 dnl Checks for libraries.
211 dnl =====================
213 #dnl check for the gnu multiprecission (gmp) library
215 #AC_CHECK_LIB(gmp, main, ac_gmp_library="yes", ac_gmp_library="no")
216 #if test "$ac_gmp_library" != yes; then
217 # dnl gmp library not found.
218 # AC_MSG_ERROR("GNU multiprecission gmp library not found")
222 AC_CHECK_LIB(m, main, ac_m_library="yes", ac_m_library="no")
223 if test "$ac_m_library" != yes; then
224 dnl std math library not found.
225 AC_MSG_ERROR("standard math library not found")
229 dnl Checks for typedefs, structures, and compiler characteristics.
230 dnl ==============================================================
233 dnl Checks for library functions.
234 dnl =============================
236 dnl check for strerror
238 AC_CHECK_FUNC(strerror,,
239 AC_MSG_ERROR("need strerror function")
247 AC_OUTPUT($ac_output_file,[ touch stamp-h ])