build: Make sure AC_INCLUDES_DEFAULT is used

Without using AC_INCLUDES_DEFAULT explicitly,
certain platforms will complain that the header
was found, but not usable by the compiler.
This happens for instance on Solaris where certain
headers are needed to pull in proper defines.

Also upgrade to newer autoconf syntax and use proper quoting.

https://bugzilla.gnome.org/show_bug.cgi?id=667293
This commit is contained in:
Idar Tollefsen 2012-01-01 16:38:08 +01:00 committed by Tim-Philipp Müller
parent d6e6391518
commit 7b80441f9d
2 changed files with 17 additions and 15 deletions

View file

@ -296,40 +296,40 @@ dnl check if we have ANSI C header files
AC_HEADER_STDC AC_HEADER_STDC
dnl Check for ucontext.h dnl Check for ucontext.h
AC_CHECK_HEADERS([ucontext.h]) AC_CHECK_HEADERS([ucontext.h], [], [], [AC_INCLUDES_DEFAULT])
dnl Check for sys/socket.h dnl Check for sys/socket.h
AC_CHECK_HEADERS([sys/socket.h], HAVE_SYS_SOCKET_H=yes) AC_CHECK_HEADERS([sys/socket.h], [HAVE_SYS_SOCKET_H=yes], [HAVE_SYS_SOCKET_H=no], [AC_INCLUDES_DEFAULT])
AM_CONDITIONAL(HAVE_SYS_SOCKET_H, test "x$HAVE_SYS_SOCKET_H" = "xyes") AM_CONDITIONAL(HAVE_SYS_SOCKET_H, test "x$HAVE_SYS_SOCKET_H" = "xyes")
dnl check for sys/times.h for tests/examples/adapter/ dnl check for sys/times.h for tests/examples/adapter/
AC_CHECK_HEADERS([sys/times.h], HAVE_SYS_TIMES_H=yes) AC_CHECK_HEADERS([sys/times.h], [HAVE_SYS_TIMES_H=yes], [HAVE_SYS_TIME_H=no], [AC_INCLUDES_DEFAULT])
AC_CHECK_HEADERS([unistd.h], HAVE_UNISTD_H=yes) AC_CHECK_HEADERS([unistd.h], [HAVE_UNISTD_H=yes], [HAVE_UNISTD_H=no], [AC_INCLUDES_DEFAULT])
AM_CONDITIONAL(HAVE_SYS_TIMES_H_AND_UNISTD_H, test "x$HAVE_SYS_TIMES_H" = "xyes" -a "x$HAVE_UNISTD_H" = "xyes") AM_CONDITIONAL(HAVE_SYS_TIMES_H_AND_UNISTD_H, test "x$HAVE_SYS_TIMES_H" = "xyes" -a "x$HAVE_UNISTD_H" = "xyes")
dnl Check for process.h for getpid() on win32 dnl Check for process.h for getpid() on win32
AC_CHECK_HEADERS([process.h]) AC_CHECK_HEADERS([process.h], [], [], [AC_INCLUDES_DEFAULT])
dnl Check for sys/utsname.h for uname dnl Check for sys/utsname.h for uname
AC_CHECK_HEADERS([sys/utsname.h]) AC_CHECK_HEADERS([sys/utsname.h], [], [], [AC_INCLUDES_DEFAULT])
dnl Check for stdio_ext.f for __fbufsize dnl Check for stdio_ext.f for __fbufsize
AC_CHECK_HEADERS([stdio_ext.h]) AC_CHECK_HEADERS([stdio_ext.h], [], [], [AC_INCLUDES_DEFAULT])
dnl check for pthreads dnl check for pthreads
AC_CHECK_HEADERS([pthread.h], HAVE_PTHREAD_H=yes) AC_CHECK_HEADERS([pthread.h], [HAVE_PTHREAD_H=yes], [HAVE_PTHREAD_H=no], [AC_INCLUDES_DEFAULT])
AM_CONDITIONAL(HAVE_PTHREAD_H, test "x$HAVE_PTHREAD_H" = "xyes") AM_CONDITIONAL(HAVE_PTHREAD_H, test "x$HAVE_PTHREAD_H" = "xyes")
dnl check for sys/prctl for setting thread name on Linux dnl check for sys/prctl for setting thread name on Linux
AC_CHECK_HEADERS([sys/prctl.h], HAVE_SYS_PRCTL_H=yes) AC_CHECK_HEADERS([sys/prctl.h], [], [], [AC_INCLUDES_DEFAULT])
dnl Check for valgrind.h dnl Check for valgrind.h
dnl separate from HAVE_VALGRIND because you can have the program, but not dnl separate from HAVE_VALGRIND because you can have the program, but not
dnl the dev package dnl the dev package
AC_CHECK_HEADERS([valgrind/valgrind.h], HAVE_VALGRIND_H=yes) AC_CHECK_HEADERS([valgrind/valgrind.h], [], [], [AC_INCLUDES_DEFAULT])
dnl used in gst/gstpoll.c dnl used in gst/gstpoll.c
AC_CHECK_HEADERS([winsock2.h], HAVE_WINSOCK2_H=yes) AC_CHECK_HEADERS([winsock2.h], [HAVE_WINSOCK2_H=yes], [HAVE_WINSOCK2_H=no], [AC_INCLUDES_DEFAULT])
AM_CONDITIONAL(HAVE_WINSOCK2_H, test "x$HAVE_WINSOCK2_H" = "xyes") AM_CONDITIONAL(HAVE_WINSOCK2_H, test "x$HAVE_WINSOCK2_H" = "xyes")
if test "x$HAVE_WINSOCK2_H" = "xyes"; then if test "x$HAVE_WINSOCK2_H" = "xyes"; then
WIN32_LIBS="-lws2_32" WIN32_LIBS="-lws2_32"
@ -408,12 +408,12 @@ AC_CHECK_FUNCS([fgetpos])
AC_CHECK_FUNCS([fsetpos]) AC_CHECK_FUNCS([fsetpos])
dnl check for poll(), ppoll() and pselect() dnl check for poll(), ppoll() and pselect()
AC_CHECK_HEADERS([sys/poll.h], [], [], [AC_INCLUDES_DEFAULT])
AC_CHECK_HEADERS([poll.h], [], [], [AC_INCLUDES_DEFAULT])
AC_CHECK_FUNCS([poll]) AC_CHECK_FUNCS([poll])
AC_CHECK_FUNCS([ppoll]) AC_CHECK_FUNCS([ppoll])
AC_CHECK_FUNCS([pselect]) AC_CHECK_FUNCS([pselect])
AC_CHECK_HEADERS([sys/poll.h])
dnl **************************************** dnl ****************************************
dnl *** GLib POLL* compatibility defines *** dnl *** GLib POLL* compatibility defines ***
dnl **************************************** dnl ****************************************
@ -422,10 +422,12 @@ AC_MSG_CHECKING([for broken poll])
AC_RUN_IFELSE([AC_LANG_SOURCE([[ AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdlib.h> #include <stdlib.h>
#include <fcntl.h> #include <fcntl.h>
#include <poll.h>
#ifdef HAVE_SYS_POLL_H #ifdef HAVE_SYS_POLL_H
#include <sys/poll.h> #include <sys/poll.h>
#endif #endif
#ifdef HAVE_POLL_H
#include <poll.h>
#endif
int main(void) { int main(void) {
struct pollfd fds[1]; struct pollfd fds[1];
int fd; int fd;

View file

@ -16,7 +16,7 @@ AC_SUBST(CHECK_MICRO_VERSION)
AC_SUBST(CHECK_VERSION) AC_SUBST(CHECK_VERSION)
dnl Checks for header files and declarations dnl Checks for header files and declarations
AC_CHECK_HEADERS([unistd.h sys/wait.h sys/time.h]) AC_CHECK_HEADERS([unistd.h sys/wait.h sys/time.h], [], [], [AC_INCLUDES_DEFAULT])
AC_CHECK_FUNCS([localtime_r]) AC_CHECK_FUNCS([localtime_r])