--- /dev/null
+aadb400e7536b29fb2b34299ef3cac07d86c108d
--- /dev/null
+The rra-c-util package as a whole is:
+
+ Copyright 2000, 2009, 2010 Russ Allbery <rra@stanford.edu>
+ Copyright 2009, 2010, 2011
+ The Board of Trustees of the Leland Stanford Junior University
+
+The package is collectively released under the following license:
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+All individual files without an explicit exception below are released
+under this license. Some files may have additional copyright holders as
+noted in those files.
+
+Some files in this distribution are individually released under different
+licenses, all of which are compatible with the above general package
+license but which may require preservation of additional notices. All
+required notices are preserved in this file. Each file intended for
+copying into other software packages contains a copyright and license
+notice at the top of the file. Please take note of any attribution and
+notice requirements specified in that license.
+
+Collected copyright notices for the entire package:
+
+ Copyright 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+ 2010 Russ Allbery <rra@stanford.edu>
+ Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+ The Board of Trustees of the Leland Stanford Junior University
+ Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010
+ by Internet Systems Consortium, Inc. ("ISC")
+ Copyright 1991, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+ 2003 by The Internet Software Consortium and Rich Salz
+ Copyright 2007 Markus Moeller
+ Copyright 1985-2005 Massachusetts Institute of Technology
+ Copyright 1997, 2000, 2001, 2002 Benjamin Sittler
+ Copyright 1995 Patrick Powell
+ Copyright 1996, 1997 Brandon Long <blong@fiction.net>
+ Copyright 1998 Thomas Roessler <roessler@guug.de>
+ Copyright 1998 Michael Elkins <me@cs.hmc.edu>
+ Copyright 1998 Andrew Tridgell <tridge@samba.org>
+ Copyright 2000, 2005 Hrvoje Niksic <hniksic@xemacs.org>
+ Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+ 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+ Free Software Foundation, Inc.
+ Copyright 1994 X Consortium
+
+The files kafs/sys-syscall.c, mkusage, pam-util/vector.c,
+pam-util/vector.h, portable/asprintf.c, portable/daemon.c,
+portable/dummy.c, portable/getaddrinfo.c, portable/getaddrinfo.h,
+portable/getnameinfo.c, portable/getnameinfo.h, portable/gssapi-mech.c,
+portable/gssapi.h, portable/inet_aton.c, portable/inet_ntoa.c,
+portable/inet_ntop.c, portable/issetuidgid.c, portable/krb4.h,
+portable/krb5-extra.c, portable/krb5.h, portable/macros.h,
+portable/mkstemp.c, portable/pam.h, portable/pam_syslog.c,
+portable/pam_vsyslog.c, portable/setenv.c, portable/seteuid.c,
+portable/stdbool.h, portable/strlcat.c, portable/strlcpy.c,
+portable/strndup.c, portable/system.h, portable/uio.h, portable/winsock.c,
+tests/pam-util/vector-t.c, tests/portable/asprintf-t.c,
+tests/portable/daemon-t.c, tests/portable/getaddrinfo-t.c,
+tests/portable/getnameinfo-t.c, tests/portable/inet_aton-t.c,
+tests/portable/inet_ntoa-t.c, tests/portable/inet_ntop-t.c,
+tests/portable/mkstemp-t.c, tests/portable/setenv-t.c,
+tests/portable/strlcat-t.c, tests/portable/strlcpy-t.c,
+tests/portable/strndup-t.c, tests/util/buffer-t.c, tests/util/concat-t.c,
+tests/util/vector-t.c, util/concat.c, util/concat.h, util/macros.h,
+util/vector.c, and util/vector.h are covered by the following statement:
+
+ The authors hereby relinquish any claim to any copyright that they may
+ have in this work, whether granted under contract or by operation of
+ law or international treaty, and hereby commit to the public, at
+ large, that they shall not, at any time in the future, seek to enforce
+ any copyright in this work against any person or entity, or prevent
+ any person or entity from copying, publishing, distributing or
+ creating derivative works of this work.
+
+In other words, you can do anything you wish with this code, although I
+would strongly prefer that any improvements or modifications be sent to me
+(rra@stanford.edu) so that I can continue to maintain a canonical version.
+
+The files configure.ac, m4/apache.m4, m4/apr.m4, m4/aprutil.m4,
+m4/curl.m4, m4/gssapi.m4, m4/inet-ntoa.m4, m4/kafs.m4, m4/krb4.m4,
+m4/krb5.m4, m4/ld-version.m4, m4/ldap.m4, m4/lib-depends.m4,
+m4/lib-pathname.m4, m4/pam-const.m4, m4/pcre.m4, m4/remctl.m4,
+m4/snprintf.m4, m4/ssl.m4, and m4/vamacros.m4 are released under the
+following copyright and license:
+
+ Copyright 1999, 2000, 2001, 2003 Russ Allbery <rra@stanford.edu>
+ Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011
+ The Board of Trustees of the Leland Stanford Junior University
+ Copyright 2007, 2008 Markus Moeller
+ Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+
+ This file is free software; the authors give unlimited permission to
+ copy and/or distribute it, with or without modifications, as long as
+ this notice is preserved.
+
+The files m4/socket-unix.m4, m4/socket.m4, portable/socket.h,
+util/buffer.c, util/buffer.h, util/fdflag.c, util/fdflag.h,
+util/messages.c, util/messages.h, util/network.c, util/network.h,
+util/xmalloc.c, util/xmalloc.h, util/xwrite.c, and util/xwrite.h are
+released under the following copyright and license:
+
+ Copyright 2008, 2009, 2010, 2011
+ The Board of Trustees of the Leland Stanford Junior University
+ Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009, 2010
+ by Internet Systems Consortium, Inc. ("ISC")
+ Copyright (c) 1991, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+ 2002, 2003 by The Internet Software Consortium and Rich Salz
+
+ This code is derived from software contributed to the Internet Software
+ Consortium by Rich Salz.
+
+ Permission to use, copy, modify, and distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY
+ SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+The file portable/krb5-profile.c is taken from the MIT Kerberos
+distribution and is released under the following copyright and license:
+
+ Copyright (C) 1985-2005 by the Massachusetts Institute of Technology.
+
+ All rights reserved.
+
+ Export of this software from the United States of America may require
+ a specific license from the United States Government. It is the
+ responsibility of any person or organization contemplating export to
+ obtain such a license before exporting.
+
+ WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ distribute this software and its documentation for any purpose and
+ without fee is hereby granted, provided that the above copyright
+ notice appear in all copies and that both that copyright notice and
+ this permission notice appear in supporting documentation, and that
+ the name of M.I.T. not be used in advertising or publicity pertaining
+ to distribution of the software without specific, written prior
+ permission. Furthermore if you modify this software you must label
+ your software as modified software and not distribute it in such a
+ fashion that it might be confused with the original MIT software.
+ M.I.T. makes no representations about the suitability of this software
+ for any purpose. It is provided "as is" without express or implied
+ warranty.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+
+ Individual source code files are copyright MIT, Cygnus Support,
+ OpenVision, Oracle, Sun Soft, FundsXpress, and others.
+
+ Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira,
+ and Zephyr are trademarks of the Massachusetts Institute of Technology
+ (MIT). No commercial use of these trademarks may be made without
+ prior written permission of MIT.
+
+ "Commercial use" means use of a name in a product or other for-profit
+ manner. It does NOT prevent a commercial firm from referring to the
+ MIT trademarks in order to convey information (although in doing so,
+ recognition of their trademark status should be given).
+
+The files portable/snprintf.c and tests/portable/snprintf-t.c are released
+under the following license:
+
+ This code is based on code written by Patrick Powell (papowell@astart.com)
+ It may be used for any purpose as long as this notice remains intact
+ on all source code distributions
+
+The files Makefile.in and aclocal.m4 are generated by GNU Automake and
+released under the following copyright and license:
+
+ Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+ 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
+ Inc. This file is free software; the Free Software Foundation gives
+ unlimited permission to copy and/or distribute it, with or without
+ modifications, as long as this notice is preserved.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+ even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ PARTICULAR PURPOSE.
+
+The file configure is generated by GNU Autoconf and is released under the
+following copyright and license:
+
+ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+ 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+ Foundation, Inc. This configure script is free software; the Free
+ Software Foundation gives unlimited permission to copy, distribute and
+ modify it.
+
+The files build-aux/depcomp and build-aux/missing are taken from GNU
+Automake. The files build-aux/config.guess and build-aux/config.sub are
+taken from the Debian autotools-dev package. These files are released
+under the following copyright and license:
+
+ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+ 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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.
+
+ As a special exception to the GNU General Public License, if you
+ distribute this file as part of a program that contains a configuration
+ script generated by Autoconf, you may include it under the same
+ distribution terms that you use for the rest of that program.
+
+For the rra-c-util distribution, the option described in the last
+paragraph has been accepted and these files are distributed under the same
+terms as the rra-c-util package as a whole, as described at the top of
+this file.
+
+The file build-aux/install-sh is released under the following copyright
+and license:
+
+ Copyright (C) 1994 X Consortium
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+
+ Except as contained in this notice, the name of the X Consortium shall
+ not be used in advertising or otherwise to promote the sale, use or
+ other dealings in this Software without prior written authorization
+ from the X Consortium.
+
+ FSF changes to this file are in the public domain.
--- /dev/null
+dnl Find the compiler and linker flags for GSS-API.
+dnl
+dnl Finds the compiler and linker flags for linking with GSS-API libraries.
+dnl Provides the --with-gssapi, --with-gssapi-include, and --with-gssapi-lib
+dnl configure option to specify a non-standard path to the GSS-API libraries.
+dnl Uses krb5-config where available unless reduced dependencies is requested
+dnl or --with-gssapi-include or --with-gssapi-lib are given.
+dnl
+dnl Provides the macro RRA_LIB_GSSAPI and sets the substitution variables
+dnl GSSAPI_CPPFLAGS, GSSAPI_LDFLAGS, and GSSAPI_LIBS. Also provides
+dnl RRA_LIB_GSSAPI_SWITCH to set CPPFLAGS, LDFLAGS, and LIBS to include the
+dnl GSS-API libraries, saving the ecurrent values, and RRA_LIB_GSSAPI_RESTORE
+dnl to restore those settings to before the last RRA_LIB_GSSAPI_SWITCH.
+dnl
+dnl Depends on RRA_ENABLE_REDUCED_DEPENDS and RRA_SET_LDFLAGS.
+dnl
+dnl The canonical version of this file is maintained in the rra-c-util
+dnl package, available at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+dnl
+dnl Written by Russ Allbery <rra@stanford.edu>
+dnl Copyright 2005, 2006, 2007, 2008, 2009, 2011
+dnl The Board of Trustees of the Leland Stanford Junior University
+dnl
+dnl This file is free software; the authors give unlimited permission to copy
+dnl and/or distribute it, with or without modifications, as long as this
+dnl notice is preserved.
+
+dnl Save the current CPPFLAGS, LDFLAGS, and LIBS settings and switch to
+dnl versions that include the GSS-API flags. Used as a wrapper, with
+dnl RRA_LIB_GSSAPI_RESTORE, around tests.
+AC_DEFUN([RRA_LIB_GSSAPI_SWITCH],
+[rra_gssapi_save_CPPFLAGS="$CPPFLAGS"
+ rra_gssapi_save_LDFLAGS="$LDFLAGS"
+ rra_gssapi_save_LIBS="$LIBS"
+ CPPFLAGS="$GSSAPI_CPPFLAGS $CPPFLAGS"
+ LDFLAGS="$GSSAPI_LDFLAGS $LDFLAGS"
+ LIBS="$GSSAPI_LIBS $LIBS"])
+
+dnl Restore CPPFLAGS, LDFLAGS, and LIBS to their previous values (before
+dnl RRA_LIB_GSSAPI_SWITCH was called).
+AC_DEFUN([RRA_LIB_GSSAPI_RESTORE],
+[CPPFLAGS="$rra_gssapi_save_CPPFLAGS"
+ LDFLAGS="$rra_gssapi_save_LDFLAGS"
+ LIBS="$rra_gssapi_save_LIBS"])
+
+dnl Set GSSAPI_CPPFLAGS and GSSAPI_LDFLAGS based on rra_gssapi_root,
+dnl rra_gssapi_libdir, and rra_gssapi_includedir.
+AC_DEFUN([_RRA_LIB_GSSAPI_PATHS],
+[AS_IF([test x"$rra_gssapi_libdir" != x],
+ [GSSAPI_LDFLAGS="-L$rra_gssapi_libdir"],
+ [AS_IF([test x"$rra_gssapi_root" != x],
+ [RRA_SET_LDFLAGS([GSSAPI_LDFLAGS], [$rra_gssapi_root])])])
+ AS_IF([test x"$rra_gssapi_includedir" != x],
+ [GSSAPI_CPPFLAGS="-I$rra_gssapi_includedir"],
+ [AS_IF([test x"$rra_gssapi_root" != x],
+ [AS_IF([test x"$rra_gssapi_root" != x/usr],
+ [GSSAPI_CPPFLAGS="-I${rra_gssapi_root}/include"])])])])
+
+dnl Does the appropriate library checks for reduced-dependency GSS-API
+dnl linkage.
+AC_DEFUN([_RRA_LIB_GSSAPI_REDUCED],
+[RRA_LIB_GSSAPI_SWITCH
+ AC_CHECK_LIB([gssapi_krb5], [gss_import_name], [GSSAPI_LIBS="-lgssapi_krb5"],
+ [AC_CHECK_LIB([gssapi], [gss_import_name], [GSSAPI_LIBS="-lgssapi"],
+ [AC_CHECK_LIB([gss], [gss_import_name], [GSSAPI_LIBS="-lgss"],
+ [AC_MSG_ERROR([cannot find usable GSS-API library])])])])
+ RRA_LIB_GSSAPI_RESTORE])
+
+dnl Does the appropriate library checks for GSS-API linkage when we don't
+dnl have krb5-config or reduced dependencies. libgss is used as a last
+dnl resort, since it may be a non-functional mech-independent wrapper, but
+dnl it's the right choice on Solaris 10.
+AC_DEFUN([_RRA_LIB_GSSAPI_MANUAL],
+[RRA_LIB_GSSAPI_SWITCH
+ rra_gssapi_extra=
+ LIBS=
+ AC_SEARCH_LIBS([res_search], [resolv], [],
+ [AC_SEARCH_LIBS([__res_search], [resolv])])
+ AC_SEARCH_LIBS([gethostbyname], [nsl])
+ AC_SEARCH_LIBS([socket], [socket], [],
+ [AC_CHECK_LIB([nsl], [socket], [LIBS="-lnsl -lsocket $LIBS"], [],
+ [-lsocket])])
+ AC_SEARCH_LIBS([crypt], [crypt])
+ AC_SEARCH_LIBS([rk_simple_execve], [roken])
+ rra_gssapi_extra="$LIBS"
+ LIBS="$rra_gssapi_save_LIBS"
+ AC_CHECK_LIB([gssapi], [gss_import_name],
+ [GSSAPI_LIBS="-lgssapi -lkrb5 -lasn1 -lcrypto -lcom_err $rra_gssapi_extra"],
+ [AC_CHECK_LIB([krb5support], [krb5int_getspecific],
+ [rra_gssapi_extra="-lkrb5support $rra_gssapi_extra"],
+ [AC_CHECK_LIB([pthreads], [pthread_setspecific],
+ [rra_gssapi_pthread="-lpthreads"],
+ [AC_CHECK_LIB([pthread], [pthread_setspecific],
+ [rra_gssapi_pthread="-lpthread"])])
+ AC_CHECK_LIB([krb5support], [krb5int_setspecific],
+ [rra_gssapi_extra="-lkrb5support $rra_gssapi_extra"
+ rra_gssapi_extra="$rra_gssapi_extra $rra_gssapi_pthread"], [],
+ [$rra_gssapi_pthread])])
+ AC_CHECK_LIB([com_err], [error_message],
+ [rra_gssapi_extra="-lcom_err $rra_gssapi_extra"])
+ AC_CHECK_LIB([k5crypto], [krb5int_hash_md5],
+ [rra_gssapi_extra="-lk5crypto $rra_gssapi_extra"])
+ rra_gssapi_extra="-lkrb5 $rra_gssapi_extra"
+ AC_CHECK_LIB([gssapi_krb5], [gss_import_name],
+ [GSSAPI_LIBS="-lgssapi_krb5 $rra_gssapi_extra"],
+ [AC_CHECK_LIB([gss], [gss_import_name],
+ [GSSAPI_LIBS="-lgss"],
+ [AC_MSG_ERROR([cannot find usable GSS-API library])])],
+ [$rra_gssapi_extra])],
+ [-lkrb5 -lasn1 -lcrypto -lcom_err $rra_gssapi_extra])
+ RRA_LIB_GSSAPI_RESTORE])
+
+dnl Sanity-check the results of krb5-config and be sure we can really link a
+dnl GSS-API program. If not, fall back on the manual check.
+AC_DEFUN([_RRA_LIB_GSSAPI_CHECK],
+[RRA_LIB_GSSAPI_SWITCH
+ AC_CHECK_FUNC([gss_import_name],
+ [RRA_LIB_GSSAPI_RESTORE],
+ [RRA_LIB_GSSAPI_RESTORE
+ GSSAPI_CPPFLAGS=
+ GSSAPI_LIBS=
+ _RRA_LIB_GSSAPI_PATHS
+ _RRA_LIB_GSSAPI_MANUAL])])
+
+dnl Determine GSS-API compiler and linker flags from krb5-config.
+AC_DEFUN([_RRA_LIB_GSSAPI_CONFIG],
+[AC_ARG_VAR([PATH_KRB5_CONFIG], [Path to krb5-config])
+ AS_IF([test x"$rra_gssapi_root" != x && test -z "$PATH_KRB5_CONFIG"],
+ [AS_IF([test -x "${rra_gssapi_root}/bin/krb5-config"],
+ [PATH_KRB5_CONFIG="${rra_gssapi_root}/bin/krb5-config"])],
+ [AC_PATH_PROG([PATH_KRB5_CONFIG], [krb5-config], [],
+ [${PATH}:/usr/kerberos/bin])])
+ AS_IF([test x"$PATH_KRB5_CONFIG" != x && test -x "$PATH_KRB5_CONFIG"],
+ [AC_CACHE_CHECK([for gssapi support in krb5-config],
+ [rra_cv_lib_gssapi_config],
+ [AS_IF(["$PATH_KRB5_CONFIG" 2>&1 | grep gssapi >/dev/null 2>&1],
+ [rra_cv_lib_gssapi_config=yes],
+ [rra_cv_lib_gssapi_config=no])])
+ AS_IF([test "$rra_cv_lib_gssapi_config" = yes],
+ [GSSAPI_CPPFLAGS=`"$PATH_KRB5_CONFIG" --cflags gssapi 2>/dev/null`
+ GSSAPI_LIBS=`"$PATH_KRB5_CONFIG" --libs gssapi 2>/dev/null`],
+ [GSSAPI_CPPFLAGS=`"$PATH_KRB5_CONFIG" --cflags 2>/dev/null`
+ GSSAPI_LIBS=`"$PATH_KRB5_CONFIG" --libs 2>/dev/null`])
+ GSSAPI_CPPFLAGS=`echo "$GSSAPI_CPPFLAGS" | sed 's%-I/usr/include ?%%'`
+ _RRA_LIB_GSSAPI_CHECK],
+ [_RRA_LIB_GSSAPI_PATHS
+ _RRA_LIB_GSSAPI_MANUAL])])
+
+dnl The main macro.
+AC_DEFUN([RRA_LIB_GSSAPI],
+[AC_REQUIRE([RRA_ENABLE_REDUCED_DEPENDS])
+ rra_gssapi_root=
+ rra_gssapi_libdir=
+ rra_gssapi_includedir=
+ GSSAPI_CPPFLAGS=
+ GSSAPI_LDFLAGS=
+ GSSAPI_LIBS=
+ AC_SUBST([GSSAPI_CPPFLAGS])
+ AC_SUBST([GSSAPI_LDFLAGS])
+ AC_SUBST([GSSAPI_LIBS])
+
+ AC_ARG_WITH([gssapi],
+ [AS_HELP_STRING([--with-gssapi=DIR],
+ [Location of GSS-API headers and libraries])],
+ [AS_IF([test x"$withval" != xyes && test x"$withval" != xno],
+ [rra_gssapi_root="$withval"])])
+ AC_ARG_WITH([gssapi-include],
+ [AS_HELP_STRING([--with-gssapi-include=DIR],
+ [Location of GSS-API headers])],
+ [AS_IF([test x"$withval" != xyes && test x"$withval" != xno],
+ [rra_gssapi_includedir="$withval"])])
+ AC_ARG_WITH([gssapi-lib],
+ [AS_HELP_STRING([--with-gssapi-lib=DIR],
+ [Location of GSS-API libraries])],
+ [AS_IF([test x"$withval" != xyes && test x"$withval" != xno],
+ [rra_gssapi_libdir="$withval"])])
+
+ AS_IF([test x"$rra_reduced_depends" = xtrue],
+ [_RRA_LIB_GSSAPI_PATHS
+ _RRA_LIB_GSSAPI_REDUCED],
+ [AS_IF([test x"$rra_gssapi_includedir" = x \
+ && test x"$rra_gssapi_libdir" = x],
+ [_RRA_LIB_GSSAPI_CONFIG],
+ [_RRA_LIB_GSSAPI_PATHS
+ _RRA_LIB_GSSAPI_MANUAL])])])
--- /dev/null
+dnl Find the compiler and linker flags for Kerberos.
+dnl
+dnl Finds the compiler and linker flags for linking with Kerberos libraries.
+dnl Provides the --with-krb5, --with-krb5-include, and --with-krb5-lib
+dnl configure options to specify non-standard paths to the Kerberos libraries.
+dnl Uses krb5-config where available unless reduced dependencies is requested
+dnl or --with-krb5-include or --with-krb5-lib are given.
+dnl
+dnl Provides the macro RRA_LIB_KRB5 and sets the substitution variables
+dnl KRB5_CPPFLAGS, KRB5_LDFLAGS, and KRB5_LIBS. Also provides
+dnl RRA_LIB_KRB5_SWITCH to set CPPFLAGS, LDFLAGS, and LIBS to include the
+dnl Kerberos libraries, saving the current values first, and
+dnl RRA_LIB_KRB5_RESTORE to restore those settings to before the last
+dnl RRA_LIB_KRB5_SWITCH. HAVE_KERBEROS will always be defined if RRA_LIB_KRB5
+dnl is used.
+dnl
+dnl If KRB5_CPPFLAGS, KRB5_LDFLAGS, or KRB5_LIBS are set before calling these
+dnl macros, their values will be added to whatever the macros discover.
+dnl
+dnl Provides the RRA_LIB_KRB5_OPTIONAL macro, which should be used if Kerberos
+dnl support is optional. This macro will still always set the substitution
+dnl variables, but they'll be empty unless --with-krb5 is given. Also,
+dnl HAVE_KERBEROS will be defined if --with-krb5 is given and
+dnl $rra_use_kerberos will be set to "true".
+dnl
+dnl Sets the Automake conditional KRB5_USES_COM_ERR saying whether we use
+dnl com_err, since if we're also linking with AFS libraries, we may have to
+dnl change library ordering in that case.
+dnl
+dnl Depends on RRA_ENABLE_REDUCED_DEPENDS and RRA_SET_LDFLAGS.
+dnl
+dnl Also provides RRA_FUNC_KRB5_GET_INIT_CREDS_OPT_FREE_ARGS, which checks
+dnl whether krb5_get_init_creds_opt_free takes one argument or two. Defines
+dnl HAVE_KRB5_GET_INIT_CREDS_OPT_FREE_2_ARGS if it takes two arguments.
+dnl
+dnl The canonical version of this file is maintained in the rra-c-util
+dnl package, available at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+dnl
+dnl Written by Russ Allbery <rra@stanford.edu>
+dnl Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011
+dnl The Board of Trustees of the Leland Stanford Junior University
+dnl
+dnl This file is free software; the authors give unlimited permission to copy
+dnl and/or distribute it, with or without modifications, as long as this
+dnl notice is preserved.
+
+dnl Save the current CPPFLAGS, LDFLAGS, and LIBS settings and switch to
+dnl versions that include the Kerberos flags. Used as a wrapper, with
+dnl RRA_LIB_KRB5_RESTORE, around tests.
+AC_DEFUN([RRA_LIB_KRB5_SWITCH],
+[rra_krb5_save_CPPFLAGS="$CPPFLAGS"
+ rra_krb5_save_LDFLAGS="$LDFLAGS"
+ rra_krb5_save_LIBS="$LIBS"
+ CPPFLAGS="$KRB5_CPPFLAGS $CPPFLAGS"
+ LDFLAGS="$KRB5_LDFLAGS $LDFLAGS"
+ LIBS="$KRB5_LIBS $LIBS"])
+
+dnl Restore CPPFLAGS, LDFLAGS, and LIBS to their previous values (before
+dnl RRA_LIB_KRB5_SWITCH was called).
+AC_DEFUN([RRA_LIB_KRB5_RESTORE],
+[CPPFLAGS="$rra_krb5_save_CPPFLAGS"
+ LDFLAGS="$rra_krb5_save_LDFLAGS"
+ LIBS="$rra_krb5_save_LIBS"])
+
+dnl Set KRB5_CPPFLAGS and KRB5_LDFLAGS based on rra_krb5_root,
+dnl rra_krb5_libdir, and rra_krb5_includedir.
+AC_DEFUN([_RRA_LIB_KRB5_PATHS],
+[AS_IF([test x"$rra_krb5_libdir" != x],
+ [KRB5_LDFLAGS="-L$rra_krb5_libdir"],
+ [AS_IF([test x"$rra_krb5_root" != x],
+ [RRA_SET_LDFLAGS([KRB5_LDFLAGS], [$rra_krb5_root])])])
+ AS_IF([test x"$rra_krb5_includedir" != x],
+ [KRB5_CPPFLAGS="-I$rra_krb5_includedir"],
+ [AS_IF([test x"$rra_krb5_root" != x],
+ [AS_IF([test x"$rra_krb5_root" != x/usr],
+ [KRB5_CPPFLAGS="-I${rra_krb5_root}/include"])])])])
+
+dnl Does the appropriate library checks for reduced-dependency Kerberos
+dnl linkage. The single argument, if true, says to fail if Kerberos could not
+dnl be found.
+AC_DEFUN([_RRA_LIB_KRB5_REDUCED],
+[RRA_LIB_KRB5_SWITCH
+ AC_CHECK_LIB([krb5], [krb5_init_context], [KRB5_LIBS="-lkrb5"],
+ [AS_IF([test x"$1" = xtrue],
+ [AC_MSG_ERROR([cannot find usable Kerberos library])])])
+ LIBS="$KRB5_LIBS $LIBS"
+ AC_CHECK_FUNCS([krb5_get_error_message],
+ [AC_CHECK_FUNCS([krb5_free_error_message])],
+ [AC_CHECK_FUNCS([krb5_get_error_string], [],
+ [AC_CHECK_FUNCS([krb5_get_err_txt], [],
+ [AC_CHECK_LIB([ksvc], [krb5_svc_get_msg],
+ [KRB5_LIBS="$KRB5_LIBS -lksvc"
+ AC_DEFINE([HAVE_KRB5_SVC_GET_MSG], [1])
+ AC_CHECK_HEADERS([ibm_svc/krb5_svc.h], [], [],
+ [#include <krb5.h>])],
+ [AC_CHECK_LIB([com_err], [com_err],
+ [KRB5_LIBS="$KRB5_LIBS -lcom_err"],
+ [AC_MSG_ERROR([cannot find usable com_err library])])
+ AC_CHECK_HEADERS([et/com_err.h])])])])])
+ RRA_LIB_KRB5_RESTORE])
+
+dnl Does the appropriate library checks for Kerberos linkage when we don't
+dnl have krb5-config or reduced dependencies. The single argument, if true,
+dnl says to fail if Kerberos could not be found.
+AC_DEFUN([_RRA_LIB_KRB5_MANUAL],
+[RRA_LIB_KRB5_SWITCH
+ rra_krb5_extra=
+ LIBS=
+ AC_SEARCH_LIBS([res_search], [resolv], [],
+ [AC_SEARCH_LIBS([__res_search], [resolv])])
+ AC_SEARCH_LIBS([gethostbyname], [nsl])
+ AC_SEARCH_LIBS([socket], [socket], [],
+ [AC_CHECK_LIB([nsl], [socket], [LIBS="-lnsl -lsocket $LIBS"], [],
+ [-lsocket])])
+ AC_SEARCH_LIBS([crypt], [crypt])
+ AC_SEARCH_LIBS([rk_simple_execve], [roken])
+ rra_krb5_extra="$LIBS"
+ LIBS="$rra_krb5_save_LIBS"
+ AC_CHECK_LIB([krb5], [krb5_init_context],
+ [KRB5_LIBS="-lkrb5 -lasn1 -lcom_err -lcrypto $rra_krb5_extra"],
+ [AC_CHECK_LIB([krb5support], [krb5int_getspecific],
+ [rra_krb5_extra="-lkrb5support $rra_krb5_extra"],
+ [AC_CHECK_LIB([pthreads], [pthread_setspecific],
+ [rra_krb5_pthread="-lpthreads"],
+ [AC_CHECK_LIB([pthread], [pthread_setspecific],
+ [rra_krb5_pthread="-lpthread"])])
+ AC_CHECK_LIB([krb5support], [krb5int_setspecific],
+ [rra_krb5_extra="-lkrb5support $rra_krb5_extra $rra_krb5_pthread"],
+ [], [$rra_krb5_pthread $rra_krb5_extra])],
+ [$rra_krb5_extra])
+ AC_CHECK_LIB([com_err], [error_message],
+ [rra_krb5_extra="-lcom_err $rra_krb5_extra"], [], [$rra_krb5_extra])
+ AC_CHECK_LIB([ksvc], [krb5_svc_get_msg],
+ [rra_krb5_extra="-lksvc $rra_krb5_extra"], [], [$rra_krb5_extra])
+ AC_CHECK_LIB([k5crypto], [krb5int_hash_md5],
+ [rra_krb5_extra="-lk5crypto $rra_krb5_extra"], [], [$rra_krb5_extra])
+ AC_CHECK_LIB([k5profile], [profile_get_values],
+ [rra_krb5_extra="-lk5profile $rra_krb5_extra"], [], [$rra_krb5_extra])
+ AC_CHECK_LIB([krb5], [krb5_cc_default],
+ [KRB5_LIBS="-lkrb5 $rra_krb5_extra"],
+ [AS_IF([test x"$1" = xtrue],
+ [AC_MSG_ERROR([cannot find usable Kerberos library])])],
+ [$rra_krb5_extra])],
+ [-lasn1 -lcom_err -lcrypto $rra_krb5_extra])
+ LIBS="$KRB5_LIBS $LIBS"
+ AC_CHECK_FUNCS([krb5_get_error_message],
+ [AC_CHECK_FUNCS([krb5_free_error_message])],
+ [AC_CHECK_FUNCS([krb5_get_error_string], [],
+ [AC_CHECK_FUNCS([krb5_get_err_txt], [],
+ [AC_CHECK_FUNCS([krb5_svc_get_msg],
+ [AC_CHECK_HEADERS([ibm_svc/krb5_svc.h], [], [],
+ [#include <krb5.h>])],
+ [AC_CHECK_HEADERS([et/com_err.h])])])])])
+ RRA_LIB_KRB5_RESTORE])
+
+dnl Sanity-check the results of krb5-config and be sure we can really link a
+dnl Kerberos program. If that fails, clear KRB5_CPPFLAGS and KRB5_LIBS so
+dnl that we know we don't have usable flags and fall back on the manual
+dnl check.
+AC_DEFUN([_RRA_LIB_KRB5_CHECK],
+[RRA_LIB_KRB5_SWITCH
+ AC_CHECK_FUNC([krb5_init_context],
+ [RRA_LIB_KRB5_RESTORE],
+ [RRA_LIB_KRB5_RESTORE
+ KRB5_CPPFLAGS=
+ KRB5_LIBS=
+ _RRA_LIB_KRB5_PATHS
+ _RRA_LIB_KRB5_MANUAL([$1])])])
+
+dnl Determine Kerberos compiler and linker flags from krb5-config. Does the
+dnl additional probing we need to do to uncover error handling features, and
+dnl falls back on the manual checks.
+AC_DEFUN([_RRA_LIB_KRB5_CONFIG],
+[AC_ARG_VAR([PATH_KRB5_CONFIG], [Path to krb5-config])
+ AS_IF([test x"$rra_krb5_root" != x && test -z "$PATH_KRB5_CONFIG"],
+ [AS_IF([test -x "${rra_krb5_root}/bin/krb5-config"],
+ [PATH_KRB5_CONFIG="${rra_krb5_root}/bin/krb5-config"])],
+ [AC_PATH_PROG([PATH_KRB5_CONFIG], [krb5-config], [],
+ [${PATH}:/usr/kerberos/bin])])
+ AS_IF([test x"$PATH_KRB5_CONFIG" != x && test -x "$PATH_KRB5_CONFIG"],
+ [AC_CACHE_CHECK([for krb5 support in krb5-config],
+ [rra_cv_lib_krb5_config],
+ [AS_IF(["$PATH_KRB5_CONFIG" 2>&1 | grep krb5 >/dev/null 2>&1],
+ [rra_cv_lib_krb5_config=yes],
+ [rra_cv_lib_krb5_config=no])])
+ AS_IF([test x"$rra_cv_lib_krb5_config" = xyes],
+ [KRB5_CPPFLAGS=`"$PATH_KRB5_CONFIG" --cflags krb5 2>/dev/null`
+ KRB5_LIBS=`"$PATH_KRB5_CONFIG" --libs krb5 2>/dev/null`],
+ [KRB5_CPPFLAGS=`"$PATH_KRB5_CONFIG" --cflags 2>/dev/null`
+ KRB5_LIBS=`"$PATH_KRB5_CONFIG" --libs 2>/dev/null`])
+ KRB5_CPPFLAGS=`echo "$KRB5_CPPFLAGS" | sed 's%-I/usr/include ?%%'`
+ _RRA_LIB_KRB5_CHECK([$1])
+ RRA_LIB_KRB5_SWITCH
+ AC_CHECK_FUNCS([krb5_get_error_message],
+ [AC_CHECK_FUNCS([krb5_free_error_message])],
+ [AC_CHECK_FUNCS([krb5_get_error_string], [],
+ [AC_CHECK_FUNCS([krb5_get_err_txt], [],
+ [AC_CHECK_FUNCS([krb5_svc_get_msg],
+ [AC_CHECK_HEADERS([ibm_svc/krb5_svc.h], [], [],
+ [#include <krb5.h>])],
+ [AC_CHECK_HEADERS([et/com_err.h])])])])])
+ RRA_LIB_KRB5_RESTORE],
+ [_RRA_LIB_KRB5_PATHS
+ _RRA_LIB_KRB5_MANUAL([$1])])])
+
+dnl The core of the library checking, shared between RRA_LIB_KRB5 and
+dnl RRA_LIB_KRB5_OPTIONAL. The single argument, if "true", says to fail if
+dnl Kerberos could not be found.
+AC_DEFUN([_RRA_LIB_KRB5_INTERNAL],
+[AC_REQUIRE([RRA_ENABLE_REDUCED_DEPENDS])
+ AS_IF([test x"$rra_reduced_depends" = xtrue],
+ [_RRA_LIB_KRB5_PATHS
+ _RRA_LIB_KRB5_REDUCED([$1])],
+ [AS_IF([test x"$rra_krb5_includedir" = x && test x"$rra_krb5_libdir" = x],
+ [_RRA_LIB_KRB5_CONFIG],
+ [_RRA_LIB_KRB5_PATHS
+ _RRA_LIB_KRB5_MANUAL([$1])])])
+ rra_krb5_uses_com_err=false
+ AS_CASE([$LIBS], [*-lcom_err*], [rra_krb5_uses_com_err=true])
+ AM_CONDITIONAL([KRB5_USES_COM_ERR], [test x"$rra_krb5_uses_com_err" = xtrue])])
+
+dnl The main macro for packages with mandatory Kerberos support.
+AC_DEFUN([RRA_LIB_KRB5],
+[rra_krb5_root=
+ rra_krb5_libdir=
+ rra_krb5_includedir=
+ rra_use_kerberos=true
+ AC_SUBST([KRB5_CPPFLAGS])
+ AC_SUBST([KRB5_LDFLAGS])
+ AC_SUBST([KRB5_LIBS])
+
+ AC_ARG_WITH([krb5],
+ [AS_HELP_STRING([--with-krb5=DIR],
+ [Location of Kerberos headers and libraries])],
+ [AS_IF([test x"$withval" != xyes && test x"$withval" != xno],
+ [rra_krb5_root="$withval"])])
+ AC_ARG_WITH([krb5-include],
+ [AS_HELP_STRING([--with-krb5-include=DIR],
+ [Location of Kerberos headers])],
+ [AS_IF([test x"$withval" != xyes && test x"$withval" != xno],
+ [rra_krb5_includedir="$withval"])])
+ AC_ARG_WITH([krb5-lib],
+ [AS_HELP_STRING([--with-krb5-lib=DIR],
+ [Location of Kerberos libraries])],
+ [AS_IF([test x"$withval" != xyes && test x"$withval" != xno],
+ [rra_krb5_libdir="$withval"])])
+ _RRA_LIB_KRB5_INTERNAL([true])
+ AC_DEFINE([HAVE_KERBEROS], 1, [Define to enable Kerberos features.])])
+
+dnl The main macro for packages with optional Kerberos support.
+AC_DEFUN([RRA_LIB_KRB5_OPTIONAL],
+[rra_krb5_root=
+ rra_krb5_libdir=
+ rra_krb5_includedir=
+ rra_use_kerberos=
+ AC_SUBST([KRB5_CPPFLAGS])
+ AC_SUBST([KRB5_LDFLAGS])
+ AC_SUBST([KRB5_LIBS])
+
+ AC_ARG_WITH([krb5],
+ [AS_HELP_STRING([--with-krb5@<:@=DIR@:>@],
+ [Location of Kerberos headers and libraries])],
+ [AS_IF([test x"$withval" = xno],
+ [rra_use_kerberos=false],
+ [AS_IF([test x"$withval" != xyes], [rra_krb5_root="$withval"])
+ rra_use_kerberos=true])])
+ AC_ARG_WITH([krb5-include],
+ [AS_HELP_STRING([--with-krb5-include=DIR],
+ [Location of Kerberos headers])],
+ [AS_IF([test x"$withval" != xyes && test x"$withval" != xno],
+ [rra_krb5_includedir="$withval"])])
+ AC_ARG_WITH([krb5-lib],
+ [AS_HELP_STRING([--with-krb5-lib=DIR],
+ [Location of Kerberos libraries])],
+ [AS_IF([test x"$withval" != xyes && test x"$withval" != xno],
+ [rra_krb5_libdir="$withval"])])
+
+ AS_IF([test x"$rra_use_kerberos" != xfalse],
+ [AS_IF([test x"$rra_use_kerberos" = xtrue],
+ [_RRA_LIB_KRB5_INTERNAL([true])],
+ [_RRA_LIB_KRB5_INTERNAL([false])])],
+ [AM_CONDITIONAL([KRB5_USES_COM_ERR], [false])])
+ AS_IF([test x"$KRB5_LIBS" != x],
+ [AC_DEFINE([HAVE_KERBEROS], 1, [Define to enable Kerberos features.])])])
+
+dnl Check whether krb5_get_init_creds_opt_free takes one argument or two.
+dnl Early Heimdal used to take a single argument. Defines
+dnl HAVE_KRB5_GET_INIT_CREDS_OPT_FREE_2_ARGS if it takes two arguments.
+dnl
+dnl Should be called with RRA_LIB_KRB5_SWITCH active.
+AC_DEFUN([RRA_FUNC_KRB5_GET_INIT_CREDS_OPT_FREE_ARGS],
+[AC_CACHE_CHECK([if krb5_get_init_creds_opt_free takes two arguments],
+ [rra_cv_func_krb5_get_init_creds_opt_free_args],
+ [AC_TRY_COMPILE([#include <krb5.h>],
+ [krb5_get_init_creds_opt *opts; krb5_context c;
+ krb5_get_init_creds_opt_free(c, opts);],
+ [rra_cv_func_krb5_get_init_creds_opt_free_args=yes],
+ [rra_cv_func_krb5_get_init_creds_opt_free_args=no])])
+ AS_IF([test $rra_cv_func_krb5_get_init_creds_opt_free_args = yes],
+ [AC_DEFINE([HAVE_KRB5_GET_INIT_CREDS_OPT_FREE_2_ARGS], 1,
+ [Define if krb5_get_init_creds_opt_free takes two arguments.])])])
--- /dev/null
+dnl Provides option to change library probes.
+dnl
+dnl This file provides RRA_ENABLE_REDUCED_DEPENDS, which adds the configure
+dnl option --enable-reduced-depends to request that library probes assume
+dnl shared libraries are in use and dependencies of libraries should not be
+dnl probed. If this option is given, the shell variable rra_reduced_depends
+dnl is set to true; otherwise, it is set to false.
+dnl
+dnl This macro doesn't do much but is defined separately so that other macros
+dnl can require it with AC_REQUIRE.
+dnl
+dnl The canonical version of this file is maintained in the rra-c-util
+dnl package, available at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+dnl
+dnl Written by Russ Allbery <rra@stanford.edu>
+dnl Copyright 2005, 2006, 2007
+dnl The Board of Trustees of the Leland Stanford Junior University
+dnl
+dnl This file is free software; the authors give unlimited permission to copy
+dnl and/or distribute it, with or without modifications, as long as this
+dnl notice is preserved.
+
+AC_DEFUN([RRA_ENABLE_REDUCED_DEPENDS],
+[rra_reduced_depends=false
+AC_ARG_ENABLE([reduced-depends],
+ [AS_HELP_STRING([--enable-reduced-depends],
+ [Try to minimize shared library dependencies])],
+ [AS_IF([test x"$enableval" = xyes], [rra_reduced_depends=true])])])
--- /dev/null
+dnl Determine the library path name.
+dnl
+dnl Red Hat systems and some other Linux systems use lib64 and lib32 rather
+dnl than just lib in some circumstances. This file provides an Autoconf
+dnl macro, RRA_SET_LDFLAGS, which given a variable, a prefix, and an optional
+dnl suffix, adds -Lprefix/lib, -Lprefix/lib32, or -Lprefix/lib64 to the
+dnl variable depending on which directories exist and the size of a long in
+dnl the compilation environment. If a suffix is given, a slash and that
+dnl suffix will be appended, to allow for adding a subdirectory of the library
+dnl directory.
+dnl
+dnl This file also provides the Autoconf macro RRA_SET_LIBDIR, which sets the
+dnl libdir variable to PREFIX/lib{,32,64} as appropriate.
+dnl
+dnl The canonical version of this file is maintained in the rra-c-util
+dnl package, available at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+dnl
+dnl Written by Russ Allbery <rra@stanford.edu>
+dnl Copyright 2008, 2009
+dnl The Board of Trustees of the Leland Stanford Junior University
+dnl
+dnl This file is free software; the authors give unlimited permission to copy
+dnl and/or distribute it, with or without modifications, as long as this
+dnl notice is preserved.
+
+dnl Probe for the alternate library name that we should attempt on this
+dnl architecture, given the size of an int, and set rra_lib_arch_name to that
+dnl name. Separated out so that it can be AC_REQUIRE'd and not run multiple
+dnl times.
+dnl
+dnl There is an unfortunate abstraction violation here where we assume we know
+dnl the cache variable name used by Autoconf. Unfortunately, Autoconf doesn't
+dnl provide any other way of getting at that information in shell that I can
+dnl see.
+AC_DEFUN([_RRA_LIB_ARCH_NAME],
+[rra_lib_arch_name=lib
+ AC_CHECK_SIZEOF([long])
+ AS_IF([test "$ac_cv_sizeof_long" -eq 4 && test -d /usr/lib32],
+ [rra_lib_arch_name=lib32],
+ [AS_IF([test "$ac_cv_sizeof_long" -eq 8 && test -d /usr/lib64],
+ [rra_lib_arch_name=lib64])])])
+
+dnl Set VARIABLE to -LPREFIX/lib{,32,64} or -LPREFIX/lib{,32,64}/SUFFIX as
+dnl appropriate.
+AC_DEFUN([RRA_SET_LDFLAGS],
+[AC_REQUIRE([_RRA_LIB_ARCH_NAME])
+ AS_IF([test -d "$2/$rra_lib_arch_name"],
+ [AS_IF([test x"$3" = x],
+ [$1="[$]$1 -L$2/${rra_lib_arch_name}"],
+ [$1="[$]$1 -L$2/${rra_lib_arch_name}/$3"])],
+ [AS_IF([test x"$3" = x],
+ [$1="[$]$1 -L$2/lib"],
+ [$1="[$]$1 -L$2/lib/$3"])])
+ $1=`echo "[$]$1" | sed -e 's/^ *//'`])
+
+dnl Set libdir to PREFIX/lib{,32,64} as appropriate.
+AC_DEFUN([RRA_SET_LIBDIR],
+[AC_REQUIRE([_RRA_LIB_ARCH_NAME])
+ AS_IF([test -d "$1/$rra_lib_arch_name"],
+ [libdir="$1/${rra_lib_arch_name}"],
+ [libdir="$1/lib"])])
--- /dev/null
+dnl Determine whether PAM uses const in prototypes.
+dnl
+dnl Linux marks several PAM arguments const, including the argument to
+dnl pam_get_item and some arguments to conversation functions, which Solaris
+dnl doesn't. This test tries to determine which style is in use to select
+dnl whether to declare variables const in order to avoid compiler warnings.
+dnl
+dnl Since this is just for compiler warnings, it's not horribly important if
+dnl we guess wrong. This test is ugly, but it seems to work.
+dnl
+dnl Contributed by Markus Moeller.
+dnl
+dnl The canonical version of this file is maintained in the rra-c-util
+dnl package, available at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+dnl
+dnl Copyright 2007 Russ Allbery <rra@stanford.edu>
+dnl Copyright 2007, 2008 Markus Moeller
+dnl
+dnl This file is free software; the authors give unlimited permission to copy
+dnl and/or distribute it, with or without modifications, as long as this
+dnl notice is preserved.
+
+dnl Source used by RRA_HEADER_PAM_CONST.
+AC_DEFUN([_RRA_HEADER_PAM_CONST_SOURCE],
+[#ifdef HAVE_SECURITY_PAM_APPL_H
+# include <security/pam_appl.h>
+#else
+# include <pam/pam_appl.h>
+#endif
+])
+
+AC_DEFUN([RRA_HEADER_PAM_CONST],
+[AC_CACHE_CHECK([whether PAM prefers const], [rra_cv_header_pam_const],
+ [AC_EGREP_CPP([const void \*\* *_?item], _RRA_HEADER_PAM_CONST_SOURCE(),
+ [rra_cv_header_pam_const=yes], [rra_cv_header_pam_const=no])])
+AS_IF([test x"$rra_cv_header_pam_const" = xyes],
+ [rra_header_pam_const=const], [rra_header_pam_const=])
+AC_DEFINE_UNQUOTED([PAM_CONST], [$rra_header_pam_const],
+ [Define to const if PAM uses const in pam_get_item, empty otherwise.])])