Skip to content

Commit

Permalink
enable/disable multi-threading via the configure script
Browse files Browse the repository at this point in the history
  • Loading branch information
Expander authored and Expander committed Apr 4, 2014
1 parent 08c5592 commit eec0845
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 1 deletion.
2 changes: 2 additions & 0 deletions config/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ ENABLE_COMPILE := @ENABLE_COMPILE@
ENABLE_LOOPTOOLS := @ENABLE_LOOPTOOLS@
ENABLE_META := @ENABLE_META@
ENABLE_STATIC_LIBS := @ENABLE_STATIC_LIBS@
ENABLE_THREADS := @ENABLE_THREADS@

# the modules add their dependency files to this variable
ALLDEP :=
Expand Down Expand Up @@ -160,6 +161,7 @@ showbuild:
@echo "ENABLE_LOOPTOOLS = $(ENABLE_LOOPTOOLS)"
@echo "ENABLE_META = $(ENABLE_META)"
@echo "ENABLE_STATIC_LIBS = $(ENABLE_STATIC_LIBS)"
@echo "ENABLE_THREADS = $(ENABLE_THREADS)"
@echo ""
@echo "The list of modules to be built:"
@echo "--------------------------------"
Expand Down
2 changes: 2 additions & 0 deletions config/Makefile.standalone.in
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ THREADLIBS := @THREADLIBS@

# Switches
ENABLE_LOOPTOOLS := @ENABLE_LOOPTOOLS@
ENABLE_THREADS := @ENABLE_THREADS@

STANDALONE_SRC := \
standalone.cpp
Expand Down Expand Up @@ -144,3 +145,4 @@ showbuild:
@echo "THREADLIBS = $(THREADLIBS)"
@echo ""
@echo "ENABLE_LOOPTOOLS = $(ENABLE_LOOPTOOLS)"
@echo "ENABLE_THREADS = $(ENABLE_THREADS)"
2 changes: 2 additions & 0 deletions config/Makefile.tower.in
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ THREADLIBS := @THREADLIBS@

# Switches
ENABLE_LOOPTOOLS := @ENABLE_LOOPTOOLS@
ENABLE_THREADS := @ENABLE_THREADS@

TOWER_SRC := \
run_tower.cpp \
Expand Down Expand Up @@ -155,3 +156,4 @@ showbuild:
@echo "THREADLIBS = $(THREADLIBS)"
@echo ""
@echo "ENABLE_LOOPTOOLS = $(ENABLE_LOOPTOOLS)"
@echo "ENABLE_THREADS = $(ENABLE_THREADS)"
2 changes: 1 addition & 1 deletion config/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@
/* Switches */

/* Enable multi-threading */
#undef ENABLE_THREADS
@DEFINE_ENABLE_THREADS@
18 changes: 18 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ options=" \
enable_meta \
enable_silent \
enable_static_libs \
enable_threads \
enable_verbose \
"
enable_compile="yes"
Expand All @@ -101,8 +102,12 @@ enable_looptools="no"
enable_meta="yes"
enable_silent="no"
enable_static_libs="yes"
enable_threads="yes"
enable_verbose="no"

# corresponding preprocessor define statements
DEFINE_ENABLE_THREADS="#define ENABLE_THREADS"

boost_lib_dir=""
boost_inc_dir=""
eigen_inc_dir=""
Expand Down Expand Up @@ -1600,6 +1605,14 @@ enable_defines() {
CPPFLAGS="$CPPFLAGS -DVERBOSE"
fi
fi

if test "x${enable_threads}" = "xyes" ; then
message "Enabling multi-threading"
DEFINE_ENABLE_THREADS="#define ENABLE_THREADS"
else
message "Disabling multi-threading"
DEFINE_ENABLE_THREADS="#undef ENABLE_THREADS"
fi
}

#_____________________________________________________________________
Expand All @@ -1621,6 +1634,7 @@ enable/disable options, prefix with either --enable- or --disable-
meta Create model classes (default: $enable_meta)
silent Suppress all command line output (default: $enable_silent)
static-libs Create static libraries (default: $enable_static_libs)
threads Enable multi-threading (default: $enable_threads)
verbose Verbose messages (default: $enable_verbose)
Package directories, compilation settings and model selection
Expand Down Expand Up @@ -1815,6 +1829,7 @@ sed -e "s|@FLEXIBLESUSY_VERSION@|$FLEXIBLESUSY_VERSION|" \
-e "s|@ENABLE_COMPILE@|$enable_compile|" \
-e "s|@ENABLE_LOOPTOOLS@|$enable_looptools|" \
-e "s|@ENABLE_META@|$enable_meta|" \
-e "s|@ENABLE_THREADS@|$enable_threads|" \
-e "s|@LOOPTOOLSLIBS@|$LOOPTOOLSLIBS|" \
-e "s|@LOOPTOOLSFLAGS@|$LOOPTOOLSFLAGS|" \
-e "s|@MODELS@|$MODELS|" \
Expand Down Expand Up @@ -1849,6 +1864,7 @@ sed -e "s|@FLEXIBLESUSY_VERSION@|$FLEXIBLESUSY_VERSION|" \
-e "s|@GSLFLAGS@|$GSLFLAGS|" \
-e "s|@LAPACKLIBS@|$LAPACKLIBS|" \
-e "s|@ENABLE_LOOPTOOLS@|$enable_looptools|" \
-e "s|@ENABLE_THREADS@|$enable_threads|" \
-e "s|@LOOPTOOLSLIBS@|$LOOPTOOLSLIBS|" \
-e "s|@LOOPTOOLSFLAGS@|$LOOPTOOLSFLAGS|" \
-e "s|@MAKELIB@|$MAKELIB|" \
Expand Down Expand Up @@ -1881,6 +1897,7 @@ sed -e "s|@FLEXIBLESUSY_VERSION@|$FLEXIBLESUSY_VERSION|" \
-e "s|@GSLFLAGS@|$GSLFLAGS|" \
-e "s|@LAPACKLIBS@|$LAPACKLIBS|" \
-e "s|@ENABLE_LOOPTOOLS@|$enable_looptools|" \
-e "s|@ENABLE_THREADS@|$enable_threads|" \
-e "s|@LOOPTOOLSLIBS@|$LOOPTOOLSLIBS|" \
-e "s|@LOOPTOOLSFLAGS@|$LOOPTOOLSFLAGS|" \
-e "s|@MAKELIB@|$MAKELIB|" \
Expand Down Expand Up @@ -1923,6 +1940,7 @@ sed -e "s|@FLEXIBLESUSY_VERSION@|$FLEXIBLESUSY_VERSION|" \
-e "s|@OPERATING_SYSTEM@|$operating_system|" \
-e "s|@KERNEL_VERSION@|$kernel_version|" \
-e "s|@DATE@|$DATE|" \
-e "s|@DEFINE_ENABLE_THREADS@|$DEFINE_ENABLE_THREADS|" \
< $CONFIGHDR_TMPL > $CONFIGHDR

sed -e "s|@FLEXIBLESUSY_VERSION@|$FLEXIBLESUSY_VERSION|" \
Expand Down

0 comments on commit eec0845

Please sign in to comment.