add LIBFLACPP_LIBDIR, make AC_TRY_RUN more robust

This commit is contained in:
Josh Coalson 2006-10-25 00:44:39 +00:00
parent 03a6887cbe
commit 9452bfeda6

View File

@ -3,7 +3,7 @@
# Caller must first run AM_PATH_LIBFLAC
dnl AM_PATH_LIBFLACPP([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl Test for libFLAC++, and define LIBFLACPP_CFLAGS and LIBFLACPP_LIBS
dnl Test for libFLAC++, and define LIBFLACPP_CFLAGS, LIBFLACPP_LIBS, LIBFLACPP_LIBDIR
dnl
AC_DEFUN([AM_PATH_LIBFLACPP],
[dnl
@ -15,14 +15,14 @@ AC_ARG_WITH(libFLACPP-includes,[ --with-libFLACPP-includes=DIR Directory wher
AC_ARG_ENABLE(libFLACPPtest, [ --disable-libFLACPPtest Do not try to compile and run a test libFLAC++ program],, enable_libFLACPPtest=yes)
if test "x$libFLACPP_libraries" != "x" ; then
LIBFLACPP_LIBS="-L$libFLACPP_libraries"
LIBFLACPP_LIBDIR="$libFLACPP_libraries"
elif test "x$libFLACPP_prefix" != "x" ; then
LIBFLACPP_LIBS="-L$libFLACPP_prefix/lib"
LIBFLACPP_LIBDIR="$libFLACPP_prefix/lib"
elif test "x$prefix" != "xNONE" ; then
LIBFLACPP_LIBS="-L$libdir"
LIBFLACPP_LIBDIR="$libdir"
fi
LIBFLACPP_LIBS="$LIBFLACPP_LIBS -lFLAC++ $LIBFLAC_LIBS"
LIBFLACPP_LIBS="-L$LIBFLACPP_LIBDIR -lFLAC++ $LIBFLAC_LIBS"
if test "x$libFLACPP_includes" != "x" ; then
LIBFLACPP_CFLAGS="-I$libFLACPP_includes"
@ -42,9 +42,11 @@ AC_ARG_ENABLE(libFLACPPtest, [ --disable-libFLACPPtest Do not try to comp
ac_save_CFLAGS="$CFLAGS"
ac_save_CXXFLAGS="$CXXFLAGS"
ac_save_LIBS="$LIBS"
ac_save_LDPATH="$LD_LIBRARY_PATH"
CFLAGS="$CFLAGS $LIBFLACPP_CFLAGS"
CXXFLAGS="$CXXFLAGS $LIBFLACPP_CFLAGS"
LIBS="$LIBS $LIBFLACPP_LIBS"
LD_LIBRARY_PATH="$LIBFLACPP_LIBDIR:$LIBFLAC_LIBDIR:$LD_LIBRARY_PATH"
dnl
dnl Now check if the installed libFLAC++ is sufficiently new.
dnl
@ -63,7 +65,9 @@ int main ()
],, no_libFLACPP=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
CXXFLAGS="$ac_save_CXXFLAGS"
LIBS="$ac_save_LIBS"
LD_LIBRARY_PATH="$ac_save_LD_LIBRARY_PATH"
fi
if test "x$no_libFLACPP" = "x" ; then
@ -76,7 +80,9 @@ int main ()
else
echo "*** Could not run libFLAC++ test program, checking why..."
CFLAGS="$CFLAGS $LIBFLACPP_CFLAGS"
CXXFLAGS="$CXXFLAGS $LIBFLACPP_CFLAGS"
LIBS="$LIBS $LIBFLACPP_LIBS"
LD_LIBRARY_PATH="$LIBFLACPP_LIBDIR:$LIBFLAC_LIBDIR:$LD_LIBRARY_PATH"
AC_TRY_LINK([
#include <stdio.h>
#include <FLAC++/decoder.h>
@ -95,13 +101,17 @@ int main ()
echo "*** or that you have moved libFLAC++ since it was installed. In the latter case, you"
echo "*** may want to edit the libFLAC++-config script: $LIBFLACPP_CONFIG" ])
CFLAGS="$ac_save_CFLAGS"
CXXFLAGS="$ac_save_CXXFLAGS"
LIBS="$ac_save_LIBS"
LD_LIBRARY_PATH="$ac_save_LD_LIBRARY_PATH"
fi
LIBFLACPP_CFLAGS=""
LIBFLACPP_LIBDIR=""
LIBFLACPP_LIBS=""
ifelse([$2], , :, [$2])
fi
AC_SUBST(LIBFLACPP_CFLAGS)
AC_SUBST(LIBFLACPP_LIBDIR)
AC_SUBST(LIBFLACPP_LIBS)
rm -f conf.libFLAC++test
])