summaryrefslogtreecommitdiff
path: root/m4/lib-check.m4
blob: 2d9d0d0e235405cf573cc965f9a2969dd21fc9da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#serial 8

dnl Misc lib-related macros for coreutils.

# Copyright (C) 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2003, 2004,
# 2005 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

# Written by Jim Meyering.

AC_DEFUN([cu_LIB_CHECK],
[

  # Check for libypsec.a on Dolphin M88K machines.
  AC_CHECK_LIB(ypsec, main)

  # m88k running dgux 5.4 needs this
  AC_CHECK_LIB(ldgc, main)

  # Some programs need to link with -lm.  printf does if it uses
  # lib/strtod.c which uses pow.  And seq uses the math functions,
  # floor, modf, rint.  And sleep uses fesetround.

  # Check for these math functions used by seq.
  AC_SUBST([SEQ_LIBM])
  cu_saved_libs=$LIBS
  AC_SEARCH_LIBS([floor], [m])
  AC_SEARCH_LIBS([modf], [m])
  AC_SEARCH_LIBS([rint], [m])
  AC_CHECK_FUNCS([floor modf rint])
  test "X$LIBS" = "X$cu_saved_libs" || SEQ_LIBM=-lm
  LIBS=$cu_saved_libs

  AC_SUBST(FESETROUND_LIBM)
  cu_saved_libs=$LIBS
  AC_SEARCH_LIBS([fesetround], [m])
  AC_CHECK_FUNCS([fesetround])
  test "X$LIBS" = "X$cu_saved_libs" || FESETROUND_LIBM=-lm
  LIBS=$cu_saved_libs

  # The -lsun library is required for YP support on Irix-4.0.5 systems.
  # m88k/svr3 DolphinOS systems using YP need -lypsec for id.
  AC_SEARCH_LIBS(yp_match, [sun ypsec])

  # SysV needs -lsec, older versions of Linux need -lshadow for
  # shadow passwords.  UnixWare 7 needs -lgen.
  AC_SEARCH_LIBS(getspnam, [shadow sec gen])

  AC_CHECK_HEADERS(shadow.h)

  # Requirements for su.c.
  shadow_includes="\
$ac_includes_default
#if HAVE_SHADOW_H
# include <shadow.h>
#endif
"
  AC_CHECK_MEMBERS([struct spwd.sp_pwdp],,,[$shadow_includes])
  AC_CHECK_FUNCS(getspnam)

  # SCO-ODT-3.0 is reported to need -lufc for crypt.
  # NetBSD needs -lcrypt for crypt.
  cu_saved_libs="$LIBS"
  AC_SEARCH_LIBS(crypt, [ufc crypt],
		 [test "$ac_cv_search_crypt" = "none required" ||
		  LIB_CRYPT="$ac_cv_search_crypt"])
  LIBS="$cu_saved_libs"
  AC_SUBST(LIB_CRYPT)
])