Add an --enable-motif option, which will enable the Motif widgets in
libGLw and link it with libXm. The Motif installation information will
be gathered from the motif-config script (this comes with LessTif) or
fallback to the standard autoconf checks.

To allow the location of the Motif headers to be set from configure, the
default setting of -I/usr/include/Motif1.2 has been moved into
configs/default and then passed to the Makefile through the MOTIF_CFLAGS
variable.
---
Dan

 I already pushed this since I think it works (build tested anyway), but
 thought I'd let anyone on the list comment if anything looked wrong.
 Plus, I think Donnie needs this for Gentoo and I wanted to make sure he
 saw it.

 configs/autoconf.in |    4 ++++
 configs/default     |    1 +
 configure.ac        |   30 ++++++++++++++++++++++++++++--
 src/glw/Makefile    |    2 +-
 4 files changed, 34 insertions(+), 3 deletions(-)

diff --git a/configs/autoconf.in b/configs/autoconf.in
index 8ed1c93..a3eaed5 100644
--- a/configs/autoconf.in
+++ b/configs/autoconf.in
@@ -66,6 +66,10 @@ USING_EGL = @USING_EGL@
 # Dependencies
 X11_INCLUDES = @X11_INCLUDES@
 
+# GLw motif setup
+GLW_SOURCES = @GLW_SOURCES@
+MOTIF_CFLAGS = @MOTIF_CFLAGS@
+
 # Library/program dependencies
 GL_LIB_DEPS = $(EXTRA_LIB_PATH) @GL_LIB_DEPS@
 OSMESA_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @OSMESA_MESA_DEPS@ \
diff --git a/configs/default b/configs/default
index 36dc483..31ba2f6 100644
--- a/configs/default
+++ b/configs/default
@@ -61,6 +61,7 @@ ASM_SOURCES =
 # GLw widget sources (Append "GLwMDrawA.c" here and add -lXm to GLW_LIB_DEPS in
 # order to build the Motif widget too)
 GLW_SOURCES = GLwDrawA.c
+MOTIF_CFLAGS = -I/usr/include/Motif1.2
 
 
 # Directories to build
diff --git a/configure.ac b/configure.ac
index acb29e4..9014f8e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -878,6 +878,12 @@ if test "x$enable_glw" = xyes && test "$mesa_driver" = 
osmesa; then
     AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
     enable_glw=no
 fi
+AC_ARG_ENABLE([motif],
+    [AS_HELP_STRING([--enable-motif],
+        [use Motif widgets in GLw @<:@default=disabled@:>@])],
+    [enable_motif="$enableval"],
+    [enable_motif=no])
+
 if test "x$enable_glw" = xyes; then
     SRC_DIRS="$SRC_DIRS glw"
     if test "$x11_pkgconfig" = yes; then
@@ -885,7 +891,25 @@ if test "x$enable_glw" = xyes; then
         GLW_LIB_DEPS="$GLW_LIBS"
     else
         # should check these...
-        GLW_LIB_DEPS="$X_LIBS -lX11 -lXt"
+        GLW_LIB_DEPS="$X_LIBS -lXt -lX11"
+    fi
+
+    GLW_SOURCES="GLwDrawA.c"
+    MOTIF_CFLAGS=
+    if test "x$enable_motif" = xyes; then
+        GLW_SOURCES="$GLW_SOURCES GLwMDrawA.c"
+        AC_PATH_PROG([MOTIF_CONFIG], [motif-config], [no])
+        if test "x$MOTIF_CONFIG" != xno; then
+            MOTIF_CFLAGS=`$MOTIF_CONFIG --cflags`
+            MOTIF_LIBS=`$MOTIF_CONFIG --libs`
+        else
+            AC_CHECK_HEADER([Xm/PrimitiveP.h], [],
+                [AC_MSG_ERROR([Can't locate Motif headers])])
+            AC_CHECK_LIB([Xm], [XmGetPixmap], [MOTIF_LIBS="-lXm"],
+                [AC_MSG_ERROR([Can't locate Motif Xm library])])
+        fi
+        # MOTIF_LIBS is prepended to GLW_LIB_DEPS since Xm needs Xt/X11
+        GLW_LIB_DEPS="$MOTIF_LIBS $GLW_LIB_DEPS"
     fi
 
     # If static, empty GLW_LIB_DEPS and add libs for programs to link
@@ -900,6 +924,8 @@ if test "x$enable_glw" = xyes; then
 fi
 AC_SUBST([GLW_LIB_DEPS])
 AC_SUBST([GLW_MESA_DEPS])
+AC_SUBST([GLW_SOURCES])
+AC_SUBST([MOTIF_CFLAGS])
 
 dnl
 dnl GLUT configuration
@@ -1025,7 +1051,7 @@ echo ""
 echo "        Shared libs:     $enable_shared"
 echo "        Static libs:     $enable_static"
 echo "        GLU:             $enable_glu"
-echo "        GLw:             $enable_glw"
+echo "        GLw:             $enable_glw (Motif: $enable_motif)"
 echo "        glut:            $enable_glut"
 
 dnl Programs
diff --git a/src/glw/Makefile b/src/glw/Makefile
index a9a1745..6a522ec 100644
--- a/src/glw/Makefile
+++ b/src/glw/Makefile
@@ -7,7 +7,7 @@ MAJOR = 1
 MINOR = 0
 TINY = 0
 
-INCDIRS = -I$(TOP)/include -I/usr/include/Motif1.2 $(X11_INCLUDES)
+INCDIRS = -I$(TOP)/include $(MOTIF_CFLAGS) $(X11_INCLUDES)
 
 
 OBJECTS = $(GLW_SOURCES:.c=.o)
-- 
1.5.6.2


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to