source: branches/samba-3.5.x/source4/heimdal/cf/find-func-no-libs2.m4

Last change on this file was 414, checked in by Herwig Bauernfeind, 16 years ago

Samba 3.5.0: Initial import

File size: 1.3 KB
Line 
1dnl $Id$
2dnl
3dnl
4dnl Look for function in any of the specified libraries
5dnl
6
7dnl AC_FIND_FUNC_NO_LIBS2(func, libraries, includes, arguments, extra libs, extra args)
8AC_DEFUN([AC_FIND_FUNC_NO_LIBS2], [
9
10AC_MSG_CHECKING([for $1])
11AC_CACHE_VAL(ac_cv_funclib_$1,
12[
13if eval "test \"\$ac_cv_func_$1\" != yes" ; then
14 ac_save_LIBS="$LIBS"
15 for ac_lib in $2; do
16 case "$ac_lib" in
17 "") ;;
18 yes) ac_lib="" ;;
19 no) continue ;;
20 -l*) ;;
21 *) ac_lib="-l$ac_lib" ;;
22 esac
23 LIBS="$6 $ac_lib $5 $ac_save_LIBS"
24 AC_LINK_IFELSE([AC_LANG_PROGRAM([[$3]],[[$1($4)]])],[eval "if test -n \"$ac_lib\";then ac_cv_funclib_$1=$ac_lib; else ac_cv_funclib_$1=yes; fi";break])
25 done
26 eval "ac_cv_funclib_$1=\${ac_cv_funclib_$1-no}"
27 LIBS="$ac_save_LIBS"
28fi
29])
30
31eval "ac_res=\$ac_cv_funclib_$1"
32
33if false; then
34 AC_CHECK_FUNCS($1)
35dnl AC_CHECK_LIBS($2, foo)
36fi
37# $1
38eval "ac_tr_func=HAVE_[]upcase($1)"
39eval "ac_tr_lib=HAVE_LIB[]upcase($ac_res | sed -e 's/-l//')"
40eval "LIB_$1=$ac_res"
41
42case "$ac_res" in
43 yes)
44 eval "ac_cv_func_$1=yes"
45 eval "LIB_$1="
46 AC_DEFINE_UNQUOTED($ac_tr_func)
47 AC_MSG_RESULT([yes])
48 ;;
49 no)
50 eval "ac_cv_func_$1=no"
51 eval "LIB_$1="
52 AC_MSG_RESULT([no])
53 ;;
54 *)
55 eval "ac_cv_func_$1=yes"
56 eval "ac_cv_lib_`echo "$ac_res" | sed 's/-l//'`=yes"
57 AC_DEFINE_UNQUOTED($ac_tr_func)
58 AC_DEFINE_UNQUOTED($ac_tr_lib)
59 AC_MSG_RESULT([yes, in $ac_res])
60 ;;
61esac
62AC_SUBST(LIB_$1)
63])
Note: See TracBrowser for help on using the repository browser.