*** empty log message ***
[libfirm] / configure.in
1 dnl Process this file withautoconf to produce a configure script.
2 dnl Copyright (c) 2001 IPD, Universität Karlsruhe (TH)
3
4 dnl libFIRM Project
5 dnl $Id$
6
7 AC_REVISION($Id$)
8
9
10 AC_INIT(libfirm,0.3.0)
11 AC_PREREQ(2.50)
12 dnl if other files should be generated just add them to ac_output_files
13 ac_output_file="Makefile MakeRules ir/Makefile ir/adt/Makefile ir/debug/Makefile \
14                 ir/tv/Makefile ir/common/Makefile ir/ident/Makefile ir/ir/Makefile \
15                 ir/ana/Makefile ir/tr/Makefile ir/st/Makefile testprograms/Makefile \
16                 firmjni/Makefile firmjni/build_firm_jni firmjni/testprograms/Makefile"
17
18 dnl generate the config header file
19 AC_CONFIG_HEADER(config.h)
20
21 dnl keep track of the environment set by the user
22 libfirm_conf_env="${CC+CC='$CC'} ${CFLAGS+CFLAGS='$CFLAGS'} ${CPP+CPP='$CPP'} ${CPPFLAGS+CPPFLAGS='$CPPFLAGS'} ${LDFLAGS+LDFLAGS='$LDFLAGS'} ${LIBS+LIBS='$LIBS'}"
23 AC_SUBST(libfirm_conf_env)
24
25 dnl check for additional include dirs
26 AC_ARG_WITH(includedir, [  --with-includedir=dir add directory to include search path],
27     CPPFLAGS=$CPPFLAGS" -I"$withval, T_FLAG="")
28
29 dnl Package options
30 dnl ===============
31
32 dnl set debugging
33 dnl -------------
34 AC_ARG_ENABLE(debug,
35 [  --enable-debug          enable assertions and additional debugging routines],
36 [if test "$enableval" = yes; then
37   AC_DEFINE(DEBUG_libfirm)
38 else
39   AC_DEFINE(NDEBUG)
40 fi])
41 AC_SUBST(enable_debug_libfirm)
42
43 AC_ARG_ENABLE(gcc_inline,
44 [  --enable-gcc_inline     enable gcc inline C-extension],
45 [if test "$enableval" = yes; then
46   AC_DEFINE(USE_GCC_INLINE)
47 fi])
48 AC_SUBST(enable_gcc_inline)
49
50
51 dnl set profiling
52 dnl -------------
53 AC_ARG_ENABLE(profile,
54 [  --enable-profile        enable profiling],
55 [if test "$enableval"=yes; then
56   enable_profile_libfirm=yes
57 fi],
58 [enable_profile_libfirm=no])
59 AC_SUBST(enable_profile_libfirm)
60
61 dnl set auto documentation
62 dnl ----------------------
63 AC_ARG_ENABLE(autodoc,
64 [  --enable-autodoc        enable auto documentation],
65 [if test "$enableval"=yes; then
66   enable_auto_documentation=yes
67 fi],
68 [enable_auto_documentation=no])
69 AC_SUBST(enable_auto_documentation)
70
71
72 dnl set firm jni
73 dnl ------------
74 AC_ARG_ENABLE(firmjni,
75 [  --enable-firmjni        check for tools necesarry to construct a java native interface for Firm],
76 [if test "$enableval"=yes; then
77   enable_firm_jni=yes
78 fi],
79 [enable_firm_jni=no])
80 AC_SUBST(enable_firm_jni)
81
82
83 dnl Checks for programs.
84 dnl ====================
85
86 dnl check for a C compiler
87 dnl ----------------------
88 AC_PROG_CC
89
90 dnl check for prelinkable linker
91 dnl ----------------------------
92 LIBFIRM_PROG_LD_R
93 if test "$libfirm_cv_prog_ld_r" != "yes"; then
94   AC_MSG_ERROR(need a prelinkcapable linker)
95 fi
96
97 dnl check for ar
98 dnl ------------
99 AC_CHECK_PROG(AR, ar, "ar", "")
100 if test "$AR" != "ar"; then
101   AC_MSG_ERROR(need ar for creating archives)
102 fi
103
104 dnl check for tar
105 dnl -------------
106 AC_CHECK_PROG(TAR, tar, "tar", "")
107 if test "$TAR" != "tar"; then
108   AC_MSG_ERROR(need tar for creating archives in distribution)
109 fi
110
111 dnl check whether ar can handle option -s
112 dnl if not then ranlib is needed
113 dnl for simpliticity we use ranlib every time
114
115 AC_PROG_RANLIB
116
117 AC_PROG_INSTALL
118
119 AC_PROG_LN_S
120
121 dnl check for doxygen if enabled
122 dnl ----------------------------
123 if test "$enable_auto_documentation" = yes; then
124   AC_CHECK_PROG(DOXYGEN, doxygen, "doxygen", "")
125   if test "$DOXYGEN" != "doxygen"; then
126     AC_MSG_ERROR(need doxygen for auto documentation)
127   fi
128   AC_CHECK_PROG(DOT, dot, "dot", "")
129   if test "$DOT" != "dot"; then
130     AC_MSG_ERROR(need dot for doxygen documentation (for class graphs) (IPD: module add Graphviz))
131   fi
132 fi
133
134 dnl check for availability of a jdk
135 dnl -------------------------------
136 if test "$enable_firm_jni" = yes; then
137   AC_CHECK_PROG(JAVAC, javac, "javac", "")
138   if test "$JAVAC" != "javac"; then
139     AC_MSG_ERROR(need java compiler javac to generate jni (IPD: module add jdk-1.3.1-sun))
140   fi
141   AC_CHECK_PROG(JAVAH, javah, "javah", "")
142   if test "$JAVAH" != "javah"; then
143     AC_MSG_ERROR(need javah to generate jni headers (IPD: module add jdk-1.3.1-sun))
144   fi
145 fi
146
147
148 dnl Checks for header files.
149 dnl ========================
150
151 AC_HEADER_STDC
152
153 dnl check for the math header file
154
155 AC_CHECK_HEADERS(math.h, ac_math_headers="yes", ac_math_headers="no")
156 if test "$ac_math_headers" != yes; then
157   dnl math header not found.
158   AC_MSG_ERROR("math header file not found")
159 fi
160
161
162 #dnl check for the gnu multiprecission (gmp) header file
163
164 #AC_CHECK_HEADERS(gmp.h, ac_gmp_headers="yes", ac_gmp_headers="no")
165 #if test "$ac_gmp_headers" != yes; then
166 #  dnl gmp header not found.
167 #  AC_MSG_ERROR("GNU multiprecission gmp header file not found")
168 #fi
169
170
171 dnl check for the obstack header file
172
173 AC_CHECK_HEADERS(obstack.h, ac_obstack_headers="yes", ac_obstack_headers="no")
174 if test "$ac_obstack_headers" != yes; then
175   dnl obstack header not found.
176   AC_MSG_ERROR("obstack header file not found")
177 fi
178
179
180 dnl check for jni header files
181
182 if test "$enable_firm_jni" = yes; then
183   AC_CHECK_HEADERS(jni.h, ac_jni_headers="yes", ac_jni_headers="no")
184   if test "$ac_jni_headers" != yes; then
185     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))
186   fi
187 fi
188
189
190 dnl Checks for libraries.
191 dnl =====================
192
193 #dnl check for the gnu multiprecission (gmp) library
194
195 #AC_CHECK_LIB(gmp, main, ac_gmp_library="yes", ac_gmp_library="no")
196 #if test "$ac_gmp_library" != yes; then
197 #  dnl gmp library not found.
198 #  AC_MSG_ERROR("GNU multiprecission gmp library not found")
199 #fi
200
201
202 AC_CHECK_LIB(m, main, ac_m_library="yes", ac_m_library="no")
203 if test "$ac_m_library" != yes; then
204   dnl std math library not found.
205   AC_MSG_ERROR("standard math library not found")
206 fi
207
208
209 dnl Checks for typedefs, structures, and compiler characteristics.
210 dnl ==============================================================
211
212
213 dnl Checks for library functions.
214 dnl =============================
215
216 dnl check for strerror
217
218 AC_CHECK_FUNC(strerror,,
219   AC_MSG_ERROR("need strerror function")
220 )
221
222
223 dnl Error messaging
224 dnl ===============
225
226
227 AC_OUTPUT($ac_output_file,[ touch stamp-h ])