File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -679,6 +679,12 @@ jobs:
679679 test -z "$(nm processexecutor.o)"
680680 # TODO: test NO_* defines
681681
682+ - name : Test execinfo.h detection
683+ run : |
684+ make clean
685+ make cli/stacktrace.o | grep HAVE_EXECINFO_H=1
686+ test -n "$(nm cli/stacktrace.o)"
687+
682688 - name : Test testrunner inclusion/exclusion
683689 run : |
684690 ! ./testrunner -d TestUtils | grep -v TestUtils > /dev/null
Original file line number Diff line number Diff line change @@ -155,7 +155,13 @@ else ifneq ($(HAVE_RULES),)
155155 $(error invalid HAVE_RULES value '$(HAVE_RULES)')
156156endif
157157
158- HAVE_EXECINFO_H =$(shell echo "\#include <execinfo.h>" | $(CXX ) -c -xc - 2> /dev/null && echo "1" || echo "0")
158+ # older make versions do not support # in $(shell) and newer ones handle the escape sequence literally
159+ REQUIRE_ESCAPE =$(shell echo "\#define DEF" | $(CXX ) -c -xc - 2> /dev/null && echo "1" || echo "0")
160+ ifeq ($(REQUIRE_ESCAPE ) ,1)
161+ HAVE_EXECINFO_H =$(shell echo "\#include <execinfo.h>" | $(CXX ) -c -xc - 2> /dev/null && echo "1" || echo "0")
162+ else
163+ HAVE_EXECINFO_H =$(shell echo "#include <execinfo.h>" | $(CXX ) -c -xc - 2> /dev/null && echo "1" || echo "0")
164+ endif
159165override CPPFLAGS += -DHAVE_EXECINFO_H=$(HAVE_EXECINFO_H )
160166
161167override CXXFLAGS += $(CXXOPTS )
Original file line number Diff line number Diff line change @@ -771,8 +771,13 @@ int main(int argc, char **argv)
771771 << " $(error invalid HAVE_RULES value '$(HAVE_RULES)')\n "
772772 << " endif\n\n " ;
773773
774- // the # needs to be escaped on older make versions
775- fout << " HAVE_EXECINFO_H=$(shell echo \"\\ #include <execinfo.h>\" | $(CXX) -c -xc - 2> /dev/null && echo \" 1\" || echo \" 0\" )\n "
774+ fout << " # older make versions do not support # in $(shell) and newer ones handle the escape sequence literally\n "
775+ << " REQUIRE_ESCAPE=$(shell echo \"\\ #define DEF\" | $(CXX) -c -xc - 2> /dev/null && echo \" 1\" || echo \" 0\" )\n "
776+ << " ifeq ($(REQUIRE_ESCAPE),1)\n "
777+ << " HAVE_EXECINFO_H=$(shell echo \"\\ #include <execinfo.h>\" | $(CXX) -c -xc - 2> /dev/null && echo \" 1\" || echo \" 0\" )\n "
778+ << " else\n "
779+ << " HAVE_EXECINFO_H=$(shell echo \" #include <execinfo.h>\" | $(CXX) -c -xc - 2> /dev/null && echo \" 1\" || echo \" 0\" )\n "
780+ << " endif\n "
776781 << " override CPPFLAGS += -DHAVE_EXECINFO_H=$(HAVE_EXECINFO_H)\n\n " ;
777782
778783 fout << " override CXXFLAGS += $(CXXOPTS)\n " ;
You can’t perform that action at this time.
0 commit comments