Skip to content

Commit

Permalink
Merge branch 'patch/fix-build' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
AkarinVS committed Jul 27, 2021
2 parents 369a60d + e2bed54 commit b967d55
Show file tree
Hide file tree
Showing 114 changed files with 7,944 additions and 5,075 deletions.
69 changes: 62 additions & 7 deletions build/unix/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,10 +1,54 @@
ACLOCAL_AMFLAGS = -I m4

warningflags = -Wall -Wextra -Wshadow -Wno-expansion-to-defined -Wno-missing-field-initializers
warningflags = \
-Wall \
-Wextra \
-Wshadow \
-Wunused \
-Wnull-dereference \
-Wvla \
-Wstrict-aliasing \
-Wuninitialized \
-Wunused-parameter \
-Wreorder \
-Wsign-compare \
-Wunreachable-code \
-Wconversion \
-Wno-sign-conversion \
$(COMPWARNFLAGS)

if CLG

# Clang
warningflags += \
-Wshadow-all \
-Wshorten-64-to-32 \
-Wint-conversion \
-Wconditional-uninitialized \
-Wconstant-conversion \
-Wunused-private-field \
-Wbool-conversion \
-Wextra-semi \
-Wnullable-to-nonnull-conversion \
-Wno-unused-private-field \
-Wno-unused-command-line-argument
# -Wzero-as-null-pointer-constant

else

# GCC
warningflags += \
-Wredundant-decls \
-Wno-ignored-attributes \
-Wno-expansion-to-defined

endif

warnflagscpp =
includeflags = -I$(srcdir)/../../src
commonflags = $(DEBUGCFLAGS) $(MFLAGS) $(warningflags) $(includeflags)
AM_CXXFLAGS = -std=$(CXXSTD) $(commonflags)
AM_LDFLAGS = $(PLUGINLDFLAGS)
commoncflags = $(DEBUGCFLAGS) $(MFLAGS) $(warningflags) $(includeflags) $(STACKREALIGN)
AM_CXXFLAGS = -std=$(CXXSTD) $(commoncflags) $(warnflagscpp) $(EXTRA_CXXFLAGS)
AM_LDFLAGS = $(PLUGINLDFLAGS)

lib_LTLIBRARIES = libfmtconv.la

