gnash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnash] NetBSD success


From: Chris Wareham
Subject: Re: [Gnash] NetBSD success
Date: Mon, 23 Jan 2006 21:42:57 +0000
User-agent: Mozilla Thunderbird 1.0.7 (X11/20060119)

Rob Savoye wrote:
Chris Wareham wrote:

The configure script is still unable to find the MesaGL or SDL_mixer
libraries, despite finding the core SDL libraries, which are in the same
place. I'm digging through the sdl.m4 and opengl.m4 macro files in the
hope of finding out why.


Hum... I just rewrote mad.m4 last night to be much better, and I think the best way to fix this is to use mad.m4 as a template, and reimplement the SDL (and OpenGL tests. If you're interested... hint, hint, ... :-) If not, I'll give it a shot later.


The new mad.m4 file is much more readable than the existing OpenGL or
SDL ones!

I've attached a patch for the OpenGL macros. I'm not very familiar with
writing tests for configure scripts - for instance, I was unsure whether
the AM_CHECK_LIB macro expects the second argument to be a library
function that takes no arguments. If so, then glEnd maybe a better
choice than glBegin. It works OK on my machine though.

I've amended the paths that the tests will check to include /usr/pkg,
which is where the Mesa libraries often live on NetBSD machines.

I'm not sure this is correct, but I don't have a Linux box to test on.
Should this really be linked to a configure test though, so that
config.h can include a HAS_MALLINFO definition?


Something like that. :-) I just wrote configure support for dmalloc (based on mad.m4), and I'm changing a few things around so the code will use the current settings.

    - rob -


If the attached patch is OK, then I don't mind doing similar work to the
SDL macros.

Chris
Index: macros/opengl.m4
===================================================================
RCS file: /sources/gnash/gnash/macros/opengl.m4,v
retrieving revision 1.4
diff -u -r1.4 opengl.m4
--- macros/opengl.m4    19 Jan 2006 23:50:11 -0000      1.4
+++ macros/opengl.m4    23 Jan 2006 21:40:25 -0000
@@ -1,4 +1,3 @@
-dnl Process this file with autoconf to produce a configure script.
 dnl
 dnl  Copyright (C) 2005, 2006 Free Software Foundation, Inc.
 dnl
@@ -16,72 +15,116 @@
 dnl  along with this program; if not, write to the Free Software
 dnl  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-dnl Check for OpenGL & [Glut | GLU]
-AC_DEFUN([AM_PATH_OPENGL], [
-
-dnl Add XML support, if specified.
+AC_DEFUN([AM_PATH_OPENGL],
+[
   AC_ARG_ENABLE(opengl, [  --disable-opengl           Disable support for 
OpenGL],
   [case "${enableval}" in
-    yes) opengl=no ;;
-    no)  pengl=yes ;;
+    yes) opengl=no  ;;
+    no)  opengl=yes ;;
     *)   AC_MSG_ERROR([bad value ${enableval} for disable-opengl option]) ;;
-  esac],opengl=yes)
-
-  AM_CONDITIONAL(OPENGL, test x$opengl = xyes)
+  esac], opengl=yes)
 
