implemented Setup.hs to build boehm cpp libs and install them;
[hs-boehmgc.git] / gc-7.2 / libatomic_ops / configure.ac
1 # Process this file with autoconf to produce a configure script.
2 AC_INIT([libatomic_ops],[7.2])
3
4 AC_CANONICAL_TARGET([])
5 AC_CONFIG_SRCDIR(src/atomic_ops.c)
6 AM_INIT_AUTOMAKE
7 AC_PROG_RANLIB
8
9 AM_CONFIG_HEADER(src/config.h)
10
11 # Checks for programs.
12 AM_PROG_CC_C_O
13 AM_PROG_AS
14
15 # Checks for functions.
16 AC_FUNC_MMAP
17
18 # Checks for header files.
19 AC_HEADER_STDC
20 # AC_CHECK_HEADERS([ ])
21
22 # Determine PIC flag.
23 need_asm=false
24 PICFLAG=
25 AC_MSG_CHECKING(for PIC compiler flag)
26 if test "$GCC" = yes; then
27   case "$host" in
28     *-*-cygwin* | *-*-mingw*)
29       # Cygwin and Mingw[-w32/64] do not need -fPIC.
30       AC_MSG_RESULT("<none>")
31       ;;
32     *)
33       AC_MSG_RESULT(-fPIC)
34       PICFLAG=-fPIC
35       AC_MSG_CHECKING(whether gcc -fPIC causes __PIC__ definition)
36       # Workaround: at least GCC 3.4.6 (Solaris) does not define this macro.
37       old_CFLAGS="$CFLAGS"
38       CFLAGS="$PICFLAG $CFLAGS"
39       AC_TRY_COMPILE([],[
40  #ifndef __PIC__
41  # error
42  #endif
43       ], [ac_cv_pic_macro=yes], [ac_cv_pic_macro=no])
44       CFLAGS="$old_CFLAGS"
45       AC_MSG_RESULT($ac_cv_pic_macro)
46       AS_IF([test "$ac_cv_pic_macro" = yes], [],
47             [PICFLAG="-D__PIC__=1 $PICFLAG"])
48       ;;
49   esac
50 else
51   case "$host" in
52     *-*-hpux*)
53       AC_MSG_RESULT("+Z")
54       PICFLAG="+Z"
55       CFLAGS="$CFLAGS +O2 -mt"
56       ;;
57     *-*-solaris*)
58       AC_MSG_RESULT(-Kpic)
59       PICFLAG=-Kpic
60       CFLAGS="$CFLAGS -O"
61       need_asm=true
62       ;;
63     *-*-linux*)
64       AC_MSG_RESULT(-fPIC)
65       PICFLAG=-fPIC
66       # Any Linux compiler had better be gcc compatible.
67       ;;
68     *)
69       AC_MSG_RESULT("<none>")
70       ;;
71   esac
72 fi
73 CFLAGS="$CFLAGS -DNDEBUG"
74 AC_SUBST(PICFLAG)
75 AC_SUBST(DEFS)
76
77 AH_TEMPLATE([_PTHREADS], [Indicates the use of pthreads (NetBSD).])
78
79 THREADDLLIBS=
80 have_pthreads=true
81 ## Libraries needed to support threads.
82 AC_CHECK_LIB(pthread, pthread_self, THREADDLLIBS="-lpthread",,)
83 AC_DEFINE(_REENTRANT, 1, [Required define if using POSIX threads.])
84 case "$host" in
85     *-*-netbsd*)
86       AC_DEFINE(_PTHREADS)
87       ;;
88     *-*-openbsd* | *-*-kfreebsd*-gnu | *-*-dgux*)
89       THREADDLLIBS=-pthread
90       ;;
91     *-*-cygwin* | *-*-darwin*)
92       THREADDLLIBS=
93       ;;
94     *-*-mingw*)
95       THREADDLLIBS=
96       have_pthreads=false
97       ;;
98 esac
99 AC_SUBST(THREADDLLIBS)
100
101 AM_CONDITIONAL(HAVE_PTHREAD_H, test x$have_pthreads = xtrue)
102 AM_CONDITIONAL(NEED_ASM, test x$need_asm = xtrue)
103
104 AC_CONFIG_FILES([Makefile pkgconfig/atomic_ops.pc \
105     pkgconfig/atomic_ops-uninstalled.pc doc/Makefile src/Makefile \
106     src/atomic_ops/Makefile src/atomic_ops/sysdeps/Makefile tests/Makefile])
107 AC_CONFIG_COMMANDS([default],[[]],[[
108 PICFLAG="${PICFLAG}"
109 CC="${CC}"
110 DEFS="${DEFS}"
111 ]])
112 AC_OUTPUT