-dnl ####################### -*- Mode: M4 -*- ###########################
-dnl Copyright (C) 98, 1999 Matthew D. Langston <langston@SLAC.Stanford.EDU>
-dnl
-dnl This file is free software; you can redistribute it and/or modify it
-dnl under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This file is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this file; if not, write to:
-dnl
-dnl Free Software Foundation, Inc.
-dnl Suite 330
-dnl 59 Temple Place
-dnl Boston, MA 02111-1307, USA.
-dnl ####################################################################
+# 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