configure: add --disable-optimizations
authorJens Axboe <axboe@fb.com>
Mon, 27 Jul 2015 21:10:00 +0000 (15:10 -0600)
committerJens Axboe <axboe@fb.com>
Mon, 27 Jul 2015 21:10:00 +0000 (15:10 -0600)
Sometimes we want to build without optimizations enabled for
debugging issues, make this possible without editing the
Makefile.

Also fixup --disable-shm to not output a symbol until after
we have initialized config-host.*.

Signed-off-by: Jens Axboe <axboe@fb.com>
Makefile
configure

index 7fe7d4d196881193f0943b8d93a51fdc2b775204..24663a4851f9aeb0cc79b23f824f2c22fce019f2 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -22,12 +22,16 @@ endif
 
 DEBUGFLAGS = -D_FORTIFY_SOURCE=2 -DFIO_INC_DEBUG
 CPPFLAGS= -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DFIO_INTERNAL $(DEBUGFLAGS)
-OPTFLAGS= -O3 -g -ffast-math
+OPTFLAGS= -g -ffast-math
 CFLAGS = -std=gnu99 -Wwrite-strings -Wall -Wdeclaration-after-statement $(OPTFLAGS) $(EXTFLAGS) $(BUILD_CFLAGS) -I. -I$(SRCDIR)
 LIBS   += -lm $(EXTLIBS)
 PROGS  = fio
 SCRIPTS = $(addprefix $(SRCDIR)/,tools/fio_generate_plots tools/plot/fio2gnuplot tools/genfio)
 
+ifndef CONFIG_FIO_NO_OPT
+  CFLAGS += -O3
+endif
+
 ifdef CONFIG_GFIO
   PROGS += gfio
 endif
index 1cc54da2376617344b12c03d99b3c7e38bd4fb91..4fb65e66a5bcef26dbcec9477b809a60620463fe 100755 (executable)
--- a/configure
+++ b/configure
@@ -168,7 +168,9 @@ for opt do
   ;;
   --enable-libhdfs) libhdfs="yes"
   ;;
-  --disable-shm) output_sym "CONFIG_NO_SHM"
+  --disable-shm) no_shm="yes"
+  ;;
+  --disable-optimizations) disable_opt="yes"
   ;;
   --help)
     show_help="yes"
@@ -193,6 +195,7 @@ if test "$show_help" = "yes" ; then
   echo "--disable-gfapi        Disable gfapi"
   echo "--enable-libhdfs       Enable hdfs support"
   echo "--disable-shm          Disable SHM support"
+  echo "--disable-optimizations Don't enable compiler optimizations"
   exit $exit_val
 fi
 
@@ -220,6 +223,14 @@ printf " '%s'" "$0" "$@" >> $config_host_mak
 echo >> $config_host_mak
 echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak
 
+if test "$no_shm" = "yes" ; then
+  output_sym "CONFIG_NO_SHM"
+fi
+
+if test "$disable_opt" = "yes" ; then
+  output_sym "CONFIG_FIO_NO_OPT"
+fi
+
 # Some host OSes need non-standard checks for which CPU to use.
 # Note that these checks are broken for cross-compilation: if you're
 # cross-compiling to one of these OSes then you'll need to specify