Disabled external gits
This commit is contained in:
		
							
								
								
									
										171
									
								
								cs440-acg/ext/openexr/OpenEXR/m4/compilelinkrun.m4
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										171
									
								
								cs440-acg/ext/openexr/OpenEXR/m4/compilelinkrun.m4
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,171 @@
 | 
			
		||||
dnl
 | 
			
		||||
dnl
 | 
			
		||||
dnl compilelinkrun.m4 - used to check whether a required package is properly 
 | 
			
		||||
dnl installed.  Compiles, links and runs a c++ test program that uses the 
 | 
			
		||||
dnl package to verify that the package is properly installed
 | 
			
		||||
dnl
 | 
			
		||||
dnl Expected arguments:
 | 
			
		||||
dnl $1: the name of the package we are testing, e.g. "OpenEXR"
 | 
			
		||||
dnl     used for informational messages, warnings & errors
 | 
			
		||||
dnl
 | 
			
		||||
dnl $2: the argument passed to configure specifying how to disable this test
 | 
			
		||||
dnl     for example:
 | 
			
		||||
dnl     $3 = "openexrtest" and 
 | 
			
		||||
dnl     "configure --disable-openexrtest" will skip the test
 | 
			
		||||
dnl
 | 
			
		||||
dnl $3: CXXFLAGS used by the test
 | 
			
		||||
dnl
 | 
			
		||||
dnl $4: LDFLAGS used by the test
 | 
			
		||||
dnl
 | 
			
		||||
dnl $5: include section of sourcecode for a c++ test program
 | 
			
		||||
dnl $6: body section of sourcecode for a c++ test program
 | 
			
		||||
dnl The test program should make use of a library that is supposed to 
 | 
			
		||||
dnl be tested.
 | 
			
		||||
dnl
 | 
			
		||||
dnl $7: the action to be perfomed if the test succeeds 
 | 
			
		||||
dnl     (e.g. AC_MSG_RESULT("OpenEXR test program succeeded"))
 | 
			
		||||
dnl
 | 
			
		||||
dnl $8   the action to be perfomed if the test fails
 | 
			
		||||
dnl     (e.g. AC_MSG_ERROR("OpenEXR test program failed"))
 | 
			
		||||
dnl
 | 
			
		||||
 | 
			
		||||
