Commit 3458cafb authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Detect new contrib and pass path through --with-contrib

parent 932bc728
...@@ -104,52 +104,76 @@ dnl ...@@ -104,52 +104,76 @@ dnl
dnl Check for the contrib directory dnl Check for the contrib directory
dnl dnl
AC_ARG_WITH(contrib, AC_ARG_WITH(contrib,
[AS_HELP_STRING([--without-contrib], [AS_HELP_STRING([--with-contrib[=DIR]],
[do not use the libraries in CONTRIB_DIR])]) [search for 3rd party libraries in DIR/include and DIR/lib])
AC_ARG_VAR([CONTRIB_DIR], [directory containing pre-built contrib, overriding extras/contrib]) ])
AS_IF([test "${with_contrib}" != "no"],[ AC_MSG_CHECKING([for 3rd party libraries path])
AS_IF([test -z "$CONTRIB_DIR"], [ AS_IF([test -z "${with_contrib}" || test "${with_contrib}" = "yes"], [
topdir="`dirname $0`" CONTRIB_DIR="${srcdir}/contrib/hosts/${host}"
if test "`echo \"$topdir\" | cut -c 1`" != "/"; then AS_IF([test ! -d "${CONTRIB_DIR}"], [
topdir="`pwd`/$topdir" echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
fi CONTRIB_DIR="${srcdir}/contrib/hosts/`$CC -dumpmachine`"
CONTRIB_DIR="${topdir}/extras/contrib/hosts/${host}" AS_IF([test ! -d "${CONTRIB_DIR}"], [
if ! test -d "$CONTRIB_DIR" echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
then CONTRIB_DIR="${srcdir}/extras/contrib/hosts/${host}"
gccmachine=`$CC -dumpmachine` AS_IF([test ! -d "${CONTRIB_DIR}"], [
CONTRIB_DIR="${topdir}/extras/contrib/hosts/${gccmachine}" echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
fi CONTRIB_DIR="${srcdir}/extras/contrib/hosts/`$CC -dumpmachine`"
AS_IF([test ! -d "${CONTRIB_DIR}"], [
echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
CONTRIB_DIR=""
AC_MSG_RESULT([not found])
])
])
])
]) ])
AC_MSG_CHECKING([for libs in ${CONTRIB_DIR}]) ], [
AS_IF([test "${with_contrib}" != "no"], [
CONTRIB_DIR="${with_contrib}"
], [
CONTRIB_DIR=""
AC_MSG_RESULT([disabled])
])
])
AS_IF([test -n "${CONTRIB_DIR}"], [
AS_IF([test -d "${CONTRIB_DIR}/lib"],[ AS_IF([test -d "${CONTRIB_DIR}/lib"],[
AC_MSG_RESULT([yes]) CONTRIB_DIR=`cd "${CONTRIB_DIR}" && pwd`
AC_SUBST(CONTRIB_DIR) ], [
export PATH=${CONTRIB_DIR}/bin:$PATH echo "${CONTRIB_DIR}/lib not found" >&AS_MESSAGE_LOG_FD
CPPFLAGS="${CPPFLAGS} -I${CONTRIB_DIR}/include"
CPPFLAGS_save="${CPPFLAGS_save} -I${CONTRIB_DIR}/include"
CFLAGS="${CFLAGS} -I${CONTRIB_DIR}/include"
CFLAGS_save="${CFLAGS_save} -I${CONTRIB_DIR}/include"
CXXFLAGS="${CXXFLAGS} -I${CONTRIB_DIR}/include"
CXXFLAGS_save="${CXXFLAGS_save} -I${CONTRIB_DIR}/include"
OBJCFLAGS="${OBJCFLAGS} -I${CONTRIB_DIR}/include"
OBJCFLAGS_save="${OBJCFLAGS_save} -I${CONTRIB_DIR}/include"
if test "$build" = "$host" -o "$PKG_CONFIG_LIBDIR"; then
export PKG_CONFIG_PATH="${CONTRIB_DIR}/lib/pkgconfig:$PKG_CONFIG_PATH"
else
export PKG_CONFIG_LIBDIR="${CONTRIB_DIR}/lib/pkgconfig"
fi
LDFLAGS="${LDFLAGS} -L${CONTRIB_DIR}/lib"
LDFLAGS_save="${LDFLAGS_save} -L${CONTRIB_DIR}/lib"
if test "${SYS}" = "darwin"; then
export LD_LIBRARY_PATH="${CONTRIB_DIR}/lib:$LD_LIBRARY_PATH"
export DYLD_LIBRARY_PATH="${CONTRIB_DIR}/lib:$DYLD_LIBRARY_PATH"
fi
],[
AC_MSG_RESULT([no])
CONTRIB_DIR="" CONTRIB_DIR=""
AC_MSG_RESULT([not usable])
])
])
AS_IF([test -n "${CONTRIB_DIR}"], [
AC_MSG_RESULT([${CONTRIB_DIR}])
export PATH=${CONTRIB_DIR}/bin:$PATH
CPPFLAGS="${CPPFLAGS} -I${CONTRIB_DIR}/include"
CPPFLAGS_save="${CPPFLAGS_save} -I${CONTRIB_DIR}/include"
CFLAGS="${CFLAGS} -I${CONTRIB_DIR}/include"
CFLAGS_save="${CFLAGS_save} -I${CONTRIB_DIR}/include"
CXXFLAGS="${CXXFLAGS} -I${CONTRIB_DIR}/include"
CXXFLAGS_save="${CXXFLAGS_save} -I${CONTRIB_DIR}/include"
OBJCFLAGS="${OBJCFLAGS} -I${CONTRIB_DIR}/include"
OBJCFLAGS_save="${OBJCFLAGS_save} -I${CONTRIB_DIR}/include"
AS_IF([test "$build" = "$host" -o "$PKG_CONFIG_LIBDIR"], [
export PKG_CONFIG_PATH="${CONTRIB_DIR}/lib/pkgconfig:$PKG_CONFIG_PATH"
], [
export PKG_CONFIG_LIBDIR="${CONTRIB_DIR}/lib/pkgconfig"
])
LDFLAGS="${LDFLAGS} -L${CONTRIB_DIR}/lib"
LDFLAGS_save="${LDFLAGS_save} -L${CONTRIB_DIR}/lib"
AS_IF([test "${SYS}" = "darwin"], [
export LD_LIBRARY_PATH="${CONTRIB_DIR}/lib:$LD_LIBRARY_PATH"
export DYLD_LIBRARY_PATH="${CONTRIB_DIR}/lib:$DYLD_LIBRARY_PATH"
])
], [
AS_IF([test -n "${with_contrib}" && test "${with_contrib}" != "no"], [
AC_MSG_ERROR([Third party libraries not found!])
]) ])
]) ])
AC_SUBST(CONTRIB_DIR)
dnl dnl
dnl Set default values dnl Set default values
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment