Add -faligned-new to CXXFLAGS when available to compile dyninst 10.1 code

Fedora 30 and 31 have Dyninst 10.1.  The code added to dyninst
by commit a00056bec6a0265afb592944dde2ff461b525e8d makes some data
structures cache aligned (128 bytes).  The c++ compiler ends up flagging that
as an error:

  CXX      stap-analysis.o
/notnfs/smakarov/stap-checkout/analysis.cxx: In constructor ‘analysis::analysis(std::string)’:
/notnfs/smakarov/stap-checkout/analysis.cxx:59:37: error: ‘new’ of type ‘Dyninst::ParseAPI::SymtabCodeSource’ with extended alignment 128 [-Werror=aligned-new=]
   59 |  sts = new SymtabCodeSource(name_str);
      |                                     ^
/notnfs/smakarov/stap-checkout/analysis.cxx:59:37: note: uses ‘void* operator new(std::size_t)’, which does not have an alignment parameter
/notnfs/smakarov/stap-checkout/analysis.cxx:59:37: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
cc1plus: all warnings being treated as errors
make[2]: *** [Makefile:1724: stap-analysis.o] Error 1

To make the compiler happy adding a -faligned-new option to the
CXXFLAGS when it is available.  This issue does not affect later
releases of dyninst as the problem code was removed from dyninst in
git commit d233ae7596cd74201d634c2f0f7d7a0e3d628e79.
diff --git a/Makefile.am b/Makefile.am
index 7fd5b2f..3bccd98 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -128,7 +128,7 @@
 PHONIES =
 if BUILD_TRANSLATOR
 stap_CFLAGS = $(AM_CFLAGS) @PIECFLAGS@
-stap_CXXFLAGS = $(AM_CXXFLAGS) @PIECXXFLAGS@
+stap_CXXFLAGS = $(AM_CXXFLAGS) @PIECXXFLAGS@ @ALIGNEDNEW@
 stap_CPPFLAGS = $(AM_CPPFLAGS) -DSTAP_SDT_V2
 stap_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@ @BOOST_SYSTEM_LIB@
 
diff --git a/Makefile.in b/Makefile.in
index 56fc1f3..fe37382 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -452,6 +452,7 @@
 CSCOPE = cscope
 pkglibexecdir = ${libexecdir}/${PACKAGE}
 ACLOCAL = @ACLOCAL@
+ALIGNEDNEW = @ALIGNEDNEW@
 AMTAR = @AMTAR@
 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AR = @AR@
@@ -728,7 +729,8 @@
 @BUILD_TRANSLATOR_TRUE@stap_CFLAGS = $(AM_CFLAGS) @PIECFLAGS@ \
 @BUILD_TRANSLATOR_TRUE@	$(am__append_16)
 @BUILD_TRANSLATOR_TRUE@stap_CXXFLAGS = $(AM_CXXFLAGS) @PIECXXFLAGS@ \
-@BUILD_TRANSLATOR_TRUE@	$(am__append_11) $(am__append_17)
+@BUILD_TRANSLATOR_TRUE@	@ALIGNEDNEW@ $(am__append_11) \
+@BUILD_TRANSLATOR_TRUE@	$(am__append_17)
 @BUILD_TRANSLATOR_TRUE@stap_CPPFLAGS = $(AM_CPPFLAGS) -DSTAP_SDT_V2 \
 @BUILD_TRANSLATOR_TRUE@	$(am__append_12) $(am__append_18)
 @BUILD_TRANSLATOR_TRUE@stap_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@ @BOOST_SYSTEM_LIB@
diff --git a/configure b/configure
index 85ea271..6d0d539 100755
--- a/configure
+++ b/configure
@@ -745,6 +745,7 @@
 PIECXXFLAGS
 PIECFLAGS
 PIELDFLAGS
+ALIGNEDNEW
 HAVE_CXX11
 py3execdir
 python3dir
@@ -10278,6 +10279,56 @@
 
 fi
 
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -faligned-new" >&5
+$as_echo_n "checking whether C++ compiler accepts -faligned-new... " >&6; }
+if ${ax_cv_check_cxxflags___faligned_new+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+  ax_check_save_flags=$CXXFLAGS
+  CXXFLAGS="$CXXFLAGS  -faligned-new"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ax_cv_check_cxxflags___faligned_new=yes
+else
+  ax_cv_check_cxxflags___faligned_new=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  CXXFLAGS=$ax_check_save_flags
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cxxflags___faligned_new" >&5
+$as_echo "$ax_cv_check_cxxflags___faligned_new" >&6; }
+if test "x$ax_cv_check_cxxflags___faligned_new" = xyes; then :
+  ALIGNEDNEW="-faligned-new"
+else
+  ALIGNEDNEW=""
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
 
 
 
