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/testprograms/Makefile libfirm.doxygen"
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="")
30 AC_ARG_WITH(libdir, [ --with-libdir=add colon seperated list of directories to linker search path],
31 LDFLAGS=$LDFLAGS" -L"`echo $withval|sed 's;\:; -L;g'`, T_FLAG="")
40 [ --enable-debug enable assertions and additional debugging routines],
41 [if test "$enableval" = yes; then
42 AC_DEFINE(DEBUG_libfirm)
46 AC_SUBST(enable_debug_libfirm)
48 AC_ARG_ENABLE(gcc_inline,
49 [ --enable-gcc_inline enable gcc inline C-extension],
50 [if test "$enableval" = yes; then
51 AC_DEFINE(USE_GCC_INLINE)
53 AC_SUBST(enable_gcc_inline)
58 AC_ARG_ENABLE(profile,
59 [ --enable-profile enable profiling],
60 [if test "$enableval"=yes; then
61 enable_profile_libfirm=yes
63 [enable_profile_libfirm=no])
64 AC_SUBST(enable_profile_libfirm)
66 dnl set auto documentation
67 dnl ----------------------
68 AC_ARG_ENABLE(autodoc,
69 [ --enable-autodoc enable auto documentation],
70 [if test "$enableval"=yes; then
71 enable_auto_documentation=yes
73 [enable_auto_documentation=no])
74 AC_SUBST(enable_auto_documentation)
79 AC_ARG_ENABLE(firmjni,
80 [ --enable-firmjni check for tools necesarry to construct a java native interface for Firm],
81 [if test "$enableval"=yes; then
85 AC_SUBST(enable_firm_jni)
87 dnl disable linking of libiberty parts (xmalloc, xprintf, obstack, ...)
88 dnl ----------------------
89 AC_ARG_ENABLE(libiberty,
90 [ --disable-libiberty disable own libiberty parts],
91 [if test "$enableval"=yes; then
92 disable_libiberty_=yes
94 [disable_libiberty=no])
95 AC_SUBST(disable_libiberty)
98 dnl Checks for programs.
99 dnl ====================
101 dnl check for a C compiler
102 dnl ----------------------
105 dnl check for prelinkable linker
106 dnl ----------------------------
108 if test "$libfirm_cv_prog_ld_r" != "yes"; then
109 AC_MSG_ERROR(need a prelinkcapable linker)
114 AC_CHECK_PROG(AR, ar, "ar", "")
115 if test "$AR" != "ar"; then
116 AC_MSG_ERROR(need ar for creating archives)
121 AC_CHECK_PROG(TAR, tar, "tar", "")
122 if test "$TAR" != "tar"; then
123 AC_MSG_ERROR(need tar for creating archives in distribution)
126 dnl check whether ar can handle option -s
127 dnl if not then ranlib is needed
128 dnl for simpliticity we use ranlib every time
134 touch tmp-install.a tmp-install.b
135 if eval "$INSTALL -C tmp-install.a tmp-install.b" ; then
136 INSTALL="$INSTALL -C"
138 rm tmp-install.a tmp-install.b
143 dnl check for doxygen if enabled
144 dnl ----------------------------
145 if test "$enable_auto_documentation" = yes; then
146 AC_CHECK_PROG(DOXYGEN, doxygen, "doxygen", "")
147 if test "$DOXYGEN" != "doxygen"; then
148 AC_MSG_ERROR(need doxygen for auto documentation)
150 AC_CHECK_PROG(DOT, dot, "dot", "")
151 if test "$DOT" != "dot"; then
152 AC_MSG_ERROR(need dot for doxygen documentation (for class graphs) (IPD: module add Graphviz))
156 dnl check for availability of a jdk
157 dnl -------------------------------
158 if test "$enable_firm_jni" = yes; then
159 AC_CHECK_PROG(JAVAC, javac, "javac", "")
160 if test "$JAVAC" != "javac"; then
161 AC_MSG_ERROR(need java compiler javac to generate jni (IPD: module add jdk-1.3.1-sun))
163 AC_CHECK_PROG(JAVAH, javah, "javah", "")
164 if test "$JAVAH" != "javah"; then
165 AC_MSG_ERROR(need javah to generate jni headers (IPD: module add jdk-1.3.1-sun))
170 dnl Checks for header files.
171 dnl ========================
175 dnl check for the math header file
177 AC_CHECK_HEADERS(math.h, ac_math_headers="yes", ac_math_headers="no")
178 if test "$ac_math_headers" != yes; then
179 dnl math header not found.
180 AC_MSG_ERROR("math header file not found")
184 #dnl check for the gnu multiprecission (gmp) header file
186 #AC_CHECK_HEADERS(gmp.h, ac_gmp_headers="yes", ac_gmp_headers="no")
187 #if test "$ac_gmp_headers" != yes; then
188 # dnl gmp header not found.
189 # AC_MSG_ERROR("GNU multiprecission gmp header file not found")
193 dnl check for the obstack header file
194 dnl does not work with:
199 AC_CHECK_HEADERS(obstack.h, ac_obstack_headers="yes", ac_obstack_headers="no")
200 if test "$ac_obstack_headers" != yes; then
201 dnl obstack header not found.
202 AC_MSG_ERROR("obstack.h not found")
206 dnl check for jni header files
208 if test "$enable_firm_jni" = yes; then
209 AC_CHECK_HEADERS(jni.h, ac_jni_headers="yes", ac_jni_headers="no")
210 if test "$ac_jni_headers" != yes; then
211 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))
216 dnl Checks for libraries.
217 dnl =====================
219 #dnl check for the gnu multiprecission (gmp) library
221 #AC_CHECK_LIB(gmp, main, ac_gmp_library="yes", ac_gmp_library="no")
222 #if test "$ac_gmp_library" != yes; then
223 # dnl gmp library not found.
224 # AC_MSG_ERROR("GNU multiprecission gmp library not found")
228 AC_CHECK_LIB(m, main, ac_m_library="yes", ac_m_library="no")
229 if test "$ac_m_library" != yes; then
230 dnl std math library not found.
231 AC_MSG_ERROR("standard math library not found")
235 dnl Checks for typedefs, structures, and compiler characteristics.
236 dnl ==============================================================
240 dnl Checks for library functions.
241 dnl =============================
243 dnl check for strerror
245 AC_CHECK_FUNC(strerror,,
246 AC_MSG_ERROR("need strerror function")
254 AC_OUTPUT($ac_output_file,[ touch stamp-h ])