stddef: fix NetBSD 5.0 NULL bug, rather than working around it
[gnulib.git] / m4 / locale_h.m4
1 # locale_h.m4 serial 3
2 dnl Copyright (C) 2007, 2009 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
6
7 AC_DEFUN([gl_LOCALE_H],
8 [
9   AC_CACHE_CHECK([whether locale.h conforms to POSIX],
10     [gl_cv_header_working_locale_h],
11     [AC_TRY_COMPILE([#include <locale.h>
12 int x = LC_MESSAGES;], [],
13        [gl_cv_header_working_locale_h=yes],
14        [gl_cv_header_working_locale_h=no])])
15
16   dnl If <stddef.h> is replaced, then <locale.h> must also be replaced.
17   AC_REQUIRE([gl_STDDEF_H])
18
19   if test $gl_cv_header_working_locale_h = yes && test -z "$STDDEF_H"; then
20     LOCALE_H=
21   else
22     gl_CHECK_NEXT_HEADERS([locale.h])
23     LOCALE_H=locale.h
24   fi
25   AC_SUBST([LOCALE_H])
26 ])