From a316db1cbe69bd9d561a50c1e69a45b7fcfd449f Mon Sep 17 00:00:00 2001 From: cristy Date: Mon, 24 Oct 2011 00:49:45 +0000 Subject: [PATCH] --- ImageMagick.spec | 4 +- Magick++/bin/Magick++-config | 12 ++- MagickCore/magick-config.h | 51 ++++------- MagickCore/version.h | 2 +- config/config.h.in | 3 + config/configure.xml | 8 +- configure | 170 ++++++++++++++++++++++++----------- libtool | 6 +- m4/ax_pthread.m4 | 81 ++++++++++------- 9 files changed, 206 insertions(+), 131 deletions(-) diff --git a/ImageMagick.spec b/ImageMagick.spec index 27095f569..d0b1fe961 100644 --- a/ImageMagick.spec +++ b/ImageMagick.spec @@ -181,7 +181,7 @@ make rm -rf $RPM_BUILD_ROOT make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p" -cp -a www/source $RPM_BUILD_ROOT%{_datadir}/doc/%{name}-%{VERSION} +cp -a www/source $RPM_BUILD_ROOT%{_datadir}/doc/%{name} rm $RPM_BUILD_ROOT%{_libdir}/*.la # fix weird perl Magick.so permissions @@ -284,7 +284,7 @@ rm -rf $RPM_BUILD_ROOT %files doc %defattr(-,root,root,-) -%doc %{_datadir}/doc/%{name}-%{VERSION} +%doc %{_datadir}/doc/%{name} %doc LICENSE %files c++ diff --git a/Magick++/bin/Magick++-config b/Magick++/bin/Magick++-config index bab72bd2d..7c2772fc3 100755 --- a/Magick++/bin/Magick++-config +++ b/Magick++/bin/Magick++-config @@ -7,8 +7,6 @@ prefix=/usr/local exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include usage='Usage: Magick++-config [--cppflags] [--cxxflags] [--exec-prefix] [--ldflags] [--libs] [--prefix] [--version] @@ -43,19 +41,19 @@ while test $# -gt 0; do echo '7.0.0 Q16 ' ;; --cflags) - echo "-I${includedir} -fopenmp" + pkg-config --cflags Magick++ ;; --cxxflags) - echo '-g -O2 -pthread' + pkg-config --cflags Magick++ ;; --cppflags) - echo '-I/usr/local/include/ImageMagick' + pkg-config --cflags Magick++ ;; --ldflags) - echo '-L/usr/local/lib -L/usr/lib' + pkg-config --libs Magick++ ;; --libs) - echo "-L${libdir} -lMagick++ -lMagickWand -lMagickCore -llcms2 -ltiff -lfreetype -ljasper -ljpeg -lpng12 -ldjvulibre -lfontconfig -lXext -lXt -lSM -lICE -lX11 -llzma -lbz2 -lxml2 -lgvc -lgraph -lcdt -lz -lm -lgomp -lpthread " + pkg-config --libs Magick++ ;; *) echo "${usage}" 1>&2 diff --git a/MagickCore/magick-config.h b/MagickCore/magick-config.h index 4de7f9ad5..978a4cd7a 100644 --- a/MagickCore/magick-config.h +++ b/MagickCore/magick-config.h @@ -12,9 +12,7 @@ /* #undef AUTOTRACE_DELEGATE */ /* Define if coders and filters are to be built as modules. */ -#ifndef MAGICKCORE_BUILD_MODULES -#define MAGICKCORE_BUILD_MODULES 1 -#endif +/* #undef BUILD_MODULES */ /* Define if you have the bzip2 library */ #ifndef MAGICKCORE_BZLIB_DELEGATE @@ -77,9 +75,7 @@ #endif /* Define if you have FFTW library */ -#ifndef MAGICKCORE_FFTW_DELEGATE -#define MAGICKCORE_FFTW_DELEGATE 1 -#endif +/* #undef FFTW_DELEGATE */ /* Location of filter modules */ #ifndef MAGICKCORE_FILTER_PATH @@ -221,9 +217,7 @@ #endif /* Define to 1 if you have the header file. */ -#ifndef MAGICKCORE_HAVE_CL_CL_H -#define MAGICKCORE_HAVE_CL_CL_H 1 -#endif +/* #undef HAVE_CL_CL_H */ /* Define to 1 if you have the header file. */ #ifndef MAGICKCORE_HAVE_COMPLEX_H @@ -441,15 +435,15 @@ #endif /* Define if you have the header file. */ -/* #undef HAVE_LCMS2_H */ +#ifndef MAGICKCORE_HAVE_LCMS2_H +#define MAGICKCORE_HAVE_LCMS2_H 1 +#endif /* Define if you have the header file. */ /* #undef HAVE_LCMS2_LCMS2_H */ /* Define if you have the header file. */ -#ifndef MAGICKCORE_HAVE_LCMS_H -#define MAGICKCORE_HAVE_LCMS_H 1 -#endif +/* #undef HAVE_LCMS_H */ /* Define if you have the header file. */ /* #undef HAVE_LCMS_LCMS_H */ @@ -659,6 +653,11 @@ #define MAGICKCORE_HAVE_PTHREAD 1 #endif +/* Have PTHREAD_PRIO_INHERIT. */ +#ifndef MAGICKCORE_HAVE_PTHREAD_PRIO_INHERIT +#define MAGICKCORE_HAVE_PTHREAD_PRIO_INHERIT 1 +#endif + /* Define to 1 if you have the `pwrite' function. */ #ifndef MAGICKCORE_HAVE_PWRITE #define MAGICKCORE_HAVE_PWRITE 1 @@ -1172,9 +1171,7 @@ #endif /* Define if you have JBIG library */ -#ifndef MAGICKCORE_JBIG_DELEGATE -#define MAGICKCORE_JBIG_DELEGATE 1 -#endif +/* #undef JBIG_DELEGATE */ /* Define if you have JPEG version 2 "Jasper" library */ #ifndef MAGICKCORE_JP2_DELEGATE @@ -1203,9 +1200,7 @@ #endif /* Define if you have LQR library */ -#ifndef MAGICKCORE_LQR_DELEGATE -#define MAGICKCORE_LQR_DELEGATE 1 -#endif +/* #undef LQR_DELEGATE */ /* Define if using libltdl to support dynamically loadable modules */ #ifndef MAGICKCORE_LTDL_DELEGATE @@ -1217,7 +1212,7 @@ /* Define to the system default library search path. */ #ifndef MAGICKCORE_LT_DLSEARCH_PATH -#define MAGICKCORE_LT_DLSEARCH_PATH "/lib64:/usr/lib64:/lib:/usr/lib:/usr/lib64/R/lib:/usr/lib64/atlas:/opt/modules/pkg/intel/f77/10.0.025/lib:/opt/intel/lib/intel64:/usr/lib64/llvm:/usr/local/lib:/usr/lib64/mysql:/usr/lib64/nvidia:/usr/lib64/qt-3.3/lib:/usr/lib64/tracker-0.12:/usr/lib64/xulrunner-2" +#define MAGICKCORE_LT_DLSEARCH_PATH "/lib64:/usr/lib64:/lib:/usr/lib:/usr/lib64/atlas:/usr/lib/llvm:/usr/lib64/llvm:/usr/lib64/mysql:/usr/lib64/qt-3.3/lib:/usr/lib64/tcl8.5/tclx8.4:/usr/lib64/tcl8.5:/usr/lib64/tracker-0.12:/usr/lib/wine/:/usr/lib64/wine/:/usr/lib64/xulrunner-2" #endif /* The archive extension */ @@ -1268,9 +1263,7 @@ /* #undef NO_MINUS_C_MINUS_O */ /* Define if you have OPENEXR library */ -#ifndef MAGICKCORE_OPENEXR_DELEGATE -#define MAGICKCORE_OPENEXR_DELEGATE 1 -#endif +/* #undef OPENEXR_DELEGATE */ /* Name of package */ #ifndef MAGICKCORE_PACKAGE @@ -1330,9 +1323,7 @@ #endif /* Define if you have RSVG library */ -#ifndef MAGICKCORE_RSVG_DELEGATE -#define MAGICKCORE_RSVG_DELEGATE 1 -#endif +/* #undef RSVG_DELEGATE */ /* Define to the type of arg 1 for `select'. */ #ifndef MAGICKCORE_SELECT_TYPE_ARG1 @@ -1479,9 +1470,7 @@ #endif /* Define if you have WEBP library */ -#ifndef MAGICKCORE_WEBP_DELEGATE -#define MAGICKCORE_WEBP_DELEGATE 1 -#endif +/* #undef WEBP_DELEGATE */ /* Define to use the Windows GDI32 library */ /* #undef WINGDI32_DELEGATE */ @@ -1490,9 +1479,7 @@ /* #undef WITH_DMALLOC */ /* Define if you have WMF library */ -#ifndef MAGICKCORE_WMF_DELEGATE -#define MAGICKCORE_WMF_DELEGATE 1 -#endif +/* #undef WMF_DELEGATE */ /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ diff --git a/MagickCore/version.h b/MagickCore/version.h index 4456bb8c5..0704a782f 100644 --- a/MagickCore/version.h +++ b/MagickCore/version.h @@ -27,7 +27,7 @@ extern "C" { */ #define MagickPackageName "ImageMagick" #define MagickCopyright "Copyright (C) 1999-2011 ImageMagick Studio LLC" -#define MagickSVNRevision "exported" +#define MagickSVNRevision "5733" #define MagickLibVersion 0x700 #define MagickLibVersionText "7.0.0" #define MagickLibVersionNumber 7,0,0 diff --git a/config/config.h.in b/config/config.h.in index 327362a46..922ed79ff 100644 --- a/config/config.h.in +++ b/config/config.h.in @@ -430,6 +430,9 @@ /* Define if you have POSIX threads libraries and header files. */ #undef HAVE_PTHREAD +/* Have PTHREAD_PRIO_INHERIT. */ +#undef HAVE_PTHREAD_PRIO_INHERIT + /* Define to 1 if you have the `pwrite' function. */ #undef HAVE_PWRITE diff --git a/config/configure.xml b/config/configure.xml index c51ac5654..e05bb653e 100644 --- a/config/configure.xml +++ b/config/configure.xml @@ -10,9 +10,9 @@ - - - + + + @@ -28,7 +28,7 @@ - + diff --git a/configure b/configure index fcf586641..425daf591 100755 --- a/configure +++ b/configure @@ -3583,7 +3583,7 @@ MAGICK_LIBRARY_CURRENT_MIN=`expr $MAGICK_LIBRARY_CURRENT - $MAGICK_LIBRARY_AGE` MAGICK_LIBRARY_VERSION_INFO=$MAGICK_LIBRARY_CURRENT:$MAGICK_LIBRARY_REVISION:$MAGICK_LIBRARY_AGE -MAGICK_SVN_REVISION=5659 +MAGICK_SVN_REVISION=5733 @@ -8250,7 +8250,6 @@ have_threads=no if test "$with_threads" != 'no'; then - ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -8352,9 +8351,9 @@ case "${host_cpu}-${host_os}" in ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags" ;; - *-darwin*) - ax_pthread_flags="-pthread $ax_pthread_flags" - ;; + *-darwin*) + ax_pthread_flags="-pthread $ax_pthread_flags" + ;; esac if test x"$ax_pthread_ok" = xno; then @@ -8372,8 +8371,8 @@ $as_echo_n "checking whether pthreads work with $flag... " >&6; } PTHREAD_CFLAGS="$flag" ;; - pthread-config) - # Extract the first word of "pthread-config", so it can be a program name with args. + pthread-config) + # Extract the first word of "pthread-config", so it can be a program name with args. set dummy pthread-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } @@ -8411,10 +8410,10 @@ $as_echo "no" >&6; } fi - if test x"$ax_pthread_config" = xno; then continue; fi - PTHREAD_CFLAGS="`pthread-config --cflags`" - PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" - ;; + if test x"$ax_pthread_config" = xno; then continue; fi + PTHREAD_CFLAGS="`pthread-config --cflags`" + PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" + ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$flag" >&5 @@ -8440,17 +8439,17 @@ $as_echo_n "checking for the pthreads library -l$flag... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include - static void routine(void* a) {a=0;} - static void* start_routine(void* a) {return a;} + static void routine(void *a) { a = 0; } + static void *start_routine(void *a) { return a; } int main () { pthread_t th; pthread_attr_t attr; - pthread_create(&th,0,start_routine,0); - pthread_join(th, 0); - pthread_attr_init(&attr); - pthread_cleanup_push(routine, 0); - pthread_cleanup_pop(0); + pthread_create(&th, 0, start_routine, 0); + pthread_join(th, 0); + pthread_attr_init(&attr); + pthread_cleanup_push(routine, 0); + pthread_cleanup_pop(0) /* ; */ ; return 0; } @@ -8483,17 +8482,17 @@ if test "x$ax_pthread_ok" = xyes; then CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5 $as_echo_n "checking for joinable pthread attribute... " >&6; } - attr_name=unknown - for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + attr_name=unknown + for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { -int attr=$attr; return attr; +int attr = $attr; return attr /* ; */ ; return 0; } @@ -8503,7 +8502,7 @@ if ac_fn_c_try_link "$LINENO"; then : fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - done + done { $as_echo "$as_me:${as_lineno-$LINENO}: result: $attr_name" >&5 $as_echo "$attr_name" >&6; } if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then @@ -8527,11 +8526,46 @@ $as_echo "${flag}" >&6; } PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PTHREAD_PRIO_INHERIT" >&5 +$as_echo_n "checking for PTHREAD_PRIO_INHERIT... " >&6; } +if ${ax_cv_PTHREAD_PRIO_INHERIT+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include +int +main () +{ +int i = PTHREAD_PRIO_INHERIT; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ax_cv_PTHREAD_PRIO_INHERIT=yes +else + ax_cv_PTHREAD_PRIO_INHERIT=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_PRIO_INHERIT" >&5 +$as_echo "$ax_cv_PTHREAD_PRIO_INHERIT" >&6; } + if test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"; then : + +$as_echo "#define HAVE_PTHREAD_PRIO_INHERIT 1" >>confdefs.h + +fi + LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" # More AIX lossage: must compile with xlc_r or cc_r - if test x"$GCC" != xyes; then + if test x"$GCC" != xyes; then for ac_prog in xlc_r cc_r do # Extract the first word of "$ac_prog", so it can be a program name with args. @@ -8577,7 +8611,7 @@ test -n "$PTHREAD_CC" || PTHREAD_CC="${CC}" else PTHREAD_CC=$CC - fi + fi else PTHREAD_CC="$CC" fi @@ -8700,7 +8734,6 @@ fi # Enable support for OpenCL - ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -8802,9 +8835,9 @@ case "${host_cpu}-${host_os}" in ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags" ;; - *-darwin*) - ax_pthread_flags="-pthread $ax_pthread_flags" - ;; + *-darwin*) + ax_pthread_flags="-pthread $ax_pthread_flags" + ;; esac if test x"$ax_pthread_ok" = xno; then @@ -8822,8 +8855,8 @@ $as_echo_n "checking whether pthreads work with $flag... " >&6; } PTHREAD_CFLAGS="$flag" ;; - pthread-config) - # Extract the first word of "pthread-config", so it can be a program name with args. + pthread-config) + # Extract the first word of "pthread-config", so it can be a program name with args. set dummy pthread-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } @@ -8861,10 +8894,10 @@ $as_echo "no" >&6; } fi - if test x"$ax_pthread_config" = xno; then continue; fi - PTHREAD_CFLAGS="`pthread-config --cflags`" - PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" - ;; + if test x"$ax_pthread_config" = xno; then continue; fi + PTHREAD_CFLAGS="`pthread-config --cflags`" + PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" + ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$flag" >&5 @@ -8890,17 +8923,17 @@ $as_echo_n "checking for the pthreads library -l$flag... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include - static void routine(void* a) {a=0;} - static void* start_routine(void* a) {return a;} + static void routine(void *a) { a = 0; } + static void *start_routine(void *a) { return a; } int main () { pthread_t th; pthread_attr_t attr; - pthread_create(&th,0,start_routine,0); - pthread_join(th, 0); - pthread_attr_init(&attr); - pthread_cleanup_push(routine, 0); - pthread_cleanup_pop(0); + pthread_create(&th, 0, start_routine, 0); + pthread_join(th, 0); + pthread_attr_init(&attr); + pthread_cleanup_push(routine, 0); + pthread_cleanup_pop(0) /* ; */ ; return 0; } @@ -8933,17 +8966,17 @@ if test "x$ax_pthread_ok" = xyes; then CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5 $as_echo_n "checking for joinable pthread attribute... " >&6; } - attr_name=unknown - for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + attr_name=unknown + for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { -int attr=$attr; return attr; +int attr = $attr; return attr /* ; */ ; return 0; } @@ -8953,7 +8986,7 @@ if ac_fn_c_try_link "$LINENO"; then : fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - done + done { $as_echo "$as_me:${as_lineno-$LINENO}: result: $attr_name" >&5 $as_echo "$attr_name" >&6; } if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then @@ -8977,11 +9010,46 @@ $as_echo "${flag}" >&6; } PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PTHREAD_PRIO_INHERIT" >&5 +$as_echo_n "checking for PTHREAD_PRIO_INHERIT... " >&6; } +if ${ax_cv_PTHREAD_PRIO_INHERIT+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include +int +main () +{ +int i = PTHREAD_PRIO_INHERIT; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ax_cv_PTHREAD_PRIO_INHERIT=yes +else + ax_cv_PTHREAD_PRIO_INHERIT=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_PRIO_INHERIT" >&5 +$as_echo "$ax_cv_PTHREAD_PRIO_INHERIT" >&6; } + if test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"; then : + +$as_echo "#define HAVE_PTHREAD_PRIO_INHERIT 1" >>confdefs.h + +fi + LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" # More AIX lossage: must compile with xlc_r or cc_r - if test x"$GCC" != xyes; then + if test x"$GCC" != xyes; then for ac_prog in xlc_r cc_r do # Extract the first word of "$ac_prog", so it can be a program name with args. @@ -9027,7 +9095,7 @@ test -n "$PTHREAD_CC" || PTHREAD_CC="${CC}" else PTHREAD_CC=$CC - fi + fi else PTHREAD_CC="$CC" fi diff --git a/libtool b/libtool index b07ec29d5..025fcf37e 100755 --- a/libtool +++ b/libtool @@ -74,7 +74,7 @@ DLLTOOL="false" OBJDUMP="objdump" # Whether or not to build shared libraries. -build_libtool_libs=no +build_libtool_libs=yes # Whether or not to build static libraries. build_old_libs=yes @@ -83,7 +83,7 @@ build_old_libs=yes pic_mode=default # Whether or not to optimize for fast installation. -fast_install=needless +fast_install=yes # The host system. host_alias= @@ -323,7 +323,7 @@ link_static_flag="" compiler_c_o="yes" # Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=yes +build_libtool_need_lc=no # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=no diff --git a/m4/ax_pthread.m4 b/m4/ax_pthread.m4 index 2152a80a0..a6bf596c3 100644 --- a/m4/ax_pthread.m4 +++ b/m4/ax_pthread.m4 @@ -33,6 +33,10 @@ # has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name # (e.g. PTHREAD_CREATE_UNDETACHED on AIX). # +# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the +# PTHREAD_PRIO_INHERIT symbol is defined when compiling with +# PTHREAD_CFLAGS. +# # ACTION-IF-FOUND is a list of shell commands to run if a threads library # is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it # is not found. If ACTION-IF-FOUND is not specified, the default action @@ -45,9 +49,12 @@ # Alejandro Forero Cuervo to the autoconf macro repository. We are also # grateful for the helpful feedback of numerous users. # +# Updated for Autoconf 2.68 by Daniel Richard G. +# # LICENSE # # Copyright (c) 2008 Steven G. Johnson +# Copyright (c) 2011 Daniel Richard G. # # 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 @@ -75,13 +82,12 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 11 +#serial 16 AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) AC_DEFUN([AX_PTHREAD], [ AC_REQUIRE([AC_CANONICAL_HOST]) -AC_LANG_SAVE -AC_LANG_C +AC_LANG_PUSH([C]) ax_pthread_ok=no # We used to check for pthread.h first, but this fails if pthread.h @@ -153,9 +159,9 @@ case "${host_cpu}-${host_os}" in ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags" ;; - *-darwin*) - ax_pthread_flags="-pthread $ax_pthread_flags" - ;; + *-darwin*) + ax_pthread_flags="-pthread $ax_pthread_flags" + ;; esac if test x"$ax_pthread_ok" = xno; then @@ -171,12 +177,12 @@ for flag in $ax_pthread_flags; do PTHREAD_CFLAGS="$flag" ;; - pthread-config) - AC_CHECK_PROG(ax_pthread_config, pthread-config, yes, no) - if test x"$ax_pthread_config" = xno; then continue; fi - PTHREAD_CFLAGS="`pthread-config --cflags`" - PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" - ;; + pthread-config) + AC_CHECK_PROG(ax_pthread_config, pthread-config, yes, no) + if test x"$ax_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]) @@ -198,16 +204,17 @@ for flag in $ax_pthread_flags; do # pthread_cleanup_push because it is one of the few pthread # functions on Solaris that doesn't have a non-functional libc stub. # We try pthread_create on general principles. - AC_TRY_LINK([#include - static void routine(void* a) {a=0;} - static void* start_routine(void* a) {return a;}], - [pthread_t th; pthread_attr_t attr; - pthread_create(&th,0,start_routine,0); - pthread_join(th, 0); - pthread_attr_init(&attr); - pthread_cleanup_push(routine, 0); - pthread_cleanup_pop(0); ], - [ax_pthread_ok=yes]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include + static void routine(void *a) { a = 0; } + static void *start_routine(void *a) { return a; }], + [pthread_t th; pthread_attr_t attr; + pthread_create(&th, 0, start_routine, 0); + pthread_join(th, 0); + pthread_attr_init(&attr); + pthread_cleanup_push(routine, 0); + pthread_cleanup_pop(0) /* ; */])], + [ax_pthread_ok=yes], + []) LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" @@ -230,12 +237,14 @@ if test "x$ax_pthread_ok" = xyes; then CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. - AC_MSG_CHECKING([for joinable pthread attribute]) - attr_name=unknown - for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do - AC_TRY_LINK([#include ], [int attr=$attr; return attr;], - [attr_name=$attr; break]) - done + AC_MSG_CHECKING([for joinable pthread attribute]) + attr_name=unknown + for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], + [int attr = $attr; return 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, @@ -254,15 +263,25 @@ if test "x$ax_pthread_ok" = xyes; then PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" fi + AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT], + ax_cv_PTHREAD_PRIO_INHERIT, [ + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[#include ]], [[int i = PTHREAD_PRIO_INHERIT;]])], + [ax_cv_PTHREAD_PRIO_INHERIT=yes], + [ax_cv_PTHREAD_PRIO_INHERIT=no]) + ]) + AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"], + AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], 1, [Have PTHREAD_PRIO_INHERIT.])) + LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" # More AIX lossage: must compile with xlc_r or cc_r - if test x"$GCC" != xyes; then + if test x"$GCC" != xyes; then AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC}) else PTHREAD_CC=$CC - fi + fi else PTHREAD_CC="$CC" fi @@ -279,5 +298,5 @@ else ax_pthread_ok=no $2 fi -AC_LANG_RESTORE +AC_LANG_POP ])dnl AX_PTHREAD -- 2.40.0