From 02f1403c00f04aab73f988a2ebdc0195d6feaed5 Mon Sep 17 00:00:00 2001 From: stwo Date: Fri, 19 Feb 2010 13:26:36 +0000 Subject: Correct compiler/linker flags for threaded builds on OpenBSD. --- ChangeLog | 6 ++++++ unix/configure | 22 +++++++++++++++------- unix/tcl.m4 | 9 +++++++-- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index af715b3..554dcee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-02-19 Stuart Cassoff + + * tcl.m4: Correct compiler/linker flags + for threaded builds on OpenBSD. + * configure: (regenerated). + 2010-02-17 Joe English * generic/tkMenu.c: Defer TkMenuOptionTables cleanup diff --git a/unix/configure b/unix/configure index b38b7ac..7bcf5e5 100755 --- a/unix/configure +++ b/unix/configure @@ -5902,6 +5902,14 @@ else LDFLAGS="" fi + if test "${TCL_THREADS}" = "1"; then + + # OpenBSD builds and links with -pthread, never -lpthread. + LIBS=`echo $LIBS | sed s/-lpthread//` + CFLAGS="$CFLAGS -pthread" + SHLIB_CFLAGS="$SHLIB_CFLAGS -pthread" + +fi # OpenBSD doesn't do version numbers with dots. UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' @@ -7157,7 +7165,7 @@ fi BSD/OS*) ;; CYGWIN_*) ;; IRIX*) ;; - NetBSD-*|FreeBSD-*) ;; + NetBSD-*|FreeBSD-*|OpenBSD-*) ;; Darwin-*) ;; SCO_SV-3.2*) ;; *) SHLIB_CFLAGS="-fPIC" ;; @@ -10024,7 +10032,7 @@ ac_x_header_dirs=' /usr/openwin/share/include' if test "$ac_x_includes" = no; then - # Guess where to find include files, by looking for Xlib.h. + # Guess where to find include files, by looking for Intrinsic.h. # First, try using that file with no special directory specified. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -10032,7 +10040,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include +#include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 @@ -10059,7 +10067,7 @@ else sed 's/^/| /' conftest.$ac_ext >&5 for ac_dir in $ac_x_header_dirs; do - if test -r "$ac_dir/X11/Xlib.h"; then + if test -r "$ac_dir/X11/Intrinsic.h"; then ac_x_includes=$ac_dir break fi @@ -10073,18 +10081,18 @@ if test "$ac_x_libraries" = no; then # See if we find them without any special options. # Don't add to $LIBS permanently. ac_save_LIBS=$LIBS - LIBS="-lX11 $LIBS" + LIBS="-lXt $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include +#include int main () { -XrmInitialize () +XtMalloc (0) ; return 0; } diff --git a/unix/tcl.m4 b/unix/tcl.m4 index d7ca5a2..2013aa1 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -1574,7 +1574,12 @@ dnl AC_CHECK_TOOL(AR, ar) AS_IF([test $tcl_cv_ld_elf = yes], [ LDFLAGS=-Wl,-export-dynamic ], [LDFLAGS=""]) - + AS_IF([test "${TCL_THREADS}" = "1"], [ + # OpenBSD builds and links with -pthread, never -lpthread. + LIBS=`echo $LIBS | sed s/-lpthread//` + CFLAGS="$CFLAGS -pthread" + SHLIB_CFLAGS="$SHLIB_CFLAGS -pthread" + ]) # OpenBSD doesn't do version numbers with dots. UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' TCL_LIB_VERSIONS_OK=nodots @@ -2111,7 +2116,7 @@ dnl # preprocessing tests use only CPPFLAGS. BSD/OS*) ;; CYGWIN_*) ;; IRIX*) ;; - NetBSD-*|FreeBSD-*) ;; + NetBSD-*|FreeBSD-*|OpenBSD-*) ;; Darwin-*) ;; SCO_SV-3.2*) ;; *) SHLIB_CFLAGS="-fPIC" ;; -- cgit v0.12