]> granicus.if.org Git - libjpeg-turbo/commitdiff
Emulate the version script in libjpeg v7/v8 shared libraries
authorDRC <dcommander@users.sourceforge.net>
Tue, 19 Oct 2010 06:38:57 +0000 (06:38 +0000)
committerDRC <dcommander@users.sourceforge.net>
Tue, 19 Oct 2010 06:38:57 +0000 (06:38 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@285 632fc199-4ca6-4c93-a231-07263d6284db

Makefile.am
configure.ac
libjpeg.map.in [new file with mode: 0644]

index e3b8314ed0391e22e3ee50517f212a11cf9cd31c..9eef5d261befe5690d02617b9542b1d90feedbf0 100644 (file)
@@ -19,9 +19,15 @@ libjpeg_la_SOURCES = $(HDRS) jcapimin.c jcapistd.c jccoefct.c jccolor.c \
 libturbojpeg_la_SOURCES = $(libjpeg_la_SOURCES) turbojpegl.c turbojpeg.h \
        turbojpeg-mapfile
 
+if ANON_VERSION_SCRIPT
+
+libturbojpeg_la_LDFLAGS += $(ANON_VERSION_SCRIPT_FLAG)$(srcdir)/turbojpeg-mapfile
+
+endif
+
 if VERSION_SCRIPT
 
-libturbojpeg_la_LDFLAGS += $(VERSION_SCRIPT_FLAG)$(srcdir)/turbojpeg-mapfile
+libjpeg_la_LDFLAGS += $(VERSION_SCRIPT_FLAG)libjpeg.map
 
 endif
 
@@ -91,7 +97,7 @@ TESTFILES= testorig.jpg testorig.ppm testimg.bmp testimgflt.jpg \
        testimgint.ppm testimgflt-nosimd.jpg testimgcrop.jpg
 
 EXTRA_DIST = win release $(DOCS) $(TESTFILES) CMakeLists.txt \
-       sharedlib/CMakeLists.txt cmakescripts
+       sharedlib/CMakeLists.txt cmakescripts libjpeg.map.in
 
 dist-hook:
        rm -rf `find $(distdir) -name .svn`
index 6d0e5bdbf8f753c686104bf5edce08d798354f08..782ae19999defce3be03b3b83187fdd1cb528d07 100644 (file)
@@ -28,27 +28,6 @@ AC_MSG_RESULT(yes),
 [AC_MSG_RESULT(no)
 AC_DEFINE([INCOMPLETE_TYPES_BROKEN],[1],[Compiler does not support pointers to undefined structures.])])
 
-AC_MSG_CHECKING([whether the linker supports version scripts])
-VERSION_SCRIPT=no
-LDVER=`$LD --help </dev/null 2>&1 | grep "\-\-version-script"`
-if test "$LDVER"; then
-  VERSION_SCRIPT=yes
-  VERSION_SCRIPT_FLAG=-Wl,--version-script,
-  AC_MSG_RESULT(yes)
-else
-  LDVER=`$LD --help </dev/null 2>&1 | grep "\-M"`
-  if test "$LDVER"; then
-    VERSION_SCRIPT=yes
-    VERSION_SCRIPT_FLAG=-Wl,-M,
-    AC_MSG_RESULT(yes)
-  else
-    AC_MSG_RESULT(no)
-  fi
-fi
-
-AM_CONDITIONAL(VERSION_SCRIPT, test "x$VERSION_SCRIPT" = "xyes")
-AC_SUBST(VERSION_SCRIPT_FLAG)
-
 if test "x${GCC}" = "xyes"; then
   if test "x${SAVED_CFLAGS}" = "x"; then
     CFLAGS=-O3
@@ -149,6 +128,7 @@ if test "x$JPEG_LIB_VERSION" = "x"; then
     fi
 fi
 JPEG_LIB_VERSION_DECIMAL=`expr $JPEG_LIB_VERSION / 10`.`expr $JPEG_LIB_VERSION % 10`
+AC_SUBST(JPEG_LIB_VERSION_DECIMAL)
 AC_MSG_RESULT([$JPEG_LIB_VERSION_DECIMAL])
 AC_DEFINE_UNQUOTED(JPEG_LIB_VERSION, [$JPEG_LIB_VERSION], [libjpeg API version])
 
@@ -171,6 +151,66 @@ AC_MSG_RESULT([$SO_MAJOR_VERSION:$SO_MINOR_VERSION])
 AC_SUBST(SO_MAJOR_VERSION)
 AC_SUBST(SO_MINOR_VERSION)
 
