xref: /netbsd-src/external/bsd/am-utils/dist/m4/macros/check_map_funcs.m4 (revision a53f50b9b44dc9467ccc9c464999b1d1c509cb0c)
1*a53f50b9Schristosdnl ######################################################################
2*a53f50b9Schristosdnl check if a map exists (if some library function exists).
3*a53f50b9Schristosdnl Usage: AC_CHECK_MAP_FUNCS(<functions>..., <map>, [<mapsymbol>])
4*a53f50b9Schristosdnl Check if any of the functions <functions> exist.  If any exist, then
5*a53f50b9Schristosdnl define HAVE_MAP_<map>.  If <mapsymbol> exits, then defined
6*a53f50b9Schristosdnl HAVE_MAP_<mapsymbol> instead...
7*a53f50b9SchristosAC_DEFUN([AMU_CHECK_MAP_FUNCS],
8*a53f50b9Schristos[
9*a53f50b9Schristos# find what name to give to the map
10*a53f50b9Schristosif test -n "$3"
11*a53f50b9Schristosthen
12*a53f50b9Schristos  ac_map_name=$3
13*a53f50b9Schristoselse
14*a53f50b9Schristos  ac_map_name=$2
15*a53f50b9Schristosfi
16*a53f50b9Schristos# store variable name of map
17*a53f50b9Schristosac_upcase_map_name=`echo $ac_map_name | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
18*a53f50b9Schristosac_safe=HAVE_MAP_$ac_upcase_map_name
19*a53f50b9Schristos# check for cache and set it if needed
20*a53f50b9SchristosAMU_CACHE_CHECK_DYNAMIC(for $ac_map_name maps,
21*a53f50b9Schristosac_cv_map_$ac_map_name,
22*a53f50b9Schristos[
23*a53f50b9Schristos# define to "no" by default
24*a53f50b9Schristoseval "ac_cv_map_$ac_map_name=no"
25*a53f50b9Schristos# and look to see if it was found
26*a53f50b9SchristosAC_CHECK_FUNCS($1,
27*a53f50b9Schristos[
28*a53f50b9Schristos  eval "ac_cv_map_$ac_map_name=yes"
29*a53f50b9Schristos  break
30*a53f50b9Schristos])])
31*a53f50b9Schristos# check if need to define variable
32*a53f50b9Schristosif test "`eval echo '$''{ac_cv_map_'$ac_map_name'}'`" = yes
33*a53f50b9Schristosthen
34*a53f50b9Schristos  AC_DEFINE_UNQUOTED($ac_safe)
35*a53f50b9Schristos# append info_<map>.o object to AMD_INFO_OBJS for automatic compilation
36*a53f50b9Schristos# if first time we add something to this list, then also tell autoconf
37*a53f50b9Schristos# to replace instances of it in Makefiles.
38*a53f50b9Schristos  if test -z "$AMD_INFO_OBJS"
39*a53f50b9Schristos  then
40*a53f50b9Schristos    AMD_INFO_OBJS="info_${ac_map_name}.o"
41*a53f50b9Schristos    AC_SUBST(AMD_INFO_OBJS)
42*a53f50b9Schristos  else
43*a53f50b9Schristos    AMD_INFO_OBJS="$AMD_INFO_OBJS info_${ac_map_name}.o"
44*a53f50b9Schristos  fi
45*a53f50b9Schristosfi
46*a53f50b9Schristos])
47*a53f50b9Schristosdnl ======================================================================
48