From 8d9c8f162b6cc71ae217ddeef2cef522060bc85e Mon Sep 17 00:00:00 2001 From: Ting-Wei Lan Date: Tue, 21 Apr 2015 03:27:04 +0800 Subject: [PATCH] ax_compiler_flags: Prevent using bash substring expansion Substring expansion such as ${flag:5} is not supported by POSIX, and it can cause error for systems not using bash as their default shell. --- m4/ax_compiler_flags_cflags.m4 | 3 ++- m4/ax_compiler_flags_cxxflags.m4 | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/m4/ax_compiler_flags_cflags.m4 b/m4/ax_compiler_flags_cflags.m4 index 86896c1..5bebe25 100644 --- m4/ax_compiler_flags_cflags.m4 +++ m4/ax_compiler_flags_cflags.m4 @@ -28,6 +28,7 @@ #serial 9 AC_DEFUN([AX_COMPILER_FLAGS_CFLAGS],[ + AC_REQUIRE([AC_PROG_SED]) AX_REQUIRE_DEFINED([AX_APPEND_COMPILE_FLAGS]) AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG]) @@ -119,7 +120,7 @@ AC_DEFUN([AX_COMPILER_FLAGS_CFLAGS],[ AS_CASE([$flag], [-Wno-*=*],[], [-Wno-*],[ - AX_APPEND_COMPILE_FLAGS([-Wno-error=${flag:5}], + AX_APPEND_COMPILE_FLAGS([-Wno-error=$(AS_ECHO([$flag]) | $SED 's/^-Wno-//')], ax_warn_cflags_variable, [$ax_compiler_flags_test]) ]) diff --git a/m4/ax_compiler_flags_cxxflags.m4 b/m4/ax_compiler_flags_cxxflags.m4 index dd3b583..112cb76 100644 --- m4/ax_compiler_flags_cxxflags.m4 +++ m4/ax_compiler_flags_cxxflags.m4 @@ -29,6 +29,7 @@ #serial 5 AC_DEFUN([AX_COMPILER_FLAGS_CXXFLAGS],[ + AC_REQUIRE([AC_PROG_SED]) AX_REQUIRE_DEFINED([AX_APPEND_COMPILE_FLAGS]) AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG]) @@ -115,7 +116,7 @@ AC_DEFUN([AX_COMPILER_FLAGS_CXXFLAGS],[ AS_CASE([$flag], [-Wno-*=*],[], [-Wno-*],[ - AX_APPEND_COMPILE_FLAGS([-Wno-error=${flag:5}], + AX_APPEND_COMPILE_FLAGS([-Wno-error=$(AS_ECHO([$flag]) | $SED 's/^-Wno-//')], ax_warn_cxxflags_variable, [$ax_compiler_flags_test]) ])