-
Notifications
You must be signed in to change notification settings - Fork 0
/
valhalla_baldr.m4
58 lines (52 loc) · 1.75 KB
/
valhalla_baldr.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_BALDR],
[
AC_ARG_WITH([valhalla-baldr],
[AS_HELP_STRING([--with-valhalla-baldr@<:@=ARG@:>@],
[use the system valhalla-baldr (ARG=yes), or from a specified location (ARG=<path>).])],
[
if test "$withval" = "yes"; then
VALHALLA_BALDR_CPPFLAGS=""
VALHALLA_BALDR_LDFLAGS=""
else
VALHALLA_BALDR_CPPFLAGS="-I$withval/include -I$withval"
VALHALLA_BALDR_LDFLAGS="-L$withval/lib"
fi
],
[
VALHALLA_BALDR_CPPFLAGS=""
VALHALLA_BALDR_LDFLAGS=""
])
CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $VALHALLA_MIDGARD_CPPFLAGS $VALHALLA_BALDR_CPPFLAGS"
export CPPFLAGS
LDFLAGS_SAVED="$LDFLAGS"
LDFLAGS="$LDFLAGS $VALHALLA_MIDGARD_CPPFLAGS $VALHALLA_BALDR_LDFLAGS"
export LDFLAGS
AC_REQUIRE([AC_PROG_CC])
AC_CACHE_CHECK(whether the valhalla::baldr library is available, ax_cv_valhalla_baldr,
[AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <valhalla/baldr/graphid.h>]],
[[using namespace valhalla::baldr;
GraphId(0,0,0);]])],
ax_cv_valhalla_baldr=yes, ax_cv_valhalla_baldr=no)
AC_LANG_POP([C++])
])
if test "x$ax_cv_valhalla_baldr" = "xyes"; then
AC_DEFINE(HAVE_VALHALLA_BALDR,,[define if the valhalla::baldr library is available])
else
AC_MSG_ERROR(Could not find valhalla_baldr!)
fi
AC_CHECK_LIB(valhalla_baldr, exit, [VALHALLA_BALDR_LIB="-lvalhalla_baldr"; AC_SUBST(VALHALLA_BALDR_LIB) link_baldr="yes"; break], [link_baldr="no"])
if test "x$link_baldr" = "xyes"; then
AC_SUBST(VALHALLA_BALDR_CPPFLAGS)
AC_SUBST(VALHALLA_BALDR_LDFLAGS)
VALHALLA_BALDR_LIBS="-lvalhalla_baldr"
AC_SUBST(VALHALLA_BALDR_LIBS)
CPPFLAGS="$CPPFLAGS_SAVED"
export CPPFLAGS
LDFLAGS="$LDFLAGS_SAVED"
export LDFLAGS
else
AC_MSG_ERROR(Could not link against valhalla_baldr!)
fi
])