# check that the C compiler works.
cat > $TMPC <<EOF
-int main(void) {}
+int main(void) { return 0; }
EOF
if compile_object ; then
cat > $TMPC <<EOF
#include <sched.h>
#include <linux/futex.h>
-void foo()
-{
+int main(void) {
#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
#error bork
#endif
+ return 0;
}
EOF
if test "$xen" != "no" ; then
xen_libs="-lxenstore -lxenctrl -lxenguest"
- # Xen unstable
+ # First we test whether Xen headers and libraries are available.
+ # If no, we are done and there is no Xen support.
+ # If yes, more tests are run to detect the Xen version.
+
+ # Xen (any)
cat > $TMPC <<EOF
#include <xenctrl.h>
#include <xs.h>
+int main(void) {
+ return 0;
+}
+EOF
+ if ! compile_prog "" "$xen_libs" ; then
+ # Xen not found
+ if test "$xen" = "yes" ; then
+ feature_not_found "xen"
+ fi
+ xen=no
+
+ # Xen unstable
+ elif (
+ cat > $TMPC <<EOF
+#include <xenctrl.h>
+#include <xs.h>
#include <stdint.h>
#include <xen/hvm/hvm_info_table.h>
#if !defined(HVM_MAX_VCPUS)
return 0;
}
EOF
- if compile_prog "" "$xen_libs" ; then
+ compile_prog "" "$xen_libs"
+ ) ; then
xen_ctrl_version=410
xen=yes
xen_ctrl_version=330
xen=yes
- # Xen not found or unsupported
+ # Xen version unsupported
else
if test "$xen" = "yes" ; then
- feature_not_found "xen"
+ feature_not_found "xen (unsupported version)"
fi
xen=no
fi
# xfsctl() probe, used for raw-posix
if test "$xfs" != "no" ; then
cat > $TMPC << EOF
+#include <stddef.h> /* NULL */
#include <xfs/xfs.h>
int main(void)
{
#ifdef __OpenBSD__
#define resize_term resizeterm
#endif
-int main(void) { resize_term(0, 0); return curses_version(); }
+int main(void) {
+ const char *s = curses_version();
+ resize_term(0, 0);
+ return s != 0;
+}
EOF
for curses_lib in $curses_list; do
if compile_prog "" "$curses_lib" ; then
pthread=no
cat > $TMPC << EOF
#include <pthread.h>
-int main(void) { pthread_create(0,0,0,0); return 0; }
+static void *f(void *p) { return NULL; }
+int main(void) {
+ pthread_t thread;
+ pthread_create(&thread, 0, f, 0);
+ return 0;
+}
EOF
if compile_prog "" "" ; then
pthread=yes
#include <sys/types.h>
#include <sys/uio.h>
#include <unistd.h>
-int main(void) { struct iovec iov; return 0; }
+int main(void) { return sizeof(struct iovec); }
EOF
iovec=no
if compile_prog "" "" ; then
#include <sys/types.h>
#include <sys/uio.h>
#include <unistd.h>
-int main(void) { preadv; }
+int main(void) { return preadv == preadv; }
EOF
preadv=no
if compile_prog "" "" ; then
#include <X11/Xlib.h>
#include <GL/gl.h>
#include <GL/glx.h>
-int main(void) { GL_VERSION; return 0; }
+int main(void) { return GL_VERSION != 0; }
EOF
if compile_prog "" "-lGL" ; then
opengl=yes
int main(void)
{
- int len, fd;
+ int len, fd = 0;
len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
return 0;
# signalfd probe
signalfd="no"
cat > $TMPC << EOF
-#define _GNU_SOURCE
#include <unistd.h>
#include <sys/syscall.h>
#include <signal.h>
int main(void)
{
- int efd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
- return 0;
+ return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
}
EOF
if compile_prog "" "" ; then
* warning but not an error, and will proceed to fail the
* qemu compile where we compile with -Werror.)
*/
- epoll_create1;
- return 0;
+ return epoll_create1 == epoll_create1;
}
EOF
if compile_prog "$ARCH_CFLAGS" "" ; then
cat > $TMPC <<EOF
#include <signal.h>
#include <time.h>
-int main(void) { clockid_t id; return clock_gettime(id, NULL); }
+int main(void) { return clock_gettime(CLOCK_REALTIME, NULL); }
EOF
if compile_prog "" "" ; then
if test "$darwin" != "yes"; then
cat > $TMPC << EOF
#include <ucontext.h>
-int main(void) { makecontext(0, 0, 0); }
+int main(void) { makecontext(0, 0, 0); return 0; }
EOF
if compile_prog "" "" ; then
ucontext_coroutine=yes
open_by_hande_at=no
cat > $TMPC << EOF
#include <fcntl.h>
-int main(void) { struct file_handle fh; open_by_handle_at(0, &fh, 0); }
+int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
EOF
if compile_prog "" "" ; then
open_by_handle_at=yes
cat > $TMPC << EOF
#include <linux/magic.h>
int main(void) {
+ return 0;
}
EOF
if compile_prog "" "" ; then