Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
| 3 | # Fio configure script. Heavily influenced by the manual qemu configure |
| 4 | # script. Sad this this is easier than autoconf and enemies. |
| 5 | # |
| 6 | |
| 7 | # set temporary file name |
| 8 | if test ! -z "$TMPDIR" ; then |
| 9 | TMPDIR1="${TMPDIR}" |
| 10 | elif test ! -z "$TEMPDIR" ; then |
| 11 | TMPDIR1="${TEMPDIR}" |
| 12 | else |
| 13 | TMPDIR1="/tmp" |
| 14 | fi |
| 15 | |
| 16 | TMPC="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.c" |
| 17 | TMPO="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.o" |
| 18 | TMPE="${TMPDIR1}/fio-conf-${RANDOM}-$$-${RANDOM}.exe" |
| 19 | |
| 20 | # NB: do not call "exit" in the trap handler; this is buggy with some shells; |
| 21 | # see <1285349658-3122-1-git-send-email-loic.minier@linaro.org> |
| 22 | trap "rm -f $TMPC $TMPO $TMPE" EXIT INT QUIT TERM |
| 23 | |
| 24 | rm -rf config.log |
| 25 | |
| 26 | config_host_mak="config-host.mak" |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 27 | config_host_h="config-host.h" |
| 28 | |
| 29 | rm -rf $config_host_mak |
| 30 | rm -rf $config_host_h |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 31 | |
Jens Axboe | d7145a7 | 2013-02-11 13:21:54 +0100 | [diff] [blame] | 32 | fatal() { |
| 33 | echo $@ |
| 34 | echo "Configure failed, check config.log and/or the above output" |
| 35 | rm -rf $config_host_mak |
| 36 | rm -rf $config_host_h |
| 37 | exit 1 |
| 38 | } |
| 39 | |
Jens Axboe | 44404c5 | 2013-01-24 14:20:09 -0700 | [diff] [blame] | 40 | # Default CFLAGS |
Jens Axboe | af4862b | 2013-03-29 08:55:32 -0600 | [diff] [blame^] | 41 | CFLAGS="-D_GNU_SOURCE -include config-host.h" |
| 42 | BUILD_CFLAGS="" |
Jens Axboe | 44404c5 | 2013-01-24 14:20:09 -0700 | [diff] [blame] | 43 | |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 44 | # Print a helpful header at the top of config.log |
| 45 | echo "# FIO configure log $(date)" >> config.log |
| 46 | printf "# Configured with:" >> config.log |
| 47 | printf " '%s'" "$0" "$@" >> config.log |
| 48 | echo >> config.log |
| 49 | echo "#" >> config.log |
| 50 | |
Jens Axboe | 7560fe7 | 2013-01-25 08:52:28 -0700 | [diff] [blame] | 51 | # Print configure header at the top of $config_host_h |
| 52 | echo "/*" > $config_host_h |
| 53 | echo " * Automatically generated by configure - do not modify" >> $config_host_h |
| 54 | printf " * Configured with:" >> $config_host_h |
| 55 | printf " * '%s'" "$0" "$@" >> $config_host_h |
| 56 | echo "" >> $config_host_h |
| 57 | echo " */" >> $config_host_h |
| 58 | |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 59 | do_cc() { |
| 60 | # Run the compiler, capturing its output to the log. |
| 61 | echo $cc "$@" >> config.log |
| 62 | $cc "$@" >> config.log 2>&1 || return $? |
| 63 | # Test passed. If this is an --enable-werror build, rerun |
| 64 | # the test with -Werror and bail out if it fails. This |
| 65 | # makes warning-generating-errors in configure test code |
| 66 | # obvious to developers. |
| 67 | if test "$werror" != "yes"; then |
| 68 | return 0 |
| 69 | fi |
| 70 | # Don't bother rerunning the compile if we were already using -Werror |
| 71 | case "$*" in |
| 72 | *-Werror*) |
| 73 | return 0 |
| 74 | ;; |
| 75 | esac |
| 76 | echo $cc -Werror "$@" >> config.log |
| 77 | $cc -Werror "$@" >> config.log 2>&1 && return $? |
| 78 | echo "ERROR: configure test passed without -Werror but failed with -Werror." |
| 79 | echo "This is probably a bug in the configure script. The failing command" |
| 80 | echo "will be at the bottom of config.log." |
Jens Axboe | d7145a7 | 2013-02-11 13:21:54 +0100 | [diff] [blame] | 81 | fatal "You can run configure with --disable-werror to bypass this check." |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 82 | } |
| 83 | |
| 84 | compile_object() { |
| 85 | do_cc $CFLAGS -c -o $TMPO $TMPC |
| 86 | } |
| 87 | |
| 88 | compile_prog() { |
| 89 | local_cflags="$1" |
Jens Axboe | adaa46d | 2013-02-28 22:10:22 +0100 | [diff] [blame] | 90 | local_ldflags="$2 $LIBS" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 91 | echo "Compiling test case $3" >> config.log |
| 92 | do_cc $CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags |
| 93 | } |
| 94 | |
| 95 | feature_not_found() { |
| 96 | feature=$1 |
| 97 | |
| 98 | echo "ERROR" |
| 99 | echo "ERROR: User requested feature $feature" |
| 100 | echo "ERROR: configure was not able to find it" |
Jens Axboe | d7145a7 | 2013-02-11 13:21:54 +0100 | [diff] [blame] | 101 | fatal "ERROR" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 102 | } |
| 103 | |
| 104 | has() { |
| 105 | type "$1" >/dev/null 2>&1 |
| 106 | } |
| 107 | |
| 108 | check_define() { |
| 109 | cat > $TMPC <<EOF |
| 110 | #if !defined($1) |
| 111 | #error $1 not defined |
| 112 | #endif |
| 113 | int main(void) |
| 114 | { |
| 115 | return 0; |
| 116 | } |
| 117 | EOF |
| 118 | compile_object |
| 119 | } |
| 120 | |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 121 | output_sym() { |
| 122 | echo "$1=y" >> $config_host_mak |
| 123 | echo "#define $1" >> $config_host_h |
| 124 | } |
| 125 | |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 126 | targetos="" |
| 127 | cpu="" |
| 128 | |
Aaron Carroll | 53cd4ee | 2013-03-14 16:57:38 +1100 | [diff] [blame] | 129 | cross_prefix=${cross_prefix-${CROSS_COMPILE}} |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 130 | cc="${CC-${cross_prefix}gcc}" |
| 131 | |
Jens Axboe | 899fab3 | 2013-01-29 10:06:30 +0100 | [diff] [blame] | 132 | show_help="no" |
| 133 | exit_val=0 |
| 134 | |
Jens Axboe | cb1125b | 2013-01-23 13:47:54 -0700 | [diff] [blame] | 135 | # parse options |
| 136 | for opt do |
| 137 | optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` |
| 138 | case "$opt" in |
Jens Axboe | 8b156d8 | 2013-02-10 15:48:34 +0100 | [diff] [blame] | 139 | --cpu=*) cpu="$optarg" |
| 140 | ;; |
Jens Axboe | cb1125b | 2013-01-23 13:47:54 -0700 | [diff] [blame] | 141 | --cc=*) CC="$optarg" |
| 142 | ;; |
Jens Axboe | 208e4c8 | 2013-01-29 09:26:07 +0100 | [diff] [blame] | 143 | --extra-cflags=*) CFLAGS="$CFLAGS $optarg" |
| 144 | ;; |
Huadong Liu | 7409711 | 2013-02-05 08:43:14 +0100 | [diff] [blame] | 145 | --build-32bit-win=*) build_32bit_win="$optarg" |
| 146 | ;; |
Jens Axboe | 899fab3 | 2013-01-29 10:06:30 +0100 | [diff] [blame] | 147 | --help) |
| 148 | show_help="yes" |
| 149 | ;; |
Jens Axboe | cb1125b | 2013-01-23 13:47:54 -0700 | [diff] [blame] | 150 | *) |
| 151 | echo "Bad option $opt" |
Jens Axboe | 899fab3 | 2013-01-29 10:06:30 +0100 | [diff] [blame] | 152 | show_help="yes" |
| 153 | exit_val=1 |
Jens Axboe | cb1125b | 2013-01-23 13:47:54 -0700 | [diff] [blame] | 154 | esac |
| 155 | done |
| 156 | |
Jens Axboe | 899fab3 | 2013-01-29 10:06:30 +0100 | [diff] [blame] | 157 | if test "$show_help" = "yes" ; then |
Jens Axboe | 8b156d8 | 2013-02-10 15:48:34 +0100 | [diff] [blame] | 158 | echo "--cpu= Specify target CPU if auto-detect fails" |
Jens Axboe | 899fab3 | 2013-01-29 10:06:30 +0100 | [diff] [blame] | 159 | echo "--cc= Specify compiler to use" |
| 160 | echo "--extra-cflags= Specify extra CFLAGS to pass to compiler" |
Bruce Cran | 723d7b3 | 2013-02-05 17:44:19 +0000 | [diff] [blame] | 161 | echo "--build-32bit-win= Specify yes for a 32-bit build on Windows" |
Jens Axboe | 899fab3 | 2013-01-29 10:06:30 +0100 | [diff] [blame] | 162 | exit $exit_val |
| 163 | fi |
| 164 | |
Aaron Carroll | 6d0e9f8 | 2013-02-12 09:58:14 +0100 | [diff] [blame] | 165 | if check_define __ANDROID__ ; then |
| 166 | targetos="Android" |
| 167 | elif check_define __linux__ ; then |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 168 | targetos="Linux" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 169 | elif check_define __OpenBSD__ ; then |
| 170 | targetos='OpenBSD' |
| 171 | elif check_define __sun__ ; then |
| 172 | targetos='SunOS' |
| 173 | else |
| 174 | targetos=`uname -s` |
| 175 | fi |
| 176 | |
Aaron Carroll | 53cd4ee | 2013-03-14 16:57:38 +1100 | [diff] [blame] | 177 | echo "# Automatically generated by configure - do not modify" > $config_host_mak |
| 178 | printf "# Configured with:" >> $config_host_mak |
| 179 | printf " '%s'" "$0" "$@" >> $config_host_mak |
| 180 | echo >> $config_host_mak |
| 181 | echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak |
| 182 | |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 183 | # Some host OSes need non-standard checks for which CPU to use. |
| 184 | # Note that these checks are broken for cross-compilation: if you're |
| 185 | # cross-compiling to one of these OSes then you'll need to specify |
| 186 | # the correct CPU with the --cpu option. |
| 187 | case $targetos in |
| 188 | Darwin) |
| 189 | # on Leopard most of the system is 32-bit, so we have to ask the kernel if |
| 190 | # we can run 64-bit userspace code. |
| 191 | # If the user didn't specify a CPU explicitly and the kernel says this is |
| 192 | # 64 bit hw, then assume x86_64. Otherwise fall through to the usual |
| 193 | # detection code. |
| 194 | if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then |
| 195 | cpu="x86_64" |
| 196 | fi |
| 197 | ;; |
| 198 | SunOS) |
| 199 | # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo |
| 200 | if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then |
| 201 | cpu="x86_64" |
| 202 | fi |
Jens Axboe | adaa46d | 2013-02-28 22:10:22 +0100 | [diff] [blame] | 203 | LIBS="-lnsl -lsocket" |
Jens Axboe | cfd94f7 | 2013-01-23 16:23:48 -0700 | [diff] [blame] | 204 | ;; |
| 205 | CYGWIN*) |
| 206 | echo "Forcing known good options on Windows" |
Jens Axboe | 4578d01 | 2013-01-23 16:26:12 -0700 | [diff] [blame] | 207 | if test -z "$CC" ; then |
Huadong Liu | 7409711 | 2013-02-05 08:43:14 +0100 | [diff] [blame] | 208 | if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then |
| 209 | CC="i686-w64-mingw32-gcc" |
| 210 | else |
| 211 | CC="x86_64-w64-mingw32-gcc" |
| 212 | fi |
Jens Axboe | 4578d01 | 2013-01-23 16:26:12 -0700 | [diff] [blame] | 213 | fi |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 214 | output_sym "CONFIG_LITTLE_ENDIAN" |
Huadong Liu | 7409711 | 2013-02-05 08:43:14 +0100 | [diff] [blame] | 215 | if test ! -z "$build_32bit_win" && test "$build_32bit_win" = "yes"; then |
| 216 | output_sym "CONFIG_32BIT" |
| 217 | else |
| 218 | output_sym "CONFIG_64BIT_LLP64" |
| 219 | fi |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 220 | output_sym "CONFIG_FADVISE" |
| 221 | output_sym "CONFIG_SOCKLEN_T" |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 222 | output_sym "CONFIG_FADVISE" |
| 223 | output_sym "CONFIG_SFAA" |
| 224 | output_sym "CONFIG_RUSAGE_THREAD" |
| 225 | output_sym "CONFIG_WINDOWSAIO" |
| 226 | output_sym "CONFIG_FDATASYNC" |
Bruce Cran | 59308a6 | 2013-02-02 20:59:31 +0000 | [diff] [blame] | 227 | output_sym "CONFIG_CLOCK_MONOTONIC" |
Bruce Cran | dc0518c | 2013-01-28 16:07:15 +0000 | [diff] [blame] | 228 | output_sym "CONFIG_GETTIMEOFDAY" |
| 229 | output_sym "CONFIG_CLOCK_GETTIME" |
Jens Axboe | 7e09a9f | 2013-01-30 13:58:58 +0100 | [diff] [blame] | 230 | output_sym "CONFIG_SCHED_IDLE" |
Jens Axboe | 1eafa37 | 2013-01-31 10:19:51 +0100 | [diff] [blame] | 231 | output_sym "CONFIG_TCP_NODELAY" |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 232 | echo "CC=$CC" >> $config_host_mak |
Jens Axboe | af4862b | 2013-03-29 08:55:32 -0600 | [diff] [blame^] | 233 | echo "BUILD_CFLAGS=$CFLAGS -include config-host.h -D_GNU_SOURCE" >> $config_host_mak |
Jens Axboe | cfd94f7 | 2013-01-23 16:23:48 -0700 | [diff] [blame] | 234 | exit 0 |
Aaron Carroll | 6d0e9f8 | 2013-02-12 09:58:14 +0100 | [diff] [blame] | 235 | ;; |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 236 | esac |
| 237 | |
| 238 | if test ! -z "$cpu" ; then |
| 239 | # command line argument |
| 240 | : |
| 241 | elif check_define __i386__ ; then |
| 242 | cpu="i386" |
| 243 | elif check_define __x86_64__ ; then |
| 244 | cpu="x86_64" |
| 245 | elif check_define __sparc__ ; then |
| 246 | if check_define __arch64__ ; then |
| 247 | cpu="sparc64" |
| 248 | else |
| 249 | cpu="sparc" |
| 250 | fi |
| 251 | elif check_define _ARCH_PPC ; then |
| 252 | if check_define _ARCH_PPC64 ; then |
| 253 | cpu="ppc64" |
| 254 | else |
| 255 | cpu="ppc" |
| 256 | fi |
| 257 | elif check_define __mips__ ; then |
| 258 | cpu="mips" |
| 259 | elif check_define __ia64__ ; then |
| 260 | cpu="ia64" |
| 261 | elif check_define __s390__ ; then |
| 262 | if check_define __s390x__ ; then |
| 263 | cpu="s390x" |
| 264 | else |
| 265 | cpu="s390" |
| 266 | fi |
| 267 | elif check_define __arm__ ; then |
| 268 | cpu="arm" |
| 269 | elif check_define __hppa__ ; then |
| 270 | cpu="hppa" |
| 271 | else |
| 272 | cpu=`uname -m` |
| 273 | fi |
| 274 | |
| 275 | # Normalise host CPU name and set ARCH. |
| 276 | case "$cpu" in |
| 277 | ia64|ppc|ppc64|s390|s390x|sparc64) |
| 278 | cpu="$cpu" |
| 279 | ;; |
| 280 | i386|i486|i586|i686|i86pc|BePC) |
| 281 | cpu="i386" |
| 282 | ;; |
| 283 | x86_64|amd64) |
| 284 | cpu="x86_64" |
| 285 | ;; |
| 286 | armv*b|armv*l|arm) |
| 287 | cpu="arm" |
| 288 | ;; |
| 289 | hppa|parisc|parisc64) |
| 290 | cpu="hppa" |
| 291 | ;; |
| 292 | mips*) |
| 293 | cpu="mips" |
| 294 | ;; |
| 295 | sparc|sun4[cdmuv]) |
| 296 | cpu="sparc" |
| 297 | ;; |
| 298 | *) |
Jens Axboe | 8b156d8 | 2013-02-10 15:48:34 +0100 | [diff] [blame] | 299 | echo "Unknown CPU" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 300 | ;; |
| 301 | esac |
| 302 | |
Jens Axboe | dcbbf5b | 2013-01-25 14:35:27 -0700 | [diff] [blame] | 303 | if test -z "$CC" ; then |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 304 | if test "$targetos" = "FreeBSD"; then |
| 305 | if has clang; then |
| 306 | CC=clang |
| 307 | else |
| 308 | CC=gcc |
| 309 | fi |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 310 | fi |
| 311 | fi |
| 312 | |
| 313 | cc="${CC-${cross_prefix}gcc}" |
| 314 | |
Jens Axboe | 0dcebdf | 2013-01-23 15:42:16 -0700 | [diff] [blame] | 315 | ########################################## |
Aaron Carroll | 1a17cfd | 2013-03-14 16:57:40 +1100 | [diff] [blame] | 316 | # check cross compile |
| 317 | |
| 318 | cross_compile="no" |
| 319 | cat > $TMPC <<EOF |
| 320 | int main(void) |
| 321 | { |
| 322 | return 0; |
| 323 | } |
| 324 | EOF |
| 325 | if compile_prog "" "" "cross"; then |
| 326 | $TMPE 2>/dev/null || cross_compile="yes" |
| 327 | else |
| 328 | fatal "compile test failed" |
| 329 | fi |
| 330 | |
| 331 | ########################################## |
Jens Axboe | 0dcebdf | 2013-01-23 15:42:16 -0700 | [diff] [blame] | 332 | # check endianness |
| 333 | bigendian="no" |
Aaron Carroll | 1a17cfd | 2013-03-14 16:57:40 +1100 | [diff] [blame] | 334 | if test "$cross_compile" = "no" ; then |
| 335 | cat > $TMPC <<EOF |
Jens Axboe | 0dcebdf | 2013-01-23 15:42:16 -0700 | [diff] [blame] | 336 | #include <inttypes.h> |
| 337 | int main(void) |
| 338 | { |
| 339 | volatile uint32_t i=0x01234567; |
| 340 | return (*((uint8_t*)(&i))) == 0x67; |
| 341 | } |
| 342 | EOF |
Aaron Carroll | 1a17cfd | 2013-03-14 16:57:40 +1100 | [diff] [blame] | 343 | if compile_prog "" "" "endian"; then |
| 344 | $TMPE && bigendian="yes" |
| 345 | fi |
| 346 | else |
| 347 | # If we're cross compiling, try our best to work it out and rely on the |
| 348 | # run-time check to fail if we get it wrong. |
| 349 | cat > $TMPC <<EOF |
| 350 | #include <endian.h> |
| 351 | int main(void) |
| 352 | { |
| 353 | #if __BYTE_ORDER != __BIG_ENDIAN |
| 354 | # error "Unknown endianness" |
| 355 | #endif |
| 356 | } |
| 357 | EOF |
| 358 | compile_prog "" "" "endian" && bigendian="yes" |
| 359 | check_define "__ARMEB__" && bigendian="yes" |
| 360 | check_define "__MIPSEB__" && bigendian="yes" |
Jens Axboe | 0dcebdf | 2013-01-23 15:42:16 -0700 | [diff] [blame] | 361 | fi |
| 362 | |
| 363 | |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 364 | echo "Operating system $targetos" |
| 365 | echo "CPU $cpu" |
Jens Axboe | 0dcebdf | 2013-01-23 15:42:16 -0700 | [diff] [blame] | 366 | echo "Big endian $bigendian" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 367 | echo "Compiler $cc" |
Aaron Carroll | 1a17cfd | 2013-03-14 16:57:40 +1100 | [diff] [blame] | 368 | echo "Cross compile $cross_compile" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 369 | echo |
| 370 | |
| 371 | ########################################## |
| 372 | # check for wordsize |
| 373 | wordsize="0" |
| 374 | cat > $TMPC <<EOF |
Aaron Carroll | 142429e | 2013-03-14 16:57:39 +1100 | [diff] [blame] | 375 | #include <limits.h> |
| 376 | #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 377 | int main(void) |
| 378 | { |
Aaron Carroll | 142429e | 2013-03-14 16:57:39 +1100 | [diff] [blame] | 379 | BUILD_BUG_ON(sizeof(long)*CHAR_BIT != WORDSIZE); |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 380 | return 0; |
| 381 | } |
| 382 | EOF |
Aaron Carroll | 142429e | 2013-03-14 16:57:39 +1100 | [diff] [blame] | 383 | if compile_prog "-DWORDSIZE=32" "" "wordsize"; then |
| 384 | wordsize="32" |
| 385 | elif compile_prog "-DWORDSIZE=64" "" "wordsize"; then |
| 386 | wordsize="64" |
| 387 | else |
| 388 | fatal "Unknown wordsize" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 389 | fi |
| 390 | echo "Wordsize $wordsize" |
| 391 | |
| 392 | ########################################## |
| 393 | # linux-aio probe |
| 394 | libaio="no" |
| 395 | cat > $TMPC <<EOF |
| 396 | #include <libaio.h> |
| 397 | #include <stddef.h> |
| 398 | int main(void) |
| 399 | { |
| 400 | io_setup(0, NULL); |
| 401 | return 0; |
| 402 | } |
| 403 | EOF |
| 404 | if compile_prog "" "-laio" "libaio" ; then |
| 405 | libaio=yes |
| 406 | LIBS="-laio $LIBS" |
| 407 | else |
| 408 | if test "$libaio" = "yes" ; then |
| 409 | feature_not_found "linux AIO" |
| 410 | fi |
| 411 | libaio=no |
| 412 | fi |
| 413 | echo "Linux AIO support $libaio" |
| 414 | |
| 415 | ########################################## |
| 416 | # posix aio probe |
| 417 | posix_aio="no" |
| 418 | posix_aio_lrt="no" |
| 419 | cat > $TMPC <<EOF |
| 420 | #include <aio.h> |
| 421 | int main(void) |
| 422 | { |
| 423 | struct aiocb cb; |
| 424 | aio_read(&cb); |
| 425 | return 0; |
| 426 | } |
| 427 | EOF |
| 428 | if compile_prog "" "" "posixaio" ; then |
| 429 | posix_aio="yes" |
| 430 | elif compile_prog "" "-lrt" "posixaio"; then |
| 431 | posix_aio="yes" |
| 432 | posix_aio_lrt="yes" |
| 433 | LIBS="-lrt $LIBS" |
| 434 | fi |
| 435 | echo "POSIX AIO support $posix_aio" |
| 436 | echo "POSIX AIO support needs -lrt $posix_aio_lrt" |
| 437 | |
| 438 | ########################################## |
| 439 | # posix aio fsync probe |
| 440 | posix_aio_fsync="no" |
| 441 | if test "$posix_aio" = "yes" ; then |
| 442 | cat > $TMPC <<EOF |
| 443 | #include <fcntl.h> |
| 444 | #include <aio.h> |
| 445 | int main(void) |
| 446 | { |
| 447 | struct aiocb cb; |
| 448 | return aio_fsync(O_SYNC, &cb); |
| 449 | return 0; |
| 450 | } |
| 451 | EOF |
| 452 | if compile_prog "" "$LIBS" "posix_aio_fsync" ; then |
| 453 | posix_aio_fsync=yes |
| 454 | fi |
| 455 | fi |
| 456 | echo "POSIX AIO fsync $posix_aio_fsync" |
| 457 | |
| 458 | ########################################## |
| 459 | # solaris aio probe |
| 460 | solaris_aio="no" |
| 461 | cat > $TMPC <<EOF |
| 462 | #include <sys/types.h> |
| 463 | #include <sys/asynch.h> |
| 464 | #include <unistd.h> |
| 465 | int main(void) |
| 466 | { |
| 467 | aio_result_t res; |
| 468 | return aioread(0, NULL, 0, 0, SEEK_SET, &res); |
| 469 | return 0; |
| 470 | } |
| 471 | EOF |
| 472 | if compile_prog "" "-laio" "solarisaio" ; then |
| 473 | solaris_aio=yes |
| 474 | LIBS="-laio $LIBS" |
| 475 | fi |
| 476 | echo "Solaris AIO support $solaris_aio" |
| 477 | |
| 478 | ########################################## |
| 479 | # __sync_fetch_and_and test |
| 480 | sfaa="no" |
| 481 | cat > $TMPC << EOF |
| 482 | static int sfaa(int *ptr) |
| 483 | { |
Jens Axboe | 9c639a7 | 2013-02-28 22:13:29 +0100 | [diff] [blame] | 484 | return __sync_fetch_and_add(ptr, 0); |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 485 | } |
| 486 | |
| 487 | int main(int argc, char **argv) |
| 488 | { |
| 489 | int val = 42; |
| 490 | sfaa(&val); |
| 491 | return val; |
| 492 | } |
| 493 | EOF |
| 494 | if compile_prog "" "" "__sync_fetch_and_add()" ; then |
| 495 | sfaa="yes" |
| 496 | fi |
Jens Axboe | 9c639a7 | 2013-02-28 22:13:29 +0100 | [diff] [blame] | 497 | echo "__sync_fetch_and_add $sfaa" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 498 | |
| 499 | ########################################## |
| 500 | # libverbs probe |
| 501 | libverbs="no" |
| 502 | cat > $TMPC << EOF |
| 503 | #include <stdio.h> |
| 504 | #include <infiniband/arch.h> |
| 505 | int main(int argc, char **argv) |
| 506 | { |
| 507 | struct ibv_pd *pd = ibv_alloc_pd(NULL); |
| 508 | return 0; |
| 509 | } |
| 510 | EOF |
| 511 | if compile_prog "" "-libverbs" "libverbs" ; then |
| 512 | libverbs="yes" |
| 513 | LIBS="-libverbs $LIBS" |
| 514 | fi |
| 515 | echo "libverbs $libverbs" |
| 516 | |
| 517 | ########################################## |
| 518 | # rdmacm probe |
| 519 | rdmacm="no" |
| 520 | cat > $TMPC << EOF |
| 521 | #include <stdio.h> |
| 522 | #include <rdma/rdma_cma.h> |
| 523 | int main(int argc, char **argv) |
| 524 | { |
| 525 | rdma_destroy_qp(NULL); |
| 526 | return 0; |
| 527 | } |
| 528 | EOF |
| 529 | if compile_prog "" "-lrdmacm" "rdma"; then |
| 530 | rdmacm="yes" |
| 531 | LIBS="-lrdmacm $LIBS" |
| 532 | fi |
| 533 | echo "rdmacm $rdmacm" |
| 534 | |
| 535 | ########################################## |
| 536 | # Linux fallocate probe |
| 537 | linux_fallocate="no" |
| 538 | cat > $TMPC << EOF |
| 539 | #include <stdio.h> |
| 540 | #include <linux/falloc.h> |
| 541 | int main(int argc, char **argv) |
| 542 | { |
| 543 | int r = fallocate(0, FALLOC_FL_KEEP_SIZE, 0, 1024); |
| 544 | return r; |
| 545 | } |
| 546 | EOF |
| 547 | if compile_prog "" "" "linux_fallocate"; then |
| 548 | linux_fallocate="yes" |
| 549 | fi |
| 550 | echo "Linux fallocate $linux_fallocate" |
| 551 | |
| 552 | ########################################## |
| 553 | # POSIX fadvise probe |
| 554 | posix_fadvise="no" |
| 555 | cat > $TMPC << EOF |
| 556 | #include <stdio.h> |
| 557 | #include <fcntl.h> |
| 558 | int main(int argc, char **argv) |
| 559 | { |
| 560 | int r = posix_fadvise(0, 0, 0, POSIX_FADV_NORMAL); |
| 561 | return r; |
| 562 | } |
| 563 | EOF |
| 564 | if compile_prog "" "" "posix_fadvise"; then |
| 565 | posix_fadvise="yes" |
| 566 | fi |
| 567 | echo "POSIX fadvise $posix_fadvise" |
| 568 | |
| 569 | ########################################## |
| 570 | # POSIX fallocate probe |
| 571 | posix_fallocate="no" |
| 572 | cat > $TMPC << EOF |
| 573 | #include <stdio.h> |
| 574 | #include <fcntl.h> |
| 575 | int main(int argc, char **argv) |
| 576 | { |
| 577 | int r = posix_fallocate(0, 0, 1024); |
| 578 | return r; |
| 579 | } |
| 580 | EOF |
| 581 | if compile_prog "" "" "posix_fallocate"; then |
| 582 | posix_fallocate="yes" |
| 583 | fi |
| 584 | echo "POSIX fallocate $posix_fallocate" |
| 585 | |
| 586 | ########################################## |
| 587 | # sched_set/getaffinity 2 or 3 argument test |
| 588 | linux_2arg_affinity="no" |
| 589 | linux_3arg_affinity="no" |
| 590 | cat > $TMPC << EOF |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 591 | #include <sched.h> |
| 592 | int main(int argc, char **argv) |
| 593 | { |
| 594 | cpu_set_t mask; |
| 595 | return sched_setaffinity(0, sizeof(mask), &mask); |
| 596 | } |
| 597 | EOF |
| 598 | if compile_prog "" "" "sched_setaffinity(,,)"; then |
| 599 | linux_3arg_affinity="yes" |
| 600 | else |
| 601 | cat > $TMPC << EOF |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 602 | #include <sched.h> |
| 603 | int main(int argc, char **argv) |
| 604 | { |
| 605 | cpu_set_t mask; |
| 606 | return sched_setaffinity(0, &mask); |
| 607 | } |
| 608 | EOF |
| 609 | if compile_prog "" "" "sched_setaffinity(,)"; then |
| 610 | linux_2arg_affinity="yes" |
| 611 | fi |
| 612 | fi |
| 613 | echo "sched_setaffinity(3 arg) $linux_3arg_affinity" |
| 614 | echo "sched_setaffinity(2 arg) $linux_2arg_affinity" |
| 615 | |
| 616 | ########################################## |
| 617 | # clock_gettime probe |
| 618 | clock_gettime="no" |
| 619 | cat > $TMPC << EOF |
| 620 | #include <stdio.h> |
| 621 | #include <time.h> |
| 622 | int main(int argc, char **argv) |
| 623 | { |
| 624 | return clock_gettime(0, NULL); |
| 625 | } |
| 626 | EOF |
| 627 | if compile_prog "" "" "clock_gettime"; then |
| 628 | clock_gettime="yes" |
| 629 | elif compile_prog "" "-lrt" "clock_gettime"; then |
| 630 | clock_gettime="yes" |
| 631 | LIBS="-lrt $LIBS" |
| 632 | fi |
| 633 | echo "clock_gettime $clock_gettime" |
| 634 | |
| 635 | ########################################## |
| 636 | # CLOCK_MONOTONIC probe |
| 637 | clock_monotonic="no" |
| 638 | if test "$clock_gettime" = "yes" ; then |
| 639 | cat > $TMPC << EOF |
| 640 | #include <stdio.h> |
| 641 | #include <time.h> |
| 642 | int main(int argc, char **argv) |
| 643 | { |
| 644 | return clock_gettime(CLOCK_MONOTONIC, NULL); |
| 645 | } |
| 646 | EOF |
| 647 | if compile_prog "" "$LIBS" "clock monotonic"; then |
| 648 | clock_monotonic="yes" |
| 649 | fi |
| 650 | fi |
| 651 | echo "CLOCK_MONOTONIC $clock_monotonic" |
| 652 | |
| 653 | ########################################## |
| 654 | # CLOCK_MONOTONIC_PRECISE probe |
| 655 | clock_monotonic_precise="no" |
| 656 | if test "$clock_gettime" = "yes" ; then |
| 657 | cat > $TMPC << EOF |
| 658 | #include <stdio.h> |
| 659 | #include <time.h> |
| 660 | int main(int argc, char **argv) |
| 661 | { |
| 662 | return clock_gettime(CLOCK_MONOTONIC_PRECISE, NULL); |
| 663 | } |
| 664 | EOF |
| 665 | if compile_prog "" "$LIBS" "clock monotonic precise"; then |
| 666 | clock_monotonic_precise="yes" |
| 667 | fi |
| 668 | fi |
| 669 | echo "CLOCK_MONOTONIC_PRECISE $clock_monotonic_precise" |
| 670 | |
| 671 | ########################################## |
| 672 | # gettimeofday() probe |
| 673 | gettimeofday="no" |
| 674 | cat > $TMPC << EOF |
| 675 | #include <sys/time.h> |
| 676 | #include <stdio.h> |
| 677 | int main(int argc, char **argv) |
| 678 | { |
| 679 | struct timeval tv; |
| 680 | return gettimeofday(&tv, NULL); |
| 681 | } |
| 682 | EOF |
| 683 | if compile_prog "" "" "gettimeofday"; then |
| 684 | gettimeofday="yes" |
| 685 | fi |
| 686 | echo "gettimeofday $gettimeofday" |
| 687 | |
| 688 | ########################################## |
| 689 | # fdatasync() probe |
| 690 | fdatasync="no" |
| 691 | cat > $TMPC << EOF |
| 692 | #include <stdio.h> |
| 693 | #include <unistd.h> |
| 694 | int main(int argc, char **argv) |
| 695 | { |
| 696 | return fdatasync(0); |
| 697 | } |
| 698 | EOF |
| 699 | if compile_prog "" "" "fdatasync"; then |
| 700 | fdatasync="yes" |
| 701 | fi |
| 702 | echo "fdatasync $fdatasync" |
| 703 | |
| 704 | ########################################## |
| 705 | # sync_file_range() probe |
| 706 | sync_file_range="no" |
| 707 | cat > $TMPC << EOF |
| 708 | #include <stdio.h> |
| 709 | #include <unistd.h> |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 710 | #include <fcntl.h> |
| 711 | #include <linux/fs.h> |
| 712 | int main(int argc, char **argv) |
| 713 | { |
| 714 | unsigned int flags = SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE | |
| 715 | SYNC_FILE_RANGE_WAIT_AFTER; |
| 716 | return sync_file_range(0, 0, 0, flags); |
| 717 | } |
| 718 | EOF |
| 719 | if compile_prog "" "" "sync_file_range"; then |
| 720 | sync_file_range="yes" |
| 721 | fi |
| 722 | echo "sync_file_range $sync_file_range" |
| 723 | |
| 724 | ########################################## |
| 725 | # ext4 move extent probe |
| 726 | ext4_me="no" |
| 727 | cat > $TMPC << EOF |
| 728 | #include <fcntl.h> |
| 729 | #include <sys/ioctl.h> |
| 730 | int main(int argc, char **argv) |
| 731 | { |
| 732 | struct move_extent me; |
| 733 | return ioctl(0, EXT4_IOC_MOVE_EXT, &me); |
| 734 | } |
| 735 | EOF |
Jens Axboe | c7165b8 | 2013-01-12 10:27:53 +0100 | [diff] [blame] | 736 | if compile_prog "" "" "ext4 move extent" ; then |
| 737 | ext4_me="yes" |
| 738 | elif test $targetos = "Linux" ; then |
| 739 | # On Linux, just default to it on and let it error at runtime if we really |
| 740 | # don't have it. None of my updated systems have it defined, but it does |
| 741 | # work. Takes a while to bubble back. |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 742 | ext4_me="yes" |
| 743 | fi |
| 744 | echo "EXT4 move extent $ext4_me" |
| 745 | |
| 746 | ########################################## |
| 747 | # splice probe |
| 748 | linux_splice="no" |
| 749 | cat > $TMPC << EOF |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 750 | #include <stdio.h> |
| 751 | #include <fcntl.h> |
| 752 | int main(int argc, char **argv) |
| 753 | { |
| 754 | return splice(0, NULL, 0, NULL, 0, SPLICE_F_NONBLOCK); |
| 755 | } |
| 756 | EOF |
| 757 | if compile_prog "" "" "linux splice"; then |
| 758 | linux_splice="yes" |
| 759 | fi |
| 760 | echo "Linux splice(2) $linux_splice" |
| 761 | |
| 762 | ########################################## |
| 763 | # GUASI probe |
| 764 | guasi="no" |
| 765 | cat > $TMPC << EOF |
| 766 | #include <guasi.h> |
| 767 | #include <guasi_syscalls.h> |
| 768 | int main(int argc, char **argv) |
| 769 | { |
| 770 | guasi_t ctx = guasi_create(0, 0, 0); |
| 771 | return 0; |
| 772 | } |
| 773 | EOF |
| 774 | if compile_prog "" "" "guasi"; then |
| 775 | guasi="yes" |
| 776 | fi |
| 777 | echo "GUASI $guasi" |
| 778 | |
| 779 | ########################################## |
| 780 | # fusion-aw probe |
| 781 | fusion_aw="no" |
| 782 | cat > $TMPC << EOF |
Jens Axboe | 99db656 | 2013-01-14 19:33:40 +0100 | [diff] [blame] | 783 | #include <nvm/vectored_write.h> |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 784 | int main(int argc, char **argv) |
| 785 | { |
| 786 | struct vsl_iovec iov; |
| 787 | return vsl_vectored_write(0, &iov, 0, O_ATOMIC); |
| 788 | } |
| 789 | EOF |
Jens Axboe | 99db656 | 2013-01-14 19:33:40 +0100 | [diff] [blame] | 790 | if compile_prog "" "-L/usr/lib/fio -lnvm-primitives" "fusion-aw"; then |
| 791 | LIBS="-L/usr/lib/fio -lnvm-primitives $LIBS" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 792 | fusion_aw="yes" |
| 793 | fi |
| 794 | echo "Fusion-io atomic engine $fusion_aw" |
| 795 | |
| 796 | ########################################## |
| 797 | # libnuma probe |
| 798 | libnuma="no" |
| 799 | cat > $TMPC << EOF |
| 800 | #include <numa.h> |
| 801 | int main(int argc, char **argv) |
| 802 | { |
| 803 | return numa_available(); |
| 804 | } |
| 805 | EOF |
| 806 | if compile_prog "" "-lnuma" "libnuma"; then |
| 807 | libnuma="yes" |
| 808 | LIBS="-lnuma $LIBS" |
| 809 | fi |
| 810 | echo "libnuma $libnuma" |
| 811 | |
| 812 | ########################################## |
Jens Axboe | 50206d9 | 2013-03-25 13:20:08 -0600 | [diff] [blame] | 813 | # libnuma 2.x version API |
| 814 | if test "$libnuma" = "yes" ; then |
| 815 | libnuma_v2="no" |
| 816 | cat > $TMPC << EOF |
| 817 | #include <numa.h> |
| 818 | int main(int argc, char **argv) |
| 819 | { |
| 820 | struct bitmask *mask = numa_parse_nodestring(NULL); |
| 821 | return 0; |
| 822 | } |
| 823 | EOF |
| 824 | if compile_prog "" "" "libnuma api"; then |
| 825 | libnuma_v2="yes" |
| 826 | fi |
| 827 | echo "libnuma v2 $libnuma_v2" |
| 828 | fi |
| 829 | |
| 830 | ########################################## |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 831 | # strsep() probe |
| 832 | strsep="no" |
| 833 | cat > $TMPC << EOF |
| 834 | #include <string.h> |
| 835 | int main(int argc, char **argv) |
| 836 | { |
| 837 | strsep(NULL, NULL); |
| 838 | return 0; |
| 839 | } |
| 840 | EOF |
| 841 | if compile_prog "" "" "strsep"; then |
| 842 | strsep="yes" |
| 843 | fi |
| 844 | echo "strsep $strsep" |
| 845 | |
| 846 | ########################################## |
| 847 | # getopt_long_only() probe |
| 848 | getopt_long_only="no" |
| 849 | cat > $TMPC << EOF |
| 850 | #include <unistd.h> |
| 851 | #include <stdio.h> |
| 852 | int main(int argc, char **argv) |
| 853 | { |
| 854 | int c = getopt_long_only(argc, argv, NULL, NULL, NULL); |
| 855 | return c; |
| 856 | } |
| 857 | EOF |
| 858 | if compile_prog "" "" "getopt_long_only"; then |
| 859 | getopt_long_only="yes" |
| 860 | fi |
| 861 | echo "getopt_long_only() $getopt_long_only" |
| 862 | |
| 863 | ########################################## |
| 864 | # inet_aton() probe |
| 865 | inet_aton="no" |
| 866 | cat > $TMPC << EOF |
| 867 | #include <sys/socket.h> |
| 868 | #include <arpa/inet.h> |
| 869 | #include <stdio.h> |
| 870 | int main(int argc, char **argv) |
| 871 | { |
| 872 | struct in_addr in; |
| 873 | return inet_aton(NULL, &in); |
| 874 | } |
| 875 | EOF |
| 876 | if compile_prog "" "" "inet_aton"; then |
| 877 | inet_aton="yes" |
| 878 | fi |
| 879 | echo "inet_aton $inet_aton" |
| 880 | |
| 881 | ########################################## |
| 882 | # socklen_t probe |
| 883 | socklen_t="no" |
| 884 | cat > $TMPC << EOF |
Aaron Carroll | f648261 | 2013-03-14 16:57:41 +1100 | [diff] [blame] | 885 | #include <sys/socket.h> |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 886 | int main(int argc, char **argv) |
| 887 | { |
| 888 | socklen_t len = 0; |
| 889 | return len; |
| 890 | } |
| 891 | EOF |
| 892 | if compile_prog "" "" "socklen_t"; then |
| 893 | socklen_t="yes" |
| 894 | fi |
| 895 | echo "socklen_t $socklen_t" |
| 896 | |
| 897 | ########################################## |
| 898 | # Whether or not __thread is supported for TLS |
| 899 | tls_thread="no" |
| 900 | cat > $TMPC << EOF |
| 901 | #include <stdio.h> |
| 902 | static int __thread ret; |
| 903 | int main(int argc, char **argv) |
| 904 | { |
| 905 | return ret; |
| 906 | } |
| 907 | EOF |
| 908 | if compile_prog "" "" "__thread"; then |
| 909 | tls_thread="yes" |
| 910 | fi |
| 911 | echo "__thread $tls_thread" |
| 912 | |
Jens Axboe | 44404c5 | 2013-01-24 14:20:09 -0700 | [diff] [blame] | 913 | ########################################## |
| 914 | # Check whether we have getrusage(RUSAGE_THREAD) |
| 915 | rusage_thread="no" |
| 916 | cat > $TMPC << EOF |
| 917 | #include <sys/time.h> |
| 918 | #include <sys/resource.h> |
| 919 | int main(int argc, char **argv) |
| 920 | { |
| 921 | struct rusage ru; |
| 922 | getrusage(RUSAGE_THREAD, &ru); |
| 923 | return 0; |
| 924 | } |
| 925 | EOF |
| 926 | if compile_prog "" "" "RUSAGE_THREAD"; then |
| 927 | rusage_thread="yes" |
| 928 | fi |
| 929 | echo "RUSAGE_THREAD $rusage_thread" |
| 930 | |
Jens Axboe | 7e09a9f | 2013-01-30 13:58:58 +0100 | [diff] [blame] | 931 | ########################################## |
| 932 | # Check whether we have SCHED_IDLE |
| 933 | sched_idle="no" |
| 934 | cat > $TMPC << EOF |
| 935 | #include <sched.h> |
| 936 | int main(int argc, char **argv) |
| 937 | { |
| 938 | struct sched_param p; |
| 939 | return sched_setscheduler(0, SCHED_IDLE, &p); |
| 940 | } |
| 941 | EOF |
| 942 | if compile_prog "" "" "SCHED_IDLE"; then |
| 943 | sched_idle="yes" |
| 944 | fi |
| 945 | echo "SCHED_IDLE $sched_idle" |
| 946 | |
Jens Axboe | 1eafa37 | 2013-01-31 10:19:51 +0100 | [diff] [blame] | 947 | ########################################## |
| 948 | # Check whether we have TCP_NODELAY |
| 949 | tcp_nodelay="no" |
| 950 | cat > $TMPC << EOF |
| 951 | #include <stdio.h> |
| 952 | #include <sys/types.h> |
| 953 | #include <sys/socket.h> |
| 954 | #include <netinet/tcp.h> |
| 955 | int main(int argc, char **argv) |
| 956 | { |
| 957 | return getsockopt(0, 0, TCP_NODELAY, NULL, NULL); |
| 958 | } |
| 959 | EOF |
| 960 | if compile_prog "" "" "TCP_NODELAY"; then |
| 961 | tcp_nodelay="yes" |
| 962 | fi |
| 963 | echo "TCP_NODELAY $tcp_nodelay" |
| 964 | |
Jens Axboe | 38b9354 | 2013-02-28 08:28:05 +0100 | [diff] [blame] | 965 | ########################################## |
| 966 | # Check whether we have RLIMIT_MEMLOCK |
| 967 | rlimit_memlock="no" |
| 968 | cat > $TMPC << EOF |
| 969 | #include <sys/time.h> |
| 970 | #include <sys/resource.h> |
| 971 | int main(int argc, char **argv) |
| 972 | { |
| 973 | struct rlimit rl; |
| 974 | return getrlimit(RLIMIT_MEMLOCK, &rl); |
| 975 | } |
| 976 | EOF |
| 977 | if compile_prog "" "" "RLIMIT_MEMLOCK"; then |
| 978 | rlimit_memlock="yes" |
| 979 | fi |
| 980 | echo "RLIMIT_MEMLOCK $rlimit_memlock" |
| 981 | |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 982 | ############################################################################# |
| 983 | |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 984 | if test "$wordsize" = "64" ; then |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 985 | output_sym "CONFIG_64BIT" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 986 | elif test "$wordsize" = "32" ; then |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 987 | output_sym "CONFIG_32BIT" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 988 | else |
Jens Axboe | d7145a7 | 2013-02-11 13:21:54 +0100 | [diff] [blame] | 989 | fatal "Unknown wordsize!" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 990 | fi |
Jens Axboe | 0dcebdf | 2013-01-23 15:42:16 -0700 | [diff] [blame] | 991 | if test "$bigendian" = "yes" ; then |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 992 | output_sym "CONFIG_BIG_ENDIAN" |
Jens Axboe | 0dcebdf | 2013-01-23 15:42:16 -0700 | [diff] [blame] | 993 | else |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 994 | output_sym "CONFIG_LITTLE_ENDIAN" |
Jens Axboe | 0dcebdf | 2013-01-23 15:42:16 -0700 | [diff] [blame] | 995 | fi |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 996 | if test "$libaio" = "yes" ; then |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 997 | output_sym "CONFIG_LIBAIO" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 998 | fi |
| 999 | if test "$posix_aio" = "yes" ; then |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 1000 | output_sym "CONFIG_POSIXAIO" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1001 | fi |
| 1002 | if test "$posix_aio_fsync" = "yes" ; then |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 1003 | output_sym "CONFIG_POSIXAIO_FSYNC" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1004 | fi |
| 1005 | if test "$linux_fallocate" = "yes" ; then |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 1006 | output_sym "CONFIG_LINUX_FALLOCATE" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1007 | fi |
| 1008 | if test "$posix_fallocate" = "yes" ; then |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 1009 | output_sym "CONFIG_POSIX_FALLOCATE" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1010 | fi |
| 1011 | if test "$fdatasync" = "yes" ; then |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 1012 | output_sym "CONFIG_FDATASYNC" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1013 | fi |
| 1014 | if test "$sync_file_range" = "yes" ; then |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 1015 | output_sym "CONFIG_SYNC_FILE_RANGE" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1016 | fi |
| 1017 | if test "$sfaa" = "yes" ; then |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 1018 | output_sym "CONFIG_SFAA" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1019 | fi |
Jens Axboe | d9d9db0 | 2013-03-28 12:52:17 -0600 | [diff] [blame] | 1020 | if test "$libverbs" = "yes" -a "rdmacm" = "yes" ; then |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 1021 | output_sym "CONFIG_RDMA" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1022 | fi |
| 1023 | if test "$clock_gettime" = "yes" ; then |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 1024 | output_sym "CONFIG_CLOCK_GETTIME" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1025 | fi |
| 1026 | if test "$clock_monotonic" = "yes" ; then |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 1027 | output_sym "CONFIG_CLOCK_MONOTONIC" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1028 | fi |
| 1029 | if test "$clock_monotonic_precise" = "yes" ; then |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 1030 | output_sym "CONFIG_CLOCK_MONOTONIC_PRECISE" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1031 | fi |
| 1032 | if test "$gettimeofday" = "yes" ; then |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 1033 | output_sym "CONFIG_GETTIMEOFDAY" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1034 | fi |
| 1035 | if test "$posix_fadvise" = "yes" ; then |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 1036 | output_sym "CONFIG_POSIX_FADVISE" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1037 | fi |
| 1038 | if test "$linux_3arg_affinity" = "yes" ; then |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 1039 | output_sym "CONFIG_3ARG_AFFINITY" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1040 | elif test "$linux_2arg_affinity" = "yes" ; then |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 1041 | output_sym "CONFIG_2ARG_AFFINITY" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1042 | fi |
| 1043 | if test "$strsep" = "yes" ; then |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 1044 | output_sym "CONFIG_STRSEP" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1045 | fi |
| 1046 | if test "$getopt_long_only" = "yes" ; then |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 1047 | output_sym "CONFIG_GETOPT_LONG_ONLY" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1048 | fi |
| 1049 | if test "$inet_aton" = "yes" ; then |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 1050 | output_sym "CONFIG_INET_ATON" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1051 | fi |
| 1052 | if test "$socklen_t" = "yes" ; then |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 1053 | output_sym "CONFIG_SOCKLEN_T" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1054 | fi |
| 1055 | if test "$ext4_me" = "yes" ; then |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 1056 | output_sym "CONFIG_LINUX_EXT4_MOVE_EXTENT" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1057 | fi |
| 1058 | if test "$linux_splice" = "yes" ; then |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 1059 | output_sym "CONFIG_LINUX_SPLICE" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1060 | fi |
| 1061 | if test "$guasi" = "yes" ; then |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 1062 | output_sym "CONFIG_GUASI" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1063 | fi |
| 1064 | if test "$fusion_aw" = "yes" ; then |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 1065 | output_sym "CONFIG_FUSION_AW" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1066 | fi |
Jens Axboe | 50206d9 | 2013-03-25 13:20:08 -0600 | [diff] [blame] | 1067 | if test "$libnuma_v2" = "yes" ; then |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 1068 | output_sym "CONFIG_LIBNUMA" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1069 | fi |
| 1070 | if test "$solaris_aio" = "yes" ; then |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 1071 | output_sym "CONFIG_SOLARISAIO" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1072 | fi |
| 1073 | if test "$tls_thread" = "yes" ; then |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 1074 | output_sym "CONFIG_TLS_THREAD" |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1075 | fi |
Jens Axboe | 44404c5 | 2013-01-24 14:20:09 -0700 | [diff] [blame] | 1076 | if test "$rusage_thread" = "yes" ; then |
Jens Axboe | 4feafb1 | 2013-01-24 23:07:55 -0700 | [diff] [blame] | 1077 | output_sym "CONFIG_RUSAGE_THREAD" |
Jens Axboe | 44404c5 | 2013-01-24 14:20:09 -0700 | [diff] [blame] | 1078 | fi |
Jens Axboe | 7e09a9f | 2013-01-30 13:58:58 +0100 | [diff] [blame] | 1079 | if test "$sched_idle" = "yes" ; then |
| 1080 | output_sym "CONFIG_SCHED_IDLE" |
| 1081 | fi |
Jens Axboe | 44583e0 | 2013-03-18 15:34:41 -0600 | [diff] [blame] | 1082 | if test "$tcp_nodelay" = "yes" ; then |
| 1083 | output_sym "CONFIG_TCP_NODELAY" |
| 1084 | fi |
Jens Axboe | 38b9354 | 2013-02-28 08:28:05 +0100 | [diff] [blame] | 1085 | if test "$rlimit_memlock" = "yes" ; then |
| 1086 | output_sym "CONFIG_RLIMIT_MEMLOCK" |
| 1087 | fi |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1088 | |
| 1089 | echo "LIBS+=$LIBS" >> $config_host_mak |
| 1090 | echo "CC=$cc" >> $config_host_mak |
Jens Axboe | af4862b | 2013-03-29 08:55:32 -0600 | [diff] [blame^] | 1091 | echo "BUILD_CFLAGS=$BUILD_CFLAGS $CFLAGS" >> $config_host_mak |