* lib/autoconf/types.m4 (AC_TYPE_SIGNAL): Switch to AU_DEFUN.
* doc/autoconf.texi (Function Portability): Update documentation.
(Particular Types): Move AC_TYPE_SIGNAL...
(Obsolete Macros): ...here, and mention why.
Signed-off-by: Eric Blake <ebb9@byu.net>
2008-06-09 Eric Blake <ebb9@byu.net>
+ Mark AC_TYPE_SIGNAL as obsolete.
+ * lib/autoconf/types.m4 (AC_TYPE_SIGNAL): Switch to AU_DEFUN.
+ * doc/autoconf.texi (Function Portability): Update documentation.
+ (Particular Types): Move AC_TYPE_SIGNAL...
+ (Obsolete Macros): ...here, and mention why.
+
Allow lib64 as a default X library location.
* lib/autoconf/libs.m4 (_AC_PATH_X_XMKMF): Add lib64.
* NEWS: Mention the change.
@item @code{signal} handler
@c @fuindex signal
@prindex @code{signal}
+@prindex @code{sigaction}
Normally @code{signal} takes a handler function with a return type of
@code{void}, but some old systems required @code{int} instead. Any
actual @code{int} value returned is not used; this is only a
All systems we know of in current use return @code{void}. The
@code{int} was to support K&R C, where of course @code{void} is not
-available. @code{AC_TYPE_SIGNAL} (@pxref{Particular Types}) can be
-used to establish the correct type in all cases.
+available. The obsolete macro @code{AC_TYPE_SIGNAL}
+(@pxref{AC_TYPE_SIGNAL}) can be used to establish the correct type in
+all cases.
+
+In most cases, it is more robust to use @code{sigaction} when it is
+available, rather than @code{signal}.
@item @code{snprintf}
@c @fuindex snprintf
define it.
@end defmac
-@anchor{AC_TYPE_SIGNAL}
-@defmac AC_TYPE_SIGNAL
-@acindex{TYPE_SIGNAL}
-@cvindex RETSIGTYPE
-@hdrindex{signal.h}
-If @file{signal.h} declares @code{signal} as returning a pointer to a
-function returning @code{void}, define @code{RETSIGTYPE} to be
-@code{void}; otherwise, define it to be @code{int}.
-
-Define signal handlers as returning type @code{RETSIGTYPE}:
-
-@example
-@group
-RETSIGTYPE
-hup_handler ()
-@{
-@dots{}
-@}
-@end group
-@end example
-@end defmac
-
@anchor{AC_TYPE_SIZE_T}
@defmac AC_TYPE_SIZE_T
@acindex{TYPE_SIZE_T}
@defmac AC_RETSIGTYPE
@acindex{RETSIGTYPE}
-Replaced by @code{AC_TYPE_SIGNAL} (@pxref{AC_TYPE_SIGNAL}).
+Replaced by @code{AC_TYPE_SIGNAL} (@pxref{AC_TYPE_SIGNAL}), which itself
+is obsolete when assuming C89 or better.
@end defmac
@defmac AC_RSH
@xref{Runtime}.
@end defmac
+@anchor{AC_TYPE_SIGNAL}
+@defmac AC_TYPE_SIGNAL
+@acindex{TYPE_SIGNAL}
+@cvindex RETSIGTYPE
+@hdrindex{signal.h}
+If @file{signal.h} declares @code{signal} as returning a pointer to a
+function returning @code{void}, define @code{RETSIGTYPE} to be
+@code{void}; otherwise, define it to be @code{int}. These days, it is
+portable to assume C89, and that signal handlers return @code{void},
+without needing to use this macro or @code{RETSIGTYPE}.
+
+When targetting older K&R C, it is possible to define signal handlers as
+returning type @code{RETSIGTYPE}, and omit a return statement:
+
+@example
+@group
+RETSIGTYPE
+hup_handler ()
+@{
+@dots{}
+@}
+@end group
+@end example
+@end defmac
+
@defmac AC_UID_T
@acindex{UID_T}
Replaced by @code{AC_TYPE_UID_T} (@pxref{AC_TYPE_UID_T}).
# This file is part of Autoconf. -*- Autoconf -*-
# Type related macros: existence, sizeof, and structure members.
#
-# Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006, 2007 Free Software
-# Foundation, Inc.
+# Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008 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
# AC_TYPE_SIGNAL
# --------------
# Note that identifiers starting with SIG are reserved by ANSI C.
-AN_FUNCTION([signal], [AC_TYPE_SIGNAL])
-AC_DEFUN([AC_TYPE_SIGNAL],
+# C89 requires signal handlers to return void; only K&R returned int;
+# modern code does not need to worry about using this macro (not to
+# mention that sigaction is better than signal).
+AU_DEFUN([AC_TYPE_SIGNAL],
[AC_CACHE_CHECK([return type of signal handlers], ac_cv_type_signal,
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([#include <sys/types.h>
AC_DEFINE_UNQUOTED(RETSIGTYPE, $ac_cv_type_signal,
[Define as the return type of signal handlers
(`int' or `void').])
-])
+], [your code may safely assume C89 semantics that RETSIGTYPE is void.
+Remove this warning and the `AC_CACHE_CHECK' when you adjust the code.])
## ------------------------ ##