Blame build/find_apu.m4

Packit Service 384592
dnl Check for APU Libraries
Packit Service 384592
dnl CHECK_APU(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
Packit Service 384592
dnl Sets:
Packit Service 384592
dnl  APU_CFLAGS
Packit Service 384592
dnl  APU_LDFLAGS
Packit Service 384592
dnl  APU_LIBS
Packit Service 384592
dnl  APU_LINK_LD
Packit Service 384592
Packit Service 384592
APU_CONFIG=""
Packit Service 384592
APU_CFLAGS=""
Packit Service 384592
APU_LDFLAGS=""
Packit Service 384592
APU_LDADD=""
Packit Service 384592
APU_INCLUDEDIR=""
Packit Service 384592
APU_LINKLD=""
Packit Service 384592
Packit Service 384592
AC_DEFUN([CHECK_APU],
Packit Service 384592
[dnl
Packit Service 384592
Packit Service 384592
AC_ARG_WITH(
Packit Service 384592
    apu,
Packit Service 384592
    [AC_HELP_STRING([--with-apu=PATH],[Path to apu prefix or config script])],
Packit Service 384592
    [test_paths="${with_apu}"],
Packit Service 384592
    [test_paths="/usr/local/libapr-util /usr/local/apr-util /usr/local/libapu /usr/local/apu /usr/local/apr /usr/local /opt/libapr-util /opt/apr-util /opt/libapu /opt/apu /opt /usr"])
Packit Service 384592
Packit Service 384592
AC_MSG_CHECKING([for libapu config script])
Packit Service 384592
Packit Service 384592
for x in ${test_paths}; do
Packit Service 384592
    dnl # Determine if the script was specified and use it directly
Packit Service 384592
    if test ! -d "$x" -a -e "$x"; then
Packit Service 384592
        APU_CONFIG=$x
Packit Service 384592
        apu_path="no"
Packit Service 384592
        break
Packit Service 384592
    fi
Packit Service 384592
Packit Service 384592
    dnl # Try known config script names/locations
Packit Service 384592
    for APU_CONFIG in apu-1-mt-config apu-1-config apu-config-1 apu-mt-config-1 apu-mt-config apu-config; do
Packit Service 384592
        if test -e "${x}/bin/${APU_CONFIG}"; then
Packit Service 384592
            apu_path="${x}/bin"
Packit Service 384592
            break
Packit Service 384592
        elif test -e "${x}/${APU_CONFIG}"; then
Packit Service 384592
            apu_path="${x}"
Packit Service 384592
            break
Packit Service 384592
        else
Packit Service 384592
            apu_path=""
Packit Service 384592
        fi
Packit Service 384592
    done
Packit Service 384592
    if test -n "$apu_path"; then
Packit Service 384592
        break
Packit Service 384592
    fi
Packit Service 384592
done
Packit Service 384592
Packit Service 384592
if test -n "${apu_path}"; then
Packit Service 384592
    if test "${apu_path}" != "no"; then
Packit Service 384592
        APU_CONFIG="${apu_path}/${APU_CONFIG}"
Packit Service 384592
    fi
Packit Service 384592
    AC_MSG_RESULT([${APU_CONFIG}])
Packit Service 384592
    APU_VERSION="`${APU_CONFIG} --version`"
Packit Service 384592
    if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apu VERSION: $APU_VERSION); fi
Packit Service 384592
    APU_CFLAGS="`${APU_CONFIG} --includes`"
Packit Service 384592
    if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apu CFLAGS: $APU_CFLAGS); fi
Packit Service 384592
    APU_LDFLAGS="`${APU_CONFIG} --ldflags`"
Packit Service 384592
    APU_LDFLAGS="$APU_LDFLAGS `${APU_CONFIG} --libs`"
Packit Service 384592
    if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apu LDFLAGS: $APU_LDFLAGS); fi
Packit Service 384592
    APU_LDADD="`${APU_CONFIG} --link-libtool`"
Packit Service 384592
    if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apu LDADD: $APU_LDADD); fi
Packit Service 384592
    APU_INCLUDEDIR="`${APU_CONFIG} --includedir`"
Packit Service 384592
    if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apu INCLUDEDIR: $APU_INCLUDEDIR); fi
Packit Service 384592
    APU_LINKLD="`${APU_CONFIG} --link-ld`"
Packit Service 384592
    if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(apu LINKLD: $APU_LINKLD); fi
Packit Service 384592
else
Packit Service 384592
    AC_MSG_RESULT([no])
Packit Service 384592
fi
Packit Service 384592
Packit Service 384592
AC_SUBST(APU_CONFIG)
Packit Service 384592
AC_SUBST(APU_VERSION)
Packit Service 384592
AC_SUBST(APU_CFLAGS)
Packit Service 384592
AC_SUBST(APU_LDFLAGS)
Packit Service 384592
AC_SUBST(APU_LDADD)
Packit Service 384592
AC_SUBST(APU_INCLUDEDIR)
Packit Service 384592
AC_SUBST(APU_LINKLD)
Packit Service 384592
Packit Service 384592
if test -z "${APU_VERSION}"; then
Packit Service 384592
    AC_MSG_NOTICE([*** apu library not found.])
Packit Service 384592
    ifelse([$2], , AC_MSG_ERROR([apu library is required]), $2)
Packit Service 384592
else
Packit Service 384592
    AC_MSG_NOTICE([using apu v${APU_VERSION}])
Packit Service 384592
    ifelse([$1], , , $1) 
Packit Service 384592
fi 
Packit Service 384592
])