4 AM_CONFIG_HEADER(config.h)
5 AM_INIT_AUTOMAKE(mono, 0.7)
8 AC_CHECK_TOOL(CC, gcc, gcc)
13 dnl may require a specific autoconf version
14 dnl AC_PROG_CC_FOR_BUILD
15 dnl CC_FOR_BUILD not automatically detected
18 if test "x$cross_compiling" = "xyes"; then
22 AC_SUBST(CC_FOR_BUILD)
24 AC_SUBST(BUILD_EXEEXT)
31 # not 64 bit clean in cross-compile
32 AC_CHECK_SIZEOF(void *, 4)
34 CFLAGS='-g -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations'
36 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
37 if test "x$PKG_CONFIG" = "xno"; then
38 AC_MSG_ERROR([You need to install pkg-config])
41 dnl for use on the build system
42 dnl pkg-config is stupid
43 BUILD_GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0`
44 BUILD_GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0`
45 AC_SUBST(BUILD_GLIB_CFLAGS)
46 AC_SUBST(BUILD_GLIB_LIBS)
49 AC_ARG_WITH(crosspkgdir, [ --with-crosspkgdir=/path/to/pkg-config/dir],
50 if test x$with_crosspkgdir = "x"; then
51 if test -s $PKG_CONFIG_PATH; then
52 PKG_PATH=$PKG_CONFIG_PATH
55 PKG_PATH=$with_crosspkgdir
56 PKG_CONFIG_PATH=$PKG_PATH
57 export PKG_CONFIG_PATH
61 ## Versions of dependencies
62 GLIB_REQUIRED_VERSION=1.3.11
64 PKG_CHECK_MODULES(BASE_DEPENDENCIES, glib-2.0 >= $GLIB_REQUIRED_VERSION)
66 GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0`
67 GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0`
68 GMODULE_CFLAGS=`$PKG_CONFIG --cflags gmodule-2.0`
69 GMODULE_LIBS=`$PKG_CONFIG --libs gmodule-2.0`
73 AC_SUBST(GMODULE_CFLAGS)
74 AC_SUBST(GMODULE_LIBS)
76 dnl ****************************************
77 dnl *** Check if we're building on win32 ***
78 dnl ****************************************
79 AC_MSG_CHECKING([if building for some Win32 platform])
81 *-*-mingw*|*-*-cygwin*)
83 AC_DEFINE(PLATFORM_WIN32)
89 AC_MSG_RESULT($platform_win32)
90 AM_CONDITIONAL(PLATFORM_WIN32, test x$platform_win32 = xyes)
92 if test x$platform_win32 = xyes; then
93 AC_MSG_CHECKING([if building for native Win32])
96 platform_win32_native=yes
97 AC_DEFINE(PLATFORM_WIN32_NATIVE)
100 platform_win32_native=no
103 AC_MSG_RESULT($platform_win32_native)
104 AM_CONDITIONAL(PLATFORM_WIN32_NATIVE,
105 test x$platform_win32_native = xyes)
109 if test x$platform_win32 = xno; then
110 dnl ******************************************************************
111 dnl *** Check for large file support ***
112 dnl *** (If we were using autoconf 2.50 we'd use AC_SYS_LARGEFILE) ***
113 dnl ******************************************************************
115 # Check that off_t can represent 2**63 - 1 correctly, working around
116 # potential compiler bugs. Defines LARGE_FILE_SUPPORT, adds $1 to
117 # CFLAGS and sets $large_offt to yes if the test succeeds
119 AC_DEFUN(LARGE_FILES, [
120 large_CPPFLAGS=$CPPFLAGS
121 CPPFLAGS="$CPPFLAGS $1"
123 #include <sys/types.h>
125 #define BIG_OFF_T (((off_t)1<<62)-1+((off_t)1<<62))
128 int big_off_t=((BIG_OFF_T%2147483629==721) &&
129 (BIG_OFF_T%2147483647==1));
138 AC_DEFINE(HAVE_LARGE_FILE_SUPPORT)
144 CPPFLAGS=$large_CPPFLAGS
147 AC_MSG_CHECKING(if off_t is 64 bits wide)
149 if test $large_offt = no; then
150 AC_MSG_CHECKING(if _FILE_OFFSET_BITS=64 gives 64 bit off_t)
151 LARGE_FILES("-D_FILE_OFFSET_BITS=64")
153 if test $large_offt = no; then
154 AC_MSG_WARN([No 64 bit file size support available])
158 dnl *****************************
159 dnl *** Checks for libpthread ***
160 dnl *****************************
161 AC_SEARCH_LIBS(pthread_create, pthread, [
162 AM_CONDITIONAL(THREADS_PTHREAD, true)
163 AC_DEFINE(HAVE_PTHREAD)
165 # Need pthread_mutex_timedlock
167 orig_CPPFLAGS=$CPPFLAGS
168 # This is a gcc-specific error, but we already set
169 # gcc-specific options in CFLAGS
170 CPPFLAGS="$CPPFLAGS -Werror-implicit-function-declaration"
171 AC_MSG_CHECKING(for pthread_mutex_timedlock)
172 AC_TRY_COMPILE([ #include <pthread.h>], [
173 pthread_mutex_t mut=PTHREAD_MUTEX_INITIALIZER;
174 pthread_mutex_timedlock(&mut, NULL);
178 AC_DEFINE(HAVE_PTHREAD_MUTEX_TIMEDLOCK)
182 # glibc requires -D_GNU_SOURCE before it will declare
184 AC_MSG_CHECKING(whether _GNU_SOURCE is needed for pthread_mutex_timedlock)
185 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
186 AC_TRY_COMPILE([ #include <pthread.h>], [
187 pthread_mutex_t mut=PTHREAD_MUTEX_INITIALIZER;
188 pthread_mutex_timedlock(&mut, NULL);
191 pthread_CFLAGS="-D_GNU_SOURCE"
192 AC_DEFINE(HAVE_PTHREAD_MUTEX_TIMEDLOCK)
195 dnl Add other variants here
196 AC_MSG_WARN(Working around pthread_mutex_timedlock)
199 CPPFLAGS=$orig_CPPFLAGS
200 CFLAGS="$CFLAGS $pthread_CFLAGS"
202 # Need PTHREAD_MUTEX_RECURSIVE
204 orig_CPPFLAGS=$CPPFLAGS
205 # This is a gcc-specific error, but we already set
206 # gcc-specific options in CFLAGS
207 CPPFLAGS="$CPPFLAGS -Werror-implicit-function-declaration"
208 AC_MSG_CHECKING(for PTHREAD_MUTEX_RECURSIVE)
209 AC_TRY_COMPILE([ #include <pthread.h>], [
210 pthread_mutexattr_t attr;
211 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
218 # glibc requires -D_GNU_SOURCE before it will declare
220 AC_MSG_CHECKING(whether _GNU_SOURCE is needed for PTHREAD_MUTEX_RECURSIVE)
221 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
222 AC_TRY_COMPILE([ #include <pthread.h>], [
223 pthread_mutexattr_t attr;
224 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
227 pthread_CFLAGS="-D_GNU_SOURCE"
230 dnl Add other variants here
231 AC_MSG_ERROR([PTHREAD_MUTEX_RECURSIVE not found])
234 CPPFLAGS=$orig_CPPFLAGS
235 CFLAGS="$CFLAGS $pthread_CFLAGS"
237 AC_MSG_ERROR([libpthread is required on non-win32 hosts])
241 if test "x$cross_compiling" = "xno"; then
242 # check for new iconv version
243 AC_MSG_CHECKING(for new iconv)
244 AC_CACHE_VAL(new_iconv,[
245 AC_TRY_RUN([#include <stdio.h>
250 exit (iconv_open ("UTF-16le", "UTF-8") == (iconv_t)-1);
253 new_iconv=yes,new_iconv=)])
254 if test -n "$new_iconv"; then
256 AC_DEFINE(HAVE_NEW_ICONV)
263 ACCESS_UNALIGNED="yes"
266 #mips-sgi-irix5.* | mips-sgi-irix6.*) TARGET=MIPS; ACCESS_UNALIGNED="no";;
267 i*86-*-*) TARGET=X86; arch_target=x86;;
268 sparc*-*-*) TARGET=SPARC; ACCESS_UNALIGNED="no";;
269 #alpha*-*-linux* | alpha*-*-osf*) TARGET=ALPHA; ACCESS_UNALIGNED="no";;
270 #m68k-*-linux*) TARGET=M68K;;
271 powerpc-*-linux* | powerpc-*-sysv*) TARGET=POWERPC; arch_target=ppc;;
272 #arm-*-linux-*) TARGET=ARM; ACCESS_UNALIGNED="no";;
275 if test ${TARGET} = unknown; then
276 CFLAGS="$CFLAGS -DNO_PORT"
277 AC_MSG_WARN("mono has not been ported to $host: some things may not work.")
280 if test ${ACCESS_UNALIGNED} = no; then
281 CPPFLAGS="$CPPFLAGS -DNO_UNALIGNED_ACCESS"
284 AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
285 AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
286 AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
287 AM_CONDITIONAL(X86, test x$TARGET = xX86)
288 AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
289 AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
290 AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
291 AM_CONDITIONAL(ARM, test x$TARGET = xARM)
293 AC_SUBST(arch_target)
299 mono/metadata/Makefile
303 mono/arch/x86/Makefile
304 mono/arch/ppc/Makefile
305 mono/interpreter/Makefile
307 mono/wrapper/Makefile
308 mono/monoburg/Makefile
310 mono/io-layer/Makefile