diff --git a/driver/xf86-video-intel/config.h.in b/driver/xf86-video-intel/config.h.in index e8256bfcc..8999d3a21 100644 --- a/driver/xf86-video-intel/config.h.in +++ b/driver/xf86-video-intel/config.h.in @@ -129,6 +129,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H +/* Define to 1 if typeof works with your compiler. */ +#undef HAVE_TYPEOF + /* Enable udev-based monitor hotplug detection */ #undef HAVE_UDEV @@ -257,3 +260,6 @@ /* Define for large files, on AIX-style hosts. */ #undef _LARGE_FILES + +/* Define to __typeof__ if your compiler spells it that way. */ +#undef typeof diff --git a/driver/xf86-video-intel/configure b/driver/xf86-video-intel/configure index ec024664d..9290c3849 100644 --- a/driver/xf86-video-intel/configure +++ b/driver/xf86-video-intel/configure @@ -18527,6 +18527,61 @@ fi done + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for typeof syntax and keyword spelling" >&5 +$as_echo_n "checking for typeof syntax and keyword spelling... " >&6; } +if ${ac_cv_c_typeof+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_c_typeof=no + for ac_kw in typeof __typeof__ no; do + test $ac_kw = no && break + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + int value; + typedef struct { + char a [1 + + ! (($ac_kw (value)) + (($ac_kw (value)) 0 < ($ac_kw (value)) -1 + ? ($ac_kw (value)) - 1 + : ~ (~ ($ac_kw (value)) 0 + << sizeof ($ac_kw (value)))))]; } + ac__typeof_type_; + return + (! ((void) ((ac__typeof_type_ *) 0), 0)); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_typeof=$ac_kw +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test $ac_cv_c_typeof != no && break + done +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_typeof" >&5 +$as_echo "$ac_cv_c_typeof" >&6; } + if test $ac_cv_c_typeof != no; then + +$as_echo "#define HAVE_TYPEOF 1" >>confdefs.h + + if test $ac_cv_c_typeof != typeof; then + +cat >>confdefs.h <<_ACEOF +#define typeof $ac_cv_c_typeof +_ACEOF + + fi + fi + + # Platform specific settings case $host_os in *linux*) diff --git a/driver/xf86-video-intel/configure.ac b/driver/xf86-video-intel/configure.ac index 0191bd5c9..9144dd5f1 100644 --- a/driver/xf86-video-intel/configure.ac +++ b/driver/xf86-video-intel/configure.ac @@ -65,6 +65,8 @@ AC_SYS_LARGEFILE # Check for common libc routines redefined by os.h AC_CHECK_FUNCS([strlcpy strlcat strndup], [], []) +AC_C_TYPEOF + # Platform specific settings case $host_os in *linux*) diff --git a/driver/xf86-video-intel/src/intel_list.h b/driver/xf86-video-intel/src/intel_list.h index 51af825d7..99615d273 100644 --- a/driver/xf86-video-intel/src/intel_list.h +++ b/driver/xf86-video-intel/src/intel_list.h @@ -305,9 +305,15 @@ list_is_empty(const struct list *head) #define list_last_entry(ptr, type, member) \ list_entry((ptr)->prev, type, member) +/* + * Do not redefine __container_of, we better off using the one in xorg/list.h. + */ +#ifndef __container_of #define __container_of(ptr, sample, member) \ (void *)((char *)(ptr) \ - ((char *)&(sample)->member - (char *)(sample))) +#endif + /** * Loop through the list given by head and set pos to struct in the list. *