Gabe Black has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/40865 )

Change subject: scons: Simplify the check for hdf5 support.
......................................................................

scons: Simplify the check for hdf5 support.

Collapse the check_hdf5 to the only place it was called, to set a simple
flag variable. Pull the invariant have_pkg_config check out of
check_hdf5_pkg, since if we don't have pkg-config there's no reason to
even try to use to set up hdf5. Turn the one-off, non-standard "Warning"
print into an actual warning().

Change-Id: I04793ae862aeaf1605467d205837b9dd744f93cb
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40865
Tested-by: kokoro <[email protected]>
Maintainer: Gabe Black <[email protected]>
Reviewed-by: Andreas Sandberg <[email protected]>
---
M SConstruct
1 file changed, 11 insertions(+), 18 deletions(-)

Approvals:
  Andreas Sandberg: Looks good to me, approved
  Gabe Black: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/SConstruct b/SConstruct
index a3c330f..9e3af37 100755
--- a/SConstruct
+++ b/SConstruct
@@ -724,42 +724,35 @@
 main['HAVE_PERF_ATTR_EXCLUDE_HOST'] = conf.CheckMember(
     'linux/perf_event.h', 'struct perf_event_attr', 'exclude_host')

-def check_hdf5():
-    return \
-        conf.CheckLibWithHeader('hdf5', 'hdf5.h', 'C',
-                                'H5Fcreate("", 0, 0, 0);') and \
-        conf.CheckLibWithHeader('hdf5_cpp', 'H5Cpp.h', 'C++',
-                                'H5::H5File("", 0);')
-
 def check_hdf5_pkg(name):
     print("Checking for %s using pkg-config..." % name, end="")
-    if not have_pkg_config:
-        print(" pkg-config not found")
-        return False
-
     try:
main.ParseConfig('pkg-config --cflags-only-I --libs-only-L %s' % name)
-        print(" yes")
-        return True
     except:
         print(" no")
         return False
+    print(" yes")
+    return True

 # 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
 # stage.
-if not check_hdf5_pkg('hdf5-serial'):
-    check_hdf5_pkg('hdf5')
+if have_pkg_config:
+    if not check_hdf5_pkg('hdf5-serial'):
+        check_hdf5_pkg('hdf5')

 # Check if the HDF5 libraries can be found. This check respects the
 # 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 = check_hdf5()
+have_hdf5 = \
+        conf.CheckLibWithHeader('hdf5', 'hdf5.h', 'C',
+                                'H5Fcreate("", 0, 0, 0);') and \
+        conf.CheckLibWithHeader('hdf5_cpp', 'H5Cpp.h', 'C++',
+                                'H5::H5File("", 0);')
 if not have_hdf5:
-    print("Warning: Couldn't find any HDF5 C++ libraries. Disabling")
-    print("         HDF5 support.")
+ warning("Couldn't find any HDF5 C++ libraries. Disabling HDF5 support.")

 ######################################################################
 #



The change was submitted with unreviewed changes in the following files:

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/40865
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: I04793ae862aeaf1605467d205837b9dd744f93cb
Gerrit-Change-Number: 40865
Gerrit-PatchSet: 8
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: kokoro <[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

Reply via email to