if a package doesn't happen to include stddef.h before trying to do
AC_CHECK_ALIGNOF, the current cross-compile fallback fails with newer
gcc.

for example, see the attached generated conftest.c (taken from recent
glib versions) where it does:
AC_CHECK_TYPE([guint32],,,[typedef unsigned $gint32 guint32;])
AC_CHECK_ALIGNOF([guint32], [AC_INCLUDES_DEFAULT
typedef unsigned $gint32 guint32;])

compiling this gcc-4.5+ fails (checked 4.4.7, 4.5.3, 4.6.3, and 4.7.1):
$ gcc -O2 conftest.c
conftest.c: In function ‘main’:
conftest.c:216:12: error: storage size of ‘test_array’ isn’t constant

if, however, we happen to pull in the stddef.h from gcc which now
includes an offsetof definition itself (which uses a builtin),
everything works nicely:
$ gcc -O2 conftest.c -DSTDC_HEADERS

perhaps one fix would be for AC_CHECK_ALIGNOF to require AC_STDC_HEADERS ?
-mike
/* confdefs.h */
#define PACKAGE_NAME "glib"
#define PACKAGE_TARNAME "glib"
#define PACKAGE_VERSION "2.32.4"
#define PACKAGE_STRING "glib 2.32.4"
#define PACKAGE_BUGREPORT "http://bugzilla.gnome.org/enter_bug.cgi?product=glib";
#define PACKAGE_URL ""
#define GLIB_MAJOR_VERSION 2
#define GLIB_MINOR_VERSION 32
#define GLIB_MICRO_VERSION 4
#define GLIB_INTERFACE_AGE 4
#define GLIB_BINARY_AGE 3204
#define _GNU_SOURCE 1
#define _FILE_OFFSET_BITS 64
#define HAVE_LOCALE_H 1
#define HAVE_LC_MESSAGES 1
#define HAVE_BIND_TEXTDOMAIN_CODESET 1
#define HAVE_GETTEXT 1
#define HAVE_DCGETTEXT 1
#define ENABLE_NLS 1
#define GETTEXT_PACKAGE "glib20"
#define GLIB_LOCALE_DIR "/usr/share/locale"
#define HAVE_DLFCN_H 1
#define LT_OBJDIR ".libs/"
#define HAVE_VPRINTF 1
#define HAVE_ALLOCA_H 1
#define HAVE_ALLOCA 1
#define HAVE_MMAP 1
#define HAVE_POSIX_MEMALIGN 1
#define HAVE_MEMALIGN 1
#define HAVE_VALLOC 1
#define HAVE_FSYNC 1
#define HAVE_PIPE2 1
#define HAVE_ATEXIT 1
#define HAVE_ON_EXIT 1
#define HAVE_TIMEGM 1
#define HAVE_GMTIME_R 1
#define SIZEOF_CHAR 1
#define SIZEOF_SHORT 2
#define SIZEOF_LONG 4
#define SIZEOF_INT 4
#define SIZEOF_VOID_P 4
#define SIZEOF_LONG_LONG 8
#define SIZEOF___INT64 0
#define HAVE_SIG_ATOMIC_T 1
#define HAVE_LONG_LONG_FORMAT 1
#define G_HAVE___INLINE 1
#define G_HAVE___INLINE__ 1
#define G_HAVE_INLINE 1
#define HAVE_DOWHILE_MACROS 1
#define HAVE_DIRENT_H 1
#define HAVE_FLOAT_H 1
#define HAVE_LIMITS_H 1
#define HAVE_PWD_H 1
#define HAVE_GRP_H 1
#define HAVE_SYS_PARAM_H 1
#define HAVE_SYS_POLL_H 1
#define HAVE_SYS_RESOURCE_H 1
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_TIMES_H 1
#define HAVE_SYS_WAIT_H 1
#define HAVE_UNISTD_H 1
#define HAVE_VALUES_H 1
#define HAVE_SYS_SELECT_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_STDINT_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_SCHED_H 1
#define HAVE_MALLOC_H 1
#define HAVE_SYS_VFS_H 1
#define HAVE_SYS_STATFS_H 1
#define HAVE_SYS_STATVFS_H 1
#define HAVE_MNTENT_H 1
#define HAVE_FSTAB_H 1
#define HAVE_SYS_UIO_H 1
#define HAVE_LINUX_MAGIC_H 1
#define HAVE_SYS_PRCTL_H 1
#define HAVE_SYS_MOUNT_H 1
#define HAVE_SYS_SYSCTL_H 1
#define HAVE_XLOCALE_H 1
#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
#define HAVE_STRUCT_STAT_ST_BLOCKS 1
#define HAVE_STRUCT_STATFS_F_BAVAIL 1
#define HAVE_STRUCT_TM_TM_GMTOFF 1
#define HAVE_DIRENT_H 1
#define HAVE_STRUCT_DIRENT_D_TYPE 1
#define HAVE_LANGINFO_CODESET 1
#define HAVE_STDDEF_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_SETLOCALE 1
#define SIZEOF_SIZE_T 4
#define HAVE_LSTAT 1
#define HAVE_STRERROR 1
#define HAVE_STRSIGNAL 1
#define HAVE_MEMMOVE 1
#define HAVE_VSNPRINTF 1
#define HAVE_STPCPY 1
#define HAVE_STRCASECMP 1
#define HAVE_STRNCASECMP 1
#define HAVE_POLL 1
#define HAVE_GETCWD 1
#define HAVE_VASPRINTF 1
#define HAVE_SETENV 1
#define HAVE_UNSETENV 1
#define HAVE_GETC_UNLOCKED 1
#define HAVE_READLINK 1
#define HAVE_SYMLINK 1
#define HAVE_MEMMEM 1
#define HAVE_CHOWN 1
#define HAVE_LCHOWN 1
#define HAVE_FCHMOD 1
#define HAVE_FCHOWN 1
#define HAVE_LINK 1
#define HAVE_UTIMES 1
#define HAVE_GETGRGID 1
#define HAVE_GETPWUID 1
#define HAVE_GETMNTENT_R 1
#define HAVE_SETMNTENT 1
#define HAVE_ENDMNTENT 1
#define HAVE_HASMNTOPT 1
#define HAVE_SPLICE 1
#define HAVE_PRLIMIT 1
#define HAVE_STATVFS 1
#define HAVE_STATFS 1
#define USE_STATFS 1
#define HAVE_NEWLOCALE 1
#define HAVE_USELOCALE 1
#define HAVE_STRTOD_L 1
#define HAVE_STRTOLL_L 1
#define HAVE_STRTOULL_L 1
#define HAVE_C99_VSNPRINTF 1
#define HAVE_UNIX98_PRINTF 1
#define HAVE_GETPROTOBYNAME_R 1
#define HAVE_ENDSERVENT 1
#define HAVE_IF_NAMETOINDEX 1
#define HAVE_NETDB_H 1
#define HAVE_ARPA_NAMESER_COMPAT_H 1
#define HAVE_NETLINK 1
#define HAVE_IP_MREQN /**/
#define STATFS_ARGS 2
#define HAVE_GOOD_PRINTF 1
#define HAVE_LONG_LONG 1
#define HAVE_LONG_DOUBLE 1
#define HAVE_WCHAR_T 1
#define HAVE_WINT_T 1
#define HAVE_INTTYPES_H_WITH_UINTMAX 1
#define HAVE_STDINT_H_WITH_UINTMAX 1
#define HAVE_INTMAX_T 1
#define HAVE_SNPRINTF 1
#define HAVE_WCSLEN 1
#define REALLOC_0_WORKS 1
#define HAVE_CODESET 1
#define HAVE_LANGINFO_TIME 1
#define HAVE_LANGINFO_OUTDIGIT 1
#define G_VA_COPY va_copy
#define G_VA_COPY_AS_ARRAY 1
#define HAVE_SYS_INOTIFY_H 1
#define HAVE_INOTIFY_INIT1 1
#define HAVE_LIBELF 1
#define HAVE_LIBELF 1
#define HAVE_LIBELF 1
#define HAVE_LIBELF 1
#define HAVE_LOCALTIME_R 1
#define HAVE_GMTIME_R 1
#define HAVE_POSIX_GETPWUID_R 1
#define HAVE_POSIX_GETGRGID_R 1
#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1
#define HAVE_PTHREAD_CONDATTR_SETCLOCK 1
#define HAVE_CLOCK_GETTIME 1
#define HAVE_FUTEX 1
#define HAVE_EVENTFD 1
/* end confdefs.h.  */
#include <stdio.h>
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#ifdef STDC_HEADERS
# include <stdlib.h>
# include <stddef.h>
#else
# ifdef HAVE_STDLIB_H
#  include <stdlib.h>
# endif
#endif
#ifdef HAVE_STRING_H
# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
#  include <memory.h>
# endif
# include <string.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#ifdef HAVE_INTTYPES_H
# include <inttypes.h>
#endif
#ifdef HAVE_STDINT_H
# include <stdint.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
typedef unsigned int guint32;

#ifndef offsetof
# define offsetof(type, member) ((char *) &((type *) 0)->member - (char *) 0)
#endif
typedef struct { char x; guint32 y; } ac__type_alignof_;
int
main ()
{
static int test_array [1 - 2 * !(((long int) offsetof (ac__type_alignof_, y)) >= 4)];
test_array [0] = 0

  ;
  return 0;
}

Reply via email to