File: find_apr.m4

package info (click to toggle)
modsecurity-apache 2.9.11-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 10,436 kB
  • sloc: ansic: 53,590; sh: 5,249; perl: 2,340; cpp: 1,930; makefile: 618; xml: 6
file content (91 lines) | stat: -rw-r--r-- 2,756 bytes parent folder | download
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
dnl Check for APR Libraries
dnl CHECK_APR(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
dnl Sets:
dnl  APR_CFLAGS
dnl  APR_LDFLAGS
dnl  APR_LIBS
dnl  APR_LINK_LD

APR_CONFIG=""
APR_CFLAGS=""
APR_CPPFLAGS=""
APR_LDFLAGS=""
APR_LDADD=""
APR_INCLUDEDIR=""
APR_LINKLD=""
AC_DEFUN([CHECK_APR],
[dnl

AC_ARG_WITH(
    apr,
    [AS_HELP_STRING([--with-apr=PATH],[Path to apr prefix or config script])],
    [test_paths="${with_apr}"],
    [test_paths="/usr/local/libapr /usr/local/apr /usr/local /opt/libapr /opt/apr /opt /usr"])

AC_MSG_CHECKING([for libapr config script])

for x in ${test_paths}; do
    dnl # Determine if the script was specified and use it directly
    if test ! -d "$x" -a -e "$x"; then
        APR_CONFIG=$x
        apr_path=no
        break
    fi

    dnl # Try known config script names/locations
    for APR_CONFIG in apr-1-mt-config apr-1-config apr-config-1 apr-mt-config-1 apr-mt-config apr-config; do
        if test -e "${x}/bin/${APR_CONFIG}"; then
            apr_path="${x}/bin"
            break
        elif test -e "${x}/${APR_CONFIG}"; then
            apr_path="${x}"
            break
        else
            apr_path=""
        fi
    done
    if test -n "$apr_path"; then
        break
    fi
done

if test -n "${apr_path}"; then
    if test "${apr_path}" != "no"; then
        APR_CONFIG="${apr_path}/${APR_CONFIG}"
    fi
    AC_MSG_RESULT([${APR_CONFIG}])
    APR_VERSION="`${APR_CONFIG} --version`"
    if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apr VERSION: $APR_VERSION); fi
    APR_CFLAGS="`${APR_CONFIG} --includes`"
    if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apr CFLAGS: $APR_CFLAGS); fi
    APR_CPPFLAGS="`${APR_CONFIG} --cppflags`"
    if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apr CPPFLAGS: $APR_CPPFLAGS); fi
    APR_LDFLAGS="`${APR_CONFIG} --libs`"
    if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apr LDFLAGS: $APR_LDFLAGS); fi
    APR_LDADD="`${APR_CONFIG} --link-libtool`"
    if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apr LDADD: $APR_LDADD); fi
    APR_INCLUDEDIR="`${APR_CONFIG} --includedir`"
    if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apr INCLUDEDIR: $APR_INCLUDEDIR); fi
    APR_LINKLD="`${APR_CONFIG} --link-ld`"
    if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apr LINKLD: $APR_LINKLD); fi
else
    AC_MSG_RESULT([no])
fi

AC_SUBST(APR_CONFIG)
AC_SUBST(APR_VERSION)
AC_SUBST(APR_CFLAGS)
AC_SUBST(APR_CPPFLAGS)
AC_SUBST(APR_LDFLAGS)
AC_SUBST(APR_LDADD)
AC_SUBST(APR_INCLUDEDIR)
AC_SUBST(APR_LINKLD)

if test -z "${APR_VERSION}"; then
    AC_MSG_NOTICE([*** apr library not found.])
    ifelse([$2], , AC_MSG_ERROR([apr library is required]), $2)
else
    AC_MSG_NOTICE([using apr v${APR_VERSION}])
    ifelse([$1], , , $1) 
fi 
])