1 # NP_FINDLIB(VARNAME, NAME, STRING, TESTAPP, CFLAGS, LIBS, ACTION_IF_FOUND,
2 # ACTION_IF_NOT_FOUND, EXTRACFLAGS, EXTRALIBS)
3 AC_DEFUN([NP_FINDLIB], [
4 AC_ARG_WITH([lib$2], [AC_HELP_STRING([--with-lib$2=dir],
5 [specify location of lib$2 if not detected automatically; uses
6 dir, dir/include and dir/lib])])
9 save_CPPFLAGS="$CPPFLAGS"
14 CFLAGS="$CFLAGS $5 $9"
15 CPPFLAGS="$CPPFLAGS $5 $9"
18 AS_IF([test -n "$with_lib$2"], [
19 CFLAGS="-I$with_lib$2/include $CFLAGS"
20 CPPFLAGS="-I$with_lib$2/include $CPPFLAGS"
21 LIBS="-L$with_lib$2/lib $LIBS"
22 RESCFLAGS="-I$with_lib$2/include $RESCFLAGS"
23 RESLIBS="-L$with_lib$2/lib $RESLIBS"
26 AC_MSG_CHECKING([for $3])
28 AC_LINK_IFELSE([$4], [buildok=yes], [buildok=no])
31 CPPFLAGS=$save_CPPFLAGS
34 AS_IF([test $buildok = yes],
35 [AC_MSG_RESULT([found])
37 $1_CFLAGS="$RESCFLAGS"
39 [AC_MSG_RESULT([not found])
44 AC_SUBST([$1_AVAILABLE])
48 AS_IF([test $buildok = yes],
49 [ifelse([$7], , :, [$7])],
50 [ifelse([$8], , :, [$8])])