Issue #2512 - Part 1 - Imported minimal autoconf 2.13.

https://bugzilla.mozilla.org/show_bug.cgi?id=1663863
This commit is contained in:
Brian Smith 2024-05-06 19:07:28 -05:00 committed by wuggy
commit bb05f81b14
6 changed files with 5642 additions and 54 deletions

2607
build/autoconf/acgeneral.m4 Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,80 @@
dnl Map old names of Autoconf macros to new regularized names.
dnl This file is part of Autoconf.
dnl Copyright (C) 1994 Free Software Foundation, Inc.
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2, or (at your option)
dnl any later version.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
dnl 02111-1307, USA.
dnl
dnl General macros.
dnl
define(AC_WARN, [indir([AC_MSG_WARN], $@)])dnl
define(AC_ERROR, [indir([AC_MSG_ERROR], $@)])dnl
AC_DEFUN(AC_PROGRAM_CHECK, [indir([AC_CHECK_PROG], $@)])dnl
AC_DEFUN(AC_PROGRAM_PATH, [indir([AC_PATH_PROG], $@)])dnl
AC_DEFUN(AC_PROGRAMS_CHECK, [indir([AC_CHECK_PROGS], $@)])dnl
AC_DEFUN(AC_PROGRAMS_PATH, [indir([AC_PATH_PROGS], $@)])dnl
AC_DEFUN(AC_PREFIX, [indir([AC_PREFIX_PROGRAM], $@)])dnl
AC_DEFUN(AC_HEADER_EGREP, [indir([AC_EGREP_HEADER], $@)])dnl
AC_DEFUN(AC_PROGRAM_EGREP, [indir([AC_EGREP_CPP], $@)])dnl
AC_DEFUN(AC_TEST_PROGRAM, [indir([AC_TRY_RUN], $@)])dnl
AC_DEFUN(AC_TEST_CPP, [indir([AC_TRY_CPP], $@)])dnl
AC_DEFUN(AC_HEADER_CHECK, [indir([AC_CHECK_HEADER], $@)])dnl
AC_DEFUN(AC_FUNC_CHECK, [indir([AC_CHECK_FUNC], $@)])dnl
AC_DEFUN(AC_HAVE_FUNCS, [indir([AC_CHECK_FUNCS], $@)])dnl
AC_DEFUN(AC_HAVE_HEADERS, [indir([AC_CHECK_HEADERS], $@)])dnl
AC_DEFUN(AC_SIZEOF_TYPE, [indir([AC_CHECK_SIZEOF], $@)])dnl
dnl
dnl Specific macros.
dnl
AC_DEFUN(AC_GCC_TRADITIONAL, [indir([AC_PROG_GCC_TRADITIONAL])])dnl
AC_DEFUN(AC_MINUS_C_MINUS_O, [indir([AC_PROG_CC_C_O])])dnl
AC_DEFUN(AC_SET_MAKE, [indir([AC_PROG_MAKE_SET])])dnl
AC_DEFUN(AC_YYTEXT_POINTER, [indir([AC_DECL_YYTEXT])])dnl
AC_DEFUN(AC_LN_S, [indir([AC_PROG_LN_S])])dnl
AC_DEFUN(AC_STDC_HEADERS, [indir([AC_HEADER_STDC])])dnl
AC_DEFUN(AC_MAJOR_HEADER, [indir([AC_HEADER_MAJOR])])dnl
AC_DEFUN(AC_STAT_MACROS_BROKEN, [indir([AC_HEADER_STAT])])dnl
AC_DEFUN(AC_SYS_SIGLIST_DECLARED, [indir([AC_DECL_SYS_SIGLIST])])dnl
AC_DEFUN(AC_GETGROUPS_T, [indir([AC_TYPE_GETGROUPS])])dnl
AC_DEFUN(AC_UID_T, [indir([AC_TYPE_UID_T])])dnl
AC_DEFUN(AC_SIZE_T, [indir([AC_TYPE_SIZE_T])])dnl
AC_DEFUN(AC_PID_T, [indir([AC_TYPE_PID_T])])dnl
AC_DEFUN(AC_OFF_T, [indir([AC_TYPE_OFF_T])])dnl
AC_DEFUN(AC_MODE_T, [indir([AC_TYPE_MODE_T])])dnl
AC_DEFUN(AC_RETSIGTYPE, [indir([AC_TYPE_SIGNAL])])dnl
AC_DEFUN(AC_MMAP, [indir([AC_FUNC_MMAP])])dnl
AC_DEFUN(AC_VPRINTF, [indir([AC_FUNC_VPRINTF])])dnl
AC_DEFUN(AC_VFORK, [indir([AC_FUNC_VFORK])])dnl
AC_DEFUN(AC_WAIT3, [indir([AC_FUNC_WAIT3])])dnl
AC_DEFUN(AC_ALLOCA, [indir([AC_FUNC_ALLOCA])])dnl
AC_DEFUN(AC_GETLOADAVG, [indir([AC_FUNC_GETLOADAVG])])dnl
AC_DEFUN(AC_UTIME_NULL, [indir([AC_FUNC_UTIME_NULL])])dnl
AC_DEFUN(AC_STRCOLL, [indir([AC_FUNC_STRCOLL])])dnl
AC_DEFUN(AC_SETVBUF_REVERSED, [indir([AC_FUNC_SETVBUF_REVERSED])])dnl
AC_DEFUN(AC_TIME_WITH_SYS_TIME, [indir([AC_HEADER_TIME])])dnl
AC_DEFUN(AC_TIMEZONE, [indir([AC_STRUCT_TIMEZONE])])dnl
AC_DEFUN(AC_ST_BLOCKS, [indir([AC_STRUCT_ST_BLOCKS])])dnl
AC_DEFUN(AC_ST_BLKSIZE, [indir([AC_STRUCT_ST_BLKSIZE])])dnl
AC_DEFUN(AC_ST_RDEV, [indir([AC_STRUCT_ST_RDEV])])dnl
AC_DEFUN(AC_CROSS_CHECK, [indir([AC_C_CROSS])])dnl
AC_DEFUN(AC_CHAR_UNSIGNED, [indir([AC_C_CHAR_UNSIGNED])])dnl
AC_DEFUN(AC_LONG_DOUBLE, [indir([AC_C_LONG_DOUBLE])])dnl
AC_DEFUN(AC_WORDS_BIGENDIAN, [indir([AC_C_BIGENDIAN])])dnl
AC_DEFUN(AC_INLINE, [indir([AC_C_INLINE])])dnl
AC_DEFUN(AC_CONST, [indir([AC_C_CONST])])dnl
AC_DEFUN(AC_LONG_FILE_NAMES, [indir([AC_SYS_LONG_FILE_NAMES])])dnl
AC_DEFUN(AC_RESTARTABLE_SYSCALLS, [indir([AC_SYS_RESTARTABLE_SYSCALLS])])dnl
AC_DEFUN(AC_FIND_X, [indir([AC_PATH_X])])dnl
AC_DEFUN(AC_FIND_XTRA, [indir([AC_PATH_XTRA])])dnl

