diff --git a/contrib/bmake/ChangeLog b/contrib/bmake/ChangeLog index 0762e4e6b925..d012520dc2bb 100644 --- a/contrib/bmake/ChangeLog +++ b/contrib/bmake/ChangeLog @@ -1,3 +1,132 @@ +2023-01-26 Simon J Gerraty + + * VERSION (_MAKE_VERSION): 20230126 + Merge with NetBSD make, pick up + o variables like .newline and .MAKE.{GID,PID,PPID,UID} + should be read-only. + +2023-01-23 Simon J Gerraty + + * VERSION (_MAKE_VERSION): 20230123 + Merge with NetBSD make, pick up + o .[NO]READONLY: for control of read-only variables + o .SYSPATH: for controlling the path searched for makefiles + +2023-01-20 Simon J Gerraty + + * VERSION (_MAKE_VERSION): 20230120 + Merge with NetBSD make, pick up + o allow for white-space between command specifiers @+- + o add more details to warning 'Extra targets ignored' + +2023-01-12 Simon J Gerraty + + * machine.sh: leverage os.sh rather than duplicate + also dispence with the $OS.$MACHINE values - we have $HOST_TARGET + for that purpose for the past decade or so. + We invariably get MACHINE and MACHINE_ARCH at runtime anyway. + +2023-01-02 Simon J Gerraty + + * VERSION (_MAKE_VERSION): 20230101 + Merge with NetBSD make, pick up + o cleanup comments, inline some LazyBuf_ methods + o unit-tests/ add/improve comments in tests + o make.1: sync list of built-in variables with reality + sort list of built-in variables + reduce indentation of the long list of variable names + use consistent markup for boolean flags + move description of .MAKE.MODE below the .MAKE.META block + clarify in which case an expression may omit braces + +2022-11-08 Simon J Gerraty + + * VERSION (_MAKE_VERSION): 20221024 + Merge with NetBSD make, pick up + o change return type of unlink_file back to int + +2022-10-07 Simon J Gerraty + + * Makefile: Darwin and Linux can handle MANTARGET=man + +2022-09-28 Simon J Gerraty + + * VERSION (_MAKE_VERSION): 20220928 + Merge with NetBSD make, pick up + o fix more ignored returns from snprintf + o compile with higher warnings + +2022-09-26 Simon J Gerraty + + * main.c meta.c: do not ignore return from snprintf + + * meta.c strlcpy.c: we need prototype for strlcpy + + * sigcompat.c: fix unused function warnings + +2022-09-24 Simon J Gerraty + + * VERSION (_MAKE_VERSION): 20220924 + Merge with NetBSD make, pick up + o fix bug in .break reset of conditional depth + o overhaul and simplify tracking of conditional depth + +2022-09-17 Simon J Gerraty + + * VERSION (_MAKE_VERSION): 20220912 + Merge with NetBSD make, pick up + o man page updates + +2022-09-09 Simon J Gerraty + + * VERSION (_MAKE_VERSION): 20220909 + Merge with NetBSD make, pick up + o update unit-tests to handle deprecation of egrep + o cond.c: add more details to error message for numeric comparison + + * configure.in: allow for deprecation of egrep + + * Makefile: Linux can handle MANTARGET=man + +2022-09-03 Simon J Gerraty + + * VERSION (_MAKE_VERSION): 20220903 + Merge with NetBSD make, pick up + o job.c: fix handling of null bytes in output + +2022-09-02 Simon J Gerraty + + * VERSION (_MAKE_VERSION): 20220902 + Merge with NetBSD make, pick up + o Allow .break to terminate a .for loop early + +2022-09-01 Simon J Gerraty + + * VERSION (_MAKE_VERSION): 20220901 + Merge with NetBSD make, pick up + o var.c: fix out-of-bounds errors when parsing + +2022-08-24 Simon J Gerraty + + * VERSION (_MAKE_VERSION): 20220824 + Merge with NetBSD make, pick up + o var.c: revert change to modifier parsing that breaks + shell variable references within ':@var@body@' + o adjust unit-tests + +2022-08-18 Simon J Gerraty + + * VERSION (_MAKE_VERSION): 20220818 + Merge with NetBSD make, pick up + o fix exit status for '-q' (since 1994) + +2022-08-08 Simon J Gerraty + + * VERSION (_MAKE_VERSION): 20220808 + Merge with NetBSD make, pick up + o var.c: fix parsing of modifiers containing unbalanced subexpressions + extract parsing of ':D' and ':U' modifiers into separate function + 2022-07-26 Simon J Gerraty * VERSION (_MAKE_VERSION): 20220726 diff --git a/contrib/bmake/FILES b/contrib/bmake/FILES index 7a6ca8ad6212..b88aa64271bf 100644 --- a/contrib/bmake/FILES +++ b/contrib/bmake/FILES @@ -322,6 +322,8 @@ unit-tests/directive-export-literal.exp unit-tests/directive-export-literal.mk unit-tests/directive-export.exp unit-tests/directive-export.mk +unit-tests/directive-for-break.exp +unit-tests/directive-for-break.mk unit-tests/directive-for-empty.exp unit-tests/directive-for-empty.mk unit-tests/directive-for-errors.exp @@ -402,8 +404,8 @@ unit-tests/impsrc.exp unit-tests/impsrc.mk unit-tests/include-main.exp unit-tests/include-main.mk -unit-tests/include-sub.mk -unit-tests/include-subsub.mk +unit-tests/include-sub.inc +unit-tests/include-subsub.inc unit-tests/job-flags.exp unit-tests/job-flags.mk unit-tests/job-output-long-lines.exp @@ -650,6 +652,8 @@ unit-tests/var-op-sunsh.exp unit-tests/var-op-sunsh.mk unit-tests/var-op.exp unit-tests/var-op.mk +unit-tests/var-readonly.exp +unit-tests/var-readonly.mk unit-tests/var-recursive.exp unit-tests/var-recursive.mk unit-tests/var-scope-cmdline.exp diff --git a/contrib/bmake/Makefile b/contrib/bmake/Makefile index 201e4869dc3f..ad78883ff890 100644 --- a/contrib/bmake/Makefile +++ b/contrib/bmake/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.120 2022/07/26 23:02:54 sjg Exp $ +# $Id: Makefile,v 1.122 2022/10/08 02:53:30 sjg Exp $ PROG= bmake @@ -88,7 +88,7 @@ OS := ${.MAKE.OS:U${uname -s:L:sh}} # are we 4.4BSD ? isBSD44:=${BSD44_LIST:M${OS}} -.if ${isBSD44} == "" +.if ${isBSD44} == "" && ${OS:NDarwin:NLinux} != "" MANTARGET= cat INSTALL?=${srcdir}/install-sh .if ${MACHINE} == "sun386" diff --git a/contrib/bmake/Makefile.config.in b/contrib/bmake/Makefile.config.in index 042b2570ff88..dfc26d90a02a 100644 --- a/contrib/bmake/Makefile.config.in +++ b/contrib/bmake/Makefile.config.in @@ -9,6 +9,7 @@ CC= @CC@ @force_machine_arch@MACHINE_ARCH?= @machine_arch@ DEFAULT_SYS_PATH?= @default_sys_path@ +EGREP = @egrep@ CPPFLAGS+= @CPPFLAGS@ CFLAGS+= ${CPPFLAGS} @DEFS@ LDFLAGS+= @LDFLAGS@ diff --git a/contrib/bmake/VERSION b/contrib/bmake/VERSION index bbf893546603..d57c71f1e797 100644 --- a/contrib/bmake/VERSION +++ b/contrib/bmake/VERSION @@ -1,2 +1,2 @@ # keep this compatible with sh and make -_MAKE_VERSION=20220726 +_MAKE_VERSION=20230126 diff --git a/contrib/bmake/arch.c b/contrib/bmake/arch.c index 5e561b132f36..15816fd0b606 100644 --- a/contrib/bmake/arch.c +++ b/contrib/bmake/arch.c @@ -1,4 +1,4 @@ -/* $NetBSD: arch.c,v 1.210 2022/01/15 18:34:41 rillig Exp $ */ +/* $NetBSD: arch.c,v 1.212 2022/12/07 10:28:48 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -147,7 +147,7 @@ struct ar_hdr { #include "dir.h" /* "@(#)arch.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: arch.c,v 1.210 2022/01/15 18:34:41 rillig Exp $"); +MAKE_RCSID("$NetBSD: arch.c,v 1.212 2022/12/07 10:28:48 rillig Exp $"); typedef struct List ArchList; typedef struct ListNode ArchListNode; @@ -353,11 +353,10 @@ Arch_ParseArchive(char **pp, GNodeList *gns, GNode *scope) */ /* * If member contains variables, try and substitute for them. - * This will slow down archive specs with dynamic sources, of - * course, since we'll be (non-)substituting them three - * times, but them's the breaks -- we need to do this since - * SuffExpandChildren calls us, otherwise we could assume the - * thing would be taken care of later. + * This slows down archive specs with dynamic sources, since + * they are (non-)substituted three times, but we need to do + * this since SuffExpandChildren calls us, otherwise we could + * assume the substitutions would be taken care of later. */ if (doSubst) { char *fullName; @@ -594,7 +593,8 @@ ArchStatMember(const char *archive, const char *member, bool addToCache) if (strncmp(memName, AR_EFMT1, sizeof AR_EFMT1 - 1) == 0 && ch_isdigit(memName[sizeof AR_EFMT1 - 1])) { - size_t elen = atoi(memName + sizeof AR_EFMT1 - 1); + size_t elen = (size_t)atoi( + memName + sizeof AR_EFMT1 - 1); if (elen > MAXPATHLEN) goto badarch; @@ -836,7 +836,7 @@ ArchFindMember(const char *archive, const char *member, struct ar_hdr *out_arh, if (strncmp(out_arh->AR_NAME, AR_EFMT1, sizeof AR_EFMT1 - 1) == 0 && (ch_isdigit(out_arh->AR_NAME[sizeof AR_EFMT1 - 1]))) { - size_t elen = atoi( + size_t elen = (size_t)atoi( &out_arh->AR_NAME[sizeof AR_EFMT1 - 1]); char ename[MAXPATHLEN + 1]; diff --git a/contrib/bmake/bmake.1 b/contrib/bmake/bmake.1 index 9e7889a03923..13bb9e9235b9 100644 --- a/contrib/bmake/bmake.1 +++ b/contrib/bmake/bmake.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.315 2022/07/12 23:47:00 rillig Exp $ +.\" $NetBSD: make.1,v 1.360 2023/01/26 20:48:17 sjg Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd July 12, 2022 +.Dd January 26, 2023 .Dt BMAKE 1 .Os .Sh NAME @@ -49,8 +49,8 @@ .Op Fl T Ar file .Op Fl V Ar variable .Op Fl v Ar variable -.Op Ar variable=value -.Op Ar target ... +.Op Ar variable\| Ns Cm \&= Ns Ar value +.Op Ar target No ... .Sh DESCRIPTION .Nm is a program designed to simplify the maintenance of other programs. @@ -58,34 +58,35 @@ Its input is a list of specifications as to the files upon which programs and other files depend. If no .Fl f Ar makefile -makefile option is given, +option is given, .Nm -will try to open +tries to open .Sq Pa makefile then .Sq Pa Makefile in order to find the specifications. If the file .Sq Pa .depend -exists, it is read (see -.Xr mkdep 1 ) . +exists, it is read, see +.Xr mkdep 1 . .Pp This manual page is intended as a reference document only. For a more thorough description of .Nm and makefiles, please refer to -.%T "PMake \- A Tutorial" . +.%T "PMake \- A Tutorial" +(from 1993). .Pp .Nm -will prepend the contents of the -.Va MAKEFLAGS +prepends the contents of the +.Ev MAKEFLAGS environment variable to the command line arguments before parsing them. .Pp The options are as follows: .Bl -tag -width Ds .It Fl B Try to be backwards compatible by executing a single shell per command and -by executing the commands to make the sources of a dependency line in sequence. +by making the sources of a dependency line in sequence. .It Fl C Ar directory Change to .Ar directory @@ -100,92 +101,97 @@ is equivalent to Define .Ar variable to be 1, in the global scope. -.It Fl d Ar [-]flags +.It Fl d Oo Cm \- Oc Ns Ar flags Turn on debugging, and specify which portions of .Nm are to print debugging information. Unless the flags are preceded by -.Ql \- +.Ql \- , they are added to the -.Va MAKEFLAGS -environment variable and will be processed by any child make processes. +.Ev MAKEFLAGS +environment variable and are passed on to any child make processes. By default, debugging information is printed to standard error, but this can be changed using the -.Ar F +.Cm F debugging flag. The debugging output is always unbuffered; in addition, if debugging is enabled but debugging output is not directed to standard output, -then the standard output is line buffered. -.Ar Flags -is one or more of the following: +the standard output is line buffered. +The available +.Ar flags +are: .Bl -tag -width Ds -.It Ar A +.It Cm A Print all possible debugging information; equivalent to specifying all of the debugging flags. -.It Ar a +.It Cm a Print debugging information about archive searching and caching. -.It Ar C -Print debugging information about current working directory. -.It Ar c +.It Cm C +Print debugging information about the current working directory. +.It Cm c Print debugging information about conditional evaluation. -.It Ar d +.It Cm d Print debugging information about directory searching and caching. -.It Ar e +.It Cm e Print debugging information about failed commands and targets. -.It Ar F Ns Oo Sy \&+ Oc Ns Ar filename +.It Cm F Ns Oo Cm \&+ Oc Ns Ar filename Specify where debugging output is written. This must be the last flag, because it consumes the remainder of the argument. If the character immediately after the -.Ql F +.Cm F flag is .Ql \&+ , -then the file will be opened in append mode; -otherwise the file will be overwritten. +the file is opened in append mode; +otherwise the file is overwritten. If the file name is .Ql stdout or -.Ql stderr -then debugging output will be written to the -standard output or standard error output file descriptors respectively -(and the +.Ql stderr , +debugging output is written to the standard output or standard error output +respectively (and the .Ql \&+ option has no effect). -Otherwise, the output will be written to the named file. -If the file name ends -.Ql .%d -then the +Otherwise, the output is written to the named file. +If the file name ends with +.Ql .%d , +the .Ql %d is replaced by the pid. -.It Ar f +.It Cm f Print debugging information about loop evaluation. -.It Ar "g1" +.It Cm g1 Print the input graph before making anything. -.It Ar "g2" +.It Cm g2 Print the input graph after making everything, or before exiting on error. -.It Ar "g3" +.It Cm g3 Print the input graph before exiting on error. -.It Ar h +.It Cm h Print debugging information about hash table operations. -.It Ar j +.It Cm j Print debugging information about running multiple shells. -.It Ar L +.It Cm L Turn on lint checks. -This will throw errors for variable assignments that do not parse -correctly, at the time of assignment so the file and line number -are available. -.It Ar l +This throws errors for variable assignments that do not parse correctly, +at the time of assignment, so the file and line number are available. +.It Cm l Print commands in Makefiles regardless of whether or not they are prefixed by .Ql @ -or other "quiet" flags. -Also known as "loud" behavior. -.It Ar M -Print debugging information about "meta" mode decisions about targets. -.It Ar m +or other +.Dq quiet +flags. +Also known as +.Dq loud +behavior. +.It Cm M +Print debugging information about +.Dq meta +mode decisions about targets. +.It Cm m Print debugging information about making targets, including modification dates. -.It Ar n +.It Cm n Don't delete the temporary command scripts created when running commands. These temporary scripts are created in the directory referred to by the @@ -205,35 +211,36 @@ This can create many files in or .Pa /tmp , so use with care. -.It Ar p +.It Cm p Print debugging information about makefile parsing. -.It Ar s +.It Cm s Print debugging information about suffix-transformation rules. -.It Ar t +.It Cm t Print debugging information about target list maintenance. -.It Ar V +.It Cm V Force the .Fl V -option to print raw values of variables, overriding the default behavior -set via +option to print raw values of variables, +overriding the default behavior set via .Va .MAKE.EXPAND_VARIABLES . -.It Ar v -Print debugging information about variable assignment. -.It Ar x +.It Cm v +Print debugging information about variable assignment and expansion. +.It Cm x Run shell commands with .Fl x so the actual commands are printed as they are executed. .El .It Fl e -Specify that environment variables override macro assignments within -makefiles. +Let environment variables override global variables within makefiles. .It Fl f Ar makefile Specify a makefile to read instead of the default -.Sq Pa makefile . +.Pa makefile +or +.Pa Makefile . If .Ar makefile is -.Sq Fl , +.Ql \&- , standard input is read. Multiple makefiles may be specified, and are read in the order specified. .It Fl I Ar directory @@ -244,7 +251,7 @@ option) is automatically included as part of this list. .It Fl i Ignore non-zero exit of shell commands in the makefile. Equivalent to specifying -.Sq Fl +.Ql \&- before each command line in the makefile. .It Fl J Ar private This option should @@ -277,56 +284,61 @@ compatibility on. Continue processing after errors are encountered, but only on those targets that do not depend on the target whose creation caused the error. .It Fl m Ar directory -Specify a directory in which to search for sys.mk and makefiles included -via the +Specify a directory in which to search for +.Pa sys.mk +and makefiles included via the .Li \&< Ns Ar file Ns Li \&> Ns -style include statement. The .Fl m option can be used multiple times to form a search path. -This path will override the default system include path: /usr/share/mk. -Furthermore the system include path will be appended to the search path used -for +This path overrides the default system include path +.Pa /usr/share/mk . +Furthermore, the system include path is appended to the search path used for .Li \*q Ns Ar file Ns Li \*q Ns -style include statements (see the .Fl I option). +The system include path can be referenced via the read-only variable +.Va .SYSPATH . .Pp -If a file or directory name in the +If a directory name in the .Fl m argument (or the .Ev MAKESYSPATH environment variable) starts with the string -.Qq \&.../ -then +.Ql \&.../ , .Nm -will search for the specified file or directory named in the remaining part +searches for the specified file or directory named in the remaining part of the argument string. -The search starts with the current directory of -the Makefile and then works upward towards the root of the file system. -If the search is successful, then the resulting directory replaces the -.Qq \&.../ +The search starts with the current directory +and then works upward towards the root of the file system. +If the search is successful, the resulting directory replaces the +.Ql \&.../ specification in the .Fl m argument. -If used, this feature allows +This feature allows .Nm -to easily search in the current source tree for customized sys.mk files -(e.g., by using -.Qq \&.../mk/sys.mk +to easily search in the current source tree for customized +.Pa sys.mk +files (e.g., by using +.Ql \&.../mk/sys.mk as an argument). .It Fl n Display the commands that would have been executed, but do not -actually execute them unless the target depends on the .MAKE special -source (see below) or the command is prefixed with -.Sq Ic + . +actually execute them unless the target depends on the +.Va .MAKE +special source (see below) or the command is prefixed with +.Sq Cm + . .It Fl N -Display the commands which would have been executed, but do not -actually execute any of them; useful for debugging top-level makefiles +Display the commands that would have been executed, +but do not actually execute any of them; +useful for debugging top-level makefiles without descending into subdirectories. .It Fl q -Do not execute any commands, but exit 0 if the specified targets are -up-to-date and 1, otherwise. +Do not execute any commands, +instead exit 0 if the specified targets are up to date, and 1 otherwise. .It Fl r Do not use the built-in rules specified in the system makefile. .It Fl S @@ -353,24 +365,25 @@ Print the value of .Ar variable . Do not build any targets. Multiple instances of this option may be specified; -the variables will be printed one per line, +the variables are printed one per line, with a blank line for each null or undefined variable. The value printed is extracted from the global scope after all makefiles have been read. +.Pp By default, the raw variable contents (which may include additional unexpanded variable references) are shown. If .Ar variable contains a -.Ql \&$ -then the value will be recursively expanded to its complete resultant -text before printing. -The expanded value will also be printed if +.Ql \&$ , +it is not interpreted as a variable name but rather as an expression. +Its value is expanded before printing. +The value is also expanded before printing if .Va .MAKE.EXPAND_VARIABLES -is set to true and -the +is set to true and the .Fl dV option has not been used to override it. +.Pp Note that loop-local and target-local variables, as well as values taken temporarily by global variables during makefile processing, are not accessible via this option. @@ -380,8 +393,13 @@ debug mode can be used to see these at the cost of generating substantial extraneous output. .It Fl v Ar variable Like +.Fl V , +but all printed variables are always expanded to their complete value. +The last occurrence of .Fl V -but the variable is always expanded to its complete value. +or +.Fl v +decides whether all variables are expanded or not. .It Fl W Treat any warnings during makefile parsing as errors. .It Fl w @@ -389,13 +407,12 @@ Print entering and leaving directory messages, pre and post processing. .It Fl X Don't export variables passed on the command line to the environment individually. -Variables passed on the command line are still exported -via the -.Va MAKEFLAGS +Variables passed on the command line are still exported via the +.Ev MAKEFLAGS environment variable. This option may be useful on systems which have a small limit on the size of command arguments. -.It Ar variable=value +.It Ar variable\| Ns Cm \&= Ns Ar value Set the value of the variable .Ar variable to @@ -409,12 +426,12 @@ Variable assignments should follow options for POSIX compatibility but no ordering is enforced. .El .Pp -There are seven different types of lines in a makefile: file dependency +There are several different types of lines in a makefile: dependency specifications, shell commands, variable assignments, include statements, -conditional directives, for loops, and comments. +conditional directives, for loops, other directives, and comments. .Pp -In general, lines may be continued from one line to the next by ending -them with a backslash +Lines may be continued from one line to the next +by ending them with a backslash .Pq Ql \e . The trailing newline character and initial whitespace on the following line are compressed into a single space. @@ -423,11 +440,10 @@ Dependency lines consist of one or more targets, an operator, and zero or more sources. This creates a relationship where the targets .Dq depend -on the sources -and are customarily created from them. -A target is considered out-of-date if it does not exist, or if its -modification time is less than that of any of its sources. -An out-of-date target will be re-created, but not until all sources +on the sources and are customarily created from them. +A target is considered out of date if it does not exist, +or if its modification time is less than that of any of its sources. +An out-of-date target is re-created, but not until all sources have been examined and themselves re-created as needed. Three operators may be used: .Bl -tag -width flag @@ -451,15 +467,16 @@ shell commands are run if the target is out of date with respect to Thus, different groups of the attached shell commands may be run depending on the circumstances. Furthermore, unlike -.Ic \&:, +.Ic \&: , for dependency lines with no sources, the attached shell commands are always run. Also unlike -.Ic \&:, -the target will not be removed if +.Ic \&: , +the target is not removed if .Nm is interrupted. .El +.Pp All dependency lines mentioning a particular target must use the same operator. .Pp @@ -474,123 +491,115 @@ The values .Ql * , and .Ql [] -may only be used as part of the final -component of the target or source, and must be used to describe existing -files. +may only be used as part of the final component of the target or source, +and only match existing files. The value .Ql {} need not necessarily be used to describe existing files. Expansion is in directory order, not alphabetically as done in the shell. .Sh SHELL COMMANDS -Each target may have associated with it one or more lines of shell -commands, normally -used to create the target. +Each target may have associated with it one or more lines of shell commands, +normally used to create the target. Each of the lines in this script .Em must be preceded by a tab. (For historical reasons, spaces are not accepted.) -While targets can appear in many dependency lines if desired, by -default only one of these rules may be followed by a creation -script. +While targets can occur in many dependency lines if desired, +by default only one of these rules may be followed by a creation script. If the .Sq Ic \&:: -operator is used, however, all rules may include scripts and the -scripts are executed in the order found. +operator is used, however, all rules may include scripts, +and the respective scripts are executed in the order found. .Pp -Each line is treated as a separate shell command, unless the end of -line is escaped with a backslash -.Pq Ql \e +Each line is treated as a separate shell command, +unless the end of line is escaped with a backslash +.Ql \e , in which case that line and the next are combined. -.\" The escaped newline is retained and passed to the shell, which -.\" normally ignores it. -.\" However, the tab at the beginning of the following line is removed. If the first characters of the command are any combination of .Sq Ic @ , .Sq Ic + , or .Sq Ic \- , the command is treated specially. -A -.Sq Ic @ +.Bl -tag -offset indent -width indent +.It Ic @ causes the command not to be echoed before it is executed. -A -.Sq Ic + +.It Ic + causes the command to be executed even when .Fl n is given. -This is similar to the effect of the .MAKE special source, +This is similar to the effect of the +.Va .MAKE +special source, except that the effect can be limited to a single line of a script. -A -.Sq Ic \- +.It Ic \- in compatibility mode causes any non-zero exit status of the command line to be ignored. +.El .Pp When .Nm is run in jobs mode with .Fl j Ar max_jobs , -the entire script for the target is fed to a -single instance of the shell. +the entire script for the target is fed to a single instance of the shell. In compatibility (non-jobs) mode, each command is run in a separate process. If the command contains any shell meta characters -.Pq Ql #=|^(){};&<>*?[]:$`\e\en -it will be passed to the shell; otherwise +.Pq Ql #=|^(){};&<>*?[]:$`\e\en , +it is passed to the shell; otherwise .Nm -will attempt direct execution. +attempts direct execution. If a line starts with .Sq Ic \- -and the shell has ErrCtl enabled then failure of the command line -will be ignored as in compatibility mode. +and the shell has ErrCtl enabled, +failure of the command line is ignored as in compatibility mode. Otherwise .Sq Ic \- affects the entire job; -the script will stop at the first command line that fails, -but the target will not be deemed to have failed. +the script stops at the first command line that fails, +but the target is not deemed to have failed. .Pp Makefiles should be written so that the mode of .Nm operation does not change their behavior. -For example, any command which needs to use +For example, any command which uses .Dq cd or .Dq chdir -without potentially changing the directory for subsequent commands +without the intention of changing the directory for subsequent commands should be put in parentheses so it executes in a subshell. -To force the use of one shell, escape the line breaks so as to make +To force the use of a single shell, escape the line breaks so as to make the whole script one command. For example: .Bd -literal -offset indent avoid-chdir-side-effects: - @echo Building $@ in `pwd` + @echo "Building $@ in $$(pwd)" @(cd ${.CURDIR} && ${MAKE} $@) - @echo Back in `pwd` + @echo "Back in $$(pwd)" ensure-one-shell-regardless-of-mode: - @echo Building $@ in `pwd`; \e + @echo "Building $@ in $$(pwd)"; \e (cd ${.CURDIR} && ${MAKE} $@); \e - echo Back in `pwd` + echo "Back in $$(pwd)" .Ed .Pp Since .Nm -will -.Xr chdir 2 -to +changes the current working directory to .Sq Va .OBJDIR -before executing any targets, each child process -starts with that as its current working directory. +before executing any targets, +each child process starts with that as its current working directory. .Sh VARIABLE ASSIGNMENTS Variables in make behave much like macros in the C preprocessor. .Pp Variable assignments have the form .Sq Ar NAME Ar op Ar value , where: -.Bl -tag -width Ds +.Bl -tag -offset Ds -width Ds .It Ar NAME is a single-word variable name, consisting, by tradition, of all upper-case letters, .It Ar op -is one of the five variable assignment operators described below, and +is one of the variable assignment operators described below, and .It Ar value is interpreted according to the variable assignment operator. .El @@ -602,7 +611,7 @@ and .Ar value is discarded. .Ss Variable assignment operators -The five operators that can be used to assign values to variables are: +The five operators that assign values to variables are: .Bl -tag -width Ds .It Ic \&= Assign the value to the variable. @@ -613,39 +622,43 @@ separating them by a single space. .It Ic \&?= Assign the value to the variable if it is not already defined. .It Ic \&:= -Assign with expansion, i.e. expand the value before assigning it -to the variable. -Normally, expansion is not done until the variable is referenced. +Expand the value, then assign it to the variable. .Pp .Em NOTE : References to undefined variables are .Em not expanded. This can cause problems when variable modifiers are used. +.\" See var-op-expand.mk, the section with LATER and INDIRECT. .It Ic \&!= -Expand the value and pass it to the shell for execution and assign -the result to the variable. +Expand the value and pass it to the shell for execution, +then assign the output from the child's standard output to the variable. Any newlines in the result are replaced with spaces. .El .Ss Expansion of variables -In contexts where variables are expanded, +In most contexts where variables are expanded, .Ql \&$$ expands to a single dollar sign. +In other contexts (most variable modifiers, string literals in conditions), +.Ql \&\e$ +expands to a single dollar sign. +.Pp References to variables have the form -.Ql \&${ Ns Ar name Ns Oo \&: Ns Ar modifiers Oc Ns } +.Cm \&${ Ns Ar name Ns Oo Ns Cm \&: Ns Ar modifiers Oc Ns Cm \&} or -.Ql \&$( Ns Ar name Ns Oo \&: Ns Ar modifiers Oc Ns ) . -If the variable name contains only a single character, +.Cm \&$( Ns Ar name Ns Oo Ns Cm \&: Ns Ar modifiers Oc Ns Cm \&) . +If the variable name consists of only a single character +and the expression contains no modifiers, the surrounding curly braces or parentheses are not required. This shorter form is not recommended. .Pp -If the variable name contains a dollar, then the name itself is expanded first. +If the variable name contains a dollar, the name itself is expanded first. This allows almost arbitrary variable names, however names containing dollar, -braces, parentheses, or whitespace are really best avoided. +braces, parentheses or whitespace are really best avoided. .Pp -If the result of expanding a variable contains a dollar sign +If the result of expanding a nested variable expression contains a dollar sign .Pq Ql \&$ , -the string is expanded again. +the result is subject to further expansion. .Pp Variable substitution occurs at four distinct times, depending on where the variable is being used. @@ -659,38 +672,48 @@ but only as far as necessary to determine the result of the conditional. Variables in shell commands are expanded when the shell command is executed. .It -.Dq .for +.Ic .for loop index variables are expanded on each loop iteration. Note that other variables are not expanded when composing the body of a loop, so the following example code: .Bd -literal -offset indent - -.Dv .for i in 1 2 3 +\&.for i in 1 2 3 a+= ${i} j= ${i} b+= ${j} -.Dv .endfor +\&.endfor all: @echo ${a} @echo ${b} - .Ed -will print: +.Pp +prints: .Bd -literal -offset indent 1 2 3 3 3 3 - .Ed -Because while ${a} contains -.Dq 1 2 3 -after the loop is executed, ${b} +.Pp +After the loop is executed: +.Bl -tag -offset indent -width indent +.It Va a contains -.Dq ${j} ${j} ${j} +.Ql ${:U1} ${:U2} ${:U3} , which expands to -.Dq 3 3 3 -since after the loop completes ${j} contains -.Dq 3 . +.Ql 1 2 3 . +.It Va j +contains +.Ql ${:U3} , +which expands to +.Ql 3 . +.It Va b +contains +.Ql ${j} ${j} ${j} , +which expands to +.Ql ${:U3} ${:U3} ${:U3} +and further to +.Ql 3 3 3 . +.El .El .Ss Variable classes The four different classes of variables (in order of increasing precedence) @@ -708,12 +731,12 @@ Variables defined as part of the command line. Variables that are defined specific to a certain target. .El .Pp -Local variables can be set on a dependency line, if +Local variables can be set on a dependency line, unless .Va .MAKE.TARGET_LOCAL_VARIABLES -is not set to +is set to .Ql false . The rest of the line -(which will already have had global variables expanded) +(which already has had global variables expanded) is the variable value. For example: .Bd -literal -offset indent @@ -724,8 +747,10 @@ ${OBJS}: .MAKE.META.CMP_FILTER=${COMPILER_WRAPPERS:S,^,N,} .Pp Only the targets .Ql ${OBJS} -will be impacted by that filter (in "meta" mode) and -simply enabling/disabling any of the compiler wrappers will not render all +are impacted by that filter (in +.Dq meta +mode) and +simply enabling/disabling any of the compiler wrappers does not render all of those targets out-of-date. .Pp .Em NOTE : @@ -739,8 +764,8 @@ Is redundant with respect to global variables, which have already been expanded. .El .Pp -The seven built-in local variables are as follows: -.Bl -tag -width ".ARCHIVE" -offset indent +The seven built-in local variables are: +.Bl -tag -width ".Va .ARCHIVE" -offset indent .It Va .ALLSRC The list of all sources for this target; also known as .Sq Va \&> . @@ -766,25 +791,27 @@ The file prefix of the target, containing only the file portion, no suffix or preceding directory components; also known as .Sq Va * . The suffix must be one of the known suffixes declared with -.Ic .SUFFIXES -or it will not be recognized. +.Ic .SUFFIXES , +or it is not recognized. .It Va .TARGET The name of the target; also known as .Sq Va @ . For compatibility with other makes this is an alias for -.Ic .ARCHIVE +.Va .ARCHIVE in archive member rules. .El .Pp The shorter forms -.Ql ( Va > , +.Po +.Sq Va \&> , .Sq Va \&! , -.Sq Va < , -.Sq Va % , +.Sq Va \&< , +.Sq Va \&% , .Sq Va \&? , -.Sq Va * , +.Sq Va \&* , and -.Sq Va @ ) +.Sq Va \&@ +.Pc are permitted for backward compatibility with historical makefiles and legacy POSIX make and are not recommended. @@ -794,7 +821,7 @@ Variants of these variables with the punctuation followed immediately by or .Ql F , e.g.\& -.Sq Va $(@D) , +.Ql $(@D) , are legacy forms equivalent to using the .Ql :H and @@ -816,41 +843,72 @@ and In addition, .Nm sets or knows about the following variables: -.Bl -tag -width .MAKEOVERRIDES +.Bl -tag +.\" NB: This list is sorted case-insensitive, ignoring punctuation. +.\" NB: To find all built-in variables in make's source code, +.\" NB: search for Var_*, Global_*, SetVarObjdir, GetBooleanExpr, +.\" NB: and the implementation of Var_SetWithFlags. +.\" NB: Last synced on 2023-01-01. .It Va .ALLTARGETS -The list of all targets encountered in the Makefile. -If evaluated during -Makefile parsing, lists only those targets encountered thus far. +The list of all targets encountered in the makefiles. +If evaluated during makefile parsing, +lists only those targets encountered thus far. .It Va .CURDIR A path to the directory where .Nm was executed. Refer to the description of -.Sq Ev PWD +.Sq Va PWD for more details. +.It Va .ERROR_CMD +Is used in error handling, see +.Va MAKE_PRINT_VAR_ON_ERROR . +.It Va .ERROR_CWD +Is used in error handling, see +.Va MAKE_PRINT_VAR_ON_ERROR . +.It Va .ERROR_META_FILE +Is used in error handling in +.Dq meta +mode, see +.Va MAKE_PRINT_VAR_ON_ERROR . +.It Va .ERROR_TARGET +Is used in error handling, see +.Va MAKE_PRINT_VAR_ON_ERROR . .It Va .INCLUDEDFROMDIR -The directory of the file this Makefile was included from. +The directory of the file this makefile was included from. .It Va .INCLUDEDFROMFILE -The filename of the file this Makefile was included from. -.It Ev MAKE +The filename of the file this makefile was included from. +.\" .INCLUDES is intentionally undocumented, as it is obsolete. +.\" .LIBS is intentionally undocumented, as it is obsolete. +.It Va MACHINE +The machine hardware name, see +.Xr uname 1 . +.It Va MACHINE_ARCH +The machine processor architecture name, see +.Xr uname 1 . +.It Va MAKE The name that .Nm was executed with .Pq Va argv[0] . -For compatibility -.Nm -also sets -.Va .MAKE -with the same value. +.It Va .MAKE +The same as +.Va MAKE , +for compatibility. The preferred variable to use is the environment variable .Ev MAKE -because it is more compatible with other versions of -.Nm +because it is more compatible with other make variants and cannot be confused with the special target with the same name. +.\" '.MAKE.cmd_filtered' is intentionally undocumented, +.\" as it is an internal implementation detail. .It Va .MAKE.DEPENDFILE Names the makefile (default .Sq Pa .depend ) from which generated dependencies are read. +.It Va .MAKE.DIE_QUIETLY +If set to +.Ql true , +do not print error information at the end. .It Va .MAKE.EXPAND_VARIABLES A boolean that controls the default behavior of the .Fl V @@ -862,35 +920,10 @@ include additional unexpanded variable references) are shown. .It Va .MAKE.EXPORTED The list of variables exported by .Nm . -.It Va .MAKE.JOBS -The argument to the -.Fl j -option. -.It Va .MAKE.JOB.PREFIX -If -.Nm -is run with -.Fl j , -the output for each target is prefixed with a token -.Ql --- target --- -the first part of which can be controlled via -.Va .MAKE.JOB.PREFIX . -If -.Va .MAKE.JOB.PREFIX -is empty, no token is printed. -For example, setting -.Va .MAKE.JOB.PREFIX -to -.Li ${.newline}---${.MAKE:T}[${.MAKE.PID}] -would produce tokens like -.Ql ---make[1234] target --- -making it easier to track the degree of parallelism being achieved. -.It .MAKE.TARGET_LOCAL_VARIABLES -If set to -.Ql false , -apparent variable assignments in dependency lines are -treated as normal sources. -.It Ev MAKEFLAGS +.It Va MAKEFILE +The top-level makefile that is currently read, +as given in the command line. +.It Va .MAKEFLAGS The environment variable .Sq Ev MAKEFLAGS may contain anything that @@ -900,21 +933,49 @@ command line. Anything specified on .Nm Ns 's command line is appended to the -.Sq Ev MAKEFLAGS -variable which is then -entered into the environment for all programs which +.Va .MAKEFLAGS +variable, which is then added to the environment for all programs that .Nm executes. +.It Va .MAKE.GID +The numeric group ID of the user running +.Nm . +It is read-only. +.It Va .MAKE.JOB.PREFIX +If +.Nm +is run with +.Fl j , +the output for each target is prefixed with a token +.Dl --- Ar target Li --- +the first part of which can be controlled via +.Va .MAKE.JOB.PREFIX . +If +.Va .MAKE.JOB.PREFIX +is empty, no token is printed. +For example, setting +.Va .MAKE.JOB.PREFIX +to +.Ql ${.newline}---${.MAKE:T}[${.MAKE.PID}] +would produce tokens like +.Dl ---make[1234] Ar target Li --- +making it easier to track the degree of parallelism being achieved. +.It Va .MAKE.JOBS +The argument to the +.Fl j +option. .It Va .MAKE.LEVEL The recursion depth of .Nm . -The initial instance of +The top-level instance of .Nm -will be 0, and an incremented value is put into the environment -to be seen by the next generation. +has level 0, and each child make has its parent level plus 1. This allows tests like: .Li .if ${.MAKE.LEVEL} == 0 -to protect things which should only be evaluated in the initial instance of +to protect things which should only be evaluated in the top-level instance of +.Nm . +.It Va .MAKE.LEVEL.ENV +The name of the environment variable that stores the level of nested calls to .Nm . .It Va .MAKE.MAKEFILE_PREFERENCE The ordered list of makefile names @@ -923,79 +984,16 @@ The ordered list of makefile names .Sq Pa Makefile ) that .Nm -will look for. +looks for. .It Va .MAKE.MAKEFILES The list of makefiles read by .Nm , which is useful for tracking dependencies. Each makefile is recorded only once, regardless of the number of times read. -.It Va .MAKE.MODE -Processed after reading all makefiles. -Can affect the mode that -.Nm -runs in. -It can contain a number of keywords: -.Bl -hang -width missing-filemon=bf. -.It Pa compat -Like -.Fl B , -puts -.Nm -into "compat" mode. -.It Pa meta -Puts -.Nm -into "meta" mode, where meta files are created for each target -to capture the command run, the output generated and if -.Xr filemon 4 -is available, the system calls which are of interest to -.Nm . -The captured output can be very useful when diagnosing errors. -.It Pa curdirOk= Ar bf -Normally -.Nm -will not create .meta files in -.Sq Va .CURDIR . -This can be overridden by setting -.Va bf -to a value which represents True. -.It Pa missing-meta= Ar bf -If -.Va bf -is True, then a missing .meta file makes the target out-of-date. -.It Pa missing-filemon= Ar bf -If -.Va bf -is True, then missing filemon data makes the target out-of-date. -.It Pa nofilemon -Do not use -.Xr filemon 4 . -.It Pa env -For debugging, it can be useful to include the environment -in the .meta file. -.It Pa verbose -If in "meta" mode, print a clue about the target being built. -This is useful if the build is otherwise running silently. -The message printed the value of: -.Va .MAKE.META.PREFIX . -.It Pa ignore-cmd -Some makefiles have commands which are simply not stable. -This keyword causes them to be ignored for -determining whether a target is out of date in "meta" mode. -See also -.Ic .NOMETA_CMP . -.It Pa silent= Ar bf -If -.Va bf -is True, when a .meta file is created, mark the target -.Ic .SILENT . -.It Pa randomize-targets -In both compat and parallel mode, do not make the targets in the usual order, -but instead randomize their order. -This mode can be used to detect undeclared dependencies between files. -.El .It Va .MAKE.META.BAILIWICK -In "meta" mode, provides a list of prefixes which +In +.Dq meta +mode, provides a list of prefixes which match the directories controlled by .Nm . If a file that was generated outside of @@ -1003,21 +1001,30 @@ If a file that was generated outside of but within said bailiwick is missing, the current target is considered out-of-date. .It Va .MAKE.META.CMP_FILTER -In "meta" mode, it can (very rarely!) be useful to filter command +In +.Dq meta +mode, it can (very rarely!) be useful to filter command lines before comparison. -This variable can be set to a set of modifiers that will be applied to +This variable can be set to a set of modifiers that are applied to each line of the old and new command that differ, if the filtered commands still differ, the target is considered out-of-date. .It Va .MAKE.META.CREATED -In "meta" mode, this variable contains a list of all the meta files +In +.Dq meta +mode, this variable contains a list of all the meta files updated. If not empty, it can be used to trigger processing of .Va .MAKE.META.FILES . .It Va .MAKE.META.FILES -In "meta" mode, this variable contains a list of all the meta files +In +.Dq meta +mode, this variable contains a list of all the meta files used (updated or not). This list can be used to process the meta files to extract dependency information. +.It Va .MAKE.META.IGNORE_FILTER +Provides a list of variable modifiers to apply to each pathname. +Ignore if the expansion is an empty string. .It Va .MAKE.META.IGNORE_PATHS Provides a list of path prefixes that should be ignored; because the contents are expected to change over time. @@ -1026,13 +1033,105 @@ The default list includes: .It Va .MAKE.META.IGNORE_PATTERNS Provides a list of patterns to match against pathnames. Ignore any that match. -.It Va .MAKE.META.IGNORE_FILTER -Provides a list of variable modifiers to apply to each pathname. -Ignore if the expansion is an empty string. .It Va .MAKE.META.PREFIX -Defines the message printed for each meta file updated in "meta verbose" mode. +Defines the message printed for each meta file updated in +.Dq meta verbose +mode. The default value is: .Dl Building ${.TARGET:H:tA}/${.TARGET:T} +.It Va .MAKE.MODE +Processed after reading all makefiles. +Affects the mode that +.Nm +runs in. +It can contain these keywords: +.Bl -tag -width indent +.It Cm compat +Like +.Fl B , +puts +.Nm +into +.Dq compat +mode. +.It Cm meta +Puts +.Nm +into +.Dq meta +mode, where meta files are created for each target +to capture the command run, the output generated, and if +.Xr filemon 4 +is available, the system calls which are of interest to +.Nm . +The captured output can be useful when diagnosing errors. +.It Cm curdirOk= Ns Ar bf +By default, +.Nm +does not create +.Pa .meta +files in +.Sq Va .CURDIR . +This can be overridden by setting +.Ar bf +to a value which represents true. +.It Cm missing-meta= Ns Ar bf +If +.Ar bf +is true, a missing +.Pa .meta +file makes the target out-of-date. +.It Cm missing-filemon= Ns Ar bf +If +.Ar bf +is true, missing filemon data makes the target out-of-date. +.It Cm nofilemon +Do not use +.Xr filemon 4 . +.It Cm env +For debugging, it can be useful to include the environment +in the +.Pa .meta +file. +.It Cm verbose +If in +.Dq meta +mode, print a clue about the target being built. +This is useful if the build is otherwise running silently. +The message printed is the expanded value of +.Va .MAKE.META.PREFIX . +.It Cm ignore-cmd +Some makefiles have commands which are simply not stable. +This keyword causes them to be ignored for +determining whether a target is out of date in +.Dq meta +mode. +See also +.Ic .NOMETA_CMP . +.It Cm silent= Ns Ar bf +If +.Ar bf +is true, when a .meta file is created, mark the target +.Ic .SILENT . +.It Cm randomize-targets +In both compat and parallel mode, do not make the targets in the usual order, +but instead randomize their order. +This mode can be used to detect undeclared dependencies between files. +.El +.It Va MAKEOBJDIR +Used to create files in a separate directory, see +.Va .OBJDIR . +.It Va MAKE_OBJDIR_CHECK_WRITABLE +Used to force a separate directory for the created files, +even if that directory is not writable, see +.Va .OBJDIR . +.It Va MAKEOBJDIRPREFIX +Used to create files in a separate directory, see +.Va .OBJDIR . +.It Va .MAKE.OS +The name of the operating system, see +.Xr uname 1 . +It is read-only. .It Va .MAKEOVERRIDES This variable is used to record the names of variables assigned to on the command line, so that they may be exported as part of @@ -1055,13 +1154,36 @@ was built with support, this is set to the path of the device node. This allows makefiles to test for this support. .It Va .MAKE.PID -The process-id of +The process ID of .Nm . +It is read-only. .It Va .MAKE.PPID -The parent process-id of +The parent process ID of .Nm . +It is read-only. +.It Va MAKE_PRINT_VAR_ON_ERROR +When +.Nm +stops due to an error, it sets +.Sq Va .ERROR_TARGET +to the name of the target that failed, +.Sq Va .ERROR_CMD +to the commands of the failed target, +and in +.Dq meta +mode, it also sets +.Sq Va .ERROR_CWD +to the +.Xr getcwd 3 , +and +.Sq Va .ERROR_META_FILE +to the path of the meta file (if any) describing the failed target. +It then prints its name and the value of +.Sq Va .CURDIR +as well as the value of any variables named in +.Sq Va MAKE_PRINT_VAR_ON_ERROR . .It Va .MAKE.SAVE_DOLLARS -value should be a boolean that controls whether +If true, .Ql $$ are preserved when doing .Ql := @@ -1073,40 +1195,35 @@ If set to false, becomes .Ql $ per normal evaluation rules. +.It Va .MAKE.TARGET_LOCAL_VARIABLES +If set to +.Ql false , +apparent variable assignments in dependency lines are +treated as normal sources. .It Va .MAKE.UID -The user-id running +The numeric ID of the user running .Nm . -.It Va .MAKE.GID -The group-id running -.Nm . -.It Va MAKE_PRINT_VAR_ON_ERROR -When -.Nm -stops due to an error, it sets -.Sq Va .ERROR_TARGET -to the name of the target that failed, -.Sq Va .ERROR_CMD -to the commands of the failed target, -and in "meta" mode, it also sets -.Sq Va .ERROR_CWD -to the -.Xr getcwd 3 , -and -.Sq Va .ERROR_META_FILE -to the path of the meta file (if any) describing the failed target. -It then prints its name and the value of -.Sq Va .CURDIR -as well as the value of any variables named in -.Sq Va MAKE_PRINT_VAR_ON_ERROR . +It is read-only. +.\" 'MAKE_VERSION' is intentionally undocumented +.\" since it is only defined in the bmake distribution, +.\" but not in NetBSD's native make. +.\" '.meta.%d.lcwd' is intentionally undocumented +.\" since it is an internal implementation detail. +.\" '.meta.%d.ldir' is intentionally undocumented +.\" since it is an internal implementation detail. +.\" 'MFLAGS' is intentionally undocumented +.\" since it is obsolete. .It Va .newline This variable is simply assigned a newline character as its value. +It is read-only. This allows expansions using the .Cm \&:@ modifier to put a newline between iterations of the loop rather than a space. -For example, the printing of -.Sq Va MAKE_PRINT_VAR_ON_ERROR -could be done as ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@}. +For example, in case of an error, +.Nm +prints the variable names and their values using: +.Dl ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@} .It Va .OBJDIR A path to the directory where the targets are built. Its value is determined by trying to @@ -1114,30 +1231,30 @@ Its value is determined by trying to to the following directories in order and using the first match: .Bl -enum .It -.Ev ${MAKEOBJDIRPREFIX}${.CURDIR} +.Cm ${MAKEOBJDIRPREFIX} Ns Cm ${.CURDIR} .Pp (Only if .Sq Ev MAKEOBJDIRPREFIX is set in the environment or on the command line.) .It -.Ev ${MAKEOBJDIR} +.Cm ${MAKEOBJDIR} .Pp (Only if .Sq Ev MAKEOBJDIR is set in the environment or on the command line.) .It -.Ev ${.CURDIR} Ns Pa /obj. Ns Ev ${MACHINE} +.Cm ${.CURDIR} Ns Pa /obj. Ns Cm ${MACHINE} .It -.Ev ${.CURDIR} Ns Pa /obj +.Cm ${.CURDIR} Ns Pa /obj .It -.Pa /usr/obj/ Ns Ev ${.CURDIR} +.Pa /usr/obj/ Ns Cm ${.CURDIR} .It -.Ev ${.CURDIR} +.Cm ${.CURDIR} .El .Pp -Variable expansion is performed on the value before it's used, +Variable expansion is performed on the value before it is used, so expressions such as -.Dl ${.CURDIR:S,^/usr/src,/var/obj,} +.Cm ${.CURDIR:S,^/usr/src,/var/obj,} may be used. This is especially useful with .Sq Ev MAKEOBJDIR . @@ -1147,47 +1264,45 @@ may be modified in the makefile via the special target .Sq Ic .OBJDIR . In all cases, .Nm -will -.Xr chdir 2 -to the specified directory if it exists, and set +changes to the specified directory if it exists, and sets .Sq Va .OBJDIR and -.Sq Ev PWD +.Sq Va PWD to that directory before executing any targets. .Pp Except in the case of an explicit .Sq Ic .OBJDIR target, .Nm -will check that the specified directory is writable and ignore it if not. +checks that the specified directory is writable and ignores it if not. This check can be skipped by setting the environment variable .Sq Ev MAKE_OBJDIR_CHECK_WRITABLE -to "no". -. +to +.Dq no . .It Va .PARSEDIR -A path to the directory of the current -.Sq Pa Makefile -being parsed. +The directory name of the current makefile being parsed. .It Va .PARSEFILE -The basename of the current -.Sq Pa Makefile -being parsed. +The basename of the current makefile being parsed. This variable and .Sq Va .PARSEDIR -are both set only while the -.Sq Pa Makefiles -are being parsed. -If you want to retain their current values, assign them to a variable -using assignment with expansion +are both set only while the makefiles are being parsed. +To retain their current values, +assign them to a variable using assignment with expansion .Sq Cm \&:= . .It Va .PATH -A variable that represents the list of directories that +The space-separated list of directories that .Nm -will search for files. -The search list should be updated using the target -.Sq Va .PATH -rather than the variable. -.It Ev PWD +searches for files. +To update this search list, use the special target +.Sq Ic .PATH +rather than modifying the variable directly. +.It Va %POSIX +Is set in POSIX mode, see the special +.Ql Va .POSIX +target. +.\" XXX: There is no make variable named 'PWD', +.\" XXX: make only reads and writes the environment variable 'PWD'. +.It Va PWD Alternate path to the current directory. .Nm normally sets @@ -1196,7 +1311,7 @@ to the canonical path given by .Xr getcwd 3 . However, if the environment variable .Sq Ev PWD -is set and gives a path to the current directory, then +is set and gives a path to the current directory, .Nm sets .Sq Va .CURDIR @@ -1208,62 +1323,81 @@ This behavior is disabled if is set or .Sq Ev MAKEOBJDIR contains a variable transform. -.Sq Ev PWD +.Sq Va PWD is set to the value of .Sq Va .OBJDIR for all programs which .Nm executes. -.It Ev .SHELL +.It Va .SHELL The pathname of the shell used to run target scripts. It is read-only. -.It Ev .SUFFIXES +.It Va .SUFFIXES The list of known suffixes. It is read-only. -.It Ev .TARGETS -The list of targets explicitly specified on the command line, if any. -.It Ev VPATH -Colon-separated -.Pq Dq \&: -lists of directories that +.It Va .SYSPATH +The space-separated list of directories that .Nm -will search for files. -The variable is supported for compatibility with old make programs only, -use +searches for makefiles, referred to as the system include path. +To update this search list, use the special target +.Sq Ic .SYSPATH +rather than modifying the variable which is read-only. +.It Va .TARGETS +The list of targets explicitly specified on the command line, if any. +.It Va VPATH +The colon-separated +.Pq Dq \&: +list of directories that +.Nm +searches for files. +This variable is supported for compatibility with old make programs only, use .Sq Va .PATH instead. .El .Ss Variable modifiers -Variable expansion may be modified to select or modify each word of the -variable (where a -.Dq word -is white-space delimited sequence of characters). -The general format of a variable expansion is as follows: +The general format of a variable expansion is: .Pp -.Dl ${variable[:modifier[:...]]} +.Sm off +.D1 Ic \&${ Ar variable\| Oo Ic \&: Ar modifier\| Oo Ic \&: No ... Oc Oc Ic \&} +.Sm on .Pp -Each modifier begins with a colon, -which may be escaped with a backslash -.Pq Ql \e . +Each modifier begins with a colon. +To escape a colon, precede it with a backslash +.Ql \e . .Pp -A set of modifiers can be specified via a variable, as follows: +A list of indirect modifiers can be specified via a variable, as follows: .Pp -.Dl modifier_variable=modifier[:...] -.Dl ${variable:${modifier_variable}[:...]} +.Bd -literal -offset indent +.Ar modifier_variable\^ Li \&= Ar modifier Ns Oo Ic \&: Ns No ... Oc + +.Sm off +.Ic \&${ Ar variable Ic \&:${ Ar modifier_variable Ic \&} Oo Ic \&: No ... Oc Ic \&} +.Sm on +.Ed .Pp -In this case the first modifier in the modifier_variable does not -start with a colon, since that must appear in the referencing -variable. -If any of the modifiers in the modifier_variable contain a dollar sign +In this case, the first modifier in the +.Ar modifier_variable +does not start with a colon, +since that colon already occurs in the referencing variable. +If any of the modifiers in the +.Ar modifier_variable +contains a dollar sign .Pq Ql $ , these must be doubled to avoid early expansion. .Pp +Some modifiers interpret the expression value as a single string, +others treat the expression value as a whitespace-separated list of words. +When splitting a string into words, +whitespace can be escaped using double quotes, single quotes and backslashes, +like in the shell. +The quotes and backslashes are retained in the words. +.Pp The supported modifiers are: .Bl -tag -width EEE .It Cm \&:E -Replaces each word in the variable with its suffix. +Replaces each word with its suffix. .It Cm \&:H -Replaces each word in the variable with everything but the last component. +Replaces each word with its dirname. .It Cm \&:M\| Ns Ar pattern Selects only those words that match .Ar pattern . @@ -1277,36 +1411,40 @@ be used. The wildcard characters may be escaped with a backslash .Pq Ql \e . As a consequence of the way values are split into words, matched, -and then joined, a construct like -.Dl ${VAR:M*} -will normalize the inter-word spacing, removing all leading and -trailing space, and converting multiple consecutive spaces -to single spaces. -. +and then joined, the construct +.Ql ${VAR:M*} +removes all leading and trailing whitespace +and normalizes the inter-word spacing to a single space. .It Cm \&:N\| Ns Ar pattern -This is identical to +This is the opposite of .Sq Cm \&:M , -but selects all words which do not match +selecting all words which do +.Em not +match .Ar pattern . .It Cm \&:O -Orders every word in variable alphabetically. +Orders the words lexicographically. .It Cm \&:On -Orders every word in variable numerically. +Orders the words numerically. A number followed by one of .Ql k , .Ql M or .Ql G -is multiplied by the appropriate factor (1024 (k), 1048576 (M), or -1073741824 (G)). +is multiplied by the appropriate factor, which is 1024 for +.Ql k , +1048576 for +.Ql M , +or 1073741824 for +.Ql G . Both upper- and lower-case letters are accepted. .It Cm \&:Or -Orders every word in variable in reverse alphabetical order. +Orders the words in reverse lexicographical order. .It Cm \&:Orn -Orders every word in variable in reverse numerical order. +Orders the words in reverse numerical order. .It Cm \&:Ox -Shuffles the words in variable. -The results will be different each time you are referring to the +Shuffles the words. +The results are different each time you are referring to the modified variable; use the assignment with expansion .Sq Cm \&:= to prevent such behavior. @@ -1330,64 +1468,66 @@ due uno quattro tre due uno quattro tre .Ed .It Cm \&:Q -Quotes every shell meta-character in the variable, so that it can be passed +Quotes every shell meta-character in the value, so that it can be passed safely to the shell. .It Cm \&:q -Quotes every shell meta-character in the variable, and also doubles +Quotes every shell meta-character in the value, and also doubles .Sq $ characters so that it can be passed safely through recursive invocations of .Nm . -This is equivalent to: -.Sq \&:S/\e\&$/&&/g:Q . +This is equivalent to +.Sq Cm \&:S/\e\&$/&&/g:Q . .It Cm \&:R -Replaces each word in the variable with everything but its suffix. -.It Cm \&:range Ns Oo = Ns Ar count Oc +Replaces each word with everything but its suffix. +.It Cm \&:range Ns Oo Cm = Ns Ar count Oc The value is an integer sequence representing the words of the original value, or the supplied -.Va count . -.It Cm \&:gmtime Ns Oo = Ns Ar utc Oc -The value is a format string for +.Ar count . +.It Cm \&:gmtime Ns Oo Cm = Ns Ar timestamp Oc +The value is interpreted as a format string for .Xr strftime 3 , using -.Xr gmtime 3 . +.Xr gmtime 3 , +producing the formatted timestamp. If a -.Va utc +.Ar timestamp value is not provided or is 0, the current time is used. .It Cm \&:hash -Computes a 32-bit hash of the value and encode it as hex digits. -.It Cm \&:localtime Ns Oo = Ns Ar utc Oc -The value is a format string for +Computes a 32-bit hash of the value and encodes it as 8 hex digits. +.It Cm \&:localtime Ns Oo Cm = Ns Ar timestamp Oc +The value is interpreted as a format string for .Xr strftime 3 , using -.Xr localtime 3 . +.Xr localtime 3 , +producing the formatted timestamp. If a -.Va utc +.Ar timestamp value is not provided or is 0, the current time is used. .It Cm \&:tA -Attempts to convert variable to an absolute path using -.Xr realpath 3 , -if that fails, the value is unchanged. +Attempts to convert the value to an absolute path using +.Xr realpath 3 . +If that fails, the value is unchanged. .It Cm \&:tl -Converts variable to lower-case letters. +Converts the value to lower-case letters. .It Cm \&:ts Ns Ar c -Words in the variable are normally separated by a space on expansion. -This modifier sets the separator to the character +When joining the words after a modifier that treats the value as words, +the words are normally separated by a space. +This modifier changes the separator to the character .Ar c . If .Ar c -is omitted, then no separator is used. +is omitted, no separator is used. The common escapes (including octal numeric codes) work as expected. .It Cm \&:tu -Converts variable to upper-case letters. +Converts the value to upper-case letters. .It Cm \&:tW -Causes the value to be treated as a single word -(possibly containing embedded white space). +Causes subsequent modifiers to treat the value as a single word +(possibly containing embedded whitespace). See also .Sq Cm \&:[*] . .It Cm \&:tw -Causes the value to be treated as a sequence of -words delimited by white space. +Causes the value to be treated as a list of words. See also .Sq Cm \&:[@] . .Sm off @@ -1395,21 +1535,20 @@ See also .Sm on Modifies the first occurrence of .Ar old_string -in each word of the variable's value, replacing it with +in each word of the value, replacing it with .Ar new_string . If a .Ql g -is appended to the last delimiter of the pattern, all occurrences -in each word are replaced. +is appended to the last delimiter of the pattern, +all occurrences in each word are replaced. If a .Ql 1 -is appended to the last delimiter of the pattern, only the first occurrence -is affected. +is appended to the last delimiter of the pattern, +only the first occurrence is affected. If a .Ql W is appended to the last delimiter of the pattern, -then the value is treated as a single word -(possibly containing embedded white space). +the value is treated as a single word. If .Ar old_string begins with a caret @@ -1427,39 +1566,37 @@ an ampersand .Pq Ql & is replaced by .Ar old_string -(without any +(without the anchoring .Ql ^ or .Ql \&$ ) . -Any character may be used as a delimiter for the parts of the modifier +Any character may be used as the delimiter for the parts of the modifier string. -The anchoring, ampersand and delimiter characters may be escaped with a +The anchoring, ampersand and delimiter characters can be escaped with a backslash .Pq Ql \e . .Pp -Variable expansion occurs in the normal fashion inside both +Both .Ar old_string and .Ar new_string -with the single exception that a backslash is used to prevent the expansion -of a dollar sign -.Pq Ql \&$ , -not a preceding dollar sign as is usual. +may contain nested expressions. +To prevent a dollar sign from starting a nested expression, +escape it with a backslash. .Sm off .It Cm \&:C\| No \&/ Ar pattern\| No \&/ Ar replacement\| No \&/ Op Cm 1gW .Sm on The .Cm \&:C -modifier is just like the +modifier works like the .Cm \&:S modifier except that the old and new strings, instead of being -simple strings, are an extended regular expression (see -.Xr regex 3 ) -string +simple strings, are an extended regular expression .Ar pattern +(see +.Xr regex 3 ) and an .Xr ed 1 Ns \-style -string .Ar replacement . Normally, the first occurrence of the pattern .Ar pattern @@ -1475,7 +1612,7 @@ search pattern as occur in the word or words it is found in; the .Ql W modifier causes the value to be treated as a single word -(possibly containing embedded white space). +(possibly containing embedded whitespace). .Pp As for the .Cm \&:S @@ -1486,103 +1623,99 @@ and are subjected to variable expansion before being parsed as regular expressions. .It Cm \&:T -Replaces each word in the variable with its last path component. +Replaces each word with its last path component (basename). .It Cm \&:u Removes adjacent duplicate words (like .Xr uniq 1 ) . .Sm off .It Cm \&:\&?\| Ar true_string\| Cm \&: Ar false_string .Sm on -If the variable name (not its value), when parsed as a .if conditional -expression, evaluates to true, return as its value the +If the variable name (not its value), when parsed as a +.Cm .if +conditional expression, evaluates to true, return as its value the .Ar true_string , otherwise return the .Ar false_string . -Since the variable name is used as the expression, \&:\&? must be the -first modifier after the variable name itself - which will, of course, -usually contain variable expansions. +Since the variable name is used as the expression, +\&:\&? must be the first modifier after the variable name +.No itself Ns \^\(em\^ Ns +which, of course, usually contains variable expansions. A common error is trying to use expressions like .Dl ${NUMBERS:M42:?match:no} -which actually tests defined(NUMBERS), -to determine if any words match "42" you need to use something like: +which actually tests defined(NUMBERS). +To determine if any words match +.Dq 42 , +you need to use something like: .Dl ${"${NUMBERS:M42}" != \&"\&":?match:no} . .It Cm :\| Ns Ar old_string\| Ns Cm = Ns Ar new_string This is the .At V -style variable substitution. -It must be the last modifier specified. +style substitution. +It can only be the last modifier specified, +as a +.Ql \&: +in either +.Ar old_string +or +.Ar new_string +is treated as a regular character, not as the end of the modifier. +.Pp If .Ar old_string -or -.Ar new_string -do not contain the pattern matching character -.Ar % -then it is assumed that they are -anchored at the end of each word, so only suffixes or entire -words may be replaced. -Otherwise -.Ar % -is the substring of +does not contain the pattern matching character +.Ql % , +and the word ends with .Ar old_string -to be replaced in +or equals it, +that suffix is replaced with .Ar new_string . -If only -.Ar old_string -contains the pattern matching character -.Ar % , -and -.Ar old_string -matches, then the result is the -.Ar new_string . -If only the -.Ar new_string -contains the pattern matching character -.Ar % , -then it is not treated specially and it is printed as a literal -.Ar % -on match. -If there is more than one pattern matching character -.Ar ( % ) -in either the -.Ar new_string -or -.Ar old_string , -only the first instance is treated specially (as the pattern character); -all subsequent instances are treated as regular characters. .Pp -Variable expansion occurs in the normal fashion inside both +Otherwise, the first +.Ql % +in +.Ar old_string +matches a possibly empty substring of arbitrary characters, +and if the whole pattern is found in the word, +the matching part is replaced with +.Ar new_string , +and the first occurrence of +.Ql % +in +.Ar new_string +(if any) is replaced with the substring matched by the +.Ql % . +.Pp +Both .Ar old_string and .Ar new_string -with the single exception that a backslash is used to prevent the -expansion of a dollar sign -.Pq Ql \&$ , -not a preceding dollar sign as is usual. +may contain nested expressions. +To prevent a dollar sign from starting a nested expression, +escape it with a backslash. .Sm off -.It Cm \&:@ Ar temp\| Cm @ Ar string\| Cm @ +.It Cm \&:@ Ar varname\| Cm @ Ar string\| Cm @ .Sm on This is the loop expansion mechanism from the OSF Development Environment (ODE) make. Unlike .Cm \&.for loops, expansion occurs at the time of reference. -Assigns -.Ar temp -to each word in the variable and evaluates +For each word in the value, assign the word to the variable named +.Ar varname +and evaluate .Ar string . The ODE convention is that -.Ar temp -should start and end with a period. -For example. +.Ar varname +should start and end with a period, for example: .Dl ${LINKS:@.LINK.@${LN} ${TARGET} ${.LINK.}@} .Pp -However a single character variable is often more readable: +However, a single-letter variable is often more readable: .Dl ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@} .It Cm \&:_ Ns Oo Cm = Ns Ar var Oc Saves the current variable value in .Ql $_ or the named -.Va var +.Ar var for later reference. Example usage: .Bd -literal -offset indent @@ -1616,12 +1749,10 @@ is the value. .It Cm \&:L The name of the variable is the value. .It Cm \&:P -The path of the node which has the same name as the variable -is the value. -If no such node exists or its path is null, then the -name of the variable is used. +The path of the node which has the same name as the variable is the value. +If no such node exists or its path is null, the name of the variable is used. In order for this modifier to work, the name (node) must at least have -appeared on the rhs of a dependency. +appeared on the right-hand side of a dependency. .Sm off .It Cm \&:\&! Ar cmd\| Cm \&! .Sm on @@ -1629,29 +1760,24 @@ The output of running .Ar cmd is the value. .It Cm \&:sh -If the variable is non-empty it is run as a command and the output -becomes the new value. +The value is run as a command, and the output becomes the new value. .It Cm \&::= Ns Ar str The variable is assigned the value .Ar str after substitution. -This modifier and its variations are useful in -obscure situations such as wanting to set a variable when shell commands -are being parsed. -These assignment modifiers always expand to -nothing, so if appearing in a rule line by themselves should be -preceded with something to keep -.Nm -happy. +This modifier and its variations are useful in obscure situations +such as wanting to set a variable +at a point where a target's shell commands are being parsed. +These assignment modifiers always expand to nothing. .Pp The .Sq Cm \&:: helps avoid false matches with the .At V style -.Cm \&:= -modifier and since substitution always occurs the -.Cm \&::= +.Ql \&:= +modifier and since substitution always occurs, the +.Ql \&::= form is vaguely appropriate. .It Cm \&::?= Ns Ar str As for @@ -1668,13 +1794,8 @@ to the variable. .It Cm \&:\&[ Ns Ar range Ns Cm \&] Selects one or more words from the value, or performs other operations related to the way in which the -value is divided into words. +value is split into words. .Pp -Ordinarily, a value is treated as a sequence of words -delimited by white space. -Some modifiers suppress this behavior, -causing a value to be treated as a single word -(possibly containing embedded white space). An empty value, or a value that consists entirely of white-space, is treated as a single word. For the purposes of the @@ -1706,21 +1827,22 @@ If .Ar start is greater than .Ar end , -then the words are output in reverse order. +the words are output in reverse order. For example, .Sq Cm \&:[-1..1] selects all the words from last to first. -If the list is already ordered, then this effectively reverses -the list, but it is more efficient to use +If the list is already ordered, +this effectively reverses the list, +but it is more efficient to use .Sq Cm \&:Or instead of .Sq Cm \&:O:[-1..1] . .\" :[*] .It Cm \&* Causes subsequent modifiers to treat the value as a single word -(possibly containing embedded white space). +(possibly containing embedded whitespace). Analogous to the effect of -\&"$*\&" +.Li \&$* in Bourne shell. .\" :[0] .It 0 @@ -1729,23 +1851,25 @@ Means the same as .\" :[*] .It Cm \&@ Causes subsequent modifiers to treat the value as a sequence of words -delimited by white space. +delimited by whitespace. Analogous to the effect of -\&"$@\&" +.Li \&$@ in Bourne shell. .\" :[#] .It Cm \&# Returns the number of words in the value. .El \" :[range] .El -.Sh INCLUDE STATEMENTS, CONDITIONALS AND FOR LOOPS -Makefile inclusion, conditional structures and for loops reminiscent -of the C programming language are provided in -.Nm . -All such structures are identified by a line beginning with a single -dot +.Sh DIRECTIVES +.Nm +offers directives for including makefiles, conditionals and for loops. +All these directives are identified by a line beginning with a single dot .Pq Ql \&. -character. +character, followed by the keyword of the directive, such as +.Cm include +or +.Cm if . +.Ss File inclusion Files are included with either .Cm \&.include \&< Ns Ar file Ns Cm \&> or @@ -1757,36 +1881,28 @@ the system makefile directory. If double quotes are used, the including makefile's directory and any directories specified using the .Fl I -option are searched before the system -makefile directory. -For compatibility with other versions of -.Nm -.Ql include file ... +option are searched before the system makefile directory. +.Pp +For compatibility with other make variants, +.Sq Cm include Ar file No ... +(without leading dot) is also accepted. .Pp If the include statement is written as .Cm .-include or as -.Cm .sinclude -then errors locating and/or opening include files are ignored. +.Cm .sinclude , +errors locating and/or opening include files are ignored. .Pp If the include statement is written as -.Cm .dinclude +.Cm .dinclude , not only are errors locating and/or opening include files ignored, -but stale dependencies within the included file will be ignored -just like +but stale dependencies within the included file are ignored just like in .Va .MAKE.DEPENDFILE . -.Pp -Conditional expressions are also preceded by a single dot as the first -character of a line. -The possible conditionals are as follows: +.Ss Exporting variables +The directives for exporting and unexporting variables are: .Bl -tag -width Ds -.It Ic .error Ar message -The message is printed along with the name of the makefile and line number, -then -.Nm -will exit immediately. -.It Ic .export Ar variable ... +.It Ic .export Ar variable No ... Export the specified global variable. If no variable list is provided, all globals are exported except for internal variables (those that start with @@ -1794,16 +1910,14 @@ except for internal variables (those that start with This is not affected by the .Fl X flag, so should be used with caution. -For compatibility with other -.Nm -programs -.Ql export variable=value -is also accepted. +For compatibility with other make programs, +.Cm export Ar variable\| Ns Cm \&= Ns Ar value +(without leading dot) is also accepted. .Pp Appending a variable name to .Va .MAKE.EXPORTED is equivalent to exporting a variable. -.It Ic .export-env Ar variable ... +.It Ic .export-env Ar variable No ... The same as .Ql .export , except that the variable is not appended to @@ -1812,21 +1926,16 @@ This allows exporting a value to the environment which is different from that used by .Nm internally. -.It Ic .export-literal Ar variable ... +.It Ic .export-literal Ar variable No ... The same as .Ql .export-env , except that variables in the value are not expanded. -.It Ic .info Ar message -The message is printed along with the name of the makefile and line number. -.It Ic .undef Ar variable ... -Un-define the specified global variables. -Only global variables can be un-defined. -.It Ic .unexport Ar variable ... +.It Ic .unexport Ar variable No ... The opposite of .Ql .export . The specified global -.Va variable -will be removed from +.Ar variable +is removed from .Va .MAKE.EXPORTED . If no variable list is provided, all globals are unexported, and @@ -1835,11 +1944,11 @@ deleted. .It Ic .unexport-env Unexport all globals previously exported and clear the environment inherited from the parent. -This operation will cause a memory leak of the original environment, +This operation causes a memory leak of the original environment, so should be used sparingly. Testing for .Va .MAKE.LEVEL -being 0, would make sense. +being 0 would make sense. Also note that any variables which originated in the parent environment should be explicitly preserved if desired. For example: @@ -1854,46 +1963,62 @@ PATH := ${PATH} Would result in an environment containing only .Sq Ev PATH , which is the minimal useful environment. +.\" TODO: Check the below sentence, environment variables don't start with '.'. Actually -.Sq Ev .MAKE.LEVEL -will also be pushed into the new environment. +.Sq Va .MAKE.LEVEL +is also pushed into the new environment. +.El +.Ss Messages +The directives for printing messages to the output are: +.Bl -tag -width Ds +.It Ic .info Ar message +The message is printed along with the name of the makefile and line number. .It Ic .warning Ar message The message prefixed by -.Sq Pa warning: +.Sq Li warning: is printed along with the name of the makefile and line number. -.It Ic \&.if Oo \&! Oc Ns Ar expression Op Ar operator expression ... +.It Ic .error Ar message +The message is printed along with the name of the makefile and line number, +.Nm +exits immediately. +.El +.Ss Conditionals +The directives for conditionals are: +.ds maybenot Oo Ic \&! Oc Ns +.Bl -tag +.It Ic .if \*[maybenot] Ar expression Op Ar operator expression No ... Test the value of an expression. -.It Ic .ifdef Oo \&! Oc Ns Ar variable Op Ar operator variable ... -Test the value of a variable. -.It Ic .ifndef Oo \&! Oc Ns Ar variable Op Ar operator variable ... -Test the value of a variable. -.It Ic .ifmake Oo \&! Oc Ns Ar target Op Ar operator target ... -Test the target being built. -.It Ic .ifnmake Oo \&! Ns Oc Ar target Op Ar operator target ... -Test the target being built. +.It Ic .ifdef \*[maybenot] Ar variable Op Ar operator variable No ... +Test whether a variable is defined. +.It Ic .ifndef \*[maybenot] Ar variable Op Ar operator variable No ... +Test whether a variable is not defined. +.It Ic .ifmake \*[maybenot] Ar target Op Ar operator target No ... +Test the target being requested. +.It Ic .ifnmake \*[maybenot] Ar target Op Ar operator target No ... +Test the target being requested. .It Ic .else Reverse the sense of the last conditional. -.It Ic .elif Oo \&! Ns Oc Ar expression Op Ar operator expression ... +.It Ic .elif \*[maybenot] Ar expression Op Ar operator expression No ... A combination of .Sq Ic .else followed by .Sq Ic .if . -.It Ic .elifdef Oo \&! Oc Ns Ar variable Op Ar operator variable ... +.It Ic .elifdef \*[maybenot] Ar variable Op Ar operator variable No ... A combination of .Sq Ic .else followed by .Sq Ic .ifdef . -.It Ic .elifndef Oo \&! Oc Ns Ar variable Op Ar operator variable ... +.It Ic .elifndef \*[maybenot] Ar variable Op Ar operator variable No ... A combination of .Sq Ic .else followed by .Sq Ic .ifndef . -.It Ic .elifmake Oo \&! Oc Ns Ar target Op Ar operator target ... +.It Ic .elifmake \*[maybenot] Ar target Op Ar operator target No ... A combination of .Sq Ic .else followed by .Sq Ic .ifmake . -.It Ic .elifnmake Oo \&! Oc Ns Ar target Op Ar operator target ... +.It Ic .elifnmake \*[maybenot] Ar target Op Ar operator target No ... A combination of .Sq Ic .else followed by @@ -1905,133 +2030,157 @@ End the body of the conditional. The .Ar operator may be any one of the following: -.Bl -tag -width "Cm XX" -.It Cm \&|\&| +.Bl -tag +.It Ic \&|\&| Logical OR. -.It Cm \&&& -Logical -.Tn AND ; -of higher precedence than -.Dq \&|\&| . +.It Ic \&&& +Logical AND; of higher precedence than +.Sq Ic \&|\&| . .El .Pp -As in C, .Nm -will only evaluate a conditional as far as is necessary to determine -its value. -Parentheses may be used to change the order of evaluation. +only evaluates a conditional as far as is necessary to determine its value. +Parentheses can be used to override the operator precedence. The boolean operator .Sq Ic \&! -may be used to logically negate an entire -conditional. +may be used to logically negate an entire conditional. It is of higher precedence than .Sq Ic \&&& . .Pp The value of .Ar expression -may be any of the following: -.Bl -tag -width defined -.It Ic defined -Takes a variable name as an argument and evaluates to true if the variable +may be any of the following function call expressions: +.Bl -tag +.Sm off +.It Ic defined Li \&( Ar varname Li \&) +.Sm on +Evaluates to true if the variable +.Ar varname has been defined. -.It Ic make -Takes a target name as an argument and evaluates to true if the target -was specified as part of +.Sm off +.It Ic make Li \&( Ar target Li \&) +.Sm on +Evaluates to true if the target was specified as part of .Nm Ns 's command line or was declared the default target (either implicitly or explicitly, see .Va .MAIN ) before the line containing the conditional. -.It Ic empty -Takes a variable, with possible modifiers, and evaluates to true if -the expansion of the variable would result in an empty string. -.It Ic exists -Takes a file name as an argument and evaluates to true if the file exists. -The file is searched for on the system search path (see +.Sm off +.It Ic empty Li \&( Ar varname Oo Li : Ar modifiers Oc Li \&) +.Sm on +Evaluates to true if the expansion of the variable, +after applying the modifiers, results in an empty string. +.Sm off +.It Ic exists Li \&( Ar pathname Li \&) +.Sm on +Evaluates to true if the given pathname exists. +If relative, the pathname is searched for on the system search path (see .Va .PATH ) . -.It Ic target -Takes a target name as an argument and evaluates to true if the target -has been defined. -.It Ic commands -Takes a target name as an argument and evaluates to true if the target -has been defined and has commands associated with it. +.Sm off +.It Ic target Li \&( Ar target Li \&) +.Sm on +Evaluates to true if the target has been defined. +.Sm off +.It Ic commands Li \&( Ar target Li \&) +.Sm on +Evaluates to true if the target has been defined +and has commands associated with it. .El .Pp .Ar Expression may also be an arithmetic or string comparison. -Variable expansion is -performed on both sides of the comparison, after which the numerical -values are compared. -A value is interpreted as hexadecimal if it is -preceded by 0x, otherwise it is decimal; octal numbers are not supported. -The standard C relational operators are all supported. -If after -variable expansion, either the left or right hand side of a -.Sq Ic == -or -.Sq Ic "!=" -operator is not a numerical value, then -string comparison is performed between the expanded -variables. -If no relational operator is given, it is assumed that the expanded -variable is being compared against 0, or an empty string in the case -of a string comparison. +Variable expansion is performed on both sides of the comparison. +If both sides are numeric and neither is enclosed in quotes, +the comparison is done numerically, otherwise lexicographically. +A string is interpreted as hexadecimal integer if it is preceded by +.Li 0x , +otherwise it is a decimal floating-point number; +octal numbers are not supported. +.Pp +All comparisons may use the operators +.Sq Ic \&== +and +.Sq Ic \&!= . +Numeric comparisons may also use the operators +.Sq Ic \&< , +.Sq Ic \&<= , +.Sq Ic \&> +and +.Sq Ic \&>= . +.Pp +If the comparison has neither a comparison operator nor a right side, +the expression evaluates to true if it is nonempty +and its numeric value (if any) is not zero. .Pp When .Nm is evaluating one of these conditional expressions, and it encounters -a (white-space separated) word it doesn't recognize, either the +a (whitespace separated) word it doesn't recognize, either the .Dq make or .Dq defined -expression is applied to it, depending on the form of the conditional. +function is applied to it, depending on the form of the conditional. If the form is .Sq Ic .ifdef , -.Sq Ic .ifndef , +.Sq Ic .ifndef or -.Sq Ic .if +.Sq Ic .if , the .Dq defined -expression is applied. +function is applied. Similarly, if the form is .Sq Ic .ifmake or .Sq Ic .ifnmake , the .Dq make -expression is applied. +function is applied. .Pp -If the conditional evaluates to true the parsing of the makefile continues -as before. +If the conditional evaluates to true, +parsing of the makefile continues as before. If it evaluates to false, the following lines are skipped. -In both cases this continues until a +In both cases, this continues until the corresponding .Sq Ic .else or .Sq Ic .endif is found. -.Pp +.Ss For loops For loops are typically used to apply a set of rules to a list of files. The syntax of a for loop is: .Pp .Bl -tag -compact -width Ds -.It Ic \&.for Ar variable Oo Ar variable ... Oc Ic in Ar expression -.It Aq make-lines +.It Ic \&.for Ar variable Oo Ar variable No ... Oc Ic in Ar expression +.It Aq Ar make-lines .It Ic \&.endfor .El .Pp -After the for -.Ic expression -is evaluated, it is split into words. +The +.Ar expression +is expanded and then split into words. On each iteration of the loop, one word is taken and assigned to each -.Ic variable , +.Ar variable , in order, and these -.Ic variables +.Ar variables are substituted into the -.Ic make-lines +.Ar make-lines inside the body of the for loop. The number of words must come out even; that is, if there are three iteration variables, the number of words provided must be a multiple of three. +.Pp +If +.Sq Ic .break +is encountered within a +.Cm \&.for +loop, it causes early termination of the loop, otherwise a parse error. +.\" TODO: Describe limitations with defined/empty. +.Ss Other directives +.Bl -tag -width Ds +.It Ic .undef Ar variable No ... +Un-define the specified global variables. +Only global variables can be un-defined. +.El .Sh COMMENTS Comments begin with a hash .Pq Ql \&# @@ -2050,7 +2199,7 @@ as if they all were preceded by a dash .\" .It Ic .JOIN .\" XXX .It Ic .MADE -Mark all sources of this target as being up-to-date. +Mark all sources of this target as being up to date. .It Ic .MAKE Execute the commands associated with this target even if the .Fl n @@ -2068,7 +2217,9 @@ or Usage in conjunction with .Ic .MAKE is the most likely case. -In "meta" mode, the target is out-of-date if the meta file is missing. +In +.Dq meta +mode, the target is out-of-date if the meta file is missing. .It Ic .NOMETA Do not create a meta file for the target. Meta files are also not created for @@ -2080,16 +2231,17 @@ targets. .It Ic .NOMETA_CMP Ignore differences in commands when deciding if target is out of date. This is useful if the command contains a value which always changes. -If the number of commands change, though, the target will still be out of date. +If the number of commands change, though, +the target is still considered out of date. The same effect applies to any command line that uses the variable .Va .OODATE , which can be used for that purpose even when not otherwise needed or desired: .Bd -literal -offset indent skip-compare-for-some: - @echo this will be compared - @echo this will not ${.OODATE:M.NOMETA_CMP} - @echo this will also be compared + @echo this is compared + @echo this is not ${.OODATE:M.NOMETA_CMP} + @echo this is also compared .Ed The @@ -2097,7 +2249,7 @@ The pattern suppresses any expansion of the unwanted variable. .It Ic .NOPATH Do not search for the target in the directories specified by -.Ic .PATH . +.Va .PATH . .It Ic .NOTMAIN Normally .Nm @@ -2107,12 +2259,12 @@ This source prevents this target from being selected. .It Ic .OPTIONAL If a target is marked with this attribute and .Nm -can't figure out how to create it, it will ignore this fact and assume +can't figure out how to create it, it ignores this fact and assumes the file isn't needed or already exists. .It Ic .PHONY -The target does not -correspond to an actual file; it is always considered to be out of date, -and will not be created with the +The target does not correspond to an actual file; +it is always considered to be out of date, +and is not created with the .Fl t option. Suffix-transformation rules are not applied to @@ -2144,9 +2296,9 @@ If the target already has commands, the target's commands are appended to them. .It Ic .USEBEFORE -Exactly like +Like .Ic .USE , -but prepend the +but instead of appending, prepend the .Ic .USEBEFORE target commands to the target. .It Ic .WAIT @@ -2174,7 +2326,7 @@ the output is always .Ql b1 , .Ql b , .Ql x . -.br +.Pp The ordering imposed by .Ic .WAIT is only relevant for parallel makes. @@ -2189,17 +2341,15 @@ else is done. .It Ic .DEFAULT This is sort of a .Ic .USE -rule for any target (that was used only as a -source) that +rule for any target (that was used only as a source) that .Nm can't figure out any other way to create. Only the shell script is used. The -.Ic .IMPSRC +.Va .IMPSRC variable of a target that inherits .Ic .DEFAULT Ns 's -commands is set -to the target's own name. +commands is set to the target's own name. .It Ic .DELETE_ON_ERROR If this target is present in the makefile, it globally causes make to delete targets whose commands fail. @@ -2210,14 +2360,14 @@ This setting can be used to help prevent half-finished or malformed targets from being left around and corrupting future rebuilds. .It Ic .END Any command lines attached to this target are executed after everything -else is done. +else is done successfully. .It Ic .ERROR Any command lines attached to this target are executed when another target fails. The -.Ic .ERROR_TARGET +.Va .ERROR_TARGET variable is set to the target that failed. See also -.Ic MAKE_PRINT_VAR_ON_ERROR . +.Va MAKE_PRINT_VAR_ON_ERROR . .It Ic .IGNORE Mark each of the sources with the .Ic .IGNORE @@ -2228,24 +2378,24 @@ option. .It Ic .INTERRUPT If .Nm -is interrupted, the commands for this target will be executed. +is interrupted, the commands for this target are executed. .It Ic .MAIN If no target is specified when .Nm -is invoked, this target will be built. +is invoked, this target is built. .It Ic .MAKEFLAGS This target provides a way to specify flags for .Nm -when the makefile is used. +at the time when the makefiles are read. The flags are as if typed to the shell, though the .Fl f -option will have +option has no effect. .\" XXX: NOT YET!!!! .\" .It Ic .NOTPARALLEL .\" The named targets are executed in non parallel mode. .\" If no targets are -.\" specified, then all targets are executed in non parallel mode. +.\" specified, all targets are executed in non parallel mode. .It Ic .NOPATH Apply the .Ic .NOPATH @@ -2256,14 +2406,14 @@ Disable parallel mode. Synonym for .Ic .NOTPARALLEL , for compatibility with other pmake variants. +.It Ic .NOREADONLY +clear the read-only attribute from the global variables specified as sources. .It Ic .OBJDIR The source is a new value for .Sq Va .OBJDIR . If it exists, .Nm -will -.Xr chdir 2 -to it and update the value of +changes the current working directory to it and updates the value of .Sq Va .OBJDIR . .It Ic .ORDER In parallel mode, the named targets are made in sequence. @@ -2283,17 +2433,16 @@ b: a .\" .It Ic .PARALLEL .\" The named targets are executed in parallel mode. .\" If no targets are -.\" specified, then all targets are executed in parallel mode. +.\" specified, all targets are executed in parallel mode. .It Ic .PATH The sources are directories which are to be searched for files not found in the current directory. -If no sources are specified, any previously specified directories are -deleted. +If no sources are specified, +any previously specified directories are removed from the search path. If the source is the special .Ic .DOTLAST -target, then the current working -directory is searched last. -.It Ic .PATH. Ns Va suffix +target, the current working directory is searched last. +.It Ic .PATH. Ns Ar suffix Like .Ic .PATH but applies only to files with a particular suffix. @@ -2317,55 +2466,56 @@ If .Nm is run with the .Fl r -flag, then only +flag, only .Ql posix.mk -will contribute to the default rules. +contributes to the default rules. .It Ic .PRECIOUS Apply the .Ic .PRECIOUS attribute to any specified sources. If no sources are specified, the .Ic .PRECIOUS -attribute is applied to every -target in the file. +attribute is applied to every target in the file. +.It Ic .READONLY +set the read-only attribute on the global variables specified as sources. .It Ic .SHELL Sets the shell that .Nm -will use to execute commands. +uses to execute commands in jobs mode. The sources are a set of -.Ar field=value +.Ar field\| Ns Cm \&= Ns Ar value pairs. -.Bl -tag -width hasErrCtls -.It Ar name +.Bl -tag -width ".Li hasErrCtls" +.It Li name This is the minimal specification, used to select one of the built-in shell specs; -.Ar sh , -.Ar ksh , +.Li sh , +.Li ksh , and -.Ar csh . -.It Ar path -Specifies the path to the shell. -.It Ar hasErrCtl +.Li csh . +.It Li path +Specifies the absolute path to the shell. +.It Li hasErrCtl Indicates whether the shell supports exit on error. -.It Ar check +.It Li check The command to turn on error checking. -.It Ar ignore +.It Li ignore The command to disable error checking. -.It Ar echo +.It Li echo The command to turn on echoing of commands executed. -.It Ar quiet +.It Li quiet The command to turn off echoing of commands executed. -.It Ar filter +.It Li filter The output to filter after issuing the -.Ar quiet +.Li quiet command. It is typically identical to -.Ar quiet . -.It Ar errFlag +.Li quiet . +.It Li errFlag The flag to pass the shell to enable error checking. -.It Ar echoFlag +.It Li echoFlag The flag to pass the shell to enable command echoing. -.It Ar newline +.It Li newline The string literal to pass the shell that results in a single newline character when used outside of any quoting characters. .El @@ -2396,10 +2546,18 @@ It allows the creation of suffix-transformation rules. .Pp Example: .Bd -literal -\&.SUFFIXES: .o +\&.SUFFIXES: .c .o \&.c.o: cc \-o ${.TARGET} \-c ${.IMPSRC} .Ed +.It Ic .SYSPATH +The sources are directories which are to be added to the system +include path which +.Nm +searches for makefiles. +If no sources are specified, +any previously specified directories are removed from the system +include path. .El .Sh ENVIRONMENT .Nm @@ -2428,17 +2586,17 @@ for more details. .Bl -tag -width /usr/share/mk -compact .It .depend list of dependencies -.It Makefile -list of dependencies .It makefile -list of dependencies +first default makefile if no makefile is specified on the command line +.It Makefile +second default makefile if no makefile is specified on the command line .It sys.mk system makefile .It /usr/share/mk system makefile directory .El .Sh COMPATIBILITY -The basic make syntax is compatible between different versions of make; +The basic make syntax is compatible between different make variants; however the special variables, variable modifiers and conditionals are not. .Ss Older versions An incomplete list of changes in older versions of @@ -2467,13 +2625,15 @@ The and .Ic .ORDER declarations and most functionality pertaining to parallelization. -(GNU make supports parallelization but lacks these features needed to +(GNU make supports parallelization but lacks the features needed to control it effectively.) .It Directives, including for loops and conditionals and most of the forms of include files. (GNU make has its own incompatible and less powerful syntax for conditionals.) +.\" The "less powerful" above means that GNU make does not have the +.\" make(target), target(target) and commands(target) functions. .It All built-in variables that begin with a dot. .It @@ -2485,7 +2645,7 @@ and .Ic .SUFFIXES . .It Variable modifiers, except for the -.Dl :old=new +.Ql :old=new string substitution, which does not portably support globbing with .Ql % and historically only works on declared suffixes. @@ -2502,7 +2662,7 @@ Some features are somewhat more portable, such as assignment with and .Ic != . The -.Ic .PATH +.Va .PATH functionality is based on an older feature .Ic VPATH found in GNU make and many versions of SVR4 make; however, @@ -2533,22 +2693,22 @@ command appeared in .At v7 . This make -implementation is based on Adam De Boor's pmake program which was written -for Sprite at Berkeley. +implementation is based on Adam de Boor's pmake program, +which was written for Sprite at Berkeley. It was designed to be a parallel distributed make running jobs on different machines using a daemon called .Dq customs . .Pp Historically the target/dependency -.Dq FRC +.Ic FRC has been used to FoRCe rebuilding (since the target/dependency -does not exist... unless someone creates an -.Dq FRC +does not exist ... unless someone creates an +.Pa FRC file). .Sh BUGS The make -syntax is difficult to parse without actually acting on the data. +syntax is difficult to parse. For instance, finding the end of a variable's use should involve scanning each of the modifiers, using the correct terminator for each field. In many places diff --git a/contrib/bmake/bmake.cat1 b/contrib/bmake/bmake.cat1 index ff19b554c8c3..7cb47607417f 100644 --- a/contrib/bmake/bmake.cat1 +++ b/contrib/bmake/bmake.cat1 @@ -1,153 +1,152 @@ BMAKE(1) FreeBSD General Commands Manual BMAKE(1) NAME - bmake — maintain program dependencies + bmake -- maintain program dependencies SYNOPSIS bmake [-BeikNnqrSstWwX] [-C directory] [-D variable] [-d flags] [-f makefile] [-I directory] [-J private] [-j max_jobs] [-m directory] [-T file] [-V variable] [-v variable] - [variable=value] [target ...] + [variable=value] [target ...] DESCRIPTION - bmake is a program designed to simplify the maintenance of other pro‐ + bmake is a program designed to simplify the maintenance of other pro- grams. Its input is a list of specifications as to the files upon which - programs and other files depend. If no -f makefile makefile option is - given, bmake will try to open ‘makefile’ then ‘Makefile’ in order to find - the specifications. If the file ‘.depend’ exists, it is read (see - mkdep(1)). + programs and other files depend. If no -f makefile option is given, + bmake tries to open `makefile' then `Makefile' in order to find the spec- + ifications. If the file `.depend' exists, it is read, see mkdep(1). This manual page is intended as a reference document only. For a more thorough description of bmake and makefiles, please refer to PMake - A - Tutorial. + Tutorial (from 1993). - bmake will prepend the contents of the MAKEFLAGS environment variable to - the command line arguments before parsing them. + bmake prepends the contents of the MAKEFLAGS environment variable to the + command line arguments before parsing them. The options are as follows: -B Try to be backwards compatible by executing a single shell per - command and by executing the commands to make the sources of a - dependency line in sequence. + command and by making the sources of a dependency line in se- + quence. -C directory - Change to directory before reading the makefiles or doing any‐ - thing else. If multiple -C options are specified, each is inter‐ + Change to directory before reading the makefiles or doing any- + thing else. If multiple -C options are specified, each is inter- preted relative to the previous one: -C / -C etc is equivalent to -C /etc. -D variable Define variable to be 1, in the global scope. - -d [-]flags + -d [-]flags Turn on debugging, and specify which portions of bmake are to print debugging information. Unless the flags are preceded by - ‘-’ they are added to the MAKEFLAGS environment variable and will - be processed by any child make processes. By default, debugging - information is printed to standard error, but this can be changed - using the F debugging flag. The debugging output is always un‐ - buffered; in addition, if debugging is enabled but debugging out‐ - put is not directed to standard output, then the standard output - is line buffered. Flags is one or more of the following: + `-', they are added to the MAKEFLAGS environment variable and are + passed on to any child make processes. By default, debugging in- + formation is printed to standard error, but this can be changed + using the F debugging flag. The debugging output is always un- + buffered; in addition, if debugging is enabled but debugging out- + put is not directed to standard output, the standard output is + line buffered. The available flags are: - A Print all possible debugging information; equivalent to + A Print all possible debugging information; equivalent to specifying all of the debugging flags. - a Print debugging information about archive searching and + a Print debugging information about archive searching and caching. - C Print debugging information about current working direc‐ - tory. + C Print debugging information about the current working di- + rectory. - c Print debugging information about conditional evaluation. + c Print debugging information about conditional evaluation. - d Print debugging information about directory searching and + d Print debugging information about directory searching and caching. - e Print debugging information about failed commands and + e Print debugging information about failed commands and targets. - F[+]filename + F[+]filename Specify where debugging output is written. This must be the last flag, because it consumes the remainder of the - argument. If the character immediately after the ‘F’ - flag is ‘+’, then the file will be opened in append mode; - otherwise the file will be overwritten. If the file name - is ‘stdout’ or ‘stderr’ then debugging output will be - written to the standard output or standard error output - file descriptors respectively (and the ‘+’ option has no - effect). Otherwise, the output will be written to the - named file. If the file name ends ‘.%d’ then the ‘%d’ is - replaced by the pid. + argument. If the character immediately after the F flag + is `+', the file is opened in append mode; otherwise the + file is overwritten. If the file name is `stdout' or + `stderr', debugging output is written to the standard + output or standard error output respectively (and the `+' + option has no effect). Otherwise, the output is written + to the named file. If the file name ends with `.%d', the + `%d' is replaced by the pid. - f Print debugging information about loop evaluation. + f Print debugging information about loop evaluation. - g1 Print the input graph before making anything. + g1 Print the input graph before making anything. - g2 Print the input graph after making everything, or before + g2 Print the input graph after making everything, or before exiting on error. - g3 Print the input graph before exiting on error. + g3 Print the input graph before exiting on error. - h Print debugging information about hash table operations. + h Print debugging information about hash table operations. - j Print debugging information about running multiple + j Print debugging information about running multiple shells. - L Turn on lint checks. This will throw errors for variable - assignments that do not parse correctly, at the time of - assignment so the file and line number are available. + L Turn on lint checks. This throws errors for variable as- + signments that do not parse correctly, at the time of as- + signment, so the file and line number are available. - l Print commands in Makefiles regardless of whether or not - they are prefixed by ‘@’ or other "quiet" flags. Also + l Print commands in Makefiles regardless of whether or not + they are prefixed by `@' or other "quiet" flags. Also known as "loud" behavior. - M Print debugging information about "meta" mode decisions + M Print debugging information about "meta" mode decisions about targets. - m Print debugging information about making targets, includ‐ + m Print debugging information about making targets, includ- ing modification dates. - n Don't delete the temporary command scripts created when + n Don't delete the temporary command scripts created when running commands. These temporary scripts are created in - the directory referred to by the TMPDIR environment vari‐ + the directory referred to by the TMPDIR environment vari- able, or in /tmp if TMPDIR is unset or set to the empty string. The temporary scripts are created by mkstemp(3), and have names of the form makeXXXXXX. NOTE: This can create many files in TMPDIR or /tmp, so use with care. - p Print debugging information about makefile parsing. + p Print debugging information about makefile parsing. - s Print debugging information about suffix-transformation + s Print debugging information about suffix-transformation rules. - t Print debugging information about target list mainte‐ + t Print debugging information about target list mainte- nance. - V Force the -V option to print raw values of variables, + V Force the -V option to print raw values of variables, overriding the default behavior set via .MAKE.EXPAND_VARIABLES. - v Print debugging information about variable assignment. + v Print debugging information about variable assignment and + expansion. - x Run shell commands with -x so the actual commands are + x Run shell commands with -x so the actual commands are printed as they are executed. - -e Specify that environment variables override macro assignments - within makefiles. + -e Let environment variables override global variables within make- + files. -f makefile - Specify a makefile to read instead of the default ‘makefile’. If - makefile is ‘-’, standard input is read. Multiple makefiles may - be specified, and are read in the order specified. + Specify a makefile to read instead of the default makefile or + Makefile. If makefile is `-', standard input is read. Multiple + makefiles may be specified, and are read in the order specified. -I directory Specify a directory in which to search for makefiles and included makefiles. The system makefile directory (or directories, see the -m option) is automatically included as part of this list. - -i Ignore non-zero exit of shell commands in the makefile. Equiva‐ - lent to specifying ‘-’ before each command line in the makefile. + -i Ignore non-zero exit of shell commands in the makefile. Equiva- + lent to specifying `-' before each command line in the makefile. -J private This option should not be specified by the user. @@ -158,12 +157,12 @@ BMAKE(1) FreeBSD General Commands Manual BMAKE(1) -j max_jobs Specify the maximum number of jobs that bmake may have running at - any one time. The value is saved in .MAKE.JOBS. Turns compati‐ + any one time. The value is saved in .MAKE.JOBS. Turns compati- bility mode off, unless the -B option is also specified. When compatibility mode is off, all commands associated with a target - are executed in a single shell invocation as opposed to the tra‐ - ditional one shell invocation per line. This can break tradi‐ - tional scripts which change directories on each command invoca‐ + are executed in a single shell invocation as opposed to the tra- + ditional one shell invocation per line. This can break tradi- + tional scripts which change directories on each command invoca- tion and then expect to start with a fresh environment on the next line. It is more efficient to correct the scripts rather than turn backwards compatibility on. @@ -173,35 +172,36 @@ BMAKE(1) FreeBSD General Commands Manual BMAKE(1) caused the error. -m directory - Specify a directory in which to search for sys.mk and makefiles + Specify a directory in which to search for sys.mk and makefiles included via the <file>-style include statement. The -m option - can be used multiple times to form a search path. This path will - override the default system include path: /usr/share/mk. Fur‐ - thermore the system include path will be appended to the search - path used for "file"-style include statements (see the -I op‐ - tion). + can be used multiple times to form a search path. This path + overrides the default system include path /usr/share/mk. Fur- + thermore, the system include path is appended to the search path + used for "file"-style include statements (see the -I option). + The system include path can be referenced via the read-only vari- + able .SYSPATH. - If a file or directory name in the -m argument (or the - MAKESYSPATH environment variable) starts with the string ".../" - then bmake will search for the specified file or directory named - in the remaining part of the argument string. The search starts - with the current directory of the Makefile and then works upward - towards the root of the file system. If the search is success‐ - ful, then the resulting directory replaces the ".../" specifica‐ - tion in the -m argument. If used, this feature allows bmake to - easily search in the current source tree for customized sys.mk - files (e.g., by using ".../mk/sys.mk" as an argument). + If a directory name in the -m argument (or the MAKESYSPATH envi- + ronment variable) starts with the string `.../', bmake searches + for the specified file or directory named in the remaining part + of the argument string. The search starts with the current di- + rectory and then works upward towards the root of the file sys- + tem. If the search is successful, the resulting directory re- + places the `.../' specification in the -m argument. This feature + allows bmake to easily search in the current source tree for cus- + tomized sys.mk files (e.g., by using `.../mk/sys.mk' as an argu- + ment). -n Display the commands that would have been executed, but do not - actually execute them unless the target depends on the .MAKE spe‐ - cial source (see below) or the command is prefixed with ‘+’. + actually execute them unless the target depends on the .MAKE spe- + cial source (see below) or the command is prefixed with `+'. - -N Display the commands which would have been executed, but do not + -N Display the commands that would have been executed, but do not actually execute any of them; useful for debugging top-level makefiles without descending into subdirectories. - -q Do not execute any commands, but exit 0 if the specified targets - are up-to-date and 1, otherwise. + -q Do not execute any commands, instead exit 0 if the specified tar- + gets are up to date, and 1 otherwise. -r Do not use the built-in rules specified in the system makefile. @@ -209,7 +209,7 @@ BMAKE(1) FreeBSD General Commands Manual BMAKE(1) behavior and the opposite of -k. -s Do not echo any commands as they are executed. Equivalent to - specifying ‘@’ before each command line in the makefile. + specifying `@' before each command line in the makefile. -T tracefile When used with the -j flag, append a trace record to tracefile @@ -221,156 +221,167 @@ BMAKE(1) FreeBSD General Commands Manual BMAKE(1) -V variable Print the value of variable. Do not build any targets. Multiple - instances of this option may be specified; the variables will be - printed one per line, with a blank line for each null or unde‐ + instances of this option may be specified; the variables are + printed one per line, with a blank line for each null or unde- fined variable. The value printed is extracted from the global - scope after all makefiles have been read. By default, the raw - variable contents (which may include additional unexpanded vari‐ - able references) are shown. If variable contains a ‘$’ then the - value will be recursively expanded to its complete resultant text - before printing. The expanded value will also be printed if + scope after all makefiles have been read. + + By default, the raw variable contents (which may include addi- + tional unexpanded variable references) are shown. If variable + contains a `$', it is not interpreted as a variable name but + rather as an expression. Its value is expanded before printing. + The value is also expanded before printing if .MAKE.EXPAND_VARIABLES is set to true and the -dV option has not - been used to override it. Note that loop-local and target-local - variables, as well as values taken temporarily by global vari‐ - ables during makefile processing, are not accessible via this op‐ - tion. The -dv debug mode can be used to see these at the cost of - generating substantial extraneous output. + been used to override it. + + Note that loop-local and target-local variables, as well as val- + ues taken temporarily by global variables during makefile pro- + cessing, are not accessible via this option. The -dv debug mode + can be used to see these at the cost of generating substantial + extraneous output. -v variable - Like -V but the variable is always expanded to its complete - value. + Like -V, but all printed variables are always expanded to their + complete value. The last occurrence of -V or -v decides whether + all variables are expanded or not. -W Treat any warnings during makefile parsing as errors. - -w Print entering and leaving directory messages, pre and post pro‐ + -w Print entering and leaving directory messages, pre and post pro- cessing. - -X Don't export variables passed on the command line to the environ‐ + -X Don't export variables passed on the command line to the environ- ment individually. Variables passed on the command line are - still exported via the MAKEFLAGS environment variable. This op‐ + still exported via the MAKEFLAGS environment variable. This op- tion may be useful on systems which have a small limit on the size of command arguments. - variable=value + variable=value Set the value of the variable variable to value. Normally, all values passed on the command line are also exported to sub-makes - in the environment. The -X flag disables this behavior. Vari‐ + in the environment. The -X flag disables this behavior. Vari- able assignments should follow options for POSIX compatibility but no ordering is enforced. - There are seven different types of lines in a makefile: file dependency + There are several different types of lines in a makefile: dependency specifications, shell commands, variable assignments, include statements, - conditional directives, for loops, and comments. + conditional directives, for loops, other directives, and comments. - In general, lines may be continued from one line to the next by ending - them with a backslash (‘\’). The trailing newline character and initial - whitespace on the following line are compressed into a single space. + Lines may be continued from one line to the next by ending them with a + backslash (`\'). The trailing newline character and initial whitespace + on the following line are compressed into a single space. FILE DEPENDENCY SPECIFICATIONS Dependency lines consist of one or more targets, an operator, and zero or - more sources. This creates a relationship where the targets “depend” on - the sources and are customarily created from them. A target is consid‐ - ered out-of-date if it does not exist, or if its modification time is - less than that of any of its sources. An out-of-date target will be re- - created, but not until all sources have been examined and themselves re- - created as needed. Three operators may be used: + more sources. This creates a relationship where the targets "depend" on + the sources and are customarily created from them. A target is consid- + ered out of date if it does not exist, or if its modification time is + less than that of any of its sources. An out-of-date target is re-cre- + ated, but not until all sources have been examined and themselves re-cre- + ated as needed. Three operators may be used: : Many dependency lines may name this target but only one may have attached shell commands. All sources named in all dependency lines are considered together, and if needed the attached shell commands - are run to create or re-create the target. If bmake is inter‐ + are run to create or re-create the target. If bmake is inter- rupted, the target is removed. ! The same, but the target is always re-created whether or not it is out of date. :: Any dependency line may have attached shell commands, but each one - is handled independently: its sources are considered and the at‐ - tached shell commands are run if the target is out of date with re‐ - spect to (only) those sources. Thus, different groups of the at‐ + is handled independently: its sources are considered and the at- + tached shell commands are run if the target is out of date with re- + spect to (only) those sources. Thus, different groups of the at- tached shell commands may be run depending on the circumstances. - Furthermore, unlike :, for dependency lines with no sources, the - attached shell commands are always run. Also unlike :, the target - will not be removed if bmake is interrupted. - All dependency lines mentioning a particular target must use the same op‐ + Furthermore, unlike :, for dependency lines with no sources, the + attached shell commands are always run. Also unlike :, the target + is not removed if bmake is interrupted. + + All dependency lines mentioning a particular target must use the same op- erator. - Targets and sources may contain the shell wildcard values ‘?’, ‘*’, ‘[]’, - and ‘{}’. The values ‘?’, ‘*’, and ‘[]’ may only be used as part of the - final component of the target or source, and must be used to describe ex‐ - isting files. The value ‘{}’ need not necessarily be used to describe - existing files. Expansion is in directory order, not alphabetically as - done in the shell. + Targets and sources may contain the shell wildcard values `?', `*', `[]', + and `{}'. The values `?', `*', and `[]' may only be used as part of the + final component of the target or source, and only match existing files. + The value `{}' need not necessarily be used to describe existing files. + Expansion is in directory order, not alphabetically as done in the shell. SHELL COMMANDS - Each target may have associated with it one or more lines of shell com‐ + Each target may have associated with it one or more lines of shell com- mands, normally used to create the target. Each of the lines in this script must be preceded by a tab. (For historical reasons, spaces are - not accepted.) While targets can appear in many dependency lines if de‐ + not accepted.) While targets can occur in many dependency lines if de- sired, by default only one of these rules may be followed by a creation - script. If the ‘::’ operator is used, however, all rules may include - scripts and the scripts are executed in the order found. + script. If the `::' operator is used, however, all rules may include + scripts, and the respective scripts are executed in the order found. Each line is treated as a separate shell command, unless the end of line - is escaped with a backslash (‘\’) in which case that line and the next - are combined. If the first characters of the command are any combination - of ‘@’, ‘+’, or ‘-’, the command is treated specially. A ‘@’ causes the - command not to be echoed before it is executed. A ‘+’ causes the command - to be executed even when -n is given. This is similar to the effect of - the .MAKE special source, except that the effect can be limited to a sin‐ - gle line of a script. A ‘-’ in compatibility mode causes any non-zero - exit status of the command line to be ignored. + is escaped with a backslash `\', in which case that line and the next are + combined. If the first characters of the command are any combination of + `@', `+', or `-', the command is treated specially. + + @ causes the command not to be echoed before it is executed. + + + causes the command to be executed even when -n is given. + This is similar to the effect of the .MAKE special source, + except that the effect can be limited to a single line of a + script. + + - in compatibility mode causes any non-zero exit status of + the command line to be ignored. When bmake is run in jobs mode with -j max_jobs, the entire script for the target is fed to a single instance of the shell. In compatibility - (non-jobs) mode, each command is run in a separate process. If the com‐ - mand contains any shell meta characters (‘#=|^(){};&<>*?[]:$`\\n’) it - will be passed to the shell; otherwise bmake will attempt direct execu‐ - tion. If a line starts with ‘-’ and the shell has ErrCtl enabled then - failure of the command line will be ignored as in compatibility mode. - Otherwise ‘-’ affects the entire job; the script will stop at the first - command line that fails, but the target will not be deemed to have - failed. + (non-jobs) mode, each command is run in a separate process. If the com- + mand contains any shell meta characters (`#=|^(){};&<>*?[]:$`\\n'), it is + passed to the shell; otherwise bmake attempts direct execution. If a + line starts with `-' and the shell has ErrCtl enabled, failure of the + command line is ignored as in compatibility mode. Otherwise `-' affects + the entire job; the script stops at the first command line that fails, + but the target is not deemed to have failed. Makefiles should be written so that the mode of bmake operation does not - change their behavior. For example, any command which needs to use “cd” - or “chdir” without potentially changing the directory for subsequent com‐ - mands should be put in parentheses so it executes in a subshell. To - force the use of one shell, escape the line breaks so as to make the + change their behavior. For example, any command which uses "cd" or + "chdir" without the intention of changing the directory for subsequent + commands should be put in parentheses so it executes in a subshell. To + force the use of a single shell, escape the line breaks so as to make the whole script one command. For example: avoid-chdir-side-effects: - @echo Building $@ in `pwd` + @echo "Building $@ in $$(pwd)" @(cd ${.CURDIR} && ${MAKE} $@) - @echo Back in `pwd` + @echo "Back in $$(pwd)" ensure-one-shell-regardless-of-mode: - @echo Building $@ in `pwd`; \ + @echo "Building $@ in $$(pwd)"; \ (cd ${.CURDIR} && ${MAKE} $@); \ - echo Back in `pwd` + echo "Back in $$(pwd)" - Since bmake will chdir(2) to ‘.OBJDIR’ before executing any targets, each - child process starts with that as its current working directory. + Since bmake changes the current working directory to `.OBJDIR' before ex- + ecuting any targets, each child process starts with that as its current + working directory. VARIABLE ASSIGNMENTS Variables in make behave much like macros in the C preprocessor. - Variable assignments have the form ‘NAME op value’, where: + Variable assignments have the form `NAME op value', where: - NAME is a single-word variable name, consisting, by tradition, of all - upper-case letters, + NAME is a single-word variable name, consisting, by tradition, + of all upper-case letters, - op is one of the five variable assignment operators described below, - and + op is one of the variable assignment operators described be- + low, and - value is interpreted according to the variable assignment operator. + value is interpreted according to the variable assignment opera- + tor. Whitespace around NAME, op and value is discarded. Variable assignment operators - The five operators that can be used to assign values to variables are: + The five operators that assign values to variables are: - = Assign the value to the variable. Any previous value is over‐ + = Assign the value to the variable. Any previous value is over- written. += Append the value to the current value of the variable, separating @@ -378,31 +389,33 @@ BMAKE(1) FreeBSD General Commands Manual BMAKE(1) ?= Assign the value to the variable if it is not already defined. - := Assign with expansion, i.e. expand the value before assigning it - to the variable. Normally, expansion is not done until the vari‐ - able is referenced. + := Expand the value, then assign it to the variable. NOTE: References to undefined variables are not expanded. This can cause problems when variable modifiers are used. - != Expand the value and pass it to the shell for execution and as‐ - sign the result to the variable. Any newlines in the result are - replaced with spaces. + != Expand the value and pass it to the shell for execution, then as- + sign the output from the child's standard output to the variable. + Any newlines in the result are replaced with spaces. Expansion of variables - In contexts where variables are expanded, ‘$$’ expands to a single dollar - sign. References to variables have the form ‘${name[:modifiers]}’ or - ‘$(name[:modifiers]’). If the variable name contains only a single char‐ - acter, the surrounding curly braces or parentheses are not required. - This shorter form is not recommended. + In most contexts where variables are expanded, `$$' expands to a single + dollar sign. In other contexts (most variable modifiers, string literals + in conditions), `\$' expands to a single dollar sign. - If the variable name contains a dollar, then the name itself is expanded - first. This allows almost arbitrary variable names, however names con‐ - taining dollar, braces, parentheses, or whitespace are really best + References to variables have the form ${name[:modifiers]} or + $(name[:modifiers]). If the variable name consists of only a single + character and the expression contains no modifiers, the surrounding curly + braces or parentheses are not required. This shorter form is not recom- + mended. + + If the variable name contains a dollar, the name itself is expanded + first. This allows almost arbitrary variable names, however names con- + taining dollar, braces, parentheses or whitespace are really best avoided. - If the result of expanding a variable contains a dollar sign (‘$’), the - string is expanded again. + If the result of expanding a nested variable expression contains a dollar + sign (`$'), the result is subject to further expansion. Variable substitution occurs at four distinct times, depending on where the variable is being used. @@ -415,10 +428,9 @@ BMAKE(1) FreeBSD General Commands Manual BMAKE(1) 3. Variables in shell commands are expanded when the shell command is executed. - 4. “.for” loop index variables are expanded on each loop iteration. - Note that other variables are not expanded when composing the body - of a loop, so the following example code: - + 4. .for loop index variables are expanded on each loop iteration. Note + that other variables are not expanded when composing the body of a + loop, so the following example code: .for i in 1 2 3 a+= ${i} @@ -430,17 +442,23 @@ BMAKE(1) FreeBSD General Commands Manual BMAKE(1) @echo ${a} @echo ${b} - will print: + prints: 1 2 3 3 3 3 - Because while ${a} contains “1 2 3” after the loop is executed, ${b} - contains “${j} ${j} ${j}” which expands to “3 3 3” since after the - loop completes ${j} contains “3”. + After the loop is executed: + + a contains `${:U1} ${:U2} ${:U3}', which expands to `1 2 + 3'. + + j contains `${:U3}', which expands to `3'. + + b contains `${j} ${j} ${j}', which expands to `${:U3} + ${:U3} ${:U3}' and further to `3 3 3'. Variable classes - The four different classes of variables (in order of increasing prece‐ + The four different classes of variables (in order of increasing prece- dence) are: Environment variables @@ -455,18 +473,18 @@ BMAKE(1) FreeBSD General Commands Manual BMAKE(1) Local variables Variables that are defined specific to a certain target. - Local variables can be set on a dependency line, if - .MAKE.TARGET_LOCAL_VARIABLES is not set to ‘false’. The rest of the line - (which will already have had global variables expanded) is the variable - value. For example: + Local variables can be set on a dependency line, unless + .MAKE.TARGET_LOCAL_VARIABLES is set to `false'. The rest of the line + (which already has had global variables expanded) is the variable value. + For example: COMPILER_WRAPPERS= ccache distcc icecc ${OBJS}: .MAKE.META.CMP_FILTER=${COMPILER_WRAPPERS:S,^,N,} - Only the targets ‘${OBJS}’ will be impacted by that filter (in "meta" - mode) and simply enabling/disabling any of the compiler wrappers will not - render all of those targets out-of-date. + Only the targets `${OBJS}' are impacted by that filter (in "meta" mode) + and simply enabling/disabling any of the compiler wrappers does not ren- + der all of those targets out-of-date. NOTE: target-local variable assignments behave differently in that; @@ -476,400 +494,451 @@ BMAKE(1) FreeBSD General Commands Manual BMAKE(1) := Is redundant with respect to global variables, which have already been expanded. - The seven built-in local variables are as follows: + The seven built-in local variables are: .ALLSRC The list of all sources for this target; also known as - ‘>’. + `>'. - .ARCHIVE The name of the archive file; also known as ‘!’. + .ARCHIVE The name of the archive file; also known as `!'. .IMPSRC In suffix-transformation rules, the name/path of the source from which the target is to be transformed (the - “implied” source); also known as ‘<’. It is not defined + "implied" source); also known as `<'. It is not defined in explicit rules. - .MEMBER The name of the archive member; also known as ‘%’. + .MEMBER The name of the archive member; also known as `%'. .OODATE The list of sources for this target that were deemed out- - of-date; also known as ‘?’. + of-date; also known as `?'. .PREFIX The file prefix of the target, containing only the file portion, no suffix or preceding directory components; - also known as ‘*’. The suffix must be one of the known - suffixes declared with .SUFFIXES or it will not be recog‐ + also known as `*'. The suffix must be one of the known + suffixes declared with .SUFFIXES, or it is not recog- nized. - .TARGET The name of the target; also known as ‘@’. For compati‐ - bility with other makes this is an alias for .ARCHIVE in + .TARGET The name of the target; also known as `@'. For compati- + bility with other makes this is an alias for .ARCHIVE in archive member rules. - The shorter forms (‘>’, ‘!’, ‘<’, ‘%’, ‘?’, ‘*’, and ‘@’) are permitted + The shorter forms (`>', `!', `<', `%', `?', `*', and `@') are permitted for backward compatibility with historical makefiles and legacy POSIX make and are not recommended. Variants of these variables with the punctuation followed immediately by - ‘D’ or ‘F’, e.g. ‘$(@D)’, are legacy forms equivalent to using the ‘:H’ - and ‘:T’ modifiers. These forms are accepted for compatibility with AT&T + `D' or `F', e.g. `$(@D)', are legacy forms equivalent to using the `:H' + and `:T' modifiers. These forms are accepted for compatibility with AT&T System V UNIX makefiles and POSIX but are not recommended. Four of the local variables may be used in sources on dependency lines because they expand to the proper value for each target on the line. - These variables are ‘.TARGET’, ‘.PREFIX’, ‘.ARCHIVE’, and ‘.MEMBER’. + These variables are `.TARGET', `.PREFIX', `.ARCHIVE', and `.MEMBER'. Additional built-in variables In addition, bmake sets or knows about the following variables: - .ALLTARGETS The list of all targets encountered in the Makefile. If - evaluated during Makefile parsing, lists only those tar‐ - gets encountered thus far. + .ALLTARGETS + The list of all targets encountered in the makefiles. If evalu- + ated during makefile parsing, lists only those targets encoun- + tered thus far. - .CURDIR A path to the directory where bmake was executed. Refer - to the description of ‘PWD’ for more details. + .CURDIR + A path to the directory where bmake was executed. Refer to the + description of `PWD' for more details. + + .ERROR_CMD + Is used in error handling, see MAKE_PRINT_VAR_ON_ERROR. + + .ERROR_CWD + Is used in error handling, see MAKE_PRINT_VAR_ON_ERROR. + + .ERROR_META_FILE + Is used in error handling in "meta" mode, see + MAKE_PRINT_VAR_ON_ERROR. + + .ERROR_TARGET + Is used in error handling, see MAKE_PRINT_VAR_ON_ERROR. .INCLUDEDFROMDIR - The directory of the file this Makefile was included - from. + The directory of the file this makefile was included from. .INCLUDEDFROMFILE - The filename of the file this Makefile was included from. + The filename of the file this makefile was included from. - MAKE The name that bmake was executed with (argv[0]). For - compatibility bmake also sets .MAKE with the same value. - The preferred variable to use is the environment variable - MAKE because it is more compatible with other versions of - bmake and cannot be confused with the special target with - the same name. + MACHINE + The machine hardware name, see uname(1). + + MACHINE_ARCH + The machine processor architecture name, see uname(1). + + MAKE The name that bmake was executed with (argv[0]). + + .MAKE The same as MAKE, for compatibility. The preferred variable to + use is the environment variable MAKE because it is more compati- + ble with other make variants and cannot be confused with the spe- + cial target with the same name. .MAKE.DEPENDFILE - Names the makefile (default ‘.depend’) from which gener‐ - ated dependencies are read. + Names the makefile (default `.depend') from which generated de- + pendencies are read. + + .MAKE.DIE_QUIETLY + If set to `true', do not print error information at the end. .MAKE.EXPAND_VARIABLES - A boolean that controls the default behavior of the -V - option. If true, variable values printed with -V are - fully expanded; if false, the raw variable contents - (which may include additional unexpanded variable refer‐ - ences) are shown. + A boolean that controls the default behavior of the -V option. + If true, variable values printed with -V are fully expanded; if + false, the raw variable contents (which may include additional + unexpanded variable references) are shown. - .MAKE.EXPORTED The list of variables exported by bmake. + .MAKE.EXPORTED + The list of variables exported by bmake. - .MAKE.JOBS The argument to the -j option. + MAKEFILE + The top-level makefile that is currently read, as given in the + command line. + + .MAKEFLAGS + The environment variable `MAKEFLAGS' may contain anything that + may be specified on bmake's command line. Anything specified on + bmake's command line is appended to the .MAKEFLAGS variable, + which is then added to the environment for all programs that + bmake executes. + + .MAKE.GID + The numeric group ID of the user running bmake. It is read-only. .MAKE.JOB.PREFIX - If bmake is run with -j, the output for each target is - prefixed with a token ‘--- target ---’ the first part of - which can be controlled via .MAKE.JOB.PREFIX. If - .MAKE.JOB.PREFIX is empty, no token is printed. For ex‐ - ample, setting .MAKE.JOB.PREFIX to - ${.newline}---${.MAKE:T}[${.MAKE.PID}] would produce to‐ - kens like ‘---make[1234] target ---’ making it easier to - track the degree of parallelism being achieved. + If bmake is run with -j, the output for each target is prefixed + with a token + --- target --- + the first part of which can be controlled via .MAKE.JOB.PREFIX. + If .MAKE.JOB.PREFIX is empty, no token is printed. For example, + setting .MAKE.JOB.PREFIX to + `${.newline}---${.MAKE:T}[${.MAKE.PID}]' would produce tokens + like + ---make[1234] target --- + making it easier to track the degree of parallelism being + achieved. - .MAKE.TARGET_LOCAL_VARIABLES - If set to ‘false’, apparent variable assignments in de‐ - pendency lines are treated as normal sources. + .MAKE.JOBS + The argument to the -j option. - MAKEFLAGS The environment variable ‘MAKEFLAGS’ may contain anything - that may be specified on bmake's command line. Anything - specified on bmake's command line is appended to the - ‘MAKEFLAGS’ variable which is then entered into the envi‐ - ronment for all programs which bmake executes. + .MAKE.LEVEL + The recursion depth of bmake. The top-level instance of bmake + has level 0, and each child make has its parent level plus 1. + This allows tests like: .if ${.MAKE.LEVEL} == 0 to protect things + which should only be evaluated in the top-level instance of + bmake. - .MAKE.LEVEL The recursion depth of bmake. The initial instance of - bmake will be 0, and an incremented value is put into the - environment to be seen by the next generation. This al‐ - lows tests like: .if ${.MAKE.LEVEL} == 0 to protect - things which should only be evaluated in the initial in‐ - stance of bmake. + .MAKE.LEVEL.ENV + The name of the environment variable that stores the level of + nested calls to bmake. .MAKE.MAKEFILE_PREFERENCE - The ordered list of makefile names (default ‘makefile’, - ‘Makefile’) that bmake will look for. + The ordered list of makefile names (default `makefile', + `Makefile') that bmake looks for. .MAKE.MAKEFILES - The list of makefiles read by bmake, which is useful for - tracking dependencies. Each makefile is recorded only - once, regardless of the number of times read. - - .MAKE.MODE Processed after reading all makefiles. Can affect the - mode that bmake runs in. It can contain a number of key‐ - words: - - compat Like -B, puts bmake into "compat" - mode. - - meta Puts bmake into "meta" mode, where - meta files are created for each tar‐ - get to capture the command run, the - output generated and if filemon(4) - is available, the system calls which - are of interest to bmake. The cap‐ - tured output can be very useful when - diagnosing errors. - - curdirOk= bf Normally bmake will not create .meta - files in ‘.CURDIR’. This can be - overridden by setting bf to a value - which represents True. - - missing-meta= bf If bf is True, then a missing .meta - file makes the target out-of-date. - - missing-filemon= bf If bf is True, then missing filemon - data makes the target out-of-date. - - nofilemon Do not use filemon(4). - - env For debugging, it can be useful to - include the environment in the .meta - file. - - verbose If in "meta" mode, print a clue - about the target being built. This - is useful if the build is otherwise - running silently. The message - printed the value of: - .MAKE.META.PREFIX. - - ignore-cmd Some makefiles have commands which - are simply not stable. This keyword - causes them to be ignored for deter‐ - mining whether a target is out of - date in "meta" mode. See also - .NOMETA_CMP. - - silent= bf If bf is True, when a .meta file is - created, mark the target .SILENT. - - randomize-targets In both compat and parallel mode, do - not make the targets in the usual - order, but instead randomize their - order. This mode can be used to de‐ - tect undeclared dependencies between - files. + The list of makefiles read by bmake, which is useful for tracking + dependencies. Each makefile is recorded only once, regardless of + the number of times read. .MAKE.META.BAILIWICK - In "meta" mode, provides a list of prefixes which match - the directories controlled by bmake. If a file that was - generated outside of .OBJDIR but within said bailiwick is - missing, the current target is considered out-of-date. + In "meta" mode, provides a list of prefixes which match the di- + rectories controlled by bmake. If a file that was generated out- + side of .OBJDIR but within said bailiwick is missing, the current + target is considered out-of-date. .MAKE.META.CMP_FILTER - In "meta" mode, it can (very rarely!) be useful to filter - command lines before comparison. This variable can be - set to a set of modifiers that will be applied to each - line of the old and new command that differ, if the fil‐ - tered commands still differ, the target is considered - out-of-date. + In "meta" mode, it can (very rarely!) be useful to filter command + lines before comparison. This variable can be set to a set of + modifiers that are applied to each line of the old and new com- + mand that differ, if the filtered commands still differ, the tar- + get is considered out-of-date. .MAKE.META.CREATED - In "meta" mode, this variable contains a list of all the - meta files updated. If not empty, it can be used to - trigger processing of .MAKE.META.FILES. + In "meta" mode, this variable contains a list of all the meta + files updated. If not empty, it can be used to trigger process- + ing of .MAKE.META.FILES. .MAKE.META.FILES - In "meta" mode, this variable contains a list of all the - meta files used (updated or not). This list can be used - to process the meta files to extract dependency informa‐ - tion. - - .MAKE.META.IGNORE_PATHS - Provides a list of path prefixes that should be ignored; - because the contents are expected to change over time. - The default list includes: ‘/dev /etc /proc /tmp /var/run - /var/tmp’ - - .MAKE.META.IGNORE_PATTERNS - Provides a list of patterns to match against pathnames. - Ignore any that match. + In "meta" mode, this variable contains a list of all the meta + files used (updated or not). This list can be used to process + the meta files to extract dependency information. .MAKE.META.IGNORE_FILTER - Provides a list of variable modifiers to apply to each - pathname. Ignore if the expansion is an empty string. + Provides a list of variable modifiers to apply to each pathname. + Ignore if the expansion is an empty string. + + .MAKE.META.IGNORE_PATHS + Provides a list of path prefixes that should be ignored; because + the contents are expected to change over time. The default list + includes: `/dev /etc /proc /tmp /var/run /var/tmp' + + .MAKE.META.IGNORE_PATTERNS + Provides a list of patterns to match against pathnames. Ignore + any that match. .MAKE.META.PREFIX - Defines the message printed for each meta file updated in - "meta verbose" mode. The default value is: - Building ${.TARGET:H:tA}/${.TARGET:T} + Defines the message printed for each meta file updated in "meta + verbose" mode. The default value is: + Building ${.TARGET:H:tA}/${.TARGET:T} - .MAKEOVERRIDES This variable is used to record the names of variables - assigned to on the command line, so that they may be ex‐ - ported as part of ‘MAKEFLAGS’. This behavior can be dis‐ - abled by assigning an empty value to ‘.MAKEOVERRIDES’ - within a makefile. Extra variables can be exported from - a makefile by appending their names to ‘.MAKEOVERRIDES’. - ‘MAKEFLAGS’ is re-exported whenever ‘.MAKEOVERRIDES’ is - modified. + .MAKE.MODE + Processed after reading all makefiles. Affects the mode that + bmake runs in. It can contain these keywords: + + compat Like -B, puts bmake into "compat" mode. + + meta Puts bmake into "meta" mode, where meta files are created + for each target to capture the command run, the output + generated, and if filemon(4) is available, the system + calls which are of interest to bmake. The captured out- + put can be useful when diagnosing errors. + + curdirOk=bf + By default, bmake does not create .meta files in + `.CURDIR'. This can be overridden by setting bf to a + value which represents true. + + missing-meta=bf + If bf is true, a missing .meta file makes the target out- + of-date. + + missing-filemon=bf + If bf is true, missing filemon data makes the target out- + of-date. + + nofilemon + Do not use filemon(4). + + env For debugging, it can be useful to include the environ- + ment in the .meta file. + + verbose + If in "meta" mode, print a clue about the target being + built. This is useful if the build is otherwise running + silently. The message printed is the expanded value of + .MAKE.META.PREFIX. + + ignore-cmd + Some makefiles have commands which are simply not stable. + This keyword causes them to be ignored for determining + whether a target is out of date in "meta" mode. See also + .NOMETA_CMP. + + silent=bf + If bf is true, when a .meta file is created, mark the + target .SILENT. + + randomize-targets + In both compat and parallel mode, do not make the targets + in the usual order, but instead randomize their order. + This mode can be used to detect undeclared dependencies + between files. + + MAKEOBJDIR + Used to create files in a separate directory, see .OBJDIR. + + MAKE_OBJDIR_CHECK_WRITABLE + Used to force a separate directory for the created files, even if + that directory is not writable, see .OBJDIR. + + MAKEOBJDIRPREFIX + Used to create files in a separate directory, see .OBJDIR. + + .MAKE.OS + The name of the operating system, see uname(1). It is read-only. + + .MAKEOVERRIDES + This variable is used to record the names of variables assigned + to on the command line, so that they may be exported as part of + `MAKEFLAGS'. This behavior can be disabled by assigning an empty + value to `.MAKEOVERRIDES' within a makefile. Extra variables can + be exported from a makefile by appending their names to + `.MAKEOVERRIDES'. `MAKEFLAGS' is re-exported whenever + `.MAKEOVERRIDES' is modified. .MAKE.PATH_FILEMON - If bmake was built with filemon(4) support, this is set - to the path of the device node. This allows makefiles to - test for this support. + If bmake was built with filemon(4) support, this is set to the + path of the device node. This allows makefiles to test for this + support. - .MAKE.PID The process-id of bmake. + .MAKE.PID + The process ID of bmake. It is read-only. - .MAKE.PPID The parent process-id of bmake. - - .MAKE.SAVE_DOLLARS - value should be a boolean that controls whether ‘$$’ are - preserved when doing ‘:=’ assignments. The default is - false, for backwards compatibility. Set to true for com‐ - patability with other makes. If set to false, ‘$$’ be‐ - comes ‘$’ per normal evaluation rules. - - .MAKE.UID The user-id running bmake. - - .MAKE.GID The group-id running bmake. + .MAKE.PPID + The parent process ID of bmake. It is read-only. MAKE_PRINT_VAR_ON_ERROR - When bmake stops due to an error, it sets ‘.ERROR_TARGET’ - to the name of the target that failed, ‘.ERROR_CMD’ to - the commands of the failed target, and in "meta" mode, it - also sets ‘.ERROR_CWD’ to the getcwd(3), and - ‘.ERROR_META_FILE’ to the path of the meta file (if any) - describing the failed target. It then prints its name - and the value of ‘.CURDIR’ as well as the value of any - variables named in ‘MAKE_PRINT_VAR_ON_ERROR’. + When bmake stops due to an error, it sets `.ERROR_TARGET' to the + name of the target that failed, `.ERROR_CMD' to the commands of + the failed target, and in "meta" mode, it also sets `.ERROR_CWD' + to the getcwd(3), and `.ERROR_META_FILE' to the path of the meta + file (if any) describing the failed target. It then prints its + name and the value of `.CURDIR' as well as the value of any vari- + ables named in `MAKE_PRINT_VAR_ON_ERROR'. - .newline This variable is simply assigned a newline character as - its value. This allows expansions using the :@ modifier - to put a newline between iterations of the loop rather - than a space. For example, the printing of - ‘MAKE_PRINT_VAR_ON_ERROR’ could be done as - ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@}. + .MAKE.SAVE_DOLLARS + If true, `$$' are preserved when doing `:=' assignments. The de- + fault is false, for backwards compatibility. Set to true for + compatability with other makes. If set to false, `$$' becomes + `$' per normal evaluation rules. - .OBJDIR A path to the directory where the targets are built. Its - value is determined by trying to chdir(2) to the follow‐ - ing directories in order and using the first match: + .MAKE.TARGET_LOCAL_VARIABLES + If set to `false', apparent variable assignments in dependency + lines are treated as normal sources. - 1. ${MAKEOBJDIRPREFIX}${.CURDIR} + .MAKE.UID + The numeric ID of the user running bmake. It is read-only. - (Only if ‘MAKEOBJDIRPREFIX’ is set in the environ‐ - ment or on the command line.) + .newline + This variable is simply assigned a newline character as its + value. It is read-only. This allows expansions using the :@ + modifier to put a newline between iterations of the loop rather + than a space. For example, in case of an error, bmake prints the + variable names and their values using: + ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@} - 2. ${MAKEOBJDIR} + .OBJDIR + A path to the directory where the targets are built. Its value + is determined by trying to chdir(2) to the following directories + in order and using the first match: - (Only if ‘MAKEOBJDIR’ is set in the environment or - on the command line.) + 1. ${MAKEOBJDIRPREFIX}${.CURDIR} - 3. ${.CURDIR}/obj.${MACHINE} + (Only if `MAKEOBJDIRPREFIX' is set in the environment or on + the command line.) - 4. ${.CURDIR}/obj + 2. ${MAKEOBJDIR} - 5. /usr/obj/${.CURDIR} + (Only if `MAKEOBJDIR' is set in the environment or on the + command line.) - 6. ${.CURDIR} + 3. ${.CURDIR}/obj.${MACHINE} - Variable expansion is performed on the value before it's - used, so expressions such as - ${.CURDIR:S,^/usr/src,/var/obj,} - may be used. This is especially useful with - ‘MAKEOBJDIR’. + 4. ${.CURDIR}/obj - ‘.OBJDIR’ may be modified in the makefile via the special - target ‘.OBJDIR’. In all cases, bmake will chdir(2) to - the specified directory if it exists, and set ‘.OBJDIR’ - and ‘PWD’ to that directory before executing any targets. + 5. /usr/obj/${.CURDIR} - Except in the case of an explicit ‘.OBJDIR’ target, bmake - will check that the specified directory is writable and - ignore it if not. This check can be skipped by setting - the environment variable ‘MAKE_OBJDIR_CHECK_WRITABLE’ to - "no". + 6. ${.CURDIR} - .PARSEDIR A path to the directory of the current ‘Makefile’ being - parsed. + Variable expansion is performed on the value before it is used, + so expressions such as ${.CURDIR:S,^/usr/src,/var/obj,} may be + used. This is especially useful with `MAKEOBJDIR'. - .PARSEFILE The basename of the current ‘Makefile’ being parsed. - This variable and ‘.PARSEDIR’ are both set only while the - ‘Makefiles’ are being parsed. If you want to retain - their current values, assign them to a variable using as‐ - signment with expansion ‘:=’. + `.OBJDIR' may be modified in the makefile via the special target + `.OBJDIR'. In all cases, bmake changes to the specified direc- + tory if it exists, and sets `.OBJDIR' and `PWD' to that directory + before executing any targets. - .PATH A variable that represents the list of directories that - bmake will search for files. The search list should be - updated using the target ‘.PATH’ rather than the vari‐ - able. + Except in the case of an explicit `.OBJDIR' target, bmake checks + that the specified directory is writable and ignores it if not. + This check can be skipped by setting the environment variable + `MAKE_OBJDIR_CHECK_WRITABLE' to "no". - PWD Alternate path to the current directory. bmake normally - sets ‘.CURDIR’ to the canonical path given by getcwd(3). - However, if the environment variable ‘PWD’ is set and - gives a path to the current directory, then bmake sets - ‘.CURDIR’ to the value of ‘PWD’ instead. This behavior - is disabled if ‘MAKEOBJDIRPREFIX’ is set or ‘MAKEOBJDIR’ - contains a variable transform. ‘PWD’ is set to the value - of ‘.OBJDIR’ for all programs which bmake executes. + .PARSEDIR + The directory name of the current makefile being parsed. - .SHELL The pathname of the shell used to run target scripts. It - is read-only. + .PARSEFILE + The basename of the current makefile being parsed. This variable + and `.PARSEDIR' are both set only while the makefiles are being + parsed. To retain their current values, assign them to a vari- + able using assignment with expansion `:='. - .SUFFIXES The list of known suffixes. It is read-only. + .PATH The space-separated list of directories that bmake searches for + files. To update this search list, use the special target + `.PATH' rather than modifying the variable directly. - .TARGETS The list of targets explicitly specified on the command - line, if any. + %POSIX Is set in POSIX mode, see the special `.POSIX' target. - VPATH Colon-separated (“:”) lists of directories that bmake - will search for files. The variable is supported for - compatibility with old make programs only, use ‘.PATH’ - instead. + PWD Alternate path to the current directory. bmake normally sets + `.CURDIR' to the canonical path given by getcwd(3). However, if + the environment variable `PWD' is set and gives a path to the + current directory, bmake sets `.CURDIR' to the value of `PWD' in- + stead. This behavior is disabled if `MAKEOBJDIRPREFIX' is set or + `MAKEOBJDIR' contains a variable transform. `PWD' is set to the + value of `.OBJDIR' for all programs which bmake executes. + + .SHELL The pathname of the shell used to run target scripts. It is + read-only. + + .SUFFIXES + The list of known suffixes. It is read-only. + + .SYSPATH + The space-separated list of directories that bmake searches for + makefiles, referred to as the system include path. To update + this search list, use the special target `.SYSPATH' rather than + modifying the variable which is read-only. + + .TARGETS + The list of targets explicitly specified on the command line, if + any. + + VPATH The colon-separated (":") list of directories that bmake searches + for files. This variable is supported for compatibility with old + make programs only, use `.PATH' instead. Variable modifiers - Variable expansion may be modified to select or modify each word of the - variable (where a “word” is white-space delimited sequence of charac‐ - ters). The general format of a variable expansion is as follows: + The general format of a variable expansion is: - ${variable[:modifier[:...]]} + ${variable[:modifier[:...]]} - Each modifier begins with a colon, which may be escaped with a backslash - (‘\’). + Each modifier begins with a colon. To escape a colon, precede it with a + backslash `\'. - A set of modifiers can be specified via a variable, as follows: + A list of indirect modifiers can be specified via a variable, as follows: - modifier_variable=modifier[:...] - ${variable:${modifier_variable}[:...]} + modifier_variable = modifier[:...] - In this case the first modifier in the modifier_variable does not start - with a colon, since that must appear in the referencing variable. If any - of the modifiers in the modifier_variable contain a dollar sign (‘$’), - these must be doubled to avoid early expansion. + ${variable:${modifier_variable}[:...]} + + In this case, the first modifier in the modifier_variable does not start + with a colon, since that colon already occurs in the referencing vari- + able. If any of the modifiers in the modifier_variable contains a dollar + sign (`$'), these must be doubled to avoid early expansion. + + Some modifiers interpret the expression value as a single string, others + treat the expression value as a whitespace-separated list of words. When + splitting a string into words, whitespace can be escaped using double + quotes, single quotes and backslashes, like in the shell. The quotes and + backslashes are retained in the words. The supported modifiers are: - :E Replaces each word in the variable with its suffix. + :E Replaces each word with its suffix. - :H Replaces each word in the variable with everything but the last com‐ - ponent. + :H Replaces each word with its dirname. :Mpattern Selects only those words that match pattern. The standard shell - wildcard characters (‘*’, ‘?’, and ‘[]’) may be used. The wildcard - characters may be escaped with a backslash (‘\’). As a consequence - of the way values are split into words, matched, and then joined, a - construct like - ${VAR:M*} - will normalize the inter-word spacing, removing all leading and - trailing space, and converting multiple consecutive spaces to single - spaces. + wildcard characters (`*', `?', and `[]') may be used. The wildcard + characters may be escaped with a backslash (`\'). As a consequence + of the way values are split into words, matched, and then joined, + the construct `${VAR:M*}' removes all leading and trailing white- + space and normalizes the inter-word spacing to a single space. :Npattern - This is identical to ‘:M’, but selects all words which do not match + This is the opposite of `:M', selecting all words which do not match pattern. - :O Orders every word in variable alphabetically. + :O Orders the words lexicographically. - :On Orders every word in variable numerically. A number followed by one - of ‘k’, ‘M’ or ‘G’ is multiplied by the appropriate factor (1024 - (k), 1048576 (M), or 1073741824 (G)). Both upper- and lower-case - letters are accepted. + :On Orders the words numerically. A number followed by one of `k', `M' + or `G' is multiplied by the appropriate factor, which is 1024 for + `k', 1048576 for `M', or 1073741824 for `G'. Both upper- and lower- + case letters are accepted. - :Or Orders every word in variable in reverse alphabetical order. + :Or Orders the words in reverse lexicographical order. :Orn - Orders every word in variable in reverse numerical order. + Orders the words in reverse numerical order. - :Ox Shuffles the words in variable. The results will be different each - time you are referring to the modified variable; use the assignment - with expansion ‘:=’ to prevent such behavior. For example, + :Ox Shuffles the words. The results are different each time you are re- + ferring to the modified variable; use the assignment with expansion + `:=' to prevent such behavior. For example, LIST= uno due tre quattro RANDOM_LIST= ${LIST:Ox} @@ -887,136 +956,134 @@ BMAKE(1) FreeBSD General Commands Manual BMAKE(1) due uno quattro tre due uno quattro tre - :Q Quotes every shell meta-character in the variable, so that it can be + :Q Quotes every shell meta-character in the value, so that it can be passed safely to the shell. - :q Quotes every shell meta-character in the variable, and also doubles - ‘$’ characters so that it can be passed safely through recursive in‐ - vocations of bmake. This is equivalent to: ‘:S/\$/&&/g:Q’. + :q Quotes every shell meta-character in the value, and also doubles `$' + characters so that it can be passed safely through recursive invoca- + tions of bmake. This is equivalent to `:S/\$/&&/g:Q'. - :R Replaces each word in the variable with everything but its suffix. + :R Replaces each word with everything but its suffix. - :range[=count] - The value is an integer sequence representing the words of the orig‐ + :range[=count] + The value is an integer sequence representing the words of the orig- inal value, or the supplied count. - :gmtime[=utc] - The value is a format string for strftime(3), using gmtime(3). If a - utc value is not provided or is 0, the current time is used. + :gmtime[=timestamp] + The value is interpreted as a format string for strftime(3), using + gmtime(3), producing the formatted timestamp. If a timestamp value + is not provided or is 0, the current time is used. :hash - Computes a 32-bit hash of the value and encode it as hex digits. + Computes a 32-bit hash of the value and encodes it as 8 hex digits. - :localtime[=utc] - The value is a format string for strftime(3), using localtime(3). - If a utc value is not provided or is 0, the current time is used. + :localtime[=timestamp] + The value is interpreted as a format string for strftime(3), using + localtime(3), producing the formatted timestamp. If a timestamp + value is not provided or is 0, the current time is used. - :tA Attempts to convert variable to an absolute path using realpath(3), - if that fails, the value is unchanged. + :tA Attempts to convert the value to an absolute path using realpath(3). + If that fails, the value is unchanged. - :tl Converts variable to lower-case letters. + :tl Converts the value to lower-case letters. :tsc - Words in the variable are normally separated by a space on expan‐ - sion. This modifier sets the separator to the character c. If c is - omitted, then no separator is used. The common escapes (including - octal numeric codes) work as expected. + When joining the words after a modifier that treats the value as + words, the words are normally separated by a space. This modifier + changes the separator to the character c. If c is omitted, no sepa- + rator is used. The common escapes (including octal numeric codes) + work as expected. - :tu Converts variable to upper-case letters. + :tu Converts the value to upper-case letters. - :tW Causes the value to be treated as a single word (possibly containing - embedded white space). See also ‘:[*]’. + :tW Causes subsequent modifiers to treat the value as a single word + (possibly containing embedded whitespace). See also `:[*]'. - :tw Causes the value to be treated as a sequence of words delimited by - white space. See also ‘:[@]’. + :tw Causes the value to be treated as a list of words. See also `:[@]'. :S/old_string/new_string/[1gW] Modifies the first occurrence of old_string in each word of the - variable's value, replacing it with new_string. If a ‘g’ is ap‐ - pended to the last delimiter of the pattern, all occurrences in each - word are replaced. If a ‘1’ is appended to the last delimiter of - the pattern, only the first occurrence is affected. If a ‘W’ is ap‐ - pended to the last delimiter of the pattern, then the value is - treated as a single word (possibly containing embedded white space). - If old_string begins with a caret (‘^’), old_string is anchored at - the beginning of each word. If old_string ends with a dollar sign - (‘$’), it is anchored at the end of each word. Inside new_string, - an ampersand (‘&’) is replaced by old_string (without any ‘^’ or - ‘$’). Any character may be used as a delimiter for the parts of the - modifier string. The anchoring, ampersand and delimiter characters - may be escaped with a backslash (‘\’). + value, replacing it with new_string. If a `g' is appended to the + last delimiter of the pattern, all occurrences in each word are re- + placed. If a `1' is appended to the last delimiter of the pattern, + only the first occurrence is affected. If a `W' is appended to the + last delimiter of the pattern, the value is treated as a single + word. If old_string begins with a caret (`^'), old_string is an- + chored at the beginning of each word. If old_string ends with a + dollar sign (`$'), it is anchored at the end of each word. Inside + new_string, an ampersand (`&') is replaced by old_string (without + the anchoring `^' or `$'). Any character may be used as the delim- + iter for the parts of the modifier string. The anchoring, ampersand + and delimiter characters can be escaped with a backslash (`\'). - Variable expansion occurs in the normal fashion inside both - old_string and new_string with the single exception that a backslash - is used to prevent the expansion of a dollar sign (‘$’), not a pre‐ - ceding dollar sign as is usual. + Both old_string and new_string may contain nested expressions. To + prevent a dollar sign from starting a nested expression, escape it + with a backslash. :C/pattern/replacement/[1gW] - The :C modifier is just like the :S modifier except that the old and - new strings, instead of being simple strings, are an extended regu‐ - lar expression (see regex(3)) string pattern and an ed(1)-style - string replacement. Normally, the first occurrence of the pattern - pattern in each word of the value is substituted with replacement. - The ‘1’ modifier causes the substitution to apply to at most one - word; the ‘g’ modifier causes the substitution to apply to as many - instances of the search pattern pattern as occur in the word or - words it is found in; the ‘W’ modifier causes the value to be - treated as a single word (possibly containing embedded white space). + The :C modifier works like the :S modifier except that the old and + new strings, instead of being simple strings, are an extended regu- + lar expression pattern (see regex(3)) and an ed(1)-style + replacement. Normally, the first occurrence of the pattern pattern + in each word of the value is substituted with replacement. The `1' + modifier causes the substitution to apply to at most one word; the + `g' modifier causes the substitution to apply to as many instances + of the search pattern pattern as occur in the word or words it is + found in; the `W' modifier causes the value to be treated as a sin- + gle word (possibly containing embedded whitespace). As for the :S modifier, the pattern and replacement are subjected to variable expansion before being parsed as regular expressions. - :T Replaces each word in the variable with its last path component. + :T Replaces each word with its last path component (basename). :u Removes adjacent duplicate words (like uniq(1)). :?true_string:false_string - If the variable name (not its value), when parsed as a .if condi‐ + If the variable name (not its value), when parsed as a .if condi- tional expression, evaluates to true, return as its value the true_string, otherwise return the false_string. Since the variable name is used as the expression, :? must be the first modifier after - the variable name itself - which will, of course, usually contain - variable expansions. A common error is trying to use expressions - like + the variable name itself--which, of course, usually contains vari- + able expansions. A common error is trying to use expressions like ${NUMBERS:M42:?match:no} - which actually tests defined(NUMBERS), to determine if any words - match "42" you need to use something like: + which actually tests defined(NUMBERS). To determine if any words + match "42", you need to use something like: ${"${NUMBERS:M42}" != "":?match:no}. :old_string=new_string - This is the AT&T System V UNIX style variable substitution. It must - be the last modifier specified. If old_string or new_string do not - contain the pattern matching character % then it is assumed that - they are anchored at the end of each word, so only suffixes or en‐ - tire words may be replaced. Otherwise % is the substring of - old_string to be replaced in new_string. If only old_string con‐ - tains the pattern matching character %, and old_string matches, then - the result is the new_string. If only the new_string contains the - pattern matching character %, then it is not treated specially and - it is printed as a literal % on match. If there is more than one - pattern matching character (%) in either the new_string or - old_string, only the first instance is treated specially (as the - pattern character); all subsequent instances are treated as regular - characters. + This is the AT&T System V UNIX style substitution. It can only be + the last modifier specified, as a `:' in either old_string or + new_string is treated as a regular character, not as the end of the + modifier. - Variable expansion occurs in the normal fashion inside both - old_string and new_string with the single exception that a backslash - is used to prevent the expansion of a dollar sign (‘$’), not a pre‐ - ceding dollar sign as is usual. + If old_string does not contain the pattern matching character `%', + and the word ends with old_string or equals it, that suffix is re- + placed with new_string. - :@temp@string@ - This is the loop expansion mechanism from the OSF Development Envi‐ + Otherwise, the first `%' in old_string matches a possibly empty sub- + string of arbitrary characters, and if the whole pattern is found in + the word, the matching part is replaced with new_string, and the + first occurrence of `%' in new_string (if any) is replaced with the + substring matched by the `%'. + + Both old_string and new_string may contain nested expressions. To + prevent a dollar sign from starting a nested expression, escape it + with a backslash. + + :@varname@string@ + This is the loop expansion mechanism from the OSF Development Envi- ronment (ODE) make. Unlike .for loops, expansion occurs at the time - of reference. Assigns temp to each word in the variable and evalu‐ - ates string. The ODE convention is that temp should start and end - with a period. For example. + of reference. For each word in the value, assign the word to the + variable named varname and evaluate string. The ODE convention is + that varname should start and end with a period, for example: ${LINKS:@.LINK.@${LN} ${TARGET} ${.LINK.}@} - However a single character variable is often more readable: + However, a single-letter variable is often more readable: ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@} :_[=var] - Saves the current variable value in ‘$_’ or the named var for later + Saves the current variable value in `$_' or the named var for later reference. Example usage: M_cmpv.units = 1 1000 1000000 @@ -1025,13 +1092,13 @@ BMAKE(1) FreeBSD General Commands Manual BMAKE(1) .if ${VERSION:${M_cmpv}} < ${3.1.12:L:${M_cmpv}} - Here ‘$_’ is used to save the result of the ‘:S’ modifier which is - later referenced using the index values from ‘:range’. + Here `$_' is used to save the result of the `:S' modifier which is + later referenced using the index values from `:range'. :Unewval If the variable is undefined, newval is the value. If the variable is defined, the existing value is returned. This is another ODE - make feature. It is handy for setting per-target CFLAGS for in‐ + make feature. It is handy for setting per-target CFLAGS for in- stance: ${_${.TARGET:T}_CFLAGS:U${DEF_CFLAGS}} If a value is only required if the variable is undefined, use: @@ -1043,27 +1110,26 @@ BMAKE(1) FreeBSD General Commands Manual BMAKE(1) :L The name of the variable is the value. :P The path of the node which has the same name as the variable is the - value. If no such node exists or its path is null, then the name of - the variable is used. In order for this modifier to work, the name - (node) must at least have appeared on the rhs of a dependency. + value. If no such node exists or its path is null, the name of the + variable is used. In order for this modifier to work, the name + (node) must at least have appeared on the right-hand side of a de- + pendency. :!cmd! The output of running cmd is the value. - :sh If the variable is non-empty it is run as a command and the output - becomes the new value. + :sh The value is run as a command, and the output becomes the new value. ::=str The variable is assigned the value str after substitution. This modifier and its variations are useful in obscure situations such as - wanting to set a variable when shell commands are being parsed. - These assignment modifiers always expand to nothing, so if appearing - in a rule line by themselves should be preceded with something to - keep bmake happy. + wanting to set a variable at a point where a target's shell commands + are being parsed. These assignment modifiers always expand to noth- + ing. - The ‘::’ helps avoid false matches with the AT&T System V UNIX style - := modifier and since substitution always occurs the ::= form is - vaguely appropriate. + The `::' helps avoid false matches with the AT&T System V UNIX style + `:=' modifier and since substitution always occurs, the `::=' form + is vaguely appropriate. ::?=str As for ::= but only if the variable does not already have a value. @@ -1075,110 +1141,100 @@ BMAKE(1) FreeBSD General Commands Manual BMAKE(1) Assign the output of cmd to the variable. :[range] - Selects one or more words from the value, or performs other opera‐ - tions related to the way in which the value is divided into words. + Selects one or more words from the value, or performs other opera- + tions related to the way in which the value is split into words. - Ordinarily, a value is treated as a sequence of words delimited by - white space. Some modifiers suppress this behavior, causing a value - to be treated as a single word (possibly containing embedded white - space). An empty value, or a value that consists entirely of white- - space, is treated as a single word. For the purposes of the ‘:[]’ - modifier, the words are indexed both forwards using positive inte‐ - gers (where index 1 represents the first word), and backwards using - negative integers (where index -1 represents the last word). + An empty value, or a value that consists entirely of white-space, is + treated as a single word. For the purposes of the `:[]' modifier, + the words are indexed both forwards using positive integers (where + index 1 represents the first word), and backwards using negative in- + tegers (where index -1 represents the last word). - The range is subjected to variable expansion, and the expanded re‐ + The range is subjected to variable expansion, and the expanded re- sult is then interpreted as follows: index Selects a single word from the value. start..end Selects all words from start to end, inclusive. For example, - ‘:[2..-1]’ selects all words from the second word to the last - word. If start is greater than end, then the words are out‐ - put in reverse order. For example, ‘:[-1..1]’ selects all - the words from last to first. If the list is already or‐ - dered, then this effectively reverses the list, but it is - more efficient to use ‘:Or’ instead of ‘:O:[-1..1]’. + `:[2..-1]' selects all words from the second word to the last + word. If start is greater than end, the words are output in + reverse order. For example, `:[-1..1]' selects all the words + from last to first. If the list is already ordered, this ef- + fectively reverses the list, but it is more efficient to use + `:Or' instead of `:O:[-1..1]'. * Causes subsequent modifiers to treat the value as a single - word (possibly containing embedded white space). Analogous - to the effect of "$*" in Bourne shell. + word (possibly containing embedded whitespace). Analogous to + the effect of $* in Bourne shell. - 0 Means the same as ‘:[*]’. + 0 Means the same as `:[*]'. @ Causes subsequent modifiers to treat the value as a sequence - of words delimited by white space. Analogous to the effect - of "$@" in Bourne shell. + of words delimited by whitespace. Analogous to the effect of + $@ in Bourne shell. # Returns the number of words in the value. -INCLUDE STATEMENTS, CONDITIONALS AND FOR LOOPS - Makefile inclusion, conditional structures and for loops reminiscent of - the C programming language are provided in bmake. All such structures - are identified by a line beginning with a single dot (‘.’) character. - Files are included with either .include <file> or .include "file". Vari‐ +DIRECTIVES + bmake offers directives for including makefiles, conditionals and for + loops. All these directives are identified by a line beginning with a + single dot (`.') character, followed by the keyword of the directive, + such as include or if. + + File inclusion + Files are included with either .include <file> or .include "file". Vari- ables between the angle brackets or double quotes are expanded to form - the file name. If angle brackets are used, the included makefile is ex‐ + the file name. If angle brackets are used, the included makefile is ex- pected to be in the system makefile directory. If double quotes are used, the including makefile's directory and any directories specified using the -I option are searched before the system makefile directory. - For compatibility with other versions of bmake ‘include file ...’ is also - accepted. - If the include statement is written as .-include or as .sinclude then er‐ - rors locating and/or opening include files are ignored. + For compatibility with other make variants, `include file ...' (without + leading dot) is also accepted. - If the include statement is written as .dinclude not only are errors lo‐ + If the include statement is written as .-include or as .sinclude, errors + locating and/or opening include files are ignored. + + If the include statement is written as .dinclude, not only are errors lo- cating and/or opening include files ignored, but stale dependencies - within the included file will be ignored just like .MAKE.DEPENDFILE. + within the included file are ignored just like in .MAKE.DEPENDFILE. - Conditional expressions are also preceded by a single dot as the first - character of a line. The possible conditionals are as follows: + Exporting variables + The directives for exporting and unexporting variables are: - .error message - The message is printed along with the name of the makefile and - line number, then bmake will exit immediately. - - .export variable ... + .export variable ... Export the specified global variable. If no variable list is provided, all globals are exported except for internal variables - (those that start with ‘.’). This is not affected by the -X + (those that start with `.'). This is not affected by the -X flag, so should be used with caution. For compatibility with - other bmake programs ‘export variable=value’ is also accepted. + other make programs, export variable=value (without leading dot) + is also accepted. - Appending a variable name to .MAKE.EXPORTED is equivalent to ex‐ + Appending a variable name to .MAKE.EXPORTED is equivalent to ex- porting a variable. - .export-env variable ... - The same as ‘.export’, except that the variable is not appended - to .MAKE.EXPORTED. This allows exporting a value to the environ‐ + .export-env variable ... + The same as `.export', except that the variable is not appended + to .MAKE.EXPORTED. This allows exporting a value to the environ- ment which is different from that used by bmake internally. - .export-literal variable ... - The same as ‘.export-env’, except that variables in the value are + .export-literal variable ... + The same as `.export-env', except that variables in the value are not expanded. - .info message - The message is printed along with the name of the makefile and - line number. - - .undef variable ... - Un-define the specified global variables. Only global variables - can be un-defined. - - .unexport variable ... - The opposite of ‘.export’. The specified global variable will be - removed from .MAKE.EXPORTED. If no variable list is provided, - all globals are unexported, and .MAKE.EXPORTED deleted. + .unexport variable ... + The opposite of `.export'. The specified global variable is re- + moved from .MAKE.EXPORTED. If no variable list is provided, all + globals are unexported, and .MAKE.EXPORTED deleted. .unexport-env - Unexport all globals previously exported and clear the environ‐ - ment inherited from the parent. This operation will cause a mem‐ - ory leak of the original environment, so should be used spar‐ - ingly. Testing for .MAKE.LEVEL being 0, would make sense. Also - note that any variables which originated in the parent environ‐ - ment should be explicitly preserved if desired. For example: + Unexport all globals previously exported and clear the environ- + ment inherited from the parent. This operation causes a memory + leak of the original environment, so should be used sparingly. + Testing for .MAKE.LEVEL being 0 would make sense. Also note that + any variables which originated in the parent environment should + be explicitly preserved if desired. For example: .if ${.MAKE.LEVEL} == 0 PATH := ${PATH} @@ -1186,133 +1242,161 @@ BMAKE(1) FreeBSD General Commands Manual BMAKE(1) .export PATH .endif - Would result in an environment containing only ‘PATH’, which is - the minimal useful environment. Actually ‘.MAKE.LEVEL’ will also - be pushed into the new environment. + Would result in an environment containing only `PATH', which is + the minimal useful environment. Actually `.MAKE.LEVEL' is also + pushed into the new environment. + + Messages + The directives for printing messages to the output are: + + .info message + The message is printed along with the name of the makefile and + line number. .warning message - The message prefixed by ‘warning:’ is printed along with the name + The message prefixed by `warning:' is printed along with the name of the makefile and line number. - .if [!]expression [operator expression ...] + .error message + The message is printed along with the name of the makefile and + line number, bmake exits immediately. + + Conditionals + The directives for conditionals are: + + .if [!]expression [operator expression ...] Test the value of an expression. - .ifdef [!]variable [operator variable ...] - Test the value of a variable. + .ifdef [!]variable [operator variable ...] + Test whether a variable is defined. - .ifndef [!]variable [operator variable ...] - Test the value of a variable. + .ifndef [!]variable [operator variable ...] + Test whether a variable is not defined. - .ifmake [!]target [operator target ...] - Test the target being built. + .ifmake [!]target [operator target ...] + Test the target being requested. - .ifnmake [!] target [operator target ...] - Test the target being built. + .ifnmake [!]target [operator target ...] + Test the target being requested. .else Reverse the sense of the last conditional. - .elif [!] expression [operator expression ...] - A combination of ‘.else’ followed by ‘.if’. + .elif [!]expression [operator expression ...] + A combination of `.else' followed by `.if'. - .elifdef [!]variable [operator variable ...] - A combination of ‘.else’ followed by ‘.ifdef’. + .elifdef [!]variable [operator variable ...] + A combination of `.else' followed by `.ifdef'. - .elifndef [!]variable [operator variable ...] - A combination of ‘.else’ followed by ‘.ifndef’. + .elifndef [!]variable [operator variable ...] + A combination of `.else' followed by `.ifndef'. - .elifmake [!]target [operator target ...] - A combination of ‘.else’ followed by ‘.ifmake’. + .elifmake [!]target [operator target ...] + A combination of `.else' followed by `.ifmake'. - .elifnmake [!]target [operator target ...] - A combination of ‘.else’ followed by ‘.ifnmake’. + .elifnmake [!]target [operator target ...] + A combination of `.else' followed by `.ifnmake'. .endif End the body of the conditional. The operator may be any one of the following: - || Logical OR. + || Logical OR. - && Logical AND; of higher precedence than “||”. + && Logical AND; of higher precedence than `||'. - As in C, bmake will only evaluate a conditional as far as is necessary to - determine its value. Parentheses may be used to change the order of - evaluation. The boolean operator ‘!’ may be used to logically negate an - entire conditional. It is of higher precedence than ‘&&’. + bmake only evaluates a conditional as far as is necessary to determine + its value. Parentheses can be used to override the operator precedence. + The boolean operator `!' may be used to logically negate an entire condi- + tional. It is of higher precedence than `&&'. - The value of expression may be any of the following: + The value of expression may be any of the following function call expres- + sions: - defined Takes a variable name as an argument and evaluates to true if - the variable has been defined. + defined(varname) + Evaluates to true if the variable varname has been defined. - make Takes a target name as an argument and evaluates to true if the - target was specified as part of bmake's command line or was de‐ - clared the default target (either implicitly or explicitly, see - .MAIN) before the line containing the conditional. + make(target) + Evaluates to true if the target was specified as part of bmake's + command line or was declared the default target (either implic- + itly or explicitly, see .MAIN) before the line containing the + conditional. - empty Takes a variable, with possible modifiers, and evaluates to true - if the expansion of the variable would result in an empty - string. + empty(varname[:modifiers]) + Evaluates to true if the expansion of the variable, after apply- + ing the modifiers, results in an empty string. - exists Takes a file name as an argument and evaluates to true if the - file exists. The file is searched for on the system search path - (see .PATH). + exists(pathname) + Evaluates to true if the given pathname exists. If relative, the + pathname is searched for on the system search path (see .PATH). - target Takes a target name as an argument and evaluates to true if the - target has been defined. + target(target) + Evaluates to true if the target has been defined. - commands - Takes a target name as an argument and evaluates to true if the - target has been defined and has commands associated with it. + commands(target) + Evaluates to true if the target has been defined and has commands + associated with it. - Expression may also be an arithmetic or string comparison. Variable ex‐ - pansion is performed on both sides of the comparison, after which the nu‐ - merical values are compared. A value is interpreted as hexadecimal if it - is preceded by 0x, otherwise it is decimal; octal numbers are not sup‐ - ported. The standard C relational operators are all supported. If after - variable expansion, either the left or right hand side of a ‘==’ or ‘!=’ - operator is not a numerical value, then string comparison is performed - between the expanded variables. If no relational operator is given, it - is assumed that the expanded variable is being compared against 0, or an - empty string in the case of a string comparison. + Expression may also be an arithmetic or string comparison. Variable ex- + pansion is performed on both sides of the comparison. If both sides are + numeric and neither is enclosed in quotes, the comparison is done numeri- + cally, otherwise lexicographically. A string is interpreted as hexadeci- + mal integer if it is preceded by 0x, otherwise it is a decimal floating- + point number; octal numbers are not supported. - When bmake is evaluating one of these conditional expressions, and it en‐ - counters a (white-space separated) word it doesn't recognize, either the - “make” or “defined” expression is applied to it, depending on the form of - the conditional. If the form is ‘.ifdef’, ‘.ifndef’, or ‘.if’ the - “defined” expression is applied. Similarly, if the form is ‘.ifmake’ or - ‘.ifnmake’, the “make” expression is applied. + All comparisons may use the operators `==' and `!='. Numeric comparisons + may also use the operators `<', `<=', `>' and `>='. - If the conditional evaluates to true the parsing of the makefile contin‐ - ues as before. If it evaluates to false, the following lines are - skipped. In both cases this continues until a ‘.else’ or ‘.endif’ is - found. + If the comparison has neither a comparison operator nor a right side, the + expression evaluates to true if it is nonempty and its numeric value (if + any) is not zero. + When bmake is evaluating one of these conditional expressions, and it en- + counters a (whitespace separated) word it doesn't recognize, either the + "make" or "defined" function is applied to it, depending on the form of + the conditional. If the form is `.ifdef', `.ifndef' or `.if', the + "defined" function is applied. Similarly, if the form is `.ifmake' or + `.ifnmake', the "make" function is applied. + + If the conditional evaluates to true, parsing of the makefile continues + as before. If it evaluates to false, the following lines are skipped. + In both cases, this continues until the corresponding `.else' or `.endif' + is found. + + For loops For loops are typically used to apply a set of rules to a list of files. The syntax of a for loop is: - .for variable [variable ...] in expression - ⟨make-lines⟩ + .for variable [variable ...] in expression + <make-lines> .endfor - After the for expression is evaluated, it is split into words. On each - iteration of the loop, one word is taken and assigned to each variable, - in order, and these variables are substituted into the make-lines inside - the body of the for loop. The number of words must come out even; that - is, if there are three iteration variables, the number of words provided - must be a multiple of three. + The expression is expanded and then split into words. On each iteration + of the loop, one word is taken and assigned to each variable, in order, + and these variables are substituted into the make-lines inside the body + of the for loop. The number of words must come out even; that is, if + there are three iteration variables, the number of words provided must be + a multiple of three. + + If `.break' is encountered within a .for loop, it causes early termina- + tion of the loop, otherwise a parse error. + + Other directives + .undef variable ... + Un-define the specified global variables. Only global variables + can be un-defined. COMMENTS - Comments begin with a hash (‘#’) character, anywhere but in a shell com‐ + Comments begin with a hash (`#') character, anywhere but in a shell com- mand line, and continue to the end of an unescaped new line. SPECIAL SOURCES (ATTRIBUTES) - .EXEC Target is never out of date, but always execute commands any‐ + .EXEC Target is never out of date, but always execute commands any- way. - .IGNORE Ignore any errors from the commands associated with this tar‐ - get, exactly as if they all were preceded by a dash (‘-’). + .IGNORE Ignore any errors from the commands associated with this tar- + get, exactly as if they all were preceded by a dash (`-'). - .MADE Mark all sources of this target as being up-to-date. + .MADE Mark all sources of this target as being up to date. .MAKE Execute the commands associated with this target even if the -n or -t options were specified. Normally used to mark recursive @@ -1330,61 +1414,61 @@ BMAKE(1) FreeBSD General Commands Manual BMAKE(1) Ignore differences in commands when deciding if target is out of date. This is useful if the command contains a value which always changes. If the number of commands change, though, the - target will still be out of date. The same effect applies to - any command line that uses the variable .OODATE, which can be - used for that purpose even when not otherwise needed or de‐ - sired: + target is still considered out of date. The same effect ap- + plies to any command line that uses the variable .OODATE, which + can be used for that purpose even when not otherwise needed or + desired: skip-compare-for-some: - @echo this will be compared - @echo this will not ${.OODATE:M.NOMETA_CMP} - @echo this will also be compared + @echo this is compared + @echo this is not ${.OODATE:M.NOMETA_CMP} + @echo this is also compared - The :M pattern suppresses any expansion of the unwanted vari‐ + The :M pattern suppresses any expansion of the unwanted vari- able. .NOPATH Do not search for the target in the directories specified by - .PATH. + .PATH. .NOTMAIN Normally bmake selects the first target it encounters as the default target to be built if no target was specified. This source prevents this target from being selected. .OPTIONAL - If a target is marked with this attribute and bmake can't fig‐ - ure out how to create it, it will ignore this fact and assume - the file isn't needed or already exists. + If a target is marked with this attribute and bmake can't fig- + ure out how to create it, it ignores this fact and assumes the + file isn't needed or already exists. .PHONY The target does not correspond to an actual file; it is always - considered to be out of date, and will not be created with the - -t option. Suffix-transformation rules are not applied to - .PHONY targets. + considered to be out of date, and is not created with the -t + option. Suffix-transformation rules are not applied to .PHONY + targets. .PRECIOUS When bmake is interrupted, it normally removes any partially - made targets. This source prevents the target from being re‐ + made targets. This source prevents the target from being re- moved. .RECURSIVE Synonym for .MAKE. .SILENT Do not echo any of the commands associated with this target, - exactly as if they all were preceded by an at sign (‘@’). + exactly as if they all were preceded by an at sign (`@'). - .USE Turn the target into bmake's version of a macro. When the tar‐ + .USE Turn the target into bmake's version of a macro. When the tar- get is used as a source for another target, the other target acquires the commands, sources, and attributes (except for .USE) of the source. If the target already has commands, the .USE target's commands are appended to them. .USEBEFORE - Exactly like .USE, but prepend the .USEBEFORE target commands - to the target. + Like .USE, but instead of appending, prepend the .USEBEFORE + target commands to the target. .WAIT If .WAIT appears in a dependency line, the sources that precede it are made before the sources that succeed it in the line. - Since the dependents of files are not made until the file it‐ + Since the dependents of files are not made until the file it- self could be made, this also stops the dependents being built unless they are needed for another branch of the dependency tree. So given: @@ -1398,7 +1482,8 @@ BMAKE(1) FreeBSD General Commands Manual BMAKE(1) b1: echo b1 - the output is always ‘a’, ‘b1’, ‘b’, ‘x’. + the output is always `a', `b1', `b', `x'. + The ordering imposed by .WAIT is only relevant for parallel makes. @@ -1411,8 +1496,8 @@ BMAKE(1) FreeBSD General Commands Manual BMAKE(1) .DEFAULT This is sort of a .USE rule for any target (that was used only - as a source) that bmake can't figure out any other way to cre‐ - ate. Only the shell script is used. The .IMPSRC variable of a + as a source) that bmake can't figure out any other way to cre- + ate. Only the shell script is used. The .IMPSRC variable of a target that inherits .DEFAULT's commands is set to the target's own name. @@ -1421,31 +1506,31 @@ BMAKE(1) FreeBSD General Commands Manual BMAKE(1) make to delete targets whose commands fail. (By default, only targets whose commands are interrupted during execution are deleted. This is the historical behavior.) This setting can be - used to help prevent half-finished or malformed targets from be‐ + used to help prevent half-finished or malformed targets from be- ing left around and corrupting future rebuilds. - .END Any command lines attached to this target are executed after ev‐ - erything else is done. + .END Any command lines attached to this target are executed after ev- + erything else is done successfully. - .ERROR Any command lines attached to this target are executed when an‐ - other target fails. The .ERROR_TARGET variable is set to the - target that failed. See also MAKE_PRINT_VAR_ON_ERROR. + .ERROR Any command lines attached to this target are executed when an- + other target fails. The .ERROR_TARGET variable is set to the + target that failed. See also MAKE_PRINT_VAR_ON_ERROR. .IGNORE Mark each of the sources with the .IGNORE attribute. If no sources are specified, this is the equivalent of specifying the -i option. .INTERRUPT - If bmake is interrupted, the commands for this target will be - executed. + If bmake is interrupted, the commands for this target are exe- + cuted. - .MAIN If no target is specified when bmake is invoked, this target - will be built. + .MAIN If no target is specified when bmake is invoked, this target is + built. .MAKEFLAGS - This target provides a way to specify flags for bmake when the - makefile is used. The flags are as if typed to the shell, - though the -f option will have no effect. + This target provides a way to specify flags for bmake at the + time when the makefiles are read. The flags are as if typed to + the shell, though the -f option has no effect. .NOPATH Apply the .NOPATH attribute to any specified sources. @@ -1456,24 +1541,29 @@ BMAKE(1) FreeBSD General Commands Manual BMAKE(1) Synonym for .NOTPARALLEL, for compatibility with other pmake variants. - .OBJDIR The source is a new value for ‘.OBJDIR’. If it exists, bmake - will chdir(2) to it and update the value of ‘.OBJDIR’. + .NOREADONLY + clear the read-only attribute from the global variables speci- + fied as sources. + + .OBJDIR The source is a new value for `.OBJDIR'. If it exists, bmake + changes the current working directory to it and updates the + value of `.OBJDIR'. .ORDER In parallel mode, the named targets are made in sequence. This ordering does not add targets to the list of targets to be made. - Since the dependents of a target do not get built until the tar‐ - get itself could be built, unless ‘a’ is built by another part + Since the dependents of a target do not get built until the tar- + get itself could be built, unless `a' is built by another part of the dependency graph, the following is a dependency loop: .ORDER: b a b: a .PATH The sources are directories which are to be searched for files - not found in the current directory. If no sources are speci‐ - fied, any previously specified directories are deleted. If the - source is the special .DOTLAST target, then the current working - directory is searched last. + not found in the current directory. If no sources are speci- + fied, any previously specified directories are removed from the + search path. If the source is the special .DOTLAST target, the + current working directory is searched last. .PATH.suffix Like .PATH but applies only to files with a particular suffix. @@ -1482,44 +1572,48 @@ BMAKE(1) FreeBSD General Commands Manual BMAKE(1) .PHONY Apply the .PHONY attribute to any specified sources. .POSIX If this is the first non-comment line in the main makefile, the - variable %POSIX is set to the value ‘1003.2’ and the makefile - ‘’ is included if it exists, to provide POSIX-compati‐ - ble default rules. If bmake is run with the -r flag, then only - ‘posix.mk’ will contribute to the default rules. + variable %POSIX is set to the value `1003.2' and the makefile + `' is included if it exists, to provide POSIX-compati- + ble default rules. If bmake is run with the -r flag, only + `posix.mk' contributes to the default rules. .PRECIOUS Apply the .PRECIOUS attribute to any specified sources. If no - sources are specified, the .PRECIOUS attribute is applied to ev‐ + sources are specified, the .PRECIOUS attribute is applied to ev- ery target in the file. - .SHELL Sets the shell that bmake will use to execute commands. The - sources are a set of field=value pairs. + .READONLY + set the read-only attribute on the global variables specified as + sources. - name This is the minimal specification, used to select - one of the built-in shell specs; sh, ksh, and csh. + .SHELL Sets the shell that bmake uses to execute commands in jobs mode. + The sources are a set of field=value pairs. - path Specifies the path to the shell. + name This is the minimal specification, used to select + one of the built-in shell specs; sh, ksh, and csh. - hasErrCtl Indicates whether the shell supports exit on error. + path Specifies the absolute path to the shell. - check The command to turn on error checking. + hasErrCtl Indicates whether the shell supports exit on error. - ignore The command to disable error checking. + check The command to turn on error checking. - echo The command to turn on echoing of commands executed. + ignore The command to disable error checking. - quiet The command to turn off echoing of commands exe‐ + echo The command to turn on echoing of commands executed. + + quiet The command to turn off echoing of commands exe- cuted. - filter The output to filter after issuing the quiet com‐ - mand. It is typically identical to quiet. + filter The output to filter after issuing the quiet com- + mand. It is typically identical to quiet. - errFlag The flag to pass the shell to enable error checking. + errFlag The flag to pass the shell to enable error checking. - echoFlag The flag to pass the shell to enable command echo‐ + echoFlag The flag to pass the shell to enable command echo- ing. - newline The string literal to pass the shell that results in + newline The string literal to pass the shell that results in a single newline character when used outside of any quoting characters. Example: @@ -1533,7 +1627,7 @@ BMAKE(1) FreeBSD General Commands Manual BMAKE(1) sources are specified, the .SILENT attribute is applied to every command in the file. - .STALE This target gets run when a dependency file contains stale en‐ + .STALE This target gets run when a dependency file contains stale en- tries, having .ALLSRC set to the name of that dependency file. .SUFFIXES @@ -1543,76 +1637,82 @@ BMAKE(1) FreeBSD General Commands Manual BMAKE(1) Example: - .SUFFIXES: .o + .SUFFIXES: .c .o .c.o: cc -o ${.TARGET} -c ${.IMPSRC} + .SYSPATH + The sources are directories which are to be added to the system + include path which bmake searches for makefiles. If no sources + are specified, any previously specified directories are removed + from the system include path. + ENVIRONMENT bmake uses the following environment variables, if they exist: MACHINE, MACHINE_ARCH, MAKE, MAKEFLAGS, MAKEOBJDIR, MAKEOBJDIRPREFIX, MAKESYSPATH, PWD, and TMPDIR. MAKEOBJDIRPREFIX and MAKEOBJDIR may only be set in the environment or on - the command line to bmake and not as makefile variables; see the descrip‐ - tion of ‘.OBJDIR’ for more details. + the command line to bmake and not as makefile variables; see the descrip- + tion of `.OBJDIR' for more details. FILES .depend list of dependencies - Makefile list of dependencies - makefile list of dependencies + makefile first default makefile if no makefile is specified on the + command line + Makefile second default makefile if no makefile is specified on the + command line sys.mk system makefile /usr/share/mk system makefile directory COMPATIBILITY - The basic make syntax is compatible between different versions of make; - however the special variables, variable modifiers and conditionals are - not. + The basic make syntax is compatible between different make variants; how- + ever the special variables, variable modifiers and conditionals are not. Older versions An incomplete list of changes in older versions of bmake: The way that .for loop variables are substituted changed after NetBSD 5.0 so that they still appear to be variable expansions. In particular this - stops them being treated as syntax, and removes some obscure problems us‐ + stops them being treated as syntax, and removes some obscure problems us- ing them in .if statements. The way that parallel makes are scheduled changed in NetBSD 4.0 so that - .ORDER and .WAIT apply recursively to the dependent nodes. The algo‐ + .ORDER and .WAIT apply recursively to the dependent nodes. The algo- rithms used may change again in the future. Other make dialects - Other make dialects (GNU make, SVR4 make, POSIX make, etc.) do not sup‐ - port most of the features of bmake as described in this manual. Most no‐ + Other make dialects (GNU make, SVR4 make, POSIX make, etc.) do not sup- + port most of the features of bmake as described in this manual. Most no- tably: - • The .WAIT and .ORDER declarations and most functionality per‐ + +o The .WAIT and .ORDER declarations and most functionality per- taining to parallelization. (GNU make supports parallelization - but lacks these features needed to control it effectively.) + but lacks the features needed to control it effectively.) - • Directives, including for loops and conditionals and most of + +o Directives, including for loops and conditionals and most of the forms of include files. (GNU make has its own incompatible and less powerful syntax for conditionals.) - • All built-in variables that begin with a dot. + +o All built-in variables that begin with a dot. - • Most of the special sources and targets that begin with a dot, + +o Most of the special sources and targets that begin with a dot, with the notable exception of .PHONY, .PRECIOUS, and .SUFFIXES. - • Variable modifiers, except for the - :old=new - string substitution, which does not portably support globbing - with ‘%’ and historically only works on declared suffixes. + +o Variable modifiers, except for the `:old=new' string substitu- + tion, which does not portably support globbing with `%' and + historically only works on declared suffixes. - • The $> variable even in its short form; most makes support this + +o The $> variable even in its short form; most makes support this functionality but its name varies. Some features are somewhat more portable, such as assignment with +=, ?=, - and !=. The .PATH functionality is based on an older feature VPATH found - in GNU make and many versions of SVR4 make; however, historically its be‐ + and !=. The .PATH functionality is based on an older feature VPATH found + in GNU make and many versions of SVR4 make; however, historically its be- havior is too ill-defined (and too buggy) to rely upon. The $@ and $< variables are more or less universally portable, as is the - $(MAKE) variable. Basic use of suffix rules (for files only in the cur‐ + $(MAKE) variable. Basic use of suffix rules (for files only in the cur- rent directory, not trying to chain transformations together, etc.) is also reasonably portable. @@ -1624,21 +1724,20 @@ BMAKE(1) FreeBSD General Commands Manual BMAKE(1) portability to other platforms. A make command appeared in Version 7 AT&T UNIX. This make implementation - is based on Adam De Boor's pmake program which was written for Sprite at + is based on Adam de Boor's pmake program, which was written for Sprite at Berkeley. It was designed to be a parallel distributed make running jobs - on different machines using a daemon called “customs”. + on different machines using a daemon called "customs". - Historically the target/dependency “FRC” has been used to FoRCe rebuild‐ - ing (since the target/dependency does not exist... unless someone creates - an “FRC” file). + Historically the target/dependency FRC has been used to FoRCe rebuilding + (since the target/dependency does not exist ... unless someone creates an + FRC file). BUGS - The make syntax is difficult to parse without actually acting on the - data. For instance, finding the end of a variable's use should involve - scanning each of the modifiers, using the correct terminator for each - field. In many places make just counts {} and () in order to find the - end of a variable expansion. + The make syntax is difficult to parse. For instance, finding the end of + a variable's use should involve scanning each of the modifiers, using the + correct terminator for each field. In many places make just counts {} + and () in order to find the end of a variable expansion. There is no way of escaping a space character in a filename. -FreeBSD 13.0 July 12, 2022 FreeBSD 13.0 +FreeBSD 13.0 January 26, 2023 FreeBSD 13.0 diff --git a/contrib/bmake/compat.c b/contrib/bmake/compat.c index b1996b91af6d..13063d8abd7e 100644 --- a/contrib/bmake/compat.c +++ b/contrib/bmake/compat.c @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.240 2022/05/07 17:49:47 rillig Exp $ */ +/* $NetBSD: compat.c,v 1.244 2023/01/17 21:35:19 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -94,15 +94,15 @@ #include "pathnames.h" /* "@(#)compat.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: compat.c,v 1.240 2022/05/07 17:49:47 rillig Exp $"); +MAKE_RCSID("$NetBSD: compat.c,v 1.244 2023/01/17 21:35:19 christos Exp $"); static GNode *curTarg = NULL; static pid_t compatChild; static int compatSigno; /* - * CompatDeleteTarget -- delete the file of a failed, interrupted, or - * otherwise duffed target if not inhibited by .PRECIOUS. + * Delete the file of a failed, interrupted, or otherwise duffed target, + * unless inhibited by .PRECIOUS. */ static void CompatDeleteTarget(GNode *gn) @@ -110,7 +110,7 @@ CompatDeleteTarget(GNode *gn) if (gn != NULL && !GNode_IsPrecious(gn)) { const char *file = GNode_VarTarget(gn); - if (!opts.noExecute && unlink_file(file)) { + if (!opts.noExecute && unlink_file(file) == 0) { Error("*** %s removed", file); } } @@ -283,7 +283,8 @@ Compat_RunCommand(const char *cmdp, GNode *gn, StringListNode *ln) doIt = true; if (shellName == NULL) /* we came here from jobs */ Shell_Init(); - } else + } else if (!ch_isspace(*cmd)) + /* Ignore whitespace for compatibility with gnu make */ break; cmd++; } @@ -573,7 +574,7 @@ MakeUnmade(GNode *gn, GNode *pgn) * to tell him/her "yes". */ DEBUG0(MAKE, "out-of-date.\n"); - if (opts.query) + if (opts.query && gn != Targ_GetEndNode()) exit(1); /* diff --git a/contrib/bmake/cond.c b/contrib/bmake/cond.c index 3dd177d5acb8..fb7f789af0d1 100644 --- a/contrib/bmake/cond.c +++ b/contrib/bmake/cond.c @@ -1,4 +1,4 @@ -/* $NetBSD: cond.c,v 1.334 2022/04/15 09:33:20 rillig Exp $ */ +/* $NetBSD: cond.c,v 1.342 2022/09/24 16:13:48 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -81,12 +81,9 @@ * of one of the .if directives or the condition in a * ':?then:else' variable modifier. * - * Cond_save_depth - * Cond_restore_depth - * Save and restore the nesting of the conditions, at - * the start and end of including another makefile, to - * ensure that in each makefile the conditional - * directives are well-balanced. + * Cond_EndFile + * At the end of reading a makefile, ensure that the + * conditional directives are well-balanced. */ #include @@ -95,7 +92,7 @@ #include "dir.h" /* "@(#)cond.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: cond.c,v 1.334 2022/04/15 09:33:20 rillig Exp $"); +MAKE_RCSID("$NetBSD: cond.c,v 1.342 2022/09/24 16:13:48 rillig Exp $"); /* * Conditional expressions conform to this grammar: @@ -178,8 +175,7 @@ typedef struct CondParser { static CondResult CondParser_Or(CondParser *par, bool); -static unsigned int cond_depth = 0; /* current .if nesting level */ -static unsigned int cond_min_depth = 0; /* depth at makefile open */ +unsigned int cond_depth = 0; /* current .if nesting level */ /* Names for ComparisonOp. */ static const char opname[][3] = { "<", "<=", ">", ">=", "==", "!=" }; @@ -570,10 +566,10 @@ EvalCompareNum(double lhs, ComparisonOp op, double rhs) return lhs > rhs; case GE: return lhs >= rhs; - case NE: - return lhs != rhs; - default: + case EQ: return lhs == rhs; + default: + return lhs != rhs; } } @@ -583,7 +579,9 @@ EvalCompareStr(CondParser *par, const char *lhs, { if (op != EQ && op != NE) { Parse_Error(PARSE_FATAL, - "String comparison operator must be either == or !="); + "Comparison with '%s' requires both operands " + "'%s' and '%s' to be numeric", + opname[op], lhs, rhs); par->printedError = true; return TOK_ERROR; } @@ -1135,7 +1133,7 @@ Cond_EvalLine(const char *line) "The .endif directive does not take arguments"); } - if (cond_depth == cond_min_depth) { + if (cond_depth == CurFile_CondMinDepth()) { Parse_Error(PARSE_FATAL, "if-less endif"); return CR_TRUE; } @@ -1165,7 +1163,7 @@ Cond_EvalLine(const char *line) "The .else directive " "does not take arguments"); - if (cond_depth == cond_min_depth) { + if (cond_depth == CurFile_CondMinDepth()) { Parse_Error(PARSE_FATAL, "if-less else"); return CR_TRUE; } @@ -1200,7 +1198,7 @@ Cond_EvalLine(const char *line) return CR_ERROR; if (isElif) { - if (cond_depth == cond_min_depth) { + if (cond_depth == CurFile_CondMinDepth()) { Parse_Error(PARSE_FATAL, "if-less elif"); return CR_TRUE; } @@ -1254,24 +1252,13 @@ Cond_EvalLine(const char *line) } void -Cond_restore_depth(unsigned int saved_depth) +Cond_EndFile(void) { - unsigned int open_conds = cond_depth - cond_min_depth; + unsigned int open_conds = cond_depth - CurFile_CondMinDepth(); - if (open_conds != 0 || saved_depth > cond_depth) { + if (open_conds != 0) { Parse_Error(PARSE_FATAL, "%u open conditional%s", open_conds, open_conds == 1 ? "" : "s"); - cond_depth = cond_min_depth; + cond_depth = CurFile_CondMinDepth(); } - - cond_min_depth = saved_depth; -} - -unsigned int -Cond_save_depth(void) -{ - unsigned int depth = cond_min_depth; - - cond_min_depth = cond_depth; - return depth; } diff --git a/contrib/bmake/config.h.in b/contrib/bmake/config.h.in index aebebe783a44..85fc10cf30b6 100644 --- a/contrib/bmake/config.h.in +++ b/contrib/bmake/config.h.in @@ -71,8 +71,8 @@ /* Define to 1 if the system has the type `long long int'. */ #undef HAVE_LONG_LONG_INT -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H +/* Define to 1 if you have the header file. */ +#undef HAVE_MINIX_CONFIG_H /* Define to 1 if you have the `mmap' function. */ #undef HAVE_MMAP @@ -140,6 +140,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H +/* Define to 1 if you have the header file. */ +#undef HAVE_STDIO_H + /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H @@ -176,13 +179,6 @@ /* Define to 1 if you have the `strtoul' function. */ #undef HAVE_STRTOUL -/* Define to 1 if `st_rdev' is a member of `struct stat'. */ -#undef HAVE_STRUCT_STAT_ST_RDEV - -/* Define to 1 if your `struct stat' has `st_rdev'. Deprecated, use - `HAVE_STRUCT_STAT_ST_RDEV' instead. */ -#undef HAVE_ST_RDEV - /* Define to 1 if you have the `sysctl' function. */ #undef HAVE_SYSCTL @@ -263,6 +259,9 @@ /* Define to 1 if you have the `warnx' function. */ #undef HAVE_WARNX +/* Define to 1 if you have the header file. */ +#undef HAVE_WCHAR_H + /* Define to 1 if `fork' works. */ #undef HAVE_WORKING_FORK @@ -290,18 +289,14 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION -/* Define as the return type of signal handlers (`int' or `void'). */ -#undef RETSIGTYPE - /* Define to 1 if the `S_IS*' macros in do not work properly. */ #undef STAT_MACROS_BROKEN -/* Define to 1 if you have the ANSI C header files. */ +/* Define to 1 if all of the C90 standard headers exist (not just the ones + required in a freestanding environment). This macro is provided for + backward compatibility; new code need not use it. */ #undef STDC_HEADERS -/* Define to 1 if you can safely include both and . */ -#undef TIME_WITH_SYS_TIME - /* Define to 1 if your declares `struct tm'. */ #undef TM_IN_SYS_TIME @@ -309,21 +304,87 @@ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif +/* Enable general extensions on macOS. */ +#ifndef _DARWIN_C_SOURCE +# undef _DARWIN_C_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif -/* Enable threading extensions on Solaris. */ +/* Enable X/Open compliant socket functions that do not require linking + with -lxnet on HP-UX 11.11. */ +#ifndef _HPUX_ALT_XOPEN_SOCKET_API +# undef _HPUX_ALT_XOPEN_SOCKET_API +#endif +/* Identify the host operating system as Minix. + This macro does not affect the system headers' behavior. + A future release of Autoconf may stop defining this macro. */ +#ifndef _MINIX +# undef _MINIX +#endif +/* Enable general extensions on NetBSD. + Enable NetBSD compatibility extensions on Minix. */ +#ifndef _NETBSD_SOURCE +# undef _NETBSD_SOURCE +#endif +/* Enable OpenBSD compatibility extensions on NetBSD. + Oddly enough, this does nothing on OpenBSD. */ +#ifndef _OPENBSD_SOURCE +# undef _OPENBSD_SOURCE +#endif +/* Define to 1 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_SOURCE +# undef _POSIX_SOURCE +#endif +/* Define to 2 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_1_SOURCE +# undef _POSIX_1_SOURCE +#endif +/* Enable POSIX-compatible threading on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif +/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */ +#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +# undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */ +#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ +# undef __STDC_WANT_IEC_60559_BFP_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */ +#ifndef __STDC_WANT_IEC_60559_DFP_EXT__ +# undef __STDC_WANT_IEC_60559_DFP_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */ +#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__ +# undef __STDC_WANT_IEC_60559_FUNCS_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */ +#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ +# undef __STDC_WANT_IEC_60559_TYPES_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */ +#ifndef __STDC_WANT_LIB_EXT2__ +# undef __STDC_WANT_LIB_EXT2__ +#endif +/* Enable extensions specified by ISO/IEC 24747:2009. */ +#ifndef __STDC_WANT_MATH_SPEC_FUNCS__ +# undef __STDC_WANT_MATH_SPEC_FUNCS__ +#endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE #endif -/* Enable general extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# undef __EXTENSIONS__ +/* Enable X/Open extensions. Define to 500 only if necessary + to make mbstate_t available. */ +#ifndef _XOPEN_SOURCE +# undef _XOPEN_SOURCE #endif @@ -339,16 +400,6 @@ # endif #endif -/* Define to 1 if on MINIX. */ -#undef _MINIX - -/* Define to 2 if the system does not provide POSIX.1 features except with - this defined. */ -#undef _POSIX_1_SOURCE - -/* Define to 1 if you need to in order for `stat' and other things to work. */ -#undef _POSIX_SOURCE - /* Define for Solaris 2.5.1 so the uint32_t typedef from , , or is not used. If the typedef were allowed, the #define below would cause a syntax error. */ @@ -376,7 +427,7 @@ /* Define to `long int' if does not define. */ #undef off_t -/* Define to `int' if does not define. */ +/* Define as a signed integer type capable of holding a process identifier. */ #undef pid_t /* type that signal handlers can safely frob */ diff --git a/contrib/bmake/configure b/contrib/bmake/configure index 42295d1db3e3..44f016b249e1 100755 --- a/contrib/bmake/configure +++ b/contrib/bmake/configure @@ -1,11 +1,12 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for bmake 20211020. +# Generated by GNU Autoconf 2.71 for bmake 20220909. # # Report bugs to . # # -# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, +# Inc. # # # This configure script is free software; the Free Software Foundation @@ -16,14 +17,16 @@ # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else +else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -33,46 +36,46 @@ esac fi + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then +if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -81,13 +84,6 @@ if test "${PATH_SEPARATOR+set}" != set; then fi -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -96,8 +92,12 @@ case $0 in #(( for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS @@ -109,30 +109,10 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. @@ -154,20 +134,22 @@ esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -as_fn_exit 255 +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + as_bourne_compatible="as_nop=: +if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST -else +else \$as_nop case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( @@ -187,42 +169,52 @@ as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : +if ( set x; as_fn_ret_success y && test x = \"\$1\" ) +then : -else +else \$as_nop exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 +blah=\$(echo \$(echo blah)) +test x\"\$blah\" = xblah || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && - test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 -test \$(( 1 + 1 )) = 2 || exit 1" - if (eval "$as_required") 2>/dev/null; then : + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1" + if (eval "$as_required") 2>/dev/null +then : as_have_required=yes -else +else $as_nop as_have_required=no fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null +then : -else +else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base + as_shell=$as_dir$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null +then : break 2 fi fi @@ -230,14 +222,21 @@ fi esac as_found=false done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi +fi - if test "x$CONFIG_SHELL" != x; then : + if test "x$CONFIG_SHELL" != x +then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also @@ -255,18 +254,19 @@ esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." + if test x$as_have_required = xno +then : + printf "%s\n" "$0: This script requires a shell more modern than all" + printf "%s\n" "$0: the shells that I found on your system." + if test ${ZSH_VERSION+y} ; then + printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" + printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." else - $as_echo "$0: Please tell bug-autoconf@gnu.org and sjg@NetBSD.org + printf "%s\n" "$0: Please tell bug-autoconf@gnu.org and sjg@NetBSD.org $0: about your system, including any error possibly output $0: before this message. Then install a modern shell, or $0: manually run the script under such a shell if you do @@ -294,6 +294,7 @@ as_fn_unset () } as_unset=as_fn_unset + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -311,6 +312,14 @@ as_fn_exit () as_fn_set_status $1 exit $1 } # as_fn_exit +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop # as_fn_mkdir_p # ------------- @@ -325,7 +334,7 @@ as_fn_mkdir_p () as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -334,7 +343,7 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | +printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -373,12 +382,13 @@ as_fn_executable_p () # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : eval 'as_fn_append () { eval $1+=\$2 }' -else +else $as_nop as_fn_append () { eval $1=\$$1\$2 @@ -390,18 +400,27 @@ fi # as_fn_append # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else +else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- @@ -413,9 +432,9 @@ as_fn_error () as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $2" >&2 + printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error @@ -442,7 +461,7 @@ as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -486,7 +505,7 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall @@ -500,6 +519,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits exit } + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -513,6 +536,13 @@ case `echo -n x` in #((((( ECHO_N='-n';; esac +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + + rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -580,47 +610,44 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='bmake' PACKAGE_TARNAME='bmake' -PACKAGE_VERSION='20211020' -PACKAGE_STRING='bmake 20211020' +PACKAGE_VERSION='20220909' +PACKAGE_STRING='bmake 20220909' PACKAGE_BUGREPORT='sjg@NetBSD.org' PACKAGE_URL='' # Factoring default headers for most tests. ac_includes_default="\ -#include -#ifdef HAVE_SYS_TYPES_H -# include +#include +#ifdef HAVE_STDIO_H +# include #endif -#ifdef HAVE_SYS_STAT_H -# include -#endif -#ifdef STDC_HEADERS +#ifdef HAVE_STDLIB_H # include -# include -#else -# ifdef HAVE_STDLIB_H -# include -# endif #endif #ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include -# endif # include #endif -#ifdef HAVE_STRINGS_H -# include -#endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif #ifdef HAVE_UNISTD_H # include #endif" +ac_header_c_list= +ac_func_c_list= ac_subst_vars='LTLIBOBJS UTC_1 _MAKE_VERSION @@ -637,15 +664,13 @@ force_machine_arch machine_arch force_machine machine +egrep LIBOBJS bmake_path_max ac_exe_suffix INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM -EGREP -GREP -CPP OBJEXT EXEEXT ac_ct_CC @@ -672,6 +697,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -715,8 +741,7 @@ CC CFLAGS LDFLAGS LIBS -CPPFLAGS -CPP' +CPPFLAGS' # Initialize some variables set by options. @@ -755,6 +780,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -784,8 +810,6 @@ do *) ac_optarg=yes ;; esac - # Accept the important Cygnus configure options, so we can diagnose typos. - case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; @@ -826,9 +850,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -852,9 +876,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -1007,6 +1031,15 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1056,9 +1089,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -1072,9 +1105,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -1118,9 +1151,9 @@ Try \`$0 --help' for more information" *) # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; @@ -1136,7 +1169,7 @@ if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -1144,7 +1177,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1200,7 +1233,7 @@ $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | +printf "%s\n" X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -1257,7 +1290,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures bmake 20211020 to adapt to many kinds of systems. +\`configure' configures bmake 20220909 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1297,6 +1330,7 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -1318,7 +1352,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of bmake 20211020:";; + short | recursive ) echo "Configuration of bmake 20220909:";; esac cat <<\_ACEOF @@ -1356,7 +1390,6 @@ Some influential environment variables: LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory - CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -1377,9 +1410,9 @@ if test "$ac_init_help" = "recursive"; then case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -1407,7 +1440,8 @@ esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. + # Check for configure.gnu first; this name is used for a wrapper for + # Metaconfig's "Configure" on case-insensitive file systems. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive @@ -1415,7 +1449,7 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix echo && $SHELL "$ac_srcdir/configure" --help=recursive else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done @@ -1424,10 +1458,10 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -bmake configure 20211020 -generated by GNU Autoconf 2.69 +bmake configure 20220909 +generated by GNU Autoconf 2.71 -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2021 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1444,14 +1478,14 @@ fi ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext + rm -f conftest.$ac_objext conftest.beam if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1459,14 +1493,15 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then : + } && test -s conftest.$ac_objext +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1476,176 +1511,6 @@ fi } # ac_fn_c_try_compile -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_cpp - -# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists, giving a warning if it cannot be compiled using -# the include files in INCLUDES and setting the cache variable VAR -# accordingly. -ac_fn_c_check_header_mongrel () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval \${$3+:} false; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 -$as_echo_n "checking $2 usability... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_header_compiler=yes -else - ac_header_compiler=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 -$as_echo_n "checking $2 presence... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <$2> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - ac_header_preproc=yes -else - ac_header_preproc=no -fi -rm -f conftest.err conftest.i conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( - yes:no: ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; - no:yes:* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} -( $as_echo "## ----------------------------- ## -## Report this to sjg@NetBSD.org ## -## ----------------------------- ##" - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=\$ac_header_compiler" -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_mongrel - -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_run - # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in @@ -1653,26 +1518,28 @@ fi ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : eval "$3=yes" -else +else $as_nop eval "$3=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile @@ -1683,14 +1550,14 @@ $as_echo "$ac_res" >&6; } ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1698,17 +1565,18 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext - }; then : + } +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1723,6 +1591,49 @@ fi } # ac_fn_c_try_link +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that +# executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: program exited with status $ac_status" >&5 + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + # ac_fn_c_find_intX_t LINENO BITS VAR # ----------------------------------- # Finds a signed integer type with width BITS, setting cache variable VAR @@ -1730,11 +1641,12 @@ fi ac_fn_c_find_intX_t () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5 -$as_echo_n "checking for int$2_t... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5 +printf %s "checking for int$2_t... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop eval "$3=no" # Order is important - never check a type that is potentially smaller # than half of the expected target width. @@ -1745,7 +1657,7 @@ else $ac_includes_default enum { N = $2 / 2 - 1 }; int -main () +main (void) { static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))]; test_array [0] = 0; @@ -1755,13 +1667,14 @@ return test_array [0]; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default enum { N = $2 / 2 - 1 }; int -main () +main (void) { static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1) < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))]; @@ -1772,9 +1685,10 @@ return test_array [0]; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : -else +else $as_nop case $ac_type in #( int$2_t) : eval "$3=yes" ;; #( @@ -1782,19 +1696,20 @@ else eval "$3=\$ac_type" ;; esac fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if eval test \"x\$"$3"\" = x"no"; then : +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + if eval test \"x\$"$3"\" = x"no" +then : -else +else $as_nop break fi done fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_find_intX_t @@ -1806,17 +1721,18 @@ $as_echo "$ac_res" >&6; } ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int -main () +main (void) { if (sizeof ($2)) return 0; @@ -1824,12 +1740,13 @@ if (sizeof ($2)) return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int -main () +main (void) { if (sizeof (($2))) return 0; @@ -1837,18 +1754,19 @@ if (sizeof (($2))) return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : -else +else $as_nop eval "$3=yes" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type @@ -1860,11 +1778,12 @@ $as_echo "$ac_res" >&6; } ac_fn_c_find_uintX_t () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 -$as_echo_n "checking for uint$2_t... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 +printf %s "checking for uint$2_t... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop eval "$3=no" # Order is important - never check a type that is potentially smaller # than half of the expected target width. @@ -1874,7 +1793,7 @@ else /* end confdefs.h. */ $ac_includes_default int -main () +main (void) { static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)]; test_array [0] = 0; @@ -1884,7 +1803,8 @@ return test_array [0]; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : case $ac_type in #( uint$2_t) : eval "$3=yes" ;; #( @@ -1892,40 +1812,44 @@ if ac_fn_c_try_compile "$LINENO"; then : eval "$3=\$ac_type" ;; esac fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if eval test \"x\$"$3"\" = x"no"; then : +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + if eval test \"x\$"$3"\" = x"no" +then : -else +else $as_nop break fi done fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_find_uintX_t -# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES -# --------------------------------------------- +# ac_fn_check_decl LINENO SYMBOL VAR INCLUDES EXTRA-OPTIONS FLAG-VAR +# ------------------------------------------------------------------ # Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR -# accordingly. -ac_fn_c_check_decl () +# accordingly. Pass EXTRA-OPTIONS to the compiler, using FLAG-VAR. +ac_fn_check_decl () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack as_decl_name=`echo $2|sed 's/ *(.*//'` + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +printf %s "checking whether $as_decl_name is declared... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 -$as_echo_n "checking whether $as_decl_name is declared... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + eval ac_save_FLAGS=\$$6 + as_fn_append $6 " $5" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int -main () +main (void) { #ifndef $as_decl_name #ifdef __cplusplus @@ -1939,19 +1863,22 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : eval "$3=yes" -else +else $as_nop eval "$3=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + eval $6=\$ac_save_FLAGS + fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno -} # ac_fn_c_check_decl +} # ac_fn_check_decl # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- @@ -1959,11 +1886,12 @@ $as_echo "$ac_res" >&6; } ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. @@ -1971,16 +1899,9 @@ else #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif + which can conflict with char $2 (); below. */ +#include #undef $2 /* Override any GCC internal prototype to avoid an error. @@ -1998,92 +1919,56 @@ choke me #endif int -main () +main (void) { return $2 (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : eval "$3=yes" -else +else $as_nop eval "$3=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func +ac_configure_args_raw= +for ac_arg +do + case $ac_arg in + *\'*) + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append ac_configure_args_raw " '$ac_arg'" +done -# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES -# ---------------------------------------------------- -# Tries to find if the field MEMBER exists in type AGGR, after including -# INCLUDES, setting cache variable VAR accordingly. -ac_fn_c_check_member () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 -$as_echo_n "checking for $2.$3... " >&6; } -if eval \${$4+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$5 -int -main () -{ -static $2 ac_aggr; -if (ac_aggr.$3) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$4=yes" -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$5 -int -main () -{ -static $2 ac_aggr; -if (sizeof ac_aggr.$3) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$4=yes" -else - eval "$4=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$4 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno +case $ac_configure_args_raw in + *$as_nl*) + ac_safe_unquote= ;; + *) + ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. + ac_unsafe_a="$ac_unsafe_z#~" + ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" + ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; +esac -} # ac_fn_c_check_member cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by bmake $as_me 20211020, which was -generated by GNU Autoconf 2.69. Invocation command line was +It was created by bmake $as_me 20220909, which was +generated by GNU Autoconf 2.71. Invocation command line was - $ $0 $@ + $ $0$ac_configure_args_raw _ACEOF exec 5>>config.log @@ -2116,8 +2001,12 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + printf "%s\n" "PATH: $as_dir" done IFS=$as_save_IFS @@ -2152,7 +2041,7 @@ do | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; @@ -2187,11 +2076,13 @@ done # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? + # Sanitize IFS. + IFS=" "" $as_nl" # Save into config.log some information that might help in debugging. { echo - $as_echo "## ---------------- ## + printf "%s\n" "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo @@ -2202,8 +2093,8 @@ trap 'exit_status=$? case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -2227,7 +2118,7 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; ) echo - $as_echo "## ----------------- ## + printf "%s\n" "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo @@ -2235,14 +2126,14 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - $as_echo "$ac_var='\''$ac_val'\''" + printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## + printf "%s\n" "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo @@ -2250,15 +2141,15 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - $as_echo "$ac_var='\''$ac_val'\''" + printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then - $as_echo "## ----------- ## + printf "%s\n" "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo @@ -2266,8 +2157,8 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; echo fi test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" + printf "%s\n" "$as_me: caught signal $ac_signal" + printf "%s\n" "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && @@ -2281,63 +2172,48 @@ ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h -$as_echo "/* confdefs.h */" > confdefs.h +printf "%s\n" "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF +printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF +printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF +printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF +printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF +printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" -_ACEOF +printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in #(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac + ac_site_files="$CONFIG_SITE" elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site + ac_site_files="$prefix/share/config.site $prefix/etc/config.site" else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site + ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" + +for ac_site_file in $ac_site_files do - test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} + case $ac_site_file in #( + */*) : + ;; #( + *) : + ac_site_file=./$ac_site_file ;; +esac + if test -f "$ac_site_file" && test -r "$ac_site_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ - || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi @@ -2347,19 +2223,441 @@ if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +printf "%s\n" "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +printf "%s\n" "$as_me: creating cache $cache_file" >&6;} >$cache_file fi +as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" +# Test code for whether the C compiler supports C89 (global declarations) +ac_c_conftest_c89_globals=' +/* Does the compiler advertise C89 conformance? + Do not test the value of __STDC__, because some compilers set it to 0 + while being otherwise adequately conformant. */ +#if !defined __STDC__ +# error "Compiler does not advertise C89 conformance" +#endif + +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ +struct buf { int x; }; +struct buf * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not \xHH hex character constants. + These do not provoke an error unfortunately, instead are silently treated + as an "x". The following induces an error, until -std is added to get + proper ANSI mode. Curiously \x00 != x always comes out true, for an + array size at least. It is necessary to write \x00 == 0 to get something + that is true only with -std. */ +int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) '\''x'\'' +int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), + int, int);' + +# Test code for whether the C compiler supports C89 (body of main). +ac_c_conftest_c89_main=' +ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); +' + +# Test code for whether the C compiler supports C99 (global declarations) +ac_c_conftest_c99_globals=' +// Does the compiler advertise C99 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L +# error "Compiler does not advertise C99 conformance" +#endif + +#include +extern int puts (const char *); +extern int printf (const char *, ...); +extern int dprintf (int, const char *, ...); +extern void *malloc (size_t); + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +// dprintf is used instead of fprintf to avoid needing to declare +// FILE and stderr. +#define debug(...) dprintf (2, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + #error "your preprocessor is broken" +#endif +#if BIG_OK +#else + #error "your preprocessor is broken" +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static bool +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str = ""; + int number = 0; + float fnumber = 0; + + while (*format) + { + switch (*format++) + { + case '\''s'\'': // string + str = va_arg (args_copy, const char *); + break; + case '\''d'\'': // int + number = va_arg (args_copy, int); + break; + case '\''f'\'': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); + + return *str && number && fnumber; +} +' + +# Test code for whether the C compiler supports C99 (body of main). +ac_c_conftest_c99_main=' + // Check bool. + _Bool success = false; + success |= (argc != 0); + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[0] = argv[0][0]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' + || dynamic_array[ni.number - 1] != 543); +' + +# Test code for whether the C compiler supports C11 (global declarations) +ac_c_conftest_c11_globals=' +// Does the compiler advertise C11 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L +# error "Compiler does not advertise C11 conformance" +#endif + +// Check _Alignas. +char _Alignas (double) aligned_as_double; +char _Alignas (0) no_special_alignment; +extern char aligned_as_int; +char _Alignas (0) _Alignas (int) aligned_as_int; + +// Check _Alignof. +enum +{ + int_alignment = _Alignof (int), + int_array_alignment = _Alignof (int[100]), + char_alignment = _Alignof (char) +}; +_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); + +// Check _Noreturn. +int _Noreturn does_not_return (void) { for (;;) continue; } + +// Check _Static_assert. +struct test_static_assert +{ + int x; + _Static_assert (sizeof (int) <= sizeof (long int), + "_Static_assert does not work in struct"); + long int y; +}; + +// Check UTF-8 literals. +#define u8 syntax error! +char const utf8_literal[] = u8"happens to be ASCII" "another string"; + +// Check duplicate typedefs. +typedef long *long_ptr; +typedef long int *long_ptr; +typedef long_ptr long_ptr; + +// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. +struct anonymous +{ + union { + struct { int i; int j; }; + struct { int k; long int l; } w; + }; + int m; +} v1; +' + +# Test code for whether the C compiler supports C11 (body of main). +ac_c_conftest_c11_main=' + _Static_assert ((offsetof (struct anonymous, i) + == offsetof (struct anonymous, w.k)), + "Anonymous union alignment botch"); + v1.i = 2; + v1.w.k = 5; + ok |= v1.i != 5; +' + +# Test code for whether the C compiler supports C11 (complete). +ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} +${ac_c_conftest_c11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + ${ac_c_conftest_c11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C99 (complete). +ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + return ok; +} +" + +# Test code for whether the C compiler supports C89 (complete). +ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + return ok; +} +" + +as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" +as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" +as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" +as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" +as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" +as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" +as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" +as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" +as_fn_append ac_header_c_list " wchar.h wchar_h HAVE_WCHAR_H" +as_fn_append ac_header_c_list " minix/config.h minix_config_h HAVE_MINIX_CONFIG_H" +as_fn_append ac_header_c_list " sys/time.h sys_time_h HAVE_SYS_TIME_H" +as_fn_append ac_header_c_list " vfork.h vfork_h HAVE_VFORK_H" +as_fn_append ac_func_c_list " fork HAVE_FORK" +as_fn_append ac_func_c_list " vfork HAVE_VFORK" +as_fn_append ac_func_c_list " vprintf HAVE_VPRINTF" + +# Auxiliary files required by this configure script. +ac_aux_files="install-sh" + +# Locations in which to look for auxiliary files. +ac_aux_dir_candidates="${srcdir}${PATH_SEPARATOR}${srcdir}/..${PATH_SEPARATOR}${srcdir}/../.." + +# Search for a directory containing all of the required auxiliary files, +# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. +# If we don't find one directory that contains all the files we need, +# we report the set of missing files from the *first* directory in +# $ac_aux_dir_candidates and give up. +ac_missing_aux_files="" +ac_first_candidate=: +printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in $ac_aux_dir_candidates +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + + printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 + ac_aux_dir_found=yes + ac_install_sh= + for ac_aux in $ac_aux_files + do + # As a special case, if "install-sh" is required, that requirement + # can be satisfied by any of "install-sh", "install.sh", or "shtool", + # and $ac_install_sh is set appropriately for whichever one is found. + if test x"$ac_aux" = x"install-sh" + then + if test -f "${as_dir}install-sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 + ac_install_sh="${as_dir}install-sh -c" + elif test -f "${as_dir}install.sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 + ac_install_sh="${as_dir}install.sh -c" + elif test -f "${as_dir}shtool"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 + ac_install_sh="${as_dir}shtool install -c" + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} install-sh" + else + break + fi + fi + else + if test -f "${as_dir}${ac_aux}"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" + else + break + fi + fi + fi + done + if test "$ac_aux_dir_found" = yes; then + ac_aux_dir="$as_dir" + break + fi + ac_first_candidate=false + + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 +fi + + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +if test -f "${ac_aux_dir}config.guess"; then + ac_config_guess="$SHELL ${ac_aux_dir}config.guess" +fi +if test -f "${ac_aux_dir}config.sub"; then + ac_config_sub="$SHELL ${ac_aux_dir}config.sub" +fi +if test -f "$ac_aux_dir/configure"; then + ac_configure="$SHELL ${ac_aux_dir}configure" +fi + # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false @@ -2370,12 +2668,12 @@ for ac_var in $ac_precious_vars; do eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) @@ -2384,24 +2682,24 @@ $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in @@ -2411,11 +2709,12 @@ $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi done if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' + and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## @@ -2462,7 +2761,8 @@ use_defshell() { } # Check whether --with-defshell was given. -if test "${with_defshell+set}" = set; then : +if test ${with_defshell+y} +then : withval=$with_defshell; case "${withval}" in yes) as_fn_error $? "bad value ${withval} given for bmake DEFSHELL" "$LINENO" 5 ;; no) ;; @@ -2476,7 +2776,8 @@ CYGWIN*|MINGW*) use_makefile=no;; esac # Check whether --with-makefile was given. -if test "${with_makefile+set}" = set; then : +if test ${with_makefile+y} +then : withval=$with_makefile; case "${withval}" in yes|no) use_makefile=${withval};; *) as_fn_error $? "bad value ${withval} given for makefile" "$LINENO" 5 ;; @@ -2486,7 +2787,8 @@ fi use_meta=yes # Check whether --with-meta was given. -if test "${with_meta+set}" = set; then : +if test ${with_meta+y} +then : withval=$with_meta; case "${withval}" in yes|no) use_meta=${withval};; *) as_fn_error $? "bad value ${withval} given for meta" "$LINENO" 5 ;; @@ -2495,7 +2797,8 @@ fi # Check whether --with-filemon was given. -if test "${with_filemon+set}" = set; then : +if test ${with_filemon+y} +then : withval=$with_filemon; case "/${withval}" in /no) use_filemon=no;; /*trace) filemon_h=no use_filemon="${withval}";; @@ -2507,7 +2810,7 @@ case "$use_filemon,$filemon_h" in ,*.h) use_filemon=dev;; esac -else +else $as_nop case "$OS" in NetBSD) filemon_h=no use_filemon=ktrace;; @@ -2570,6 +2873,15 @@ do PATH=$PATH:$d done export PATH + + + + + + + + + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -2578,11 +2890,12 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -2590,11 +2903,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2605,11 +2922,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -2618,11 +2935,12 @@ if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -2630,11 +2948,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2645,11 +2967,11 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then @@ -2657,8 +2979,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -2671,11 +2993,12 @@ if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -2683,11 +3006,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2698,11 +3025,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -2711,11 +3038,12 @@ fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -2724,15 +3052,19 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2748,18 +3080,18 @@ if test $ac_prog_rejected = yes; then # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -2770,11 +3102,12 @@ if test -z "$CC"; then do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -2782,11 +3115,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2797,11 +3134,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -2814,11 +3151,12 @@ if test -z "$CC"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -2826,11 +3164,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2841,11 +3183,11 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -2857,8 +3199,8 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -2866,25 +3208,129 @@ esac fi fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. +set dummy ${ac_tool_prefix}clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "clang", so it can be a program name with args. +set dummy clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +fi + + +test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 -for ac_option in --version -v -V -qversion; do +for ac_option in --version -v -V -qversion -version; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -2894,7 +3340,7 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done @@ -2902,7 +3348,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; @@ -2914,9 +3360,9 @@ ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +printf %s "checking whether the C compiler works... " >&6; } +ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" @@ -2937,11 +3383,12 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, @@ -2958,7 +3405,7 @@ do # certainly right. break;; *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi @@ -2974,44 +3421,46 @@ do done test "$ac_cv_exeext" = no && ac_cv_exeext= -else +else $as_nop ac_file='' fi -if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 +if test -z "$ac_file" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +printf %s "checking for C compiler default output file name... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +printf "%s\n" "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +printf %s "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with @@ -3025,15 +3474,15 @@ for ac_file in conftest.exe conftest conftest.*; do * ) break;; esac done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +printf "%s\n" "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext @@ -3042,7 +3491,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main () +main (void) { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; @@ -3054,8 +3503,8 @@ _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +printf %s "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in @@ -3063,10 +3512,10 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in @@ -3074,39 +3523,40 @@ $as_echo "$ac_try_echo"; } >&5 *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C compiled programs. + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +printf "%s\n" "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +printf %s "checking for suffix of object files... " >&6; } +if test ${ac_cv_objext+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; @@ -3120,11 +3570,12 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in @@ -3133,31 +3584,32 @@ $as_echo "$ac_try_echo"; } >&5 break;; esac done -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +printf "%s\n" "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 +printf %s "checking whether the compiler supports GNU C... " >&6; } +if test ${ac_cv_c_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { #ifndef __GNUC__ choke me @@ -3167,29 +3619,33 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_compiler_gnu=yes -else +else $as_nop ac_compiler_gnu=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_c_compiler_gnu + if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi -ac_test_CFLAGS=${CFLAGS+set} +ac_test_CFLAGS=${CFLAGS+y} ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +printf %s "checking whether $CC accepts -g... " >&6; } +if test ${ac_cv_prog_cc_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no @@ -3198,57 +3654,60 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_g=yes -else +else $as_nop CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : -else +else $as_nop ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_g=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +printf "%s\n" "$ac_cv_prog_cc_g" >&6; } +if test $ac_test_CFLAGS; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then @@ -3263,94 +3722,144 @@ else CFLAGS= fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else +ac_prog_cc_stdc=no +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 +printf %s "checking for $CC option to enable C11 features... " >&6; } +if test ${ac_cv_prog_cc_c11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c11=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c11_program +_ACEOF +for ac_arg in '' -std=gnu11 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c11" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } + CC="$CC $ac_cv_prog_cc_c11" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 + ac_prog_cc_stdc=c11 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 +printf %s "checking for $CC option to enable C99 features... " >&6; } +if test ${ac_cv_prog_cc_c99+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c99_program +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c99" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c99" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } + CC="$CC $ac_cv_prog_cc_c99" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 + ac_prog_cc_stdc=c99 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 +printf %s "checking for $CC option to enable C89 features... " >&6; } +if test ${ac_cv_prog_cc_c89+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -struct stat; -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} +$ac_c_conftest_c89_program _ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : + if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_c89=$ac_arg fi -rm -f core conftest.err conftest.$ac_objext +rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC - fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : +if test "x$ac_cv_prog_cc_c89" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c89" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } + CC="$CC $ac_cv_prog_cc_c89" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 + ac_prog_cc_stdc=c89 +fi fi ac_ext=c @@ -3360,463 +3869,175 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes +ac_header= ac_cache= +for ac_item in $ac_header_c_list do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_GREP" || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count + if test $ac_cache; then + ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" + if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then + printf "%s\n" "#define $ac_item 1" >> confdefs.h fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + ac_header= ac_cache= + elif test $ac_header; then + ac_cache=$ac_item + else + ac_header=$ac_item fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_EGREP" || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - done - ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" -if test "x$ac_cv_header_minix_config_h" = xyes; then : - MINIX=yes -else - MINIX= + + + + + +if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes +then : + +printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h + fi - if test "$MINIX" = yes; then - -$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h -$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h -$as_echo "#define _MINIX 1" >>confdefs.h - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 -$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } -if ${ac_cv_safe_to_define___extensions__+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 +printf %s "checking whether it is safe to define __EXTENSIONS__... " >&6; } +if test ${ac_cv_safe_to_define___extensions__+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ # define __EXTENSIONS__ 1 $ac_includes_default int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_safe_to_define___extensions__=yes -else +else $as_nop ac_cv_safe_to_define___extensions__=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 -$as_echo "$ac_cv_safe_to_define___extensions__" >&6; } - test $ac_cv_safe_to_define___extensions__ = yes && - $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 +printf "%s\n" "$ac_cv_safe_to_define___extensions__" >&6; } - $as_echo "#define _ALL_SOURCE 1" >>confdefs.h + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether _XOPEN_SOURCE should be defined" >&5 +printf %s "checking whether _XOPEN_SOURCE should be defined... " >&6; } +if test ${ac_cv_should_define__xopen_source+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_should_define__xopen_source=no + if test $ac_cv_header_wchar_h = yes +then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - $as_echo "#define _GNU_SOURCE 1" >>confdefs.h + #include + mbstate_t x; +int +main (void) +{ - $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : - $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + #define _XOPEN_SOURCE 500 + #include + mbstate_t x; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_should_define__xopen_source=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_should_define__xopen_source" >&5 +printf "%s\n" "$ac_cv_should_define__xopen_source" >&6; } + + printf "%s\n" "#define _ALL_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _DARWIN_C_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _GNU_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _HPUX_ALT_XOPEN_SOCKET_API 1" >>confdefs.h + + printf "%s\n" "#define _NETBSD_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _OPENBSD_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_BFP_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_DFP_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_TYPES_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_LIB_EXT2__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_MATH_SPEC_FUNCS__ 1" >>confdefs.h + + printf "%s\n" "#define _TANDEM_SOURCE 1" >>confdefs.h + + if test $ac_cv_header_minix_config_h = yes +then : + MINIX=yes + printf "%s\n" "#define _MINIX 1" >>confdefs.h + + printf "%s\n" "#define _POSIX_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _POSIX_1_SOURCE 2" >>confdefs.h + +else $as_nop + MINIX= +fi + if test $ac_cv_safe_to_define___extensions__ = yes +then : + printf "%s\n" "#define __EXTENSIONS__ 1" >>confdefs.h + +fi + if test $ac_cv_should_define__xopen_source = yes +then : + printf "%s\n" "#define _XOPEN_SOURCE 500" >>confdefs.h + +fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -3826,11 +4047,12 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -3838,11 +4060,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3853,11 +4079,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3866,11 +4092,12 @@ if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -3878,11 +4105,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3893,11 +4124,11 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then @@ -3905,8 +4136,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -3919,11 +4150,12 @@ if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -3931,11 +4163,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3946,11 +4182,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3959,11 +4195,12 @@ fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -3972,15 +4209,19 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3996,18 +4237,18 @@ if test $ac_prog_rejected = yes; then # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -4018,11 +4259,12 @@ if test -z "$CC"; then do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -4030,11 +4272,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4045,11 +4291,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -4062,11 +4308,12 @@ if test -z "$CC"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -4074,11 +4321,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4089,11 +4340,11 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -4105,8 +4356,8 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -4114,25 +4365,129 @@ esac fi fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. +set dummy ${ac_tool_prefix}clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "clang", so it can be a program name with args. +set dummy clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +fi + + +test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 -for ac_option in --version -v -V -qversion; do +for ac_option in --version -v -V -qversion -version; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -4142,20 +4497,21 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 +printf %s "checking whether the compiler supports GNU C... " >&6; } +if test ${ac_cv_c_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { #ifndef __GNUC__ choke me @@ -4165,29 +4521,33 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_compiler_gnu=yes -else +else $as_nop ac_compiler_gnu=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_c_compiler_gnu + if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi -ac_test_CFLAGS=${CFLAGS+set} +ac_test_CFLAGS=${CFLAGS+y} ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +printf %s "checking whether $CC accepts -g... " >&6; } +if test ${ac_cv_prog_cc_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no @@ -4196,57 +4556,60 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_g=yes -else +else $as_nop CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : -else +else $as_nop ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_g=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +printf "%s\n" "$ac_cv_prog_cc_g" >&6; } +if test $ac_test_CFLAGS; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then @@ -4261,94 +4624,144 @@ else CFLAGS= fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else +ac_prog_cc_stdc=no +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 +printf %s "checking for $CC option to enable C11 features... " >&6; } +if test ${ac_cv_prog_cc_c11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c11=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c11_program +_ACEOF +for ac_arg in '' -std=gnu11 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c11" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } + CC="$CC $ac_cv_prog_cc_c11" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 + ac_prog_cc_stdc=c11 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 +printf %s "checking for $CC option to enable C99 features... " >&6; } +if test ${ac_cv_prog_cc_c99+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c99_program +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c99" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c99" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } + CC="$CC $ac_cv_prog_cc_c99" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 + ac_prog_cc_stdc=c99 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 +printf %s "checking for $CC option to enable C89 features... " >&6; } +if test ${ac_cv_prog_cc_c89+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -struct stat; -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} +$ac_c_conftest_c89_program _ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : + if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_c89=$ac_arg fi -rm -f core conftest.err conftest.$ac_objext +rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC - fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : +if test "x$ac_cv_prog_cc_c89" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c89" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } + CC="$CC $ac_cv_prog_cc_c89" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 + ac_prog_cc_stdc=c89 +fi fi ac_ext=c @@ -4357,213 +4770,9 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5 -$as_echo_n "checking for $CC option to accept ISO C99... " >&6; } -if ${ac_cv_prog_cc_c99+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c99=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -#include - -// Check varargs macros. These examples are taken from C99 6.10.3.5. -#define debug(...) fprintf (stderr, __VA_ARGS__) -#define showlist(...) puts (#__VA_ARGS__) -#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) -static void -test_varargs_macros (void) -{ - int x = 1234; - int y = 5678; - debug ("Flag"); - debug ("X = %d\n", x); - showlist (The first, second, and third items.); - report (x>y, "x is %d but y is %d", x, y); -} - -// Check long long types. -#define BIG64 18446744073709551615ull -#define BIG32 4294967295ul -#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) -#if !BIG_OK - your preprocessor is broken; -#endif -#if BIG_OK -#else - your preprocessor is broken; -#endif -static long long int bignum = -9223372036854775807LL; -static unsigned long long int ubignum = BIG64; - -struct incomplete_array -{ - int datasize; - double data[]; -}; - -struct named_init { - int number; - const wchar_t *name; - double average; -}; - -typedef const char *ccp; - -static inline int -test_restrict (ccp restrict text) -{ - // See if C++-style comments work. - // Iterate through items via the restricted pointer. - // Also check for declarations in for loops. - for (unsigned int i = 0; *(text+i) != '\0'; ++i) - continue; - return 0; -} - -// Check varargs and va_copy. -static void -test_varargs (const char *format, ...) -{ - va_list args; - va_start (args, format); - va_list args_copy; - va_copy (args_copy, args); - - const char *str; - int number; - float fnumber; - - while (*format) - { - switch (*format++) - { - case 's': // string - str = va_arg (args_copy, const char *); - break; - case 'd': // int - number = va_arg (args_copy, int); - break; - case 'f': // float - fnumber = va_arg (args_copy, double); - break; - default: - break; - } - } - va_end (args_copy); - va_end (args); -} - -int -main () -{ - - // Check bool. - _Bool success = false; - - // Check restrict. - if (test_restrict ("String literal") == 0) - success = true; - char *restrict newvar = "Another string"; - - // Check varargs. - test_varargs ("s, d' f .", "string", 65, 34.234); - test_varargs_macros (); - - // Check flexible array members. - struct incomplete_array *ia = - malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); - ia->datasize = 10; - for (int i = 0; i < ia->datasize; ++i) - ia->data[i] = i * 1.234; - - // Check named initializers. - struct named_init ni = { - .number = 34, - .name = L"Test wide string", - .average = 543.34343, - }; - - ni.number = 58; - - int dynamic_array[ni.number]; - dynamic_array[ni.number - 1] = 543; - - // work around unused variable warnings - return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' - || dynamic_array[ni.number - 1] != 543); - - ; - return 0; -} -_ACEOF -for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc99 -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c99=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c99" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c99" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c99" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 -$as_echo "$ac_cv_prog_cc_c99" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c99" != xno; then : - -fi -ac_aux_dir= -for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 -fi - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - - -# Find a good install program. We prefer a C program (faster), + # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install @@ -4577,20 +4786,25 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 -$as_echo_n "checking for a BSD-compatible install... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +printf %s "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then -if ${ac_cv_path_install+:} false; then : - $as_echo_n "(cached) " >&6 -else +if test ${ac_cv_path_install+y} +then : + printf %s "(cached) " >&6 +else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in #(( - ./ | .// | /[cC]/* | \ + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + # Account for fact that we put trailing slashes in our PATH walk. +case $as_dir in #(( + ./ | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; @@ -4600,13 +4814,13 @@ case $as_dir/ in #(( # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext"; then if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + grep dspmsg "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + grep pwplus "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else @@ -4614,12 +4828,12 @@ case $as_dir/ in #(( echo one > conftest.one echo two > conftest.two mkdir conftest.dir - if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir/" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c" break 3 fi fi @@ -4635,7 +4849,7 @@ IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi - if test "${ac_cv_path_install+set}" = set; then + if test ${ac_cv_path_install+y}; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a @@ -4645,8 +4859,8 @@ fi INSTALL=$ac_install_sh fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +printf "%s\n" "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. @@ -4690,11 +4904,12 @@ case "$CC" in fi ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5 -$as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; } -if ${ac_cv_header_sys_wait_h+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5 +printf %s "checking for sys/wait.h that is POSIX.1 compatible... " >&6; } +if test ${ac_cv_header_sys_wait_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -4707,7 +4922,7 @@ else #endif int -main () +main (void) { int s; wait (&s); @@ -4716,36 +4931,38 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_header_sys_wait_h=yes -else +else $as_nop ac_cv_header_sys_wait_h=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5 -$as_echo "$ac_cv_header_sys_wait_h" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5 +printf "%s\n" "$ac_cv_header_sys_wait_h" >&6; } if test $ac_cv_header_sys_wait_h = yes; then -$as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h +printf "%s\n" "#define HAVE_SYS_WAIT_H 1" >>confdefs.h fi ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do - as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5 -$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; } -if eval \${$as_ac_Header+:} false; then : - $as_echo_n "(cached) " >&6 -else + as_ac_Header=`printf "%s\n" "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5 +printf %s "checking for $ac_hdr that defines DIR... " >&6; } +if eval test \${$as_ac_Header+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include <$ac_hdr> int -main () +main (void) { if ((DIR *) 0) return 0; @@ -4753,19 +4970,21 @@ return 0; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : eval "$as_ac_Header=yes" -else +else $as_nop eval "$as_ac_Header=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$as_ac_Header - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Header"\" = x"yes" +then : cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 +#define `printf "%s\n" "HAVE_$ac_hdr" | $as_tr_cpp` 1 _ACEOF ac_header_dirent=$ac_hdr; break @@ -4774,11 +4993,12 @@ fi done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 -$as_echo_n "checking for library containing opendir... " >&6; } -if ${ac_cv_search_opendir+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 +printf %s "checking for library containing opendir... " >&6; } +if test ${ac_cv_search_opendir+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -4786,56 +5006,59 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char opendir (); int -main () +main (void) { return opendir (); ; return 0; } _ACEOF -for ac_lib in '' dir; do +for ac_lib in '' dir +do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi - if ac_fn_c_try_link "$LINENO"; then : + if ac_fn_c_try_link "$LINENO" +then : ac_cv_search_opendir=$ac_res fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext - if ${ac_cv_search_opendir+:} false; then : + if test ${ac_cv_search_opendir+y} +then : break fi done -if ${ac_cv_search_opendir+:} false; then : +if test ${ac_cv_search_opendir+y} +then : -else +else $as_nop ac_cv_search_opendir=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 -$as_echo "$ac_cv_search_opendir" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 +printf "%s\n" "$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir -if test "$ac_res" != no; then : +if test "$ac_res" != no +then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 -$as_echo_n "checking for library containing opendir... " >&6; } -if ${ac_cv_search_opendir+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 +printf %s "checking for library containing opendir... " >&6; } +if test ${ac_cv_search_opendir+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -4843,125 +5066,175 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char opendir (); int -main () +main (void) { return opendir (); ; return 0; } _ACEOF -for ac_lib in '' x; do +for ac_lib in '' x +do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi - if ac_fn_c_try_link "$LINENO"; then : + if ac_fn_c_try_link "$LINENO" +then : ac_cv_search_opendir=$ac_res fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext - if ${ac_cv_search_opendir+:} false; then : + if test ${ac_cv_search_opendir+y} +then : break fi done -if ${ac_cv_search_opendir+:} false; then : +if test ${ac_cv_search_opendir+y} +then : -else +else $as_nop ac_cv_search_opendir=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 -$as_echo "$ac_cv_search_opendir" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 +printf "%s\n" "$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir -if test "$ac_res" != no; then : +if test "$ac_res" != no +then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi fi -for ac_header in sys/param.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "sys/param.h" "ac_cv_header_sys_param_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_param_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SYS_PARAM_H 1 -_ACEOF +ac_fn_c_check_header_compile "$LINENO" "sys/param.h" "ac_cv_header_sys_param_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_param_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_PARAM_H 1" >>confdefs.h fi -done - -for ac_header in sys/sysctl.h -do : - ac_fn_c_check_header_compile "$LINENO" "sys/sysctl.h" "ac_cv_header_sys_sysctl_h" "#ifdef HAVE_SYS_PARAM_H +ac_fn_c_check_header_compile "$LINENO" "sys/sysctl.h" "ac_cv_header_sys_sysctl_h" "#ifdef HAVE_SYS_PARAM_H # include # endif " -if test "x$ac_cv_header_sys_sysctl_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SYS_SYSCTL_H 1 -_ACEOF +if test "x$ac_cv_header_sys_sysctl_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_SYSCTL_H 1" >>confdefs.h fi -done +ac_fn_c_check_header_compile "$LINENO" "ar.h" "ac_cv_header_ar_h" "$ac_includes_default" +if test "x$ac_cv_header_ar_h" = xyes +then : + printf "%s\n" "#define HAVE_AR_H 1" >>confdefs.h -for ac_header in \ - ar.h \ - err.h \ - fcntl.h \ - libgen.h \ - limits.h \ - paths.h \ - poll.h \ - ranlib.h \ - sys/mman.h \ - sys/select.h \ - sys/socket.h \ - sys/time.h \ - sys/uio.h \ - utime.h \ +fi +ac_fn_c_check_header_compile "$LINENO" "err.h" "ac_cv_header_err_h" "$ac_includes_default" +if test "x$ac_cv_header_err_h" = xyes +then : + printf "%s\n" "#define HAVE_ERR_H 1" >>confdefs.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +fi +ac_fn_c_check_header_compile "$LINENO" "fcntl.h" "ac_cv_header_fcntl_h" "$ac_includes_default" +if test "x$ac_cv_header_fcntl_h" = xyes +then : + printf "%s\n" "#define HAVE_FCNTL_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "libgen.h" "ac_cv_header_libgen_h" "$ac_includes_default" +if test "x$ac_cv_header_libgen_h" = xyes +then : + printf "%s\n" "#define HAVE_LIBGEN_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "limits.h" "ac_cv_header_limits_h" "$ac_includes_default" +if test "x$ac_cv_header_limits_h" = xyes +then : + printf "%s\n" "#define HAVE_LIMITS_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "paths.h" "ac_cv_header_paths_h" "$ac_includes_default" +if test "x$ac_cv_header_paths_h" = xyes +then : + printf "%s\n" "#define HAVE_PATHS_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "poll.h" "ac_cv_header_poll_h" "$ac_includes_default" +if test "x$ac_cv_header_poll_h" = xyes +then : + printf "%s\n" "#define HAVE_POLL_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "ranlib.h" "ac_cv_header_ranlib_h" "$ac_includes_default" +if test "x$ac_cv_header_ranlib_h" = xyes +then : + printf "%s\n" "#define HAVE_RANLIB_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/mman.h" "ac_cv_header_sys_mman_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_mman_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_MMAN_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/select.h" "ac_cv_header_sys_select_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_select_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_SELECT_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/socket.h" "ac_cv_header_sys_socket_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_socket_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_SOCKET_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/time.h" "ac_cv_header_sys_time_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_time_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_TIME_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/uio.h" "ac_cv_header_sys_uio_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_uio_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_UIO_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "utime.h" "ac_cv_header_utime_h" "$ac_includes_default" +if test "x$ac_cv_header_utime_h" = xyes +then : + printf "%s\n" "#define HAVE_UTIME_H 1" >>confdefs.h fi -done +ac_fn_c_check_header_compile "$LINENO" "sys/cdefs.h" "ac_cv_header_sys_cdefs_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_cdefs_h" = xyes +then : -ac_fn_c_check_header_mongrel "$LINENO" "sys/cdefs.h" "ac_cv_header_sys_cdefs_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_cdefs_h" = xyes; then : - -else +else $as_nop CPPFLAGS="${CPPFLAGS} -I`cd ${srcdir}/missing && pwd`" fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __attribute__" >&5 -$as_echo_n "checking for __attribute__... " >&6; } -if ${ac_cv___attribute__+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for __attribute__" >&5 +printf %s "checking for __attribute__... " >&6; } +if test ${ac_cv___attribute__+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -4983,28 +5256,30 @@ main(int argc, char **argv) } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv___attribute__=yes -else +else $as_nop ac_cv___attribute__=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi if test "$ac_cv___attribute__" = "yes"; then -$as_echo "#define HAVE___ATTRIBUTE__ 1" >>confdefs.h +printf "%s\n" "#define HAVE___ATTRIBUTE__ 1" >>confdefs.h fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv___attribute__" >&5 -$as_echo "$ac_cv___attribute__" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv___attribute__" >&5 +printf "%s\n" "$ac_cv___attribute__" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 -$as_echo_n "checking whether byte ordering is bigendian... " >&6; } -if ${ac_cv_c_bigendian+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 +printf %s "checking whether byte ordering is bigendian... " >&6; } +if test ${ac_cv_c_bigendian+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_cv_c_bigendian=unknown # See if we're dealing with a universal compiler. cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -5015,7 +5290,8 @@ else typedef int dummy; _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : # Check for potential -arch flags. It is not universal unless # there are at least two -arch flags with different values. @@ -5039,7 +5315,7 @@ if ac_fn_c_try_compile "$LINENO"; then : fi done fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test $ac_cv_c_bigendian = unknown; then # See if sys/param.h defines the BYTE_ORDER macro. cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -5048,7 +5324,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext #include int -main () +main (void) { #if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ @@ -5060,7 +5336,8 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : # It does; now see whether it defined to BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -5068,7 +5345,7 @@ if ac_fn_c_try_compile "$LINENO"; then : #include int -main () +main (void) { #if BYTE_ORDER != BIG_ENDIAN not big endian @@ -5078,14 +5355,15 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_c_bigendian=yes -else +else $as_nop ac_cv_c_bigendian=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). @@ -5094,7 +5372,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext #include int -main () +main (void) { #if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) bogus endian macros @@ -5104,14 +5382,15 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : # It does; now see whether it defined to _BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main () +main (void) { #ifndef _BIG_ENDIAN not big endian @@ -5121,31 +5400,33 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_c_bigendian=yes -else +else $as_nop ac_cv_c_bigendian=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # Compile a test program. - if test "$cross_compiling" = yes; then : + if test "$cross_compiling" = yes +then : # Try to guess by grepping values from an object file. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -short int ascii_mm[] = +unsigned short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; - short int ascii_ii[] = + unsigned short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; int use_ascii (int i) { return ascii_mm[i] + ascii_ii[i]; } - short int ebcdic_ii[] = + unsigned short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; - short int ebcdic_mm[] = + unsigned short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; int use_ebcdic (int i) { return ebcdic_mm[i] + ebcdic_ii[i]; @@ -5153,14 +5434,15 @@ short int ascii_mm[] = extern int foo; int -main () +main (void) { return use_ascii (foo) == use_ebcdic (foo); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then ac_cv_c_bigendian=yes fi @@ -5173,13 +5455,13 @@ if ac_fn_c_try_compile "$LINENO"; then : fi fi fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int -main () +main (void) { /* Are we little or big endian? From Harbison&Steele. */ @@ -5195,9 +5477,10 @@ main () return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : ac_cv_c_bigendian=no -else +else $as_nop ac_cv_c_bigendian=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -5206,17 +5489,17 @@ fi fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 -$as_echo "$ac_cv_c_bigendian" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 +printf "%s\n" "$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in #( yes) - $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h + printf "%s\n" "#define WORDS_BIGENDIAN 1" >>confdefs.h ;; #( no) ;; #( universal) -$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h +printf "%s\n" "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h ;; #( *) @@ -5224,16 +5507,17 @@ $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 -$as_echo_n "checking for an ANSI C-conforming const... " >&6; } -if ${ac_cv_c_const+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 +printf %s "checking for an ANSI C-conforming const... " >&6; } +if test ${ac_cv_c_const+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { #ifndef __cplusplus @@ -5246,7 +5530,7 @@ main () /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; - /* AIX XL C 1.02.0.0 rejects this. + /* IBM XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ @@ -5274,7 +5558,7 @@ main () iptr p = 0; ++p; } - { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying + { /* IBM XL C 1.02.0.0 rejects this sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; } bx; struct s *b = &bx; b->j = 5; @@ -5290,47 +5574,50 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_c_const=yes -else +else $as_nop ac_cv_c_const=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 -$as_echo "$ac_cv_c_const" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 +printf "%s\n" "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then -$as_echo "#define const /**/" >>confdefs.h +printf "%s\n" "#define const /**/" >>confdefs.h fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 -$as_echo_n "checking for inline... " >&6; } -if ${ac_cv_c_inline+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 +printf %s "checking for inline... " >&6; } +if test ${ac_cv_c_inline+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; -static $ac_kw foo_t static_foo () {return 0; } -$ac_kw foo_t foo () {return 0; } +static $ac_kw foo_t static_foo (void) {return 0; } +$ac_kw foo_t foo (void) {return 0; } #endif _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_c_inline=$ac_kw fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 -$as_echo "$ac_cv_c_inline" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 +printf "%s\n" "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; @@ -5352,21 +5639,22 @@ case $ac_cv_c_int64_t in #( no|yes) ;; #( *) -cat >>confdefs.h <<_ACEOF -#define int64_t $ac_cv_c_int64_t -_ACEOF +printf "%s\n" "#define int64_t $ac_cv_c_int64_t" >>confdefs.h ;; esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for unsigned long long int" >&5 -$as_echo_n "checking for unsigned long long int... " >&6; } -if ${ac_cv_type_unsigned_long_long_int+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for unsigned long long int" >&5 +printf %s "checking for unsigned long long int... " >&6; } +if test ${ac_cv_type_unsigned_long_long_int+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_cv_type_unsigned_long_long_int=yes - if test "x${ac_cv_prog_cc_c99-no}" = xno; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + case $ac_prog_cc_stdc in + no | c89) ;; + *) + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* For now, do not test the preprocessor; as of 2007 there are too many @@ -5384,7 +5672,7 @@ else ? 1 : -1)]; int i = 63; int -main () +main (void) { /* Test availability of runtime routines for shift and division. */ long long int llmax = 9223372036854775807ll; @@ -5398,124 +5686,153 @@ main () } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : -else +else $as_nop ac_cv_type_unsigned_long_long_int=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext;; + esac fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_unsigned_long_long_int" >&5 -$as_echo "$ac_cv_type_unsigned_long_long_int" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_unsigned_long_long_int" >&5 +printf "%s\n" "$ac_cv_type_unsigned_long_long_int" >&6; } if test $ac_cv_type_unsigned_long_long_int = yes; then -$as_echo "#define HAVE_UNSIGNED_LONG_LONG_INT 1" >>confdefs.h +printf "%s\n" "#define HAVE_UNSIGNED_LONG_LONG_INT 1" >>confdefs.h fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for long long int" >&5 -$as_echo_n "checking for long long int... " >&6; } -if ${ac_cv_type_long_long_int+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for long long int" >&5 +printf %s "checking for long long int... " >&6; } +if test ${ac_cv_type_long_long_int+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_cv_type_long_long_int=yes - if test "x${ac_cv_prog_cc_c99-no}" = xno; then - ac_cv_type_long_long_int=$ac_cv_type_unsigned_long_long_int - if test $ac_cv_type_long_long_int = yes; then - if test "$cross_compiling" = yes; then : + case $ac_prog_cc_stdc in + no | c89) ;; + *) + ac_cv_type_long_long_int=$ac_cv_type_unsigned_long_long_int + if test $ac_cv_type_long_long_int = yes; then + if test "$cross_compiling" = yes +then : : -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include - #ifndef LLONG_MAX - # define HALF \ - (1LL << (sizeof (long long int) * CHAR_BIT - 2)) - # define LLONG_MAX (HALF - 1 + HALF) - #endif + #ifndef LLONG_MAX + # define HALF \ + (1LL << (sizeof (long long int) * CHAR_BIT - 2)) + # define LLONG_MAX (HALF - 1 + HALF) + #endif int -main () +main (void) { long long int n = 1; - int i; - for (i = 0; ; i++) - { - long long int m = n << i; - if (m >> i != n) - return 1; - if (LLONG_MAX / 2 < m) - break; - } - return 0; + int i; + for (i = 0; ; i++) + { + long long int m = n << i; + if (m >> i != n) + return 1; + if (LLONG_MAX / 2 < m) + break; + } + return 0; ; return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : -else +else $as_nop ac_cv_type_long_long_int=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi - fi - fi + fi;; + esac fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_long_long_int" >&5 -$as_echo "$ac_cv_type_long_long_int" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_long_long_int" >&5 +printf "%s\n" "$ac_cv_type_long_long_int" >&6; } if test $ac_cv_type_long_long_int = yes; then -$as_echo "#define HAVE_LONG_LONG_INT 1" >>confdefs.h +printf "%s\n" "#define HAVE_LONG_LONG_INT 1" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default" -if test "x$ac_cv_type_mode_t" = xyes; then : +if test "x$ac_cv_type_mode_t" = xyes +then : -else +else $as_nop -cat >>confdefs.h <<_ACEOF -#define mode_t int -_ACEOF +printf "%s\n" "#define mode_t int" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default" -if test "x$ac_cv_type_off_t" = xyes; then : +if test "x$ac_cv_type_off_t" = xyes +then : -else +else $as_nop -cat >>confdefs.h <<_ACEOF -#define off_t long int -_ACEOF +printf "%s\n" "#define off_t long int" >>confdefs.h fi -ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" -if test "x$ac_cv_type_pid_t" = xyes; then : -else + ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default +" +if test "x$ac_cv_type_pid_t" = xyes +then : + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #if defined _WIN64 && !defined __CYGWIN__ + LLP64 + #endif + +int +main (void) +{ + + ; + return 0; +} -cat >>confdefs.h <<_ACEOF -#define pid_t int _ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_pid_type='int' +else $as_nop + ac_pid_type='__int64' +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +printf "%s\n" "#define pid_t $ac_pid_type" >>confdefs.h + fi + ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" -if test "x$ac_cv_type_size_t" = xyes; then : +if test "x$ac_cv_type_size_t" = xyes +then : -else +else $as_nop -cat >>confdefs.h <<_ACEOF -#define size_t unsigned int -_ACEOF +printf "%s\n" "#define size_t unsigned int" >>confdefs.h fi @@ -5524,80 +5841,125 @@ case $ac_cv_c_uint32_t in #( no|yes) ;; #( *) -$as_echo "#define _UINT32_T 1" >>confdefs.h +printf "%s\n" "#define _UINT32_T 1" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define uint32_t $ac_cv_c_uint32_t -_ACEOF +printf "%s\n" "#define uint32_t $ac_cv_c_uint32_t" >>confdefs.h ;; esac -ac_fn_c_check_decl "$LINENO" "sys_siglist" "ac_cv_have_decl_sys_siglist" "#include +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC options needed to detect all undeclared functions" >&5 +printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; } +if test ${ac_cv_c_undeclared_builtin_options+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_save_CFLAGS=$CFLAGS + ac_cv_c_undeclared_builtin_options='cannot detect' + for ac_arg in '' -fno-builtin; do + CFLAGS="$ac_save_CFLAGS $ac_arg" + # This test program should *not* compile successfully. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +(void) strchr; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + # This test program should compile successfully. + # No library function is consistently available on + # freestanding implementations, so test against a dummy + # declaration. Include always-available headers on the + # off chance that they somehow elicit warnings. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +extern void ac_decl (int, char *); + +int +main (void) +{ +(void) ac_decl (0, (char *) 0); + (void) ac_decl; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + if test x"$ac_arg" = x +then : + ac_cv_c_undeclared_builtin_options='none needed' +else $as_nop + ac_cv_c_undeclared_builtin_options=$ac_arg +fi + break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + done + CFLAGS=$ac_save_CFLAGS + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_undeclared_builtin_options" >&5 +printf "%s\n" "$ac_cv_c_undeclared_builtin_options" >&6; } + case $ac_cv_c_undeclared_builtin_options in #( + 'cannot detect') : + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot make $CC report undeclared builtins +See \`config.log' for more details" "$LINENO" 5; } ;; #( + 'none needed') : + ac_c_undeclared_builtin_options='' ;; #( + *) : + ac_c_undeclared_builtin_options=$ac_cv_c_undeclared_builtin_options ;; +esac + +ac_fn_check_decl "$LINENO" "sys_siglist" "ac_cv_have_decl_sys_siglist" "#include /* NetBSD declares sys_siglist in unistd.h. */ #ifdef HAVE_UNISTD_H # include #endif -" -if test "x$ac_cv_have_decl_sys_siglist" = xyes; then : +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_sys_siglist" = xyes +then : ac_have_decl=1 -else +else $as_nop ac_have_decl=0 fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SYS_SIGLIST $ac_have_decl -_ACEOF +printf "%s\n" "#define HAVE_DECL_SYS_SIGLIST $ac_have_decl" >>confdefs.h -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 -$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } -if ${ac_cv_header_time+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -int -main () -{ -if ((struct tm *) 0) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_time=yes -else - ac_cv_header_time=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 -$as_echo "$ac_cv_header_time" >&6; } -if test $ac_cv_header_time = yes; then -$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5 -$as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; } -if ${ac_cv_struct_tm+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5 +printf %s "checking whether struct tm is in sys/time.h or time.h... " >&6; } +if test ${ac_cv_struct_tm+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int -main () +main (void) { struct tm tm; int *p = &tm.tm_sec; @@ -5606,18 +5968,19 @@ struct tm tm; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_struct_tm=time.h -else +else $as_nop ac_cv_struct_tm=sys/time.h fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_tm" >&5 -$as_echo "$ac_cv_struct_tm" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_tm" >&5 +printf "%s\n" "$ac_cv_struct_tm" >&6; } if test $ac_cv_struct_tm = sys/time.h; then -$as_echo "#define TM_IN_SYS_TIME 1" >>confdefs.h +printf "%s\n" "#define TM_IN_SYS_TIME 1" >>confdefs.h fi @@ -5630,87 +5993,48 @@ ac_fn_c_check_type "$LINENO" "sig_atomic_t" "ac_cv_type_sig_atomic_t" " #include " -if test "x$ac_cv_type_sig_atomic_t" = xyes; then : +if test "x$ac_cv_type_sig_atomic_t" = xyes +then : -cat >>confdefs.h <<_ACEOF -#define HAVE_SIG_ATOMIC_T 1 -_ACEOF +printf "%s\n" "#define HAVE_SIG_ATOMIC_T 1" >>confdefs.h fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5 -$as_echo_n "checking return type of signal handlers... " >&6; } -if ${ac_cv_type_signal+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include - -int -main () -{ -return *(signal (0, 0)) (0) == 1; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_type_signal=int -else - ac_cv_type_signal=void -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5 -$as_echo "$ac_cv_type_signal" >&6; } - -cat >>confdefs.h <<_ACEOF -#define RETSIGTYPE $ac_cv_type_signal -_ACEOF - - -for ac_header in vfork.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default" -if test "x$ac_cv_header_vfork_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_VFORK_H 1 -_ACEOF - -fi +ac_func= +for ac_item in $ac_func_c_list +do + if test $ac_func; then + ac_fn_c_check_func "$LINENO" $ac_func ac_cv_func_$ac_func + if eval test \"x\$ac_cv_func_$ac_func\" = xyes; then + echo "#define $ac_item 1" >> confdefs.h + fi + ac_func= + else + ac_func=$ac_item + fi done -for ac_func in fork vfork -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF -fi -done if test "x$ac_cv_func_fork" = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5 -$as_echo_n "checking for working fork... " >&6; } -if ${ac_cv_func_fork_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5 +printf %s "checking for working fork... " >&6; } +if test ${ac_cv_func_fork_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : ac_cv_func_fork_works=cross -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int -main () +main (void) { /* By Ruediger Kuhlmann. */ @@ -5720,9 +6044,10 @@ main () return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : ac_cv_func_fork_works=yes -else +else $as_nop ac_cv_func_fork_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -5730,8 +6055,8 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5 -$as_echo "$ac_cv_func_fork_works" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5 +printf "%s\n" "$ac_cv_func_fork_works" >&6; } else ac_cv_func_fork_works=$ac_cv_func_fork @@ -5746,27 +6071,37 @@ if test "x$ac_cv_func_fork_works" = xcross; then ac_cv_func_fork_works=yes ;; esac - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 -$as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 +printf "%s\n" "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} fi ac_cv_func_vfork_works=$ac_cv_func_vfork if test "x$ac_cv_func_vfork" = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5 -$as_echo_n "checking for working vfork... " >&6; } -if ${ac_cv_func_vfork_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5 +printf %s "checking for working vfork... " >&6; } +if test ${ac_cv_func_vfork_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : ac_cv_func_vfork_works=cross -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Thanks to Paul Eggert for this test. */ $ac_includes_default +#include #include #ifdef HAVE_VFORK_H # include #endif + +static void +do_nothing (int sig) +{ + (void) sig; +} + /* On some sparc systems, changes by the child to local and incoming argument registers are propagated back to the parent. The compiler is told about this with #include , but some compilers @@ -5774,11 +6109,7 @@ $ac_includes_default static variable whose address is put into a register that is clobbered by the vfork. */ static void -#ifdef __cplusplus sparc_address_test (int arg) -# else -sparc_address_test (arg) int arg; -#endif { static pid_t child; if (!child) { @@ -5796,13 +6127,18 @@ sparc_address_test (arg) int arg; } int -main () +main (void) { pid_t parent = getpid (); pid_t child; sparc_address_test (0); + /* On Solaris 2.4, changes by the child to the signal handler + also munge signal handlers in the parent. To detect this, + start by putting the parent's handler in a known state. */ + signal (SIGTERM, SIG_DFL); + child = vfork (); if (child == 0) { @@ -5824,6 +6160,10 @@ main () || p != p5 || p != p6 || p != p7) _exit(1); + /* Alter the child's signal handler. */ + if (signal (SIGTERM, do_nothing) != SIG_DFL) + _exit(1); + /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent from child file descriptors. If the child closes a descriptor before it execs or exits, this munges the parent's descriptor @@ -5839,6 +6179,9 @@ main () /* Was there some problem with vforking? */ child < 0 + /* Did the child munge the parent's signal handler? */ + || signal (SIGTERM, SIG_DFL) != SIG_DFL + /* Did the child fail? (This shouldn't happen.) */ || status @@ -5851,9 +6194,10 @@ main () } } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : ac_cv_func_vfork_works=yes -else +else $as_nop ac_cv_func_vfork_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -5861,58 +6205,54 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5 -$as_echo "$ac_cv_func_vfork_works" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5 +printf "%s\n" "$ac_cv_func_vfork_works" >&6; } fi; if test "x$ac_cv_func_fork_works" = xcross; then ac_cv_func_vfork_works=$ac_cv_func_vfork - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 -$as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 +printf "%s\n" "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} fi if test "x$ac_cv_func_vfork_works" = xyes; then -$as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h +printf "%s\n" "#define HAVE_WORKING_VFORK 1" >>confdefs.h else -$as_echo "#define vfork fork" >>confdefs.h +printf "%s\n" "#define vfork fork" >>confdefs.h fi if test "x$ac_cv_func_fork_works" = xyes; then -$as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h +printf "%s\n" "#define HAVE_WORKING_FORK 1" >>confdefs.h fi -for ac_func in vprintf -do : - ac_fn_c_check_func "$LINENO" "vprintf" "ac_cv_func_vprintf" -if test "x$ac_cv_func_vprintf" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_VPRINTF 1 -_ACEOF -ac_fn_c_check_func "$LINENO" "_doprnt" "ac_cv_func__doprnt" -if test "x$ac_cv_func__doprnt" = xyes; then : -$as_echo "#define HAVE_DOPRNT 1" >>confdefs.h +if test "x$ac_cv_func_vprintf" = xno +then : + ac_fn_c_check_func "$LINENO" "_doprnt" "ac_cv_func__doprnt" +if test "x$ac_cv_func__doprnt" = xyes +then : + +printf "%s\n" "#define HAVE_DOPRNT 1" >>confdefs.h fi fi -done - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for wait3 that fills in rusage" >&5 -$as_echo_n "checking for wait3 that fills in rusage... " >&6; } -if ${ac_cv_func_wait3_rusage+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for wait3 that fills in rusage" >&5 +printf %s "checking for wait3 that fills in rusage... " >&6; } +if test ${ac_cv_func_wait3_rusage+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : ac_cv_func_wait3_rusage=no -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default @@ -5921,7 +6261,7 @@ $ac_includes_default #include /* HP-UX has wait3 but does not fill in rusage at all. */ int -main () +main (void) { struct rusage r; int i; @@ -5951,9 +6291,10 @@ main () } } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : ac_cv_func_wait3_rusage=yes -else +else $as_nop ac_cv_func_wait3_rusage=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -5961,69 +6302,238 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_wait3_rusage" >&5 -$as_echo "$ac_cv_func_wait3_rusage" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_wait3_rusage" >&5 +printf "%s\n" "$ac_cv_func_wait3_rusage" >&6; } if test $ac_cv_func_wait3_rusage = yes; then -$as_echo "#define HAVE_WAIT3 1" >>confdefs.h +printf "%s\n" "#define HAVE_WAIT3 1" >>confdefs.h fi -for ac_func in \ - err \ - errx \ - getcwd \ - getenv \ - getwd \ - killpg \ - mmap \ - putenv \ - select \ - setenv \ - setpgid \ - setrlimit \ - setsid \ - sigaddset \ - sigpending \ - sigprocmask \ - sigsetmask \ - sigsuspend \ - sigvec \ - snprintf \ - strerror \ - stresep \ - strftime \ - strsep \ - strtod \ - strtol \ - strtoll \ - strtoul \ - sysctl \ - unsetenv \ - vsnprintf \ - wait3 \ - wait4 \ - waitpid \ - warn \ - warnx \ - -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF +ac_fn_c_check_func "$LINENO" "err" "ac_cv_func_err" +if test "x$ac_cv_func_err" = xyes +then : + printf "%s\n" "#define HAVE_ERR 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "errx" "ac_cv_func_errx" +if test "x$ac_cv_func_errx" = xyes +then : + printf "%s\n" "#define HAVE_ERRX 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "getcwd" "ac_cv_func_getcwd" +if test "x$ac_cv_func_getcwd" = xyes +then : + printf "%s\n" "#define HAVE_GETCWD 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "getenv" "ac_cv_func_getenv" +if test "x$ac_cv_func_getenv" = xyes +then : + printf "%s\n" "#define HAVE_GETENV 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "getwd" "ac_cv_func_getwd" +if test "x$ac_cv_func_getwd" = xyes +then : + printf "%s\n" "#define HAVE_GETWD 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "killpg" "ac_cv_func_killpg" +if test "x$ac_cv_func_killpg" = xyes +then : + printf "%s\n" "#define HAVE_KILLPG 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" +if test "x$ac_cv_func_mmap" = xyes +then : + printf "%s\n" "#define HAVE_MMAP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "putenv" "ac_cv_func_putenv" +if test "x$ac_cv_func_putenv" = xyes +then : + printf "%s\n" "#define HAVE_PUTENV 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "select" "ac_cv_func_select" +if test "x$ac_cv_func_select" = xyes +then : + printf "%s\n" "#define HAVE_SELECT 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "setenv" "ac_cv_func_setenv" +if test "x$ac_cv_func_setenv" = xyes +then : + printf "%s\n" "#define HAVE_SETENV 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "setpgid" "ac_cv_func_setpgid" +if test "x$ac_cv_func_setpgid" = xyes +then : + printf "%s\n" "#define HAVE_SETPGID 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "setrlimit" "ac_cv_func_setrlimit" +if test "x$ac_cv_func_setrlimit" = xyes +then : + printf "%s\n" "#define HAVE_SETRLIMIT 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "setsid" "ac_cv_func_setsid" +if test "x$ac_cv_func_setsid" = xyes +then : + printf "%s\n" "#define HAVE_SETSID 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "sigaddset" "ac_cv_func_sigaddset" +if test "x$ac_cv_func_sigaddset" = xyes +then : + printf "%s\n" "#define HAVE_SIGADDSET 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "sigpending" "ac_cv_func_sigpending" +if test "x$ac_cv_func_sigpending" = xyes +then : + printf "%s\n" "#define HAVE_SIGPENDING 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "sigprocmask" "ac_cv_func_sigprocmask" +if test "x$ac_cv_func_sigprocmask" = xyes +then : + printf "%s\n" "#define HAVE_SIGPROCMASK 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "sigsetmask" "ac_cv_func_sigsetmask" +if test "x$ac_cv_func_sigsetmask" = xyes +then : + printf "%s\n" "#define HAVE_SIGSETMASK 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "sigsuspend" "ac_cv_func_sigsuspend" +if test "x$ac_cv_func_sigsuspend" = xyes +then : + printf "%s\n" "#define HAVE_SIGSUSPEND 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "sigvec" "ac_cv_func_sigvec" +if test "x$ac_cv_func_sigvec" = xyes +then : + printf "%s\n" "#define HAVE_SIGVEC 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "snprintf" "ac_cv_func_snprintf" +if test "x$ac_cv_func_snprintf" = xyes +then : + printf "%s\n" "#define HAVE_SNPRINTF 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strerror" "ac_cv_func_strerror" +if test "x$ac_cv_func_strerror" = xyes +then : + printf "%s\n" "#define HAVE_STRERROR 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "stresep" "ac_cv_func_stresep" +if test "x$ac_cv_func_stresep" = xyes +then : + printf "%s\n" "#define HAVE_STRESEP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strftime" "ac_cv_func_strftime" +if test "x$ac_cv_func_strftime" = xyes +then : + printf "%s\n" "#define HAVE_STRFTIME 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strsep" "ac_cv_func_strsep" +if test "x$ac_cv_func_strsep" = xyes +then : + printf "%s\n" "#define HAVE_STRSEP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strtod" "ac_cv_func_strtod" +if test "x$ac_cv_func_strtod" = xyes +then : + printf "%s\n" "#define HAVE_STRTOD 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strtol" "ac_cv_func_strtol" +if test "x$ac_cv_func_strtol" = xyes +then : + printf "%s\n" "#define HAVE_STRTOL 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strtoll" "ac_cv_func_strtoll" +if test "x$ac_cv_func_strtoll" = xyes +then : + printf "%s\n" "#define HAVE_STRTOLL 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strtoul" "ac_cv_func_strtoul" +if test "x$ac_cv_func_strtoul" = xyes +then : + printf "%s\n" "#define HAVE_STRTOUL 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "sysctl" "ac_cv_func_sysctl" +if test "x$ac_cv_func_sysctl" = xyes +then : + printf "%s\n" "#define HAVE_SYSCTL 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "unsetenv" "ac_cv_func_unsetenv" +if test "x$ac_cv_func_unsetenv" = xyes +then : + printf "%s\n" "#define HAVE_UNSETENV 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "vsnprintf" "ac_cv_func_vsnprintf" +if test "x$ac_cv_func_vsnprintf" = xyes +then : + printf "%s\n" "#define HAVE_VSNPRINTF 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "wait3" "ac_cv_func_wait3" +if test "x$ac_cv_func_wait3" = xyes +then : + printf "%s\n" "#define HAVE_WAIT3 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "wait4" "ac_cv_func_wait4" +if test "x$ac_cv_func_wait4" = xyes +then : + printf "%s\n" "#define HAVE_WAIT4 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "waitpid" "ac_cv_func_waitpid" +if test "x$ac_cv_func_waitpid" = xyes +then : + printf "%s\n" "#define HAVE_WAITPID 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "warn" "ac_cv_func_warn" +if test "x$ac_cv_func_warn" = xyes +then : + printf "%s\n" "#define HAVE_WARN 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "warnx" "ac_cv_func_warnx" +if test "x$ac_cv_func_warnx" = xyes +then : + printf "%s\n" "#define HAVE_WARNX 1" >>confdefs.h fi -done ac_fn_c_check_func "$LINENO" "getopt" "ac_cv_func_getopt" -if test "x$ac_cv_func_getopt" = xyes; then : - $as_echo "#define HAVE_GETOPT 1" >>confdefs.h +if test "x$ac_cv_func_getopt" = xyes +then : + printf "%s\n" "#define HAVE_GETOPT 1" >>confdefs.h -else +else $as_nop case " $LIBOBJS " in *" getopt.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS getopt.$ac_objext" @@ -6031,12 +6541,12 @@ else esac fi - ac_fn_c_check_func "$LINENO" "realpath" "ac_cv_func_realpath" -if test "x$ac_cv_func_realpath" = xyes; then : - $as_echo "#define HAVE_REALPATH 1" >>confdefs.h +if test "x$ac_cv_func_realpath" = xyes +then : + printf "%s\n" "#define HAVE_REALPATH 1" >>confdefs.h -else +else $as_nop case " $LIBOBJS " in *" realpath.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS realpath.$ac_objext" @@ -6044,12 +6554,12 @@ else esac fi - ac_fn_c_check_func "$LINENO" "dirname" "ac_cv_func_dirname" -if test "x$ac_cv_func_dirname" = xyes; then : - $as_echo "#define HAVE_DIRNAME 1" >>confdefs.h +if test "x$ac_cv_func_dirname" = xyes +then : + printf "%s\n" "#define HAVE_DIRNAME 1" >>confdefs.h -else +else $as_nop case " $LIBOBJS " in *" dirname.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS dirname.$ac_objext" @@ -6057,12 +6567,12 @@ else esac fi - ac_fn_c_check_func "$LINENO" "sigaction" "ac_cv_func_sigaction" -if test "x$ac_cv_func_sigaction" = xyes; then : - $as_echo "#define HAVE_SIGACTION 1" >>confdefs.h +if test "x$ac_cv_func_sigaction" = xyes +then : + printf "%s\n" "#define HAVE_SIGACTION 1" >>confdefs.h -else +else $as_nop case " $LIBOBJS " in *" sigaction.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS sigaction.$ac_objext" @@ -6070,12 +6580,12 @@ else esac fi - ac_fn_c_check_func "$LINENO" "stresep" "ac_cv_func_stresep" -if test "x$ac_cv_func_stresep" = xyes; then : - $as_echo "#define HAVE_STRESEP 1" >>confdefs.h +if test "x$ac_cv_func_stresep" = xyes +then : + printf "%s\n" "#define HAVE_STRESEP 1" >>confdefs.h -else +else $as_nop case " $LIBOBJS " in *" stresep.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS stresep.$ac_objext" @@ -6083,12 +6593,12 @@ else esac fi - ac_fn_c_check_func "$LINENO" "strlcpy" "ac_cv_func_strlcpy" -if test "x$ac_cv_func_strlcpy" = xyes; then : - $as_echo "#define HAVE_STRLCPY 1" >>confdefs.h +if test "x$ac_cv_func_strlcpy" = xyes +then : + printf "%s\n" "#define HAVE_STRLCPY 1" >>confdefs.h -else +else $as_nop case " $LIBOBJS " in *" strlcpy.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS strlcpy.$ac_objext" @@ -6098,12 +6608,12 @@ esac fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for emalloc in -lutil" >&5 -$as_echo_n "checking for emalloc in -lutil... " >&6; } -if ${ac_cv_lib_util_emalloc+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for emalloc in -lutil" >&5 +printf %s "checking for emalloc in -lutil... " >&6; } +if test ${ac_cv_lib_util_emalloc+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lutil $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6112,35 +6622,35 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char emalloc (); int -main () +main (void) { return emalloc (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_util_emalloc=yes -else +else $as_nop ac_cv_lib_util_emalloc=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_emalloc" >&5 -$as_echo "$ac_cv_lib_util_emalloc" >&6; } -if test "x$ac_cv_lib_util_emalloc" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for erealloc in -lutil" >&5 -$as_echo_n "checking for erealloc in -lutil... " >&6; } -if ${ac_cv_lib_util_erealloc+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_emalloc" >&5 +printf "%s\n" "$ac_cv_lib_util_emalloc" >&6; } +if test "x$ac_cv_lib_util_emalloc" = xyes +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for erealloc in -lutil" >&5 +printf %s "checking for erealloc in -lutil... " >&6; } +if test ${ac_cv_lib_util_erealloc+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lutil $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6149,35 +6659,35 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char erealloc (); int -main () +main (void) { return erealloc (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_util_erealloc=yes -else +else $as_nop ac_cv_lib_util_erealloc=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_erealloc" >&5 -$as_echo "$ac_cv_lib_util_erealloc" >&6; } -if test "x$ac_cv_lib_util_erealloc" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for estrdup in -lutil" >&5 -$as_echo_n "checking for estrdup in -lutil... " >&6; } -if ${ac_cv_lib_util_estrdup+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_erealloc" >&5 +printf "%s\n" "$ac_cv_lib_util_erealloc" >&6; } +if test "x$ac_cv_lib_util_erealloc" = xyes +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for estrdup in -lutil" >&5 +printf %s "checking for estrdup in -lutil... " >&6; } +if test ${ac_cv_lib_util_estrdup+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lutil $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6186,35 +6696,35 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char estrdup (); int -main () +main (void) { return estrdup (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_util_estrdup=yes -else +else $as_nop ac_cv_lib_util_estrdup=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_estrdup" >&5 -$as_echo "$ac_cv_lib_util_estrdup" >&6; } -if test "x$ac_cv_lib_util_estrdup" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for estrndup in -lutil" >&5 -$as_echo_n "checking for estrndup in -lutil... " >&6; } -if ${ac_cv_lib_util_estrndup+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_estrdup" >&5 +printf "%s\n" "$ac_cv_lib_util_estrdup" >&6; } +if test "x$ac_cv_lib_util_estrdup" = xyes +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for estrndup in -lutil" >&5 +printf %s "checking for estrndup in -lutil... " >&6; } +if test ${ac_cv_lib_util_estrndup+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lutil $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6223,30 +6733,29 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char estrndup (); int -main () +main (void) { return estrndup (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_util_estrndup=yes -else +else $as_nop ac_cv_lib_util_estrndup=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_estrndup" >&5 -$as_echo "$ac_cv_lib_util_estrndup" >&6; } -if test "x$ac_cv_lib_util_estrndup" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_estrndup" >&5 +printf "%s\n" "$ac_cv_lib_util_estrndup" >&6; } +if test "x$ac_cv_lib_util_estrndup" = xyes +then : LIBS="$LIBS -lutil" CPPFLAGS="$CPPFLAGS -DUSE_EMALLOC" fi @@ -6258,11 +6767,12 @@ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat file-mode macros are broken" >&5 -$as_echo_n "checking whether stat file-mode macros are broken... " >&6; } -if ${ac_cv_header_stat_broken+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stat file-mode macros are broken" >&5 +printf %s "checking whether stat file-mode macros are broken... " >&6; } +if test ${ac_cv_header_stat_broken+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -6285,34 +6795,22 @@ extern char c4[S_ISSOCK (S_IFREG) ? -1 : 1]; #endif _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_header_stat_broken=no -else +else $as_nop ac_cv_header_stat_broken=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stat_broken" >&5 -$as_echo "$ac_cv_header_stat_broken" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stat_broken" >&5 +printf "%s\n" "$ac_cv_header_stat_broken" >&6; } if test $ac_cv_header_stat_broken = yes; then -$as_echo "#define STAT_MACROS_BROKEN 1" >>confdefs.h +printf "%s\n" "#define STAT_MACROS_BROKEN 1" >>confdefs.h fi -ac_fn_c_check_member "$LINENO" "struct stat" "st_rdev" "ac_cv_member_struct_stat_st_rdev" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_rdev" = xyes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_STAT_ST_RDEV 1 -_ACEOF - - -$as_echo "#define HAVE_ST_RDEV 1" >>confdefs.h - -fi - - echo "checking if compiler supports __func__" >&6 ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -6324,21 +6822,22 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { const char *func = __func__; ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : -else +else $as_nop -$as_echo "#define __func__ __FUNCTION__" >>confdefs.h +printf "%s\n" "#define __func__ __FUNCTION__" >>confdefs.h fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test -x /usr/gnu/bin/diff; then diff=/usr/gnu/bin/diff diff_u=-u @@ -6366,7 +6865,7 @@ machine_arch=MACHINE_ARCH EOF default_machine=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep machine= | tr -d ' "'` + grep machine= | tr -d ' "'` rm -rf conftest* if test "$default_machine"; then eval "$default_machine" @@ -6376,7 +6875,8 @@ machine_arch=${machine_arch:-`$srcdir/machine.sh arch`} echo "defaults: MACHINE=$machine, MACHINE_ARCH=$machine_arch" 1>&6 # Check whether --with-machine was given. -if test "${with_machine+set}" = set; then : +if test ${with_machine+y} +then : withval=$with_machine; case "${withval}" in yes) as_fn_error $? "bad value ${withval} given for bmake MACHINE" "$LINENO" 5 ;; no) ;; @@ -6388,7 +6888,8 @@ fi force_machine= # Check whether --with-force_machine was given. -if test "${with_force_machine+set}" = set; then : +if test ${with_force_machine+y} +then : withval=$with_force_machine; case "${withval}" in yes) force_machine=FORCE_;; no) ;; @@ -6399,7 +6900,8 @@ fi force_machine_arch= # Check whether --with-force_machine_arch was given. -if test "${with_force_machine_arch+set}" = set; then : +if test ${with_force_machine_arch+y} +then : withval=$with_force_machine_arch; case "${withval}" in yes) force_machine_arch=FORCE_;; no) ;; @@ -6409,7 +6911,8 @@ fi # Check whether --with-machine_arch was given. -if test "${with_machine_arch+set}" = set; then : +if test ${with_machine_arch+y} +then : withval=$with_machine_arch; case "${withval}" in yes) as_fn_error $? "bad value ${withval} given for bmake MACHINE_ARCH" "$LINENO" 5 ;; no) ;; @@ -6421,7 +6924,8 @@ echo "Using: ${force_machine}MACHINE=$machine, ${force_machine_arch}MACHINE_ARCH default_sys_path=\${prefix}/share/mk # Check whether --with-default-sys-path was given. -if test "${with_default_sys_path+set}" = set; then : +if test ${with_default_sys_path+y} +then : withval=$with_default_sys_path; case "${withval}" in yes) as_fn_error $? "bad value ${withval} given for bmake _PATH_DEFSYSPATH" "$LINENO" 5 ;; no) ;; @@ -6432,7 +6936,8 @@ fi # Check whether --with-path-objdirprefix was given. -if test "${with_path_objdirprefix+set}" = set; then : +if test ${with_path_objdirprefix+y} +then : withval=$with_path_objdirprefix; case "${withval}" in yes) as_fn_error $? "bad value ${withval} given for bmake _PATH_OBJDIRPREFIX" "$LINENO" 5 ;; no) CPPFLAGS="$CPPFLAGS -DNO_PATH_OBJDIRPREFIX" ;; @@ -6441,7 +6946,8 @@ esac fi # Check whether --enable-pwd-override was given. -if test "${enable_pwd_override+set}" = set; then : +if test ${enable_pwd_override+y} +then : enableval=$enable_pwd_override; case "${enableval}" in yes) ;; no) CPPFLAGS="$CPPFLAGS -DNO_PWD_OVERRIDE" ;; @@ -6450,7 +6956,8 @@ esac fi # Check whether --enable-check-make-chdir was given. -if test "${enable_check_make_chdir+set}" = set; then : +if test ${enable_check_make_chdir+y} +then : enableval=$enable_check_make_chdir; case "${enableval}" in yes) ;; no) CPPFLAGS="$CPPFLAGS -DNO_CHECK_MAKE_CHDIR" ;; @@ -6460,7 +6967,8 @@ fi # Check whether --with-mksrc was given. -if test "${with_mksrc+set}" = set; then : +if test ${with_mksrc+y} +then : withval=$with_mksrc; case "${withval}" in ""|yes|no) ;; *) test -s $withval/install-mk && mksrc=$withval || @@ -6490,33 +6998,30 @@ case "$defshell_path$DEFSHELL_INDEX" in *DEFSHELL_INDEX_CUSTOM) echo "Using: SHELL=$defshell_path" >&6 -cat >>confdefs.h <<_ACEOF -#define DEFSHELL_CUSTOM "$defshell_path" -_ACEOF +printf "%s\n" "#define DEFSHELL_CUSTOM \"$defshell_path\"" >>confdefs.h ;; /*INDEX*) echo "Using: SHELL=$DEFSHELL_INDEX ($defshell_path)" | sed 's,DEFSHELL_INDEX_,,' >&6 -cat >>confdefs.h <<_ACEOF -#define DEFSHELL_INDEX $DEFSHELL_INDEX -_ACEOF +printf "%s\n" "#define DEFSHELL_INDEX $DEFSHELL_INDEX" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define DEFSHELL_PATH "$defshell_path" -_ACEOF +printf "%s\n" "#define DEFSHELL_PATH \"$defshell_path\"" >>confdefs.h ;; *) echo "Using: SHELL=$DEFSHELL_INDEX" | sed 's,DEFSHELL_INDEX_,,' >&6 -cat >>confdefs.h <<_ACEOF -#define DEFSHELL_INDEX $DEFSHELL_INDEX -_ACEOF +printf "%s\n" "#define DEFSHELL_INDEX $DEFSHELL_INDEX" >>confdefs.h ;; esac +case "`echo bmake | egrep 'a|b' 2>&1`" in +bmake) egrep=egrep;; +*) egrep='grep -E';; +esac + @@ -6577,8 +7082,8 @@ _ACEOF case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -6608,15 +7113,15 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; /^ac_cv_env_/b end t clear :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +printf "%s\n" "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else @@ -6630,8 +7135,8 @@ $as_echo "$as_me: updating cache $cache_file" >&6;} fi fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache @@ -6648,7 +7153,7 @@ U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" @@ -6665,8 +7170,8 @@ LTLIBOBJS=$ac_ltlibobjs ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL @@ -6689,14 +7194,16 @@ cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else +else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -6706,46 +7213,46 @@ esac fi + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then +if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -6754,13 +7261,6 @@ if test "${PATH_SEPARATOR+set}" != set; then fi -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -6769,8 +7269,12 @@ case $0 in #(( for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS @@ -6782,30 +7286,10 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] @@ -6818,13 +7302,14 @@ as_fn_error () as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $2" >&2 + printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -6851,18 +7336,20 @@ as_fn_unset () { eval $1=; unset $1;} } as_unset=as_fn_unset + # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : eval 'as_fn_append () { eval $1+=\$2 }' -else +else $as_nop as_fn_append () { eval $1=\$$1\$2 @@ -6874,12 +7361,13 @@ fi # as_fn_append # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else +else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` @@ -6910,7 +7398,7 @@ as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -6932,6 +7420,10 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -6945,6 +7437,12 @@ case `echo -n x` in #((((( ECHO_N='-n';; esac +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -6986,7 +7484,7 @@ as_fn_mkdir_p () as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -6995,7 +7493,7 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | +printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -7057,8 +7555,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by bmake $as_me 20211020, which was -generated by GNU Autoconf 2.69. Invocation command line was +This file was extended by bmake $as_me 20220909, which was +generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -7116,14 +7614,16 @@ $config_headers Report bugs to ." _ACEOF +ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` +ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -bmake config.status 20211020 -configured by $0, generated by GNU Autoconf 2.69, +bmake config.status 20220909 +configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2021 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -7161,15 +7661,15 @@ do -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; + printf "%s\n" "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; + printf "%s\n" "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" @@ -7177,7 +7677,7 @@ do --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; @@ -7186,7 +7686,7 @@ do as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; + printf "%s\n" "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; @@ -7214,7 +7714,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" @@ -7228,7 +7728,7 @@ exec 5>>config.log sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX - $as_echo "$ac_log" + printf "%s\n" "$ac_log" } >&5 _ACEOF @@ -7254,8 +7754,8 @@ done # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files + test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers fi # Have a temporary directory for convenience. Make it in the build tree @@ -7591,7 +8091,7 @@ do esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done @@ -7599,17 +8099,17 @@ do # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | + ac_sed_conf_input=`printf "%s\n" "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac @@ -7626,7 +8126,7 @@ $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | +printf "%s\n" X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -7650,9 +8150,9 @@ $as_echo X"$ac_file" | case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -7709,8 +8209,8 @@ ac_sed_dataroot=' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' @@ -7753,9 +8253,9 @@ test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" @@ -7771,20 +8271,20 @@ which seems to be undefined. Please make sure it is defined" >&2;} # if test x"$ac_file" != x-; then { - $as_echo "/* $configure_input */" \ + printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 -$as_echo "$as_me: $ac_file is unchanged" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else - $as_echo "/* $configure_input */" \ + printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi @@ -7825,8 +8325,8 @@ if test "$no_create" != yes; then $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi cat <&6 AC_SUBST(bmake_path_max)dnl dnl -dnl AC_C_CROSS -dnl dnl if type does not work which(1) had better! dnl note we cannot rely on type returning non-zero on failure if (type cat) > /dev/null 2>&1; then @@ -254,8 +250,15 @@ AC_TYPE_OFF_T AC_TYPE_PID_T AC_TYPE_SIZE_T AC_TYPE_UINT32_T -AC_DECL_SYS_SIGLIST -AC_HEADER_TIME +AC_CHECK_DECLS([sys_siglist],[],[],[#include +/* NetBSD declares sys_siglist in unistd.h. */ +#ifdef HAVE_UNISTD_H +# include +#endif +]) + +AC_CHECK_HEADERS_ONCE([sys/time.h]) + AC_STRUCT_TM dnl we need sig_atomic_t @@ -269,8 +272,7 @@ AC_CHECK_TYPES([sig_atomic_t],[],[], ]) dnl Checks for library functions. -AC_TYPE_SIGNAL -AC_FUNC_VFORK +AC_FUNC_FORK AC_FUNC_VPRINTF AC_FUNC_WAIT3 dnl Keep this list sorted @@ -334,7 +336,6 @@ dnl dnl Structures dnl AC_HEADER_STAT -AC_STRUCT_ST_RDEV dnl echo "checking if compiler supports __func__" >&6 AC_LANG(C) @@ -373,7 +374,7 @@ machine_arch=MACHINE_ARCH EOF default_machine=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep machine= | tr -d ' "'` + grep machine= | tr -d ' "'` rm -rf conftest* if test "$default_machine"; then eval "$default_machine" @@ -515,6 +516,13 @@ AC_DEFINE_UNQUOTED(DEFSHELL_PATH, "$defshell_path", Path of default shell) ;; esac dnl +dnl Some systems have deprecated egrep in favor of grep -E +case "`echo bmake | egrep 'a|b' 2>&1`" in +bmake) egrep=egrep;; +*) egrep='grep -E';; +esac +dnl +AC_SUBST(egrep) AC_SUBST(machine) AC_SUBST(force_machine) AC_SUBST(machine_arch) @@ -546,7 +554,8 @@ $srcdir/obj*) # make sure we put unit-tests/Makefile.config in the right place ;; esac -AC_OUTPUT($bm_outfiles) +AC_CONFIG_FILES([$bm_outfiles]) +AC_OUTPUT cat <dirs.first; ln != NULL; ln = ln->next) { + CachedDir *dir = ln->datum; + Global_Append(".SYSPATH", dir->name); + } + Var_ReadOnly(".SYSPATH", true); +} + /* * See if the given name has any wildcard characters in it and all braces and * brackets are properly balanced. diff --git a/contrib/bmake/dir.h b/contrib/bmake/dir.h index 3d98fb0201b4..09cbca8ec4c1 100644 --- a/contrib/bmake/dir.h +++ b/contrib/bmake/dir.h @@ -1,4 +1,4 @@ -/* $NetBSD: dir.h,v 1.46 2021/12/15 12:08:25 rillig Exp $ */ +/* $NetBSD: dir.h,v 1.47 2023/01/24 00:24:02 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -82,6 +82,7 @@ void Dir_InitCur(const char *); void Dir_InitDot(void); void Dir_End(void); void Dir_SetPATH(void); +void Dir_SetSYSPATH(void); bool Dir_HasWildcards(const char *) MAKE_ATTR_USE; void SearchPath_Expand(SearchPath *, const char *, StringList *); char *Dir_FindFile(const char *, SearchPath *) MAKE_ATTR_USE; diff --git a/contrib/bmake/find_lib.sh b/contrib/bmake/find_lib.sh index 3c2e4af2f251..f6419bb85da2 100755 --- a/contrib/bmake/find_lib.sh +++ b/contrib/bmake/find_lib.sh @@ -1,6 +1,13 @@ : re=$1; shift +# some Linux systems have deprecated egrep in favor of grep -E +# but not everyone supports that +case "`echo bmake | egrep 'a|b' 2>&1`" in +bmake) ;; +*) egrep() { grep -E "$@"; } +esac + for lib in $* do found=`nm $lib | egrep "$re"` diff --git a/contrib/bmake/for.c b/contrib/bmake/for.c index 65cb612fdc5b..bbe6171326f4 100644 --- a/contrib/bmake/for.c +++ b/contrib/bmake/for.c @@ -1,4 +1,4 @@ -/* $NetBSD: for.c,v 1.168 2022/06/12 16:09:21 rillig Exp $ */ +/* $NetBSD: for.c,v 1.170 2022/09/03 00:50:07 rillig Exp $ */ /* * Copyright (c) 1992, The Regents of the University of California. @@ -58,7 +58,7 @@ #include "make.h" /* "@(#)for.c 8.1 (Berkeley) 6/6/93" */ -MAKE_RCSID("$NetBSD: for.c,v 1.168 2022/06/12 16:09:21 rillig Exp $"); +MAKE_RCSID("$NetBSD: for.c,v 1.170 2022/09/03 00:50:07 rillig Exp $"); typedef struct ForLoop { @@ -490,6 +490,13 @@ For_NextIteration(ForLoop *f, Buffer *body) return true; } +/* Break out of the .for loop. */ +void +For_Break(ForLoop *f) +{ + f->nextItem = (unsigned int)f->items.len; +} + /* Run the .for loop, imitating the actions of an include file. */ void For_Run(unsigned headLineno, unsigned bodyReadLines) diff --git a/contrib/bmake/job.c b/contrib/bmake/job.c index 01f864176677..b9b5a5d36e47 100644 --- a/contrib/bmake/job.c +++ b/contrib/bmake/job.c @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.453 2022/05/07 08:01:20 rillig Exp $ */ +/* $NetBSD: job.c,v 1.457 2023/01/17 21:35:19 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -155,7 +155,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.453 2022/05/07 08:01:20 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.457 2023/01/17 21:35:19 christos Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -541,7 +541,7 @@ JobDeleteTarget(GNode *gn) return; file = GNode_Path(gn); - if (unlink_file(file)) + if (unlink_file(file) == 0) Error("*** %s removed", file); } @@ -761,7 +761,8 @@ ParseCommandFlags(char **pp, CommandFlags *out_cmdFlags) out_cmdFlags->ignerr = true; else if (*p == '+') out_cmdFlags->always = true; - else + else if (!ch_isspace(*p)) + /* Ignore whitespace for compatibility with gnu make */ break; p++; } @@ -1868,46 +1869,36 @@ CollectOutput(Job *job, bool finish) if (nRead < 0) { if (errno == EAGAIN) return; - if (DEBUG(JOB)) { + if (DEBUG(JOB)) perror("CollectOutput(piperead)"); - } nr = 0; - } else { + } else nr = (size_t)nRead; - } + + if (nr == 0) + finish = false; /* stop looping */ /* * If we hit the end-of-file (the job is dead), we must flush its * remaining output, so pretend we read a newline if there's any * output remaining in the buffer. - * Also clear the 'finish' flag so we stop looping. */ if (nr == 0 && job->curPos != 0) { job->outBuf[job->curPos] = '\n'; nr = 1; - finish = false; - } else if (nr == 0) { - finish = false; } - /* - * Look for the last newline in the bytes we just got. If there is - * one, break out of the loop with 'i' as its index and gotNL set - * true. - */ max = job->curPos + nr; + for (i = job->curPos; i < max; i++) + if (job->outBuf[i] == '\0') + job->outBuf[i] = ' '; + + /* Look for the last newline in the bytes we just got. */ for (i = job->curPos + nr - 1; i >= job->curPos && i != (size_t)-1; i--) { if (job->outBuf[i] == '\n') { gotNL = true; break; - } else if (job->outBuf[i] == '\0') { - /* - * FIXME: The null characters are only replaced with - * space _after_ the last '\n'. Everywhere else they - * hide the rest of the command output. - */ - job->outBuf[i] = ' '; } } diff --git a/contrib/bmake/machine.sh b/contrib/bmake/machine.sh index 0cf9daeeef3a..14fc5269ad40 100755 --- a/contrib/bmake/machine.sh +++ b/contrib/bmake/machine.sh @@ -1,10 +1,12 @@ : -# derrived from /etc/rc_d/os.sh +# This is mostly redundant. +# These days I use the pseudo machine "host" when building for host +# and $TARGET_HOST for its objdir # RCSid: -# $Id: machine.sh,v 1.18 2017/08/13 19:11:28 sjg Exp $ +# $Id: machine.sh,v 1.19 2023/01/17 18:30:21 sjg Exp $ # -# @(#) Copyright (c) 1994-2002 Simon J. Gerraty +# @(#) Copyright (c) 1994-2023 Simon J. Gerraty # # This file is provided in the hope that it will # be of use. There is absolutely NO WARRANTY. @@ -17,82 +19,23 @@ # sjg@crufty.net # -OS=`uname` -OSREL=`uname -r` -OSMAJOR=`IFS=.; set $OSREL; echo $1` -machine=`uname -p 2>/dev/null || uname -m` -MACHINE= - -# there is at least one case of `uname -p` outputting -# a bunch of usless drivel -case "$machine" in -unknown|*[!A-Za-z0-9_-]*) - machine=`uname -m` - ;; -esac - -# Great! Solaris keeps moving arch(1) -# we need this here, and it is not always available... -Which() { - # some shells cannot correctly handle `IFS` - # in conjunction with the for loop. - _dirs=`IFS=:; echo ${2:-$PATH}` - for d in $_dirs - do - test -x $d/$1 && { echo $d/$1; break; } - done -} +# leverage os.sh +Mydir=`dirname $0` +. $Mydir/os.sh +# some further overrides - mostly for MACHINE_ACH case $OS in AIX) # from http://gnats.netbsd.org/29386 - OSMAJOR=`uname -v` - OSMINOR=`uname -r` - MACHINE=$OS$OSMAJOR.$OSMINOR MACHINE_ARCH=`bootinfo -T` ;; -OpenBSD) - MACHINE=$OS$OSMAJOR.$machine - arch=`Which arch /usr/bin:/usr/ucb:$PATH` - MACHINE_ARCH=`$arch -s`; - ;; Bitrig) - MACHINE=$OS$OSMAJOR.$machine - MACHINE_ARCH=`uname -m`; - ;; -*BSD) - MACHINE=$OS$OSMAJOR.$machine - ;; -SunOS) - arch=`Which arch /usr/bin:/usr/ucb:$PATH` - test "$arch" && machine_arch=`$arch` - - case "$OSREL" in - 4.0*) MACHINE_ARCH=$machine_arch MACHINE=$machine_arch;; - 4*) MACHINE_ARCH=$machine_arch;; - esac + MACHINE_ARCH=$MACHINE; ;; HP-UX) - MACHINE_ARCH=`IFS="/-."; set $machine; echo $1` + MACHINE_ARCH=`IFS="/-."; set $MACHINE; echo $1` ;; -Interix) - MACHINE=i386 - MACHINE_ARCH=i386 - ;; -UnixWare) - OSREL=`uname -v` - OSMAJOR=`IFS=.; set $OSREL; echo $1` - MACHINE_ARCH=`uname -m` - ;; -Linux) - case "$machine" in - i?86) MACHINE_ARCH=i386;;# does anyone really care about 686 vs 586? - esac - ;; esac -MACHINE=${MACHINE:-$OS$OSMAJOR} -MACHINE_ARCH=${MACHINE_ARCH:-$machine} - ( case "$0" in arch*) echo $MACHINE_ARCH;; @@ -103,4 +46,4 @@ arch*) echo $MACHINE_ARCH;; esac ;; esac -) | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz +) | toLower diff --git a/contrib/bmake/main.c b/contrib/bmake/main.c index b6401ee39959..23350b49e536 100644 --- a/contrib/bmake/main.c +++ b/contrib/bmake/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.582 2022/05/07 17:49:47 rillig Exp $ */ +/* $NetBSD: main.c,v 1.589 2023/01/26 20:48:17 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,7 +111,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.582 2022/05/07 17:49:47 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.589 2023/01/26 20:48:17 sjg Exp $"); #if defined(MAKE_NATIVE) && !defined(lint) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -432,6 +432,7 @@ MainParseArgSysInc(const char *argvalue) } Global_Append(MAKEFLAGS, "-m"); Global_Append(MAKEFLAGS, argvalue); + Dir_SetSYSPATH(); } static bool @@ -722,8 +723,10 @@ Main_SetObjdir(bool writable, const char *fmt, ...) va_end(ap); if (path[0] != '/') { - snprintf(buf2, MAXPATHLEN, "%s/%s", curdir, path); - path = buf2; + if (snprintf(buf2, MAXPATHLEN, "%s/%s", curdir, path) <= MAXPATHLEN) + path = buf2; + else + return false; } /* look for the directory and try to chdir there */ @@ -1370,19 +1373,19 @@ main_Init(int argc, char **argv) */ Targ_Init(); Var_Init(); - Global_Set(".MAKE.OS", utsname.sysname); + Global_Set_ReadOnly(".MAKE.OS", utsname.sysname); Global_Set("MACHINE", machine); Global_Set("MACHINE_ARCH", machine_arch); #ifdef MAKE_VERSION Global_Set("MAKE_VERSION", MAKE_VERSION); #endif - Global_Set(".newline", "\n"); /* handy for :@ loops */ + Global_Set_ReadOnly(".newline", "\n"); /* handy for :@ loops */ #ifndef MAKEFILE_PREFERENCE_LIST /* This is the traditional preference for makefiles. */ # define MAKEFILE_PREFERENCE_LIST "makefile Makefile" #endif Global_Set(MAKE_MAKEFILE_PREFERENCE, MAKEFILE_PREFERENCE_LIST); - Global_Set(MAKE_DEPENDFILE, ".depend"); + Global_Set(".MAKE.DEPENDFILE", ".depend"); CmdOpts_Init(); allPrecious = false; /* Remove targets when interrupted */ @@ -1410,7 +1413,7 @@ main_Init(int argc, char **argv) Global_Set(MAKEOVERRIDES, ""); Global_Set("MFLAGS", ""); Global_Set(".ALLTARGETS", ""); - Var_Set(SCOPE_CMDLINE, MAKE_LEVEL ".ENV", MAKE_LEVEL_ENV); + Var_Set(SCOPE_CMDLINE, ".MAKE.LEVEL.ENV", MAKE_LEVEL_ENV); /* Set some other useful variables. */ { @@ -1422,13 +1425,13 @@ main_Init(int argc, char **argv) snprintf(buf, sizeof buf, "%d", makelevel); Global_Set(MAKE_LEVEL, buf); snprintf(buf, sizeof buf, "%u", myPid); - Global_Set(".MAKE.PID", buf); + Global_Set_ReadOnly(".MAKE.PID", buf); snprintf(buf, sizeof buf, "%u", getppid()); - Global_Set(".MAKE.PPID", buf); + Global_Set_ReadOnly(".MAKE.PPID", buf); snprintf(buf, sizeof buf, "%u", getuid()); - Global_Set(".MAKE.UID", buf); + Global_Set_ReadOnly(".MAKE.UID", buf); snprintf(buf, sizeof buf, "%u", getgid()); - Global_Set(".MAKE.GID", buf); + Global_Set_ReadOnly(".MAKE.GID", buf); } if (makelevel > 0) { char pn[1024]; @@ -1502,6 +1505,10 @@ static void main_ReadFiles(void) { + if (Lst_IsEmpty(&sysIncPath->dirs)) + SearchPath_AddAll(sysIncPath, defSysIncPath); + + Dir_SetSYSPATH(); if (!opts.noBuiltins) ReadBuiltinRules(); @@ -1906,19 +1913,23 @@ Finish(int errs) Fatal("%d error%s", errs, errs == 1 ? "" : "s"); } -bool +int unlink_file(const char *file) { struct stat st; if (lstat(file, &st) == -1) - return false; + return -1; if (S_ISDIR(st.st_mode)) { + /* + * POSIX says for unlink: "The path argument shall not name + * a directory unless [...]". + */ errno = EISDIR; - return false; + return -1; } - return unlink(file) == 0; + return unlink(file); } static void diff --git a/contrib/bmake/make.1 b/contrib/bmake/make.1 index 9accbaae9f61..5a28d2f83ca3 100644 --- a/contrib/bmake/make.1 +++ b/contrib/bmake/make.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.315 2022/07/12 23:47:00 rillig Exp $ +.\" $NetBSD: make.1,v 1.360 2023/01/26 20:48:17 sjg Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd July 12, 2022 +.Dd January 26, 2023 .Dt MAKE 1 .Os .Sh NAME @@ -49,8 +49,8 @@ .Op Fl T Ar file .Op Fl V Ar variable .Op Fl v Ar variable -.Op Ar variable=value -.Op Ar target ... +.Op Ar variable\| Ns Cm \&= Ns Ar value +.Op Ar target No ... .Sh DESCRIPTION .Nm is a program designed to simplify the maintenance of other programs. @@ -58,34 +58,35 @@ Its input is a list of specifications as to the files upon which programs and other files depend. If no .Fl f Ar makefile -makefile option is given, +option is given, .Nm -will try to open +tries to open .Sq Pa makefile then .Sq Pa Makefile in order to find the specifications. If the file .Sq Pa .depend -exists, it is read (see -.Xr mkdep 1 ) . +exists, it is read, see +.Xr mkdep 1 . .Pp This manual page is intended as a reference document only. For a more thorough description of .Nm and makefiles, please refer to -.%T "PMake \- A Tutorial" . +.%T "PMake \- A Tutorial" +(from 1993). .Pp .Nm -will prepend the contents of the -.Va MAKEFLAGS +prepends the contents of the +.Ev MAKEFLAGS environment variable to the command line arguments before parsing them. .Pp The options are as follows: .Bl -tag -width Ds .It Fl B Try to be backwards compatible by executing a single shell per command and -by executing the commands to make the sources of a dependency line in sequence. +by making the sources of a dependency line in sequence. .It Fl C Ar directory Change to .Ar directory @@ -100,92 +101,97 @@ is equivalent to Define .Ar variable to be 1, in the global scope. -.It Fl d Ar [-]flags +.It Fl d Oo Cm \- Oc Ns Ar flags Turn on debugging, and specify which portions of .Nm are to print debugging information. Unless the flags are preceded by -.Ql \- +.Ql \- , they are added to the -.Va MAKEFLAGS -environment variable and will be processed by any child make processes. +.Ev MAKEFLAGS +environment variable and are passed on to any child make processes. By default, debugging information is printed to standard error, but this can be changed using the -.Ar F +.Cm F debugging flag. The debugging output is always unbuffered; in addition, if debugging is enabled but debugging output is not directed to standard output, -then the standard output is line buffered. -.Ar Flags -is one or more of the following: +the standard output is line buffered. +The available +.Ar flags +are: .Bl -tag -width Ds -.It Ar A +.It Cm A Print all possible debugging information; equivalent to specifying all of the debugging flags. -.It Ar a +.It Cm a Print debugging information about archive searching and caching. -.It Ar C -Print debugging information about current working directory. -.It Ar c +.It Cm C +Print debugging information about the current working directory. +.It Cm c Print debugging information about conditional evaluation. -.It Ar d +.It Cm d Print debugging information about directory searching and caching. -.It Ar e +.It Cm e Print debugging information about failed commands and targets. -.It Ar F Ns Oo Sy \&+ Oc Ns Ar filename +.It Cm F Ns Oo Cm \&+ Oc Ns Ar filename Specify where debugging output is written. This must be the last flag, because it consumes the remainder of the argument. If the character immediately after the -.Ql F +.Cm F flag is .Ql \&+ , -then the file will be opened in append mode; -otherwise the file will be overwritten. +the file is opened in append mode; +otherwise the file is overwritten. If the file name is .Ql stdout or -.Ql stderr -then debugging output will be written to the -standard output or standard error output file descriptors respectively -(and the +.Ql stderr , +debugging output is written to the standard output or standard error output +respectively (and the .Ql \&+ option has no effect). -Otherwise, the output will be written to the named file. -If the file name ends -.Ql .%d -then the +Otherwise, the output is written to the named file. +If the file name ends with +.Ql .%d , +the .Ql %d is replaced by the pid. -.It Ar f +.It Cm f Print debugging information about loop evaluation. -.It Ar "g1" +.It Cm g1 Print the input graph before making anything. -.It Ar "g2" +.It Cm g2 Print the input graph after making everything, or before exiting on error. -.It Ar "g3" +.It Cm g3 Print the input graph before exiting on error. -.It Ar h +.It Cm h Print debugging information about hash table operations. -.It Ar j +.It Cm j Print debugging information about running multiple shells. -.It Ar L +.It Cm L Turn on lint checks. -This will throw errors for variable assignments that do not parse -correctly, at the time of assignment so the file and line number -are available. -.It Ar l +This throws errors for variable assignments that do not parse correctly, +at the time of assignment, so the file and line number are available. +.It Cm l Print commands in Makefiles regardless of whether or not they are prefixed by .Ql @ -or other "quiet" flags. -Also known as "loud" behavior. -.It Ar M -Print debugging information about "meta" mode decisions about targets. -.It Ar m +or other +.Dq quiet +flags. +Also known as +.Dq loud +behavior. +.It Cm M +Print debugging information about +.Dq meta +mode decisions about targets. +.It Cm m Print debugging information about making targets, including modification dates. -.It Ar n +.It Cm n Don't delete the temporary command scripts created when running commands. These temporary scripts are created in the directory referred to by the @@ -205,35 +211,36 @@ This can create many files in or .Pa /tmp , so use with care. -.It Ar p +.It Cm p Print debugging information about makefile parsing. -.It Ar s +.It Cm s Print debugging information about suffix-transformation rules. -.It Ar t +.It Cm t Print debugging information about target list maintenance. -.It Ar V +.It Cm V Force the .Fl V -option to print raw values of variables, overriding the default behavior -set via +option to print raw values of variables, +overriding the default behavior set via .Va .MAKE.EXPAND_VARIABLES . -.It Ar v -Print debugging information about variable assignment. -.It Ar x +.It Cm v +Print debugging information about variable assignment and expansion. +.It Cm x Run shell commands with .Fl x so the actual commands are printed as they are executed. .El .It Fl e -Specify that environment variables override macro assignments within -makefiles. +Let environment variables override global variables within makefiles. .It Fl f Ar makefile Specify a makefile to read instead of the default -.Sq Pa makefile . +.Pa makefile +or +.Pa Makefile . If .Ar makefile is -.Sq Fl , +.Ql \&- , standard input is read. Multiple makefiles may be specified, and are read in the order specified. .It Fl I Ar directory @@ -244,7 +251,7 @@ option) is automatically included as part of this list. .It Fl i Ignore non-zero exit of shell commands in the makefile. Equivalent to specifying -.Sq Fl +.Ql \&- before each command line in the makefile. .It Fl J Ar private This option should @@ -277,56 +284,61 @@ compatibility on. Continue processing after errors are encountered, but only on those targets that do not depend on the target whose creation caused the error. .It Fl m Ar directory -Specify a directory in which to search for sys.mk and makefiles included -via the +Specify a directory in which to search for +.Pa sys.mk +and makefiles included via the .Li \&< Ns Ar file Ns Li \&> Ns -style include statement. The .Fl m option can be used multiple times to form a search path. -This path will override the default system include path: /usr/share/mk. -Furthermore the system include path will be appended to the search path used -for +This path overrides the default system include path +.Pa /usr/share/mk . +Furthermore, the system include path is appended to the search path used for .Li \*q Ns Ar file Ns Li \*q Ns -style include statements (see the .Fl I option). +The system include path can be referenced via the read-only variable +.Va .SYSPATH . .Pp -If a file or directory name in the +If a directory name in the .Fl m argument (or the .Ev MAKESYSPATH environment variable) starts with the string -.Qq \&.../ -then +.Ql \&.../ , .Nm -will search for the specified file or directory named in the remaining part +searches for the specified file or directory named in the remaining part of the argument string. -The search starts with the current directory of -the Makefile and then works upward towards the root of the file system. -If the search is successful, then the resulting directory replaces the -.Qq \&.../ +The search starts with the current directory +and then works upward towards the root of the file system. +If the search is successful, the resulting directory replaces the +.Ql \&.../ specification in the .Fl m argument. -If used, this feature allows +This feature allows .Nm -to easily search in the current source tree for customized sys.mk files -(e.g., by using -.Qq \&.../mk/sys.mk +to easily search in the current source tree for customized +.Pa sys.mk +files (e.g., by using +.Ql \&.../mk/sys.mk as an argument). .It Fl n Display the commands that would have been executed, but do not -actually execute them unless the target depends on the .MAKE special -source (see below) or the command is prefixed with -.Sq Ic + . +actually execute them unless the target depends on the +.Va .MAKE +special source (see below) or the command is prefixed with +.Sq Cm + . .It Fl N -Display the commands which would have been executed, but do not -actually execute any of them; useful for debugging top-level makefiles +Display the commands that would have been executed, +but do not actually execute any of them; +useful for debugging top-level makefiles without descending into subdirectories. .It Fl q -Do not execute any commands, but exit 0 if the specified targets are -up-to-date and 1, otherwise. +Do not execute any commands, +instead exit 0 if the specified targets are up to date, and 1 otherwise. .It Fl r Do not use the built-in rules specified in the system makefile. .It Fl S @@ -353,24 +365,25 @@ Print the value of .Ar variable . Do not build any targets. Multiple instances of this option may be specified; -the variables will be printed one per line, +the variables are printed one per line, with a blank line for each null or undefined variable. The value printed is extracted from the global scope after all makefiles have been read. +.Pp By default, the raw variable contents (which may include additional unexpanded variable references) are shown. If .Ar variable contains a -.Ql \&$ -then the value will be recursively expanded to its complete resultant -text before printing. -The expanded value will also be printed if +.Ql \&$ , +it is not interpreted as a variable name but rather as an expression. +Its value is expanded before printing. +The value is also expanded before printing if .Va .MAKE.EXPAND_VARIABLES -is set to true and -the +is set to true and the .Fl dV option has not been used to override it. +.Pp Note that loop-local and target-local variables, as well as values taken temporarily by global variables during makefile processing, are not accessible via this option. @@ -380,8 +393,13 @@ debug mode can be used to see these at the cost of generating substantial extraneous output. .It Fl v Ar variable Like +.Fl V , +but all printed variables are always expanded to their complete value. +The last occurrence of .Fl V -but the variable is always expanded to its complete value. +or +.Fl v +decides whether all variables are expanded or not. .It Fl W Treat any warnings during makefile parsing as errors. .It Fl w @@ -389,13 +407,12 @@ Print entering and leaving directory messages, pre and post processing. .It Fl X Don't export variables passed on the command line to the environment individually. -Variables passed on the command line are still exported -via the -.Va MAKEFLAGS +Variables passed on the command line are still exported via the +.Ev MAKEFLAGS environment variable. This option may be useful on systems which have a small limit on the size of command arguments. -.It Ar variable=value +.It Ar variable\| Ns Cm \&= Ns Ar value Set the value of the variable .Ar variable to @@ -409,12 +426,12 @@ Variable assignments should follow options for POSIX compatibility but no ordering is enforced. .El .Pp -There are seven different types of lines in a makefile: file dependency +There are several different types of lines in a makefile: dependency specifications, shell commands, variable assignments, include statements, -conditional directives, for loops, and comments. +conditional directives, for loops, other directives, and comments. .Pp -In general, lines may be continued from one line to the next by ending -them with a backslash +Lines may be continued from one line to the next +by ending them with a backslash .Pq Ql \e . The trailing newline character and initial whitespace on the following line are compressed into a single space. @@ -423,11 +440,10 @@ Dependency lines consist of one or more targets, an operator, and zero or more sources. This creates a relationship where the targets .Dq depend -on the sources -and are customarily created from them. -A target is considered out-of-date if it does not exist, or if its -modification time is less than that of any of its sources. -An out-of-date target will be re-created, but not until all sources +on the sources and are customarily created from them. +A target is considered out of date if it does not exist, +or if its modification time is less than that of any of its sources. +An out-of-date target is re-created, but not until all sources have been examined and themselves re-created as needed. Three operators may be used: .Bl -tag -width flag @@ -451,15 +467,16 @@ shell commands are run if the target is out of date with respect to Thus, different groups of the attached shell commands may be run depending on the circumstances. Furthermore, unlike -.Ic \&:, +.Ic \&: , for dependency lines with no sources, the attached shell commands are always run. Also unlike -.Ic \&:, -the target will not be removed if +.Ic \&: , +the target is not removed if .Nm is interrupted. .El +.Pp All dependency lines mentioning a particular target must use the same operator. .Pp @@ -474,123 +491,115 @@ The values .Ql * , and .Ql [] -may only be used as part of the final -component of the target or source, and must be used to describe existing -files. +may only be used as part of the final component of the target or source, +and only match existing files. The value .Ql {} need not necessarily be used to describe existing files. Expansion is in directory order, not alphabetically as done in the shell. .Sh SHELL COMMANDS -Each target may have associated with it one or more lines of shell -commands, normally -used to create the target. +Each target may have associated with it one or more lines of shell commands, +normally used to create the target. Each of the lines in this script .Em must be preceded by a tab. (For historical reasons, spaces are not accepted.) -While targets can appear in many dependency lines if desired, by -default only one of these rules may be followed by a creation -script. +While targets can occur in many dependency lines if desired, +by default only one of these rules may be followed by a creation script. If the .Sq Ic \&:: -operator is used, however, all rules may include scripts and the -scripts are executed in the order found. +operator is used, however, all rules may include scripts, +and the respective scripts are executed in the order found. .Pp -Each line is treated as a separate shell command, unless the end of -line is escaped with a backslash -.Pq Ql \e +Each line is treated as a separate shell command, +unless the end of line is escaped with a backslash +.Ql \e , in which case that line and the next are combined. -.\" The escaped newline is retained and passed to the shell, which -.\" normally ignores it. -.\" However, the tab at the beginning of the following line is removed. If the first characters of the command are any combination of .Sq Ic @ , .Sq Ic + , or .Sq Ic \- , the command is treated specially. -A -.Sq Ic @ +.Bl -tag -offset indent -width indent +.It Ic @ causes the command not to be echoed before it is executed. -A -.Sq Ic + +.It Ic + causes the command to be executed even when .Fl n is given. -This is similar to the effect of the .MAKE special source, +This is similar to the effect of the +.Va .MAKE +special source, except that the effect can be limited to a single line of a script. -A -.Sq Ic \- +.It Ic \- in compatibility mode causes any non-zero exit status of the command line to be ignored. +.El .Pp When .Nm is run in jobs mode with .Fl j Ar max_jobs , -the entire script for the target is fed to a -single instance of the shell. +the entire script for the target is fed to a single instance of the shell. In compatibility (non-jobs) mode, each command is run in a separate process. If the command contains any shell meta characters -.Pq Ql #=|^(){};&<>*?[]:$`\e\en -it will be passed to the shell; otherwise +.Pq Ql #=|^(){};&<>*?[]:$`\e\en , +it is passed to the shell; otherwise .Nm -will attempt direct execution. +attempts direct execution. If a line starts with .Sq Ic \- -and the shell has ErrCtl enabled then failure of the command line -will be ignored as in compatibility mode. +and the shell has ErrCtl enabled, +failure of the command line is ignored as in compatibility mode. Otherwise .Sq Ic \- affects the entire job; -the script will stop at the first command line that fails, -but the target will not be deemed to have failed. +the script stops at the first command line that fails, +but the target is not deemed to have failed. .Pp Makefiles should be written so that the mode of .Nm operation does not change their behavior. -For example, any command which needs to use +For example, any command which uses .Dq cd or .Dq chdir -without potentially changing the directory for subsequent commands +without the intention of changing the directory for subsequent commands should be put in parentheses so it executes in a subshell. -To force the use of one shell, escape the line breaks so as to make +To force the use of a single shell, escape the line breaks so as to make the whole script one command. For example: .Bd -literal -offset indent avoid-chdir-side-effects: - @echo Building $@ in `pwd` + @echo "Building $@ in $$(pwd)" @(cd ${.CURDIR} && ${MAKE} $@) - @echo Back in `pwd` + @echo "Back in $$(pwd)" ensure-one-shell-regardless-of-mode: - @echo Building $@ in `pwd`; \e + @echo "Building $@ in $$(pwd)"; \e (cd ${.CURDIR} && ${MAKE} $@); \e - echo Back in `pwd` + echo "Back in $$(pwd)" .Ed .Pp Since .Nm -will -.Xr chdir 2 -to +changes the current working directory to .Sq Va .OBJDIR -before executing any targets, each child process -starts with that as its current working directory. +before executing any targets, +each child process starts with that as its current working directory. .Sh VARIABLE ASSIGNMENTS Variables in make behave much like macros in the C preprocessor. .Pp Variable assignments have the form .Sq Ar NAME Ar op Ar value , where: -.Bl -tag -width Ds +.Bl -tag -offset Ds -width Ds .It Ar NAME is a single-word variable name, consisting, by tradition, of all upper-case letters, .It Ar op -is one of the five variable assignment operators described below, and +is one of the variable assignment operators described below, and .It Ar value is interpreted according to the variable assignment operator. .El @@ -602,7 +611,7 @@ and .Ar value is discarded. .Ss Variable assignment operators -The five operators that can be used to assign values to variables are: +The five operators that assign values to variables are: .Bl -tag -width Ds .It Ic \&= Assign the value to the variable. @@ -613,39 +622,43 @@ separating them by a single space. .It Ic \&?= Assign the value to the variable if it is not already defined. .It Ic \&:= -Assign with expansion, i.e. expand the value before assigning it -to the variable. -Normally, expansion is not done until the variable is referenced. +Expand the value, then assign it to the variable. .Pp .Em NOTE : References to undefined variables are .Em not expanded. This can cause problems when variable modifiers are used. +.\" See var-op-expand.mk, the section with LATER and INDIRECT. .It Ic \&!= -Expand the value and pass it to the shell for execution and assign -the result to the variable. +Expand the value and pass it to the shell for execution, +then assign the output from the child's standard output to the variable. Any newlines in the result are replaced with spaces. .El .Ss Expansion of variables -In contexts where variables are expanded, +In most contexts where variables are expanded, .Ql \&$$ expands to a single dollar sign. +In other contexts (most variable modifiers, string literals in conditions), +.Ql \&\e$ +expands to a single dollar sign. +.Pp References to variables have the form -.Ql \&${ Ns Ar name Ns Oo \&: Ns Ar modifiers Oc Ns } +.Cm \&${ Ns Ar name Ns Oo Ns Cm \&: Ns Ar modifiers Oc Ns Cm \&} or -.Ql \&$( Ns Ar name Ns Oo \&: Ns Ar modifiers Oc Ns ) . -If the variable name contains only a single character, +.Cm \&$( Ns Ar name Ns Oo Ns Cm \&: Ns Ar modifiers Oc Ns Cm \&) . +If the variable name consists of only a single character +and the expression contains no modifiers, the surrounding curly braces or parentheses are not required. This shorter form is not recommended. .Pp -If the variable name contains a dollar, then the name itself is expanded first. +If the variable name contains a dollar, the name itself is expanded first. This allows almost arbitrary variable names, however names containing dollar, -braces, parentheses, or whitespace are really best avoided. +braces, parentheses or whitespace are really best avoided. .Pp -If the result of expanding a variable contains a dollar sign +If the result of expanding a nested variable expression contains a dollar sign .Pq Ql \&$ , -the string is expanded again. +the result is subject to further expansion. .Pp Variable substitution occurs at four distinct times, depending on where the variable is being used. @@ -659,38 +672,48 @@ but only as far as necessary to determine the result of the conditional. Variables in shell commands are expanded when the shell command is executed. .It -.Dq .for +.Ic .for loop index variables are expanded on each loop iteration. Note that other variables are not expanded when composing the body of a loop, so the following example code: .Bd -literal -offset indent - -.Dv .for i in 1 2 3 +\&.for i in 1 2 3 a+= ${i} j= ${i} b+= ${j} -.Dv .endfor +\&.endfor all: @echo ${a} @echo ${b} - .Ed -will print: +.Pp +prints: .Bd -literal -offset indent 1 2 3 3 3 3 - .Ed -Because while ${a} contains -.Dq 1 2 3 -after the loop is executed, ${b} +.Pp +After the loop is executed: +.Bl -tag -offset indent -width indent +.It Va a contains -.Dq ${j} ${j} ${j} +.Ql ${:U1} ${:U2} ${:U3} , which expands to -.Dq 3 3 3 -since after the loop completes ${j} contains -.Dq 3 . +.Ql 1 2 3 . +.It Va j +contains +.Ql ${:U3} , +which expands to +.Ql 3 . +.It Va b +contains +.Ql ${j} ${j} ${j} , +which expands to +.Ql ${:U3} ${:U3} ${:U3} +and further to +.Ql 3 3 3 . +.El .El .Ss Variable classes The four different classes of variables (in order of increasing precedence) @@ -708,12 +731,12 @@ Variables defined as part of the command line. Variables that are defined specific to a certain target. .El .Pp -Local variables can be set on a dependency line, if +Local variables can be set on a dependency line, unless .Va .MAKE.TARGET_LOCAL_VARIABLES -is not set to +is set to .Ql false . The rest of the line -(which will already have had global variables expanded) +(which already has had global variables expanded) is the variable value. For example: .Bd -literal -offset indent @@ -724,8 +747,10 @@ ${OBJS}: .MAKE.META.CMP_FILTER=${COMPILER_WRAPPERS:S,^,N,} .Pp Only the targets .Ql ${OBJS} -will be impacted by that filter (in "meta" mode) and -simply enabling/disabling any of the compiler wrappers will not render all +are impacted by that filter (in +.Dq meta +mode) and +simply enabling/disabling any of the compiler wrappers does not render all of those targets out-of-date. .Pp .Em NOTE : @@ -739,8 +764,8 @@ Is redundant with respect to global variables, which have already been expanded. .El .Pp -The seven built-in local variables are as follows: -.Bl -tag -width ".ARCHIVE" -offset indent +The seven built-in local variables are: +.Bl -tag -width ".Va .ARCHIVE" -offset indent .It Va .ALLSRC The list of all sources for this target; also known as .Sq Va \&> . @@ -766,25 +791,27 @@ The file prefix of the target, containing only the file portion, no suffix or preceding directory components; also known as .Sq Va * . The suffix must be one of the known suffixes declared with -.Ic .SUFFIXES -or it will not be recognized. +.Ic .SUFFIXES , +or it is not recognized. .It Va .TARGET The name of the target; also known as .Sq Va @ . For compatibility with other makes this is an alias for -.Ic .ARCHIVE +.Va .ARCHIVE in archive member rules. .El .Pp The shorter forms -.Ql ( Va > , +.Po +.Sq Va \&> , .Sq Va \&! , -.Sq Va < , -.Sq Va % , +.Sq Va \&< , +.Sq Va \&% , .Sq Va \&? , -.Sq Va * , +.Sq Va \&* , and -.Sq Va @ ) +.Sq Va \&@ +.Pc are permitted for backward compatibility with historical makefiles and legacy POSIX make and are not recommended. @@ -794,7 +821,7 @@ Variants of these variables with the punctuation followed immediately by or .Ql F , e.g.\& -.Sq Va $(@D) , +.Ql $(@D) , are legacy forms equivalent to using the .Ql :H and @@ -816,36 +843,61 @@ and In addition, .Nm sets or knows about the following variables: -.Bl -tag -width .MAKEOVERRIDES +.Bl -tag +.\" NB: This list is sorted case-insensitive, ignoring punctuation. +.\" NB: To find all built-in variables in make's source code, +.\" NB: search for Var_*, Global_*, SetVarObjdir, GetBooleanExpr, +.\" NB: and the implementation of Var_SetWithFlags. +.\" NB: Last synced on 2023-01-01. .It Va .ALLTARGETS -The list of all targets encountered in the Makefile. -If evaluated during -Makefile parsing, lists only those targets encountered thus far. +The list of all targets encountered in the makefiles. +If evaluated during makefile parsing, +lists only those targets encountered thus far. .It Va .CURDIR A path to the directory where .Nm was executed. Refer to the description of -.Sq Ev PWD +.Sq Va PWD for more details. +.It Va .ERROR_CMD +Is used in error handling, see +.Va MAKE_PRINT_VAR_ON_ERROR . +.It Va .ERROR_CWD +Is used in error handling, see +.Va MAKE_PRINT_VAR_ON_ERROR . +.It Va .ERROR_META_FILE +Is used in error handling in +.Dq meta +mode, see +.Va MAKE_PRINT_VAR_ON_ERROR . +.It Va .ERROR_TARGET +Is used in error handling, see +.Va MAKE_PRINT_VAR_ON_ERROR . .It Va .INCLUDEDFROMDIR -The directory of the file this Makefile was included from. +The directory of the file this makefile was included from. .It Va .INCLUDEDFROMFILE -The filename of the file this Makefile was included from. -.It Ev MAKE +The filename of the file this makefile was included from. +.\" .INCLUDES is intentionally undocumented, as it is obsolete. +.\" .LIBS is intentionally undocumented, as it is obsolete. +.It Va MACHINE +The machine hardware name, see +.Xr uname 1 . +.It Va MACHINE_ARCH +The machine processor architecture name, see +.Xr uname 1 . +.It Va MAKE The name that .Nm was executed with .Pq Va argv[0] . -For compatibility -.Nm -also sets -.Va .MAKE -with the same value. +.It Va .MAKE +The same as +.Va MAKE , +for compatibility. The preferred variable to use is the environment variable .Ev MAKE -because it is more compatible with other versions of -.Nm +because it is more compatible with other make variants and cannot be confused with the special target with the same name. .It Va .MAKE.ALWAYS_PASS_JOB_QUEUE Tells @@ -858,10 +910,16 @@ The default is for backwards compatability with .Fx 9.0 and earlier. +.\" '.MAKE.cmd_filtered' is intentionally undocumented, +.\" as it is an internal implementation detail. .It Va .MAKE.DEPENDFILE Names the makefile (default .Sq Pa .depend ) from which generated dependencies are read. +.It Va .MAKE.DIE_QUIETLY +If set to +.Ql true , +do not print error information at the end. .It Va .MAKE.EXPAND_VARIABLES A boolean that controls the default behavior of the .Fl V @@ -873,35 +931,10 @@ include additional unexpanded variable references) are shown. .It Va .MAKE.EXPORTED The list of variables exported by .Nm . -.It Va .MAKE.JOBS -The argument to the -.Fl j -option. -.It Va .MAKE.JOB.PREFIX -If -.Nm -is run with -.Fl j , -the output for each target is prefixed with a token -.Ql --- target --- -the first part of which can be controlled via -.Va .MAKE.JOB.PREFIX . -If -.Va .MAKE.JOB.PREFIX -is empty, no token is printed. -For example, setting -.Va .MAKE.JOB.PREFIX -to -.Li ${.newline}---${.MAKE:T}[${.MAKE.PID}] -would produce tokens like -.Ql ---make[1234] target --- -making it easier to track the degree of parallelism being achieved. -.It .MAKE.TARGET_LOCAL_VARIABLES -If set to -.Ql false , -apparent variable assignments in dependency lines are -treated as normal sources. -.It Ev MAKEFLAGS +.It Va MAKEFILE +The top-level makefile that is currently read, +as given in the command line. +.It Va .MAKEFLAGS The environment variable .Sq Ev MAKEFLAGS may contain anything that @@ -911,21 +944,49 @@ command line. Anything specified on .Nm Ns 's command line is appended to the -.Sq Ev MAKEFLAGS -variable which is then -entered into the environment for all programs which +.Va .MAKEFLAGS +variable, which is then added to the environment for all programs that .Nm executes. +.It Va .MAKE.GID +The numeric group ID of the user running +.Nm . +It is read-only. +.It Va .MAKE.JOB.PREFIX +If +.Nm +is run with +.Fl j , +the output for each target is prefixed with a token +.Dl --- Ar target Li --- +the first part of which can be controlled via +.Va .MAKE.JOB.PREFIX . +If +.Va .MAKE.JOB.PREFIX +is empty, no token is printed. +For example, setting +.Va .MAKE.JOB.PREFIX +to +.Ql ${.newline}---${.MAKE:T}[${.MAKE.PID}] +would produce tokens like +.Dl ---make[1234] Ar target Li --- +making it easier to track the degree of parallelism being achieved. +.It Va .MAKE.JOBS +The argument to the +.Fl j +option. .It Va .MAKE.LEVEL The recursion depth of .Nm . -The initial instance of +The top-level instance of .Nm -will be 0, and an incremented value is put into the environment -to be seen by the next generation. +has level 0, and each child make has its parent level plus 1. This allows tests like: .Li .if ${.MAKE.LEVEL} == 0 -to protect things which should only be evaluated in the initial instance of +to protect things which should only be evaluated in the top-level instance of +.Nm . +.It Va .MAKE.LEVEL.ENV +The name of the environment variable that stores the level of nested calls to .Nm . .It Va .MAKE.MAKEFILE_PREFERENCE The ordered list of makefile names @@ -934,79 +995,16 @@ The ordered list of makefile names .Sq Pa Makefile ) that .Nm -will look for. +looks for. .It Va .MAKE.MAKEFILES The list of makefiles read by .Nm , which is useful for tracking dependencies. Each makefile is recorded only once, regardless of the number of times read. -.It Va .MAKE.MODE -Processed after reading all makefiles. -Can affect the mode that -.Nm -runs in. -It can contain a number of keywords: -.Bl -hang -width missing-filemon=bf. -.It Pa compat -Like -.Fl B , -puts -.Nm -into "compat" mode. -.It Pa meta -Puts -.Nm -into "meta" mode, where meta files are created for each target -to capture the command run, the output generated and if -.Xr filemon 4 -is available, the system calls which are of interest to -.Nm . -The captured output can be very useful when diagnosing errors. -.It Pa curdirOk= Ar bf -Normally -.Nm -will not create .meta files in -.Sq Va .CURDIR . -This can be overridden by setting -.Va bf -to a value which represents True. -.It Pa missing-meta= Ar bf -If -.Va bf -is True, then a missing .meta file makes the target out-of-date. -.It Pa missing-filemon= Ar bf -If -.Va bf -is True, then missing filemon data makes the target out-of-date. -.It Pa nofilemon -Do not use -.Xr filemon 4 . -.It Pa env -For debugging, it can be useful to include the environment -in the .meta file. -.It Pa verbose -If in "meta" mode, print a clue about the target being built. -This is useful if the build is otherwise running silently. -The message printed the value of: -.Va .MAKE.META.PREFIX . -.It Pa ignore-cmd -Some makefiles have commands which are simply not stable. -This keyword causes them to be ignored for -determining whether a target is out of date in "meta" mode. -See also -.Ic .NOMETA_CMP . -.It Pa silent= Ar bf -If -.Va bf -is True, when a .meta file is created, mark the target -.Ic .SILENT . -.It Pa randomize-targets -In both compat and parallel mode, do not make the targets in the usual order, -but instead randomize their order. -This mode can be used to detect undeclared dependencies between files. -.El .It Va .MAKE.META.BAILIWICK -In "meta" mode, provides a list of prefixes which +In +.Dq meta +mode, provides a list of prefixes which match the directories controlled by .Nm . If a file that was generated outside of @@ -1014,21 +1012,30 @@ If a file that was generated outside of but within said bailiwick is missing, the current target is considered out-of-date. .It Va .MAKE.META.CMP_FILTER -In "meta" mode, it can (very rarely!) be useful to filter command +In +.Dq meta +mode, it can (very rarely!) be useful to filter command lines before comparison. -This variable can be set to a set of modifiers that will be applied to +This variable can be set to a set of modifiers that are applied to each line of the old and new command that differ, if the filtered commands still differ, the target is considered out-of-date. .It Va .MAKE.META.CREATED -In "meta" mode, this variable contains a list of all the meta files +In +.Dq meta +mode, this variable contains a list of all the meta files updated. If not empty, it can be used to trigger processing of .Va .MAKE.META.FILES . .It Va .MAKE.META.FILES -In "meta" mode, this variable contains a list of all the meta files +In +.Dq meta +mode, this variable contains a list of all the meta files used (updated or not). This list can be used to process the meta files to extract dependency information. +.It Va .MAKE.META.IGNORE_FILTER +Provides a list of variable modifiers to apply to each pathname. +Ignore if the expansion is an empty string. .It Va .MAKE.META.IGNORE_PATHS Provides a list of path prefixes that should be ignored; because the contents are expected to change over time. @@ -1037,13 +1044,105 @@ The default list includes: .It Va .MAKE.META.IGNORE_PATTERNS Provides a list of patterns to match against pathnames. Ignore any that match. -.It Va .MAKE.META.IGNORE_FILTER -Provides a list of variable modifiers to apply to each pathname. -Ignore if the expansion is an empty string. .It Va .MAKE.META.PREFIX -Defines the message printed for each meta file updated in "meta verbose" mode. +Defines the message printed for each meta file updated in +.Dq meta verbose +mode. The default value is: .Dl Building ${.TARGET:H:tA}/${.TARGET:T} +.It Va .MAKE.MODE +Processed after reading all makefiles. +Affects the mode that +.Nm +runs in. +It can contain these keywords: +.Bl -tag -width indent +.It Cm compat +Like +.Fl B , +puts +.Nm +into +.Dq compat +mode. +.It Cm meta +Puts +.Nm +into +.Dq meta +mode, where meta files are created for each target +to capture the command run, the output generated, and if +.Xr filemon 4 +is available, the system calls which are of interest to +.Nm . +The captured output can be useful when diagnosing errors. +.It Cm curdirOk= Ns Ar bf +By default, +.Nm +does not create +.Pa .meta +files in +.Sq Va .CURDIR . +This can be overridden by setting +.Ar bf +to a value which represents true. +.It Cm missing-meta= Ns Ar bf +If +.Ar bf +is true, a missing +.Pa .meta +file makes the target out-of-date. +.It Cm missing-filemon= Ns Ar bf +If +.Ar bf +is true, missing filemon data makes the target out-of-date. +.It Cm nofilemon +Do not use +.Xr filemon 4 . +.It Cm env +For debugging, it can be useful to include the environment +in the +.Pa .meta +file. +.It Cm verbose +If in +.Dq meta +mode, print a clue about the target being built. +This is useful if the build is otherwise running silently. +The message printed is the expanded value of +.Va .MAKE.META.PREFIX . +.It Cm ignore-cmd +Some makefiles have commands which are simply not stable. +This keyword causes them to be ignored for +determining whether a target is out of date in +.Dq meta +mode. +See also +.Ic .NOMETA_CMP . +.It Cm silent= Ns Ar bf +If +.Ar bf +is true, when a .meta file is created, mark the target +.Ic .SILENT . +.It Cm randomize-targets +In both compat and parallel mode, do not make the targets in the usual order, +but instead randomize their order. +This mode can be used to detect undeclared dependencies between files. +.El +.It Va MAKEOBJDIR +Used to create files in a separate directory, see +.Va .OBJDIR . +.It Va MAKE_OBJDIR_CHECK_WRITABLE +Used to force a separate directory for the created files, +even if that directory is not writable, see +.Va .OBJDIR . +.It Va MAKEOBJDIRPREFIX +Used to create files in a separate directory, see +.Va .OBJDIR . +.It Va .MAKE.OS +The name of the operating system, see +.Xr uname 1 . +It is read-only. .It Va .MAKEOVERRIDES This variable is used to record the names of variables assigned to on the command line, so that they may be exported as part of @@ -1066,13 +1165,36 @@ was built with support, this is set to the path of the device node. This allows makefiles to test for this support. .It Va .MAKE.PID -The process-id of +The process ID of .Nm . +It is read-only. .It Va .MAKE.PPID -The parent process-id of +The parent process ID of .Nm . +It is read-only. +.It Va MAKE_PRINT_VAR_ON_ERROR +When +.Nm +stops due to an error, it sets +.Sq Va .ERROR_TARGET +to the name of the target that failed, +.Sq Va .ERROR_CMD +to the commands of the failed target, +and in +.Dq meta +mode, it also sets +.Sq Va .ERROR_CWD +to the +.Xr getcwd 3 , +and +.Sq Va .ERROR_META_FILE +to the path of the meta file (if any) describing the failed target. +It then prints its name and the value of +.Sq Va .CURDIR +as well as the value of any variables named in +.Sq Va MAKE_PRINT_VAR_ON_ERROR . .It Va .MAKE.SAVE_DOLLARS -value should be a boolean that controls whether +If true, .Ql $$ are preserved when doing .Ql := @@ -1084,40 +1206,35 @@ If set to false, becomes .Ql $ per normal evaluation rules. +.It Va .MAKE.TARGET_LOCAL_VARIABLES +If set to +.Ql false , +apparent variable assignments in dependency lines are +treated as normal sources. .It Va .MAKE.UID -The user-id running +The numeric ID of the user running .Nm . -.It Va .MAKE.GID -The group-id running -.Nm . -.It Va MAKE_PRINT_VAR_ON_ERROR -When -.Nm -stops due to an error, it sets -.Sq Va .ERROR_TARGET -to the name of the target that failed, -.Sq Va .ERROR_CMD -to the commands of the failed target, -and in "meta" mode, it also sets -.Sq Va .ERROR_CWD -to the -.Xr getcwd 3 , -and -.Sq Va .ERROR_META_FILE -to the path of the meta file (if any) describing the failed target. -It then prints its name and the value of -.Sq Va .CURDIR -as well as the value of any variables named in -.Sq Va MAKE_PRINT_VAR_ON_ERROR . +It is read-only. +.\" 'MAKE_VERSION' is intentionally undocumented +.\" since it is only defined in the bmake distribution, +.\" but not in NetBSD's native make. +.\" '.meta.%d.lcwd' is intentionally undocumented +.\" since it is an internal implementation detail. +.\" '.meta.%d.ldir' is intentionally undocumented +.\" since it is an internal implementation detail. +.\" 'MFLAGS' is intentionally undocumented +.\" since it is obsolete. .It Va .newline This variable is simply assigned a newline character as its value. +It is read-only. This allows expansions using the .Cm \&:@ modifier to put a newline between iterations of the loop rather than a space. -For example, the printing of -.Sq Va MAKE_PRINT_VAR_ON_ERROR -could be done as ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@}. +For example, in case of an error, +.Nm +prints the variable names and their values using: +.Dl ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@} .It Va .OBJDIR A path to the directory where the targets are built. Its value is determined by trying to @@ -1125,30 +1242,30 @@ Its value is determined by trying to to the following directories in order and using the first match: .Bl -enum .It -.Ev ${MAKEOBJDIRPREFIX}${.CURDIR} +.Cm ${MAKEOBJDIRPREFIX} Ns Cm ${.CURDIR} .Pp (Only if .Sq Ev MAKEOBJDIRPREFIX is set in the environment or on the command line.) .It -.Ev ${MAKEOBJDIR} +.Cm ${MAKEOBJDIR} .Pp (Only if .Sq Ev MAKEOBJDIR is set in the environment or on the command line.) .It -.Ev ${.CURDIR} Ns Pa /obj. Ns Ev ${MACHINE} +.Cm ${.CURDIR} Ns Pa /obj. Ns Cm ${MACHINE} .It -.Ev ${.CURDIR} Ns Pa /obj +.Cm ${.CURDIR} Ns Pa /obj .It -.Pa /usr/obj/ Ns Ev ${.CURDIR} +.Pa /usr/obj/ Ns Cm ${.CURDIR} .It -.Ev ${.CURDIR} +.Cm ${.CURDIR} .El .Pp -Variable expansion is performed on the value before it's used, +Variable expansion is performed on the value before it is used, so expressions such as -.Dl ${.CURDIR:S,^/usr/src,/var/obj,} +.Cm ${.CURDIR:S,^/usr/src,/var/obj,} may be used. This is especially useful with .Sq Ev MAKEOBJDIR . @@ -1158,47 +1275,45 @@ may be modified in the makefile via the special target .Sq Ic .OBJDIR . In all cases, .Nm -will -.Xr chdir 2 -to the specified directory if it exists, and set +changes to the specified directory if it exists, and sets .Sq Va .OBJDIR and -.Sq Ev PWD +.Sq Va PWD to that directory before executing any targets. .Pp Except in the case of an explicit .Sq Ic .OBJDIR target, .Nm -will check that the specified directory is writable and ignore it if not. +checks that the specified directory is writable and ignores it if not. This check can be skipped by setting the environment variable .Sq Ev MAKE_OBJDIR_CHECK_WRITABLE -to "no". -. +to +.Dq no . .It Va .PARSEDIR -A path to the directory of the current -.Sq Pa Makefile -being parsed. +The directory name of the current makefile being parsed. .It Va .PARSEFILE -The basename of the current -.Sq Pa Makefile -being parsed. +The basename of the current makefile being parsed. This variable and .Sq Va .PARSEDIR -are both set only while the -.Sq Pa Makefiles -are being parsed. -If you want to retain their current values, assign them to a variable -using assignment with expansion +are both set only while the makefiles are being parsed. +To retain their current values, +assign them to a variable using assignment with expansion .Sq Cm \&:= . .It Va .PATH -A variable that represents the list of directories that +The space-separated list of directories that .Nm -will search for files. -The search list should be updated using the target -.Sq Va .PATH -rather than the variable. -.It Ev PWD +searches for files. +To update this search list, use the special target +.Sq Ic .PATH +rather than modifying the variable directly. +.It Va %POSIX +Is set in POSIX mode, see the special +.Ql Va .POSIX +target. +.\" XXX: There is no make variable named 'PWD', +.\" XXX: make only reads and writes the environment variable 'PWD'. +.It Va PWD Alternate path to the current directory. .Nm normally sets @@ -1207,7 +1322,7 @@ to the canonical path given by .Xr getcwd 3 . However, if the environment variable .Sq Ev PWD -is set and gives a path to the current directory, then +is set and gives a path to the current directory, .Nm sets .Sq Va .CURDIR @@ -1219,62 +1334,81 @@ This behavior is disabled if is set or .Sq Ev MAKEOBJDIR contains a variable transform. -.Sq Ev PWD +.Sq Va PWD is set to the value of .Sq Va .OBJDIR for all programs which .Nm executes. -.It Ev .SHELL +.It Va .SHELL The pathname of the shell used to run target scripts. It is read-only. -.It Ev .SUFFIXES +.It Va .SUFFIXES The list of known suffixes. It is read-only. -.It Ev .TARGETS -The list of targets explicitly specified on the command line, if any. -.It Ev VPATH -Colon-separated -.Pq Dq \&: -lists of directories that +.It Va .SYSPATH +The space-separated list of directories that .Nm -will search for files. -The variable is supported for compatibility with old make programs only, -use +searches for makefiles, referred to as the system include path. +To update this search list, use the special target +.Sq Ic .SYSPATH +rather than modifying the variable which is read-only. +.It Va .TARGETS +The list of targets explicitly specified on the command line, if any. +.It Va VPATH +The colon-separated +.Pq Dq \&: +list of directories that +.Nm +searches for files. +This variable is supported for compatibility with old make programs only, use .Sq Va .PATH instead. .El .Ss Variable modifiers -Variable expansion may be modified to select or modify each word of the -variable (where a -.Dq word -is white-space delimited sequence of characters). -The general format of a variable expansion is as follows: +The general format of a variable expansion is: .Pp -.Dl ${variable[:modifier[:...]]} +.Sm off +.D1 Ic \&${ Ar variable\| Oo Ic \&: Ar modifier\| Oo Ic \&: No ... Oc Oc Ic \&} +.Sm on .Pp -Each modifier begins with a colon, -which may be escaped with a backslash -.Pq Ql \e . +Each modifier begins with a colon. +To escape a colon, precede it with a backslash +.Ql \e . .Pp -A set of modifiers can be specified via a variable, as follows: +A list of indirect modifiers can be specified via a variable, as follows: .Pp -.Dl modifier_variable=modifier[:...] -.Dl ${variable:${modifier_variable}[:...]} +.Bd -literal -offset indent +.Ar modifier_variable\^ Li \&= Ar modifier Ns Oo Ic \&: Ns No ... Oc + +.Sm off +.Ic \&${ Ar variable Ic \&:${ Ar modifier_variable Ic \&} Oo Ic \&: No ... Oc Ic \&} +.Sm on +.Ed .Pp -In this case the first modifier in the modifier_variable does not -start with a colon, since that must appear in the referencing -variable. -If any of the modifiers in the modifier_variable contain a dollar sign +In this case, the first modifier in the +.Ar modifier_variable +does not start with a colon, +since that colon already occurs in the referencing variable. +If any of the modifiers in the +.Ar modifier_variable +contains a dollar sign .Pq Ql $ , these must be doubled to avoid early expansion. .Pp +Some modifiers interpret the expression value as a single string, +others treat the expression value as a whitespace-separated list of words. +When splitting a string into words, +whitespace can be escaped using double quotes, single quotes and backslashes, +like in the shell. +The quotes and backslashes are retained in the words. +.Pp The supported modifiers are: .Bl -tag -width EEE .It Cm \&:E -Replaces each word in the variable with its suffix. +Replaces each word with its suffix. .It Cm \&:H -Replaces each word in the variable with everything but the last component. +Replaces each word with its dirname. .It Cm \&:M\| Ns Ar pattern Selects only those words that match .Ar pattern . @@ -1288,36 +1422,40 @@ be used. The wildcard characters may be escaped with a backslash .Pq Ql \e . As a consequence of the way values are split into words, matched, -and then joined, a construct like -.Dl ${VAR:M*} -will normalize the inter-word spacing, removing all leading and -trailing space, and converting multiple consecutive spaces -to single spaces. -. +and then joined, the construct +.Ql ${VAR:M*} +removes all leading and trailing whitespace +and normalizes the inter-word spacing to a single space. .It Cm \&:N\| Ns Ar pattern -This is identical to +This is the opposite of .Sq Cm \&:M , -but selects all words which do not match +selecting all words which do +.Em not +match .Ar pattern . .It Cm \&:O -Orders every word in variable alphabetically. +Orders the words lexicographically. .It Cm \&:On -Orders every word in variable numerically. +Orders the words numerically. A number followed by one of .Ql k , .Ql M or .Ql G -is multiplied by the appropriate factor (1024 (k), 1048576 (M), or -1073741824 (G)). +is multiplied by the appropriate factor, which is 1024 for +.Ql k , +1048576 for +.Ql M , +or 1073741824 for +.Ql G . Both upper- and lower-case letters are accepted. .It Cm \&:Or -Orders every word in variable in reverse alphabetical order. +Orders the words in reverse lexicographical order. .It Cm \&:Orn -Orders every word in variable in reverse numerical order. +Orders the words in reverse numerical order. .It Cm \&:Ox -Shuffles the words in variable. -The results will be different each time you are referring to the +Shuffles the words. +The results are different each time you are referring to the modified variable; use the assignment with expansion .Sq Cm \&:= to prevent such behavior. @@ -1341,64 +1479,66 @@ due uno quattro tre due uno quattro tre .Ed .It Cm \&:Q -Quotes every shell meta-character in the variable, so that it can be passed +Quotes every shell meta-character in the value, so that it can be passed safely to the shell. .It Cm \&:q -Quotes every shell meta-character in the variable, and also doubles +Quotes every shell meta-character in the value, and also doubles .Sq $ characters so that it can be passed safely through recursive invocations of .Nm . -This is equivalent to: -.Sq \&:S/\e\&$/&&/g:Q . +This is equivalent to +.Sq Cm \&:S/\e\&$/&&/g:Q . .It Cm \&:R -Replaces each word in the variable with everything but its suffix. -.It Cm \&:range Ns Oo = Ns Ar count Oc +Replaces each word with everything but its suffix. +.It Cm \&:range Ns Oo Cm = Ns Ar count Oc The value is an integer sequence representing the words of the original value, or the supplied -.Va count . -.It Cm \&:gmtime Ns Oo = Ns Ar utc Oc -The value is a format string for +.Ar count . +.It Cm \&:gmtime Ns Oo Cm = Ns Ar timestamp Oc +The value is interpreted as a format string for .Xr strftime 3 , using -.Xr gmtime 3 . +.Xr gmtime 3 , +producing the formatted timestamp. If a -.Va utc +.Ar timestamp value is not provided or is 0, the current time is used. .It Cm \&:hash -Computes a 32-bit hash of the value and encode it as hex digits. -.It Cm \&:localtime Ns Oo = Ns Ar utc Oc -The value is a format string for +Computes a 32-bit hash of the value and encodes it as 8 hex digits. +.It Cm \&:localtime Ns Oo Cm = Ns Ar timestamp Oc +The value is interpreted as a format string for .Xr strftime 3 , using -.Xr localtime 3 . +.Xr localtime 3 , +producing the formatted timestamp. If a -.Va utc +.Ar timestamp value is not provided or is 0, the current time is used. .It Cm \&:tA -Attempts to convert variable to an absolute path using -.Xr realpath 3 , -if that fails, the value is unchanged. +Attempts to convert the value to an absolute path using +.Xr realpath 3 . +If that fails, the value is unchanged. .It Cm \&:tl -Converts variable to lower-case letters. +Converts the value to lower-case letters. .It Cm \&:ts Ns Ar c -Words in the variable are normally separated by a space on expansion. -This modifier sets the separator to the character +When joining the words after a modifier that treats the value as words, +the words are normally separated by a space. +This modifier changes the separator to the character .Ar c . If .Ar c -is omitted, then no separator is used. +is omitted, no separator is used. The common escapes (including octal numeric codes) work as expected. .It Cm \&:tu -Converts variable to upper-case letters. +Converts the value to upper-case letters. .It Cm \&:tW -Causes the value to be treated as a single word -(possibly containing embedded white space). +Causes subsequent modifiers to treat the value as a single word +(possibly containing embedded whitespace). See also .Sq Cm \&:[*] . .It Cm \&:tw -Causes the value to be treated as a sequence of -words delimited by white space. +Causes the value to be treated as a list of words. See also .Sq Cm \&:[@] . .Sm off @@ -1406,21 +1546,20 @@ See also .Sm on Modifies the first occurrence of .Ar old_string -in each word of the variable's value, replacing it with +in each word of the value, replacing it with .Ar new_string . If a .Ql g -is appended to the last delimiter of the pattern, all occurrences -in each word are replaced. +is appended to the last delimiter of the pattern, +all occurrences in each word are replaced. If a .Ql 1 -is appended to the last delimiter of the pattern, only the first occurrence -is affected. +is appended to the last delimiter of the pattern, +only the first occurrence is affected. If a .Ql W is appended to the last delimiter of the pattern, -then the value is treated as a single word -(possibly containing embedded white space). +the value is treated as a single word. If .Ar old_string begins with a caret @@ -1438,39 +1577,37 @@ an ampersand .Pq Ql & is replaced by .Ar old_string -(without any +(without the anchoring .Ql ^ or .Ql \&$ ) . -Any character may be used as a delimiter for the parts of the modifier +Any character may be used as the delimiter for the parts of the modifier string. -The anchoring, ampersand and delimiter characters may be escaped with a +The anchoring, ampersand and delimiter characters can be escaped with a backslash .Pq Ql \e . .Pp -Variable expansion occurs in the normal fashion inside both +Both .Ar old_string and .Ar new_string -with the single exception that a backslash is used to prevent the expansion -of a dollar sign -.Pq Ql \&$ , -not a preceding dollar sign as is usual. +may contain nested expressions. +To prevent a dollar sign from starting a nested expression, +escape it with a backslash. .Sm off .It Cm \&:C\| No \&/ Ar pattern\| No \&/ Ar replacement\| No \&/ Op Cm 1gW .Sm on The .Cm \&:C -modifier is just like the +modifier works like the .Cm \&:S modifier except that the old and new strings, instead of being -simple strings, are an extended regular expression (see -.Xr regex 3 ) -string +simple strings, are an extended regular expression .Ar pattern +(see +.Xr regex 3 ) and an .Xr ed 1 Ns \-style -string .Ar replacement . Normally, the first occurrence of the pattern .Ar pattern @@ -1486,7 +1623,7 @@ search pattern as occur in the word or words it is found in; the .Ql W modifier causes the value to be treated as a single word -(possibly containing embedded white space). +(possibly containing embedded whitespace). .Pp As for the .Cm \&:S @@ -1497,103 +1634,99 @@ and are subjected to variable expansion before being parsed as regular expressions. .It Cm \&:T -Replaces each word in the variable with its last path component. +Replaces each word with its last path component (basename). .It Cm \&:u Removes adjacent duplicate words (like .Xr uniq 1 ) . .Sm off .It Cm \&:\&?\| Ar true_string\| Cm \&: Ar false_string .Sm on -If the variable name (not its value), when parsed as a .if conditional -expression, evaluates to true, return as its value the +If the variable name (not its value), when parsed as a +.Cm .if +conditional expression, evaluates to true, return as its value the .Ar true_string , otherwise return the .Ar false_string . -Since the variable name is used as the expression, \&:\&? must be the -first modifier after the variable name itself - which will, of course, -usually contain variable expansions. +Since the variable name is used as the expression, +\&:\&? must be the first modifier after the variable name +.No itself Ns \^\(em\^ Ns +which, of course, usually contains variable expansions. A common error is trying to use expressions like .Dl ${NUMBERS:M42:?match:no} -which actually tests defined(NUMBERS), -to determine if any words match "42" you need to use something like: +which actually tests defined(NUMBERS). +To determine if any words match +.Dq 42 , +you need to use something like: .Dl ${"${NUMBERS:M42}" != \&"\&":?match:no} . .It Cm :\| Ns Ar old_string\| Ns Cm = Ns Ar new_string This is the .At V -style variable substitution. -It must be the last modifier specified. +style substitution. +It can only be the last modifier specified, +as a +.Ql \&: +in either +.Ar old_string +or +.Ar new_string +is treated as a regular character, not as the end of the modifier. +.Pp If .Ar old_string -or -.Ar new_string -do not contain the pattern matching character -.Ar % -then it is assumed that they are -anchored at the end of each word, so only suffixes or entire -words may be replaced. -Otherwise -.Ar % -is the substring of +does not contain the pattern matching character +.Ql % , +and the word ends with .Ar old_string -to be replaced in +or equals it, +that suffix is replaced with .Ar new_string . -If only -.Ar old_string -contains the pattern matching character -.Ar % , -and -.Ar old_string -matches, then the result is the -.Ar new_string . -If only the -.Ar new_string -contains the pattern matching character -.Ar % , -then it is not treated specially and it is printed as a literal -.Ar % -on match. -If there is more than one pattern matching character -.Ar ( % ) -in either the -.Ar new_string -or -.Ar old_string , -only the first instance is treated specially (as the pattern character); -all subsequent instances are treated as regular characters. .Pp -Variable expansion occurs in the normal fashion inside both +Otherwise, the first +.Ql % +in +.Ar old_string +matches a possibly empty substring of arbitrary characters, +and if the whole pattern is found in the word, +the matching part is replaced with +.Ar new_string , +and the first occurrence of +.Ql % +in +.Ar new_string +(if any) is replaced with the substring matched by the +.Ql % . +.Pp +Both .Ar old_string and .Ar new_string -with the single exception that a backslash is used to prevent the -expansion of a dollar sign -.Pq Ql \&$ , -not a preceding dollar sign as is usual. +may contain nested expressions. +To prevent a dollar sign from starting a nested expression, +escape it with a backslash. .Sm off -.It Cm \&:@ Ar temp\| Cm @ Ar string\| Cm @ +.It Cm \&:@ Ar varname\| Cm @ Ar string\| Cm @ .Sm on This is the loop expansion mechanism from the OSF Development Environment (ODE) make. Unlike .Cm \&.for loops, expansion occurs at the time of reference. -Assigns -.Ar temp -to each word in the variable and evaluates +For each word in the value, assign the word to the variable named +.Ar varname +and evaluate .Ar string . The ODE convention is that -.Ar temp -should start and end with a period. -For example. +.Ar varname +should start and end with a period, for example: .Dl ${LINKS:@.LINK.@${LN} ${TARGET} ${.LINK.}@} .Pp -However a single character variable is often more readable: +However, a single-letter variable is often more readable: .Dl ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@} .It Cm \&:_ Ns Oo Cm = Ns Ar var Oc Saves the current variable value in .Ql $_ or the named -.Va var +.Ar var for later reference. Example usage: .Bd -literal -offset indent @@ -1627,12 +1760,10 @@ is the value. .It Cm \&:L The name of the variable is the value. .It Cm \&:P -The path of the node which has the same name as the variable -is the value. -If no such node exists or its path is null, then the -name of the variable is used. +The path of the node which has the same name as the variable is the value. +If no such node exists or its path is null, the name of the variable is used. In order for this modifier to work, the name (node) must at least have -appeared on the rhs of a dependency. +appeared on the right-hand side of a dependency. .Sm off .It Cm \&:\&! Ar cmd\| Cm \&! .Sm on @@ -1640,29 +1771,24 @@ The output of running .Ar cmd is the value. .It Cm \&:sh -If the variable is non-empty it is run as a command and the output -becomes the new value. +The value is run as a command, and the output becomes the new value. .It Cm \&::= Ns Ar str The variable is assigned the value .Ar str after substitution. -This modifier and its variations are useful in -obscure situations such as wanting to set a variable when shell commands -are being parsed. -These assignment modifiers always expand to -nothing, so if appearing in a rule line by themselves should be -preceded with something to keep -.Nm -happy. +This modifier and its variations are useful in obscure situations +such as wanting to set a variable +at a point where a target's shell commands are being parsed. +These assignment modifiers always expand to nothing. .Pp The .Sq Cm \&:: helps avoid false matches with the .At V style -.Cm \&:= -modifier and since substitution always occurs the -.Cm \&::= +.Ql \&:= +modifier and since substitution always occurs, the +.Ql \&::= form is vaguely appropriate. .It Cm \&::?= Ns Ar str As for @@ -1679,13 +1805,8 @@ to the variable. .It Cm \&:\&[ Ns Ar range Ns Cm \&] Selects one or more words from the value, or performs other operations related to the way in which the -value is divided into words. +value is split into words. .Pp -Ordinarily, a value is treated as a sequence of words -delimited by white space. -Some modifiers suppress this behavior, -causing a value to be treated as a single word -(possibly containing embedded white space). An empty value, or a value that consists entirely of white-space, is treated as a single word. For the purposes of the @@ -1717,21 +1838,22 @@ If .Ar start is greater than .Ar end , -then the words are output in reverse order. +the words are output in reverse order. For example, .Sq Cm \&:[-1..1] selects all the words from last to first. -If the list is already ordered, then this effectively reverses -the list, but it is more efficient to use +If the list is already ordered, +this effectively reverses the list, +but it is more efficient to use .Sq Cm \&:Or instead of .Sq Cm \&:O:[-1..1] . .\" :[*] .It Cm \&* Causes subsequent modifiers to treat the value as a single word -(possibly containing embedded white space). +(possibly containing embedded whitespace). Analogous to the effect of -\&"$*\&" +.Li \&$* in Bourne shell. .\" :[0] .It 0 @@ -1740,23 +1862,25 @@ Means the same as .\" :[*] .It Cm \&@ Causes subsequent modifiers to treat the value as a sequence of words -delimited by white space. +delimited by whitespace. Analogous to the effect of -\&"$@\&" +.Li \&$@ in Bourne shell. .\" :[#] .It Cm \&# Returns the number of words in the value. .El \" :[range] .El -.Sh INCLUDE STATEMENTS, CONDITIONALS AND FOR LOOPS -Makefile inclusion, conditional structures and for loops reminiscent -of the C programming language are provided in -.Nm . -All such structures are identified by a line beginning with a single -dot +.Sh DIRECTIVES +.Nm +offers directives for including makefiles, conditionals and for loops. +All these directives are identified by a line beginning with a single dot .Pq Ql \&. -character. +character, followed by the keyword of the directive, such as +.Cm include +or +.Cm if . +.Ss File inclusion Files are included with either .Cm \&.include \&< Ns Ar file Ns Cm \&> or @@ -1768,36 +1892,28 @@ the system makefile directory. If double quotes are used, the including makefile's directory and any directories specified using the .Fl I -option are searched before the system -makefile directory. -For compatibility with other versions of -.Nm -.Ql include file ... +option are searched before the system makefile directory. +.Pp +For compatibility with other make variants, +.Sq Cm include Ar file No ... +(without leading dot) is also accepted. .Pp If the include statement is written as .Cm .-include or as -.Cm .sinclude -then errors locating and/or opening include files are ignored. +.Cm .sinclude , +errors locating and/or opening include files are ignored. .Pp If the include statement is written as -.Cm .dinclude +.Cm .dinclude , not only are errors locating and/or opening include files ignored, -but stale dependencies within the included file will be ignored -just like +but stale dependencies within the included file are ignored just like in .Va .MAKE.DEPENDFILE . -.Pp -Conditional expressions are also preceded by a single dot as the first -character of a line. -The possible conditionals are as follows: +.Ss Exporting variables +The directives for exporting and unexporting variables are: .Bl -tag -width Ds -.It Ic .error Ar message -The message is printed along with the name of the makefile and line number, -then -.Nm -will exit immediately. -.It Ic .export Ar variable ... +.It Ic .export Ar variable No ... Export the specified global variable. If no variable list is provided, all globals are exported except for internal variables (those that start with @@ -1805,16 +1921,14 @@ except for internal variables (those that start with This is not affected by the .Fl X flag, so should be used with caution. -For compatibility with other -.Nm -programs -.Ql export variable=value -is also accepted. +For compatibility with other make programs, +.Cm export Ar variable\| Ns Cm \&= Ns Ar value +(without leading dot) is also accepted. .Pp Appending a variable name to .Va .MAKE.EXPORTED is equivalent to exporting a variable. -.It Ic .export-env Ar variable ... +.It Ic .export-env Ar variable No ... The same as .Ql .export , except that the variable is not appended to @@ -1823,21 +1937,16 @@ This allows exporting a value to the environment which is different from that used by .Nm internally. -.It Ic .export-literal Ar variable ... +.It Ic .export-literal Ar variable No ... The same as .Ql .export-env , except that variables in the value are not expanded. -.It Ic .info Ar message -The message is printed along with the name of the makefile and line number. -.It Ic .undef Ar variable ... -Un-define the specified global variables. -Only global variables can be un-defined. -.It Ic .unexport Ar variable ... +.It Ic .unexport Ar variable No ... The opposite of .Ql .export . The specified global -.Va variable -will be removed from +.Ar variable +is removed from .Va .MAKE.EXPORTED . If no variable list is provided, all globals are unexported, and @@ -1846,11 +1955,11 @@ deleted. .It Ic .unexport-env Unexport all globals previously exported and clear the environment inherited from the parent. -This operation will cause a memory leak of the original environment, +This operation causes a memory leak of the original environment, so should be used sparingly. Testing for .Va .MAKE.LEVEL -being 0, would make sense. +being 0 would make sense. Also note that any variables which originated in the parent environment should be explicitly preserved if desired. For example: @@ -1865,46 +1974,62 @@ PATH := ${PATH} Would result in an environment containing only .Sq Ev PATH , which is the minimal useful environment. +.\" TODO: Check the below sentence, environment variables don't start with '.'. Actually -.Sq Ev .MAKE.LEVEL -will also be pushed into the new environment. +.Sq Va .MAKE.LEVEL +is also pushed into the new environment. +.El +.Ss Messages +The directives for printing messages to the output are: +.Bl -tag -width Ds +.It Ic .info Ar message +The message is printed along with the name of the makefile and line number. .It Ic .warning Ar message The message prefixed by -.Sq Pa warning: +.Sq Li warning: is printed along with the name of the makefile and line number. -.It Ic \&.if Oo \&! Oc Ns Ar expression Op Ar operator expression ... +.It Ic .error Ar message +The message is printed along with the name of the makefile and line number, +.Nm +exits immediately. +.El +.Ss Conditionals +The directives for conditionals are: +.ds maybenot Oo Ic \&! Oc Ns +.Bl -tag +.It Ic .if \*[maybenot] Ar expression Op Ar operator expression No ... Test the value of an expression. -.It Ic .ifdef Oo \&! Oc Ns Ar variable Op Ar operator variable ... -Test the value of a variable. -.It Ic .ifndef Oo \&! Oc Ns Ar variable Op Ar operator variable ... -Test the value of a variable. -.It Ic .ifmake Oo \&! Oc Ns Ar target Op Ar operator target ... -Test the target being built. -.It Ic .ifnmake Oo \&! Ns Oc Ar target Op Ar operator target ... -Test the target being built. +.It Ic .ifdef \*[maybenot] Ar variable Op Ar operator variable No ... +Test whether a variable is defined. +.It Ic .ifndef \*[maybenot] Ar variable Op Ar operator variable No ... +Test whether a variable is not defined. +.It Ic .ifmake \*[maybenot] Ar target Op Ar operator target No ... +Test the target being requested. +.It Ic .ifnmake \*[maybenot] Ar target Op Ar operator target No ... +Test the target being requested. .It Ic .else Reverse the sense of the last conditional. -.It Ic .elif Oo \&! Ns Oc Ar expression Op Ar operator expression ... +.It Ic .elif \*[maybenot] Ar expression Op Ar operator expression No ... A combination of .Sq Ic .else followed by .Sq Ic .if . -.It Ic .elifdef Oo \&! Oc Ns Ar variable Op Ar operator variable ... +.It Ic .elifdef \*[maybenot] Ar variable Op Ar operator variable No ... A combination of .Sq Ic .else followed by .Sq Ic .ifdef . -.It Ic .elifndef Oo \&! Oc Ns Ar variable Op Ar operator variable ... +.It Ic .elifndef \*[maybenot] Ar variable Op Ar operator variable No ... A combination of .Sq Ic .else followed by .Sq Ic .ifndef . -.It Ic .elifmake Oo \&! Oc Ns Ar target Op Ar operator target ... +.It Ic .elifmake \*[maybenot] Ar target Op Ar operator target No ... A combination of .Sq Ic .else followed by .Sq Ic .ifmake . -.It Ic .elifnmake Oo \&! Oc Ns Ar target Op Ar operator target ... +.It Ic .elifnmake \*[maybenot] Ar target Op Ar operator target No ... A combination of .Sq Ic .else followed by @@ -1916,133 +2041,157 @@ End the body of the conditional. The .Ar operator may be any one of the following: -.Bl -tag -width "Cm XX" -.It Cm \&|\&| +.Bl -tag +.It Ic \&|\&| Logical OR. -.It Cm \&&& -Logical -.Tn AND ; -of higher precedence than -.Dq \&|\&| . +.It Ic \&&& +Logical AND; of higher precedence than +.Sq Ic \&|\&| . .El .Pp -As in C, .Nm -will only evaluate a conditional as far as is necessary to determine -its value. -Parentheses may be used to change the order of evaluation. +only evaluates a conditional as far as is necessary to determine its value. +Parentheses can be used to override the operator precedence. The boolean operator .Sq Ic \&! -may be used to logically negate an entire -conditional. +may be used to logically negate an entire conditional. It is of higher precedence than .Sq Ic \&&& . .Pp The value of .Ar expression -may be any of the following: -.Bl -tag -width defined -.It Ic defined -Takes a variable name as an argument and evaluates to true if the variable +may be any of the following function call expressions: +.Bl -tag +.Sm off +.It Ic defined Li \&( Ar varname Li \&) +.Sm on +Evaluates to true if the variable +.Ar varname has been defined. -.It Ic make -Takes a target name as an argument and evaluates to true if the target -was specified as part of +.Sm off +.It Ic make Li \&( Ar target Li \&) +.Sm on +Evaluates to true if the target was specified as part of .Nm Ns 's command line or was declared the default target (either implicitly or explicitly, see .Va .MAIN ) before the line containing the conditional. -.It Ic empty -Takes a variable, with possible modifiers, and evaluates to true if -the expansion of the variable would result in an empty string. -.It Ic exists -Takes a file name as an argument and evaluates to true if the file exists. -The file is searched for on the system search path (see +.Sm off +.It Ic empty Li \&( Ar varname Oo Li : Ar modifiers Oc Li \&) +.Sm on +Evaluates to true if the expansion of the variable, +after applying the modifiers, results in an empty string. +.Sm off +.It Ic exists Li \&( Ar pathname Li \&) +.Sm on +Evaluates to true if the given pathname exists. +If relative, the pathname is searched for on the system search path (see .Va .PATH ) . -.It Ic target -Takes a target name as an argument and evaluates to true if the target -has been defined. -.It Ic commands -Takes a target name as an argument and evaluates to true if the target -has been defined and has commands associated with it. +.Sm off +.It Ic target Li \&( Ar target Li \&) +.Sm on +Evaluates to true if the target has been defined. +.Sm off +.It Ic commands Li \&( Ar target Li \&) +.Sm on +Evaluates to true if the target has been defined +and has commands associated with it. .El .Pp .Ar Expression may also be an arithmetic or string comparison. -Variable expansion is -performed on both sides of the comparison, after which the numerical -values are compared. -A value is interpreted as hexadecimal if it is -preceded by 0x, otherwise it is decimal; octal numbers are not supported. -The standard C relational operators are all supported. -If after -variable expansion, either the left or right hand side of a -.Sq Ic == -or -.Sq Ic "!=" -operator is not a numerical value, then -string comparison is performed between the expanded -variables. -If no relational operator is given, it is assumed that the expanded -variable is being compared against 0, or an empty string in the case -of a string comparison. +Variable expansion is performed on both sides of the comparison. +If both sides are numeric and neither is enclosed in quotes, +the comparison is done numerically, otherwise lexicographically. +A string is interpreted as hexadecimal integer if it is preceded by +.Li 0x , +otherwise it is a decimal floating-point number; +octal numbers are not supported. +.Pp +All comparisons may use the operators +.Sq Ic \&== +and +.Sq Ic \&!= . +Numeric comparisons may also use the operators +.Sq Ic \&< , +.Sq Ic \&<= , +.Sq Ic \&> +and +.Sq Ic \&>= . +.Pp +If the comparison has neither a comparison operator nor a right side, +the expression evaluates to true if it is nonempty +and its numeric value (if any) is not zero. .Pp When .Nm is evaluating one of these conditional expressions, and it encounters -a (white-space separated) word it doesn't recognize, either the +a (whitespace separated) word it doesn't recognize, either the .Dq make or .Dq defined -expression is applied to it, depending on the form of the conditional. +function is applied to it, depending on the form of the conditional. If the form is .Sq Ic .ifdef , -.Sq Ic .ifndef , +.Sq Ic .ifndef or -.Sq Ic .if +.Sq Ic .if , the .Dq defined -expression is applied. +function is applied. Similarly, if the form is .Sq Ic .ifmake or .Sq Ic .ifnmake , the .Dq make -expression is applied. +function is applied. .Pp -If the conditional evaluates to true the parsing of the makefile continues -as before. +If the conditional evaluates to true, +parsing of the makefile continues as before. If it evaluates to false, the following lines are skipped. -In both cases this continues until a +In both cases, this continues until the corresponding .Sq Ic .else or .Sq Ic .endif is found. -.Pp +.Ss For loops For loops are typically used to apply a set of rules to a list of files. The syntax of a for loop is: .Pp .Bl -tag -compact -width Ds -.It Ic \&.for Ar variable Oo Ar variable ... Oc Ic in Ar expression -.It Aq make-lines +.It Ic \&.for Ar variable Oo Ar variable No ... Oc Ic in Ar expression +.It Aq Ar make-lines .It Ic \&.endfor .El .Pp -After the for -.Ic expression -is evaluated, it is split into words. +The +.Ar expression +is expanded and then split into words. On each iteration of the loop, one word is taken and assigned to each -.Ic variable , +.Ar variable , in order, and these -.Ic variables +.Ar variables are substituted into the -.Ic make-lines +.Ar make-lines inside the body of the for loop. The number of words must come out even; that is, if there are three iteration variables, the number of words provided must be a multiple of three. +.Pp +If +.Sq Ic .break +is encountered within a +.Cm \&.for +loop, it causes early termination of the loop, otherwise a parse error. +.\" TODO: Describe limitations with defined/empty. +.Ss Other directives +.Bl -tag -width Ds +.It Ic .undef Ar variable No ... +Un-define the specified global variables. +Only global variables can be un-defined. +.El .Sh COMMENTS Comments begin with a hash .Pq Ql \&# @@ -2061,7 +2210,7 @@ as if they all were preceded by a dash .\" .It Ic .JOIN .\" XXX .It Ic .MADE -Mark all sources of this target as being up-to-date. +Mark all sources of this target as being up to date. .It Ic .MAKE Execute the commands associated with this target even if the .Fl n @@ -2079,7 +2228,9 @@ or Usage in conjunction with .Ic .MAKE is the most likely case. -In "meta" mode, the target is out-of-date if the meta file is missing. +In +.Dq meta +mode, the target is out-of-date if the meta file is missing. .It Ic .NOMETA Do not create a meta file for the target. Meta files are also not created for @@ -2091,16 +2242,17 @@ targets. .It Ic .NOMETA_CMP Ignore differences in commands when deciding if target is out of date. This is useful if the command contains a value which always changes. -If the number of commands change, though, the target will still be out of date. +If the number of commands change, though, +the target is still considered out of date. The same effect applies to any command line that uses the variable .Va .OODATE , which can be used for that purpose even when not otherwise needed or desired: .Bd -literal -offset indent skip-compare-for-some: - @echo this will be compared - @echo this will not ${.OODATE:M.NOMETA_CMP} - @echo this will also be compared + @echo this is compared + @echo this is not ${.OODATE:M.NOMETA_CMP} + @echo this is also compared .Ed The @@ -2108,7 +2260,7 @@ The pattern suppresses any expansion of the unwanted variable. .It Ic .NOPATH Do not search for the target in the directories specified by -.Ic .PATH . +.Va .PATH . .It Ic .NOTMAIN Normally .Nm @@ -2118,12 +2270,12 @@ This source prevents this target from being selected. .It Ic .OPTIONAL If a target is marked with this attribute and .Nm -can't figure out how to create it, it will ignore this fact and assume +can't figure out how to create it, it ignores this fact and assumes the file isn't needed or already exists. .It Ic .PHONY -The target does not -correspond to an actual file; it is always considered to be out of date, -and will not be created with the +The target does not correspond to an actual file; +it is always considered to be out of date, +and is not created with the .Fl t option. Suffix-transformation rules are not applied to @@ -2155,9 +2307,9 @@ If the target already has commands, the target's commands are appended to them. .It Ic .USEBEFORE -Exactly like +Like .Ic .USE , -but prepend the +but instead of appending, prepend the .Ic .USEBEFORE target commands to the target. .It Ic .WAIT @@ -2185,7 +2337,7 @@ the output is always .Ql b1 , .Ql b , .Ql x . -.br +.Pp The ordering imposed by .Ic .WAIT is only relevant for parallel makes. @@ -2200,17 +2352,15 @@ else is done. .It Ic .DEFAULT This is sort of a .Ic .USE -rule for any target (that was used only as a -source) that +rule for any target (that was used only as a source) that .Nm can't figure out any other way to create. Only the shell script is used. The -.Ic .IMPSRC +.Va .IMPSRC variable of a target that inherits .Ic .DEFAULT Ns 's -commands is set -to the target's own name. +commands is set to the target's own name. .It Ic .DELETE_ON_ERROR If this target is present in the makefile, it globally causes make to delete targets whose commands fail. @@ -2221,14 +2371,14 @@ This setting can be used to help prevent half-finished or malformed targets from being left around and corrupting future rebuilds. .It Ic .END Any command lines attached to this target are executed after everything -else is done. +else is done successfully. .It Ic .ERROR Any command lines attached to this target are executed when another target fails. The -.Ic .ERROR_TARGET +.Va .ERROR_TARGET variable is set to the target that failed. See also -.Ic MAKE_PRINT_VAR_ON_ERROR . +.Va MAKE_PRINT_VAR_ON_ERROR . .It Ic .IGNORE Mark each of the sources with the .Ic .IGNORE @@ -2239,24 +2389,24 @@ option. .It Ic .INTERRUPT If .Nm -is interrupted, the commands for this target will be executed. +is interrupted, the commands for this target are executed. .It Ic .MAIN If no target is specified when .Nm -is invoked, this target will be built. +is invoked, this target is built. .It Ic .MAKEFLAGS This target provides a way to specify flags for .Nm -when the makefile is used. +at the time when the makefiles are read. The flags are as if typed to the shell, though the .Fl f -option will have +option has no effect. .\" XXX: NOT YET!!!! .\" .It Ic .NOTPARALLEL .\" The named targets are executed in non parallel mode. .\" If no targets are -.\" specified, then all targets are executed in non parallel mode. +.\" specified, all targets are executed in non parallel mode. .It Ic .NOPATH Apply the .Ic .NOPATH @@ -2267,14 +2417,14 @@ Disable parallel mode. Synonym for .Ic .NOTPARALLEL , for compatibility with other pmake variants. +.It Ic .NOREADONLY +clear the read-only attribute from the global variables specified as sources. .It Ic .OBJDIR The source is a new value for .Sq Va .OBJDIR . If it exists, .Nm -will -.Xr chdir 2 -to it and update the value of +changes the current working directory to it and updates the value of .Sq Va .OBJDIR . .It Ic .ORDER In parallel mode, the named targets are made in sequence. @@ -2294,17 +2444,16 @@ b: a .\" .It Ic .PARALLEL .\" The named targets are executed in parallel mode. .\" If no targets are -.\" specified, then all targets are executed in parallel mode. +.\" specified, all targets are executed in parallel mode. .It Ic .PATH The sources are directories which are to be searched for files not found in the current directory. -If no sources are specified, any previously specified directories are -deleted. +If no sources are specified, +any previously specified directories are removed from the search path. If the source is the special .Ic .DOTLAST -target, then the current working -directory is searched last. -.It Ic .PATH. Ns Va suffix +target, the current working directory is searched last. +.It Ic .PATH. Ns Ar suffix Like .Ic .PATH but applies only to files with a particular suffix. @@ -2328,55 +2477,56 @@ If .Nm is run with the .Fl r -flag, then only +flag, only .Ql posix.mk -will contribute to the default rules. +contributes to the default rules. .It Ic .PRECIOUS Apply the .Ic .PRECIOUS attribute to any specified sources. If no sources are specified, the .Ic .PRECIOUS -attribute is applied to every -target in the file. +attribute is applied to every target in the file. +.It Ic .READONLY +set the read-only attribute on the global variables specified as sources. .It Ic .SHELL Sets the shell that .Nm -will use to execute commands. +uses to execute commands in jobs mode. The sources are a set of -.Ar field=value +.Ar field\| Ns Cm \&= Ns Ar value pairs. -.Bl -tag -width hasErrCtls -.It Ar name +.Bl -tag -width ".Li hasErrCtls" +.It Li name This is the minimal specification, used to select one of the built-in shell specs; -.Ar sh , -.Ar ksh , +.Li sh , +.Li ksh , and -.Ar csh . -.It Ar path -Specifies the path to the shell. -.It Ar hasErrCtl +.Li csh . +.It Li path +Specifies the absolute path to the shell. +.It Li hasErrCtl Indicates whether the shell supports exit on error. -.It Ar check +.It Li check The command to turn on error checking. -.It Ar ignore +.It Li ignore The command to disable error checking. -.It Ar echo +.It Li echo The command to turn on echoing of commands executed. -.It Ar quiet +.It Li quiet The command to turn off echoing of commands executed. -.It Ar filter +.It Li filter The output to filter after issuing the -.Ar quiet +.Li quiet command. It is typically identical to -.Ar quiet . -.It Ar errFlag +.Li quiet . +.It Li errFlag The flag to pass the shell to enable error checking. -.It Ar echoFlag +.It Li echoFlag The flag to pass the shell to enable command echoing. -.It Ar newline +.It Li newline The string literal to pass the shell that results in a single newline character when used outside of any quoting characters. .El @@ -2407,10 +2557,18 @@ It allows the creation of suffix-transformation rules. .Pp Example: .Bd -literal -\&.SUFFIXES: .o +\&.SUFFIXES: .c .o \&.c.o: cc \-o ${.TARGET} \-c ${.IMPSRC} .Ed +.It Ic .SYSPATH +The sources are directories which are to be added to the system +include path which +.Nm +searches for makefiles. +If no sources are specified, +any previously specified directories are removed from the system +include path. .El .Sh ENVIRONMENT .Nm @@ -2439,17 +2597,17 @@ for more details. .Bl -tag -width /usr/share/mk -compact .It .depend list of dependencies -.It Makefile -list of dependencies .It makefile -list of dependencies +first default makefile if no makefile is specified on the command line +.It Makefile +second default makefile if no makefile is specified on the command line .It sys.mk system makefile .It /usr/share/mk system makefile directory .El .Sh COMPATIBILITY -The basic make syntax is compatible between different versions of make; +The basic make syntax is compatible between different make variants; however the special variables, variable modifiers and conditionals are not. .Ss Older versions An incomplete list of changes in older versions of @@ -2478,13 +2636,15 @@ The and .Ic .ORDER declarations and most functionality pertaining to parallelization. -(GNU make supports parallelization but lacks these features needed to +(GNU make supports parallelization but lacks the features needed to control it effectively.) .It Directives, including for loops and conditionals and most of the forms of include files. (GNU make has its own incompatible and less powerful syntax for conditionals.) +.\" The "less powerful" above means that GNU make does not have the +.\" make(target), target(target) and commands(target) functions. .It All built-in variables that begin with a dot. .It @@ -2496,7 +2656,7 @@ and .Ic .SUFFIXES . .It Variable modifiers, except for the -.Dl :old=new +.Ql :old=new string substitution, which does not portably support globbing with .Ql % and historically only works on declared suffixes. @@ -2513,7 +2673,7 @@ Some features are somewhat more portable, such as assignment with and .Ic != . The -.Ic .PATH +.Va .PATH functionality is based on an older feature .Ic VPATH found in GNU make and many versions of SVR4 make; however, @@ -2540,22 +2700,22 @@ command appeared in .At v7 . This .Nm -implementation is based on Adam De Boor's pmake program which was written -for Sprite at Berkeley. +implementation is based on Adam de Boor's pmake program, +which was written for Sprite at Berkeley. It was designed to be a parallel distributed make running jobs on different machines using a daemon called .Dq customs . .Pp Historically the target/dependency -.Dq FRC +.Ic FRC has been used to FoRCe rebuilding (since the target/dependency -does not exist... unless someone creates an -.Dq FRC +does not exist ... unless someone creates an +.Pa FRC file). .Sh BUGS The .Nm -syntax is difficult to parse without actually acting on the data. +syntax is difficult to parse. For instance, finding the end of a variable's use should involve scanning each of the modifiers, using the correct terminator for each field. In many places diff --git a/contrib/bmake/make.c b/contrib/bmake/make.c index fa1e594a1b16..c9e59c40a033 100644 --- a/contrib/bmake/make.c +++ b/contrib/bmake/make.c @@ -1,4 +1,4 @@ -/* $NetBSD: make.c,v 1.255 2022/05/07 17:49:47 rillig Exp $ */ +/* $NetBSD: make.c,v 1.258 2022/12/05 23:28:08 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -104,7 +104,7 @@ #include "job.h" /* "@(#)make.c 8.1 (Berkeley) 6/6/93" */ -MAKE_RCSID("$NetBSD: make.c,v 1.255 2022/05/07 17:49:47 rillig Exp $"); +MAKE_RCSID("$NetBSD: make.c,v 1.258 2022/12/05 23:28:08 rillig Exp $"); /* Sequence # to detect recursion. */ static unsigned int checked_seqno = 1; @@ -175,17 +175,15 @@ GNodeFlags_ToString(GNodeFlags flags, void **freeIt) Buffer buf; Buf_InitSize(&buf, 32); -#define ADD(flag, name) Buf_AddFlag(&buf, flags.flag, name) - ADD(remake, "REMAKE"); - ADD(childMade, "CHILDMADE"); - ADD(force, "FORCE"); - ADD(doneWait, "DONE_WAIT"); - ADD(doneOrder, "DONE_ORDER"); - ADD(fromDepend, "FROM_DEPEND"); - ADD(doneAllsrc, "DONE_ALLSRC"); - ADD(cycle, "CYCLE"); - ADD(doneCycle, "DONECYCLE"); -#undef ADD + Buf_AddFlag(&buf, flags.remake, "REMAKE"); + Buf_AddFlag(&buf, flags.childMade, "CHILDMADE"); + Buf_AddFlag(&buf, flags.force, "FORCE"); + Buf_AddFlag(&buf, flags.doneWait, "DONE_WAIT"); + Buf_AddFlag(&buf, flags.doneOrder, "DONE_ORDER"); + Buf_AddFlag(&buf, flags.fromDepend, "FROM_DEPEND"); + Buf_AddFlag(&buf, flags.doneAllsrc, "DONE_ALLSRC"); + Buf_AddFlag(&buf, flags.cycle, "CYCLE"); + Buf_AddFlag(&buf, flags.doneCycle, "DONECYCLE"); return buf.len == 0 ? "none" : (*freeIt = Buf_DoneData(&buf)); } @@ -462,7 +460,7 @@ Make_HandleUse(GNode *cgn, GNode *pgn) } pgn->type |= - cgn->type & ~(OP_OPMASK | OP_USE | OP_USEBEFORE | OP_TRANSFORM); + cgn->type & (unsigned)~(OP_OPMASK | OP_USE | OP_USEBEFORE | OP_TRANSFORM); } /* @@ -820,7 +818,7 @@ UnmarkChildren(GNode *gn) for (ln = gn->children.first; ln != NULL; ln = ln->next) { GNode *child = ln->datum; - child->type &= ~OP_MARK; + child->type &= (unsigned)~OP_MARK; } } @@ -1077,7 +1075,7 @@ MakeStartJobs(void) if (GNode_IsOODate(gn)) { DEBUG0(MAKE, "out-of-date\n"); if (opts.query) - return true; + return strcmp(gn->name, ".MAIN") != 0; GNode_SetLocalVars(gn); Job_Make(gn); have_token = false; diff --git a/contrib/bmake/make.h b/contrib/bmake/make.h index e4e374f71e0c..d62e2a3f507b 100644 --- a/contrib/bmake/make.h +++ b/contrib/bmake/make.h @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.303 2022/06/12 13:37:32 rillig Exp $ */ +/* $NetBSD: make.h,v 1.311 2023/01/26 20:48:17 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -632,7 +632,6 @@ extern pid_t myPid; #define MAKE_MAKEFILES ".MAKE.MAKEFILES" /* all loaded makefiles */ #define MAKE_LEVEL ".MAKE.LEVEL" /* recursion level */ #define MAKE_MAKEFILE_PREFERENCE ".MAKE.MAKEFILE_PREFERENCE" -#define MAKE_DEPENDFILE ".MAKE.DEPENDFILE" /* .depend */ #define MAKE_MODE ".MAKE.MODE" #ifndef MAKE_LEVEL_ENV # define MAKE_LEVEL_ENV "MAKELEVEL" @@ -813,10 +812,10 @@ void Compat_MakeAll(GNodeList *); void Compat_Make(GNode *, GNode *); /* cond.c */ +extern unsigned int cond_depth; CondResult Cond_EvalCondition(const char *) MAKE_ATTR_USE; CondResult Cond_EvalLine(const char *) MAKE_ATTR_USE; -void Cond_restore_depth(unsigned int); -unsigned int Cond_save_depth(void) MAKE_ATTR_USE; +void Cond_EndFile(void); /* dir.c; see also dir.h */ @@ -845,6 +844,7 @@ void For_Run(unsigned, unsigned); bool For_NextIteration(struct ForLoop *, Buffer *); char *ForLoop_Details(struct ForLoop *); void ForLoop_Free(struct ForLoop *); +void For_Break(struct ForLoop *); /* job.c */ void JobReapChild(pid_t, int, bool); @@ -857,7 +857,7 @@ void Fatal(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2) MAKE_ATTR_DEAD; void Punt(const char *, ...) MAKE_ATTR_PRINTFLIKE(1, 2) MAKE_ATTR_DEAD; void DieHorribly(void) MAKE_ATTR_DEAD; void Finish(int) MAKE_ATTR_DEAD; -bool unlink_file(const char *) MAKE_ATTR_USE; +int unlink_file(const char *) MAKE_ATTR_USE; void execDie(const char *, const char *); char *getTmpdir(void) MAKE_ATTR_USE; bool ParseBoolean(const char *, bool) MAKE_ATTR_USE; @@ -878,6 +878,7 @@ void Parse_PushInput(const char *, unsigned, unsigned, Buffer, struct ForLoop *); void Parse_MainName(GNodeList *); int Parse_NumErrors(void) MAKE_ATTR_USE; +unsigned int CurFile_CondMinDepth(void) MAKE_ATTR_USE; /* suff.c */ @@ -1041,10 +1042,12 @@ void Var_ReexportVars(void); void Var_Export(VarExportMode, const char *); void Var_ExportVars(const char *); void Var_UnExport(bool, const char *); +void Var_ReadOnly(const char *, bool); void Global_Set(const char *, const char *); void Global_Append(const char *, const char *); void Global_Delete(const char *); +void Global_Set_ReadOnly(const char *, const char *); /* util.c */ typedef void (*SignalProc)(int); @@ -1068,6 +1071,10 @@ int str2Lst_Append(StringList *, char *); void GNode_FprintDetails(FILE *, const char *, const GNode *, const char *); bool GNode_ShouldExecute(GNode *gn) MAKE_ATTR_USE; +#ifndef HAVE_STRLCPY +size_t strlcpy(char *, const char *, size_t); +#endif + /* See if the node was seen on the left-hand side of a dependency operator. */ MAKE_INLINE bool MAKE_ATTR_USE GNode_IsTarget(const GNode *gn) diff --git a/contrib/bmake/meta.c b/contrib/bmake/meta.c index f400485d25c0..f31a4666fce7 100644 --- a/contrib/bmake/meta.c +++ b/contrib/bmake/meta.c @@ -1,4 +1,4 @@ -/* $NetBSD: meta.c,v 1.200 2022/04/15 12:28:16 rillig Exp $ */ +/* $NetBSD: meta.c,v 1.201 2022/09/28 16:34:47 sjg Exp $ */ /* * Implement 'meta' mode. @@ -281,15 +281,19 @@ meta_name(char *mname, size_t mnamelen, /* on some systems dirname may modify its arg */ tp = bmake_strdup(tname); dtp = dirname(tp); - if (strcmp(dname, dtp) == 0) - snprintf(mname, mnamelen, "%s.meta", tname); - else { + if (strcmp(dname, dtp) == 0) { + if (snprintf(mname, mnamelen, "%s.meta", tname) >= (int)mnamelen) + mname[mnamelen - 1] = '\0'; + } else { + int x; + ldname = strlen(dname); if (strncmp(dname, dtp, ldname) == 0 && dtp[ldname] == '/') - snprintf(mname, mnamelen, "%s/%s.meta", dname, &tname[ldname+1]); + x = snprintf(mname, mnamelen, "%s/%s.meta", dname, &tname[ldname+1]); else - snprintf(mname, mnamelen, "%s/%s.meta", dname, tname); - + x = snprintf(mname, mnamelen, "%s/%s.meta", dname, tname); + if (x >= (int)mnamelen) + mname[mnamelen - 1] = '\0'; /* * Replace path separators in the file name after the * current object directory path. @@ -769,7 +773,9 @@ meta_job_error(Job *job, GNode *gn, bool ignerr, int status) } if (gn != NULL) Global_Set(".ERROR_TARGET", GNode_Path(gn)); - getcwd(cwd, sizeof cwd); + if (getcwd(cwd, sizeof cwd) == NULL) + Punt("Cannot get cwd: %s", strerror(errno)); + Global_Set(".ERROR_CWD", cwd); if (pbm->meta_fname[0] != '\0') { Global_Set(".ERROR_META_FILE", pbm->meta_fname); @@ -1443,18 +1449,18 @@ meta_oodate(GNode *gn, bool oodate) continue; /* no point */ /* Check vs latestdir */ - snprintf(fname1, sizeof fname1, "%s/%s", latestdir, p); - sdirs[sdx++] = fname1; + if (snprintf(fname1, sizeof fname1, "%s/%s", latestdir, p) < (int)(sizeof fname1)) + sdirs[sdx++] = fname1; if (strcmp(latestdir, lcwd) != 0) { /* Check vs lcwd */ - snprintf(fname2, sizeof fname2, "%s/%s", lcwd, p); - sdirs[sdx++] = fname2; + if (snprintf(fname2, sizeof fname2, "%s/%s", lcwd, p) < (int)(sizeof fname2)) + sdirs[sdx++] = fname2; } if (strcmp(lcwd, cwd) != 0) { /* Check vs cwd */ - snprintf(fname3, sizeof fname3, "%s/%s", cwd, p); - sdirs[sdx++] = fname3; + if (snprintf(fname3, sizeof fname3, "%s/%s", cwd, p) < (int)(sizeof fname3)) + sdirs[sdx++] = fname3; } } sdirs[sdx++] = NULL; diff --git a/contrib/bmake/mk/ChangeLog b/contrib/bmake/mk/ChangeLog index b1a8313b929d..92606f6bfbe5 100644 --- a/contrib/bmake/mk/ChangeLog +++ b/contrib/bmake/mk/ChangeLog @@ -1,3 +1,35 @@ +2023-01-20 Simon J Gerraty + + * install-mk (MK_VERSION): 20230120 + + * sys.vars.mk: add M_On and M_Onr also cleanup to be more + consistent wrt testing MAKE_VERSION + +2023-01-12 Simon J Gerraty + + * install-mk (MK_VERSION): 20230112 + + * meta2deps.{py,sh}: assert if filemon data is truncated + we should see the '# Bye bye' record - assert if we do not. + +2022-09-09 Simon J Gerraty + + * install-mk (MK_VERSION): 20220909 + + * sys/Linux.mk set EGREP to grep -E to avoid deprecation warnings + +2022-09-06 Simon J Gerraty + + * dirdeps-options.mk: explain the need to use + ${DEP_${TARGET_SPEC_VAR}:U${TARGET_SPEC_VAR}} when refering to + ${TARGET_SPEC_VAR} + +2022-09-03 Simon J Gerraty + + * install-mk (MK_VERSION): 20220903 + + * M_cmpv handle more than 3 dots and clear leading 0's + 2022-07-20 Simon J Gerraty * install-mk (MK_VERSION): 20220720 diff --git a/contrib/bmake/mk/compiler.mk b/contrib/bmake/mk/compiler.mk index 83c0cead8f25..ce394c3275bf 100644 --- a/contrib/bmake/mk/compiler.mk +++ b/contrib/bmake/mk/compiler.mk @@ -1,4 +1,4 @@ -# $Id: compiler.mk,v 1.10 2021/12/08 05:56:50 sjg Exp $ +# $Id: compiler.mk,v 1.11 2022/09/09 17:44:29 sjg Exp $ # # @(#) Copyright (c) 2019, Simon J. Gerraty # @@ -23,7 +23,7 @@ COMPILER_VERSION = 0 .if empty(COMPILER_TYPE) || empty(COMPILER_VERSION) # gcc does not always say gcc _v != (${CC} --version) 2> /dev/null | \ - egrep -i 'clang|cc|[1-9]\.[0-9]|Free Software Foundation'; echo + ${EGREP:Uegrep} -i 'clang|cc|[1-9]\.[0-9]|Free Software Foundation'; echo .if empty(COMPILER_TYPE) .if ${_v:Mclang} != "" COMPILER_TYPE = clang diff --git a/contrib/bmake/mk/dirdeps-options.mk b/contrib/bmake/mk/dirdeps-options.mk index b31d2033ae98..9a97615bbeb8 100644 --- a/contrib/bmake/mk/dirdeps-options.mk +++ b/contrib/bmake/mk/dirdeps-options.mk @@ -1,4 +1,4 @@ -# $Id: dirdeps-options.mk,v 1.20 2022/03/17 20:11:36 sjg Exp $ +# $Id: dirdeps-options.mk,v 1.21 2022/09/06 22:18:45 sjg Exp $ # # @(#) Copyright (c) 2018-2022, Simon J. Gerraty # @@ -42,6 +42,13 @@ # so we qualify MK_FOO with .${TARGET_SPEC} and each component # TARGET_SPEC_VAR (in reverse order) before using MK_FOO. # +# Because Makefile.depend.options are processed at both level 0 (when +# computing DIRDEPS to build) and higher (when updating +# Makefile.depend* after successful build), it is important that +# all references to TARGET_SPEC_VARs should use the syntax +# ${DEP_${TARGET_SPEC_VAR}:U${TARGET_SPEC_VAR}} to ensure correct +# behavior. +# # This should have been set by Makefile.depend.options # before including us diff --git a/contrib/bmake/mk/dirdeps.mk b/contrib/bmake/mk/dirdeps.mk index ee31e47c76c5..94b493a77fa6 100644 --- a/contrib/bmake/mk/dirdeps.mk +++ b/contrib/bmake/mk/dirdeps.mk @@ -1,4 +1,4 @@ -# $Id: dirdeps.mk,v 1.151 2022/01/28 01:13:14 sjg Exp $ +# $Id: dirdeps.mk,v 1.152 2022/08/01 23:09:19 sjg Exp $ # Copyright (c) 2010-2022, Simon J. Gerraty # Copyright (c) 2010-2018, Juniper Networks, Inc. @@ -401,7 +401,7 @@ DIRDEP_LOADAVG_LAST = 0 # Note: expr(1) will exit 1 if the expression evaluates to 0 # hence the || true DIRDEP_LOADAVG_REPORT = \ - test -z "${"${expr ${now_utc} - ${DIRDEP_LOADAVG_INTEVAL:U60} - ${DIRDEP_LOADAVG_LAST} || true:L:sh:N-*}":?yes${DIRDEP_LOADAVG_LAST::=${now_utc}}:}" || \ + test -z "${"${expr ${now_utc} - ${DIRDEP_LOADAVG_INTERVAL:U60} - ${DIRDEP_LOADAVG_LAST} || true:L:sh:N-*}":?yes${DIRDEP_LOADAVG_LAST::=${now_utc}}:}" || \ echo "${TRACER}`${DIRDEP_LOADAVG_CMD}`" # we suppress SUBDIR when visiting the leaves diff --git a/contrib/bmake/mk/gendirdeps.mk b/contrib/bmake/mk/gendirdeps.mk index b449bb5cc9d9..1ff2036237ed 100644 --- a/contrib/bmake/mk/gendirdeps.mk +++ b/contrib/bmake/mk/gendirdeps.mk @@ -1,4 +1,4 @@ -# $Id: gendirdeps.mk,v 1.47 2022/04/23 21:37:03 sjg Exp $ +# $Id: gendirdeps.mk,v 1.48 2022/09/09 17:44:29 sjg Exp $ # Copyright (c) 2011-2020, Simon J. Gerraty # Copyright (c) 2010-2018, Juniper Networks, Inc. @@ -88,7 +88,7 @@ META_FILES := ${META_FILES:T:O:u} # they should all be absolute paths SKIP_GENDIRDEPS ?= .if !empty(SKIP_GENDIRDEPS) -_skip_gendirdeps = egrep -v '^(${SKIP_GENDIRDEPS:O:u:ts|})' | +_skip_gendirdeps = ${EGREP:Uegrep} -v '^(${SKIP_GENDIRDEPS:O:u:ts|})' | .else _skip_gendirdeps = .endif diff --git a/contrib/bmake/mk/install-mk b/contrib/bmake/mk/install-mk index 5fbdd49e26b5..51fb68b959a0 100644 --- a/contrib/bmake/mk/install-mk +++ b/contrib/bmake/mk/install-mk @@ -55,7 +55,7 @@ # Simon J. Gerraty # RCSid: -# $Id: install-mk,v 1.220 2022/07/22 20:08:56 sjg Exp $ +# $Id: install-mk,v 1.224 2023/01/20 17:34:06 sjg Exp $ # # @(#) Copyright (c) 1994 Simon J. Gerraty # @@ -70,7 +70,7 @@ # sjg@crufty.net # -MK_VERSION=20220720 +MK_VERSION=20230120 OWNER= GROUP= MODE=444 @@ -131,6 +131,12 @@ realpath() { echo $1 } +# some Linux systems have deprecated egrep in favor of grep -E +case "`echo bmake | egrep 'a' 2>&1`" in +*"grep -E"*) egrep='grep -E';; +*) egrep=egrep;; +esac + if [ -s $SYS_MK -a -d $dest ]; then # if this is a BSD system we don't want to touch $SYS_MK dest=`realpath $dest` @@ -160,8 +166,8 @@ if [ $mksrc = $dest ]; then SKIP_MKFILES=: else # we do not install the examples - mk_files=`grep '^[a-z].*\.mk' FILES | egrep -v '(examples/|^sys\.mk|sys/)'` - mk_scripts=`egrep '^[a-z].*\.(sh|py)' FILES | egrep -v '/'` + mk_files=`grep '^[a-z].*\.mk' FILES | $egrep -v '(examples/|^sys\.mk|sys/)'` + mk_scripts=`$egrep '^[a-z].*\.(sh|py)' FILES | $egrep -v '/'` sys_mk_files=`grep 'sys/.*\.mk' FILES` SKIP_MKFILES= [ -z "$SKIP_SYS_MK" ] && mk_files="sys.mk $mk_files" diff --git a/contrib/bmake/mk/meta.autodep.mk b/contrib/bmake/mk/meta.autodep.mk index f9ed6d305b99..cd08ac3b3520 100644 --- a/contrib/bmake/mk/meta.autodep.mk +++ b/contrib/bmake/mk/meta.autodep.mk @@ -1,4 +1,4 @@ -# $Id: meta.autodep.mk,v 1.55 2021/12/13 08:12:01 sjg Exp $ +# $Id: meta.autodep.mk,v 1.56 2022/09/09 17:44:29 sjg Exp $ # # @(#) Copyright (c) 2010, Simon J. Gerraty @@ -174,7 +174,7 @@ DEPEND_SUFFIXES += .c .h .cpp .hpp .cxx .hxx .cc .hh .endif .depend: .NOMETA $${.MAKE.META.CREATED} ${_this} @echo "Updating $@: ${.OODATE:T:[1..8]}" - @egrep -i '^R .*\.(${DEPEND_SUFFIXES:tl:O:u:S,^.,,:ts|})$$' /dev/null ${.MAKE.META.FILES:T:O:u:${META_FILE_FILTER:ts:}:M*o.meta} | \ + @${EGREP:Uegrep} -i '^R .*\.(${DEPEND_SUFFIXES:tl:O:u:S,^.,,:ts|})$$' /dev/null ${.MAKE.META.FILES:T:O:u:${META_FILE_FILTER:ts:}:M*o.meta} | \ sed -e 's, \./, ,${OBJDIR_REFS:O:u:@d@;s, $d/, ,@};/\//d' \ -e 's,^\([^/][^/]*\).meta...[0-9]* ,\1: ,' | \ sort -u | \ diff --git a/contrib/bmake/mk/meta.stage.mk b/contrib/bmake/mk/meta.stage.mk index 1da45f4f2167..e4ca45820110 100644 --- a/contrib/bmake/mk/meta.stage.mk +++ b/contrib/bmake/mk/meta.stage.mk @@ -1,4 +1,4 @@ -# $Id: meta.stage.mk,v 1.64 2021/12/08 05:56:50 sjg Exp $ +# $Id: meta.stage.mk,v 1.65 2022/09/09 17:44:29 sjg Exp $ # # @(#) Copyright (c) 2011-2017, Simon J. Gerraty # @@ -354,7 +354,7 @@ all: stale_staged # get a list of paths that we have previously staged to those same dirs # anything in the 2nd list but not the first is stale - remove it. stale_staged: staging .NOMETA - @egrep '^[WL] .*${STAGE_OBJTOP}' /dev/null ${.MAKE.META.FILES:M*stage_*} | \ + @${EGREP:Uegrep} '^[WL] .*${STAGE_OBJTOP}' /dev/null ${.MAKE.META.FILES:M*stage_*} | \ sed "/\.dirdep/d;s,.* '*\(${STAGE_OBJTOP}/[^ '][^ ']*\).*,\1," | \ sort > ${.TARGET}.staged1 @grep -l '${_dirdep}' /dev/null ${_STAGED_DIRS:M${STAGE_OBJTOP}*:O:u:@d@$d/*.dirdep@} | \ diff --git a/contrib/bmake/mk/meta2deps.py b/contrib/bmake/mk/meta2deps.py index bc6975182429..d7820ec71b5b 100755 --- a/contrib/bmake/mk/meta2deps.py +++ b/contrib/bmake/mk/meta2deps.py @@ -37,7 +37,7 @@ """ RCSid: - $Id: meta2deps.py,v 1.44 2022/01/29 02:42:01 sjg Exp $ + $Id: meta2deps.py,v 1.45 2023/01/18 01:35:24 sjg Exp $ Copyright (c) 2011-2020, Simon J. Gerraty Copyright (c) 2011-2017, Juniper Networks, Inc. @@ -448,12 +448,13 @@ def parse(self, name=None, file=None): pid_cwd = {} pid_last_dir = {} last_pid = 0 + eof_token = False self.line = 0 if self.curdir: self.seenit(self.curdir) # we ignore this - interesting = 'CEFLRVX' + interesting = '#CEFLRVX' for line in f: self.line += 1 # ignore anything we don't care about @@ -480,6 +481,12 @@ def parse(self, name=None, file=None): print("%s: CWD=%s" % (self.name, cwd), file=self.debug_out) continue + if w[0] == '#': + # check the file has not been truncated + if line.find('Bye') > 0: + eof_token = True + continue + pid = int(w[1]) if pid != last_pid: if last_pid: @@ -535,7 +542,11 @@ def parse(self, name=None, file=None): continue self.parse_path(path, cwd, w[0], w) - assert(version > 0) + if version == 0: + raise AssertionError('missing filemon data') + if not eof_token: + raise AssertionError('truncated filemon data') + setid_pids = [] # self.pids should be empty! for pid,path in self.pids.items(): diff --git a/contrib/bmake/mk/meta2deps.sh b/contrib/bmake/mk/meta2deps.sh index 4b7f9588987a..d590a383f82e 100755 --- a/contrib/bmake/mk/meta2deps.sh +++ b/contrib/bmake/mk/meta2deps.sh @@ -75,7 +75,7 @@ # RCSid: -# $Id: meta2deps.sh,v 1.18 2022/01/28 21:17:43 sjg Exp $ +# $Id: meta2deps.sh,v 1.20 2023/01/18 01:35:24 sjg Exp $ # Copyright (c) 2010-2013, Juniper Networks, Inc. # All rights reserved. @@ -137,6 +137,13 @@ add_list() { eval "$name=\"$list\"" } +# some Linux systems have deprecated egrep in favor of grep -E +# but not everyone supports that +case "`echo bmake | egrep 'a|b' 2>&1`" in +bmake) ;; +*) egrep() { grep -E "$@"; } +esac + _excludes_f() { egrep -v "$EXCLUDES" } @@ -239,8 +246,8 @@ meta2deps() { ;; *) cat /dev/null "$@";; esac 2> /dev/null | - sed -e 's,^CWD,C C,;/^[CREFLMVX] /!d' -e "s,',,g" | - $_excludes | ( version=no epids= xpids= + sed -e 's,^CWD,C C,;/^[#CREFLMVX] /!d' -e "s,',,g" | + $_excludes | ( version=no epids= xpids= eof_token=no while read op pid path junk do : op=$op pid=$pid path=$path @@ -258,10 +265,15 @@ meta2deps() { *) ;; esac version=0 + case "$eof_token" in + no) ;; # ignore + 0) error "truncated filemon data";; + esac + eof_token=0 continue ;; $pid,$pid) ;; - *) + [1-9]*) case "$lpid" in "") ;; *) eval ldir_$lpid=$ldir;; @@ -289,6 +301,8 @@ meta2deps() { eval cwd_$path=$cwd ldir_$path=$ldir continue ;; + \#,bye) eof_token=1; continue;; + \#*) continue;; *) dir=${path%/*} case "$op" in E) # setid apps get no tracing so we won't see eXit @@ -392,6 +406,10 @@ meta2deps() { case "$version" in 0) error "no filemon data";; esac + : eof_token=$eof_token + case "$eof_token" in + 0) error "truncated filemon data";; + esac for p in $epids do : p=$p diff --git a/contrib/bmake/mk/sys.clean-env.mk b/contrib/bmake/mk/sys.clean-env.mk index 85e829c0a8f2..1d0119d6d37a 100644 --- a/contrib/bmake/mk/sys.clean-env.mk +++ b/contrib/bmake/mk/sys.clean-env.mk @@ -1,4 +1,4 @@ -# $Id: sys.clean-env.mk,v 1.24 2022/01/15 17:34:42 sjg Exp $ +# $Id: sys.clean-env.mk,v 1.25 2022/09/09 17:44:29 sjg Exp $ # # @(#) Copyright (c) 2009, Simon J. Gerraty # @@ -68,7 +68,7 @@ MAKE_ENV_SAVE_VAR_LIST += \ USER \ ${_env_vars:${MAKE_ENV_SAVE_EXCLUDE_LIST:${M_ListToSkip}}} -_env_vars != env | egrep '^(${MAKE_ENV_SAVE_PREFIX_LIST:ts|})' | sed 's,=.*,,'; echo +_env_vars != env | ${EGREP:Uegrep} '^(${MAKE_ENV_SAVE_PREFIX_LIST:ts|})' | sed 's,=.*,,'; echo _export_list = .for v in ${MAKE_ENV_SAVE_VAR_LIST:O:u} @@ -125,6 +125,6 @@ MAKEOBJDIR = ${.CURDIR:S,${SRCTOP},${OBJTOP},} .endif #.info ${_tricky_env_vars:@v@${.newline}$v=${$v}@} #showenv: -# @env | egrep 'OBJ|SRC' +# @env | ${EGREP:Uegrep} 'OBJ|SRC' .endif # MAKEOBJDIR .endif # level 0 diff --git a/contrib/bmake/mk/sys.mk b/contrib/bmake/mk/sys.mk index e39d5ac74548..966409870cc5 100644 --- a/contrib/bmake/mk/sys.mk +++ b/contrib/bmake/mk/sys.mk @@ -1,4 +1,4 @@ -# $Id: sys.mk,v 1.53 2021/12/13 05:50:13 sjg Exp $ +# $Id: sys.mk,v 1.54 2022/09/09 17:44:29 sjg Exp $ # # @(#) Copyright (c) 2003-2009, Simon J. Gerraty # @@ -68,6 +68,9 @@ SYS_OS_MK := ${_sys_mk} .export SYS_OS_MK .endif +# some sys/ may have set this to grep -E +EGREP ?= egrep + # some options we need to know early OPTIONS_DEFAULT_NO += \ DIRDEPS_BUILD \ diff --git a/contrib/bmake/mk/sys.vars.mk b/contrib/bmake/mk/sys.vars.mk index b759cc3f5cfb..f62adbcf08ba 100644 --- a/contrib/bmake/mk/sys.vars.mk +++ b/contrib/bmake/mk/sys.vars.mk @@ -1,6 +1,6 @@ -# $Id: sys.vars.mk,v 1.9 2022/02/05 19:04:53 sjg Exp $ +# $Id: sys.vars.mk,v 1.12 2023/01/20 17:34:06 sjg Exp $ # -# @(#) Copyright (c) 2003-2009, Simon J. Gerraty +# @(#) Copyright (c) 2003-2023, Simon J. Gerraty # # This file is provided in the hope that it will # be of use. There is absolutely NO WARRANTY. @@ -17,15 +17,10 @@ # It relies on the fact that conditionals and dependencies are resolved # at the time they are read. # -# _this ?= ${.PARSEFILE} +# _this ?= ${.PARSEDIR:tA}/${.PARSEFILE} # .if !target(__${_this}__) # __${_this}__: .NOTMAIN # -.if ${MAKE_VERSION:U0} > 20100408 -_this = ${.PARSEDIR:tA}/${.PARSEFILE} -.else -_this = ${.PARSEDIR}/${.PARSEFILE} -.endif # if this is an ancient version of bmake MAKE_VERSION ?= 0 @@ -34,12 +29,18 @@ MAKE_VERSION ?= 0 MAKE_VERSION := ${MAKE_VERSION:[1]:C,.*-,,} .endif +.if ${MAKE_VERSION} < 20100414 +_this = ${.PARSEDIR}/${.PARSEFILE} +.else +_this = ${.PARSEDIR:tA}/${.PARSEFILE} +.endif + # some useful modifiers # A useful trick for testing multiple :M's against something # :L says to use the variable's name as its value - ie. literal # got = ${clean* destroy:${M_ListToMatch:S,V,.TARGETS,}} -M_ListToMatch = L:@m@$${V:M$$m}@ +M_ListToMatch = L:@m@$${V:U:M$$m}@ # match against our initial targets (see above) M_L_TARGETS = ${M_ListToMatch:S,V,_TARGETS,} @@ -79,35 +80,44 @@ M_JOT = [1]:@x@i=1;while [ $$$$i -le $$x ]; do echo $$$$i; i=$$$$((i + 1)); done .endif # ${LIST:${M_RANGE}} is 1 2 3 4 5 if LIST has 5 words -.if ${MAKE_VERSION} >= 20170130 -M_RANGE = range -.else +.if ${MAKE_VERSION} < 20170130 M_RANGE = [#]:${M_JOT} +.else +M_RANGE = range .endif # convert a path to a valid shell variable M_P2V = tu:C,[./-],_,g # convert path to absolute -.if ${MAKE_VERSION:U0} > 20100408 -M_tA = tA -.else +.if ${MAKE_VERSION} < 20100414 M_tA = C,.*,('cd' & \&\& 'pwd') 2> /dev/null || echo &,:sh -.endif - -.if ${MAKE_VERSION:U0} >= 20170130 -# M_cmpv allows comparing dotted versions like 3.1.2 -# ${3.1.2:L:${M_cmpv}} -> 3001002 -# we use big jumps to handle 3 digits per dot: -# ${123.456.789:L:${M_cmpv}} -> 123456789 -M_cmpv.units = 1 1000 1000000 -M_cmpv = S,., ,g:_:range:@i@+ $${_:[-$$i]} \* $${M_cmpv.units:[$$i]}@:S,^,expr 0 ,1:sh +.else +M_tA = tA .endif # absoulte path to what we are reading. _PARSEDIR = ${.PARSEDIR:${M_tA}} +.if ${MAKE_VERSION} >= 20170130 +# M_cmpv allows comparing dotted versions like 3.1.2 +# ${3.1.2:L:${M_cmpv}} -> 3001002 +# we use big jumps to handle 3 digits per dot: +# ${123.456.789:L:${M_cmpv}} -> 123456789 +M_cmpv.units = 1 1000 1000000 1000000000 1000000000000 +M_cmpv = S,., ,g:C,^0*([0-9]),\1,:_:range:@i@+ $${_:[-$$i]} \* $${M_cmpv.units:[$$i]}@:S,^,expr 0 ,1:sh +.endif + # many projects use MAJOR MINOR PATCH versioning # ${OPENSSL:${M_M.M.P_VERSION}} is equivalent to # ${OPENSSL_MAJOR_VERSION}.${OPENSSL_MINOR_VERSION}.${OPENSSL_PATCH_VERSION} M_M.M.P_VERSION = L:@v@$${MAJOR MINOR PATCH:L:@t@$${$$v_$$t_VERSION:U0}@}@:ts. + +# numeric sort +.if ${MAKE_VERSION} < 20210803 +M_On = O +M_Onr = O +.else +M_On = On +M_Onr = Onr +.endif diff --git a/contrib/bmake/mk/sys/Linux.mk b/contrib/bmake/mk/sys/Linux.mk index fbba793e734c..0c95419c0abe 100644 --- a/contrib/bmake/mk/sys/Linux.mk +++ b/contrib/bmake/mk/sys/Linux.mk @@ -1,4 +1,4 @@ -# $Id: Linux.mk,v 1.15 2022/03/25 23:43:06 sjg Exp $ +# $Id: Linux.mk,v 1.16 2022/09/09 17:44:29 sjg Exp $ # $NetBSD: sys.mk,v 1.19.2.1 1994/07/26 19:58:31 cgd Exp $ # @(#)sys.mk 5.11 (Berkeley) 3/13/91 @@ -186,3 +186,7 @@ ${CXX_SUFFIXES:%=%.a}: rm -f ${.TARGET} cp ${.IMPSRC} ${.TARGET} chmod a+x ${.TARGET} + + +# egrep is deprecated +EGREP = grep -E diff --git a/contrib/bmake/mkdeps.sh b/contrib/bmake/mkdeps.sh index dd87c4f5020e..3e4ea6711aa9 100755 --- a/contrib/bmake/mkdeps.sh +++ b/contrib/bmake/mkdeps.sh @@ -40,7 +40,7 @@ # # RCSid: -# $Id: mkdeps.sh,v 1.23 2002/11/29 06:58:59 sjg Exp $ +# $Id: mkdeps.sh,v 1.24 2022/09/09 18:44:56 sjg Exp $ # # @(#) Copyright (c) 1993 Simon J. Gerraty # @@ -119,6 +119,13 @@ else fi fi +# some Linux systems have deprecated egrep in favor of grep -E +# but not everyone supports that +case "`echo bmake | egrep 'a|b' 2>&1`" in +bmake) ;; +*) egrep() { grep -E "$@"; } +esac + clean_up() { trap "" 2 3 trap 0 diff --git a/contrib/bmake/os.sh b/contrib/bmake/os.sh old mode 100755 new mode 100644 index 1fc66ecc6a63..6bf52420c90f --- a/contrib/bmake/os.sh +++ b/contrib/bmake/os.sh @@ -17,7 +17,7 @@ # Simon J. Gerraty # RCSid: -# $Id: os.sh,v 1.59 2021/11/14 04:18:00 sjg Exp $ +# $Id: os.sh,v 1.62 2023/01/17 18:30:21 sjg Exp $ # # @(#) Copyright (c) 1994 Simon J. Gerraty # @@ -78,10 +78,11 @@ toLower() { } K= -case $OS in +case "$OS" in AIX) # everyone loves to be different... OSMAJOR=`uname -v` - OSREL="$OSMAJOR.`uname -r`" + OSMINOR=`uname -r` + OSREL="$OSMAJOR.$OSMINOR" LOCAL_FS=jfs PS_AXC=-e SHARE_ARCH=$OS/$OSMAJOR.X @@ -229,16 +230,21 @@ HOST_TARGET=`echo ${OS}${OSMAJOR}-$HOST_ARCH | tr -d / | toLower` HOST_TARGET32=`echo ${OS}${OSMAJOR}-$HOST_ARCH32 | tr -d / | toLower` export HOST_TARGET HOST_TARGET32 -case `echo -n .` in -n*) N=; C="\c";; *) N=-n; C=;; esac +case `echo -n .` in -n*) echo_n=; echo_c="\c";; *) echo_n=-n; echo_c=;; esac Echo() { case "$1" in - -n) _n=$N _c=$C; shift;; - *) _n= _c=;; + -n) shift; echo $echo_n "$@$echo_c";; + *) echo "$@";; esac - echo $_n "$@" $_c } +# for systems that deprecate egrep +case "`echo egrep | egrep 'e|g' 2>&1`" in +egrep) ;; +*) egrep() { grep -E "$@"; };; +esac + export HOSTNAME HOST export OS MACHINE MACHINE_ARCH OSREL OSMAJOR LOCAL_FS TMP_DIRS MAILER N C K PS_AXC export LN SHARE_ARCH TR diff --git a/contrib/bmake/parse.c b/contrib/bmake/parse.c index c2ecdbe875bf..3193543f56bf 100644 --- a/contrib/bmake/parse.c +++ b/contrib/bmake/parse.c @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.681 2022/07/24 20:25:23 rillig Exp $ */ +/* $NetBSD: parse.c,v 1.692 2023/01/24 00:24:02 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -121,7 +121,7 @@ #include "pathnames.h" /* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: parse.c,v 1.681 2022/07/24 20:25:23 rillig Exp $"); +MAKE_RCSID("$NetBSD: parse.c,v 1.692 2023/01/24 00:24:02 sjg Exp $"); /* * A file being read. @@ -135,7 +135,8 @@ typedef struct IncludedFile { unsigned forBodyReadLines; /* the number of physical lines that have * been read from the file above the body of * the .for loop */ - unsigned int cond_depth; /* 'if' nesting when file opened */ + unsigned int condMinDepth; /* depth of nested 'if' directives, at the + * beginning of the file */ bool depending; /* state of doing_depend on EOF */ Buffer buf; /* the file's content or the body of the .for @@ -164,6 +165,7 @@ typedef enum ParseSpecial { SP_NOMETA, /* .NOMETA */ SP_NOMETA_CMP, /* .NOMETA_CMP */ SP_NOPATH, /* .NOPATH */ + SP_NOREADONLY, /* .NOREADONLY */ SP_NOT, /* Not special */ SP_NOTPARALLEL, /* .NOTPARALLEL or .NO_PARALLEL */ SP_NULL, /* .NULL; not mentioned in the manual page */ @@ -176,11 +178,13 @@ typedef enum ParseSpecial { SP_POSIX, /* .POSIX; not mentioned in the manual page */ #endif SP_PRECIOUS, /* .PRECIOUS */ + SP_READONLY, /* .READONLY */ SP_SHELL, /* .SHELL */ SP_SILENT, /* .SILENT */ SP_SINGLESHELL, /* .SINGLESHELL; not mentioned in the manual page */ SP_STALE, /* .STALE */ SP_SUFFIXES, /* .SUFFIXES */ + SP_SYSPATH, /* .SYSPATH */ SP_WAIT /* .WAIT */ } ParseSpecial; @@ -284,6 +288,7 @@ static const struct { { ".NOMETA", SP_NOMETA, OP_NOMETA }, { ".NOMETA_CMP", SP_NOMETA_CMP, OP_NOMETA_CMP }, { ".NOPATH", SP_NOPATH, OP_NOPATH }, + { ".NOREADONLY", SP_NOREADONLY, OP_NONE }, { ".NOTMAIN", SP_ATTRIBUTE, OP_NOTMAIN }, { ".NOTPARALLEL", SP_NOTPARALLEL, OP_NONE }, { ".NO_PARALLEL", SP_NOTPARALLEL, OP_NONE }, @@ -298,12 +303,14 @@ static const struct { { ".POSIX", SP_POSIX, OP_NONE }, #endif { ".PRECIOUS", SP_PRECIOUS, OP_PRECIOUS }, + { ".READONLY", SP_READONLY, OP_NONE }, { ".RECURSIVE", SP_ATTRIBUTE, OP_MAKE }, { ".SHELL", SP_SHELL, OP_NONE }, { ".SILENT", SP_SILENT, OP_SILENT }, { ".SINGLESHELL", SP_SINGLESHELL, OP_NONE }, { ".STALE", SP_STALE, OP_NONE }, { ".SUFFIXES", SP_SUFFIXES, OP_NONE }, + { ".SYSPATH", SP_SYSPATH, OP_NONE }, { ".USE", SP_ATTRIBUTE, OP_USE }, { ".USEBEFORE", SP_ATTRIBUTE, OP_USEBEFORE }, { ".WAIT", SP_WAIT, OP_NONE }, @@ -314,6 +321,7 @@ enum PosixState posix_state = PS_NOT_YET; static IncludedFile * GetInclude(size_t i) { + assert(i < includes.len); return Vector_Get(&includes, i); } @@ -324,6 +332,12 @@ CurFile(void) return GetInclude(includes.len - 1); } +unsigned int +CurFile_CondMinDepth(void) +{ + return CurFile()->condMinDepth; +} + static Buffer LoadFile(const char *path, int fd) { @@ -376,11 +390,11 @@ PrintStackTrace(bool includingInnermost) const IncludedFile *entries; size_t i, n; - entries = GetInclude(0); n = includes.len; if (n == 0) return; + entries = GetInclude(0); if (!includingInnermost && entries[n - 1].forLoop == NULL) n--; /* already in the diagnostic */ @@ -661,7 +675,7 @@ TryApplyDependencyOperator(GNode *gn, GNodeType op) * Propagate copied bits to the initial node. They'll be * propagated back to the rest of the cohorts later. */ - gn->type |= op & ~OP_OPMASK; + gn->type |= op & (unsigned)~OP_OPMASK; cohort = Targ_NewInternalNode(gn->name); if (doing_depend) @@ -927,6 +941,11 @@ HandleDependencyTargetSpecial(const char *targetName, *inout_paths = Lst_New(); Lst_Append(*inout_paths, &dirSearchPath); break; + case SP_SYSPATH: + if (*inout_paths == NULL) + *inout_paths = Lst_New(); + Lst_Append(*inout_paths, sysIncPath); + break; case SP_MAIN: /* * Allow targets from the command line to override the @@ -1080,8 +1099,12 @@ SkipExtraTargets(char **pp, const char *lstart) warning = true; p++; } - if (warning) - Parse_Error(PARSE_WARNING, "Extra target ignored"); + if (warning) { + const char *start = *pp; + cpp_skip_whitespace(&start); + Parse_Error(PARSE_WARNING, "Extra target '%.*s' ignored", + (int)(p - start), start); + } *pp += p - *pp; } @@ -1129,15 +1152,17 @@ ParseDependencyOp(char **pp) } static void -ClearPaths(SearchPathList *paths) +ClearPaths(ParseSpecial special, SearchPathList *paths) { if (paths != NULL) { SearchPathListNode *ln; for (ln = paths->first; ln != NULL; ln = ln->next) SearchPath_Clear(ln->datum); } - - Dir_SetPATH(); + if (special == SP_SYSPATH) + Dir_SetSYSPATH(); + else + Dir_SetPATH(); } static char * @@ -1258,7 +1283,8 @@ HandleDependencySourcesEmpty(ParseSpecial special, SearchPathList *paths) opts.silent = true; break; case SP_PATH: - ClearPaths(paths); + case SP_SYSPATH: + ClearPaths(special, paths); break; #ifdef POSIX case SP_POSIX: @@ -1310,12 +1336,21 @@ ParseDependencySourceSpecial(ParseSpecial special, const char *word, case SP_LIBS: Suff_AddLib(word); break; + case SP_NOREADONLY: + Var_ReadOnly(word, false); + break; case SP_NULL: Suff_SetNull(word); break; case SP_OBJDIR: Main_SetObjdir(false, "%s", word); break; + case SP_READONLY: + Var_ReadOnly(word, true); + break; + case SP_SYSPATH: + AddToPaths(word, paths); + break; default: break; } @@ -1343,26 +1378,26 @@ ApplyDependencyTarget(char *name, char *nameEnd, ParseSpecial *inout_special, } static bool -ParseDependencyTargets(char **inout_cp, +ParseDependencyTargets(char **pp, const char *lstart, ParseSpecial *inout_special, GNodeType *inout_targetAttr, SearchPathList **inout_paths) { - char *cp = *inout_cp; + char *p = *pp; for (;;) { - char *tgt = cp; + char *tgt = p; - ParseDependencyTargetWord(&cp, lstart); + ParseDependencyTargetWord(&p, lstart); /* * If the word is followed by a left parenthesis, it's the * name of one or more files inside an archive. */ - if (!IsEscaped(lstart, cp) && *cp == '(') { - cp = tgt; - if (!Arch_ParseArchive(&cp, targets, SCOPE_CMDLINE)) { + if (!IsEscaped(lstart, p) && *p == '(') { + p = tgt; + if (!Arch_ParseArchive(&p, targets, SCOPE_CMDLINE)) { Parse_Error(PARSE_FATAL, "Error in archive specification: \"%s\"", tgt); @@ -1371,27 +1406,27 @@ ParseDependencyTargets(char **inout_cp, continue; } - if (*cp == '\0') { + if (*p == '\0') { InvalidLineType(lstart); return false; } - if (!ApplyDependencyTarget(tgt, cp, inout_special, + if (!ApplyDependencyTarget(tgt, p, inout_special, inout_targetAttr, inout_paths)) return false; if (*inout_special != SP_NOT && *inout_special != SP_PATH) - SkipExtraTargets(&cp, lstart); + SkipExtraTargets(&p, lstart); else - pp_skip_whitespace(&cp); + pp_skip_whitespace(&p); - if (*cp == '\0') + if (*p == '\0') break; - if ((*cp == '!' || *cp == ':') && !IsEscaped(lstart, cp)) + if ((*p == '!' || *p == ':') && !IsEscaped(lstart, p)) break; } - *inout_cp = cp; + *pp = p; return true; } @@ -1528,9 +1563,16 @@ ParseDependencySources(char *p, GNodeType targetAttr, } /* Now go for the sources. */ - if (special == SP_SUFFIXES || special == SP_PATH || - special == SP_INCLUDES || special == SP_LIBS || - special == SP_NULL || special == SP_OBJDIR) { + switch (special) { + case SP_INCLUDES: + case SP_LIBS: + case SP_NOREADONLY: + case SP_NULL: + case SP_OBJDIR: + case SP_PATH: + case SP_READONLY: + case SP_SUFFIXES: + case SP_SYSPATH: ParseDependencySourcesSpecial(p, special, *inout_paths); if (*inout_paths != NULL) { Lst_Free(*inout_paths); @@ -1538,10 +1580,14 @@ ParseDependencySources(char *p, GNodeType targetAttr, } if (special == SP_PATH) Dir_SetPATH(); - } else { + if (special == SP_SYSPATH) + Dir_SetSYSPATH(); + break; + default: assert(*inout_paths == NULL); if (!ParseDependencySourcesMundane(p, special, targetAttr)) return; + break; } MaybeUpdateMainTarget(); @@ -2155,7 +2201,7 @@ Parse_PushInput(const char *name, unsigned lineno, unsigned readLines, curFile->buf_ptr = curFile->buf.data; curFile->buf_end = curFile->buf.data + curFile->buf.len; - curFile->cond_depth = Cond_save_depth(); + curFile->condMinDepth = cond_depth; SetParseFile(name); } @@ -2288,11 +2334,7 @@ ParseEOF(void) return true; } - /* - * Ensure the makefile (or .for loop) didn't have mismatched - * conditionals. - */ - Cond_restore_depth(curFile->cond_depth); + Cond_EndFile(); FStr_Done(&curFile->name); Buf_Done(&curFile->buf); @@ -2677,6 +2719,20 @@ ParseLine_ShellCommand(const char *p) } } +static void +HandleBreak(void) +{ + IncludedFile *curFile = CurFile(); + + if (curFile->forLoop != NULL) { + /* pretend we reached EOF */ + For_Break(curFile->forLoop); + cond_depth = CurFile_CondMinDepth(); + ParseEOF(); + } else + Parse_Error(PARSE_FATAL, "break outside of for loop"); +} + /* * See if the line starts with one of the known directives, and if so, handle * the directive. @@ -2705,7 +2761,9 @@ ParseDirective(char *line) pp_skip_whitespace(&cp); arg = cp; - if (Substring_Equals(dir, "undef")) + if (Substring_Equals(dir, "break")) + HandleBreak(); + else if (Substring_Equals(dir, "undef")) Var_Undef(arg); else if (Substring_Equals(dir, "export")) Var_Export(VEM_PLAIN, arg); diff --git a/contrib/bmake/sigcompat.c b/contrib/bmake/sigcompat.c index 608538d77d0f..c720eeba92e5 100644 --- a/contrib/bmake/sigcompat.c +++ b/contrib/bmake/sigcompat.c @@ -104,7 +104,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)sigcompat.c 5.3 (Berkeley) 2/24/91";*/ -static char *rcsid = "$Id: sigcompat.c,v 1.23 2011/02/14 00:07:11 sjg Exp $"; +static char *rcsid = "$Id: sigcompat.c,v 1.24 2022/09/26 17:38:10 sjg Exp $"; #endif /* LIBC_SCCS and not lint */ #undef signal @@ -204,7 +204,7 @@ SIG_HDLR(*signal(int sig, SIG_HDLR(*handler)(int)))(int) #ifdef SIGSET_T_INT # define ss2m(ss) (MASK_T) *(ss) # define m2ss(ss, m) *ss = (sigset_t) *(m) -#else +#elif !defined(HAVE_SIGSETMASK) || defined(FORCE_POSIX_SIGNALS) static MASK_T ss2m(sigset_t *ss) { diff --git a/contrib/bmake/str.c b/contrib/bmake/str.c index d88f895630e5..5bb9938296f5 100644 --- a/contrib/bmake/str.c +++ b/contrib/bmake/str.c @@ -1,4 +1,4 @@ -/* $NetBSD: str.c,v 1.93 2022/06/11 09:24:07 rillig Exp $ */ +/* $NetBSD: str.c,v 1.94 2022/12/07 10:28:48 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -71,7 +71,7 @@ #include "make.h" /* "@(#)str.c 5.8 (Berkeley) 6/1/90" */ -MAKE_RCSID("$NetBSD: str.c,v 1.93 2022/06/11 09:24:07 rillig Exp $"); +MAKE_RCSID("$NetBSD: str.c,v 1.94 2022/12/07 10:28:48 rillig Exp $"); static HashTable interned_strings; @@ -313,8 +313,8 @@ in_range(char e1, char c, char e2) } /* - * Str_Match -- Test if a string matches a pattern like "*.[ch]". - * The following special characters are known *?\[] (as in fnmatch(3)). + * Test if a string matches a pattern like "*.[ch]". The pattern matching + * characters are '*', '?' and '[]', as in fnmatch(3). * * XXX: this function does not detect or report malformed patterns. * diff --git a/contrib/bmake/str.h b/contrib/bmake/str.h index 7a4047cb27c3..38fd2cf0da1a 100644 --- a/contrib/bmake/str.h +++ b/contrib/bmake/str.h @@ -1,4 +1,4 @@ -/* $NetBSD: str.h,v 1.15 2021/12/15 10:57:01 rillig Exp $ */ +/* $NetBSD: str.h,v 1.16 2022/12/05 23:41:24 rillig Exp $ */ /* Copyright (c) 2021 Roland Illig @@ -273,19 +273,13 @@ LazyBuf_AddStr(LazyBuf *buf, const char *str) LazyBuf_Add(buf, *p); } -MAKE_STATIC void -LazyBuf_AddBytesBetween(LazyBuf *buf, const char *start, const char *end) -{ - const char *p; - - for (p = start; p != end; p++) - LazyBuf_Add(buf, *p); -} - MAKE_INLINE void LazyBuf_AddSubstring(LazyBuf *buf, Substring sub) { - LazyBuf_AddBytesBetween(buf, sub.start, sub.end); + const char *p; + + for (p = sub.start; p != sub.end; p++) + LazyBuf_Add(buf, *p); } MAKE_STATIC Substring diff --git a/contrib/bmake/strlcpy.c b/contrib/bmake/strlcpy.c index b59b2f4ba5a6..111a2aa13435 100644 --- a/contrib/bmake/strlcpy.c +++ b/contrib/bmake/strlcpy.c @@ -17,9 +17,8 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include "make.h" + #ifndef HAVE_STRLCPY #include diff --git a/contrib/bmake/targ.c b/contrib/bmake/targ.c index 7ce495c73b01..a3e234a959ff 100644 --- a/contrib/bmake/targ.c +++ b/contrib/bmake/targ.c @@ -1,4 +1,4 @@ -/* $NetBSD: targ.c,v 1.177 2022/04/15 12:19:28 rillig Exp $ */ +/* $NetBSD: targ.c,v 1.179 2022/12/06 00:12:44 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -107,7 +107,7 @@ #include "dir.h" /* "@(#)targ.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: targ.c,v 1.177 2022/04/15 12:19:28 rillig Exp $"); +MAKE_RCSID("$NetBSD: targ.c,v 1.179 2022/12/06 00:12:44 rillig Exp $"); /* * All target nodes that appeared on the left-hand side of one of the @@ -159,17 +159,17 @@ Targ_List(void) /* * Create a new graph node, but don't register it anywhere. * - * Graph nodes that appear on the left-hand side of a dependency line such + * Graph nodes that occur on the left-hand side of a dependency line such * as "target: source" are called targets. XXX: In some cases (like the - * .ALLTARGETS variable), all nodes are called targets as well, even if they - * never appear on the left-hand side. This is a mistake. + * .ALLTARGETS variable), other nodes are called targets as well, even if + * they never occur on the left-hand side of a dependency line. * * Typical names for graph nodes are: - * "src.c" (an ordinary file) - * "clean" (a .PHONY target) - * ".END" (a special hook target) - * "-lm" (a library) - * "libc.a(isspace.o)" (an archive member) + * "src.c" an ordinary file + * "clean" a .PHONY target + * ".END" a special hook target + * "-lm" a library + * "libm.a(sin.o)" an archive member */ GNode * GNode_New(const char *name) @@ -242,9 +242,9 @@ GNode_Free(void *gnp) * * XXX: The GNodes that are only used as variable scopes (SCOPE_CMD, * SCOPE_GLOBAL, SCOPE_INTERNAL) are not freed at all (see Var_End, - * where they are not mentioned). These might be freed at all, if - * their variable values are indeed not used anywhere else (see - * Trace_Init for the only suspicious use). + * where they are not mentioned). These may be freed if their + * variable values are indeed not used anywhere else (see Trace_Init + * for the only suspicious use). */ HashTable_Done(&gn->vars); @@ -599,7 +599,7 @@ Targ_Propagate(void) for (cln = gn->cohorts.first; cln != NULL; cln = cln->next) { GNode *cohort = cln->datum; - cohort->type |= type & ~OP_OPMASK; + cohort->type |= type & (unsigned)~OP_OPMASK; } } } diff --git a/contrib/bmake/unit-tests/Makefile b/contrib/bmake/unit-tests/Makefile index 10d8f32c61c7..f4d4425e204c 100644 --- a/contrib/bmake/unit-tests/Makefile +++ b/contrib/bmake/unit-tests/Makefile @@ -1,6 +1,6 @@ -# $Id: Makefile,v 1.182 2022/07/26 19:39:32 sjg Exp $ +# $Id: Makefile,v 1.191 2023/01/24 06:09:49 sjg Exp $ # -# $NetBSD: Makefile,v 1.318 2022/06/10 21:28:50 rillig Exp $ +# $NetBSD: Makefile,v 1.331 2023/01/24 00:24:02 sjg Exp $ # # Unit tests for make(1) # @@ -25,10 +25,6 @@ # named makefile (*.mk), with its own set of expected results (*.exp), # and it should be added to the TESTS list. # -# A few *.mk files are helper files for other tests (such as include-sub.mk) -# and are thus not added to TESTS. Such files must be ignored in -# src/tests/usr.bin/make/t_make.sh. -# .MAIN: all @@ -167,6 +163,7 @@ TESTS+= directive-export-impl TESTS+= directive-export-gmake TESTS+= directive-export-literal TESTS+= directive-for +TESTS+= directive-for-break TESTS+= directive-for-empty TESTS+= directive-for-errors TESTS+= directive-for-escape @@ -324,6 +321,7 @@ TESTS+= ternary TESTS+= unexport TESTS+= unexport-env TESTS+= use-inference +TESTS+= var-readonly TESTS+= var-scope TESTS+= var-scope-cmdline TESTS+= var-scope-env @@ -500,7 +498,7 @@ TESTS:= ${TESTS:${BROKEN_TESTS:S,^,N,:ts:}} ENV.depsrc-optional+= TZ=UTC ENV.deptgt-phony+= MAKESYSPATH=. ENV.directive-undef= ENV_VAR=env-value -ENV.envfirst= FROM_ENV=value-from-env +ENV.opt-env= FROM_ENV=value-from-env ENV.opt-m-include-dir= ${MAKEOBJDIR:DMAKEOBJDIR=${MAKEOBJDIR}} ENV.varmisc= FROM_ENV=env ENV.varmisc+= FROM_ENV_BEFORE=env @@ -563,6 +561,7 @@ SED_CMDS.sh-dots+= -e 's,^\(\*\*\* Error code \)[1-9][0-9]*,\1,' SED_CMDS.sh-errctl= ${STD_SED_CMDS.dj} SED_CMDS.sh-flags= ${STD_SED_CMDS.hide-from-output} SED_CMDS.shell-csh= ${STD_SED_CMDS.white-space} +SED_CMDS.sh-leading-hyphen= ${STD_SED_CMDS.shell} SED_CMDS.suff-main+= ${STD_SED_CMDS.dg1} SED_CMDS.suff-main-several+= ${STD_SED_CMDS.dg1} SED_CMDS.suff-transform-debug+= ${STD_SED_CMDS.dg1} @@ -571,12 +570,13 @@ SED_CMDS.var-op-shell+= -e '/command/s,No such.*,not found,' SED_CMDS.var-op-shell+= ${STD_SED_CMDS.white-space} SED_CMDS.vardebug+= -e 's,${.SHELL},,' SED_CMDS.varmod-subst-regex+= ${STD_SED_CMDS.regex} +SED_CMDS.varparse-errors+= ${STD_SED_CMDS.timestamp} SED_CMDS.varname-dot-parsedir= -e '/in some cases/ s,^make: "[^"]*,make: ",' SED_CMDS.varname-dot-parsefile= -e '/in some cases/ s,^make: "[^"]*,make: ",' SED_CMDS.varname-dot-shell= -e 's, = /[^ ]*, = (details omitted),g' SED_CMDS.varname-dot-shell+= -e 's,"/[^" ]*","(details omitted)",g' SED_CMDS.varname-dot-shell+= -e 's,\[/[^] ]*\],[(details omitted)],g' -SED_CMDS.varname-empty= ${.OBJDIR .PARSEDIR .PATH .SHELL:L:@v@-e '/\\$v/d'@} +SED_CMDS.varname-empty= ${.OBJDIR .PARSEDIR .PATH .SHELL .SYSPATH:L:@v@-e '/\\$v/d'@} # Some tests need an additional round of postprocessing. POSTPROC.depsrc-wait= sed -e '/^---/d' -e 's,^\(: Making 3[abc]\)[123]$$,\1,' @@ -601,13 +601,14 @@ STD_SED_CMDS.dd+= -e '/^CachedDir /d' # Omit details such as process IDs from the output of the -dg1 option. STD_SED_CMDS.dg1= -e '/\#.* \.$$/d' STD_SED_CMDS.dg1+= -e '/\.MAKE.PATH_FILEMON/d' -STD_SED_CMDS.dg1+= -e '/^MAKE_VERSION/d;/^\#.*\/mk/d' +STD_SED_CMDS.dg1+= -e '/^\#.*\/mk/d' STD_SED_CMDS.dg1+= -e 's, ${DEFSYSPATH:U/usr/share/mk}$$, ,' STD_SED_CMDS.dg1+= -e 's,^\(\.MAKE *=\) .*,\1
,' STD_SED_CMDS.dg1+= -e 's,^\(\.MAKE\.[A-Z_]* *=\) .*,\1
,' STD_SED_CMDS.dg1+= -e 's,^\(MACHINE[_ARCH]* *=\) .*,\1
,' STD_SED_CMDS.dg1+= -e 's,^\(MAKE *=\) .*,\1
,' STD_SED_CMDS.dg1+= -e 's,^\(\.SHELL *=\) .*,\1
,' +STD_SED_CMDS.dg1+= -e '/\.SYSPATH/d' STD_SED_CMDS.dg2= ${STD_SED_CMDS.dg1} STD_SED_CMDS.dg2+= -e 's,\(last modified\) ..:..:.. ... ..\, ....,\1 ,' @@ -651,9 +652,11 @@ STD_SED_CMDS.hide-from-output= \ # bash 5.1.0 bash: line 1: /nonexistent: No such file or directory # dash dash: 1: cannot open /nonexistent: No such file # +STD_SED_CMDS.shell+= -e 's,^${.SHELL},${.SHELL:T},' STD_SED_CMDS.shell+= -e 's,^${.SHELL:T}: line [0-9][0-9]*: ,,' STD_SED_CMDS.shell+= -e 's,^${.SHELL:T}: [0-9][0-9]*: ,,' STD_SED_CMDS.shell+= -e 's,^${.SHELL:T}: ,,' +STD_SED_CMDS.shell+= -e 's,: command not found,: not found,' STD_SED_CMDS.white-space= -e 's, *, ,g' -e 's, *$$,,' @@ -662,6 +665,11 @@ STD_SED_CMDS.white-space= -e 's, *, ,g' -e 's, *$$,,' STD_SED_CMDS.regex= \ -e 's,\(Regex compilation error:\).*,\1 (details omitted),' +# Normalize timestamps from ':gmtime' or ':localtime' to ''. +# See STD_SED_CMDS.dg2 for timestamps from the debug log. +STD_SED_CMDS.timestamp= \ + -e 's,[A-Z][a-z][a-z] [A-Z][a-z][a-z] [ 0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9] [12][0-9][0-9][0-9],,' + # End of the configuration helpers section. .-include "Makefile.inc" @@ -721,7 +729,17 @@ TMPDIR:= /tmp/uid${.MAKE.UID} _!= mkdir -p ${TMPDIR} .endif -MAKE_TEST_ENV= MALLOC_OPTIONS="JA" # for jemalloc 100 +# Some Linux systems such as Fedora have deprecated egrep in favor of grep -E. +.if ${.MAKE.OS:NLinux} == "" +EGREP= grep -E +.endif +# Keep the classical definition for all other systems. Just as the bmake code +# is kept compatible with C90, the tests are kept compatible with systems that +# are several decades old and don't follow modern POSIX standards. +EGREP?= egrep + +MAKE_TEST_ENV= EGREP="${EGREP}" +MAKE_TEST_ENV+= MALLOC_OPTIONS="JA" # for jemalloc 100 MAKE_TEST_ENV+= MALLOC_CONF="junk:true" # for jemalloc 510 MAKE_TEST_ENV+= TMPDIR=${TMPDIR} @@ -769,6 +787,9 @@ _SED_CMDS+= -e 's,${.OBJDIR},,g' _SED_CMDS+= -e 's,${.CURDIR},,g' _SED_CMDS+= -e 's,/,,g' _SED_CMDS+= -e 's,${UNIT_TESTS:S,.,\\.,g}/,,g' +_SED_CMDS+= -e '/MAKE_VERSION/d' +_SED_CMDS+= -e '/EGREP=/d' + # on AT&T derived systems: false exits 255 not 1 .if ${.MAKE.OS:N*BSD} != "" _SED_CMDS+= -e 's,\(Error code\) 255,\1 1,' diff --git a/contrib/bmake/unit-tests/Makefile.config.in b/contrib/bmake/unit-tests/Makefile.config.in index 3139a0d4d0b5..30049eaa7c26 100644 --- a/contrib/bmake/unit-tests/Makefile.config.in +++ b/contrib/bmake/unit-tests/Makefile.config.in @@ -1,6 +1,7 @@ -# $Id: Makefile.config.in,v 1.3 2021/10/22 07:48:57 sjg Exp $ +# $Id: Makefile.config.in,v 1.4 2022/09/09 18:44:56 sjg Exp $ srcdir= @srcdir@ +EGREP= @egrep@ TOOL_DIFF?= @diff@ DIFF_FLAGS?= @diff_u@ UTC_1= @UTC_1@ diff --git a/contrib/bmake/unit-tests/cmd-errors-jobs.exp b/contrib/bmake/unit-tests/cmd-errors-jobs.exp index 9ed0557975b3..c6baacfe0ed7 100644 --- a/contrib/bmake/unit-tests/cmd-errors-jobs.exp +++ b/contrib/bmake/unit-tests/cmd-errors-jobs.exp @@ -1,9 +1,9 @@ -: undefined eol +: undefined--eol make: Unclosed variable "UNCLOSED" -: unclosed-variable +: unclosed-variable- make: Unclosed variable expression (expecting '}') for "UNCLOSED" -: unclosed-modifier +: unclosed-modifier- make: Unknown modifier "Z" -: unknown-modifier eol -: end eol +: unknown-modifier--eol +: end-eol exit status 0 diff --git a/contrib/bmake/unit-tests/cmd-errors-jobs.mk b/contrib/bmake/unit-tests/cmd-errors-jobs.mk index 8462a2e3497e..b3dc982de35f 100644 --- a/contrib/bmake/unit-tests/cmd-errors-jobs.mk +++ b/contrib/bmake/unit-tests/cmd-errors-jobs.mk @@ -1,4 +1,4 @@ -# $NetBSD: cmd-errors-jobs.mk,v 1.1 2020/12/27 05:11:40 rillig Exp $ +# $NetBSD: cmd-errors-jobs.mk,v 1.2 2022/09/25 12:51:37 rillig Exp $ # # Demonstrate how errors in variable expansions affect whether the commands # are actually executed in jobs mode. @@ -9,24 +9,24 @@ all: undefined unclosed-variable unclosed-modifier unknown-modifier end # Undefined variables are not an error. They expand to empty strings. undefined: - : $@ ${UNDEFINED} eol + : $@-${UNDEFINED}-eol # XXX: As of 2020-11-01, this command is executed even though it contains # parse errors. unclosed-variable: - : $@ ${UNCLOSED + : $@-${UNCLOSED # XXX: As of 2020-11-01, this command is executed even though it contains # parse errors. unclosed-modifier: - : $@ ${UNCLOSED: + : $@-${UNCLOSED: # XXX: As of 2020-11-01, this command is executed even though it contains # parse errors. unknown-modifier: - : $@ ${UNKNOWN:Z} eol + : $@-${UNKNOWN:Z}-eol end: - : $@ eol + : $@-eol # XXX: As of 2020-11-02, despite the parse errors, the exit status is 0. diff --git a/contrib/bmake/unit-tests/cmd-errors.exp b/contrib/bmake/unit-tests/cmd-errors.exp index 9ed0557975b3..c6baacfe0ed7 100644 --- a/contrib/bmake/unit-tests/cmd-errors.exp +++ b/contrib/bmake/unit-tests/cmd-errors.exp @@ -1,9 +1,9 @@ -: undefined eol +: undefined--eol make: Unclosed variable "UNCLOSED" -: unclosed-variable +: unclosed-variable- make: Unclosed variable expression (expecting '}') for "UNCLOSED" -: unclosed-modifier +: unclosed-modifier- make: Unknown modifier "Z" -: unknown-modifier eol -: end eol +: unknown-modifier--eol +: end-eol exit status 0 diff --git a/contrib/bmake/unit-tests/cmd-errors.mk b/contrib/bmake/unit-tests/cmd-errors.mk index 356fe1a3e4a2..6d3880684bcf 100644 --- a/contrib/bmake/unit-tests/cmd-errors.mk +++ b/contrib/bmake/unit-tests/cmd-errors.mk @@ -1,4 +1,4 @@ -# $NetBSD: cmd-errors.mk,v 1.4 2020/12/27 05:11:40 rillig Exp $ +# $NetBSD: cmd-errors.mk,v 1.5 2022/09/25 12:51:37 rillig Exp $ # # Demonstrate how errors in variable expansions affect whether the commands # are actually executed in compat mode. @@ -7,24 +7,24 @@ all: undefined unclosed-variable unclosed-modifier unknown-modifier end # Undefined variables are not an error. They expand to empty strings. undefined: - : $@ ${UNDEFINED} eol + : $@-${UNDEFINED}-eol # XXX: As of 2020-11-01, this command is executed even though it contains # parse errors. unclosed-variable: - : $@ ${UNCLOSED + : $@-${UNCLOSED # XXX: As of 2020-11-01, this command is executed even though it contains # parse errors. unclosed-modifier: - : $@ ${UNCLOSED: + : $@-${UNCLOSED: # XXX: As of 2020-11-01, this command is executed even though it contains # parse errors. unknown-modifier: - : $@ ${UNKNOWN:Z} eol + : $@-${UNKNOWN:Z}-eol end: - : $@ eol + : $@-eol # XXX: As of 2020-11-02, despite the parse errors, the exit status is 0. diff --git a/contrib/bmake/unit-tests/cond-cmp-numeric.exp b/contrib/bmake/unit-tests/cond-cmp-numeric.exp index d913a44ff889..c03ecd1b311e 100644 --- a/contrib/bmake/unit-tests/cond-cmp-numeric.exp +++ b/contrib/bmake/unit-tests/cond-cmp-numeric.exp @@ -1,7 +1,7 @@ CondParser_Eval: !(${:UINF} > 1e100) -make: "cond-cmp-numeric.mk" line 11: String comparison operator must be either == or != +make: "cond-cmp-numeric.mk" line 11: Comparison with '>' requires both operands 'INF' and '1e100' to be numeric CondParser_Eval: ${:UNaN} > NaN -make: "cond-cmp-numeric.mk" line 16: String comparison operator must be either == or != +make: "cond-cmp-numeric.mk" line 16: Comparison with '>' requires both operands 'NaN' and 'NaN' to be numeric CondParser_Eval: !(${:UNaN} == NaN) Comparing "NaN" == "NaN" CondParser_Eval: 123 ! 123 @@ -9,7 +9,7 @@ make: "cond-cmp-numeric.mk" line 34: Malformed conditional (123 ! 123) CondParser_Eval: ${:U 123} < 124 Comparing 123.000000 < 124.000000 CondParser_Eval: ${:U123 } < 124 -make: "cond-cmp-numeric.mk" line 50: String comparison operator must be either == or != +make: "cond-cmp-numeric.mk" line 50: Comparison with '<' requires both operands '123 ' and '124' to be numeric make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/contrib/bmake/unit-tests/cond-cmp-numeric.mk b/contrib/bmake/unit-tests/cond-cmp-numeric.mk index b34e5bfc0a06..5386e4a97297 100644 --- a/contrib/bmake/unit-tests/cond-cmp-numeric.mk +++ b/contrib/bmake/unit-tests/cond-cmp-numeric.mk @@ -1,4 +1,4 @@ -# $NetBSD: cond-cmp-numeric.mk,v 1.5 2021/07/29 06:31:18 rillig Exp $ +# $NetBSD: cond-cmp-numeric.mk,v 1.6 2022/09/04 22:55:00 rillig Exp $ # # Tests for numeric comparisons in .if conditions. @@ -46,7 +46,7 @@ # Trailing spaces are NOT allowed for numbers. # See EvalCompare and TryParseNumber. -# expect+1: String comparison operator must be either == or != +# expect+1: Comparison with '<' requires both operands '123 ' and '124' to be numeric .if ${:U123 } < 124 . error .else diff --git a/contrib/bmake/unit-tests/cond-cmp-string.exp b/contrib/bmake/unit-tests/cond-cmp-string.exp index a10341ed2121..c9c7a0777383 100644 --- a/contrib/bmake/unit-tests/cond-cmp-string.exp +++ b/contrib/bmake/unit-tests/cond-cmp-string.exp @@ -2,10 +2,10 @@ make: "cond-cmp-string.mk" line 18: Malformed conditional (str != str) make: "cond-cmp-string.mk" line 42: Malformed conditional ("string" != "str""ing") make: "cond-cmp-string.mk" line 49: Malformed conditional (!("value" = "value")) make: "cond-cmp-string.mk" line 56: Malformed conditional (!("value" === "value")) -make: "cond-cmp-string.mk" line 113: String comparison operator must be either == or != -make: "cond-cmp-string.mk" line 120: String comparison operator must be either == or != -make: "cond-cmp-string.mk" line 127: String comparison operator must be either == or != -make: "cond-cmp-string.mk" line 134: String comparison operator must be either == or != +make: "cond-cmp-string.mk" line 113: Comparison with '<' requires both operands 'string' and 'string' to be numeric +make: "cond-cmp-string.mk" line 120: Comparison with '<=' requires both operands 'string' and 'string' to be numeric +make: "cond-cmp-string.mk" line 127: Comparison with '>' requires both operands 'string' and 'string' to be numeric +make: "cond-cmp-string.mk" line 134: Comparison with '>=' requires both operands 'string' and 'string' to be numeric make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/contrib/bmake/unit-tests/cond-cmp-unary.mk b/contrib/bmake/unit-tests/cond-cmp-unary.mk index 168de0f30e3f..90cd04e5092b 100755 --- a/contrib/bmake/unit-tests/cond-cmp-unary.mk +++ b/contrib/bmake/unit-tests/cond-cmp-unary.mk @@ -1,11 +1,11 @@ -# $NetBSD: cond-cmp-unary.mk,v 1.2 2020/11/11 07:30:11 rillig Exp $ +# $NetBSD: cond-cmp-unary.mk,v 1.3 2022/09/08 05:43:20 rillig Exp $ # # Tests for unary comparisons in .if conditions, that is, comparisons with # a single operand. If the operand is a number, it is compared to zero, # if it is a string, it is tested for emptiness. -# The number 0 evaluates to false. -.if 0 +# The number 0 in all its various representations evaluates to false. +.if 0 || 0.0 || 0e0 || 0.0e0 || 0.0e10 . error .endif @@ -55,4 +55,20 @@ . error .endif +# The condition '${VAR:M*}' is almost equivalent to '${VAR:M*} != ""'. The +# only case where they differ is for a single word whose numeric value is zero. +.if ${:U0:M*} +. error +.endif +.if ${:U0:M*} == "" +. error +.endif +# Multiple words cannot be parsed as a single number, thus evaluating to true. +.if !${:U0 0:M*} +. error +.endif +.if ${:U0 0:M*} == "" +. error +.endif + all: # nothing diff --git a/contrib/bmake/unit-tests/cond-op-parentheses.exp b/contrib/bmake/unit-tests/cond-op-parentheses.exp index 63f7b19570b5..c2530f62de64 100644 --- a/contrib/bmake/unit-tests/cond-op-parentheses.exp +++ b/contrib/bmake/unit-tests/cond-op-parentheses.exp @@ -1,7 +1,7 @@ -make: "cond-op-parentheses.mk" line 19: String comparison operator must be either == or != -make: "cond-op-parentheses.mk" line 22: Malformed conditional ((3) > 2) -make: "cond-op-parentheses.mk" line 40: Malformed conditional (() -make: "cond-op-parentheses.mk" line 53: Malformed conditional ()) +make: "cond-op-parentheses.mk" line 22: Comparison with '>' requires both operands '3' and '(2' to be numeric +make: "cond-op-parentheses.mk" line 25: Malformed conditional ((3) > 2) +make: "cond-op-parentheses.mk" line 43: Malformed conditional (() +make: "cond-op-parentheses.mk" line 56: Malformed conditional ()) make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/contrib/bmake/unit-tests/cond-op-parentheses.mk b/contrib/bmake/unit-tests/cond-op-parentheses.mk index b790f8bec330..8f8c3ee1e791 100644 --- a/contrib/bmake/unit-tests/cond-op-parentheses.mk +++ b/contrib/bmake/unit-tests/cond-op-parentheses.mk @@ -1,4 +1,4 @@ -# $NetBSD: cond-op-parentheses.mk,v 1.5 2022/01/22 21:50:41 rillig Exp $ +# $NetBSD: cond-op-parentheses.mk,v 1.6 2022/09/04 22:55:00 rillig Exp $ # # Tests for parentheses in .if conditions, which group expressions to override # the precedence of the operators '!', '&&' and '||'. Parentheses cannot be @@ -15,7 +15,10 @@ # Parentheses cannot enclose numbers as there is no need for it. Make does # not implement any arithmetic functions in its condition parser. If # absolutely necessary, use expr(1). -# expect+1: String comparison operator must be either == or != +# +# XXX: It's inconsistent that the right operand has unbalanced parentheses. +# +# expect+1: Comparison with '>' requires both operands '3' and '(2' to be numeric .if 3 > (2) .endif # expect+1: Malformed conditional ((3) > 2) diff --git a/contrib/bmake/unit-tests/cond-token-plain.exp b/contrib/bmake/unit-tests/cond-token-plain.exp index 90da7644bd9e..a508bf62a5ea 100644 --- a/contrib/bmake/unit-tests/cond-token-plain.exp +++ b/contrib/bmake/unit-tests/cond-token-plain.exp @@ -9,11 +9,11 @@ Comparing "\" != "\" CondParser_Eval: ${:U#hash} != #hash Comparing "#hash" != "#hash" CondParser_Eval: 0 # This is treated as a comment, but why? -CondParser_Eval: ${0 # comment :?yes:no} != no -CondParser_Eval: 0 # comment +CondParser_Eval: ${0 # comment:?yes:no} != no +CondParser_Eval: 0 # comment Comparing "no" != "no" -CondParser_Eval: ${1 # comment :?yes:no} != yes -CondParser_Eval: 1 # comment +CondParser_Eval: ${1 # comment:?yes:no} != yes +CondParser_Eval: 1 # comment Comparing "yes" != "yes" CondParser_Eval: ${UNDEF:Uundefined}!=undefined Comparing "undefined" != "undefined" diff --git a/contrib/bmake/unit-tests/cond-token-plain.mk b/contrib/bmake/unit-tests/cond-token-plain.mk index 1e9f30be9153..5fb4a72b74a5 100644 --- a/contrib/bmake/unit-tests/cond-token-plain.mk +++ b/contrib/bmake/unit-tests/cond-token-plain.mk @@ -1,4 +1,4 @@ -# $NetBSD: cond-token-plain.mk,v 1.15 2021/12/30 02:14:55 rillig Exp $ +# $NetBSD: cond-token-plain.mk,v 1.16 2022/09/25 12:51:37 rillig Exp $ # # Tests for plain tokens (that is, string literals without quotes) # in .if conditions. These are also called bare words. @@ -63,10 +63,10 @@ # anybody really use this? This is neither documented nor obvious since # the '#' is escaped. It's much clearer to write a comment in the line # above the condition. -.if ${0 \# comment :?yes:no} != no +.if ${0 \# comment:?yes:no} != no . error .endif -.if ${1 \# comment :?yes:no} != yes +.if ${1 \# comment:?yes:no} != yes . error .endif diff --git a/contrib/bmake/unit-tests/deptgt.exp b/contrib/bmake/unit-tests/deptgt.exp index 0a27f562293d..73d4a7f0c33f 100644 --- a/contrib/bmake/unit-tests/deptgt.exp +++ b/contrib/bmake/unit-tests/deptgt.exp @@ -1,4 +1,4 @@ -make: "deptgt.mk" line 10: warning: Extra target ignored +make: "deptgt.mk" line 10: warning: Extra target '.PHONY' ignored make: "deptgt.mk" line 28: Unassociated shell command ": command3 # parse error, since targets == NULL" Parsing line 34: ${:U}: empty-source ParseDependency(: empty-source) @@ -9,7 +9,7 @@ Parsing line 37: : command for empty targets list Parsing line 38: .MAKEFLAGS: -d0 ParseDependency(.MAKEFLAGS: -d0) make: "deptgt.mk" line 46: Unknown modifier "Z" -make: "deptgt.mk" line 49: warning: Extra target ignored +make: "deptgt.mk" line 49: warning: Extra target 'ordinary' ignored make: "deptgt.mk" line 52: warning: Extra target (ordinary) ignored make: "deptgt.mk" line 55: warning: Special and mundane targets don't mix. Mundane ones ignored make: Fatal errors encountered -- cannot continue diff --git a/contrib/bmake/unit-tests/deptgt.mk b/contrib/bmake/unit-tests/deptgt.mk index 044644dcbd66..7d43220e888a 100644 --- a/contrib/bmake/unit-tests/deptgt.mk +++ b/contrib/bmake/unit-tests/deptgt.mk @@ -1,4 +1,4 @@ -# $NetBSD: deptgt.mk,v 1.12 2021/12/13 23:38:54 rillig Exp $ +# $NetBSD: deptgt.mk,v 1.13 2023/01/03 00:00:45 rillig Exp $ # # Tests for special targets like .BEGIN or .SUFFIXES in dependency # declarations. @@ -45,7 +45,7 @@ ${:U}: empty-source # that nobody uses it. $$$$$$$${:U:Z}: -# expect+1: warning: Extra target ignored +# expect+1: warning: Extra target 'ordinary' ignored .END ordinary: # expect+1: warning: Extra target (ordinary) ignored diff --git a/contrib/bmake/unit-tests/dir.mk b/contrib/bmake/unit-tests/dir.mk index 36fe2baf978c..d3c75c8cb11d 100644 --- a/contrib/bmake/unit-tests/dir.mk +++ b/contrib/bmake/unit-tests/dir.mk @@ -1,8 +1,10 @@ -# $NetBSD: dir.mk,v 1.9 2021/01/23 10:48:49 rillig Exp $ +# $NetBSD: dir.mk,v 1.10 2023/01/24 00:24:02 sjg Exp $ # # Tests for dir.c. -.MAKEFLAGS: -m / # hide /usr/share/mk from the debug log +# hide /usr/share/mk from the debug log +.SYSPATH: +.SYSPATH: / # Dependency lines may use braces for expansion. # See DirExpandCurly for the implementation. diff --git a/contrib/bmake/unit-tests/directive-for-break.exp b/contrib/bmake/unit-tests/directive-for-break.exp new file mode 100644 index 000000000000..b036ebfeb661 --- /dev/null +++ b/contrib/bmake/unit-tests/directive-for-break.exp @@ -0,0 +1,4 @@ +make: "directive-for-break.mk" line 45: break outside of for loop +make: Fatal errors encountered -- cannot continue +make: stopped in unit-tests +exit status 1 diff --git a/contrib/bmake/unit-tests/directive-for-break.mk b/contrib/bmake/unit-tests/directive-for-break.mk new file mode 100644 index 000000000000..a86acfa8bde0 --- /dev/null +++ b/contrib/bmake/unit-tests/directive-for-break.mk @@ -0,0 +1,60 @@ +# $NetBSD: directive-for-break.mk,v 1.3 2022/09/24 10:52:05 rillig Exp $ +# +# Tests for .break in .for loops, which immediately terminates processing of +# the surrounding .for loop. + + +# .break terminates the loop early. +# This is usually done within a conditional. +.for i in 1 2 3 4 5 6 7 8 +. if $i == 3 +I= $i +. break +I= unreached +. endif +.endfor +.if $I != "3" +. error +.endif + + +# The .break only breaks out of the immediately surrounding .for loop, any +# other .for loops are continued normally. +.for outer in o1 o2 o3 +. for inner in i1 i2 i3 +. if ${outer} == o2 && ${inner} == i2 +. break +. endif +COMBINED+= ${outer}-${inner} +. endfor +.endfor +# Only o2-i2 and o2-i3 are missing. +.if ${COMBINED} != "o1-i1 o1-i2 o1-i3 o2-i1 o3-i1 o3-i2 o3-i3" +. error +.endif + + +# A .break outside the context of a .for loop is an error. +.if $I == 0 +# No parse error, even though the .break occurs outside a .for loop, since +# lines from inactive branches are only parsed as far as necessary to see +# whether they belong to an .if/.elif/.else/.endif chain. +. break +.else +# expect+1: break outside of for loop +. break +.endif + + +# Since cond.c 1.335 from 2022-09-02 and before cond.c 1.338 from 2022-09-23, +# the following paragraph generated the wrong error message '4294967294 open +# conditionals'. +.if 1 +. if 2 +. for var in value +. if 3 +. break +. endif +. endfor +. endif +.endif diff --git a/contrib/bmake/unit-tests/directive-for.mk b/contrib/bmake/unit-tests/directive-for.mk index 572c4d6a5c92..95171c68031f 100755 --- a/contrib/bmake/unit-tests/directive-for.mk +++ b/contrib/bmake/unit-tests/directive-for.mk @@ -1,4 +1,4 @@ -# $NetBSD: directive-for.mk,v 1.13 2022/01/15 12:35:18 rillig Exp $ +# $NetBSD: directive-for.mk,v 1.15 2022/10/01 09:23:04 rillig Exp $ # # Tests for the .for directive. # @@ -228,3 +228,19 @@ var= outer endfor .endfor .MAKEFLAGS: -d0 + + +# When there is a variable definition 'scope=cmdline' from the command line +# (which has higher precedence than global variables) and a .for loop iterates +# over a variable of the same name, the expression '${scope}' expands to the +# value from the .for loop. This is because when the body of the .for loop is +# expanded, the expression '${scope}' is textually replaced with ${:Uloop}', +# without resolving any other variable names (ForLoop_SubstBody). Later, when +# the body of the .for loop is actually interpreted, the body text doesn't +# contain the word 'scope' anymore. +.MAKEFLAGS: scope=cmdline +.for scope in loop +. if ${scope} != "loop" +. error +. endif +.endfor diff --git a/contrib/bmake/unit-tests/export.mk b/contrib/bmake/unit-tests/export.mk index bab08ee3ea23..38670eaaaf48 100644 --- a/contrib/bmake/unit-tests/export.mk +++ b/contrib/bmake/unit-tests/export.mk @@ -1,4 +1,4 @@ -# $NetBSD: export.mk,v 1.11 2021/12/05 14:57:36 rillig Exp $ +# $NetBSD: export.mk,v 1.12 2022/09/09 18:36:15 sjg Exp $ UT_TEST= export UT_FOO= foo${BAR} @@ -40,7 +40,7 @@ BAR= bar is ${UT_FU} .MAKE.EXPORTED+= UT_ZOO UT_TEST -FILTER_CMD?= egrep -v '^(MAKEFLAGS|MALLOC_.*|PATH|PWD|SHLVL|_|&)=' +FILTER_CMD?= ${EGREP} -v '^(MAKEFLAGS|MALLOC_.*|PATH|PWD|SHLVL|_|&)=' all: @env | ${FILTER_CMD} | sort diff --git a/contrib/bmake/unit-tests/hanoi-include.mk b/contrib/bmake/unit-tests/hanoi-include.mk index ce443c506b9b..5e7d5c476dfc 100644 --- a/contrib/bmake/unit-tests/hanoi-include.mk +++ b/contrib/bmake/unit-tests/hanoi-include.mk @@ -1,4 +1,4 @@ -# $NetBSD: hanoi-include.mk,v 1.3 2022/05/08 07:27:50 rillig Exp $ +# $NetBSD: hanoi-include.mk,v 1.4 2023/01/19 22:48:42 rillig Exp $ # # Implements the Towers of Hanoi puzzle, demonstrating a bunch of more or less # useful programming techniques: @@ -21,22 +21,28 @@ FROM?= A # ... from this stack ... VIA?= B # ... via this stack ... TO?= C # ... to this stack. -.if $N == 1 +# Since make has no built-in arithmetic functions, convert N to a list of +# words and use the built-in word counting instead. +.if ${N:[#]} == 1 +N:= count ${:U:${:Urange=$N}} # 'count' + one word for every disk +.endif + +.if ${N:[#]} == 2 . for from to in ${FROM} ${TO} all:: @echo "Move the upper disk from stack ${from} to stack ${to}." . endfor .else -_:= ${N::!=expr $N - 1} ${TMP::=${VIA}} ${VIA::=${TO}} ${TO::=${TMP}} +_:= ${N::=${N:[1..-2]}} ${TMP::=${VIA}} ${VIA::=${TO}} ${TO::=${TMP}} . include "${.PARSEDIR}/${.PARSEFILE}" -_:= ${N::!=expr $N + 1} ${TMP::=${VIA}} ${VIA::=${TO}} ${TO::=${TMP}} +_:= ${N::+=D} ${TMP::=${VIA}} ${VIA::=${TO}} ${TO::=${TMP}} . for from to in ${FROM} ${TO} all:: @echo "Move the upper disk from stack ${from} to stack ${to}." . endfor -_:= ${N::!=expr $N - 1} ${TMP::=${VIA}} ${VIA::=${FROM}} ${FROM::=${TMP}} +_:= ${N::=${N:[1..-2]}} ${TMP::=${VIA}} ${VIA::=${FROM}} ${FROM::=${TMP}} . include "${.PARSEDIR}/${.PARSEFILE}" -_:= ${N::!=expr $N + 1} ${TMP::=${VIA}} ${VIA::=${FROM}} ${FROM::=${TMP}} +_:= ${N::+=D} ${TMP::=${VIA}} ${VIA::=${FROM}} ${FROM::=${TMP}} .endif diff --git a/contrib/bmake/unit-tests/include-main.exp b/contrib/bmake/unit-tests/include-main.exp index e677826373c1..f58870486f87 100644 --- a/contrib/bmake/unit-tests/include-main.exp +++ b/contrib/bmake/unit-tests/include-main.exp @@ -1,17 +1,17 @@ make: "include-main.mk" line 14: main-before-ok make: "include-main.mk" line 21: main-before-for-ok -make: "include-sub.mk" line 4: sub-before-ok -make: "include-sub.mk" line 14: sub-before-for-ok +make: "include-sub.inc" line 4: sub-before-ok +make: "include-sub.inc" line 14: sub-before-for-ok Parsing line 5: . info subsub-ok -make: "include-subsub.mk" line 5: subsub-ok - in .for loop from include-sub.mk:31 with i = include - in .for loop from include-sub.mk:30 with i = nested - in .for loop from include-sub.mk:29 with i = deeply +make: "include-subsub.inc" line 5: subsub-ok + in .for loop from include-sub.inc:31 with i = include + in .for loop from include-sub.inc:30 with i = nested + in .for loop from include-sub.inc:29 with i = deeply in include-main.mk:27 Parsing line 6: .MAKEFLAGS: -d0 ParseDependency(.MAKEFLAGS: -d0) -make: "include-sub.mk" line 38: sub-after-ok -make: "include-sub.mk" line 45: sub-after-for-ok +make: "include-sub.inc" line 38: sub-after-ok +make: "include-sub.inc" line 45: sub-after-for-ok make: "include-main.mk" line 30: main-after-ok make: "include-main.mk" line 37: main-after-for-ok exit status 0 diff --git a/contrib/bmake/unit-tests/include-main.mk b/contrib/bmake/unit-tests/include-main.mk index 9a4c6630506b..50be0587348b 100644 --- a/contrib/bmake/unit-tests/include-main.mk +++ b/contrib/bmake/unit-tests/include-main.mk @@ -1,4 +1,4 @@ -# $NetBSD: include-main.mk,v 1.7 2022/01/08 23:41:43 rillig Exp $ +# $NetBSD: include-main.mk,v 1.8 2023/01/19 23:26:14 rillig Exp $ # # Until 2020-09-05, the .INCLUDEDFROMFILE magic variable did not behave # as described in the manual page. @@ -24,7 +24,7 @@ . endif .endfor -.include "include-sub.mk" +.include "include-sub.inc" .if !defined(.INCLUDEDFROMFILE) . info main-after-ok diff --git a/contrib/bmake/unit-tests/include-sub.mk b/contrib/bmake/unit-tests/include-sub.inc similarity index 91% rename from contrib/bmake/unit-tests/include-sub.mk rename to contrib/bmake/unit-tests/include-sub.inc index 57d2aafe9d1d..f26f14c9d84f 100644 --- a/contrib/bmake/unit-tests/include-sub.mk +++ b/contrib/bmake/unit-tests/include-sub.inc @@ -1,4 +1,4 @@ -# $NetBSD: include-sub.mk,v 1.9 2022/01/08 23:41:43 rillig Exp $ +# $NetBSD: include-sub.inc,v 1.1 2023/01/19 23:26:14 rillig Exp $ .if ${.INCLUDEDFROMFILE} == "include-main.mk" . info sub-before-ok @@ -29,7 +29,7 @@ .for i in deeply . for i in nested . for i in include -.include "include-subsub.mk" +.include "include-subsub.inc" . endfor . endfor .endfor diff --git a/contrib/bmake/unit-tests/include-subsub.inc b/contrib/bmake/unit-tests/include-subsub.inc new file mode 100644 index 000000000000..79a6a3770090 --- /dev/null +++ b/contrib/bmake/unit-tests/include-subsub.inc @@ -0,0 +1,9 @@ +# $NetBSD: include-subsub.inc,v 1.1 2023/01/19 23:26:14 rillig Exp $ + +.if ${.INCLUDEDFROMFILE} == "include-sub.inc" +.MAKEFLAGS: -dp +. info subsub-ok +.MAKEFLAGS: -d0 +.else +. warning subsub-fail(${.INCLUDEDFROMFILE}) +.endif diff --git a/contrib/bmake/unit-tests/include-subsub.mk b/contrib/bmake/unit-tests/include-subsub.mk deleted file mode 100644 index 476d75f79556..000000000000 --- a/contrib/bmake/unit-tests/include-subsub.mk +++ /dev/null @@ -1,9 +0,0 @@ -# $NetBSD: include-subsub.mk,v 1.4 2021/01/26 23:44:56 rillig Exp $ - -.if ${.INCLUDEDFROMFILE} == "include-sub.mk" -.MAKEFLAGS: -dp -. info subsub-ok -.MAKEFLAGS: -d0 -.else -. warning subsub-fail(${.INCLUDEDFROMFILE}) -.endif diff --git a/contrib/bmake/unit-tests/job-output-null.exp b/contrib/bmake/unit-tests/job-output-null.exp index 631d4862af44..628ec54a1a6b 100644 --- a/contrib/bmake/unit-tests/job-output-null.exp +++ b/contrib/bmake/unit-tests/job-output-null.exp @@ -1,4 +1,6 @@ -1 -2a +1 trailing +2a trailing +2b trailing +2c trailing 3a without newline, 3b without newline. exit status 0 diff --git a/contrib/bmake/unit-tests/job-output-null.mk b/contrib/bmake/unit-tests/job-output-null.mk index 1efd9c667980..04786dba4096 100644 --- a/contrib/bmake/unit-tests/job-output-null.mk +++ b/contrib/bmake/unit-tests/job-output-null.mk @@ -1,11 +1,11 @@ -# $NetBSD: job-output-null.mk,v 1.3 2021/09/12 10:26:49 rillig Exp $ +# $NetBSD: job-output-null.mk,v 1.4 2022/09/03 08:03:27 rillig Exp $ # # Test how null bytes in the output of a command are handled. Make processes # them using null-terminated strings, which may cut off some of the output. # -# As of 2021-04-15, make handles null bytes from the child process -# inconsistently. It's an edge case though since typically the child -# processes output text. +# Before job.c 1.454 from 2022-09-03, make handled null bytes in the output +# from the child process inconsistently. It's an edge case though since +# typically the child processes output text. # Note: The printf commands used in this test must only use a single format # string, without parameters. This is because it is implementation-dependent @@ -16,30 +16,40 @@ # NetBSD /bin/ksh 3 x write("fmt") (via /bin/printf) # Bash 5 3 x write("fmt") # -# In the latter case the output may arrive in parts, which in this test makes -# a crucial difference since the outcome of the test depends on whether there -# is a '\n' in each of the blocks from the output. +# In the latter case the output may arrive in 1 to 3 parts, depending on the +# exact timing, which in this test makes a crucial difference since before +# job.c 1.454 from 2022-09-03, the outcome of the test depended on whether +# there was a '\n' in each of the blocks from the output. Depending on the +# exact timing, the output of that test varied, its possible values were '2a', +# '2a 2b', '2a 2c', '2a 2b 2c'. .MAKEFLAGS: -j1 # force jobs mode all: .PHONY - # The null byte from the command output is kept as-is. - # See CollectOutput, which looks like it intended to replace these - # null bytes with simple spaces. + # The null byte from the command output is replaced with a single + # space by CollectOutput. @printf '1\0trailing\n' + # expect: 1 trailing # Give the parent process a chance to see the above output, but not # yet the output from the next printf command. @sleep 1 - # All null bytes from the command output are kept as-is. + # Each null byte from the command output is replaced with a single + # space. @printf '2a\0trailing\n''2b\0trailing\n''2c\0trailing\n' + # expect: 2a trailing + # expect: 2b trailing + # expect: 2c trailing @sleep 1 - # The null bytes are replaced with spaces since they are not followed - # by a newline. + # Each null byte from the command output is replaced with a single + # space. Because there is no trailing newline in the output, these + # null bytes were replaced with spaces even before job.c 1.454 from + # 2022-09-03, unlike in the cases above. # # The three null bytes in a row test whether this output is # compressed to a single space like in DebugFailedTarget. It isn't. @printf '3a\0without\0\0\0newline, 3b\0without\0\0\0newline.' + # expect: 3a without newline, 3b without newline. diff --git a/contrib/bmake/unit-tests/make-exported.mk b/contrib/bmake/unit-tests/make-exported.mk index 58cb15183b8d..363ea2733a47 100755 --- a/contrib/bmake/unit-tests/make-exported.mk +++ b/contrib/bmake/unit-tests/make-exported.mk @@ -1,4 +1,4 @@ -# $NetBSD: make-exported.mk,v 1.6 2020/10/05 19:27:48 rillig Exp $ +# $NetBSD: make-exported.mk,v 1.7 2022/09/09 18:36:15 sjg Exp $ # # As of 2020-08-09, the code in Var_Export is shared between the .export # directive and the .MAKE.EXPORTED variable. This leads to non-obvious @@ -22,4 +22,4 @@ UT_VAR= ${UNEXPANDED} .MAKE.EXPORTED= -literal UT_VAR all: - @env | sort | egrep '^UT_|make-exported-value' || true + @env | sort | ${EGREP} '^UT_|make-exported-value' || true diff --git a/contrib/bmake/unit-tests/opt-env.exp b/contrib/bmake/unit-tests/opt-env.exp index b2e9ea85bafd..39a9383953dd 100644 --- a/contrib/bmake/unit-tests/opt-env.exp +++ b/contrib/bmake/unit-tests/opt-env.exp @@ -1,5 +1 @@ -make: "opt-env.mk" line 13: Malformed conditional (${FROM_ENV} != value-from-env) -make: "opt-env.mk" line 20: value-from-mk - -make: stopped in unit-tests -exit status 1 +exit status 0 diff --git a/contrib/bmake/unit-tests/opt-query.exp b/contrib/bmake/unit-tests/opt-query.exp index 38025dcf4d3a..0ba62780d844 100644 --- a/contrib/bmake/unit-tests/opt-query.exp +++ b/contrib/bmake/unit-tests/opt-query.exp @@ -1,2 +1,24 @@ +Making commands: command during parsing -exit status 1 +commands: query status 1 + +Making opt-query-file.out-of-date in compat mode: +opt-query-file.out-of-date in compat mode: query status 1 + +Making opt-query-file.up-to-date in compat mode: +`opt-query-file.up-to-date' is up to date. +opt-query-file.up-to-date in compat mode: query status 0 + +Making phony in compat mode: +phony in compat mode: query status 1 + +Making opt-query-file.out-of-date in jobs mode: +opt-query-file.out-of-date in jobs mode: query status 1 + +Making opt-query-file.up-to-date in jobs mode: +opt-query-file.up-to-date in jobs mode: query status 0 + +Making phony in jobs mode: +phony in jobs mode: query status 1 + +exit status 0 diff --git a/contrib/bmake/unit-tests/opt-query.mk b/contrib/bmake/unit-tests/opt-query.mk index 0a7d5219a8fe..3554d69afad6 100644 --- a/contrib/bmake/unit-tests/opt-query.mk +++ b/contrib/bmake/unit-tests/opt-query.mk @@ -1,4 +1,4 @@ -# $NetBSD: opt-query.mk,v 1.4 2020/11/09 20:50:56 rillig Exp $ +# $NetBSD: opt-query.mk,v 1.7 2022/08/18 05:37:05 rillig Exp $ # # Tests for the -q command line option. # @@ -6,7 +6,57 @@ # None of the commands in the targets are run, not even those that are # prefixed with '+'. -.MAKEFLAGS: -q +# This test consists of several parts: +# +# main Delegates to the actual tests. +# +# commands Ensures that none of the targets is made. +# +# variants Ensures that the up-to-date status is correctly +# reported in both compat and jobs mode, and for several +# kinds of make targets. +PART?= main + +.if ${PART} == "main" + +all: .PHONY variants cleanup + +_!= touch -f opt-query-file.up-to-date + +variants: .PHONY + +. for target in commands + @echo 'Making ${target}': + @${MAKE} -r -f ${MAKEFILE} -q ${mode:Mjobs:%=-j1} ${target} PART=commands \ + && echo "${target}: query status $$?" \ + || echo "${target}: query status $$?" + @echo +. endfor + +. for mode in compat jobs +. for target in opt-query-file.out-of-date opt-query-file.up-to-date phony + @echo 'Making ${target} in ${mode} mode': + @${MAKE} -r -f ${MAKEFILE} -q ${mode:Mjobs:%=-j1} ${target} PART=variants \ + && echo "${target} in ${mode} mode: query status $$?" \ + || echo "${target} in ${mode} mode: query status $$?" + @echo +. endfor +. endfor + +# Between 1994 and before 2022-08-17, the exit status for '-q' was always 1, +# the cause for that exit code varied over time though. +# +# expect: opt-query-file.out-of-date in compat mode: query status 1 +# expect: opt-query-file.up-to-date in compat mode: query status 0 +# expect: phony in compat mode: query status 1 +# expect: opt-query-file.out-of-date in jobs mode: query status 1 +# expect: opt-query-file.up-to-date in jobs mode: query status 0 +# expect: phony in jobs mode: query status 1 + +cleanup: .PHONY + @rm -f opt-query-file.up-to-date + +.elif ${PART} == "commands" # This command cannot be prevented from being run since it is used at parse # time, and any later variable assignments may depend on its result. @@ -18,9 +68,18 @@ @+echo '$@: run always' # None of these commands are run. -all: +commands: @echo '$@: hidden command' @+echo '$@: run always' - -# The exit status 1 is because the "all" target has to be made, that is, +# The exit status 1 is because the "commands" target has to be made, that is, # it is not up-to-date. + +.elif ${PART} == "variants" + +opt-query-file.out-of-date: ${MAKEFILE} +opt-query-file.up-to-date: ${MAKEFILE} +phony: .PHONY + +.else +. error Invalid part '${PART}' +.endif diff --git a/contrib/bmake/unit-tests/parse-var.exp b/contrib/bmake/unit-tests/parse-var.exp index 39a9383953dd..bae925e8c869 100644 --- a/contrib/bmake/unit-tests/parse-var.exp +++ b/contrib/bmake/unit-tests/parse-var.exp @@ -1 +1,5 @@ -exit status 0 +make: Unfinished modifier for "BRACE_GROUP" (',' missing) +make: "parse-var.mk" line 130: Malformed conditional (0 && ${BRACE_GROUP:S,${BRACE_PAIR:S,{,{{,},,}) +make: Fatal errors encountered -- cannot continue +make: stopped in unit-tests +exit status 1 diff --git a/contrib/bmake/unit-tests/parse-var.mk b/contrib/bmake/unit-tests/parse-var.mk index bd6c59f0e5cb..cca6931d14a1 100644 --- a/contrib/bmake/unit-tests/parse-var.mk +++ b/contrib/bmake/unit-tests/parse-var.mk @@ -1,13 +1,135 @@ -# $NetBSD: parse-var.mk,v 1.1 2020/10/04 06:53:15 rillig Exp $ +# $NetBSD: parse-var.mk,v 1.6 2022/09/25 21:26:23 rillig Exp $ +# +# Tests for parsing variable expressions. +# +# TODO: Add systematic tests for all of the below combinations. +# +# Written form: +# short form +# long form with braces endc == '}' +# long form with parentheses endc == ')' +# indirect modifiers endc == '\0' +# +# Based on: +# undefined variable +# global variable +# command-line variable +# environment variable +# target-local variable +# legacy variable '@F' +# +# VarEvalMode: +# parse +# eval +# eval-undeferr +# eval-keep-dollar +# eval-keep-undef +# eval-keep-dollar-undef +# +# Global mode: +# without -dL +# with -dL +# +# Modifiers: +# no +# yes, stay undefined +# convert to defined +# indirect modifiers, involving changes to VarEvalMode +# +# Error conditions: +# for the short form, EOF after the '$' +# for the short form, each character +# for the long forms, EOF right after '${' +# for the long forms, EOF after the variable name +# for the long forms, EOF after the ':' +# for the long forms, EOF after parsing a modifier +# for the long forms, ':}' +# for each modifier: syntactic error +# for each modifier: evaluation error +# +# Context: +# in a condition, only operand, unquoted +# in a condition, only operand, quoted +# in a condition, left-hand side, unquoted +# in a condition, left-hand side, quoted +# in a condition, right-hand side, unquoted +# in a condition, right-hand side, quoted +# left-hand side of a variable assignment +# right-hand side of a ':=' variable assignment +# right-hand side of a '!=' variable assignment +# shell command in a target +# .info directive +# dependency line +# items in a .for loop +# everywhere else Var_Parse is called +# +# Further influences: +# multi-level evaluations like 'other=${OTHER}' with OTHER='$$ ${THIRD}' +# +# Effects: +# How much does the parsing position advance (pp)? +# What's the value of the expression (out_val)? +# What's the status after parsing the expression (VarParseResult)? +# What error messages are printed (Parse_Error)? +# What no-effect error messages are printed (Error)? +# What error messages should be printed but aren't? +# What other side effects are there? .MAKEFLAGS: -dL -# In variable assignments, there may be spaces on the left-hand side of the -# assignment, but only if they occur inside variable expressions. +# In variable assignments, there may be spaces in the middle of the left-hand +# side of the assignment, but only if they occur inside variable expressions. +# Leading spaces (but not tabs) are possible but unusual. +# Trailing spaces are common in some coding styles, others omit them. VAR.${:U param }= value .if ${VAR.${:U param }} != "value" . error .endif -all: - @:; +# XXX: The following paragraph already uses past tense, in the hope that the +# parsing behavior can be cleaned up soon. + +# Since var.c 1.323 from 2020-07-26 18:11 and except for var.c 1.1028 from +# 2022-08-08, the exact way of parsing an expression depended on whether the +# expression was actually evaluated or merely parsed. +# +# If it was evaluated, nested expressions were parsed correctly, parsing each +# modifier according to its exact definition (see varmod.mk). +# +# If the expression was merely parsed but not evaluated (for example, because +# its value would not influence the outcome of the condition, or during the +# first pass of the ':@var@body@' modifier), and the expression contained a +# modifier, and that modifier contained a nested expression, the nested +# expression was not parsed correctly. Instead, make only counted the opening +# and closing delimiters, which failed for nested modifiers with unbalanced +# braces. +# +# This naive brace counting was implemented in ParseModifierPartDollar. As of +# var.c 1.1029, there are still several other places that merely count braces +# instead of properly parsing subexpressions. + +#.MAKEFLAGS: -dcpv +# Keep these braces outside the conditions below, to keep them simple to +# understand. If the BRACE_PAIR had been replaced with ':U{}', the '}' would +# have to be escaped, but not the '{'. This asymmetry would have made the +# example even more complicated to understand. +BRACE_PAIR= {} +# In this test word, the '{{}' in the middle will be replaced. +BRACE_GROUP= {{{{}}}} + +# The inner ':S' modifier turns the word '{}' into '{{}'. +# The outer ':S' modifier then replaces '{{}' with ''. +# In the first case, the outer expression is relevant and is parsed correctly. +.if 1 && ${BRACE_GROUP:S,${BRACE_PAIR:S,{,{{,},,} +.endif +# In the second case, the outer expression was irrelevant. In this case, in +# the parts of the outer ':S' modifier, make only counted the braces, and since +# the inner expression '${BRACE_PAIR:...}' contains more '{' than '}', parsing +# failed with the error message 'Unfinished modifier for "BRACE_GROUP"'. Fixed +# in var.c 1.1028 from 2022-08-08, reverted in var.c 1.1029 from 2022-08-23. +.if 0 && ${BRACE_GROUP:S,${BRACE_PAIR:S,{,{{,},,} +.endif +#.MAKEFLAGS: -d0 + + +all: .PHONY diff --git a/contrib/bmake/unit-tests/sh-leading-at.exp b/contrib/bmake/unit-tests/sh-leading-at.exp index 8347fda085f7..8197a0d2b71a 100644 --- a/contrib/bmake/unit-tests/sh-leading-at.exp +++ b/contrib/bmake/unit-tests/sh-leading-at.exp @@ -3,4 +3,5 @@ space after @ echo 'echoed' echoed 3 +whitespace in leading part exit status 0 diff --git a/contrib/bmake/unit-tests/sh-leading-at.mk b/contrib/bmake/unit-tests/sh-leading-at.mk index 9f98005ec088..cff3d4da1263 100644 --- a/contrib/bmake/unit-tests/sh-leading-at.mk +++ b/contrib/bmake/unit-tests/sh-leading-at.mk @@ -1,4 +1,4 @@ -# $NetBSD: sh-leading-at.mk,v 1.5 2020/11/15 20:20:58 rillig Exp $ +# $NetBSD: sh-leading-at.mk,v 1.6 2023/01/19 19:55:27 rillig Exp $ # # Tests for shell commands preceded by an '@', to suppress printing # the command to stdout. @@ -16,3 +16,7 @@ all: # The leading '@' can be repeated. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@echo '3' + + # Since 2023-01-17, the leading '@', '+' and '-' may contain + # whitespace, for compatibility with GNU make. + @ @ @ echo 'whitespace in leading part' diff --git a/contrib/bmake/unit-tests/sh-leading-hyphen.exp b/contrib/bmake/unit-tests/sh-leading-hyphen.exp index 39a9383953dd..d049757777cd 100644 --- a/contrib/bmake/unit-tests/sh-leading-hyphen.exp +++ b/contrib/bmake/unit-tests/sh-leading-hyphen.exp @@ -1 +1,11 @@ +true +false +*** Error code 1 (ignored) +unknown-command 'needed for needshell in compat.c' +unknown-command: not found +*** Error code 127 (ignored) +unknown-long-option 'needed for needshell in compat.c' +unknown-long-option: not found +whitespace in leading part +*** Error code 127 (ignored) exit status 0 diff --git a/contrib/bmake/unit-tests/sh-leading-hyphen.mk b/contrib/bmake/unit-tests/sh-leading-hyphen.mk index d760abb9afdd..08b50a2ddc42 100644 --- a/contrib/bmake/unit-tests/sh-leading-hyphen.mk +++ b/contrib/bmake/unit-tests/sh-leading-hyphen.mk @@ -1,4 +1,4 @@ -# $NetBSD: sh-leading-hyphen.mk,v 1.3 2020/11/15 20:20:58 rillig Exp $ +# $NetBSD: sh-leading-hyphen.mk,v 1.4 2023/01/19 19:55:27 rillig Exp $ # # Tests for shell commands preceded by a '-', to ignore the exit status of # the command line. @@ -11,4 +11,19 @@ # TODO: Implementation all: - @:; + -true + -false + + # An undefined variable expands to an empty string, without warning. + # This is used in practice for prefixing tool names or for DESTDIR. + # The '-' before 'unknown' is interpreted by make as '.IGNORE' flag. + ${UNDEF}-unknown-command 'needed for needshell in compat.c' + + # Expanding undefined variables may lead to strange error messages + # when the shell interprets single-character options as commands + # instead. + ${UNDEF} --unknown-long-option 'needed for needshell in compat.c' + + # Since 2023-01-17, the leading '@', '+' and '-' may contain + # whitespace, for compatibility with GNU make. + - - - @echo 'whitespace in leading part' diff --git a/contrib/bmake/unit-tests/sh-leading-plus.exp b/contrib/bmake/unit-tests/sh-leading-plus.exp index eb586d29f1c2..8cc26deaacb5 100644 --- a/contrib/bmake/unit-tests/sh-leading-plus.exp +++ b/contrib/bmake/unit-tests/sh-leading-plus.exp @@ -1,4 +1,6 @@ echo 'this command is not run' echo 'this command is run' this command is run +echo 'whitespace in leading part' +whitespace in leading part exit status 0 diff --git a/contrib/bmake/unit-tests/sh-leading-plus.mk b/contrib/bmake/unit-tests/sh-leading-plus.mk index ff57b4a38a7d..83e7e7a15e24 100644 --- a/contrib/bmake/unit-tests/sh-leading-plus.mk +++ b/contrib/bmake/unit-tests/sh-leading-plus.mk @@ -1,4 +1,4 @@ -# $NetBSD: sh-leading-plus.mk,v 1.4 2020/11/09 20:50:56 rillig Exp $ +# $NetBSD: sh-leading-plus.mk,v 1.5 2023/01/19 19:55:27 rillig Exp $ # # Tests for shell commands preceded by a '+', to run them even if # the command line option -n is given. @@ -8,3 +8,7 @@ all: @echo 'this command is not run' @+echo 'this command is run' + + # Since 2023-01-17, the leading '@', '+' and '-' may contain + # whitespace, for compatibility with GNU make. + + + + @echo 'whitespace in leading part' diff --git a/contrib/bmake/unit-tests/var-op-expand.exp b/contrib/bmake/unit-tests/var-op-expand.exp index a4ba53942cf7..4916336c0400 100644 --- a/contrib/bmake/unit-tests/var-op-expand.exp +++ b/contrib/bmake/unit-tests/var-op-expand.exp @@ -1,7 +1,7 @@ -make: "var-op-expand.mk" line 265: Unknown modifier "s,value,replaced," -make: "var-op-expand.mk" line 268: warning: XXX Neither branch should be taken. -make: "var-op-expand.mk" line 273: Unknown modifier "s,value,replaced," -make: "var-op-expand.mk" line 274: warning: XXX Neither branch should be taken. +make: "var-op-expand.mk" line 274: Unknown modifier "s,value,replaced," +make: "var-op-expand.mk" line 277: warning: XXX Neither branch should be taken. +make: "var-op-expand.mk" line 282: Unknown modifier "s,value,replaced," +make: "var-op-expand.mk" line 283: warning: XXX Neither branch should be taken. make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/contrib/bmake/unit-tests/var-op-expand.mk b/contrib/bmake/unit-tests/var-op-expand.mk index 1d905aeb3757..f89aa6fa4b56 100644 --- a/contrib/bmake/unit-tests/var-op-expand.mk +++ b/contrib/bmake/unit-tests/var-op-expand.mk @@ -1,4 +1,4 @@ -# $NetBSD: var-op-expand.mk,v 1.16 2021/12/28 10:47:00 rillig Exp $ +# $NetBSD: var-op-expand.mk,v 1.17 2022/09/08 20:23:45 rillig Exp $ # # Tests for the := variable assignment operator, which expands its # right-hand side. @@ -37,7 +37,7 @@ VAR:= $$ $$$$ $$$$$$$$ .endif -# reference to a variable containing a literal dollar sign +# reference to a variable containing literal dollar signs REF= $$ $$$$ $$$$$$$$ VAR:= ${REF} REF= too late @@ -49,6 +49,9 @@ REF= too late # reference to an undefined variable .undef UNDEF VAR:= <${UNDEF}> +.if ${VAR} != "<>" +. error +.endif UNDEF= after .if ${VAR} != "" . error @@ -68,6 +71,9 @@ REF= too late # expression with an indirect modifier referring to an undefined variable .undef UNDEF VAR:= ${:${UNDEF}} +.if ${VAR} != "" +. error +.endif UNDEF= Uwas undefined .if ${VAR} != "was undefined" . error @@ -99,6 +105,9 @@ UNDEF= Uwas undefined REF2= <${REF3}> REF= ${REF2} VAR:= ${REF} +.if ${VAR} != "<>" +. error +.endif REF3= too late .if ${VAR} != "" . error diff --git a/contrib/bmake/unit-tests/var-readonly.exp b/contrib/bmake/unit-tests/var-readonly.exp new file mode 100644 index 000000000000..39a9383953dd --- /dev/null +++ b/contrib/bmake/unit-tests/var-readonly.exp @@ -0,0 +1 @@ +exit status 0 diff --git a/contrib/bmake/unit-tests/var-readonly.mk b/contrib/bmake/unit-tests/var-readonly.mk new file mode 100644 index 000000000000..43799e4adb5c --- /dev/null +++ b/contrib/bmake/unit-tests/var-readonly.mk @@ -0,0 +1,20 @@ +# $NetBSD: var-readonly.mk,v 1.1 2023/01/24 00:20:00 sjg Exp $ + +# the answer +N = 42 +.READONLY: N +# this should be ignored +N = 666 +.if ${N} != 42 +.error N ($N) should be 42 +.endif + +.NOREADONLY: N +# now we can change it +N = 69 +.if ${N} == 42 +.error N should not be 42 +.endif + +all: + diff --git a/contrib/bmake/unit-tests/var-scope-local-legacy.exp b/contrib/bmake/unit-tests/var-scope-local-legacy.exp index 39a9383953dd..fb7e0863b2e6 100644 --- a/contrib/bmake/unit-tests/var-scope-local-legacy.exp +++ b/contrib/bmake/unit-tests/var-scope-local-legacy.exp @@ -1 +1,6 @@ +: LEN4=undef_ +: XY=undef_ +: AF=undef_ +: %D=undef_ %F=undef_ +: @D=._ @F=all_ exit status 0 diff --git a/contrib/bmake/unit-tests/var-scope-local-legacy.mk b/contrib/bmake/unit-tests/var-scope-local-legacy.mk index e519d63e7c51..9b70e3f8f143 100644 --- a/contrib/bmake/unit-tests/var-scope-local-legacy.mk +++ b/contrib/bmake/unit-tests/var-scope-local-legacy.mk @@ -1,8 +1,17 @@ -# $NetBSD: var-scope-local-legacy.mk,v 1.1 2022/01/23 16:25:54 rillig Exp $ +# $NetBSD: var-scope-local-legacy.mk,v 1.2 2022/09/27 19:18:45 rillig Exp $ # # Tests for legacy target-local variables, such as ${=' requires both operands 'no' and '10' to be numeric make: Bad conditional expression 'string == "literal" || no >= 10' in 'string == "literal" || no >= 10?yes:no' make: "varmod-ifelse.mk" line 154: . make: Bad conditional expression 'string == "literal" && >= 10' in 'string == "literal" && >= 10?yes:no' diff --git a/contrib/bmake/unit-tests/varmod-ifelse.mk b/contrib/bmake/unit-tests/varmod-ifelse.mk index a823ae784935..2d1c54943ca1 100644 --- a/contrib/bmake/unit-tests/varmod-ifelse.mk +++ b/contrib/bmake/unit-tests/varmod-ifelse.mk @@ -1,4 +1,4 @@ -# $NetBSD: varmod-ifelse.mk,v 1.19 2022/05/08 06:51:27 rillig Exp $ +# $NetBSD: varmod-ifelse.mk,v 1.20 2022/09/25 12:51:37 rillig Exp $ # # Tests for the ${cond:?then:else} variable modifier, which evaluates either # the then-expression or the else-expression, depending on the condition. @@ -106,7 +106,7 @@ COND:= ${${UNDEF} == "":?bad-assign:bad-assign} # from the parser of the .for loop body. See ForLoop_SubstVarLong. .MAKEFLAGS: -dc VAR= value -.if ${ ${:U\$}{VAR} == value :?ok:bad} != "ok" +.if ${ ${:U\$}{VAR} == value:?ok:bad} != "ok" . error .endif .MAKEFLAGS: -d0 diff --git a/contrib/bmake/unit-tests/varmod-loop.exp b/contrib/bmake/unit-tests/varmod-loop.exp index bbe0037673b3..9b432c806885 100644 --- a/contrib/bmake/unit-tests/varmod-loop.exp +++ b/contrib/bmake/unit-tests/varmod-loop.exp @@ -13,4 +13,10 @@ mod-loop-dollar:$3$: mod-loop-dollar:$${word}$$: mod-loop-dollar:$$5$$: mod-loop-dollar:$$${word}$$$: +: t=$(( ${t:-0} + 1 )) +: dollar=end +: backslash=\ end +: dollar=$ at=@ backslash=\ end +: dollar=$$ at=@@ backslash=\\ end +: dollar=$$ at=@@ backslash=\\ end exit status 0 diff --git a/contrib/bmake/unit-tests/varmod-loop.mk b/contrib/bmake/unit-tests/varmod-loop.mk index 82046ff95d79..d3cc0228efd9 100644 --- a/contrib/bmake/unit-tests/varmod-loop.mk +++ b/contrib/bmake/unit-tests/varmod-loop.mk @@ -1,4 +1,4 @@ -# $NetBSD: varmod-loop.mk,v 1.18 2021/12/05 15:20:13 rillig Exp $ +# $NetBSD: varmod-loop.mk,v 1.21 2022/08/23 21:13:46 rillig Exp $ # # Tests for the :@var@...${var}...@ variable modifier. @@ -186,4 +186,49 @@ CMDLINE= global # needed for deleting the environment . error # 'CMDLINE' is gone now from all scopes .endif + +# In the loop body text of the ':@' modifier, a literal '$' is written as '$$', +# not '\$'. In the following example, each '$$' turns into a single '$', +# except for '$i', which is replaced with the then-current value '1' of the +# iteration variable. +# +# XXX: was broken in var.c 1.1028 from 2022-08-08, reverted in var.c 1.1029 +# from 2022-08-23; see parse-var.mk, keyword 'BRACE_GROUP'. +all: varmod-loop-literal-dollar +varmod-loop-literal-dollar: .PHONY + : ${:U1:@i@ t=$$(( $${t:-0} + $i ))@} + + +# When parsing the loop body, each '\$', '\@' and '\\' is unescaped to '$', +# '@' and '\'; all other backslashes are retained. +# +# In practice, the '$' is not escaped as '\$', as there is a second round of +# unescaping '$$' to '$' later when the loop body is expanded after setting the +# iteration variable. +# +# After the iteration variable has been set, the loop body is expanded with +# this unescaping, regardless of whether .MAKE.SAVE_DOLLARS is set or not: +# $$ a literal '$' +# $x, ${var}, $(var) a nested expression +# any other character itself +all: escape-modifier +escape-modifier: .PHONY + # In the first round, '\$ ' is unescaped to '$ ', and since the + # variable named ' ' is not defined, the expression '$ ' expands to an + # empty string. + # expect: : dollar=end + : ${:U1:@i@ dollar=\$ end@} + + # Like in other modifiers, '\ ' is preserved, since ' ' is not one of + # the characters that _must_ be escaped. + # expect: : backslash=\ end + : ${:U1:@i@ backslash=\ end@} + + # expect: : dollar=$ at=@ backslash=\ end + : ${:U1:@i@ dollar=\$\$ at=\@ backslash=\\ end@} + # expect: : dollar=$$ at=@@ backslash=\\ end + : ${:U1:@i@ dollar=\$\$\$\$ at=\@\@ backslash=\\\\ end@} + # expect: : dollar=$$ at=@@ backslash=\\ end + : ${:U1:@i@ dollar=$$$$ at=\@\@ backslash=\\\\ end@} + all: .PHONY diff --git a/contrib/bmake/unit-tests/varmod-match.mk b/contrib/bmake/unit-tests/varmod-match.mk index 8435c2a614e0..87928267d794 100644 --- a/contrib/bmake/unit-tests/varmod-match.mk +++ b/contrib/bmake/unit-tests/varmod-match.mk @@ -1,4 +1,4 @@ -# $NetBSD: varmod-match.mk,v 1.11 2022/06/11 09:15:49 rillig Exp $ +# $NetBSD: varmod-match.mk,v 1.12 2022/08/24 21:03:57 rillig Exp $ # # Tests for the :M variable modifier, which filters words that match the # given pattern. @@ -280,3 +280,13 @@ n= 2 .if ${PRIMES:M${:U2}} != "2" . error .endif + + +# Before var.c 1.1031 from 2022-08-24, the following expressions caused an +# out-of-bounds read beyond the indirect ':M' modifiers. +.if ${:U:${:UM\\}} # The ':M' pattern need not be unescaped, the +. error # resulting pattern is '\', it never matches +.endif # anything. +.if ${:U:${:UM\\\:\\}} # The ':M' pattern must be unescaped, the +. error # resulting pattern is ':\', it never matches +.endif # anything. diff --git a/contrib/bmake/unit-tests/varmod-order-numeric.mk b/contrib/bmake/unit-tests/varmod-order-numeric.mk index 542894c53942..62212bd265ad 100644 --- a/contrib/bmake/unit-tests/varmod-order-numeric.mk +++ b/contrib/bmake/unit-tests/varmod-order-numeric.mk @@ -1,4 +1,4 @@ -# $NetBSD: varmod-order-numeric.mk,v 1.7 2022/02/09 21:09:24 rillig Exp $ +# $NetBSD: varmod-order-numeric.mk,v 1.8 2022/09/27 19:18:45 rillig Exp $ # # Tests for the variable modifiers ':On', which returns the words, sorted in # ascending numeric order, and for ':Orn' and ':Onr', which additionally @@ -50,4 +50,10 @@ MIXED_BASE= 0 010 0x7 9 . error ${MIXED_BASE:On} .endif +# The measurement units for suffixes are k, M, G, but not T. +# The string '3T' evaluates to 3, the string 'x' evaluates as '0'. +.if ${4 3T 2M x:L:On} != "x 3T 4 2M" +. error +.endif + all: diff --git a/contrib/bmake/unit-tests/varmod-to-lower.mk b/contrib/bmake/unit-tests/varmod-to-lower.mk index 19d3406054b7..44116fd3eee2 100644 --- a/contrib/bmake/unit-tests/varmod-to-lower.mk +++ b/contrib/bmake/unit-tests/varmod-to-lower.mk @@ -1,7 +1,7 @@ -# $NetBSD: varmod-to-lower.mk,v 1.5 2020/11/15 20:20:58 rillig Exp $ +# $NetBSD: varmod-to-lower.mk,v 1.6 2022/11/29 23:54:55 rillig Exp $ # -# Tests for the :tl variable modifier, which returns the words in the -# variable value, converted to lowercase. +# Tests for the :tl variable modifier, which converts the expression value +# to lowercase. # # TODO: What about non-ASCII characters? ISO-8859-1, UTF-8? @@ -17,5 +17,10 @@ . error .endif -all: - @:; +# The ':tl' modifier works on the whole string, without splitting it into +# words. +.if ${:Umultiple spaces:tl} != "multiple spaces" +. error +.endif + +all: .PHONY diff --git a/contrib/bmake/unit-tests/varmod-undefined.mk b/contrib/bmake/unit-tests/varmod-undefined.mk index e06fc73244ab..9fd41c7fdb60 100644 --- a/contrib/bmake/unit-tests/varmod-undefined.mk +++ b/contrib/bmake/unit-tests/varmod-undefined.mk @@ -1,4 +1,4 @@ -# $NetBSD: varmod-undefined.mk,v 1.7 2020/11/15 20:20:58 rillig Exp $ +# $NetBSD: varmod-undefined.mk,v 1.8 2022/08/06 21:26:05 rillig Exp $ # # Tests for the :U variable modifier, which returns the given string # if the variable is undefined. @@ -29,7 +29,7 @@ # The nested variable expressions may contain braces, and these braces don't # need to match pairwise. In the following example, the :S modifier uses '{' # as delimiter, which confuses both editors and humans because the opening -# and # closing braces don't match anymore. It's syntactically valid though. +# and closing braces don't match anymore. It's syntactically valid though. # For more similar examples, see varmod-subst.mk, mod-subst-delimiter. .if ${:U${:Uvalue:S{a{X{}} != vXlue diff --git a/contrib/bmake/unit-tests/varmod.exp b/contrib/bmake/unit-tests/varmod.exp index e36c4ded9b47..3e588dc4d83f 100644 --- a/contrib/bmake/unit-tests/varmod.exp +++ b/contrib/bmake/unit-tests/varmod.exp @@ -1,8 +1,8 @@ -make: "varmod.mk" line 42: To escape a dollar, use \$, not $$, at "$$:L} != """ -make: "varmod.mk" line 42: Invalid variable name ':', at "$:L} != """ -make: "varmod.mk" line 47: Dollar followed by nothing -make: "varmod.mk" line 56: Missing delimiter ':' after modifier "P" -make: "varmod.mk" line 57: Missing argument for ".error" +make: "varmod.mk" line 96: To escape a dollar, use \$, not $$, at "$$:L} != """ +make: "varmod.mk" line 96: Invalid variable name ':', at "$:L} != """ +make: "varmod.mk" line 101: Dollar followed by nothing +make: "varmod.mk" line 110: Missing delimiter ':' after modifier "P" +make: "varmod.mk" line 111: Missing argument for ".error" make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/contrib/bmake/unit-tests/varmod.mk b/contrib/bmake/unit-tests/varmod.mk index 21ddf9103251..17bc1e6e3ae3 100644 --- a/contrib/bmake/unit-tests/varmod.mk +++ b/contrib/bmake/unit-tests/varmod.mk @@ -1,6 +1,60 @@ -# $NetBSD: varmod.mk,v 1.5 2020/12/19 22:33:11 rillig Exp $ +# $NetBSD: varmod.mk,v 1.7 2022/08/24 21:38:06 rillig Exp $ # # Tests for variable modifiers, such as :Q, :S,from,to or :Ufallback. +# +# See also: +# varparse-errors.mk + +# As of 2022-08-06, the possible behaviors during parsing are: +# +# * `strict`: the parsing style used by most modifiers: +# * either uses `ParseModifierPart` or parses the modifier literal +# * other modifiers may follow, separated by a ':' +# +# * `greedy`: calls `ParseModifierPart` with `ch->endc`; this means +# that no further modifiers are parsed in that expression. +# +# * `no-colon`: after parsing this modifier, the following modifier +# does not need to be separated by a colon. +# Omitting this colon is bad style. +# +# * `individual`: parsing this modifier does not follow the common +# pattern of calling `ParseModifierPart`. +# +# The SysV column says whether a parse error in the modifier falls back +# trying the `:from=to` System V modifier. +# +# | **Operator** | **Behavior** | **Remarks** | **SysV** | +# |--------------|--------------|--------------------|----------| +# | `!` | no-colon | | no | +# | `:=` | greedy | | yes | +# | `?:` | greedy | | no | +# | `@` | no-colon | | no | +# | `C` | no-colon | | no | +# | `D` | individual | custom parser | N/A | +# | `E` | strict | | yes | +# | `H` | strict | | yes | +# | `L` | no-colon | | N/A | +# | `M` | individual | custom parser | N/A | +# | `N` | individual | custom parser | N/A | +# | `O` | strict | only literal value | no | +# | `P` | no-colon | | N/A | +# | `Q` | strict | | yes | +# | `R` | strict | | yes | +# | `S` | no-colon | | N/A | +# | `T` | strict | | N/A | +# | `U` | individual | custom parser | N/A | +# | `[` | strict | | no | +# | `_` | individual | strcspn | yes | +# | `gmtime` | strict | only literal value | yes | +# | `hash` | strict | | N/A | +# | `localtime` | strict | only literal value | yes | +# | `q` | strict | | yes | +# | `range` | strict | | N/A | +# | `sh` | strict | | N/A | +# | `t` | strict | | no | +# | `u` | strict | | yes | +# | `from=to` | greedy | SysV, fallback | N/A | DOLLAR1= $$ DOLLAR2= ${:U\$} diff --git a/contrib/bmake/unit-tests/varname-dot-newline.exp b/contrib/bmake/unit-tests/varname-dot-newline.exp index 13943539bf3b..684fb5799752 100644 --- a/contrib/bmake/unit-tests/varname-dot-newline.exp +++ b/contrib/bmake/unit-tests/varname-dot-newline.exp @@ -1,4 +1,5 @@ -make: "varname-dot-newline.mk" line 16: The .newline variable can be overwritten. Just don't do that. first second +backslash newline: <\ +> exit status 0 diff --git a/contrib/bmake/unit-tests/varname-dot-newline.mk b/contrib/bmake/unit-tests/varname-dot-newline.mk index 0565d244f298..1940dc2a990d 100644 --- a/contrib/bmake/unit-tests/varname-dot-newline.mk +++ b/contrib/bmake/unit-tests/varname-dot-newline.mk @@ -1,23 +1,31 @@ -# $NetBSD: varname-dot-newline.mk,v 1.4 2020/10/24 08:46:08 rillig Exp $ +# $NetBSD: varname-dot-newline.mk,v 1.6 2023/01/26 20:48:18 sjg Exp $ # -# Tests for the special .newline variable. +# Tests for the special .newline variable, which contains a single newline +# character (U+000A). + + +# https://austingroupbugs.net/view.php?id=1549 proposes: +# > After all macro expansion is complete, when an escaped is +# > found in a command line in a makefile, the command line that is executed +# > shall contain the , the , and the next line, except +# > that the first character of the next line shall not be included if it is +# > a . # -# Contrary to the special variable named "" that is used in expressions like -# ${:Usome-value}, the variable ".newline" is not protected against -# modification. Nobody exploits that though. +# The above quote assumes that each resulting character has a "next +# line", but that's not how the .newline variable works. +BACKSLASH_NEWLINE:= \${.newline} + + +# Check that .newline is read-only NEWLINE:= ${.newline} .newline= overwritten -.if ${.newline} == ${NEWLINE} -. info The .newline variable cannot be overwritten. Good. -.else -. info The .newline variable can be overwritten. Just don't do that. +.if ${.newline} != ${NEWLINE} +. error The .newline variable can be overwritten. It should be read-only. .endif -# Restore the original value. -.newline= ${NEWLINE} - all: @echo 'first${.newline}second' + @echo 'backslash newline: <${BACKSLASH_NEWLINE}>' diff --git a/contrib/bmake/unit-tests/varparse-errors.exp b/contrib/bmake/unit-tests/varparse-errors.exp index e47127447cda..2c3568e468ca 100644 --- a/contrib/bmake/unit-tests/varparse-errors.exp +++ b/contrib/bmake/unit-tests/varparse-errors.exp @@ -6,6 +6,20 @@ make: Bad modifier ":OX" for variable "" make: Bad modifier ":OX" for variable "" make: "varparse-errors.mk" line 68: Undefined variable "${:U:OX" make: Bad modifier ":OX" for variable "" +make: Unclosed variable expression, expecting '}' for modifier "Q" of variable "" with value "" +make: Unclosed variable expression, expecting '}' for modifier "sh" of variable "" with value "" +make: Unclosed variable expression, expecting '}' for modifier "tA" of variable "" with value "" +make: Unclosed variable expression, expecting '}' for modifier "tsX" of variable "" with value "" +make: Unclosed variable expression, expecting '}' for modifier "ts" of variable "" with value "" +make: Unclosed variable expression, expecting '}' for modifier "ts\040" of variable "" with value "" +make: Unclosed variable expression, expecting '}' for modifier "u" of variable "" with value "" +make: Unclosed variable expression, expecting '}' for modifier "H" of variable "" with value "." +make: Unclosed variable expression, expecting '}' for modifier "[1]" of variable "" with value "" +make: Unclosed variable expression, expecting '}' for modifier "hash" of variable "" with value "b2af338b" +make: Unclosed variable expression, expecting '}' for modifier "range" of variable "" with value "1" +make: Unclosed variable expression, expecting '}' for modifier "_" of variable "" with value "" +make: Unclosed variable expression, expecting '}' for modifier "gmtime" of variable "" with value "" +make: Unclosed variable expression, expecting '}' for modifier "localtime" of variable "" with value "" make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 diff --git a/contrib/bmake/unit-tests/varparse-errors.mk b/contrib/bmake/unit-tests/varparse-errors.mk index 51a403fa898f..9174d264db0f 100644 --- a/contrib/bmake/unit-tests/varparse-errors.mk +++ b/contrib/bmake/unit-tests/varparse-errors.mk @@ -1,4 +1,4 @@ -# $NetBSD: varparse-errors.mk,v 1.5 2022/01/24 22:59:49 rillig Exp $ +# $NetBSD: varparse-errors.mk,v 1.7 2022/08/24 22:09:41 rillig Exp $ # Tests for parsing and evaluating all kinds of variable expressions. # @@ -68,4 +68,21 @@ IND= ${:OX} _:= ${:U:OX:U${IND}} ${:U:OX:U${IND}} #.MAKEFLAGS: -d0 -all: + +# Before var.c 1.032 from 2022-08-24, make complained about 'Unknown modifier' +# or 'Bad modifier' when in fact the modifier was entirely correct, it was +# just not delimited by either ':' or '}' but instead by '\0'. +UNCLOSED:= ${:U:Q +UNCLOSED:= ${:U:sh +UNCLOSED:= ${:U:tA +UNCLOSED:= ${:U:tsX +UNCLOSED:= ${:U:ts +UNCLOSED:= ${:U:ts\040 +UNCLOSED:= ${:U:u +UNCLOSED:= ${:U:H +UNCLOSED:= ${:U:[1] +UNCLOSED:= ${:U:hash +UNCLOSED:= ${:U:range +UNCLOSED:= ${:U:_ +UNCLOSED:= ${:U:gmtime +UNCLOSED:= ${:U:localtime diff --git a/contrib/bmake/var.c b/contrib/bmake/var.c index b5a063ed20a2..9657f4b7fa18 100644 --- a/contrib/bmake/var.c +++ b/contrib/bmake/var.c @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1025 2022/06/14 19:57:56 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1039 2023/01/26 20:48:17 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -147,7 +147,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1025 2022/06/14 19:57:56 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1039 2023/01/26 20:48:17 sjg Exp $"); /* * Variables are defined using one of the VAR=value assignments. Their @@ -200,15 +200,16 @@ typedef struct Var { * The variable value cannot be changed anymore, and the variable * cannot be deleted. Any attempts to do so are silently ignored, * they are logged with -dv though. + * Use .[NO]READONLY: to adjust. * * See VAR_SET_READONLY. */ bool readOnly:1; /* - * The variable's value is currently being used by Var_Parse or - * Var_Subst. This marker is used to avoid endless recursion. - */ + * The variable is currently being accessed by Var_Parse or Var_Subst. + * This temporary marker is used to avoid endless recursion. + */ bool inUse:1; /* @@ -1085,6 +1086,12 @@ Global_Delete(const char *name) Var_Delete(SCOPE_GLOBAL, name); } +void +Global_Set_ReadOnly(const char *name, const char *value) +{ + Var_SetWithFlags(SCOPE_GLOBAL, name, value, VAR_SET_READONLY); +} + /* * Append the value to the named variable. * @@ -1229,6 +1236,23 @@ Var_Value(GNode *scope, const char *name) return FStr_InitOwn(value); } +/* + * set readOnly attribute of specified var if it exists + */ +void +Var_ReadOnly(const char *name, bool bf) +{ + Var *v; + + v = VarFind(name, SCOPE_GLOBAL, false); + if (v == NULL) { + DEBUG1(VAR, "Var_ReadOnly: %s not found\n", name); + return; + } + v->readOnly = bf; + DEBUG2(VAR, "Var_ReadOnly: %s %s\n", name, bf ? "true" : "false"); +} + /* * Return the unexpanded variable value from this node, without trying to look * up the variable in any other scope. @@ -1563,7 +1587,7 @@ static void RegexReplaceBackref(char ref, SepBuf *buf, const char *wp, const regmatch_t *m, size_t nsub) { - unsigned int n = ref - '0'; + unsigned int n = (unsigned)ref - '0'; if (n >= nsub) Error("No subexpression \\%u", n); @@ -2150,6 +2174,12 @@ ParseModifierPartExpr(const char **pp, LazyBuf *part, const ModChain *ch, * This subtle difference is not documented in the manual page, neither is * the difference between parsing ':D' and ':M' documented. No code should * ever depend on these details, but who knows. + * + * TODO: Before trying to replace this code with Var_Parse, there need to be + * more unit tests in varmod-loop.mk. The modifier ':@' uses Var_Subst + * internally, in which a '$' is escaped as '$$', not as '\$' like in other + * modifiers. When parsing the body text '$${var}', skipping over the first + * '$' would treat '${var}' as a make expression, not as a shell variable. */ static void ParseModifierPartDollar(const char **pp, LazyBuf *part) @@ -2170,7 +2200,7 @@ ParseModifierPartDollar(const char **pp, LazyBuf *part) depth--; } } - LazyBuf_AddBytesBetween(part, start, p); + LazyBuf_AddSubstring(part, Substring_Init(start, p)); *pp = p; } else { LazyBuf_Add(part, *start); @@ -2272,7 +2302,7 @@ ParseModifierPart( MAKE_INLINE bool IsDelimiter(char c, const ModChain *ch) { - return c == ':' || c == ch->endc; + return c == ':' || c == ch->endc || c == '\0'; } /* Test whether mod starts with modname, followed by a delimiter. */ @@ -2447,22 +2477,15 @@ ApplyModifier_Loop(const char **pp, ModChain *ch) return AMR_OK; } -/* :Ddefined or :Uundefined */ -static ApplyModifierResult -ApplyModifier_Defined(const char **pp, ModChain *ch) +static void +ParseModifier_Defined(const char **pp, ModChain *ch, bool shouldEval, + LazyBuf *buf) { - Expr *expr = ch->expr; - LazyBuf buf; const char *p; - VarEvalMode emode = VARE_PARSE_ONLY; - if (Expr_ShouldEval(expr)) - if ((**pp == 'D') == (expr->defined == DEF_REGULAR)) - emode = expr->emode; - p = *pp + 1; - LazyBuf_Init(&buf, p); - while (!IsDelimiter(*p, ch) && *p != '\0') { + LazyBuf_Init(buf, p); + while (!IsDelimiter(*p, ch)) { /* * XXX: This code is similar to the one in Var_Parse. See if @@ -2474,8 +2497,10 @@ ApplyModifier_Defined(const char **pp, ModChain *ch) /* See Buf_AddEscaped in for.c. */ if (*p == '\\') { char c = p[1]; - if (IsDelimiter(c, ch) || c == '$' || c == '\\') { - LazyBuf_Add(&buf, c); + if ((IsDelimiter(c, ch) && c != '\0') || + c == '$' || c == '\\') { + if (shouldEval) + LazyBuf_Add(buf, c); p += 2; continue; } @@ -2483,28 +2508,41 @@ ApplyModifier_Defined(const char **pp, ModChain *ch) /* Nested variable expression */ if (*p == '$') { - FStr nested_val; + FStr val; - (void)Var_Parse(&p, expr->scope, emode, &nested_val); + (void)Var_Parse(&p, ch->expr->scope, + shouldEval ? ch->expr->emode : VARE_PARSE_ONLY, + &val); /* TODO: handle errors */ - if (Expr_ShouldEval(expr)) - LazyBuf_AddStr(&buf, nested_val.str); - FStr_Done(&nested_val); + if (shouldEval) + LazyBuf_AddStr(buf, val.str); + FStr_Done(&val); continue; } /* Ordinary text */ - LazyBuf_Add(&buf, *p); + if (shouldEval) + LazyBuf_Add(buf, *p); p++; } *pp = p; +} + +/* :Ddefined or :Uundefined */ +static ApplyModifierResult +ApplyModifier_Defined(const char **pp, ModChain *ch) +{ + Expr *expr = ch->expr; + LazyBuf buf; + bool shouldEval = + Expr_ShouldEval(expr) && + (**pp == 'D') == (expr->defined == DEF_REGULAR); + + ParseModifier_Defined(pp, ch, shouldEval, &buf); Expr_Define(expr); - - if (VarEvalMode_ShouldEval(emode)) + if (shouldEval) Expr_SetValue(expr, Substring_Str(LazyBuf_Get(&buf))); - else - LazyBuf_Done(&buf); return AMR_OK; } @@ -2734,7 +2772,7 @@ ParseModifier_Match(const char **pp, const ModChain *ch) int nest = 0; const char *p; for (p = mod + 1; *p != '\0' && !(*p == ':' && nest == 0); p++) { - if (*p == '\\' && + if (*p == '\\' && p[1] != '\0' && (IsDelimiter(p[1], ch) || p[1] == ch->startc)) { if (!needSubst) copy = true; @@ -2920,11 +2958,8 @@ ApplyModifier_Regex(const char **pp, ModChain *ch) oneBigWord = ch->oneBigWord; ParsePatternFlags(pp, &args.pflags, &oneBigWord); - if (!ModChain_ShouldEval(ch)) { - LazyBuf_Done(&replaceBuf); - FStr_Done(&re); - return AMR_OK; - } + if (!ModChain_ShouldEval(ch)) + goto done; error = regcomp(&args.re, re.str, REG_EXTENDED); if (error != 0) { @@ -2941,6 +2976,7 @@ ApplyModifier_Regex(const char **pp, ModChain *ch) ModifyWords(ch, ModifyWord_SubstRegex, &args, oneBigWord); regfree(&args.re); +done: LazyBuf_Done(&replaceBuf); FStr_Done(&re); return AMR_OK; @@ -3093,7 +3129,7 @@ ApplyModifier_To(const char **pp, ModChain *ch) const char *mod = *pp; assert(mod[0] == 't'); - if (IsDelimiter(mod[1], ch) || mod[1] == '\0') { + if (IsDelimiter(mod[1], ch)) { *pp = mod + 1; return AMR_BAD; /* Found ":t" or ":t:". */ } @@ -3101,7 +3137,7 @@ ApplyModifier_To(const char **pp, ModChain *ch) if (mod[1] == 's') return ApplyModifier_ToSep(pp, ch); - if (!IsDelimiter(mod[2], ch)) { /* :t */ + if (!IsDelimiter(mod[2], ch)) { /* :t */ *pp = mod + 1; return AMR_BAD; } @@ -3329,10 +3365,10 @@ ApplyModifier_Order(const char **pp, ModChain *ch) SubstringWords words; int (*cmp)(const void *, const void *); - if (IsDelimiter(mod[1], ch) || mod[1] == '\0') { + if (IsDelimiter(mod[1], ch)) { cmp = SubStrAsc; (*pp)++; - } else if (IsDelimiter(mod[2], ch) || mod[2] == '\0') { + } else if (IsDelimiter(mod[2], ch)) { if (mod[1] == 'n') cmp = SubNumAsc; else if (mod[1] == 'r') @@ -3342,7 +3378,7 @@ ApplyModifier_Order(const char **pp, ModChain *ch) else goto bad; *pp += 2; - } else if (IsDelimiter(mod[3], ch) || mod[3] == '\0') { + } else if (IsDelimiter(mod[3], ch)) { if ((mod[1] == 'n' && mod[2] == 'r') || (mod[1] == 'r' && mod[2] == 'n')) cmp = SubNumDesc; @@ -3861,7 +3897,7 @@ ApplyModifiersIndirect(ModChain *ch, const char **pp) (void)Var_Parse(&p, expr->scope, expr->emode, &mods); /* TODO: handle errors */ - if (mods.str[0] != '\0' && *p != '\0' && !IsDelimiter(*p, ch)) { + if (mods.str[0] != '\0' && !IsDelimiter(*p, ch)) { FStr_Done(&mods); return AMIR_SYSV; } @@ -3920,7 +3956,7 @@ ApplySingleModifier(const char **pp, ModChain *ch) * errors and leads to wrong results. * Parsing should rather stop here. */ - for (p++; !IsDelimiter(*p, ch) && *p != '\0'; p++) + for (p++; !IsDelimiter(*p, ch); p++) continue; Parse_Error(PARSE_FATAL, "Unknown modifier \"%.*s\"", (int)(p - mod), mod); @@ -4499,6 +4535,8 @@ Var_Parse(const char **pp, GNode *scope, VarEvalMode emode, FStr *out_val) if (Var_Parse_FastLane(pp, emode, out_val)) return VPR_OK; + /* TODO: Reduce computations in parse-only mode. */ + DEBUG2(VAR, "Var_Parse: %s (%s)\n", start, VarEvalMode_Name[emode]); *out_val = FStr_InitRefer(NULL); @@ -4525,7 +4563,7 @@ Var_Parse(const char **pp, GNode *scope, VarEvalMode emode, FStr *out_val) } expr.name = v->name.str; - if (v->inUse) { + if (v->inUse && VarEvalMode_ShouldEval(emode)) { if (scope->fname != NULL) { fprintf(stderr, "In a command near "); PrintLocation(stderr, false, scope); @@ -4791,7 +4829,7 @@ Var_Dump(GNode *scope) for (i = 0; i < vec.len; i++) { const char *varname = varnames[i]; - Var *var = HashTable_FindValue(&scope->vars, varname); + const Var *var = HashTable_FindValue(&scope->vars, varname); debug_printf("%-16s = %s%s\n", varname, var->val.data, ValueDescription(var->val.data)); } diff --git a/usr.bin/bmake/Makefile b/usr.bin/bmake/Makefile index c8d2dbd63b2b..722de897acbb 100644 --- a/usr.bin/bmake/Makefile +++ b/usr.bin/bmake/Makefile @@ -12,7 +12,7 @@ CFLAGS+= -I${.CURDIR} CLEANDIRS+= FreeBSD CLEANFILES+= bootstrap -# $Id: Makefile,v 1.120 2022/07/26 23:02:54 sjg Exp $ +# $Id: Makefile,v 1.122 2022/10/08 02:53:30 sjg Exp $ PROG?= ${.CURDIR:T} diff --git a/usr.bin/bmake/Makefile.config b/usr.bin/bmake/Makefile.config index f92abbc61dbf..fab0991419ff 100644 --- a/usr.bin/bmake/Makefile.config +++ b/usr.bin/bmake/Makefile.config @@ -7,13 +7,14 @@ SRCTOP?= ${.CURDIR:H:H} # things set by configure -_MAKE_VERSION?=20220726 +_MAKE_VERSION?=20230126 prefix?= /usr srcdir= ${SRCTOP}/contrib/bmake CC?= cc DEFAULT_SYS_PATH?= .../share/mk:/usr/share/mk +EGREP = egrep CPPFLAGS+= CFLAGS+= ${CPPFLAGS} -DHAVE_CONFIG_H LDFLAGS+= diff --git a/usr.bin/bmake/config.h b/usr.bin/bmake/config.h index 6c053cf96cfd..baaa1f38ea54 100644 --- a/usr.bin/bmake/config.h +++ b/usr.bin/bmake/config.h @@ -73,8 +73,8 @@ /* Define to 1 if the system has the type `long long int'. */ #define HAVE_LONG_LONG_INT 1 -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 +/* Define to 1 if you have the header file. */ +/* #undef HAVE_MINIX_CONFIG_H */ /* Define to 1 if you have the `mmap' function. */ #define HAVE_MMAP 1 @@ -142,6 +142,9 @@ /* Define to 1 if you have the header file. */ #define HAVE_STDINT_H 1 +/* Define to 1 if you have the header file. */ +#define HAVE_STDIO_H 1 + /* Define to 1 if you have the header file. */ #define HAVE_STDLIB_H 1 @@ -178,13 +181,6 @@ /* Define to 1 if you have the `strtoul' function. */ #define HAVE_STRTOUL 1 -/* Define to 1 if `st_rdev' is a member of `struct stat'. */ -#define HAVE_STRUCT_STAT_ST_RDEV 1 - -/* Define to 1 if your `struct stat' has `st_rdev'. Deprecated, use - `HAVE_STRUCT_STAT_ST_RDEV' instead. */ -#define HAVE_ST_RDEV 1 - /* Define to 1 if you have the `sysctl' function. */ #define HAVE_SYSCTL 1 @@ -265,6 +261,9 @@ /* Define to 1 if you have the `warnx' function. */ #define HAVE_WARNX 1 +/* Define to 1 if you have the header file. */ +#define HAVE_WCHAR_H 1 + /* Define to 1 if `fork' works. */ #define HAVE_WORKING_FORK 1 @@ -281,7 +280,7 @@ #define PACKAGE_NAME "bmake" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "bmake 20211020" +#define PACKAGE_STRING "bmake 20220909" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "bmake" @@ -290,20 +289,16 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "20211020" - -/* Define as the return type of signal handlers (`int' or `void'). */ -#define RETSIGTYPE void +#define PACKAGE_VERSION "20220909" /* Define to 1 if the `S_IS*' macros in do not work properly. */ /* #undef STAT_MACROS_BROKEN */ -/* Define to 1 if you have the ANSI C header files. */ +/* Define to 1 if all of the C90 standard headers exist (not just the ones + required in a freestanding environment). This macro is provided for + backward compatibility; new code need not use it. */ #define STDC_HEADERS 1 -/* Define to 1 if you can safely include both and . */ -#define TIME_WITH_SYS_TIME 1 - /* Define to 1 if your declares `struct tm'. */ /* #undef TM_IN_SYS_TIME */ @@ -311,21 +306,87 @@ #ifndef _ALL_SOURCE # define _ALL_SOURCE 1 #endif +/* Enable general extensions on macOS. */ +#ifndef _DARWIN_C_SOURCE +# define _DARWIN_C_SOURCE 1 +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# define __EXTENSIONS__ 1 +#endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # define _GNU_SOURCE 1 #endif -/* Enable threading extensions on Solaris. */ +/* Enable X/Open compliant socket functions that do not require linking + with -lxnet on HP-UX 11.11. */ +#ifndef _HPUX_ALT_XOPEN_SOCKET_API +# define _HPUX_ALT_XOPEN_SOCKET_API 1 +#endif +/* Identify the host operating system as Minix. + This macro does not affect the system headers' behavior. + A future release of Autoconf may stop defining this macro. */ +#ifndef _MINIX +/* # undef _MINIX */ +#endif +/* Enable general extensions on NetBSD. + Enable NetBSD compatibility extensions on Minix. */ +#ifndef _NETBSD_SOURCE +# define _NETBSD_SOURCE 1 +#endif +/* Enable OpenBSD compatibility extensions on NetBSD. + Oddly enough, this does nothing on OpenBSD. */ +#ifndef _OPENBSD_SOURCE +# define _OPENBSD_SOURCE 1 +#endif +/* Define to 1 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_SOURCE +/* # undef _POSIX_SOURCE */ +#endif +/* Define to 2 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_1_SOURCE +/* # undef _POSIX_1_SOURCE */ +#endif +/* Enable POSIX-compatible threading on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # define _POSIX_PTHREAD_SEMANTICS 1 #endif +/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */ +#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +# define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1 +#endif +/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */ +#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ +# define __STDC_WANT_IEC_60559_BFP_EXT__ 1 +#endif +/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */ +#ifndef __STDC_WANT_IEC_60559_DFP_EXT__ +# define __STDC_WANT_IEC_60559_DFP_EXT__ 1 +#endif +/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */ +#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__ +# define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1 +#endif +/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */ +#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ +# define __STDC_WANT_IEC_60559_TYPES_EXT__ 1 +#endif +/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */ +#ifndef __STDC_WANT_LIB_EXT2__ +# define __STDC_WANT_LIB_EXT2__ 1 +#endif +/* Enable extensions specified by ISO/IEC 24747:2009. */ +#ifndef __STDC_WANT_MATH_SPEC_FUNCS__ +# define __STDC_WANT_MATH_SPEC_FUNCS__ 1 +#endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # define _TANDEM_SOURCE 1 #endif -/* Enable general extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# define __EXTENSIONS__ 1 +/* Enable X/Open extensions. Define to 500 only if necessary + to make mbstate_t available. */ +#ifndef _XOPEN_SOURCE +/* # undef _XOPEN_SOURCE */ #endif @@ -341,16 +402,6 @@ # endif #endif -/* Define to 1 if on MINIX. */ -/* #undef _MINIX */ - -/* Define to 2 if the system does not provide POSIX.1 features except with - this defined. */ -/* #undef _POSIX_1_SOURCE */ - -/* Define to 1 if you need to in order for `stat' and other things to work. */ -/* #undef _POSIX_SOURCE */ - /* Define for Solaris 2.5.1 so the uint32_t typedef from , , or is not used. If the typedef were allowed, the #define below would cause a syntax error. */ @@ -378,7 +429,7 @@ /* Define to `long int' if does not define. */ /* #undef off_t */ -/* Define to `int' if does not define. */ +/* Define as a signed integer type capable of holding a process identifier. */ /* #undef pid_t */ /* type that signal handlers can safely frob */ diff --git a/usr.bin/bmake/unit-tests/Makefile b/usr.bin/bmake/unit-tests/Makefile index 2a0bbcb3c441..3214dacda5fc 100644 --- a/usr.bin/bmake/unit-tests/Makefile +++ b/usr.bin/bmake/unit-tests/Makefile @@ -2,9 +2,9 @@ # See contrib/bmake/bsd.after-import.mk # # $FreeBSD$ -# $Id: Makefile,v 1.182 2022/07/26 19:39:32 sjg Exp $ +# $Id: Makefile,v 1.191 2023/01/24 06:09:49 sjg Exp $ # -# $NetBSD: Makefile,v 1.318 2022/06/10 21:28:50 rillig Exp $ +# $NetBSD: Makefile,v 1.331 2023/01/24 00:24:02 sjg Exp $ # # Unit tests for make(1) # @@ -29,10 +29,6 @@ # named makefile (*.mk), with its own set of expected results (*.exp), # and it should be added to the TESTS list. # -# A few *.mk files are helper files for other tests (such as include-sub.mk) -# and are thus not added to TESTS. Such files must be ignored in -# src/tests/usr.bin/make/t_make.sh. -# .MAIN: all @@ -171,6 +167,7 @@ TESTS+= directive-export-impl TESTS+= directive-export-gmake TESTS+= directive-export-literal TESTS+= directive-for +TESTS+= directive-for-break TESTS+= directive-for-empty TESTS+= directive-for-errors TESTS+= directive-for-escape @@ -328,6 +325,7 @@ TESTS+= ternary TESTS+= unexport TESTS+= unexport-env TESTS+= use-inference +TESTS+= var-readonly TESTS+= var-scope TESTS+= var-scope-cmdline TESTS+= var-scope-env @@ -504,7 +502,7 @@ TESTS:= ${TESTS:${BROKEN_TESTS:S,^,N,:ts:}} ENV.depsrc-optional+= TZ=UTC ENV.deptgt-phony+= MAKESYSPATH=. ENV.directive-undef= ENV_VAR=env-value -ENV.envfirst= FROM_ENV=value-from-env +ENV.opt-env= FROM_ENV=value-from-env ENV.opt-m-include-dir= ${MAKEOBJDIR:DMAKEOBJDIR=${MAKEOBJDIR}} ENV.varmisc= FROM_ENV=env ENV.varmisc+= FROM_ENV_BEFORE=env @@ -567,6 +565,7 @@ SED_CMDS.sh-dots+= -e 's,^\(\*\*\* Error code \)[1-9][0-9]*,\1,' SED_CMDS.sh-errctl= ${STD_SED_CMDS.dj} SED_CMDS.sh-flags= ${STD_SED_CMDS.hide-from-output} SED_CMDS.shell-csh= ${STD_SED_CMDS.white-space} +SED_CMDS.sh-leading-hyphen= ${STD_SED_CMDS.shell} SED_CMDS.suff-main+= ${STD_SED_CMDS.dg1} SED_CMDS.suff-main-several+= ${STD_SED_CMDS.dg1} SED_CMDS.suff-transform-debug+= ${STD_SED_CMDS.dg1} @@ -575,12 +574,13 @@ SED_CMDS.var-op-shell+= -e '/command/s,No such.*,not found,' SED_CMDS.var-op-shell+= ${STD_SED_CMDS.white-space} SED_CMDS.vardebug+= -e 's,${.SHELL},,' SED_CMDS.varmod-subst-regex+= ${STD_SED_CMDS.regex} +SED_CMDS.varparse-errors+= ${STD_SED_CMDS.timestamp} SED_CMDS.varname-dot-parsedir= -e '/in some cases/ s,^make: "[^"]*,make: ",' SED_CMDS.varname-dot-parsefile= -e '/in some cases/ s,^make: "[^"]*,make: ",' SED_CMDS.varname-dot-shell= -e 's, = /[^ ]*, = (details omitted),g' SED_CMDS.varname-dot-shell+= -e 's,"/[^" ]*","(details omitted)",g' SED_CMDS.varname-dot-shell+= -e 's,\[/[^] ]*\],[(details omitted)],g' -SED_CMDS.varname-empty= ${.OBJDIR .PARSEDIR .PATH .SHELL:L:@v@-e '/\\$v/d'@} +SED_CMDS.varname-empty= ${.OBJDIR .PARSEDIR .PATH .SHELL .SYSPATH:L:@v@-e '/\\$v/d'@} # Some tests need an additional round of postprocessing. POSTPROC.depsrc-wait= sed -e '/^---/d' -e 's,^\(: Making 3[abc]\)[123]$$,\1,' @@ -605,13 +605,14 @@ STD_SED_CMDS.dd+= -e '/^CachedDir /d' # Omit details such as process IDs from the output of the -dg1 option. STD_SED_CMDS.dg1= -e '/\#.* \.$$/d' STD_SED_CMDS.dg1+= -e '/\.MAKE.PATH_FILEMON/d' -STD_SED_CMDS.dg1+= -e '/^MAKE_VERSION/d;/^\#.*\/mk/d' +STD_SED_CMDS.dg1+= -e '/^\#.*\/mk/d' STD_SED_CMDS.dg1+= -e 's, ${DEFSYSPATH:U/usr/share/mk}$$, ,' STD_SED_CMDS.dg1+= -e 's,^\(\.MAKE *=\) .*,\1
,' STD_SED_CMDS.dg1+= -e 's,^\(\.MAKE\.[A-Z_]* *=\) .*,\1
,' STD_SED_CMDS.dg1+= -e 's,^\(MACHINE[_ARCH]* *=\) .*,\1
,' STD_SED_CMDS.dg1+= -e 's,^\(MAKE *=\) .*,\1
,' STD_SED_CMDS.dg1+= -e 's,^\(\.SHELL *=\) .*,\1
,' +STD_SED_CMDS.dg1+= -e '/\.SYSPATH/d' STD_SED_CMDS.dg2= ${STD_SED_CMDS.dg1} STD_SED_CMDS.dg2+= -e 's,\(last modified\) ..:..:.. ... ..\, ....,\1 ,' @@ -655,9 +656,11 @@ STD_SED_CMDS.hide-from-output= \ # bash 5.1.0 bash: line 1: /nonexistent: No such file or directory # dash dash: 1: cannot open /nonexistent: No such file # +STD_SED_CMDS.shell+= -e 's,^${.SHELL},${.SHELL:T},' STD_SED_CMDS.shell+= -e 's,^${.SHELL:T}: line [0-9][0-9]*: ,,' STD_SED_CMDS.shell+= -e 's,^${.SHELL:T}: [0-9][0-9]*: ,,' STD_SED_CMDS.shell+= -e 's,^${.SHELL:T}: ,,' +STD_SED_CMDS.shell+= -e 's,: command not found,: not found,' STD_SED_CMDS.white-space= -e 's, *, ,g' -e 's, *$$,,' @@ -666,6 +669,11 @@ STD_SED_CMDS.white-space= -e 's, *, ,g' -e 's, *$$,,' STD_SED_CMDS.regex= \ -e 's,\(Regex compilation error:\).*,\1 (details omitted),' +# Normalize timestamps from ':gmtime' or ':localtime' to ''. +# See STD_SED_CMDS.dg2 for timestamps from the debug log. +STD_SED_CMDS.timestamp= \ + -e 's,[A-Z][a-z][a-z] [A-Z][a-z][a-z] [ 0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9] [12][0-9][0-9][0-9],,' + # End of the configuration helpers section. .sinclude "Makefile.inc" @@ -725,7 +733,17 @@ TMPDIR:= /tmp/uid${.MAKE.UID} _!= mkdir -p ${TMPDIR} .endif -MAKE_TEST_ENV= MALLOC_OPTIONS="JA" # for jemalloc 100 +# Some Linux systems such as Fedora have deprecated egrep in favor of grep -E. +.if ${.MAKE.OS:NLinux} == "" +EGREP= grep -E +.endif +# Keep the classical definition for all other systems. Just as the bmake code +# is kept compatible with C90, the tests are kept compatible with systems that +# are several decades old and don't follow modern POSIX standards. +EGREP?= egrep + +MAKE_TEST_ENV= EGREP="${EGREP}" +MAKE_TEST_ENV+= MALLOC_OPTIONS="JA" # for jemalloc 100 MAKE_TEST_ENV+= MALLOC_CONF="junk:true" # for jemalloc 510 MAKE_TEST_ENV+= TMPDIR=${TMPDIR} @@ -773,6 +791,9 @@ _SED_CMDS+= -e 's,${.OBJDIR},,g' _SED_CMDS+= -e 's,${.CURDIR},,g' _SED_CMDS+= -e 's,/,,g' _SED_CMDS+= -e 's,${UNIT_TESTS:S,.,\\.,g}/,,g' +_SED_CMDS+= -e '/MAKE_VERSION/d' +_SED_CMDS+= -e '/EGREP=/d' + # on AT&T derived systems: false exits 255 not 1 .if ${.MAKE.OS:N*BSD} != "" _SED_CMDS+= -e 's,\(Error code\) 255,\1 1,' diff --git a/usr.bin/bmake/unit-tests/Makefile.config b/usr.bin/bmake/unit-tests/Makefile.config index 17ccf593b495..1e71a3dd5ef6 100644 --- a/usr.bin/bmake/unit-tests/Makefile.config +++ b/usr.bin/bmake/unit-tests/Makefile.config @@ -5,9 +5,10 @@ SRCTOP?= ${.CURDIR:H:H:H} -# $Id: Makefile.config.in,v 1.3 2021/10/22 07:48:57 sjg Exp $ +# $Id: Makefile.config.in,v 1.4 2022/09/09 18:44:56 sjg Exp $ srcdir= ${SRCTOP}/contrib/bmake/unit-tests +EGREP= egrep TOOL_DIFF?= diff DIFF_FLAGS?= -u UTC_1= Europe/Berlin