Cope with systems that have pthread.h but no libpthread
[mono.git] / configure.in
1 AC_INIT(README)
2 AM_CONFIG_HEADER(config.h)
3 AM_INIT_AUTOMAKE(mono, 0.7)
4 AM_MAINTAINER_MODE
5
6 AC_CANONICAL_HOST
7
8 AC_PROG_CC
9 AM_PROG_CC_STDC
10 AC_PROG_INSTALL
11
12 # Set STDC_HEADERS
13 AC_HEADER_STDC
14 AM_PROG_LIBTOOL
15
16 AC_CHECK_SIZEOF(void *)
17
18 dnl ***************************
19 dnl *** Checks for glib 1.2 ***
20 dnl ***************************
21 AM_PATH_GLIB(1.2.0,,
22              AC_MSG_ERROR([Cannot find GLIB: Is glib-config in path?]))
23
24 GLIB_CFLAGS=`glib-config --cflags glib`
25 GLIB_LIBS=`glib-config --libs glib`
26
27 AC_SUBST(GLIB_CFLAGS)
28 AC_SUBST(GLIB_LIBS)
29
30 GMODULE_CFLAGS=`glib-config --cflags gmodule`
31 GMODULE_LIBS=`glib-config --libs gmodule`
32
33 AC_SUBST(GMODULE_CFLAGS)
34 AC_SUBST(GMODULE_LIBS)
35
36 dnl *****************************
37 dnl *** Checks for libpthread ***
38 dnl *****************************
39 AC_CHECK_LIB(pthread, pthread_create, [
40                 THREAD_LIBS=-lpthread
41                 AM_CONDITIONAL(THREADS_PTHREAD, true)
42                 AC_DEFINE(HAVE_PTHREAD)
43         ], [
44                 AC_MSG_RESULT([Cannot find libpthread])
45                 # Check for other thread systems here, set THREAD_LIBS to
46                 # whatever is needed, and define
47                 # AM_CONDITIONAL(THREADS_foo, true), and add it to the
48                 # section in mono/metadata/Makefile.am, AC_DEFINE(HAVE_foo),
49                 # add that to acconfig.h, add the section for that in
50                 # mono/metadata/threads.h
51         ])
52 AC_SUBST(THREAD_LIBS)
53
54 CFLAGS='-g -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations'
55
56 TARGET="unknown"
57
58 case "$host" in
59 #mips-sgi-irix5.* | mips-sgi-irix6.*) TARGET=MIPS;;
60 i*86-*-*) TARGET=X86; arch_target=x86;;
61 #sparc-sun-4*) TARGET=SPARC;;
62 #sparc-sun-*) TARGET=SPARC;;
63 #sparc*-*-linux*) TARGET=SPARC;;
64 #alpha*-*-linux* | alpha*-*-osf*) TARGET=ALPHA;;
65 #m68k-*-linux*) TARGET=M68K;;
66 #powerpc-*-linux* | powerpc-*-sysv*) TARGET=POWERPC;;
67 #arm-*-linux-*) TARGET=ARM;;
68 esac
69
70 if test ${TARGET} = unknown; then
71         CFLAGS="$CFLAGS -DNO_PORT"
72         AC_MSG_WARN("mono has not been ported to $host: some things may not work.")
73 fi
74
75 AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
76 AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
77 AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
78 AM_CONDITIONAL(X86, test x$TARGET = xX86)
79 AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
80 AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
81 AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
82 AM_CONDITIONAL(ARM, test x$TARGET = xARM)
83
84 AC_SUBST(arch_target)
85 AC_SUBST(CFLAGS)
86
87 AC_OUTPUT([
88 Makefile
89 mono/Makefile
90 mono/metadata/Makefile
91 mono/dis/Makefile
92 mono/cil/Makefile
93 mono/arch/Makefile
94 mono/arch/x86/Makefile
95 mono/interpreter/Makefile
96 mono/tests/Makefile
97 mono/wrapper/Makefile
98 mono/monoburg/Makefile
99 mono/jit/Makefile
100 runtime/Makefile
101 doc/Makefile
102 ])