Alan Coopersmith wrote:
> I've also got some autoconfig improvements for Solaris I've had
> sitting here for a while and should finish getting ready to push,
> but I'll understand if it's a bit late for those.

Attached are the autoconfig/mklib changes, cherry-picked back to the
7.4 branch (with the merge conflict against the master version with
the EGL changes resolved) and another simple fix needed to allow
building with non-gcc compilers after the glheader.h removal took
away the #define they were using for __builtin_expect compatibility
(also cherry-picked from the master set I sent for review this
evening).

These work for me on Solaris, and I didn't see any other OS using
$OS_LIBS in configure.ac, but I haven't tested on other OS'es.

-- 
        -Alan Coopersmith-           [email protected]
         Sun Microsystems, Inc. - X Window System Engineering

>From b3f8fd08b4d8cb323aa2ba3c5fd19560fef26a98 Mon Sep 17 00:00:00 2001
From: Alan Coopersmith <[email protected]>
Date: Mon, 23 Mar 2009 16:51:54 -0700
Subject: [PATCH] mklib improvements for Solaris

Move flags for linking standard C/C++ libraries from configure.ac to mklib
Use -norunpath flag when linking with Sun C++ compiler
Convert mklib -exports list into a linker mapfile
Set FINAL_LIBS correctly when -noprefix is used

Signed-off-by: Alan Coopersmith <[email protected]>
---
 bin/mklib    |   28 +++++++++++++++++++++++++++-
 configure.ac |   33 +++++++++++----------------------
 2 files changed, 38 insertions(+), 23 deletions(-)

diff --git a/bin/mklib b/bin/mklib
index d7b740f..a3e826a 100755
--- a/bin/mklib
+++ b/bin/mklib
@@ -394,6 +394,30 @@ case $ARCH in
 		fi
 	    fi
 
+	    # If using Sun C++ compiler, need to tell it not to add runpaths
+	    # that are specific to the build machine
+	    if [ ${LINK} = "CC" ] ; then
+		OPTS="${OPTS} -norunpath"
+	    fi
+
+	    # Solaris linker requires explicitly listing the Standard C & C++
+	    # libraries in the link path when building shared objects
+	    if [ ${LINK} = "CC" ] ; then
+		DEPS="${DEPS} -lCrun"
+	    fi
+	    DEPS="${DEPS} -lc"
+
+	    if [ $EXPORTS ] ; then
+		# Make the 'mapfile.scope' linker mapfile
+		echo "{" > mapfile.scope
+		echo "global:" >> mapfile.scope
+		sed 's/$/;/' ${EXPORTS} >> mapfile.scope
+		echo "local:" >> mapfile.scope
+		echo "    *;" >> mapfile.scope
+		echo "};" >> mapfile.scope
+		OPTS="${OPTS} -Wl,-Mmapfile.scope"
+	    fi
+
 	    # Check if objects are SPARC v9
 	    # file says: ELF 64-bit MSB relocatable SPARCV9 Version 1
 	    set ${OBJECTS}
@@ -406,17 +430,19 @@ case $ARCH in
             if [ "${ALTOPTS}" ] ; then
                 OPTS=${ALTOPTS}
             fi
+
 	    # for debug:
 	    #echo "mklib: linker is" ${LINK} ${OPTS}
 	    if [ $NOPREFIX = 1 ] ; then
 		rm -f ${LIBNAME}
 		${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS}
+		FINAL_LIBS="${LIBNAME}"
 	    else
 		rm -f ${LIBNAME}.${MAJOR} ${LIBNAME}
 		${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME}.${MAJOR} -h ${LIBNAME}.${MAJOR} ${OBJECTS} ${DEPS}
 		ln -s ${LIBNAME}.${MAJOR} ${LIBNAME}
+		FINAL_LIBS="${LIBNAME}.${MAJOR} ${LIBNAME}"
 	    fi
-	    FINAL_LIBS="${LIBNAME}.${MAJOR} ${LIBNAME}"
 	fi
 	;;
 
diff --git a/configure.ac b/configure.ac
index c15e4f7..967545b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -346,17 +346,6 @@ if test "x$enable_selinux" = "xyes"; then
     DEFINES="$DEFINES -DMESA_SELINUX"
 fi
 
-dnl OS-specific libraries
-OS_LIBS=""
-case "$host_os" in
-solaris*)
-    OS_LIBS="-lc"
-    if test "x$GXX" != xyes; then
-        OS_CPLUSPLUS_LIBS="-lCrun $OS_LIBS"
-    fi
-    ;;
-esac
-
 dnl
 dnl Driver configuration. Options are xlib, dri and osmesa right now.
 dnl More later: directfb, fbdev, ...