2758
build/autoconf/acspecific.m4 Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,28 @@
dnl Driver that loads the Autoconf macro files.
dnl Requires GNU m4.
dnl This file is part of Autoconf.
dnl Copyright (C) 1994 Free Software Foundation, Inc.
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2, or (at your option)
dnl any later version.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
dnl 02111-1307, USA.
dnl
dnl Written by David MacKenzie.
dnl
include(acgeneral.m4)dnl
builtin(include, acspecific.m4)dnl
builtin(include, acoldnames.m4)dnl
dnl Do not sinclude acsite.m4 here, because it may not be installed
dnl yet when Autoconf is frozen.
dnl Do not sinclude ./aclocal.m4 here, to prevent it from being frozen.

159
build/autoconf/autoconf.sh Executable file
View file

@ -0,0 +1,159 @@
#! @SHELL@
# autoconf -- create `configure' using m4 macros
# Copyright (C) 1992, 1993, 1994, 1996 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# If given no args, create `configure' from template file `configure.in'.
# With one arg, create a configure script on standard output from
# the given template file.
usage="\
Usage: autoconf [-h] [--help] [-m dir] [--macrodir=dir]
[-l dir] [--localdir=dir] [--version] [template-file]"
# NLS nuisances.
# Only set these to C if already set. These must not be set unconditionally
# because not all systems understand e.g. LANG=C (notably SCO).
# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
# Non-C LC_CTYPE values break the ctype check.
if test "${LANG+set}" = set; then LANG=C; export LANG; fi
if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
: ${AC_MACRODIR=@datadir@}
: ${M4=@M4@}
: ${AWK=@AWK@}
case "${M4}" in
/*) # Handle the case that m4 has moved since we were configured.
# It may have been found originally in a build directory.
test -f "${M4}" || M4=m4 ;;
esac
: ${TMPDIR=/tmp}
tmpout=${TMPDIR}/acout.$$
localdir=
show_version=no
while test $# -gt 0 ; do
case "${1}" in
-h | --help | --h* )
echo "${usage}" 1>&2; exit 0 ;;
--localdir=* | --l*=* )
localdir="`echo \"${1}\" | sed -e 's/^[^=]*=//'`"
shift ;;
-l | --localdir | --l*)
shift
test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; }
localdir="${1}"
shift ;;
--macrodir=* | --m*=* )
AC_MACRODIR="`echo \"${1}\" | sed -e 's/^[^=]*=//'`"
shift ;;
-m | --macrodir | --m* )
shift
test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; }
AC_MACRODIR="${1}"
shift ;;
--version | --v* )
show_version=yes; shift ;;
-- ) # Stop option processing
shift; break ;;
- ) # Use stdin as input.
break ;;
-* )
echo "${usage}" 1>&2; exit 1 ;;
* )
break ;;
esac
done
if test $show_version = yes; then
version=`sed -n 's/define.AC_ACVERSION.[ ]*\([0-9.]*\).*/\1/p' \
$AC_MACRODIR/acgeneral.m4`
echo "Autoconf version $version"
exit 0
fi
case $# in
0) infile=configure.in ;;
1) infile="$1" ;;
*) echo "$usage" >&2; exit 1 ;;
esac
trap 'rm -f $tmpin $tmpout; exit 1' 1 2 15
tmpin=${TMPDIR}/acin.$$ # Always set this, to avoid bogus errors from some rm's.
if test z$infile = z-; then
infile=$tmpin
cat > $infile
elif test ! -r "$infile"; then
echo "autoconf: ${infile}: No such file or directory" >&2
exit 1
fi
if test -n "$localdir"; then
use_localdir="-I$localdir -DAC_LOCALDIR=$localdir"
else
use_localdir=
fi
# Use the frozen version of Autoconf if available.
r= f=
# Some non-GNU m4's don't reject the --help option, so give them /dev/null.
case `$M4 --help < /dev/null 2>&1` in
*reload-state*) test -r $AC_MACRODIR/autoconf.m4f && { r=--reload f=f; } ;;
*traditional*) ;;
*) echo Autoconf requires GNU m4 1.1 or later >&2; rm -f $tmpin; exit 1 ;;
esac
$M4 -I$AC_MACRODIR $use_localdir $r autoconf.m4$f $infile > $tmpout ||
{ rm -f $tmpin $tmpout; exit 2; }
# You could add your own prefixes to pattern if you wanted to check for
# them too, e.g. pattern='\(AC_\|ILT_\)', except that UNIX sed doesn't do
# alternation.
pattern="AC_"
status=0
if grep "^[^#]*${pattern}" $tmpout > /dev/null 2>&1; then
echo "autoconf: Undefined macros:" >&2
sed -n "s/^[^#]*\\(${pattern}[_A-Za-z0-9]*\\).*/\\1/p" $tmpout |
while read macro; do
grep -n "^[^#]*$macro" $infile /dev/null
test $? -eq 1 && echo >&2 "***BUG in Autoconf--please report*** $macro"
done | sort -u >&2
status=1
fi
if test $# -eq 0; then
exec 4> configure; chmod +x configure
else
exec 4>&1
fi
# Put the real line numbers into configure to make config.log more helpful.
$AWK '
/__oline__/ { printf "%d:", NR + 1 }
{ print }
' $tmpout | sed '
/__oline__/s/^\([0-9][0-9]*\):\(.*\)__oline__/\2\1/
' >&4
rm -f $tmpout
exit $status