diff --git a/configure.ac b/configure.ac
index fdf1688..b0a8236 100644
--- a/configure.ac
+++ b/configure.ac
@@ -190,6 +190,14 @@
   AC_LANG_POP(C++)
   ])
 
+dnl Some versions of dyninst (10.1) need -faligned-new
+dnl If -faligned-new available, pass it in
+AC_LANG_PUSH(C++)
+AX_CHECK_COMPILE_FLAG([-faligned-new], ALIGNEDNEW="-faligned-new", ALIGNEDNEW="")
+AC_LANG_POP(C++)
+
+AC_SUBST(ALIGNEDNEW)
+
 dnl Carry forward some empty PIE*FLAGS so we don't have to modify
 dnl all the Makefile.am's just now.
 AC_SUBST(PIELDFLAGS)
diff --git a/doc/Makefile.in b/doc/Makefile.in
index 82bd5dc..dc8a9a2 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -161,6 +161,7 @@
 DIST_SUBDIRS = $(SUBDIRS)
 pkglibexecdir = @pkglibexecdir@
 ACLOCAL = @ACLOCAL@
+ALIGNEDNEW = @ALIGNEDNEW@
 AMTAR = @AMTAR@
 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AR = @AR@
diff --git a/doc/SystemTap_Tapset_Reference/Makefile.in b/doc/SystemTap_Tapset_Reference/Makefile.in
index ded109a..19a9dae 100644
--- a/doc/SystemTap_Tapset_Reference/Makefile.in
+++ b/doc/SystemTap_Tapset_Reference/Makefile.in
@@ -169,6 +169,7 @@
 CTAGS = ctags
 pkglibexecdir = @pkglibexecdir@
 ACLOCAL = @ACLOCAL@
+ALIGNEDNEW = @ALIGNEDNEW@
 AMTAR = @AMTAR@
 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AR = @AR@
diff --git a/doc/beginners/Makefile.in b/doc/beginners/Makefile.in
index a63c096..b271195 100644
--- a/doc/beginners/Makefile.in
+++ b/doc/beginners/Makefile.in
@@ -127,6 +127,7 @@
 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
 pkglibexecdir = @pkglibexecdir@
 ACLOCAL = @ACLOCAL@
+ALIGNEDNEW = @ALIGNEDNEW@
 AMTAR = @AMTAR@
 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AR = @AR@
@@ -409,8 +410,8 @@
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
 	@echo "it deletes files that may require special tools to rebuild."
-@INSTALL_PREBUILT_DOCS_FALSE@clean-local:
 @INSTALL_PREBUILT_DOCS_FALSE@uninstall-local:
+@INSTALL_PREBUILT_DOCS_FALSE@clean-local:
 @INSTALL_PREBUILT_DOCS_FALSE@install-data-hook:
 clean: clean-am
 
diff --git a/httpd/Makefile.in b/httpd/Makefile.in
index 545c686..2ba877c 100644
--- a/httpd/Makefile.in
+++ b/httpd/Makefile.in
@@ -231,6 +231,7 @@
 DIST_SUBDIRS = $(SUBDIRS)
 pkglibexecdir = @pkglibexecdir@
 ACLOCAL = @ACLOCAL@
+ALIGNEDNEW = @ALIGNEDNEW@
 AMTAR = @AMTAR@
 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AR = @AR@
@@ -936,8 +937,8 @@
 	@echo "This command is intended for maintainers to use"
 	@echo "it deletes files that may require special tools to rebuild."
 	-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
-@HAVE_HTTP_SUPPORT_FALSE@install-data-local:
 @HAVE_HTTP_SUPPORT_FALSE@uninstall-local:
+@HAVE_HTTP_SUPPORT_FALSE@install-data-local:
 clean: clean-recursive
 
 clean-am: clean-generic clean-pkglibexecPROGRAMS mostlyclean-am
diff --git a/httpd/docker/Makefile.in b/httpd/docker/Makefile.in
index 1011ab4..f4f4415 100644
--- a/httpd/docker/Makefile.in
+++ b/httpd/docker/Makefile.in
@@ -173,6 +173,7 @@
 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
 pkglibexecdir = @pkglibexecdir@
 ACLOCAL = @ACLOCAL@
+ALIGNEDNEW = @ALIGNEDNEW@
 AMTAR = @AMTAR@
 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AR = @AR@
diff --git a/java/Makefile.in b/java/Makefile.in
index 589d0c1..d36aac3 100644
--- a/java/Makefile.in
+++ b/java/Makefile.in
@@ -216,6 +216,7 @@
 CTAGS = ctags
 pkglibexecdir = @pkglibexecdir@
 ACLOCAL = @ACLOCAL@
+ALIGNEDNEW = @ALIGNEDNEW@
 AMTAR = @AMTAR@
 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AR = @AR@
