reintroduce install -C option if available
[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
11 AC_INIT(libfirm,0.3.0)
12 AC_PREREQ(2.50)
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"
18
19 dnl generate the config header file
20 AC_CONFIG_HEADER(config.h)
21
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)
25
26 dnl check for additional include dirs
27 AC_ARG_WITH(includedir, [  --with-includedir=dir add directory to include search path],
28     CPPFLAGS=$CPPFLAGS" -I"$withval, T_FLAG="")
29
30 dnl Package options
31 dnl ===============
32
33 dnl set debugging
34 dnl -------------
35 AC_ARG_ENABLE(debug,
36 [  --enable-debug          enable assertions and additional debugging routines],
37 [if test "$enableval" = yes; then
38   AC_DEFINE(DEBUG_libfirm)
39 else
40   AC_DEFINE(NDEBUG)
41 fi])
42 AC_SUBST(enable_debug_libfirm)
43
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)
48 fi])
49 AC_SUBST(enable_gcc_inline)
50
51
52 dnl set profiling
53 dnl -------------
54 AC_ARG_ENABLE(profile,
55 [  --enable-profile        enable profiling],
56 [if test "$enableval"=yes; then
57   enable_profile_libfirm=yes
58 fi],
59 [enable_profile_libfirm=no])
60 AC_SUBST(enable_profile_libfirm)
61
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
68 fi],
69 [enable_auto_documentation=no])
70 AC_SUBST(enable_auto_documentation)
71
72
73 dnl set firm jni
74 dnl ------------
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
78   enable_firm_jni=yes
79 fi],
80 [enable_firm_jni=no])
81 AC_SUBST(enable_firm_jni)
82
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
89 fi],
90 [disable_libiberty=no])
91 AC_SUBST(disable_libiberty)
92
93
94 dnl Checks for programs.
95 dnl ====================
96
97 dnl check for a C compiler
98 dnl ----------------------
99 AC_PROG_CC
100
101 dnl check for prelinkable linker
102 dnl ----------------------------
103 LIBFIRM_PROG_LD_R
104 if test "$libfirm_cv_prog_ld_r" != "yes"; then
105   AC_MSG_ERROR(need a prelinkcapable linker)
106 fi
107
108 dnl check for ar
109 dnl ------------
110 AC_CHECK_PROG(AR, ar, "ar", "")
111 if test "$AR" != "ar"; then
112   AC_MSG_ERROR(need ar for creating archives)
113 fi
114
115 dnl check for tar
116 dnl -------------
117 AC_CHECK_PROG(TAR, tar, "tar", "")
118 if test "$TAR" != "tar"; then
119   AC_MSG_ERROR(need tar for creating archives in distribution)
120 fi
121
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
125
126 AC_PROG_RANLIB
127
128 AC_PROG_INSTALL
129
130 touch tmp-install.a tmp-install.b
131 if eval "$INSTALL -C tmp-install.a tmp-install.b" ; then
132     INSTALL="$INSTALL -C"
133 fi
134 rm tmp-install.a tmp-install.b
135
136
137 AC_PROG_LN_S
138
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)
145   fi
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))
149   fi
150 fi
151
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))
158   fi
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))
162   fi
163 fi
164
165
166 dnl Checks for header files.
167 dnl ========================
168
169 AC_HEADER_STDC
170
171 dnl check for the math header file
172
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")
177 fi
178
179
180 #dnl check for the gnu multiprecission (gmp) header file
181
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")
186 #fi
187
188
189 dnl check for the obstack header file
190 AC_FUNC_OBSTACK
191
192 #AC_CHECK_HEADERS(obstack.h, ac_obstack_headers="yes", ac_obstack_headers="no")
193 #if test "$ac_obstack_headers" != yes; then
194 #  dnl obstack header not found.
195 #  AC_MSG_ERROR("obstack header file not found")
196 #fi
197
198
199 dnl check for jni header files
200
201 if test "$enable_firm_jni" = yes; then
202   AC_CHECK_HEADERS(jni.h, ac_jni_headers="yes", ac_jni_headers="no")
203   if test "$ac_jni_headers" != yes; then
204     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))
205   fi
206 fi
207
208
209 dnl Checks for libraries.
210 dnl =====================
211
212 #dnl check for the gnu multiprecission (gmp) library
213
214 #AC_CHECK_LIB(gmp, main, ac_gmp_library="yes", ac_gmp_library="no")
215 #if test "$ac_gmp_library" != yes; then
216 #  dnl gmp library not found.
217 #  AC_MSG_ERROR("GNU multiprecission gmp library not found")
218 #fi
219
220
221 AC_CHECK_LIB(m, main, ac_m_library="yes", ac_m_library="no")
222 if test "$ac_m_library" != yes; then
223   dnl std math library not found.
224   AC_MSG_ERROR("standard math library not found")
225 fi
226
227
228 dnl Checks for typedefs, structures, and compiler characteristics.
229 dnl ==============================================================
230
231
232 dnl Checks for library functions.
233 dnl =============================
234
235 dnl check for strerror
236
237 AC_CHECK_FUNC(strerror,,
238   AC_MSG_ERROR("need strerror function")
239 )
240
241
242 dnl Error messaging
243 dnl ===============
244
245
246 AC_OUTPUT($ac_output_file,[ touch stamp-h ])