Build: New alternative to identify the presence of libfuzzy

Searching for the fuzzy.h instead of the .so file.
This commit is contained in:
Felipe Zimmerle 2014-11-14 10:56:02 -08:00
parent 723336f1fb
commit eb61e891ae

View File

@ -18,62 +18,39 @@ AC_ARG_WITH(
AS_CASE(["${with_ssdeep}"], AS_CASE(["${with_ssdeep}"],
[no], [test_paths=], [no], [test_paths=],
[yes], [test_paths="/usr/lib /usr/local/lib /usr/local/libfuzzy /usr/local/fuzzy /usr/local /opt/libfuzzy /opt/fuzzy /opt /usr"]) [yes], [test_paths="/usr/ /usr/local/ /usr/local/libfuzzy /usr/local/fuzzy /opt/libfuzzy /opt/fuzzy /opt /opt/local"],
[test_paths="${with_ssdeep}"], [test_paths="${with_ssdeep}"])
AS_IF([test "x${test_paths}" != "x"], [ AS_IF([test "x${test_paths}" != "x"], [
AC_MSG_CHECKING([for ssdeep path]) AC_MSG_CHECKING([for ssdeep path])
SSDEEP_LIB_NAME="fuzzy" SSDEEP_LIB_NAME="fuzzy"
SSDEEP_LIB_FILENAME="lib$SSDEEP_LIB_NAME.so"
if test -z "$withssdeep" -o "$withssdeep" = "yes"; then if test -z "$withssdeep" -o "$withssdeep" = "yes"; then
for i in ${test_paths}; do for i in ${test_paths}; do
if test -f "$i/$SSDEEP_LIB_FILENAME"; then if test -f "$i/include/fuzzy.h"; then
SSDEEP_LIB_DIR="$i"
fi
done
else
if test -f "$withssdeep/$SSDEEP_LIB_FILENAME"; then
SSDEEP_LIB_DIR="$withssdeep"
else
if test -f "$withssdeep/.libs/$SSDEEP_LIB_FILENAME"; then
SSDEEP_LIB_DIR="$withssdeep/.libs/"
fi
fi
fi
SSDEEP_LDFLAGS="-l$SSDEEP_LIB_NAME"
SSDEEP_LDADD="-l$SSDEEP_LIB_NAME"
if test -z "$withssdeep" -o "$withssdeep" = "yes"; then
for i in /usr/include /usr/local/include; do
if test -f "$i/$SSDEEP_LIB_NAME.h"; then
SSDEEP_CFLAGS="-I$i" SSDEEP_CFLAGS="-I$i"
fi fi
done done
else else
if test -f "$withssdeep/../$SSDEEP_LIB_NAME.h"; then if test -f "$withssdeep/include/fuzzy.h"; then
SSDEEP_CFLAGS="-I$withssdeep/../" SSDEEP_CFLAGS="-I$i"
else
if test -f "$withssdeep/$SSDEEP_LIB_NAME.h"; then
SSDEEP_CFLAGS="-I$withssdeep"
fi
fi fi
fi fi
SSDEEP_LDFLAGS="-lfuzzy"
SSDEEP_LDADD="-lfuzzy"
]) ])
if test -z "${SSDEEP_CFLAGS}"; then if test -z "${SSDEEP_CFLAGS}"; then
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
SSDEEP_LDFLAGS="" SSDEEP_LDFLAGS=""
SSDEEP_LDADD="" SSDEEP_LDADD=""
#ifelse([$2], , AC_MSG_NOTICE([optional ssdeep library not found]), $2) AC_MSG_NOTICE([optional ssdeep library not found])
else else
SSDEEP_CFLAGS="-DWITH_SSDEEP ${SSDEEP_CFLAGS}" SSDEEP_CFLAGS="-DWITH_SSDEEP ${SSDEEP_CFLAGS}"
AC_MSG_RESULT([${SSDEEP_LDFLAGS} ${SSDEEP_CFLAGS}]) AC_MSG_RESULT([${SSDEEP_LDFLAGS} ${SSDEEP_CFLAGS}])
#AC_MSG_NOTICE([using ssdeep: ${SSDEEP_CFLAGS} ${SSDEEP_LDFLAGS}])
#ifelse([$1], , , $1)
fi fi
AC_SUBST(SSDEEP_LDFLAGS) AC_SUBST(SSDEEP_LDFLAGS)