1dnl Process this file with autoconf to produce a configure script.
2AC_INIT([which], [2.21])
3AC_CONFIG_SRCDIR(which.c)
4AM_INIT_AUTOMAKE
5AM_CONFIG_HEADER(config.h)
6AM_MAINTAINER_MODE
7
8dnl Because we use cwautomacros.
9CW_AUTOMACROS
10
11which_cv_iberty=yes
12AC_ARG_ENABLE(iberty,
13  [  --disable-iberty        do not try to find and use the iberty library],
14  which_cv_iberty=$enableval)
15
16dnl Checks for programs.
17AC_PROG_CC
18AC_PROG_INSTALL
19AC_LANG_C
20AC_MINIX
21
22dnl Checks for libraries.
23if test "$which_cv_iberty" = yes ; then
24  AC_CHECK_STATICLIB(libiberty.a, xmalloc)
25fi
26
27dnl Checks for header files.
28AC_HEADER_STDC
29AC_CHECK_HEADERS(unistd.h string.h libiberty.h)
30AC_HEADER_STAT
31
32dnl Checks for typedefs, structures, and compiler characteristics.
33AC_C_CONST
34AC_TYPE_SIZE_T
35
36dnl Checks for library functions.
37AC_TYPE_GETGROUPS
38AC_CHECK_FUNCS(strchr memcpy getopt_long getcwd getwd sysconf getgroups eaccess)
39
40if test "$ac_cv_lib_static_libiberty_a_xmalloc" = no \
41     -o "$which_cv_iberty" = no ; then
42  AC_DEFINE([NEED_XMALLOC], 1, [Define if you need xmalloc().])
43fi
44
45dnl Additional stuff needed for the tilde directory
46AC_CHECK_PROG(AR, ar, ar, ar)
47AC_PROG_RANLIB
48AC_CHECK_HEADERS(stdlib.h memory.h pwd.h strings.h)
49AC_CHECK_FUNCS(getpwent getpwnam getpwuid)
50BASH_CHECK_GETPW_FUNCS
51
52dnl Generate output files.
53AC_OUTPUT([Makefile maintMakefile tilde/Makefile])
54