1*ebfedea0SLionel Sambucdnl Id 2*ebfedea0SLionel Sambucdnl 3*ebfedea0SLionel Sambucdnl 4*ebfedea0SLionel Sambucdnl Look for function in any of the specified libraries 5*ebfedea0SLionel Sambucdnl 6*ebfedea0SLionel Sambuc 7*ebfedea0SLionel Sambucdnl AC_FIND_FUNC_NO_LIBS2(func, libraries, includes, arguments, extra libs, extra args) 8*ebfedea0SLionel SambucAC_DEFUN([AC_FIND_FUNC_NO_LIBS2], [ 9*ebfedea0SLionel Sambuc 10*ebfedea0SLionel SambucAC_MSG_CHECKING([for $1]) 11*ebfedea0SLionel SambucAC_CACHE_VAL(ac_cv_funclib_$1, 12*ebfedea0SLionel Sambuc[ 13*ebfedea0SLionel Sambucif eval "test \"\$ac_cv_func_$1\" != yes" ; then 14*ebfedea0SLionel Sambuc ac_save_LIBS="$LIBS" 15*ebfedea0SLionel Sambuc for ac_lib in $2; do 16*ebfedea0SLionel Sambuc case "$ac_lib" in 17*ebfedea0SLionel Sambuc "") ;; 18*ebfedea0SLionel Sambuc yes) ac_lib="" ;; 19*ebfedea0SLionel Sambuc no) continue ;; 20*ebfedea0SLionel Sambuc -l*) ;; 21*ebfedea0SLionel Sambuc *) ac_lib="-l$ac_lib" ;; 22*ebfedea0SLionel Sambuc esac 23*ebfedea0SLionel Sambuc LIBS="$6 $ac_lib $5 $ac_save_LIBS" 24*ebfedea0SLionel Sambuc 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*ebfedea0SLionel Sambuc done 26*ebfedea0SLionel Sambuc eval "ac_cv_funclib_$1=\${ac_cv_funclib_$1-no}" 27*ebfedea0SLionel Sambuc LIBS="$ac_save_LIBS" 28*ebfedea0SLionel Sambucfi 29*ebfedea0SLionel Sambuc]) 30*ebfedea0SLionel Sambuc 31*ebfedea0SLionel Sambuceval "ac_res=\$ac_cv_funclib_$1" 32*ebfedea0SLionel Sambuc 33*ebfedea0SLionel Sambucif false; then 34*ebfedea0SLionel Sambuc AC_CHECK_FUNCS($1) 35*ebfedea0SLionel Sambucdnl AC_CHECK_LIBS($2, foo) 36*ebfedea0SLionel Sambucfi 37*ebfedea0SLionel Sambuc# $1 38*ebfedea0SLionel Sambuceval "ac_tr_func=HAVE_[]upcase($1)" 39*ebfedea0SLionel Sambuceval "ac_tr_lib=HAVE_LIB[]upcase($ac_res | sed -e 's/-l//')" 40*ebfedea0SLionel Sambuceval "LIB_$1=$ac_res" 41*ebfedea0SLionel Sambuc 42*ebfedea0SLionel Sambuccase "$ac_res" in 43*ebfedea0SLionel Sambuc yes) 44*ebfedea0SLionel Sambuc eval "ac_cv_func_$1=yes" 45*ebfedea0SLionel Sambuc eval "LIB_$1=" 46*ebfedea0SLionel Sambuc AC_DEFINE_UNQUOTED($ac_tr_func) 47*ebfedea0SLionel Sambuc AC_MSG_RESULT([yes]) 48*ebfedea0SLionel Sambuc ;; 49*ebfedea0SLionel Sambuc no) 50*ebfedea0SLionel Sambuc eval "ac_cv_func_$1=no" 51*ebfedea0SLionel Sambuc eval "LIB_$1=" 52*ebfedea0SLionel Sambuc AC_MSG_RESULT([no]) 53*ebfedea0SLionel Sambuc ;; 54*ebfedea0SLionel Sambuc *) 55*ebfedea0SLionel Sambuc eval "ac_cv_func_$1=yes" 56*ebfedea0SLionel Sambuc eval "ac_cv_lib_`echo "$ac_res" | sed 's/-l//'`=yes" 57*ebfedea0SLionel Sambuc AC_DEFINE_UNQUOTED($ac_tr_func) 58*ebfedea0SLionel Sambuc AC_DEFINE_UNQUOTED($ac_tr_lib) 59*ebfedea0SLionel Sambuc AC_MSG_RESULT([yes, in $ac_res]) 60*ebfedea0SLionel Sambuc ;; 61*ebfedea0SLionel Sambucesac 62*ebfedea0SLionel SambucAC_SUBST(LIB_$1) 63*ebfedea0SLionel Sambuc]) 64