Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/40964 )
Change subject: scons,misc: Remove the ability to disable some trivial
features.
......................................................................
scons,misc: Remove the ability to disable some trivial features.
These are HDF5, PNG, FENV, and TUNTAP support, all of which add
capabilities to gem5 which can be ignored if not wanted. It could be
argued that FENV changes behavior because it makes setting the FP
rounding mode work or not as used by SPARC, but since the difference is
trivial and in a niche area, that (along with the other options) doesn't
seem to justify having a top level control in the build system.
Since these are no longer options which say whether to *use* a
particular feature, and are instead flags which say whether we *have* a
particular feature, change their names from USE_* to HAVE_*, to stay
consistent with other variables.
Most of the remaining USE_* flags, KVM, FASTMODEL, SYSTEMC, and
(indirectly) USE_PYTHON, toggle on and off major systems which can have
a significant effect on boot time, or, in the case of FASTMODEL, even
consume external resources which may not be available and which may
break the build.
USE_POSIX_TIMER was also left alone since it selects between two
implementations of some functions. By forcing it to be on or off
depending on the host, we would be forcing some code to be excluded in
either case. That would make that other code impossible to test without
hacking up scons or modifying the host machine.
Change-Id: I0b03f23e65478caefd50cd3516974386e3dbf0db
---
M src/base/SConscript
M src/base/SConsopts
M src/base/fenv.hh
M src/base/imgwriter.cc
M src/base/stats/SConscript
M src/base/stats/SConsopts
M src/dev/net/Ethernet.py
M src/dev/net/SConsopts
M src/dev/net/ethertap.cc
M src/dev/net/ethertap.hh
M src/python/pybind11/stats.cc
11 files changed, 28 insertions(+), 61 deletions(-)
diff --git a/src/base/SConscript b/src/base/SConscript
index d7aa2df..ce11dc7 100644
--- a/src/base/SConscript
+++ b/src/base/SConscript
@@ -42,12 +42,12 @@
Executable('cprintftime', 'cprintftime.cc', 'cprintf.cc')
Source('debug.cc')
GTest('debug.test', 'debug.test.cc', 'debug.cc')
-if env['USE_FENV']:
+if env['HAVE_FENV']:
Source('fenv.cc')
else:
warning("No IEEE FP rounding mode control.\n"
"FP results may deviate slightly from other platforms.")
-if env['USE_PNG']:
+if env['HAVE_PNG']:
env.Append(LIBS=['png'])
Source('pngwriter.cc')
Source('fiber.cc')
diff --git a/src/base/SConsopts b/src/base/SConsopts
index 424789d..15c1f54 100644
--- a/src/base/SConsopts
+++ b/src/base/SConsopts
@@ -32,11 +32,11 @@
conf = gem5_scons.Configure(main)
# Check for <fenv.h> (C99 FP environment control)
-have_fenv = conf.CheckHeader('fenv.h', '<>')
+main['HAVE_FENV'] = conf.CheckHeader('fenv.h', '<>')
# Check for <png.h> (libpng library needed if wanting to dump
# frame buffer image in png format)
-have_png = conf.CheckHeader('png.h', '<>')
+main['HAVE_PNG'] = conf.CheckHeader('png.h', '<>')
have_posix_clock = \
conf.CheckLibWithHeader([None, 'rt'], 'time.h', 'C',
@@ -51,26 +51,9 @@
main = conf.Finish()
-if have_fenv:
- sticky_vars.Add(BoolVariable('USE_FENV', 'Use <fenv.h> IEEE mode
control',
- True))
-else:
- warning("Header file <fenv.h> not found.\n"
- "This host has no IEEE FP rounding mode control.")
- main['USE_FENV'] = False
-
-
-if have_png:
- sticky_vars.Add(BoolVariable('USE_PNG', 'Enable support for PNG
images',
- True))
-else:
- warning("Header file <png.h> not found.\n"
- "This host has no libpng library.\n"
- "Disabling support for PNG framebuffers.")
- main['USE_PNG'] = False
-
sticky_vars.Add(BoolVariable('USE_POSIX_CLOCK', 'Use POSIX Clocks',
have_posix_clock))
-export_vars.extend(['USE_FENV', 'USE_PNG', 'USE_POSIX_CLOCK', 'HAVE_VALGRIND'])
+export_vars.extend([
+ 'HAVE_FENV', 'HAVE_PNG', 'USE_POSIX_CLOCK', 'HAVE_VALGRIND'])
diff --git a/src/base/fenv.hh b/src/base/fenv.hh
index 8801e10..8366720 100644
--- a/src/base/fenv.hh
+++ b/src/base/fenv.hh
@@ -29,7 +29,7 @@
#ifndef __BASE_FENV_HH__
#define __BASE_FENV_HH__
-#include "config/use_fenv.hh"
+#include "config/have_fenv.hh"
namespace Gem5
{
@@ -42,7 +42,7 @@
Upward = 3
};
-#if USE_FENV
+#if HAVE_FENV
void setFpRound(RoundingMode rm);
RoundingMode getFpRound();
@@ -53,7 +53,7 @@
static inline void setFpRound(RoundingMode rm) {}
static inline RoundingMode getFpRound() { return RoundingMode::Downward; }
-#endif // USE_FENV
+#endif // HAVE_FENV
} // namespace Gem5
diff --git a/src/base/imgwriter.cc b/src/base/imgwriter.cc
index abefb7f..8b5550b 100644
--- a/src/base/imgwriter.cc
+++ b/src/base/imgwriter.cc
@@ -39,9 +39,9 @@
#include "base/bmpwriter.hh"
#include "base/logging.hh"
-#include "config/use_png.hh"
+#include "config/have_png.hh"
-#if USE_PNG
+#if HAVE_PNG
#include "base/pngwriter.hh"
#endif
@@ -58,7 +58,7 @@
// available.
M5_FALLTHROUGH;
-#if USE_PNG
+#if HAVE_PNG
case Enums::Png:
return std::unique_ptr<PngWriter>(new PngWriter(fb));
#endif
diff --git a/src/base/stats/SConscript b/src/base/stats/SConscript
index 69ac275..0ed6254 100644
--- a/src/base/stats/SConscript
+++ b/src/base/stats/SConscript
@@ -33,7 +33,7 @@
Source('storage.cc')
Source('text.cc')
-if env['USE_HDF5']:
+if env['HAVE_HDF5']:
if main['GCC']:
Source('hdf5.cc', append={'CXXFLAGS': '-Wno-deprecated-copy'})
else:
diff --git a/src/base/stats/SConsopts b/src/base/stats/SConsopts
index 6e0fd8a..c8e0161 100644
--- a/src/base/stats/SConsopts
+++ b/src/base/stats/SConsopts
@@ -25,8 +25,6 @@
Import('*')
-from gem5_scons import warning
-
import gem5_scons
conf = gem5_scons.Configure(main)
@@ -43,7 +41,7 @@
# include path and library path provided by pkg-config. We perform
# this check even if there isn't a pkg-config configuration for hdf5
# since some installations don't use pkg-config.
-have_hdf5 = \
+main['HAVE_HDF5'] = \
conf.CheckLibWithHeader('hdf5', 'hdf5.h', 'C',
'H5Fcreate("", 0, 0, 0);') and \
conf.CheckLibWithHeader('hdf5_cpp', 'H5Cpp.h', 'C++',
@@ -51,10 +49,4 @@
main = conf.Finish()
-if have_hdf5:
- sticky_vars.Add(BoolVariable('USE_HDF5', 'Enable the HDF5 support',
True))
-else:
- warning("Couldn't find any HDF5 C++ libraries. Disabling HDF5
support.")
- main['USE_HDF5'] = False
-
-export_vars.append('USE_HDF5')
+export_vars.append('HAVE_HDF5')
diff --git a/src/dev/net/Ethernet.py b/src/dev/net/Ethernet.py
index e5c5562..53cc035 100644
--- a/src/dev/net/Ethernet.py
+++ b/src/dev/net/Ethernet.py
@@ -109,7 +109,7 @@
dump = Param.EtherDump(NULL, "dump object")
tap = EtherInt("Ethernet interface to connect to gem5's network")
-if buildEnv['USE_TUNTAP']:
+if buildEnv['HAVE_TUNTAP']:
class EtherTap(EtherTapBase):
type = 'EtherTap'
cxx_header = "dev/net/ethertap.hh"
diff --git a/src/dev/net/SConsopts b/src/dev/net/SConsopts
index ce8b168..e7cd7fd 100644
--- a/src/dev/net/SConsopts
+++ b/src/dev/net/SConsopts
@@ -30,16 +30,8 @@
conf = gem5_scons.Configure(main)
# Check if the TUN/TAP driver is available.
-have_tuntap = conf.CheckHeader('linux/if_tun.h', '<>')
+main['HAVE_TUNTAP'] = conf.CheckHeader('linux/if_tun.h', '<>')
main = conf.Finish()
-if have_tuntap:
- sticky_vars.Add(BoolVariable('USE_TUNTAP',
- 'Enable using a tap device to bridge to the host network',
- True))
-else:
- print("Info: Compatible header file <linux/if_tun.h> not found.")
- main['USE_TUNTAP'] = False
-
-export_vars.append('USE_TUNTAP')
+export_vars.append('HAVE_TUNTAP')
diff --git a/src/dev/net/ethertap.cc b/src/dev/net/ethertap.cc
index 1ac9b66..e78af5c 100644
--- a/src/dev/net/ethertap.cc
+++ b/src/dev/net/ethertap.cc
@@ -37,7 +37,7 @@
#endif
-#if USE_TUNTAP && defined(__linux__)
+#if HAVE_TUNTAP && defined(__linux__)
#if 1 // Hide from the style checker since these have to be out of order.
#include <sys/socket.h> // Has to be included before if.h for some reason.
@@ -395,7 +395,7 @@
}
-#if USE_TUNTAP
+#if HAVE_TUNTAP
EtherTap::EtherTap(const Params &p) : EtherTapBase(p)
{
diff --git a/src/dev/net/ethertap.hh b/src/dev/net/ethertap.hh
index d79cd0a..fb81fc9 100644
--- a/src/dev/net/ethertap.hh
+++ b/src/dev/net/ethertap.hh
@@ -37,11 +37,11 @@
#include <string>
#include "base/pollevent.hh"
-#include "config/use_tuntap.hh"
+#include "config/have_tuntap.hh"
#include "dev/net/etherint.hh"
#include "dev/net/etherpkt.hh"
-#if USE_TUNTAP
+#if HAVE_TUNTAP
#include "params/EtherTap.hh"
#endif
@@ -167,7 +167,7 @@
};
-#if USE_TUNTAP
+#if HAVE_TUNTAP
class EtherTap : public EtherTapBase
{
public:
diff --git a/src/python/pybind11/stats.cc b/src/python/pybind11/stats.cc
index 5d52872..cb3fda5 100644
--- a/src/python/pybind11/stats.cc
+++ b/src/python/pybind11/stats.cc
@@ -38,20 +38,20 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "config/use_hdf5.hh"
-
#include "pybind11/pybind11.h"
#include "pybind11/stl.h"
#include "base/statistics.hh"
#include "base/stats/text.hh"
-#if USE_HDF5
+#include "config/have_hdf5.hh"
+
+#if HAVE_HDF5
#include "base/stats/hdf5.hh"
+
#endif
#include "sim/stat_control.hh"
#include "sim/stat_register.hh"
-
namespace py = pybind11;
static const py::object
@@ -99,7 +99,7 @@
m
.def("initSimStats", &Stats::initSimStats)
.def("initText", &Stats::initText,
py::return_value_policy::reference)
-#if USE_HDF5
+#if HAVE_HDF5
.def("initHDF5", &Stats::initHDF5)
#endif
.def("registerPythonStatsHandlers",
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/40964
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I0b03f23e65478caefd50cd3516974386e3dbf0db
Gerrit-Change-Number: 40964
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s