-
Notifications
You must be signed in to change notification settings - Fork 0
/
valhalla_tyr.m4
58 lines (52 loc) · 1.75 KB
/
valhalla_tyr.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
51
52
53
54
55
56
57
58
AC_DEFUN([CHECK_VALHALLA_TYR],
[
AC_ARG_WITH([valhalla-tyr],
[AS_HELP_STRING([--with-valhalla-tyr@<:@=ARG@:>@],
[use the system valhalla-tyr (ARG=yes), or from a specified location (ARG=<path>).])],
[
if test "$withval" = "yes"; then
VALHALLA_TYR_CPPFLAGS=""
VALHALLA_TYR_LDFLAGS=""
else
VALHALLA_TYR_CPPFLAGS="-I$withval/include -I$withval"
VALHALLA_TYR_LDFLAGS="-L$withval/lib"
fi
],
[
VALHALLA_TYR_CPPFLAGS=""
VALHALLA_TYR_LDFLAGS=""
])
CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $VALHALLA_MIDGARD_CPPFLAGS $VALHALLA_BALDR_CPPFLAGS $VALHALLA_TYR_CPPFLAGS"
export CPPFLAGS
LDFLAGS_SAVED="$LDFLAGS"
LDFLAGS="$LDFLAGS $VALHALLA_MIDGARD_LDFLAGS $VALHALLA_BALDR_LDFLAGS $VALHALLA_TYR_LDFLAGS"
export LDFLAGS
AC_REQUIRE([AC_PROG_CC])
AC_CACHE_CHECK(whether the valhalla::tyr library is available, ax_cv_valhalla_thor,
[AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <valhalla/tyr/adjacencylist.h>]],
[[using namespace valhalla::tyr;
AdjacencyList a(1.f, 5.f, 7.f);]])],
ax_cv_valhalla_tyr=yes, ax_cv_valhalla_thor=no)
AC_LANG_POP([C++])
])
if test "x$ax_cv_valhalla_tyr" = "xyes"; then
AC_DEFINE(HAVE_VALHALLA_TYR,,[define if the valhalla::tyr library is available])
else
AC_MSG_ERROR(Could not find valhalla_tyr!)
fi
AC_CHECK_LIB(valhalla_tyr, exit, [VALHALLA_TYR_LIB="-lvalhalla_thor"; AC_SUBST(VALHALLA_TYR_LIB) link_thor="yes"; break], [link_thor="no"])
if test "x$link_tyr" = "xyes"; then
AC_SUBST(VALHALLA_TYR_CPPFLAGS)
AC_SUBST(VALHALLA_TYR_LDFLAGS)
VALHALLA_TYR_LIBS="-lvalhalla_tyr"
AC_SUBST(VALHALLA_TYR_LIBS)
CPPFLAGS="$CPPFLAGS_SAVED"
export CPPFLAGS
LDFLAGS="$LDFLAGS_SAVED"
export LDFLAGS
else
AC_MSG_ERROR(Could not link against valhalla_tyr!)
fi
])