2017-11-09 02:22:10 +08:00
|
|
|
dnl Process this file with autoconf 2.69 or later to produce
|
2002-05-19 10:26:38 +08:00
|
|
|
dnl a configure script.
|
2017-11-09 02:22:10 +08:00
|
|
|
AC_PREREQ(2.69)
|
2019-10-04 12:32:08 +08:00
|
|
|
AC_INIT([config/config.h.in])
|
|
|
|
AC_CONFIG_HEADERS([config/config.h])
|
2002-05-01 04:53:16 +08:00
|
|
|
AC_PREFIX_PROGRAM(nasm)
|
2019-02-22 17:13:52 +08:00
|
|
|
AC_CONFIG_AUX_DIR(autoconf/helpers)
|
2002-05-01 04:53:16 +08:00
|
|
|
|
2017-03-02 04:57:46 +08:00
|
|
|
dnl Save initial CFLAGS, to see if -g -O2 came from configure or not
|
|
|
|
pa_init_cflags="$CFLAGS"
|
|
|
|
|
2017-04-07 06:24:58 +08:00
|
|
|
dnl This prevents us from running Wine and thinking we are not
|
|
|
|
dnl cross-compiling when in fact we are; running Wine here is at
|
|
|
|
dnl the best very slow and doesn't buy us a single thing at all.
|
|
|
|
WINELOADER=/dev/null
|
|
|
|
export WINELOADER
|
|
|
|
|
2020-05-27 05:13:31 +08:00
|
|
|
dnl Get the canonical target system name
|
|
|
|
AC_CANONICAL_HOST
|
|
|
|
|
2017-03-02 04:57:46 +08:00
|
|
|
dnl Checks for programs and enable necessary CC extensions
|
2008-06-09 11:53:29 +08:00
|
|
|
AC_USE_SYSTEM_EXTENSIONS
|
2016-02-19 03:57:53 +08:00
|
|
|
AC_SYS_LARGEFILE
|
2002-05-01 04:53:16 +08:00
|
|
|
AC_PROG_CC
|
2016-02-18 16:54:30 +08:00
|
|
|
AC_PROG_CC_STDC
|
2018-06-15 10:19:09 +08:00
|
|
|
|
|
|
|
dnl If the user did not specify a CFLAGS default, change default
|
|
|
|
dnl to -O0 for debugging
|
2017-04-07 06:24:58 +08:00
|
|
|
PA_ARG_DISABLED([optimization],
|
|
|
|
[compile without optimization (-O0) to help debugging],
|
2018-06-15 10:19:09 +08:00
|
|
|
[pa_no_optimize=true])
|
2017-03-01 11:02:51 +08:00
|
|
|
|
2020-07-01 01:14:21 +08:00
|
|
|
dnl LLVM doesn't error out on invalid -W options unless this option is
|
|
|
|
dnl specified first. Enable this so this script can actually discover
|
|
|
|
dnl which -W options are possible for this compiler.
|
|
|
|
PA_ADD_CFLAGS([-Werror=unknown-warning-option])
|
|
|
|
|
|
|
|
dnl Other programs
|
|
|
|
AC_PROG_LN_S
|
|
|
|
AC_PROG_MAKE_SET
|
|
|
|
AC_PROG_INSTALL
|
|
|
|
AC_PROG_MKDIR_P
|
|
|
|
|
|
|
|
pa_no_optimize=false
|
|
|
|
|
2017-07-29 21:05:36 +08:00
|
|
|
dnl Compile and link with dwarf debug
|
|
|
|
PA_ARG_ENABLED([gdb],
|
|
|
|
[disable optimization and compile with extra debug information for GDB debugger],
|
2018-06-15 10:19:09 +08:00
|
|
|
[PA_ADD_CFLAGS([-ggdb3])
|
|
|
|
pa_no_optimize=true])
|
2017-10-12 07:47:59 +08:00
|
|
|
|
2018-06-15 10:19:09 +08:00
|
|
|
AS_IF([$pa_no_optimize],
|
|
|
|
[PA_ADD_CFLAGS([-O0])
|
|
|
|
PA_ADD_CFLAGS([-fno-omit-frame-pointer])])
|
2017-07-29 21:05:36 +08:00
|
|
|
|
2019-02-26 13:00:43 +08:00
|
|
|
dnl Profiling
|
|
|
|
PA_ARG_ENABLED([profiling],
|
|
|
|
[compile with profiling (-pg option)],
|
|
|
|
[PA_ADD_CFLAGS([-pg])])
|
|
|
|
|
2017-12-21 04:06:54 +08:00
|
|
|
dnl Abort on panic
|
|
|
|
PA_ARG_ENABLED([panic-abort],
|
|
|
|
[call abort() on panic to trap in the debugger],
|
|
|
|
[AC_DEFINE(ABORT_ON_PANIC)])
|
|
|
|
AH_TEMPLATE(ABORT_ON_PANIC,
|
|
|
|
[Define to 1 to call abort() on panics (internal errors), for debugging.])
|
|
|
|
|
2016-03-10 06:11:40 +08:00
|
|
|
dnl Check for library extension
|
|
|
|
PA_LIBEXT
|
|
|
|
|
2014-12-20 16:35:51 +08:00
|
|
|
dnl Checks for typedefs, structures, and compiler characteristics.
|
|
|
|
AC_C_CONST
|
2015-11-05 03:29:09 +08:00
|
|
|
AC_C_INLINE
|
2014-12-20 16:35:51 +08:00
|
|
|
AC_C_RESTRICT
|
|
|
|
AC_TYPE_SIZE_T
|
2016-03-02 13:53:09 +08:00
|
|
|
AC_C_BIGENDIAN(AC_DEFINE(WORDS_BIGENDIAN),AC_DEFINE(WORDS_LITTLEENDIAN),,)
|
2014-12-20 16:35:51 +08:00
|
|
|
AH_TEMPLATE(WORDS_BIGENDIAN,
|
|
|
|
[Define to 1 if your processor stores words with the most significant
|
|
|
|
byte first (like Motorola and SPARC, unlike Intel and VAX).])
|
|
|
|
AH_TEMPLATE(WORDS_LITTLEENDIAN,
|
|
|
|
[Define to 1 if your processor stores words with the least significant
|
|
|
|
byte first (like Intel and VAX, unlike Motorola and SPARC).])
|
|
|
|
|
2016-03-02 13:51:40 +08:00
|
|
|
dnl Force gcc and gcc-compatible compilers treat signed integers
|
|
|
|
dnl as 2's complement
|
2016-02-27 16:15:13 +08:00
|
|
|
PA_ADD_CFLAGS([-fwrapv])
|
2002-05-01 04:53:16 +08:00
|
|
|
|
2016-11-16 06:01:37 +08:00
|
|
|
dnl Some environments abuse __STRICT_ANSI__ to disable some
|
|
|
|
dnl function declarations
|
|
|
|
PA_ADD_CFLAGS([-U__STRICT_ANSI__])
|
|
|
|
|
2016-08-03 00:28:22 +08:00
|
|
|
dnl Don't put things in common if we can avoid it. We don't want to
|
|
|
|
dnl assume all compilers support common, and this will help find those
|
|
|
|
dnl problems. This also works around an OSX linker problem.
|
|
|
|
PA_ADD_CFLAGS([-fno-common])
|
|
|
|
|
2008-06-20 02:39:23 +08:00
|
|
|
dnl Look for programs...
|
2013-05-18 03:02:49 +08:00
|
|
|
AC_CHECK_PROGS(NROFF, nroff, false)
|
2013-10-24 20:22:19 +08:00
|
|
|
AC_CHECK_PROGS(ASCIIDOC, asciidoc, false)
|
|
|
|
AC_CHECK_PROGS(XMLTO, xmlto, false)
|
2020-05-27 05:13:31 +08:00
|
|
|
AC_CHECK_PROGS(XZ, xz, false)
|
2002-05-01 04:57:38 +08:00
|
|
|
|
2013-10-24 20:22:19 +08:00
|
|
|
dnl Check for progs needed for manpage generation
|
2020-05-27 05:13:31 +08:00
|
|
|
MANPAGES=manpages
|
|
|
|
AS_IF([test x$ASCIIDOC = xfalse],
|
|
|
|
[AC_MSG_WARN([No asciidoc package found, cannot build man pages])
|
|
|
|
MANPAGES='']
|
2017-04-07 06:24:58 +08:00
|
|
|
)
|
2020-05-27 05:13:31 +08:00
|
|
|
AS_IF([test x"$XMLTO" = xfalse],
|
|
|
|
[AC_MSG_WARN([No xmlto package found, cannot build man pages])
|
|
|
|
MANPAGES='']
|
2017-04-07 06:24:58 +08:00
|
|
|
)
|
2020-05-27 05:13:31 +08:00
|
|
|
AC_SUBST([MANPAGES])
|
|
|
|
|
|
|
|
dnl Don't create .pdf.xz if there is no xz
|
|
|
|
AS_IF([test x"$XZ" = xfalse],
|
|
|
|
[],
|
|
|
|
[XZFILES=xzfiles])
|
|
|
|
AC_SUBST([XZFILES])
|
|
|
|
|
|
|
|
dnl Can't create NSIS package if there is no makensis
|
|
|
|
dnl ... but it only applies to a Windows target ...
|
|
|
|
dnl Note: AC_CHECK_TOOLS is supposed to check for the "plain"
|
|
|
|
dnl version of the program name, but it doesn't seem to.
|
|
|
|
AC_ARG_WITH([nsis],
|
|
|
|
[AS_HELP_STRING([[--with-nsis[=makensis]]],
|
|
|
|
[build an install .exe using NSIS on Windows hosts])],
|
|
|
|
[], [with_nsis=yes])
|
|
|
|
AS_IF([test x"$MAKENSIS" = x], [],
|
|
|
|
[AS_IF([test x"$with_nsis" = xno], []
|
|
|
|
[with_nsis="$MAKENSIS"])])
|
|
|
|
|
|
|
|
MAKENSIS=false
|
|
|
|
|
|
|
|
AS_CASE([$host],
|
|
|
|
[*-win* | *-mingw*],
|
|
|
|
[AS_IF([test x"$with_nsis" = xno], [],
|
|
|
|
[NSIS=nsis
|
|
|
|
AS_IF([test x"$with_nsis" = xyes],
|
|
|
|
[AC_CHECK_TOOL(MAKENSIS_TOOL, makensis, false)
|
|
|
|
MAKENSIS="$MAKENSIS_TOOL"
|
|
|
|
AS_IF([test x"$MAKENSIS" = xfalse],
|
|
|
|
[AC_CHECK_PROGS(MAKENSIS_PLAIN, makensis, false)
|
|
|
|
MAKENSIS="$MAKENSIS_PLAIN"])
|
|
|
|
AS_IF([test x"$MAKENSIS" = xfalse],
|
|
|
|
[AC_MSG_WARN([no makensis found, cannot build installer])
|
|
|
|
NSIS=''])],
|
|
|
|
[MAKENSIS="$with_nsis"])])])
|
|
|
|
AC_SUBST([MAKENSIS])
|
|
|
|
AC_SUBST([NSIS])
|
2013-10-24 20:22:19 +08:00
|
|
|
|
2016-03-08 18:06:39 +08:00
|
|
|
dnl Check for host compiler tools
|
|
|
|
AC_CHECK_TOOL(AR, ar)
|
|
|
|
AC_CHECK_TOOL(RANLIB, ranlib, :)
|
|
|
|
AC_CHECK_TOOL(STRIP, strip)
|
|
|
|
|
2002-05-01 04:53:16 +08:00
|
|
|
dnl Checks for header files.
|
|
|
|
AC_HEADER_STDC
|
2016-03-09 04:14:55 +08:00
|
|
|
AC_CHECK_HEADERS(inttypes.h)
|
2007-10-03 12:53:51 +08:00
|
|
|
AC_CHECK_HEADERS(strings.h)
|
2016-02-18 16:54:30 +08:00
|
|
|
AC_HEADER_STDBOOL
|
2016-12-20 18:29:58 +08:00
|
|
|
AC_CHECK_HEADERS(stdnoreturn.h)
|
2016-02-19 06:24:40 +08:00
|
|
|
AC_CHECK_HEADERS(io.h)
|
2016-09-22 05:03:18 +08:00
|
|
|
AC_CHECK_HEADERS(fcntl.h)
|
2016-01-27 04:01:34 +08:00
|
|
|
AC_CHECK_HEADERS(unistd.h)
|
2016-09-22 05:03:18 +08:00
|
|
|
AC_CHECK_HEADERS(sys/mman.h)
|
2016-10-20 04:13:38 +08:00
|
|
|
AC_CHECK_HEADERS(sys/types.h)
|
2017-04-06 12:19:03 +08:00
|
|
|
AC_CHECK_HEADERS(sys/stat.h)
|
2020-06-02 04:10:46 +08:00
|
|
|
AC_CHECK_HEADERS(sys/resource.h)
|
2016-01-27 04:01:34 +08:00
|
|
|
|
2002-05-01 04:53:16 +08:00
|
|
|
dnl Checks for library functions.
|
2007-10-03 12:53:51 +08:00
|
|
|
AC_CHECK_FUNCS(strcasecmp stricmp)
|
|
|
|
AC_CHECK_FUNCS(strncasecmp strnicmp)
|
2016-02-19 06:40:37 +08:00
|
|
|
AC_CHECK_FUNCS(strsep)
|
2016-05-25 20:42:47 +08:00
|
|
|
AC_CHECK_FUNCS(strnlen)
|
2017-12-21 05:33:49 +08:00
|
|
|
AC_CHECK_FUNCS(strrchrnul)
|
2018-11-29 06:55:58 +08:00
|
|
|
AC_CHECK_FUNCS(iscntrl)
|
|
|
|
AC_CHECK_FUNCS(isascii)
|
2018-12-26 22:22:47 +08:00
|
|
|
AC_CHECK_FUNCS(mempcpy)
|
2007-10-03 12:53:51 +08:00
|
|
|
|
2007-04-13 00:54:50 +08:00
|
|
|
AC_CHECK_FUNCS(getuid)
|
|
|
|
AC_CHECK_FUNCS(getgid)
|
2020-06-02 04:10:46 +08:00
|
|
|
AC_CHECK_FUNCS(getrlimit)
|
2007-04-13 00:54:50 +08:00
|
|
|
|
2016-01-27 04:01:34 +08:00
|
|
|
AC_CHECK_FUNCS(realpath)
|
|
|
|
AC_CHECK_FUNCS(canonicalize_file_name)
|
|
|
|
AC_CHECK_FUNCS(_fullpath)
|
|
|
|
AC_CHECK_FUNCS(pathconf)
|
|
|
|
|
2016-02-19 06:24:40 +08:00
|
|
|
AC_FUNC_FSEEKO
|
2016-02-22 13:20:45 +08:00
|
|
|
AC_CHECK_FUNCS([_fseeki64])
|
2016-02-19 06:24:40 +08:00
|
|
|
AC_CHECK_FUNCS([ftruncate _chsize _chsize_s])
|
2016-10-05 08:01:59 +08:00
|
|
|
AC_CHECK_FUNCS([fileno _fileno])
|
2016-02-19 06:24:40 +08:00
|
|
|
|
2017-02-24 12:34:38 +08:00
|
|
|
AC_FUNC_MMAP
|
2016-09-22 05:03:18 +08:00
|
|
|
AC_CHECK_FUNCS(getpagesize)
|
|
|
|
AC_CHECK_FUNCS(sysconf)
|
|
|
|
|
2016-10-05 08:01:59 +08:00
|
|
|
AC_CHECK_FUNCS([access _access faccessat])
|
2016-09-22 05:03:18 +08:00
|
|
|
|
2017-04-19 07:05:22 +08:00
|
|
|
PA_HAVE_FUNC(__builtin_expect, (1,1))
|
|
|
|
|
|
|
|
dnl ilog2() building blocks
|
|
|
|
PA_ADD_HEADERS(intrin.h)
|
2016-11-16 06:23:54 +08:00
|
|
|
PA_HAVE_FUNC(__builtin_clz, (0U))
|
|
|
|
PA_HAVE_FUNC(__builtin_clzl, (0UL))
|
|
|
|
PA_HAVE_FUNC(__builtin_clzll, (0ULL))
|
2017-04-19 07:05:22 +08:00
|
|
|
PA_HAVE_FUNC(_BitScanReverse, (0))
|
|
|
|
PA_HAVE_FUNC(_BitScanReverse64, (0))
|
2016-02-18 16:54:30 +08:00
|
|
|
|
2017-12-21 05:33:49 +08:00
|
|
|
dnl Functions for which we have replacements available in stdlib/
|
2016-03-08 18:06:39 +08:00
|
|
|
AC_CHECK_FUNCS([vsnprintf _vsnprintf])
|
|
|
|
AC_CHECK_FUNCS([snprintf _snprintf])
|
|
|
|
AC_CHECK_FUNCS([strlcpy])
|
2017-12-21 05:33:49 +08:00
|
|
|
AC_CHECK_FUNCS([strrchrnul])
|
2016-02-18 16:54:30 +08:00
|
|
|
|
2017-04-07 06:30:56 +08:00
|
|
|
dnl These types are POSIX-specific, and Windows does it differently...
|
|
|
|
AC_CHECK_TYPES([struct _stati64])
|
|
|
|
AC_CHECK_TYPES([struct stat])
|
|
|
|
AC_CHECK_FUNCS([stat _stati64])
|
|
|
|
AC_CHECK_FUNCS([fstat _fstati64])
|
2019-05-16 04:07:21 +08:00
|
|
|
AC_CHECK_FUNCS([S_ISREG])
|
2017-04-07 06:30:56 +08:00
|
|
|
|
2007-10-27 09:49:29 +08:00
|
|
|
dnl Check for functions that might not be declared in the headers for
|
|
|
|
dnl various idiotic reasons (mostly because of library authors
|
|
|
|
dnl abusing the meaning of __STRICT_ANSI__)
|
|
|
|
AC_CHECK_DECLS(strcasecmp)
|
|
|
|
AC_CHECK_DECLS(stricmp)
|
|
|
|
AC_CHECK_DECLS(strncasecmp)
|
|
|
|
AC_CHECK_DECLS(strnicmp)
|
|
|
|
AC_CHECK_DECLS(strsep)
|
2009-08-11 06:56:52 +08:00
|
|
|
AC_CHECK_DECLS(strlcpy)
|
2016-05-25 20:42:47 +08:00
|
|
|
AC_CHECK_DECLS(strnlen)
|
2017-12-21 05:33:49 +08:00
|
|
|
AC_CHECK_DECLS(strrchrnul)
|
2007-10-27 09:49:29 +08:00
|
|
|
|
2016-09-22 05:03:18 +08:00
|
|
|
dnl Check for missing types
|
|
|
|
AC_TYPE_UINTPTR_T
|
|
|
|
|
2017-04-11 07:10:28 +08:00
|
|
|
dnl Documentation: should we generate an uncompressed PDF? It is
|
|
|
|
dnl about twice as big, but it can be externally compressed (e.g. with xz)
|
|
|
|
dnl and becomes significantly smaller than the original.
|
|
|
|
PA_ARG_DISABLED([pdf-compression],
|
|
|
|
[generate an uncompressed documentation PDF],
|
|
|
|
[PDFOPT='-nocompress'])
|
|
|
|
AC_SUBST([PDFOPT])
|
|
|
|
|
2017-04-19 06:49:25 +08:00
|
|
|
dnl
|
|
|
|
dnl Look for byte-swapping support...
|
|
|
|
dnl
|
2017-11-30 08:04:05 +08:00
|
|
|
PA_ADD_HEADERS(endian.h sys/endian.h machine/endian.h)
|
2017-04-19 06:49:25 +08:00
|
|
|
PA_HAVE_FUNC(cpu_to_le16, (0))
|
|
|
|
PA_HAVE_FUNC(cpu_to_le32, (0))
|
|
|
|
PA_HAVE_FUNC(cpu_to_le64, (0))
|
|
|
|
PA_HAVE_FUNC(__cpu_to_le16, (0))
|
|
|
|
PA_HAVE_FUNC(__cpu_to_le32, (0))
|
|
|
|
PA_HAVE_FUNC(__cpu_to_le64, (0))
|
|
|
|
PA_HAVE_FUNC(htole16, (0))
|
|
|
|
PA_HAVE_FUNC(htole32, (0))
|
|
|
|
PA_HAVE_FUNC(htole64, (0))
|
|
|
|
PA_HAVE_FUNC(__bswap_16, (0))
|
|
|
|
PA_HAVE_FUNC(__bswap_32, (0))
|
|
|
|
PA_HAVE_FUNC(__bswap_64, (0))
|
|
|
|
PA_HAVE_FUNC(__builtin_bswap16, (0))
|
|
|
|
PA_HAVE_FUNC(__builtin_bswap32, (0))
|
|
|
|
PA_HAVE_FUNC(__builtin_bswap64, (0))
|
2017-04-19 07:05:22 +08:00
|
|
|
PA_HAVE_FUNC(_byteswap_ushort, (0))
|
|
|
|
PA_HAVE_FUNC(_byteswap_ulong, (0))
|
|
|
|
PA_HAVE_FUNC(_byteswap_uint64, (0))
|
2017-04-19 06:49:25 +08:00
|
|
|
|
2017-11-30 08:04:05 +08:00
|
|
|
dnl
|
2018-12-15 06:21:16 +08:00
|
|
|
dnl Some rather useful gcc extensions...
|
2017-11-30 08:04:05 +08:00
|
|
|
dnl
|
|
|
|
PA_HAVE_FUNC(__builtin_constant_p, (0))
|
2018-12-15 06:21:16 +08:00
|
|
|
PA_HAVE_FUNC(__builtin_choose_expr, (0,1,2))
|
2017-11-30 08:04:05 +08:00
|
|
|
|
2016-11-16 06:01:37 +08:00
|
|
|
dnl
|
|
|
|
dnl Check for supported gcc attributes; some compilers (e.g. Sun CC)
|
|
|
|
dnl support these, but don't define __GNUC__ as they don't support
|
|
|
|
dnl some other features of gcc.
|
|
|
|
dnl
|
2017-02-24 11:22:27 +08:00
|
|
|
PA_ADD_CFLAGS([-Werror=attributes])
|
2016-11-16 06:01:37 +08:00
|
|
|
PA_FUNC_ATTRIBUTE(noreturn)
|
2019-08-16 15:08:27 +08:00
|
|
|
PA_FUNC_ATTRIBUTE(returns_nonnull,,,,,never_null)
|
2016-11-16 06:01:37 +08:00
|
|
|
PA_FUNC_ATTRIBUTE(malloc)
|
2019-08-16 15:08:27 +08:00
|
|
|
PA_FUNC_ATTRIBUTE(alloc_size,[1])
|
|
|
|
PA_FUNC_ATTRIBUTE(alloc_size,[1,2])
|
|
|
|
PA_FUNC_ATTRIBUTE(sentinel,,, [const char *, ...], ["a","b",NULL],end_with_null)
|
|
|
|
PA_FUNC_ATTRIBUTE(format, [printf,1,2], int, [const char *, ...], ["%d",1])
|
2016-11-16 06:01:37 +08:00
|
|
|
PA_FUNC_ATTRIBUTE(const)
|
|
|
|
PA_FUNC_ATTRIBUTE(pure)
|
2019-08-16 15:08:27 +08:00
|
|
|
PA_FUNC_ATTRIBUTE(cold,,,,,unlikely_func)
|
2020-07-01 01:14:21 +08:00
|
|
|
PA_FUNC_ATTRIBUTE(unused)
|
2016-12-20 18:29:58 +08:00
|
|
|
PA_FUNC_ATTRIBUTE_ERROR
|
2002-05-01 04:53:16 +08:00
|
|
|
|
2010-11-11 16:18:44 +08:00
|
|
|
dnl
|
2017-10-12 07:47:59 +08:00
|
|
|
dnl support function sections (if available)
|
2010-11-11 16:18:44 +08:00
|
|
|
dnl
|
2018-12-14 14:51:22 +08:00
|
|
|
PA_ARG_DISABLED([sections],
|
2018-12-23 22:15:41 +08:00
|
|
|
[do not try to compile with function/data section support],
|
2018-12-14 14:51:22 +08:00
|
|
|
[],
|
2018-12-23 10:17:16 +08:00
|
|
|
[PA_ADD_CFLAGS([-ffunction-sections])
|
|
|
|
PA_ADD_CFLAGS([-fdata-sections])
|
|
|
|
PA_ADD_LDFLAGS([-Wl,--gc-sections])]
|
2018-12-14 14:51:22 +08:00
|
|
|
)
|
2017-10-12 07:47:59 +08:00
|
|
|
|
2017-03-01 10:48:01 +08:00
|
|
|
dnl
|
|
|
|
dnl support LTO
|
|
|
|
dnl
|
2017-04-07 06:24:58 +08:00
|
|
|
PA_ARG_ENABLED([lto],
|
|
|
|
[compile with gcc-style link time optimization],
|
2018-12-23 10:17:16 +08:00
|
|
|
[PA_ADD_CFLAGS([-flto])
|
2017-04-07 06:24:58 +08:00
|
|
|
dnl Note: we use _PROG rather than _TOOL since we are prepending the full
|
|
|
|
dnl CC name which ought to already contain the host triplet if needed
|
|
|
|
ccbase=`echo "$CC" | awk '{ print $1; }'`
|
|
|
|
AC_CHECK_PROGS(CC_AR, [${ccbase}-ar], [$ac_cv_prog_AR])
|
|
|
|
AR="$CC_AR"
|
|
|
|
AC_CHECK_PROGS(CC_RANLIB, [${ccbase}-ranlib], [$ac_cv_prog_RANLIB])
|
|
|
|
RANLIB="$CC_RANLIB"], [])
|
2017-03-01 10:48:01 +08:00
|
|
|
|
2017-10-12 07:47:59 +08:00
|
|
|
dnl
|
|
|
|
dnl support sanitizers (if available)
|
|
|
|
dnl
|
|
|
|
PA_ARG_ENABLED([sanitizer],
|
|
|
|
[compile with sanitizers enabled],
|
|
|
|
[PA_ADD_CFLAGS([-fno-omit-frame-pointer])
|
2018-12-23 10:17:16 +08:00
|
|
|
PA_ADD_CFLAGS([-fsanitize=address])
|
|
|
|
PA_ADD_CFLAGS([-fsanitize=undefined])])
|
2017-10-12 07:47:59 +08:00
|
|
|
|
2018-05-31 02:48:00 +08:00
|
|
|
dnl
|
|
|
|
dnl Don't make symbols visible, there is no point and it just
|
2020-07-01 01:14:21 +08:00
|
|
|
dnl makes the code slower. This mainly affects ELF.
|
2018-05-31 02:48:00 +08:00
|
|
|
dnl
|
2018-12-23 10:17:16 +08:00
|
|
|
PA_ADD_CFLAGS([-fvisibility=hidden])
|
2018-05-31 02:48:00 +08:00
|
|
|
|
2020-07-01 01:14:21 +08:00
|
|
|
dnl
|
|
|
|
dnl If we have gcc, add appropriate code cleanliness options. Do this
|
|
|
|
dnl here at the end, because configure relies on being able to use
|
|
|
|
dnl some very, very old C constructs.
|
|
|
|
dnl
|
2016-02-18 16:54:30 +08:00
|
|
|
PA_ADD_CFLAGS([-Wall])
|
2019-08-16 15:52:26 +08:00
|
|
|
PA_ARG_DISABLED([pedantic],
|
|
|
|
[disable some extra paranoid compiler warnings],
|
|
|
|
[],
|
|
|
|
[PA_ADD_CFLAGS([-W])
|
|
|
|
PA_ADD_CFLAGS([-pedantic])
|
2020-07-01 01:14:21 +08:00
|
|
|
PA_ADD_CFLAGS([-Wc90-c99-compat])
|
|
|
|
PA_ADD_CFLAGS([-Wc99-compat])
|
|
|
|
PA_ADD_CFLAGS([-Wc99-extensions])
|
|
|
|
])
|
2016-03-02 14:20:10 +08:00
|
|
|
dnl Suppress format warning on Windows targets due to their <inttypes.h>
|
|
|
|
PA_ADD_CFLAGS([-Wpedantic-ms-format],[-Wno-pedantic-ms-format])
|
|
|
|
PA_ADD_CFLAGS([-Wlong-long],[-Wno-long-long])
|
2018-06-03 14:46:21 +08:00
|
|
|
dnl This is needed because we intentionally expect strncpy() to fill
|
|
|
|
dnl in a zero-padded (not zero-terminated) buffer in several backends
|
|
|
|
PA_ADD_CFLAGS([-Wstringop-truncation],[-Wno-stringop-truncation])
|
2018-12-13 07:56:28 +08:00
|
|
|
dnl This is needed because we assume 2's-completement signed arithmetic;
|
|
|
|
dnl on compilers with gcc-like command line syntax we pass the -fwrapv
|
|
|
|
dnl option for exactly that reason.
|
|
|
|
PA_ADD_CFLAGS([-Wshift-negative-value],[-Wno-shift-negative-value])
|
|
|
|
|
2020-07-01 01:14:21 +08:00
|
|
|
dnl Want to turn this on at some point...
|
2016-03-07 13:44:14 +08:00
|
|
|
dnl PA_ADD_CFLAGS([-Wwrite-strings])
|
2017-04-07 06:24:58 +08:00
|
|
|
PA_ARG_ENABLED([werror],
|
|
|
|
[compile with -Werror to error out on any warning],
|
|
|
|
[PA_ADD_CFLAGS([-Werror])],
|
|
|
|
[PA_ADD_CFLAGS([-Werror=implicit])
|
|
|
|
PA_ADD_CFLAGS([-Werror=missing-braces])
|
|
|
|
PA_ADD_CFLAGS([-Werror=return-type])
|
|
|
|
PA_ADD_CFLAGS([-Werror=trigraphs])
|
|
|
|
PA_ADD_CFLAGS([-Werror=pointer-arith])
|
|
|
|
PA_ADD_CFLAGS([-Werror=strict-prototypes])
|
|
|
|
PA_ADD_CFLAGS([-Werror=missing-prototypes])
|
|
|
|
PA_ADD_CFLAGS([-Werror=missing-declarations])
|
|
|
|
PA_ADD_CFLAGS([-Werror=comment])
|
|
|
|
PA_ADD_CFLAGS([-Werror=vla])]
|
|
|
|
)
|
2016-02-13 15:49:49 +08:00
|
|
|
|
2018-02-21 04:34:17 +08:00
|
|
|
dnl
|
|
|
|
dnl On some versions of gcc, -Werror=missing-prototypes causes problems
|
|
|
|
dnl with C99-style external inlines. Test this *after* adding the -Werror
|
|
|
|
dnl options.
|
|
|
|
dnl
|
|
|
|
PA_CHECK_BAD_STDC_INLINE
|
|
|
|
|
2017-03-01 11:34:36 +08:00
|
|
|
dnl
|
|
|
|
dnl support ccache
|
|
|
|
dnl
|
2017-04-07 06:24:58 +08:00
|
|
|
PA_ARG_ENABLED([ccache], [compile with ccache], [CC="ccache $CC"], [])
|
2017-03-01 11:34:36 +08:00
|
|
|
|
2020-05-27 05:13:31 +08:00
|
|
|
AC_CONFIG_FILES([Makefile doc/Makefile])
|
|
|
|
AC_OUTPUT
|