View file

@ -10,55 +10,9 @@ def encoded_open(path, mode):
return codecs.open(path, mode, encoding)
option(env='AUTOCONF', nargs=1, help='Path to autoconf 2.13')
m4 = check_prog('M4', ('m4',))
@depends(mozconfig, 'AUTOCONF')
@checking('for autoconf')
@imports(_from='os.path', _import='exists')
@imports('re')
def autoconf(mozconfig, autoconf):
mozconfig_autoconf = None
if mozconfig['path']:
make_extra = mozconfig['make_extra']
if make_extra:
for assignment in make_extra:
m = re.match('(?:export\s+)?AUTOCONF\s*:?=\s*(.+)$',
assignment)
if m:
mozconfig_autoconf = m.group(1)
autoconf = autoconf[0] if autoconf else None
for ac in (mozconfig_autoconf, autoconf, 'autoconf-2.13', 'autoconf2.13',
'autoconf213'):
if ac:
autoconf = find_program(ac)
if autoconf:
break
else:
fink = find_program('fink')
if fink:
autoconf = os.path.normpath(os.path.join(
fink, '..', '..', 'lib', 'autoconf2.13', 'bin', 'autoconf'))
else:
brew = find_program('brew')
if brew:
autoconf = os.path.normpath(os.path.join(
brew, '..', '..', 'Cellar', 'autoconf213', '2.13', 'bin',
'autoconf213'))
if not autoconf:
die('Could not find autoconf 2.13')
if not exists(autoconf):
die('Could not find autoconf 2.13 at %s', autoconf)
return autoconf
set_config('AUTOCONF', autoconf)
@depends('OLD_CONFIGURE', mozconfig, autoconf, check_build_environment, shell,
@depends('OLD_CONFIGURE', mozconfig, awk, m4, check_build_environment, shell,
old_configure_assignments, build_project)
@imports(_from='__builtin__', _import='open')
@imports(_from='__builtin__', _import='print')
@ -69,7 +23,8 @@ set_config('AUTOCONF', autoconf)
@imports(_from='os.path', _import='getmtime')
@imports(_from='os.path', _import='exists')
@imports(_from='mozbuild.shellutil', _import='quote')
def prepare_configure(old_configure, mozconfig, autoconf, build_env, shell,
@imports(_from='os', _import='environ')
def prepare_configure(old_configure, mozconfig, awk, m4, build_env, shell,
old_configure_assignments, build_project):
# os.path.abspath in the sandbox will ensure forward slashes on Windows,
# which is actually necessary because this path actually ends up literally
@ -98,11 +53,16 @@ def prepare_configure(old_configure, mozconfig, autoconf, build_env, shell,
refresh = False
if refresh:
autoconf = os.path.join(build_env.topsrcdir, 'build', 'autoconf', 'autoconf.sh')
log.info('Refreshing %s with %s', old_configure, autoconf)
env = dict(environ)
env['M4'] = m4
env['AWK'] = awk
env['AC_MACRODIR'] = os.path.join(build_env.topsrcdir, 'build', 'autoconf')
script = subprocess.check_output([
shell, autoconf,
'--localdir=%s' % os.path.dirname(old_configure),
old_configure + '.in'])
old_configure + '.in'], env=env)
# Make old-configure append to config.log, where we put our own log.
# This could be done with a m4 macro, but it's way easier this way
@ -127,10 +87,6 @@ def prepare_configure(old_configure, mozconfig, autoconf, build_env, shell,
for key in mozconfig[t]['removed'].keys():
inject("unset %s" % key)
# Autoconf is special, because it might be passed from
# mozconfig['make_extra'], which we don't pass automatically above.
inject('export AUTOCONF=%s' % quote(autoconf))
for assignment in old_configure_assignments:
inject(assignment)