1 AC_DEFUN([OPENAFS_TEST_PACKAGE],[
3 [ --with-$1=dir use $1 in dir])
5 [ --with-$1-lib=dir use $1 libraries in dir],
6 [if test "$withval" = "yes" -o "$withval" = "no"; then
7 AC_MSG_ERROR([No argument for --with-$1-lib])
8 elif test "X$with_$1" = "X"; then
11 AC_ARG_WITH($1-include,
12 [ --with-$1-include=dir use $1 headers in dir],
13 [if test "$withval" = "yes" -o "$withval" = "no"; then
14 AC_MSG_ERROR([No argument for --with-$1-include])
15 elif test "X$with_$1" = "X"; then
19 AC_MSG_CHECKING(for $1)
25 *) if test "$with_$1_include" = ""; then
26 with_$1_include="$with_$1/include"
28 if test "$with_$1_lib" = ""; then
29 with_$1_lib="$with_$1/lib$abilibdirext"
37 header_dirs="$header_dirs $i/include"
38 lib_dirs="$lib_dirs $i/lib$abilibdirext"
41 case "$with_$1_include" in
44 *) header_dirs="$with_$1_include $header_dirs";;
46 case "$with_$1_lib" in
49 *) lib_dirs="$with_$1_lib $lib_dirs";;
55 for i in $header_dirs; do
56 CFLAGS="-I$i $save_CFLAGS"
57 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$2]], [[]])],[ires=$i;break],[])
59 for i in $lib_dirs; do
60 LIBS="-L$i $3 $4 $save_LIBS"
61 AC_LINK_IFELSE([AC_LANG_PROGRAM([[$2]], [[]])],[lres=$i;break],[])
66 if test "$ires" -a "$lres" -a "$with_$1" != "no"; then
69 INCLUDE_$1="-I$$1_includedir"
70 LIB_$1="-L$$1_libdir $3"
71 AC_DEFINE_UNQUOTED(m4_toupper($1),1,[Define if you have the $1 package.])
72 AC_DEFINE_UNQUOTED(m4_toupper(HAVE_$1),1,[Define if you have the $1 package.])
74 AC_MSG_RESULT([headers $ires, libraries $lres])
79 AC_MSG_RESULT($with_$1)