diff --git a/build-aux/Makefile.in b/build-aux/Makefile.in index 0424ff39fc..415a8df305 100644 --- a/build-aux/Makefile.in +++ b/build-aux/Makefile.in @@ -5,6 +5,7 @@ top_builddir = @top_builddir@ FLAKE8 = @flake8_path@ RUNUTF8 = @runutf8@ PYTHON = @PYTHON3@ +GREP = @GREP@ # include syntax-check.mk file include $(top_srcdir)/build-aux/syntax-check.mk diff --git a/build-aux/meson.build b/build-aux/meson.build index c506feefd2..c44ed6821c 100644 --- a/build-aux/meson.build +++ b/build-aux/meson.build @@ -10,18 +10,32 @@ syntax_check_conf.set('flake8_path', flake8_path) syntax_check_conf.set('runutf8', ' '.join(runutf8)) syntax_check_conf.set('PYTHON3', python3_prog.path()) + +grep_prog = find_program('grep') + +if host_machine.system() == 'freebsd' + make_prog = find_program('gmake') + + grep_cmd = run_command(grep_prog, '--version') + if grep_cmd.stdout().startswith('grep (BSD grep') + grep_prog = find_program('/usr/local/bin/grep') + grep_cmd = run_command(grep_prog, '--version') + if grep_cmd.stdout().startswith('grep (BSD grep') + error('GNU grep not found') + endif + endif +else + make_prog = find_program('make') +endif + +syntax_check_conf.set('GREP', grep_prog.path()) + configure_file( input: 'Makefile.in', output: '@BASENAME@', configuration: syntax_check_conf, ) -if host_machine.system() == 'freebsd' - make_prog = find_program('gmake') -else - make_prog = find_program('make') -endif - rc = run_command( 'sed', '-n', 's/^\\(sc_[a-zA-Z0-9_-]*\\):.*/\\1/p', diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk index e1ccb74986..2f4f932a5b 100644 --- a/build-aux/syntax-check.mk +++ b/build-aux/syntax-check.mk @@ -27,7 +27,6 @@ ME := build-aux/syntax-check.mk # of the module description. But some packages import this file directly, # ignoring the module description. AWK ?= awk -GREP ?= grep # FreeBSD (and probably some other OSes too) ships own version of sed(1), not # compatible with the GNU sed. GNU sed is available as gsed(1), so use this # instead