Gabe Black has submitted this change. (
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
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40964
Reviewed-by: Gabe Black <[email protected]>
Maintainer: Gabe Black <[email protected]>
Tested-by: kokoro <[email protected]>
---
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, 40 insertions(+), 59 deletions(-)
Approvals:
Gabe Black: Looks good to me, approved; Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/base/SConscript b/src/base/SConscript
index 4242f9a..94f8398 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 e56e9ba..9b301c3 100644
--- a/src/base/SConsopts
+++ b/src/base/SConsopts
@@ -30,13 +30,21 @@
import gem5_scons
with gem5_scons.Configure(main) as conf:
-
# Check for <fenv.h> (C99 FP environment control)
- have_fenv = conf.CheckHeader('fenv.h', '<>')
+ conf.env['HAVE_FENV'] = conf.CheckHeader('fenv.h', '<>')
+
+ if not conf.env['HAVE_FENV']:
+ warning("Header file <fenv.h> not found.\n"
+ "This host has no IEEE FP rounding mode control.")
# Check for <png.h> (libpng library needed if wanting to dump
# frame buffer image in png format)
- have_png = conf.CheckHeader('png.h', '<>')
+ conf.env['HAVE_PNG'] = conf.CheckHeader('png.h', '<>')
+
+ if not conf.env['HAVE_PNG']:
+ warning("Header file <png.h> not found.\n"
+ "This host has no libpng library.\n"
+ "Disabling support for PNG framebuffers.")
have_posix_clock = \
conf.CheckLibWithHeader([None, 'rt'], 'time.h', 'C',
@@ -49,26 +57,9 @@
conf.env['HAVE_VALGRIND'] = conf.CheckCHeader('valgrind/valgrind.h')
-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 fbd0d5b..cb6fc0f 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();
@@ -57,7 +57,7 @@
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 6981418..1e275fa 100644
--- a/src/base/stats/SConscript
+++ b/src/base/stats/SConscript
@@ -34,7 +34,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 6fc9f67..0869a83 100644
--- a/src/base/stats/SConsopts
+++ b/src/base/stats/SConsopts
@@ -26,11 +26,9 @@
Import('*')
from gem5_scons import warning
-
import gem5_scons
with gem5_scons.Configure(main) as conf:
-
# Check if there is a pkg-config configuration for hdf5. If we find
# it, setup the environment to enable linking and header inclusion. We
# don't actually try to include any headers or link with hdf5 at this
@@ -43,16 +41,13 @@
# 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 = \
+ conf.env['HAVE_HDF5'] = \
conf.CheckLibWithHeader('hdf5', 'hdf5.h', 'C',
'H5Fcreate("", 0, 0, 0);') and \
conf.CheckLibWithHeader('hdf5_cpp', 'H5Cpp.h', 'C++',
'H5::H5File("", 0);')
-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
+ if not conf.env['HAVE_HDF5']:
+ warning("Couldn't find HDF5 C++ libraries. Disabling HDF5
support.")
-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 1bb78da..874c06e 100644
--- a/src/dev/net/SConsopts
+++ b/src/dev/net/SConsopts
@@ -29,14 +29,9 @@
with gem5_scons.Configure(main) as conf:
# Check if the TUN/TAP driver is available.
- have_tuntap = conf.CheckHeader('linux/if_tun.h', '<>')
+ conf.env['HAVE_TUNTAP'] = conf.CheckHeader('linux/if_tun.h', '<>')
-if have_tuntap:
- sticky_vars.Add(BoolVariable('USE_TUNTAP',
- 'Enable using a tap device to bridge to the host network',
- True))
-else:
+if not main['HAVE_TUNTAP']:
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 eb67fa3..feac79d 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
@@ -155,7 +155,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 f1b1e9c..faa2f0e 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
@@ -106,7 +106,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: 22
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Bobby R. Bruce <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Giacomo Travaglini <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-CC: Andreas Sandberg <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s