@@ -685,9 +686,9 @@
 	@echo "This command is intended for maintainers to use"
 	@echo "it deletes files that may require special tools to rebuild."
 	-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
-@HAVE_JAVA_FALSE@uninstall-local:
-@HAVE_JAVA_FALSE@install-data-local:
 @HAVE_JAVA_FALSE@install-exec-local:
+@HAVE_JAVA_FALSE@install-data-local:
+@HAVE_JAVA_FALSE@uninstall-local:
 clean: clean-am
 
 clean-am: clean-binPROGRAMS clean-generic clean-noinstPROGRAMS \
diff --git a/man/Makefile.in b/man/Makefile.in
index 7f24dd2..2cb753e 100644
--- a/man/Makefile.in
+++ b/man/Makefile.in
@@ -199,6 +199,7 @@
 DIST_SUBDIRS = $(SUBDIRS)
 pkglibexecdir = @pkglibexecdir@
 ACLOCAL = @ACLOCAL@
+ALIGNEDNEW = @ALIGNEDNEW@
 AMTAR = @AMTAR@
 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AR = @AR@
diff --git a/man/cs/Makefile.in b/man/cs/Makefile.in
index e503170..168a1be 100644
--- a/man/cs/Makefile.in
+++ b/man/cs/Makefile.in
@@ -163,6 +163,7 @@
 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
 pkglibexecdir = @pkglibexecdir@
 ACLOCAL = @ACLOCAL@
+ALIGNEDNEW = @ALIGNEDNEW@
 AMTAR = @AMTAR@
 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AR = @AR@
diff --git a/python/Makefile.in b/python/Makefile.in
index fe067da..d696a0e 100644
--- a/python/Makefile.in
+++ b/python/Makefile.in
@@ -170,6 +170,7 @@
 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
 pkglibexecdir = @pkglibexecdir@
 ACLOCAL = @ACLOCAL@
+ALIGNEDNEW = @ALIGNEDNEW@
 AMTAR = @AMTAR@
 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AR = @AR@
@@ -530,8 +531,8 @@
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
 	@echo "it deletes files that may require special tools to rebuild."
-@HAVE_PYTHON_PROBES_FALSE@install-exec-local:
 @HAVE_PYTHON_PROBES_FALSE@clean-local:
+@HAVE_PYTHON_PROBES_FALSE@install-exec-local:
 clean: clean-am
 
 clean-am: clean-generic clean-local mostlyclean-am
diff --git a/stap-exporter/Makefile.in b/stap-exporter/Makefile.in
index 370115a..70c0a38 100644
--- a/stap-exporter/Makefile.in
+++ b/stap-exporter/Makefile.in
@@ -160,6 +160,7 @@
 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
 pkglibexecdir = @pkglibexecdir@
 ACLOCAL = @ACLOCAL@
+ALIGNEDNEW = @ALIGNEDNEW@
 AMTAR = @AMTAR@
 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AR = @AR@
@@ -523,8 +524,8 @@
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
 	@echo "it deletes files that may require special tools to rebuild."
-@HAVE_PYTHON3_PROBES_FALSE@clean-local:
 @HAVE_PYTHON3_PROBES_FALSE@uninstall-local:
+@HAVE_PYTHON3_PROBES_FALSE@clean-local:
 @HAVE_PYTHON3_PROBES_FALSE@install-data-local:
 clean: clean-am
 
diff --git a/stapbpf/Makefile.in b/stapbpf/Makefile.in
index 9c4ce4b..cd21a6c1 100644
--- a/stapbpf/Makefile.in
+++ b/stapbpf/Makefile.in
@@ -228,6 +228,7 @@
 CTAGS = ctags
 pkglibexecdir = @pkglibexecdir@
 ACLOCAL = @ACLOCAL@
+ALIGNEDNEW = @ALIGNEDNEW@
 AMTAR = @AMTAR@
 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AR = @AR@
diff --git a/stapdyn/Makefile.in b/stapdyn/Makefile.in
index 09621af..aebe842 100644
--- a/stapdyn/Makefile.in
+++ b/stapdyn/Makefile.in
@@ -231,6 +231,7 @@
 CTAGS = ctags
 pkglibexecdir = @pkglibexecdir@
 ACLOCAL = @ACLOCAL@
+ALIGNEDNEW = @ALIGNEDNEW@
 AMTAR = @AMTAR@
 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AR = @AR@
diff --git a/staprun/Makefile.in b/staprun/Makefile.in
index 6741b51..d20795e 100644
--- a/staprun/Makefile.in
+++ b/staprun/Makefile.in
@@ -280,6 +280,7 @@
 CTAGS = ctags
 pkglibexecdir = @pkglibexecdir@
 ACLOCAL = @ACLOCAL@
+ALIGNEDNEW = @ALIGNEDNEW@
 AMTAR = @AMTAR@
 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AR = @AR@