M4: add spack external find support (#16693)

This commit is contained in:
Adam J. Stewart 2020-08-14 09:05:30 -05:00 committed by GitHub
parent f901947f69
commit 73fe3ce158
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,7 +3,7 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
import re
class M4(AutotoolsPackage, GNUMirrorPackage):
@ -32,6 +32,18 @@ class M4(AutotoolsPackage, GNUMirrorPackage):
build_directory = 'spack-build'
executables = ['^g?m4$']
@classmethod
def determine_version(cls, exe):
# Output on macOS:
# GNU M4 1.4.6
# Output on Linux:
# m4 (GNU M4) 1.4.18
output = Executable(exe)('--version', output=str, error=str)
match = re.search(r'GNU M4\)?\s+(\S+)', output)
return match.group(1) if match else None
def configure_args(self):
spec = self.spec
args = ['--enable-c++']