Add 'restrict' module.
[gnulib.git] / m4 / lib-check.m4
1 #serial 5
2
3 dnl Misc lib-related macros for fileutils, sh-utils, textutils.
4
5 AC_DEFUN([jm_LIB_CHECK],
6 [
7
8   # Check for libypsec.a on Dolphin M88K machines.
9   AC_CHECK_LIB(ypsec, main)
10
11   # m88k running dgux 5.4 needs this
12   AC_CHECK_LIB(ldgc, main)
13
14   # Some programs need to link with -lm.  printf does if it uses
15   # lib/strtod.c which uses pow.  And seq uses the math functions,
16   # floor, modf, rint.  And factor uses sqrt.  And sleep uses fesetround.
17
18   # Save a copy of $LIBS and add $FLOOR_LIBM before these tests
19   # Check for these math functions used by seq.
20   ac_su_saved_lib="$LIBS"
21   LIBS="$LIBS -lm"
22   AC_CHECK_FUNCS(floor modf rint)
23   LIBS="$ac_su_saved_lib"
24
25   AC_SUBST(SQRT_LIBM)
26   AC_CHECK_FUNCS(sqrt)
27   if test $ac_cv_func_sqrt = no; then
28     AC_CHECK_LIB(m, sqrt, [SQRT_LIBM=-lm])
29   fi
30
31   AC_SUBST(FESETROUND_LIBM)
32   AC_CHECK_FUNCS(fesetround)
33   if test $ac_cv_func_fesetround = no; then
34     AC_CHECK_LIB(m, fesetround, [FESETROUND_LIBM=-lm])
35   fi
36
37   # The -lsun library is required for YP support on Irix-4.0.5 systems.
38   # m88k/svr3 DolphinOS systems using YP need -lypsec for id.
39   AC_SEARCH_LIBS(yp_match, [sun ypsec])
40
41   # SysV needs -lsec, older versions of Linux need -lshadow for
42   # shadow passwords.  UnixWare 7 needs -lgen.
43   AC_SEARCH_LIBS(getspnam, [shadow sec gen])
44
45   AC_CHECK_HEADERS(shadow.h)
46
47   # Requirements for su.c.
48   shadow_includes="\
49 $ac_includes_default
50 #if HAVE_SHADOW_H
51 # include <shadow.h>
52 #endif
53 "
54   AC_CHECK_MEMBERS([struct spwd.sp_pwdp],,,[$shadow_includes])
55   AC_CHECK_FUNCS(getspnam)
56
57   # SCO-ODT-3.0 is reported to need -lufc for crypt.
58   # NetBSD needs -lcrypt for crypt.
59   ac_su_saved_lib="$LIBS"
60   AC_SEARCH_LIBS(crypt, [ufc crypt], [LIB_CRYPT="$ac_cv_search_crypt"])
61   LIBS="$ac_su_saved_lib"
62   AC_SUBST(LIB_CRYPT)
63 ])