This commit is contained in:
Markus Armbruster 2007-07-28 13:09:00 +00:00
parent 8bd0a2cf81
commit 015d8d933b
2 changed files with 121 additions and 65 deletions

View file

@ -1,50 +1,88 @@
dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) ##### http://autoconf-archive.cryp.to/acx_pthread.html
dnl #
dnl @summary figure out how to build C programs using POSIX threads # SYNOPSIS
dnl #
dnl This macro figures out how to build C programs using POSIX threads. # ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
dnl It sets the PTHREAD_LIBS output variable to the threads library and #
dnl linker flags, and the PTHREAD_CFLAGS output variable to any special # DESCRIPTION
dnl C compiler flags that are needed. (The user can also force certain #
dnl compiler flags/libs to be tested by setting these environment # This macro figures out how to build C programs using POSIX threads.
dnl variables.) # It sets the PTHREAD_LIBS output variable to the threads library and
dnl # linker flags, and the PTHREAD_CFLAGS output variable to any special
dnl Also sets PTHREAD_CC to any special C compiler that is needed for # C compiler flags that are needed. (The user can also force certain
dnl multi-threaded programs (defaults to the value of CC otherwise). # compiler flags/libs to be tested by setting these environment
dnl (This is necessary on AIX to use the special cc_r compiler alias.) # variables.)
dnl #
dnl NOTE: You are assumed to not only compile your program with these # Also sets PTHREAD_CC to any special C compiler that is needed for
dnl flags, but also link it with them as well. e.g. you should link # multi-threaded programs (defaults to the value of CC otherwise).
dnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS # (This is necessary on AIX to use the special cc_r compiler alias.)
dnl $LIBS #
dnl # NOTE: You are assumed to not only compile your program with these
dnl If you are only building threads programs, you may wish to use # flags, but also link it with them as well. e.g. you should link
dnl these variables in your default LIBS, CFLAGS, and CC: # with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS
dnl # $LIBS
dnl LIBS="$PTHREAD_LIBS $LIBS" #
dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # If you are only building threads programs, you may wish to use
dnl CC="$PTHREAD_CC" # these variables in your default LIBS, CFLAGS, and CC:
dnl #
dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute # LIBS="$PTHREAD_LIBS $LIBS"
dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to # CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
dnl that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). # CC="$PTHREAD_CC"
dnl #
dnl ACTION-IF-FOUND is a list of shell commands to run if a threads # In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to # constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to
dnl run it if it is not found. If ACTION-IF-FOUND is not specified, the # that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
dnl default action will define HAVE_PTHREAD. #
dnl # ACTION-IF-FOUND is a list of shell commands to run if a threads
dnl Please let the authors know if this macro fails on any platform, or # library is found, and ACTION-IF-NOT-FOUND is a list of commands to
dnl if you have any other suggestions or comments. This macro was based # run it if it is not found. If ACTION-IF-FOUND is not specified, the
dnl on work by SGJ on autoconf scripts for FFTW (www.fftw.org) (with # default action will define HAVE_PTHREAD.
dnl help from M. Frigo), as well as ac_pthread and hb_pthread macros #
dnl posted by Alejandro Forero Cuervo to the autoconf macro repository. # Please let the authors know if this macro fails on any platform, or
dnl We are also grateful for the helpful feedback of numerous users. # if you have any other suggestions or comments. This macro was based
dnl # on work by SGJ on autoconf scripts for FFTW (http://www.fftw.org/)
dnl @category InstalledPackages # (with help from M. Frigo), as well as ac_pthread and hb_pthread
dnl @author Steven G. Johnson <stevenj@alum.mit.edu> # macros posted by Alejandro Forero Cuervo to the autoconf macro
dnl @version 2005-06-15 # repository. We are also grateful for the helpful feedback of
dnl @license GPLWithACException # numerous users.
#
# LAST MODIFICATION
#
# 2006-05-29
#
# COPYLEFT
#
# Copyright (c) 2006 Steven G. Johnson <stevenj@alum.mit.edu>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
#
# As a special exception, the respective Autoconf Macro's copyright
# owner gives unlimited permission to copy, distribute and modify the
# configure scripts that are the output of Autoconf when processing
# the Macro. You need not follow the terms of the GNU General Public
# License when using or distributing such scripts, even though
# portions of the text of the Macro appear in them. The GNU General
# Public License (GPL) does govern all other use of the material that
# constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the
# Autoconf Macro released by the Autoconf Macro Archive. When you
# make and distribute a modified version of the Autoconf Macro, you
# may extend this special exception to the GPL to apply to your
# modified version as well.
AC_DEFUN([ACX_PTHREAD], [ AC_DEFUN([ACX_PTHREAD], [
AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_CANONICAL_HOST])
@ -216,8 +254,12 @@ if test "x$acx_pthread_ok" = xyes; then
LIBS="$save_LIBS" LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS" CFLAGS="$save_CFLAGS"
# More AIX lossage: must compile with cc_r # More AIX lossage: must compile with xlc_r or cc_r
AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC}) if test x"$GCC" != xyes; then
AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
else
PTHREAD_CC=$CC
fi
else else
PTHREAD_CC="$CC" PTHREAD_CC="$CC"
fi fi

View file

@ -1,19 +1,33 @@
dnl @synopsis LIB_SOCKET_NSL ##### http://autoconf-archive.cryp.to/lib_socket_nsl.html
dnl #
dnl This macro figures out what libraries are required on this platform # SYNOPSIS
dnl to link sockets programs. #
dnl # LIB_SOCKET_NSL
dnl The common cases are not to need any extra libraries, or to need #
dnl -lsocket and -lnsl. We need to avoid linking with libnsl unless we # DESCRIPTION
dnl need it, though, since on some OSes where it isn't necessary it #
dnl will totally break networking. Unisys also includes gethostbyname() # This macro figures out what libraries are required on this platform
dnl in libsocket but needs libnsl for socket(). # to link sockets programs.
dnl #
dnl @category Misc # The common cases are not to need any extra libraries, or to need
dnl @author Russ Allbery <rra@stanford.edu> # -lsocket and -lnsl. We need to avoid linking with libnsl unless we
dnl @author Stepan Kasal <kasal@ucw.cz> # need it, though, since on some OSes where it isn't necessary it
dnl @author Warren Young <warren@etr-usa.com> # will totally break networking. Unisys also includes gethostbyname()
dnl @version 2005-09-06 # in libsocket but needs libnsl for socket().
#
# LAST MODIFICATION
#
# 2005-09-06
#
# COPYLEFT
#
# Copyright (c) 2005 Russ Allbery <rra@stanford.edu>
# Copyright (c) 2005 Stepan Kasal <kasal@ucw.cz>
# Copyright (c) 2005 Warren Young <warren@etr-usa.com>
#
# Copying and distribution of this file, with or without
# modification, are permitted in any medium without royalty provided
# the copyright notice and this notice are preserved.
AC_DEFUN([LIB_SOCKET_NSL], AC_DEFUN([LIB_SOCKET_NSL],
[ [