-dnl @synopsis FPTOOLS_CHECK_LIBM
-dnl
-dnl Search for math library (typically -lm).
-dnl
-dnl The variable LIBM (which is not an output variable by default) is
-dnl set to a value which is suitable for use in a Makefile (for example,
-dnl in make's LOADLIBES macro) provided you AC_SUBST it first.
-dnl
-dnl @author Matthew D. Langston <langston@SLAC.Stanford.EDU>
-
-# FPTOOLS_CHECK_LIBM - check for math library
-AC_DEFUN(FPTOOLS_CHECK_LIBM,
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-LIBM=
-case "$host" in
-*-*-beos*)
- # These system don't have libm
- ;;
-*-ncr-sysv4.3*)
- AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
- AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
- ;;
-*)
- AC_CHECK_LIB(m, main, LIBM="-lm")
- ;;
-esac
-])
+# FP_PATH_XTRA
+# ------------
+# Same as AC_PATH_XTRA, but works even for broken Cygwins which try to include
+# the non-existant <gl/mesa_wgl.h> header when -mno-cygwin is used.
+AC_DEFUN([FP_PATH_XTRA],
+[AC_REQUIRE([FP_CHECK_WIN32])
+if test x"$is_win32" = xyes; then
+ no_x=yes
+else
+ AC_PATH_XTRA
+fi
+])# FP_PATH_XTRA
+
+
+# FP_CHECK_GL_HELPER(LIBNAME, LIBS, INCLUDES, FUNCTION-BODY)
+# ----------------------------------------------------------
+# Try each library in LIBS to successfully link INCLUDES plus FUNCTION-BODY,
+# setting LIBNAME_CFLAGS and LIBNAME_LIBS to the corresponding values. Sets
+# no_LIBNAME to "yes" if no suitable library was found. (LIBNAME_CFLAGS0
+# contains the value of LIBNAME_CFLAGS without CPPFLAGS, and LIBNAME_LIBS0
+# contains the value of LIBNAME_LIBS without LDFLAGS, but these are only
+# used internally.)
+AC_DEFUN([FP_CHECK_GL_HELPER],
+[AC_CACHE_CHECK([for $1 library], [fp_cv_check_$1_lib],
+ [fp_cv_check_$1_lib="no"
+ fp_save_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS ${$1_CFLAGS}"
+ fp_save_LIBS="$LIBS"
+ for fp_try_lib in $2; do
+ # transform "-lfoo" to "foo.lib" when using cl
+ if test x"$CC" = xcl; then
+ fp_try_lib=`echo $fp_try_lib | sed -e 's/^-l//' -e 's/$/.lib/'`
+ fi
+ LIBS="$fp_try_lib ${$1_LIBS} $fp_save_LIBS"
+ AC_TRY_LINK([$3], [$4], [fp_cv_check_$1_lib="$fp_try_lib ${$1_LIBS}"; break])
+ done
+ LIBS="$fp_save_LIBS"
+ CPPFLAGS="$fp_save_CPPFLAGS"])
+
+ if test x"$fp_cv_check_$1_lib" = xno; then
+ no_$1=yes
+ $1_CFLAGS=
+ $1_LIBS=
+ else
+ $1_CFLAGS0="${$1_CFLAGS}"
+ $1_CFLAGS="$CPPFLAGS ${$1_CFLAGS0}"
+ $1_LIBS0="$fp_cv_check_$1_lib"
+ $1_LIBS="$LDFLAGS ${$1_LIBS0}"
+ fi
+])# FP_CHECK_GL_HELPER