From 3c499aa2a70b06b40a64fb5699622ff458e4ee0f Mon Sep 17 00:00:00 2001
From: Kalev Lember <kalevlember@gmail.com>
Date: Sun, 25 Nov 2012 03:26:42 +0100
Subject: [PATCH] [GTK] Explicitly link against librt

Fixes broken build with undefined references to shm_open / shm_unlink
symbols. SharedMemoryUnix.cpp uses these so we need to link with -lrt.

https://bugs.webkit.org/show_bug.cgi?id=103194
---
 ChangeLog                     | 12 ++++++++++++
 Source/WebKit2/ChangeLog      | 12 ++++++++++++
 Source/WebKit2/GNUmakefile.am |  1 +
 configure.ac                  |  7 +++++++
 4 files changed, 32 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 547ddf5..ad5b382 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2012-11-24  Kalev Lember  <kalevlember@gmail.com>
+
+        [GTK] Explicitly link against librt
+        https://bugs.webkit.org/show_bug.cgi?id=103194
+
+        Reviewed by NOBODY (OOPS!).
+
+        Fixes broken build with undefined references to shm_open / shm_unlink
+        symbols. SharedMemoryUnix.cpp uses these so we need to link with -lrt.
+
+        * configure.ac:
+
 2012-11-23  Alexis Menard  <alexis@webkit.org>
 
         [CSS3 Backgrounds and Borders] Implement new CSS3 background-position parsing.
diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog
index ca80c82..97ba51a 100644
--- a/Source/WebKit2/ChangeLog
+++ b/Source/WebKit2/ChangeLog
@@ -1,3 +1,15 @@
+2012-11-24  Kalev Lember  <kalevlember@gmail.com>
+
+        [GTK] Explicitly link against librt
+        https://bugs.webkit.org/show_bug.cgi?id=103194
+
+        Reviewed by NOBODY (OOPS!).
+
+        Fixes broken build with undefined references to shm_open / shm_unlink
+        symbols. SharedMemoryUnix.cpp uses these so we need to link with -lrt.
+
+        * GNUmakefile.am:
+
 2012-11-24  Mikhail Pozdnyakov  <mikhail.pozdnyakov@intel.com>
 
         [EFL][WK2] Check errors in EwkView callbacks usage at compile time
diff --git a/Source/WebKit2/GNUmakefile.am b/Source/WebKit2/GNUmakefile.am
index 9a02bbd..c775990 100644
--- a/Source/WebKit2/GNUmakefile.am
+++ b/Source/WebKit2/GNUmakefile.am
@@ -572,6 +572,7 @@ Programs_WebKitPluginProcess_LDADD += \
 	$(PANGO_LIBS) \
 	$(PNG_LIBS) \
 	$(SHLWAPI_LIBS) \
+	$(SHM_LIBS) \
 	$(SQLITE3_LIBS) \
 	$(UNICODE_LIBS) \
 	$(XRENDER_LIBS) \
diff --git a/configure.ac b/configure.ac
index 4e1f0e8..97980e4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1118,6 +1118,13 @@ if test "$enable_webkit2" = "yes"; then
    if test "$have_gtk_unix_printing" = "yes"; then
        AC_DEFINE([HAVE_GTK_UNIX_PRINTING], [1], [Define if GTK+ UNIX Printing is available])
    fi
+
+   # On some Linux/Unix platforms, shm_* may only be available if linking
+   # against librt
+   if test "$os_win32" = "no"; then
+       AC_SEARCH_LIBS([shm_open], [rt], [SHM_LIBS="-lrt"])
+       AC_SUBST(SHM_LIBS)
+   fi
 fi
 
 # Plugin Process
-- 
1.8.0

