diff --git a/.gitignore b/.gitignore index 914d1d77639..e3e5969df1d 100644 --- a/.gitignore +++ b/.gitignore @@ -78,6 +78,7 @@ src/tscore/ink_autoconf.h.in include/tscore/ink_config.h include/ts/apidefs.h src/tscore/CompileParseRules +src/tscore/CompileParseRules.dSYM src/tscore/ParseRulesCType src/tscore/ParseRulesCTypeToLower src/tscore/ParseRulesCTypeToUpper diff --git a/build/ax_cc_for_build.m4 b/build/ax_cc_for_build.m4 new file mode 100644 index 00000000000..42b0629de97 --- /dev/null +++ b/build/ax_cc_for_build.m4 @@ -0,0 +1,76 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_cc_for_build.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CC_FOR_BUILD +# +# DESCRIPTION +# +# Find a build-time compiler. Sets CC_FOR_BUILD and EXEEXT_FOR_BUILD. +# +# LICENSE +# +# Copyright (c) 2010 Reuben Thomas +# Copyright (c) 1999 Richard Henderson +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 3 + +dnl Get a default for CC_FOR_BUILD to put into Makefile. +AC_DEFUN([AX_CC_FOR_BUILD], +[# Put a plausible default for CC_FOR_BUILD in Makefile. +if test -z "$CC_FOR_BUILD"; then + CC_FOR_BUILD='$(CC)' + CXX_FOR_BUILD='$(CXX)' +fi +AC_SUBST(CC_FOR_BUILD) +AC_SUBST(CXX_FOR_BUILD) + +# Also set EXEEXT_FOR_BUILD. +if test "x$cross_compiling" = "xno"; then + EXEEXT_FOR_BUILD='$(EXEEXT)' +else + AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext, + [rm -f conftest* + echo 'int main () { return 0; }' > conftest.c + bfd_cv_build_exeext= + ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5 + for file in conftest.*; do + case $file in + *.c | *.o | *.obj | *.ilk | *.pdb) ;; + *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;; + esac + done + rm -f conftest* + test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no]) + EXEEXT_FOR_BUILD="" + test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext} +fi +AC_SUBST(EXEEXT_FOR_BUILD)])dnl diff --git a/build/crypto.m4 b/build/crypto.m4 index b7bb9c62a5a..3d5ab0ed20e 100644 --- a/build/crypto.m4 +++ b/build/crypto.m4 @@ -45,7 +45,8 @@ dnl Check OpenSSL Version dnl AC_DEFUN([TS_CHECK_CRYPTO_VERSION], [ AC_MSG_CHECKING([OpenSSL version]) - AC_RUN_IFELSE([AC_LANG_SOURCE([[ + AC_RUN_IFELSE([AC_LANG_SOURCE( + [ #include int main() { if (OPENSSL_VERSION_NUMBER < 0x1000200fL) { @@ -53,7 +54,9 @@ int main() { } return 0; } -]])],[AC_MSG_RESULT([ok])],[AC_MSG_FAILURE([requires OpenSSL version 1.0.2 or greater])],[]) + ])], + [AC_MSG_RESULT([ok])], [AC_MSG_FAILURE([requires OpenSSL version 1.0.2 or greater])], [AC_MSG_RESULT([assuming ok])] + ) ]) dnl diff --git a/configure.ac b/configure.ac index 86f7f4f4b0b..b0352c4e62d 100644 --- a/configure.ac +++ b/configure.ac @@ -640,6 +640,8 @@ AM_PROG_AS AX_COMPILER_VENDOR +AX_CC_FOR_BUILD + CFLAGS="${_ts_saved_CFLAGS}" CXXFLAGS="${_ts_saved_CXXFLAGS}" diff --git a/mgmt/api/Makefile.am b/mgmt/api/Makefile.am index 0ddd113b49d..40890dc861a 100644 --- a/mgmt/api/Makefile.am +++ b/mgmt/api/Makefile.am @@ -67,7 +67,7 @@ libmgmtapilocal_la_LIBADD = \ libmgmtapi.la \ $(top_builddir)/src/tscore/libtscore.la -libtsmgmt_la_LDFLAGS = -no-undefined -version-info @TS_LIBTOOL_VERSION@ +libtsmgmt_la_LDFLAGS = @AM_LDFLAGS@ -no-undefined -version-info @TS_LIBTOOL_VERSION@ libtsmgmt_la_LIBADD = @LIBOBJS@ \ libmgmtapi.la \ $(top_builddir)/src/tscore/libtscore.la \ diff --git a/src/tscore/Makefile.am b/src/tscore/Makefile.am index a1cef02d0a4..371dc1d40df 100644 --- a/src/tscore/Makefile.am +++ b/src/tscore/Makefile.am @@ -27,6 +27,8 @@ endif TESTS_ENVIRONMENT = LSAN_OPTIONS=suppressions=$(abs_top_srcdir)/ci/asan_leak_suppression/unit_tests.txt +BUILT_SOURCES = ParseRules.cc + TESTS = $(check_PROGRAMS) lib_LTLIBRARIES = libtscore.la @@ -38,7 +40,7 @@ AM_CPPFLAGS += \ $(TS_INCLUDES) \ @YAMLCPP_INCLUDES@ -libtscore_la_LDFLAGS = -no-undefined -version-info @TS_LIBTOOL_VERSION@ @YAMLCPP_LDFLAGS@ +libtscore_la_LDFLAGS = @AM_LDFLAGS@ -no-undefined -version-info @TS_LIBTOOL_VERSION@ @YAMLCPP_LDFLAGS@ libtscore_la_LIBADD = \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ @HWLOC_LIBS@ \ @@ -205,6 +207,9 @@ freelist_benchmark_SOURCES = unit_tests/freelist_benchmark.cc CompileParseRules_SOURCES = CompileParseRules.cc +CompileParseRules$(BUILD_EXEEXT): $(CompileParseRules_OBJECTS) + $(CXX_FOR_BUILD) $(AM_CXXFLAGS) -I$(top_builddir)/include -I$(abs_top_srcdir)/include -o $@ $(abs_top_srcdir)/src/tscore/CompileParseRules.cc + clean-local: rm -f ParseRulesCType ParseRulesCTypeToLower ParseRulesCTypeToUpper diff --git a/src/tscpp/util/Makefile.am b/src/tscpp/util/Makefile.am index 07351fde45c..40139bf24fb 100644 --- a/src/tscpp/util/Makefile.am +++ b/src/tscpp/util/Makefile.am @@ -26,7 +26,7 @@ lib_LTLIBRARIES = libtscpputil.la AM_CPPFLAGS += -I$(abs_top_srcdir)/include -libtscpputil_la_LDFLAGS = -no-undefined -version-info @TS_LIBTOOL_VERSION@ +libtscpputil_la_LDFLAGS = @AM_LDFLAGS@ -no-undefined -version-info @TS_LIBTOOL_VERSION@ libtscpputil_la_SOURCES = \ TextView.cc