Commit 257e38c82124454808687d1208629069109474ce

Ran Benita 2015-07-17T23:26:20

build: don't fail if linker version scripts are not supported Some platforms (such as OSX) do not support version scripts. In these platforms the symbols will not be versioned, but it is OK to omit them. https://github.com/xkbcommon/libxkbcommon/issues/24

diff --git a/Makefile.am b/Makefile.am
index 8e45ccb..eae2b29 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -97,7 +97,9 @@ libxkbcommon_la_SOURCES = \
 	src/utf8.h \
 	src/utils.c \
 	src/utils.h
+if HAVE_VERSION_SCRIPT
 libxkbcommon_la_LDFLAGS = -Wl,--version-script=${srcdir}/xkbcommon.map
+endif HAVE_VERSION_SCRIPT
 
 if ENABLE_X11
 pkgconfig_DATA += xkbcommon-x11.pc
@@ -111,7 +113,9 @@ lib_LTLIBRARIES += libxkbcommon-x11.la
 libxkbcommon_x11_la_CFLAGS = $(AM_CFLAGS) $(XCB_XKB_CFLAGS)
 libxkbcommon_x11_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/src/x11
 libxkbcommon_x11_la_LIBADD = libxkbcommon.la $(XCB_XKB_LIBS)
+if HAVE_VERSION_SCRIPT
 libxkbcommon_x11_la_LDFLAGS = -Wl,--version-script=${srcdir}/xkbcommon-x11.map
+endif HAVE_VERSION_SCRIPT
 
 libxkbcommon_x11_la_SOURCES = \
 	src/x11/keymap.c \
diff --git a/configure.ac b/configure.ac
index 136bee3..57e3fde 100644
--- a/configure.ac
+++ b/configure.ac
@@ -100,9 +100,11 @@ openbsd*)
 *)
     XORG_CHECK_LINKER_FLAGS([-Wl,--no-undefined], [have_no_undefined=yes]) ;;
 esac
-
 AM_CONDITIONAL([HAVE_NO_UNDEFINED], [test "x$have_no_undefined" = xyes])
 
+XORG_CHECK_LINKER_FLAGS([-Wl,--version-script="$srcdir/xkbcommon.map"], [have_version_script=yes])
+AM_CONDITIONAL([HAVE_VERSION_SCRIPT], [test "x$have_version_script" = xyes])
+
 AC_CHECK_LIB(rt, clock_gettime,
     [AC_SUBST(RT_LIBS, "-lrt")],
     [AC_SUBST(RT_LIBS, "")],