Expand Down Expand Up @@ -52,8 +96,6 @@ libfmtconv_la_SOURCES = \
../../src/conc/ObjPool.h \
../../src/conc/ObjPool.hpp \
../../src/ffft/def.h \
../../src/ffft/DynArray.h \
../../src/ffft/DynArray.hpp \
../../src/ffft/FFTReal.h \
../../src/ffft/FFTReal.hpp \
../../src/ffft/OscSinCos.h \
Expand Down Expand Up @@ -129,6 +171,8 @@ libfmtconv_la_SOURCES = \
../../src/fmtcl/DiscreteFirCustom.h \
../../src/fmtcl/DiscreteFirInterface.cpp \
../../src/fmtcl/DiscreteFirInterface.h \
../../src/fmtcl/Dither.cpp \
../../src/fmtcl/Dither.h \
../../src/fmtcl/ErrDifBuf.cpp \
../../src/fmtcl/ErrDifBuf.h \
../../src/fmtcl/ErrDifBuf.hpp \
Expand All @@ -138,6 +182,7 @@ libfmtconv_la_SOURCES = \
../../src/fmtcl/FilterResize.h \
../../src/fmtcl/fnc.cpp \
../../src/fmtcl/fnc.h \
../../src/fmtcl/InterlacingType.h \
../../src/fmtcl/KernelData.cpp \
../../src/fmtcl/KernelData.h \
../../src/fmtcl/Mat3.h \
Expand All @@ -150,9 +195,14 @@ libfmtconv_la_SOURCES = \
../../src/fmtcl/MatrixProc.cpp \
../../src/fmtcl/MatrixProc.h \
../../src/fmtcl/MatrixProc_macro.h \
../../src/fmtcl/MatrixUtil.cpp \
../../src/fmtcl/MatrixUtil.h \
../../src/fmtcl/MatrixWrap.h \
../../src/fmtcl/MatrixWrap.hpp \
../../src/fmtcl/PicFmt.h \
../../src/fmtcl/PrimariesPreset.h \
../../src/fmtcl/PrimUtil.cpp \
../../src/fmtcl/PrimUtil.h \
../../src/fmtcl/Proxy.h \
../../src/fmtcl/Proxy.hpp \
../../src/fmtcl/ProxyRwCpp.h \
Expand All @@ -163,8 +213,11 @@ libfmtconv_la_SOURCES = \
../../src/fmtcl/ReadWrapperFlt.hpp \
../../src/fmtcl/ReadWrapperInt.h \
../../src/fmtcl/ReadWrapperInt.hpp \
../../src/fmtcl/ResamplePlaneData.h \
../../src/fmtcl/ResampleSpecPlane.cpp \
../../src/fmtcl/ResampleSpecPlane.h \
../../src/fmtcl/ResampleUtil.cpp \
../../src/fmtcl/ResampleUtil.h \
../../src/fmtcl/ResizeData.cpp \
../../src/fmtcl/ResizeData.h \
../../src/fmtcl/ResizeData.hpp \
Expand Down Expand Up @@ -212,6 +265,8 @@ libfmtconv_la_SOURCES = \
../../src/fmtcl/TransOpSLog.h \
../../src/fmtcl/TransOpSLog3.cpp \
../../src/fmtcl/TransOpSLog3.h \
../../src/fmtcl/TransUtil.cpp \
../../src/fmtcl/TransUtil.h \
../../src/fmtcl/Vec3.h \
../../src/fmtcl/Vec3.hpp \
../../src/fmtcl/VoidAndCluster.cpp \
Expand All @@ -223,7 +278,7 @@ libfmtconv_la_SOURCES = \
../../src/fstb/CpuId.cpp \
../../src/fstb/CpuId.h \
../../src/fstb/def.h \
../../src/fstb/fnc.cpp \
../../src/fstb/fnc_fstb.cpp \
../../src/fstb/fnc.h \
../../src/fstb/fnc.hpp \
../../src/fstb/SingleObj.h \
Expand Down
101 changes: 72 additions & 29 deletions build/unix/configure.ac
Original file line number Diff line number Diff line change
@@ -1,37 +1,31 @@
AC_INIT([fmtconv], [r22], [http://forum.doom9.org/showthread.php?t=166504], [fmtconv], [http://forum.doom9.org/showthread.php?t=166504])
AC_INIT([fmtconv], [r23], [http://forum.doom9.org/showthread.php?t=166504], [fmtconv], [http://forum.doom9.org/showthread.php?t=166504])
AC_CONFIG_MACRO_DIR([m4])

AM_INIT_AUTOMAKE([foreign no-dist-gzip dist-xz subdir-objects no-define])
AM_SILENT_RULES([yes])

LT_INIT([win32-dll disable-static])

: ${CXXFLAGS=""}
: ${CFLAGS=""}

AC_PROG_CXX
AC_PROG_CC

AC_CANONICAL_HOST

AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug], [Compilation options required for debugging. [default=no]]))
AC_ARG_ENABLE([clang], AS_HELP_STRING([--enable-clang], [Use Clang as compiler along with libc++. [default=no]]))

AC_LANG_PUSH([C++])
AS_IF([test "x$CXXSTD" = "x"], AX_CHECK_COMPILE_FLAG([-std=c++17], [CXXSTD="c++17"]))
AS_IF([test "x$CXXSTD" = "x"], AX_CHECK_COMPILE_FLAG([-std=c++11], [CXXSTD="c++11"]))
AS_IF([test "x$CXXSTD" = "x"], AC_MSG_ERROR([Minimum requirement: C++11]))
AX_CHECK_COMPILE_FLAG([-Wunused-private-field] , [CXXFLAGS="$CXXFLAGS -Wno-unused-private-field"] , , [-Werror])
AX_CHECK_COMPILE_FLAG([-Wunused-command-line-argument], [CXXFLAGS="$CXXFLAGS -Wno-unused-command-line-argument"], , [-Werror])
AC_LANG_POP([C++])

# It seems that -latomic is needed only for some versions of GCC < 5.3
AX_CHECK_LINK_FLAG([-latomic], [LIBS="$LIBS -latomic"])

AS_IF(
[test "x$enable_debug" = "xyes"],
[DEBUGCFLAGS="-O0 -g3 -ggdb"],
[DEBUGCFLAGS="-O3 -g3 -DNDEBUG"]
)

X86="false"
PPC="false"
ARM="false"
WIN="false"
UNX="false"
MAC="false"
CLG="false"

AS_CASE(
[$host_cpu],
Expand All @@ -44,21 +38,62 @@ AS_CASE(

AS_CASE(
[$host_os],
[cygwin*|mingw*],
[AS_IF(
[test "x$BITS" = "x32"],
[
PLUGINLDFLAGS="-Wl,--kill-at"
STACKREALIGN="-mstackrealign"
]
)]
[cygwin*|mingw*], [WIN="true"],
[darwin*], [MAC="true"],
[*linux*|gnu*|dragonfly*|*bsd*], [UNX="true"]
)

AS_IF(
[test "x$X86" = "xtrue"],
[test "x$enable_debug" = "xyes"],
[
DEBUGCFLAGS="-O0 -g3 -ggdb"
AC_MSG_NOTICE([Debug mode enabled.])
],
[DEBUGCFLAGS="-O3 -g3 -DNDEBUG"]
)

AS_IF(
[test "x$enable_clang" = "xyes"],
[
CLG="true"
CXX="clang++"
CC="clang"
LD="clang++"
MFLAGS="$MFLAGS -fexperimental-new-pass-manager -mllvm -inline-threshold=1000"
COMPWARNFLAGS=""
AC_MSG_NOTICE([Using clang as compiler.])
],
[COMPWARNFLAGS="-Wduplicated-cond -Wduplicated-branches -Wlogical-op"]
)

AC_LANG_PUSH([C++])
#AS_IF([test "x$CXXSTD" = "x"], AX_CHECK_COMPILE_FLAG([-std=c++20], [CXXSTD="c++20"]))
#AS_IF([test "x$CXXSTD" = "x"], AX_CHECK_COMPILE_FLAG([-std=c++17], [CXXSTD="c++17"]))
AS_IF([test "x$CXXSTD" = "x"], AX_CHECK_COMPILE_FLAG([-std=c++14], [CXXSTD="c++14"]))
AS_IF([test "x$CXXSTD" = "x"], AC_MSG_ERROR([Minimum requirement: C++14]))
AC_LANG_POP([C++])

# It seems that -latomic is needed only for some versions of GCC < 5.3
AX_CHECK_LINK_FLAG([-latomic], [LIBS="$LIBS -latomic"])

AS_IF(
[test "x$WIN" = "xtrue"],
[
MFLAGS="-mfpmath=sse -msse2 -Wno-ignored-attributes"
AS_IF(
[test "x$BITS" = "x32"],
[
PLUGINLDFLAGS="-Wl,--kill-at"
STACKREALIGN="-mstackrealign"
]
)
]
)

AS_IF(
[test "x$X86" = "xtrue"],
[
MFLAGS="$MFLAGS -mfpmath=sse -msse2"
COMPWARNFLAGS="$COMPWARNFLAGS -Wno-ignored-attributes"
# We need this to use CMPXCHG16B for 2x64-bit CAS (compare and swap)
AS_IF([test "x$BITS" = "x64"], [MFLAGS="$MFLAGS -mcx16"])
]
Expand All @@ -72,19 +107,27 @@ AS_IF(
AX_CHECK_COMPILE_FLAG([-mfpu=neon], [MFLAGS="$MFLAGS -mfpu=neon"])
# GCC 7 emits some warnings about ABI changes when using std::vector
AX_CHECK_COMPILE_FLAG([-Wpsabi -Werror], [MFLAGS="$MFLAGS -Wno-psabi"])
AX_CHECK_COMPILE_FLAG([-Wpsabi], [COMPWARNFLAGS="$COMPWARNFLAGS -Wno-psabi"], , [-Werror])
]
)

AX_CHECK_COMPILE_FLAG([-Wmisleading-indentation] , [COMPWARNFLAGS="$COMPWARNFLAGS -Wmisleading-indentation"] , , [-Werror])
# Clang only
AX_CHECK_COMPILE_FLAG([-Wno-implicit-int-float-conversion], [COMPWARNFLAGS="$COMPWARNFLAGS -Wno-implicit-int-float-conversion"], , [-Werror])

AC_SUBST([CXXSTD])
AC_SUBST([EXTRA_CXXFLAGS])
AC_SUBST([LDFLAGS])
AC_SUBST([MFLAGS])
AC_SUBST([DEBUGCFLAGS])
AC_SUBST([CXXSTD])
AC_SUBST([PLUGINLDFLAGS])
AC_SUBST([STACKREALIGN])

AM_CONDITIONAL([X86], [test "x$X86" = "xtrue"])
AM_CONDITIONAL([ARM], [test "x$ARM" = "xtrue"])

AM_CONDITIONAL([UNX], [test "x$UNX" = "xtrue"])
AM_CONDITIONAL([WIN], [test "x$WIN" = "xtrue"])
AM_CONDITIONAL([CLG], [test "x$CLG" = "xtrue"])

AC_CONFIG_FILES([Makefile])
AC_OUTPUT
Loading

0 comments on commit b967d55

Please sign in to comment.