lib-check.m4: Add copyright notice.
[platform/upstream/coreutils.git] / m4 / lib-check.m4
1 #serial 8
2
3 dnl Misc lib-related macros for coreutils.
4
5 # Copyright (C) 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2003, 2004,
6 # 2005 Free Software Foundation, Inc.
7
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2, or (at your option)
11 # any later version.
12
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software Foundation,
20 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
22 # Written by Jim Meyering.
23
24 AC_DEFUN([cu_LIB_CHECK],
25 [
26
27   # Check for libypsec.a on Dolphin M88K machines.
28   AC_CHECK_LIB(ypsec, main)
29
30   # m88k running dgux 5.4 needs this
31   AC_CHECK_LIB(ldgc, main)
32
33   # Some programs need to link with -lm.  printf does if it uses
34   # lib/strtod.c which uses pow.  And seq uses the math functions,
35   # floor, modf, rint.  And sleep uses fesetround.
36
37   # Check for these math functions used by seq.
38   AC_SUBST([SEQ_LIBM])
39   cu_saved_libs=$LIBS
40   AC_SEARCH_LIBS([floor], [m])
41   AC_SEARCH_LIBS([modf], [m])
42   AC_SEARCH_LIBS([rint], [m])
43   AC_CHECK_FUNCS([floor modf rint])
44   test "X$LIBS" = "X$cu_saved_libs" || SEQ_LIBM=-lm
45   LIBS=$cu_saved_libs
46
47   AC_SUBST(FESETROUND_LIBM)
48   cu_saved_libs=$LIBS
49   AC_SEARCH_LIBS([fesetround], [m])
50   AC_CHECK_FUNCS([fesetround])
51   test "X$LIBS" = "X$cu_saved_libs" || FESETROUND_LIBM=-lm
52   LIBS=$cu_saved_libs
53
54   # The -lsun library is required for YP support on Irix-4.0.5 systems.
55   # m88k/svr3 DolphinOS systems using YP need -lypsec for id.
56   AC_SEARCH_LIBS(yp_match, [sun ypsec])
57
58   # SysV needs -lsec, older versions of Linux need -lshadow for
59   # shadow passwords.  UnixWare 7 needs -lgen.
60   AC_SEARCH_LIBS(getspnam, [shadow sec gen])
61
62   AC_CHECK_HEADERS(shadow.h)
63
64   # Requirements for su.c.
65   shadow_includes="\
66 $ac_includes_default
67 #if HAVE_SHADOW_H
68 # include <shadow.h>
69 #endif
70 "
71   AC_CHECK_MEMBERS([struct spwd.sp_pwdp],,,[$shadow_includes])
72   AC_CHECK_FUNCS(getspnam)
73
74   # SCO-ODT-3.0 is reported to need -lufc for crypt.
75   # NetBSD needs -lcrypt for crypt.
76   cu_saved_libs="$LIBS"
77   AC_SEARCH_LIBS(crypt, [ufc crypt],
78                  [test "$ac_cv_search_crypt" = "none required" ||
79                   LIB_CRYPT="$ac_cv_search_crypt"])
80   LIBS="$cu_saved_libs"
81   AC_SUBST(LIB_CRYPT)
82 ])