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