0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-28 17:52:54 +01:00

Reserve EXTRA_* flag sets for user.

configure: Move unit configuration section above application settings.

configure: -fasm-blocks not yet useful without GCC parity.
This commit is contained in:
Jason Volk 2020-07-30 06:23:31 -07:00
parent 2317ff4ec0
commit 2f6f2af06f
6 changed files with 91 additions and 84 deletions

View file

@ -39,6 +39,7 @@ AC_PROG_MAKE_SET
AC_LANG(C++)
AX_CXX_COMPILE_STDCXX([17], [gnu], [mandatory], 201703)
dnl ***************************************************************************
dnl
dnl Makefile tree
@ -71,6 +72,7 @@ dnl
# mrproper
#])
dnl ***************************************************************************
dnl
dnl Platform
@ -117,6 +119,7 @@ AC_SEARCH_LIBS([__dynamic_cast], [c++], [],
AC_MSG_ERROR([Please install libstdc++ on this system.])
])
dnl ***************************************************************************
dnl
dnl Developer options
@ -464,6 +467,23 @@ AC_ARG_ENABLE(lowmem-compile, RB_HELP_STRING([--enable-lowmem-compile], [Enable
AM_CONDITIONAL([LOWMEM_COMPILE], [[[[ $lowmem_compile = "yes" ]]]])
dnl ***************************************************************************
dnl
dnl Base Build Flags
dnl
dnl
dnl Reserved for user
dnl
dnl ex. `make EXTRA_CXXFLAGS="-Weverything" ircd` to append CXXFLAGS
dnl AC_SUBST(EXTRA_CPPFLAGS, "$EXTRA_CPPFLAGS")
dnl AC_SUBST(EXTRA_CFLAGS, "$EXTRA_CFLAGS")
dnl AC_SUBST(EXTRA_CXXFLAGS, "$EXTRA_CXXFLAGS")
dnl AC_SUBST(EXTRA_LDFLAGS, "$EXTRA_LDFLAGS")
dnl AC_SUBST(EXTRA_LIBS, "$EXTRA_LIBS")
dnl
dnl Gold linker
dnl
@ -503,6 +523,13 @@ dnl RB_VAR_PREPEND([LDFLAGS], ["-Wl,--icf=all"])
AC_MSG_ERROR([Sorry, disabling the gold linker is not supported at this time.])
])
dnl Note compact mode options available in both GOLD and LLD
AM_COND_IF([COMPACT],
[
RB_VAR_PREPEND([LDFLAGS], ["-Wl,--strip-all"])
RB_VAR_PREPEND([LDFLAGS], ["-Wl,--gc-sections"])
])
dnl
dnl Optimization
dnl
@ -1094,9 +1121,16 @@ dnl
AM_COND_IF(MINGW,
[
AC_DEFINE(HAVE_WIN32, [1], [Define to 1 if you are on windows])
LIBS="$LIBS -lws2_32 -liphlpapi"
],[])
RB_VAR_PREPEND([LIBS], ["-lws2_32 -liphlpapi"])
], [
RB_VAR_PREPEND([LIBS], ["-latomic"])
RB_VAR_PREPEND([LIBS], ["-lpthread"])
AM_COND_IF([GCC],
[
RB_VAR_PREPEND([CXXFLAGS], ["-pthread"])
])
])
AM_COND_IF(INTERIX,
[
@ -2213,31 +2247,49 @@ PKG_CHECK_MODULES(LLVM, [LLVM],
AM_CONDITIONAL([LLVM], [test "x$have_libllvm" = "xyes" ])
dnl
dnl
dnl Additional linkages
dnl
dnl
AC_SUBST(EXTRA_CPPFLAGS)
AC_SUBST(EXTRA_CXXFLAGS)
AC_SUBST(EXTRA_LDFLAGS)
AC_SUBST(EXTRA_LIBS)
dnl ***************************************************************************
dnl
dnl Unit configuration macros
dnl
dnl These are used in various Makefiles on certain units which require them.
dnl They are defined here to deduplicate between Makefile.
AM_COND_IF([COMPACT],
dnl Units which require boost::asio use these flags. This includes the
dnl ircd/asio.h PCH, which includes ircd.h upstream in the precompile.
AC_SUBST(ASIO_UNIT_CPPFLAGS)
ASIO_UNIT_CPPFLAGS+=" $BOOST_CPPFLAGS"
ASIO_UNIT_CPPFLAGS+=" $SSL_CPPFLAGS"
ASIO_UNIT_CPPFLAGS+=" $CRYPTO_CPPFLAGS"
ASIO_UNIT_CPPFLAGS+=" -include ircd/asio.h"
dnl Units which include rocksdb headers use these flags.
AC_SUBST(ROCKSDB_UNIT_CPPFLAGS)
ROCKSDB_UNIT_CPPFLAGS+=" $ROCKSDB_CPPFLAGS"
ROCKSDB_UNIT_CPPFLAGS+=" $SNAPPY_CPPFLAGS"
ROCKSDB_UNIT_CPPFLAGS+=" $LZ4_CPPFLAGS"
ROCKSDB_UNIT_CPPFLAGS+=" $Z_CPPFLAGS"
dnl Units defining spirit grammars may benefit from special compiler flags due
dnl to their various complexities. The ./configure may have generated flags
dnl in $GRAMMAR_UNIT_CXXFLAGS to improve compile time and reduce debug symbol.
AC_SUBST(SPIRIT_UNIT_CPPFLAGS)
SPIRIT_UNIT_CPPFLAGS+=" $ICU_CPPFLAGS"
SPIRIT_UNIT_CPPFLAGS+=" $BOOST_CPPFLAGS"
SPIRIT_UNIT_CPPFLAGS+=" -include ircd/spirit.h"
AC_SUBST(SPIRIT_UNIT_CXXFLAGS)
AM_COND_IF([GCC],
[
EXTRA_LDFLAGS+=" -Wl,--strip-all"
EXTRA_LDFLAGS+=" -Wl,--gc-sections"
])
SPIRIT_UNIT_CXXFLAGS+=" -fno-var-tracking"
SPIRIT_UNIT_CXXFLAGS+=" -fno-var-tracking-assignments"
SPIRIT_UNIT_CXXFLAGS+=" -femit-struct-debug-baseonly"
AM_COND_IF([MINGW],
[
], [
EXTRA_LIBS+="-lpthread -latomic"
AM_COND_IF([GCC],
AM_COND_IF([LOWMEM_COMPILE],
[
EXTRA_CXXFLAGS+=" -pthread"
SPIRIT_UNIT_CXXFLAGS+=" --param ggc-min-expand=1"
SPIRIT_UNIT_CXXFLAGS+=" -fno-ipa-pta"
])
])
@ -2272,6 +2324,7 @@ RB_HELP_STRING([--with-mxid-maxlen=LENGTH],[Set the upper-bound mxid length to L
RB_DEFINE_UNQUOTED([MXID_MAXLEN], [$MXID_MAXLEN], [Maximum string length of an MXID (not including null)])
dnl ***************************************************************************
dnl
dnl Branding defined in the compilation
@ -2339,52 +2392,6 @@ AC_ARG_WITH(custom-version, RB_HELP_STRING([--with-custom-version=NAME], [Custom
])
dnl ***************************************************************************
dnl
dnl Unit configuration macros
dnl
dnl These are used in various Makefiles on certain units which require them.
dnl They are defined here to deduplicate between Makefile.
dnl Units which require boost::asio use these flags. This includes the
dnl ircd/asio.h PCH, which includes ircd.h upstream in the precompile.
AC_SUBST(ASIO_UNIT_CPPFLAGS)
ASIO_UNIT_CPPFLAGS+=" $BOOST_CPPFLAGS"
ASIO_UNIT_CPPFLAGS+=" $SSL_CPPFLAGS"
ASIO_UNIT_CPPFLAGS+=" $CRYPTO_CPPFLAGS"
ASIO_UNIT_CPPFLAGS+=" -include ircd/asio.h"
dnl Units which include rocksdb headers use these flags.
AC_SUBST(ROCKSDB_UNIT_CPPFLAGS)
ROCKSDB_UNIT_CPPFLAGS+=" $ROCKSDB_CPPFLAGS"
ROCKSDB_UNIT_CPPFLAGS+=" $SNAPPY_CPPFLAGS"
ROCKSDB_UNIT_CPPFLAGS+=" $LZ4_CPPFLAGS"
ROCKSDB_UNIT_CPPFLAGS+=" $Z_CPPFLAGS"
dnl Units defining spirit grammars may benefit from special compiler flags due
dnl to their various complexities. The ./configure may have generated flags
dnl in $GRAMMAR_UNIT_CXXFLAGS to improve compile time and reduce debug symbol.
AC_SUBST(SPIRIT_UNIT_CPPFLAGS)
SPIRIT_UNIT_CPPFLAGS+=" $ICU_CPPFLAGS"
SPIRIT_UNIT_CPPFLAGS+=" $BOOST_CPPFLAGS"
SPIRIT_UNIT_CPPFLAGS+=" -include ircd/spirit.h"
AC_SUBST(SPIRIT_UNIT_CXXFLAGS)
AM_COND_IF([GCC],
[
SPIRIT_UNIT_CXXFLAGS+=" -fno-var-tracking"
SPIRIT_UNIT_CXXFLAGS+=" -fno-var-tracking-assignments"
SPIRIT_UNIT_CXXFLAGS+=" -femit-struct-debug-baseonly"
AM_COND_IF([LOWMEM_COMPILE],
[
SPIRIT_UNIT_CXXFLAGS+=" --param ggc-min-expand=1"
SPIRIT_UNIT_CXXFLAGS+=" -fno-ipa-pta"
])
])
dnl ***************************************************************************
dnl
dnl Output

View file

@ -2,7 +2,7 @@ prefix = @prefix@
AM_CXXFLAGS = \
-ftls-model=initial-exec \
@EXTRA_CXXFLAGS@ \
$(EXTRA_CXXFLAGS) \
###
AM_CPPFLAGS = \
@ -10,7 +10,7 @@ AM_CPPFLAGS = \
@BOOST_CPPFLAGS@ \
@SSL_CPPFLAGS@ \
@CRYPTO_CPPFLAGS@ \
@EXTRA_CPPFLAGS@ \
$(EXTRA_CPPFLAGS) \
###
AM_LDFLAGS = \
@ -28,7 +28,7 @@ AM_LDFLAGS = \
-L$(top_srcdir)/ircd \
-L$(top_srcdir)/modules \
$(PLATFORM_LDFLAGS) \
@EXTRA_LDFLAGS@ \
$(EXTRA_LDFLAGS) \
###
bin_PROGRAMS = construct
@ -47,7 +47,7 @@ construct_LDADD = \
@SSL_LIBS@ \
@CRYPTO_LIBS@ \
@MALLOC_LIBS@ \
@EXTRA_LIBS@ \
$(EXTRA_LIBS) \
###
construct_SOURCES = \

View file

@ -2,12 +2,12 @@ AUTOMAKE_OPTIONS = foreign
AM_CPPFLAGS = \
-I$(top_srcdir)/include \
@EXTRA_CPPFLAGS@ \
$(EXTRA_CPPFLAGS) \
###
AM_CXXFLAGS = \
-x c++-header \
@EXTRA_CXXFLAGS@ \
$(EXTRA_CXXFLAGS) \
###
if GCC

View file

@ -6,13 +6,13 @@ DEFS += \
AM_CXXFLAGS = \
-ftls-model=initial-exec \
@EXTRA_CXXFLAGS@ \
$(EXTRA_CXXFLAGS) \
###
AM_CPPFLAGS = \
-I$(top_srcdir)/include \
-include ircd/ircd.pic.h \
@EXTRA_CPPFLAGS@ \
$(EXTRA_CPPFLAGS) \
###
AM_LDFLAGS = \
@ -29,7 +29,7 @@ AM_LDFLAGS = \
-Wl,-z,nodlopen \
-Wl,-z,lazy \
$(PLATFORM_LDFLAGS) \
@EXTRA_LDFLAGS@ \
$(EXTRA_LDFLAGS) \
###
if CLANG
@ -96,7 +96,7 @@ libircd_la_LIBADD = \
@LZ4_LIBS@ \
@Z_LIBS@ \
@MALLOC_LIBS@ \
@EXTRA_LIBS@ \
$(EXTRA_LIBS) \
###
#

View file

@ -6,14 +6,14 @@ DEFS += \
###
AM_CXXFLAGS = \
@EXTRA_CXXFLAGS@ \
$(EXTRA_CXXFLAGS) \
###
AM_CPPFLAGS = \
-I$(top_srcdir)/include \
-include ircd/matrix.pic.h \
-include ircd/mods/mapi.h \
@EXTRA_CPPFLAGS@ \
$(EXTRA_CPPFLAGS) \
###
AM_LDFLAGS = \
@ -24,7 +24,7 @@ AM_LDFLAGS = \
-Wl,-z,lazy \
-L$(top_srcdir)/ircd \
$(PLATFORM_LDFLAGS) \
@EXTRA_LDFLAGS@ \
$(EXTRA_LDFLAGS) \
###
AM_LIBS = \

View file

@ -10,14 +10,14 @@ DEFS += \
AM_CXXFLAGS = \
-ftls-model=global-dynamic \
@EXTRA_CXXFLAGS@ \
$(EXTRA_CXXFLAGS) \
###
AM_CPPFLAGS = \
-I$(top_srcdir)/include \
-include $(top_srcdir)/include/ircd/matrix.pic.h \
-include $(top_srcdir)/include/ircd/mods/mapi.h \
@EXTRA_CPPFLAGS@ \
$(EXTRA_CPPFLAGS) \
###
#TODO: split options for if LD_GOLD
@ -29,7 +29,7 @@ AM_LDFLAGS = \
-L$(top_srcdir)/ircd \
-L$(top_srcdir)/matrix \
$(PLATFORM_LDFLAGS) \
@EXTRA_LDFLAGS@ \
$(EXTRA_LDFLAGS) \
###
###############################################################################