xfs
[Top] [All Lists]

[PATCH 1/8] xfsdump: link with libpthread

To: xfs@xxxxxxxxxxx
Subject: [PATCH 1/8] xfsdump: link with libpthread
From: Bill Kendall <wkendall@xxxxxxx>
Date: Wed, 2 Nov 2011 16:10:47 -0500
Cc: Bill Kendall <wkendall@xxxxxxx>
In-reply-to: <1320268254-20583-1-git-send-email-wkendall@xxxxxxx>
References: <1320268254-20583-1-git-send-email-wkendall@xxxxxxx>
This patch changes xfsdump/xfsrestore to link with libpthread in
preparation for enabling multi-stream support. The libpthread checks
are the same as those used in xfsprogs.

Signed-off-by: Bill Kendall <wkendall@xxxxxxx>
---
 configure.in          |    3 +++
 dump/Makefile         |    2 +-
 include/builddefs.in  |    1 +
 m4/Makefile           |    1 +
 m4/package_pthread.m4 |   19 +++++++++++++++++++
 restore/Makefile      |    2 +-
 6 files changed, 26 insertions(+), 2 deletions(-)
 create mode 100644 m4/package_pthread.m4

diff --git a/configure.in b/configure.in
index b7ea1eb..8d4a256 100644
--- a/configure.in
+++ b/configure.in
@@ -67,6 +67,9 @@ AC_MULTILIB($enable_lib64)
 AC_PACKAGE_NEED_UUID_H
 AC_PACKAGE_NEED_UUIDCOMPARE
 
+AC_PACKAGE_NEED_PTHREAD_H
+AC_PACKAGE_NEED_PTHREADMUTEXINIT
+
 AC_PACKAGE_NEED_NCURSES_H
 AC_PACKAGE_WANT_WORKING_LIBNCURSES
 
diff --git a/dump/Makefile b/dump/Makefile
index ce964a0..d193f68 100644
--- a/dump/Makefile
+++ b/dump/Makefile
@@ -89,7 +89,7 @@ HFILES = $(LOCALINCL)
 LHFILES = $(COMMINCL) $(INVINCL)
 LINKS = $(COMMINCL) $(COMMON) $(INVINCL) $(INVCOMMON)
 LDIRT = $(LINKS)
-LLDLIBS = $(LIBUUID) $(LIBHANDLE) $(LIBATTR) $(LIBRMT)
+LLDLIBS = $(LIBUUID) $(LIBHANDLE) $(LIBATTR) $(LIBRMT) $(LIBPTHREAD)
 LTDEPENDENCIES = $(LIBRMT)
 
 LCFLAGS = -DDUMP
diff --git a/include/builddefs.in b/include/builddefs.in
index f69c038..d5cc8d3 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -16,6 +16,7 @@ CFLAGS = @CFLAGS@
 LIBRMT = $(TOPDIR)/librmt/librmt.la
 LIBXFS = @libxfs@
 LIBATTR = @libattr@
+LIBPTHREAD = @libpthread@
 LIBUUID = @libuuid@
 LIBCURSES = @libcurses@
 LIBHANDLE = @libhdl@
diff --git a/m4/Makefile b/m4/Makefile
index 8ce63f8..9a35056 100644
--- a/m4/Makefile
+++ b/m4/Makefile
@@ -17,6 +17,7 @@ LSRCFILES = \
        package_attrdev.m4 \
        package_globals.m4 \
        package_ncurses.m4 \
+       package_pthread.m4 \
        package_utilies.m4 \
        package_uuiddev.m4 \
        package_xfslibs.m4 \
diff --git a/m4/package_pthread.m4 b/m4/package_pthread.m4
new file mode 100644
index 0000000..be21d29
--- /dev/null
+++ b/m4/package_pthread.m4
@@ -0,0 +1,19 @@
+AC_DEFUN([AC_PACKAGE_NEED_PTHREAD_H],
+  [ AC_CHECK_HEADERS(pthread.h)
+    if test $ac_cv_header_pthread_h = no; then
+       AC_CHECK_HEADERS(pthread.h,, [
+       echo
+       echo 'FATAL ERROR: could not find a valid pthread header.'
+       exit 1])
+    fi
+  ])
+
+AC_DEFUN([AC_PACKAGE_NEED_PTHREADMUTEXINIT],
+  [ AC_CHECK_LIB(pthread, pthread_mutex_init,, [
+       echo
+       echo 'FATAL ERROR: could not find a valid pthread library.'
+       exit 1
+    ])
+    libpthread=-lpthread
+    AC_SUBST(libpthread)
+  ])
diff --git a/restore/Makefile b/restore/Makefile
index 003ea16..ce3d6b4 100644
--- a/restore/Makefile
+++ b/restore/Makefile
@@ -99,7 +99,7 @@ HFILES = $(LOCALINCL)
 LHFILES = $(COMMINCL) $(INVINCL)
 LINKS = $(COMMINCL) $(COMMON) $(INVINCL) $(INVCOMMON)
 LDIRT = $(LINKS)
-LLDLIBS = $(LIBUUID) $(LIBHANDLE) $(LIBATTR) $(LIBRMT)
+LLDLIBS = $(LIBUUID) $(LIBHANDLE) $(LIBATTR) $(LIBRMT) $(LIBPTHREAD)
 LTDEPENDENCIES = $(LIBRMT)
 
 LCFLAGS = -DRESTORE
-- 
1.7.0.4

<Prev in Thread] Current Thread [Next in Thread>