CFLAGS ?= -O2 -g -Wall -Werror
CFLAGS += -std=gnu99
CPPFLAGS += -D_GNU_SOURCE -D__CHECK_ENDIAN__
-LDFLAGS += -luuid
+LIBUUID = $(shell ld -o /dev/null -luuid >/dev/null 2>&1; echo $$?)
NVME = nvme
INSTALL ?= install
DESTDIR =
SBINDIR = $(PREFIX)/sbin
LIB_DEPENDS =
+ifeq ($(LIBUUID),0)
+ override LDFLAGS += -luuid
+ override CFLAGS += -DLIBUUID
+ override LIB_DEPENDS += uuid
+endif
+
RPMBUILD = rpmbuild
TAR = tar
RM = rm -f
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
+
+#ifdef LIBUUID
#include <uuid/uuid.h>
+#endif
#include "nvme-print.h"
#include "nvme-ioctl.h"
return passthru(argc, argv, NVME_IOCTL_ADMIN_CMD, desc, cmd);
}
+#ifdef LIBUUID
static int gen_hostnqn_cmd(int argc, char **argv, struct command *command, struct plugin *plugin)
{
uuid_t uuid;
printf("nqn.2014-08.org.nvmexpress:NVMf:uuid:%s\n", uuid_str);
return 0;
}
+#else
+static int gen_hostnqn_cmd(int argc, char **argv, struct command *command, struct plugin *plugin)
+{
+ fprintf(stderr, "\"%s\" not supported. Install lib uuid and rebuild.\n",
+ command->name);
+ return -ENOTSUP;
+}
+#endif
static int discover_cmd(int argc, char **argv, struct command *command, struct plugin *plugin)
{