[PATCH] Don't hardcode ioengine path
authorJens Axboe <jens.axboe@oracle.com>
Mon, 9 Oct 2006 17:56:04 +0000 (19:56 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Mon, 9 Oct 2006 17:56:04 +0000 (19:56 +0200)
Use the prefix in the Makefile, so it can be packaged properly.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Makefile
fio.c
fio.h
ioengines.c

index 5335e145696faf7fd7aa133829ff787937ac1adf..f6001ad3a825c1fec06008b55113dfb25535fd14 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,15 @@ CFLAGS = -Wall -O2 -g -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
 PROGS  = fio
 SCRIPTS = fio_generate_plots
 
 PROGS  = fio
 SCRIPTS = fio_generate_plots
 
+INSTALL = install
+prefix = /usr/local
+bindir = $(prefix)/bin
+libdir = $(prefix)/lib/fio
+
+FIO_INST_DIR = $(subst ','\'',$(prefix))
+
+CFLAGS += '-D_INST_PREFIX="$(FIO_INST_DIR)"'
+
 all: depend $(PROGS) $(SCRIPTS)
        $(MAKE) -C engines
 
 all: depend $(PROGS) $(SCRIPTS)
        $(MAKE) -C engines
 
@@ -18,11 +27,6 @@ depend:
 cscope:
        @cscope -b
 
 cscope:
        @cscope -b
 
-INSTALL = install
-prefix = /usr/local
-bindir = $(prefix)/bin
-libdir = $(prefix)/lib/fio
-
 install: $(PROGS) $(SCRIPTS)
        $(INSTALL) -m755 -d $(DESTDIR)$(bindir)
        $(INSTALL) $(PROGS) $(SCRIPTS) $(DESTDIR)$(bindir)
 install: $(PROGS) $(SCRIPTS)
        $(INSTALL) -m755 -d $(DESTDIR)$(bindir)
        $(INSTALL) $(PROGS) $(SCRIPTS) $(DESTDIR)$(bindir)
diff --git a/fio.c b/fio.c
index a2651f0325490d780ee7a9352fa01d53b81350b5..8278b60eb46dc2c7310d929ba00fd248620e565e 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -45,6 +45,7 @@ static char run_str[MAX_JOBS + 1];
 int shm_id = 0;
 static struct timeval genesis;
 static int temp_stall_ts;
 int shm_id = 0;
 static struct timeval genesis;
 static int temp_stall_ts;
+char *fio_inst_prefix = _INST_PREFIX;
 
 static void print_thread_status(void);
 
 
 static void print_thread_status(void);
 
diff --git a/fio.h b/fio.h
index 64f3b2d1ae0f96a6ead8eb7fb0855b6e6e125483..112736c81a360b265bd25c26820734f743ee34eb 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -325,6 +325,7 @@ extern int groupid;
 extern int terse_output;
 extern FILE *f_out;
 extern FILE *f_err;
 extern int terse_output;
 extern FILE *f_out;
 extern FILE *f_err;
+extern char *fio_inst_prefix;
 
 extern struct thread_data *threads;
 
 
 extern struct thread_data *threads;
 
index 17909636527175091a6296beff1d95ad65cbd9ac..82b7ec3f6f25957832e2f56fc2de83829a519aeb 100644 (file)
@@ -31,7 +31,7 @@ struct ioengine_ops *load_ioengine(struct thread_data *td, char *name)
        if (!strncmp(engine, "linuxaio", 8) || !strncmp(engine, "aio", 3))
                strcpy(engine, "libaio");
 
        if (!strncmp(engine, "linuxaio", 8) || !strncmp(engine, "aio", 3))
                strcpy(engine, "libaio");
 
-       sprintf(engine_lib, "/usr/local/lib/fio/fio-engine-%s.o", engine);
+       sprintf(engine_lib, "%s/lib/fio/fio-engine-%s.o", fio_inst_prefix, engine);
        dlerror();
        dlhandle = dlopen(engine_lib, RTLD_LAZY);
        if (!dlhandle) {
        dlerror();
        dlhandle = dlopen(engine_lib, RTLD_LAZY);
        if (!dlhandle) {