Skip to content

Commit a916e41

Browse files
author
H. Peter Anvin
committed
Merge remote-tracking branch 'github/nasm-2.16.xx'
2 parents cb29058 + 8ce37da commit a916e41

8 files changed

+137
-46
lines changed

autoconf/m4/pa_add_cppflags.m4

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
dnl --------------------------------------------------------------------------
2+
dnl PA_ADD_CPPFLAGS(variable, flag [,actual_flag [,success [,failure]]]])
3+
dnl
4+
dnl Attempt to add the given option to xFLAGS, if it doesn't break
5+
dnl compilation. If the option to be tested is different than the
6+
dnl option that should actually be added, add the option to be
7+
dnl actually added as a second argument.
8+
dnl --------------------------------------------------------------------------
9+
AC_DEFUN([PA_ADD_CPPFLAGS], [PA_ADD_FLAGS(CPPFLAGS, [$1], [$2], [$3], [$4])])

autoconf/m4/pa_add_flags.m4

+34-18
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,39 @@
11
dnl --------------------------------------------------------------------------
2-
dnl PA_ADD_FLAGS(variable, flag [,actual_flag [,success [,failure]]])
2+
dnl PA_ADD_FLAGS(flagvar, flags)
33
dnl
4-
dnl Attempt to add the given option to CPPFLAGS, if it doesn't break
5-
dnl compilation. If the option to be tested is different than the
6-
dnl option that should actually be added, add the option to be
7-
dnl actually added as a second argument.
4+
dnl Add [flags] to the variable [flagvar] if and only if it is accepted
5+
dnl by all languages affected by [flagvar], if those languages have
6+
dnl been previously seen in the script.
87
dnl --------------------------------------------------------------------------
98
AC_DEFUN([PA_ADD_FLAGS],
10-
[AC_MSG_CHECKING([if $CC accepts $2])
11-
pa_add_flags__old_flags="$$1"
12-
$1="$$1 $2"
13-
AC_LINK_IFELSE(
14-
[AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
15-
[printf("Hello, World!\n");])],
16-
[AC_MSG_RESULT([yes])
17-
$1="$pa_add_flags__old_flags ifelse([$3],[],[$2],[$3])"
18-
AC_DEFINE(PA_SYM([$1_],[$2]), 1,
19-
[Define to 1 if compiled with the `$2' compiler flag])
9+
[
10+
AS_VAR_PUSHDEF([old], [_$0_$1_orig])
11+
AS_VAR_PUSHDEF([ok], [_$0_$1_ok])
12+
AS_VAR_PUSHDEF([flags], [$1])
13+
14+
AS_VAR_COPY([old], [flags])
15+
AS_VAR_SET([flags], ["$flags $2"])
16+
AS_VAR_SET([ok], [yes])
17+
18+
PA_LANG_FOREACH(PA_FLAGS_LANGLIST($1),
19+
[AS_VAR_IF([ok], [yes],
20+
[AC_MSG_CHECKING([if $]_AC_CC[ accepts $2])
21+
PA_BUILD_IFELSE([],
22+
[AC_MSG_RESULT([yes])],
23+
[AC_MSG_RESULT([no])
24+
AS_VAR_SET([ok], [no])])])
25+
])
26+
27+
AS_VAR_IF([ok], [yes],
28+
[m4_ifnblank([$3],[AS_VAR_SET([flags], ["$old $3"])])
29+
m4_foreach_w([_pa_add_flags_flag], [m4_ifblank([$3],[$2],[$3])],
30+
[AC_DEFINE(PA_SYM([$1_]_pa_add_flags_flag), 1,
31+
[Define to 1 if compiled with the ]_pa_add_flags_flag[ compiler flag])])
2032
$4],
21-
[AC_MSG_RESULT([no])
22-
$1="$pa_add_flags__old_flags"
23-
$5])])
33+
[AS_VAR_SET([flags], ["$old"])
34+
$5])
35+
36+
AS_VAR_POPDEF([flags])
37+
AS_VAR_POPDEF([ok])
38+
AS_VAR_POPDEF([old])
39+
])

autoconf/m4/pa_build_ifelse.m4

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
dnl --------------------------------------------------------------------------
2+
dnl PA_BUILD_IFELSE(input [,success [,failure]])
3+
dnl
4+
dnl Same as AC_LINK_IFELSE for languages where linking is applicable,
5+
dnl otherwise AC_COMPILE_IFELSE.
6+
dnl
7+
dnl If the first argument is empty, use _AC_LANG_IO_PROGRAM.
8+
dnl --------------------------------------------------------------------------
9+
m4_defun([_PA_BUILD_IFELSE],
10+
[m4_case(_AC_LANG,
11+
[Erlang], [AC_COMPILE_IFELSE($@)],
12+
[AC_LINK_IFELSE($@)])])
13+
14+
AC_DEFUN([PA_BUILD_IFELSE],
15+
[_PA_BUILD_IFELSE([m4_ifblank([$1],[AC_LANG_SOURCE(_AC_LANG_IO_PROGRAM)],
16+
[$1])],[$2],[$3])])

autoconf/m4/pa_flags_langlist.m4

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
dnl --------------------------------------------------------------------------
2+
dnl PA_FLAGS_LANGLIST(flagvar)
3+
dnl
4+
dnl Return a list of languages affected by the variable flagvar.
5+
dnl If flagvar is unknown, assume it affects the current language.
6+
dnl --------------------------------------------------------------------------
7+
AC_DEFUN([PA_FLAGS_LANGLIST],
8+
[m4_dquote(m4_case([$1],
9+
[CPPFLAGS], [[C],[C++],[Objective C],[Objective C++]],
10+
[CFLAGS], [[C]],
11+
[CXXFLAGS], [[C++]],
12+
[FFLAGS], [[Fortran 77]],
13+
[FCFLAGS], [[Fortran]],
14+
[ERLCFLAGS], [[Erlang]],
15+
[OBJCFLAGS], [[Objective C]],
16+
[OBJCXXFLAGS], [[Objective C++]],
17+
[GOFLAGS], [[Go]],
18+
[LDFLAGS], [[C],[C++],[Fortran 77],[Fortran],[Objective C],[Objective C++],[Go]],
19+
m4_dquote(_AC_LANG)))])

autoconf/m4/pa_lang_foreach.m4

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
dnl --------------------------------------------------------------------------
2+
dnl PA_LANG_FOREACH(subset, body)
3+
dnl
4+
dnl Expand [body] for each language encountered in the configure script also
5+
dnl present in [subset], or all if [subset] is empty
6+
dnl --------------------------------------------------------------------------
7+
AC_DEFUN([_PA_LANG_DO],dnl
8+
[AC_LANG([$2])dnl
9+
$1])
10+
11+
AC_DEFUN([PA_LANG_FOREACH],dnl
12+
[m4_pushdef([_pa_lang_foreach_current],[_AC_LANG])dnl
13+
m4_map_args([m4_curry([_PA_LANG_DO],[$2])],m4_unquote(PA_LANG_SEEN_LIST($1)))dnl
14+
AC_LANG(_pa_lang_foreach_current)dnl
15+
m4_popdef([_pa_lang_foreach_current])])

autoconf/m4/pa_lang_seen_list.m4

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
dnl --------------------------------------------------------------------------
2+
dnl PA_LANG_SEEN_LIST(subset)
3+
dnl
4+
dnl List of the language lang has been used in the configuration
5+
dnl script so far, possibly subset by [subset].
6+
dnl
7+
dnl This relies on overriding _AC_LANG_SET(from, to),
8+
dnl the internal implementation of _AC_LANG.
9+
dnl --------------------------------------------------------------------------
10+
m4_ifndef([_PA_LANG_SET],
11+
[m4_rename([_AC_LANG_SET], [_PA_LANG_SET])dnl
12+
m4_defun([_AC_LANG_SET], [m4_set_add([_PA_LANG_SEEN_SET],[$2])dnl
13+
_PA_LANG_SET($@)])])
14+
15+
AC_DEFUN([PA_LANG_SEEN_LIST],
16+
[m4_set_delete([_pa_lang_seen_subset])dnl
17+
m4_pushdef([_pa_lang_seen_subset_list],m4_ifnblank([$1],[$1],m4_dquote(m4_set_list([_PA_LANG_SEEN_SET]))))dnl
18+
m4_set_add_all([_pa_lang_seen_subset],_pa_lang_seen_subset_list)dnl
19+
m4_cdr(m4_set_intersection([_pa_lang_seen_subset],[_PA_LANG_SEEN_SET]))dnl
20+
m4_popdef([_pa_lang_seen_subset_list])])

configure.ac

+18-27
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ dnl start; this is used to generate config/unconfig.h.
1212
AH_BOTTOM([
1313
/* Begin unconfig.h */])
1414

15-
dnl Save initial CFLAGS, to see if -g -O2 came from configure or not
16-
pa_init_cflags="$CFLAGS"
17-
1815
dnl This prevents us from running Wine and thinking we are not
1916
dnl cross-compiling when in fact we are; running Wine here is at
2017
dnl the best very slow and doesn't buy us a single thing at all.
@@ -27,35 +24,29 @@ AC_CANONICAL_HOST
2724
dnl Enable any available C extensions
2825
AC_PROG_CC
2926
AC_USE_SYSTEM_EXTENSIONS
30-
AC_SYS_LARGEFILE
31-
PA_ADD_CFLAGS([-std=c17], [], [],
32-
[PA_ADD_CFLAGS([-std=c11], [], [],
33-
[PA_ADD_CFLAGS([-std=c99])])])
34-
35-
dnl If the user did not specify a CFLAGS default, change default
36-
dnl to -O0 for debugging
37-
PA_ARG_DISABLED([optimization],
38-
[compile without optimization (-O0) to help debugging],
39-
[pa_no_optimize=true])
27+
PA_ADD_CPPFLAGS([-std=c17], [], [],
28+
[PA_ADD_CPPFLAGS([-std=c11], [], [],
29+
[PA_ADD_CPPFLAGS([-std=c99])])])
4030

41-
dnl Other programs
42-
pa_no_optimize=false
43-
44-
dnl Compile and link with dwarf debug
31+
dnl Compile and link with gdb debug extensions
4532
PA_ARG_ENABLED([gdb],
46-
[disable optimization and compile with extra debug information for GDB debugger],
47-
[PA_ADD_CFLAGS([-ggdb3])
48-
pa_no_optimize=true])
33+
[compile with extra debug information for GDB debugger],
34+
[PA_ADD_CFLAGS([-ggdb3])])
4935

50-
AS_IF([$pa_no_optimize],
51-
[PA_ADD_CFLAGS([-O0])
52-
PA_ADD_CFLAGS([-fno-omit-frame-pointer])])
36+
dnl Disable optimization
37+
PA_ARG_DISABLED([optimization],
38+
[compile without optimization (-O0) to help debugging],
39+
[PA_ADD_CFLAGS([-O0])
40+
PA_ADD_CFLAGS([-fno-omit-frame-pointer])])
5341

5442
dnl Profiling
5543
PA_ARG_ENABLED([profiling],
5644
[compile with profiling (-pg option)],
5745
[PA_ADD_CFLAGS([-pg])])
5846

47+
dnl Large files
48+
AC_SYS_LARGEFILE
49+
5950
dnl Abort on panic
6051
PA_ARG_ENABLED([panic-abort],
6152
[call abort() on panic to trap in the debugger],
@@ -104,10 +95,10 @@ AC_PROG_MAKE_SET
10495
AC_PROG_INSTALL
10596
AC_PROG_MKDIR_P
10697

107-
AC_CHECK_PROGS(NROFF, nroff, false)
108-
AC_CHECK_PROGS(ASCIIDOC, asciidoc, false)
109-
AC_CHECK_PROGS(XMLTO, xmlto, false)
110-
AC_CHECK_PROGS(XZ, xz, false)
98+
AC_CHECK_PROGS([NROFF], nroff, false)
99+
AC_CHECK_PROGS([ASCIIDOC], asciidoc, false)
100+
AC_CHECK_PROGS([XMLTO], xmlto, false)
101+
AC_CHECK_PROGS([XZ], xz, false)
111102

112103
dnl Check for progs needed for manpage generation
113104
MANPAGES=manpages

doc/changes.src

+6-1
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,17 @@
77
The NASM 2 series supports x86-64, and is the production version of NASM
88
since 2007.
99

10-
1110
\S{cl-2.17} Version 2.17
1211

1312
\b ... here goes release notes not intended to be included in the
1413
2.16.xx stable series ...
1514

15+
\S{cl-2.16.02} Version 2.16.02
16+
17+
\b Fix building from the source distribution in a separate directory
18+
from the source.
19+
20+
\b Update broken \c{autoconf} macros.
1621

1722
\S{cl-2.16.01} Version 2.16.01
1823

0 commit comments

Comments
 (0)