diff --git a/configure.ac b/configure.ac index 37c13045..69160d59 100644 --- a/configure.ac +++ b/configure.ac @@ -43,6 +43,10 @@ AX_ADD_FORTIFY_SOURCE AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory]) PKG_PROG_PKG_CONFIG +AC_ARG_ENABLE([stack-protector], + AS_HELP_STRING([--disable-stack-protector], [Disable stack-protector])) +AM_CONDITIONAL([ENABLE_STACK_PROTECTOR], [test x$enable_stack_protector != xno]) + # Checks for libraries. AX_PTHREAD([ LIBS="$PTHREAD_LIBS $LIBS" diff --git a/src/Makefile.am b/src/Makefile.am index 6b523f60..ca30d20f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -138,13 +138,16 @@ powertop_CXXFLAGS = \ -Wformat \ -Wshadow \ -fno-omit-frame-pointer \ - -fstack-protector \ $(GLIB2_CFLAGS) \ $(LIBNL_CFLAGS) \ $(NCURSES_CFLAGS) \ $(PCIUTILS_CFLAGS) \ $(PTHREAD_CFLAGS) +if ENABLE_STACK_PROTECTOR +powertop_CXXFLAGS += \ + -fstack-protector +endif powertop_CPPFLAGS = \ -DLOCALEDIR=\"$(localedir)\" \