@@ -518,8 +507,8 @@ xlib)
         GL_PC_LIB_PRIV="$GL_LIB_DEPS"
         GL_PC_CFLAGS="$X11_INCLUDES"
     fi
-    GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread $OS_LIBS"
-    GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread $OS_LIBS"
+    GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread"
+    GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread"
 
     # if static, move the external libraries to the programs
     # and empty the libraries for libGL
@@ -569,12 +558,12 @@ dri)
     fi
 
     # need DRM libs, -lpthread, etc.
-    GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS $OS_LIBS"
-    GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS $OS_LIBS"
+    GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
+    GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
     ;;
 osmesa)
     # No libGL for osmesa
-    GL_LIB_DEPS="$OS_LIBS"
+    GL_LIB_DEPS=""
     ;;
 esac
 AC_SUBST([GL_LIB_DEPS])
@@ -817,9 +806,9 @@ osmesa)
     ;;
 esac
 if test "$enable_static" = no; then
-    OSMESA_LIB_DEPS="$OSMESA_LIB_DEPS $OS_LIBS"
+    OSMESA_LIB_DEPS="$OSMESA_LIB_DEPS"
 fi
-OSMESA_PC_LIB_PRIV="$OSMESA_PC_LIB_PRIV $OS_LIBS"
+OSMESA_PC_LIB_PRIV="$OSMESA_PC_LIB_PRIV"
 AC_SUBST([OSMESA_LIB_DEPS])
 AC_SUBST([OSMESA_MESA_DEPS])
 AC_SUBST([OSMESA_PC_REQ])
@@ -932,10 +921,10 @@ if test "x$enable_glw" = xyes; then
     fi
 
     # If static, empty GLW_LIB_DEPS and add libs for programs to link
-    GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV $OS_LIBS"
+    GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV"
     if test "$enable_static" = no; then
         GLW_MESA_DEPS='-l$(GL_LIB)'
-        GLW_LIB_DEPS="$GLW_LIB_DEPS $OS_LIBS"
+        GLW_LIB_DEPS="$GLW_LIB_DEPS"
     else
         APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
         GLW_LIB_DEPS=""
@@ -991,8 +980,8 @@ if test "x$enable_glut" = xyes; then
         GLUT_PC_LIB_PRIV="$GLUT_LIB_DEPS"
         GLUT_PC_CFLAGS="$X11_INCLUDES"
     fi
-    GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm $OS_LIBS"
-    GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm $OS_LIBS"
+    GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
+    GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm"
 
     # If glut is available, we can build most programs
     if test "$with_demos" = yes; then
-- 
1.5.6.5

>From 101a71089fadd2479948b9fec8f2f9fb120f30cd Mon Sep 17 00:00:00 2001
From: Alan Coopersmith <[email protected]>
Date: Mon, 23 Mar 2009 20:35:09 -0700
Subject: [PATCH] define __builtin_expect for non-gcc compilers in two more glx files

Signed-off-by: Alan Coopersmith <[email protected]>
---
 src/glx/x11/indirect_vertex_program.c |    4 ++++
 src/glx/x11/pixelstore.c              |    4 ++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/glx/x11/indirect_vertex_program.c b/src/glx/x11/indirect_vertex_program.c
index 865a4b1..3313ac0 100644
--- a/src/glx/x11/indirect_vertex_program.c
+++ b/src/glx/x11/indirect_vertex_program.c
@@ -30,6 +30,10 @@
 #include "indirect_vertex_array.h"
 #include <GL/glxproto.h>
 
+#if !defined __GNUC__ || __GNUC__ < 3
+#  define __builtin_expect(x, y) x
+#endif
+
 static void
 do_vertex_attrib_enable(GLuint index, GLboolean val)
 {
diff --git a/src/glx/x11/pixelstore.c b/src/glx/x11/pixelstore.c
index 0eb31bf..8b51b5d 100644
--- a/src/glx/x11/pixelstore.c
+++ b/src/glx/x11/pixelstore.c
@@ -31,6 +31,10 @@
 #include "glxclient.h"
 #include "indirect.h"
 
+#if !defined __GNUC__ || __GNUC__ < 3
+#  define __builtin_expect(x, y) x
+#endif
+
 /**
  * Send glPixelStore command to the server
  * 
-- 
1.5.6.5

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to