Fix boost not found on debian-testing MP-628
[m4-moved-to-github.git] / authority-0.0.m4
1 AC_DEFUN([AUTHORITY_INIT],
2 [
3         AC_SUBST(AUTHORITYLIB)
4         AC_SUBST(AUTHORITYLALIB)
5         AC_SUBST(AUTHORITYINC)
6         AC_SUBST(AUTHORITYVERSION)
7         authconfig=NONE
8         authpath=NONE
9         AC_ARG_WITH(auth, [  --with-auth=DIR          use authority-config-0.0 in DIR (example /home/frbr-0.0)], [authpath=$withval])
10         if test "x$authpath" != "xNONE"; then
11                 authconfig=$authpath/authority-config-0.0
12         else
13                 if test "x$srcdir" = "x"; then
14                         authsrcdir=.
15                 else
16                         authsrcdir=$srcdir
17                 fi
18                 for i in ${authsrcdir}/../../frbr ${authsrcdir}/../frbr-* ${authsrcdir}/../frbr; do
19                         if test -d $i; then
20                                 if test -r $i/authority-config-0.0; then
21                                         authconfig=$i/authority-config-0.0
22                                 fi
23                         fi
24                 done
25                 if test "x$authconfig" = "xNONE"; then
26                         AC_PATH_PROG(authconfig, authority-config-0.0, NONE)
27                 fi
28         fi
29         AC_MSG_CHECKING(for AUTHORITY)
30         if $authconfig --version >/dev/null 2>&1; then
31                 AUTHORITYLIB=`$authconfig --libs $1`
32                 AUTHORITYLALIB=`$authconfig --lalibs $1`
33                 AUTHORITYINC=`$authconfig --cflags $1`
34                 AUTHORITYVERSION=`$authconfig --version`
35                 AC_MSG_RESULT([$authconfig])
36         else
37                 AC_MSG_RESULT(Not found)
38                 AUTHORITYVERSION=NONE
39         fi
40         if test "X$AUTHORITYVERSION" != "XNONE"; then
41                 AC_MSG_CHECKING([for AUTHORITY version])
42                 AC_MSG_RESULT([$AUTHORITYVERSION])
43                 if test "$2"; then
44                         have_auth_version=`echo "$AUTHORITYVERSION" | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`
45                         req_auth_version=`echo "$2" | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`
46                         if test "$have_auth_version" -lt "$req_auth_version"; then
47                                 AC_MSG_ERROR([$AUTHORITYVERSION. Requires AUTHORITY $2 or later])
48                         fi
49                 fi
50         fi
51 ])