Commit be515937 authored by Mark Andrews's avatar Mark Andrews
Browse files

2054. [port] freebsd: do not explicitly link against -lpthread.

                        [RT #16170]
parent c870001a
......@@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: Makefile.in,v 1.125 2005/06/08 02:06:57 marka Exp $
# $Id: Makefile.in,v 1.126 2006/07/20 05:39:08 marka Exp $
srcdir = @srcdir@
VPATH = @srcdir@
......@@ -135,7 +135,7 @@ XSRCS = adb_test.c \
all_tests: ${XTARGETS}
genrandom@EXEEXT@: genrandom.@O@
${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ genrandom.@O@ @GENRANDOMLIB@
${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ genrandom.@O@ @GENRANDOMLIB@ ${LIBS}
adb_test@EXEEXT@: adb_test.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS}
${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ adb_test.@O@ \
......
......@@ -140,6 +140,31 @@ then
fi
fi
;;
*-freebsd*)
# We don't want to set -lpthread as that break
# the ability to choose threads library at final
# link time and is not valid for all architectures.
PTHREAD=
if test "X$GCC" = "Xyes"; then
saved_cc="$CC"
CC="$CC -pthread"
AC_MSG_CHECKING(for gcc -pthread support);
AC_TRY_LINK([#include <pthread.h>],
[printf("%x\n", pthread_create);],
PTHREAD="yes"
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
CC="$saved_cc"
fi
if test "X$PTHREAD" != "Xyes"; then
AC_CHECK_LIB(pthread, pthread_create,,
AC_CHECK_LIB(thr, thread_create,,
AC_CHECK_LIB(c_r, pthread_create,,
AC_CHECK_LIB(c, pthread_create,,
AC_MSG_ERROR("could not find thread libraries")))))
fi
;;
*)
AC_CHECK_LIB(pthread, pthread_create,,
AC_CHECK_LIB(pthread, __pthread_create,,
......
This diff is collapsed.
......@@ -18,7 +18,7 @@ AC_DIVERT_PUSH(1)dnl
esyscmd([sed "s/^/# /" COPYRIGHT])dnl
AC_DIVERT_POP()dnl
AC_REVISION($Revision: 1.409 $)
AC_REVISION($Revision: 1.410 $)
AC_INIT(lib/dns/name.c)
AC_PREREQ(2.59)
......@@ -634,16 +634,61 @@ sinclude(config.threads.in)dnl
if $use_threads
then
if test "X$GCC" = "Xyes"; then
case "$host" in
*-freebsd*)
CC="$CC -pthread"
CCOPT="$CCOPT -pthread"
STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
;;
*-openbsd*)
CC="$CC -pthread"
CCOPT="$CCOPT -pthread"
;;
*-solaris*)
LIBS="$LIBS -lthread"
;;
*-ibm-aix*)
STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
;;
esac
else
case $host in
*-dec-osf*)
CC="$CC -pthread"
CCOPT="$CCOPT -pthread"
;;
*-solaris*)
CC="$CC -mt"
CCOPT="$CCOPT -mt"
;;
*-ibm-aix*)
STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
;;
*-sco-sysv*uw*|*-*-sysv*UnixWare*)
CC="$CC -Kthread"
CCOPT="$CCOPT -Kthread"
;;
*-*-sysv*OpenUNIX*)
CC="$CC -Kpthread"
CCOPT="$CCOPT -Kpthread"
;;
esac
fi
ALWAYS_DEFINES="-D_REENTRANT"
ISC_PLATFORM_USETHREADS="#define ISC_PLATFORM_USETHREADS 1"
thread_dir=pthreads
#
# We'd like to use sigwait() too
#
AC_CHECK_LIB(c, sigwait,
AC_DEFINE(HAVE_SIGWAIT),
AC_CHECK_LIB(pthread, sigwait,
AC_DEFINE(HAVE_SIGWAIT),
AC_CHECK_LIB(pthread, _Psigwait,
AC_DEFINE(HAVE_SIGWAIT),))
)
AC_CHECK_FUNC(sigwait,
AC_DEFINE(HAVE_SIGWAIT),
AC_CHECK_LIB(c, sigwait,
AC_DEFINE(HAVE_SIGWAIT),
AC_CHECK_LIB(pthread, sigwait,
AC_DEFINE(HAVE_SIGWAIT),
AC_CHECK_LIB(pthread, _Psigwait,
AC_DEFINE(HAVE_SIGWAIT),))))
AC_CHECK_FUNC(pthread_attr_getstacksize,
AC_DEFINE(HAVE_PTHREAD_ATTR_GETSTACKSIZE),)
......@@ -707,50 +752,6 @@ then
#
AC_CHECK_FUNC(sysconf, AC_DEFINE(HAVE_SYSCONF),)
if test "X$GCC" = "Xyes"; then
case "$host" in
*-freebsd*)
CC="$CC -pthread"
CCOPT="$CCOPT -pthread"
STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
;;
*-openbsd*)
CC="$CC -pthread"
CCOPT="$CCOPT -pthread"
;;
*-solaris*)
LIBS="$LIBS -lthread"
;;
*-ibm-aix*)
STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
;;
esac
else
case $host in
*-dec-osf*)
CC="$CC -pthread"
CCOPT="$CCOPT -pthread"
;;
*-solaris*)
CC="$CC -mt"
CCOPT="$CCOPT -mt"
;;
*-ibm-aix*)
STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
;;
*-sco-sysv*uw*|*-*-sysv*UnixWare*)
CC="$CC -Kthread"
CCOPT="$CCOPT -Kthread"
;;
*-*-sysv*OpenUNIX*)
CC="$CC -Kpthread"
CCOPT="$CCOPT -Kpthread"
;;
esac
fi
ALWAYS_DEFINES="-D_REENTRANT"
ISC_PLATFORM_USETHREADS="#define ISC_PLATFORM_USETHREADS 1"
thread_dir=pthreads
else
ISC_PLATFORM_USETHREADS="#undef ISC_PLATFORM_USETHREADS"
thread_dir=nothreads
......
This diff is collapsed.
......@@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
AC_REVISION($Revision: 1.118 $)
AC_REVISION($Revision: 1.119 $)
AC_INIT(resolv/herror.c)
AC_PREREQ(2.13)
......@@ -319,16 +319,68 @@ sinclude(../../config.threads.in)dnl
if $use_threads
then
if test "X$GCC" = "Xyes"; then
case "$host" in
*-freebsd*)
CC="$CC -pthread"
CCOPT="$CCOPT -pthread"
STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
;;
*-openbsd*)
CC="$CC -pthread"
CCOPT="$CCOPT -pthread"
;;
*-solaris*)
LIBS="$LIBS -lthread"
;;
*-ibm-aix*)
STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
;;
esac
else
case $host in
*-dec-osf*)
CC="$CC -pthread"
CCOPT="$CCOPT -pthread"
;;
*-solaris*)
CC="$CC -mt"
CCOPT="$CCOPT -mt"
;;
*-ibm-aix*)
STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
;;
*-UnixWare*)
CC="$CC -Kthread"
CCOPT="$CCOPT -Kthread"
;;
esac
fi
AC_DEFINE(_REENTRANT)
ALWAYS_DEFINES="-D_REENTRANT"
DO_PTHREADS="#define DO_PTHREADS 1"
WANT_IRS_THREADSGR_OBJS="\${WANT_IRS_THREADSGR_OBJS}"
WANT_IRS_THREADSPW_OBJS="\${WANT_IRS_THREADSPW_OBJS}"
case $host in
ia64-hp-hpux11.*)
WANT_IRS_THREADS_OBJS="";;
*)
WANT_IRS_THREADS_OBJS="\${WANT_IRS_THREADS_OBJS}";;
esac
WANT_THREADS_OBJS="\${WANT_THREADS_OBJS}"
thread_dir=pthreads
#
# We'd like to use sigwait() too
#
AC_CHECK_LIB(c, sigwait,
AC_DEFINE(HAVE_SIGWAIT),
AC_CHECK_LIB(pthread, sigwait,
AC_DEFINE(HAVE_SIGWAIT),
AC_CHECK_LIB(pthread, _Psigwait,
AC_DEFINE(HAVE_SIGWAIT),))
)
AC_CHECK_FUNC(sigwait,
AC_DEFINE(HAVE_SIGWAIT),
AC_CHECK_LIB(c, sigwait,
AC_DEFINE(HAVE_SIGWAIT),
AC_CHECK_LIB(pthread, sigwait,
AC_DEFINE(HAVE_SIGWAIT),
AC_CHECK_LIB(pthread, _Psigwait,
AC_DEFINE(HAVE_SIGWAIT),))))
AC_CHECK_FUNC(pthread_attr_getstacksize,
AC_DEFINE(HAVE_PTHREAD_ATTR_GETSTACKSIZE),)
......@@ -388,56 +440,6 @@ then
#
AC_CHECK_FUNC(sysconf, AC_DEFINE(HAVE_SYSCONF),)
if test "X$GCC" = "Xyes"; then
case "$host" in
*-freebsd*)
CC="$CC -pthread"
CCOPT="$CCOPT -pthread"
STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
;;
*-openbsd*)
CC="$CC -pthread"
CCOPT="$CCOPT -pthread"
;;
*-solaris*)
LIBS="$LIBS -lthread"
;;
*-ibm-aix*)
STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
;;
esac
else
case $host in
*-dec-osf*)
CC="$CC -pthread"
CCOPT="$CCOPT -pthread"
;;
*-solaris*)
CC="$CC -mt"
CCOPT="$CCOPT -mt"
;;
*-ibm-aix*)
STD_CDEFINES="$STD_CDEFINES -D_THREAD_SAFE"
;;
*-UnixWare*)
CC="$CC -Kthread"
CCOPT="$CCOPT -Kthread"
;;
esac
fi
AC_DEFINE(_REENTRANT)
ALWAYS_DEFINES="-D_REENTRANT"
DO_PTHREADS="#define DO_PTHREADS 1"
WANT_IRS_THREADSGR_OBJS="\${WANT_IRS_THREADSGR_OBJS}"
WANT_IRS_THREADSPW_OBJS="\${WANT_IRS_THREADSPW_OBJS}"
case $host in
ia64-hp-hpux11.*)
WANT_IRS_THREADS_OBJS="";;
*)
WANT_IRS_THREADS_OBJS="\${WANT_IRS_THREADS_OBJS}";;
esac
WANT_THREADS_OBJS="\${WANT_THREADS_OBJS}"
thread_dir=pthreads
else
ALWAYS_DEFINES=""
DO_PTHREADS="#undef DO_PTHREADS"
......@@ -2412,7 +2414,7 @@ esac
case "$hack_shutup_in6addr_init_macros" in
yes)
AC_DEFINE(BROKEN_IN6ADDR_INIT_MACROS)
AC_DEFINE(BROKEN_IN6ADDR_INIT_MACROS, 1, [Defined if IN6ADDR_ANY_INIT and IN6ADDR_LOOPBACK_INIT need to be redefined.] )
;;
esac
......
......@@ -1488,9 +1488,17 @@ EOF
;;
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
case "$archive_cmds" in
*"\$LD"*) ;;
*) deplibs="$deplibs $arg";;
case $host in
*-*-freebsd*)
compile_command="$compile_command $arg"
finalize_command="$finalize_command $arg"
;;
*)
case "$archive_cmds" in
*"\$LD"*) ;;
*) deplibs="$deplibs $arg";;
esac
;;
esac
continue
;;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment