+if compile_prog "" "" "getopt_long_only"; then
+ getopt_long_only="yes"
+fi
+print_config "getopt_long_only()" "$getopt_long_only"
+
+##########################################
+# inet_aton() probe
+if test "$inet_aton" != "yes" ; then
+ inet_aton="no"
+fi
+cat > $TMPC << EOF
+#include <sys/socket.h>
+#include <arpa/inet.h>
+#include <stdio.h>
+int main(int argc, char **argv)
+{
+ struct in_addr in;
+ return inet_aton(NULL, &in);
+}
+EOF
+if compile_prog "" "" "inet_aton"; then
+ inet_aton="yes"
+fi
+print_config "inet_aton" "$inet_aton"
+
+##########################################
+# socklen_t probe
+if test "$socklen_t" != "yes" ; then
+ socklen_t="no"
+fi
+cat > $TMPC << EOF
+#include <sys/socket.h>
+int main(int argc, char **argv)
+{
+ socklen_t len = 0;
+ return len;
+}
+EOF
+if compile_prog "" "" "socklen_t"; then
+ socklen_t="yes"
+fi
+print_config "socklen_t" "$socklen_t"
+
+##########################################
+# Whether or not __thread is supported for TLS
+if test "$tls_thread" != "yes" ; then
+ tls_thread="no"
+fi
+cat > $TMPC << EOF
+#include <stdio.h>
+static __thread int ret;
+int main(int argc, char **argv)
+{
+ return ret;
+}
+EOF
+if compile_prog "" "" "__thread"; then
+ tls_thread="yes"
+fi
+print_config "__thread" "$tls_thread"
+
+##########################################
+# Check if we have required gtk/glib support for gfio
+if test "$gfio" != "yes" ; then
+ gfio="no"
+fi
+if test "$gfio_check" = "yes" ; then
+ cat > $TMPC << EOF
+#include <glib.h>
+#include <cairo.h>
+#include <gtk/gtk.h>
+int main(void)
+{
+ gdk_threads_enter();
+ gdk_threads_leave();
+
+ return GTK_CHECK_VERSION(2, 18, 0) ? 0 : 1; /* 0 on success */
+}
+EOF
+GTK_CFLAGS=$(pkg-config --cflags gtk+-2.0 gthread-2.0)
+ORG_LDFLAGS=$LDFLAGS
+LDFLAGS=$(echo $LDFLAGS | sed s/"-static"//g)
+if test "$?" != "0" ; then
+ echo "configure: gtk and gthread not found"
+ exit 1
+fi
+GTK_LIBS=$(pkg-config --libs gtk+-2.0 gthread-2.0)
+if test "$?" != "0" ; then
+ echo "configure: gtk and gthread not found"
+ exit 1
+fi
+if compile_prog "$GTK_CFLAGS" "$GTK_LIBS" "gfio" ; then
+ $TMPE
+ if test "$?" = "0" ; then
+ gfio="yes"
+ GFIO_LIBS="$LIBS $GTK_LIBS"
+ CFLAGS="$CFLAGS $GTK_CFLAGS"
+ else
+ echo "GTK found, but need version 2.18 or higher"
+ gfio="no"
+ fi
+else
+ echo "Please install gtk and gdk libraries"
+ gfio="no"
+fi
+LDFLAGS=$ORG_LDFLAGS
+fi
+
+if test "$gfio_check" = "yes" ; then
+ print_config "gtk 2.18 or higher" "$gfio"
+fi
+
+##########################################
+# Check whether we have getrusage(RUSAGE_THREAD)
+if test "$rusage_thread" != "yes" ; then
+ rusage_thread="no"
+fi
+cat > $TMPC << EOF
+#include <sys/time.h>
+#include <sys/resource.h>
+int main(int argc, char **argv)
+{
+ struct rusage ru;
+ getrusage(RUSAGE_THREAD, &ru);
+ return 0;
+}
+EOF
+if compile_prog "" "" "RUSAGE_THREAD"; then
+ rusage_thread="yes"
+fi
+print_config "RUSAGE_THREAD" "$rusage_thread"
+
+##########################################
+# Check whether we have SCHED_IDLE
+if test "$sched_idle" != "yes" ; then
+ sched_idle="no"
+fi
+cat > $TMPC << EOF
+#include <sched.h>
+int main(int argc, char **argv)
+{
+ struct sched_param p;
+ return sched_setscheduler(0, SCHED_IDLE, &p);
+}
+EOF
+if compile_prog "" "" "SCHED_IDLE"; then
+ sched_idle="yes"
+fi
+print_config "SCHED_IDLE" "$sched_idle"
+
+##########################################
+# Check whether we have TCP_NODELAY
+if test "$tcp_nodelay" != "yes" ; then
+ tcp_nodelay="no"
+fi
+cat > $TMPC << EOF
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/tcp.h>
+int main(int argc, char **argv)
+{
+ return getsockopt(0, 0, TCP_NODELAY, NULL, NULL);
+}
+EOF
+if compile_prog "" "" "TCP_NODELAY"; then
+ tcp_nodelay="yes"
+fi
+print_config "TCP_NODELAY" "$tcp_nodelay"
+
+##########################################
+# Check whether we have SO_SNDBUF
+if test "$window_size" != "yes" ; then
+ window_size="no"
+fi
+cat > $TMPC << EOF
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/tcp.h>
+int main(int argc, char **argv)
+{
+ setsockopt(0, SOL_SOCKET, SO_SNDBUF, NULL, 0);
+ setsockopt(0, SOL_SOCKET, SO_RCVBUF, NULL, 0);
+}
+EOF
+if compile_prog "" "" "SO_SNDBUF"; then
+ window_size="yes"
+fi
+print_config "Net engine window_size" "$window_size"
+
+##########################################
+# Check whether we have TCP_MAXSEG
+if test "$mss" != "yes" ; then
+ mss="no"
+fi
+cat > $TMPC << EOF
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/tcp.h>
+#include <arpa/inet.h>
+#include <netinet/in.h>
+int main(int argc, char **argv)
+{
+ return setsockopt(0, IPPROTO_TCP, TCP_MAXSEG, NULL, 0);
+}
+EOF
+if compile_prog "" "" "TCP_MAXSEG"; then
+ mss="yes"
+fi
+print_config "TCP_MAXSEG" "$mss"
+
+##########################################
+# Check whether we have RLIMIT_MEMLOCK
+if test "$rlimit_memlock" != "yes" ; then
+ rlimit_memlock="no"
+fi
+cat > $TMPC << EOF
+#include <sys/time.h>
+#include <sys/resource.h>
+int main(int argc, char **argv)
+{
+ struct rlimit rl;
+ return getrlimit(RLIMIT_MEMLOCK, &rl);
+}
+EOF
+if compile_prog "" "" "RLIMIT_MEMLOCK"; then
+ rlimit_memlock="yes"
+fi
+print_config "RLIMIT_MEMLOCK" "$rlimit_memlock"
+
+##########################################
+# Check whether we have pwritev/preadv
+if test "$pwritev" != "yes" ; then
+ pwritev="no"
+fi
+cat > $TMPC << EOF
+#include <stdio.h>
+#include <sys/uio.h>
+int main(int argc, char **argv)
+{
+ return pwritev(0, NULL, 1, 0) + preadv(0, NULL, 1, 0);
+}
+EOF
+if compile_prog "" "" "pwritev"; then
+ pwritev="yes"
+fi
+print_config "pwritev/preadv" "$pwritev"
+
+##########################################
+# Check whether we have pwritev2/preadv2
+if test "$pwritev2" != "yes" ; then
+ pwritev2="no"
+fi
+cat > $TMPC << EOF
+#include <stdio.h>
+#include <sys/uio.h>
+int main(int argc, char **argv)
+{
+ return pwritev2(0, NULL, 1, 0, 0) + preadv2(0, NULL, 1, 0, 0);
+}
+EOF
+if compile_prog "" "" "pwritev2"; then
+ pwritev2="yes"
+fi
+print_config "pwritev2/preadv2" "$pwritev2"
+
+##########################################
+# Check whether we have the required functions for ipv6
+if test "$ipv6" != "yes" ; then
+ ipv6="no"
+fi
+cat > $TMPC << EOF
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <stdio.h>
+int main(int argc, char **argv)
+{
+ struct addrinfo hints;
+ struct in6_addr addr;
+ int ret;
+
+ ret = getaddrinfo(NULL, NULL, &hints, NULL);
+ freeaddrinfo(NULL);
+ printf("%s\n", gai_strerror(ret));
+ addr = in6addr_any;
+ return 0;
+}
+EOF
+if compile_prog "" "" "ipv6"; then
+ ipv6="yes"
+fi
+print_config "IPv6 helpers" "$ipv6"
+
+##########################################
+# check for http
+if test "$http" != "yes" ; then
+ http="no"
+fi
+# check for openssl >= 1.1.0, which uses an opaque HMAC_CTX pointer
+cat > $TMPC << EOF
+#include <curl/curl.h>
+#include <openssl/hmac.h>
+
+int main(int argc, char **argv)
+{
+ CURL *curl;
+ HMAC_CTX *ctx;
+
+ curl = curl_easy_init();
+ curl_easy_cleanup(curl);
+
+ ctx = HMAC_CTX_new();
+ HMAC_CTX_reset(ctx);
+ HMAC_CTX_free(ctx);
+ return 0;
+}
+EOF
+# openssl < 1.1.0 uses the HMAC_CTX type directly
+cat > $TMPC2 << EOF
+#include <curl/curl.h>
+#include <openssl/hmac.h>
+
+int main(int argc, char **argv)
+{
+ CURL *curl;
+ HMAC_CTX ctx;
+
+ curl = curl_easy_init();
+ curl_easy_cleanup(curl);
+
+ HMAC_CTX_init(&ctx);
+ HMAC_CTX_cleanup(&ctx);
+ return 0;
+}
+EOF
+if test "$disable_http" != "yes"; then
+ HTTP_LIBS="-lcurl -lssl -lcrypto"
+ if compile_prog "" "$HTTP_LIBS" "curl-new-ssl"; then
+ output_sym "CONFIG_HAVE_OPAQUE_HMAC_CTX"
+ http="yes"
+ LIBS="$HTTP_LIBS $LIBS"
+ elif mv $TMPC2 $TMPC && compile_prog "" "$HTTP_LIBS" "curl-old-ssl"; then
+ http="yes"
+ LIBS="$HTTP_LIBS $LIBS"
+ fi
+fi
+print_config "http engine" "$http"
+
+##########################################
+# check for rados
+if test "$rados" != "yes" ; then
+ rados="no"
+fi
+cat > $TMPC << EOF
+#include <rados/librados.h>
+
+int main(int argc, char **argv)
+{
+ rados_t cluster;
+ rados_ioctx_t io_ctx;
+ const char cluster_name[] = "ceph";
+ const char user_name[] = "client.admin";
+ const char pool[] = "rados";
+
+ /* The rados_create2 signature required was only introduced in ceph 0.65 */
+ rados_create2(&cluster, cluster_name, user_name, 0);
+ rados_ioctx_create(cluster, pool, &io_ctx);
+
+ return 0;
+}
+EOF
+if test "$disable_rados" != "yes" && compile_prog "" "-lrados" "rados"; then
+ LIBS="-lrados $LIBS"
+ rados="yes"
+fi
+print_config "Rados engine" "$rados"
+
+##########################################
+# check for rbd
+if test "$rbd" != "yes" ; then
+ rbd="no"
+fi
+cat > $TMPC << EOF
+#include <rbd/librbd.h>
+
+int main(int argc, char **argv)
+{
+ rados_t cluster;
+ rados_ioctx_t io_ctx;
+ const char cluster_name[] = "ceph";
+ const char user_name[] = "client.admin";
+ const char pool[] = "rbd";
+ int major, minor, extra;
+
+ rbd_version(&major, &minor, &extra);
+ /* The rados_create2 signature required was only introduced in ceph 0.65 */
+ rados_create2(&cluster, cluster_name, user_name, 0);
+ rados_ioctx_create(cluster, pool, &io_ctx);
+
+ return 0;
+}
+EOF
+if test "$disable_rbd" != "yes" && compile_prog "" "-lrbd -lrados" "rbd"; then
+ LIBS="-lrbd -lrados $LIBS"
+ rbd="yes"
+fi
+print_config "Rados Block Device engine" "$rbd"
+
+##########################################
+# check for rbd_poll
+if test "$rbd_poll" != "yes" ; then
+ rbd_poll="no"
+fi
+if test "$rbd" = "yes"; then
+cat > $TMPC << EOF
+#include <rbd/librbd.h>
+#include <sys/eventfd.h>
+
+int main(int argc, char **argv)
+{
+ rbd_image_t image;
+ rbd_completion_t comp;
+
+ int fd = eventfd(0, EFD_NONBLOCK);
+ rbd_set_image_notification(image, fd, EVENT_TYPE_EVENTFD);
+ rbd_poll_io_events(image, comp, 1);
+
+ return 0;
+}
+EOF
+if compile_prog "" "-lrbd -lrados" "rbd"; then
+ rbd_poll="yes"
+fi
+print_config "rbd_poll" "$rbd_poll"
+fi
+
+##########################################
+# check for rbd_invalidate_cache()
+if test "$rbd_inval" != "yes" ; then
+ rbd_inval="no"
+fi
+if test "$rbd" = "yes"; then
+cat > $TMPC << EOF
+#include <rbd/librbd.h>
+
+int main(int argc, char **argv)
+{
+ rbd_image_t image;
+
+ return rbd_invalidate_cache(image);
+}
+EOF
+if compile_prog "" "-lrbd -lrados" "rbd"; then
+ rbd_inval="yes"
+fi
+print_config "rbd_invalidate_cache" "$rbd_inval"
+fi
+
+##########################################
+# Check whether we have setvbuf
+if test "$setvbuf" != "yes" ; then
+ setvbuf="no"
+fi
+cat > $TMPC << EOF
+#include <stdio.h>
+int main(int argc, char **argv)
+{
+ FILE *f = NULL;
+ char buf[80];
+ setvbuf(f, buf, _IOFBF, sizeof(buf));
+ return 0;
+}
+EOF
+if compile_prog "" "" "setvbuf"; then
+ setvbuf="yes"
+fi
+print_config "setvbuf" "$setvbuf"
+
+##########################################
+# check for gfapi
+if test "$gfapi" != "yes" ; then
+ gfapi="no"
+fi
+cat > $TMPC << EOF
+#include <glusterfs/api/glfs.h>
+
+int main(int argc, char **argv)
+{
+ glfs_t *g = glfs_new("foo");
+
+ return 0;
+}
+EOF
+if test "$disable_gfapi" != "yes" && compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
+ LIBS="-lgfapi -lglusterfs $LIBS"
+ gfapi="yes"
+fi
+print_config "Gluster API engine" "$gfapi"
+
+##########################################
+# check for gfapi fadvise support, initialize with "no" only if $gfapi is set to "yes"
+if test "$gfapi" = "yes" ; then
+gf_fadvise="no"
+cat > $TMPC << EOF
+#include <glusterfs/api/glfs.h>
+
+int main(int argc, char **argv)
+{
+ struct glfs_fd *fd;
+ int ret = glfs_fadvise(fd, 0, 0, 1);
+
+ return 0;
+}
+EOF
+if compile_prog "" "-lgfapi -lglusterfs" "gfapi"; then
+ gf_fadvise="yes"
+fi
+print_config "Gluster API use fadvise" "$gf_fadvise"
+fi
+
+##########################################
+# check for gfapi trim support
+if test "$gf_trim" != "yes" ; then
+ gf_trim="no"
+fi
+if test "$gfapi" = "yes" ; then
+cat > $TMPC << EOF
+#include <glusterfs/api/glfs.h>
+
+int main(int argc, char **argv)
+{
+ return glfs_discard_async(NULL, 0, 0);
+}
+EOF
+if compile_prog "" "-lgfapi -lglusterfs" "gf trim"; then
+ gf_trim="yes"
+fi
+print_config "Gluster API trim support" "$gf_trim"
+fi
+
+##########################################
+# Check if we support stckf on s390
+if test "$s390_z196_facilities" != "yes" ; then
+ s390_z196_facilities="no"
+fi
+cat > $TMPC << EOF
+#define STFLE_BITS_Z196 45 /* various z196 facilities ... */
+int main(int argc, char **argv)
+{
+ /* We want just 1 double word to be returned. */
+ register unsigned long reg0 asm("0") = 0;
+ unsigned long stfle_bits;
+ asm volatile(".machine push" "\n\t"
+ ".machine \"z9-109\"" "\n\t"
+ "stfle %0" "\n\t"
+ ".machine pop" "\n"
+ : "=QS" (stfle_bits), "+d" (reg0)
+ : : "cc");
+
+ if ((stfle_bits & (1UL << (63 - STFLE_BITS_Z196))) != 0)
+ return 0;
+ else
+ return -1;
+}
+EOF
+if compile_prog "" "" "s390_z196_facilities"; then
+ $TMPE
+ if [ $? -eq 0 ]; then
+ s390_z196_facilities="yes"
+ fi
+fi
+print_config "s390_z196_facilities" "$s390_z196_facilities"
+
+##########################################
+# Check if we have required environment variables configured for libhdfs
+if test "$libhdfs" = "yes" ; then
+ hdfs_conf_error=0
+ if test "$JAVA_HOME" = "" ; then
+ echo "configure: JAVA_HOME should be defined to jdk/jvm path"
+ hdfs_conf_error=1
+ fi
+ if test "$FIO_LIBHDFS_INCLUDE" = "" ; then
+ echo "configure: FIO_LIBHDFS_INCLUDE should be defined to libhdfs inlude path"
+ hdfs_conf_error=1
+ fi
+ if test "$FIO_LIBHDFS_LIB" = "" ; then
+ echo "configure: FIO_LIBHDFS_LIB should be defined to libhdfs library path"
+ hdfs_conf_error=1
+ fi
+ if test "$hdfs_conf_error" = "1" ; then
+ exit 1
+ fi
+ FIO_HDFS_CPU=$cpu
+ if test "$FIO_HDFS_CPU" = "x86_64" ; then
+ FIO_HDFS_CPU="amd64"
+ fi
+fi
+print_config "HDFS engine" "$libhdfs"
+
+##########################################
+# Check whether we have MTD
+if test "$mtd" != "yes" ; then
+ mtd="no"
+fi
+cat > $TMPC << EOF
+#include <string.h>
+#include <mtd/mtd-user.h>
+#include <sys/ioctl.h>
+int main(int argc, char **argv)
+{
+ struct mtd_write_req ops;
+ struct mtd_info_user info;
+ memset(&ops, 0, sizeof(ops));
+ info.type = MTD_MLCNANDFLASH;
+ return ioctl(0, MEMGETINFO, &info);
+}
+EOF
+if compile_prog "" "" "mtd"; then
+ mtd="yes"
+fi
+print_config "MTD" "$mtd"
+
+##########################################
+# Check whether we have libpmem
+if test "$libpmem" != "yes" ; then
+ libpmem="no"
+fi
+cat > $TMPC << EOF
+#include <libpmem.h>
+int main(int argc, char **argv)
+{
+ int rc;
+ rc = pmem_is_pmem(0, 0);
+ return 0;
+}
+EOF
+if compile_prog "" "-lpmem" "libpmem"; then
+ libpmem="yes"
+ LIBS="-lpmem $LIBS"
+fi
+print_config "libpmem" "$libpmem"
+
+##########################################
+# Check whether we have libpmemblk
+# libpmem is a prerequisite
+if test "$libpmemblk" != "yes" ; then
+ libpmemblk="no"
+fi
+if test "$libpmem" = "yes"; then
+ cat > $TMPC << EOF
+#include <libpmemblk.h>
+int main(int argc, char **argv)
+{
+ PMEMblkpool *pbp;
+ pbp = pmemblk_open("", 0);
+ return 0;
+}
+EOF
+ if compile_prog "" "-lpmemblk" "libpmemblk"; then
+ libpmemblk="yes"
+ LIBS="-lpmemblk $LIBS"
+ fi
+fi
+print_config "libpmemblk" "$libpmemblk"
+
+# Choose the ioengines
+if test "$libpmem" = "yes" && test "$disable_pmem" = "no"; then
+ pmem="yes"
+ devdax="yes"
+ if test "$libpmemblk" = "yes"; then
+ pmemblk="yes"
+ fi