Commit bc0ab164 authored by Karl Heyes's avatar Karl Heyes

update pthread check, for the pth lib and a solaris -pthreads check. Update the

other m4 macros for the --with-X prefix check

svn path=/icecast/trunk/m4/; revision=9556
parent 84cd8c9c
......@@ -37,9 +37,10 @@ fi
# Create a list of thread flags to try. Items starting with a "-" are
# C compiler flags, and other items are library names, except for "none"
# which indicates that we try without any flags at all.
# which indicates that we try without any flags at all, and "pthread-config"
# which is a program returning the flags for the Pth emulation library.
acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt"
acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
# The ordering *is* (sometimes) important. Some notes on the
# individual items follow:
......@@ -58,6 +59,7 @@ acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -m
# also defines -D_REENTRANT)
# pthread: Linux, etcetera
# --thread-safe: KAI C++
# pthread-config: use pthread-config program (for GNU Pth library)
case "${host_cpu}-${host_os}" in
*solaris*)
......@@ -70,7 +72,7 @@ case "${host_cpu}-${host_os}" in
# who knows whether they'll stub that too in a future libc.) So,
# we'll just look for -pthreads and -lpthread first:
acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags"
acx_pthread_flags="-pthreads pthread -mt $acx_pthread_flags"
;;
esac
......@@ -87,6 +89,13 @@ for flag in $acx_pthread_flags; do
PTHREAD_CFLAGS="$flag"
;;
pthread-config)
AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
if test x"$acx_pthread_config" = xno; then continue; fi
PTHREAD_CFLAGS="`pthread-config --cflags`"
PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
;;
*)
AC_MSG_CHECKING([for the pthreads library -l$flag])
PTHREAD_LIBS="-l$flag"
......@@ -133,36 +142,29 @@ if test "x$acx_pthread_ok" = xyes; then
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# Detect AIX lossage: threads are created detached by default
# and the JOINABLE attribute has a nonstandard name (UNDETACHED).
# Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
AC_MSG_CHECKING([for joinable pthread attribute])
AC_TRY_LINK([#include <pthread.h>],
[int attr=PTHREAD_CREATE_JOINABLE;],
ok=PTHREAD_CREATE_JOINABLE, ok=unknown)
if test x"$ok" = xunknown; then
AC_TRY_LINK([#include <pthread.h>],
[int attr=PTHREAD_CREATE_UNDETACHED;],
ok=PTHREAD_CREATE_UNDETACHED, ok=unknown)
fi
if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then
AC_DEFINE(PTHREAD_CREATE_JOINABLE, $ok,
[Define to the necessary symbol if this constant
uses a non-standard name on your system.])
fi
AC_MSG_RESULT(${ok})
if test x"$ok" = xunknown; then
AC_MSG_WARN([we do not know how to create joinable pthreads])
attr_name=unknown
for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
AC_TRY_LINK([#include <pthread.h>], [int attr=$attr;],
[attr_name=$attr; break])
done
AC_MSG_RESULT($attr_name)
if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
[Define to necessary symbol if this constant
uses a non-standard name on your system.])
fi
AC_MSG_CHECKING([if more special flags are required for pthreads])
flag=no
case "${host_cpu}-${host_os}" in
*-aix* | *-freebsd*) flag="-D_THREAD_SAFE";;
*solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
*-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
*solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
esac
AC_MSG_RESULT(${flag})
if test "x$flag" != xno; then
PTHREAD_CPPFLAGS="$flag $PTHREAD_CPPFLAGS"
PTHREAD_CPPFLAGS="$flag $PTHREAD_CPPFLAGS"
fi
AC_CHECK_TYPES(pthread_rwlock_t,,,[#include <pthread.h>])
......
......@@ -15,7 +15,7 @@ AC_ARG_WITH(ogg,
ogg_prefix="$withval",
ogg_prefix="$OGG_PREFIX"
)
if test "x$ogg_prefix" = "x"; then
if test "x$ogg_prefix" = "x" -o "x$ogg_prefix" = "xyes"; then
if test "x$prefix" = "xNONE"; then
ogg_prefix=/usr/local
else
......
......@@ -23,7 +23,7 @@ if test "x$with_speex" = "xno"
then
AC_MSG_RESULT([Speex support disabled by request])
else
if test "x$speex_prefix" = "x"; then
if test "x$speex_prefix" = "x" -o "x$speex_prefix" = "xyes"; then
if test "x$prefix" = "xNONE"; then
speex_prefix="/usr/local"
else
......
......@@ -23,7 +23,7 @@ if test "x$with_theora" = "xno"
then
AC_MSG_RESULT([Theora support disabled by request])
else
if test "x$theora_prefix" = "x"; then
if test "x$theora_prefix" = "x" -o "x$theora_prefix" = "xyes"; then
if test "x$prefix" = "xNONE"; then
theora_prefix="/usr/local"
else
......
......@@ -21,7 +21,7 @@ AC_ARG_WITH(vorbis,
vorbis_prefix="$withval",
vorbis_prefix="$VORBIS_PREFIX"
)
if test "x$vorbis_prefix" = "x"; then
if test "x$vorbis_prefix" = "x" -o "x$vorbis_prefix" = "xyes"; then
if test "x$prefix" = "xNONE"; then
vorbis_prefix="/usr/local"
else
......
......@@ -14,7 +14,7 @@ AC_ARG_WITH(curl-config,
AC_HELP_STRING([--with-curl-config=curl-config],[Use curl-config to find libcurl]),
CURL_CONFIG="$withval", [AC_PATH_PROGS(CURL_CONFIG, [curl-config], "")])
if test "x$curl_prefix" != "x"; then
if test "x$curl_prefix" != "x" -a "x$curl_prefix" != "xyes"; then
CURL_LIBS="-L$curl_prefix/lib -lcurl"
CURL_CFLAGS="-I$curl_prefix/include"
elif test "x$CURL_CONFIG" != "x"; then
......
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