summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorRuss Allbery <rra@stanford.edu>2009-05-12 00:43:51 -0700
committerRuss Allbery <rra@stanford.edu>2009-05-12 00:43:51 -0700
commite9c792711c5ff53c4704de4a9e94bfba312af5af (patch)
tree976ca6a4b53e52b8584e0ca6fd1d46c35d45ffae /m4
parentb1630dfabcc72f7e71ce0de512a1be9f8ac20bb4 (diff)
Update to rra-c-util 1.0 and C TAP Harness 1.0
Update to rra-c-util 1.0: * Fix open call parameters in daemon portability test. * Fix AI_ADDRCONFIG portability on BSD/OS systems. * Split die into a separate object to not link it in shared libraries. * Don't break if the user clobbers CPPFLAGS at build time. * Correctly set -L options with --with-gssapi-lib, not -I. * Change AC_TRY_* to AC_*_IFELSE as recommended by Autoconf. * Update portable and util test suite for C TAP Harness 1.0. * Use native Kerberos instead of forking kinit in test suite. Update to C TAP Harness 1.0: * Rewrite of all test cases to use the new TAP library support. * Much improved and simplified builddir != srcdir test suite support. * Support running a single test with tests/runtests -o. * Correctly handle completely skipped tests, like client/pod. * Better reporting of fatal errors in the test suite.
Diffstat (limited to 'm4')
-rw-r--r--m4/gssapi.m430
-rw-r--r--m4/inet-ntoa.m436
-rw-r--r--m4/snprintf.m416
-rw-r--r--m4/socket.m497
-rw-r--r--m4/vamacros.m455
5 files changed, 133 insertions, 101 deletions
diff --git a/m4/gssapi.m4 b/m4/gssapi.m4
index 88cd8ee..b5b8724 100644
--- a/m4/gssapi.m4
+++ b/m4/gssapi.m4
@@ -1,32 +1,24 @@
dnl gssapi.m4 -- Find the compiler and linker flags for GSS-API.
dnl
-dnl Finds the compiler and linker flags for linking with GSS-API libraries
-dnl and sets the substitution variables GSSAPI_CPPFLAGS, GSSAPI_LDFLAGS, and
-dnl GSSAPI_LIBS. Provides the --with-gssapi configure option to specify a
-dnl non-standard path to the GSS-API libraries. Uses krb5-config where
-dnl available unless reduced dependencies is requested.
+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
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_SET to set CPPFLAGS, LDFLAGS, and LIBS to include the
-dnl GSS-API libraries; RRA_LIB_GSSAPI_SWITCH to do the same but save the
-dnl current values first; and RRA_LIB_GSSAPI_RESTORE to restore those settings
-dnl to before the last RRA_LIB_GSSAPI_SWITCH.
+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 Written by Russ Allbery <rra@stanford.edu>
-dnl Copyright 2005, 2006, 2007, 2008
+dnl Copyright 2005, 2006, 2007, 2008, 2009
dnl Board of Trustees, Leland Stanford Jr. University
dnl
dnl See LICENSE for licensing terms.
-dnl Set CPPFLAGS, LDFLAGS, and LIBS to values including the GSS-API settings.
-AC_DEFUN([RRA_LIB_GSSAPI_SET],
-[CPPFLAGS="$GSSAPI_CPPFLAGS $CPPFLAGS"
- LDFLAGS="$GSSAPI_LDFLAGS $LDFLAGS"
- LIBS="$GSSAPI_LIBS $LIBS"])
-
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.
@@ -34,7 +26,9 @@ AC_DEFUN([RRA_LIB_GSSAPI_SWITCH],
[rra_gssapi_save_CPPFLAGS="$CPPFLAGS"
rra_gssapi_save_LDFLAGS="$LDFLAGS"
rra_gssapi_save_LIBS="$LIBS"
- RRA_LIB_GSSAPI_SET])
+ 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).
@@ -47,7 +41,7 @@ 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="-I$rra_gssapi_libdir"],
+ [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],
diff --git a/m4/inet-ntoa.m4 b/m4/inet-ntoa.m4
index e8ebb9f..6045bd7 100644
--- a/m4/inet-ntoa.m4
+++ b/m4/inet-ntoa.m4
@@ -1,4 +1,4 @@
-dnl inet-ntoa.m4 -- Check for a working inet_ntoa.
+dnl Check for a working inet_ntoa.
dnl
dnl Check whether inet_ntoa is present and working. Since calling inet_ntoa
dnl involves passing small structs on the stack, present and working versions
@@ -6,30 +6,17 @@ dnl may still not function with gcc on some platforms (such as IRIX).
dnl Provides RRA_FUNC_INET_NTOA and defines HAVE_INET_NTOA if inet_ntoa is
dnl present and working.
dnl
-dnl Copyright 2008 Board of Trustees, Leland Stanford Jr. University
+dnl Copyright 2008, 2009 Board of Trustees, Leland Stanford Jr. University
dnl Copyright (c) 2004, 2005, 2006, 2007
dnl by Internet Systems Consortium, Inc. ("ISC")
dnl Copyright (c) 1991, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
dnl 2002, 2003 by The Internet Software Consortium and Rich Salz
dnl
-dnl This code is derived from software contributed to the Internet Software
-dnl Consortium by Rich Salz.
-dnl
-dnl Permission to use, copy, modify, and distribute this software for any
-dnl purpose with or without fee is hereby granted, provided that the above
-dnl copyright notice and this permission notice appear in all copies.
-dnl
-dnl THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-dnl REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-dnl MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY
-dnl SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-dnl ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-dnl OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+dnl See LICENSE for licensing terms.
dnl Source used by RRA_FUNC_INET_NTOA.
-define([_RRA_FUNC_INET_NTOA_SOURCE],
-[#include <sys/types.h>
+AC_DEFUN([_RRA_FUNC_INET_NTOA_SOURCE], [[
+#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -41,16 +28,17 @@ main(void)
struct in_addr in;
in.s_addr = htonl(0x7f000000L);
return (strcmp(inet_ntoa(in), "127.0.0.0") == 0) ? 0 : 1;
-}])
+}
+]])
dnl The public macro.
AC_DEFUN([RRA_FUNC_INET_NTOA],
[AC_CACHE_CHECK(for working inet_ntoa, rra_cv_func_inet_ntoa_works,
-[AC_TRY_RUN(_RRA_FUNC_INET_NTOA_SOURCE(),
- [rra_cv_func_inet_ntoa_works=yes],
- [rra_cv_func_inet_ntoa_works=no],
- [rra_cv_func_inet_ntoa_works=no])])
-AS_IF([test "$rra_cv_func_inet_ntoa_works" = yes],
+ [AC_RUN_IFELSE([AC_LANG_SOURCE([_RRA_FUNC_INET_NTOA_SOURCE])],
+ [rra_cv_func_inet_ntoa_works=yes],
+ [rra_cv_func_inet_ntoa_works=no],
+ [rra_cv_func_inet_ntoa_works=no])])
+ AS_IF([test "$rra_cv_func_inet_ntoa_works" = yes],
[AC_DEFINE([HAVE_INET_NTOA], 1,
[Define if your system has a working inet_ntoa function.])],
[AC_LIBOBJ([inet_ntoa])])])
diff --git a/m4/snprintf.m4 b/m4/snprintf.m4
index 1938dea..1fe8198 100644
--- a/m4/snprintf.m4
+++ b/m4/snprintf.m4
@@ -1,4 +1,4 @@
-dnl snprintf.m4 -- Test for a working C99 snprintf.
+dnl Test for a working C99 snprintf.
dnl
dnl Check for a working snprintf. Some systems have an snprintf that doesn't
dnl nul-terminate if the buffer isn't large enough. Others return -1 if the
@@ -10,13 +10,14 @@ dnl Provides RRA_FUNC_SNPRINTF, which adds snprintf.o to LIBOBJS unless a
dnl fully working snprintf is found.
dnl
dnl Written by Russ Allbery <rra@stanford.edu>
-dnl Copyright 2006, 2008 Board of Trustees, Leland Stanford Jr. University
+dnl Copyright 2006, 2008, 2009
+dnl Board of Trustees, Leland Stanford Jr. University
dnl
dnl See LICENSE for licensing terms.
dnl Source used by RRA_FUNC_SNPRINTF.
-define([_RRA_FUNC_SNPRINTF_SOURCE],
-[[#include <stdio.h>
+AC_DEFUN([_RRA_FUNC_SNPRINTF_SOURCE], [[
+#include <stdio.h>
#include <stdarg.h>
char buf[2];
@@ -38,16 +39,17 @@ main()
{
return ((test("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
&& snprintf(NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
-}]])
+}
+]])
dnl The user-callable test.
AC_DEFUN([RRA_FUNC_SNPRINTF],
[AC_CACHE_CHECK([for working snprintf], [rra_cv_func_snprintf_works],
- [AC_TRY_RUN(_RRA_FUNC_SNPRINTF_SOURCE(),
+ [AC_RUN_IFELSE([AC_LANG_SOURCE([_RRA_FUNC_SNPRINTF_SOURCE])],
[rra_cv_func_snprintf_works=yes],
[rra_cv_func_snprintf_works=no],
[rra_cv_func_snprintf_works=no])])
-AS_IF([test "$rra_cv_func_snprintf_works" = yes],
+ AS_IF([test "$rra_cv_func_snprintf_works" = yes],
[AC_DEFINE([HAVE_SNPRINTF], 1,
[Define if your system has a working snprintf function.])],
[AC_LIBOBJ([snprintf])])])
diff --git a/m4/socket.m4 b/m4/socket.m4
index 1589432..60b262a 100644
--- a/m4/socket.m4
+++ b/m4/socket.m4
@@ -1,39 +1,57 @@
-dnl socket.m4 -- Various checks for socket support and macros.
+dnl Various checks for socket support and macros.
dnl
dnl This is a collection of various Autoconf macros for checking networking
dnl and socket properties. The macros provided are:
dnl
+dnl RRA_FUNC_GETADDRINFO_ADDRCONFIG
dnl RRA_MACRO_IN6_ARE_ADDR_EQUAL
dnl RRA_MACRO_SA_LEN
dnl
-dnl Most of them use a separate internal source macro to make the code easier
-dnl to read.
+dnl They use a separate internal source macro to make the code easier to read.
dnl
-dnl Copyright 2008 Board of Trustees, Leland Stanford Jr. University
-dnl Copyright (c) 2004, 2005, 2006, 2007
+dnl Copyright 2008, 2009 Board of Trustees, Leland Stanford Jr. University
+dnl Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009
dnl by Internet Systems Consortium, Inc. ("ISC")
dnl Copyright (c) 1991, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
dnl 2002, 2003 by The Internet Software Consortium and Rich Salz
dnl
-dnl This code is derived from software contributed to the Internet Software
-dnl Consortium by Rich Salz.
-dnl
-dnl Permission to use, copy, modify, and distribute this software for any
-dnl purpose with or without fee is hereby granted, provided that the above
-dnl copyright notice and this permission notice appear in all copies.
-dnl
-dnl THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-dnl REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-dnl MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY
-dnl SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-dnl ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-dnl OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+dnl See LICENSE for licensing terms.
+
+dnl Source used by RRA_FUNC_GETADDRINFO_ADDRCONFIG.
+AC_DEFUN([_RRA_FUNC_GETADDRINFO_ADDRCONFIG_SOURCE], [[
+#include <netdb.h>
+#include <stdio.h>
+#include <sys/socket.h>
+
+int
+main(void) {
+ struct addrinfo hints, *ai;
+
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = AF_UNSPEC;
+ hints.ai_socktype = SOCK_STREAM;
+ hints.ai_flags = AI_ADDRCONFIG;
+ return (getaddrinfo("localhost", NULL, &hints, &ai) != 0);
+}
+]])
+
+dnl Check whether the AI_ADDRCONFIG flag works properly with getaddrinfo.
+dnl If so, set HAVE_GETADDRINFO_ADDRCONFIG.
+AC_DEFUN([RRA_FUNC_GETADDRINFO_ADDRCONFIG],
+[AC_CACHE_CHECK([for working AI_ADDRCONFIG flag],
+ [rra_cv_func_getaddrinfo_addrconfig_works],
+ [AC_RUN_IFELSE(AC_LANG_SOURCE([_RRA_FUNC_GETADDRINFO_ADDRCONFIG_SOURCE]),
+ [rra_cv_func_getaddrinfo_addrconfig_works=yes],
+ [rra_cv_func_getaddrinfo_addrconfig_works=no],
+ [rra_cv_func_getaddrinfo_addrconfig_works=no])])
+ AS_IF([test x"$rra_cv_func_getaddrinfo_addrconfig_works" = xyes],
+ [AC_DEFINE([HAVE_GETADDRINFO_ADDRCONFIG], 1,
+ [Define if the AI_ADDRCONFIG flag works with getaddrinfo.])])])
dnl Source used by INN_IN6_EQ_BROKEN. Test borrowed from a bug report by
dnl tmoestl@gmx.net for glibc.
-AC_DEFUN([_RRA_MACRO_IN6_ARE_ADDR_EQUAL_SOURCE],
-[#include <sys/types.h>
+AC_DEFUN([_RRA_MACRO_IN6_ARE_ADDR_EQUAL_SOURCE], [[
+#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -47,31 +65,42 @@ main (void)
inet_pton(AF_INET6, "fe80::1234:5678:abcd", &a);
inet_pton(AF_INET6, "fe80::1234:5678:abcd", &b);
return IN6_ARE_ADDR_EQUAL(&a, &b) ? 0 : 1;
-}])
+}
+]])
dnl Check whether the IN6_ARE_ADDR_EQUAL macro is broken (like glibc 2.1.3) or
dnl missing.
AC_DEFUN([RRA_MACRO_IN6_ARE_ADDR_EQUAL],
[AC_CACHE_CHECK([whether IN6_ARE_ADDR_EQUAL macro is broken],
[rra_cv_in6_are_addr_equal_broken],
- [AC_TRY_RUN(_RRA_MACRO_IN6_ARE_ADDR_EQUAL_SOURCE,
- rra_cv_in6_are_addr_equal_broken=no,
- rra_cv_in6_are_addr_equal_broken=yes,
- rra_cv_in6_are_addr_equal_broken=yes)])
-AS_IF([test x"$rra_cv_in6_are_addr_equal_broken" = xyes],
+ [AC_RUN_IFELSE([AC_LANG_SOURCE([_RRA_MACRO_IN6_ARE_ADDR_EQUAL_SOURCE])],
+ [rra_cv_in6_are_addr_equal_broken=no],
+ [rra_cv_in6_are_addr_equal_broken=yes],
+ [rra_cv_in6_are_addr_equal_broken=yes])])
+ AS_IF([test x"$rra_cv_in6_are_addr_equal_broken" = xyes],
[AC_DEFINE([HAVE_BROKEN_IN6_ARE_ADDR_EQUAL], 1,
[Define if your IN6_ARE_ADDR_EQUAL macro is broken.])])])
+dnl Source used by RRA_MACRO_SA_LEN.
+AC_DEFUN([_RRA_MACRO_SA_LEN_SOURCE], [[
+#include <sys/types.h>
+#include <sys/socket.h>
+
+int
+main(void)
+{
+ struct sockaddr sa;
+ int x = SA_LEN(&sa);
+}
+]])
+
dnl Check whether the SA_LEN macro is available. This should give the length
dnl of a struct sockaddr regardless of type.
AC_DEFUN([RRA_MACRO_SA_LEN],
[AC_CACHE_CHECK([for SA_LEN macro], [rra_cv_sa_len_macro],
-[AC_TRY_LINK(
-[#include <sys/types.h>
-#include <sys/socket.h>],
- [struct sockaddr sa; int x = SA_LEN(&sa);],
- [rra_cv_sa_len_macro=yes],
- [rra_cv_sa_len_macro=no])])
-AS_IF([test "$rra_cv_sa_len_macro" = yes],
+ [AC_LINK_IFELSE([AC_LANG_SOURCE([_RRA_MACRO_SA_LEN_SOURCE])],
+ [rra_cv_sa_len_macro=yes],
+ [rra_cv_sa_len_macro=no])])
+ AS_IF([test "$rra_cv_sa_len_macro" = yes],
[AC_DEFINE([HAVE_SA_LEN], 1,
[Define if <sys/socket.h> defines the SA_LEN macro])])])
diff --git a/m4/vamacros.m4 b/m4/vamacros.m4
index 6740d77..5348d31 100644
--- a/m4/vamacros.m4
+++ b/m4/vamacros.m4
@@ -1,4 +1,4 @@
-dnl vamacros.m4 -- Check for support for variadic macros.
+dnl Check for support for variadic macros.
dnl
dnl This file defines two macros for probing for compiler support for variadic
dnl macros. Provided are RRA_C_C99_VAMACROS, which checks for support for the
@@ -14,30 +14,49 @@ dnl
dnl They set HAVE_C99_VAMACROS or HAVE_GNU_VAMACROS as appropriate.
dnl
dnl Written by Russ Allbery <rra@stanford.edu>
-dnl Copyright 2006, 2008 Board of Trustees, Leland Stanford Jr. University
+dnl Copyright 2006, 2008, 2009
+dnl Board of Trustees, Leland Stanford Jr. University
dnl
dnl See LICENSE for licensing terms.
+AC_DEFUN([_RRA_C_C99_VAMACROS_SOURCE], [[
+#include <stdio.h>
+#define error(...) fprintf(stderr, __VA_ARGS__)
+
+int
+main(void) {
+ error("foo");
+ error("foo %d", 0);
+ return 0;
+}
+]])
+
AC_DEFUN([RRA_C_C99_VAMACROS],
[AC_CACHE_CHECK([for C99 variadic macros], [rra_cv_c_c99_vamacros],
-[AC_TRY_COMPILE(
-[#include <stdio.h>
-#define error(...) fprintf(stderr, __VA_ARGS__)],
- [error("foo"); error("foo %d", 0); return 0;],
- [rra_cv_c_c99_vamacros=yes],
- [rra_cv_c_c99_vamacros=no])])
-AS_IF([test $rra_cv_c_c99_vamacros = yes],
+ [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_RRA_C_C99_VAMACROS_SOURCE])],
+ [rra_cv_c_c99_vamacros=yes],
+ [rra_cv_c_c99_vamacros=no])])
+ AS_IF([test $rra_cv_c_c99_vamacros = yes],
[AC_DEFINE([HAVE_C99_VAMACROS], 1,
- [Define if the compiler supports C99 variadic macros.])])])
+ [Define if the compiler supports C99 variadic macros.])])])
+
+AC_DEFUN([_RRA_C_GNU_VAMACROS_SOURCE], [[
+#include <stdio.h>
+#define error(args...) fprintf(stderr, args)
+
+int
+main(void) {
+ error("foo");
+ error("foo %d", 0);
+ return 0;
+}
+]])
AC_DEFUN([RRA_C_GNU_VAMACROS],
[AC_CACHE_CHECK([for GNU-style variadic macros], [rra_cv_c_gnu_vamacros],
-[AC_TRY_COMPILE(
-[#include <stdio.h>
-#define error(args...) fprintf(stderr, args)],
- [error("foo"); error("foo %d", 0); return 0;],
- [rra_cv_c_gnu_vamacros=yes],
- [rra_cv_c_gnu_vamacros=no])])
-AS_IF([test $rra_cv_c_gnu_vamacros = yes],
+ [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_RRA_C_GNU_VAMACROS_SOURCE])],
+ [rra_cv_c_gnu_vamacros=yes],
+ [rra_cv_c_gnu_vamacros=no])])
+ AS_IF([test $rra_cv_c_gnu_vamacros = yes],
[AC_DEFINE([HAVE_GNU_VAMACROS], 1,
- [Define if the compiler supports GNU-style variadic macros.])])])
+ [Define if the compiler supports GNU-style variadic macros.])])])