-dnl Free Software Foundation, Inc.
-dnl Suite 330
-dnl 59 Temple Place
-dnl Boston, MA 02111-1307, USA.
-dnl ####################################################################
-
-dnl @synopsis FPTOOLS_HAVE_OPENGL
-dnl
-dnl Search for OpenGL. We search first for Mesa (a GPL'ed version of
-dnl OpenGL) before a vendor's version of OpenGL, unless we were
-dnl specifically asked not to with `--with-Mesa=no' or `--without-Mesa'.
-dnl
-dnl The four "standard" OpenGL libraries are searched for: "-lGL",
-dnl "-lGLU", "-lGLX" (or "-lMesaGL", "-lMesaGLU" as the case may be) and
-dnl "-lglut".
-dnl
-dnl All of the libraries that are found (since "-lglut" or "-lGLX" might
-dnl be missing) are added to the shell output variable "GL_LIBS", along
-dnl with any other libraries that are necessary to successfully link an
-dnl OpenGL application (e.g. the X11 libraries). Care has been taken to
-dnl make sure that all of the libraries in "GL_LIBS" are listed in the
-dnl proper order.
-dnl
-dnl Additionally, the shell output variable "GL_CFLAGS" is set to any
-dnl flags (e.g. "-I" flags) that are necessary to successfully compile
-dnl an OpenGL application.
-dnl
-dnl The following shell variable (which are not output variables) are
-dnl also set to either "yes" or "no" (depending on which libraries were
-dnl found) to help you determine exactly what was found.
-dnl
-dnl have_GL
-dnl have_GLU
-dnl have_GLX
-dnl have_glut
-dnl
-dnl A complete little toy "Automake `make distcheck'" package of how to
-dnl use this macro is available at:
-dnl
-dnl ftp://ftp.slac.stanford.edu/users/langston/autoconf/ac_opengl-0.01.tar.gz
-dnl
-dnl Please note that as the ac_opengl macro and the toy example evolves,
-dnl the version number increases, so you may have to adjust the above
-dnl URL accordingly.
-dnl
-dnl @version 0.01 $Id: aclocal.m4,v 1.71 2001/04/20 10:56:12 michaelw Exp $
-dnl @author Matthew D. Langston <langston@SLAC.Stanford.EDU>
-
-AC_DEFUN(FPTOOLS_HAVE_OPENGL,
-[
- AC_REQUIRE([AC_PROG_CC])
- AC_REQUIRE([AC_PATH_X])
- AC_REQUIRE([AC_PATH_XTRA])
- AC_REQUIRE([FPTOOLS_CHECK_LIBM])
-
-dnl Check for Mesa first, unless we were asked not to.
-dnl AC_HELP_STRING([--with-Mesa],
-dnl [Prefer the Mesa library over a vendors native OpenGL library (default=yes)],
-dnl with_Mesa_help_string)
-dnl AC_ARG_ENABLE(Mesa, $with_Mesa_help_string, use_Mesa=$enableval, use_Mesa=yes)
- AC_ARG_ENABLE(Mesa, [ --with-Mesa Prefer the Mesa library over a vendors native OpenGL library (default=yes)], use_Mesa=$enableval, use_Mesa=yes)
-
- if test x"$use_Mesa" = xyes; then
- GL_search_list="MesaGL GL opengl32"
- GLU_search_list="MesaGLU GLU glu32"
- GLX_search_list="MesaGLX GLX"
- else
- GL_search_list="GL opengl32 MesaGL"
- GLU_search_list="GLU glu32 MesaGLU"
- GLX_search_list="GLX MesaGLX"
- fi
-
- AC_LANG_SAVE
- AC_LANG_C
-
-dnl If we are running under X11 then add in the appropriate libraries.
- if ! test x"$no_x" = xyes; then
-dnl Add everything we need to compile and link X programs to GL_CFLAGS
-dnl and GL_X_LIBS.
- GL_CFLAGS="$X_CFLAGS"
- GL_X_LIBS="$X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS $LIBM"
- fi
- GL_save_CPPFLAGS="$CPPFLAGS"
- CPPFLAGS="$GL_CFLAGS"
-
- GL_save_LIBS="$LIBS"
- LIBS="$GL_X_LIBS"
-
- FPTOOLS_SEARCH_LIBS([#include <GL/gl.h>], glEnd, $GL_search_list, have_GL=yes, have_GL=no)
- FPTOOLS_SEARCH_LIBS([#include <GL/glu.h>], gluNewQuadric, $GLU_search_list, have_GLU=yes, have_GLU=no)
- FPTOOLS_SEARCH_LIBS([#include <GL/glx.h>], glXChooseVisual, $GLX_search_list, have_GLX=yes, have_GLX=no)
- FPTOOLS_SEARCH_LIBS([#include <GL/glut.h>], glutMainLoop, glut glut32, have_glut=yes, have_glut=no)
-
- if test -n "$LIBS"; then
- GL_LIBS="$LIBS"
- else
- GL_LIBS=
- GL_CFLAGS=
- fi
-
- AC_CACHE_CHECK([OpenGL flags], mdl_cv_gl_cflags, [mdl_cv_gl_cflags="$GL_CFLAGS"])
- GL_CFLAGS="$mdl_cv_gl_cflags"
- AC_SUBST(GL_CFLAGS)
- AC_CACHE_CHECK([OpenGL libs], mdl_cv_gl_libs, [mdl_cv_gl_libs="$GL_LIBS"])
- GL_LIBS="$mdl_cv_gl_libs"
- AC_SUBST(GL_LIBS)
-
-dnl Reset GL_X_LIBS regardless, since it was just a temporary variable
-dnl and we don't want to be global namespace polluters.
- GL_X_LIBS=
-
- LIBS="$GL_save_LIBS"
- CPPFLAGS="$GL_save_CPPFLAGS"
-
- AC_LANG_RESTORE
+AC_DEFUN(FP_DIRENT_FLAT_LAYOUT,
+[AC_CACHE_CHECK([if struct dirent layout is flat], fptools_cv_dirent_flat_layout,
+[AC_TRY_RUN([#include <dirent.h>
+#include <stdio.h>
+#include <string.h>
+int
+main(argc, argv)
+int argc;
+char **argv;
+{
+ struct dirent de;
+ /*
+ * Check whether d_name is defined as
+ * struct dirent { .... ; char d_name[..]; }
+ * or
+ * struct dirent { .... ; char* d_name; }
+ *
+ * Returns 0 if the former.
+ */
+ memset(&de,0,sizeof(struct dirent));
+ return ((int)de.d_name == 0);
+}],fptools_cv_dirent_flat_layout=yes, fptools_cv_dirent_flat_layout=no, fptools_cv_dirent_flat_layout=yes)])
+dnl the cross value is somewhat bogus.
+if test "$fptools_cv_dirent_flat_layout" = yes; then
+AC_DEFINE([STRUCT_DIRENT_FLAT_LAYOUT], [1], [Define to 1 if struct dirent is a flat structure])
+fi