AC_DEFUN([AM_COMPILELINKRUN],
 | 
			
		||||
[
 | 
			
		||||
 | 
			
		||||
dnl create some local m4 "variables" so that we don't have to use numbers
 | 
			
		||||
define([arg_pkg_name],$1)
 | 
			
		||||
define([arg_disable],$2)
 | 
			
		||||
define([arg_cxxflags],$3)
 | 
			
		||||
define([arg_ldflags],$4)
 | 
			
		||||
define([arg_libs],$5)
 | 
			
		||||
define([arg_include_source],$6)
 | 
			
		||||
define([arg_body_source],$7)
 | 
			
		||||
define([arg_do_yes],$8)
 | 
			
		||||
define([arg_do_no],$9)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
dnl check arguments
 | 
			
		||||
AC_ARG_ENABLE(arg_disable, [  --disable-arg_disable  Do not try to compile and run a test arg_pkg_name program],, enable_programtest=yes)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
dnl
 | 
			
		||||
dnl if the test hasn't been disabled, then compile, link and run test program
 | 
			
		||||
dnl
 | 
			
		||||
  if test "x$enable_programtest" = "xyes" ; then
 | 
			
		||||
 | 
			
		||||
    dnl basic preliminary checks
 | 
			
		||||
    AC_MSG_CHECKING(for arg_pkg_name)
 | 
			
		||||
    test_runs="yes"
 | 
			
		||||
 | 
			
		||||
    dnl save settings and setup c++ before we start
 | 
			
		||||
    ac_save_CXXFLAGS="$CXXFLAGS"
 | 
			
		||||
    ac_save_LDFLAGS="$LDFLAGS"
 | 
			
		||||
    ac_save_LIBS="$LIBS"
 | 
			
		||||
    CXXFLAGS="$CXXFLAGS arg_cxxflags"
 | 
			
		||||
    LDFLAGS="$LDFLAGS arg_ldflags"
 | 
			
		||||
    LIBS="$LIBS arg_libs"
 | 
			
		||||
    AC_REQUIRE_CPP()
 | 
			
		||||
    AC_LANG_PUSH([C++])
 | 
			
		||||
    rm -f conf.testprogram
 | 
			
		||||
 | 
			
		||||
    dnl
 | 
			
		||||
    dnl first try a complete test - compile, link run
 | 
			
		||||
    dnl
 | 
			
		||||
    AC_RUN_IFELSE([AC_LANG_PROGRAM(arg_include_source,
 | 
			
		||||
                  arg_body_source; [[system("touch conf.testprogram"); ]])],
 | 
			
		||||
                  test_runs=yes,
 | 
			
		||||
                  test_runs=no,
 | 
			
		||||
                  [echo $ac_n "cross compiling; assumed OK... $ac_c"])
 | 
			
		||||
 | 
			
		||||
    if test "x$test_runs" = "xyes"  || test -f conf.testprogram ; then
 | 
			
		||||
       AC_MSG_RESULT(yes)
 | 
			
		||||
       ifelse([arg_do_yes], , :, [arg_do_yes])     
 | 
			
		||||
    else
 | 
			
		||||
       AC_MSG_RESULT(no)
 | 
			
		||||
       echo "*** Could not run the arg_pkg_name test program, checking why..."
 | 
			
		||||
 | 
			
		||||
       test_compiles="yes"
 | 
			
		||||
       test_links="yes"
 | 
			
		||||
 | 
			
		||||
       dnl
 | 
			
		||||
       dnl if the program did not run, attempt to compile only
 | 
			
		||||
       dnl
 | 
			
		||||
 | 
			
		||||
       AC_COMPILE_IFELSE([AC_LANG_PROGRAM(arg_include_source,
 | 
			
		||||
                                          arg_body_source ; )],
 | 
			
		||||
                      test_compiles=yes,
 | 
			
		||||
                      test_compiles=no)
 | 
			
		||||
 | 
			
		||||
       if test "x$test_compiles" = "xno" ; then
 | 
			
		||||
          echo "*** The test program could not be compiled.  Is arg_pkg_name installed?"
 | 
			
		||||
          echo "*** Check that the cflags (below) includes the arg_pkg_name include directory"
 | 
			
		||||
 | 
			
		||||
       else
 | 
			
		||||
          dnl
 | 
			
		||||
          dnl if the program did compile, try linking
 | 
			
		||||
          dnl
 | 
			
		||||
          AC_LINK_IFELSE([AC_LANG_PROGRAM(arg_include_source,
 | 
			
		||||
                                          arg_body_source ; )],
 | 
			
		||||
                         test_links=yes,
 | 
			
		||||
                         test_links=no)
 | 
			
		||||
 | 
			
		||||
          if test "x$test_links" = "xyes"; then
 | 
			
		||||
              echo "*** The test program compiled and staticly linked, but did not run. This "
 | 
			
		||||
              echo "*** usually means that the run-time linker is not finding arg_pkg_name or finding"
 | 
			
		||||
              echo "*** the wrong version of arg_pkg_name."
 | 
			
		||||
              echo "***"
 | 
			
		||||
              echo "*** If the linker is not finding arg_pkg_name, you'll need to set your"
 | 
			
		||||
              echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
 | 
			
		||||
              echo "*** to the installed location  Also, make sure you have run ldconfig if that"
 | 
			
		||||
              echo "*** is required on your system."
 | 
			
		||||
          else
 | 
			
		||||
              echo "*** The arg_pkg_name test program could be compiled, but could not be dynamically."
 | 
			
		||||
              echo "*** or statically linked."
 | 
			
		||||
              echo "***"
 | 
			
		||||
              echo "*** Make sure the LDFLAGS points to the location of the arg_pkg_name library."
 | 
			
		||||
              echo "*** (e.g. -L/usr/local/lib)."
 | 
			
		||||
              echo "*** If the run-time linker is not finding arg_pkg_name, you'll need to set your"
 | 
			
		||||
              echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
 | 
			
		||||
              echo "*** to the installed location  Also, make sure you have run ldconfig if that"
 | 
			
		||||
              echo "*** is required on your system."
 | 
			
		||||
          fi
 | 
			
		||||
       fi
 | 
			
		||||
 | 
			
		||||
       dnl
 | 
			
		||||
       dnl The test failed for some reason. Print out more info, 
 | 
			
		||||
       dnl unset flags  and signal an error.
 | 
			
		||||
       dnl
 | 
			
		||||
       echo "***"
 | 
			
		||||
       echo "*** Flags used by the test:"
 | 
			
		||||
       echo "***     cflags: $CXXFLAGS "
 | 
			
		||||
       echo "***     ldflags: $LDFLAGS"
 | 
			
		||||
       echo "***"
 | 
			
		||||
       echo "*** You can also run configure with --disable-arg_disable to skip this test."
 | 
			
		||||
 | 
			
		||||
       ifelse([arg_do_no], , :, [arg_do_no])
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    AC_LANG_POP([C++])
 | 
			
		||||
    CXXFLAGS="$ac_save_CXXFLAGS"
 | 
			
		||||
    LDFLAGS="$ac_save_LDFLAGS"
 | 
			
		||||
    LIBS="$ac_save_LIBS"
 | 
			
		||||
        
 | 
			
		||||
    dnl
 | 
			
		||||
    dnl clean up
 | 
			
		||||
    dnl
 | 
			
		||||
    rm -f conf.testprogram
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
dnl clean up local "variables"
 | 
			
		||||
undefine([arg_pkg_name])
 | 
			
		||||
undefine([arg_disable])
 | 
			
		||||
undefine([arg_cxxflags])
 | 
			
		||||
undefine([arg_ldflags])
 | 
			
		||||
undefine([arg_libs])
 | 
			
		||||
undefine([arg_include_source])
 | 
			
		||||
undefine([arg_body_source])
 | 
			
		||||
undefine([arg_do_yes])
 | 
			
		||||
undefine([arg_do_no])
 | 
			
		||||
 | 
			
		||||
])
 | 
			
		||||
							
								
								
									
										134
									
								
								cs440-acg/ext/openexr/OpenEXR/m4/path.pkgconfig.m4
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										134
									
								
								cs440-acg/ext/openexr/OpenEXR/m4/path.pkgconfig.m4
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,134 @@
 | 
			
		||||
