summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordevzero2000 <devzero2000>2010-11-10 17:02:25 +0000
committerdevzero2000 <devzero2000>2010-11-10 17:02:25 +0000
commit1fdf45347e673cdca9fc769632e4cfe0f1c2528f (patch)
treecf50214097c0ba502ac936c5874d39e569fdba19
parent6da936b49a812449bd5041555475f2f5446f89a3 (diff)
downloadlibpopt-1fdf45347e673cdca9fc769632e4cfe0f1c2528f.tar.gz
add version-script linker capability also for openindiana native ld
-rw-r--r--CHANGES1
-rw-r--r--Makefile.am2
-rwxr-xr-xconfigure.ac65
3 files changed, 54 insertions, 14 deletions
diff --git a/CHANGES b/CHANGES
index 654f22b..a2b933c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,5 @@
1.17 -> 2.0:
+ - devzero2000: add version-script linker capability also for openindiana native ld
- devzero2000: add test3 to the unit test, add color-tests automake option
- devzero2000: add tdict to the unit test: augment make check with some tdict tests
- devzero2000: add test2 to the unit test: augment make check with some test2 tests
diff --git a/Makefile.am b/Makefile.am
index aaef452..9095994 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -62,7 +62,7 @@ pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = popt.pc
if HAVE_LD_VERSION_SCRIPT
-libpopt_la_LDFLAGS += -Wl,--version-script=$(top_srcdir)/libpopt.vers
+libpopt_la_LDFLAGS += -Wl,@LD_VERSION_SCRIPT_FLAG@,@top_srcdir@/libpopt.vers
endif
dist_man_MANS = popt.3
diff --git a/configure.ac b/configure.ac
index c29eeb9..7037739 100755
--- a/configure.ac
+++ b/configure.ac
@@ -249,23 +249,62 @@ AC_CHECK_FUNCS([getuid geteuid iconv mtrace __secure_getenv setregid stpcpy stre
# drop AC_FUNC_MALLOC, REALLOC and STRTOD
AC_CHECK_FUNCS([malloc realloc strtod memset nl_langinfo stpcpy strchr strerror strrchr])
-# Checks for ld_version scripts
-# For some systems we know that we have ld_version scripts.
-# Use it then as default.
-have_ld_version_script=no
-case "${host}" in
- *-*-linux*)
- have_ld_version_script=yes
- ;;
- *-*-gnu*)
- have_ld_version_script=yes
- ;;
-esac
AC_ARG_ENABLE([ld-version-script],
AS_HELP_STRING([--enable-ld-version-script],[enable/disable use of linker version script.
(default is system dependent)]),
[have_ld_version_script=$enableval],
- [ : ] )
+ [have_ld_version_script=yes] )
+
+AS_IF([test "x$have_ld_version_script" = xyes],
+ [
+ dnl check for version script support in the linker (GNU ld, or Solaris ld style)
+ AC_CACHE_CHECK([for ld --version-script], [popt_cv_ld_version_script], [dnl
+ cat > conftest.c <<EOF
+void cl_symbol1(void) {}
+void cli_symbol2(void) {}
+EOF
+ cat > conftest.map <<EOF
+RELEASE
+{
+ global:
+ cl_*;
+ local:
+ *;
+};
+PRIVATE
+{
+ global:
+ cli_*;
+ local:
+ *;
+};
+EOF
+ dnl check for GNU ld style linker version script
+ if AC_TRY_COMMAND([${CC-cc} $CFLAGS $pic_flag $LDFLAGS -shared
+ -o conftest.so conftest.c
+ -Wl,--version-script,conftest.map
+ 1>&AS_MESSAGE_LOG_FD]);
+ then
+ LD_VERSION_SCRIPT_FLAG=--version-script
+ popt_cv_ld_version_script=yes
+ else
+ dnl check for Solaris ld style linker version script
+ if AC_TRY_COMMAND([${CC-cc} $CFLAGS $pic_flag $LDFLAGS -shared
+ -o conftest.so conftest.c
+ -Wl,-M,conftest.map
+ 1>&AS_MESSAGE_LOG_FD]);
+ then
+ LD_VERSION_SCRIPT_FLAG=-M
+ popt_cv_ld_version_script=yes;
+ else
+ popt_cv_ld_version_script=no
+ fi
+ fi
+ have_ld_version_script=$popt_cv_ld_version_script
+ rm -f conftest*])
+ ])
+
+AC_SUBST([LD_VERSION_SCRIPT_FLAG])
AM_CONDITIONAL([HAVE_LD_VERSION_SCRIPT],[test "$have_ld_version_script" = "yes"])
# Autofu for pkgconfig