implemented Setup.hs to build boehm cpp libs and install them;
[hs-boehmgc.git] / gc-7.2 / extra / threadlibs.c
1 /*
2  * Copyright (c) 1994 by Xerox Corporation.  All rights reserved.
3  * Copyright (c) 1996 by Silicon Graphics.  All rights reserved.
4  * Copyright (c) 1998 by Fergus Henderson.  All rights reserved.
5  * Copyright (c) 2000-2010 by Hewlett-Packard Development Company.
6  * All rights reserved.
7  *
8  * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
9  * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
10  *
11  * Permission is hereby granted to use or copy this program
12  * for any purpose,  provided the above notices are retained on all copies.
13  * Permission to modify the code and to distribute modified code is granted,
14  * provided the above notices are retained, and a notice that the code was
15  * modified is included with the above copyright notice.
16  */
17
18 # include "gc_config_macros.h"
19 # include "private/gcconfig.h"
20
21 # include <stdio.h>
22
23 int main(void)
24 {
25 #   if defined(GC_USE_LD_WRAP)
26         printf("-Wl,--wrap -Wl,dlopen "
27                "-Wl,--wrap -Wl,pthread_create -Wl,--wrap -Wl,pthread_join "
28                "-Wl,--wrap -Wl,pthread_detach -Wl,--wrap -Wl,pthread_sigmask "
29                "-Wl,--wrap -Wl,pthread_exit -Wl,--wrap -Wl,pthread_cancel\n");
30 #   endif
31 #   if (defined(GC_LINUX_THREADS) && !defined(PLATFORM_ANDROID)) \
32         || defined(GC_IRIX_THREADS) || defined(GC_DARWIN_THREADS) \
33         || defined(GC_AIX_THREADS) || defined(GC_GNU_THREADS)
34 #       ifdef GC_USE_DLOPEN_WRAP
35           printf("-ldl ");
36 #       endif
37         printf("-lpthread\n");
38 #   endif
39 #   if defined(GC_OPENBSD_THREADS)
40         printf("-pthread\n");
41 #   endif
42 #   if defined(GC_FREEBSD_THREADS)
43 #       ifdef GC_USE_DLOPEN_WRAP
44           printf("-ldl ");
45 #       endif
46 #       if (__FREEBSD_version >= 500000)
47           printf("-lpthread\n");
48 #       else
49           printf("-pthread\n");
50 #       endif
51 #   endif
52 #   if defined(GC_NETBSD_THREADS)
53           printf("-lpthread -lrt\n");
54 #   endif
55
56 #   if defined(GC_HPUX_THREADS) || defined(GC_OSF1_THREADS)
57         printf("-lpthread -lrt\n");
58 #   endif
59 #   if defined(GC_SOLARIS_THREADS)
60         printf("-lthread -lposix4\n");
61                 /* Is this right for recent versions? */
62 #   endif
63 #   if defined(GC_WIN32_THREADS) && defined(CYGWIN32)
64         printf("-lpthread\n");
65 #   endif
66 #   if defined(GC_WIN32_PTHREADS)
67 #      ifdef PTW32_STATIC_LIB
68          /* assume suffix s for static version of the win32 pthread library */
69          printf("-lpthreadGC2s -lws2_32\n");
70 #      else
71          printf("-lpthreadGC2\n");
72 #      endif
73 #   endif
74 #   if defined(GC_OSF1_THREADS)
75         printf("-pthread -lrt"); /* DOB: must be -pthread, not -lpthread */
76 #   endif
77     /* You need GCC 3.0.3 to build this one!            */
78     /* DG/UX native gcc doesn't know what "-pthread" is */
79 #   if defined(GC_DGUX386_THREADS)
80         printf("-ldl -pthread\n");
81 #   endif
82     return 0;
83 }