]>
git.proxmox.com Git - ceph.git/blob - ceph/src/liburing/configure
3 # set temporary file name
4 if test ! -z "$TMPDIR" ; then
6 elif test ! -z "$TEMPDIR" ; then
16 optarg
=$
(expr "x$opt" : 'x[^=]*=\(.*\)')
18 --help|
-h) show_help
=yes
20 --prefix=*) prefix
="$optarg"
22 --includedir=*) includedir
="$optarg"
24 --libdir=*) libdir
="$optarg"
26 --libdevdir=*) libdevdir
="$optarg"
28 --mandir=*) mandir
="$optarg"
30 --datadir=*) datadir
="$optarg"
34 --cxx=*) cxx
="$optarg"
37 echo "ERROR: unknown option $opt"
38 echo "Try '$0 --help' for more information"
44 if test -z "$prefix"; then
47 if test -z "$includedir"; then
48 includedir
="$prefix/include"
50 if test -z "$libdir"; then
53 if test -z "$libdevdir"; then
54 libdevdir
="$prefix/lib"
56 if test -z "$mandir"; then
59 if test -z "$datadir"; then
60 datadir
="$prefix/share"
63 if test x
"$libdir" = x
"$libdevdir"; then
66 relativelibdir
="$libdir/"
69 if test "$show_help" = "yes"; then
72 Usage: configure [options]
73 Options: [defaults in brackets after descriptions]
74 --help print this message
75 --prefix=PATH install in PATH [$prefix]
76 --includedir=PATH install headers in PATH [$includedir]
77 --libdir=PATH install runtime libraries in PATH [$libdir]
78 --libdevdir=PATH install development libraries in PATH [$libdevdir]
79 --mandir=PATH install man pages in PATH [$mandir]
80 --datadir=PATH install shared data in PATH [$datadir]
85 TMPC
="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.c"
86 TMPC2
="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}-2.c"
87 TMPO
="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.o"
88 TMPE
="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.exe"
90 # NB: do not call "exit" in the trap handler; this is buggy with some shells;
91 # see <1285349658-3122-1-git-send-email-loic.minier@linaro.org>
92 trap "rm -f $TMPC $TMPC2 $TMPO $TMPE" EXIT INT QUIT TERM
96 config_host_mak
="config-host.mak"
97 config_host_h
="config-host.h"
99 rm -rf $config_host_mak
100 rm -rf $config_host_h
104 echo "Configure failed, check config.log and/or the above output"
105 rm -rf $config_host_mak
106 rm -rf $config_host_h
110 # Print result for each configuration test
112 printf "%-30s%s\n" "$1" "$2"
116 CFLAGS
="-D_GNU_SOURCE -include config-host.h"
119 # Print configure header at the top of $config_host_h
120 echo "/*" > $config_host_h
121 echo " * Automatically generated by configure - do not modify" >> $config_host_h
122 printf " * Configured with:" >> $config_host_h
123 printf " * '%s'" "$0" "$@" >> $config_host_h
124 echo "" >> $config_host_h
125 echo " */" >> $config_host_h
127 echo "# Automatically generated by configure - do not modify" > $config_host_mak
128 printf "# Configured with:" >> $config_host_mak
129 printf " '%s'" "$0" "$@" >> $config_host_mak
130 echo >> $config_host_mak
133 # Run the compiler, capturing its output to the log.
134 echo $cxx "$@" >> config.log
135 $cxx "$@" >> config.log
2>&1 ||
return $?
140 # Run the compiler, capturing its output to the log.
141 echo $cc "$@" >> config.log
142 $cc "$@" >> config.log
2>&1 ||
return $?
143 # Test passed. If this is an --enable-werror build, rerun
144 # the test with -Werror and bail out if it fails. This
145 # makes warning-generating-errors in configure test code
146 # obvious to developers.
147 if test "$werror" != "yes"; then
150 # Don't bother rerunning the compile if we were already using -Werror
156 echo $cc -Werror "$@" >> config.log
157 $cc -Werror "$@" >> config.log
2>&1 && return $?
158 echo "ERROR: configure test passed without -Werror but failed with -Werror."
159 echo "This is probably a bug in the configure script. The failing command"
160 echo "will be at the bottom of config.log."
161 fatal
"You can run configure with --disable-werror to bypass this check."
166 local_ldflags
="$2 $LIBS"
167 echo "Compiling test case $3" >> config.log
168 do_cc
$CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
173 local_ldflags
="$2 $LIBS"
174 echo "Compiling test case $3" >> config.log
175 do_cxx
$CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
179 type "$1" >/dev
/null
2>&1
183 echo "$1=$2" >> $config_host_mak
188 echo "#define $1" >> $config_host_h
191 print_and_output_mak
() {
192 print_config
"$1" "$2"
195 print_and_output_mak
"prefix" "$prefix"
196 print_and_output_mak
"includedir" "$includedir"
197 print_and_output_mak
"libdir" "$libdir"
198 print_and_output_mak
"libdevdir" "$libdevdir"
199 print_and_output_mak
"relativelibdir" "$relativelibdir"
200 print_and_output_mak
"mandir" "$mandir"
201 print_and_output_mak
"datadir" "$datadir"
203 ##########################################
204 # check for __kernel_rwf_t
207 #include <linux/fs.h>
208 int main(int argc, char **argv)
215 if compile_prog
"" "" "__kernel_rwf_t"; then
218 print_config
"__kernel_rwf_t" "$__kernel_rwf_t"
220 ##########################################
221 # check for __kernel_timespec
222 __kernel_timespec
="no"
224 #include <linux/time.h>
225 #include <linux/time_types.h>
226 int main(int argc, char **argv)
228 struct __kernel_timespec ts;
234 if compile_prog
"" "" "__kernel_timespec"; then
235 __kernel_timespec
="yes"
237 print_config
"__kernel_timespec" "$__kernel_timespec"
239 ##########################################
243 #include <sys/types.h>
244 #include <sys/stat.h>
247 int main(int argc, char **argv)
256 if compile_prog
"" "" "open_how"; then
259 print_config
"open_how" "$open_how"
261 ##########################################
265 #include <sys/types.h>
266 #include <sys/stat.h>
270 #include <linux/stat.h>
271 int main(int argc, char **argv)
275 return memset(&x, 0, sizeof(x)) != NULL;
278 if compile_prog
"" "" "statx"; then
281 print_config
"statx" "$statx"
283 ##########################################
288 int main(int argc, char **argv)
294 if compile_prog_cxx
"" "" "C++"; then
297 print_config
"C++" "$has_cxx"
299 #############################################################################
301 if test "$__kernel_rwf_t" = "yes"; then
302 output_sym
"CONFIG_HAVE_KERNEL_RWF_T"
304 if test "$__kernel_timespec" = "yes"; then
305 output_sym
"CONFIG_HAVE_KERNEL_TIMESPEC"
307 if test "$open_how" = "yes"; then
308 output_sym
"CONFIG_HAVE_OPEN_HOW"
310 if test "$statx" = "yes"; then
311 output_sym
"CONFIG_HAVE_STATX"
313 if test "$has_cxx" = "yes"; then
314 output_sym
"CONFIG_HAVE_CXX"
317 echo "CC=$cc" >> $config_host_mak
318 print_config
"CC" "$cc"
319 echo "CXX=$cxx" >> $config_host_mak
320 print_config
"CXX" "$cxx"
323 compat_h
="src/include/liburing/compat.h"
324 cat > $compat_h << EOF
325 /* SPDX-License-Identifier: MIT */
326 #ifndef LIBURING_COMPAT_H
327 #define LIBURING_COMPAT_H
331 if test "$__kernel_rwf_t" != "yes"; then
332 cat >> $compat_h << EOF
333 typedef int __kernel_rwf_t;
337 if test "$__kernel_timespec" != "yes"; then
338 cat >> $compat_h << EOF
341 struct __kernel_timespec {
348 cat >> $compat_h << EOF
349 #include <linux/time_types.h>
353 if test "$open_how" != "yes"; then
354 cat >> $compat_h << EOF
355 #include <inttypes.h>
366 cat >> $compat_h << EOF