Skip to content

Commit 6cc17b0

Browse files
mca/threads/qthreads: rework configury to be smarter
Signed-off-by: Shintaro Iwasaki <siwasaki@anl.gov>
1 parent 6c46da3 commit 6cc17b0

File tree

7 files changed

+109
-12
lines changed

7 files changed

+109
-12
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,3 +688,4 @@ test/util/bipartite_graph
688688
opal/test/reachable/reachable_netlink
689689
opal/test/reachable/reachable_weighted
690690
opal/mca/threads/argobots/threads_argobots.h
691+
opal/mca/threads/qthreads/threads_qthreads.h

opal/mca/threads/qthreads/Makefile.am

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,37 @@
1919
# $HEADER$
2020
#
2121

22-
noinst_LTLIBRARIES = libmca_threads_qthreads.la
22+
AM_CPPFLAGS = $(opal_qthreads_CPPFLAGS)
2323

24-
libmca_threads_qthreads_la_SOURCES = \
24+
sources = \
25+
threads_qthreads.h \
2526
threads_qthreads_component.c \
26-
threads_qthreads_mutex.c \
2727
threads_qthreads_condition.c \
28-
threads_qthreads_module.c
28+
threads_qthreads_module.c \
29+
threads_qthreads_mutex.c \
30+
threads_qthreads_mutex.h \
31+
threads_qthreads_threads.h \
32+
threads_qthreads_tsd.h \
33+
threads_qthreads_wait_sync.h
34+
35+
lib_sources = $(sources)
36+
37+
if MCA_BUILD_opal_threads_qthreads_DSO
38+
component_noinst =
39+
component_install = mca_threads_qthreads.la
40+
else
41+
component_noinst = libmca_threads_qthreads.la
42+
component_install =
43+
endif
44+
45+
mcacomponentdir = $(opallibdir)
46+
mcacomponent_LTLIBRARIES = $(component_install)
47+
mca_threads_qthreads_la_SOURCES = $(sources)
48+
mca_threads_qthreads_la_LDFLAGS = -module -avoid-version
49+
mca_threads_qthreads_la_LIBADD = $(top_builddir)/opal/lib@OPAL_LIB_PREFIX@open-pal.la \
50+
$(opal_qthreads_LIBS)
2951

30-
AM_LDFLAGS = -lqthread
52+
noinst_LTLIBRARIES = $(component_noinst)
53+
libmca_threads_qthreads_la_SOURCES = $(sources)
54+
libmca_threads_qthreads_la_LDFLAGS = -module -avoid-version $(opal_qthreads_LDFLAGS)
55+
libmca_threads_qthreads_la_LIBADD = $(opal_qthreads_LIBS)

opal/mca/threads/qthreads/configure.m4

Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,68 @@ AC_DEFUN([OPAL_CONFIG_QTHREADS],[
3131
[threads_qthreads_happy="no"])],
3232
[threads_qthreads_happy="no"])
3333

