Skip to content

Instantly share code, notes, and snippets.

@misuchiru03
Created November 26, 2018 02:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save misuchiru03/994f60b5291761660f03ac8bd560bb99 to your computer and use it in GitHub Desktop.
Save misuchiru03/994f60b5291761660f03ac8bd560bb99 to your computer and use it in GitHub Desktop.
moloch check yara
# Check whether --with-yara was given.
if test "${with_yara+set}" = set; then :
withval=$with_yara; case "$withval" in
yes|no)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
;;
*)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $withval" >&5
$as_echo "$withval" >&6; }
if test -f $withval/libyara/yara.h -a -f $withval/libyara/.libs/libyara.a; then
owd=`pwd`
if cd $withval; then
withval=`pwd`;
cd $owd;
fi
YARA_CFLAGS="-I$withval/libyara"
YARA_LIBS="$withval/libyara/.libs/libyara.a"
elif test -f $withval/libyara/include/yara.h -a -f $withval/libyara/.libs/libyara.a; then
owd=`pwd`
if cd $withval; then
withval=`pwd`;
cd $owd;
fi
YARA_CFLAGS="-I$withval/libyara/include"
YARA_LIBS="$withval/libyara/.libs/libyara.a"
elif test -f $withval/include/yara.h -a -f $withval/lib/libyara.a; then
owd=`pwd`
if cd $withval; then
withval=`pwd`;
cd $owd;
fi
YARA_CFLAGS="-I$withval/include"
YARA_LIBS="$withval/lib/libyara.a"
else
as_fn_error $? "yara.h or yara.a not found in $withval" "$LINENO" 5
fi
;;
esac
else
if test -f ${prefix}/include/libyara/yara.h; then
YARA_CFLAGS="-I${prefix}/include/libyara"
YARA_LIBS="-L${exec_prefix}/lib -lyara"
elif test -f /usr/include/libyara/yara.h; then
YARA_CFLAGS=""
YARA_LIBS="-lyara"
else
TMP=$LIBS
LIBS="-lyara $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <yara.h>
int
main ()
{
yr_init()
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
LIBYARA_FOUND=1
else
LIBYARA_FOUND=0
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$TMP
if test $LIBYARA_FOUND = 1 ; then
YARA_LIBS="-lyara"
else
as_fn_error $? "yara not found" "$LINENO" 5
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment