diff --git a/ChangeLog b/ChangeLog index d0d64568..61781eb3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,13 @@ 2007-05-24 James Youngman - + * m4/noreturn.m4: New file, testing for support of __attribute__ + ((__noreturn__)). Defines jy_AC_ATTRIBUTE_NORETURN and sets + HAVE_ATTRIBUTE_NORETURN. + * configure.in: Call jy_AC_ATTRIBUTE_NORETURN. + * find/defs.h (ATTRIBUTE_NORETURN): Define to nothing if + HAVE_ATTRIBUTE_NORETURN is not set in config.h. This should fix a + compilation error with non-GCC compilers. + * configure.in (FINDLIBS): Update FINDLIBS to link against -lm for modf. This fixed a link error on HP-UX. * find/Makefile.am (LDADD): Use @FINDLIBS@ diff --git a/configure.in b/configure.in index 88f0c078..107a2b98 100644 --- a/configure.in +++ b/configure.in @@ -215,6 +215,7 @@ AC_CHECK_MEMBER(struct dirent.d_type,,,[ #include #include ]) +jy_AC_ATTRIBUTE_NORETURN dnl internationalization macros AM_GNU_GETTEXT([external]) diff --git a/find/defs.h b/find/defs.h index b6b1a185..d70396c8 100644 --- a/find/defs.h +++ b/find/defs.h @@ -58,7 +58,11 @@ typedef bool boolean; #define PARAMS(Args) Args #ifndef ATTRIBUTE_NORETURN -# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) +# if HAVE_ATTRIBUTE_NORETURN +# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) +# else +# define ATTRIBUTE_NORETURN /* nothing */ +# endif #endif int optionl_stat PARAMS((const char *name, struct stat *p)); diff --git a/m4/noreturn.m4 b/m4/noreturn.m4 new file mode 100644 index 00000000..343ac106 --- /dev/null +++ b/m4/noreturn.m4 @@ -0,0 +1,33 @@ +dnl Copyright (C) 2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl James Youngman , 2007. + +AC_DEFUN([jy_AC_ATTRIBUTE_NORETURN], +[AC_CACHE_CHECK([for __attribute__ ((__noreturn__)) support], + [jy_cv_cc_attribute_noreturn], + [AC_COMPILE_IFELSE( + [void report_fatal_error(void) __attribute__ ((__noreturn__));] + [jy_cv_cc_attribute_noreturn=yes], + [jy_cv_cc_attribute_noreturn=no])]) +if test $jy_cv_cc_attribute_noreturn = yes; then + HAVE_ATTRIBUTE_NORETURN=1 +else + HAVE_ATTRIBUTE_NORETURN=0 +fi +AC_SUBST([HAVE_ATTRIBUTE_NORETURN]) +AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE_NORETURN],[$HAVE_ATTRIBUTE_NORETURN], + [Define to 1 if the compiler supports __attribute__ ((__noreturn__))]) +])