-  AC_ARG_WITH(opengl,[  --with-opengl=PFX   Prefix where opengl is installed 
(optional)], opengl_prefix="$withval", opengl_prefix="")
-  AC_ARG_WITH(opengl-libraries,[  --with-opengl-libraries=DIR   Directory 
where opengl library is installed (optional)], opengl_libraries="$withval", 
opengl_libraries="")
-  AC_ARG_WITH(opengl-includes,[  --with-opengl-includes=DIR   Directory where 
opengl header files are installed (optional)], opengl_includes="$withval", 
opengl_includes="")
-
-  if test "x$opengl_libraries" != "x" ; then
-    OPENGL_LIBS="-L$opengl_libraries -lxml2"
-  elif test "x$opengl_prefix" != "x" ; then
-    OPENGL_LIBS="-L$opengl_prefix/lib -lxml2"
-  fi
+  if test x"$opengl" = x"yes"; then
+    dnl Look for the headers.
+    AC_ARG_WITH(opengl_includes, [  --with-opengl-includes         directory 
where OpenGL headers are], with_opengl_includes=${withval})
+    AC_CACHE_VAL(ac_cv_path_opengl_includes,[
+    if test x"${with_opengl_includes}" != x ; then
+      if test -f ${with_opengl_includes}/GL/gl.h ; then
+        ac_cv_path_opengl_includes=`(cd ${with_opengl_includes}; pwd)`
+      else
+        AC_MSG_ERROR([${with_opengl_includes} directory doesn't contain GL.h])
+      fi
+    fi
+    ])
 
-  if test "x$opengl_includes" != "x" ; then
-    OPENGL_CFLAGS="-I$opengl_includes"
-  elif test "x$opengl_prefix" != "x" ; then
-    OPENGL_CFLAGS="-I$opengl_prefix/include"
-  fi
+    dnl If the include path hasn't been specified, go look for it.
+    if test x"${ac_cv_path_opengl_includes}" = x; then
+      AC_CHECK_HEADERS(gl.h, [ac_cv_path_opengl_includes=""],[
+      if test x"${ac_cv_path_opengl_includes}" = x; then
+        AC_MSG_CHECKING([for OpenGL headers])
+        incllist="/usr/include /usr/local/include /opt/include 
/usr/X11R6/include /usr/pkg/include .. ../.."
+
+        for i in $incllist; do
+          if test -f $i/GL/gl.h; then
+            if test x"$i" != x"/usr/include"; then
+              ac_cv_path_opengl_includes="-I$i"
+              break
+            else
+              ac_cv_path_opengl_includes=""
+              break
+            fi
+          fi
+        done
+      fi])
+    else
+      AC_MSG_RESULT(-I${ac_cv_path_opengl_includes})
+      if test x"${ac_cv_path_opengl_includes}" != x"/usr/include"; then
+        ac_cv_path_opengl_includes="-I${ac_cv_path_opengl_includes}"
+       else
+        ac_cv_path_opengl_includes=""
+      fi
+    fi
 
-  if test x"$opengl" = x"yes"; then
-    LIBS_SAVE="$LIBS"
-    LIBS="$LIBS $OPENGL_LIBS"
-    AC_CHECK_LIB(GL, glBegin)
-    LIBS="$LIBS_SAVE"
-    AC_CHECK_HEADERS(GL/gl.h)
-    AC_CHECK_LIB(GLU, gluPerspective)
-    if test x"$HAVE_GL" = x; then
-      AC_MSG_CHECKING(futher locations for OpenGL Header files)
-      dirlist="/usr/X11R6 /usr /usr/local /opt /home/latest"
-      for i in $dirlist; do
-        if test -f $i/include/GL/gl.h; then
-          OPENGL_CFLAGS=-I`(cd $i/include; pwd)`
-          break
-        fi
-      done
-      if test x"$OPENGL_CFLAGS" != x; then
-       AC_MSG_RESULT(yes)
+    if test x"${ac_cv_path_opengl_includes}" != x ; then
+      OPENGL_CFLAGS="${ac_cv_path_opengl_includes}"
+      AC_MSG_RESULT(${ac_cv_path_opengl_includes})
+    else
+      OPENGL_CFLAGS=""
+    fi
+
+    dnl Look for the libraries.
+    AC_ARG_WITH(opengl_lib, [  --with-opengl-libraries      directory where 
OpenGL libraries are], with_opengl_libraries=${withval})
+    AC_CACHE_VAL(ac_cv_path_opengl_libraries,[
+    if test x"${with_opengl_libraries}" != x ; then
+      if test -f ${with_opengl_libraries}/libGL.a -o -f 
${with_opengl_libraries}/libGL.so; then
+        ac_cv_path_opengl_libraries=`(cd ${with_opengl_libraries}; pwd)`
       else
-       AC_MSG_RESULT(no)
+        AC_MSG_ERROR([${with_opengl_libraries} directory doesn't contain 
libGL.])
       fi
-      AC_MSG_CHECKING(futher locations for OpenGL library files)
-      for i in $dirlist; do
-        if test -f $i/lib/libGL.a; then
-          OPENGL_LIBS="-L`(cd $i/lib; pwd)` -lGL -lGLU"
-          break
+    fi
+    ])
+
+    dnl If the header doesn't exist, there is no point looking for the library.
+    if test x"${ac_cv_path_opengl_libraries}" = x; then
+      AC_CHECK_LIB(GL, glBegin, [ac_cv_path_opengl_libraries="-lGL"],[
+        AC_MSG_CHECKING([for libGL library])
+        libslist="/usr/lib /usr/local/lib /opt/lib /usr/X11R6/lib /usr/pkg/lib 
.. ../.."
+        for i in $libslist; do
+          if test -f $i/libGL.a -o -f $i/libGL.so; then
+            if test x"$i" != x"/usr/lib"; then
+              ac_cv_path_opengl_libraries="-L$i"
+              AC_MSG_RESULT(${ac_cv_path_opengl_libraries})
+              break
+            else
+              ac_cv_path_opengl_libraries=""
+              AC_MSG_RESULT(yes)
+              break
+            fi
+          fi
+        done])
+    else
+      if test -f ${ac_cv_path_opengl_libraries}/libGL.a -o -f 
${ac_cv_path_opengl_libraries}/libGL.so; then
+        if test x"${ac_cv_path_opengl_libraries}" != x"/usr/lib"; then
+          ac_cv_path_opengl_libraries="-I${ac_cv_path_opengl_libraries}"
+         else
+          ac_cv_path_opengl_libraries=""
         fi
-      done
-      if test x"$OPENGL_LIBS" != x; then
-       AC_MSG_RESULT(yes)
-      else
-       AC_MSG_RESULT(no)
       fi
-    fi 
+    fi
+
+    if test x"${ac_cv_path_opengl_libraries}" != x ; then
+      OPENGL_LIBS="${ac_cv_path_opengl_libraries}"
+    else
+      OPENGL_LIBS=""
+    fi
+  fi
+
+  if test x"${ac_cv_path_opengl_libraries}" != x ; then
+      OPENGL_LIBS="${ac_cv_path_opengl_libraries}"
   fi
 
+  AM_CONDITIONAL(opengl, [test x$opengl = xyes])
+
   AC_SUBST(OPENGL_CFLAGS)
   AC_SUBST(OPENGL_LIBS)
-  AM_CONDITIONAL(HAVE_OPENGL, [test x$ac_use_opengl = "xyes"])
 ])

reply via email to

[Prev in Thread] Current Thread [Next in Thread]