34-
AS_IF([test "$threads_qthreads_happy" = "yes"],
34+
AC_ARG_WITH([qthreads],
35+
[AC_HELP_STRING([--with-qthreads=DIR],
36+
[Specify location of qthreads installation. Error if qthreads support cannot be found.])])
37+
38+
AC_ARG_WITH([qthreads-libdir],
39+
[AC_HELP_STRING([--with-qthreads-libdir=DIR],
40+
[Search for qthreads libraries in DIR])])
41+
42+
opal_check_qthreads_save_CPPFLAGS=$CPPFLAGS
43+
opal_check_qthreads_save_LDFLAGS=$LDFLAGS
44+
opal_check_qthreads_save_LIBS=$LIBS
45+
46+
opal_qthreads_happy=yes
47+
AS_IF([test "$with_qthreads" = "no"],
48+
[opal_qthreads_happy=no])
49+
50+
AS_IF([test $opal_qthreads_happy = yes],
51+
[AC_MSG_CHECKING([looking for qthreads in])
52+
AS_IF([test "$with_qthreads" != "yes"],
53+
[opal_qthreads_dir=$with_qthreads
54+
AC_MSG_RESULT([($opal_qthreads_dir)])],
55+
[AC_MSG_RESULT([(default search paths)])])
56+
AS_IF([test ! -z "$with_qthreads_libdir" && \
57+
test "$with_qthreads_libdir" != "yes"],
58+
[opal_qthreads_libdir=$with_qthreads_libdir])
59+
])
60+
61+
AS_IF([test $opal_qthreads_happy = yes],
62+
[OPAL_CHECK_PACKAGE([opal_qthreads],
63+
[qthread/qthread.h],
64+
[qthread],
65+
[qthread_initialize],
66+
[],
67+
[$opal_qthreads_dir],
68+
[$opal_qthreads_libdir],
69+
[],
70+
[opal_qthreads_happy=no])])
71+
72+
AS_IF([test $opal_qthreads_happy = yes && test -n "$opal_qthreads_dir"],
73+
[OPAL_QTHREADS_INCLUDE_PATH="$opal_qthreads_dir/include/"],
74+
[OPAL_QTHREADS_INCLUDE_PATH=""])
75+
76+
AS_IF([test $opal_qthreads_happy = yes],
77+
[TPKG_CFLAGS="$opal_qthreads_CPPFLAGS"
78+
TPKG_FCFLAGS="$opal_qthreads_CPPFLAGS"
79+
TPKG_CXXFLAGS="$opal_qthreads_CPPFLAGS"
80+
TPKG_CPPFLAGS="$opal_qthreads_CPPFLAGS"
81+
TPKG_CXXCPPFLAGS="$opal_qthreads_CPPFLAGS"
82+
TPKG_LDFLAGS="$opal_qthreads_LDFLAGS"
83+
TPKG_LIBS="$opal_qthreads_LIBS"])
84+
85+
AC_CONFIG_FILES([opal/mca/threads/qthreads/threads_qthreads.h])
86+
AC_SUBST([OPAL_QTHREADS_INCLUDE_PATH])
87+
AC_SUBST([opal_qthreads_CPPFLAGS])
88+
AC_SUBST([opal_qthreads_LDFLAGS])
89+
AC_SUBST([opal_qthreads_LIBS])
90+
91+
CPPFLAGS=$opal_check_qthreads_save_CPPFLAGS
92+
LDFLAGS=$opal_check_qthreads_save_LDFLAGS
93+
LIBS=$opal_check_qthreads_save_LIBS
94+
95+
AS_IF([test "$opal_qthreads_happy" = "yes"],
3596
[$1],
3697
[$2])
3798
])dnl
@@ -60,7 +121,22 @@ AC_DEFUN([MCA_opal_threads_qthreads_POST_CONFIG],[
60121
AC_DEFINE_UNQUOTED([MCA_threads_wait_sync_base_include_HEADER],
61122
["opal/mca/threads/qthreads/threads_qthreads_wait_sync.h"],
62123
[Header to include for wait_sync implementation])
124+
THREAD_CFLAGS="$TPKG_CFLAGS"
125+
THREAD_FCFLAGS="$TPKG_FCFLAGS"
126+
THREAD_CXXFLAGS="$TPKG_CXXFLAGS"
127+
THREAD_CPPFLAGS="$TPKG_CPPFLAGS"
128+
THREAD_CXXCPPFLAGS="$TPKG_CXXCPPFLAGS"
129+
THREAD_LDFLAGS="$TPKG_LDFLAGS"
130+
THREAD_LIBS="$TPKG_LIBS"
131+
LIBS="$LIBS $THREAD_LIBS"
132+
LDFLAGS="$LDFLAGS $THREAD_LDFLAGS"
63133
])
134+
AC_SUBST(THREAD_CFLAGS)
135+
AC_SUBST(THREAD_FCFLAGS)
136+
AC_SUBST(THREAD_CXXFLAGS)
137+
AC_SUBST(THREAD_CPPFLAGS)
138+
AC_SUBST(THREAD_LDFLAGS)
139+
AC_SUBST(THREAD_LIBS)
64140
])dnl
65141

66142

opal/mca/threads/qthreads/threads_qthreads.h renamed to opal/mca/threads/qthreads/threads_qthreads.h.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#ifndef OPAL_MCA_THREADS_QTHREADS_THREADS_QTHREADS_H
2727
#define OPAL_MCA_THREADS_QTHREADS_THREADS_QTHREADS_H 1
2828

29-
#include <qthread/qthread.h>
29+
#include "@OPAL_QTHREADS_INCLUDE_PATH@qthread/qthread.h"
3030

3131
static inline void ensure_init_qthreads(void)
3232
{

opal/mca/threads/qthreads/threads_qthreads_mutex.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@
4848
#include "opal/sys/atomic.h"
4949
#include "opal/util/output.h"
5050

51-
#include <qthread/qthread.h>
52-
5351
BEGIN_C_DECLS
5452

5553
struct opal_mutex_t {

opal/mca/threads/qthreads/threads_qthreads_threads.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#ifndef OPAL_MCA_THREADS_QTHREADS_THREADS_QTHREADS_THREADS_H
2727
#define OPAL_MCA_THREADS_QTHREADS_THREADS_QTHREADS_THREADS_H 1
2828

29-
#include <qthread/qthread.h>
3029
#include <signal.h>
3130

3231
struct opal_thread_t {

opal/mca/threads/qthreads/threads_qthreads_tsd.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
#define OPAL_MCA_THREADS_QTHREADS_THREADS_QTHREADS_TSD_H 1
2929

3030
#include "opal/mca/threads/qthreads/threads_qthreads.h"
31-
#include <qthread/qthread.h>
32-
#include <qthread/tls.h>
3331

3432
typedef qthread_key_t opal_tsd_key_t;
3533

0 commit comments

Comments
 (0)