forked from sstsimulator/sst-elements
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sst_check_nvdimmsim.m4
50 lines (42 loc) · 1.74 KB
/
sst_check_nvdimmsim.m4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
AC_DEFUN([SST_CHECK_NVDIMMSIM], [
AC_ARG_WITH([nvdimmsim],
[AS_HELP_STRING([--with-nvdimmsim@<:@=DIR@:>@],
[Use NVDIMMSim package installed in optionally specified DIR])])
sst_check_nvdimmsim_happy="yes"
AS_IF([test "$with_nvdimmsim" = "no"], [sst_check_nvdimmsim_happy="no"])
CXXFLAGS_saved="$CXXFLAGS"
CPPFLAGS_saved="$CPPFLAGS"
LDFLAGS_saved="$LDFLAGS"
LIBS_saved="$LIBS"
AS_IF([test ! -z "$with_nvdimmsim" -a "$with_nvdimmsim" != "yes"],
[NVDIMMSIM_CPPFLAGS="-I$with_nvdimmsim -I$with_nvdimmsim/include"
CPPFLAGS="$NVDIMMSIM_CPPFLAGS $AM_CPPFLAGS $CPPFLAGS"
CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS"
NVDIMMSIM_CXXFLAGS="$CXXFLAGS"
NVDIMMSIM_LDFLAGS="-L$with_nvdimmsim -L$with_nvdimmsim/lib"
NVDIMMSIM_LIBDIR="$with_nvdimmsim"
LDFLAGS="$NVDIMMSIM_LDFLAGS $AM_LDFLAGS $LDFLAGS"],
[NVDIMMSIM_CPPFLAGS=
NVDIMMSIM_LDFLAGS=
NVDIMMSIM_LIBDIR=
NVDIMMSIM_CXXFLAGS=])
AC_LANG_PUSH(C++)
AC_CHECK_HEADERS([NVDIMM.h], [], [sst_check_nvdimmsim_happy="no"])
AC_CHECK_LIB([nvdsim], [main],
[NVDIMMSIM_LIB="-lnvdsim"], [sst_check_nvdimmsim_happy="no"])
AC_LANG_POP(C++)
CXXFLAGS="$CXXFLAGS_saved"
CPPFLAGS="$CPPFLAGS_saved"
LDFLAGS="$LDFLAGS_saved"
LIBS="$LIBS_saved"
AC_SUBST([NVDIMMSIM_CPPFLAGS])
AC_SUBST([NVDIMMSIM_LDFLAGS])
AC_SUBST([NVDIMMSIM_CXXFLAGS])
AC_SUBST([NVDIMMSIM_LIB])
AC_SUBST([NVDIMMSIM_LIBDIR])
AM_CONDITIONAL([HAVE_NVDIMMSIM], [test "$sst_check_nvdimmsim_happy" = "yes"])
AS_IF([test "$sst_check_nvdimmsim_happy" = "yes"],
[AC_DEFINE([HAVE_NVDIMMSIM], [1], [Set to 1 if NVDIMMSim was found])])
AC_DEFINE_UNQUOTED([NVDIMMSIM_LIBDIR], ["$NVDIMMSIM_LIBDIR"], [Path to NVDIMMSim library])
AS_IF([test "$sst_check_nvdimmsim_happy" = "yes"], [$1], [$2])
])