1dnl Copyright (C) 1996 Noah S. Friedman <friedman@prep.ai.mit.edu>
2
3dnl $Id$
4
5dnl This program is free software; you can redistribute it and/or modify
6dnl it under the terms of the GNU General Public License as published by
7dnl the Free Software Foundation; either version 2, or (at your option)
8dnl any later version.
9dnl
10dnl This program is distributed in the hope that it will be useful,
11dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13dnl GNU General Public License for more details.
14dnl
15dnl You should have received a copy of the GNU General Public License
16dnl along with this program; if not, you can either send email to this
17dnl program's maintainer or write to: The Free Software Foundation,
18dnl Inc.; 59 Temple Place, Suite 330; Boston, MA 02111-1307, USA.
19
20dnl ############################################################
21
22define([AC_ARG_WITH_RESOLV],
23[AC_ARG_WITH([resolv],
24   [  --with-resolv           Use -lresolv for host name lookups.
25  --without-resolv        Do not use -lresolv for host name lookups.],
26   [sed_downcase='y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'
27    val=`echo "$withval" | sed -e "$sed_downcase"`
28    case "$val" in
29      "" )               ac_use_resolv=yes ;;
30      yes | no | maybe ) ac_use_resolv=$val ;;
31      * ) AC_MSG_ERROR([$withval: invalid argument to --with-resolv]) ;;
32    esac
33   ],[# Default is not to link with resolv.
34      ac_use_resolv=no
35   ])dnl
36])
37
38dnl ############################################################
39
40define([AC_USE_RESOLV],[
41# Check whether resolv support is desired.
42# If --with-resolv is specified to configure, support for resolv must
43#   be available or configure will exit with an error.
44# If --without-resolv is specified, no attempt is made to look for
45#   resolv headers or libraries.
46# By default, configure will use resolv if all the necessary support is
47#   available, otherwise it won't.  No fatal errors should occur in either
48#   circumstance.
49
50# Default if not otherwise found
51ac_resolv_support=no
52
53if test $ac_use_resolv != no ; then
54  AC_CHECK_LIB(resolv, gethostbyname)
55  if eval test '$'ac_cv_lib_resolv_gethostbyname = yes; then
56    ac_resolv_support=yes
57  elif test $ac_use_resolv = yes; then
58    AC_MSG_ERROR([Cannot link with -lresolv.  Is it missing?])
59  fi
60fi])
61
62dnl ############################################################
63
64define([AC_ARG_ENABLE_XAUTH],
65[AC_ARG_ENABLE([xauth],
66  [  --enable-xauth          Support XAUTH authentication support.
67  --disable-xauth         Do not support XAUTH authentication support.],
68  [sed_downcase='y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'
69   val=`echo "$enableval" | sed -e "$sed_downcase"`
70   case "$val" in
71     yes | no | try ) require_xauth=$val ;;
72     * ) AC_MSG_ERROR([$enableval: invalid argument to --enable-xauth]) ;;
73    esac],[require_xauth=try])])
74
75dnl ############################################################
76
77define([AC_HAVE_XAUTH],
78[AC_PATH_X
79AC_SUBST(LIBXAUTH)
80if test "$require_xauth" != "no" ; then
81  if test "$have_x" = yes; then
82    o_CPPFLAGS="$CPPFLAGS"
83    CPPFLAGS="$CPPFLAGS -I$x_includes -L$x_libraries"
84  fi
85
86  AC_CHECK_HEADER(X11/Xauth.h,[use_xauth=yes],[use_xauth=no])
87  AC_CHECK_LIB(Xau, XauGetAuthByAddr, [use_xauth=yes], [use_xauth=no])
88
89  if test "$have_x" = yes ; then
90    CPPFLAGS="$o_CPPFLAGS"
91  fi
92
93  if test "$use_xauth" = "yes" ; then
94    AC_DEFINE(HAVE_XAUTH)
95    LIBXAUTH="-lXau"
96    if test "$have_x" = yes ; then
97      LIBXAUTH="-L$x_libraries $LIBXAUTH"
98      CPPFLAGS="$CPPFLAGS -I$x_includes"
99    fi
100  elif test "$require_xauth" = "yes" ; then
101    AC_MSG_ERROR([Cannot find headers or libraries for XAUTH support.])
102  fi
103fi])
104
105dnl aclocal.m4 ends here
106