AC_DEFUN([AM_PATH_PKGCONFIG],
 | 
			
		||||
[
 | 
			
		||||
 | 
			
		||||
dnl sets cflags and ldflags
 | 
			
		||||
dnl TEST_CXXFLAGS and TEST_LDFLAGS, by trying thes following
 | 
			
		||||
dnl until something works:
 | 
			
		||||
dnl
 | 
			
		||||
dnl 1 -  try the test_prefix
 | 
			
		||||
dnl 2 -  check whether pkgconfig can find values (unless --with-pkg-config=no)
 | 
			
		||||
dnl 3 -  use the prefix, if it is not the default
 | 
			
		||||
dnl 4 -  use defaults, /usr/local/include/OpenEXR and /usr/local/lib
 | 
			
		||||
dnl 
 | 
			
		||||
dnl 
 | 
			
		||||
dnl Expected arguments
 | 
			
		||||
dnl $1: arg_cxxflags - CXXFLAGS variable to set
 | 
			
		||||
dnl
 | 
			
		||||
dnl $2: arg-ldflags - LDFLAGS variable to set
 | 
			
		||||
dnl
 | 
			
		||||
dnl $3: package name (the package being checked), as requried by pkg-config
 | 
			
		||||
dnl 
 | 
			
		||||
dnl $4: arg_include_subdir 
 | 
			
		||||
dnl     the name of the subdirectory name that is tacked on to 
 | 
			
		||||
dnl     the end of the include path e.g. "OpenEXR" in 
 | 
			
		||||
dnl     /usr/local/include/OpenEXR
 | 
			
		||||
dnl 
 | 
			
		||||
dnl $5: arg_default_libs - default libraries, used if pkgconfig doesnt work
 | 
			
		||||
dnl
 | 
			
		||||
dnl $6: arg_test_prefix
 | 
			
		||||
dnl     the argument passed to configure specifying a directory to
 | 
			
		||||
dnl     be used in the CXX and LD flags for example: 
 | 
			
		||||
dnl     $2 = "openexr-prefix" and 
 | 
			
		||||
dnl     "configure --openexr-prefix=/usr/lib"
 | 
			
		||||
dnl     leads to CXX including "-I/usr/lib/OpenEXR"
 | 
			
		||||
dnl
 | 
			
		||||
 | 
			
		||||
dnl create some local m4 "variables" so that we don't have to use numbers
 | 
			
		||||
define([arg_cxxflags],$1)
 | 
			
		||||
define([arg_ldflags],$2)
 | 
			
		||||
define([arg_libs],$3)
 | 
			
		||||
define([arg_pkg_name],$4)
 | 
			
		||||
define([arg_include_subdir],$5)
 | 
			
		||||
define([arg_default_ldflags],$6)
 | 
			
		||||
define([arg_default_libs],$7)
 | 
			
		||||
define([arg_test_prefix],$8)
 | 
			
		||||
 | 
			
		||||
TEST_CXXFLAGS=""
 | 
			
		||||
TEST_LDFLAGS=""
 | 
			
		||||
TEST_LIBS=""
 | 
			
		||||
 | 
			
		||||
AC_ARG_WITH(arg_test_prefix,[  --with-arg_test_prefix=PFX  Prefix where tested libraries are supposed to be installed (optional)], test_prefix="$withval", test_prefix="NONE")
 | 
			
		||||
echo "test_prefix = $test_prefix"
 | 
			
		||||
 | 
			
		||||
AC_ARG_VAR(PKG_CONFIG, Path to pkg-config command)
 | 
			
		||||
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
 | 
			
		||||
AC_ARG_WITH(pkg-config,[  --with-pkg-config=PATH Specify which pkg-config to use (optional)], PKG_CONFIG="$withval",)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if test "x$test_prefix" != "xNONE" ; then
 | 
			
		||||
   echo "using arg_test_prefix to set arg_cxxflags, arg_ldflags and arg_libs:"
 | 
			
		||||
   for inc_dir in arg_include_subdir
 | 
			
		||||
   do
 | 
			
		||||
      TEST_CXXFLAGS="$TEST_CXXFLAGS -I$test_prefix/include/$inc_dir"
 | 
			
		||||
   done
 | 
			
		||||
   TEST_LDFLAGS="-L$test_prefix/lib"
 | 
			
		||||
   TEST_LDFLAGS="$TEST_LDFLAGS arg_default_ldflags"
 | 
			
		||||
   TEST_LIBS="arg_default_libs"
 | 
			
		||||
else
 | 
			
		||||
   dnl
 | 
			
		||||
   dnl Get the cflags and libraries from the arg_pkg_name package using 
 | 
			
		||||
   dnl pkg-config
 | 
			
		||||
   dnl
 | 
			
		||||
   dnl Note: the TEST_LIBS contains both the -L and the -l flags.  This means
 | 
			
		||||
   dnl the -L flags will appear twice on the command line, but we can not
 | 
			
		||||
   dnl limit it to --libs-only-l because it may include the "-pthread" flag.
 | 
			
		||||
   dnl 
 | 
			
		||||
   if test x$PKG_CONFIG != xno ; then
 | 
			
		||||
      echo "using pkg-config to set arg_cxxflags and arg_ldflags:"
 | 
			
		||||
      TEST_CXXFLAGS="`$PKG_CONFIG --cflags arg_pkg_name`"
 | 
			
		||||
      TEST_LDFLAGS="`$PKG_CONFIG --libs-only-L arg_pkg_name`"
 | 
			
		||||
      TEST_LIBS="`$PKG_CONFIG --libs arg_pkg_name`"
 | 
			
		||||
   else
 | 
			
		||||
      echo "Not using pkg-config."
 | 
			
		||||
      TEST_CXXFLAGS=""
 | 
			
		||||
      TEST_LDFLAGS=""
 | 
			
		||||
      TEST_LIBS=""
 | 
			
		||||
   fi
 | 
			
		||||
 | 
			
		||||
   dnl
 | 
			
		||||
   dnl if the flags are still not set, try a prefix and finally a default
 | 
			
		||||
   dnl
 | 
			
		||||
   if test -z "${TEST_CXXFLAGS}"; then
 | 
			
		||||
      TEST_CXXFLAGS=""
 | 
			
		||||
      if test "x$prefix" != "xNONE"; then
 | 
			
		||||
         echo "using prefix to set arg_cxxflags and arg_ldflags:"
 | 
			
		||||
         for inc_dir in arg_include_subdir
 | 
			
		||||
         do
 | 
			
		||||
            TEST_CXXFLAGS="$TEST_CXXFLAGS -I$prefix/include/$inc_dir"
 | 
			
		||||
         done
 | 
			
		||||
         TEST_LDFLAGS="-L$prefix/lib"
 | 
			
		||||
      else
 | 
			
		||||
         echo "using default as guess for arg_cxxflags and arg_ldflags:"
 | 
			
		||||
         for inc_dir in arg_include_subdir
 | 
			
		||||
         do
 | 
			
		||||
             TEST_CXXFLAGS="$TEST_CXXFLAGS -I/usr/local/include/$inc_dir"
 | 
			
		||||
         done
 | 
			
		||||
         TEST_LDFLAGS="arg_default_ldflags"
 | 
			
		||||
      fi
 | 
			
		||||
      TEST_LIBS="arg_default_libs"
 | 
			
		||||
   fi
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
echo "    arg_cxxflags = $TEST_CXXFLAGS"
 | 
			
		||||
echo "    arg_ldflags = $TEST_LDFLAGS"
 | 
			
		||||
echo "    arg_libs = $TEST_LIBS"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
AC_SUBST(arg_cxxflags, $TEST_CXXFLAGS)
 | 
			
		||||
AC_SUBST(arg_ldflags, $TEST_LDFLAGS)
 | 
			
		||||
AC_SUBST(arg_libs, $TEST_LIBS)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
dnl clean up local "variables"
 | 
			
		||||
undefine([arg_cxxflags])
 | 
			
		||||
undefine([arg_ldflags])
 | 
			
		||||
undefine([arg_libs])
 | 
			
		||||
undefine([arg_pkg_name])
 | 
			
		||||
undefine([arg_include_subdir])
 | 
			
		||||
undefine([arg_default_ldflags])
 | 
			
		||||
undefine([arg_default_libs])
 | 
			
		||||
undefine([arg_test_prefix])
 | 
			
		||||
 | 
			
		||||
])
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										291
									
								
								cs440-acg/ext/openexr/OpenEXR/m4/threads.m4
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										291
									
								
								cs440-acg/ext/openexr/OpenEXR/m4/threads.m4
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,291 @@
 | 
			
		||||
 | 
			
		||||
dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
 | 
			
		||||
dnl
 | 
			
		||||
dnl Modified by Wojciech Jarosz (2005) to include check for POSIX
 | 
			
		||||
dnl semaphore usability. Defines HAVE_POSIX_SEMAPHORES if found.
 | 
			
		||||
dnl
 | 
			
		||||
dnl This macro figures out how to build C programs using POSIX threads.
 | 
			
		||||
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
 | 
			
		||||
dnl C compiler flags that are needed. (The user can also force certain
 | 
			
		||||
dnl compiler flags/libs to be tested by setting these environment
 | 
			
		||||
dnl variables.)
 | 
			
		||||
dnl
 | 
			
		||||
dnl Also sets PTHREAD_CC to any special C compiler that is needed for
 | 
			
		||||
dnl multi-threaded programs (defaults to the value of CC otherwise).
 | 
			
		||||
dnl (This is necessary on AIX to use the special cc_r compiler alias.)
 | 
			
		||||
dnl
 | 
			
		||||
dnl NOTE: You are assumed to not only compile your program with these
 | 
			
		||||
dnl flags, but also link it with them as well. e.g. you should link
 | 
			
		||||
dnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS
 | 
			
		||||
dnl $LIBS
 | 
			
		||||
dnl
 | 
			
		||||
