diff --git a/acinclude.m4 b/acinclude.m4 index dc93c294..d236a6bc 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -5,8 +5,26 @@ AC_DEFUN([LOC_MSG],[echo "$1"]) dnl --------------------------------------------------------------------------- dnl Available from the GNU Autoconf Macro Archive at: -dnl http://www.gnu.org/software/ac-archive/htmldoc/vl_prog_cc_warnings.html +dnl http://www.gnu.org/software/ac-archive/vl_prog_cc_warnings.html dnl --------------------------------------------------------------------------- + +dnl @synopsis VL_PROG_CC_WARNINGS([ANSI]) +dnl +dnl Enables a reasonable set of warnings for the C compiler. +dnl Optionally, if the first argument is nonempty, turns on flags which +dnl enforce and/or enable proper ANSI C if such are known with the +dnl compiler used. +dnl +dnl Currently this macro knows about GCC, Solaris C compiler, Digital +dnl Unix C compiler, C for AIX Compiler, HP-UX C compiler, IRIX C +dnl compiler, NEC SX-5 (Super-UX 10) C compiler, and Cray J90 (Unicos +dnl 10.0.0.8) C compiler. +dnl +dnl @category C +dnl @author Ville Laurikari +dnl @version 2002-04-04 +dnl @license AllPermissive + AC_DEFUN([VL_PROG_CC_WARNINGS], [ ansi=$1 if test -z "$ansi"; then @@ -118,10 +136,56 @@ EOF ]) ])dnl +dnl --------------------------------------------------------------------------- +dnl Available from the GNU Autoconf Macro Archive at: +dnl http://autoconf-archive.cryp.to/ax_lang_compiler_ms.html +dnl --------------------------------------------------------------------------- + +dnl @synopsis AX_LANG_COMPILER_MS +dnl +dnl Check whether the compiler for the current language is Microsoft. +dnl +dnl This macro is modeled after _AC_LANG_COMPILER_GNU in the GNU +dnl Autoconf implementation. +dnl +dnl @category InstalledPackages +dnl @author Braden McDaniel +dnl @version 2004-11-15 +dnl @license AllPermissive + +AC_DEFUN([AX_LANG_COMPILER_MS], +[AC_CACHE_CHECK([whether we are using the Microsoft _AC_LANG compiler], + [ax_cv_[]_AC_LANG_ABBREV[]_compiler_ms], +[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[#ifndef _MSC_VER + choke me +#endif +]])], + [ax_compiler_ms=yes], + [ax_compiler_ms=no]) +ax_cv_[]_AC_LANG_ABBREV[]_compiler_ms=$ax_compiler_ms +])]) + dnl --------------------------------------------------------------------------- dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/ax_check_gl.html dnl --------------------------------------------------------------------------- + +dnl @synopsis AX_CHECK_GL +dnl +dnl Check for an OpenGL implementation. If GL is found, the required +dnl compiler and linker flags are included in the output variables +dnl "GL_CFLAGS" and "GL_LIBS", respectively. This macro adds the +dnl configure option "--with-apple-opengl-framework", which users can +dnl use to indicate that Apple's OpenGL framework should be used on Mac +dnl OS X. If Apple's OpenGL framework is used, the symbol +dnl "HAVE_APPLE_OPENGL_FRAMEWORK" is defined. If no GL implementation +dnl is found, "no_gl" is set to "yes". +dnl +dnl @category InstalledPackages +dnl @author Braden McDaniel +dnl @version 2004-11-15 +dnl @license AllPermissive + AC_DEFUN([AX_CHECK_GL], [AC_REQUIRE([AC_PATH_X])dnl AC_REQUIRE([ACX_PTHREAD])dnl @@ -206,6 +270,23 @@ dnl --------------------------------------------------------------------------- dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/ax_check_glu.html dnl --------------------------------------------------------------------------- + +dnl @synopsis AX_CHECK_GLU +dnl +dnl Check for GLU. If GLU is found, the required preprocessor and +dnl linker flags are included in the output variables "GLU_CFLAGS" and +dnl "GLU_LIBS", respectively. This macro adds the configure option +dnl "--with-apple-opengl-framework", which users can use to indicate +dnl that Apple's OpenGL framework should be used on Mac OS X. If +dnl Apple's OpenGL framework is used, the symbol +dnl "HAVE_APPLE_OPENGL_FRAMEWORK" is defined. If no GLU implementation +dnl is found, "no_glu" is set to "yes". +dnl +dnl @category InstalledPackages +dnl @author Braden McDaniel +dnl @version 2004-11-15 +dnl @license AllPermissive + AC_DEFUN([AX_CHECK_GLU], [AC_REQUIRE([AX_CHECK_GL])dnl AC_REQUIRE([AC_PROG_CXX])dnl @@ -267,6 +348,22 @@ dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/ax_check_glut.html dnl --------------------------------------------------------------------------- +dnl @synopsis AX_CHECK_GLUT +dnl +dnl Check for GLUT. If GLUT is found, the required compiler and linker +dnl flags are included in the output variables "GLUT_CFLAGS" and +dnl "GLUT_LIBS", respectively. This macro adds the configure option +dnl "--with-apple-opengl-framework", which users can use to indicate +dnl that Apple's OpenGL framework should be used on Mac OS X. If +dnl Apple's OpenGL framework is used, the symbol +dnl "HAVE_APPLE_OPENGL_FRAMEWORK" is defined. If GLUT is not found, +dnl "no_glut" is set to "yes". +dnl +dnl @category InstalledPackages +dnl @author Braden McDaniel +dnl @version 2004-11-15 +dnl @license AllPermissive + AC_DEFUN([AX_CHECK_GLUT], [AC_REQUIRE([AX_CHECK_GLU])dnl AC_REQUIRE([AC_PATH_XTRA])dnl @@ -332,8 +429,55 @@ AC_SUBST([GLUT_LIBS]) dnl --------------------------------------------------------------------------- dnl Available from the GNU Autoconf Macro Archive at: -dnl http://www.gnu.org/software/ac-archive/htmldoc/acx_pthread.html +dnl http://www.gnu.org/software/ac-archive/acx_pthread.html dnl --------------------------------------------------------------------------- + +dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-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 +dnl @version 2005-01-14 +dnl @license GPLWithACException + AC_DEFUN([ACX_PTHREAD], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_LANG_SAVE @@ -475,36 +619,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). - AC_MSG_CHECKING([for joinable pthread attribute]) - AC_TRY_LINK([#include ], - [int attr=PTHREAD_CREATE_JOINABLE;], - ok=PTHREAD_CREATE_JOINABLE, ok=unknown) - if test x"$ok" = xunknown; then - AC_TRY_LINK([#include ], - [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]) + # 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;], + [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";; + *-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" + PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" fi LIBS="$save_LIBS" diff --git a/configure b/configure index db4e3389..9b5763d9 100755 --- a/configure +++ b/configure @@ -25550,11 +25550,12 @@ 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). - echo "$as_me:$LINENO: checking for joinable pthread attribute" >&5 + # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. + echo "$as_me:$LINENO: checking for joinable pthread attribute" >&5 echo $ECHO_N "checking for joinable pthread attribute... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF + attr_name=unknown + for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -25564,7 +25565,7 @@ cat >>conftest.$ac_ext <<_ACEOF int main () { -int attr=PTHREAD_CREATE_JOINABLE; +int attr=$attr; ; return 0; } @@ -25590,87 +25591,36 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ok=PTHREAD_CREATE_JOINABLE + attr_name=$attr; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ok=unknown fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - if test x"$ok" = xunknown; then - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -int -main () -{ -int attr=PTHREAD_CREATE_UNDETACHED; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ok=PTHREAD_CREATE_UNDETACHED -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + done + echo "$as_me:$LINENO: result: $attr_name" >&5 +echo "${ECHO_T}$attr_name" >&6 + if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then -ok=unknown -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi - if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then - -cat >>confdefs.h <<\_ACEOF -#define PTHREAD_CREATE_JOINABLE $ok +cat >>confdefs.h <<_ACEOF +#define PTHREAD_CREATE_JOINABLE $attr_name _ACEOF fi - echo "$as_me:$LINENO: result: ${ok}" >&5 -echo "${ECHO_T}${ok}" >&6 - if test x"$ok" = xunknown; then - { echo "$as_me:$LINENO: WARNING: we do not know how to create joinable pthreads" >&5 -echo "$as_me: WARNING: we do not know how to create joinable pthreads" >&2;} - fi echo "$as_me:$LINENO: checking if more special flags are required for pthreads" >&5 echo $ECHO_N "checking if more special flags are required for pthreads... $ECHO_C" >&6 flag=no case "${host_cpu}-${host_os}" in - *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";; - *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; + *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";; + *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; esac echo "$as_me:$LINENO: result: ${flag}" >&5 echo "${ECHO_T}${flag}" >&6 if test "x$flag" != xno; then - PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" + PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" fi LIBS="$save_LIBS" @@ -25767,7 +25717,63 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu - AX_LANG_COMPILER_MS + echo "$as_me:$LINENO: checking whether we are using the Microsoft C compiler" >&5 +echo $ECHO_N "checking whether we are using the Microsoft C compiler... $ECHO_C" >&6 +if test "${ax_cv_c_compiler_ms+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef _MSC_VER + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ax_compiler_ms=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ax_compiler_ms=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ax_cv_c_compiler_ms=$ax_compiler_ms + +fi +echo "$as_me:$LINENO: result: $ax_cv_c_compiler_ms" >&5 +echo "${ECHO_T}$ax_cv_c_compiler_ms" >&6 if test X$ax_compiler_ms = Xno; then GL_CFLAGS="${PTHREAD_CFLAGS}" GL_LIBS="${PTHREAD_LIBS} -lm"