5
# Test for DATASPACES installation
6
# and set $DATASPACES to the correct value.
9
dnl @synopsis AC_PROG_DATASPACES
11
dnl This macro test if DATASPACES is installed. If DATASPACES
12
dnl is installed, it set $DATASPACES to the right value
15
dnl @author Norbert Podhorszki, pnorbert@ornl.gov
17
AC_DEFUN([AC_PROG_DATASPACES],[
19
AC_REQUIRE([AC_INFINIBAND])
20
dnl AC_REQUIRE([AC_PORTALS])
21
dnl AC_REQUIRE([AC_GNI])
24
AM_CONDITIONAL(HAVE_DATASPACES,true)
26
AC_ARG_WITH(dataspaces,
27
[AS_HELP_STRING([--with-dataspaces=DIR],
28
[Build the DATASPACES transport method. Point to the DATASPACES installation.])],
29
[DATASPACES_LDFLAGS="-L$withval/lib";
30
DATASPACES_CPPFLAGS="-I$withval/include";],
31
[with_dataspaces=check])
33
dnl If --without-dataspaces was given set HAVE_DATASPACES to false and do nothing more
34
if test "x$with_dataspaces" == "xno"; then
36
AM_CONDITIONAL(HAVE_DATASPACES,false)
40
dnl allow args --with-dataspaces incdir and --with-dataspaces-libdir
41
AC_ARG_WITH(dataspaces-incdir,
42
[ --with-dataspaces-incdir=<location of dataspaces includes>],
43
[DATASPACES_INCDIR=$withval
44
with_dataspaces=detailed])
46
AC_ARG_WITH(dataspaces-libdir,
47
[ --with-dataspaces-libdir=<location of dataspaces library>],
48
[DATASPACES_LIBDIR=$withval
49
with_dataspaces=detailed])
52
dnl If we know DATASPACES_DIR, then we can know DATASPACES_INCDIR.
53
dnl We don't overwrite DATASPACES_INCDIR.
54
if test -n "${DATASPACES_DIR}" -a -z "${DATASPACES_INCDIR}"; then
55
DATASPACES_INCDIR="${DATASPACES_DIR}/include";
56
dnl We may have DATASPACES denoting the dir (e.g. on ewok BUT on franklin it contains all flags)
57
elif test -n "${DATASPACES}" -a -d "${DATASPACES}"; then
58
DATASPACES_INCDIR="${DATASPACES}/include"
61
dnl If we know DATASPACES_DIR, then we can know DATASPACES_LIBDIR.
62
dnl We don't overwrite DATASPACES_LIBDIR.
63
if test -n "${DATASPACES_DIR}" -a -z "${DATASPACES_LIBDIR}"; then
64
DATASPACES_LIBDIR="${DATASPACES_DIR}/lib";
65
dnl We may have DATASPACES denoting the dir (e.g. on ewok BUT on franklin it contains all flags)
66
elif test -n "${DATASPACES}" -a -d "${DATASPACES}"; then
67
DATASPACES_LIBDIR="${DATASPACES}/lib"
70
dnl Add "-I" to DATASPACES_INCDIR.
71
if test -n "${DATASPACES_INCDIR}"; then
72
DATASPACES_CPPFLAGS="-I${DATASPACES_INCDIR}"
77
dnl Add "-L" to DATASPACES_LIBDIR.
78
if test -n "${DATASPACES_LIBDIR}"; then
79
DATASPACES_LDFLAGS="-L${DATASPACES_LIBDIR}"
84
save_CPPFLAGS="$CPPFLAGS"
86
save_LDFLAGS="$LDFLAGS"
87
if test "x${ac_infiniband_lib_ok}" == "xyes"; then
88
dnl LIBS="$LIBS -ldart -ldataspaces"
89
LIBS="$LIBS -ldspaces -ldscommon -ldart"
90
elif test "x${ac_portals_lib_ok}" == "xyes"; then
91
LIBS="$LIBS -ldart2 -lspaces"
92
elif test "x${ac_dmcf_lib_ok}" == "xyes"; then
93
LIBS="$LIBS -ldspaces -ldscommon -ldart"
95
LIBS="$LIBS -ldspaces -ldscommon -ldart"
97
dnl LIBS="$LIBS -ldspaces -ldscommon -ldart"
98
LDFLAGS="$LDFLAGS $DATASPACES_LDFLAGS"
99
CPPFLAGS="$CPPFLAGS $DATASPACES_CPPFLAGS"
101
if test -z "${HAVE_DATASPACES_TRUE}"; then
102
AC_CHECK_HEADERS(dataspaces.h,
104
[AM_CONDITIONAL(HAVE_DATASPACES,false)])
107
if test -z "${HAVE_DATASPACES_TRUE}"; then
108
# Check for the DataSpaces library and headers
109
if test "x${ac_portals_lib_ok}" == "xyes"; then
110
AC_TRY_COMPILE([#include "dataspaces.h"],
111
[int err; err = dspaces_init(1,1);],
112
[DATASPACES_LIBS="-ldart2 -lspaces"],
113
[AM_CONDITIONAL(HAVE_DATASPACES,false)])
114
elif test "x${ac_infiniband_lib_ok}" == "xyes"; then
115
AC_TRY_COMPILE([#include "dataspaces.h"],
116
[int err; err = dspaces_init(1,1);],
117
[DATASPACES_LIBS="-ldspaces -ldscommon -ldart -lrdmacm"],
118
[AM_CONDITIONAL(HAVE_DATASPACES,false)])
119
elif test -z "${HAVE_CRAY_PMI_TRUE}" -a -z "${HAVE_CRAY_UGNI_TRUE}"; then
120
AC_TRY_COMPILE([#include "dataspaces.h"],
121
[int err; err = dspaces_init(1,1);],
122
[DATASPACES_LIBS="-ldspaces -ldscommon -ldart"],
123
[AM_CONDITIONAL(HAVE_DATASPACES,false)])
124
elif test "x${ac_dcmf_lib_ok}" == "xyes"; then
125
AC_TRY_COMPILE([#include "dataspaces.h"],
126
[int err; err = dspaces_init(1,1);],
127
[DATASPACES_LIBS="-ldspaces -ldscommon -ldart"],
128
[AM_CONDITIONAL(HAVE_DATASPACES,false)])
130
AM_CONDITIONAL(HAVE_DATASPACES,false)
135
LDFLAGS="$save_LDFLAGS"
136
CPPFLAGS="$save_CPPFLAGS"
138
AC_SUBST(DATASPACES_LIBS)
139
AC_SUBST(DATASPACES_LDFLAGS)
140
AC_SUBST(DATASPACES_CPPFLAGS)
142
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
143
if test -z "${HAVE_DATASPACES_TRUE}"; then
144
ifelse([$1],,[AC_DEFINE(HAVE_DATASPACES,1,[Define if you have the DATASPACES.])],[$1])