dnl If you are only building threads programs, you may wish to use
 | 
			
		||||
dnl these variables in your default LIBS, CFLAGS, and CC:
 | 
			
		||||
dnl
 | 
			
		||||
dnl        LIBS="$PTHREAD_LIBS $LIBS"
 | 
			
		||||
dnl        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
 | 
			
		||||
dnl        CC="$PTHREAD_CC"
 | 
			
		||||
dnl
 | 
			
		||||
dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
 | 
			
		||||
dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to
 | 
			
		||||
dnl that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
 | 
			
		||||
dnl
 | 
			
		||||
dnl ACTION-IF-FOUND is a list of shell commands to run if a threads
 | 
			
		||||
dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to
 | 
			
		||||
dnl run it if it is not found. If ACTION-IF-FOUND is not specified, the
 | 
			
		||||
dnl default action will define HAVE_PTHREAD.
 | 
			
		||||
dnl
 | 
			
		||||
dnl Please let the authors know if this macro fails on any platform, or
 | 
			
		||||
dnl if you have any other suggestions or comments. This macro was based
 | 
			
		||||
dnl on work by SGJ on autoconf scripts for FFTW (www.fftw.org) (with
 | 
			
		||||
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.
 | 
			
		||||
dnl We are also grateful for the helpful feedback of numerous users.
 | 
			
		||||
dnl
 | 
			
		||||
dnl @category InstalledPackages
 | 
			
		||||
dnl @author Steven G. Johnson <stevenj@alum.mit.edu>
 | 
			
		||||
dnl @version 2005-01-14
 | 
			
		||||
dnl @license GPLWithACException
 | 
			
		||||
 | 
			
		||||
AC_DEFUN([ACX_PTHREAD], [
 | 
			
		||||
AC_REQUIRE([AC_CANONICAL_HOST])
 | 
			
		||||
AC_LANG_SAVE
 | 
			
		||||
AC_LANG_C
 | 
			
		||||
acx_pthread_ok=no
 | 
			
		||||
 | 
			
		||||
# We used to check for pthread.h first, but this fails if pthread.h
 | 
			
		||||
# requires special compiler flags (e.g. on True64 or Sequent).
 | 
			
		||||
# It gets checked for in the link test anyway.
 | 
			
		||||
 | 
			
		||||
# First of all, check if the user has set any of the PTHREAD_LIBS,
 | 
			
		||||
# etcetera environment variables, and if threads linking works using
 | 
			
		||||
# them:
 | 
			
		||||
if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
 | 
			
		||||
        save_CFLAGS="$CFLAGS"
 | 
			
		||||
        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
 | 
			
		||||
        save_LIBS="$LIBS"
 | 
			
		||||
        LIBS="$PTHREAD_LIBS $LIBS"
 | 
			
		||||
        AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
 | 
			
		||||
        AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
 | 
			
		||||
        AC_MSG_RESULT($acx_pthread_ok)
 | 
			
		||||
        if test x"$acx_pthread_ok" = xno; then
 | 
			
		||||
                PTHREAD_LIBS=""
 | 
			
		||||
                PTHREAD_CFLAGS=""
 | 
			
		||||
        fi
 | 
			
		||||
        LIBS="$save_LIBS"
 | 
			
		||||
        CFLAGS="$save_CFLAGS"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# We must check for the threads library under a number of different
 | 
			
		||||
# names; the ordering is very important because some systems
 | 
			
		||||
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
 | 
			
		||||
# libraries is broken (non-POSIX).
 | 
			
		||||
 | 
			
		||||
# 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, 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 pthread-config"
 | 
			
		||||
 | 
			
		||||
# The ordering *is* (sometimes) important.  Some notes on the
 | 
			
		||||
# individual items follow:
 | 
			
		||||
 | 
			
		||||
# pthreads: AIX (must check this before -lpthread)
 | 
			
		||||
# none: in case threads are in libc; should be tried before -Kthread and
 | 
			
		||||
#       other compiler flags to prevent continual compiler warnings
 | 
			
		||||
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
 | 
			
		||||
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
 | 
			
		||||
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
 | 
			
		||||
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
 | 
			
		||||
# -pthreads: Solaris/gcc
 | 
			
		||||
# -mthreads: Mingw32/gcc, Lynx/gcc
 | 
			
		||||
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
 | 
			
		||||
#      doesn't hurt to check since this sometimes defines pthreads too;
 | 
			
		||||
#      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*)
 | 
			
		||||
 | 
			
		||||
        # On Solaris (at least, for some versions), libc contains stubbed
 | 
			
		||||
        # (non-functional) versions of the pthreads routines, so link-based
 | 
			
		||||
        # tests will erroneously succeed.  (We need to link with -pthread or
 | 
			
		||||
        # -lpthread.)  (The stubs are missing pthread_cleanup_push, or rather
 | 
			
		||||
        # a function called by this macro, so we could check for that, but
 | 
			
		||||
        # 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"
 | 
			
		||||
        ;;
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
if test x"$acx_pthread_ok" = xno; then
 | 
			
		||||
for flag in $acx_pthread_flags; do
 | 
			
		||||
 | 
			
		||||
        case $flag in
 | 
			
		||||
                none)
 | 
			
		||||
                AC_MSG_CHECKING([whether pthreads work without any flags])
 | 
			
		||||
                ;;
 | 
			
		||||
 | 
			
		||||
                -*)
 | 
			
		||||
                AC_MSG_CHECKING([whether pthreads work with $flag])
 | 
			
		||||
                PTHREAD_CFLAGS="$flag"
 | 
			
		||||
                PTHREAD_LIBS="$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"
 | 
			
		||||
                ;;
 | 
			
		||||
        esac
 | 
			
		||||
 | 
			
		||||
        save_LIBS="$LIBS"
 | 
			
		||||
        save_CFLAGS="$CFLAGS"
 | 
			
		||||
        LIBS="$PTHREAD_LIBS $LIBS"
 | 
			
		||||
        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
 | 
			
		||||
 | 
			
		||||
        # Check for various functions.  We must include pthread.h,
 | 
			
		||||
        # since some functions may be macros.  (On the Sequent, we
 | 
			
		||||
        # need a special flag -Kthread to make this header compile.)
 | 
			
		||||
        # We check for pthread_join because it is in -lpthread on IRIX
 | 
			
		||||
        # while pthread_create is in libc.  We check for pthread_attr_init
 | 
			
		||||
        # due to DEC craziness with -lpthreads.  We check for
 | 
			
		||||
        # 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 <pthread.h>],
 | 
			
		||||
                    [pthread_t th; pthread_join(th, 0);
 | 
			
		||||
                     pthread_attr_init(0); pthread_cleanup_push(0, 0);
 | 
			
		||||
                     pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
 | 
			
		||||
                    [acx_pthread_ok=yes])
 | 
			
		||||
 | 
			
		||||
        LIBS="$save_LIBS"
 | 
			
		||||
        CFLAGS="$save_CFLAGS"
 | 
			
		||||
 | 
			
		||||
        AC_MSG_RESULT($acx_pthread_ok)
 | 
			
		||||
        if test "x$acx_pthread_ok" = xyes; then
 | 
			
		||||
                break;
 | 
			
		||||
        fi
 | 
			
		||||
 | 
			
		||||
        PTHREAD_LIBS=""
 | 
			
		||||
        PTHREAD_CFLAGS=""
 | 
			
		||||
done
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Various other checks:
 | 
			
		||||
if test "x$acx_pthread_ok" = xyes; then
 | 
			
		||||
        save_LIBS="$LIBS"
 | 
			
		||||
        LIBS="$PTHREAD_LIBS $LIBS"
 | 
			
		||||
        save_CFLAGS="$CFLAGS"
 | 
			
		||||
        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 <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* | *-darwin*) flag="-D_THREAD_SAFE";;
 | 
			
		||||
            *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
 | 
			
		||||
        esac
 | 
			
		||||
        AC_MSG_RESULT(${flag})
 | 
			
		||||
        if test "x$flag" != xno; then
 | 
			
		||||
            PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
 | 
			
		||||
        fi
 | 
			
		||||
 | 
			
		||||
        LIBS="$save_LIBS"
 | 
			
		||||
        CFLAGS="$save_CFLAGS"
 | 
			
		||||
 | 
			
		||||
        # More AIX lossage: must compile with cc_r
 | 
			
		||||
        AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
 | 
			
		||||
