Add configure script
Some older installs don't have __kernel_rwf_t in linux/fs.h, so add a check for that. Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
14
Makefile
14
Makefile
@@ -14,10 +14,24 @@ all:
|
|||||||
@$(MAKE) -C src
|
@$(MAKE) -C src
|
||||||
@$(MAKE) -C test
|
@$(MAKE) -C test
|
||||||
|
|
||||||
|
config-host.mak: configure
|
||||||
|
@if [ ! -e "$@" ]; then \
|
||||||
|
echo "Running configure ..."; \
|
||||||
|
./configure; \
|
||||||
|
else \
|
||||||
|
echo "$@ is out-of-date, running configure"; \
|
||||||
|
sed -n "/.*Configured with/s/[^:]*: //p" "$@" | sh; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
ifneq ($(MAKECMDGOALS),clean)
|
||||||
|
include config-host.mak
|
||||||
|
endif
|
||||||
|
|
||||||
install:
|
install:
|
||||||
@$(MAKE) -C src install prefix=$(DESTDIR)$(prefix) includedir=$(DESTDIR)$(includedir) libdir=$(DESTDIR)$(libdir)
|
@$(MAKE) -C src install prefix=$(DESTDIR)$(prefix) includedir=$(DESTDIR)$(includedir) libdir=$(DESTDIR)$(libdir)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
@rm -f config-host.mak config-host.h
|
||||||
@$(MAKE) -C src clean
|
@$(MAKE) -C src clean
|
||||||
@$(MAKE) -C test clean
|
@$(MAKE) -C test clean
|
||||||
|
|
||||||
|
|||||||
127
configure
vendored
Executable file
127
configure
vendored
Executable file
@@ -0,0 +1,127 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# set temporary file name
|
||||||
|
if test ! -z "$TMPDIR" ; then
|
||||||
|
TMPDIR1="${TMPDIR}"
|
||||||
|
elif test ! -z "$TEMPDIR" ; then
|
||||||
|
TMPDIR1="${TEMPDIR}"
|
||||||
|
else
|
||||||
|
TMPDIR1="/tmp"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cc=gcc
|
||||||
|
|
||||||
|
TMPC="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.c"
|
||||||
|
TMPC2="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}-2.c"
|
||||||
|
TMPO="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.o"
|
||||||
|
TMPE="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.exe"
|
||||||
|
|
||||||
|
# NB: do not call "exit" in the trap handler; this is buggy with some shells;
|
||||||
|
# see <1285349658-3122-1-git-send-email-loic.minier@linaro.org>
|
||||||
|
trap "rm -f $TMPC $TMPC2 $TMPO $TMPE" EXIT INT QUIT TERM
|
||||||
|
|
||||||
|
rm -rf config.log
|
||||||
|
|
||||||
|
config_host_mak="config-host.mak"
|
||||||
|
config_host_h="config-host.h"
|
||||||
|
|
||||||
|
rm -rf $config_host_mak
|
||||||
|
rm -rf $config_host_h
|
||||||
|
|
||||||
|
fatal() {
|
||||||
|
echo $@
|
||||||
|
echo "Configure failed, check config.log and/or the above output"
|
||||||
|
rm -rf $config_host_mak
|
||||||
|
rm -rf $config_host_h
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Print result for each configuration test
|
||||||
|
print_config() {
|
||||||
|
printf "%-30s%s\n" "$1" "$2"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Default CFLAGS
|
||||||
|
CFLAGS="-D_GNU_SOURCE -include config-host.h"
|
||||||
|
BUILD_CFLAGS=""
|
||||||
|
|
||||||
|
# Print configure header at the top of $config_host_h
|
||||||
|
echo "/*" > $config_host_h
|
||||||
|
echo " * Automatically generated by configure - do not modify" >> $config_host_h
|
||||||
|
printf " * Configured with:" >> $config_host_h
|
||||||
|
printf " * '%s'" "$0" "$@" >> $config_host_h
|
||||||
|
echo "" >> $config_host_h
|
||||||
|
echo " */" >> $config_host_h
|
||||||
|
|
||||||
|
echo "# Automatically generated by configure - do not modify" > $config_host_mak
|
||||||
|
printf "# Configured with:" >> $config_host_mak
|
||||||
|
printf " '%s'" "$0" "$@" >> $config_host_mak
|
||||||
|
echo >> $config_host_mak
|
||||||
|
|
||||||
|
do_cc() {
|
||||||
|
# Run the compiler, capturing its output to the log.
|
||||||
|
echo $cc "$@" >> config.log
|
||||||
|
$cc "$@" >> config.log 2>&1 || return $?
|
||||||
|
# Test passed. If this is an --enable-werror build, rerun
|
||||||
|
# the test with -Werror and bail out if it fails. This
|
||||||
|
# makes warning-generating-errors in configure test code
|
||||||
|
# obvious to developers.
|
||||||
|
if test "$werror" != "yes"; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
# Don't bother rerunning the compile if we were already using -Werror
|
||||||
|
case "$*" in
|
||||||
|
*-Werror*)
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
echo $cc -Werror "$@" >> config.log
|
||||||
|
$cc -Werror "$@" >> config.log 2>&1 && return $?
|
||||||
|
echo "ERROR: configure test passed without -Werror but failed with -Werror."
|
||||||
|
echo "This is probably a bug in the configure script. The failing command"
|
||||||
|
echo "will be at the bottom of config.log."
|
||||||
|
fatal "You can run configure with --disable-werror to bypass this check."
|
||||||
|
}
|
||||||
|
|
||||||
|
compile_object() {
|
||||||
|
do_cc $CFLAGS -c -o $TMPO $TMPC
|
||||||
|
}
|
||||||
|
|
||||||
|
compile_prog() {
|
||||||
|
local_cflags="$1"
|
||||||
|
local_ldflags="$2 $LIBS"
|
||||||
|
echo "Compiling test case $3" >> config.log
|
||||||
|
do_cc $CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
|
||||||
|
}
|
||||||
|
|
||||||
|
has() {
|
||||||
|
type "$1" >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
output_sym() {
|
||||||
|
echo "$1=y" >> $config_host_mak
|
||||||
|
echo "#define $1" >> $config_host_h
|
||||||
|
}
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
# check for __kernel_rwf_t
|
||||||
|
__kernel_rwf_t="no"
|
||||||
|
cat > $TMPC << EOF
|
||||||
|
#include <linux/fs.h>
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
__kernel_rwf_t x;
|
||||||
|
x = 0;
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
if compile_prog "" "" "__kernel_rwf_t"; then
|
||||||
|
__kernel_rwf_t="yes"
|
||||||
|
fi
|
||||||
|
print_config "__kernel_rwf_t" "$__kernel_rwf_t"
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
|
||||||
|
if test "$__kernel_rwf_t" = "yes"; then
|
||||||
|
output_sym "CONFIG_HAVE_KERNEL_RWF_T"
|
||||||
|
fi
|
||||||
8
src/compat.h
Normal file
8
src/compat.h
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#ifndef LIBURING_COMPAT_H
|
||||||
|
#define LIBURING_COMPAT_H
|
||||||
|
|
||||||
|
#if !defined(CONFIG_HAVE_KERNEL_RWF_T)
|
||||||
|
typedef int __kernel_rwf_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "compat.h"
|
||||||
#include "io_uring.h"
|
#include "io_uring.h"
|
||||||
#include "liburing.h"
|
#include "liburing.h"
|
||||||
#include "barrier.h"
|
#include "barrier.h"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#define LIB_URING_H
|
#define LIB_URING_H
|
||||||
|
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
|
#include "compat.h"
|
||||||
#include "io_uring.h"
|
#include "io_uring.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
|
#include "compat.h"
|
||||||
#include "io_uring.h"
|
#include "io_uring.h"
|
||||||
|
|
||||||
#if defined(__x86_64)
|
#if defined(__x86_64)
|
||||||
|
|||||||
Reference in New Issue
Block a user