[Mesa-dev] [PATCH 01/24] Partially revert "automake: allow only shared builds"

Emil Velikov emil.l.velikov at gmail.com
Thu Mar 27 14:00:16 PDT 2014


Evidently at least static OSMesa is still used as shared one
causes substantial increase in the load time for some programs
that use it (from seconds up-to ~30min).

Rather than forcing everyone to use shared mesa, revert commit
a6efbac9fb502c4f0166e7a0680b6828e1f6926c and default to shared
build when both shared and static are disabled.

Reported-by: Burlen Loring <burlen.loring at gmail.com>
---
 configure.ac             | 30 +++++++++++++++++++++++-------
 install-gallium-links.mk |  2 ++
 install-lib-links.mk     |  2 ++
 3 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/configure.ac b/configure.ac
index 1e5e496..39330cf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -284,15 +284,18 @@ dnl Can't have static and shared libraries, default to static if user
 dnl explicitly requested. If both disabled, set to static since shared
 dnl was explicitly requested.
 case "x$enable_static$enable_shared" in
-xnoyes )
+xyesyes )
+    AC_MSG_WARN([Cannot build static and shared libraries, disabling shared])
+    enable_shared=no
     ;;
-* )
-    AC_MSG_WARN([Messa build supports only shared libraries, enabling shared])
+xnono )
+    AC_MSG_WARN([Cannot disable both static and shared libraries, enabling shared])
     enable_shared=yes
-    enable_static=no
     ;;
 esac
 
+AM_CONDITIONAL(BUILD_SHARED, test "x$enable_shared" = xyes)
+
 dnl
 dnl other compiler options
 dnl
@@ -773,6 +776,11 @@ PKG_CHECK_MODULES([LIBUDEV], [libudev >= $LIBUDEV_REQUIRED],
                   have_libudev=yes, have_libudev=no)
 
 if test "x$enable_dri" = xyes; then
+    # DRI must be shared, I think
+    if test "$enable_static" = yes; then
+        AC_MSG_ERROR([Cannot use static libraries for DRI drivers])
+    fi
+
     # not a hard requirement as swrast does not depend on it
     if test "x$have_libdrm" = xyes; then
         DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
@@ -1104,7 +1112,12 @@ x16|x32)
 esac
 
 if test "x$enable_osmesa" = xyes -o "x$enable_gallium_osmesa" = xyes; then
-    OSMESA_LIB_DEPS="-lm $PTHREAD_LIBS $SELINUX_LIBS $DLOPEN_LIBS"
+    # only link libraries with osmesa if shared
+    if test "$enable_static" = no; then
+        OSMESA_LIB_DEPS="-lm $PTHREAD_LIBS $SELINUX_LIBS $DLOPEN_LIBS"
+    else
+        OSMESA_LIB_DEPS=""
+    fi
     OSMESA_MESA_DEPS=""
     OSMESA_PC_LIB_PRIV="-lm $PTHREAD_LIBS $SELINUX_LIBS $DLOPEN_LIBS"
 fi
@@ -1153,8 +1166,11 @@ if test "x$enable_egl" = xyes; then
 
     AC_CHECK_FUNC(mincore, [DEFINES="$DEFINES -DHAVE_MINCORE"])
 
-    if test "x$enable_dri" = xyes; then
-        HAVE_EGL_DRIVER_DRI2=1
+    if test "$enable_static" != yes; then
+        if test "x$enable_dri" = xyes; then
+	    HAVE_EGL_DRIVER_DRI2=1
+	fi
+
     fi
 fi
 AM_CONDITIONAL(HAVE_EGL, test "x$enable_egl" = xyes)
diff --git a/install-gallium-links.mk b/install-gallium-links.mk
index 5ee923b..6ed8a24a 100644
--- a/install-gallium-links.mk
+++ b/install-gallium-links.mk
@@ -1,6 +1,7 @@
 # Provide compatibility with scripts for the old Mesa build system for
 # a while by putting a link to the driver into /lib of the build tree.
 
+if BUILD_SHARED
 if HAVE_COMPAT_SYMLINKS
 all-local : .libs/install-gallium-links
 
@@ -23,3 +24,4 @@ all-local : .libs/install-gallium-links
 		fi;						\
 	done && touch $@
 endif
+endif
diff --git a/install-lib-links.mk b/install-lib-links.mk
index 0e13719..09fb86a 100644
--- a/install-lib-links.mk
+++ b/install-lib-links.mk
@@ -1,6 +1,7 @@
 # Provide compatibility with scripts for the old Mesa build system for
 # a while by putting a link to the driver into /lib of the build tree.
 
+if BUILD_SHARED
 if HAVE_COMPAT_SYMLINKS
 all-local : .libs/install-mesa-links
 
@@ -14,3 +15,4 @@ all-local : .libs/install-mesa-links
 		fi;						\
 	done && touch $@
 endif
+endif
-- 
1.9.1



More information about the mesa-dev mailing list