else
 | 
			
		||||
        PTHREAD_CC="$CC"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
AC_SUBST(PTHREAD_LIBS)
 | 
			
		||||
AC_SUBST(PTHREAD_CFLAGS)
 | 
			
		||||
AC_SUBST(PTHREAD_CC)
 | 
			
		||||
 | 
			
		||||
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
 | 
			
		||||
if test x"$acx_pthread_ok" = xyes; then
 | 
			
		||||
        ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
 | 
			
		||||
        :
 | 
			
		||||
else
 | 
			
		||||
        acx_pthread_ok=no
 | 
			
		||||
        $2
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
AC_LANG_RESTORE
 | 
			
		||||
])dnl ACX_PTHREAD
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
dnl
 | 
			
		||||
dnl Posix Semaphore support
 | 
			
		||||
dnl
 | 
			
		||||
 | 
			
		||||
AC_DEFUN([AM_POSIX_SEM],
 | 
			
		||||
[
 | 
			
		||||
AC_ARG_ENABLE([posix-sem], AC_HELP_STRING([--disable-posix-sem],
 | 
			
		||||
    [do not attempt to use POSIX unnamed semaphores]))
 | 
			
		||||
 | 
			
		||||
am_posix_sem_ok=no
 | 
			
		||||
if test "${enable_posix_sem:-yes}" != "no"; then
 | 
			
		||||
    AC_CHECK_HEADERS([semaphore.h], [
 | 
			
		||||
	AC_SEARCH_LIBS(sem_init, [posix4 pthread], [
 | 
			
		||||
	    AC_MSG_CHECKING([whether to use POSIX unnamed semaphores])
 | 
			
		||||
	    AC_RUN_IFELSE([
 | 
			
		||||
		AC_LANG_PROGRAM([#include <semaphore.h>], [
 | 
			
		||||
		    sem_t mysem;
 | 
			
		||||
		    if (sem_init (&mysem, 1, 1) == 0)
 | 
			
		||||
		    {
 | 
			
		||||
			if (sem_wait (&mysem) == 0)
 | 
			
		||||
			{
 | 
			
		||||
			    sem_post (&mysem);
 | 
			
		||||
			    sem_destroy (&mysem);
 | 
			
		||||
			    return 0;
 | 
			
		||||
			}
 | 
			
		||||
		    }
 | 
			
		||||
		    return 1;
 | 
			
		||||
		])
 | 
			
		||||
		], [
 | 
			
		||||
		AC_MSG_RESULT([yes])
 | 
			
		||||
		am_posix_sem_ok=yes], [
 | 
			
		||||
		AC_MSG_RESULT([no (pshared not usable)])], [
 | 
			
		||||
		AC_MSG_RESULT([no (cannot check usability when cross compiling)])])
 | 
			
		||||
	])
 | 
			
		||||
    ])
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
 | 
			
		||||
if test x"$am_posix_sem_ok" = xyes; then
 | 
			
		||||
        ifelse([$1],,AC_DEFINE(HAVE_POSIX_SEMAPHORES),[$1])
 | 
			
		||||
        :
 | 
			
		||||
else
 | 
			
		||||
        am_posix_sem_ok=no
 | 
			
		||||
        $2
 | 
			
		||||
fi
 | 
			
		||||
])
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user