compile with -std=c99 instead of -std=gnu99; use kiddie-gloves with bluetooth/bluetooh.h (#28017)

This commit is contained in:
Benjamin Peterson 2016-09-09 10:22:45 -07:00
parent 52a7e37555
commit 93b2dee80e
2 changed files with 29 additions and 8 deletions

24
configure vendored
View File

@ -6855,9 +6855,7 @@ UNIVERSAL_ARCH_FLAGS=
# tweak BASECFLAGS based on compiler and platform # tweak BASECFLAGS based on compiler and platform
case $GCC in case $GCC in
yes) yes)
# GNU dialect of C99, enables GNU extensions like __attribute__. GNU99 CFLAGS_NODIST="$CFLAGS_NODIST -std=c99"
# is required by bluetooth.h on big endian machines.
CFLAGS_NODIST="$CFLAGS_NODIST -std=gnu99"
# Python doesn't violate C99 aliasing rules, but older versions of # Python doesn't violate C99 aliasing rules, but older versions of
# GCC produce warnings for legal Python code. Enable # GCC produce warnings for legal Python code. Enable
@ -7617,7 +7615,7 @@ sys/param.h sys/select.h sys/sendfile.h sys/socket.h sys/statvfs.h \
sys/stat.h sys/syscall.h sys/sys_domain.h sys/termio.h sys/time.h \ sys/stat.h sys/syscall.h sys/sys_domain.h sys/termio.h sys/time.h \
sys/times.h sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/wait.h pty.h \ sys/times.h sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/wait.h pty.h \
libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
bluetooth/bluetooth.h linux/tipc.h linux/random.h spawn.h util.h alloca.h endian.h \ linux/tipc.h linux/random.h spawn.h util.h alloca.h endian.h \
sys/endian.h sys/endian.h
do : do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
@ -7840,6 +7838,24 @@ fi
fi fi
# bluetooth/bluetooth.h has been known to not compile with -std=c99.
# http://permalink.gmane.org/gmane.linux.bluez.kernel/22294
SAVE_CFLAGS=$CFLAGS
CFLAGS="-std=c99 $CFLAGS"
for ac_header in bluetooth/bluetooth.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "bluetooth/bluetooth.h" "ac_cv_header_bluetooth_bluetooth_h" "$ac_includes_default"
if test "x$ac_cv_header_bluetooth_bluetooth_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_BLUETOOTH_BLUETOOTH_H 1
_ACEOF
fi
done
CFLAGS=$SAVE_CFLAGS
# On Darwin (OS X) net/if.h requires sys/socket.h to be imported first. # On Darwin (OS X) net/if.h requires sys/socket.h to be imported first.
for ac_header in net/if.h for ac_header in net/if.h
do : do :

View File

@ -1520,9 +1520,7 @@ AC_SUBST(UNIVERSAL_ARCH_FLAGS)
# tweak BASECFLAGS based on compiler and platform # tweak BASECFLAGS based on compiler and platform
case $GCC in case $GCC in
yes) yes)
# GNU dialect of C99, enables GNU extensions like __attribute__. GNU99 CFLAGS_NODIST="$CFLAGS_NODIST -std=c99"
# is required by bluetooth.h on big endian machines.
CFLAGS_NODIST="$CFLAGS_NODIST -std=gnu99"
# Python doesn't violate C99 aliasing rules, but older versions of # Python doesn't violate C99 aliasing rules, but older versions of
# GCC produce warnings for legal Python code. Enable # GCC produce warnings for legal Python code. Enable
@ -1991,11 +1989,18 @@ sys/param.h sys/select.h sys/sendfile.h sys/socket.h sys/statvfs.h \
sys/stat.h sys/syscall.h sys/sys_domain.h sys/termio.h sys/time.h \ sys/stat.h sys/syscall.h sys/sys_domain.h sys/termio.h sys/time.h \
sys/times.h sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/wait.h pty.h \ sys/times.h sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/wait.h pty.h \
libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
bluetooth/bluetooth.h linux/tipc.h linux/random.h spawn.h util.h alloca.h endian.h \ linux/tipc.h linux/random.h spawn.h util.h alloca.h endian.h \
sys/endian.h) sys/endian.h)
AC_HEADER_DIRENT AC_HEADER_DIRENT
AC_HEADER_MAJOR AC_HEADER_MAJOR
# bluetooth/bluetooth.h has been known to not compile with -std=c99.
# http://permalink.gmane.org/gmane.linux.bluez.kernel/22294
SAVE_CFLAGS=$CFLAGS
CFLAGS="-std=c99 $CFLAGS"
AC_CHECK_HEADERS(bluetooth/bluetooth.h)
CFLAGS=$SAVE_CFLAGS
# On Darwin (OS X) net/if.h requires sys/socket.h to be imported first. # On Darwin (OS X) net/if.h requires sys/socket.h to be imported first.
AC_CHECK_HEADERS([net/if.h], [], [], AC_CHECK_HEADERS([net/if.h], [], [],
[#include <stdio.h> [#include <stdio.h>