Support OpenBSD.

configure.ac:
    Set flags to build Boehm GC with threads support and parallel
    marking.

    Prevent use of "__thread" storage class specifier on OpenBSD;
    it does not work.

    Enable shared libraries on OpenBSD.

README.OpenBSD:
    New file.

.README.in:
README.md:
    Mention README.OpenBSD.

.nocopyright:
    Add README.OpenBSD.
This commit is contained in:
Peter Wang
2018-03-01 16:15:04 +11:00
parent 76cd5898d8
commit 04ad98c7b4
5 changed files with 39 additions and 5 deletions

View File

@@ -9,7 +9,7 @@ or particular architectures, so first read the README file for your particular
platform, if there is one:
README.AIX RS/6000 systems running AIX
README.FreeBSD The FreeBSD version of BSD Unix on Intel x86
README.FreeBSD FreeBSD on Intel x86 and x86_64
README.HPUX HPPA systems running HPUX
README.Linux Linux on Intel x86 and x86_64
README.Linux-Alpha Linux on DEC Alpha
@@ -17,6 +17,7 @@ platform, if there is one:
README.Linux-m68k Linux on Motorola 68000
README.MacOS Apple Mac systems running Mac OS X
README.MS-Windows Microsoft Windows
README.OpenBSD OpenBSD on x86_64
README.Solaris Solaris (SunOS) on SPARC or Intel x86.
The documentation sources are in the `doc' subdirectory. The installation

View File

@@ -34,6 +34,7 @@ README.MinGW-cross
README.MS-VisualC
README.MS-Windows
README.OSF1
README.OpenBSD
README.Solaris
README.ssdebug
README.CSharp

12
README.OpenBSD Normal file
View File

@@ -0,0 +1,12 @@
Mercury on OpenBSD
==================
Tested on OpenBSD 6.2 amd64 with clang 4.0 and gcc 4.9.
The base version of gcc is 4.2.1, but you can install a more recent
version from ports with "pkg_add gcc", then direct Mercury to use 'egcc'
by running:
CC=egcc ./configure <your normal configure arguments>

View File

@@ -42,6 +42,7 @@ Specific information is contained in individual README files:
[m68k](README.Linux-m68k))
* [MacOS X](README.MacOS)
* [FreeBSD](README.FreeBSD)
* [OpenBSD](README.OpenBSD)
* [AIX](README.AIX)
* [HP-UX](README.HPUX)
* [Solaris](README.Solaris)

View File

@@ -3265,7 +3265,15 @@ case "$host" in
ENABLE_BOEHM_PARALLEL_MARK="-DPARALLEL_MARK"
;;
*freebsd*)
*-freebsd*)
CFLAGS_FOR_THREADS="-DGC_THREADS"
THREAD_LIBS="-lpthread"
ENABLE_BOEHM_THREAD_LOCAL_ALLOC="-DTHREAD_LOCAL_ALLOC"
ENABLE_BOEHM_PARALLEL_MARK="-DPARALLEL_MARK"
avoid_sbrk=yes
;;
*-openbsd*)
CFLAGS_FOR_THREADS="-DGC_THREADS"
THREAD_LIBS="-lpthread"
ENABLE_BOEHM_THREAD_LOCAL_ALLOC="-DTHREAD_LOCAL_ALLOC"
@@ -3326,12 +3334,11 @@ AC_CACHE_VAL(mercury_cv_thread_local_storage,
)
AC_MSG_RESULT($mercury_cv_thread_local_storage)
# Thread-local storage is disabled on Solaris as there is a linker problem
# with shared objects and TLS.
if test "$mercury_cv_thread_local_storage" = yes; then
case "$host" in
*-solaris2.*)
# Thread-local storage is disabled on Solaris as there is a linker
# problem with shared objects and TLS.
;;
*apple*darwin*)
# XXX only attempt to use __thread with GCC on Mac OS X.
@@ -3343,6 +3350,14 @@ if test "$mercury_cv_thread_local_storage" = yes; then
;;
esac
;;
*-openbsd*)
# The above test "passes" but OpenBSD (6.2) does not support TLS
# natively, so is emulated by gcc/clang using something like the
# pthread thread-specific data API. Moreover, something goes wrong
# with the emulation when a Mercury program is dynamically linked
# to the Mercury runtime (MR_thread_engine_base is assigned in one
# place but remains NULL when read elsewhere).
;;
*)
AC_DEFINE([MR_THREAD_LOCAL_STORAGE])
;;
@@ -4440,6 +4455,10 @@ case "$host" in
AC_MSG_RESULT(yes)
EXT_FOR_SHARED_LIB=so
;;
*-openbsd*)
AC_MSG_RESULT(yes)
EXT_FOR_SHARED_LIB=so
;;
i*86-*-solaris2.*)
AC_MSG_RESULT(yes)