and build without SMB support if not available.
Add pritning of which optional backends are available int he build
at the end of the configure script
For now : support for raw scsi through the linux sg interface and smb
support are optional.
docdir=@datadir@/doc/dbench
XSLTPROC = /usr/bin/xsltproc
INSTALLCMD=@INSTALL@
-LIBS=@LIBS@ -lpopt -lz -lsmbclient
+LIBS=@LIBS@ -lpopt -lz @LIBSMBCLIENT@
DESTDIR=/
CC=@CC@
CFLAGS=@CFLAGS@ -I. -DVERSION=\"$(VERSION)\" -DDATADIR=\"$(datadir)\"
LIBNFS_OBJ = libnfs.o mount_client.o nfs_client.o mount_xdr.o nfs_xdr.o
-DB_OBJS = fileio.o util.o dbench.o child.o system.o snprintf.o sockio.o nfsio.o libnfs.a socklib.o linux_scsi.o iscsi.o smb.o
+DB_OBJS = fileio.o util.o dbench.o child.o system.o snprintf.o sockio.o nfsio.o libnfs.a socklib.o @LINUXSCSI@ iscsi.o @SMBO@
SRV_OBJS = util.o tbench_srv.o socklib.o
all: dbench doc
/* Define to 1 if you have the `lgetxattr' function. */
#undef HAVE_LGETXATTR
+/* Whether we have LIBSMBCLIENT support */
+#undef HAVE_LIBSMBCLIENT
+
/* Define if Linux SCSI Generic is enabled */
#undef HAVE_LINUX_SCSI_SG
exit
fi
+#
+# Check that libsmbclient is available
+#
+AC_MSG_CHECKING(whether libsmbclient is available)
+ac_save_CFLAGS="$CFLAGS"
+ac_save_LIBS="$LIBS"
+CFLAGS="$CFLAGS $GLIB_CFLAGS"
+LIBS="$GLIB_LIBS $LIBS -lsmbclient"
+AC_TRY_RUN([
+#include <stdio.h>
+#include <libsmbclient.h>
+
+int main(int argc, char *argv[])
+{
+ SMBCCTX *ctx;
+
+ ctx = smbc_new_context();
+ if (ctx == NULL) {
+ fprintf(stderr, "Could not allocate SMB Context\n");
+ return 1;
+ }
+
+ smbc_free_context(ctx, 1);
+
+ return 0;
+}
+], ac_cv_have_libsmbclient=yes, ac_cv_have_libsmbclient=no,
+ [echo $ac_n "compile with LIBSMBCLIENT. Assuming OK... $ac_c"
+ ac_cv_have_libsmbclient=yes])
+CFLAGS="$ac_save_CFLAGS"
+LIBS="$ac_save_LIBS"
+if test "$ac_cv_have_libsmbclient" = yes ; then
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_LIBSMBCLIENT, 1, [Whether we have LIBSMBCLIENT support])
+ LIBSMBCLIENT="-lsmbclient"
+ SMBO="smb.o"
+else
+ AC_MSG_RESULT(no)
+ AC_MSG_NOTICE(Libsmbclient-dev not available. Building DBENCH without SMB support)
+ LIBSMBCLIENT=""
+ SMBO=""
+fi
#
# Check whether we have access to Linux SCSI Generic ioctl()
if test "$ac_cv_linux_scsi_sg" = yes ; then
AC_MSG_RESULT(yes)
have_linux_scsi_sg=yes
+ LINUXSCSI="linux_scsi.o"
else
AC_MSG_RESULT(no)
have_linux_scsi_sg=no
+ LINUXSCSI=""
fi
if test x$have_linux_scsi_sg = xyes
then
AC_DEFINE(HAVE_LINUX_SCSI_SG, 1, [Define if Linux SCSI Generic is enabled])
fi
+AC_SUBST(LIBSMBCLIENT)
+AC_SUBST(SMBO)
+AC_SUBST(LINUXSCSI)
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
+
+
+
+AC_MSG_NOTICE(============================================)
+if test "$ac_cv_have_libsmbclient" = yes ; then
+ AC_MSG_NOTICE(SMB support .......................... [YES])
+else
+ AC_MSG_NOTICE(SMB support .......................... [NO])
+fi
+if test "$ac_cv_linux_scsi_sg" = yes ; then
+ AC_MSG_NOTICE(LINUX SCSI SG support ................ [YES])
+else
+ AC_MSG_NOTICE(LINUX SCSI SG support ................ [NO])
+fi
struct poptOption popt_options[] = {
POPT_AUTOHELP
{ "backend", 'B', POPT_ARG_STRING, &options.backend, 0,
- "dbench backend (fileio, sockio, nfs, scsi, iscsi)", "string" },
+ "dbench backend (fileio, sockio, nfs, scsi, iscsi, smb)", "string" },
{ "timelimit", 't', POPT_ARG_INT, &options.timelimit, 0,
"timelimit", "integer" },
{ "loadfile", 'c', POPT_ARG_STRING, &options.loadfile, 0,
"How many seconds of warmup to run", NULL },
{ "machine-readable", 0, POPT_ARG_NONE, &options.machine_readable, 0,
"Print data in more machine-readable friendly format", NULL},
+#ifdef HAVE_LIBSMBCLIENT
{ "smb-share", 0, POPT_ARG_STRING, &options.smb_share, 0,
"//SERVER/SHARE to use", NULL },
{ "smb-user", 0, POPT_ARG_STRING, &options.smb_user, 0,
"User to authenticate as : [<domain>/]<user>%<password>", NULL },
+#endif
POPT_TABLEEND
};
poptContext pc;
} else if (strcmp(options.backend, "iscsi") == 0) {
extern struct nb_operations iscsi_ops;
nb_ops = &iscsi_ops;
+#ifdef HAVE_LIBSMBCLIENT
} else if (strcmp(options.backend, "smb") == 0) {
extern struct nb_operations smb_ops;
nb_ops = &smb_ops;
+#endif
} else {
printf("Unknown backend '%s'\n", options.backend);
exit(1);
#include <stdio.h>
#undef _GNU_SOURCE
-#ifdef HAVE_LINUX_SCSI_SG
-
#include <fcntl.h>
#include <sys/ioctl.h>
#include <scsi/sg.h>
.ops = ops
};
-#endif /* HAVE_LINUX_SCSI_SG */