xref: /freebsd/contrib/ntp/sntp/m4/hms_search_lib.m4 (revision 43a5ec4eb41567cc92586503212743d89686d78f)
1dnl Helper function to manage granular libraries
2dnl
3dnl Usage:
4dnl
5dnl LIB_MATH=''
6dnl AC_SUBST([LIB_MATH])
7dnl ...
8dnl HMS_SEARCH_LIBS([LIB_MATH], [sqrt], [m], [AIF], [AINF], [OL])
9dnl
10dnl which expands to something like:
11dnl
12dnl  AC_SEARCH_LIBS([sqrt], [m], [case "$ac_cv_search_sqrt" in
13dnl    'none required') ;;
14dnl    no) ;;
15dnl    *) LIB_MATH="$ac_cv_search_sqrt $LIB_MATH" ;;
16dnl   esac
17dnl   [AIF]],
18dnl   [AINF],
19dnl   [OL])
20dnl
21dnl arguments are: lib-var, function, search-libs, [AIF], [AINF], [other-libs]
22AC_DEFUN([HMS_SEARCH_LIBS],
23[AC_SEARCH_LIBS([$2], [$3], [case "$ac_cv_search_$2[]" in
24 'none required') ;;
25 no) ;;
26 *) $1[]="$ac_cv_search_$2[] $[]$1" ;;
27 esac
28 $4],
29 $5,
30 [$6])])
31