2023-10-11 10:19:16 -07:00
|
|
|
dnl Process this file with autoconf 2.71 or later to produce
|
2002-05-19 02:26:38 +00:00
|
|
|
dnl a configure script.
|
2022-10-05 12:09:36 -07:00
|
|
|
AC_PREREQ([2.71])
|
2025-10-02 16:02:11 -07:00
|
|
|
m4_define([VERSION],m4_normalize(m4_include([version])))
|
|
|
|
|
AC_INIT([nasm],VERSION,[https://bugs.nasm.us/],[nasm],[https://www.nasm.us/])
|
2022-10-05 12:09:36 -07:00
|
|
|
AC_CONFIG_SRCDIR([config/config.h.in])
|
2019-10-03 21:32:08 -07:00
|
|
|
AC_CONFIG_HEADERS([config/config.h])
|
2002-04-30 20:53:16 +00:00
|
|
|
AC_PREFIX_PROGRAM(nasm)
|
2019-02-22 01:13:52 -08:00
|
|
|
AC_CONFIG_AUX_DIR(autoconf/helpers)
|
2002-04-30 20:53:16 +00:00
|
|
|
|
2020-07-06 11:10:30 -07:00
|
|
|
dnl Mark where in config.h.in macros auto-generated by the configuration
|
|
|
|
|
dnl start; this is used to generate config/unconfig.h.
|
|
|
|
|
AH_BOTTOM([
|
|
|
|
|
/* Begin unconfig.h */])
|
|
|
|
|
|
2017-04-06 15:24:58 -07: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.
|
2024-01-04 23:21:44 -08:00
|
|
|
PA_CROSS_COMPILE
|
2017-04-06 15:24:58 -07:00
|
|
|
|
2020-07-09 19:12:25 -07:00
|
|
|
dnl Enable any available C extensions
|
2025-09-16 13:25:39 -07:00
|
|
|
PA_PROG_CC([[-std=c23],[-std=c17],[-std=c11],[-std=c99]])
|
2008-06-08 20:53:29 -07:00
|
|
|
AC_USE_SYSTEM_EXTENSIONS
|
2025-09-16 13:25:39 -07:00
|
|
|
dnl Some environments abuse __STRICT_ANSI__ to disable some
|
|
|
|
|
dnl function declarations
|
|
|
|
|
PA_ADD_CFLAGS([-U__STRICT_ANSI__])
|
2017-02-28 19:02:51 -08:00
|
|
|
|
2023-10-11 10:19:16 -07:00
|
|
|
dnl Options for debugging and profiling
|
|
|
|
|
PA_OPTION_DEBUG
|
|
|
|
|
PA_OPTION_PROFILING
|
2019-02-25 21:00:43 -08:00
|
|
|
|
2023-02-19 21:26:15 -08:00
|
|
|
dnl Large files
|
|
|
|
|
AC_SYS_LARGEFILE
|
|
|
|
|
|
2017-12-20 12: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.])
|
|
|
|
|
|
2025-08-15 16:37:08 -07:00
|
|
|
dnl Externally specified zlib
|
|
|
|
|
AC_ARG_WITH([zlib],
|
|
|
|
|
[AS_HELP_STRING([--with-zlib=path], [specify location of external zlib library])],
|
|
|
|
|
[AS_IF([test "x$with_zlib" = xno],
|
|
|
|
|
[ac_cv_search_inflate=no],
|
|
|
|
|
[AS_IF([test -d "x$with_zlib"],
|
|
|
|
|
[for p in "$with_zlib"/include "$with_zlib"
|
|
|
|
|
do
|
|
|
|
|
AS_IF([test -d "$p"], [CPPFLAGS="$CPPFLAGS -I$p"])
|
|
|
|
|
done
|
|
|
|
|
for p in "$with_zlib"/lib64 "$with_zlib"/lib "$with_zlib"
|
|
|
|
|
do
|
|
|
|
|
AS_IF([test -d "$p"], [LDFLAGS="-L$p $LDFLAGS"])
|
|
|
|
|
done])])])
|
|
|
|
|
|
|
|
|
|
AS_IF([test "x$ac_cv_search_inflate" != xno],
|
|
|
|
|
[AC_SEARCH_LIBS([inflate], [z zlib])])
|
|
|
|
|
|
|
|
|
|
AS_IF([test "x$ac_cv_search_inflate" = xno],
|
|
|
|
|
[AC_SUBST([ZLIB],['$(ZLIBOBJ)'])
|
2025-09-05 18:36:28 -07:00
|
|
|
AC_SUBST([ZLIBINC],['-I$(top_srcdir)/zlib'])])
|
2025-08-15 16:37:08 -07:00
|
|
|
|
2014-12-20 11:35:51 +03:00
|
|
|
dnl Checks for typedefs, structures, and compiler characteristics.
|
|
|
|
|
AC_TYPE_SIZE_T
|
|
|
|
|
|
2020-07-06 10:15:11 -07: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])
|
|
|
|
|
|
2016-03-01 21:51:40 -08:00
|
|
|
dnl Force gcc and gcc-compatible compilers treat signed integers
|
|
|
|
|
dnl as 2's complement
|
2016-02-27 00:15:13 -08:00
|
|
|
PA_ADD_CFLAGS([-fwrapv])
|
2002-04-30 20:53:16 +00:00
|
|
|
|
2020-07-06 10:15:11 -07:00
|
|
|
dnl Force clang to behave in a predictable manner, in order to make bugs
|
|
|
|
|
dnl possible to track down. gcc appears to have this behavior by default.
|
|
|
|
|
PA_ADD_CFLAGS([-ftrivial-auto-var-init=zero])
|
|
|
|
|
|
2016-08-02 09:28:22 -07: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])
|
|
|
|
|
|
2020-07-09 19:04:28 -07:00
|
|
|
dnl Check for library extension
|
|
|
|
|
PA_LIBEXT
|
2020-07-06 12:39:14 -07:00
|
|
|
|
2008-06-19 11:39:23 -07:00
|
|
|
dnl Look for programs...
|
2020-07-09 19:04:28 -07:00
|
|
|
AC_PROG_LN_S
|
|
|
|
|
AC_PROG_MAKE_SET
|
|
|
|
|
AC_PROG_INSTALL
|
|
|
|
|
AC_PROG_MKDIR_P
|
|
|
|
|
|
2023-02-19 21:26:15 -08:00
|
|
|
AC_CHECK_PROGS([ASCIIDOC], asciidoc, false)
|
|
|
|
|
AC_CHECK_PROGS([XMLTO], xmlto, false)
|
|
|
|
|
AC_CHECK_PROGS([XZ], xz, false)
|
2025-10-08 12:56:00 -07:00
|
|
|
AC_CHECK_PROGS([PYTHON3], [python3 python], false)
|
2002-04-30 20:57:38 +00:00
|
|
|
|
2013-10-24 13:22:19 +01:00
|
|
|
dnl Check for progs needed for manpage generation
|
2020-05-26 14:13:31 -07:00
|
|
|
MANPAGES=manpages
|
|
|
|
|
AS_IF([test x$ASCIIDOC = xfalse],
|
|
|
|
|
[AC_MSG_WARN([No asciidoc package found, cannot build man pages])
|
|
|
|
|
MANPAGES='']
|
2017-04-06 15:24:58 -07:00
|
|
|
)
|
2020-05-26 14:13:31 -07:00
|
|
|
AS_IF([test x"$XMLTO" = xfalse],
|
|
|
|
|
[AC_MSG_WARN([No xmlto package found, cannot build man pages])
|
|
|
|
|
MANPAGES='']
|
2017-04-06 15:24:58 -07:00
|
|
|
)
|
2020-05-26 14:13:31 -07: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 13:22:19 +01:00
|
|
|
|
2016-03-08 02:06:39 -08:00
|
|
|
dnl Check for host compiler tools
|
|
|
|
|
AC_CHECK_TOOL(AR, ar)
|
|
|
|
|
AC_CHECK_TOOL(RANLIB, ranlib, :)
|
2026-06-04 10:40:06 -07:00
|
|
|
AC_CHECK_TOOL(STRIP, strip, :)
|
2016-03-08 02:06:39 -08:00
|
|
|
|
2020-07-09 19:04:28 -07:00
|
|
|
dnl
|
|
|
|
|
dnl NOTE: the tests for header files and library functions use constructs
|
|
|
|
|
dnl that create warnings on modern compilers, due to lack of prototypes,
|
|
|
|
|
dnl etc. Therefore, do not add the -Werror options before this.
|
|
|
|
|
dnl
|
|
|
|
|
|
|
|
|
|
dnl Tests which may trigger warnings on some compilers
|
|
|
|
|
AC_C_CONST
|
|
|
|
|
AC_C_INLINE
|
|
|
|
|
AC_C_RESTRICT
|
|
|
|
|
|
2002-04-30 20:53:16 +00:00
|
|
|
dnl Checks for header files.
|
2022-10-05 12:09:36 -07:00
|
|
|
AC_CHECK_INCLUDES_DEFAULT
|
|
|
|
|
|
2023-10-11 13:32:00 -07:00
|
|
|
dnl Check for variadic macro support
|
|
|
|
|
PA_VARIADIC_MACROS
|
|
|
|
|
|
Major changes to a number of subsystems to improve matching
Work through a number of changes toward making matching a lot saner,
both to reduce the number of patterns to generate for APX but also to
make a number of code patterns simpler.
This replaces a fair number of byte codes.
Improve a number of error messages, especially related to overflows.
Move process_insn() from nasm.c to assemble.c, as it really is the
primary entry point to the assembler module.
Reorder some prefixes. In particular, F2/F3 override 66 when used as a
mandatory prefix, so it makes more sense for them to be closer to the
opcode.
Move a lot more information into struct insn. It is better to have it
in one place; memory consumption is not an issue because struct insn
is transient information.
Get rid of "optimization levels" and replace it with a mask of
flags. That was already halfway done; complete the job.
Replace seg:offset in struct out_data with a struct location. It would
be better to extend this to more places, too.
The ARx and SMx flags are now explicit bitmasks, instead of having a
couple of hard-coded ranges.
Add __func__ to assert or panic messages.
Because of prefix and message changes, a number of travis tests had to
be audited and updated.
Fix a number of instruction patterns which had .128 when they ought to
be .lig. This is no longer a minor issue with the disassembler: for
AVX10, the pattern vector length determines how SAE/RC are encoded,
and there is no valid 128-bit encoding. However, with .lig the 512-bit
encoding can be used.
Separate "o64nw" into two pieces: opsize 64 and "nw" = "REX.w not necessary". The
latter can be included in non-64-bit patterns. "o64" still set REX.W
since that is still the common thing.
New "osz" bytecode: emit an OSP *or* REX.W depending on the current
mode and operand size. Useful for special cases like "nop" where "o64
nop" probably wants to be encoded as "48 90".
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-08-07 17:13:44 -07:00
|
|
|
dnl Check if the compiler supports __func__ or some equivalent
|
|
|
|
|
PA_HAVE_FUNC_NAME
|
|
|
|
|
|
2024-01-29 17:19:32 -08:00
|
|
|
dnl Handle Windows embedded manifests
|
|
|
|
|
AS_CASE([$host],
|
|
|
|
|
[*-win* | *-mingw*],
|
|
|
|
|
[AC_CHECK_TOOL(WINDRES, windres, false)
|
|
|
|
|
AS_IF([test x"$WINDRES" != xfalse],
|
|
|
|
|
[AC_SUBST(MANIFEST, ['win/manifest.$(O)'])])])
|
|
|
|
|
|
2020-07-09 19:04:28 -07:00
|
|
|
PA_ADD_HEADERS(string.h)
|
|
|
|
|
PA_ADD_HEADERS(stdarg.h)
|
2023-10-11 10:19:16 -07:00
|
|
|
PA_ADD_HEADERS(inttypes.h)
|
2007-10-02 21:53:51 -07:00
|
|
|
AC_CHECK_HEADERS(strings.h)
|
2016-02-18 00:54:30 -08:00
|
|
|
AC_HEADER_STDBOOL
|
2016-12-20 02:29:58 -08:00
|
|
|
AC_CHECK_HEADERS(stdnoreturn.h)
|
2016-02-18 14:24:40 -08:00
|
|
|
AC_CHECK_HEADERS(io.h)
|
2016-09-21 14:03:18 -07:00
|
|
|
AC_CHECK_HEADERS(fcntl.h)
|
2016-01-26 12:01:34 -08:00
|
|
|
AC_CHECK_HEADERS(unistd.h)
|
2016-09-21 14:03:18 -07:00
|
|
|
AC_CHECK_HEADERS(sys/mman.h)
|
2016-10-19 13:13:38 -07:00
|
|
|
AC_CHECK_HEADERS(sys/types.h)
|
2017-04-05 21:19:03 -07:00
|
|
|
AC_CHECK_HEADERS(sys/stat.h)
|
2020-06-01 13:10:46 -07:00
|
|
|
AC_CHECK_HEADERS(sys/resource.h)
|
2016-01-26 12:01:34 -08:00
|
|
|
|
2002-04-30 20:53:16 +00:00
|
|
|
dnl Checks for library functions.
|
2007-10-02 21:53:51 -07:00
|
|
|
AC_CHECK_FUNCS(strcasecmp stricmp)
|
|
|
|
|
AC_CHECK_FUNCS(strncasecmp strnicmp)
|
2016-02-18 14:40:37 -08:00
|
|
|
AC_CHECK_FUNCS(strsep)
|
2016-05-25 05:42:47 -07:00
|
|
|
AC_CHECK_FUNCS(strnlen)
|
2018-11-28 14:55:58 -08:00
|
|
|
AC_CHECK_FUNCS(iscntrl)
|
|
|
|
|
AC_CHECK_FUNCS(isascii)
|
2018-12-26 06:22:47 -08:00
|
|
|
AC_CHECK_FUNCS(mempcpy)
|
2022-11-07 10:26:03 -08:00
|
|
|
AC_CHECK_FUNCS(mempset)
|
2007-10-02 21:53:51 -07:00
|
|
|
|
2007-04-12 16:54:50 +00:00
|
|
|
AC_CHECK_FUNCS(getuid)
|
|
|
|
|
AC_CHECK_FUNCS(getgid)
|
2020-06-01 13:10:46 -07:00
|
|
|
AC_CHECK_FUNCS(getrlimit)
|
2007-04-12 16:54:50 +00:00
|
|
|
|
2016-01-26 12:01:34 -08:00
|
|
|
AC_CHECK_FUNCS(realpath)
|
|
|
|
|
AC_CHECK_FUNCS(canonicalize_file_name)
|
|
|
|
|
AC_CHECK_FUNCS(_fullpath)
|
|
|
|
|
AC_CHECK_FUNCS(pathconf)
|
|
|
|
|
|
2016-02-18 14:24:40 -08:00
|
|
|
AC_FUNC_FSEEKO
|
2016-02-21 21:20:45 -08:00
|
|
|
AC_CHECK_FUNCS([_fseeki64])
|
2016-02-18 14:24:40 -08:00
|
|
|
AC_CHECK_FUNCS([ftruncate _chsize _chsize_s])
|
2016-10-04 17:01:59 -07:00
|
|
|
AC_CHECK_FUNCS([fileno _fileno])
|
2016-02-18 14:24:40 -08:00
|
|
|
|
2017-02-23 20:34:38 -08:00
|
|
|
AC_FUNC_MMAP
|
2016-09-21 14:03:18 -07:00
|
|
|
AC_CHECK_FUNCS(getpagesize)
|
|
|
|
|
AC_CHECK_FUNCS(sysconf)
|
|
|
|
|
|
2016-10-04 17:01:59 -07:00
|
|
|
AC_CHECK_FUNCS([access _access faccessat])
|
2016-09-21 14:03:18 -07:00
|
|
|
|
2025-09-15 18:19:55 -07:00
|
|
|
PA_HAVE_FUNC(__builtin_expect,(1,1))
|
2025-10-13 17:53:42 -07:00
|
|
|
PA_HAVE_FUNC(__builtin_unreachable,())
|
2017-04-18 16:05:22 -07:00
|
|
|
|
2020-07-09 19:04:28 -07:00
|
|
|
PA_FUNC_SNPRINTF
|
|
|
|
|
PA_FUNC_VSNPRINTF
|
2016-03-08 02:06:39 -08:00
|
|
|
AC_CHECK_FUNCS([strlcpy])
|
2016-02-18 00:54:30 -08:00
|
|
|
|
2017-04-06 15:30:56 -07:00
|
|
|
dnl These types are POSIX-specific, and Windows does it differently...
|
2025-09-15 20:02:01 -07:00
|
|
|
AC_CHECK_TYPES([struct stat], [AC_CHECK_FUNCS([stat fstat])])
|
|
|
|
|
AC_CHECK_TYPES([struct _stati64], [AC_CHECK_FUNCS([_stati64 _fstati64])])
|
|
|
|
|
PA_HAVE_FUNC([S_ISREG],,[unistd.h fcntl.h sys/stat.h io.h])
|
2017-04-06 15:30:56 -07:00
|
|
|
|
2007-10-26 18:49:29 -07: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-10 15:56:52 -07:00
|
|
|
AC_CHECK_DECLS(strlcpy)
|
2016-05-25 05:42:47 -07:00
|
|
|
AC_CHECK_DECLS(strnlen)
|
2007-10-26 18:49:29 -07:00
|
|
|
|
2016-09-21 14:03:18 -07:00
|
|
|
dnl Check for missing types
|
2025-09-20 17:26:48 -07:00
|
|
|
AC_TYPE_UINTMAX_T
|
2016-09-21 14:03:18 -07:00
|
|
|
AC_TYPE_UINTPTR_T
|
|
|
|
|
|
2017-04-10 16:10:28 -07: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-18 15:49:25 -07:00
|
|
|
dnl
|
2025-09-15 18:19:55 -07:00
|
|
|
dnl Look for byte-swapping support and endian detection
|
2017-04-18 15:49:25 -07:00
|
|
|
dnl
|
2023-10-11 10:19:16 -07:00
|
|
|
PA_ENDIAN
|
2017-04-18 15:49:25 -07:00
|
|
|
|
2025-08-29 01:46:57 -07:00
|
|
|
dnl
|
2025-09-15 18:19:55 -07:00
|
|
|
dnl ilog2() building blocks
|
2025-08-29 01:46:57 -07:00
|
|
|
dnl
|
2025-09-15 18:19:55 -07:00
|
|
|
PA_HAVE_FUNC([stdc_leading_zeros],(0U),[stdbit.h])
|
|
|
|
|
AS_IF([test x$pa_cv_func_stdc_leading_zeros != xyes],
|
|
|
|
|
[PA_FIND_FUNC([__builtin_clz,(0U)],
|
|
|
|
|
[_BitScanReverse,(0UL),[intrin.h]])
|
|
|
|
|
PA_FIND_FUNC([__builtin_clzll,(0ULL)],
|
|
|
|
|
[_BitScanReverse64,(0ULL),[intrin.h]])])
|
2025-08-29 01:46:57 -07:00
|
|
|
|
2017-11-29 16:04:05 -08:00
|
|
|
dnl
|
2018-12-14 14:21:16 -08:00
|
|
|
dnl Some rather useful gcc extensions...
|
2017-11-29 16:04:05 -08:00
|
|
|
dnl
|
|
|
|
|
PA_HAVE_FUNC(__builtin_constant_p, (0))
|
2018-12-14 14:21:16 -08:00
|
|
|
PA_HAVE_FUNC(__builtin_choose_expr, (0,1,2))
|
2025-10-03 10:46:07 -07:00
|
|
|
PA_HAVE_FUNC(__builtin_prefetch, (NULL))
|
2017-11-29 16:04:05 -08:00
|
|
|
|
2016-11-15 14: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
|
2023-10-11 10:19:16 -07:00
|
|
|
PA_COMMON_ATTRIBUTES
|
2002-04-30 20:53:16 +00:00
|
|
|
|
2010-11-11 11:18:44 +03:00
|
|
|
dnl
|
2017-10-11 16:47:59 -07:00
|
|
|
dnl support function sections (if available)
|
2010-11-11 11:18:44 +03:00
|
|
|
dnl
|
2023-10-11 10:19:16 -07:00
|
|
|
PA_OPTION_GC
|
2017-10-11 16:47:59 -07:00
|
|
|
|
2017-02-28 18:48:01 -08:00
|
|
|
dnl
|
|
|
|
|
dnl support LTO
|
|
|
|
|
dnl
|
2023-10-11 10:19:16 -07:00
|
|
|
PA_OPTION_LTO
|
2017-02-28 18:48:01 -08:00
|
|
|
|
2017-10-11 16:47:59 -07:00
|
|
|
dnl
|
|
|
|
|
dnl support sanitizers (if available)
|
|
|
|
|
dnl
|
2023-10-11 10:19:16 -07:00
|
|
|
PA_OPTION_SANITIZER
|
2017-10-11 16:47:59 -07:00
|
|
|
|
2018-05-30 11:48:00 -07:00
|
|
|
dnl
|
|
|
|
|
dnl Don't make symbols visible, there is no point and it just
|
2020-06-30 10:14:21 -07:00
|
|
|
dnl makes the code slower. This mainly affects ELF.
|
2018-05-30 11:48:00 -07:00
|
|
|
dnl
|
2018-12-22 18:17:16 -08:00
|
|
|
PA_ADD_CFLAGS([-fvisibility=hidden])
|
2018-05-30 11:48:00 -07:00
|
|
|
|
2020-06-30 10:14:21 -07: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 00:54:30 -08:00
|
|
|
PA_ADD_CFLAGS([-Wall])
|
2019-08-16 00:52:26 -07:00
|
|
|
PA_ARG_DISABLED([pedantic],
|
|
|
|
|
[disable some extra paranoid compiler warnings],
|
|
|
|
|
[],
|
|
|
|
|
[PA_ADD_CFLAGS([-W])
|
2023-10-11 13:32:00 -07:00
|
|
|
PA_ADD_CFLAGS([-pedantic])
|
2020-06-30 10:14:21 -07:00
|
|
|
])
|
|
|
|
|
dnl Want to turn this on at some point...
|
2016-03-06 21:44:14 -08:00
|
|
|
dnl PA_ADD_CFLAGS([-Wwrite-strings])
|
2017-04-06 15:24:58 -07: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=comment])
|
|
|
|
|
PA_ADD_CFLAGS([-Werror=vla])]
|
|
|
|
|
)
|
2016-02-12 23:49:49 -08:00
|
|
|
|
2024-11-04 10:26:48 -08:00
|
|
|
dnl These warnings are apparently not included in -Wall -W -pedantic
|
|
|
|
|
dnl for some bizarre reason. They are, however, absolutely forbidden
|
|
|
|
|
dnl in this code base.
|
|
|
|
|
PA_ADD_CFLAGS([-Werror=strict-prototypes])
|
|
|
|
|
PA_ADD_CFLAGS([-Werror=missing-prototypes])
|
|
|
|
|
PA_ADD_CFLAGS([-Werror=missing-declarations])
|
|
|
|
|
|
2023-10-11 13:32:00 -07:00
|
|
|
dnl Variadic macros are used in this code, but only under explicit guard
|
|
|
|
|
PA_ADD_CFLAGS([-Wvariadic-macros],[-Wno-variadic-macros])
|
|
|
|
|
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])
|
|
|
|
|
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])
|
|
|
|
|
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-30 17:37:42 -07:00
|
|
|
dnl Warnings that are probabilistic based on the compiler version, and
|
|
|
|
|
dnl only should be used specifically when looking for opportunities to
|
|
|
|
|
dnl address or optimize these cases.
|
|
|
|
|
PA_ARG_ENABLED([suggestions],
|
|
|
|
|
[compile with compiler suggestion warnings enabled],
|
|
|
|
|
[PA_ADD_CFLAGS([-Wsuggest-attribute=pure])
|
|
|
|
|
PA_ADD_CFLAGS([-Wsuggest-attribute=const])
|
|
|
|
|
PA_ADD_CFLAGS([-Wsuggest-attribute=noreturn])
|
|
|
|
|
PA_ADD_CFLAGS([-Wsuggest-attribute=format])
|
|
|
|
|
PA_ADD_CFLAGS([-Wsuggest-attribute=cold])
|
|
|
|
|
PA_ADD_CFLAGS([-Wsuggest-attribute=malloc])])
|
|
|
|
|
|
2018-02-20 12:34:17 -08:00
|
|
|
dnl
|
2020-07-09 19:04:28 -07:00
|
|
|
dnl Test compiler features. On some compilers, this can be affected
|
|
|
|
|
dnl by -Werror options, so run this *after* those options are added.
|
2018-02-20 12:34:17 -08:00
|
|
|
dnl
|
|
|
|
|
PA_CHECK_BAD_STDC_INLINE
|
2020-07-09 19:04:28 -07:00
|
|
|
PA_C_TYPEOF
|
2018-02-20 12:34:17 -08:00
|
|
|
|
2026-07-06 14:09:02 -07:00
|
|
|
AC_CONFIG_FILES([Makefile doc/Makefile misc/Makefile test/Makefile travis.mak])
|
2020-05-26 14:13:31 -07:00
|
|
|
AC_OUTPUT
|