compile and link, rather than looking for files; also export more
information, so it's possible to add rpath information git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@5851 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -1,118 +1,88 @@
|
|||||||
dnl $Id$
|
dnl $Id$
|
||||||
dnl
|
dnl
|
||||||
dnl AC_TEST_PACKAGE(package,header,lib,linkline,default location)
|
dnl AC_TEST_PACKAGE_NEW(package,headers,libraries,extra libs,default locations)
|
||||||
AC_DEFUN(AC_TEST_PACKAGE,
|
|
||||||
[
|
AC_DEFUN(AC_TEST_PACKAGE,[AC_TEST_PACKAGE_NEW($1,[#include <$2>],$4,,$5)])
|
||||||
AC_MSG_CHECKING(for $1)
|
|
||||||
|
AC_DEFUN(AC_TEST_PACKAGE_NEW,[
|
||||||
AC_ARG_WITH($1,
|
AC_ARG_WITH($1,
|
||||||
[ --with-$1=dir use $1 in dir],
|
[ --with-$1=dir use $1 in dir])
|
||||||
[if test "$with_$1" = "no"; then
|
|
||||||
with_$1=
|
|
||||||
fi]
|
|
||||||
)
|
|
||||||
AC_ARG_WITH($1-lib,
|
AC_ARG_WITH($1-lib,
|
||||||
[ --with-$1-lib=dir use $1-lib in dir],
|
[ --with-$1-lib=dir use $1 libraries in dir],
|
||||||
[if test "$withval" = "yes" -o "$withval" = "no"; then
|
[if test "$withval" = "yes" -o "$withval" = "no"; then
|
||||||
AC_MSG_ERROR([No argument for --with-$1-lib])
|
AC_MSG_ERROR([No argument for --with-$1-lib])
|
||||||
elif test "X$with_$1" = "X"; then
|
elif test "X$with_$1" = "X"; then
|
||||||
with_$1=yes
|
with_$1=yes
|
||||||
fi]
|
fi])
|
||||||
)
|
|
||||||
AC_ARG_WITH($1-include,
|
AC_ARG_WITH($1-include,
|
||||||
[ --with-$1-include=dir use $1-include in dir],
|
[ --with-$1-include=dir use $1 headers in dir],
|
||||||
[if test "$withval" = "yes" -o "$withval" = "no"; then
|
[if test "$withval" = "yes" -o "$withval" = "no"; then
|
||||||
AC_MSG_ERROR([No argument for --with-$1-include])
|
AC_MSG_ERROR([No argument for --with-$1-include])
|
||||||
elif test "X$with_$1" = "X"; then
|
elif test "X$with_$1" = "X"; then
|
||||||
with_$1=yes
|
with_$1=yes
|
||||||
fi]
|
fi])
|
||||||
)
|
|
||||||
|
|
||||||
define([foo], translit($1, [a-z], [A-Z]))
|
AC_MSG_CHECKING(for $1)
|
||||||
if test -n "$with_$1" -o -n "$5"; then
|
|
||||||
dnl AC_DEFINE([foo])
|
case "$with_$1" in
|
||||||
if test -n "$with_$1" -a "$with_$1" != "yes"; then
|
yes) ;;
|
||||||
$1_dir="$with_$1"
|
no) ;;
|
||||||
elif test -n "$5"; then
|
"") ;;
|
||||||
$1_dir="$5"
|
*) if test "$with_$1_include" = ""; then
|
||||||
fi
|
with_$1_include="$with_$1/include"
|
||||||
dnl Try to find include
|
fi
|
||||||
if test -n "$with_$1_include"; then
|
if test "$with_$1_lib" = ""; then
|
||||||
trydir=$with_$1_include
|
with_$1_lib="$with_$1/lib$abilibdirext"
|
||||||
elif test -n "$with_$1" -a "$with_$1" != "yes"; then
|
fi
|
||||||
trydir="$with_$1 $with_$1/include"
|
;;
|
||||||
elif test -n "$5"; then
|
esac
|
||||||
trydir="$5/include"
|
header_dirs=
|
||||||
else
|
lib_dirs=
|
||||||
trydir=
|
d='$5'
|
||||||
fi
|
for i in $d; do
|
||||||
found=
|
header_dirs="$header_dirs $i/include"
|
||||||
for i in $trydir ""; do
|
lib_dirs="$lib_dirs $i/lib$abilibdirext"
|
||||||
if test -n "$i"; then
|
done
|
||||||
if test -f $i/$2; then
|
|
||||||
found=yes; res=$i; break
|
case "$with_$1_include" in
|
||||||
fi
|
yes) ;;
|
||||||
else
|
no) ;;
|
||||||
AC_TRY_CPP([#include <$2>], [found=yes; res=$i; break])
|
*) header_dirs="$with_$1_include $header_dirs";;
|
||||||
fi
|
esac
|
||||||
done
|
case "$with_$1_lib" in
|
||||||
if test -n "$found"; then
|
yes) ;;
|
||||||
$1_include=$res
|
no) ;;
|
||||||
elif test -n "$with_$1"; then
|
*) lib_dirs="$with_$1_lib $lib_dirs";;
|
||||||
AC_MSG_ERROR(Cannot find $2)
|
esac
|
||||||
fi
|
|
||||||
dnl Try to find lib
|
save_CFLAGS="$CFLAGS"
|
||||||
if test -n "$with_$1_lib"; then
|
save_LIBS="$LIBS"
|
||||||
trydir=$with_$1_lib
|
ires= lres=
|
||||||
elif test -n "$with_$1" -a "$with_$1" != "yes"; then
|
for i in $header_dirs; do
|
||||||
trydir="$with_$1 $with_$1/lib"
|
CFLAGS="-I$i $save_CFLAGS"
|
||||||
elif test -n "$5"; then
|
AC_TRY_COMPILE([$2],,ires=$i;break)
|
||||||
trydir="$5/lib"
|
done
|
||||||
else
|
for i in $lib_dirs; do
|
||||||
trydir=
|
LIBS="-L$i $3 $4 $save_LIBS"
|
||||||
fi
|
AC_TRY_LINK([$2],,lres=$i;break)
|
||||||
found=
|
done
|
||||||
for i in $trydir ""; do
|
CFLAGS="$save_CFLAGS"
|
||||||
if test -n "$i"; then
|
LIBS="$save_LIBS"
|
||||||
if test -f $i/$3; then
|
|
||||||
found=yes; res=$i; break
|
if test "$ires" -a "$lres"; then
|
||||||
fi
|
$1_includedir="$ires"
|
||||||
else
|
$1_libdir="$lres"
|
||||||
old_LIBS=$LIBS
|
INCLUDE_$1="-I$$1_includedir"
|
||||||
LIBS="$4 $LIBS"
|
LIB_$1="-L$$1_libdir $3"
|
||||||
AC_TRY_LINK([], [], [found=yes; res=$i; LIBS=$old_LIBS; break])
|
AC_DEFINE_UNQUOTED(upcase($1),1,[Define if you have the $1 package.])
|
||||||
LIBS=$old_LIBS
|
with_$1=yes
|
||||||
fi
|
AC_MSG_RESULT([headers $ires, libraries $lres])
|
||||||
done
|
|
||||||
if test -n "$found"; then
|
|
||||||
$1_lib=$res
|
|
||||||
elif test -n "$with_$1"; then
|
|
||||||
AC_MSG_ERROR(Cannot find $3)
|
|
||||||
fi
|
|
||||||
if test -n "$$1_include" -o -n "$$1_lib"; then
|
|
||||||
AC_MSG_RESULT([headers $$1_include, libraries $$1_lib])
|
|
||||||
AC_DEFINE_UNQUOTED(foo, 1, [Define if you have the $1 package])
|
|
||||||
if test "$with_$1" = "" -a "$5"; then
|
|
||||||
with_$1="$5"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
AC_MSG_RESULT(no)
|
|
||||||
fi
|
|
||||||
if test -n "$$1_include"; then
|
|
||||||
INCLUDE_$1="-I$$1_include"
|
|
||||||
fi
|
|
||||||
AC_SUBST(INCLUDE_$1)
|
|
||||||
foo[INCLUDE]="$INCLUDE_$1"
|
|
||||||
AC_SUBST(foo[INCLUDE])
|
|
||||||
if test -n "$$1_lib"; then
|
|
||||||
LIB_$1="-L$$1_lib"
|
|
||||||
fi
|
|
||||||
LIB_$1="$LIB_$1 $4"
|
|
||||||
AC_SUBST(LIB_$1)
|
|
||||||
foo[LIB]="$LIB_$1"
|
|
||||||
AC_SUBST(foo[LIB])
|
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT(no)
|
INCLUDE_$1=
|
||||||
|
LIB_$1=
|
||||||
|
with_$1=no
|
||||||
|
AC_MSG_RESULT($with_$1)
|
||||||
fi
|
fi
|
||||||
undefine([foo])
|
AC_SUBST(INCLUDE_$1)
|
||||||
|
AC_SUBST(LIB_$1)
|
||||||
])
|
])
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user