+if test $JPEG_LIB_VERSION -lt 70; then
+  VERSION_SCRIPT=no
+else
+  VERSION_SCRIPT=yes
+  AC_ARG_ENABLE([ld-version-script],
+    AS_HELP_STRING([--disable-ld-version-script],
+      [Disable linker version script for libjpeg-turbo (default is to use linker version script when emulating libjpeg v7/v8b, if the linker supports it)]),
+      [VERSION_SCRIPT=$enableval], [])
+fi
+
+AC_MSG_CHECKING([whether the linker supports version scripts])
+SAVED_LDFLAGS="$LDFLAGS"
+LDFLAGS="$LDFLAGS -Wl,--version-script,conftest.map"
+cat > conftest.map <<EOF
+VERS_1 {
+  global: *;
+};
+EOF
+AC_LINK_IFELSE(AC_LANG_PROGRAM([], []),
+  [VERSION_SCRIPT_FLAG=-Wl,--version-script,; AC_MSG_RESULT([yes (GNU style)])], [])
+if test "x$VERSION_SCRIPT_FLAG" = "x"; then
+  LDFLAGS="$SAVED_LDFLAGS -Wl,-M,conftest.map"
+  AC_LINK_IFELSE(AC_LANG_PROGRAM([], []),
+    [VERSION_SCRIPT_FLAG=-Wl,-M,; AC_MSG_RESULT([yes (Sun style)])], [])
+fi
+if test "x$VERSION_SCRIPT_FLAG" = "x"; then
+  VERSION_SCRIPT=no
+  AC_MSG_RESULT(no)
+fi
+
+ANON_VERSION_SCRIPT=yes
+AC_MSG_CHECKING([whether the linker supports anonymous version scripts])
+LDFLAGS="$SAVED_LDFLAGS -Wl,--version-script,conftest.map"
+cat > conftest.map <<EOF
+{
+  global: main;
+  local: *;
+};
+EOF
+AC_LINK_IFELSE(AC_LANG_PROGRAM([], []),
+  [ANON_VERSION_SCRIPT_FLAG=-Wl,--version-script,; AC_MSG_RESULT([yes (GNU style)])], [])
+if test "x$ANON_VERSION_SCRIPT_FLAG" = "x"; then
+  LDFLAGS="$SAVED_LDFLAGS -Wl,-M,conftest.map"
+  AC_LINK_IFELSE(AC_LANG_PROGRAM([], []),
+    [ANON_VERSION_SCRIPT_FLAG=-Wl,-M,; AC_MSG_RESULT([yes (Sun style)])], [])
+fi
+if test "x$ANON_VERSION_SCRIPT_FLAG" = "x"; then
+  ANON_VERSION_SCRIPT=no
+  AC_MSG_RESULT(no)
+fi
+LDFLAGS="$SAVED_LDFLAGS"
+
+AC_MSG_CHECKING([whether to use version script when building libjpeg])
+AC_MSG_RESULT($VERSION_SCRIPT)
+
+AM_CONDITIONAL(VERSION_SCRIPT, test "x$VERSION_SCRIPT" = "xyes")
+AM_CONDITIONAL(ANON_VERSION_SCRIPT, test "x$ANON_VERSION_SCRIPT" = "xyes")
+AC_SUBST(VERSION_SCRIPT_FLAG)
+AC_SUBST(ANON_VERSION_SCRIPT_FLAG)
+
 # SIMD is optional
 AC_ARG_WITH([simd],
     AC_HELP_STRING([--without-simd],[Omit accelerated SIMD routines.]))
@@ -228,5 +268,6 @@ AC_DEFINE_UNQUOTED([BUILD], "$BUILD", [Build number])
 AC_CONFIG_HEADERS([config.h])
 AC_CONFIG_HEADERS([jconfig.h])
 AC_CONFIG_FILES([libjpeg-turbo.spec:release/libjpeg-turbo.spec.in])
+AC_CONFIG_FILES([libjpeg.map])
 AC_CONFIG_FILES([Makefile simd/Makefile])
 AC_OUTPUT
diff --git a/libjpeg.map.in b/libjpeg.map.in
new file mode 100644 (file)
index 0000000..f3e7ff8
--- /dev/null
@@ -0,0 +1,4 @@
+LIBJPEG_@JPEG_LIB_VERSION_DECIMAL@ {
+  global:
+    *;
+};