form-5.0.1/ 0000755 0001751 0001751 00000000000 15217035744 006233 5 form-5.0.1/scripts/ 0000755 0001751 0001751 00000000000 15217035744 007722 5 form-5.0.1/scripts/run-latex2html.sh 0000755 0001751 0001751 00000002122 15217035721 013057 #!/bin/bash
#
# @file run-latex2html.sh
#
# Usage:
# run-latex2html.sh main.tex
#
set -euo pipefail
if [ $# -ne 1 ]; then
echo "Usage: $(basename "$0") main.tex" >&2
exit 1
fi
MAIN_PATH=$1
MAIN_TEX=$(basename "$MAIN_PATH")
MAIN_DIR=$(dirname "$MAIN_PATH")
case $MAIN_TEX in
*.tex)
MAIN=$(basename "$MAIN_TEX" .tex)
;;
*)
MAIN_PATH=$MAIN_PATH.tex
MAIN=$MAIN_TEX
MAIN_TEX=$MAIN.tex
;;
esac
MAIN_DIR=$MAIN_DIR/$MAIN
if [ -z "${LATEX2HTML+x}" ] || [ -z "$LATEX2HTML" ]; then
LATEX2HTML=latex2html
fi
# https://stackoverflow.com/a/43919044
a="/$0"; a="${a%/*}"; a="${a:-.}"; a="${a##/}/"; BINDIR=$(cd "$a"; pwd)
LATEX2HTML_INIT=$BINDIR/.latex2html-init
"$LATEX2HTML" -init_file "$LATEX2HTML_INIT" "$MAIN_PATH"
fix_html() {
# (1) HREF="main.html#SECTION..." -> HREF="#SECTION..."
# (2) workaround for latex2html < v2025
# See: https://github.com/latex2html/latex2html/commit/b77ee98
sed "s/$2.html#/#/g" "$1" | sed 's/&̈#305;/\ï/g' >"$1.tmp"
mv "$1.tmp" "$1"
}
fix_html "$MAIN_DIR/index.html" "$MAIN"
fix_html "$MAIN_DIR/$MAIN.html" "$MAIN"
form-5.0.1/scripts/.latex2html-init 0000644 0001751 0001751 00000000612 15217035721 012662 $ADDRESS = ''
. 'This document was generated using the '
. "LaTeX2HTML"
. " translator Version $TEX2HTMLVERSION."
. '';
$DO_INCLUDE = 'float'; # https://github.com/vermaseren/form/issues/442
$DVIPSOPT = ' -E';
$INFO = 0;
$MAX_SPLIT_DEPTH = 0;
$NO_FOOTNODE = 1;
$NO_NAVIGATION = 1;
$SHORT_INDEX = 1;
$SHOW_SECTION_NUMBERS = 1;
1;
form-5.0.1/README.md 0000644 0001751 0001751 00000006177 15217035721 007440 FORM
====
[](https://github.com/form-dev/form/actions/workflows/test.yml)
[](https://coveralls.io/github/form-dev/form?branch=master)
FORM is a Symbolic Manipulation System. It reads symbolic expressions from files and executes symbolic/algebraic transformations upon them. The answers are returned in a textual mathematical representation. As its landmark feature, the size of the considered expressions in FORM is only limited by the available disk space and not by the available RAM. FORM has been essential for many state-of-the-art computations in High Energy Physics.
FORM's original author is Jos Vermaseren of NIKHEF, the Dutch institute for subatomic physics. Other people that have made contributions can be found in the file "[AUTHORS](AUTHORS)".
Quick examples
--------------
The following FORM program repeatedly matches the power of a variable `x` in the expression `E`, as long as the power is more than 1 and creates two new terms with lower power:
```form
Symbol x,n;
Local E = x^10;
repeat id x^n?{>1} = x^(n-1) + x^(n-2);
Print;
.end
```
and yields `E = 34 + 55*x`.
The following FORM program matches the function `f` that has any arguments before encountering an `x` and any arguments after, and switches them around:
```form
CFunction f;
Symbol x;
Local E = f(1,2,x,3,4);
id f(?a,x,?b) = f(?b,?a);
Print;
.end
```
and yields `E = f(3,4,1,2)`.
FORM can match many more complicated patterns and has many more features, as documented in the [additional information](#additional-information).
Build instructions
------------
Before building FORM, it is advised to install the optional dependencies `gmp`, `mpfr`, `zstd`, `zlib` and `flint` for better performance. To use arbitrary-precision floating-point arithmetic, both `gmp` and `mpfr` are required; if either is unavailable it will not be enabled. To quickly build FORM, install the `autoconf` and `automake` packages. Then, after cloning the repository, run:
```sh
autoreconf -i
./configure
make
make install
```
For more advanced build options, see the file "[INSTALL](INSTALL)".
Additional information
----------------------
The latest release notes are available on the [Wiki](https://github.com/form-dev/form/wiki/Release-Notes-FORM-5.0.0); the latest reference manual can be found [here](https://form-dev.github.io/form-docs/stable/manual/), and the Form Cookbook can be found [here](https://github.com/form-dev/form/wiki/FORM-Cookbook).
More background information, a collection of FORM programs, and a number of courses can be found on the official [FORM website](http://www.nikhef.nl/~form) and on the [Wiki](https://github.com/form-dev/form/wiki).
Information about copying and licensing of this software can be found in the file "[COPYING](COPYING)".
Bugs and remarks
----------------
For reporting bugs, asking questions, giving remarks and suggestions, we welcome you to use the [Issue Tracker](https://github.com/form-dev/form/issues) or [Discussion Forum](https://github.com/form-dev/form/discussions).
form-5.0.1/m4/ 0000755 0001751 0001751 00000000000 15217035744 006553 5 form-5.0.1/m4/ax_check_compile_flag.m4 0000644 0001751 0001751 00000006411 15217035721 013200 # ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
#
# DESCRIPTION
#
# Check whether the given FLAG works with the current language's compiler
# or gives an error. (Warnings, however, are ignored)
#
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
# success/failure.
#
# If EXTRA-FLAGS is defined, it is added to the current language's default
# flags (e.g. CFLAGS) when the check is done. The check is thus made with
# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
# force the compiler to issue an error when a bad flag is given.
#
# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
#
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
#
# LICENSE
#
# Copyright (c) 2008 Guido U. Draheim
# Copyright (c) 2011 Maarten Bosmans
#
# 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 3 of the License, 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, see .
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 3
AC_DEFUN([AX_CHECK_COMPILE_FLAG],
[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX
AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
[AS_VAR_SET(CACHEVAR,[yes])],
[AS_VAR_SET(CACHEVAR,[no])])
_AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes],
[m4_default([$2], :)],
[m4_default([$3], :)])
AS_VAR_POPDEF([CACHEVAR])dnl
])dnl AX_CHECK_COMPILE_FLAGS
form-5.0.1/.version 0000644 0001751 0001751 00000000006 15217035744 007635 5.0.1
form-5.0.1/configure 0000755 0001751 0001751 00001117613 15217035732 010071 #! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.71 for FORM 5.0.1.
#
# Report bugs to .
#
#
# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation,
# Inc.
#
#
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
## -------------------- ##
## M4sh Initialization. ##
## -------------------- ##
# Be more Bourne compatible
DUALCASE=1; export DUALCASE # for MKS sh
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 $as_nop
case `(set -o) 2>/dev/null` in #(
*posix*) :
set -o posix ;; #(
*) :
;;
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
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 ${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 ||
PATH_SEPARATOR=';'
}
fi
# Find who we are. Look in the path if we contain no directory separator.
as_myself=
case $0 in #((
*[\\/]* ) as_myself=$0 ;;
*) 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
test -r "$as_dir$0" && as_myself=$as_dir$0 && break
done
IFS=$as_save_IFS
;;
esac
# We did not find ourselves, most probably we were run as `sh COMMAND'
# in which case we are not to be found in the path.
if test "x$as_myself" = x; then
as_myself=$0
fi
if test ! -f "$as_myself"; then
printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
exit 1
fi
# Use a proper internal environment variable to ensure we don't fall
# into an infinite loop, continuously re-executing ourselves.
if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
_as_can_reexec=no; export _as_can_reexec;
# We cannot yet assume a decent shell, so we have to provide a
# neutralization value for shells without unset; and this also
# works around shells that cannot unset nonexistent variables.
# Preserve -v and -x to the replacement shell.
BASH_ENV=/dev/null
ENV=/dev/null
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
case $- in # ((((
*v*x* | *x*v* ) as_opts=-vx ;;
*v* ) as_opts=-v ;;
*x* ) as_opts=-x ;;
* ) as_opts= ;;
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'.
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="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 \$as_nop
case \`(set -o) 2>/dev/null\` in #(
*posix*) :
set -o posix ;; #(
*) :
;;
esac
fi
"
as_required="as_fn_return () { (exit \$1); }
as_fn_success () { as_fn_return 0; }
as_fn_failure () { as_fn_return 1; }
as_fn_ret_success () { return 0; }
as_fn_ret_failure () { return 1; }
exitcode=0
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 :
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 :
as_have_required=yes
else $as_nop
as_have_required=no
fi
if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null
then :
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
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
if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
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_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null
then :
break 2
fi
fi
done;;
esac
as_found=false
done
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 :
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
# works around shells that cannot unset nonexistent variables.
# Preserve -v and -x to the replacement shell.
BASH_ENV=/dev/null
ENV=/dev/null
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
case $- in # ((((
*v*x* | *x*v* ) as_opts=-vx ;;
*v* ) as_opts=-v ;;
*x* ) as_opts=-x ;;
* ) as_opts= ;;
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'.
printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2
exit 255
fi
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
printf "%s\n" "$0: Please tell bug-autoconf@gnu.org and
$0: https://github.com/form-dev/form/issues about your
$0: system, including any error possibly output before this
$0: message. Then install a modern shell, or manually run
$0: the script under such a shell if you do have one."
fi
exit 1
fi
fi
fi
SHELL=${CONFIG_SHELL-/bin/sh}
export SHELL
# Unset more variables known to interfere with behavior of common tools.
CLICOLOR_FORCE= GREP_OPTIONS=
unset CLICOLOR_FORCE GREP_OPTIONS
## --------------------- ##
## M4sh Shell Functions. ##
## --------------------- ##
# as_fn_unset VAR
# ---------------
# Portably unset VAR.
as_fn_unset ()
{
{ eval $1=; unset $1;}
}
as_unset=as_fn_unset
# as_fn_set_status STATUS
# -----------------------
# Set $? to STATUS, without forking.
as_fn_set_status ()
{
return $1
} # as_fn_set_status
# as_fn_exit STATUS
# -----------------
# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
as_fn_exit ()
{
set +e
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
# -------------
# Create "$as_dir" as a directory, including parents if necessary.
as_fn_mkdir_p ()
{
case $as_dir in #(
-*) as_dir=./$as_dir;;
esac
test -d "$as_dir" || eval $as_mkdir_p || {
as_dirs=
while :; do
case $as_dir in #(
*\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
*) as_qdir=$as_dir;;
esac
as_dirs="'$as_qdir' $as_dirs"
as_dir=`$as_dirname -- "$as_dir" ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
printf "%s\n" X"$as_dir" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
test -d "$as_dir" && break
done
test -z "$as_dirs" || eval "mkdir $as_dirs"
} || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
} # as_fn_mkdir_p
# as_fn_executable_p FILE
# -----------------------
# Test if FILE is an executable regular file.
as_fn_executable_p ()
{
test -f "$1" && test -x "$1"
} # as_fn_executable_p
# 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 :
eval 'as_fn_append ()
{
eval $1+=\$2
}'
else $as_nop
as_fn_append ()
{
eval $1=\$$1\$2
}
fi # as_fn_append
# as_fn_arith ARG...
# ------------------
# 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 :
eval 'as_fn_arith ()
{
as_val=$(( $* ))
}'
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]
# ----------------------------------------
# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
# script with STATUS, using 1 if that was 0.
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
printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
fi
printf "%s\n" "$as_me: error: $2" >&2
as_fn_exit $as_status
} # as_fn_error
if expr a : '\(a\)' >/dev/null 2>&1 &&
test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
fi
if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
as_dirname=dirname
else
as_dirname=false
fi
as_me=`$as_basename -- "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)' \| . 2>/dev/null ||
printf "%s\n" X/"$0" |
sed '/^.*\/\([^/][^/]*\)\/*$/{
s//\1/
q
}
/^X\/\(\/\/\)$/{
s//\1/
q
}
/^X\/\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits
as_lineno_1=$LINENO as_lineno_1a=$LINENO
as_lineno_2=$LINENO 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'"' || {
# Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
sed -n '
p
/[$]LINENO/=
' <$as_myself |
sed '
s/[$]LINENO.*/&-/
t lineno
b
:lineno
N
:loop
s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
t loop
s/-\n.*//
' >$as_me.lineno &&
chmod +x "$as_me.lineno" ||
{ 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
# in an infinite loop. This has already happened in practice.
_as_can_reexec=no; export _as_can_reexec
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
# original and so on. Autoconf is especially sensitive to this).
. "./$as_me.lineno"
# Exit status is that of the last command.
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*)
case `echo 'xy\c'` in
*c*) ECHO_T=' ';; # ECHO_T is single tab character.
xy) ECHO_C='\c';;
*) echo `echo ksh88 bug on AIX 6.1` > /dev/null
ECHO_T=' ';;
esac;;
*)
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
else
rm -f conf$$.dir
mkdir conf$$.dir 2>/dev/null
fi
if (echo >conf$$.file) 2>/dev/null; then
if ln -s conf$$.file conf$$ 2>/dev/null; then
as_ln_s='ln -s'
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
# In both cases, we have to default to `cp -pR'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
as_ln_s='cp -pR'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -pR'
fi
else
as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
if mkdir -p . 2>/dev/null; then
as_mkdir_p='mkdir -p "$as_dir"'
else
test -d ./-p && rmdir ./-p
as_mkdir_p=false
fi
as_test_x='test -x'
as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
# Sed expression to map a string onto a valid variable name.
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
test -n "$DJDIR" || exec 7<&0 &1
# Name of the host.
# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
# so uname gets run too.
ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
#
# Initializations.
#
ac_default_prefix=/usr/local
ac_clean_files=
ac_config_libobj_dir=.
LIBOBJS=
cross_compiling=no
subdirs=
MFLAGS=
MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='FORM'
PACKAGE_TARNAME='form'
PACKAGE_VERSION='5.0.1'
PACKAGE_STRING='FORM 5.0.1'
PACKAGE_BUGREPORT='https://github.com/form-dev/form/issues'
PACKAGE_URL=''
ac_unique_file="sources/form3.h"
# Factoring default headers for most tests.
ac_includes_default="\
#include
#ifdef HAVE_STDIO_H
# include
#endif
#ifdef HAVE_STDLIB_H
# include
#endif
#ifdef HAVE_STRING_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_subst_vars='am__EXEEXT_FALSE
am__EXEEXT_TRUE
LTLIBOBJS
LIBOBJS
CONFIG_RUBY_FALSE
CONFIG_RUBY_TRUE
RUBY
CONFIG_LATEX2HTML_FALSE
CONFIG_LATEX2HTML_TRUE
CONFIG_HTLATEX_FALSE
CONFIG_HTLATEX_TRUE
CONFIG_MAKEINDEX_FALSE
CONFIG_MAKEINDEX_TRUE
CONFIG_PDF_FALSE
CONFIG_PDF_TRUE
CONFIG_PS_FALSE
CONFIG_PS_TRUE
CONFIG_TEX_FALSE
CONFIG_TEX_TRUE
LATEX2HTML
HTLATEX
MAKEINDEX
DVIPS
PDFLATEX
LATEX
CONFIG_DOXYGEN_FALSE
CONFIG_DOXYGEN_TRUE
DOXYGEN
DEBUGTOOL_LIBS
TOOL_LIBS
DEBUGLINKFLAGS
DEBUGCOMPILEFLAGS
LINKFLAGS
COMPILEFLAGS
MPI_STATIC_LDFLAGS
STATIC_LDFLAGS
WITHFLOAT_FALSE
WITHFLOAT_TRUE
BUILD_PARVORM_FALSE
BUILD_PARVORM_TRUE
BUILD_PARFORM_FALSE
BUILD_PARFORM_TRUE
MPI_CPPFLAGS
MPI_CXXFLAGS
MPI_CFLAGS
MPICXX
MPICC
BUILD_TVORM_FALSE
BUILD_TVORM_TRUE
BUILD_TFORM_FALSE
BUILD_TFORM_TRUE
PTHREAD_LIBS
PTHREAD_CPPFLAGS
PTHREAD_CFLAGS
BUILD_VORM_FALSE
BUILD_VORM_TRUE
BUILD_FORM_FALSE
BUILD_FORM_TRUE
WITHFLINT_FALSE
WITHFLINT_TRUE
CPP
GIT
WITHZSTD_FALSE
WITHZSTD_TRUE
ONWINDOWS_FALSE
ONWINDOWS_TRUE
ONUNIX_FALSE
ONUNIX_TRUE
EGREP
GREP
host_os
host_vendor
host_cpu
host
build_os
build_vendor
build_cpu
build
LN_S
am__fastdepCXX_FALSE
am__fastdepCXX_TRUE
CXXDEPMODE
ac_ct_CXX
CXXFLAGS
CXX
am__fastdepCC_FALSE
am__fastdepCC_TRUE
CCDEPMODE
am__nodep
AMDEPBACKSLASH
AMDEP_FALSE
AMDEP_TRUE
am__include
DEPDIR
OBJEXT
EXEEXT
ac_ct_CC
CPPFLAGS
LDFLAGS
CFLAGS
CC
FIXED_VERSION_FALSE
FIXED_VERSION_TRUE
AM_BACKSLASH
AM_DEFAULT_VERBOSITY
AM_DEFAULT_V
AM_V
CSCOPE
ETAGS
CTAGS
am__untar
am__tar
AMTAR
am__leading_dot
SET_MAKE
AWK
mkdir_p
MKDIR_P
INSTALL_STRIP_PROGRAM
STRIP
install_sh
MAKEINFO
AUTOHEADER
AUTOMAKE
AUTOCONF
ACLOCAL
VERSION
PACKAGE
CYGPATH_W
am__isrc
INSTALL_DATA
INSTALL_SCRIPT
INSTALL_PROGRAM
target_alias
host_alias
build_alias
LIBS
ECHO_T
ECHO_N
ECHO_C
DEFS
mandir
localedir
libdir
psdir
pdfdir
dvidir
htmldir
infodir
docdir
oldincludedir
includedir
runstatedir
localstatedir
sharedstatedir
sysconfdir
datadir
datarootdir
libexecdir
sbindir
bindir
program_transform_name
prefix
exec_prefix
PACKAGE_URL
PACKAGE_BUGREPORT
PACKAGE_STRING
PACKAGE_VERSION
PACKAGE_TARNAME
PACKAGE_NAME
PATH_SEPARATOR
SHELL
am__quote'
ac_subst_files=''
ac_user_opts='
enable_option_checking
enable_silent_rules
enable_dependency_tracking
with_cxxstd
enable_largefile
with_api
with_gmp
with_mpfr
with_zlib
with_zstd
with_flint
enable_scalar
enable_threaded
enable_parform
enable_debug
enable_float
enable_static_link
enable_native
enable_profile
enable_coverage
enable_sanitize
enable_extra_warning
enable_backtrace
'
ac_precious_vars='build_alias
host_alias
target_alias
CC
CFLAGS
LDFLAGS
LIBS
CPPFLAGS
CXX
CXXFLAGS
CCC
CPP
MPICC
MPICXX
COMPILEFLAGS
LINKFLAGS
DEBUGCOMPILEFLAGS
DEBUGLINKFLAGS'
# Initialize some variables set by options.
ac_init_help=
ac_init_version=false
ac_unrecognized_opts=
ac_unrecognized_sep=
# The variables have the same names as the options, with
# dashes changed to underlines.
cache_file=/dev/null
exec_prefix=NONE
no_create=
no_recursion=
prefix=NONE
program_prefix=NONE
program_suffix=NONE
program_transform_name=s,x,x,
silent=
site=
srcdir=
verbose=
x_includes=NONE
x_libraries=NONE
# Installation directory options.
# These are left unexpanded so users can "make install exec_prefix=/foo"
# and all the variables that are supposed to be based on exec_prefix
# by default will actually change.
# Use braces instead of parens because sh, perl, etc. also accept them.
# (The list follows the same order as the GNU Coding Standards.)
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
datarootdir='${prefix}/share'
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}'
infodir='${datarootdir}/info'
htmldir='${docdir}'
dvidir='${docdir}'
pdfdir='${docdir}'
psdir='${docdir}'
libdir='${exec_prefix}/lib'
localedir='${datarootdir}/locale'
mandir='${datarootdir}/man'
ac_prev=
ac_dashdash=
for ac_option
do
# If the previous option needs an argument, assign it.
if test -n "$ac_prev"; then
eval $ac_prev=\$ac_option
ac_prev=
continue
fi
case $ac_option in
*=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
*=) ac_optarg= ;;
*) ac_optarg=yes ;;
esac
case $ac_dashdash$ac_option in
--)
ac_dashdash=yes ;;
-bindir | --bindir | --bindi | --bind | --bin | --bi)
ac_prev=bindir ;;
-bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
bindir=$ac_optarg ;;
-build | --build | --buil | --bui | --bu)
ac_prev=build_alias ;;
-build=* | --build=* | --buil=* | --bui=* | --bu=*)
build_alias=$ac_optarg ;;
-cache-file | --cache-file | --cache-fil | --cache-fi \
| --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
ac_prev=cache_file ;;
-cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
| --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
cache_file=$ac_optarg ;;
--config-cache | -C)
cache_file=config.cache ;;
-datadir | --datadir | --datadi | --datad)
ac_prev=datadir ;;
-datadir=* | --datadir=* | --datadi=* | --datad=*)
datadir=$ac_optarg ;;
-datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
| --dataroo | --dataro | --datar)
ac_prev=datarootdir ;;
-datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
| --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
datarootdir=$ac_optarg ;;
-disable-* | --disable-*)
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'"
ac_useropt_orig=$ac_useropt
ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
*"
"enable_$ac_useropt"
"*) ;;
*) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
ac_unrecognized_sep=', ';;
esac
eval enable_$ac_useropt=no ;;
-docdir | --docdir | --docdi | --doc | --do)
ac_prev=docdir ;;
-docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
docdir=$ac_optarg ;;
-dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
ac_prev=dvidir ;;
-dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
dvidir=$ac_optarg ;;
-enable-* | --enable-*)
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'"
ac_useropt_orig=$ac_useropt
ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
*"
"enable_$ac_useropt"
"*) ;;
*) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
ac_unrecognized_sep=', ';;
esac
eval enable_$ac_useropt=\$ac_optarg ;;
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
| --exec | --exe | --ex)
ac_prev=exec_prefix ;;
-exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
| --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
| --exec=* | --exe=* | --ex=*)
exec_prefix=$ac_optarg ;;
-gas | --gas | --ga | --g)
# Obsolete; use --with-gas.
with_gas=yes ;;
-help | --help | --hel | --he | -h)
ac_init_help=long ;;
-help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
ac_init_help=recursive ;;
-help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
ac_init_help=short ;;
-host | --host | --hos | --ho)
ac_prev=host_alias ;;
-host=* | --host=* | --hos=* | --ho=*)
host_alias=$ac_optarg ;;
-htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
ac_prev=htmldir ;;
-htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
| --ht=*)
htmldir=$ac_optarg ;;
-includedir | --includedir | --includedi | --included | --include \
| --includ | --inclu | --incl | --inc)
ac_prev=includedir ;;
-includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
| --includ=* | --inclu=* | --incl=* | --inc=*)
includedir=$ac_optarg ;;
-infodir | --infodir | --infodi | --infod | --info | --inf)
ac_prev=infodir ;;
-infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
infodir=$ac_optarg ;;
-libdir | --libdir | --libdi | --libd)
ac_prev=libdir ;;
-libdir=* | --libdir=* | --libdi=* | --libd=*)
libdir=$ac_optarg ;;
-libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
| --libexe | --libex | --libe)
ac_prev=libexecdir ;;
-libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
| --libexe=* | --libex=* | --libe=*)
libexecdir=$ac_optarg ;;
-localedir | --localedir | --localedi | --localed | --locale)
ac_prev=localedir ;;
-localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
localedir=$ac_optarg ;;
-localstatedir | --localstatedir | --localstatedi | --localstated \
| --localstate | --localstat | --localsta | --localst | --locals)
ac_prev=localstatedir ;;
-localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
| --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
localstatedir=$ac_optarg ;;
-mandir | --mandir | --mandi | --mand | --man | --ma | --m)
ac_prev=mandir ;;
-mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
mandir=$ac_optarg ;;
-nfp | --nfp | --nf)
# Obsolete; use --without-fp.
with_fp=no ;;
-no-create | --no-create | --no-creat | --no-crea | --no-cre \
| --no-cr | --no-c | -n)
no_create=yes ;;
-no-recursion | --no-recursion | --no-recursio | --no-recursi \
| --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
no_recursion=yes ;;
-oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
| --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
| --oldin | --oldi | --old | --ol | --o)
ac_prev=oldincludedir ;;
-oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
| --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
| --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
oldincludedir=$ac_optarg ;;
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
ac_prev=prefix ;;
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
prefix=$ac_optarg ;;
-program-prefix | --program-prefix | --program-prefi | --program-pref \
| --program-pre | --program-pr | --program-p)
ac_prev=program_prefix ;;
-program-prefix=* | --program-prefix=* | --program-prefi=* \
| --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
program_prefix=$ac_optarg ;;
-program-suffix | --program-suffix | --program-suffi | --program-suff \
| --program-suf | --program-su | --program-s)
ac_prev=program_suffix ;;
-program-suffix=* | --program-suffix=* | --program-suffi=* \
| --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
program_suffix=$ac_optarg ;;
-program-transform-name | --program-transform-name \
| --program-transform-nam | --program-transform-na \
| --program-transform-n | --program-transform- \
| --program-transform | --program-transfor \
| --program-transfo | --program-transf \
| --program-trans | --program-tran \
| --progr-tra | --program-tr | --program-t)
ac_prev=program_transform_name ;;
-program-transform-name=* | --program-transform-name=* \
| --program-transform-nam=* | --program-transform-na=* \
| --program-transform-n=* | --program-transform-=* \
| --program-transform=* | --program-transfor=* \
| --program-transfo=* | --program-transf=* \
| --program-trans=* | --program-tran=* \
| --progr-tra=* | --program-tr=* | --program-t=*)
program_transform_name=$ac_optarg ;;
-pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
ac_prev=pdfdir ;;
-pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
pdfdir=$ac_optarg ;;
-psdir | --psdir | --psdi | --psd | --ps)
ac_prev=psdir ;;
-psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
psdir=$ac_optarg ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -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=* \
| --sbi=* | --sb=*)
sbindir=$ac_optarg ;;
-sharedstatedir | --sharedstatedir | --sharedstatedi \
| --sharedstated | --sharedstate | --sharedstat | --sharedsta \
| --sharedst | --shareds | --shared | --share | --shar \
| --sha | --sh)
ac_prev=sharedstatedir ;;
-sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
| --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
| --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
| --sha=* | --sh=*)
sharedstatedir=$ac_optarg ;;
-site | --site | --sit)
ac_prev=site ;;
-site=* | --site=* | --sit=*)
site=$ac_optarg ;;
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
ac_prev=srcdir ;;
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
srcdir=$ac_optarg ;;
-sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
| --syscon | --sysco | --sysc | --sys | --sy)
ac_prev=sysconfdir ;;
-sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
| --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
sysconfdir=$ac_optarg ;;
-target | --target | --targe | --targ | --tar | --ta | --t)
ac_prev=target_alias ;;
-target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
target_alias=$ac_optarg ;;
-v | -verbose | --verbose | --verbos | --verbo | --verb)
verbose=yes ;;
-version | --version | --versio | --versi | --vers | -V)
ac_init_version=: ;;
-with-* | --with-*)
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'"
ac_useropt_orig=$ac_useropt
ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
*"
"with_$ac_useropt"
"*) ;;
*) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
ac_unrecognized_sep=', ';;
esac
eval with_$ac_useropt=\$ac_optarg ;;
-without-* | --without-*)
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'"
ac_useropt_orig=$ac_useropt
ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
*"
"with_$ac_useropt"
"*) ;;
*) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
ac_unrecognized_sep=', ';;
esac
eval with_$ac_useropt=no ;;
--x)
# Obsolete; use --with-x.
with_x=yes ;;
-x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
| --x-incl | --x-inc | --x-in | --x-i)
ac_prev=x_includes ;;
-x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
| --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
x_includes=$ac_optarg ;;
-x-libraries | --x-libraries | --x-librarie | --x-librari \
| --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
ac_prev=x_libraries ;;
-x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
| --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
x_libraries=$ac_optarg ;;
-*) as_fn_error $? "unrecognized option: \`$ac_option'
Try \`$0 --help' for more information"
;;
*=*)
ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
# Reject names that are not valid shell variable names.
case $ac_envvar in #(
'' | [0-9]* | *[!_$as_cr_alnum]* )
as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
esac
eval $ac_envvar=\$ac_optarg
export $ac_envvar ;;
*)
# FIXME: should be removed in autoconf 3.0.
printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2
expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2
: "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
;;
esac
done
if test -n "$ac_prev"; then
ac_option=--`echo $ac_prev | sed 's/_/-/g'`
as_fn_error $? "missing argument to $ac_option"
fi
if test -n "$ac_unrecognized_opts"; then
case $enable_option_checking in
no) ;;
fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
*) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
esac
fi
# Check all directory arguments for consistency.
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 runstatedir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
case $ac_val in
*/ )
ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
eval $ac_var=\$ac_val;;
esac
# Be sure to have absolute directory names.
case $ac_val in
[\\/$]* | ?:[\\/]* ) continue;;
NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
esac
as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
done
# There might be people who depend on the old broken behavior: `$host'
# used to hold the argument of --host etc.
# FIXME: To remove some day.
build=$build_alias
host=$host_alias
target=$target_alias
# FIXME: To remove some day.
if test "x$host_alias" != x; then
if test "x$build_alias" = x; then
cross_compiling=maybe
elif test "x$build_alias" != "x$host_alias"; then
cross_compiling=yes
fi
fi
ac_tool_prefix=
test -n "$host_alias" && ac_tool_prefix=$host_alias-
test "$silent" = yes && exec 6>/dev/null
ac_pwd=`pwd` && test -n "$ac_pwd" &&
ac_ls_di=`ls -di .` &&
ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
as_fn_error $? "working directory cannot be determined"
test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
as_fn_error $? "pwd does not report name of working directory"
# Find the source files, if location was not specified.
if test -z "$srcdir"; then
ac_srcdir_defaulted=yes
# Try the directory containing this script, then the parent directory.
ac_confdir=`$as_dirname -- "$as_myself" ||
$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_myself" : 'X\(//\)[^/]' \| \
X"$as_myself" : 'X\(//\)$' \| \
X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
printf "%s\n" X"$as_myself" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
srcdir=$ac_confdir
if test ! -r "$srcdir/$ac_unique_file"; then
srcdir=..
fi
else
ac_srcdir_defaulted=no
fi
if test ! -r "$srcdir/$ac_unique_file"; then
test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
fi
ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
ac_abs_confdir=`(
cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
pwd)`
# When building in place, set srcdir=.
if test "$ac_abs_confdir" = "$ac_pwd"; then
srcdir=.
fi
# Remove unnecessary trailing slashes from srcdir.
# Double slashes in file names in object file debugging info
# mess up M-x gdb in Emacs.
case $srcdir in
*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
esac
for ac_var in $ac_precious_vars; do
eval ac_env_${ac_var}_set=\${${ac_var}+set}
eval ac_env_${ac_var}_value=\$${ac_var}
eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
eval ac_cv_env_${ac_var}_value=\$${ac_var}
done
#
# Report the --help message.
#
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 FORM 5.0.1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables.
Defaults for the options are specified in brackets.
Configuration:
-h, --help display this help and exit
--help=short display options specific to this package
--help=recursive display the short help of all the included packages
-V, --version display version information and exit
-q, --quiet, --silent do not print \`checking ...' messages
--cache-file=FILE cache test results in FILE [disabled]
-C, --config-cache alias for \`--cache-file=config.cache'
-n, --no-create do not create output files
--srcdir=DIR find the sources in DIR [configure dir or \`..']
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
[$ac_default_prefix]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]
By default, \`make install' will install all the files in
\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
an installation prefix other than \`$ac_default_prefix' using \`--prefix',
for instance \`--prefix=\$HOME'.
For better control, use the options below.
Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--libexecdir=DIR program executables [EPREFIX/libexec]
--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]
--datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
--datadir=DIR read-only architecture-independent data [DATAROOTDIR]
--infodir=DIR info documentation [DATAROOTDIR/info]
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
--mandir=DIR man documentation [DATAROOTDIR/man]
--docdir=DIR documentation root [DATAROOTDIR/doc/form]
--htmldir=DIR html documentation [DOCDIR]
--dvidir=DIR dvi documentation [DOCDIR]
--pdfdir=DIR pdf documentation [DOCDIR]
--psdir=DIR ps documentation [DOCDIR]
_ACEOF
cat <<\_ACEOF
Program names:
--program-prefix=PREFIX prepend PREFIX to installed program names
--program-suffix=SUFFIX append SUFFIX to installed program names
--program-transform-name=PROGRAM run sed PROGRAM on installed program names
System types:
--build=BUILD configure for building on BUILD [guessed]
--host=HOST cross-compile to build programs to run on HOST [BUILD]
_ACEOF
fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of FORM 5.0.1:";;
esac
cat <<\_ACEOF
Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-silent-rules less verbose build output (undo: "make V=1")
--disable-silent-rules verbose build output (undo: "make V=0")
--enable-dependency-tracking
do not reject slow dependency extractors
--disable-dependency-tracking
speeds up one-time build
--disable-largefile omit support for large files
--enable-scalar build scalar version (form) [default=yes]
--enable-threaded build multi-threaded version (tform) [default=check]
--enable-parform build parallel version using MPI (parform)
[default=no]
--enable-debug build debugging versions (vorm/tvorm/parvorm)
[default=no]
--enable-float build with the float feature [default=yes]
--enable-static-link link with static libraries (release versions)
[default=no]
--enable-native tune for the compiling machine (release versions)
[default=no]
--enable-profile[=PROFILER]
build with profiling (release versions) [default=no]
PROFILER: gprof (default) or gperftools
--enable-coverage generate coverage files (debugging versions)
[default=no]
--enable-sanitize[=CHECKS]
enable sanitizers (debugging versions) [default=no]
Optionally CHECKS will be passed via the compiler
sanitizer option
--enable-extra-warning enable extra compiler warnings [default=no]
--enable-backtrace print a stack trace on Terminate [default=no]
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-cxxstd=STANDARD specify the C++ standard [default=check]
--with-api=API use POSIX (posix) or Windows (windows) API
[default=posix]
--with-gmp[=DIR] use GMP for long integer arithmetic (installed in
prefix DIR) [default=check]
--with-mpfr[=DIR] use MPFR for long float arithmetic (installed in
prefix DIR) [default=check]
--with-zlib[=DIR] use zlib for compression (installed in prefix DIR)
[default=check]
--with-zstd[=DIR] use zstd for compression (installed in prefix DIR)
[default=check]
--with-flint[=DIR] use flint for polynomial arithmetic (installed in
prefix DIR) [default=check]
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L if you have libraries in a
nonstandard directory
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
CXX C++ compiler command
CXXFLAGS C++ compiler flags
CPP C preprocessor
MPICC C compiler with MPI support
MPICXX C++ compiler with MPI support
COMPILEFLAGS
Compiler flags for release versions
LINKFLAGS Linker flags for release versions
DEBUGCOMPILEFLAGS
Compiler flags for debugging versions
DEBUGLINKFLAGS
Linker flags for debugging versions
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
Report bugs to .
_ACEOF
ac_status=$?
fi
if test "$ac_init_help" = "recursive"; then
# If there are subdirs, report their specific --help.
for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
test -d "$ac_dir" ||
{ cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
continue
ac_builddir=.
case "$ac_dir" in
.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
*)
ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'`
# A ".." for each directory in $ac_dir_suffix.
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/ ;;
esac ;;
esac
ac_abs_top_builddir=$ac_pwd
ac_abs_builddir=$ac_pwd$ac_dir_suffix
# for backward compatibility:
ac_top_builddir=$ac_top_build_prefix
case $srcdir in
.) # We are building in place.
ac_srcdir=.
ac_top_srcdir=$ac_top_builddir_sub
ac_abs_top_srcdir=$ac_pwd ;;
[\\/]* | ?:[\\/]* ) # Absolute name.
ac_srcdir=$srcdir$ac_dir_suffix;
ac_top_srcdir=$srcdir
ac_abs_top_srcdir=$srcdir ;;
*) # Relative name.
ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
ac_top_srcdir=$ac_top_build_prefix$srcdir
ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
esac
ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
cd "$ac_dir" || { ac_status=$?; continue; }
# 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
elif test -f "$ac_srcdir/configure"; then
echo &&
$SHELL "$ac_srcdir/configure" --help=recursive
else
printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2
fi || ac_status=$?
cd "$ac_pwd" || { ac_status=$?; break; }
done
fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
FORM configure 5.0.1
generated by GNU Autoconf 2.71
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
exit
fi
## ------------------------ ##
## Autoconf initialization. ##
## ------------------------ ##
# ac_fn_c_try_compile LINENO
# --------------------------
# Try to compile conftest.$ac_ext, and return whether this succeeded.
ac_fn_c_try_compile ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
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\""
printf "%s\n" "$ac_try_echo"; } >&5
(eval "$ac_compile") 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
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 :
ac_retval=0
else $as_nop
printf "%s\n" "$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_compile
# ac_fn_cxx_try_compile LINENO
# ----------------------------
# Try to compile conftest.$ac_ext, and return whether this succeeded.
ac_fn_cxx_try_compile ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
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\""
printf "%s\n" "$ac_try_echo"; } >&5
(eval "$ac_compile") 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
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } && {
test -z "$ac_cxx_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext
then :
ac_retval=0
else $as_nop
printf "%s\n" "$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_cxx_try_compile
# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
# -------------------------------------------------------
# Tests whether HEADER exists and can be compiled using the include files in
# INCLUDES, setting the cache variable VAR accordingly.
ac_fn_c_check_header_compile ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ 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 :
eval "$3=yes"
else $as_nop
eval "$3=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
eval ac_res=\$$3
{ 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
# ac_fn_cxx_check_header_compile LINENO HEADER VAR INCLUDES
# ---------------------------------------------------------
# Tests whether HEADER exists and can be compiled using the include files in
# INCLUDES, setting the cache variable VAR accordingly.
ac_fn_cxx_check_header_compile ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ 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_cxx_try_compile "$LINENO"
then :
eval "$3=yes"
else $as_nop
eval "$3=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
eval ac_res=\$$3
{ 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_cxx_check_header_compile
# ac_fn_c_try_link LINENO
# -----------------------
# Try to link conftest.$ac_ext, and return whether this succeeded.
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.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\""
printf "%s\n" "$ac_try_echo"; } >&5
(eval "$ac_link") 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
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 :
ac_retval=0
else $as_nop
printf "%s\n" "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
# Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
# created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
# interfere with the next link command; also delete a directory that is
# left behind by Apple's compiler. We do this before executing the actions.
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_link
# 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\""
printf "%s\n" "$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
printf "%s\n" "$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_nop
printf "%s\n" "$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_cxx_try_link LINENO
# -------------------------
# Try to link conftest.$ac_ext, and return whether this succeeded.
ac_fn_cxx_try_link ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
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\""
printf "%s\n" "$ac_try_echo"; } >&5
(eval "$ac_link") 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
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } && {
test -z "$ac_cxx_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
test -x conftest$ac_exeext
}
then :
ac_retval=0
else $as_nop
printf "%s\n" "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
# Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
# created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
# interfere with the next link command; also delete a directory that is
# left behind by Apple's compiler. We do this before executing the actions.
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_cxx_try_link
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
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
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 FORM $as_me 5.0.1, which was
generated by GNU Autoconf 2.71. Invocation command line was
$ $0$ac_configure_args_raw
_ACEOF
exec 5>>config.log
{
cat <<_ASUNAME
## --------- ##
## Platform. ##
## --------- ##
hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
uname -m = `(uname -m) 2>/dev/null || echo unknown`
uname -r = `(uname -r) 2>/dev/null || echo unknown`
uname -s = `(uname -s) 2>/dev/null || echo unknown`
uname -v = `(uname -v) 2>/dev/null || echo unknown`
/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
_ASUNAME
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
printf "%s\n" "PATH: $as_dir"
done
IFS=$as_save_IFS
} >&5
cat >&5 <<_ACEOF
## ----------- ##
## Core tests. ##
## ----------- ##
_ACEOF
# Keep a trace of the command line.
# Strip out --no-create and --no-recursion so they do not pile up.
# Strip out --silent because we don't want to record it for future runs.
# Also quote any args containing shell meta-characters.
# Make two passes to allow for proper duplicate-argument suppression.
ac_configure_args=
ac_configure_args0=
ac_configure_args1=
ac_must_keep_next=false
for ac_pass in 1 2
do
for ac_arg
do
case $ac_arg in
-no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
continue ;;
*\'*)
ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
case $ac_pass in
1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
2)
as_fn_append ac_configure_args1 " '$ac_arg'"
if test $ac_must_keep_next = true; then
ac_must_keep_next=false # Got value, back to normal.
else
case $ac_arg in
*=* | --config-cache | -C | -disable-* | --disable-* \
| -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
| -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
| -with-* | --with-* | -without-* | --without-* | --x)
case "$ac_configure_args0 " in
"$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
esac
;;
-* ) ac_must_keep_next=true ;;
esac
fi
as_fn_append ac_configure_args " '$ac_arg'"
;;
esac
done
done
{ ac_configure_args0=; unset ac_configure_args0;}
{ ac_configure_args1=; unset ac_configure_args1;}
# When interrupted or exit'd, cleanup temporary files, and complete
# config.log. We remove comments because anyway the quotes in there
# would cause problems or look ugly.
# 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
printf "%s\n" "## ---------------- ##
## Cache variables. ##
## ---------------- ##"
echo
# The following way of writing the cache mishandles newlines in values,
(
for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
eval ac_val=\$$ac_var
case $ac_val in #(
*${as_nl}*)
case $ac_var in #(
*_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) ;; #(
BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
*) { eval $ac_var=; unset $ac_var;} ;;
esac ;;
esac
done
(set) 2>&1 |
case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
*${as_nl}ac_space=\ *)
sed -n \
"s/'\''/'\''\\\\'\'''\''/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
;; #(
*)
sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
;;
esac |
sort
)
echo
printf "%s\n" "## ----------------- ##
## Output variables. ##
## ----------------- ##"
echo
for ac_var in $ac_subst_vars
do
eval ac_val=\$$ac_var
case $ac_val in
*\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
esac
printf "%s\n" "$ac_var='\''$ac_val'\''"
done | sort
echo
if test -n "$ac_subst_files"; then
printf "%s\n" "## ------------------- ##
## File substitutions. ##
## ------------------- ##"
echo
for ac_var in $ac_subst_files
do
eval ac_val=\$$ac_var
case $ac_val in
*\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
esac
printf "%s\n" "$ac_var='\''$ac_val'\''"
done | sort
echo
fi
if test -s confdefs.h; then
printf "%s\n" "## ----------- ##
## confdefs.h. ##
## ----------- ##"
echo
cat confdefs.h
echo
fi
test "$ac_signal" != 0 &&
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 &&
exit $exit_status
' 0
for ac_signal in 1 2 13 15; do
trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
done
ac_signal=0
# confdefs.h avoids OS command line length limits that DEFS can exceed.
rm -f -r conftest* confdefs.h
printf "%s\n" "/* confdefs.h */" > confdefs.h
# Predefined preprocessor variables.
printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h
printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h
printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h
printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h
printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h
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.
if test -n "$CONFIG_SITE"; then
ac_site_files="$CONFIG_SITE"
elif test "x$prefix" != xNONE; then
ac_site_files="$prefix/share/config.site $prefix/etc/config.site"
else
ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
fi
for ac_site_file in $ac_site_files
do
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" \
|| { { 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
done
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
{ 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
{ 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
# 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;
}
"
# Test code for whether the C++ compiler supports C++98 (global declarations)
ac_cxx_conftest_cxx98_globals='
// Does the compiler advertise C++98 conformance?
#if !defined __cplusplus || __cplusplus < 199711L
# error "Compiler does not advertise C++98 conformance"
#endif
// These inclusions are to reject old compilers that
// lack the unsuffixed header files.
#include
#include
// and are *not* freestanding headers in C++98.
extern void assert (int);
namespace std {
extern int strcmp (const char *, const char *);
}
// Namespaces, exceptions, and templates were all added after "C++ 2.0".
using std::exception;
using std::strcmp;
namespace {
void test_exception_syntax()
{
try {
throw "test";
} catch (const char *s) {
// Extra parentheses suppress a warning when building autoconf itself,
// due to lint rules shared with more typical C programs.
assert (!(strcmp) (s, "test"));
}
}
template struct test_template
{
T const val;
explicit test_template(T t) : val(t) {}
template T add(U u) { return static_cast(u) + val; }
};
} // anonymous namespace
'
# Test code for whether the C++ compiler supports C++98 (body of main)
ac_cxx_conftest_cxx98_main='
assert (argc);
assert (! argv[0]);
{
test_exception_syntax ();
test_template tt (2.0);
assert (tt.add (4) == 6.0);
assert (true && !false);
}
'
# Test code for whether the C++ compiler supports C++11 (global declarations)
ac_cxx_conftest_cxx11_globals='
// Does the compiler advertise C++ 2011 conformance?
#if !defined __cplusplus || __cplusplus < 201103L
# error "Compiler does not advertise C++11 conformance"
#endif
namespace cxx11test
{
constexpr int get_val() { return 20; }
struct testinit
{
int i;
double d;
};
class delegate
{
public:
delegate(int n) : n(n) {}
delegate(): delegate(2354) {}
virtual int getval() { return this->n; };
protected:
int n;
};
class overridden : public delegate
{
public:
overridden(int n): delegate(n) {}
virtual int getval() override final { return this->n * 2; }
};
class nocopy
{
public:
nocopy(int i): i(i) {}
nocopy() = default;
nocopy(const nocopy&) = delete;
nocopy & operator=(const nocopy&) = delete;
private:
int i;
};
// for testing lambda expressions
template Ret eval(Fn f, Ret v)
{
return f(v);
}
// for testing variadic templates and trailing return types
template auto sum(V first) -> V
{
return first;
}
template auto sum(V first, Args... rest) -> V
{
return first + sum(rest...);
}
}
'
# Test code for whether the C++ compiler supports C++11 (body of main)
ac_cxx_conftest_cxx11_main='
{
// Test auto and decltype
auto a1 = 6538;
auto a2 = 48573953.4;
auto a3 = "String literal";
int total = 0;
for (auto i = a3; *i; ++i) { total += *i; }
decltype(a2) a4 = 34895.034;
}
{
// Test constexpr
short sa[cxx11test::get_val()] = { 0 };
}
{
// Test initializer lists
cxx11test::testinit il = { 4323, 435234.23544 };
}
{
// Test range-based for
int array[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3,
14, 19, 17, 8, 6, 20, 16, 2, 11, 1};
for (auto &x : array) { x += 23; }
}
{
// Test lambda expressions
using cxx11test::eval;
assert (eval ([](int x) { return x*2; }, 21) == 42);
double d = 2.0;
assert (eval ([&](double x) { return d += x; }, 3.0) == 5.0);
assert (d == 5.0);
assert (eval ([=](double x) mutable { return d += x; }, 4.0) == 9.0);
assert (d == 5.0);
}
{
// Test use of variadic templates
using cxx11test::sum;
auto a = sum(1);
auto b = sum(1, 2);
auto c = sum(1.0, 2.0, 3.0);
}
{
// Test constructor delegation
cxx11test::delegate d1;
cxx11test::delegate d2();
cxx11test::delegate d3(45);
}
{
// Test override and final
cxx11test::overridden o1(55464);
}
{
// Test nullptr
char *c = nullptr;
}
{
// Test template brackets
test_template<::test_template> v(test_template(12));
}
{
// Unicode literals
char const *utf8 = u8"UTF-8 string \u2500";
char16_t const *utf16 = u"UTF-8 string \u2500";
char32_t const *utf32 = U"UTF-32 string \u2500";
}
'
# Test code for whether the C compiler supports C++11 (complete).
ac_cxx_conftest_cxx11_program="${ac_cxx_conftest_cxx98_globals}
${ac_cxx_conftest_cxx11_globals}
int
main (int argc, char **argv)
{
int ok = 0;
${ac_cxx_conftest_cxx98_main}
${ac_cxx_conftest_cxx11_main}
return ok;
}
"
# Test code for whether the C compiler supports C++98 (complete).
ac_cxx_conftest_cxx98_program="${ac_cxx_conftest_cxx98_globals}
int
main (int argc, char **argv)
{
int ok = 0;
${ac_cxx_conftest_cxx98_main}
return ok;
}
"
as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H"
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 " sys/time.h sys_time_h HAVE_SYS_TIME_H"
# Auxiliary files required by this configure script.
ac_aux_files="config.guess config.sub compile missing install-sh"
# Locations in which to look for auxiliary files.
ac_aux_dir_candidates="${srcdir}/build-aux"
# 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
for ac_var in $ac_precious_vars; do
eval ac_old_set=\$ac_cv_env_${ac_var}_set
eval ac_new_set=\$ac_env_${ac_var}_set
eval ac_old_val=\$ac_cv_env_${ac_var}_value
eval ac_new_val=\$ac_env_${ac_var}_value
case $ac_old_set,$ac_new_set in
set,)
{ 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)
{ 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=: ;;
,);;
*)
if test "x$ac_old_val" != "x$ac_new_val"; then
# differences in whitespace do not lead to failure.
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
{ 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
{ 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
{ 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=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
*) ac_arg=$ac_var=$ac_new_val ;;
esac
case " $ac_configure_args " in
*" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
*) as_fn_append ac_configure_args " '$ac_arg'" ;;
esac
fi
done
if $ac_cache_corrupted; then
{ 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. ##
## -------------------- ##
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
ac_config_headers="$ac_config_headers config.h"
am__api_version='1.16'
# 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
# SunOS /usr/etc/install
# IRIX /sbin/install
# AIX /bin/install
# AmigaOS /C/install, which installs bootblocks on floppy discs
# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
# AFS /usr/afsws/bin/install, which mishandles nonexistent args
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# 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.
{ 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 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
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/* ) ;;
*)
# OSF1 and SCO ODT 3.0 have their own names for install.
# Don't use installbsd from OSF since it installs stuff as root
# 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 test $ac_prog = install &&
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
# program-specific install script used by HP pwplus--don't use.
:
else
rm -rf conftest.one conftest.two conftest.dir
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/" &&
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"
break 3
fi
fi
fi
done
done
;;
esac
done
IFS=$as_save_IFS
rm -rf conftest.one conftest.two conftest.dir
fi
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
# value for INSTALL within a source directory, because that will
# break other packages using the cache if that directory is
# removed, or if the value is a relative name.
INSTALL=$ac_install_sh
fi
fi
{ 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.
test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
printf %s "checking whether build environment is sane... " >&6; }
# Reject unsafe characters in $srcdir or the absolute working directory
# name. Accept space and tab only in the latter.
am_lf='
'
case `pwd` in
*[\\\"\#\$\&\'\`$am_lf]*)
as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;
esac
case $srcdir in
*[\\\"\#\$\&\'\`$am_lf\ \ ]*)
as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;;
esac
# Do 'set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
am_has_slept=no
for am_try in 1 2; do
echo "timestamp, slept: $am_has_slept" > conftest.file
set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
if test "$*" = "X"; then
# -L didn't work.
set X `ls -t "$srcdir/configure" conftest.file`
fi
if test "$*" != "X $srcdir/configure conftest.file" \
&& test "$*" != "X conftest.file $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
as_fn_error $? "ls -t appears to fail. Make sure there is not a broken
alias in your environment" "$LINENO" 5
fi
if test "$2" = conftest.file || test $am_try -eq 2; then
break
fi
# Just in case.
sleep 1
am_has_slept=yes
done
test "$2" = conftest.file
)
then
# Ok.
:
else
as_fn_error $? "newly created file is older than distributed files!
Check your system clock" "$LINENO" 5
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
# If we didn't sleep, we still need to ensure time stamps of config.status and
# generated files are strictly newer.
am_sleep_pid=
if grep 'slept: no' conftest.file >/dev/null 2>&1; then
( sleep 1 ) &
am_sleep_pid=$!
fi
rm -f conftest.file
test "$program_prefix" != NONE &&
program_transform_name="s&^&$program_prefix&;$program_transform_name"
# Use a double $ so make ignores it.
test "$program_suffix" != NONE &&
program_transform_name="s&\$&$program_suffix&;$program_transform_name"
# Double any \ or $.
# By default was `s,x,x', remove it if useless.
ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
program_transform_name=`printf "%s\n" "$program_transform_name" | sed "$ac_script"`
# Expand $ac_aux_dir to an absolute path.
am_aux_dir=`cd "$ac_aux_dir" && pwd`
if test x"${MISSING+set}" != xset; then
MISSING="\${SHELL} '$am_aux_dir/missing'"
fi
# Use eval to expand $SHELL
if eval "$MISSING --is-lightweight"; then
am_missing_run="$MISSING "
else
am_missing_run=
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5
printf "%s\n" "$as_me: WARNING: 'missing' script is too old or missing" >&2;}
fi
if test x"${install_sh+set}" != xset; then
case $am_aux_dir in
*\ * | *\ *)
install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
*)
install_sh="\${SHELL} $am_aux_dir/install-sh"
esac
fi
# Installed binaries are usually stripped using 'strip' when the user
# run "make install-strip". However 'strip' might not be the right
# tool to use in cross-compilation environments, therefore Automake
# will honor the 'STRIP' environment variable to overrule this program.
if test "$cross_compiling" != no; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
set dummy ${ac_tool_prefix}strip; 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_STRIP+y}
then :
printf %s "(cached) " >&6
else $as_nop
if test -n "$STRIP"; then
ac_cv_prog_STRIP="$STRIP" # 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_STRIP="${ac_tool_prefix}strip"
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
STRIP=$ac_cv_prog_STRIP
if test -n "$STRIP"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
printf "%s\n" "$STRIP" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
fi
if test -z "$ac_cv_prog_STRIP"; then
ac_ct_STRIP=$STRIP
# Extract the first word of "strip", so it can be a program name with args.
set dummy strip; 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_STRIP+y}
then :
printf %s "(cached) " >&6
else $as_nop
if test -n "$ac_ct_STRIP"; then
ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # 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_STRIP="strip"
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_STRIP=$ac_cv_prog_ac_ct_STRIP
if test -n "$ac_ct_STRIP"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
printf "%s\n" "$ac_ct_STRIP" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
if test "x$ac_ct_STRIP" = x; then
STRIP=":"
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
STRIP=$ac_ct_STRIP
fi
else
STRIP="$ac_cv_prog_STRIP"
fi
fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a race-free mkdir -p" >&5
printf %s "checking for a race-free mkdir -p... " >&6; }
if test -z "$MKDIR_P"; then
if test ${ac_cv_path_mkdir+y}
then :
printf %s "(cached) " >&6
else $as_nop
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
do
IFS=$as_save_IFS
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
for ac_prog in mkdir gmkdir; do
for ac_exec_ext in '' $ac_executable_extensions; do
as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext" || continue
case `"$as_dir$ac_prog$ac_exec_ext" --version 2>&1` in #(
'mkdir ('*'coreutils) '* | \
'BusyBox '* | \
'mkdir (fileutils) '4.1*)
ac_cv_path_mkdir=$as_dir$ac_prog$ac_exec_ext
break 3;;
esac
done
done
done
IFS=$as_save_IFS
fi
test -d ./--version && rmdir ./--version
if test ${ac_cv_path_mkdir+y}; then
MKDIR_P="$ac_cv_path_mkdir -p"
else
# As a last resort, use the slow shell script. Don't cache a
# value for MKDIR_P within a source directory, because that will
# break other packages using the cache if that directory is
# removed, or if the value is a relative name.
MKDIR_P="$ac_install_sh -d"
fi
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
printf "%s\n" "$MKDIR_P" >&6; }
for ac_prog in gawk mawk nawk awk
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; 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_AWK+y}
then :
printf %s "(cached) " >&6
else $as_nop
if test -n "$AWK"; then
ac_cv_prog_AWK="$AWK" # 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_AWK="$ac_prog"
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
AWK=$ac_cv_prog_AWK
if test -n "$AWK"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
printf "%s\n" "$AWK" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
test -n "$AWK" && break
done
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
set x ${MAKE-make}
ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
if eval test \${ac_cv_prog_make_${ac_make}_set+y}
then :
printf %s "(cached) " >&6
else $as_nop
cat >conftest.make <<\_ACEOF
SHELL = /bin/sh
all:
@echo '@@@%%%=$(MAKE)=@@@%%%'
_ACEOF
# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
case `${MAKE-make} -f conftest.make 2>/dev/null` in
*@@@%%%=?*=@@@%%%*)
eval ac_cv_prog_make_${ac_make}_set=yes;;
*)
eval ac_cv_prog_make_${ac_make}_set=no;;
esac
rm -f conftest.make
fi
if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
SET_MAKE=
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
SET_MAKE="MAKE=${MAKE-make}"
fi
rm -rf .tst 2>/dev/null
mkdir .tst 2>/dev/null
if test -d .tst; then
am__leading_dot=.
else
am__leading_dot=_
fi
rmdir .tst 2>/dev/null
# Check whether --enable-silent-rules was given.
if test ${enable_silent_rules+y}
then :
enableval=$enable_silent_rules;
fi
case $enable_silent_rules in # (((
yes) AM_DEFAULT_VERBOSITY=0;;
no) AM_DEFAULT_VERBOSITY=1;;
*) AM_DEFAULT_VERBOSITY=1;;
esac
am_make=${MAKE-make}
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5
printf %s "checking whether $am_make supports nested variables... " >&6; }
if test ${am_cv_make_support_nested_variables+y}
then :
printf %s "(cached) " >&6
else $as_nop
if printf "%s\n" 'TRUE=$(BAR$(V))
BAR0=false
BAR1=true
V=1
am__doit:
@$(TRUE)
.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then
am_cv_make_support_nested_variables=yes
else
am_cv_make_support_nested_variables=no
fi
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5
printf "%s\n" "$am_cv_make_support_nested_variables" >&6; }
if test $am_cv_make_support_nested_variables = yes; then
AM_V='$(V)'
AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
else
AM_V=$AM_DEFAULT_VERBOSITY
AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
fi
AM_BACKSLASH='\'
if test "`cd $srcdir && pwd`" != "`pwd`"; then
# Use -I$(srcdir) only when $(srcdir) != ., so that make's output
# is not polluted with repeated "-I."
am__isrc=' -I$(srcdir)'
# test to see if srcdir already configured
if test -f $srcdir/config.status; then
as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
fi
fi
# test whether we have cygpath
if test -z "$CYGPATH_W"; then
if (cygpath --version) >/dev/null 2>/dev/null; then
CYGPATH_W='cygpath -w'
else
CYGPATH_W=echo
fi
fi
# Define the identity of the package.
PACKAGE='form'
VERSION='5.0.1'
printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
printf "%s\n" "#define VERSION \"$VERSION\"" >>confdefs.h
# Some tools Automake needs.
ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
# For better backward compatibility. To be removed once Automake 1.9.x
# dies out for good. For more background, see:
#
#
mkdir_p='$(MKDIR_P)'
# We need awk for the "check" target (and possibly the TAP driver). The
# system "awk" is bad on some platforms.
# Always define AMTAR for backward compatibility. Yes, it's still used
# in the wild :-( We should find a proper way to deprecate it ...
AMTAR='$${TAR-tar}'
# We'll loop over all known methods to create a tar archive until one works.
_am_tools='gnutar pax cpio none'
am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
# Variables for tags utilities; see am/tags.am
if test -z "$CTAGS"; then
CTAGS=ctags
fi
if test -z "$ETAGS"; then
ETAGS=etags
fi
if test -z "$CSCOPE"; then
CSCOPE=cscope
fi
# POSIX will say in a future version that running "rm -f" with no argument
# is OK; and we want to be able to make that assumption in our Makefile
# recipes. So use an aggressive probe to check that the usage we want is
# actually supported "in the wild" to an acceptable degree.
# See automake bug#10828.
# To make any issue more visible, cause the running configure to be aborted
# by default if the 'rm' program in use doesn't match our expectations; the
# user can still override this though.
if rm -f && rm -fr && rm -rf; then : OK; else
cat >&2 <<'END'
Oops!
Your 'rm' program seems unable to run without file operands specified
on the command line, even when the '-f' option is present. This is contrary
to the behaviour of most rm programs out there, and not conforming with
the upcoming POSIX standard:
Please tell bug-automake@gnu.org about your system, including the value
of your $PATH and any error possibly output before this message. This
can help us improve future automake versions.
END
if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
echo 'Configuration will proceed anyway, since you have set the' >&2
echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
echo >&2
else
cat >&2 <<'END'
Aborting the configuration process, to ensure you take notice of the issue.
You can download and install GNU coreutils to get an 'rm' implementation
that behaves properly: .
If you want to complete the configuration process using your problematic
'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
to "yes", and re-run configure.
END
as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5
fi
fi
# Check for .version file
if test -f $srcdir/.version; then
FIXED_VERSION_TRUE=
FIXED_VERSION_FALSE='#'
else
FIXED_VERSION_TRUE='#'
FIXED_VERSION_FALSE=
fi
# Check for programs
: ${CFLAGS=''} # avoid autoconf's default CFLAGS/CXXFLAGS
: ${CXXFLAGS=''}
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
if test -n "$ac_tool_prefix"; then
for ac_prog in gcc cc icc
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
{ 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$ac_prog"
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 -n "$CC" && break
done
fi
if test -z "$CC"; then
ac_ct_CC=$CC
for ac_prog in gcc cc icc
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; 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="$ac_prog"
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
test -n "$ac_ct_CC" && break
done
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
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.
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 -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\""
printf "%s\n" "$ac_try_echo"; } >&5
(eval "$ac_compiler $ac_option >&5") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
sed '10a\
... rest of stderr output deleted ...
10q' conftest.err >conftest.er1
cat conftest.er1 >&5
fi
rm -f conftest.er1 conftest.err
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
done
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main (void)
{
;
return 0;
}
_ACEOF
ac_clean_files_save=$ac_clean_files
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.
{ 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.*"
ac_rmfiles=
for ac_file in $ac_files
do
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
* ) ac_rmfiles="$ac_rmfiles $ac_file";;
esac
done
rm -f $ac_rmfiles
if { { ac_try="$ac_link_default"
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_default") 2>&5
ac_status=$?
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,
# so that the user can short-circuit this test for compilers unknown to
# Autoconf.
for ac_file in $ac_files ''
do
test -f "$ac_file" || continue
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
;;
[ab].out )
# We found the default executable, but exeext='' is most
# certainly right.
break;;
*.* )
if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no;
then :; else
ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
fi
# We set ac_cv_exeext here because the later test for it is not
# safe: cross compilers may not add the suffix if given an `-o'
# argument, so we may need to know it at that point already.
# Even if this section looks crufty: it has the advantage of
# actually working.
break;;
* )
break;;
esac
done
test "$ac_cv_exeext" = no && ac_cv_exeext=
else $as_nop
ac_file=''
fi
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
{ { 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_nop
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
fi
{ 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
{ 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\""
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; }
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
# `rm'.
for ac_file in conftest.exe conftest conftest.*; do
test -f "$ac_file" || continue
case $ac_file in
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
*.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
break;;
* ) break;;
esac
done
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
{ 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
ac_exeext=$EXEEXT
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
int
main (void)
{
FILE *f = fopen ("conftest.out", "w");
return ferror (f) || fclose (f) != 0;
;
return 0;
}
_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.
{ 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
*\"* | *\`* | *\\*) 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; }
if { ac_try='./conftest$ac_cv_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
cross_compiling=no
else
if test "$cross_compiling" = maybe; then
cross_compiling=yes
else
{ { 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
{ 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
{ 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 (void)
{
;
return 0;
}
_ACEOF
rm -f conftest.o conftest.obj
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\""
printf "%s\n" "$ac_try_echo"; } >&5
(eval "$ac_compile") 2>&5
ac_status=$?
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
*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
*) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
break;;
esac
done
else $as_nop
printf "%s\n" "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
{ { 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
{ 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
{ 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 (void)
{
#ifndef __GNUC__
choke me
#endif
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
ac_compiler_gnu=yes
else $as_nop
ac_compiler_gnu=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
ac_cv_c_compiler_gnu=$ac_compiler_gnu
fi
{ 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+y}
ac_save_CFLAGS=$CFLAGS
{ 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
CFLAGS="-g"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main (void)
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
ac_cv_prog_cc_g=yes
else $as_nop
CFLAGS=""
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main (void)
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
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 (void)
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
ac_cv_prog_cc_g=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
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
fi
{ 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
CFLAGS="-g -O2"
else
CFLAGS="-g"
fi
else
if test "$GCC" = yes; then
CFLAGS="-O2"
else
CFLAGS=
fi
fi
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. */
$ac_c_conftest_c89_program
_ACEOF
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 :
ac_cv_prog_cc_c89=$ac_arg
fi
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
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
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
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
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5
printf %s "checking whether $CC understands -c and -o together... " >&6; }
if test ${am_cv_prog_cc_c_o+y}
then :
printf %s "(cached) " >&6
else $as_nop
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main (void)
{
;
return 0;
}
_ACEOF
# Make sure it works both with $CC and with simple cc.
# Following AC_PROG_CC_C_O, we do the test twice because some
# compilers refuse to overwrite an existing .o file with -o,
# though they will create one.
am_cv_prog_cc_c_o=yes
for am_i in 1 2; do
if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5
($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } \
&& test -f conftest2.$ac_objext; then
: OK
else
am_cv_prog_cc_c_o=no
break
fi
done
rm -f core conftest*
unset am_i
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5
printf "%s\n" "$am_cv_prog_cc_c_o" >&6; }
if test "$am_cv_prog_cc_c_o" != yes; then
# Losing compiler, so override with the script.
# FIXME: It is wrong to rewrite CC.
# But if we don't then we get into trouble of one sort or another.
# A longer-term fix would be to have automake use am__CC in this case,
# and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
CC="$am_aux_dir/compile $CC"
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
DEPDIR="${am__leading_dot}deps"
ac_config_commands="$ac_config_commands depfiles"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5
printf %s "checking whether ${MAKE-make} supports the include directive... " >&6; }
cat > confinc.mk << 'END'
am__doit:
@echo this is the am__doit target >confinc.out
.PHONY: am__doit
END
am__include="#"
am__quote=
# BSD make does it like this.
echo '.include "confinc.mk" # ignored' > confmf.BSD
# Other make implementations (GNU, Solaris 10, AIX) do it like this.
echo 'include confinc.mk # ignored' > confmf.GNU
_am_result=no
for s in GNU BSD; do
{ echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5
(${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
case $?:`cat confinc.out 2>/dev/null` in #(
'0:this is the am__doit target') :
case $s in #(
BSD) :
am__include='.include' am__quote='"' ;; #(
*) :
am__include='include' am__quote='' ;;
esac ;; #(
*) :
;;
esac
if test "$am__include" != "#"; then
_am_result="yes ($s style)"
break
fi
done
rm -f confinc.* confmf.*
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5
printf "%s\n" "${_am_result}" >&6; }
# Check whether --enable-dependency-tracking was given.
if test ${enable_dependency_tracking+y}
then :
enableval=$enable_dependency_tracking;
fi
if test "x$enable_dependency_tracking" != xno; then
am_depcomp="$ac_aux_dir/depcomp"
AMDEPBACKSLASH='\'
am__nodep='_no'
fi
if test "x$enable_dependency_tracking" != xno; then
AMDEP_TRUE=
AMDEP_FALSE='#'
else
AMDEP_TRUE='#'
AMDEP_FALSE=
fi
depcc="$CC" am_compiler_list=
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
printf %s "checking dependency style of $depcc... " >&6; }
if test ${am_cv_CC_dependencies_compiler_type+y}
then :
printf %s "(cached) " >&6
else $as_nop
if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
# We make a subdir and do the tests there. Otherwise we can end up
# making bogus files that we don't know about and never remove. For
# instance it was reported that on HP-UX the gcc test will end up
# making a dummy file named 'D' -- because '-MD' means "put the output
# in D".
rm -rf conftest.dir
mkdir conftest.dir
# Copy depcomp to subdir because otherwise we won't find it if we're
# using a relative directory.
cp "$am_depcomp" conftest.dir
cd conftest.dir
# We will build objects and dependencies in a subdirectory because
# it helps to detect inapplicable dependency modes. For instance
# both Tru64's cc and ICC support -MD to output dependencies as a
# side effect of compilation, but ICC will put the dependencies in
# the current directory while Tru64 will put them in the object
# directory.
mkdir sub
am_cv_CC_dependencies_compiler_type=none
if test "$am_compiler_list" = ""; then
am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
fi
am__universal=false
case " $depcc " in #(
*\ -arch\ *\ -arch\ *) am__universal=true ;;
esac
for depmode in $am_compiler_list; do
# Setup a source with many dependencies, because some compilers
# like to wrap large dependency lists on column 80 (with \), and
# we should not choose a depcomp mode which is confused by this.
#
# We need to recreate these files for each test, as the compiler may
# overwrite some of them when testing with obscure command lines.
# This happens at least with the AIX C compiler.
: > sub/conftest.c
for i in 1 2 3 4 5 6; do
echo '#include "conftst'$i'.h"' >> sub/conftest.c
# Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
# Solaris 10 /bin/sh.
echo '/* dummy */' > sub/conftst$i.h
done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
# We check with '-c' and '-o' for the sake of the "dashmstdout"
# mode. It turns out that the SunPro C++ compiler does not properly
# handle '-M -o', and we need to detect this. Also, some Intel
# versions had trouble with output in subdirs.
am__obj=sub/conftest.${OBJEXT-o}
am__minus_obj="-o $am__obj"
case $depmode in
gcc)
# This depmode causes a compiler race in universal mode.
test "$am__universal" = false || continue
;;
nosideeffect)
# After this tag, mechanisms are not by side-effect, so they'll
# only be used when explicitly requested.
if test "x$enable_dependency_tracking" = xyes; then
continue
else
break
fi
;;
msvc7 | msvc7msys | msvisualcpp | msvcmsys)
# This compiler won't grok '-c -o', but also, the minuso test has
# not run yet. These depmodes are late enough in the game, and
# so weak that their functioning should not be impacted.
am__obj=conftest.${OBJEXT-o}
am__minus_obj=
;;
none) break ;;
esac
if depmode=$depmode \
source=sub/conftest.c object=$am__obj \
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
$SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
>/dev/null 2>conftest.err &&
grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
# icc doesn't choke on unknown options, it will just issue warnings
# or remarks (even with -Werror). So we grep stderr for any message
# that says an option was ignored or not supported.
# When given -MP, icc 7.0 and 7.1 complain thusly:
# icc: Command line warning: ignoring option '-M'; no argument required
# The diagnosis changed in icc 8.0:
# icc: Command line remark: option '-MP' not supported
if (grep 'ignoring option' conftest.err ||
grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
am_cv_CC_dependencies_compiler_type=$depmode
break
fi
fi
done
cd ..
rm -rf conftest.dir
else
am_cv_CC_dependencies_compiler_type=none
fi
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
printf "%s\n" "$am_cv_CC_dependencies_compiler_type" >&6; }
CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
if
test "x$enable_dependency_tracking" != xno \
&& test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
am__fastdepCC_TRUE=
am__fastdepCC_FALSE='#'
else
am__fastdepCC_TRUE='#'
am__fastdepCC_FALSE=
fi
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
if test -z "$CXX"; then
if test -n "$CCC"; then
CXX=$CCC
else
if test -n "$ac_tool_prefix"; then
for ac_prog in g++ c++ icpc
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
{ 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_CXX+y}
then :
printf %s "(cached) " >&6
else $as_nop
if test -n "$CXX"; then
ac_cv_prog_CXX="$CXX" # 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_CXX="$ac_tool_prefix$ac_prog"
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
CXX=$ac_cv_prog_CXX
if test -n "$CXX"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5
printf "%s\n" "$CXX" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
test -n "$CXX" && break
done
fi
if test -z "$CXX"; then
ac_ct_CXX=$CXX
for ac_prog in g++ c++ icpc
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; 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_CXX+y}
then :
printf %s "(cached) " >&6
else $as_nop
if test -n "$ac_ct_CXX"; then
ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # 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_CXX="$ac_prog"
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_CXX=$ac_cv_prog_ac_ct_CXX
if test -n "$ac_ct_CXX"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5
printf "%s\n" "$ac_ct_CXX" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
test -n "$ac_ct_CXX" && break
done
if test "x$ac_ct_CXX" = x; then
CXX="g++"
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
CXX=$ac_ct_CXX
fi
fi
fi
fi
# Provide some information about the compiler.
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
{ { 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\""
printf "%s\n" "$ac_try_echo"; } >&5
(eval "$ac_compiler $ac_option >&5") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
sed '10a\
... rest of stderr output deleted ...
10q' conftest.err >conftest.er1
cat conftest.er1 >&5
fi
rm -f conftest.er1 conftest.err
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
done
{ 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_cxx_compiler_gnu+y}
then :
printf %s "(cached) " >&6
else $as_nop
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main (void)
{
#ifndef __GNUC__
choke me
#endif
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"
then :
ac_compiler_gnu=yes
else $as_nop
ac_compiler_gnu=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5
printf "%s\n" "$ac_cv_cxx_compiler_gnu" >&6; }
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
if test $ac_compiler_gnu = yes; then
GXX=yes
else
GXX=
fi
ac_test_CXXFLAGS=${CXXFLAGS+y}
ac_save_CXXFLAGS=$CXXFLAGS
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
printf %s "checking whether $CXX accepts -g... " >&6; }
if test ${ac_cv_prog_cxx_g+y}
then :
printf %s "(cached) " >&6
else $as_nop
ac_save_cxx_werror_flag=$ac_cxx_werror_flag
ac_cxx_werror_flag=yes
ac_cv_prog_cxx_g=no
CXXFLAGS="-g"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main (void)
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"
then :
ac_cv_prog_cxx_g=yes
else $as_nop
CXXFLAGS=""
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main (void)
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"
then :
else $as_nop
ac_cxx_werror_flag=$ac_save_cxx_werror_flag
CXXFLAGS="-g"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main (void)
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"
then :
ac_cv_prog_cxx_g=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
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
ac_cxx_werror_flag=$ac_save_cxx_werror_flag
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5
printf "%s\n" "$ac_cv_prog_cxx_g" >&6; }
if test $ac_test_CXXFLAGS; then
CXXFLAGS=$ac_save_CXXFLAGS
elif test $ac_cv_prog_cxx_g = yes; then
if test "$GXX" = yes; then
CXXFLAGS="-g -O2"
else
CXXFLAGS="-g"
fi
else
if test "$GXX" = yes; then
CXXFLAGS="-O2"
else
CXXFLAGS=
fi
fi
ac_prog_cxx_stdcxx=no
if test x$ac_prog_cxx_stdcxx = xno
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5
printf %s "checking for $CXX option to enable C++11 features... " >&6; }
if test ${ac_cv_prog_cxx_cxx11+y}
then :
printf %s "(cached) " >&6
else $as_nop
ac_cv_prog_cxx_cxx11=no
ac_save_CXX=$CXX
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_cxx_conftest_cxx11_program
_ACEOF
for ac_arg in '' -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x -qlanglvl=extended0x -AA
do
CXX="$ac_save_CXX $ac_arg"
if ac_fn_cxx_try_compile "$LINENO"
then :
ac_cv_prog_cxx_cxx11=$ac_arg
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam
test "x$ac_cv_prog_cxx_cxx11" != "xno" && break
done
rm -f conftest.$ac_ext
CXX=$ac_save_CXX
fi
if test "x$ac_cv_prog_cxx_cxx11" = 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_cxx_cxx11" = 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_cxx_cxx11" >&5
printf "%s\n" "$ac_cv_prog_cxx_cxx11" >&6; }
CXX="$CXX $ac_cv_prog_cxx_cxx11"
fi
ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11
ac_prog_cxx_stdcxx=cxx11
fi
fi
if test x$ac_prog_cxx_stdcxx = xno
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5
printf %s "checking for $CXX option to enable C++98 features... " >&6; }
if test ${ac_cv_prog_cxx_cxx98+y}
then :
printf %s "(cached) " >&6
else $as_nop
ac_cv_prog_cxx_cxx98=no
ac_save_CXX=$CXX
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_cxx_conftest_cxx98_program
_ACEOF
for ac_arg in '' -std=gnu++98 -std=c++98 -qlanglvl=extended -AA
do
CXX="$ac_save_CXX $ac_arg"
if ac_fn_cxx_try_compile "$LINENO"
then :
ac_cv_prog_cxx_cxx98=$ac_arg
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam
test "x$ac_cv_prog_cxx_cxx98" != "xno" && break
done
rm -f conftest.$ac_ext
CXX=$ac_save_CXX
fi
if test "x$ac_cv_prog_cxx_cxx98" = 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_cxx_cxx98" = 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_cxx_cxx98" >&5
printf "%s\n" "$ac_cv_prog_cxx_cxx98" >&6; }
CXX="$CXX $ac_cv_prog_cxx_cxx98"
fi
ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98
ac_prog_cxx_stdcxx=cxx98
fi
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
depcc="$CXX" am_compiler_list=
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
printf %s "checking dependency style of $depcc... " >&6; }
if test ${am_cv_CXX_dependencies_compiler_type+y}
then :
printf %s "(cached) " >&6
else $as_nop
if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
# We make a subdir and do the tests there. Otherwise we can end up
# making bogus files that we don't know about and never remove. For
# instance it was reported that on HP-UX the gcc test will end up
# making a dummy file named 'D' -- because '-MD' means "put the output
# in D".
rm -rf conftest.dir
mkdir conftest.dir
# Copy depcomp to subdir because otherwise we won't find it if we're
# using a relative directory.
cp "$am_depcomp" conftest.dir
cd conftest.dir
# We will build objects and dependencies in a subdirectory because
# it helps to detect inapplicable dependency modes. For instance
# both Tru64's cc and ICC support -MD to output dependencies as a
# side effect of compilation, but ICC will put the dependencies in
# the current directory while Tru64 will put them in the object
# directory.
mkdir sub
am_cv_CXX_dependencies_compiler_type=none
if test "$am_compiler_list" = ""; then
am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
fi
am__universal=false
case " $depcc " in #(
*\ -arch\ *\ -arch\ *) am__universal=true ;;
esac
for depmode in $am_compiler_list; do
# Setup a source with many dependencies, because some compilers
# like to wrap large dependency lists on column 80 (with \), and
# we should not choose a depcomp mode which is confused by this.
#
# We need to recreate these files for each test, as the compiler may
# overwrite some of them when testing with obscure command lines.
# This happens at least with the AIX C compiler.
: > sub/conftest.c
for i in 1 2 3 4 5 6; do
echo '#include "conftst'$i'.h"' >> sub/conftest.c
# Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
# Solaris 10 /bin/sh.
echo '/* dummy */' > sub/conftst$i.h
done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
# We check with '-c' and '-o' for the sake of the "dashmstdout"
# mode. It turns out that the SunPro C++ compiler does not properly
# handle '-M -o', and we need to detect this. Also, some Intel
# versions had trouble with output in subdirs.
am__obj=sub/conftest.${OBJEXT-o}
am__minus_obj="-o $am__obj"
case $depmode in
gcc)
# This depmode causes a compiler race in universal mode.
test "$am__universal" = false || continue
;;
nosideeffect)
# After this tag, mechanisms are not by side-effect, so they'll
# only be used when explicitly requested.
if test "x$enable_dependency_tracking" = xyes; then
continue
else
break
fi
;;
msvc7 | msvc7msys | msvisualcpp | msvcmsys)
# This compiler won't grok '-c -o', but also, the minuso test has
# not run yet. These depmodes are late enough in the game, and
# so weak that their functioning should not be impacted.
am__obj=conftest.${OBJEXT-o}
am__minus_obj=
;;
none) break ;;
esac
if depmode=$depmode \
source=sub/conftest.c object=$am__obj \
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
$SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
>/dev/null 2>conftest.err &&
grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
# icc doesn't choke on unknown options, it will just issue warnings
# or remarks (even with -Werror). So we grep stderr for any message
# that says an option was ignored or not supported.
# When given -MP, icc 7.0 and 7.1 complain thusly:
# icc: Command line warning: ignoring option '-M'; no argument required
# The diagnosis changed in icc 8.0:
# icc: Command line remark: option '-MP' not supported
if (grep 'ignoring option' conftest.err ||
grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
am_cv_CXX_dependencies_compiler_type=$depmode
break
fi
fi
done
cd ..
rm -rf conftest.dir
else
am_cv_CXX_dependencies_compiler_type=none
fi
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5
printf "%s\n" "$am_cv_CXX_dependencies_compiler_type" >&6; }
CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type
if
test "x$enable_dependency_tracking" != xno \
&& test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then
am__fastdepCXX_TRUE=
am__fastdepCXX_FALSE='#'
else
am__fastdepCXX_TRUE='#'
am__fastdepCXX_FALSE=
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
printf %s "checking whether ln -s works... " >&6; }
LN_S=$as_ln_s
if test "$LN_S" = "ln -s"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
printf "%s\n" "no, using $LN_S" >&6; }
fi
# Check for architecture and OS
# Make sure we can run config.sub.
$SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 ||
as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
printf %s "checking build system type... " >&6; }
if test ${ac_cv_build+y}
then :
printf %s "(cached) " >&6
else $as_nop
ac_build_alias=$build_alias
test "x$ac_build_alias" = x &&
ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"`
test "x$ac_build_alias" = x &&
as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` ||
as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
printf "%s\n" "$ac_cv_build" >&6; }
case $ac_cv_build in
*-*-*) ;;
*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
esac
build=$ac_cv_build
ac_save_IFS=$IFS; IFS='-'
set x $ac_cv_build
shift
build_cpu=$1
build_vendor=$2
shift; shift
# Remember, the first character of IFS is used to create $*,
# except with old shells:
build_os=$*
IFS=$ac_save_IFS
case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
printf %s "checking host system type... " >&6; }
if test ${ac_cv_host+y}
then :
printf %s "(cached) " >&6
else $as_nop
if test "x$host_alias" = x; then
ac_cv_host=$ac_cv_build
else
ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` ||
as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5
fi
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
printf "%s\n" "$ac_cv_host" >&6; }
case $ac_cv_host in
*-*-*) ;;
*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
esac
host=$ac_cv_host
ac_save_IFS=$IFS; IFS='-'
set x $ac_cv_host
shift
host_cpu=$1
host_vendor=$2
shift; shift
# Remember, the first character of IFS is used to create $*,
# except with old shells:
host_os=$*
IFS=$ac_save_IFS
case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
case $host_os in
darwin* )
print_os="OSX"
;;
linux* )
print_os="Linux"
# "LINUX" is still used in mallocprotect.h. (TU 16 Oct 2011)
printf "%s\n" "#define LINUX /**/" >>confdefs.h
;;
cygwin* )
print_os="Cygwin"
;;
freebsd* )
print_os="FreeBSD"
;;
netbsd* )
print_os="NetBSD"
;;
openbsd* )
print_os="OpenBSD"
;;
* )
print_os="UNKNOWN OS ($host_os)"
;;
esac
case $host_cpu in
i586 )
print_cpu="Pentium"
;;
i686 )
print_cpu="Pentium Pro"
;;
x86_64 )
print_cpu="Opteron"
;;
alpha* )
print_cpu="Alpha"
;;
* )
print_cpu="UNKNOWN CPU ($host_cpu)"
;;
esac
# Check for C compiler vendor. We assume that all compilers (CC, CXX, MPICC and
# MPICXX) have the same vendor and the same version. Clang most likely works
# as GCC.
vendors="
intel: __ICC,__ECC,__INTEL_COMPILER
gnu: __GNUC__
microsoft: _MSC_VER
unknown: UNKNOWN
"
for ventest in $vendors; do
case $ventest in
*:)
vendor=$ventest
continue
;;
*)
vencpp="defined("`echo $ventest | sed 's/,/) || defined(/g'`")"
;;
esac
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main (void)
{
#if !($vencpp)
choke me
#endif
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
break
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
done
vendor=`echo $vendor | cut -d: -f1`
# Check for the C++ standard
# Check whether --with-cxxstd was given.
if test ${with_cxxstd+y}
then :
withval=$with_cxxstd;
else $as_nop
with_cxxstd=check
fi
cxxstd_flag=
if test "x$vendor" = xgnu; then
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
if test "x$with_cxxstd" = xcheck; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++11 requires any flag" >&5
printf %s "checking whether C++11 requires any flag... " >&6; }
ok=no
for opt in none -std=gnu++11; do
save_CXXFLAGS=$CXXFLAGS
CXXFLAGS="$CXXFLAGS $opt"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main (void)
{
#if __cplusplus < 201103L
#error C+11 not supported
#endif
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"
then :
ok=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
CXXFLAGS=$save_CXXFLAGS
if test "x$ok" = xyes; then
if test "x$opt" = xnone; then
cxxstd_flag=
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
else
cxxstd_flag=$opt
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $opt" >&5
printf "%s\n" "$opt" >&6; }
fi
break
fi
done
if test "x$ok" = xno; then
cxxstd_flag=
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not supported" >&5
printf "%s\n" "not supported" >&6; }
fi
elif test "x$with_cxxstd" != xnone; then
cxxstd_flag="-std=$with_cxxstd"
as_CACHEVAR=`printf "%s\n" "ax_cv_check_cxxflags_-Werror_$cxxstd_flag" | $as_tr_sh`
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts $cxxstd_flag" >&5
printf %s "checking whether C++ compiler accepts $cxxstd_flag... " >&6; }
if eval test \${$as_CACHEVAR+y}
then :
printf %s "(cached) " >&6
else $as_nop
ax_check_save_flags=$CXXFLAGS
CXXFLAGS="$CXXFLAGS -Werror $cxxstd_flag"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main (void)
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"
then :
eval "$as_CACHEVAR=yes"
else $as_nop
eval "$as_CACHEVAR=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
CXXFLAGS=$ax_check_save_flags
fi
eval ac_res=\$$as_CACHEVAR
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
printf "%s\n" "$ac_res" >&6; }
if test x"`eval 'as_val=${'$as_CACHEVAR'};printf "%s\n" "$as_val"'`" = xyes
then :
:
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 $? "Invalid argument for --with-cxxstd
See \`config.log' for more details" "$LINENO" 5; }
fi
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
fi
if test "x$cxxstd_flag" != x; then
CXX="$CXX $cxxstd_flag"
if test "x$CXXCPP" != x; then
CXXCPP="$CXXCPP $cxxstd_flag"
fi
fi
# Checks for header files
# NOTE: autoconf>=2.70 has started to warn obsolete macros.
# We check if AC_CHECK_INCLUDES_DEFAULT (introduced in 2.70) is available
# and switch to the new code if possible.
ac_header= ac_cache=
for ac_item in $ac_header_c_list
do
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
ac_header= ac_cache=
elif test $ac_header; then
ac_cache=$ac_item
else
ac_header=$ac_item
fi
done
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
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
printf %s "checking for grep that handles long lines and -e... " >&6; }
if test ${ac_cv_path_GREP+y}
then :
printf %s "(cached) " >&6
else $as_nop
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
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
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
printf %s 0123456789 >"conftest.in"
while :
do
cat "conftest.in" "conftest.in" >"conftest.tmp"
mv "conftest.tmp" "conftest.in"
cp "conftest.in" "conftest.nl"
printf "%s\n" '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
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
fi
else
ac_cv_path_GREP=$GREP
fi
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
printf "%s\n" "$ac_cv_path_GREP" >&6; }
GREP="$ac_cv_path_GREP"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
printf %s "checking for egrep... " >&6; }
if test ${ac_cv_path_EGREP+y}
then :
printf %s "(cached) " >&6
else $as_nop
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
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
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
printf %s 0123456789 >"conftest.in"
while :
do
cat "conftest.in" "conftest.in" >"conftest.tmp"
mv "conftest.tmp" "conftest.in"
cp "conftest.in" "conftest.nl"
printf "%s\n" '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
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
printf "%s\n" "$ac_cv_path_EGREP" >&6; }
EGREP="$ac_cv_path_EGREP"
printf "%s\n" "#define TIME_WITH_SYS_TIME 1" >>confdefs.h
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" "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" "sys/file.h" "ac_cv_header_sys_file_h" "$ac_includes_default"
if test "x$ac_cv_header_sys_file_h" = xyes
then :
printf "%s\n" "#define HAVE_SYS_FILE_H 1" >>confdefs.h
fi
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
ac_fn_cxx_check_header_compile "$LINENO" "unordered_map" "ac_cv_header_unordered_map" "$ac_includes_default"
if test "x$ac_cv_header_unordered_map" = xyes
then :
printf "%s\n" "#define HAVE_UNORDERED_MAP 1" >>confdefs.h
fi
ac_fn_cxx_check_header_compile "$LINENO" "tr1/unordered_map" "ac_cv_header_tr1_unordered_map" "$ac_includes_default"
if test "x$ac_cv_header_tr1_unordered_map" = xyes
then :
printf "%s\n" "#define HAVE_TR1_UNORDERED_MAP 1" >>confdefs.h
fi
ac_fn_cxx_check_header_compile "$LINENO" "boost/unordered_map.hpp" "ac_cv_header_boost_unordered_map_hpp" "$ac_includes_default"
if test "x$ac_cv_header_boost_unordered_map_hpp" = xyes
then :
printf "%s\n" "#define HAVE_BOOST_UNORDERED_MAP_HPP 1" >>confdefs.h
fi
ac_fn_cxx_check_header_compile "$LINENO" "unordered_set" "ac_cv_header_unordered_set" "$ac_includes_default"
if test "x$ac_cv_header_unordered_set" = xyes
then :
printf "%s\n" "#define HAVE_UNORDERED_SET 1" >>confdefs.h
fi
ac_fn_cxx_check_header_compile "$LINENO" "tr1/unordered_set" "ac_cv_header_tr1_unordered_set" "$ac_includes_default"
if test "x$ac_cv_header_tr1_unordered_set" = xyes
then :
printf "%s\n" "#define HAVE_TR1_UNORDERED_SET 1" >>confdefs.h
fi
ac_fn_cxx_check_header_compile "$LINENO" "boost/unordered_set.hpp" "ac_cv_header_boost_unordered_set_hpp" "$ac_includes_default"
if test "x$ac_cv_header_boost_unordered_set_hpp" = xyes
then :
printf "%s\n" "#define HAVE_BOOST_UNORDERED_SET_HPP 1" >>confdefs.h
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
# Checks for builtin functions
ok=no
if test $ok != yes
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking __builtin_popcount" >&5
printf %s "checking __builtin_popcount... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main (void)
{
int x = __builtin_popcount((unsigned int)(-1));
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
ok=yes;
printf "%s\n" "#define HAVE_BUILTIN_POPCOUNT 1" >>confdefs.h
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ok" >&5
printf "%s\n" "$ok" >&6; }
fi
if test $ok != yes
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking __popcnt" >&5
printf %s "checking __popcnt... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
int
main (void)
{
unsigned int x = __popcnt((unsigned int)(-1));
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
ok=yes;
printf "%s\n" "#define HAVE_POPCNT 1" >>confdefs.h
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ok" >&5
printf "%s\n" "$ok" >&6; }
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking __attribute__((noreturn))" >&5
printf %s "checking __attribute__((noreturn))... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
extern void fatal() __attribute__((noreturn));
int
main (void)
{
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
printf "%s\n" "#define NORETURN __attribute__((noreturn))" >>confdefs.h
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
else $as_nop
printf "%s\n" "#define NORETURN /**/" >>confdefs.h
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
# Check for inline
{ 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 (void) {return 0; }
$ac_kw foo_t foo (void) {return 0; }
#endif
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
ac_cv_c_inline=$ac_kw
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
test "$ac_cv_c_inline" != no && break
done
fi
{ 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) ;;
*)
case $ac_cv_c_inline in
no) ac_val=;;
*) ac_val=$ac_cv_c_inline;;
esac
cat >>confdefs.h <<_ACEOF
#ifndef __cplusplus
#define inline $ac_val
#endif
_ACEOF
;;
esac
# Sets _FILE_OFFSET_BITS if possible
# Check whether --enable-largefile was given.
if test ${enable_largefile+y}
then :
enableval=$enable_largefile;
fi
if test "$enable_largefile" != no; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5
printf %s "checking for special C compiler options needed for large files... " >&6; }
if test ${ac_cv_sys_largefile_CC+y}
then :
printf %s "(cached) " >&6
else $as_nop
ac_cv_sys_largefile_CC=no
if test "$GCC" != yes; then
ac_save_CC=$CC
while :; do
# IRIX 6.2 and later do not support large files by default,
# so use the C compiler's -n32 option if that helps.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
/* Check that off_t can represent 2**63 - 1 correctly.
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
int
main (void)
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
break
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam
CC="$CC -n32"
if ac_fn_c_try_compile "$LINENO"
then :
ac_cv_sys_largefile_CC=' -n32'; break
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam
break
done
CC=$ac_save_CC
rm -f conftest.$ac_ext
fi
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5
printf "%s\n" "$ac_cv_sys_largefile_CC" >&6; }
if test "$ac_cv_sys_largefile_CC" != no; then
CC=$CC$ac_cv_sys_largefile_CC
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5
printf %s "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
if test ${ac_cv_sys_file_offset_bits+y}
then :
printf %s "(cached) " >&6
else $as_nop
while :; do
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
/* Check that off_t can represent 2**63 - 1 correctly.
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
int
main (void)
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
ac_cv_sys_file_offset_bits=no; break
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#define _FILE_OFFSET_BITS 64
#include
/* Check that off_t can represent 2**63 - 1 correctly.
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
int
main (void)
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
ac_cv_sys_file_offset_bits=64; break
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
ac_cv_sys_file_offset_bits=unknown
break
done
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5
printf "%s\n" "$ac_cv_sys_file_offset_bits" >&6; }
case $ac_cv_sys_file_offset_bits in #(
no | unknown) ;;
*)
printf "%s\n" "#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits" >>confdefs.h
;;
esac
rm -rf conftest*
if test $ac_cv_sys_file_offset_bits = unknown; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5
printf %s "checking for _LARGE_FILES value needed for large files... " >&6; }
if test ${ac_cv_sys_large_files+y}
then :
printf %s "(cached) " >&6
else $as_nop
while :; do
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
/* Check that off_t can represent 2**63 - 1 correctly.
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
int
main (void)
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
ac_cv_sys_large_files=no; break
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#define _LARGE_FILES 1
#include
/* Check that off_t can represent 2**63 - 1 correctly.
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
int
main (void)
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
ac_cv_sys_large_files=1; break
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
ac_cv_sys_large_files=unknown
break
done
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5
printf "%s\n" "$ac_cv_sys_large_files" >&6; }
case $ac_cv_sys_large_files in #(
no | unknown) ;;
*)
printf "%s\n" "#define _LARGE_FILES $ac_cv_sys_large_files" >>confdefs.h
;;
esac
rm -rf conftest*
fi
fi
# POSIX or Windows API
# Check whether --with-api was given.
if test ${with_api+y}
then :
withval=$with_api; if test "x$withval" != xposix && test "x$withval" != xwindows
then :
{ { 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 $? "Invalid argument for API. Use --with-api=posix or --with-api=windows
See \`config.log' for more details" "$LINENO" 5; }
fi
else $as_nop
with_api=posix
fi
if test "x$with_api" = xposix
then :
print_api=POSIX
for ac_header in unistd.h
do :
ac_fn_c_check_header_compile "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default"
if test "x$ac_cv_header_unistd_h" = xyes
then :
printf "%s\n" "#define HAVE_UNISTD_H 1" >>confdefs.h
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 $? "unistd.h is not found
See \`config.log' for more details" "$LINENO" 5; }
fi
done
printf "%s\n" "#define UNIX /**/" >>confdefs.h
fi
if test "x$with_api" = xwindows
then :
print_api=Windows
for ac_header in windows.h
do :
ac_fn_c_check_header_compile "$LINENO" "windows.h" "ac_cv_header_windows_h" "$ac_includes_default"
if test "x$ac_cv_header_windows_h" = xyes
then :
printf "%s\n" "#define HAVE_WINDOWS_H 1" >>confdefs.h
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 $? "windows.h is not found
See \`config.log' for more details" "$LINENO" 5; }
fi
done
printf "%s\n" "#define WINDOWS /**/" >>confdefs.h
fi
if test "x$with_api" = xposix; then
ONUNIX_TRUE=
ONUNIX_FALSE='#'
else
ONUNIX_TRUE='#'
ONUNIX_FALSE=
fi
if test "x$with_api" = xwindows; then
ONWINDOWS_TRUE=
ONWINDOWS_FALSE='#'
else
ONWINDOWS_TRUE='#'
ONWINDOWS_FALSE=
fi
# Check for gmp
# Check whether --with-gmp was given.
if test ${with_gmp+y}
then :
withval=$with_gmp; if test "x$withval" != xyes && test "x$withval" != xno && test "x$withval" != xcheck
then :
with_gmp=yes
CPPFLAGS="$CPPFLAGS -I$withval/include"
LDFLAGS="$LDFLAGS -L$withval/lib"
fi
else $as_nop
with_gmp=check
fi
if test "x$with_gmp" != xno
then :
flag=:
if $flag
then :
ac_fn_c_check_header_compile "$LINENO" "gmp.h" "ac_cv_header_gmp_h" "$ac_includes_default"
if test "x$ac_cv_header_gmp_h" = xyes
then :
else $as_nop
flag=false
fi
fi
if $flag
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for __gmpz_init in -lgmp" >&5
printf %s "checking for __gmpz_init in -lgmp... " >&6; }
if test ${ac_cv_lib_gmp___gmpz_init+y}
then :
printf %s "(cached) " >&6
else $as_nop
ac_check_lib_save_LIBS=$LIBS
LIBS="-lgmp $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* 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. */
char __gmpz_init ();
int
main (void)
{
return __gmpz_init ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
ac_cv_lib_gmp___gmpz_init=yes
else $as_nop
ac_cv_lib_gmp___gmpz_init=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gmp___gmpz_init" >&5
printf "%s\n" "$ac_cv_lib_gmp___gmpz_init" >&6; }
if test "x$ac_cv_lib_gmp___gmpz_init" = xyes
then :
LIBS="-lgmp $LIBS"
else $as_nop
flag=false
fi
fi
if $flag
then :
printf "%s\n" "#define WITHGMP /**/" >>confdefs.h
with_gmp=yes
else $as_nop
if test "x$with_gmp" = xyes
then :
{ { 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 $? "test for GMP failed. Give --without-gmp if you want to compile without GMP
See \`config.log' for more details" "$LINENO" 5; }
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: GMP is not available" >&5
printf "%s\n" "$as_me: GMP is not available" >&6;}
with_gmp=no
fi
fi
# Check for mpfr
# Check whether --with-mpfr was given.
if test ${with_mpfr+y}
then :
withval=$with_mpfr; if test "x$withval" != xyes && test "x$withval" != xno && test "x$withval" != xcheck
then :
with_mpfr=yes
CPPFLAGS="$CPPFLAGS -I$withval/include"
LDFLAGS="$LDFLAGS -L$withval/lib"
fi
else $as_nop
with_mpfr=check
fi
if test "x$with_mpfr" != xno
then :
flag=:
if $flag
then :
ac_fn_c_check_header_compile "$LINENO" "mpfr.h" "ac_cv_header_mpfr_h" "$ac_includes_default"
if test "x$ac_cv_header_mpfr_h" = xyes
then :
else $as_nop
flag=false
fi
fi
if $flag
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for mpfr_init2 in -lmpfr" >&5
printf %s "checking for mpfr_init2 in -lmpfr... " >&6; }
if test ${ac_cv_lib_mpfr_mpfr_init2+y}
then :
printf %s "(cached) " >&6
else $as_nop
ac_check_lib_save_LIBS=$LIBS
LIBS="-lmpfr $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* 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. */
char mpfr_init2 ();
int
main (void)
{
return mpfr_init2 ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
ac_cv_lib_mpfr_mpfr_init2=yes
else $as_nop
ac_cv_lib_mpfr_mpfr_init2=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpfr_mpfr_init2" >&5
printf "%s\n" "$ac_cv_lib_mpfr_mpfr_init2" >&6; }
if test "x$ac_cv_lib_mpfr_mpfr_init2" = xyes
then :
LIBS="-lmpfr $LIBS"
else $as_nop
flag=false
fi
fi
if $flag
then :
printf "%s\n" "#define WITHMPFR /**/" >>confdefs.h
with_mpfr=yes
else $as_nop
if test "x$with_mpfr" = xyes
then :
{ { 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 $? "test for MPFR failed. Give --without-mpfr if you want to compile without MPFR
See \`config.log' for more details" "$LINENO" 5; }
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: MPFR is not available" >&5
printf "%s\n" "$as_me: MPFR is not available" >&6;}
with_mpfr=no
fi
fi
# Check for zlib
# Check whether --with-zlib was given.
if test ${with_zlib+y}
then :
withval=$with_zlib; if test "x$withval" != xyes && test "x$withval" != xno && test "x$withval" != xcheck
then :
with_zlib=yes
CPPFLAGS="$CPPFLAGS -I$withval/include"
LDFLAGS="$LDFLAGS -L$withval/lib"
fi
else $as_nop
with_zlib=check
fi
if test "x$with_zlib" != xno
then :
flag=:
if $flag
then :
ac_fn_c_check_header_compile "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default"
if test "x$ac_cv_header_zlib_h" = xyes
then :
else $as_nop
flag=false
fi
fi
if $flag
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for get_crc_table in -lz" >&5
printf %s "checking for get_crc_table in -lz... " >&6; }
if test ${ac_cv_lib_z_get_crc_table+y}
then :
printf %s "(cached) " >&6
else $as_nop
ac_check_lib_save_LIBS=$LIBS
LIBS="-lz $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* 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. */
char get_crc_table ();
int
main (void)
{
return get_crc_table ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
ac_cv_lib_z_get_crc_table=yes
else $as_nop
ac_cv_lib_z_get_crc_table=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_get_crc_table" >&5
printf "%s\n" "$ac_cv_lib_z_get_crc_table" >&6; }
if test "x$ac_cv_lib_z_get_crc_table" = xyes
then :
LIBS="-lz $LIBS"
else $as_nop
flag=false
fi
fi
if $flag
then :
printf "%s\n" "#define WITHZLIB /**/" >>confdefs.h
with_zlib=yes
else $as_nop
if test "x$with_zlib" = xyes
then :
{ { 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 $? "test for zlib failed. Give --without-zlib if you want to compile without zlib
See \`config.log' for more details" "$LINENO" 5; }
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: zlib is not available" >&5
printf "%s\n" "$as_me: zlib is not available" >&6;}
with_zlib=no
fi
fi
# Check for zstd
# Check whether --with-zstd was given.
if test ${with_zstd+y}
then :
withval=$with_zstd; if test "x$withval" != xyes && test "x$withval" != xno && test "x$withval" != xcheck
then :
with_zstd=yes
CPPFLAGS="$CPPFLAGS -I$withval/include"
LDFLAGS="$LDFLAGS -L$withval/lib"
fi
else $as_nop
with_zstd=check
fi
if test "x$with_zstd" != xno
then :
flag=:
if $flag
then :
if test "x$with_zlib" = xno
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: using zstd requires zlib" >&5
printf "%s\n" "$as_me: using zstd requires zlib" >&6;}
flag=false
fi
fi
if $flag
then :
ac_fn_c_check_header_compile "$LINENO" "zstd.h" "ac_cv_header_zstd_h" "$ac_includes_default"
if test "x$ac_cv_header_zstd_h" = xyes
then :
else $as_nop
flag=false
fi
fi
if $flag
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ZSTD_versionNumber in -lzstd" >&5
printf %s "checking for ZSTD_versionNumber in -lzstd... " >&6; }
if test ${ac_cv_lib_zstd_ZSTD_versionNumber+y}
then :
printf %s "(cached) " >&6
else $as_nop
ac_check_lib_save_LIBS=$LIBS
LIBS="-lzstd $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* 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. */
char ZSTD_versionNumber ();
int
main (void)
{
return ZSTD_versionNumber ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
ac_cv_lib_zstd_ZSTD_versionNumber=yes
else $as_nop
ac_cv_lib_zstd_ZSTD_versionNumber=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_zstd_ZSTD_versionNumber" >&5
printf "%s\n" "$ac_cv_lib_zstd_ZSTD_versionNumber" >&6; }
if test "x$ac_cv_lib_zstd_ZSTD_versionNumber" = xyes
then :
LIBS="-lzstd $LIBS"
else $as_nop
flag=false
fi
fi
if $flag
then :
printf "%s\n" "#define WITHZSTD /**/" >>confdefs.h
with_zstd=yes
else $as_nop
if test "x$with_zstd" = xyes
then :
{ { 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 $? "test for zstd failed. Give --without-zstd if you want to compile without zstd
See \`config.log' for more details" "$LINENO" 5; }
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: zstd is not available" >&5
printf "%s\n" "$as_me: zstd is not available" >&6;}
with_zstd=no
fi
fi
if test "x$with_zstd" = xyes; then
WITHZSTD_TRUE=
WITHZSTD_FALSE='#'
else
WITHZSTD_TRUE='#'
WITHZSTD_FALSE=
fi
# Ensure zstd/zlibWrapper
if test -f "$srcdir/extern/zstd/zlibWrapper/zstd_zlibwrapper.h"
then :
else $as_nop
# Extract the first word of "git", so it can be a program name with args.
set dummy git; 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_path_GIT+y}
then :
printf %s "(cached) " >&6
else $as_nop
case $GIT in
[\\/]* | ?:[\\/]*)
ac_cv_path_GIT="$GIT" # Let the user override the test with a path.
;;
*)
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_path_GIT="$as_dir$ac_word$ac_exec_ext"
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
;;
esac
fi
GIT=$ac_cv_path_GIT
if test -n "$GIT"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $GIT" >&5
printf "%s\n" "$GIT" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
if test -n "$GIT" && (cd "$srcdir" && "$GIT" rev-parse --is-inside-work-tree >/dev/null 2>&1)
then :
(cd "$srcdir" && "$GIT" submodule update --init)
fi
fi
if test -f "$srcdir/extern/zstd/zlibWrapper/zstd_zlibwrapper.h"
then :
else $as_nop
if test -e "$srcdir/.git"
then :
{ { 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 $? "$srcdir/extern/zstd/zlibWrapper does not exist. Run git submodule update --init in the repository directory
See \`config.log' for more details" "$LINENO" 5; }
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 $? "$srcdir/extern/zstd/zlibWrapper does not exist. Copy the zlibWrapper directory from upstream (https://github.com/facebook/zstd)
See \`config.log' for more details" "$LINENO" 5; }
fi
fi
# Check for flint
# Check whether --with-flint was given.
if test ${with_flint+y}
then :
withval=$with_flint; if test "x$withval" != xyes && test "x$withval" != xno && test "x$withval" != xcheck
then :
with_flint=yes
CPPFLAGS="$CPPFLAGS -I$withval/include"
LDFLAGS="$LDFLAGS -L$withval/lib"
fi
else $as_nop
with_flint=check
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
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
printf %s "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 test ${ac_cv_prog_CPP+y}
then :
printf %s "(cached) " >&6
else $as_nop
# Double quotes because $CC needs to be expanded
for CPP in "$CC -E" "$CC -E -traditional-cpp" cpp /lib/cpp
do
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.
# 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. */
#include
Syntax error
_ACEOF
if ac_fn_c_try_cpp "$LINENO"
then :
else $as_nop
# 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 $as_nop
# 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
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
printf "%s\n" "$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.
# 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. */
#include
Syntax error
_ACEOF
if ac_fn_c_try_cpp "$LINENO"
then :
else $as_nop
# 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 $as_nop
# 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_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 $? "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
if test "x$with_flint" != xno
then :
flag=:
if $flag
then :
ac_fn_c_check_header_compile "$LINENO" "flint/flint.h" "ac_cv_header_flint_flint_h" "$ac_includes_default"
if test "x$ac_cv_header_flint_flint_h" = xyes
then :
else $as_nop
flag=false
fi
fi
if $flag
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a suitable FLINT version" >&5
printf %s "checking for a suitable FLINT version... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#if __FLINT_RELEASE < 30200
#error "FLINT version must be >= 3.2.0: https://github.com/form-dev/form/issues/679"
#endif
_ACEOF
if ac_fn_c_try_cpp "$LINENO"
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
else $as_nop
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: FLINT version 3.2.0 or higher is required" >&5
printf "%s\n" "$as_me: FLINT version 3.2.0 or higher is required" >&6;}
flag=false
fi
rm -f conftest.err conftest.i conftest.$ac_ext
fi
if $flag
then :
# Check how to link against the math library.
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing pow" >&5
printf %s "checking for library containing pow... " >&6; }
if test ${ac_cv_search_pow+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. */
/* 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. */
char pow ();
int
main (void)
{
return pow ();
;
return 0;
}
_ACEOF
for ac_lib in '' m
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 :
ac_cv_search_pow=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext
if test ${ac_cv_search_pow+y}
then :
break
fi
done
if test ${ac_cv_search_pow+y}
then :
else $as_nop
ac_cv_search_pow=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_pow" >&5
printf "%s\n" "$ac_cv_search_pow" >&6; }
ac_res=$ac_cv_search_pow
if test "$ac_res" != no
then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
fi
if test "x$ac_cv_search_pow" = "xno"
then :
flag=false
else $as_nop
if test "x$ac_cv_search_pow" = "xnone required"
then :
MATH_LIBS=""
else $as_nop
MATH_LIBS="$ac_cv_search_pow"
fi
fi
fi
if $flag
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fmpz_mpoly_init in -lflint" >&5
printf %s "checking for fmpz_mpoly_init in -lflint... " >&6; }
if test ${ac_cv_lib_flint_fmpz_mpoly_init+y}
then :
printf %s "(cached) " >&6
else $as_nop
ac_check_lib_save_LIBS=$LIBS
LIBS="-lflint $MATH_LIBS $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* 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. */
char fmpz_mpoly_init ();
int
main (void)
{
return fmpz_mpoly_init ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
ac_cv_lib_flint_fmpz_mpoly_init=yes
else $as_nop
ac_cv_lib_flint_fmpz_mpoly_init=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_flint_fmpz_mpoly_init" >&5
printf "%s\n" "$ac_cv_lib_flint_fmpz_mpoly_init" >&6; }
if test "x$ac_cv_lib_flint_fmpz_mpoly_init" = xyes
then :
LIBS="-lflint $MATH_LIBS $LIBS"
else $as_nop
flag=false
fi
fi
if $flag
then :
printf "%s\n" "#define WITHFLINT /**/" >>confdefs.h
with_flint=yes
else $as_nop
if test "x$with_flint" = xyes
then :
{ { 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 $? "test for flint failed. Give --without-flint if you want to compile without flint
See \`config.log' for more details" "$LINENO" 5; }
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: flint is not available" >&5
printf "%s\n" "$as_me: flint is not available" >&6;}
with_flint=no
fi
fi
if test "x$with_flint" = xyes; then
WITHFLINT_TRUE=
WITHFLINT_FALSE='#'
else
WITHFLINT_TRUE='#'
WITHFLINT_FALSE=
fi
# enable-scalar/threaded/parform/debug/float
# Check whether --enable-scalar was given.
if test ${enable_scalar+y}
then :
enableval=$enable_scalar; if test "x$enableval" != xno
then :
enable_scalar=yes
fi
else $as_nop
enable_scalar=yes
fi
# Check whether --enable-threaded was given.
if test ${enable_threaded+y}
then :
enableval=$enable_threaded; if test "x$enableval" != xno && test "x$enableval" != xcheck
then :
enable_threaded=yes
fi
else $as_nop
enable_threaded=check
fi
# Check whether --enable-parform was given.
if test ${enable_parform+y}
then :
enableval=$enable_parform; if test "x$enableval" != xno && test "x$enableval" != xcheck
then :
enable_parform=yes
fi
else $as_nop
enable_parform=no
fi
# Check whether --enable-debug was given.
if test ${enable_debug+y}
then :
enableval=$enable_debug; if test "x$enableval" != xno
then :
enable_debug=yes
fi
else $as_nop
enable_debug=no
fi
# Check whether --enable-float was given.
if test ${enable_float+y}
then :
enableval=$enable_float; if test "x$enableval" != xno && test "x$enableval" != xcheck
then :
enable_float=yes
fi
else $as_nop
enable_float=yes
fi
# Check for scalar version
build_form=$enable_scalar
if test "x$enable_scalar" = xyes && test "x$enable_debug" = xyes
then :
build_vorm=yes
else $as_nop
build_vorm=no
fi
if test "x$build_form" = xyes; then
BUILD_FORM_TRUE=
BUILD_FORM_FALSE='#'
else
BUILD_FORM_TRUE='#'
BUILD_FORM_FALSE=
fi
if test "x$build_vorm" = xyes; then
BUILD_VORM_TRUE=
BUILD_VORM_FALSE='#'
else
BUILD_VORM_TRUE='#'
BUILD_VORM_FALSE=
fi
# Check for threaded version
PTHREAD_CFLAGS=
PTHREAD_CPPFLAGS=
PTHREAD_LIBS=
thread_clock_ok=no
if test "x$enable_threaded" != xno
then :
flag=:
# Check the flag/library for pthreads
if $flag
then :
ok=no
# none : Cygwin
# -pthread : Linux/gcc (kernel threads), BSD/gcc (userland threads)
# pthread : Linux, OSX
for a in -pthread none pthread; do
case $a in
none)
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether pthreads works without any flags" >&5
printf %s "checking whether pthreads works without any flags... " >&6; }
;;
-*)
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether pthreads works with $a" >&5
printf %s "checking whether pthreads works with $a... " >&6; }
PTHREAD_CFLAGS="$a"
;;
*)
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$a" >&5
printf %s "checking for the pthreads library -l$a... " >&6; }
PTHREAD_LIBS="-l$a"
;;
esac
save_CFLAGS=$CFLAGS
save_LIBS=$LIBS
CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
static void *start_routine(void *a) { return a; }
int
main (void)
{
pthread_t th;
pthread_condattr_t attr;
pthread_create(&th, 0, start_routine, 0);
pthread_condattr_setpshared(&attr, PTHREAD_PROCESS_PRIVATE);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
ok=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
CFLAGS=$save_CFLAGS
LIBS=$save_LIBS
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ok" >&5
printf "%s\n" "$ok" >&6; }
test "x$ok" = xyes && break
PTHREAD_CFLAGS=
PTHREAD_LIBS=
done
test "x$ok" = xno && flag=false
fi
# Check pthread_rwlock_t
if $flag
then :
ok=no
# -D_XOPEN_SOURCE=500: Scientific Linux 4.8
for a in none -D_XOPEN_SOURCE=500; do
case $a in
none)
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_rwlock_t" >&5
printf %s "checking for pthread_rwlock_t... " >&6; }
;;
-D*)
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_rwlock_t with $a" >&5
printf %s "checking for pthread_rwlock_t with $a... " >&6; }
PTHREAD_CPPFLAGS="$a"
;;
esac
save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$PTHREAD_CPPFLAGS $CPPFLAGS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
pthread_rwlock_t rwlock = PTHREAD_RWLOCK_INITIALIZER;
int
main (void)
{
while (pthread_rwlock_tryrdlock(&rwlock) == EBUSY) {}
pthread_rwlock_unlock(&rwlock);
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
ok=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
CPPFLAGS=$save_CPPFLAGS
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ok" >&5
printf "%s\n" "$ok" >&6; }
test "x$ok" = xyes && break
PTHREAD_CPPFLAGS=
done
test "x$ok" = xno && flag=false
fi
# Check clock_gettime with CLOCK_THREAD_CPUTIME_ID
if $flag && test "x$with_api" = xposix
then :
ok=yes
if test "x$ok" = xyes
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for the POSIX thread clock" >&5
printf %s "checking for the POSIX thread clock... " >&6; }
save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$PTHREAD_CPPFLAGS $CPPFLAGS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
int
main (void)
{
struct timespec t;
clock_gettime(CLOCK_THREAD_CPUTIME_ID, &t);
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
else $as_nop
ok=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
CPPFLAGS=$save_CPPFLAGS
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ok" >&5
printf "%s\n" "$ok" >&6; }
fi
if test "x$ok" = xyes
then :
save_LIBS=$LIBS
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5
printf %s "checking for library containing clock_gettime... " >&6; }
if test ${ac_cv_search_clock_gettime+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. */
/* 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. */
char clock_gettime ();
int
main (void)
{
return clock_gettime ();
;
return 0;
}
_ACEOF
for ac_lib in '' rt
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 :
ac_cv_search_clock_gettime=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext
if test ${ac_cv_search_clock_gettime+y}
then :
break
fi
done
if test ${ac_cv_search_clock_gettime+y}
then :
else $as_nop
ac_cv_search_clock_gettime=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5
printf "%s\n" "$ac_cv_search_clock_gettime" >&6; }
ac_res=$ac_cv_search_clock_gettime
if test "$ac_res" != no
then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
else $as_nop
ok=no
fi
LIBS=$save_LIBS
if test "x$ac_cv_search_clock_gettime" != "xnone required" && test "x$ac_cv_search_clock_gettime" != "xno"; then
PTHREAD_LIBS="$ac_cv_search_clock_gettime $PTHREAD_LIBS"
fi
fi
if test "x$ok" = xyes
then :
cat >>confdefs.h <&5
printf "%s\n" "$as_me: WARNING: POSIX thread clock is not available." >&2;}
fi
fi
# Windows has GetThreadTimes().
$flag && test "x$with_api" = xwindows && thread_clock_ok=yes
if $flag
then :
enable_threaded=yes
else $as_nop
if test "x$enable_threaded" = xyes
then :
{ { 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 $? "test for tform failed. Give --disable-threaded if you do not need to build tform
See \`config.log' for more details" "$LINENO" 5; }
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: building tform has been disabled" >&5
printf "%s\n" "$as_me: building tform has been disabled" >&6;}
if test "x$enable_debug" = xyes
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: building tvorm has been disabled" >&5
printf "%s\n" "$as_me: building tvorm has been disabled" >&6;}
fi
enable_threaded=no
fi
fi
build_tform=$enable_threaded
if test "x$enable_threaded" = xyes && test "x$enable_debug" = xyes
then :
build_tvorm=yes
else $as_nop
build_tvorm=no
fi
if test "x$build_tform" = xyes; then
BUILD_TFORM_TRUE=
BUILD_TFORM_FALSE='#'
else
BUILD_TFORM_TRUE='#'
BUILD_TFORM_FALSE=
fi
if test "x$build_tvorm" = xyes; then
BUILD_TVORM_TRUE=
BUILD_TVORM_FALSE='#'
else
BUILD_TVORM_TRUE='#'
BUILD_TVORM_FALSE=
fi
# AX_PROG_MPICC
# -------------
# AX_PROG_MPICXX
# --------------
# _AX_CHECK_MPI(compiler, output-var-prefix)
# ------------------------------------------
# Check for MPI version
if test "x$enable_parform" != xno
then :
flag=:
if $flag
then :
if test "x$MPICC" != x
then :
for ac_prog in $MPICC
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; 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_MPICC+y}
then :
printf %s "(cached) " >&6
else $as_nop
if test -n "$MPICC"; then
ac_cv_prog_MPICC="$MPICC" # 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_MPICC="$ac_prog"
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
MPICC=$ac_cv_prog_MPICC
if test -n "$MPICC"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MPICC" >&5
printf "%s\n" "$MPICC" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
test -n "$MPICC" && break
done
else $as_nop
for ac_prog in mpicc hcc mpxlc_r mpxlc mpcc cmpicc
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; 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_MPICC+y}
then :
printf %s "(cached) " >&6
else $as_nop
if test -n "$MPICC"; then
ac_cv_prog_MPICC="$MPICC" # 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_MPICC="$ac_prog"
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
MPICC=$ac_cv_prog_MPICC
if test -n "$MPICC"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MPICC" >&5
printf "%s\n" "$MPICC" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
test -n "$MPICC" && break
done
test -n "$MPICC" || MPICC="$CC"
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
save_CC=$CC
CC=$MPICC
# Check whether MPI works or not.
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether MPI works with $MPICC" >&5
printf %s "checking whether MPI works with $MPICC... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
int main(int argc, char **argv) {
int rank, size;
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Finalize();
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
# Find a flag for showing the compile and link lines.
ax_ok=false
for ax_show in -show -showme -compile-info; do
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $MPICC accepts $ax_show" >&5
printf %s "checking whether $MPICC accepts $ax_show... " >&6; }
ax_mpi_cmdline=`$MPICC $ax_show 2>/dev/null`
if test $? -eq 0
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
ax_ok=:
break
else $as_nop
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
done
if $ax_ok
then :
else $as_nop
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Cannot extract compiler and linker flags from $MPICC" >&5
printf "%s\n" "$as_me: WARNING: Cannot extract compiler and linker flags from $MPICC" >&2;}
fi
# Extract the compile and link flags.
ax_mpi_cflags=
ax_mpi_cppflags=
ax_mpi_ldflags=
ax_mpi_libs=
ax_first=:
for ax_opt in $ax_mpi_cmdline; do
case $ax_opt in
-I*|-D*)
ax_mpi_cppflags="$ax_mpi_cppflags $ax_opt"
;;
-L*|-Wl,*)
ax_mpi_ldflags="$ax_mpi_ldflags $ax_opt"
;;
-l*)
ax_mpi_libs="$ax_mpi_libs $ax_opt"
;;
*)
$ax_first || ax_mpi_cflags="$ax_mpi_cflags $ax_opt"
;;
esac
ax_first=false
done
MPI_CFLAGS=` echo "$ax_mpi_cflags" | sed 's/^ *//;s/ *$//;s/ */ /g'`
MPI_CPPFLAGS=`echo "$ax_mpi_cppflags" | sed 's/^ *//;s/ *$//;s/ */ /g'`
MPI_CLDFLAGS=`echo "$ax_mpi_ldflags" | sed 's/^ *//;s/ *$//;s/ */ /g'`
MPI_CLIBS=` echo "$ax_mpi_libs" | sed 's/^ *//;s/ *$//;s/ */ /g'`
else $as_nop
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
MPICC=
MPI_CFLAGS=
MPI_CLDFLAGS=
MPI_CLIBS=
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
CC=$save_CC
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
if test "x$MPICC" = x
then :
flag=false
fi
fi
if $flag
then :
if test "x$MPICXX" != x
then :
for ac_prog in $MPICXX
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; 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_MPICXX+y}
then :
printf %s "(cached) " >&6
else $as_nop
if test -n "$MPICXX"; then
ac_cv_prog_MPICXX="$MPICXX" # 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_MPICXX="$ac_prog"
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
MPICXX=$ac_cv_prog_MPICXX
if test -n "$MPICXX"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MPICXX" >&5
printf "%s\n" "$MPICXX" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
test -n "$MPICXX" && break
done
else $as_nop
for ac_prog in mpic++ mpicxx mpiCC hcp mpxlC_r mpxlC mpCC cmpic++
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; 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_MPICXX+y}
then :
printf %s "(cached) " >&6
else $as_nop
if test -n "$MPICXX"; then
ac_cv_prog_MPICXX="$MPICXX" # 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_MPICXX="$ac_prog"
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
MPICXX=$ac_cv_prog_MPICXX
if test -n "$MPICXX"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MPICXX" >&5
printf "%s\n" "$MPICXX" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
test -n "$MPICXX" && break
done
test -n "$MPICXX" || MPICXX="$CXX"
fi
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
save_CXX=$CXX
CXX=$MPICXX
# Check whether MPI works or not.
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether MPI works with $MPICXX" >&5
printf %s "checking whether MPI works with $MPICXX... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
int main(int argc, char **argv) {
int rank, size;
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Finalize();
return 0;
}
_ACEOF
if ac_fn_cxx_try_link "$LINENO"
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
# Find a flag for showing the compile and link lines.
ax_ok=false
for ax_show in -show -showme -compile-info; do
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $MPICXX accepts $ax_show" >&5
printf %s "checking whether $MPICXX accepts $ax_show... " >&6; }
ax_mpi_cmdline=`$MPICXX $ax_show 2>/dev/null`
if test $? -eq 0
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
ax_ok=:
break
else $as_nop
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
done
if $ax_ok
then :
else $as_nop
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Cannot extract compiler and linker flags from $MPICXX" >&5
printf "%s\n" "$as_me: WARNING: Cannot extract compiler and linker flags from $MPICXX" >&2;}
fi
# Extract the compile and link flags.
ax_mpi_cflags=
ax_mpi_cppflags=
ax_mpi_ldflags=
ax_mpi_libs=
ax_first=:
for ax_opt in $ax_mpi_cmdline; do
case $ax_opt in
-I*|-D*)
ax_mpi_cppflags="$ax_mpi_cppflags $ax_opt"
;;
-L*|-Wl,*)
ax_mpi_ldflags="$ax_mpi_ldflags $ax_opt"
;;
-l*)
ax_mpi_libs="$ax_mpi_libs $ax_opt"
;;
*)
$ax_first || ax_mpi_cflags="$ax_mpi_cflags $ax_opt"
;;
esac
ax_first=false
done
MPI_CXXFLAGS=` echo "$ax_mpi_cflags" | sed 's/^ *//;s/ *$//;s/ */ /g'`
MPI_CXXPPFLAGS=`echo "$ax_mpi_cppflags" | sed 's/^ *//;s/ *$//;s/ */ /g'`
MPI_CXXLDFLAGS=`echo "$ax_mpi_ldflags" | sed 's/^ *//;s/ *$//;s/ */ /g'`
MPI_CXXLIBS=` echo "$ax_mpi_libs" | sed 's/^ *//;s/ *$//;s/ */ /g'`
else $as_nop
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
MPICXX=
MPI_CXXFLAGS=
MPI_CXXLDFLAGS=
MPI_CXXLIBS=
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
CXX=$save_CXX
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
if test "x$MPICXX" = x
then :
flag=false
fi
fi
if $flag
then :
enable_parform=yes
else $as_nop
if test "x$enable_parform" = xyes
then :
{ { 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 $? "test for parform failed. Give --disable-parform if you do not need to build parform
See \`config.log' for more details" "$LINENO" 5; }
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: building parform has been disabled" >&5
printf "%s\n" "$as_me: building parform has been disabled" >&6;}
if test "x$enable_debug" = xyes
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: building parvorm has been disabled" >&5
printf "%s\n" "$as_me: building parvorm has been disabled" >&6;}
fi
enable_parform=no
fi
fi
build_parform=$enable_parform
if test "x$enable_parform" = xyes && test "x$enable_debug" = xyes
then :
build_parvorm=yes
else $as_nop
build_parvorm=no
fi
if test "x$build_parform" = xyes; then
BUILD_PARFORM_TRUE=
BUILD_PARFORM_FALSE='#'
else
BUILD_PARFORM_TRUE='#'
BUILD_PARFORM_FALSE=
fi
if test "x$build_parvorm" = xyes; then
BUILD_PARVORM_TRUE=
BUILD_PARVORM_FALSE='#'
else
BUILD_PARVORM_TRUE='#'
BUILD_PARVORM_FALSE=
fi
if test "x$MPICXX" != x && test "x$cxxstd_flag" != x; then
MPICXX="$MPICXX $cxxstd_flag"
fi
if test "x$build_form" = xyes || test "x$build_tform" = xyes || test "x$build_parform" = xyes ||
test "x$build_vorm" = xyes || test "x$build_tvorm" = xyes || test "x$build_parvorm" = xyes
then :
build_any=yes
else $as_nop
build_any=no
fi
# Check for float
if test "x$enable_float" != xno
then :
if test "x$with_gmp" = xyes && test "x$with_mpfr" = xyes
then :
enable_float=yes
else $as_nop
if test "x$enable_float" = xyes && test "x$build_any" = xyes
then :
{ { 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 $? "test for the float feature failed. It requires both GMP and MPFR. Give --disable-float if you want to build without the float feature.
See \`config.log' for more details" "$LINENO" 5; }
fi
enable_float=no
fi
fi
if test "x$enable_float" = xyes
then :
printf "%s\n" "#define WITHFLOAT /**/" >>confdefs.h
else $as_nop
if test "x$with_mpfr" = xyes
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: mpfr is not required without the float feature." >&5
printf "%s\n" "$as_me: WARNING: mpfr is not required without the float feature." >&2;}
fi
fi
if test "x$enable_float" = xyes; then
WITHFLOAT_TRUE=
WITHFLOAT_FALSE='#'
else
WITHFLOAT_TRUE='#'
WITHFLOAT_FALSE=
fi
# Check for wall-clock time
ok=no
if test $ok != yes
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5
printf %s "checking for library containing clock_gettime... " >&6; }
if test ${ac_cv_search_clock_gettime+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. */
/* 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. */
char clock_gettime ();
int
main (void)
{
return clock_gettime ();
;
return 0;
}
_ACEOF
for ac_lib in '' rt
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 :
ac_cv_search_clock_gettime=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext
if test ${ac_cv_search_clock_gettime+y}
then :
break
fi
done
if test ${ac_cv_search_clock_gettime+y}
then :
else $as_nop
ac_cv_search_clock_gettime=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5
printf "%s\n" "$ac_cv_search_clock_gettime" >&6; }
ac_res=$ac_cv_search_clock_gettime
if test "$ac_res" != no
then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
printf "%s\n" "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h
ok=yes
fi
fi
if test $ok != yes
then :
# TODO: gettimeofday is also deprecated.
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing gettimeofday" >&5
printf %s "checking for library containing gettimeofday... " >&6; }
if test ${ac_cv_search_gettimeofday+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. */
/* 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. */
char gettimeofday ();
int
main (void)
{
return gettimeofday ();
;
return 0;
}
_ACEOF
for ac_lib in ''
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 :
ac_cv_search_gettimeofday=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext
if test ${ac_cv_search_gettimeofday+y}
then :
break
fi
done
if test ${ac_cv_search_gettimeofday+y}
then :
else $as_nop
ac_cv_search_gettimeofday=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gettimeofday" >&5
printf "%s\n" "$ac_cv_search_gettimeofday" >&6; }
ac_res=$ac_cv_search_gettimeofday
if test "$ac_res" != no
then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
printf "%s\n" "#define HAVE_GETTIMEOFDAY 1" >>confdefs.h
ok=yes
fi
fi
if test $ok != yes
then :
# Fallback: ftime. Available also on Windows. Some BSDs require -lcompat.
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing ftime" >&5
printf %s "checking for library containing ftime... " >&6; }
if test ${ac_cv_search_ftime+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. */
/* 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. */
char ftime ();
int
main (void)
{
return ftime ();
;
return 0;
}
_ACEOF
for ac_lib in '' compat
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 :
ac_cv_search_ftime=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext
if test ${ac_cv_search_ftime+y}
then :
break
fi
done
if test ${ac_cv_search_ftime+y}
then :
else $as_nop
ac_cv_search_ftime=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_ftime" >&5
printf "%s\n" "$ac_cv_search_ftime" >&6; }
ac_res=$ac_cv_search_ftime
if test "$ac_res" != no
then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
printf "%s\n" "#define HAVE_FTIME 1" >>confdefs.h
ok=yes
fi
fi
if test $ok != yes
then :
{ { 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 $? "Wall-clock time not available
See \`config.log' for more details" "$LINENO" 5; }
fi
# Check for static linking
STATIC_LDFLAGS=
MPI_STATIC_LDFLAGS=
# Check whether --enable-static-link was given.
if test ${enable_static_link+y}
then :
enableval=$enable_static_link; if test "x$enableval" != xno && test "x$enableval" != xcheck
then :
enable_static_link=yes
fi
else $as_nop
enable_static_link=no
fi
if test "x$enable_static_link" != xno
then :
flag=:
if test "x$vendor" = xgnu; then
static_list='-static -static-libgcc,-static-libstdc++ -static-libgcc'
elif test "x$vendor" = xintel; then
static_list='-static -static-libgcc,-static-intel -static-intel -static-libgcc'
else
static_list='-static -static-libgcc'
fi
for a in $static_list; do
a=`echo $a | sed 's/,/ /g'`
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for static linking with $CXX $a" >&5
printf %s "checking for static linking with $CXX $a... " >&6; }
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
save_CFLAGS=$CFLAGS
save_LDFLAGS=$LDFLAGS
save_LIBS=$LIBS
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
LDFLAGS="$LDFLAGS $a"
LIBS="$PTHREAD_LIBS $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main (void)
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_link "$LINENO"
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }; STATIC_LDFLAGS=$a
else $as_nop
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }; flag=false
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
CFLAGS=$save_CFLAGS
LDFLAGS=$save_LDFLAGS
LIBS=$save_LIBS
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
test "x$STATIC_LDFLAGS" != x && break
done
if test "x$enable_parform" = xyes
then :
for a in $static_list; do
a=`echo $a | sed 's/,/ /g'`
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for static linking with $MPICXX $a" >&5
printf %s "checking for static linking with $MPICXX $a... " >&6; }
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
save_CXX=$CXX
save_LDFLAGS=$LDFLAGS
CXX=$MPICXX
LDFLAGS="$LDFLAGS $a"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main (void)
{
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_link "$LINENO"
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }; MPI_STATIC_LDFLAGS=$a
else $as_nop
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }; flag=false
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
CXX=$save_CXX
LDFLAGS=$save_LDFLAGS
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
test "x$MPI_STATIC_LDFLAGS" != x && break
done
fi
if $flag
then :
enable_static_link=yes
else $as_nop
if test "x$enable_static_link" = xyes
then :
{ { 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 $? "test for static linking failed. Give --disable-static-link if you want to build without static libraries.
See \`config.log' for more details" "$LINENO" 5; }
fi
if test "x$STATIC_LDFLAGS" = x && test "x$MPI_STATIC_LDFLAGS" = x
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: static linking has been disabled" >&5
printf "%s\n" "$as_me: static linking has been disabled" >&6;}
else $as_nop
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: static linking has been partially disabled" >&5
printf "%s\n" "$as_me: static linking has been partially disabled" >&6;}
fi
enable_static_link=no
fi
fi
# Check for native/universal build
# Check whether --enable-native was given.
if test ${enable_native+y}
then :
enableval=$enable_native; if test "x$enableval" = xno || test "x$cross_compiling" = xyes
then :
enable_native=no
else $as_nop
enable_native=yes
fi
else $as_nop
enable_native=no
fi
# Check for profiling option
# Check whether --enable-profile was given.
if test ${enable_profile+y}
then :
enableval=$enable_profile; if test "x$enableval" = xyes
then :
enable_profile=gprof
else $as_nop
if test "x$enableval" = xgprof || test "x$enableval" = xgperftools
then :
enable_profile=$enableval
else $as_nop
enable_profile=no
fi
fi
else $as_nop
enable_profile=no
fi
# Check for coverage option
# Check whether --enable-coverage was given.
if test ${enable_coverage+y}
then :
enableval=$enable_coverage; if test "x$enableval" = xyes && test "x$enable_debug" = xyes
then :
enable_coverage=yes
else $as_nop
enable_coverage=no
fi
else $as_nop
enable_coverage=no
fi
# Check for sanitizers
# Check whether --enable-sanitize was given.
if test ${enable_sanitize+y}
then :
enableval=$enable_sanitize; if test "x$enable_debug" != xyes
then :
enable_sanitize=no
fi
else $as_nop
enable_sanitize=no
fi
# Check for extra compiler warnings
# Check whether --enable-extra-warning was given.
if test ${enable_extra_warning+y}
then :
enableval=$enable_extra_warning;
else $as_nop
enable_extra_warning=no
fi
# Check for backtrace (requires glibc):
# Check whether --enable-backtrace was given.
if test ${enable_backtrace+y}
then :
enableval=$enable_backtrace; if test "x$enableval" = xyes
then :
enable_backtrace=yes
elif test "x$enableval" = xno
then :
enable_backtrace=no
else $as_nop
enable_backtrace=no
fi
else $as_nop
enable_backtrace=no
fi
if test "x$enable_backtrace" != xno
then :
flag=:
if $flag
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing backtrace" >&5
printf %s "checking for library containing backtrace... " >&6; }
if test ${ac_cv_search_backtrace+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. */
/* 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. */
char backtrace ();
int
main (void)
{
return backtrace ();
;
return 0;
}
_ACEOF
for ac_lib in '' c
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 :
ac_cv_search_backtrace=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext
if test ${ac_cv_search_backtrace+y}
then :
break
fi
done
if test ${ac_cv_search_backtrace+y}
then :
else $as_nop
ac_cv_search_backtrace=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_backtrace" >&5
printf "%s\n" "$ac_cv_search_backtrace" >&6; }
ac_res=$ac_cv_search_backtrace
if test "$ac_res" != no
then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
else $as_nop
flag=false
fi
fi
if $flag
then :
for ac_header in execinfo.h
do :
ac_fn_c_check_header_compile "$LINENO" "execinfo.h" "ac_cv_header_execinfo_h" "$ac_includes_default"
if test "x$ac_cv_header_execinfo_h" = xyes
then :
printf "%s\n" "#define HAVE_EXECINFO_H 1" >>confdefs.h
else $as_nop
flag=false
fi
done
fi
if $flag
then :
printf "%s\n" "#define ENABLE_BACKTRACE /**/" >>confdefs.h
enable_backtrace=yes
else $as_nop
if test "x$enable_backtrace" = xyes
then :
{ { 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 $? "test for backtrace failed. Give --disable-backtrace if you want to compile without backtrace.
See \`config.log' for more details" "$LINENO" 5; }
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: backtrace is not available" >&5
printf "%s\n" "$as_me: backtrace is not available" >&6;}
enable_backtrace=no
fi
fi
# Optimization/debugging flags
TOOL_LIBS=
DEBUGTOOL_LIBS=
# AX_HANDLE_EXTRA_WARNING(COMPILEFLAGS)
# -------------------------------------
my_test_COMPILEFLAGS=${COMPILEFLAGS+set}
if test "$my_test_COMPILEFLAGS" != set; then
if test "x$vendor" = xgnu; then
COMPILEFLAGS="-Wall -Wextra"
if test "x$enable_extra_warning" != xyes; then
# Currently no warnings are disabled without --enable-extra-warning
COMPILEFLAGS="$COMPILEFLAGS"
fi
# Enable optimizations.
COMPILEFLAGS="$COMPILEFLAGS -O3"
if test "x$enable_backtrace" = xyes; then
# Keep symbols and frame pointers for easier debugging.
COMPILEFLAGS="$COMPILEFLAGS -g -fno-omit-frame-pointer"
fi
if test "x$enable_native" = xyes; then
# Use -march=native if available.
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -march=native" >&5
printf %s "checking whether C compiler accepts -march=native... " >&6; }
if test ${ax_cv_check_cflags__Werror__march_native+y}
then :
printf %s "(cached) " >&6
else $as_nop
ax_check_save_flags=$CFLAGS
CFLAGS="$CFLAGS -Werror -march=native"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main (void)
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
ax_cv_check_cflags__Werror__march_native=yes
else $as_nop
ax_cv_check_cflags__Werror__march_native=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
CFLAGS=$ax_check_save_flags
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror__march_native" >&5
printf "%s\n" "$ax_cv_check_cflags__Werror__march_native" >&6; }
if test x"$ax_cv_check_cflags__Werror__march_native" = xyes
then :
COMPILEFLAGS="$COMPILEFLAGS -march=native"
else $as_nop
:
fi
fi
# Profiling option.
if test "x$enable_profile" = xgprof; then
COMPILEFLAGS="$COMPILEFLAGS -g -pg"
elif test "x$enable_profile" = xgperftools; then
COMPILEFLAGS="$COMPILEFLAGS -g"
TOOL_LIBS="$TOOL_LIBS -lprofiler"
fi
elif test "x$vendor" = xintel; then
# NOTE: -fast option includes -static and may cause an error in linking.
COMPILEFLAGS="-Wall -ipo -O3 -no-prec-div"
if test "x$enable_native" = xyes; then
COMPILEFLAGS="$COMPILEFLAGS -xHost"
fi
if test "x$enable_profile" != xno; then
enable_profile=unavailable
fi
else
COMPILEFLAGS=-O2
if test "x$enable_profile" != xno; then
enable_profile=unavailable
fi
fi
fi
my_test_LINKFLAGS=${LINKFLAGS+set}
if test "$my_test_LINKFLAGS" != set; then
LINKFLAGS=""
if test "x$enable_backtrace" = xyes; then
# For easier debugging
LINKFLAGS="$LINKFLAGS -rdynamic"
fi
if test "x$vendor" = xgnu && test "x$print_os" = xOSX; then
# On OS X Mavericks, -s option has a funny effect: though the linker
# warns the option is obsolete and being ignored, it causes an internal
# error "atom not found in symbolIndex...".
LINKFLAGS="$LINKFLAGS"
elif test "x$enable_profile" != xno && test "x$enable_profile" != xunavailable; then
# Profilers needs symbol tables.
LINKFLAGS="$LINKFLAGS"
else
LINKFLAGS="$LINKFLAGS"
fi
fi
my_test_DEBUGCOMPILEFLAGS=${DEBUGCOMPILEFLAGS+set}
if test "$my_test_DEBUGCOMPILEFLAGS" != set && test "x$enable_debug" = xyes; then
if test "x$vendor" = xgnu; then
DEBUGCOMPILEFLAGS='-Wall -Wextra'
if test "x$enable_sanitize" = xno; then
# UBSan puts many paddings (at least in gcc 5.3).
#
# Unfortunately gmp.h and mpfr.h give padding warnings.
# We leave those out. (JV 5-apr-2023)
#
# DEBUGCOMPILEFLAGS="$DEBUGCOMPILEFLAGS -Wpadded"
DEBUGCOMPILEFLAGS="$DEBUGCOMPILEFLAGS"
fi
if test "x$enable_extra_warning" != xyes; then
# Currently no warnings are disabled without --enable-extra-warning
DEBUGCOMPILEFLAGS="$DEBUGCOMPILEFLAGS"
fi
# Check for -Og. If it doesn't work then use -O0.
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Og" >&5
printf %s "checking whether C compiler accepts -Og... " >&6; }
if test ${ax_cv_check_cflags__Werror__Og+y}
then :
printf %s "(cached) " >&6
else $as_nop
ax_check_save_flags=$CFLAGS
CFLAGS="$CFLAGS -Werror -Og"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main (void)
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
ax_cv_check_cflags__Werror__Og=yes
else $as_nop
ax_cv_check_cflags__Werror__Og=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
CFLAGS=$ax_check_save_flags
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror__Og" >&5
printf "%s\n" "$ax_cv_check_cflags__Werror__Og" >&6; }
if test x"$ax_cv_check_cflags__Werror__Og" = xyes
then :
DEBUGCOMPILEFLAGS="$DEBUGCOMPILEFLAGS -Og"
else $as_nop
DEBUGCOMPILEFLAGS="$DEBUGCOMPILEFLAGS -O0"
fi
# Debugging information.
DEBUGCOMPILEFLAGS="$DEBUGCOMPILEFLAGS -g3 -fno-omit-frame-pointer"
# Coverage option.
if test "x$enable_coverage" = xyes; then
DEBUGCOMPILEFLAGS="$DEBUGCOMPILEFLAGS -coverage"
fi
# Sanitizer option.
if test "x$enable_sanitize" = xyes; then
enable_sanitize=
for san in address undefined; do
if test "x$enable_sanitize" = x; then
tmp_sanitize=$san
else
tmp_sanitize=$enable_sanitize,$san
fi
as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags_-Werror_-fsanitize=$tmp_sanitize" | $as_tr_sh`
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fsanitize=$tmp_sanitize" >&5
printf %s "checking whether C compiler accepts -fsanitize=$tmp_sanitize... " >&6; }
if eval test \${$as_CACHEVAR+y}
then :
printf %s "(cached) " >&6
else $as_nop
ax_check_save_flags=$CFLAGS
CFLAGS="$CFLAGS -Werror -fsanitize=$tmp_sanitize"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main (void)
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
eval "$as_CACHEVAR=yes"
else $as_nop
eval "$as_CACHEVAR=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
CFLAGS=$ax_check_save_flags
fi
eval ac_res=\$$as_CACHEVAR
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
printf "%s\n" "$ac_res" >&6; }
if test x"`eval 'as_val=${'$as_CACHEVAR'};printf "%s\n" "$as_val"'`" = xyes
then :
enable_sanitize=$tmp_sanitize
else $as_nop
:
fi
done
if test "x$enable_sanitize" = x; then
enable_sanitize=failed
fi
elif test "x$enable_sanitize" != xno; then
as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags_-Werror_-fsanitize=$enable_sanitize" | $as_tr_sh`
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fsanitize=$enable_sanitize" >&5
printf %s "checking whether C compiler accepts -fsanitize=$enable_sanitize... " >&6; }
if eval test \${$as_CACHEVAR+y}
then :
printf %s "(cached) " >&6
else $as_nop
ax_check_save_flags=$CFLAGS
CFLAGS="$CFLAGS -Werror -fsanitize=$enable_sanitize"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main (void)
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
eval "$as_CACHEVAR=yes"
else $as_nop
eval "$as_CACHEVAR=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
CFLAGS=$ax_check_save_flags
fi
eval ac_res=\$$as_CACHEVAR
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
printf "%s\n" "$ac_res" >&6; }
if test x"`eval 'as_val=${'$as_CACHEVAR'};printf "%s\n" "$as_val"'`" = xyes
then :
:
else $as_nop
enable_sanitize=failed
fi
fi
if test "x$enable_sanitize" = xfailed; then
{ { 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 $? "test for sanitizer failed. Give --disable-sanitize if you want to compile without sanitizer
See \`config.log' for more details" "$LINENO" 5; }
fi
if test "x$enable_sanitize" != xno; then
DEBUGCOMPILEFLAGS="$DEBUGCOMPILEFLAGS -fsanitize=$enable_sanitize"
fi
elif test "x$vendor" = xintel; then
DEBUGCOMPILEFLAGS='-g3 -Wall -O0'
if test "x$enable_coverage" != xno; then
enable_coverage=unavailable
fi
if test "x$enable_sanitize" != xno; then
enable_sanitize=unavailable
fi
else
DEBUGCOMPILEFLAGS=-g
if test "x$enable_coverage" != xno; then
enable_coverage=unavailable
fi
if test "x$enable_sanitize" != xno; then
enable_sanitize=unavailable
fi
fi
fi
my_test_DEBUGLINKFLAGS=${DEBUGLINKFLAGS+set}
if test "$my_test_DEBUGLINKFLAGS" != set && test "x$enable_debug" = xyes; then
DEBUGLINKFLAGS=-rdynamic
if test "x$vendor" = xgnu; then
# Coverage option.
if test "x$enable_coverage" = xyes; then
DEBUGLINKFLAGS="$DEBUGLINKFLAGS -coverage"
fi
# Sanitizer option.
if test "x$enable_sanitize" != xno; then
# Workaround for https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/1650186
ok=no
save_CFLAGS=$CFLAGS
save_LDFLAGS=$LDFLAGS
CFLAGS="$CFLAGS -fsanitize=$enable_sanitize"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main (void)
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
ok=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
if test "x$ok" != xyes; then
LDFLAGS="$LDFLAGS -fuse-ld=gold"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main (void)
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
ok=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
if test "x$ok" = xyes; then
DEBUGLINKFLAGS="$DEBUGLINKFLAGS -fuse-ld=gold"
fi
fi
CFLAGS=$save_CFLAGS
LDFLAGS=$save_LDFLAGS
fi
fi
fi
# Check for doxygen
# Extract the first word of "doxygen", so it can be a program name with args.
set dummy doxygen; 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_path_DOXYGEN+y}
then :
printf %s "(cached) " >&6
else $as_nop
case $DOXYGEN in
[\\/]* | ?:[\\/]*)
ac_cv_path_DOXYGEN="$DOXYGEN" # Let the user override the test with a path.
;;
*)
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_path_DOXYGEN="$as_dir$ac_word$ac_exec_ext"
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
test -z "$ac_cv_path_DOXYGEN" && ac_cv_path_DOXYGEN=""""
;;
esac
fi
DOXYGEN=$ac_cv_path_DOXYGEN
if test -n "$DOXYGEN"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DOXYGEN" >&5
printf "%s\n" "$DOXYGEN" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
if test "x$DOXYGEN" != x; then
CONFIG_DOXYGEN_TRUE=
CONFIG_DOXYGEN_FALSE='#'
else
CONFIG_DOXYGEN_TRUE='#'
CONFIG_DOXYGEN_FALSE=
fi
# Check for LaTeX programs
# Extract the first word of "latex", so it can be a program name with args.
set dummy latex; 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_path_LATEX+y}
then :
printf %s "(cached) " >&6
else $as_nop
case $LATEX in
[\\/]* | ?:[\\/]*)
ac_cv_path_LATEX="$LATEX" # Let the user override the test with a path.
;;
*)
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_path_LATEX="$as_dir$ac_word$ac_exec_ext"
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
test -z "$ac_cv_path_LATEX" && ac_cv_path_LATEX=""""
;;
esac
fi
LATEX=$ac_cv_path_LATEX
if test -n "$LATEX"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LATEX" >&5
printf "%s\n" "$LATEX" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
# Extract the first word of "pdflatex", so it can be a program name with args.
set dummy pdflatex; 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_path_PDFLATEX+y}
then :
printf %s "(cached) " >&6
else $as_nop
case $PDFLATEX in
[\\/]* | ?:[\\/]*)
ac_cv_path_PDFLATEX="$PDFLATEX" # Let the user override the test with a path.
;;
*)
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_path_PDFLATEX="$as_dir$ac_word$ac_exec_ext"
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
test -z "$ac_cv_path_PDFLATEX" && ac_cv_path_PDFLATEX=""""
;;
esac
fi
PDFLATEX=$ac_cv_path_PDFLATEX
if test -n "$PDFLATEX"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PDFLATEX" >&5
printf "%s\n" "$PDFLATEX" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
# Extract the first word of "dvips", so it can be a program name with args.
set dummy dvips; 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_path_DVIPS+y}
then :
printf %s "(cached) " >&6
else $as_nop
case $DVIPS in
[\\/]* | ?:[\\/]*)
ac_cv_path_DVIPS="$DVIPS" # Let the user override the test with a path.
;;
*)
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_path_DVIPS="$as_dir$ac_word$ac_exec_ext"
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
test -z "$ac_cv_path_DVIPS" && ac_cv_path_DVIPS=""""
;;
esac
fi
DVIPS=$ac_cv_path_DVIPS
if test -n "$DVIPS"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DVIPS" >&5
printf "%s\n" "$DVIPS" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
# Extract the first word of "makeindex", so it can be a program name with args.
set dummy makeindex; 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_path_MAKEINDEX+y}
then :
printf %s "(cached) " >&6
else $as_nop
case $MAKEINDEX in
[\\/]* | ?:[\\/]*)
ac_cv_path_MAKEINDEX="$MAKEINDEX" # Let the user override the test with a path.
;;
*)
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_path_MAKEINDEX="$as_dir$ac_word$ac_exec_ext"
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
test -z "$ac_cv_path_MAKEINDEX" && ac_cv_path_MAKEINDEX=""""
;;
esac
fi
MAKEINDEX=$ac_cv_path_MAKEINDEX
if test -n "$MAKEINDEX"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MAKEINDEX" >&5
printf "%s\n" "$MAKEINDEX" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
# Extract the first word of "htlatex", so it can be a program name with args.
set dummy htlatex; 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_path_HTLATEX+y}
then :
printf %s "(cached) " >&6
else $as_nop
case $HTLATEX in
[\\/]* | ?:[\\/]*)
ac_cv_path_HTLATEX="$HTLATEX" # Let the user override the test with a path.
;;
*)
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_path_HTLATEX="$as_dir$ac_word$ac_exec_ext"
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
test -z "$ac_cv_path_HTLATEX" && ac_cv_path_HTLATEX=""""
;;
esac
fi
HTLATEX=$ac_cv_path_HTLATEX
if test -n "$HTLATEX"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $HTLATEX" >&5
printf "%s\n" "$HTLATEX" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
# Extract the first word of "latex2html", so it can be a program name with args.
set dummy latex2html; 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_path_LATEX2HTML+y}
then :
printf %s "(cached) " >&6
else $as_nop
case $LATEX2HTML in
[\\/]* | ?:[\\/]*)
ac_cv_path_LATEX2HTML="$LATEX2HTML" # Let the user override the test with a path.
;;
*)
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_path_LATEX2HTML="$as_dir$ac_word$ac_exec_ext"
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
test -z "$ac_cv_path_LATEX2HTML" && ac_cv_path_LATEX2HTML=""""
;;
esac
fi
LATEX2HTML=$ac_cv_path_LATEX2HTML
if test -n "$LATEX2HTML"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LATEX2HTML" >&5
printf "%s\n" "$LATEX2HTML" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
if test "x$LATEX" != x; then
CONFIG_TEX_TRUE=
CONFIG_TEX_FALSE='#'
else
CONFIG_TEX_TRUE='#'
CONFIG_TEX_FALSE=
fi
if test "x$LATEX" != x && test "x$DVIPS" != x; then
CONFIG_PS_TRUE=
CONFIG_PS_FALSE='#'
else
CONFIG_PS_TRUE='#'
CONFIG_PS_FALSE=
fi
if test "x$PDFLATEX" != x; then
CONFIG_PDF_TRUE=
CONFIG_PDF_FALSE='#'
else
CONFIG_PDF_TRUE='#'
CONFIG_PDF_FALSE=
fi
if test "x$MAKEINDEX" != x; then
CONFIG_MAKEINDEX_TRUE=
CONFIG_MAKEINDEX_FALSE='#'
else
CONFIG_MAKEINDEX_TRUE='#'
CONFIG_MAKEINDEX_FALSE=
fi
if test "x$HTLATEX" != x; then
CONFIG_HTLATEX_TRUE=
CONFIG_HTLATEX_FALSE='#'
else
CONFIG_HTLATEX_TRUE='#'
CONFIG_HTLATEX_FALSE=
fi
if test "x$LATEX2HTML" != x; then
CONFIG_LATEX2HTML_TRUE=
CONFIG_LATEX2HTML_FALSE='#'
else
CONFIG_LATEX2HTML_TRUE='#'
CONFIG_LATEX2HTML_FALSE=
fi
# Check for Ruby >= 2.0 and test/unit.
# Extract the first word of "ruby", so it can be a program name with args.
set dummy ruby; 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_path_RUBY+y}
then :
printf %s "(cached) " >&6
else $as_nop
case $RUBY in
[\\/]* | ?:[\\/]*)
ac_cv_path_RUBY="$RUBY" # Let the user override the test with a path.
;;
*)
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_path_RUBY="$as_dir$ac_word$ac_exec_ext"
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
test -z "$ac_cv_path_RUBY" && ac_cv_path_RUBY=""""
;;
esac
fi
RUBY=$ac_cv_path_RUBY
if test -n "$RUBY"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RUBY" >&5
printf "%s\n" "$RUBY" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
ok=yes
test "x$RUBY" = x && ok=no
if test "x$ok" = xyes; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ruby >= 2.0" >&5
printf %s "checking whether ruby >= 2.0... " >&6; }
$RUBY -e 'exit(1) if RUBY_VERSION < "2.0.0"' >/dev/null 2>&1 || ok=no
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ok" >&5
printf "%s\n" "$ok" >&6; }
fi
if test "x$ok" = xyes; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ruby test/unit" >&5
printf %s "checking for ruby test/unit... " >&6; }
{ cat >conftest.rb </dev/null 2>&1 || ok=no
require 'test/unit'
EOF
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ok" >&5
printf "%s\n" "$ok" >&6; }
fi
with_ruby_test=$ok
if test "x$with_ruby_test" = xyes; then
CONFIG_RUBY_TRUE=
CONFIG_RUBY_FALSE='#'
else
CONFIG_RUBY_TRUE='#'
CONFIG_RUBY_FALSE=
fi
ac_config_files="$ac_config_files Makefile sources/Makefile doc/Makefile doc/manual/Makefile doc/manual/manual.tex doc/devref/Makefile doc/devref/devref.tex doc/doxygen/Makefile doc/doxygen/DoxyfileHTML doc/doxygen/DoxyfileLATEX doc/doxygen/DoxyfilePDFLATEX check/Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
# scripts and configure runs, see configure's option --config-cache.
# It is not useful on other systems. If it contains results you don't
# want to keep, you may remove or edit it.
#
# config.status only pays attention to the cache file if you give it
# the --recheck option to rerun configure.
#
# `ac_cv_env_foo' variables (set or unset) will be overridden when
# loading this file, other *unset* `ac_cv_foo' will be assigned the
# following values.
_ACEOF
# The following way of writing the cache mishandles newlines in values,
# but we know of no workaround that is simple, portable, and efficient.
# So, we kill variables containing newlines.
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
(
for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
eval ac_val=\$$ac_var
case $ac_val in #(
*${as_nl}*)
case $ac_var in #(
*_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) ;; #(
BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
*) { eval $ac_var=; unset $ac_var;} ;;
esac ;;
esac
done
(set) 2>&1 |
case $as_nl`(ac_space=' '; set) 2>&1` in #(
*${as_nl}ac_space=\ *)
# `set' does not quote correctly, so add quotes: double-quote
# substitution turns \\\\ into \\, and sed turns \\ into \.
sed -n \
"s/'/'\\\\''/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
;; #(
*)
# `set' quotes correctly as required by POSIX, so do not add quotes.
sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
;;
esac |
sort
) |
sed '
/^ac_cv_env_/b end
t clear
:clear
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
{ 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
case $cache_file in #(
*/* | ?:*)
mv -f confcache "$cache_file"$$ &&
mv -f "$cache_file"$$ "$cache_file" ;; #(
*)
mv -f confcache "$cache_file" ;;
esac
fi
fi
else
{ 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
test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
DEFS=-DHAVE_CONFIG_H
ac_libobjs=
ac_ltlibobjs=
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=`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"
as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
done
LIBOBJS=$ac_libobjs
LTLIBOBJS=$ac_ltlibobjs
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5
printf %s "checking that generated files are newer than configure... " >&6; }
if test -n "$am_sleep_pid"; then
# Hide warnings about reused PIDs.
wait $am_sleep_pid 2>/dev/null
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5
printf "%s\n" "done" >&6; }
if test -n "$EXEEXT"; then
am__EXEEXT_TRUE=
am__EXEEXT_FALSE='#'
else
am__EXEEXT_TRUE='#'
am__EXEEXT_FALSE=
fi
if test -z "${FIXED_VERSION_TRUE}" && test -z "${FIXED_VERSION_FALSE}"; then
as_fn_error $? "conditional \"FIXED_VERSION\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
as_fn_error $? "conditional \"AMDEP\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCXX\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${ONUNIX_TRUE}" && test -z "${ONUNIX_FALSE}"; then
as_fn_error $? "conditional \"ONUNIX\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${ONWINDOWS_TRUE}" && test -z "${ONWINDOWS_FALSE}"; then
as_fn_error $? "conditional \"ONWINDOWS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${WITHZSTD_TRUE}" && test -z "${WITHZSTD_FALSE}"; then
as_fn_error $? "conditional \"WITHZSTD\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${WITHFLINT_TRUE}" && test -z "${WITHFLINT_FALSE}"; then
as_fn_error $? "conditional \"WITHFLINT\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${BUILD_FORM_TRUE}" && test -z "${BUILD_FORM_FALSE}"; then
as_fn_error $? "conditional \"BUILD_FORM\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${BUILD_VORM_TRUE}" && test -z "${BUILD_VORM_FALSE}"; then
as_fn_error $? "conditional \"BUILD_VORM\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${BUILD_TFORM_TRUE}" && test -z "${BUILD_TFORM_FALSE}"; then
as_fn_error $? "conditional \"BUILD_TFORM\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${BUILD_TVORM_TRUE}" && test -z "${BUILD_TVORM_FALSE}"; then
as_fn_error $? "conditional \"BUILD_TVORM\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${BUILD_PARFORM_TRUE}" && test -z "${BUILD_PARFORM_FALSE}"; then
as_fn_error $? "conditional \"BUILD_PARFORM\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${BUILD_PARVORM_TRUE}" && test -z "${BUILD_PARVORM_FALSE}"; then
as_fn_error $? "conditional \"BUILD_PARVORM\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${WITHFLOAT_TRUE}" && test -z "${WITHFLOAT_FALSE}"; then
as_fn_error $? "conditional \"WITHFLOAT\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${CONFIG_DOXYGEN_TRUE}" && test -z "${CONFIG_DOXYGEN_FALSE}"; then
as_fn_error $? "conditional \"CONFIG_DOXYGEN\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${CONFIG_TEX_TRUE}" && test -z "${CONFIG_TEX_FALSE}"; then
as_fn_error $? "conditional \"CONFIG_TEX\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${CONFIG_PS_TRUE}" && test -z "${CONFIG_PS_FALSE}"; then
as_fn_error $? "conditional \"CONFIG_PS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${CONFIG_PDF_TRUE}" && test -z "${CONFIG_PDF_FALSE}"; then
as_fn_error $? "conditional \"CONFIG_PDF\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${CONFIG_MAKEINDEX_TRUE}" && test -z "${CONFIG_MAKEINDEX_FALSE}"; then
as_fn_error $? "conditional \"CONFIG_MAKEINDEX\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${CONFIG_HTLATEX_TRUE}" && test -z "${CONFIG_HTLATEX_FALSE}"; then
as_fn_error $? "conditional \"CONFIG_HTLATEX\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${CONFIG_LATEX2HTML_TRUE}" && test -z "${CONFIG_LATEX2HTML_FALSE}"; then
as_fn_error $? "conditional \"CONFIG_LATEX2HTML\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${CONFIG_RUBY_TRUE}" && test -z "${CONFIG_RUBY_FALSE}"; then
as_fn_error $? "conditional \"CONFIG_RUBY\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files $CONFIG_STATUS"
{ 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
# Generated by $as_me.
# Run this file to recreate the current configuration.
# Compiler output produced by configure, useful for debugging
# configure, is in config.log if it exists.
debug=false
ac_cs_recheck=false
ac_cs_silent=false
SHELL=\${CONFIG_SHELL-$SHELL}
export SHELL
_ASEOF
cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
## -------------------- ##
## M4sh Initialization. ##
## -------------------- ##
# Be more Bourne compatible
DUALCASE=1; export DUALCASE # for MKS sh
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 $as_nop
case `(set -o) 2>/dev/null` in #(
*posix*) :
set -o posix ;; #(
*) :
;;
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
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 ${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 ||
PATH_SEPARATOR=';'
}
fi
# Find who we are. Look in the path if we contain no directory separator.
as_myself=
case $0 in #((
*[\\/]* ) as_myself=$0 ;;
*) 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
test -r "$as_dir$0" && as_myself=$as_dir$0 && break
done
IFS=$as_save_IFS
;;
esac
# We did not find ourselves, most probably we were run as `sh COMMAND'
# in which case we are not to be found in the path.
if test "x$as_myself" = x; then
as_myself=$0
fi
if test ! -f "$as_myself"; then
printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
exit 1
fi
# as_fn_error STATUS ERROR [LINENO LOG_FD]
# ----------------------------------------
# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
# script with STATUS, using 1 if that was 0.
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
printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
fi
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.
as_fn_set_status ()
{
return $1
} # as_fn_set_status
# as_fn_exit STATUS
# -----------------
# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
as_fn_exit ()
{
set +e
as_fn_set_status $1
exit $1
} # as_fn_exit
# as_fn_unset VAR
# ---------------
# Portably unset VAR.
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 :
eval 'as_fn_append ()
{
eval $1+=\$2
}'
else $as_nop
as_fn_append ()
{
eval $1=\$$1\$2
}
fi # as_fn_append
# as_fn_arith ARG...
# ------------------
# 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 :
eval 'as_fn_arith ()
{
as_val=$(( $* ))
}'
else $as_nop
as_fn_arith ()
{
as_val=`expr "$@" || test $? -eq 1`
}
fi # as_fn_arith
if expr a : '\(a\)' >/dev/null 2>&1 &&
test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
fi
if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
as_dirname=dirname
else
as_dirname=false
fi
as_me=`$as_basename -- "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)' \| . 2>/dev/null ||
printf "%s\n" X/"$0" |
sed '/^.*\/\([^/][^/]*\)\/*$/{
s//\1/
q
}
/^X\/\(\/\/\)$/{
s//\1/
q
}
/^X\/\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
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*)
case `echo 'xy\c'` in
*c*) ECHO_T=' ';; # ECHO_T is single tab character.
xy) ECHO_C='\c';;
*) echo `echo ksh88 bug on AIX 6.1` > /dev/null
ECHO_T=' ';;
esac;;
*)
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
else
rm -f conf$$.dir
mkdir conf$$.dir 2>/dev/null
fi
if (echo >conf$$.file) 2>/dev/null; then
if ln -s conf$$.file conf$$ 2>/dev/null; then
as_ln_s='ln -s'
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
# In both cases, we have to default to `cp -pR'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
as_ln_s='cp -pR'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -pR'
fi
else
as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
# as_fn_mkdir_p
# -------------
# Create "$as_dir" as a directory, including parents if necessary.
as_fn_mkdir_p ()
{
case $as_dir in #(
-*) as_dir=./$as_dir;;
esac
test -d "$as_dir" || eval $as_mkdir_p || {
as_dirs=
while :; do
case $as_dir in #(
*\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
*) as_qdir=$as_dir;;
esac
as_dirs="'$as_qdir' $as_dirs"
as_dir=`$as_dirname -- "$as_dir" ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
printf "%s\n" X"$as_dir" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
test -d "$as_dir" && break
done
test -z "$as_dirs" || eval "mkdir $as_dirs"
} || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
} # as_fn_mkdir_p
if mkdir -p . 2>/dev/null; then
as_mkdir_p='mkdir -p "$as_dir"'
else
test -d ./-p && rmdir ./-p
as_mkdir_p=false
fi
# as_fn_executable_p FILE
# -----------------------
# Test if FILE is an executable regular file.
as_fn_executable_p ()
{
test -f "$1" && test -x "$1"
} # as_fn_executable_p
as_test_x='test -x'
as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
# Sed expression to map a string onto a valid variable name.
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
exec 6>&1
## ----------------------------------- ##
## Main body of $CONFIG_STATUS script. ##
## ----------------------------------- ##
_ASEOF
test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# Save the log message, to keep $0 and so on meaningful, and to
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by FORM $as_me 5.0.1, which was
generated by GNU Autoconf 2.71. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
CONFIG_LINKS = $CONFIG_LINKS
CONFIG_COMMANDS = $CONFIG_COMMANDS
$ $0 $@
on `(hostname || uname -n) 2>/dev/null | sed 1q`
"
_ACEOF
case $ac_config_files in *"
"*) set x $ac_config_files; shift; ac_config_files=$*;;
esac
case $ac_config_headers in *"
"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
config_files="$ac_config_files"
config_headers="$ac_config_headers"
config_commands="$ac_config_commands"
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
ac_cs_usage="\
\`$as_me' instantiates files and other configuration actions
from templates according to the current configuration. Unless the files
and actions are specified as TAGs, all are instantiated by default.
Usage: $0 [OPTION]... [TAG]...
-h, --help print this help, then exit
-V, --version print version number and configuration settings, then exit
--config print configuration, then exit
-q, --quiet, --silent
do not print progress messages
-d, --debug don't remove temporary files
--recheck update $as_me by reconfiguring in the same conditions
--file=FILE[:TEMPLATE]
instantiate the configuration file FILE
--header=FILE[:TEMPLATE]
instantiate the configuration header FILE
Configuration files:
$config_files
Configuration headers:
$config_headers
Configuration commands:
$config_commands
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='$ac_cs_config_escaped'
ac_cs_version="\\
FORM config.status 5.0.1
configured by $0, generated by GNU Autoconf 2.71,
with options \\"\$ac_cs_config\\"
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."
ac_pwd='$ac_pwd'
srcdir='$srcdir'
INSTALL='$INSTALL'
MKDIR_P='$MKDIR_P'
AWK='$AWK'
test -n "\$AWK" || AWK=awk
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# The default lists apply if the user does not specify any file.
ac_need_defaults=:
while test $# != 0
do
case $1 in
--*=?*)
ac_option=`expr "X$1" : 'X\([^=]*\)='`
ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
ac_shift=:
;;
--*=)
ac_option=`expr "X$1" : 'X\([^=]*\)='`
ac_optarg=
ac_shift=:
;;
*)
ac_option=$1
ac_optarg=$2
ac_shift=shift
;;
esac
case $ac_option in
# Handling of the options.
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
ac_cs_recheck=: ;;
--version | --versio | --versi | --vers | --ver | --ve | --v | -V )
printf "%s\n" "$ac_cs_version"; exit ;;
--config | --confi | --conf | --con | --co | --c )
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=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
'') as_fn_error $? "missing file argument" ;;
esac
as_fn_append CONFIG_FILES " '$ac_optarg'"
ac_need_defaults=false;;
--header | --heade | --head | --hea )
$ac_shift
case $ac_optarg in
*\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
as_fn_append CONFIG_HEADERS " '$ac_optarg'"
ac_need_defaults=false;;
--he | --h)
# Conflict between --help and --header
as_fn_error $? "ambiguous option: \`$1'
Try \`$0 --help' for more information.";;
--help | --hel | -h )
printf "%s\n" "$ac_cs_usage"; exit ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil | --si | --s)
ac_cs_silent=: ;;
# This is an error.
-*) as_fn_error $? "unrecognized option: \`$1'
Try \`$0 --help' for more information." ;;
*) as_fn_append ac_config_targets " $1"
ac_need_defaults=false ;;
esac
shift
done
ac_configure_extra_args=
if $ac_cs_silent; then
exec 6>/dev/null
ac_configure_extra_args="$ac_configure_extra_args --silent"
fi
_ACEOF
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
\printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6
CONFIG_SHELL='$SHELL'
export CONFIG_SHELL
exec "\$@"
fi
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
exec 5>>config.log
{
echo
sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
## Running $as_me. ##
_ASBOX
printf "%s\n" "$ac_log"
} >&5
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
#
# INIT-COMMANDS
#
AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# Handling of arguments.
for ac_config_target in $ac_config_targets
do
case $ac_config_target in
"config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
"depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"sources/Makefile") CONFIG_FILES="$CONFIG_FILES sources/Makefile" ;;
"doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
"doc/manual/Makefile") CONFIG_FILES="$CONFIG_FILES doc/manual/Makefile" ;;
"doc/manual/manual.tex") CONFIG_FILES="$CONFIG_FILES doc/manual/manual.tex" ;;
"doc/devref/Makefile") CONFIG_FILES="$CONFIG_FILES doc/devref/Makefile" ;;
"doc/devref/devref.tex") CONFIG_FILES="$CONFIG_FILES doc/devref/devref.tex" ;;
"doc/doxygen/Makefile") CONFIG_FILES="$CONFIG_FILES doc/doxygen/Makefile" ;;
"doc/doxygen/DoxyfileHTML") CONFIG_FILES="$CONFIG_FILES doc/doxygen/DoxyfileHTML" ;;
"doc/doxygen/DoxyfileLATEX") CONFIG_FILES="$CONFIG_FILES doc/doxygen/DoxyfileLATEX" ;;
"doc/doxygen/DoxyfilePDFLATEX") CONFIG_FILES="$CONFIG_FILES doc/doxygen/DoxyfilePDFLATEX" ;;
"check/Makefile") CONFIG_FILES="$CONFIG_FILES check/Makefile" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
done
# If the user did not use the arguments to specify the items to instantiate,
# then the envvar interface is used. Set only those that are not.
# 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+y} || CONFIG_FILES=$config_files
test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers
test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands
fi
# Have a temporary directory for convenience. Make it in the build tree
# simply because there is no reason against having it here, and in addition,
# creating and moving files from /tmp can sometimes cause problems.
# Hook for its removal unless debugging.
# Note that there is a small window in which the directory will not be cleaned:
# after its creation but before its name has been assigned to `$tmp'.
$debug ||
{
tmp= ac_tmp=
trap 'exit_status=$?
: "${ac_tmp:=$tmp}"
{ test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
' 0
trap 'as_fn_exit 1' 1 2 13 15
}
# Create a (secure) tmp directory for tmp files.
{
tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
test -d "$tmp"
} ||
{
tmp=./conf$$-$RANDOM
(umask 077 && mkdir "$tmp")
} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
ac_tmp=$tmp
# Set up the scripts for CONFIG_FILES section.
# No need to generate them if there are no CONFIG_FILES.
# This happens for instance with `./config.status config.h'.
if test -n "$CONFIG_FILES"; then
ac_cr=`echo X | tr X '\015'`
# On cygwin, bash can eat \r inside `` if the user requested igncr.
# But we know of no other shell where ac_cr would be empty at this
# point, so we can use a bashism as a fallback.
if test "x$ac_cr" = x; then
eval ac_cr=\$\'\\r\'
fi
ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null`
if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
ac_cs_awk_cr='\\r'
else
ac_cs_awk_cr=$ac_cr
fi
echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
_ACEOF
{
echo "cat >conf$$subs.awk <<_ACEOF" &&
echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
echo "_ACEOF"
} >conf$$subs.sh ||
as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
. ./conf$$subs.sh ||
as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
if test $ac_delim_n = $ac_delim_num; then
break
elif $ac_last_try; then
as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
else
ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi
done
rm -f conf$$subs.sh
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
_ACEOF
sed -n '
h
s/^/S["/; s/!.*/"]=/
p
g
s/^[^!]*!//
:repl
t repl
s/'"$ac_delim"'$//
t delim
:nl
h
s/\(.\{148\}\)..*/\1/
t more1
s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
p
n
b repl
:more1
s/["\\]/\\&/g; s/^/"/; s/$/"\\/
p
g
s/.\{148\}//
t nl
:delim
h
s/\(.\{148\}\)..*/\1/
t more2
s/["\\]/\\&/g; s/^/"/; s/$/"/
p
b
:more2
s/["\\]/\\&/g; s/^/"/; s/$/"\\/
p
g
s/.\{148\}//
t delim
' >$CONFIG_STATUS || ac_write_fail=1
rm -f conf$$subs.awk
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
_ACAWK
cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
for (key in S) S_is_set[key] = 1
FS = ""
}
{
line = $ 0
nfields = split(line, field, "@")
substed = 0
len = length(field[1])
for (i = 2; i < nfields; i++) {
key = field[i]
keylen = length(key)
if (S_is_set[key]) {
value = S[key]
line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
len += length(value) + length(field[++i])
substed = 1
} else
len += 1 + keylen
}
print line
}
_ACAWK
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
else
cat
fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
|| as_fn_error $? "could not setup config files machinery" "$LINENO" 5
_ACEOF
# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
# trailing colons and then remove the whole line if VPATH becomes empty
# (actually we leave an empty line to preserve line numbers).
if test "x$srcdir" = x.; then
ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
h
s///
s/^/:/
s/[ ]*$/:/
s/:\$(srcdir):/:/g
s/:\${srcdir}:/:/g
s/:@srcdir@:/:/g
s/^:*//
s/:*$//
x
s/\(=[ ]*\).*/\1/
G
s/\n//
s/^[^=]*=[ ]*$//
}'
fi
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
fi # test -n "$CONFIG_FILES"
# Set up the scripts for CONFIG_HEADERS section.
# No need to generate them if there are no CONFIG_HEADERS.
# This happens for instance with `./config.status Makefile'.
if test -n "$CONFIG_HEADERS"; then
cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
BEGIN {
_ACEOF
# Transform confdefs.h into an awk script `defines.awk', embedded as
# here-document in config.status, that substitutes the proper values into
# config.h.in to produce config.h.
# Create a delimiter string that does not exist in confdefs.h, to ease
# handling of long lines.
ac_delim='%!_!# '
for ac_last_try in false false :; do
ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
if test -z "$ac_tt"; then
break
elif $ac_last_try; then
as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
else
ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi
done
# For the awk script, D is an array of macro values keyed by name,
# likewise P contains macro parameters if any. Preserve backslash
# newline sequences.
ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
sed -n '
s/.\{148\}/&'"$ac_delim"'/g
t rset
:rset
s/^[ ]*#[ ]*define[ ][ ]*/ /
t def
d
:def
s/\\$//
t bsnl
s/["\\]/\\&/g
s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
D["\1"]=" \3"/p
s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p
d
:bsnl
s/["\\]/\\&/g
s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
D["\1"]=" \3\\\\\\n"\\/p
t cont
s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
t cont
d
:cont
n
s/.\{148\}/&'"$ac_delim"'/g
t clear
:clear
s/\\$//
t bsnlc
s/["\\]/\\&/g; s/^/"/; s/$/"/p
d
:bsnlc
s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
b cont
' >$CONFIG_STATUS || ac_write_fail=1
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
for (key in D) D_is_set[key] = 1
FS = ""
}
/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
line = \$ 0
split(line, arg, " ")
if (arg[1] == "#") {
defundef = arg[2]
mac1 = arg[3]
} else {
defundef = substr(arg[1], 2)
mac1 = arg[2]
}
split(mac1, mac2, "(") #)
macro = mac2[1]
prefix = substr(line, 1, index(line, defundef) - 1)
if (D_is_set[macro]) {
# Preserve the white space surrounding the "#".
print prefix "define", macro P[macro] D[macro]
next
} else {
# Replace #undef with comments. This is necessary, for example,
# in the case of _POSIX_SOURCE, which is predefined and required
# on some systems where configure will not decide to define it.
if (defundef == "undef") {
print "/*", prefix defundef, macro, "*/"
next
}
}
}
{ print }
_ACAWK
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
fi # test -n "$CONFIG_HEADERS"
eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS"
shift
for ac_tag
do
case $ac_tag in
:[FHLC]) ac_mode=$ac_tag; continue;;
esac
case $ac_mode$ac_tag in
:[FHL]*:*);;
:L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
:[FH]-) ac_tag=-:-;;
:[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
esac
ac_save_IFS=$IFS
IFS=:
set x $ac_tag
IFS=$ac_save_IFS
shift
ac_file=$1
shift
case $ac_mode in
:L) ac_source=$1;;
:[FH])
ac_file_inputs=
for ac_f
do
case $ac_f in
-) ac_f="$ac_tmp/stdin";;
*) # Look for the file first in the build tree, then in the source tree
# (if the path is not absolute). The absolute path cannot be DOS-style,
# because $ac_f cannot contain `:'.
test -f "$ac_f" ||
case $ac_f in
[\\/$]*) false;;
*) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
esac ||
as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
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
# Let's still pretend it is `configure' which instantiates (i.e., don't
# use $as_me), people would be surprised to read:
# /* config.h. Generated by config.status. */
configure_input='Generated from '`
printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
`' by configure.'
if test x"$ac_file" != x-; then
configure_input="$ac_file. $configure_input"
{ 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=`printf "%s\n" "$configure_input" |
sed 's/[\\\\&|]/\\\\&/g'`;; #(
*) ac_sed_conf_input=$configure_input;;
esac
case $ac_tag in
*:-:* | *:-) cat >"$ac_tmp/stdin" \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
esac
;;
esac
ac_dir=`$as_dirname -- "$ac_file" ||
$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$ac_file" : 'X\(//\)[^/]' \| \
X"$ac_file" : 'X\(//\)$' \| \
X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
printf "%s\n" X"$ac_file" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
as_dir="$ac_dir"; as_fn_mkdir_p
ac_builddir=.
case "$ac_dir" in
.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
*)
ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'`
# A ".." for each directory in $ac_dir_suffix.
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/ ;;
esac ;;
esac
ac_abs_top_builddir=$ac_pwd
ac_abs_builddir=$ac_pwd$ac_dir_suffix
# for backward compatibility:
ac_top_builddir=$ac_top_build_prefix
case $srcdir in
.) # We are building in place.
ac_srcdir=.
ac_top_srcdir=$ac_top_builddir_sub
ac_abs_top_srcdir=$ac_pwd ;;
[\\/]* | ?:[\\/]* ) # Absolute name.
ac_srcdir=$srcdir$ac_dir_suffix;
ac_top_srcdir=$srcdir
ac_abs_top_srcdir=$srcdir ;;
*) # Relative name.
ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
ac_top_srcdir=$ac_top_build_prefix$srcdir
ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
esac
ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
case $ac_mode in
:F)
#
# CONFIG_FILE
#
case $INSTALL in
[\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
*) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
esac
ac_MKDIR_P=$MKDIR_P
case $MKDIR_P in
[\\/$]* | ?:[\\/]* ) ;;
*/*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
esac
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# If the template does not know about datarootdir, expand it.
# FIXME: This hack should be removed a few years after 2.60.
ac_datarootdir_hack=; ac_datarootdir_seen=
ac_sed_dataroot='
/datarootdir/ {
p
q
}
/@datadir@/p
/@docdir@/p
/@infodir@/p
/@localedir@/p
/@mandir@/p'
case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
*datarootdir*) ac_datarootdir_seen=yes;;
*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
{ 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='
s&@datadir@&$datadir&g
s&@docdir@&$docdir&g
s&@infodir@&$infodir&g
s&@localedir@&$localedir&g
s&@mandir@&$mandir&g
s&\\\${datarootdir}&$datarootdir&g' ;;
esac
_ACEOF
# Neutralize VPATH when `$srcdir' = `.'.
# Shell code in configure.ac might set extrasub.
# FIXME: do we really want to maintain this feature?
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_sed_extra="$ac_vpsub
$extrasub
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
:t
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
s|@configure_input@|$ac_sed_conf_input|;t t
s&@top_builddir@&$ac_top_builddir_sub&;t t
s&@top_build_prefix@&$ac_top_build_prefix&;t t
s&@srcdir@&$ac_srcdir&;t t
s&@abs_srcdir@&$ac_abs_srcdir&;t t
s&@top_srcdir@&$ac_top_srcdir&;t t
s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
s&@builddir@&$ac_builddir&;t t
s&@abs_builddir@&$ac_abs_builddir&;t t
s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
s&@INSTALL@&$ac_INSTALL&;t t
s&@MKDIR_P@&$ac_MKDIR_P&;t t
$ac_datarootdir_hack
"
eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
>$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
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"; } &&
{ 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
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"
case $ac_file in
-) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
*) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
esac \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
;;
:H)
#
# CONFIG_HEADER
#
if test x"$ac_file" != x-; then
{
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
{ 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
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
# Compute "$ac_file"'s index in $config_headers.
_am_arg="$ac_file"
_am_stamp_count=1
for _am_header in $config_headers :; do
case $_am_header in
$_am_arg | $_am_arg:* )
break ;;
* )
_am_stamp_count=`expr $_am_stamp_count + 1` ;;
esac
done
echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" ||
$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$_am_arg" : 'X\(//\)[^/]' \| \
X"$_am_arg" : 'X\(//\)$' \| \
X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null ||
printf "%s\n" X"$_am_arg" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`/stamp-h$_am_stamp_count
;;
:C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
printf "%s\n" "$as_me: executing $ac_file commands" >&6;}
;;
esac
case $ac_file$ac_mode in
"depfiles":C) test x"$AMDEP_TRUE" != x"" || {
# Older Autoconf quotes --file arguments for eval, but not when files
# are listed without --file. Let's play safe and only enable the eval
# if we detect the quoting.
# TODO: see whether this extra hack can be removed once we start
# requiring Autoconf 2.70 or later.
case $CONFIG_FILES in #(
*\'*) :
eval set x "$CONFIG_FILES" ;; #(
*) :
set x $CONFIG_FILES ;; #(
*) :
;;
esac
shift
# Used to flag and report bootstrapping failures.
am_rc=0
for am_mf
do
# Strip MF so we end up with the name of the file.
am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile which includes
# dependency-tracking related rules and includes.
# Grep'ing the whole file directly is not great: AIX grep has a line
# limit of 2048, but all sed's we know have understand at least 4000.
sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
|| continue
am_dirpart=`$as_dirname -- "$am_mf" ||
$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$am_mf" : 'X\(//\)[^/]' \| \
X"$am_mf" : 'X\(//\)$' \| \
X"$am_mf" : 'X\(/\)' \| . 2>/dev/null ||
printf "%s\n" X"$am_mf" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
am_filepart=`$as_basename -- "$am_mf" ||
$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \
X"$am_mf" : 'X\(//\)$' \| \
X"$am_mf" : 'X\(/\)' \| . 2>/dev/null ||
printf "%s\n" X/"$am_mf" |
sed '/^.*\/\([^/][^/]*\)\/*$/{
s//\1/
q
}
/^X\/\(\/\/\)$/{
s//\1/
q
}
/^X\/\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
{ echo "$as_me:$LINENO: cd "$am_dirpart" \
&& sed -e '/# am--include-marker/d' "$am_filepart" \
| $MAKE -f - am--depfiles" >&5
(cd "$am_dirpart" \
&& sed -e '/# am--include-marker/d' "$am_filepart" \
| $MAKE -f - am--depfiles) >&5 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } || am_rc=$?
done
if test $am_rc -ne 0; then
{ { 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 $? "Something went wrong bootstrapping makefile fragments
for automatic dependency tracking. If GNU make was not used, consider
re-running the configure script with MAKE=\"gmake\" (or whatever is
necessary). You can also try re-running configure with the
'--disable-dependency-tracking' option to at least be able to build
the package (albeit without support for automatic dependency tracking).
See \`config.log' for more details" "$LINENO" 5; }
fi
{ am_dirpart=; unset am_dirpart;}
{ am_filepart=; unset am_filepart;}
{ am_mf=; unset am_mf;}
{ am_rc=; unset am_rc;}
rm -f conftest-deps.mk
}
;;
esac
done # for ac_tag
as_fn_exit 0
_ACEOF
ac_clean_files=$ac_clean_files_save
test $ac_write_fail = 0 ||
as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
# configure is writing to config.log, and then calls config.status.
# config.status does its own redirection, appending to config.log.
# Unfortunately, on DOS this fails, as config.log is still kept open
# by configure, so config.status won't be able to write to it; its
# output is simply discarded. So we exec the FD to /dev/null,
# effectively closing config.log, so it can be properly (re)opened and
# appended to by config.status. When coming back to configure, we
# need to make the FD available again.
if test "$no_create" != yes; then
ac_cs_success=:
ac_config_status_args=
test "$silent" = yes &&
ac_config_status_args="$ac_config_status_args --quiet"
exec 5>/dev/null
$SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
exec 5>>config.log
# Use ||, not &&, to avoid exiting from the if with $? = 1, which
# would make configure fail if this is the last instruction.
$ac_cs_success || as_fn_exit 1
fi
if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
{ 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
# Print configuration
echo
echo "##################### CONFIGURATION #####################"
echo
outputdir=$(eval "echo $bindir")
outputdir=$(eval "echo $outputdir")
manoutputdir=$(eval "echo $mandir")
manoutputdir=$(eval "echo $manoutputdir")
echo "FORM $VERSION"
echo
echo "Compiling for: $print_cpu $print_os ($print_api)"
echo
echo "Optionally linked libraries:"
atleastone=no
if test "x$with_flint" = xyes; then
echo " flint"
atleastone=yes
fi
if test "x$with_gmp" = xyes; then
echo " gmp"
atleastone=yes
fi
if test "x$with_mpfr" = xyes; then
echo " mpfr"
atleastone=yes
fi
if test "x$with_zlib" = xyes; then
echo " zlib"
atleastone=yes
fi
if test "x$with_zstd" = xyes; then
echo " zstd"
atleastone=yes
fi
if test $atleastone = no; then
echo " "
fi
echo
echo "Optionally enabled features:"
atleastone=no
if test "x$enable_backtrace" = xyes; then
echo " backtrace"
atleastone=yes
fi
if test $atleastone = no; then
echo " "
fi
echo
echo "The following executables can be compiled:"
atleastone=no
if test "x$build_form" = xyes; then
opts=
if test "x$enable_native" = xyes; then
if test "x$opts" != x; then
opts="${opts}, "
fi
opts="${opts}native"
fi
if test "x$STATIC_LDFLAGS" != x; then
if test "x$opts" != x; then
opts="${opts}, "
fi
opts="${opts}statically linked"
fi
if test "x$enable_profile" = xgprof; then
if test "x$opts" != x; then
opts="${opts}, "
fi
opts="${opts}gprof"
fi
if test "x$enable_profile" = xgperftools; then
if test "x$opts" != x; then
opts="${opts}, "
fi
opts="${opts}gperftools"
fi
if test "x$opts" != x; then
opts=" (${opts})"
fi
echo " form scalar version$opts"
atleastone=yes
fi
if test "x$build_vorm" = xyes; then
opts=
if test "x$enable_coverage" = xyes; then
if test "x$opts" != x; then
opts="${opts}, "
fi
opts="${opts}gcov"
fi
if test "x$enable_sanitize" != xno; then
if test "x$opts" != x; then
opts="${opts}, "
fi
opts="${opts}sanitize=$enable_sanitize"
fi
if test "x$opts" != x; then
opts=" (${opts})"
fi
echo " vorm debugging version$opts"
atleastone=yes
fi
if test "x$build_tform" = xyes; then
opts=
if test "x$enable_native" = xyes; then
if test "x$opts" != x; then
opts="${opts}, "
fi
opts="${opts}native"
fi
if test "x$STATIC_LDFLAGS" != x; then
if test "x$opts" != x; then
opts="${opts}, "
fi
opts="${opts}statically linked"
fi
if test "x$enable_profile" = xgprof; then
if test "x$opts" != x; then
opts="${opts}, "
fi
opts="${opts}gprof"
fi
if test "x$enable_profile" = xgperftools; then
if test "x$opts" != x; then
opts="${opts}, "
fi
opts="${opts}gperftools"
fi
if test "x$opts" != x; then
opts=" (${opts})"
fi
echo " tform multi-threaded version$opts"
atleastone=yes
fi
if test "x$build_tvorm" = xyes; then
opts=
if test "x$enable_coverage" = xyes; then
if test "x$opts" != x; then
opts="${opts}, "
fi
opts="${opts}gcov"
fi
if test "x$enable_sanitize" != xno; then
if test "x$opts" != x; then
opts="${opts}, "
fi
opts="${opts}sanitize=$enable_sanitize"
fi
if test "x$opts" != x; then
opts=" (${opts})"
fi
echo " tvorm multi-threaded debugging version$opts"
atleastone=yes
fi
if test "x$build_parform" = xyes; then
opts=
if test "x$enable_native" = xyes; then
if test "x$opts" != x; then
opts="${opts}, "
fi
opts="${opts}native"
fi
if test "x$MPI_STATIC_LDFLAGS" != x; then
if test "x$opts" != x; then
opts="${opts}, "
fi
opts="${opts}statically linked"
fi
if test "x$enable_profile" = xgprof; then
if test "x$opts" != x; then
opts="${opts}, "
fi
opts="${opts}gprof"
fi
if test "x$enable_profile" = xgperftools; then
if test "x$opts" != x; then
opts="${opts}, "
fi
opts="${opts}gperftools"
fi
if test "x$opts" != x; then
opts=" (${opts})"
fi
echo " parform parallel version using MPI$opts"
atleastone=yes
fi
if test "x$build_parvorm" = xyes; then
opts=
if test "x$enable_coverage" = xyes; then
if test "x$opts" != x; then
opts="${opts}, "
fi
opts="${opts}gcov"
fi
if test "x$enable_sanitize" != xno; then
if test "x$opts" != x; then
opts="${opts}, "
fi
opts="${opts}sanitize=$enable_sanitize"
fi
if test "x$opts" != x; then
opts=" (${opts})"
fi
echo " parvorm parallel debugging version using MPI$opts"
atleastone=yes
fi
if test $atleastone = no; then
echo " "
fi
if test "x$thread_clock_ok" = xno; then
s="none"
if test "x$build_tform" = xyes && test "x$build_tvorm" = xyes; then
s="tform and tvorm"
elif test "x$build_tform" = xyes; then
s="tform"
elif test "x$build_tvorm" = xyes; then
s="tvorm"
fi
if test "x$s" != xnone; then
echo
echo "***CAUTION*** $s may have clock"
echo "problems which make that each worker registers"
echo "the complete time used by all workers and the master."
fi
fi
echo
echo "Type 'make ' in the source directory to"
echo "build a specific version. Type 'make' to build all."
echo
echo "Type 'make install' to install the executables in"
echo " $outputdir"
echo "and the man page in"
echo " $manoutputdir"
echo
if test "x$with_ruby_test" = xyes; then
echo "Type 'make check' to run automatic tests."
else
echo "Automatic tests are not available."
fi
echo
echo "Available documentation:"
atleastone=no
if test "x$DOXYGEN" != x; then
atleastone=yes
str=' doxygen ( html '
if test "x$MAKEINDEX" != x; then
if test "x$LATEX" != x; then
str=$str'dvi '
if test "x$DVIPS" != x; then
str=$str'ps '
fi
fi
if test "x$PDFLATEX" != x; then
str=$str'pdf '
fi
fi
str=$str')'
echo "$str"
fi
if test "x$LATEX" != x || test "x$PDFLATEX" != x; then
atleastone=yes
str=' manual ( '
if test "x$HTLATEX" != x; then
str=$str'html '
fi
if test "x$LATEX" != x; then
str=$str'dvi '
if test "x$DVIPS" != x; then
str=$str'ps '
fi
fi
if test "x$PDFLATEX" != x; then
str=$str'pdf '
fi
str=$str')'
echo "$str"
fi
if test $atleastone = no; then
echo " "
else
echo
echo "Type 'make ' in the directories doc/manual or"
echo "doc/doxygen to generate the respective documentation with"
echo "the specified format."
fi
echo
echo "#########################################################"
echo
form-5.0.1/AUTHORS 0000644 0001751 0001751 00000001300 15217035721 007210 Over the years the following people have made contributions to the code of FORM
(in alphabetical order)
Joshua Davies
Rafael L. Delgado
Denny Fliegner
Markus Frank
Florian Herren
Stephen Jones
Toshiaki Kaneko
Jan Kuipers
Florian Lorkowski
Vitaly Magerya
Andreas Maier
Coenraad Marinissen
Andrei Onyshenko
Irina Pushkina
Maximilian Reininghaus
Thomas Reiter
Albert Retey
Ben Ruijl
Misha Tentyukov
Takahiro Ueda
Jos Vermaseren
Jens Vollinga
Much support has come from Hans Staudenmaier and Hans Kuehn in Karlsruhe,
the late Eric Wassenaar and Ton Damen at Nikhef and all the directors of
Nikhef during the period that FORM was developed.
form-5.0.1/configure.ac 0000644 0001751 0001751 00000125227 15217035721 010445 # Get the version from
# (1) .version file available in a tarball, or
# (2) the latest tag in the repository.
m4_define([FORM_VERSION], m4_esyscmd_s([
if test -f .version; then
cat .version
else
scripts/git-version-gen.sh -C . -v || {
# As a fallback, try for form3.h.
major_version=`grep MAJORVERSION sources/form3.h | sed -e 's/ *#define *MAJORVERSION *//'`
minor_version=`grep MINORVERSION sources/form3.h | sed -e 's/ *#define *MINORVERSION *//'`
patch_version=`grep PATCHVERSION sources/form3.h | sed -e 's/ *#define *PATCHVERSION *//'`
if test "x$major_version" != x && test "x$minor_version" != x && test "x$patch_version" != x; then
# Make the version files.
echo "$major_version.$minor_version.$patch_version" >.version
echo "#define REPO_MAJOR_VERSION $major_version" >sources/version.h.in
echo "#define REPO_MINOR_VERSION $minor_version" >>sources/version.h.in
echo "#define REPO_PATCH_VERSION $patch_version" >>sources/version.h.in
echo '\\def\\repomajorversion'"{$major_version}" >doc/manual/version.tex.in
echo '\\def\\repominorversion'"{$minor_version}" >>doc/manual/version.tex.in
echo '\\def\\repopatchversion'"{$patch_version}" >>doc/manual/version.tex.in
cp doc/manual/version.tex.in doc/devref/version.tex.in
touch doc/doxygen/version.sh.in
fi
cat <&2
========================================================================
Failed to determine the revision of the source code.
The reason may be
- this is neither a source distribution (containing the configure
script) nor a cloned Git repository,
- this is a shallow clone and no version tags are reachable,
- some required utilities (e.g., git) are missing.
Source distributions and some binaries can be found in:
http://www.nikhef.nl/~form/maindir/binaries/binaries.html
https://github.com/form-dev/form/releases
The latest source code can be cloned by:
git clone https://github.com/form-dev/form.git
END
test -f .version && cat <&2
You can continue the build, but binaries will not contain the revision
information.
END
cat <&2
========================================================================
END
test -f .version && cat .version
}
fi
]))
# Use the serial-tests option of AM_INIT_AUTOMAKE if automake >= 1.13.
# Assume the automake command is ${AUTOMAKE:-automake} as autoreconf does.
# It may not work if "make" re-runs a different version of automake.
m4_define([serial_tests], [m4_esyscmd_s([
${AUTOMAKE:-automake} --version | head -1 |
awk '{split ($NF,a,"."); if (a[1] >= 2 || (a[1] == 1 && a[2] >= 13)) { print "serial-tests" }}'
])])
# If automake >= 1.14, use the subdir-objects option of AM_INIT_AUTOMAKE (available in automake >= 1.13)
# to suppress the "possible forward-incompatibility" warning.
m4_define([subdir_objects], [m4_esyscmd_s([
${AUTOMAKE:-automake} --version | head -1 |
awk '{split ($NF,a,"."); if (a[1] >= 2 || (a[1] == 1 && a[2] >= 14)) { print "subdir-objects" }}'
])])
AC_PREREQ([2.69])
AC_INIT([FORM], [FORM_VERSION], [https://github.com/form-dev/form/issues])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([sources/form3.h])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([1.11 foreign -Wall dist-bzip2] serial_tests subdir_objects)
# Check for .version file
AM_CONDITIONAL([FIXED_VERSION], [test -f $srcdir/.version])
# Check for programs
: ${CFLAGS=''} # avoid autoconf's default CFLAGS/CXXFLAGS
: ${CXXFLAGS=''}
AC_PROG_CC([gcc cc icc])
AM_PROG_CC_C_O
AC_PROG_CXX([g++ c++ icpc])
AC_PROG_LN_S
# Check for architecture and OS
AC_CANONICAL_HOST
case $host_os in
darwin* )
print_os="OSX"
;;
linux* )
print_os="Linux"
# "LINUX" is still used in mallocprotect.h. (TU 16 Oct 2011)
AC_DEFINE(LINUX, , [Compiling for a Linux system.])
;;
cygwin* )
print_os="Cygwin"
;;
freebsd* )
print_os="FreeBSD"
;;
netbsd* )
print_os="NetBSD"
;;
openbsd* )
print_os="OpenBSD"
;;
* )
print_os="UNKNOWN OS ($host_os)"
;;
esac
case $host_cpu in
i586 )
print_cpu="Pentium"
;;
i686 )
print_cpu="Pentium Pro"
;;
x86_64 )
print_cpu="Opteron"
;;
alpha* )
print_cpu="Alpha"
;;
* )
print_cpu="UNKNOWN CPU ($host_cpu)"
;;
esac
# Check for C compiler vendor. We assume that all compilers (CC, CXX, MPICC and
# MPICXX) have the same vendor and the same version. Clang most likely works
# as GCC.
vendors="
intel: __ICC,__ECC,__INTEL_COMPILER
gnu: __GNUC__
microsoft: _MSC_VER
unknown: UNKNOWN
"
for ventest in $vendors; do
case $ventest in
*:)
vendor=$ventest
continue
;;
*)
vencpp="defined("`echo $ventest | sed 's/,/) || defined(/g'`")"
;;
esac
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[
#if !($vencpp)
choke me
#endif
])], [break])
done
vendor=`echo $vendor | cut -d: -f1`
# Check for the C++ standard
AC_ARG_WITH([cxxstd],
[AS_HELP_STRING([--with-cxxstd=STANDARD],
[specify the C++ standard @<:@default=check@:>@])],
[],
[with_cxxstd=check])
cxxstd_flag=
if test "x$vendor" = xgnu; then
AC_LANG_PUSH([C++])
if test "x$with_cxxstd" = xcheck; then
AC_MSG_CHECKING([whether C++11 requires any flag])
ok=no
for opt in none -std=gnu++11; do
save_CXXFLAGS=$CXXFLAGS
CXXFLAGS="$CXXFLAGS $opt"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
#if __cplusplus < 201103L
#error C+11 not supported
#endif
])], [ok=yes])
CXXFLAGS=$save_CXXFLAGS
if test "x$ok" = xyes; then
if test "x$opt" = xnone; then
cxxstd_flag=
AC_MSG_RESULT([no])
else
cxxstd_flag=$opt
AC_MSG_RESULT([$opt])
fi
break
fi
done
if test "x$ok" = xno; then
cxxstd_flag=
AC_MSG_RESULT([not supported])
fi
elif test "x$with_cxxstd" != xnone; then
cxxstd_flag="-std=$with_cxxstd"
AX_CHECK_COMPILE_FLAG([$cxxstd_flag],
[],
[AC_MSG_FAILURE([Invalid argument for --with-cxxstd])],
[-Werror])
fi
AC_LANG_POP([C++])
fi
if test "x$cxxstd_flag" != x; then
CXX="$CXX $cxxstd_flag"
if test "x$CXXCPP" != x; then
CXXCPP="$CXXCPP $cxxstd_flag"
fi
fi
# Checks for header files
# NOTE: autoconf>=2.70 has started to warn obsolete macros.
# We check if AC_CHECK_INCLUDES_DEFAULT (introduced in 2.70) is available
# and switch to the new code if possible.
m4_ifdef([AC_CHECK_INCLUDES_DEFAULT],
[AC_CHECK_INCLUDES_DEFAULT
AC_PROG_EGREP
AC_CHECK_HEADERS_ONCE([sys/time.h])
AC_DEFINE([TIME_WITH_SYS_TIME],
[1],
[Define to 1 if you can safely include both and . This macro is obsolete.])],
[AC_HEADER_STDC
AC_HEADER_TIME])
AC_CHECK_HEADERS([fcntl.h limits.h sys/file.h])
AC_LANG_PUSH([C++])
AC_CHECK_HEADERS([unordered_map tr1/unordered_map boost/unordered_map.hpp])
AC_CHECK_HEADERS([unordered_set tr1/unordered_set boost/unordered_set.hpp])
AC_LANG_POP([C++])
# Checks for builtin functions
ok=no
AS_IF([test $ok != yes],
[AC_MSG_CHECKING([__builtin_popcount])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([], [
int x = __builtin_popcount((unsigned int)(-1));
])],
[ok=yes;
AC_DEFINE([HAVE_BUILTIN_POPCOUNT], [1], [Define to 1 if you have __builtin_popcount function.])])
AC_MSG_RESULT($ok)])
AS_IF([test $ok != yes],
[AC_MSG_CHECKING([__popcnt])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include ], [
unsigned int x = __popcnt((unsigned int)(-1));
])],
[ok=yes;
AC_DEFINE([HAVE_POPCNT], [1], [Define to 1 if you have __popcnt function.])])
AC_MSG_RESULT($ok)])
AC_MSG_CHECKING([__attribute__((noreturn))])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([extern void fatal() __attribute__((noreturn));], [return 0;])],
[
AC_DEFINE(NORETURN, [__attribute__((noreturn))], [The "noreturn" function attribute.])
AC_MSG_RESULT([yes])
],
[
AC_DEFINE(NORETURN, [], [The "noreturn" function attribute.])
AC_MSG_RESULT([no])
])
# Check for inline
AC_C_INLINE
# Sets _FILE_OFFSET_BITS if possible
AC_SYS_LARGEFILE
# POSIX or Windows API
AC_ARG_WITH([api],
[AS_HELP_STRING([--with-api=API],
[use POSIX (posix) or Windows (windows) API @<:@default=posix@:>@])],
[AS_IF([test "x$withval" != xposix && test "x$withval" != xwindows],
[AC_MSG_FAILURE([Invalid argument for API. Use --with-api=posix or --with-api=windows])])],
[with_api=posix])
AS_IF([test "x$with_api" = xposix],
[print_api=POSIX
AC_CHECK_HEADERS([unistd.h], [], [AC_MSG_FAILURE([unistd.h is not found])])
AC_DEFINE(UNIX, , [Compiling for UNIX system])])
AS_IF([test "x$with_api" = xwindows],
[print_api=Windows
AC_CHECK_HEADERS([windows.h], [],[AC_MSG_FAILURE([windows.h is not found])] )
AC_DEFINE(WINDOWS, , [Compiling for WINDOWS system])])
AM_CONDITIONAL([ONUNIX], [test "x$with_api" = xposix])
AM_CONDITIONAL([ONWINDOWS], [test "x$with_api" = xwindows])
# Check for gmp
AC_ARG_WITH([gmp],
[AS_HELP_STRING([--with-gmp@<:@=DIR@:>@],
[use GMP for long integer arithmetic (installed in prefix DIR) @<:@default=check@:>@])],
[AS_IF([test "x$withval" != xyes && test "x$withval" != xno && test "x$withval" != xcheck],
[with_gmp=yes
CPPFLAGS="$CPPFLAGS -I$withval/include"
LDFLAGS="$LDFLAGS -L$withval/lib"])],
[with_gmp=check])
AS_IF([test "x$with_gmp" != xno],
[flag=:
AS_IF([$flag], [AC_CHECK_HEADER([gmp.h], [], [flag=false])])
AS_IF([$flag], [AC_CHECK_LIB([gmp], [__gmpz_init], [LIBS="-lgmp $LIBS"], [flag=false])])
AS_IF([$flag],
[AC_DEFINE(WITHGMP, [], [Define to use GMP for long integer arithmetic.])
with_gmp=yes],
[AS_IF([test "x$with_gmp" = xyes],
[AC_MSG_FAILURE([test for GMP failed. Give --without-gmp if you want to compile without GMP])])
AC_MSG_NOTICE([GMP is not available])
with_gmp=no])])
# Check for mpfr
AC_ARG_WITH([mpfr],
[AS_HELP_STRING([--with-mpfr@<:@=DIR@:>@],
[use MPFR for long float arithmetic (installed in prefix DIR) @<:@default=check@:>@])],
[AS_IF([test "x$withval" != xyes && test "x$withval" != xno && test "x$withval" != xcheck],
[with_mpfr=yes
CPPFLAGS="$CPPFLAGS -I$withval/include"
LDFLAGS="$LDFLAGS -L$withval/lib"])],
[with_mpfr=check])
AS_IF([test "x$with_mpfr" != xno],
[flag=:
AS_IF([$flag], [AC_CHECK_HEADER([mpfr.h], [], [flag=false])])
AS_IF([$flag], [AC_CHECK_LIB([mpfr], [mpfr_init2], [LIBS="-lmpfr $LIBS"], [flag=false])])
AS_IF([$flag],
[AC_DEFINE(WITHMPFR, [], [Define to use MPFR for long float arithmetic.])
with_mpfr=yes],
[AS_IF([test "x$with_mpfr" = xyes],
[AC_MSG_FAILURE([test for MPFR failed. Give --without-mpfr if you want to compile without MPFR])])
AC_MSG_NOTICE([MPFR is not available])
with_mpfr=no])])
# Check for zlib
AC_ARG_WITH([zlib],
[AS_HELP_STRING([--with-zlib@<:@=DIR@:>@],
[use zlib for compression (installed in prefix DIR) @<:@default=check@:>@])],
[AS_IF([test "x$withval" != xyes && test "x$withval" != xno && test "x$withval" != xcheck],
[with_zlib=yes
CPPFLAGS="$CPPFLAGS -I$withval/include"
LDFLAGS="$LDFLAGS -L$withval/lib"])],
[with_zlib=check])
AS_IF([test "x$with_zlib" != xno],
[flag=:
AS_IF([$flag], [AC_CHECK_HEADER([zlib.h], [], [flag=false])])
AS_IF([$flag], [AC_CHECK_LIB([z], [get_crc_table], [LIBS="-lz $LIBS"], [flag=false])])
AS_IF([$flag],
[AC_DEFINE(WITHZLIB, [], [Define to use zlib for compression.])
with_zlib=yes],
[AS_IF([test "x$with_zlib" = xyes],
[AC_MSG_FAILURE([test for zlib failed. Give --without-zlib if you want to compile without zlib])])
AC_MSG_NOTICE([zlib is not available])
with_zlib=no])])
# Check for zstd
AC_ARG_WITH([zstd],
[AS_HELP_STRING([--with-zstd@<:@=DIR@:>@],
[use zstd for compression (installed in prefix DIR) @<:@default=check@:>@])],
[AS_IF([test "x$withval" != xyes && test "x$withval" != xno && test "x$withval" != xcheck],
[with_zstd=yes
CPPFLAGS="$CPPFLAGS -I$withval/include"
LDFLAGS="$LDFLAGS -L$withval/lib"])],
[with_zstd=check])
AS_IF([test "x$with_zstd" != xno],
[flag=:
AS_IF([$flag], [AS_IF([test "x$with_zlib" = xno],
[AC_MSG_NOTICE([using zstd requires zlib])
flag=false])])
AS_IF([$flag], [AC_CHECK_HEADER([zstd.h], [], [flag=false])])
AS_IF([$flag], [AC_CHECK_LIB([zstd], [ZSTD_versionNumber], [LIBS="-lzstd $LIBS"], [flag=false])])
AS_IF([$flag],
[AC_DEFINE(WITHZSTD, [], [Define to use zstd for compression.])
with_zstd=yes],
[AS_IF([test "x$with_zstd" = xyes],
[AC_MSG_FAILURE([test for zstd failed. Give --without-zstd if you want to compile without zstd])])
AC_MSG_NOTICE([zstd is not available])
with_zstd=no])])
AM_CONDITIONAL([WITHZSTD], [test "x$with_zstd" = xyes])
# Ensure zstd/zlibWrapper
AS_IF([test -f "$srcdir/extern/zstd/zlibWrapper/zstd_zlibwrapper.h"], [],
[AC_PATH_PROG([GIT], [git])
AS_IF([test -n "$GIT" && (cd "$srcdir" && "$GIT" rev-parse --is-inside-work-tree >/dev/null 2>&1)], [(cd "$srcdir" && "$GIT" submodule update --init)])])
AS_IF([test -f "$srcdir/extern/zstd/zlibWrapper/zstd_zlibwrapper.h"], [],
[AS_IF([test -e "$srcdir/.git"],
[AC_MSG_FAILURE([$srcdir/extern/zstd/zlibWrapper does not exist. Run git submodule update --init in the repository directory])],
[AC_MSG_FAILURE([$srcdir/extern/zstd/zlibWrapper does not exist. Copy the zlibWrapper directory from upstream (https://github.com/facebook/zstd)])])])
# Check for flint
AC_ARG_WITH([flint],
[AS_HELP_STRING([--with-flint@<:@=DIR@:>@],
[use flint for polynomial arithmetic (installed in prefix DIR) @<:@default=check@:>@])],
[AS_IF([test "x$withval" != xyes && test "x$withval" != xno && test "x$withval" != xcheck],
[with_flint=yes
CPPFLAGS="$CPPFLAGS -I$withval/include"
LDFLAGS="$LDFLAGS -L$withval/lib"])],
[with_flint=check])
AS_IF([test "x$with_flint" != xno],
[flag=:
AS_IF([$flag], [AC_CHECK_HEADER([flint/flint.h], [], [flag=false])])
AS_IF([$flag],
[AC_MSG_CHECKING([for a suitable FLINT version])
AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include
#if __FLINT_RELEASE < 30200
#error "FLINT version must be >= 3.2.0: https://github.com/form-dev/form/issues/679"
#endif]])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_MSG_NOTICE([FLINT version 3.2.0 or higher is required])
flag=false]
)])
AS_IF([$flag],
[# Check how to link against the math library.
AC_SEARCH_LIBS([pow], [m])
AS_IF([test "x$ac_cv_search_pow" = "xno"],
[flag=false],
[AS_IF([test "x$ac_cv_search_pow" = "xnone required"],
[MATH_LIBS=""],
[MATH_LIBS="$ac_cv_search_pow"])])])
AS_IF([$flag], [AC_CHECK_LIB([flint], [fmpz_mpoly_init], [LIBS="-lflint $MATH_LIBS $LIBS"], [flag=false], [$MATH_LIBS])])
AS_IF([$flag],
[AC_DEFINE(WITHFLINT, [], [Define to use flint for polynomial arithmetic.])
with_flint=yes],
[AS_IF([test "x$with_flint" = xyes],
[AC_MSG_FAILURE([test for flint failed. Give --without-flint if you want to compile without flint])])
AC_MSG_NOTICE([flint is not available])
with_flint=no])])
AM_CONDITIONAL([WITHFLINT], [test "x$with_flint" = xyes])
# enable-scalar/threaded/parform/debug/float
AC_ARG_ENABLE([scalar],
[AS_HELP_STRING([--enable-scalar],
[build scalar version (form) @<:@default=yes@:>@])],
[AS_IF([test "x$enableval" != xno], [enable_scalar=yes])],
[enable_scalar=yes])
AC_ARG_ENABLE([threaded],
[AS_HELP_STRING([--enable-threaded],
[build multi-threaded version (tform) @<:@default=check@:>@])],
[AS_IF([test "x$enableval" != xno && test "x$enableval" != xcheck], [enable_threaded=yes])],
[enable_threaded=check])
AC_ARG_ENABLE([parform],
[AS_HELP_STRING([--enable-parform],
[build parallel version using MPI (parform) @<:@default=no@:>@])],
[AS_IF([test "x$enableval" != xno && test "x$enableval" != xcheck], [enable_parform=yes])],
[enable_parform=no])
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],
[build debugging versions (vorm/tvorm/parvorm) @<:@default=no@:>@])],
[AS_IF([test "x$enableval" != xno], [enable_debug=yes])],
[enable_debug=no])
AC_ARG_ENABLE([float],
[AS_HELP_STRING([--enable-float],
[build with the float feature @<:@default=yes@:>@])],
[AS_IF([test "x$enableval" != xno && test "x$enableval" != xcheck], [enable_float=yes])],
[enable_float=yes])
# Check for scalar version
build_form=$enable_scalar
AS_IF([test "x$enable_scalar" = xyes && test "x$enable_debug" = xyes], [build_vorm=yes], [build_vorm=no])
AM_CONDITIONAL([BUILD_FORM], [test "x$build_form" = xyes])
AM_CONDITIONAL([BUILD_VORM], [test "x$build_vorm" = xyes])
# Check for threaded version
PTHREAD_CFLAGS=
PTHREAD_CPPFLAGS=
PTHREAD_LIBS=
AH_VERBATIM([WITHPOSIXCLOCK],
[/* Define to use POSIX thread clock. */
#ifdef WITHPTHREADS
#undef WITHPOSIXCLOCK
#endif])
thread_clock_ok=no
AS_IF([test "x$enable_threaded" != xno],
[flag=:
# Check the flag/library for pthreads
AS_IF([$flag],
[ok=no
# none : Cygwin
# -pthread : Linux/gcc (kernel threads), BSD/gcc (userland threads)
# pthread : Linux, OSX
for a in -pthread none pthread; do
case $a in
none)
AC_MSG_CHECKING([whether pthreads works without any flags])
;;
-*)
AC_MSG_CHECKING([whether pthreads works with $a])
PTHREAD_CFLAGS="$a"
;;
*)
AC_MSG_CHECKING([for the pthreads library -l$a])
PTHREAD_LIBS="-l$a"
;;
esac
save_CFLAGS=$CFLAGS
save_LIBS=$LIBS
CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include
static void *start_routine(void *a) { return a; }
], [
pthread_t th;
pthread_condattr_t attr;
pthread_create(&th, 0, start_routine, 0);
pthread_condattr_setpshared(&attr, PTHREAD_PROCESS_PRIVATE);
])],
[ok=yes],
[])
CFLAGS=$save_CFLAGS
LIBS=$save_LIBS
AC_MSG_RESULT($ok)
test "x$ok" = xyes && break
PTHREAD_CFLAGS=
PTHREAD_LIBS=
done
test "x$ok" = xno && flag=false])
# Check pthread_rwlock_t
AS_IF([$flag],
[ok=no
# -D_XOPEN_SOURCE=500: Scientific Linux 4.8
for a in none -D_XOPEN_SOURCE=500; do
case $a in
none)
AC_MSG_CHECKING([for pthread_rwlock_t])
;;
-D*)
AC_MSG_CHECKING([for pthread_rwlock_t with $a])
PTHREAD_CPPFLAGS="$a"
;;
esac
save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$PTHREAD_CPPFLAGS $CPPFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
#include
#include
pthread_rwlock_t rwlock = PTHREAD_RWLOCK_INITIALIZER;
], [
while (pthread_rwlock_tryrdlock(&rwlock) == EBUSY) {}
pthread_rwlock_unlock(&rwlock);
])],
[ok=yes],
[])
CPPFLAGS=$save_CPPFLAGS
AC_MSG_RESULT($ok)
test "x$ok" = xyes && break
PTHREAD_CPPFLAGS=
done
test "x$ok" = xno && flag=false])
# Check clock_gettime with CLOCK_THREAD_CPUTIME_ID
AS_IF([$flag && test "x$with_api" = xposix],
[ok=yes
AS_IF([test "x$ok" = xyes],
[AC_MSG_CHECKING([for the POSIX thread clock])
save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$PTHREAD_CPPFLAGS $CPPFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
#include
], [
struct timespec t;
clock_gettime(CLOCK_THREAD_CPUTIME_ID, &t);
])],
[],
[ok=no])
CPPFLAGS=$save_CPPFLAGS
AC_MSG_RESULT($ok)])
AS_IF([test "x$ok" = xyes],
[save_LIBS=$LIBS
AC_SEARCH_LIBS([clock_gettime], [rt], [], [ok=no])
LIBS=$save_LIBS
if test "x$ac_cv_search_clock_gettime" != "xnone required" && test "x$ac_cv_search_clock_gettime" != "xno"; then
PTHREAD_LIBS="$ac_cv_search_clock_gettime $PTHREAD_LIBS"
fi])
AS_IF([test "x$ok" = xyes],
[cat >>confdefs.h </dev/null`
AS_IF([test $? -eq 0], [
AC_MSG_RESULT([yes])
ax_ok=:
break
], [
AC_MSG_RESULT([no])
])
done
AS_IF([$ax_ok], [], [AC_MSG_WARN([Cannot extract compiler and linker flags from $$1])])
# Extract the compile and link flags.
ax_mpi_cflags=
ax_mpi_cppflags=
ax_mpi_ldflags=
ax_mpi_libs=
ax_first=:
for ax_opt in $ax_mpi_cmdline; do
case $ax_opt in
-I*|-D*)
ax_mpi_cppflags="$ax_mpi_cppflags $ax_opt"
;;
-L*|-Wl,*)
ax_mpi_ldflags="$ax_mpi_ldflags $ax_opt"
;;
-l*)
ax_mpi_libs="$ax_mpi_libs $ax_opt"
;;
*)
$ax_first || ax_mpi_cflags="$ax_mpi_cflags $ax_opt"
;;
esac
ax_first=false
done
MPI_$2FLAGS=` echo "$ax_mpi_cflags" | sed 's/^ *//;s/ *$//;s/ */ /g'`
MPI_$2PPFLAGS=`echo "$ax_mpi_cppflags" | sed 's/^ *//;s/ *$//;s/ */ /g'`
MPI_$2LDFLAGS=`echo "$ax_mpi_ldflags" | sed 's/^ *//;s/ *$//;s/ */ /g'`
MPI_$2LIBS=` echo "$ax_mpi_libs" | sed 's/^ *//;s/ *$//;s/ */ /g'`
], [
AC_MSG_RESULT([no])
$1=
MPI_$2FLAGS=
MPI_$2LDFLAGS=
MPI_$2LIBS=
])
])
AC_DEFUN([_AX_CHECK_MPI_SOURCE], [_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
m4_define([_AX_CHECK_MPI_SOURCE(C)],
[#include
int main(int argc, char **argv) {
int rank, size;
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Finalize();
return 0;
}])
m4_copy([_AX_CHECK_MPI_SOURCE(C)], [_AX_CHECK_MPI_SOURCE(C++)])
# Check for MPI version
AS_IF([test "x$enable_parform" != xno],
[flag=:
AS_IF([$flag], [AX_PROG_MPICC
AS_IF([test "x$MPICC" = x], [flag=false])])
AS_IF([$flag], [AX_PROG_MPICXX
AS_IF([test "x$MPICXX" = x], [flag=false])])
AS_IF([$flag],
[enable_parform=yes
AC_SUBST([MPI_CFLAGS])
AC_SUBST([MPI_CXXFLAGS])
AC_SUBST([MPI_CPPFLAGS])],
[AS_IF([test "x$enable_parform" = xyes],
[AC_MSG_FAILURE([test for parform failed. Give --disable-parform if you do not need to build parform])])
AC_MSG_NOTICE([building parform has been disabled])
AS_IF([test "x$enable_debug" = xyes],
[AC_MSG_NOTICE([building parvorm has been disabled])])
enable_parform=no])])
build_parform=$enable_parform
AS_IF([test "x$enable_parform" = xyes && test "x$enable_debug" = xyes], [build_parvorm=yes], [build_parvorm=no])
AM_CONDITIONAL([BUILD_PARFORM], [test "x$build_parform" = xyes])
AM_CONDITIONAL([BUILD_PARVORM], [test "x$build_parvorm" = xyes])
if test "x$MPICXX" != x && test "x$cxxstd_flag" != x; then
MPICXX="$MPICXX $cxxstd_flag"
fi
AS_IF([test "x$build_form" = xyes || test "x$build_tform" = xyes || test "x$build_parform" = xyes ||
test "x$build_vorm" = xyes || test "x$build_tvorm" = xyes || test "x$build_parvorm" = xyes], [build_any=yes], [build_any=no])
# Check for float
AS_IF([test "x$enable_float" != xno],
[AS_IF([test "x$with_gmp" = xyes && test "x$with_mpfr" = xyes],
[enable_float=yes],
[AS_IF([test "x$enable_float" = xyes && test "x$build_any" = xyes],
[AC_MSG_FAILURE([test for the float feature failed. It requires both GMP and MPFR. Give --disable-float if you want to build without the float feature.])])
enable_float=no
])])
AS_IF([test "x$enable_float" = xyes],
[AC_DEFINE(WITHFLOAT, [], [Define to enable the float feature.])],
[AS_IF([test "x$with_mpfr" = xyes],
[AC_MSG_WARN([mpfr is not required without the float feature.])])])
AM_CONDITIONAL([WITHFLOAT], [test "x$enable_float" = xyes])
# Check for wall-clock time
ok=no
AS_IF([test $ok != yes],
[AC_SEARCH_LIBS([clock_gettime], [rt],
[AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [Define to 1 if you have clock_gettime.])
ok=yes])])
AS_IF([test $ok != yes],
# TODO: gettimeofday is also deprecated.
[AC_SEARCH_LIBS([gettimeofday], [],
[AC_DEFINE([HAVE_GETTIMEOFDAY], [1], [Define to 1 if you have gettimeofday.])
ok=yes])])
AS_IF([test $ok != yes],
# Fallback: ftime. Available also on Windows. Some BSDs require -lcompat.
[AC_SEARCH_LIBS([ftime], [compat],
[AC_DEFINE([HAVE_FTIME], [1], [Define to 1 if you have ftime.])
ok=yes])])
AS_IF([test $ok != yes],
[AC_MSG_FAILURE([Wall-clock time not available])])
# Check for static linking
STATIC_LDFLAGS=
MPI_STATIC_LDFLAGS=
AC_ARG_ENABLE([static-link],
[AS_HELP_STRING([--enable-static-link],
[link with static libraries (release versions) @<:@default=no@:>@])],
[AS_IF([test "x$enableval" != xno && test "x$enableval" != xcheck], [enable_static_link=yes])],
[enable_static_link=no])
AS_IF([test "x$enable_static_link" != xno],
[flag=:
if test "x$vendor" = xgnu; then
static_list='-static -static-libgcc,-static-libstdc++ -static-libgcc'
elif test "x$vendor" = xintel; then
static_list='-static -static-libgcc,-static-intel -static-intel -static-libgcc'
else
static_list='-static -static-libgcc'
fi
for a in $static_list; do
a=`echo $a | sed 's/,/ /g'`
AC_MSG_CHECKING([for static linking with $CXX $a])
AC_LANG_PUSH([C++])
save_CFLAGS=$CFLAGS
save_LDFLAGS=$LDFLAGS
save_LIBS=$LIBS
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
LDFLAGS="$LDFLAGS $a"
LIBS="$PTHREAD_LIBS $LIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM(,)],
[AC_MSG_RESULT([yes]); STATIC_LDFLAGS=$a],
[AC_MSG_RESULT([no]); flag=false])
CFLAGS=$save_CFLAGS
LDFLAGS=$save_LDFLAGS
LIBS=$save_LIBS
AC_LANG_POP([C++])
test "x$STATIC_LDFLAGS" != x && break
done
AS_IF([test "x$enable_parform" = xyes],
[for a in $static_list; do
a=`echo $a | sed 's/,/ /g'`
AC_MSG_CHECKING([for static linking with $MPICXX $a])
AC_LANG_PUSH([C++])
save_CXX=$CXX
save_LDFLAGS=$LDFLAGS
CXX=$MPICXX
LDFLAGS="$LDFLAGS $a"
AC_LINK_IFELSE([AC_LANG_PROGRAM(,)],
[AC_MSG_RESULT([yes]); MPI_STATIC_LDFLAGS=$a],
[AC_MSG_RESULT([no]); flag=false])
CXX=$save_CXX
LDFLAGS=$save_LDFLAGS
AC_LANG_POP([C++])
test "x$MPI_STATIC_LDFLAGS" != x && break
done])
AS_IF([$flag],
[enable_static_link=yes],
[AS_IF([test "x$enable_static_link" = xyes],
[AC_MSG_FAILURE([test for static linking failed. Give --disable-static-link if you want to build without static libraries.])])
AS_IF([test "x$STATIC_LDFLAGS" = x && test "x$MPI_STATIC_LDFLAGS" = x],
[AC_MSG_NOTICE([static linking has been disabled])],
[AC_MSG_NOTICE([static linking has been partially disabled])])
enable_static_link=no])])
AC_SUBST([STATIC_LDFLAGS])
AC_SUBST([MPI_STATIC_LDFLAGS])
# Check for native/universal build
AC_ARG_ENABLE([native],
[AS_HELP_STRING([--enable-native],
[tune for the compiling machine (release versions) @<:@default=no@:>@])],
[AS_IF([test "x$enableval" = xno || test "x$cross_compiling" = xyes],
[enable_native=no], [enable_native=yes])],
[enable_native=no])
# Check for profiling option
AC_ARG_ENABLE([profile],
[AS_HELP_STRING([--enable-profile@<:@=PROFILER@:>@],
[build with profiling (release versions) @<:@default=no@:>@ PROFILER: gprof (default) or gperftools])],
[AS_IF([test "x$enableval" = xyes],
[enable_profile=gprof],
[AS_IF([test "x$enableval" = xgprof || test "x$enableval" = xgperftools],
[enable_profile=$enableval],
[enable_profile=no])])],
[enable_profile=no])
# Check for coverage option
AC_ARG_ENABLE([coverage],
[AS_HELP_STRING([--enable-coverage],
[generate coverage files (debugging versions) @<:@default=no@:>@])],
[AS_IF([test "x$enableval" = xyes && test "x$enable_debug" = xyes],
[enable_coverage=yes], [enable_coverage=no])],
[enable_coverage=no])
# Check for sanitizers
AC_ARG_ENABLE([sanitize],
[AS_HELP_STRING([--enable-sanitize@<:@=CHECKS@:>@],
[enable sanitizers (debugging versions) @<:@default=no@:>@ Optionally CHECKS will be passed via the compiler sanitizer option])],
[AS_IF([test "x$enable_debug" != xyes],
[enable_sanitize=no])],
[enable_sanitize=no])
# Check for extra compiler warnings
AC_ARG_ENABLE([extra-warning],
[AS_HELP_STRING([--enable-extra-warning],
[enable extra compiler warnings @<:@default=no@:>@])],
[],
[enable_extra_warning=no])
# Check for backtrace (requires glibc):
AC_ARG_ENABLE([backtrace],
[AS_HELP_STRING([--enable-backtrace],
[print a stack trace on Terminate @<:@default=no@:>@])],
[AS_IF(
[test "x$enableval" = xyes], [enable_backtrace=yes],
[test "x$enableval" = xno], [enable_backtrace=no],
[enable_backtrace=no]
)],
[enable_backtrace=no])
AS_IF([test "x$enable_backtrace" != xno],
[flag=:
AS_IF([$flag], [AC_SEARCH_LIBS([backtrace], [c], [], [flag=false])])
AS_IF([$flag], [AC_CHECK_HEADERS([execinfo.h], [], [flag=false])])
AS_IF([$flag],
[AC_DEFINE(ENABLE_BACKTRACE, [], [Define to print a stack trace on Terminate.])
enable_backtrace=yes],
[AS_IF([test "x$enable_backtrace" = xyes],
[AC_MSG_FAILURE([test for backtrace failed. Give --disable-backtrace if you want to compile without backtrace.])])
AC_MSG_NOTICE([backtrace is not available])
enable_backtrace=no])
]
)
# Optimization/debugging flags
AC_ARG_VAR([COMPILEFLAGS], [Compiler flags for release versions])
AC_ARG_VAR([LINKFLAGS], [Linker flags for release versions])
AC_ARG_VAR([DEBUGCOMPILEFLAGS], [Compiler flags for debugging versions])
AC_ARG_VAR([DEBUGLINKFLAGS], [Linker flags for debugging versions])
TOOL_LIBS=
DEBUGTOOL_LIBS=
# AX_HANDLE_EXTRA_WARNING(COMPILEFLAGS)
# -------------------------------------
AC_DEFUN([AX_HANDLE_EXTRA_WARNING],
[if test "x$enable_extra_warning" != xyes; then
# Currently no warnings are disabled without --enable-extra-warning
$1="$$1"
fi[]dnl
])
my_test_COMPILEFLAGS=${COMPILEFLAGS+set}
if test "$my_test_COMPILEFLAGS" != set; then
if test "x$vendor" = xgnu; then
COMPILEFLAGS="-Wall -Wextra"
AX_HANDLE_EXTRA_WARNING([COMPILEFLAGS])
# Enable optimizations.
COMPILEFLAGS="$COMPILEFLAGS -O3"
if test "x$enable_backtrace" = xyes; then
# Keep symbols and frame pointers for easier debugging.
COMPILEFLAGS="$COMPILEFLAGS -g -fno-omit-frame-pointer"
fi
if test "x$enable_native" = xyes; then
# Use -march=native if available.
AX_CHECK_COMPILE_FLAG([-march=native],
[COMPILEFLAGS="$COMPILEFLAGS -march=native"],
[],
[-Werror])
fi
# Profiling option.
if test "x$enable_profile" = xgprof; then
COMPILEFLAGS="$COMPILEFLAGS -g -pg"
elif test "x$enable_profile" = xgperftools; then
COMPILEFLAGS="$COMPILEFLAGS -g"
TOOL_LIBS="$TOOL_LIBS -lprofiler"
fi
elif test "x$vendor" = xintel; then
# NOTE: -fast option includes -static and may cause an error in linking.
COMPILEFLAGS="-Wall -ipo -O3 -no-prec-div"
if test "x$enable_native" = xyes; then
COMPILEFLAGS="$COMPILEFLAGS -xHost"
fi
if test "x$enable_profile" != xno; then
enable_profile=unavailable
fi
else
COMPILEFLAGS=-O2
if test "x$enable_profile" != xno; then
enable_profile=unavailable
fi
fi
fi
my_test_LINKFLAGS=${LINKFLAGS+set}
if test "$my_test_LINKFLAGS" != set; then
LINKFLAGS=""
if test "x$enable_backtrace" = xyes; then
# For easier debugging
LINKFLAGS="$LINKFLAGS -rdynamic"
fi
if test "x$vendor" = xgnu && test "x$print_os" = xOSX; then
# On OS X Mavericks, -s option has a funny effect: though the linker
# warns the option is obsolete and being ignored, it causes an internal
# error "atom not found in symbolIndex...".
LINKFLAGS="$LINKFLAGS"
elif test "x$enable_profile" != xno && test "x$enable_profile" != xunavailable; then
# Profilers needs symbol tables.
LINKFLAGS="$LINKFLAGS"
else
LINKFLAGS="$LINKFLAGS"
fi
fi
my_test_DEBUGCOMPILEFLAGS=${DEBUGCOMPILEFLAGS+set}
if test "$my_test_DEBUGCOMPILEFLAGS" != set && test "x$enable_debug" = xyes; then
if test "x$vendor" = xgnu; then
DEBUGCOMPILEFLAGS='-Wall -Wextra'
if test "x$enable_sanitize" = xno; then
# UBSan puts many paddings (at least in gcc 5.3).
#
# Unfortunately gmp.h and mpfr.h give padding warnings.
# We leave those out. (JV 5-apr-2023)
#
# DEBUGCOMPILEFLAGS="$DEBUGCOMPILEFLAGS -Wpadded"
DEBUGCOMPILEFLAGS="$DEBUGCOMPILEFLAGS"
fi
AX_HANDLE_EXTRA_WARNING([DEBUGCOMPILEFLAGS])
# Check for -Og. If it doesn't work then use -O0.
AX_CHECK_COMPILE_FLAG([-Og],
[DEBUGCOMPILEFLAGS="$DEBUGCOMPILEFLAGS -Og"],
[DEBUGCOMPILEFLAGS="$DEBUGCOMPILEFLAGS -O0"],
[-Werror])
# Debugging information.
DEBUGCOMPILEFLAGS="$DEBUGCOMPILEFLAGS -g3 -fno-omit-frame-pointer"
# Coverage option.
if test "x$enable_coverage" = xyes; then
DEBUGCOMPILEFLAGS="$DEBUGCOMPILEFLAGS -coverage"
fi
# Sanitizer option.
if test "x$enable_sanitize" = xyes; then
enable_sanitize=
for san in address undefined; do
if test "x$enable_sanitize" = x; then
tmp_sanitize=$san
else
tmp_sanitize=$enable_sanitize,$san
fi
AX_CHECK_COMPILE_FLAG([-fsanitize=$tmp_sanitize], [enable_sanitize=$tmp_sanitize], [], [-Werror])
done
if test "x$enable_sanitize" = x; then
enable_sanitize=failed
fi
elif test "x$enable_sanitize" != xno; then
AX_CHECK_COMPILE_FLAG([-fsanitize=$enable_sanitize], [], [enable_sanitize=failed], [-Werror])
fi
if test "x$enable_sanitize" = xfailed; then
AC_MSG_FAILURE([test for sanitizer failed. Give --disable-sanitize if you want to compile without sanitizer])
fi
if test "x$enable_sanitize" != xno; then
DEBUGCOMPILEFLAGS="$DEBUGCOMPILEFLAGS -fsanitize=$enable_sanitize"
fi
elif test "x$vendor" = xintel; then
DEBUGCOMPILEFLAGS='-g3 -Wall -O0'
if test "x$enable_coverage" != xno; then
enable_coverage=unavailable
fi
if test "x$enable_sanitize" != xno; then
enable_sanitize=unavailable
fi
else
DEBUGCOMPILEFLAGS=-g
if test "x$enable_coverage" != xno; then
enable_coverage=unavailable
fi
if test "x$enable_sanitize" != xno; then
enable_sanitize=unavailable
fi
fi
fi
my_test_DEBUGLINKFLAGS=${DEBUGLINKFLAGS+set}
if test "$my_test_DEBUGLINKFLAGS" != set && test "x$enable_debug" = xyes; then
DEBUGLINKFLAGS=-rdynamic
if test "x$vendor" = xgnu; then
# Coverage option.
if test "x$enable_coverage" = xyes; then
DEBUGLINKFLAGS="$DEBUGLINKFLAGS -coverage"
fi
# Sanitizer option.
if test "x$enable_sanitize" != xno; then
# Workaround for https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/1650186
ok=no
save_CFLAGS=$CFLAGS
save_LDFLAGS=$LDFLAGS
CFLAGS="$CFLAGS -fsanitize=$enable_sanitize"
AC_LINK_IFELSE([AC_LANG_PROGRAM()], [ok=yes])
if test "x$ok" != xyes; then
LDFLAGS="$LDFLAGS -fuse-ld=gold"
AC_LINK_IFELSE([AC_LANG_PROGRAM()], [ok=yes])
if test "x$ok" = xyes; then
DEBUGLINKFLAGS="$DEBUGLINKFLAGS -fuse-ld=gold"
fi
fi
CFLAGS=$save_CFLAGS
LDFLAGS=$save_LDFLAGS
fi
fi
fi
AC_SUBST([TOOL_LIBS])
AC_SUBST([DEBUGTOOL_LIBS])
# Check for doxygen
AC_PATH_PROG(DOXYGEN, doxygen, "")
AM_CONDITIONAL(CONFIG_DOXYGEN, [test "x$DOXYGEN" != x])
# Check for LaTeX programs
AC_PATH_PROG(LATEX, latex, "")
AC_PATH_PROG(PDFLATEX, pdflatex, "")
AC_PATH_PROG(DVIPS, dvips, "")
AC_PATH_PROG(MAKEINDEX, makeindex, "")
AC_PATH_PROG(HTLATEX, htlatex, "")
AC_PATH_PROG(LATEX2HTML, latex2html, "")
AM_CONDITIONAL(CONFIG_TEX, [test "x$LATEX" != x])
AM_CONDITIONAL(CONFIG_PS, [test "x$LATEX" != x && test "x$DVIPS" != x])
AM_CONDITIONAL(CONFIG_PDF, [test "x$PDFLATEX" != x])
AM_CONDITIONAL(CONFIG_MAKEINDEX, [test "x$MAKEINDEX" != x])
AM_CONDITIONAL(CONFIG_HTLATEX, [test "x$HTLATEX" != x])
AM_CONDITIONAL(CONFIG_LATEX2HTML, [test "x$LATEX2HTML" != x])
# Check for Ruby >= 2.0 and test/unit.
AC_PATH_PROG(RUBY, ruby, "")
ok=yes
test "x$RUBY" = x && ok=no
if test "x$ok" = xyes; then
AC_MSG_CHECKING([whether ruby >= 2.0])
$RUBY -e 'exit(1) if RUBY_VERSION < "2.0.0"' >/dev/null 2>&1 || ok=no
AC_MSG_RESULT([$ok])
fi
if test "x$ok" = xyes; then
AC_MSG_CHECKING([for ruby test/unit])
{ cat >conftest.rb </dev/null 2>&1 || ok=no
require 'test/unit'
EOF
AC_MSG_RESULT([$ok])
fi
with_ruby_test=$ok
AM_CONDITIONAL(CONFIG_RUBY, [test "x$with_ruby_test" = xyes])
AC_CONFIG_FILES([
Makefile
sources/Makefile
doc/Makefile
doc/manual/Makefile
doc/manual/manual.tex
doc/devref/Makefile
doc/devref/devref.tex
doc/doxygen/Makefile
doc/doxygen/DoxyfileHTML
doc/doxygen/DoxyfileLATEX
doc/doxygen/DoxyfilePDFLATEX
check/Makefile
])
AC_OUTPUT
# Print configuration
echo
echo "##################### CONFIGURATION #####################"
echo
outputdir=$(eval "echo $bindir")
outputdir=$(eval "echo $outputdir")
manoutputdir=$(eval "echo $mandir")
manoutputdir=$(eval "echo $manoutputdir")
echo "FORM $VERSION"
echo
echo "Compiling for: $print_cpu $print_os ($print_api)"
echo
echo "Optionally linked libraries:"
atleastone=no
if test "x$with_flint" = xyes; then
echo " flint"
atleastone=yes
fi
if test "x$with_gmp" = xyes; then
echo " gmp"
atleastone=yes
fi
if test "x$with_mpfr" = xyes; then
echo " mpfr"
atleastone=yes
fi
if test "x$with_zlib" = xyes; then
echo " zlib"
atleastone=yes
fi
if test "x$with_zstd" = xyes; then
echo " zstd"
atleastone=yes
fi
if test $atleastone = no; then
echo " "
fi
echo
echo "Optionally enabled features:"
atleastone=no
if test "x$enable_backtrace" = xyes; then
echo " backtrace"
atleastone=yes
fi
if test $atleastone = no; then
echo " "
fi
echo
echo "The following executables can be compiled:"
atleastone=no
if test "x$build_form" = xyes; then
opts=
if test "x$enable_native" = xyes; then
if test "x$opts" != x; then
opts="${opts}, "
fi
opts="${opts}native"
fi
if test "x$STATIC_LDFLAGS" != x; then
if test "x$opts" != x; then
opts="${opts}, "
fi
opts="${opts}statically linked"
fi
if test "x$enable_profile" = xgprof; then
if test "x$opts" != x; then
opts="${opts}, "
fi
opts="${opts}gprof"
fi
if test "x$enable_profile" = xgperftools; then
if test "x$opts" != x; then
opts="${opts}, "
fi
opts="${opts}gperftools"
fi
if test "x$opts" != x; then
opts=" (${opts})"
fi
echo " form scalar version$opts"
atleastone=yes
fi
if test "x$build_vorm" = xyes; then
opts=
if test "x$enable_coverage" = xyes; then
if test "x$opts" != x; then
opts="${opts}, "
fi
opts="${opts}gcov"
fi
if test "x$enable_sanitize" != xno; then
if test "x$opts" != x; then
opts="${opts}, "
fi
opts="${opts}sanitize=$enable_sanitize"
fi
if test "x$opts" != x; then
opts=" (${opts})"
fi
echo " vorm debugging version$opts"
atleastone=yes
fi
if test "x$build_tform" = xyes; then
opts=
if test "x$enable_native" = xyes; then
if test "x$opts" != x; then
opts="${opts}, "
fi
opts="${opts}native"
fi
if test "x$STATIC_LDFLAGS" != x; then
if test "x$opts" != x; then
opts="${opts}, "
fi
opts="${opts}statically linked"
fi
if test "x$enable_profile" = xgprof; then
if test "x$opts" != x; then
opts="${opts}, "
fi
opts="${opts}gprof"
fi
if test "x$enable_profile" = xgperftools; then
if test "x$opts" != x; then
opts="${opts}, "
fi
opts="${opts}gperftools"
fi
if test "x$opts" != x; then
opts=" (${opts})"
fi
echo " tform multi-threaded version$opts"
atleastone=yes
fi
if test "x$build_tvorm" = xyes; then
opts=
if test "x$enable_coverage" = xyes; then
if test "x$opts" != x; then
opts="${opts}, "
fi
opts="${opts}gcov"
fi
if test "x$enable_sanitize" != xno; then
if test "x$opts" != x; then
opts="${opts}, "
fi
opts="${opts}sanitize=$enable_sanitize"
fi
if test "x$opts" != x; then
opts=" (${opts})"
fi
echo " tvorm multi-threaded debugging version$opts"
atleastone=yes
fi
if test "x$build_parform" = xyes; then
opts=
if test "x$enable_native" = xyes; then
if test "x$opts" != x; then
opts="${opts}, "
fi
opts="${opts}native"
fi
if test "x$MPI_STATIC_LDFLAGS" != x; then
if test "x$opts" != x; then
opts="${opts}, "
fi
opts="${opts}statically linked"
fi
if test "x$enable_profile" = xgprof; then
if test "x$opts" != x; then
opts="${opts}, "
fi
opts="${opts}gprof"
fi
if test "x$enable_profile" = xgperftools; then
if test "x$opts" != x; then
opts="${opts}, "
fi
opts="${opts}gperftools"
fi
if test "x$opts" != x; then
opts=" (${opts})"
fi
echo " parform parallel version using MPI$opts"
atleastone=yes
fi
if test "x$build_parvorm" = xyes; then
opts=
if test "x$enable_coverage" = xyes; then
if test "x$opts" != x; then
opts="${opts}, "
fi
opts="${opts}gcov"
fi
if test "x$enable_sanitize" != xno; then
if test "x$opts" != x; then
opts="${opts}, "
fi
opts="${opts}sanitize=$enable_sanitize"
fi
if test "x$opts" != x; then
opts=" (${opts})"
fi
echo " parvorm parallel debugging version using MPI$opts"
atleastone=yes
fi
if test $atleastone = no; then
echo " "
fi
if test "x$thread_clock_ok" = xno; then
s="none"
if test "x$build_tform" = xyes && test "x$build_tvorm" = xyes; then
s="tform and tvorm"
elif test "x$build_tform" = xyes; then
s="tform"
elif test "x$build_tvorm" = xyes; then
s="tvorm"
fi
if test "x$s" != xnone; then
echo
echo "***CAUTION*** $s may have clock"
echo "problems which make that each worker registers"
echo "the complete time used by all workers and the master."
fi
fi
echo
echo "Type 'make ' in the source directory to"
echo "build a specific version. Type 'make' to build all."
echo
echo "Type 'make install' to install the executables in"
echo " $outputdir"
echo "and the man page in"
echo " $manoutputdir"
echo
if test "x$with_ruby_test" = xyes; then
echo "Type 'make check' to run automatic tests."
else
echo "Automatic tests are not available."
fi
echo
echo "Available documentation:"
atleastone=no
if test "x$DOXYGEN" != x; then
atleastone=yes
str=' doxygen ( html '
if test "x$MAKEINDEX" != x; then
if test "x$LATEX" != x; then
str=$str'dvi '
if test "x$DVIPS" != x; then
str=$str'ps '
fi
fi
if test "x$PDFLATEX" != x; then
str=$str'pdf '
fi
fi
str=$str')'
echo "$str"
fi
if test "x$LATEX" != x || test "x$PDFLATEX" != x; then
atleastone=yes
str=' manual ( '
if test "x$HTLATEX" != x; then
str=$str'html '
fi
if test "x$LATEX" != x; then
str=$str'dvi '
if test "x$DVIPS" != x; then
str=$str'ps '
fi
fi
if test "x$PDFLATEX" != x; then
str=$str'pdf '
fi
str=$str')'
echo "$str"
fi
if test $atleastone = no; then
echo " "
else
echo
echo "Type 'make ' in the directories doc/manual or"
echo "doc/doxygen to generate the respective documentation with"
echo "the specified format."
fi
echo
echo "#########################################################"
echo
form-5.0.1/Makefile.am 0000644 0001751 0001751 00000000542 15217035721 010203 SUBDIRS = doc sources check
EXTRA_DIST = README.md scripts/.latex2html-init scripts/run-latex2html.sh
dist-hook:
$(DISTHOOK_VERSION)
if FIXED_VERSION
DISTHOOK_VERSION = \
cp "$(srcdir)/.version" "$(distdir)/.version"
else
DISTHOOK_VERSION = \
$(SHELL) "$(top_srcdir)/scripts/git-version-gen.sh" -C "$(srcdir)" -v -o "$(distdir)/.version"
endif
form-5.0.1/COPYING 0000644 0001751 0001751 00000104513 15217035721 007205 GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
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 3 of the License, 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, see .
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
Copyright (C)
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
.
form-5.0.1/extern/ 0000755 0001751 0001751 00000000000 15217035744 007540 5 form-5.0.1/extern/zstd/ 0000755 0001751 0001751 00000000000 15217035744 010524 5 form-5.0.1/extern/zstd/zlibWrapper/ 0000755 0001751 0001751 00000000000 15217035744 013025 5 form-5.0.1/extern/zstd/zlibWrapper/gzlib.c 0000644 0001751 0001751 00000041520 15217035741 014217 /* gzlib.c contains minimal changes required to be compiled with zlibWrapper:
* - gz_statep was converted to union to work with -Wstrict-aliasing=1 */
/* gzlib.c -- zlib functions common to reading and writing gzip files
* Copyright (C) 2004-2017 Mark Adler
* For conditions of distribution and use, see https://www.zlib.net/zlib_license.html
*/
#include "gzguts.h"
#if defined(_WIN32) && !defined(__BORLANDC__) && !defined(__MINGW32__)
# define LSEEK _lseeki64
#else
#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
# define LSEEK lseek64
#else
# define LSEEK lseek
#endif
#endif
/* Local functions */
local void gz_reset _Z_OF((gz_statep));
local gzFile gz_open _Z_OF((const void *, int, const char *));
#if defined UNDER_CE
/* Map the Windows error number in ERROR to a locale-dependent error message
string and return a pointer to it. Typically, the values for ERROR come
from GetLastError.
The string pointed to shall not be modified by the application, but may be
overwritten by a subsequent call to gz_strwinerror
The gz_strwinerror function does not change the current setting of
GetLastError. */
char ZLIB_INTERNAL *gz_strwinerror(DWORD error) {
static char buf[1024];
wchar_t *msgbuf;
DWORD lasterr = GetLastError();
DWORD chars = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM
| FORMAT_MESSAGE_ALLOCATE_BUFFER,
NULL,
error,
0, /* Default language */
(LPVOID)&msgbuf,
0,
NULL);
if (chars != 0) {
/* If there is an \r\n appended, zap it. */
if (chars >= 2
&& msgbuf[chars - 2] == '\r' && msgbuf[chars - 1] == '\n') {
chars -= 2;
msgbuf[chars] = 0;
}
if (chars > sizeof (buf) - 1) {
chars = sizeof (buf) - 1;
msgbuf[chars] = 0;
}
wcstombs(buf, msgbuf, chars + 1);
LocalFree(msgbuf);
}
else {
sprintf(buf, "unknown win32 error (%ld)", error);
}
SetLastError(lasterr);
return buf;
}
#endif /* UNDER_CE */
/* Reset gzip file state */
local void gz_reset(gz_statep state) {
state.state->x.have = 0; /* no output data available */
if (state.state->mode == GZ_READ) { /* for reading ... */
state.state->eof = 0; /* not at end of file */
state.state->past = 0; /* have not read past end yet */
state.state->how = LOOK; /* look for gzip header */
}
state.state->seek = 0; /* no seek request pending */
gz_error(state, Z_OK, NULL); /* clear error */
state.state->x.pos = 0; /* no uncompressed data yet */
state.state->strm.avail_in = 0; /* no input data yet */
}
/* Open a gzip file either by name or file descriptor. */
local gzFile gz_open(const void *path, int fd, const char *mode) {
gz_statep state;
z_size_t len;
int oflag;
#ifdef O_CLOEXEC
int cloexec = 0;
#endif
#ifdef O_EXCL
int exclusive = 0;
#endif
/* check input */
if (path == NULL)
return NULL;
/* allocate gzFile structure to return */
state.state = (gz_state*)malloc(sizeof(gz_state));
if (state.state == NULL)
return NULL;
state.state->size = 0; /* no buffers allocated yet */
state.state->want = GZBUFSIZE; /* requested buffer size */
state.state->msg = NULL; /* no error message yet */
/* interpret mode */
state.state->mode = GZ_NONE;
state.state->level = Z_DEFAULT_COMPRESSION;
state.state->strategy = Z_DEFAULT_STRATEGY;
state.state->direct = 0;
while (*mode) {
if (*mode >= '0' && *mode <= '9')
state.state->level = *mode - '0';
else
switch (*mode) {
case 'r':
state.state->mode = GZ_READ;
break;
#ifndef NO_GZCOMPRESS
case 'w':
state.state->mode = GZ_WRITE;
break;
case 'a':
state.state->mode = GZ_APPEND;
break;
#endif
case '+': /* can't read and write at the same time */
free(state.state);
return NULL;
case 'b': /* ignore -- will request binary anyway */
break;
#ifdef O_CLOEXEC
case 'e':
cloexec = 1;
break;
#endif
#ifdef O_EXCL
case 'x':
exclusive = 1;
break;
#endif
case 'f':
state.state->strategy = Z_FILTERED;
break;
case 'h':
state.state->strategy = Z_HUFFMAN_ONLY;
break;
case 'R':
state.state->strategy = Z_RLE;
break;
case 'F':
state.state->strategy = Z_FIXED;
break;
case 'T':
state.state->direct = 1;
break;
default: /* could consider as an error, but just ignore */
;
}
mode++;
}
/* must provide an "r", "w", or "a" */
if (state.state->mode == GZ_NONE) {
free(state.state);
return NULL;
}
/* can't force transparent read */
if (state.state->mode == GZ_READ) {
if (state.state->direct) {
free(state.state);
return NULL;
}
state.state->direct = 1; /* for empty file */
}
/* save the path name for error messages */
#ifdef WIDECHAR
if (fd == -2) {
len = wcstombs(NULL, path, 0);
if (len == (z_size_t)-1)
len = 0;
}
else
#endif
len = strlen((const char *)path);
state.state->path = (char *)malloc(len + 1);
if (state.state->path == NULL) {
free(state.state);
return NULL;
}
#ifdef WIDECHAR
if (fd == -2)
if (len)
wcstombs(state.state->path, path, len + 1);
else
*(state.state->path) = 0;
else
#endif
#if !defined(NO_snprintf) && !defined(NO_vsnprintf)
(void)snprintf(state.state->path, len + 1, "%s", (const char *)path);
#else
strcpy(state.state->path, (const char*)path);
#endif
/* compute the flags for open() */
oflag =
#ifdef O_LARGEFILE
O_LARGEFILE |
#endif
#ifdef O_BINARY
O_BINARY |
#endif
#ifdef O_CLOEXEC
(cloexec ? O_CLOEXEC : 0) |
#endif
(state.state->mode == GZ_READ ?
O_RDONLY :
(O_WRONLY | O_CREAT |
#ifdef O_EXCL
(exclusive ? O_EXCL : 0) |
#endif
(state.state->mode == GZ_WRITE ?
O_TRUNC :
O_APPEND)));
/* open the file with the appropriate flags (or just use fd) */
state.state->fd = fd > -1 ? fd : (
#ifdef WIDECHAR
fd == -2 ? _wopen(path, oflag, 0666) :
#endif
open((const char *)path, oflag, 0666));
if (state.state->fd == -1) {
free(state.state->path);
free(state.state);
return NULL;
}
if (state.state->mode == GZ_APPEND) {
LSEEK(state.state->fd, 0, SEEK_END); /* so gzoffset() is correct */
state.state->mode = GZ_WRITE; /* simplify later checks */
}
/* save the current position for rewinding (only if reading) */
if (state.state->mode == GZ_READ) {
state.state->start = LSEEK(state.state->fd, 0, SEEK_CUR);
if (state.state->start == -1) state.state->start = 0;
}
/* initialize stream */
gz_reset(state);
/* return stream */
return state.file;
}
/* -- see zlib.h -- */
gzFile ZEXPORT gzopen(const char *path, const char *mode) {
return gz_open(path, -1, mode);
}
/* -- see zlib.h -- */
gzFile ZEXPORT gzopen64(const char *path, const char *mode) {
return gz_open(path, -1, mode);
}
/* -- see zlib.h -- */
gzFile ZEXPORT gzdopen(int fd, const char *mode) {
char *path; /* identifier for error messages */
gzFile gz;
if (fd == -1 || (path = (char *)malloc(7 + 3 * sizeof(int))) == NULL)
return NULL;
#if !defined(NO_snprintf) && !defined(NO_vsnprintf)
(void)snprintf(path, 7 + 3 * sizeof(int), "", fd);
#else
sprintf(path, "", fd); /* for debugging */
#endif
gz = gz_open(path, fd, mode);
free(path);
return gz;
}
/* -- see zlib.h -- */
#ifdef WIDECHAR
gzFile ZEXPORT gzopen_w(const wchar_t *path, const char *mode) {
return gz_open(path, -2, mode);
}
#endif
/* -- see zlib.h -- */
int ZEXPORT gzbuffer(gzFile file, unsigned size) {
gz_statep state;
/* get internal structure and check integrity */
if (file == NULL)
return -1;
state.file = file;
if (state.state->mode != GZ_READ && state.state->mode != GZ_WRITE)
return -1;
/* make sure we haven't already allocated memory */
if (state.state->size != 0)
return -1;
/* check and set requested size */
if ((size << 1) < size)
return -1; /* need to be able to double it */
if (size < 2)
size = 2; /* need two bytes to check magic header */
state.state->want = size;
return 0;
}
/* -- see zlib.h -- */
int ZEXPORT gzrewind(gzFile file) {
gz_statep state;
/* get internal structure */
if (file == NULL)
return -1;
state.file = file;
/* check that we're reading and that there's no error */
if (state.state->mode != GZ_READ ||
(state.state->err != Z_OK && state.state->err != Z_BUF_ERROR))
return -1;
/* back up and start over */
if (LSEEK(state.state->fd, state.state->start, SEEK_SET) == -1)
return -1;
gz_reset(state);
return 0;
}
/* -- see zlib.h -- */
z_off64_t ZEXPORT gzseek64(gzFile file, z_off64_t offset, int whence) {
unsigned n;
z_off64_t ret;
gz_statep state;
/* get internal structure and check integrity */
if (file == NULL)
return -1;
state.file = file;
if (state.state->mode != GZ_READ && state.state->mode != GZ_WRITE)
return -1;
/* check that there's no error */
if (state.state->err != Z_OK && state.state->err != Z_BUF_ERROR)
return -1;
/* can only seek from start or relative to current position */
if (whence != SEEK_SET && whence != SEEK_CUR)
return -1;
/* normalize offset to a SEEK_CUR specification */
if (whence == SEEK_SET)
offset -= state.state->x.pos;
else if (state.state->seek)
offset += state.state->skip;
state.state->seek = 0;
/* if within raw area while reading, just go there */
if (state.state->mode == GZ_READ && state.state->how == COPY &&
state.state->x.pos + offset >= 0) {
ret = LSEEK(state.state->fd, offset - state.state->x.have, SEEK_CUR);
if (ret == -1)
return -1;
state.state->x.have = 0;
state.state->eof = 0;
state.state->past = 0;
state.state->seek = 0;
gz_error(state, Z_OK, NULL);
state.state->strm.avail_in = 0;
state.state->x.pos += offset;
return state.state->x.pos;
}
/* calculate skip amount, rewinding if needed for back seek when reading */
if (offset < 0) {
if (state.state->mode != GZ_READ) /* writing -- can't go backwards */
return -1;
offset += state.state->x.pos;
if (offset < 0) /* before start of file! */
return -1;
if (gzrewind(file) == -1) /* rewind, then skip to offset */
return -1;
}
/* if reading, skip what's in output buffer (one less gzgetc() check) */
if (state.state->mode == GZ_READ) {
n = GT_OFF(state.state->x.have) || (z_off64_t)state.state->x.have > offset ?
(unsigned)offset : state.state->x.have;
state.state->x.have -= n;
state.state->x.next += n;
state.state->x.pos += n;
offset -= n;
}
/* request skip (if not zero) */
if (offset) {
state.state->seek = 1;
state.state->skip = offset;
}
return state.state->x.pos + offset;
}
/* -- see zlib.h -- */
z_off_t ZEXPORT gzseek(gzFile file, z_off_t offset, int whence) {
z_off64_t ret;
ret = gzseek64(file, (z_off64_t)offset, whence);
return ret == (z_off_t)ret ? (z_off_t)ret : -1;
}
/* -- see zlib.h -- */
z_off64_t ZEXPORT gztell64(gzFile file) {
gz_statep state;
/* get internal structure and check integrity */
if (file == NULL)
return -1;
state.file = file;
if (state.state->mode != GZ_READ && state.state->mode != GZ_WRITE)
return -1;
/* return position */
return state.state->x.pos + (state.state->seek ? state.state->skip : 0);
}
/* -- see zlib.h -- */
z_off_t ZEXPORT gztell(gzFile file) {
z_off64_t ret;
ret = gztell64(file);
return ret == (z_off_t)ret ? (z_off_t)ret : -1;
}
/* -- see zlib.h -- */
z_off64_t ZEXPORT gzoffset64(gzFile file) {
z_off64_t offset;
gz_statep state;
/* get internal structure and check integrity */
if (file == NULL)
return -1;
state.file = file;
if (state.state->mode != GZ_READ && state.state->mode != GZ_WRITE)
return -1;
/* compute and return effective offset in file */
offset = LSEEK(state.state->fd, 0, SEEK_CUR);
if (offset == -1)
return -1;
if (state.state->mode == GZ_READ) /* reading */
offset -= state.state->strm.avail_in; /* don't count buffered input */
return offset;
}
/* -- see zlib.h -- */
z_off_t ZEXPORT gzoffset(gzFile file) {
z_off64_t ret;
ret = gzoffset64(file);
return ret == (z_off_t)ret ? (z_off_t)ret : -1;
}
/* -- see zlib.h -- */
int ZEXPORT gzeof(gzFile file) {
gz_statep state;
/* get internal structure and check integrity */
if (file == NULL)
return 0;
state.file = file;
if (state.state->mode != GZ_READ && state.state->mode != GZ_WRITE)
return 0;
/* return end-of-file state */
return state.state->mode == GZ_READ ? state.state->past : 0;
}
/* -- see zlib.h -- */
const char * ZEXPORT gzerror(gzFile file, int *errnum) {
gz_statep state;
/* get internal structure and check integrity */
if (file == NULL)
return NULL;
state.file = file;
if (state.state->mode != GZ_READ && state.state->mode != GZ_WRITE)
return NULL;
/* return error information */
if (errnum != NULL)
*errnum = state.state->err;
return state.state->err == Z_MEM_ERROR ? "out of memory" :
(state.state->msg == NULL ? "" : state.state->msg);
}
/* -- see zlib.h -- */
void ZEXPORT gzclearerr(gzFile file) {
gz_statep state;
/* get internal structure and check integrity */
if (file == NULL)
return;
state.file = file;
if (state.state->mode != GZ_READ && state.state->mode != GZ_WRITE)
return;
/* clear error and end-of-file */
if (state.state->mode == GZ_READ) {
state.state->eof = 0;
state.state->past = 0;
}
gz_error(state, Z_OK, NULL);
}
/* Create an error message in allocated memory and set state.state->err and
state.state->msg accordingly. Free any previous error message already there. Do
not try to free or allocate space if the error is Z_MEM_ERROR (out of
memory). Simply save the error message as a static string. If there is an
allocation failure constructing the error message, then convert the error to
out of memory. */
void ZLIB_INTERNAL gz_error(gz_statep state, int err, const char *msg) {
/* free previously allocated message and clear */
if (state.state->msg != NULL) {
if (state.state->err != Z_MEM_ERROR)
free(state.state->msg);
state.state->msg = NULL;
}
/* if fatal, set state.state->x.have to 0 so that the gzgetc() macro fails */
if (err != Z_OK && err != Z_BUF_ERROR)
state.state->x.have = 0;
/* set error code, and if no message, then done */
state.state->err = err;
if (msg == NULL)
return;
/* for an out of memory error, return literal string when requested */
if (err == Z_MEM_ERROR)
return;
/* construct error message with path */
if ((state.state->msg = (char *)malloc(strlen(state.state->path) + strlen(msg) + 3)) ==
NULL) {
state.state->err = Z_MEM_ERROR;
return;
}
#if !defined(NO_snprintf) && !defined(NO_vsnprintf)
(void)snprintf(state.state->msg, strlen(state.state->path) + strlen(msg) + 3,
"%s%s%s", state.state->path, ": ", msg);
#else
strcpy(state.state->msg, state.state->path);
strcat(state.state->msg, ": ");
strcat(state.state->msg, msg);
#endif
}
#ifndef INT_MAX
/* portably return maximum value for an int (when limits.h presumed not
available) -- we need to do this to cover cases where 2's complement not
used, since C standard permits 1's complement and sign-bit representations,
otherwise we could just use ((unsigned)-1) >> 1 */
unsigned ZLIB_INTERNAL gz_intmax() {
unsigned p, q;
p = 1;
do {
q = p;
p <<= 1;
p++;
} while (p > q);
return q >> 1;
}
#endif
form-5.0.1/extern/zstd/zlibWrapper/gzguts.h 0000644 0001751 0001751 00000016002 15217035741 014435 /* gzguts.h contains minimal changes required to be compiled with zlibWrapper:
* - #include "zlib.h" was changed to #include "zstd_zlibwrapper.h"
* - gz_statep was converted to union to work with -Wstrict-aliasing=1 */
/* gzguts.h -- zlib internal header definitions for gz* operations
* Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013, 2016 Mark Adler
* For conditions of distribution and use, see https://www.zlib.net/zlib_license.html
*/
#ifdef _LARGEFILE64_SOURCE
# ifndef _LARGEFILE_SOURCE
# define _LARGEFILE_SOURCE 1
# endif
# ifdef _FILE_OFFSET_BITS
# undef _FILE_OFFSET_BITS
# endif
#endif
#ifdef HAVE_HIDDEN
# define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
#else
# define ZLIB_INTERNAL
#endif
#include
#include "zstd_zlibwrapper.h"
#include "gzcompatibility.h"
#ifdef STDC
# include
# include
# include
#endif
#ifndef _POSIX_SOURCE
# define _POSIX_SOURCE
#endif
#include
#ifdef _WIN32
# include
#else
# include
#endif
#if defined(__TURBOC__) || defined(_MSC_VER) || defined(_WIN32)
# include
#endif
#if defined(_WIN32)
# define WIDECHAR
#endif
#ifdef WINAPI_FAMILY
# define open _open
# define read _read
# define write _write
# define close _close
#endif
#ifdef NO_DEFLATE /* for compatibility with old definition */
# define NO_GZCOMPRESS
#endif
#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550)
# ifndef HAVE_VSNPRINTF
# define HAVE_VSNPRINTF
# endif
#endif
#if defined(__CYGWIN__)
# ifndef HAVE_VSNPRINTF
# define HAVE_VSNPRINTF
# endif
#endif
#if defined(MSDOS) && defined(__BORLANDC__) && (BORLANDC > 0x410)
# ifndef HAVE_VSNPRINTF
# define HAVE_VSNPRINTF
# endif
#endif
#ifndef HAVE_VSNPRINTF
# ifdef MSDOS
/* vsnprintf may exist on some MS-DOS compilers (DJGPP?),
but for now we just assume it doesn't. */
# define NO_vsnprintf
# endif
# ifdef __TURBOC__
# define NO_vsnprintf
# endif
# ifdef WIN32
/* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
# if !defined(vsnprintf) && !defined(NO_vsnprintf)
# if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 )
# define vsnprintf _vsnprintf
# endif
# endif
# endif
# ifdef __SASC
# define NO_vsnprintf
# endif
# ifdef VMS
# define NO_vsnprintf
# endif
# ifdef __OS400__
# define NO_vsnprintf
# endif
# ifdef __MVS__
# define NO_vsnprintf
# endif
#endif
/* unlike snprintf (which is required in C99), _snprintf does not guarantee
null termination of the result -- however this is only used in gzlib.c where
the result is assured to fit in the space provided */
#if defined(_MSC_VER) && _MSC_VER < 1900
# define snprintf _snprintf
#endif
#ifndef local
# define local static
#endif
/* since "static" is used to mean two completely different things in C, we
define "local" for the non-static meaning of "static", for readability
(compile with -Dlocal if your debugger can't find static symbols) */
/* gz* functions always use library allocation functions */
#ifndef STDC
extern voidp malloc _Z_OF((uInt size));
extern void free _Z_OF((voidpf ptr));
#endif
/* get errno and strerror definition */
#if defined UNDER_CE
# include
# define zstrerror() gz_strwinerror((DWORD)GetLastError())
#else
# ifndef NO_STRERROR
# include
# define zstrerror() strerror(errno)
# else
# define zstrerror() "stdio error (consult errno)"
# endif
#endif
/* provide prototypes for these when building zlib without LFS */
#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0
ZEXTERN gzFile ZEXPORT gzopen64 _Z_OF((const char *, const char *));
ZEXTERN z_off64_t ZEXPORT gzseek64 _Z_OF((gzFile, z_off64_t, int));
ZEXTERN z_off64_t ZEXPORT gztell64 _Z_OF((gzFile));
ZEXTERN z_off64_t ZEXPORT gzoffset64 _Z_OF((gzFile));
#endif
/* default memLevel */
#if MAX_MEM_LEVEL >= 8
# define DEF_MEM_LEVEL 8
#else
# define DEF_MEM_LEVEL MAX_MEM_LEVEL
#endif
/* default i/o buffer size -- double this for output when reading (this and
twice this must be able to fit in an unsigned type) */
#define GZBUFSIZE 8192
/* gzip modes, also provide a little integrity check on the passed structure */
#define GZ_NONE 0
#define GZ_READ 7247
#define GZ_WRITE 31153
#define GZ_APPEND 1 /* mode set to GZ_WRITE after the file is opened */
/* values for gz_state how */
#define LOOK 0 /* look for a gzip header */
#define COPY 1 /* copy input directly */
#define GZIP 2 /* decompress a gzip stream */
/* internal gzip file state data structure */
typedef struct {
/* exposed contents for gzgetc() macro */
struct gzFile_s x; /* "x" for exposed */
/* x.have: number of bytes available at x.next */
/* x.next: next output data to deliver or write */
/* x.pos: current position in uncompressed data */
/* used for both reading and writing */
int mode; /* see gzip modes above */
int fd; /* file descriptor */
char *path; /* path or fd for error messages */
unsigned size; /* buffer size, zero if not allocated yet */
unsigned want; /* requested buffer size, default is GZBUFSIZE */
unsigned char *in; /* input buffer (double-sized when writing) */
unsigned char *out; /* output buffer (double-sized when reading) */
int direct; /* 0 if processing gzip, 1 if transparent */
/* just for reading */
int how; /* 0: get header, 1: copy, 2: decompress */
z_off64_t start; /* where the gzip data started, for rewinding */
int eof; /* true if end of input file reached */
int past; /* true if read requested past end */
/* just for writing */
int level; /* compression level */
int strategy; /* compression strategy */
/* seek request */
z_off64_t skip; /* amount to skip (already rewound if backwards) */
int seek; /* true if seek request pending */
/* error information */
int err; /* error code */
char *msg; /* error message */
/* zlib inflate or deflate stream */
z_stream strm; /* stream structure in-place (not a pointer) */
} gz_state;
typedef union {
gz_state FAR *state;
gzFile file;
} gz_statep;
/* shared functions */
void ZLIB_INTERNAL gz_error _Z_OF((gz_statep, int, const char *));
#if defined UNDER_CE
char ZLIB_INTERNAL *gz_strwinerror _Z_OF((DWORD error));
#endif
/* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t
value -- needed when comparing unsigned to z_off64_t, which is signed
(possible z_off64_t types off_t, off64_t, and long are all signed) */
#ifdef INT_MAX
# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX)
#else
unsigned ZLIB_INTERNAL gz_intmax _Z_OF((void));
# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax())
#endif
form-5.0.1/extern/zstd/zlibWrapper/zstd_zlibwrapper.c 0000644 0001751 0001751 00000124114 15217035741 016516 /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under both the BSD-style license (found in the
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
* in the COPYING file in the root directory of this source tree).
* You may select, at your option, one of the above-listed licenses.
*/
/* === Tuning parameters === */
#ifndef ZWRAP_USE_ZSTD
#define ZWRAP_USE_ZSTD 0
#endif
/* === Dependencies === */
#include
#include /* vsprintf */
#include /* va_list, for z_gzprintf */
#include
#define NO_DUMMY_DECL
#define ZLIB_CONST
#include /* without #define Z_PREFIX */
#include "zstd_zlibwrapper.h"
#define ZSTD_STATIC_LINKING_ONLY /* ZSTD_isFrame, ZSTD_MAGICNUMBER, ZSTD_customMem */
#include "zstd.h"
/* === Constants === */
#define Z_INFLATE_SYNC 8
#define ZLIB_HEADERSIZE 4
#define ZSTD_HEADERSIZE ZSTD_FRAMEHEADERSIZE_MIN(ZSTD_f_zstd1)
#define ZWRAP_DEFAULT_CLEVEL 3 /* Z_DEFAULT_COMPRESSION is translated to ZWRAP_DEFAULT_CLEVEL for zstd */
/* === Debug === */
#define LOG_WRAPPERC(...) /* fprintf(stderr, __VA_ARGS__) */
#define LOG_WRAPPERD(...) /* fprintf(stderr, __VA_ARGS__) */
#define FINISH_WITH_GZ_ERR(msg) { (void)msg; return Z_STREAM_ERROR; }
#define FINISH_WITH_NULL_ERR(msg) { (void)msg; return NULL; }
/* === Utility === */
#define MIN(x,y) ((x) < (y) ? (x) : (y))
static unsigned ZWRAP_isLittleEndian(void)
{
const union { unsigned u; char c[4]; } one = { 1 }; /* don't use static : performance detrimental */
return one.c[0];
}
#ifndef __has_builtin
# define __has_builtin(x) 0
#endif
static unsigned ZWRAP_swap32(unsigned in)
{
#if defined(_MSC_VER) /* Visual Studio */
return _byteswap_ulong(in);
#elif (defined (__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 403)) \
|| (defined(__clang__) && __has_builtin(__builtin_bswap32))
return __builtin_bswap32(in);
#else
return ((in << 24) & 0xff000000 ) |
((in << 8) & 0x00ff0000 ) |
((in >> 8) & 0x0000ff00 ) |
((in >> 24) & 0x000000ff );
#endif
}
static unsigned ZWRAP_readLE32(const void* ptr)
{
unsigned value;
memcpy(&value, ptr, sizeof(value));
if (ZWRAP_isLittleEndian())
return value;
else
return ZWRAP_swap32(value);
}
/* === Wrapper === */
static int g_ZWRAP_useZSTDcompression = ZWRAP_USE_ZSTD; /* 0 = don't use ZSTD */
void ZWRAP_useZSTDcompression(int turn_on) { g_ZWRAP_useZSTDcompression = turn_on; }
int ZWRAP_isUsingZSTDcompression(void) { return g_ZWRAP_useZSTDcompression; }
static ZWRAP_decompress_type g_ZWRAPdecompressionType = ZWRAP_AUTO;
void ZWRAP_setDecompressionType(ZWRAP_decompress_type type) { g_ZWRAPdecompressionType = type; }
ZWRAP_decompress_type ZWRAP_getDecompressionType(void) { return g_ZWRAPdecompressionType; }
const char * zstdVersion(void) { return ZSTD_VERSION_STRING; }
ZEXTERN const char * ZEXPORT z_zlibVersion _Z_OF((void)) { return zlibVersion(); }
static void* ZWRAP_allocFunction(void* opaque, size_t size)
{
z_streamp strm = (z_streamp) opaque;
void* address = strm->zalloc(strm->opaque, 1, (uInt)size);
/* LOG_WRAPPERC("ZWRAP alloc %p, %d \n", address, (int)size); */
return address;
}
static void ZWRAP_freeFunction(void* opaque, void* address)
{
z_streamp strm = (z_streamp) opaque;
strm->zfree(strm->opaque, address);
/* if (address) LOG_WRAPPERC("ZWRAP free %p \n", address); */
}
static void* ZWRAP_customMalloc(size_t size, ZSTD_customMem customMem)
{
if (customMem.customAlloc)
return customMem.customAlloc(customMem.opaque, size);
return malloc(size);
}
static void* ZWRAP_customCalloc(size_t size, ZSTD_customMem customMem)
{
if (customMem.customAlloc) {
/* calloc implemented as malloc+memset;
* not as efficient as calloc, but next best guess for custom malloc */
void* const ptr = customMem.customAlloc(customMem.opaque, size);
memset(ptr, 0, size);
return ptr;
}
return calloc(1, size);
}
static void ZWRAP_customFree(void* ptr, ZSTD_customMem customMem)
{
if (ptr!=NULL) {
if (customMem.customFree)
customMem.customFree(customMem.opaque, ptr);
else
free(ptr);
}
}
/* === Compression === */
typedef enum { ZWRAP_useInit, ZWRAP_useReset, ZWRAP_streamEnd } ZWRAP_state_t;
typedef struct {
ZSTD_CStream* zbc;
int compressionLevel;
int streamEnd; /* a flag to signal the end of a stream */
unsigned long long totalInBytes; /* we need it as strm->total_in can be reset by user */
ZSTD_customMem customMem;
z_stream allocFunc; /* copy of zalloc, zfree, opaque */
ZSTD_inBuffer inBuffer;
ZSTD_outBuffer outBuffer;
ZWRAP_state_t comprState;
unsigned long long pledgedSrcSize;
} ZWRAP_CCtx;
/* typedef ZWRAP_CCtx internal_state; */
static size_t ZWRAP_freeCCtx(ZWRAP_CCtx* zwc)
{
if (zwc==NULL) return 0; /* support free on NULL */
ZSTD_freeCStream(zwc->zbc);
ZWRAP_customFree(zwc, zwc->customMem);
return 0;
}
static ZWRAP_CCtx* ZWRAP_createCCtx(z_streamp strm)
{
ZWRAP_CCtx* zwc;
ZSTD_customMem customMem = { NULL, NULL, NULL };
if (strm->zalloc && strm->zfree) {
customMem.customAlloc = ZWRAP_allocFunction;
customMem.customFree = ZWRAP_freeFunction;
}
customMem.opaque = strm;
zwc = (ZWRAP_CCtx*)ZWRAP_customCalloc(sizeof(ZWRAP_CCtx), customMem);
if (zwc == NULL) return NULL;
zwc->allocFunc = *strm;
customMem.opaque = &zwc->allocFunc;
zwc->customMem = customMem;
return zwc;
}
static int ZWRAP_initializeCStream(ZWRAP_CCtx* zwc, const void* dict, size_t dictSize, unsigned long long pledgedSrcSize)
{
LOG_WRAPPERC("- ZWRAP_initializeCStream=%p\n", zwc);
if (zwc == NULL || zwc->zbc == NULL) return Z_STREAM_ERROR;
if (!pledgedSrcSize) pledgedSrcSize = zwc->pledgedSrcSize;
{ unsigned initErr = 0;
ZSTD_parameters const params = ZSTD_getParams(zwc->compressionLevel, pledgedSrcSize, dictSize);
ZSTD_CCtx_params* cctxParams = ZSTD_createCCtxParams();
if (!cctxParams) return Z_STREAM_ERROR;
LOG_WRAPPERC("pledgedSrcSize=%d windowLog=%d chainLog=%d hashLog=%d searchLog=%d minMatch=%d strategy=%d\n",
(int)pledgedSrcSize, params.cParams.windowLog, params.cParams.chainLog, params.cParams.hashLog, params.cParams.searchLog, params.cParams.minMatch, params.cParams.strategy);
initErr |= ZSTD_isError(ZSTD_CCtx_reset(zwc->zbc, ZSTD_reset_session_only));
initErr |= ZSTD_isError(ZSTD_CCtxParams_init_advanced(cctxParams, params));
initErr |= ZSTD_isError(ZSTD_CCtx_setParametersUsingCCtxParams(zwc->zbc, cctxParams));
initErr |= ZSTD_isError(ZSTD_CCtx_setPledgedSrcSize(zwc->zbc, pledgedSrcSize));
initErr |= ZSTD_isError(ZSTD_CCtx_loadDictionary(zwc->zbc, dict, dictSize));
ZSTD_freeCCtxParams(cctxParams);
if (initErr) return Z_STREAM_ERROR;
}
return Z_OK;
}
static int ZWRAPC_finishWithError(ZWRAP_CCtx* zwc, z_streamp strm, int error)
{
LOG_WRAPPERC("- ZWRAPC_finishWithError=%d\n", error);
if (zwc) ZWRAP_freeCCtx(zwc);
if (strm) strm->state = NULL;
return (error) ? error : Z_STREAM_ERROR;
}
static int ZWRAPC_finishWithErrorMsg(z_streamp strm, char* message)
{
ZWRAP_CCtx* zwc = (ZWRAP_CCtx*) strm->state;
strm->msg = message;
if (zwc == NULL) return Z_STREAM_ERROR;
return ZWRAPC_finishWithError(zwc, strm, 0);
}
int ZWRAP_setPledgedSrcSize(z_streamp strm, unsigned long long pledgedSrcSize)
{
ZWRAP_CCtx* zwc = (ZWRAP_CCtx*) strm->state;
if (zwc == NULL) return Z_STREAM_ERROR;
zwc->pledgedSrcSize = pledgedSrcSize;
zwc->comprState = ZWRAP_useInit;
return Z_OK;
}
static struct internal_state* convert_into_sis(void* ptr)
{
return (struct internal_state*) ptr;
}
ZEXTERN int ZEXPORT z_deflateInit_ _Z_OF((z_streamp strm, int level,
const char *version, int stream_size))
{
ZWRAP_CCtx* zwc;
LOG_WRAPPERC("- deflateInit level=%d\n", level);
if (!g_ZWRAP_useZSTDcompression) {
return deflateInit_((strm), (level), version, stream_size);
}
zwc = ZWRAP_createCCtx(strm);
if (zwc == NULL) return Z_MEM_ERROR;
if (level == Z_DEFAULT_COMPRESSION)
level = ZWRAP_DEFAULT_CLEVEL;
zwc->streamEnd = 0;
zwc->totalInBytes = 0;
zwc->compressionLevel = level;
strm->state = convert_into_sis(zwc); /* use state which in not used by user */
strm->total_in = 0;
strm->total_out = 0;
strm->adler = 0;
return Z_OK;
}
ZEXTERN int ZEXPORT z_deflateInit2_ _Z_OF((z_streamp strm, int level, int method,
int windowBits, int memLevel,
int strategy, const char *version,
int stream_size))
{
if (!g_ZWRAP_useZSTDcompression)
return deflateInit2_(strm, level, method, windowBits, memLevel, strategy, version, stream_size);
return z_deflateInit_ (strm, level, version, stream_size);
}
int ZWRAP_deflateReset_keepDict(z_streamp strm)
{
LOG_WRAPPERC("- ZWRAP_deflateReset_keepDict\n");
if (!g_ZWRAP_useZSTDcompression)
return deflateReset(strm);
{ ZWRAP_CCtx* zwc = (ZWRAP_CCtx*) strm->state;
if (zwc) {
zwc->streamEnd = 0;
zwc->totalInBytes = 0;
}
}
strm->total_in = 0;
strm->total_out = 0;
strm->adler = 0;
return Z_OK;
}
ZEXTERN int ZEXPORT z_deflateReset _Z_OF((z_streamp strm))
{
LOG_WRAPPERC("- deflateReset\n");
if (!g_ZWRAP_useZSTDcompression)
return deflateReset(strm);
ZWRAP_deflateReset_keepDict(strm);
{ ZWRAP_CCtx* zwc = (ZWRAP_CCtx*) strm->state;
if (zwc) zwc->comprState = ZWRAP_useInit;
}
return Z_OK;
}
ZEXTERN int ZEXPORT z_deflateSetDictionary _Z_OF((z_streamp strm,
const Bytef *dictionary,
uInt dictLength))
{
if (!g_ZWRAP_useZSTDcompression) {
LOG_WRAPPERC("- deflateSetDictionary\n");
return deflateSetDictionary(strm, dictionary, dictLength);
}
{ ZWRAP_CCtx* zwc = (ZWRAP_CCtx*) strm->state;
LOG_WRAPPERC("- deflateSetDictionary level=%d\n", (int)zwc->compressionLevel);
if (!zwc) return Z_STREAM_ERROR;
if (zwc->zbc == NULL) {
zwc->zbc = ZSTD_createCStream_advanced(zwc->customMem);
if (zwc->zbc == NULL) return ZWRAPC_finishWithError(zwc, strm, 0);
}
{ int res = ZWRAP_initializeCStream(zwc, dictionary, dictLength, ZSTD_CONTENTSIZE_UNKNOWN);
if (res != Z_OK) return ZWRAPC_finishWithError(zwc, strm, res); }
zwc->comprState = ZWRAP_useReset;
}
return Z_OK;
}
ZEXTERN int ZEXPORT z_deflate _Z_OF((z_streamp strm, int flush))
{
ZWRAP_CCtx* zwc;
if (!g_ZWRAP_useZSTDcompression) {
LOG_WRAPPERC("- deflate1 flush=%d avail_in=%d avail_out=%d total_in=%d total_out=%d\n",
(int)flush, (int)strm->avail_in, (int)strm->avail_out, (int)strm->total_in, (int)strm->total_out);
return deflate(strm, flush);
}
zwc = (ZWRAP_CCtx*) strm->state;
if (zwc == NULL) { LOG_WRAPPERC("zwc == NULL\n"); return Z_STREAM_ERROR; }
if (zwc->zbc == NULL) {
zwc->zbc = ZSTD_createCStream_advanced(zwc->customMem);
if (zwc->zbc == NULL) return ZWRAPC_finishWithError(zwc, strm, 0);
{ int const initErr = ZWRAP_initializeCStream(zwc, NULL, 0, (flush == Z_FINISH) ? strm->avail_in : ZSTD_CONTENTSIZE_UNKNOWN);
if (initErr != Z_OK) return ZWRAPC_finishWithError(zwc, strm, initErr); }
if (flush != Z_FINISH) zwc->comprState = ZWRAP_useReset;
} else {
if (zwc->totalInBytes == 0) {
if (zwc->comprState == ZWRAP_useReset) {
size_t resetErr = ZSTD_CCtx_reset(zwc->zbc, ZSTD_reset_session_only);
if (ZSTD_isError(resetErr)) {
LOG_WRAPPERC("ERROR: ZSTD_CCtx_reset errorCode=%s\n",
ZSTD_getErrorName(resetErr));
return ZWRAPC_finishWithError(zwc, strm, 0);
}
resetErr = ZSTD_CCtx_setPledgedSrcSize(zwc->zbc, (flush == Z_FINISH) ? strm->avail_in : zwc->pledgedSrcSize);
if (ZSTD_isError(resetErr)) {
LOG_WRAPPERC("ERROR: ZSTD_CCtx_setPledgedSrcSize errorCode=%s\n",
ZSTD_getErrorName(resetErr));
return ZWRAPC_finishWithError(zwc, strm, 0);
}
} else {
int const res = ZWRAP_initializeCStream(zwc, NULL, 0, (flush == Z_FINISH) ? strm->avail_in : ZSTD_CONTENTSIZE_UNKNOWN);
if (res != Z_OK) return ZWRAPC_finishWithError(zwc, strm, res);
if (flush != Z_FINISH) zwc->comprState = ZWRAP_useReset;
}
} /* (zwc->totalInBytes == 0) */
} /* ! (zwc->zbc == NULL) */
LOG_WRAPPERC("- deflate2 flush=%d avail_in=%d avail_out=%d total_in=%d total_out=%d\n", (int)flush, (int)strm->avail_in, (int)strm->avail_out, (int)strm->total_in, (int)strm->total_out);
if (strm->avail_in > 0) {
zwc->inBuffer.src = strm->next_in;
zwc->inBuffer.size = strm->avail_in;
zwc->inBuffer.pos = 0;
zwc->outBuffer.dst = strm->next_out;
zwc->outBuffer.size = strm->avail_out;
zwc->outBuffer.pos = 0;
{ size_t const cErr = ZSTD_compressStream(zwc->zbc, &zwc->outBuffer, &zwc->inBuffer);
LOG_WRAPPERC("deflate ZSTD_compressStream srcSize=%d dstCapacity=%d\n", (int)zwc->inBuffer.size, (int)zwc->outBuffer.size);
if (ZSTD_isError(cErr)) return ZWRAPC_finishWithError(zwc, strm, 0);
}
strm->next_out += zwc->outBuffer.pos;
strm->total_out += zwc->outBuffer.pos;
strm->avail_out -= zwc->outBuffer.pos;
strm->total_in += zwc->inBuffer.pos;
zwc->totalInBytes += zwc->inBuffer.pos;
strm->next_in += zwc->inBuffer.pos;
strm->avail_in -= zwc->inBuffer.pos;
}
if (flush == Z_FULL_FLUSH
#if ZLIB_VERNUM >= 0x1240
|| flush == Z_TREES
#endif
|| flush == Z_BLOCK)
return ZWRAPC_finishWithErrorMsg(strm, "Z_FULL_FLUSH, Z_BLOCK and Z_TREES are not supported!");
if (flush == Z_FINISH) {
size_t bytesLeft;
if (zwc->streamEnd) return Z_STREAM_END;
zwc->outBuffer.dst = strm->next_out;
zwc->outBuffer.size = strm->avail_out;
zwc->outBuffer.pos = 0;
bytesLeft = ZSTD_endStream(zwc->zbc, &zwc->outBuffer);
LOG_WRAPPERC("deflate ZSTD_endStream dstCapacity=%d bytesLeft=%d\n", (int)strm->avail_out, (int)bytesLeft);
if (ZSTD_isError(bytesLeft)) return ZWRAPC_finishWithError(zwc, strm, 0);
strm->next_out += zwc->outBuffer.pos;
strm->total_out += zwc->outBuffer.pos;
strm->avail_out -= zwc->outBuffer.pos;
if (bytesLeft == 0) {
zwc->streamEnd = 1;
LOG_WRAPPERC("Z_STREAM_END2 strm->total_in=%d strm->avail_out=%d strm->total_out=%d\n",
(int)strm->total_in, (int)strm->avail_out, (int)strm->total_out);
return Z_STREAM_END;
} }
else
if (flush == Z_SYNC_FLUSH || flush == Z_PARTIAL_FLUSH) {
size_t bytesLeft;
zwc->outBuffer.dst = strm->next_out;
zwc->outBuffer.size = strm->avail_out;
zwc->outBuffer.pos = 0;
bytesLeft = ZSTD_flushStream(zwc->zbc, &zwc->outBuffer);
LOG_WRAPPERC("deflate ZSTD_flushStream dstCapacity=%d bytesLeft=%d\n", (int)strm->avail_out, (int)bytesLeft);
if (ZSTD_isError(bytesLeft)) return ZWRAPC_finishWithError(zwc, strm, 0);
strm->next_out += zwc->outBuffer.pos;
strm->total_out += zwc->outBuffer.pos;
strm->avail_out -= zwc->outBuffer.pos;
}
LOG_WRAPPERC("- deflate3 flush=%d avail_in=%d avail_out=%d total_in=%d total_out=%d\n", (int)flush, (int)strm->avail_in, (int)strm->avail_out, (int)strm->total_in, (int)strm->total_out);
return Z_OK;
}
ZEXTERN int ZEXPORT z_deflateEnd _Z_OF((z_streamp strm))
{
if (!g_ZWRAP_useZSTDcompression) {
LOG_WRAPPERC("- deflateEnd\n");
return deflateEnd(strm);
}
LOG_WRAPPERC("- deflateEnd total_in=%d total_out=%d\n", (int)(strm->total_in), (int)(strm->total_out));
{ size_t errorCode;
ZWRAP_CCtx* zwc = (ZWRAP_CCtx*) strm->state;
if (zwc == NULL) return Z_OK; /* structures are already freed */
strm->state = NULL;
errorCode = ZWRAP_freeCCtx(zwc);
if (ZSTD_isError(errorCode)) return Z_STREAM_ERROR;
}
return Z_OK;
}
ZEXTERN uLong ZEXPORT z_deflateBound _Z_OF((z_streamp strm,
uLong sourceLen))
{
if (!g_ZWRAP_useZSTDcompression)
return deflateBound(strm, sourceLen);
return ZSTD_compressBound(sourceLen);
}
ZEXTERN int ZEXPORT z_deflateParams _Z_OF((z_streamp strm,
int level,
int strategy))
{
if (!g_ZWRAP_useZSTDcompression) {
LOG_WRAPPERC("- deflateParams level=%d strategy=%d\n", level, strategy);
return deflateParams(strm, level, strategy);
}
return Z_OK;
}
/* === Decompression === */
typedef enum { ZWRAP_ZLIB_STREAM, ZWRAP_ZSTD_STREAM, ZWRAP_UNKNOWN_STREAM } ZWRAP_stream_type;
typedef struct {
ZSTD_DStream* zbd;
char headerBuf[16]; /* must be >= ZSTD_frameHeaderSize_min */
int errorCount;
unsigned long long totalInBytes; /* we need it as strm->total_in can be reset by user */
ZWRAP_state_t decompState;
ZSTD_inBuffer inBuffer;
ZSTD_outBuffer outBuffer;
/* zlib params */
int stream_size;
char *version;
int windowBits;
ZSTD_customMem customMem;
z_stream allocFunc; /* just to copy zalloc, zfree, opaque */
} ZWRAP_DCtx;
static void ZWRAP_initDCtx(ZWRAP_DCtx* zwd)
{
zwd->errorCount = 0;
zwd->outBuffer.pos = 0;
zwd->outBuffer.size = 0;
}
static ZWRAP_DCtx* ZWRAP_createDCtx(z_streamp strm)
{
ZWRAP_DCtx* zwd;
ZSTD_customMem customMem = { NULL, NULL, NULL };
if (strm->zalloc && strm->zfree) {
customMem.customAlloc = ZWRAP_allocFunction;
customMem.customFree = ZWRAP_freeFunction;
}
customMem.opaque = strm;
zwd = (ZWRAP_DCtx*)ZWRAP_customCalloc(sizeof(ZWRAP_DCtx), customMem);
if (zwd == NULL) return NULL;
zwd->allocFunc = *strm;
customMem.opaque = &zwd->allocFunc;
zwd->customMem = customMem;
ZWRAP_initDCtx(zwd);
return zwd;
}
static size_t ZWRAP_freeDCtx(ZWRAP_DCtx* zwd)
{
if (zwd==NULL) return 0; /* support free on null */
ZSTD_freeDStream(zwd->zbd);
ZWRAP_customFree(zwd->version, zwd->customMem);
ZWRAP_customFree(zwd, zwd->customMem);
return 0;
}
int ZWRAP_isUsingZSTDdecompression(z_streamp strm)
{
if (strm == NULL) return 0;
return (strm->reserved == ZWRAP_ZSTD_STREAM);
}
static int ZWRAPD_finishWithError(ZWRAP_DCtx* zwd, z_streamp strm, int error)
{
LOG_WRAPPERD("- ZWRAPD_finishWithError=%d\n", error);
ZWRAP_freeDCtx(zwd);
strm->state = NULL;
return (error) ? error : Z_STREAM_ERROR;
}
static int ZWRAPD_finishWithErrorMsg(z_streamp strm, char* message)
{
ZWRAP_DCtx* const zwd = (ZWRAP_DCtx*) strm->state;
strm->msg = message;
if (zwd == NULL) return Z_STREAM_ERROR;
return ZWRAPD_finishWithError(zwd, strm, 0);
}
ZEXTERN int ZEXPORT z_inflateInit_ _Z_OF((z_streamp strm,
const char* version, int stream_size))
{
if (g_ZWRAPdecompressionType == ZWRAP_FORCE_ZLIB) {
strm->reserved = ZWRAP_ZLIB_STREAM;
return inflateInit(strm);
}
{ ZWRAP_DCtx* const zwd = ZWRAP_createDCtx(strm);
LOG_WRAPPERD("- inflateInit\n");
if (zwd == NULL) return ZWRAPD_finishWithError(zwd, strm, 0);
zwd->version = (char*)ZWRAP_customMalloc(strlen(version)+1, zwd->customMem);
if (zwd->version == NULL) return ZWRAPD_finishWithError(zwd, strm, 0);
strcpy(zwd->version, version);
zwd->stream_size = stream_size;
zwd->totalInBytes = 0;
strm->state = convert_into_sis(zwd);
strm->total_in = 0;
strm->total_out = 0;
strm->reserved = ZWRAP_UNKNOWN_STREAM;
strm->adler = 0;
}
return Z_OK;
}
ZEXTERN int ZEXPORT z_inflateInit2_ _Z_OF((z_streamp strm, int windowBits,
const char *version, int stream_size))
{
if (g_ZWRAPdecompressionType == ZWRAP_FORCE_ZLIB) {
return inflateInit2_(strm, windowBits, version, stream_size);
}
{ int const ret = z_inflateInit_ (strm, version, stream_size);
LOG_WRAPPERD("- inflateInit2 windowBits=%d\n", windowBits);
if (ret == Z_OK) {
ZWRAP_DCtx* const zwd = (ZWRAP_DCtx*)strm->state;
if (zwd == NULL) return Z_STREAM_ERROR;
zwd->windowBits = windowBits;
}
return ret;
}
}
int ZWRAP_inflateReset_keepDict(z_streamp strm)
{
LOG_WRAPPERD("- ZWRAP_inflateReset_keepDict\n");
if (g_ZWRAPdecompressionType == ZWRAP_FORCE_ZLIB || !strm->reserved)
return inflateReset(strm);
{ ZWRAP_DCtx* const zwd = (ZWRAP_DCtx*) strm->state;
if (zwd == NULL) return Z_STREAM_ERROR;
ZWRAP_initDCtx(zwd);
zwd->decompState = ZWRAP_useReset;
zwd->totalInBytes = 0;
}
strm->total_in = 0;
strm->total_out = 0;
return Z_OK;
}
ZEXTERN int ZEXPORT z_inflateReset _Z_OF((z_streamp strm))
{
LOG_WRAPPERD("- inflateReset\n");
if (g_ZWRAPdecompressionType == ZWRAP_FORCE_ZLIB || !strm->reserved)
return inflateReset(strm);
{ int const ret = ZWRAP_inflateReset_keepDict(strm);
if (ret != Z_OK) return ret; }
{ ZWRAP_DCtx* const zwd = (ZWRAP_DCtx*) strm->state;
if (zwd == NULL) return Z_STREAM_ERROR;
zwd->decompState = ZWRAP_useInit; }
return Z_OK;
}
#if ZLIB_VERNUM >= 0x1240
ZEXTERN int ZEXPORT z_inflateReset2 _Z_OF((z_streamp strm,
int windowBits))
{
if (g_ZWRAPdecompressionType == ZWRAP_FORCE_ZLIB || !strm->reserved)
return inflateReset2(strm, windowBits);
{ int const ret = z_inflateReset (strm);
if (ret == Z_OK) {
ZWRAP_DCtx* const zwd = (ZWRAP_DCtx*)strm->state;
if (zwd == NULL) return Z_STREAM_ERROR;
zwd->windowBits = windowBits;
}
return ret;
}
}
#endif
ZEXTERN int ZEXPORT z_inflateSetDictionary _Z_OF((z_streamp strm,
const Bytef *dictionary,
uInt dictLength))
{
LOG_WRAPPERD("- inflateSetDictionary\n");
if (g_ZWRAPdecompressionType == ZWRAP_FORCE_ZLIB || !strm->reserved)
return inflateSetDictionary(strm, dictionary, dictLength);
{ ZWRAP_DCtx* const zwd = (ZWRAP_DCtx*) strm->state;
if (zwd == NULL || zwd->zbd == NULL) return Z_STREAM_ERROR;
{ size_t const resetErr = ZSTD_DCtx_reset(zwd->zbd, ZSTD_reset_session_only);
if (ZSTD_isError(resetErr)) return ZWRAPD_finishWithError(zwd, strm, 0); }
{ size_t const loadErr = ZSTD_DCtx_loadDictionary(zwd->zbd, dictionary, dictLength);
if (ZSTD_isError(loadErr)) return ZWRAPD_finishWithError(zwd, strm, 0); }
zwd->decompState = ZWRAP_useReset;
if (zwd->totalInBytes == ZSTD_HEADERSIZE) {
zwd->inBuffer.src = zwd->headerBuf;
zwd->inBuffer.size = zwd->totalInBytes;
zwd->inBuffer.pos = 0;
zwd->outBuffer.dst = strm->next_out;
zwd->outBuffer.size = 0;
zwd->outBuffer.pos = 0;
{ size_t const errorCode = ZSTD_decompressStream(zwd->zbd, &zwd->outBuffer, &zwd->inBuffer);
LOG_WRAPPERD("inflateSetDictionary ZSTD_decompressStream errorCode=%d srcSize=%d dstCapacity=%d\n",
(int)errorCode, (int)zwd->inBuffer.size, (int)zwd->outBuffer.size);
if (zwd->inBuffer.pos < zwd->outBuffer.size || ZSTD_isError(errorCode)) {
LOG_WRAPPERD("ERROR: ZSTD_decompressStream %s\n",
ZSTD_getErrorName(errorCode));
return ZWRAPD_finishWithError(zwd, strm, 0);
} } } }
return Z_OK;
}
ZEXTERN int ZEXPORT z_inflate _Z_OF((z_streamp strm, int flush))
{
ZWRAP_DCtx* zwd;
if (g_ZWRAPdecompressionType == ZWRAP_FORCE_ZLIB || !strm->reserved) {
int const result = inflate(strm, flush);
LOG_WRAPPERD("- inflate2 flush=%d avail_in=%d avail_out=%d total_in=%d total_out=%d res=%d\n",
(int)flush, (int)strm->avail_in, (int)strm->avail_out, (int)strm->total_in, (int)strm->total_out, result);
return result;
}
if (strm->avail_in <= 0) return Z_OK;
zwd = (ZWRAP_DCtx*) strm->state;
LOG_WRAPPERD("- inflate1 flush=%d avail_in=%d avail_out=%d total_in=%d total_out=%d\n",
(int)flush, (int)strm->avail_in, (int)strm->avail_out, (int)strm->total_in, (int)strm->total_out);
if (zwd == NULL) return Z_STREAM_ERROR;
if (zwd->decompState == ZWRAP_streamEnd) return Z_STREAM_END;
if (zwd->totalInBytes < ZLIB_HEADERSIZE) {
if (zwd->totalInBytes == 0 && strm->avail_in >= ZLIB_HEADERSIZE) {
if (ZWRAP_readLE32(strm->next_in) != ZSTD_MAGICNUMBER) {
{ int const initErr = (zwd->windowBits) ?
inflateInit2_(strm, zwd->windowBits, zwd->version, zwd->stream_size) :
inflateInit_(strm, zwd->version, zwd->stream_size);
LOG_WRAPPERD("ZLIB inflateInit errorCode=%d\n", initErr);
if (initErr != Z_OK) return ZWRAPD_finishWithError(zwd, strm, initErr);
}
strm->reserved = ZWRAP_ZLIB_STREAM;
{ size_t const freeErr = ZWRAP_freeDCtx(zwd);
if (ZSTD_isError(freeErr)) goto error; }
{ int const result = (flush == Z_INFLATE_SYNC) ?
inflateSync(strm) :
inflate(strm, flush);
LOG_WRAPPERD("- inflate3 flush=%d avail_in=%d avail_out=%d total_in=%d total_out=%d res=%d\n",
(int)flush, (int)strm->avail_in, (int)strm->avail_out, (int)strm->total_in, (int)strm->total_out, res);
return result;
} }
} else { /* ! (zwd->totalInBytes == 0 && strm->avail_in >= ZLIB_HEADERSIZE) */
size_t const srcSize = MIN(strm->avail_in, ZLIB_HEADERSIZE - zwd->totalInBytes);
memcpy(zwd->headerBuf+zwd->totalInBytes, strm->next_in, srcSize);
strm->total_in += srcSize;
zwd->totalInBytes += srcSize;
strm->next_in += srcSize;
strm->avail_in -= srcSize;
if (zwd->totalInBytes < ZLIB_HEADERSIZE) return Z_OK;
if (ZWRAP_readLE32(zwd->headerBuf) != ZSTD_MAGICNUMBER) {
z_stream strm2;
strm2.next_in = strm->next_in;
strm2.avail_in = strm->avail_in;
strm2.next_out = strm->next_out;
strm2.avail_out = strm->avail_out;
{ int const initErr = (zwd->windowBits) ?
inflateInit2_(strm, zwd->windowBits, zwd->version, zwd->stream_size) :
inflateInit_(strm, zwd->version, zwd->stream_size);
LOG_WRAPPERD("ZLIB inflateInit errorCode=%d\n", initErr);
if (initErr != Z_OK) return ZWRAPD_finishWithError(zwd, strm, initErr);
}
/* inflate header */
strm->next_in = (unsigned char*)zwd->headerBuf;
strm->avail_in = ZLIB_HEADERSIZE;
strm->avail_out = 0;
{ int const dErr = inflate(strm, Z_NO_FLUSH);
LOG_WRAPPERD("ZLIB inflate errorCode=%d strm->avail_in=%d\n",
dErr, (int)strm->avail_in);
if (dErr != Z_OK)
return ZWRAPD_finishWithError(zwd, strm, dErr);
}
if (strm->avail_in > 0) goto error;
strm->next_in = strm2.next_in;
strm->avail_in = strm2.avail_in;
strm->next_out = strm2.next_out;
strm->avail_out = strm2.avail_out;
strm->reserved = ZWRAP_ZLIB_STREAM; /* mark as zlib stream */
{ size_t const freeErr = ZWRAP_freeDCtx(zwd);
if (ZSTD_isError(freeErr)) goto error; }
{ int const result = (flush == Z_INFLATE_SYNC) ?
inflateSync(strm) :
inflate(strm, flush);
LOG_WRAPPERD("- inflate2 flush=%d avail_in=%d avail_out=%d total_in=%d total_out=%d res=%d\n",
(int)flush, (int)strm->avail_in, (int)strm->avail_out, (int)strm->total_in, (int)strm->total_out, res);
return result;
} } } /* if ! (zwd->totalInBytes == 0 && strm->avail_in >= ZLIB_HEADERSIZE) */
} /* (zwd->totalInBytes < ZLIB_HEADERSIZE) */
strm->reserved = ZWRAP_ZSTD_STREAM; /* mark as zstd steam */
if (flush == Z_INFLATE_SYNC) { strm->msg = "inflateSync is not supported!"; goto error; }
if (!zwd->zbd) {
zwd->zbd = ZSTD_createDStream_advanced(zwd->customMem);
if (zwd->zbd == NULL) { LOG_WRAPPERD("ERROR: ZSTD_createDStream_advanced\n"); goto error; }
zwd->decompState = ZWRAP_useInit;
}
if (zwd->totalInBytes < ZSTD_HEADERSIZE) {
if (zwd->totalInBytes == 0 && strm->avail_in >= ZSTD_HEADERSIZE) {
if (zwd->decompState == ZWRAP_useInit) {
size_t const initErr = ZSTD_initDStream(zwd->zbd);
if (ZSTD_isError(initErr)) {
LOG_WRAPPERD("ERROR: ZSTD_initDStream errorCode=%s\n",
ZSTD_getErrorName(initErr));
goto error;
}
} else {
size_t const resetErr = ZSTD_DCtx_reset(zwd->zbd, ZSTD_reset_session_only);
if (ZSTD_isError(resetErr)) goto error;
}
} else {
size_t const srcSize = MIN(strm->avail_in, ZSTD_HEADERSIZE - zwd->totalInBytes);
memcpy(zwd->headerBuf+zwd->totalInBytes, strm->next_in, srcSize);
strm->total_in += srcSize;
zwd->totalInBytes += srcSize;
strm->next_in += srcSize;
strm->avail_in -= srcSize;
if (zwd->totalInBytes < ZSTD_HEADERSIZE) return Z_OK;
if (zwd->decompState == ZWRAP_useInit) {
size_t const initErr = ZSTD_initDStream(zwd->zbd);
if (ZSTD_isError(initErr)) {
LOG_WRAPPERD("ERROR: ZSTD_initDStream errorCode=%s\n",
ZSTD_getErrorName(initErr));
goto error;
}
} else {
size_t const resetErr = ZSTD_DCtx_reset(zwd->zbd, ZSTD_reset_session_only);
if (ZSTD_isError(resetErr)) goto error;
}
zwd->inBuffer.src = zwd->headerBuf;
zwd->inBuffer.size = ZSTD_HEADERSIZE;
zwd->inBuffer.pos = 0;
zwd->outBuffer.dst = strm->next_out;
zwd->outBuffer.size = 0;
zwd->outBuffer.pos = 0;
{ size_t const dErr = ZSTD_decompressStream(zwd->zbd, &zwd->outBuffer, &zwd->inBuffer);
LOG_WRAPPERD("inflate ZSTD_decompressStream1 errorCode=%d srcSize=%d dstCapacity=%d\n",
(int)dErr, (int)zwd->inBuffer.size, (int)zwd->outBuffer.size);
if (ZSTD_isError(dErr)) {
LOG_WRAPPERD("ERROR: ZSTD_decompressStream1 %s\n", ZSTD_getErrorName(dErr));
goto error;
} }
if (zwd->inBuffer.pos != zwd->inBuffer.size) goto error; /* not consumed */
}
} /* (zwd->totalInBytes < ZSTD_HEADERSIZE) */
zwd->inBuffer.src = strm->next_in;
zwd->inBuffer.size = strm->avail_in;
zwd->inBuffer.pos = 0;
zwd->outBuffer.dst = strm->next_out;
zwd->outBuffer.size = strm->avail_out;
zwd->outBuffer.pos = 0;
{ size_t const dErr = ZSTD_decompressStream(zwd->zbd, &zwd->outBuffer, &zwd->inBuffer);
LOG_WRAPPERD("inflate ZSTD_decompressStream2 errorCode=%d srcSize=%d dstCapacity=%d\n",
(int)dErr, (int)strm->avail_in, (int)strm->avail_out);
if (ZSTD_isError(dErr)) {
zwd->errorCount++;
LOG_WRAPPERD("ERROR: ZSTD_decompressStream2 %s zwd->errorCount=%d\n",
ZSTD_getErrorName(dErr), zwd->errorCount);
if (zwd->errorCount<=1) return Z_NEED_DICT; else goto error;
}
LOG_WRAPPERD("inflate inBuffer.pos=%d inBuffer.size=%d outBuffer.pos=%d outBuffer.size=%d o\n",
(int)zwd->inBuffer.pos, (int)zwd->inBuffer.size, (int)zwd->outBuffer.pos, (int)zwd->outBuffer.size);
strm->next_out += zwd->outBuffer.pos;
strm->total_out += zwd->outBuffer.pos;
strm->avail_out -= zwd->outBuffer.pos;
strm->total_in += zwd->inBuffer.pos;
zwd->totalInBytes += zwd->inBuffer.pos;
strm->next_in += zwd->inBuffer.pos;
strm->avail_in -= zwd->inBuffer.pos;
if (dErr == 0) {
LOG_WRAPPERD("inflate Z_STREAM_END1 avail_in=%d avail_out=%d total_in=%d total_out=%d\n",
(int)strm->avail_in, (int)strm->avail_out, (int)strm->total_in, (int)strm->total_out);
zwd->decompState = ZWRAP_streamEnd;
return Z_STREAM_END;
}
} /* dErr lifetime */
LOG_WRAPPERD("- inflate2 flush=%d avail_in=%d avail_out=%d total_in=%d total_out=%d res=%d\n",
(int)flush, (int)strm->avail_in, (int)strm->avail_out, (int)strm->total_in, (int)strm->total_out, Z_OK);
return Z_OK;
error:
return ZWRAPD_finishWithError(zwd, strm, 0);
}
ZEXTERN int ZEXPORT z_inflateEnd _Z_OF((z_streamp strm))
{
if (g_ZWRAPdecompressionType == ZWRAP_FORCE_ZLIB || !strm->reserved)
return inflateEnd(strm);
LOG_WRAPPERD("- inflateEnd total_in=%d total_out=%d\n",
(int)(strm->total_in), (int)(strm->total_out));
{ ZWRAP_DCtx* const zwd = (ZWRAP_DCtx*) strm->state;
if (zwd == NULL) return Z_OK; /* structures are already freed */
{ size_t const freeErr = ZWRAP_freeDCtx(zwd);
if (ZSTD_isError(freeErr)) return Z_STREAM_ERROR; }
strm->state = NULL;
}
return Z_OK;
}
ZEXTERN int ZEXPORT z_inflateSync _Z_OF((z_streamp strm))
{
if (g_ZWRAPdecompressionType == ZWRAP_FORCE_ZLIB || !strm->reserved) {
return inflateSync(strm);
}
return z_inflate(strm, Z_INFLATE_SYNC);
}
/* Advanced compression functions */
ZEXTERN int ZEXPORT z_deflateCopy _Z_OF((z_streamp dest,
z_streamp source))
{
if (!g_ZWRAP_useZSTDcompression)
return deflateCopy(dest, source);
return ZWRAPC_finishWithErrorMsg(source, "deflateCopy is not supported!");
}
ZEXTERN int ZEXPORT z_deflateTune _Z_OF((z_streamp strm,
int good_length,
int max_lazy,
int nice_length,
int max_chain))
{
if (!g_ZWRAP_useZSTDcompression)
return deflateTune(strm, good_length, max_lazy, nice_length, max_chain);
return ZWRAPC_finishWithErrorMsg(strm, "deflateTune is not supported!");
}
#if ZLIB_VERNUM >= 0x1260
ZEXTERN int ZEXPORT z_deflatePending _Z_OF((z_streamp strm,
unsigned *pending,
int *bits))
{
if (!g_ZWRAP_useZSTDcompression)
return deflatePending(strm, pending, bits);
return ZWRAPC_finishWithErrorMsg(strm, "deflatePending is not supported!");
}
#endif
ZEXTERN int ZEXPORT z_deflatePrime _Z_OF((z_streamp strm,
int bits,
int value))
{
if (!g_ZWRAP_useZSTDcompression)
return deflatePrime(strm, bits, value);
return ZWRAPC_finishWithErrorMsg(strm, "deflatePrime is not supported!");
}
ZEXTERN int ZEXPORT z_deflateSetHeader _Z_OF((z_streamp strm,
gz_headerp head))
{
if (!g_ZWRAP_useZSTDcompression)
return deflateSetHeader(strm, head);
return ZWRAPC_finishWithErrorMsg(strm, "deflateSetHeader is not supported!");
}
/* Advanced decompression functions */
#if ZLIB_VERNUM >= 0x1280
ZEXTERN int ZEXPORT z_inflateGetDictionary _Z_OF((z_streamp strm,
Bytef *dictionary,
uInt *dictLength))
{
if (g_ZWRAPdecompressionType == ZWRAP_FORCE_ZLIB || !strm->reserved)
return inflateGetDictionary(strm, dictionary, dictLength);
return ZWRAPD_finishWithErrorMsg(strm, "inflateGetDictionary is not supported!");
}
#endif
ZEXTERN int ZEXPORT z_inflateCopy _Z_OF((z_streamp dest,
z_streamp source))
{
if (g_ZWRAPdecompressionType == ZWRAP_FORCE_ZLIB || !source->reserved)
return inflateCopy(dest, source);
return ZWRAPD_finishWithErrorMsg(source, "inflateCopy is not supported!");
}
#if ZLIB_VERNUM >= 0x1240
ZEXTERN long ZEXPORT z_inflateMark _Z_OF((z_streamp strm))
{
if (g_ZWRAPdecompressionType == ZWRAP_FORCE_ZLIB || !strm->reserved)
return inflateMark(strm);
return ZWRAPD_finishWithErrorMsg(strm, "inflateMark is not supported!");
}
#endif
ZEXTERN int ZEXPORT z_inflatePrime _Z_OF((z_streamp strm,
int bits,
int value))
{
if (g_ZWRAPdecompressionType == ZWRAP_FORCE_ZLIB || !strm->reserved)
return inflatePrime(strm, bits, value);
return ZWRAPD_finishWithErrorMsg(strm, "inflatePrime is not supported!");
}
ZEXTERN int ZEXPORT z_inflateGetHeader _Z_OF((z_streamp strm,
gz_headerp head))
{
if (g_ZWRAPdecompressionType == ZWRAP_FORCE_ZLIB || !strm->reserved)
return inflateGetHeader(strm, head);
return ZWRAPD_finishWithErrorMsg(strm, "inflateGetHeader is not supported!");
}
ZEXTERN int ZEXPORT z_inflateBackInit_ _Z_OF((z_streamp strm, int windowBits,
unsigned char FAR *window,
const char *version,
int stream_size))
{
if (g_ZWRAPdecompressionType == ZWRAP_FORCE_ZLIB || !strm->reserved)
return inflateBackInit_(strm, windowBits, window, version, stream_size);
return ZWRAPD_finishWithErrorMsg(strm, "inflateBackInit is not supported!");
}
ZEXTERN int ZEXPORT z_inflateBack _Z_OF((z_streamp strm,
in_func in, void FAR *in_desc,
out_func out, void FAR *out_desc))
{
if (g_ZWRAPdecompressionType == ZWRAP_FORCE_ZLIB || !strm->reserved)
return inflateBack(strm, in, in_desc, out, out_desc);
return ZWRAPD_finishWithErrorMsg(strm, "inflateBack is not supported!");
}
ZEXTERN int ZEXPORT z_inflateBackEnd _Z_OF((z_streamp strm))
{
if (g_ZWRAPdecompressionType == ZWRAP_FORCE_ZLIB || !strm->reserved)
return inflateBackEnd(strm);
return ZWRAPD_finishWithErrorMsg(strm, "inflateBackEnd is not supported!");
}
ZEXTERN uLong ZEXPORT z_zlibCompileFlags _Z_OF((void)) { return zlibCompileFlags(); }
/* === utility functions === */
#ifndef Z_SOLO
ZEXTERN int ZEXPORT z_compress _Z_OF((Bytef *dest, uLongf *destLen,
const Bytef *source, uLong sourceLen))
{
if (!g_ZWRAP_useZSTDcompression)
return compress(dest, destLen, source, sourceLen);
{ size_t dstCapacity = *destLen;
size_t const cSize = ZSTD_compress(dest, dstCapacity,
source, sourceLen,
ZWRAP_DEFAULT_CLEVEL);
LOG_WRAPPERD("z_compress sourceLen=%d dstCapacity=%d\n",
(int)sourceLen, (int)dstCapacity);
if (ZSTD_isError(cSize)) return Z_STREAM_ERROR;
*destLen = cSize;
}
return Z_OK;
}
ZEXTERN int ZEXPORT z_compress2 _Z_OF((Bytef *dest, uLongf *destLen,
const Bytef *source, uLong sourceLen,
int level))
{
if (!g_ZWRAP_useZSTDcompression)
return compress2(dest, destLen, source, sourceLen, level);
{ size_t dstCapacity = *destLen;
size_t const cSize = ZSTD_compress(dest, dstCapacity, source, sourceLen, level);
if (ZSTD_isError(cSize)) return Z_STREAM_ERROR;
*destLen = cSize;
}
return Z_OK;
}
ZEXTERN uLong ZEXPORT z_compressBound _Z_OF((uLong sourceLen))
{
if (!g_ZWRAP_useZSTDcompression)
return compressBound(sourceLen);
return ZSTD_compressBound(sourceLen);
}
ZEXTERN int ZEXPORT z_uncompress _Z_OF((Bytef *dest, uLongf *destLen,
const Bytef *source, uLong sourceLen))
{
if (!ZSTD_isFrame(source, sourceLen))
return uncompress(dest, destLen, source, sourceLen);
{ size_t dstCapacity = *destLen;
size_t const dSize = ZSTD_decompress(dest, dstCapacity, source, sourceLen);
if (ZSTD_isError(dSize)) return Z_STREAM_ERROR;
*destLen = dSize;
}
return Z_OK;
}
#endif /* !Z_SOLO */
/* checksum functions */
ZEXTERN uLong ZEXPORT z_adler32 _Z_OF((uLong adler, const Bytef *buf, uInt len))
{
return adler32(adler, buf, len);
}
ZEXTERN uLong ZEXPORT z_crc32 _Z_OF((uLong crc, const Bytef *buf, uInt len))
{
return crc32(crc, buf, len);
}
#if ZLIB_VERNUM >= 0x12B0
ZEXTERN uLong ZEXPORT z_adler32_z _Z_OF((uLong adler, const Bytef *buf, z_size_t len))
{
return adler32_z(adler, buf, len);
}
ZEXTERN uLong ZEXPORT z_crc32_z _Z_OF((uLong crc, const Bytef *buf, z_size_t len))
{
return crc32_z(crc, buf, len);
}
#endif
#if ZLIB_VERNUM >= 0x1270
ZEXTERN const z_crc_t FAR * ZEXPORT z_get_crc_table _Z_OF((void))
{
return get_crc_table();
}
#endif
/* Error function */
ZEXTERN const char * ZEXPORT z_zError _Z_OF((int err))
{
/* Just use zlib Error function */
return zError(err);
}
form-5.0.1/extern/zstd/zlibWrapper/gzcompatibility.h 0000644 0001751 0001751 00000003516 15217035741 016332 /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under both the BSD-style license (found in the
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
* in the COPYING file in the root directory of this source tree).
* You may select, at your option, one of the above-listed licenses.
*/
#if ZLIB_VERNUM <= 0x1240
ZEXTERN int ZEXPORT gzclose_r _Z_OF((gzFile file));
ZEXTERN int ZEXPORT gzclose_w _Z_OF((gzFile file));
ZEXTERN int ZEXPORT gzbuffer _Z_OF((gzFile file, unsigned size));
ZEXTERN z_off_t ZEXPORT gzoffset _Z_OF((gzFile file));
#if !defined(_WIN32) && defined(Z_LARGE64)
# define z_off64_t off64_t
#else
# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO)
# define z_off64_t __int64
# else
# define z_off64_t z_off_t
# endif
#endif
#endif
#if ZLIB_VERNUM <= 0x1250
struct gzFile_s {
unsigned have;
unsigned char *next;
z_off64_t pos;
};
#endif
#if ZLIB_VERNUM <= 0x1270
#if defined(_WIN32) && !defined(Z_SOLO)
# include /* for wchar_t */
ZEXTERN gzFile ZEXPORT gzopen_w _Z_OF((const wchar_t *path,
const char *mode));
#endif
#endif
#if ZLIB_VERNUM < 0x12B0
#ifdef Z_SOLO
typedef unsigned long z_size_t;
#else
# define z_longlong long long
# if defined(NO_SIZE_T)
typedef unsigned NO_SIZE_T z_size_t;
# elif defined(STDC)
# include
typedef size_t z_size_t;
# else
typedef unsigned long z_size_t;
# endif
# undef z_longlong
#endif
ZEXTERN z_size_t ZEXPORT gzfread _Z_OF((voidp buf, z_size_t size, z_size_t nitems,
gzFile file));
ZEXTERN z_size_t ZEXPORT gzfwrite _Z_OF((voidpc buf, z_size_t size,
z_size_t nitems, gzFile file));
#endif
form-5.0.1/extern/zstd/zlibWrapper/gzread.c 0000644 0001751 0001751 00000052762 15217035741 014376 /* gzread.c contains minimal changes required to be compiled with zlibWrapper:
* - gz_statep was converted to union to work with -Wstrict-aliasing=1 */
/* gzread.c -- zlib functions for reading gzip files
* Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013, 2016 Mark Adler
* For conditions of distribution and use, see https://www.zlib.net/zlib_license.html
*/
#include "gzguts.h"
/* fix for Visual Studio, which doesn't support ssize_t type.
* see https://github.com/facebook/zstd/issues/1800#issuecomment-545945050 */
#if defined(_MSC_VER) && !defined(ssize_t)
# include
typedef SSIZE_T ssize_t;
#endif
/* Local functions */
local int gz_load _Z_OF((gz_statep, unsigned char *, unsigned, unsigned *));
local int gz_avail _Z_OF((gz_statep));
local int gz_look _Z_OF((gz_statep));
local int gz_decomp _Z_OF((gz_statep));
local int gz_fetch _Z_OF((gz_statep));
local int gz_skip _Z_OF((gz_statep, z_off64_t));
local z_size_t gz_read _Z_OF((gz_statep, voidp, z_size_t));
/* Use read() to load a buffer -- return -1 on error, otherwise 0. Read from
state.state->fd, and update state.state->eof, state.state->err, and state.state->msg as appropriate.
This function needs to loop on read(), since read() is not guaranteed to
read the number of bytes requested, depending on the type of descriptor. */
local int gz_load(gz_statep state, unsigned char *buf, unsigned len,
unsigned *have) {
ssize_t ret;
unsigned get, max = ((unsigned)-1 >> 2) + 1;
*have = 0;
do {
get = len - *have;
if (get > max)
get = max;
ret = read(state.state->fd, buf + *have, get);
if (ret <= 0)
break;
*have += (unsigned)ret;
} while (*have < len);
if (ret < 0) {
gz_error(state, Z_ERRNO, zstrerror());
return -1;
}
if (ret == 0)
state.state->eof = 1;
return 0;
}
/* Load up input buffer and set eof flag if last data loaded -- return -1 on
error, 0 otherwise. Note that the eof flag is set when the end of the input
file is reached, even though there may be unused data in the buffer. Once
that data has been used, no more attempts will be made to read the file.
If strm->avail_in != 0, then the current data is moved to the beginning of
the input buffer, and then the remainder of the buffer is loaded with the
available data from the input file. */
local int gz_avail(gz_statep state)
{
unsigned got;
z_streamp strm = &(state.state->strm);
if (state.state->err != Z_OK && state.state->err != Z_BUF_ERROR)
return -1;
if (state.state->eof == 0) {
if (strm->avail_in) { /* copy what's there to the start */
unsigned char *p = state.state->in;
unsigned const char *q = strm->next_in;
unsigned n = strm->avail_in;
do {
*p++ = *q++;
} while (--n);
}
if (gz_load(state, state.state->in + strm->avail_in,
state.state->size - strm->avail_in, &got) == -1)
return -1;
strm->avail_in += got;
strm->next_in = state.state->in;
}
return 0;
}
/* Look for gzip header, set up for inflate or copy. state.state->x.have must be 0.
If this is the first time in, allocate required memory. state.state->how will be
left unchanged if there is no more input data available, will be set to COPY
if there is no gzip header and direct copying will be performed, or it will
be set to GZIP for decompression. If direct copying, then leftover input
data from the input buffer will be copied to the output buffer. In that
case, all further file reads will be directly to either the output buffer or
a user buffer. If decompressing, the inflate state will be initialized.
gz_look() will return 0 on success or -1 on failure. */
local int gz_look(gz_statep state) {
z_streamp strm = &(state.state->strm);
/* allocate read buffers and inflate memory */
if (state.state->size == 0) {
/* allocate buffers */
state.state->in = (unsigned char *)malloc(state.state->want);
state.state->out = (unsigned char *)malloc(state.state->want << 1);
if (state.state->in == NULL || state.state->out == NULL) {
free(state.state->out);
free(state.state->in);
gz_error(state, Z_MEM_ERROR, "out of memory");
return -1;
}
state.state->size = state.state->want;
/* allocate inflate memory */
state.state->strm.zalloc = Z_NULL;
state.state->strm.zfree = Z_NULL;
state.state->strm.opaque = Z_NULL;
state.state->strm.avail_in = 0;
state.state->strm.next_in = Z_NULL;
if (inflateInit2(&(state.state->strm), 15 + 16) != Z_OK) { /* gunzip */
free(state.state->out);
free(state.state->in);
state.state->size = 0;
gz_error(state, Z_MEM_ERROR, "out of memory");
return -1;
}
}
/* get at least the magic bytes in the input buffer */
if (strm->avail_in < 2) {
if (gz_avail(state) == -1)
return -1;
if (strm->avail_in == 0)
return 0;
}
/* look for gzip magic bytes -- if there, do gzip decoding (note: there is
a logical dilemma here when considering the case of a partially written
gzip file, to wit, if a single 31 byte is written, then we cannot tell
whether this is a single-byte file, or just a partially written gzip
file -- for here we assume that if a gzip file is being written, then
the header will be written in a single operation, so that reading a
single byte is sufficient indication that it is not a gzip file) */
if (strm->avail_in > 1 &&
((strm->next_in[0] == 31 && strm->next_in[1] == 139) /* gz header */
|| (strm->next_in[0] == 40 && strm->next_in[1] == 181))) { /* zstd header */
inflateReset(strm);
state.state->how = GZIP;
state.state->direct = 0;
return 0;
}
/* no gzip header -- if we were decoding gzip before, then this is trailing
garbage. Ignore the trailing garbage and finish. */
if (state.state->direct == 0) {
strm->avail_in = 0;
state.state->eof = 1;
state.state->x.have = 0;
return 0;
}
/* doing raw i/o, copy any leftover input to output -- this assumes that
the output buffer is larger than the input buffer, which also assures
space for gzungetc() */
state.state->x.next = state.state->out;
if (strm->avail_in) {
memcpy(state.state->x.next, strm->next_in, strm->avail_in);
state.state->x.have = strm->avail_in;
strm->avail_in = 0;
}
state.state->how = COPY;
state.state->direct = 1;
return 0;
}
/* Decompress from input to the provided next_out and avail_out in the state.
On return, state.state->x.have and state.state->x.next point to the just decompressed
data. If the gzip stream completes, state.state->how is reset to LOOK to look for
the next gzip stream or raw data, once state.state->x.have is depleted. Returns 0
on success, -1 on failure. */
local int gz_decomp(gz_statep state) {
int ret = Z_OK;
unsigned had;
z_streamp strm = &(state.state->strm);
/* fill output buffer up to end of deflate stream */
had = strm->avail_out;
do {
/* get more input for inflate() */
if (strm->avail_in == 0 && gz_avail(state) == -1)
return -1;
if (strm->avail_in == 0) {
gz_error(state, Z_BUF_ERROR, "unexpected end of file");
break;
}
/* decompress and handle errors */
ret = inflate(strm, Z_NO_FLUSH);
if (ret == Z_STREAM_ERROR || ret == Z_NEED_DICT) {
gz_error(state, Z_STREAM_ERROR,
"internal error: inflate stream corrupt");
return -1;
}
if (ret == Z_MEM_ERROR) {
gz_error(state, Z_MEM_ERROR, "out of memory");
return -1;
}
if (ret == Z_DATA_ERROR) { /* deflate stream invalid */
gz_error(state, Z_DATA_ERROR,
strm->msg == NULL ? "compressed data error" : strm->msg);
return -1;
}
} while (strm->avail_out && ret != Z_STREAM_END);
/* update available output */
state.state->x.have = had - strm->avail_out;
state.state->x.next = strm->next_out - state.state->x.have;
/* if the gzip stream completed successfully, look for another */
if (ret == Z_STREAM_END)
state.state->how = LOOK;
/* good decompression */
return 0;
}
/* Fetch data and put it in the output buffer. Assumes state.state->x.have is 0.
Data is either copied from the input file or decompressed from the input
file depending on state.state->how. If state.state->how is LOOK, then a gzip header is
looked for to determine whether to copy or decompress. Returns -1 on error,
otherwise 0. gz_fetch() will leave state.state->how as COPY or GZIP unless the
end of the input file has been reached and all data has been processed. */
local int gz_fetch(gz_statep state) {
z_streamp strm = &(state.state->strm);
do {
switch(state.state->how) {
case LOOK: /* -> LOOK, COPY (only if never GZIP), or GZIP */
if (gz_look(state) == -1)
return -1;
if (state.state->how == LOOK)
return 0;
break;
case COPY: /* -> COPY */
if (gz_load(state, state.state->out, state.state->size << 1, &(state.state->x.have))
== -1)
return -1;
state.state->x.next = state.state->out;
return 0;
case GZIP: /* -> GZIP or LOOK (if end of gzip stream) */
strm->avail_out = state.state->size << 1;
strm->next_out = state.state->out;
if (gz_decomp(state) == -1)
return -1;
}
} while (state.state->x.have == 0 && (!state.state->eof || strm->avail_in));
return 0;
}
/* Skip len uncompressed bytes of output. Return -1 on error, 0 on success. */
local int gz_skip(gz_statep state, z_off64_t len) {
unsigned n;
/* skip over len bytes or reach end-of-file, whichever comes first */
while (len)
/* skip over whatever is in output buffer */
if (state.state->x.have) {
n = GT_OFF(state.state->x.have) || (z_off64_t)state.state->x.have > len ?
(unsigned)len : state.state->x.have;
state.state->x.have -= n;
state.state->x.next += n;
state.state->x.pos += n;
len -= n;
}
/* output buffer empty -- return if we're at the end of the input */
else if (state.state->eof && state.state->strm.avail_in == 0)
break;
/* need more data to skip -- load up output buffer */
else {
/* get more output, looking for header if required */
if (gz_fetch(state) == -1)
return -1;
}
return 0;
}
/* Read len bytes into buf from file, or less than len up to the end of the
input. Return the number of bytes read. If zero is returned, either the
end of file was reached, or there was an error. state.state->err must be
consulted in that case to determine which. */
local z_size_t gz_read(gz_statep state, voidp buf, z_size_t len) {
z_size_t got;
unsigned n;
/* if len is zero, avoid unnecessary operations */
if (len == 0)
return 0;
/* process a skip request */
if (state.state->seek) {
state.state->seek = 0;
if (gz_skip(state, state.state->skip) == -1)
return 0;
}
/* get len bytes to buf, or less than len if at the end */
got = 0;
do {
/* set n to the maximum amount of len that fits in an unsigned int */
n = -1;
if (n > len)
n = (unsigned)len;
/* first just try copying data from the output buffer */
if (state.state->x.have) {
if (state.state->x.have < n)
n = state.state->x.have;
memcpy(buf, state.state->x.next, n);
state.state->x.next += n;
state.state->x.have -= n;
}
/* output buffer empty -- return if we're at the end of the input */
else if (state.state->eof && state.state->strm.avail_in == 0) {
state.state->past = 1; /* tried to read past end */
break;
}
/* need output data -- for small len or new stream load up our output
buffer */
else if (state.state->how == LOOK || n < (state.state->size << 1)) {
/* get more output, looking for header if required */
if (gz_fetch(state) == -1)
return 0;
continue; /* no progress yet -- go back to copy above */
/* the copy above assures that we will leave with space in the
output buffer, allowing at least one gzungetc() to succeed */
}
/* large len -- read directly into user buffer */
else if (state.state->how == COPY) { /* read directly */
if (gz_load(state, (unsigned char *)buf, n, &n) == -1)
return 0;
}
/* large len -- decompress directly into user buffer */
else { /* state.state->how == GZIP */
state.state->strm.avail_out = n;
state.state->strm.next_out = (unsigned char *)buf;
if (gz_decomp(state) == -1)
return 0;
n = state.state->x.have;
state.state->x.have = 0;
}
/* update progress */
len -= n;
buf = (char *)buf + n;
got += n;
state.state->x.pos += n;
} while (len);
/* return number of bytes read into user buffer */
return got;
}
/* -- see zlib.h -- */
int ZEXPORT gzread(gzFile file, voidp buf, unsigned len) {
gz_statep state;
/* get internal structure */
if (file == NULL)
return -1;
state.file = file;
/* check that we're reading and that there's no (serious) error */
if (state.state->mode != GZ_READ ||
(state.state->err != Z_OK && state.state->err != Z_BUF_ERROR))
return -1;
/* since an int is returned, make sure len fits in one, otherwise return
with an error (this avoids a flaw in the interface) */
if ((int)len < 0) {
gz_error(state, Z_STREAM_ERROR, "request does not fit in an int");
return -1;
}
/* read len or fewer bytes to buf */
len = (unsigned)gz_read(state, buf, len);
/* check for an error */
if (len == 0 && state.state->err != Z_OK && state.state->err != Z_BUF_ERROR)
return -1;
/* return the number of bytes read (this is assured to fit in an int) */
return (int)len;
}
/* -- see zlib.h -- */
z_size_t ZEXPORT gzfread(voidp buf, z_size_t size, z_size_t nitems,
gzFile file) {
z_size_t len;
gz_statep state;
/* get internal structure */
if (file == NULL)
return 0;
state.file = file;
/* check that we're reading and that there's no (serious) error */
if (state.state->mode != GZ_READ ||
(state.state->err != Z_OK && state.state->err != Z_BUF_ERROR))
return 0;
/* compute bytes to read -- error on overflow */
len = nitems * size;
if (size && len / size != nitems) {
gz_error(state, Z_STREAM_ERROR, "request does not fit in a size_t");
return 0;
}
/* read len or fewer bytes to buf, return the number of full items read */
return len ? gz_read(state, buf, len) / size : 0;
}
/* -- see zlib.h -- */
#if ZLIB_VERNUM >= 0x1261
#ifdef Z_PREFIX_SET
# undef z_gzgetc
#else
# undef gzgetc
#endif
#endif
#if ZLIB_VERNUM == 0x1260
# undef gzgetc
#endif
#if ZLIB_VERNUM <= 0x1250
ZEXTERN int ZEXPORT gzgetc _Z_OF((gzFile file));
ZEXTERN int ZEXPORT gzgetc_ _Z_OF((gzFile file));
#endif
int ZEXPORT gzgetc(gzFile file) {
int ret;
unsigned char buf[1];
gz_statep state;
/* get internal structure */
if (file == NULL)
return -1;
state.file = file;
/* check that we're reading and that there's no (serious) error */
if (state.state->mode != GZ_READ ||
(state.state->err != Z_OK && state.state->err != Z_BUF_ERROR))
return -1;
/* try output buffer (no need to check for skip request) */
if (state.state->x.have) {
state.state->x.have--;
state.state->x.pos++;
return *(state.state->x.next)++;
}
/* nothing there -- try gz_read() */
ret = (int)gz_read(state, buf, 1);
return ret < 1 ? -1 : buf[0];
}
int ZEXPORT gzgetc_(gzFile file) {
return gzgetc(file);
}
/* -- see zlib.h -- */
int ZEXPORT gzungetc(int c, gzFile file) {
gz_statep state;
/* get internal structure */
if (file == NULL)
return -1;
state.file = file;
/* check that we're reading and that there's no (serious) error */
if (state.state->mode != GZ_READ ||
(state.state->err != Z_OK && state.state->err != Z_BUF_ERROR))
return -1;
/* process a skip request */
if (state.state->seek) {
state.state->seek = 0;
if (gz_skip(state, state.state->skip) == -1)
return -1;
}
/* can't push EOF */
if (c < 0)
return -1;
/* if output buffer empty, put byte at end (allows more pushing) */
if (state.state->x.have == 0) {
state.state->x.have = 1;
state.state->x.next = state.state->out + (state.state->size << 1) - 1;
state.state->x.next[0] = (unsigned char)c;
state.state->x.pos--;
state.state->past = 0;
return c;
}
/* if no room, give up (must have already done a gzungetc()) */
if (state.state->x.have == (state.state->size << 1)) {
gz_error(state, Z_DATA_ERROR, "out of room to push characters");
return -1;
}
/* slide output data if needed and insert byte before existing data */
if (state.state->x.next == state.state->out) {
unsigned char *src = state.state->out + state.state->x.have;
unsigned char *dest = state.state->out + (state.state->size << 1);
while (src > state.state->out)
*--dest = *--src;
state.state->x.next = dest;
}
state.state->x.have++;
state.state->x.next--;
state.state->x.next[0] = (unsigned char)c;
state.state->x.pos--;
state.state->past = 0;
return c;
}
/* -- see zlib.h -- */
char * ZEXPORT gzgets(gzFile file, char *buf, int len) {
unsigned left, n;
char *str;
unsigned char *eol;
gz_statep state;
/* check parameters and get internal structure */
if (file == NULL || buf == NULL || len < 1)
return NULL;
state.file = file;
/* check that we're reading and that there's no (serious) error */
if (state.state->mode != GZ_READ ||
(state.state->err != Z_OK && state.state->err != Z_BUF_ERROR))
return NULL;
/* process a skip request */
if (state.state->seek) {
state.state->seek = 0;
if (gz_skip(state, state.state->skip) == -1)
return NULL;
}
/* copy output bytes up to new line or len - 1, whichever comes first --
append a terminating zero to the string (we don't check for a zero in
the contents, let the user worry about that) */
str = buf;
left = (unsigned)len - 1;
if (left) do {
/* assure that something is in the output buffer */
if (state.state->x.have == 0 && gz_fetch(state) == -1)
return NULL; /* error */
if (state.state->x.have == 0) { /* end of file */
state.state->past = 1; /* read past end */
break; /* return what we have */
}
/* look for end-of-line in current output buffer */
n = state.state->x.have > left ? left : state.state->x.have;
eol = (unsigned char *)memchr(state.state->x.next, '\n', n);
if (eol != NULL)
n = (unsigned)(eol - state.state->x.next) + 1;
/* copy through end-of-line, or remainder if not found */
memcpy(buf, state.state->x.next, n);
state.state->x.have -= n;
state.state->x.next += n;
state.state->x.pos += n;
left -= n;
buf += n;
} while (left && eol == NULL);
/* return terminated string, or if nothing, end of file */
if (buf == str)
return NULL;
buf[0] = 0;
return str;
}
/* -- see zlib.h -- */
int ZEXPORT gzdirect(gzFile file) {
gz_statep state;
/* get internal structure */
if (file == NULL)
return 0;
state.file = file;
/* if the state is not known, but we can find out, then do so (this is
mainly for right after a gzopen() or gzdopen()) */
if (state.state->mode == GZ_READ && state.state->how == LOOK && state.state->x.have == 0)
(void)gz_look(state);
/* return 1 if transparent, 0 if processing a gzip stream */
return state.state->direct;
}
/* -- see zlib.h -- */
int ZEXPORT gzclose_r(gzFile file) {
int ret, err;
gz_statep state;
/* get internal structure */
if (file == NULL)
return Z_STREAM_ERROR;
state.file = file;
/* check that we're reading */
if (state.state->mode != GZ_READ)
return Z_STREAM_ERROR;
/* free memory and close file */
if (state.state->size) {
inflateEnd(&(state.state->strm));
free(state.state->out);
free(state.state->in);
}
err = state.state->err == Z_BUF_ERROR ? Z_BUF_ERROR : Z_OK;
gz_error(state, Z_OK, NULL);
free(state.state->path);
ret = close(state.state->fd);
free(state.state);
return ret ? Z_ERRNO : err;
}
form-5.0.1/extern/zstd/zlibWrapper/gzclose.c 0000644 0001751 0001751 00000001510 15217035741 014551 /* gzclose.c contains minimal changes required to be compiled with zlibWrapper:
* - gz_statep was converted to union to work with -Wstrict-aliasing=1 */
/* gzclose.c -- zlib gzclose() function
* Copyright (C) 2004, 2010 Mark Adler
* For conditions of distribution and use, see https://www.zlib.net/zlib_license.html
*/
#include "gzguts.h"
/* gzclose() is in a separate file so that it is linked in only if it is used.
That way the other gzclose functions can be used instead to avoid linking in
unneeded compression or decompression routines. */
int ZEXPORT gzclose(gzFile file) {
#ifndef NO_GZCOMPRESS
gz_statep state;
if (file == NULL)
return Z_STREAM_ERROR;
state.file = file;
return state.state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file);
#else
return gzclose_r(file);
#endif
}
form-5.0.1/extern/zstd/zlibWrapper/zstd_zlibwrapper.h 0000644 0001751 0001751 00000007130 15217035741 016521 /*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under both the BSD-style license (found in the
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
* in the COPYING file in the root directory of this source tree).
* You may select, at your option, one of the above-listed licenses.
*/
#ifndef ZSTD_ZLIBWRAPPER_H
#define ZSTD_ZLIBWRAPPER_H
#define ZLIB_CONST
#define Z_PREFIX
#define ZLIB_INTERNAL /* disables gz*64 functions but fixes zlib 1.2.4 with Z_PREFIX */
#include
#if !defined(z_const)
#define z_const
#endif
#if !defined(_Z_OF)
#define _Z_OF OF
#endif
#if defined (__cplusplus)
extern "C" {
#endif
/* returns a string with version of zstd library */
const char * zstdVersion(void);
/*** COMPRESSION ***/
/* ZWRAP_useZSTDcompression() enables/disables zstd compression during runtime.
By default zstd compression is disabled. To enable zstd compression please use one of the methods:
- compilation with the additional option -DZWRAP_USE_ZSTD=1
- using '#define ZWRAP_USE_ZSTD 1' in source code before '#include "zstd_zlibwrapper.h"'
- calling ZWRAP_useZSTDcompression(1)
All above-mentioned methods will enable zstd compression for all threads.
Be aware that ZWRAP_useZSTDcompression() is not thread-safe and may lead to a race condition. */
void ZWRAP_useZSTDcompression(int turn_on);
/* checks if zstd compression is turned on */
int ZWRAP_isUsingZSTDcompression(void);
/* Changes a pledged source size for a given compression stream.
It will change ZSTD compression parameters what may improve compression speed and/or ratio.
The function should be called just after deflateInit() or deflateReset() and before deflate() or deflateSetDictionary().
It's only helpful when data is compressed in blocks.
There will be no change in case of deflateInit() or deflateReset() immediately followed by deflate(strm, Z_FINISH)
as this case is automatically detected. */
int ZWRAP_setPledgedSrcSize(z_streamp strm, unsigned long long pledgedSrcSize);
/* Similar to deflateReset but preserves dictionary set using deflateSetDictionary.
It should improve compression speed because there will be less calls to deflateSetDictionary
When using zlib compression this method redirects to deflateReset. */
int ZWRAP_deflateReset_keepDict(z_streamp strm);
/*** DECOMPRESSION ***/
typedef enum { ZWRAP_FORCE_ZLIB, ZWRAP_AUTO } ZWRAP_decompress_type;
/* ZWRAP_setDecompressionType() enables/disables automatic recognition of zstd/zlib compressed data during runtime.
By default auto-detection of zstd and zlib streams in enabled (ZWRAP_AUTO).
Forcing zlib decompression with ZWRAP_setDecompressionType(ZWRAP_FORCE_ZLIB) slightly improves
decompression speed of zlib-encoded streams.
Be aware that ZWRAP_setDecompressionType() is not thread-safe and may lead to a race condition. */
void ZWRAP_setDecompressionType(ZWRAP_decompress_type type);
/* checks zstd decompression type */
ZWRAP_decompress_type ZWRAP_getDecompressionType(void);
/* Checks if zstd decompression is used for a given stream.
If will return 1 only when inflate() was called and zstd header was detected. */
int ZWRAP_isUsingZSTDdecompression(z_streamp strm);
/* Similar to inflateReset but preserves dictionary set using inflateSetDictionary.
inflate() will return Z_NEED_DICT only for the first time what will improve decompression speed.
For zlib streams this method redirects to inflateReset. */
int ZWRAP_inflateReset_keepDict(z_streamp strm);
#if defined (__cplusplus)
}
#endif
#endif /* ZSTD_ZLIBWRAPPER_H */
form-5.0.1/extern/zstd/zlibWrapper/gzwrite.c 0000644 0001751 0001751 00000047375 15217035741 014621 /* gzwrite.c contains minimal changes required to be compiled with zlibWrapper:
* - gz_statep was converted to union to work with -Wstrict-aliasing=1 */
/* gzwrite.c -- zlib functions for writing gzip files
* Copyright (C) 2004-2017 Mark Adler
* For conditions of distribution and use, see https://www.zlib.net/zlib_license.html
*/
#include
#include "gzguts.h"
/* Local functions */
local int gz_init _Z_OF((gz_statep));
local int gz_comp _Z_OF((gz_statep, int));
local int gz_zero _Z_OF((gz_statep, z_off64_t));
local z_size_t gz_write _Z_OF((gz_statep, voidpc, z_size_t));
/* Initialize state for writing a gzip file. Mark initialization by setting
state.state->size to non-zero. Return -1 on a memory allocation failure, or 0 on
success. */
local int gz_init(gz_statep state) {
int ret;
z_streamp strm = &(state.state->strm);
/* allocate input buffer (double size for gzprintf) */
state.state->in = (unsigned char*)malloc(state.state->want << 1);
if (state.state->in == NULL) {
gz_error(state, Z_MEM_ERROR, "out of memory");
return -1;
}
/* only need output buffer and deflate state if compressing */
if (!state.state->direct) {
/* allocate output buffer */
state.state->out = (unsigned char*)malloc(state.state->want);
if (state.state->out == NULL) {
free(state.state->in);
gz_error(state, Z_MEM_ERROR, "out of memory");
return -1;
}
/* allocate deflate memory, set up for gzip compression */
strm->zalloc = Z_NULL;
strm->zfree = Z_NULL;
strm->opaque = Z_NULL;
ret = deflateInit2(strm, state.state->level, Z_DEFLATED,
MAX_WBITS + 16, DEF_MEM_LEVEL, state.state->strategy);
if (ret != Z_OK) {
free(state.state->out);
free(state.state->in);
gz_error(state, Z_MEM_ERROR, "out of memory");
return -1;
}
strm->next_in = NULL;
}
/* mark state as initialized */
state.state->size = state.state->want;
/* initialize write buffer if compressing */
if (!state.state->direct) {
strm->avail_out = state.state->size;
strm->next_out = state.state->out;
state.state->x.next = strm->next_out;
}
return 0;
}
/* Compress whatever is at avail_in and next_in and write to the output file.
Return -1 if there is an error writing to the output file or if gz_init()
fails to allocate memory, otherwise 0. flush is assumed to be a valid
deflate() flush value. If flush is Z_FINISH, then the deflate() state is
reset to start a new gzip stream. If gz->direct is true, then simply write
to the output file without compressing, and ignore flush. */
local int gz_comp(gz_statep state, int flush) {
int ret, writ;
unsigned have, put, max = ((unsigned)-1 >> 2) + 1;
z_streamp strm = &(state.state->strm);
/* allocate memory if this is the first time through */
if (state.state->size == 0 && gz_init(state) == -1)
return -1;
/* write directly if requested */
if (state.state->direct) {
while (strm->avail_in) {
put = strm->avail_in > max ? max : strm->avail_in;
writ = (int)write(state.state->fd, strm->next_in, put);
if (writ < 0) {
gz_error(state, Z_ERRNO, zstrerror());
return -1;
}
strm->avail_in -= (unsigned)writ;
strm->next_in += writ;
}
return 0;
}
/* run deflate() on provided input until it produces no more output */
ret = Z_OK;
do {
/* write out current buffer contents if full, or if flushing, but if
doing Z_FINISH then don't write until we get to Z_STREAM_END */
if (strm->avail_out == 0 || (flush != Z_NO_FLUSH &&
(flush != Z_FINISH || ret == Z_STREAM_END))) {
while (strm->next_out > state.state->x.next) {
put = strm->next_out - state.state->x.next > (int)max ? max :
(unsigned)(strm->next_out - state.state->x.next);
writ = (int)write(state.state->fd, state.state->x.next, put);
if (writ < 0) {
gz_error(state, Z_ERRNO, zstrerror());
return -1;
}
state.state->x.next += writ;
}
if (strm->avail_out == 0) {
strm->avail_out = state.state->size;
strm->next_out = state.state->out;
state.state->x.next = state.state->out;
}
}
/* compress */
have = strm->avail_out;
ret = deflate(strm, flush);
if (ret == Z_STREAM_ERROR) {
gz_error(state, Z_STREAM_ERROR,
"internal error: deflate stream corrupt");
return -1;
}
have -= strm->avail_out;
} while (have);
/* if that completed a deflate stream, allow another to start */
if (flush == Z_FINISH)
deflateReset(strm);
/* all done, no errors */
return 0;
}
/* Compress len zeros to output. Return -1 on a write error or memory
allocation failure by gz_comp(), or 0 on success. */
local int gz_zero(gz_statep state, z_off64_t len) {
int first;
unsigned n;
z_streamp strm = &(state.state->strm);
/* consume whatever's left in the input buffer */
if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
return -1;
/* compress len zeros (len guaranteed > 0) */
first = 1;
while (len) {
n = GT_OFF(state.state->size) || (z_off64_t)state.state->size > len ?
(unsigned)len : state.state->size;
if (first) {
memset(state.state->in, 0, n);
first = 0;
}
strm->avail_in = n;
strm->next_in = state.state->in;
state.state->x.pos += n;
if (gz_comp(state, Z_NO_FLUSH) == -1)
return -1;
len -= n;
}
return 0;
}
/* Write len bytes from buf to file. Return the number of bytes written. If
the returned value is less than len, then there was an error. */
local z_size_t gz_write(gz_statep state, voidpc buf, z_size_t len) {
z_size_t put = len;
/* if len is zero, avoid unnecessary operations */
if (len == 0)
return 0;
/* allocate memory if this is the first time through */
if (state.state->size == 0 && gz_init(state) == -1)
return 0;
/* check for seek request */
if (state.state->seek) {
state.state->seek = 0;
if (gz_zero(state, state.state->skip) == -1)
return 0;
}
/* for small len, copy to input buffer, otherwise compress directly */
if (len < state.state->size) {
/* copy to input buffer, compress when full */
do {
z_size_t have, copy;
if (state.state->strm.avail_in == 0)
state.state->strm.next_in = state.state->in;
have = (unsigned)((state.state->strm.next_in + state.state->strm.avail_in) -
state.state->in);
copy = state.state->size - have;
if (copy > len)
copy = len;
memcpy(state.state->in + have, buf, copy);
state.state->strm.avail_in += copy;
state.state->x.pos += copy;
buf = (const char *)buf + copy;
len -= copy;
if (len && gz_comp(state, Z_NO_FLUSH) == -1)
return 0;
} while (len);
}
else {
/* consume whatever's left in the input buffer */
if (state.state->strm.avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
return 0;
/* directly compress user buffer to file */
state.state->strm.next_in = (z_const Bytef *)buf;
do {
z_size_t n = (unsigned)-1;
if (n > len)
n = len;
state.state->strm.avail_in = (uInt)n;
state.state->x.pos += n;
if (gz_comp(state, Z_NO_FLUSH) == -1)
return 0;
len -= n;
} while (len);
}
/* input was all buffered or compressed */
return put;
}
/* -- see zlib.h -- */
int ZEXPORT gzwrite(gzFile file, voidpc buf, unsigned len) {
gz_statep state;
/* get internal structure */
if (file == NULL)
return 0;
state.file = file;
/* check that we're writing and that there's no error */
if (state.state->mode != GZ_WRITE || state.state->err != Z_OK)
return 0;
/* since an int is returned, make sure len fits in one, otherwise return
with an error (this avoids a flaw in the interface) */
if ((int)len < 0) {
gz_error(state, Z_DATA_ERROR, "requested length does not fit in int");
return 0;
}
/* write len bytes from buf (the return value will fit in an int) */
return (int)gz_write(state, buf, len);
}
/* -- see zlib.h -- */
z_size_t ZEXPORT gzfwrite(voidpc buf, z_size_t size, z_size_t nitems,
gzFile file) {
z_size_t len;
gz_statep state;
/* get internal structure */
assert(size != 0);
if (file == NULL)
return 0;
state.file = file;
/* check that we're writing and that there's no error */
if (state.state->mode != GZ_WRITE || state.state->err != Z_OK)
return 0;
/* compute bytes to read -- error on overflow */
len = nitems * size;
if (size && (len / size != nitems)) {
gz_error(state, Z_STREAM_ERROR, "request does not fit in a size_t");
return 0;
}
/* write len bytes to buf, return the number of full items written */
return len ? gz_write(state, buf, len) / size : 0;
}
/* -- see zlib.h -- */
int ZEXPORT gzputc(gzFile file, int c) {
unsigned have;
unsigned char buf[1];
gz_statep state;
z_streamp strm;
/* get internal structure */
if (file == NULL)
return -1;
state.file = file;
strm = &(state.state->strm);
/* check that we're writing and that there's no error */
if (state.state->mode != GZ_WRITE || state.state->err != Z_OK)
return -1;
/* check for seek request */
if (state.state->seek) {
state.state->seek = 0;
if (gz_zero(state, state.state->skip) == -1)
return -1;
}
/* try writing to input buffer for speed (state.state->size == 0 if buffer not
initialized) */
if (state.state->size) {
if (strm->avail_in == 0)
strm->next_in = state.state->in;
have = (unsigned)((strm->next_in + strm->avail_in) - state.state->in);
if (have < state.state->size) {
state.state->in[have] = (unsigned char)c;
strm->avail_in++;
state.state->x.pos++;
return c & 0xff;
}
}
/* no room in buffer or not initialized, use gz_write() */
buf[0] = (unsigned char)c;
if (gz_write(state, buf, 1) != 1)
return -1;
return c & 0xff;
}
/* -- see zlib.h -- */
int ZEXPORT gzputs(gzFile file, const char *str) {
int ret;
z_size_t len;
gz_statep state;
/* get internal structure */
if (file == NULL)
return -1;
state.file = file;
/* check that we're writing and that there's no error */
if (state.state->mode != GZ_WRITE || state.state->err != Z_OK)
return -1;
/* write string */
len = strlen(str);
ret = (int)gz_write(state, str, len);
return ret == 0 && len != 0 ? -1 : ret;
}
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
#include
/* -- see zlib.h -- */
int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va) {
int len;
unsigned left;
char *next;
gz_statep state;
z_streamp strm;
/* get internal structure */
if (file == NULL)
return Z_STREAM_ERROR;
state.file = file;
strm = &(state.state->strm);
/* check that we're writing and that there's no error */
if (state.state->mode != GZ_WRITE || state.state->err != Z_OK)
return Z_STREAM_ERROR;
/* make sure we have some buffer space */
if (state.state->size == 0 && gz_init(state) == -1)
return state.state->err;
/* check for seek request */
if (state.state->seek) {
state.state->seek = 0;
if (gz_zero(state, state.state->skip) == -1)
return state.state->err;
}
/* do the printf() into the input buffer, put length in len -- the input
buffer is double-sized just for this function, so there is guaranteed to
be state.state->size bytes available after the current contents */
if (strm->avail_in == 0)
strm->next_in = state.state->in;
next = (char *)(state.state->in + (strm->next_in - state.state->in) + strm->avail_in);
next[state.state->size - 1] = 0;
#ifdef NO_vsnprintf
# ifdef HAS_vsprintf_void
(void)vsprintf(next, format, va);
for (len = 0; len < state.state->size; len++)
if (next[len] == 0) break;
# else
len = vsprintf(next, format, va);
# endif
#else
# ifdef HAS_vsnprintf_void
(void)vsnprintf(next, state.state->size, format, va);
len = strlen(next);
# else
len = vsnprintf(next, state.state->size, format, va);
# endif
#endif
/* check that printf() results fit in buffer */
if (len == 0 || (unsigned)len >= state.state->size || next[state.state->size - 1] != 0)
return 0;
/* update buffer and position, compress first half if past that */
strm->avail_in += (unsigned)len;
state.state->x.pos += len;
if (strm->avail_in >= state.state->size) {
left = strm->avail_in - state.state->size;
strm->avail_in = state.state->size;
if (gz_comp(state, Z_NO_FLUSH) == -1)
return state.state->err;
memcpy(state.state->in, state.state->in + state.state->size, left);
strm->next_in = state.state->in;
strm->avail_in = left;
}
return len;
}
int ZEXPORTVA gzprintf(gzFile file, const char *format, ...) {
va_list va;
int ret;
va_start(va, format);
ret = gzvprintf(file, format, va);
va_end(va);
return ret;
}
#else /* !STDC && !Z_HAVE_STDARG_H */
/* -- see zlib.h -- */
int ZEXPORTVA gzprintf(gzFile file, const char *format, int a1, int a2, int a3,
int a4, int a5, int a6, int a7, int a8, int a9, int a10,
int a11, int a12, int a13, int a14, int a15, int a16,
int a17, int a18, int a19, int a20) {
unsigned len, left;
char *next;
gz_statep state;
z_streamp strm;
/* get internal structure */
if (file == NULL)
return Z_STREAM_ERROR;
state = (gz_statep)file;
strm = &(state.state->strm);
/* check that can really pass pointer in ints */
if (sizeof(int) != sizeof(void *))
return Z_STREAM_ERROR;
/* check that we're writing and that there's no error */
if (state.state->mode != GZ_WRITE || state.state->err != Z_OK)
return Z_STREAM_ERROR;
/* make sure we have some buffer space */
if (state.state->size == 0 && gz_init(state) == -1)
return state.state->error;
/* check for seek request */
if (state.state->seek) {
state.state->seek = 0;
if (gz_zero(state, state.state->skip) == -1)
return state.state->error;
}
/* do the printf() into the input buffer, put length in len -- the input
buffer is double-sized just for this function, so there is guaranteed to
be state.state->size bytes available after the current contents */
if (strm->avail_in == 0)
strm->next_in = state.state->in;
next = (char *)(strm->next_in + strm->avail_in);
next[state.state->size - 1] = 0;
#ifdef NO_snprintf
# ifdef HAS_sprintf_void
sprintf(next, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12,
a13, a14, a15, a16, a17, a18, a19, a20);
for (len = 0; len < size; len++)
if (next[len] == 0)
break;
# else
len = sprintf(next, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11,
a12, a13, a14, a15, a16, a17, a18, a19, a20);
# endif
#else
# ifdef HAS_snprintf_void
snprintf(next, state.state->size, format, a1, a2, a3, a4, a5, a6, a7, a8, a9,
a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
len = strlen(next);
# else
len = snprintf(next, state.state->size, format, a1, a2, a3, a4, a5, a6, a7, a8,
a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
# endif
#endif
/* check that printf() results fit in buffer */
if (len == 0 || len >= state.state->size || next[state.state->size - 1] != 0)
return 0;
/* update buffer and position, compress first half if past that */
strm->avail_in += len;
state.state->x.pos += len;
if (strm->avail_in >= state.state->size) {
left = strm->avail_in - state.state->size;
strm->avail_in = state.state->size;
if (gz_comp(state, Z_NO_FLUSH) == -1)
return state.state->err;
memcpy(state.state->in, state.state->in + state.state->size, left);
strm->next_in = state.state->in;
strm->avail_in = left;
}
return (int)len;
}
#endif
/* -- see zlib.h -- */
int ZEXPORT gzflush(gzFile file, int flush) {
gz_statep state;
/* get internal structure */
if (file == NULL)
return Z_STREAM_ERROR;
state.file = file;
/* check that we're writing and that there's no error */
if (state.state->mode != GZ_WRITE || state.state->err != Z_OK)
return Z_STREAM_ERROR;
/* check flush parameter */
if (flush < 0 || flush > Z_FINISH)
return Z_STREAM_ERROR;
/* check for seek request */
if (state.state->seek) {
state.state->seek = 0;
if (gz_zero(state, state.state->skip) == -1)
return state.state->err;
}
/* compress remaining data with requested flush */
(void)gz_comp(state, flush);
return state.state->err;
}
/* -- see zlib.h -- */
int ZEXPORT gzsetparams(gzFile file, int level, int strategy) {
gz_statep state;
z_streamp strm;
/* get internal structure */
if (file == NULL)
return Z_STREAM_ERROR;
state.file = file;
strm = &(state.state->strm);
/* check that we're writing and that there's no error */
if (state.state->mode != GZ_WRITE || state.state->err != Z_OK)
return Z_STREAM_ERROR;
/* if no change is requested, then do nothing */
if (level == state.state->level && strategy == state.state->strategy)
return Z_OK;
/* check for seek request */
if (state.state->seek) {
state.state->seek = 0;
if (gz_zero(state, state.state->skip) == -1)
return state.state->err;
}
/* change compression parameters for subsequent input */
if (state.state->size) {
/* flush previous input with previous parameters before changing */
if (strm->avail_in && gz_comp(state, Z_BLOCK) == -1)
return state.state->err;
deflateParams(strm, level, strategy);
}
state.state->level = level;
state.state->strategy = strategy;
return Z_OK;
}
/* -- see zlib.h -- */
int ZEXPORT gzclose_w(gzFile file) {
int ret = Z_OK;
gz_statep state;
/* get internal structure */
if (file == NULL)
return Z_STREAM_ERROR;
state.file = file;
/* check that we're writing */
if (state.state->mode != GZ_WRITE)
return Z_STREAM_ERROR;
/* check for seek request */
if (state.state->seek) {
state.state->seek = 0;
if (gz_zero(state, state.state->skip) == -1)
ret = state.state->err;
}
/* flush, free memory, and close file */
if (gz_comp(state, Z_FINISH) == -1)
ret = state.state->err;
if (state.state->size) {
if (!state.state->direct) {
(void)deflateEnd(&(state.state->strm));
free(state.state->out);
}
free(state.state->in);
}
gz_error(state, Z_OK, NULL);
free(state.state->path);
if (close(state.state->fd) == -1)
ret = Z_ERRNO;
free(state.state);
return ret;
}
form-5.0.1/build-aux/ 0000755 0001751 0001751 00000000000 15217035744 010125 5 form-5.0.1/build-aux/install-sh 0000755 0001751 0001751 00000035776 15217035732 012070 #!/bin/sh
# install - install a program, script, or datafile
scriptversion=2020-11-14.01; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# 'make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
tab=' '
nl='
'
IFS=" $tab$nl"
# Set DOITPROG to "echo" to test this script.
doit=${DOITPROG-}
doit_exec=${doit:-exec}
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_mkdir=
# Desired mode of installed file.
mode=0755
# Create dirs (including intermediate dirs) using mode 755.
# This is like GNU 'install' as of coreutils 8.32 (2020).
mkdir_umask=22
backupsuffix=
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
src=
dst=
dir_arg=
dst_arg=
copy_on_change=false
is_target_a_directory=possibly
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-p pass -p to $cpprog.
-s $stripprog installed files.
-S SUFFIX attempt to back up existing files, with suffix SUFFIX.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
By default, rm is invoked with -f; when overridden with RMPROG,
it's up to you to specify -f if you want it.
If -S is not specified, no backups are attempted.
Email bug reports to bug-automake@gnu.org.
Automake home page: https://www.gnu.org/software/automake/
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-p) cpprog="$cpprog -p";;
-s) stripcmd=$stripprog;;
-S) backupsuffix="$2"
shift;;
-t)
is_target_a_directory=always
dst_arg=$2
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
shift;;
-T) is_target_a_directory=never;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
# We allow the use of options -d and -T together, by making -d
# take the precedence; this is for compatibility with GNU install.
if test -n "$dir_arg"; then
if test -n "$dst_arg"; then
echo "$0: target directory not allowed when installing a directory." >&2
exit 1
fi
fi
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call 'install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
if test $# -gt 1 || test "$is_target_a_directory" = always; then
if test ! -d "$dst_arg"; then
echo "$0: $dst_arg: Is not a directory." >&2
exit 1
fi
fi
fi
if test -z "$dir_arg"; then
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
trap "ret=141; $do_exit" 13
trap "ret=143; $do_exit" 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names problematic for 'test' and other utilities.
case $src in
-* | [=\(\)!]) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
# Don't chown directories that already exist.
if test $dstdir_status = 0; then
chowncmd=""
fi
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# If destination is a directory, append the input filename.
if test -d "$dst"; then
if test "$is_target_a_directory" = never; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dstbase=`basename "$src"`
case $dst in
*/) dst=$dst$dstbase;;
*) dst=$dst/$dstbase;;
esac
dstdir_status=0
else
dstdir=`dirname "$dst"`
test -d "$dstdir"
dstdir_status=$?
fi
fi
case $dstdir in
*/) dstdirslash=$dstdir;;
*) dstdirslash=$dstdir/;;
esac
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
# The $RANDOM variable is not portable (e.g., dash). Use it
# here however when possible just to lower collision chance.
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap '
ret=$?
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null
exit $ret
' 0
# Because "mkdir -p" follows existing symlinks and we likely work
# directly in world-writeable /tmp, make sure that the '$tmpdir'
# directory is successfully created first before we actually test
# 'mkdir -p'.
if (umask $mkdir_umask &&
$mkdirprog $mkdir_mode "$tmpdir" &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
test_tmpdir="$tmpdir/a"
ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
fi
trap '' 0;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
[-=\(\)!]*) prefix='./';;
*) prefix='';;
esac
oIFS=$IFS
IFS=/
set -f
set fnord $dstdir
shift
set +f
IFS=$oIFS
prefixes=
for d
do
test X"$d" = X && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=${dstdirslash}_inst.$$_
rmtmp=${dstdirslash}_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask &&
{ test -z "$stripcmd" || {
# Create $dsttmp read-write so that cp doesn't create it read-only,
# which would cause strip to fail.
if test -z "$doit"; then
: >"$dsttmp" # No need to fork-exec 'touch'.
else
$doit touch "$dsttmp"
fi
}
} &&
$doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# If $backupsuffix is set, and the file being installed
# already exists, attempt a backup. Don't worry if it fails,
# e.g., if mv doesn't support -f.
if test -n "$backupsuffix" && test -f "$dst"; then
$doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null
fi
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
form-5.0.1/build-aux/depcomp 0000755 0001751 0001751 00000056020 15217035732 011422 #! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1999-2021 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, see .
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva .
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by 'PROGRAMS ARGS'.
object Object file output by 'PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputting dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to .
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
# Get the directory component of the given path, and save it in the
# global variables '$dir'. Note that this directory component will
# be either empty or ending with a '/' character. This is deliberate.
set_dir_from ()
{
case $1 in
*/*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
*) dir=;;
esac
}
# Get the suffix-stripped basename of the given path, and save it the
# global variable '$base'.
set_base_from ()
{
base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
}
# If no dependency file was actually created by the compiler invocation,
# we still have to create a dummy depfile, to avoid errors with the
# Makefile "include basename.Plo" scheme.
make_dummy_depfile ()
{
echo "#dummy" > "$depfile"
}
# Factor out some common post-processing of the generated depfile.
# Requires the auxiliary global variable '$tmpdepfile' to be set.
aix_post_process_depfile ()
{
# If the compiler actually managed to produce a dependency file,
# post-process it.
if test -f "$tmpdepfile"; then
# Each line is of the form 'foo.o: dependency.h'.
# Do two passes, one to just change these to
# $object: dependency.h
# and one to simply output
# dependency.h:
# which is needed to avoid the deleted-header problem.
{ sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
} > "$depfile"
rm -f "$tmpdepfile"
else
make_dummy_depfile
fi
}
# A tabulation character.
tab=' '
# A newline character.
nl='
'
# Character ranges might be problematic outside the C locale.
# These definitions help.
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
lower=abcdefghijklmnopqrstuvwxyz
digits=0123456789
alpha=${upper}${lower}
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Avoid interferences from the environment.
gccflag= dashmflag=
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
cygpath_u="cygpath -u -f -"
if test "$depmode" = msvcmsys; then
# This is just like msvisualcpp but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvisualcpp
fi
if test "$depmode" = msvc7msys; then
# This is just like msvc7 but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvc7
fi
if test "$depmode" = xlc; then
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
gccflag=-qmakedep=gcc,-MF
depmode=gcc
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
## the command line argument order; so add the flags where they
## appear in depend2.am. Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
for arg
do
case $arg in
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
*) set fnord "$@" "$arg" ;;
esac
shift # fnord
shift # $arg
done
"$@"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
## (see the conditional assignment to $gccflag above).
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say). Also, it might not be
## supported by the other compilers which use the 'gcc' depmode.
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
# The second -e expression handles DOS-style file names with drive
# letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the "deleted header file" problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
## Some versions of gcc put a space before the ':'. On the theory
## that the space means something, we add a space to the output as
## well. hp depmode also adds that space, but also prefixes the VPATH
## to the object. Take care to not repeat it in the output.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like '#:fec' to the end of the
# dependency line.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
| tr "$nl" ' ' >> "$depfile"
echo >> "$depfile"
# The second pass generates a dummy entry for each header file.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> "$depfile"
else
make_dummy_depfile
fi
rm -f "$tmpdepfile"
;;
xlc)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts '$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.u
tmpdepfile2=$base.u
tmpdepfile3=$dir.libs/$base.u
"$@" -Wc,-M
else
tmpdepfile1=$dir$base.u
tmpdepfile2=$dir$base.u
tmpdepfile3=$dir$base.u
"$@" -M
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
aix_post_process_depfile
;;
tcc)
# tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
# FIXME: That version still under development at the moment of writing.
# Make that this statement remains true also for stable, released
# versions.
# It will wrap lines (doesn't matter whether long or short) with a
# trailing '\', as in:
#
# foo.o : \
# foo.c \
# foo.h \
#
# It will put a trailing '\' even on the last line, and will use leading
# spaces rather than leading tabs (at least since its commit 0394caf7
# "Emit spaces for -MD").
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
# We have to change lines of the first kind to '$object: \'.
sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
# And for each line of the second kind, we have to emit a 'dep.h:'
# dummy dependency, to avoid the deleted-header problem.
sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
rm -f "$tmpdepfile"
;;
## The order of this option in the case statement is important, since the
## shell code in configure will try each of these formats in the order
## listed in this file. A plain '-MD' option would be understood by many
## compilers, so we must ensure this comes after the gcc and icc options.
pgcc)
# Portland's C compiler understands '-MD'.
# Will always output deps to 'file.d' where file is the root name of the
# source file under compilation, even if file resides in a subdirectory.
# The object file name does not affect the name of the '.d' file.
# pgcc 10.2 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using '\' :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
set_dir_from "$object"
# Use the source, not the object, to determine the base name, since
# that's sadly what pgcc will do too.
set_base_from "$source"
tmpdepfile=$base.d
# For projects that build the same source file twice into different object
# files, the pgcc approach of using the *source* file root name can cause
# problems in parallel builds. Use a locking strategy to avoid stomping on
# the same $tmpdepfile.
lockdir=$base.d-lock
trap "
echo '$0: caught signal, cleaning up...' >&2
rmdir '$lockdir'
exit 1
" 1 2 13 15
numtries=100
i=$numtries
while test $i -gt 0; do
# mkdir is a portable test-and-set.
if mkdir "$lockdir" 2>/dev/null; then
# This process acquired the lock.
"$@" -MD
stat=$?
# Release the lock.
rmdir "$lockdir"
break
else
# If the lock is being held by a different process, wait
# until the winning process is done or we timeout.
while test -d "$lockdir" && test $i -gt 0; do
sleep 1
i=`expr $i - 1`
done
fi
i=`expr $i - 1`
done
trap - 1 2 13 15
if test $i -le 0; then
echo "$0: failed to acquire lock after $numtries attempts" >&2
echo "$0: check lockdir '$lockdir'" >&2
exit 1
fi
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp2)
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
# compilers, which have integrated preprocessors. The correct option
# to use with these is +Maked; it writes dependencies to a file named
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
"$@" -Wc,+Maked
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
"$@" +Maked
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
# Add 'dependent.h:' lines.
sed -ne '2,${
s/^ *//
s/ \\*$//
s/$/:/
p
}' "$tmpdepfile" >> "$depfile"
else
make_dummy_depfile
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in 'foo.d' instead, so we check for that too.
# Subdirectories are respected.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
# Libtool generates 2 separate objects for the 2 libraries. These
# two compilations output dependencies in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir$base.o.d # libtool 1.5
tmpdepfile2=$dir.libs/$base.o.d # Likewise.
tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
# Same post-processing that is required for AIX mode.
aix_post_process_depfile
;;
msvc7)
if test "$libtool" = yes; then
showIncludes=-Wc,-showIncludes
else
showIncludes=-showIncludes
fi
"$@" $showIncludes > "$tmpdepfile"
stat=$?
grep -v '^Note: including file: ' "$tmpdepfile"
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
# The first sed program below extracts the file names and escapes
# backslashes for cygpath. The second sed program outputs the file
# name when reading, but also accumulates all include files in the
# hold buffer in order to output them again at the end. This only
# works with sed implementations that can handle large buffers.
sed < "$tmpdepfile" -n '
/^Note: including file: *\(.*\)/ {
s//\1/
s/\\/\\\\/g
p
}' | $cygpath_u | sort -u | sed -n '
s/ /\\ /g
s/\(.*\)/'"$tab"'\1 \\/p
s/.\(.*\) \\/\1:/
H
$ {
s/.*/'"$tab"'/
G
p
}' >> "$depfile"
echo >> "$depfile" # make sure the fragment doesn't end with a backslash
rm -f "$tmpdepfile"
;;
msvc7msys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove '-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for ':'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
"$@" $dashmflag |
sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this sed invocation
# correctly. Breaking it into two sed invocations is a workaround.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no eat=no
for arg
do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
if test $eat = yes; then
eat=no
continue
fi
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-arch)
eat=yes ;;
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix=`echo "$object" | sed 's/^.*\././'`
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
# makedepend may prepend the VPATH from the source file name to the object.
# No need to regex-escape $object, excess matching of '.' is harmless.
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process the last invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed '1,2d' "$tmpdepfile" \
| tr ' ' "$nl" \
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove '-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E \
| sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
| sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
IFS=" "
for arg
do
case "$arg" in
-o)
shift
;;
$object)
shift
;;
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E 2>/dev/null |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
echo "$tab" >> "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvcmsys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
form-5.0.1/build-aux/config.guess 0000755 0001751 0001751 00000140512 15217035732 012365 #! /bin/sh
# Attempt to guess a canonical system name.
# Copyright 1992-2022 Free Software Foundation, Inc.
# shellcheck disable=SC2006,SC2268 # see below for rationale
timestamp='2022-01-09'
# This file 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 3 of the License, 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, see .
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that
# program. This Exception is an additional permission under section 7
# of the GNU General Public License, version 3 ("GPLv3").
#
# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
#
# You can get the latest version of this script from:
# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
#
# Please send patches to .
# The "shellcheck disable" line above the timestamp inhibits complaints
# about features and limitations of the classic Bourne shell that were
# superseded or lifted in POSIX. However, this script identifies a wide
# variety of pre-POSIX systems that do not have POSIX shells at all, and
# even some reasonably current systems (Solaris 10 as case-in-point) still
# have a pre-POSIX /bin/sh.
me=`echo "$0" | sed -e 's,.*/,,'`
usage="\
Usage: $0 [OPTION]
Output the configuration name of the system \`$me' is run on.
Options:
-h, --help print this help, then exit
-t, --time-stamp print date of last modification, then exit
-v, --version print version number, then exit
Report bugs and patches to ."
version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
Copyright 1992-2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
help="
Try \`$me --help' for more information."
# Parse command line
while test $# -gt 0 ; do
case $1 in
--time-stamp | --time* | -t )
echo "$timestamp" ; exit ;;
--version | -v )
echo "$version" ; exit ;;
--help | --h* | -h )
echo "$usage"; exit ;;
-- ) # Stop option processing
shift; break ;;
- ) # Use stdin as input.
break ;;
-* )
echo "$me: invalid option $1$help" >&2
exit 1 ;;
* )
break ;;
esac
done
if test $# != 0; then
echo "$me: too many arguments$help" >&2
exit 1
fi
# Just in case it came from the environment.
GUESS=
# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
# compiler to aid in system detection is discouraged as it requires
# temporary files to be created and, as you can see below, it is a
# headache to deal with in a portable fashion.
# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
# use `HOST_CC' if defined, but it is deprecated.
# Portable tmp directory creation inspired by the Autoconf team.
tmp=
# shellcheck disable=SC2172
trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
set_cc_for_build() {
# prevent multiple calls if $tmp is already set
test "$tmp" && return 0
: "${TMPDIR=/tmp}"
# shellcheck disable=SC2039,SC3028
{ tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
dummy=$tmp/dummy
case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
,,) echo "int x;" > "$dummy.c"
for driver in cc gcc c89 c99 ; do
if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
CC_FOR_BUILD=$driver
break
fi
done
if test x"$CC_FOR_BUILD" = x ; then
CC_FOR_BUILD=no_compiler_found
fi
;;
,,*) CC_FOR_BUILD=$CC ;;
,*,*) CC_FOR_BUILD=$HOST_CC ;;
esac
}
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 1994-08-24)
if test -f /.attbin/uname ; then
PATH=$PATH:/.attbin ; export PATH
fi
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
case $UNAME_SYSTEM in
Linux|GNU|GNU/*)
LIBC=unknown
set_cc_for_build
cat <<-EOF > "$dummy.c"
#include
#if defined(__UCLIBC__)
LIBC=uclibc
#elif defined(__dietlibc__)
LIBC=dietlibc
#elif defined(__GLIBC__)
LIBC=gnu
#else
#include
/* First heuristic to detect musl libc. */
#ifdef __DEFINED_va_list
LIBC=musl
#endif
#endif
EOF
cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
eval "$cc_set_libc"
# Second heuristic to detect musl libc.
if [ "$LIBC" = unknown ] &&
command -v ldd >/dev/null &&
ldd --version 2>&1 | grep -q ^musl; then
LIBC=musl
fi
# If the system lacks a compiler, then just pick glibc.
# We could probably try harder.
if [ "$LIBC" = unknown ]; then
LIBC=gnu
fi
;;
esac
# Note: order is significant - the case branches are not exclusive.
case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
*:NetBSD:*:*)
# NetBSD (nbsd) targets should (where applicable) match one or
# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
# switched to ELF, *-*-netbsd* would select the old
# object file format. This provides both forward
# compatibility and a consistent mechanism for selecting the
# object file format.
#
# Note: NetBSD doesn't particularly care about the vendor
# portion of the name. We always set it to "unknown".
UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
/usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
echo unknown)`
case $UNAME_MACHINE_ARCH in
aarch64eb) machine=aarch64_be-unknown ;;
armeb) machine=armeb-unknown ;;
arm*) machine=arm-unknown ;;
sh3el) machine=shl-unknown ;;
sh3eb) machine=sh-unknown ;;
sh5el) machine=sh5le-unknown ;;
earmv*)
arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
machine=${arch}${endian}-unknown
;;
*) machine=$UNAME_MACHINE_ARCH-unknown ;;
esac
# The Operating System including object format, if it has switched
# to ELF recently (or will in the future) and ABI.
case $UNAME_MACHINE_ARCH in
earm*)
os=netbsdelf
;;
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ELF__
then
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
# Return netbsd for either. FIX?
os=netbsd
else
os=netbsdelf
fi
;;
*)
os=netbsd
;;
esac
# Determine ABI tags.
case $UNAME_MACHINE_ARCH in
earm*)
expr='s/^earmv[0-9]/-eabi/;s/eb$//'
abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
;;
esac
# The OS release
# Debian GNU/NetBSD machines have a different userland, and
# thus, need a distinct triplet. However, they do not need
# kernel version information, so it can be replaced with a
# suitable tag, in the style of linux-gnu.
case $UNAME_VERSION in
Debian*)
release='-gnu'
;;
*)
release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
;;
esac
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
# contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
GUESS=$machine-${os}${release}${abi-}
;;
*:Bitrig:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
;;
*:OpenBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
;;
*:SecBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
;;
*:LibertyBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
;;
*:MidnightBSD:*:*)
GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
;;
*:ekkoBSD:*:*)
GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
;;
*:SolidBSD:*:*)
GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
;;
*:OS108:*:*)
GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
;;
macppc:MirBSD:*:*)
GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
;;
*:MirBSD:*:*)
GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
;;
*:Sortix:*:*)
GUESS=$UNAME_MACHINE-unknown-sortix
;;
*:Twizzler:*:*)
GUESS=$UNAME_MACHINE-unknown-twizzler
;;
*:Redox:*:*)
GUESS=$UNAME_MACHINE-unknown-redox
;;
mips:OSF1:*.*)
GUESS=mips-dec-osf1
;;
alpha:OSF1:*:*)
# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
trap '' 0
case $UNAME_RELEASE in
*4.0)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
;;
*5.*)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
;;
esac
# According to Compaq, /usr/sbin/psrinfo has been available on
# OSF/1 and Tru64 systems produced since 1995. I hope that
# covers most systems running today. This code pipes the CPU
# types through head -n 1, so we only detect the type of CPU 0.
ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
case $ALPHA_CPU_TYPE in
"EV4 (21064)")
UNAME_MACHINE=alpha ;;
"EV4.5 (21064)")
UNAME_MACHINE=alpha ;;
"LCA4 (21066/21068)")
UNAME_MACHINE=alpha ;;
"EV5 (21164)")
UNAME_MACHINE=alphaev5 ;;
"EV5.6 (21164A)")
UNAME_MACHINE=alphaev56 ;;
"EV5.6 (21164PC)")
UNAME_MACHINE=alphapca56 ;;
"EV5.7 (21164PC)")
UNAME_MACHINE=alphapca57 ;;
"EV6 (21264)")
UNAME_MACHINE=alphaev6 ;;
"EV6.7 (21264A)")
UNAME_MACHINE=alphaev67 ;;
"EV6.8CB (21264C)")
UNAME_MACHINE=alphaev68 ;;
"EV6.8AL (21264B)")
UNAME_MACHINE=alphaev68 ;;
"EV6.8CX (21264D)")
UNAME_MACHINE=alphaev68 ;;
"EV6.9A (21264/EV69A)")
UNAME_MACHINE=alphaev69 ;;
"EV7 (21364)")
UNAME_MACHINE=alphaev7 ;;
"EV7.9 (21364A)")
UNAME_MACHINE=alphaev79 ;;
esac
# A Pn.n version is a patched version.
# A Vn.n version is a released version.
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
;;
Amiga*:UNIX_System_V:4.0:*)
GUESS=m68k-unknown-sysv4
;;
*:[Aa]miga[Oo][Ss]:*:*)
GUESS=$UNAME_MACHINE-unknown-amigaos
;;
*:[Mm]orph[Oo][Ss]:*:*)
GUESS=$UNAME_MACHINE-unknown-morphos
;;
*:OS/390:*:*)
GUESS=i370-ibm-openedition
;;
*:z/VM:*:*)
GUESS=s390-ibm-zvmoe
;;
*:OS400:*:*)
GUESS=powerpc-ibm-os400
;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
GUESS=arm-acorn-riscix$UNAME_RELEASE
;;
arm*:riscos:*:*|arm*:RISCOS:*:*)
GUESS=arm-unknown-riscos
;;
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
GUESS=hppa1.1-hitachi-hiuxmpp
;;
Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
case `(/bin/universe) 2>/dev/null` in
att) GUESS=pyramid-pyramid-sysv3 ;;
*) GUESS=pyramid-pyramid-bsd ;;
esac
;;
NILE*:*:*:dcosx)
GUESS=pyramid-pyramid-svr4
;;
DRS?6000:unix:4.0:6*)
GUESS=sparc-icl-nx6
;;
DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
case `/usr/bin/uname -p` in
sparc) GUESS=sparc-icl-nx7 ;;
esac
;;
s390x:SunOS:*:*)
SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
;;
sun4H:SunOS:5.*:*)
SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
GUESS=sparc-hal-solaris2$SUN_REL
;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
GUESS=sparc-sun-solaris2$SUN_REL
;;
i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
GUESS=i386-pc-auroraux$UNAME_RELEASE
;;
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
set_cc_for_build
SUN_ARCH=i386
# If there is a compiler, see if it is configured for 64-bit objects.
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
# This test works for both compilers.
if test "$CC_FOR_BUILD" != no_compiler_found; then
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
SUN_ARCH=x86_64
fi
fi
SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
# it's likely to be more like Solaris than SunOS4.
SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
GUESS=sparc-sun-solaris3$SUN_REL
;;
sun4*:SunOS:*:*)
case `/usr/bin/arch -k` in
Series*|S4*)
UNAME_RELEASE=`uname -v`
;;
esac
# Japanese Language versions have a version number like `4.1.3-JL'.
SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
GUESS=sparc-sun-sunos$SUN_REL
;;
sun3*:SunOS:*:*)
GUESS=m68k-sun-sunos$UNAME_RELEASE
;;
sun*:*:4.2BSD:*)
UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
case `/bin/arch` in
sun3)
GUESS=m68k-sun-sunos$UNAME_RELEASE
;;
sun4)
GUESS=sparc-sun-sunos$UNAME_RELEASE
;;
esac
;;
aushp:SunOS:*:*)
GUESS=sparc-auspex-sunos$UNAME_RELEASE
;;
# The situation for MiNT is a little confusing. The machine name
# can be virtually everything (everything which is not
# "atarist" or "atariste" at least should have a processor
# > m68000). The system name ranges from "MiNT" over "FreeMiNT"
# to the lowercase version "mint" (or "freemint"). Finally
# the system name "TOS" denotes a system which is actually not
# MiNT. But MiNT is downward compatible to TOS, so this should
# be no problem.
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
GUESS=m68k-atari-mint$UNAME_RELEASE
;;
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
GUESS=m68k-atari-mint$UNAME_RELEASE
;;
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
GUESS=m68k-atari-mint$UNAME_RELEASE
;;
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
GUESS=m68k-milan-mint$UNAME_RELEASE
;;
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
GUESS=m68k-hades-mint$UNAME_RELEASE
;;
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
GUESS=m68k-unknown-mint$UNAME_RELEASE
;;
m68k:machten:*:*)
GUESS=m68k-apple-machten$UNAME_RELEASE
;;
powerpc:machten:*:*)
GUESS=powerpc-apple-machten$UNAME_RELEASE
;;
RISC*:Mach:*:*)
GUESS=mips-dec-mach_bsd4.3
;;
RISC*:ULTRIX:*:*)
GUESS=mips-dec-ultrix$UNAME_RELEASE
;;
VAX*:ULTRIX*:*:*)
GUESS=vax-dec-ultrix$UNAME_RELEASE
;;
2020:CLIX:*:* | 2430:CLIX:*:*)
GUESS=clipper-intergraph-clix$UNAME_RELEASE
;;
mips:*:*:UMIPS | mips:*:*:RISCos)
set_cc_for_build
sed 's/^ //' << EOF > "$dummy.c"
#ifdef __cplusplus
#include /* for printf() prototype */
int main (int argc, char *argv[]) {
#else
int main (argc, argv) int argc; char *argv[]; {
#endif
#if defined (host_mips) && defined (MIPSEB)
#if defined (SYSTYPE_SYSV)
printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_SVR4)
printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
#endif
#endif
exit (-1);
}
EOF
$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
{ echo "$SYSTEM_NAME"; exit; }
GUESS=mips-mips-riscos$UNAME_RELEASE
;;
Motorola:PowerMAX_OS:*:*)
GUESS=powerpc-motorola-powermax
;;
Motorola:*:4.3:PL8-*)
GUESS=powerpc-harris-powermax
;;
Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
GUESS=powerpc-harris-powermax
;;
Night_Hawk:Power_UNIX:*:*)
GUESS=powerpc-harris-powerunix
;;
m88k:CX/UX:7*:*)
GUESS=m88k-harris-cxux7
;;
m88k:*:4*:R4*)
GUESS=m88k-motorola-sysv4
;;
m88k:*:3*:R3*)
GUESS=m88k-motorola-sysv3
;;
AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
then
if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
test "$TARGET_BINARY_INTERFACE"x = x
then
GUESS=m88k-dg-dgux$UNAME_RELEASE
else
GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
fi
else
GUESS=i586-dg-dgux$UNAME_RELEASE
fi
;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
GUESS=m88k-dolphin-sysv3
;;
M88*:*:R3*:*)
# Delta 88k system running SVR3
GUESS=m88k-motorola-sysv3
;;
XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
GUESS=m88k-tektronix-sysv3
;;
Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
GUESS=m68k-tektronix-bsd
;;
*:IRIX*:*:*)
IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
GUESS=mips-sgi-irix$IRIX_REL
;;
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id
;; # Note that: echo "'`uname -s`'" gives 'AIX '
i*86:AIX:*:*)
GUESS=i386-ibm-aix
;;
ia64:AIX:*:*)
if test -x /usr/bin/oslevel ; then
IBM_REV=`/usr/bin/oslevel`
else
IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
fi
GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
;;
*:AIX:2:3)
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
set_cc_for_build
sed 's/^ //' << EOF > "$dummy.c"
#include
main()
{
if (!__power_pc())
exit(1);
puts("powerpc-ibm-aix3.2.5");
exit(0);
}
EOF
if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
then
GUESS=$SYSTEM_NAME
else
GUESS=rs6000-ibm-aix3.2.5
fi
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
GUESS=rs6000-ibm-aix3.2.4
else
GUESS=rs6000-ibm-aix3.2
fi
;;
*:AIX:*:[4567])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
IBM_ARCH=rs6000
else
IBM_ARCH=powerpc
fi
if test -x /usr/bin/lslpp ; then
IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
else
IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
fi
GUESS=$IBM_ARCH-ibm-aix$IBM_REV
;;
*:AIX:*:*)
GUESS=rs6000-ibm-aix
;;
ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
GUESS=romp-ibm-bsd4.4
;;
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to
;; # report: romp-ibm BSD 4.3
*:BOSX:*:*)
GUESS=rs6000-bull-bosx
;;
DPX/2?00:B.O.S.:*:*)
GUESS=m68k-bull-sysv3
;;
9000/[34]??:4.3bsd:1.*:*)
GUESS=m68k-hp-bsd
;;
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
GUESS=m68k-hp-bsd4.4
;;
9000/[34678]??:HP-UX:*:*)
HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
case $UNAME_MACHINE in
9000/31?) HP_ARCH=m68000 ;;
9000/[34]??) HP_ARCH=m68k ;;
9000/[678][0-9][0-9])
if test -x /usr/bin/getconf; then
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
case $sc_cpu_version in
523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
532) # CPU_PA_RISC2_0
case $sc_kernel_bits in
32) HP_ARCH=hppa2.0n ;;
64) HP_ARCH=hppa2.0w ;;
'') HP_ARCH=hppa2.0 ;; # HP-UX 10.20
esac ;;
esac
fi
if test "$HP_ARCH" = ""; then
set_cc_for_build
sed 's/^ //' << EOF > "$dummy.c"
#define _HPUX_SOURCE
#include
#include
int main ()
{
#if defined(_SC_KERNEL_BITS)
long bits = sysconf(_SC_KERNEL_BITS);
#endif
long cpu = sysconf (_SC_CPU_VERSION);
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
case CPU_PA_RISC2_0:
#if defined(_SC_KERNEL_BITS)
switch (bits)
{
case 64: puts ("hppa2.0w"); break;
case 32: puts ("hppa2.0n"); break;
default: puts ("hppa2.0"); break;
} break;
#else /* !defined(_SC_KERNEL_BITS) */
puts ("hppa2.0"); break;
#endif
default: puts ("hppa1.0"); break;
}
exit (0);
}
EOF
(CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
test -z "$HP_ARCH" && HP_ARCH=hppa
fi ;;
esac
if test "$HP_ARCH" = hppa2.0w
then
set_cc_for_build
# hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
# 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
# generating 64-bit code. GNU and HP use different nomenclature:
#
# $ CC_FOR_BUILD=cc ./config.guess
# => hppa2.0w-hp-hpux11.23
# $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
# => hppa64-hp-hpux11.23
if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
grep -q __LP64__
then
HP_ARCH=hppa2.0w
else
HP_ARCH=hppa64
fi
fi
GUESS=$HP_ARCH-hp-hpux$HPUX_REV
;;
ia64:HP-UX:*:*)
HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
GUESS=ia64-hp-hpux$HPUX_REV
;;
3050*:HI-UX:*:*)
set_cc_for_build
sed 's/^ //' << EOF > "$dummy.c"
#include
int
main ()
{
long cpu = sysconf (_SC_CPU_VERSION);
/* The order matters, because CPU_IS_HP_MC68K erroneously returns
true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
results, however. */
if (CPU_IS_PA_RISC (cpu))
{
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
default: puts ("hppa-hitachi-hiuxwe2"); break;
}
}
else if (CPU_IS_HP_MC68K (cpu))
puts ("m68k-hitachi-hiuxwe2");
else puts ("unknown-hitachi-hiuxwe2");
exit (0);
}
EOF
$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
{ echo "$SYSTEM_NAME"; exit; }
GUESS=unknown-hitachi-hiuxwe2
;;
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
GUESS=hppa1.1-hp-bsd
;;
9000/8??:4.3bsd:*:*)
GUESS=hppa1.0-hp-bsd
;;
*9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
GUESS=hppa1.0-hp-mpeix
;;
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
GUESS=hppa1.1-hp-osf
;;
hp8??:OSF1:*:*)
GUESS=hppa1.0-hp-osf
;;
i*86:OSF1:*:*)
if test -x /usr/sbin/sysversion ; then
GUESS=$UNAME_MACHINE-unknown-osf1mk
else
GUESS=$UNAME_MACHINE-unknown-osf1
fi
;;
parisc*:Lites*:*:*)
GUESS=hppa1.1-hp-lites
;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
GUESS=c1-convex-bsd
;;
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit ;;
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
GUESS=c34-convex-bsd
;;
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
GUESS=c38-convex-bsd
;;
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
GUESS=c4-convex-bsd
;;
CRAY*Y-MP:*:*:*)
CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
GUESS=ymp-cray-unicos$CRAY_REL
;;
CRAY*[A-Z]90:*:*:*)
echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
-e 's/\.[^.]*$/.X/'
exit ;;
CRAY*TS:*:*:*)
CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
GUESS=t90-cray-unicos$CRAY_REL
;;
CRAY*T3E:*:*:*)
CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
GUESS=alphaev5-cray-unicosmk$CRAY_REL
;;
CRAY*SV1:*:*:*)
CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
GUESS=sv1-cray-unicos$CRAY_REL
;;
*:UNICOS/mp:*:*)
CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
GUESS=craynv-cray-unicosmp$CRAY_REL
;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
;;
5000:UNIX_System_V:4.*:*)
FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
;;
sparc*:BSD/OS:*:*)
GUESS=sparc-unknown-bsdi$UNAME_RELEASE
;;
*:BSD/OS:*:*)
GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
;;
arm:FreeBSD:*:*)
UNAME_PROCESSOR=`uname -p`
set_cc_for_build
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_PCS_VFP
then
FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
else
FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
fi
;;
*:FreeBSD:*:*)
UNAME_PROCESSOR=`/usr/bin/uname -p`
case $UNAME_PROCESSOR in
amd64)
UNAME_PROCESSOR=x86_64 ;;
i386)
UNAME_PROCESSOR=i586 ;;
esac
FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
;;
i*:CYGWIN*:*)
GUESS=$UNAME_MACHINE-pc-cygwin
;;
*:MINGW64*:*)
GUESS=$UNAME_MACHINE-pc-mingw64
;;
*:MINGW*:*)
GUESS=$UNAME_MACHINE-pc-mingw32
;;
*:MSYS*:*)
GUESS=$UNAME_MACHINE-pc-msys
;;
i*:PW*:*)
GUESS=$UNAME_MACHINE-pc-pw32
;;
*:SerenityOS:*:*)
GUESS=$UNAME_MACHINE-pc-serenity
;;
*:Interix*:*)
case $UNAME_MACHINE in
x86)
GUESS=i586-pc-interix$UNAME_RELEASE
;;
authenticamd | genuineintel | EM64T)
GUESS=x86_64-unknown-interix$UNAME_RELEASE
;;
IA64)
GUESS=ia64-unknown-interix$UNAME_RELEASE
;;
esac ;;
i*:UWIN*:*)
GUESS=$UNAME_MACHINE-pc-uwin
;;
amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
GUESS=x86_64-pc-cygwin
;;
prep*:SunOS:5.*:*)
SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
GUESS=powerpcle-unknown-solaris2$SUN_REL
;;
*:GNU:*:*)
# the GNU system
GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
;;
*:GNU/*:*:*)
# other systems with GNU libc and userland
GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
;;
*:Minix:*:*)
GUESS=$UNAME_MACHINE-unknown-minix
;;
aarch64:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
aarch64_be:Linux:*:*)
UNAME_MACHINE=aarch64_be
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
EV5) UNAME_MACHINE=alphaev5 ;;
EV56) UNAME_MACHINE=alphaev56 ;;
PCA56) UNAME_MACHINE=alphapca56 ;;
PCA57) UNAME_MACHINE=alphapca56 ;;
EV6) UNAME_MACHINE=alphaev6 ;;
EV67) UNAME_MACHINE=alphaev67 ;;
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
objdump --private-headers /bin/sh | grep -q ld.so.1
if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
arm*:Linux:*:*)
set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__
then
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
else
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_PCS_VFP
then
GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
else
GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
fi
fi
;;
avr32*:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
cris:Linux:*:*)
GUESS=$UNAME_MACHINE-axis-linux-$LIBC
;;
crisv32:Linux:*:*)
GUESS=$UNAME_MACHINE-axis-linux-$LIBC
;;
e2k:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
frv:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
hexagon:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
i*86:Linux:*:*)
GUESS=$UNAME_MACHINE-pc-linux-$LIBC
;;
ia64:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
k1om:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
m32r*:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
m68*:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
mips:Linux:*:* | mips64:Linux:*:*)
set_cc_for_build
IS_GLIBC=0
test x"${LIBC}" = xgnu && IS_GLIBC=1
sed 's/^ //' << EOF > "$dummy.c"
#undef CPU
#undef mips
#undef mipsel
#undef mips64
#undef mips64el
#if ${IS_GLIBC} && defined(_ABI64)
LIBCABI=gnuabi64
#else
#if ${IS_GLIBC} && defined(_ABIN32)
LIBCABI=gnuabin32
#else
LIBCABI=${LIBC}
#endif
#endif
#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
CPU=mipsisa64r6
#else
#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
CPU=mipsisa32r6
#else
#if defined(__mips64)
CPU=mips64
#else
CPU=mips
#endif
#endif
#endif
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
MIPS_ENDIAN=el
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
MIPS_ENDIAN=
#else
MIPS_ENDIAN=
#endif
#endif
EOF
cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
eval "$cc_set_vars"
test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
;;
mips64el:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
openrisc*:Linux:*:*)
GUESS=or1k-unknown-linux-$LIBC
;;
or32:Linux:*:* | or1k*:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
padre:Linux:*:*)
GUESS=sparc-unknown-linux-$LIBC
;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
GUESS=hppa64-unknown-linux-$LIBC
;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
*) GUESS=hppa-unknown-linux-$LIBC ;;
esac
;;
ppc64:Linux:*:*)
GUESS=powerpc64-unknown-linux-$LIBC
;;
ppc:Linux:*:*)
GUESS=powerpc-unknown-linux-$LIBC
;;
ppc64le:Linux:*:*)
GUESS=powerpc64le-unknown-linux-$LIBC
;;
ppcle:Linux:*:*)
GUESS=powerpcle-unknown-linux-$LIBC
;;
riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
s390:Linux:*:* | s390x:Linux:*:*)
GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
;;
sh64*:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
sh*:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
sparc:Linux:*:* | sparc64:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
tile*:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
vax:Linux:*:*)
GUESS=$UNAME_MACHINE-dec-linux-$LIBC
;;
x86_64:Linux:*:*)
set_cc_for_build
LIBCABI=$LIBC
if test "$CC_FOR_BUILD" != no_compiler_found; then
if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_X32 >/dev/null
then
LIBCABI=${LIBC}x32
fi
fi
GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI
;;
xtensa*:Linux:*:*)
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
# earlier versions are messed up and put the nodename in both
# sysname and nodename.
GUESS=i386-sequent-sysv4
;;
i*86:UNIX_SV:4.2MP:2.*)
# Unixware is an offshoot of SVR4, but it has its own version
# number series starting with 2...
# I am not positive that other SVR4 systems won't match this,
# I just have to hope. -- rms.
# Use sysv4.2uw... so that sysv4* matches it.
GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
;;
i*86:OS/2:*:*)
# If we were able to find `uname', then EMX Unix compatibility
# is probably installed.
GUESS=$UNAME_MACHINE-pc-os2-emx
;;
i*86:XTS-300:*:STOP)
GUESS=$UNAME_MACHINE-unknown-stop
;;
i*86:atheos:*:*)
GUESS=$UNAME_MACHINE-unknown-atheos
;;
i*86:syllable:*:*)
GUESS=$UNAME_MACHINE-pc-syllable
;;
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
GUESS=i386-unknown-lynxos$UNAME_RELEASE
;;
i*86:*DOS:*:*)
GUESS=$UNAME_MACHINE-pc-msdosdjgpp
;;
i*86:*:4.*:*)
UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
else
GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
fi
;;
i*86:*:5:[678]*)
# UnixWare 7.x, OpenUNIX and OpenServer 6.
case `/bin/uname -X | grep "^Machine"` in
*486*) UNAME_MACHINE=i486 ;;
*Pentium) UNAME_MACHINE=i586 ;;
*Pent*|*Celeron) UNAME_MACHINE=i686 ;;
esac
GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
;;
i*86:*:3.2:*)
if test -f /usr/options/cb.name; then
UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then
UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
&& UNAME_MACHINE=i586
(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
&& UNAME_MACHINE=i686
(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
&& UNAME_MACHINE=i686
GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
else
GUESS=$UNAME_MACHINE-pc-sysv32
fi
;;
pc:*:*:*)
# Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i586.
# Note: whatever this is, it MUST be the same as what config.sub
# prints for the "djgpp" host, or else GDB configure will decide that
# this is a cross-build.
GUESS=i586-pc-msdosdjgpp
;;
Intel:Mach:3*:*)
GUESS=i386-pc-mach3
;;
paragon:*:*:*)
GUESS=i860-intel-osf1
;;
i860:*:4.*:*) # i860-SVR4
if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
GUESS=i860-stardent-sysv$UNAME_RELEASE # Stardent Vistra i860-SVR4
else # Add other i860-SVR4 vendors below as they are discovered.
GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4
fi
;;
mini*:CTIX:SYS*5:*)
# "miniframe"
GUESS=m68010-convergent-sysv
;;
mc68k:UNIX:SYSTEM5:3.51m)
GUESS=m68k-convergent-sysv
;;
M680?0:D-NIX:5.3:*)
GUESS=m68k-diab-dnix
;;
M68*:*:R3V[5678]*:*)
test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
OS_REL=''
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4; exit; } ;;
NCR*:*:4.2:* | MPRAS*:*:4.2:*)
OS_REL='.3'
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
&& { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
GUESS=m68k-unknown-lynxos$UNAME_RELEASE
;;
mc68030:UNIX_System_V:4.*:*)
GUESS=m68k-atari-sysv4
;;
TSUNAMI:LynxOS:2.*:*)
GUESS=sparc-unknown-lynxos$UNAME_RELEASE
;;
rs6000:LynxOS:2.*:*)
GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
;;
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
;;
SM[BE]S:UNIX_SV:*:*)
GUESS=mips-dde-sysv$UNAME_RELEASE
;;
RM*:ReliantUNIX-*:*:*)
GUESS=mips-sni-sysv4
;;
RM*:SINIX-*:*:*)
GUESS=mips-sni-sysv4
;;
*:SINIX-*:*:*)
if uname -p 2>/dev/null >/dev/null ; then
UNAME_MACHINE=`(uname -p) 2>/dev/null`
GUESS=$UNAME_MACHINE-sni-sysv4
else
GUESS=ns32k-sni-sysv
fi
;;
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
# says
GUESS=i586-unisys-sysv4
;;
*:UNIX_System_V:4*:FTX*)
# From Gerald Hewes .
# How about differentiating between stratus architectures? -djm
GUESS=hppa1.1-stratus-sysv4
;;
*:*:*:FTX*)
# From seanf@swdc.stratus.com.
GUESS=i860-stratus-sysv4
;;
i*86:VOS:*:*)
# From Paul.Green@stratus.com.
GUESS=$UNAME_MACHINE-stratus-vos
;;
*:VOS:*:*)
# From Paul.Green@stratus.com.
GUESS=hppa1.1-stratus-vos
;;
mc68*:A/UX:*:*)
GUESS=m68k-apple-aux$UNAME_RELEASE
;;
news*:NEWS-OS:6*:*)
GUESS=mips-sony-newsos6
;;
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
if test -d /usr/nec; then
GUESS=mips-nec-sysv$UNAME_RELEASE
else
GUESS=mips-unknown-sysv$UNAME_RELEASE
fi
;;
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
GUESS=powerpc-be-beos
;;
BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
GUESS=powerpc-apple-beos
;;
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
GUESS=i586-pc-beos
;;
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
GUESS=i586-pc-haiku
;;
x86_64:Haiku:*:*)
GUESS=x86_64-unknown-haiku
;;
SX-4:SUPER-UX:*:*)
GUESS=sx4-nec-superux$UNAME_RELEASE
;;
SX-5:SUPER-UX:*:*)
GUESS=sx5-nec-superux$UNAME_RELEASE
;;
SX-6:SUPER-UX:*:*)
GUESS=sx6-nec-superux$UNAME_RELEASE
;;
SX-7:SUPER-UX:*:*)
GUESS=sx7-nec-superux$UNAME_RELEASE
;;
SX-8:SUPER-UX:*:*)
GUESS=sx8-nec-superux$UNAME_RELEASE
;;
SX-8R:SUPER-UX:*:*)
GUESS=sx8r-nec-superux$UNAME_RELEASE
;;
SX-ACE:SUPER-UX:*:*)
GUESS=sxace-nec-superux$UNAME_RELEASE
;;
Power*:Rhapsody:*:*)
GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
;;
*:Rhapsody:*:*)
GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
;;
arm64:Darwin:*:*)
GUESS=aarch64-apple-darwin$UNAME_RELEASE
;;
*:Darwin:*:*)
UNAME_PROCESSOR=`uname -p`
case $UNAME_PROCESSOR in
unknown) UNAME_PROCESSOR=powerpc ;;
esac
if command -v xcode-select > /dev/null 2> /dev/null && \
! xcode-select --print-path > /dev/null 2> /dev/null ; then
# Avoid executing cc if there is no toolchain installed as
# cc will be a stub that puts up a graphical alert
# prompting the user to install developer tools.
CC_FOR_BUILD=no_compiler_found
else
set_cc_for_build
fi
if test "$CC_FOR_BUILD" != no_compiler_found; then
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
case $UNAME_PROCESSOR in
i386) UNAME_PROCESSOR=x86_64 ;;
powerpc) UNAME_PROCESSOR=powerpc64 ;;
esac
fi
# On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_PPC >/dev/null
then
UNAME_PROCESSOR=powerpc
fi
elif test "$UNAME_PROCESSOR" = i386 ; then
# uname -m returns i386 or x86_64
UNAME_PROCESSOR=$UNAME_MACHINE
fi
GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
UNAME_PROCESSOR=`uname -p`
if test "$UNAME_PROCESSOR" = x86; then
UNAME_PROCESSOR=i386
UNAME_MACHINE=pc
fi
GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
;;
*:QNX:*:4*)
GUESS=i386-pc-qnx
;;
NEO-*:NONSTOP_KERNEL:*:*)
GUESS=neo-tandem-nsk$UNAME_RELEASE
;;
NSE-*:NONSTOP_KERNEL:*:*)
GUESS=nse-tandem-nsk$UNAME_RELEASE
;;
NSR-*:NONSTOP_KERNEL:*:*)
GUESS=nsr-tandem-nsk$UNAME_RELEASE
;;
NSV-*:NONSTOP_KERNEL:*:*)
GUESS=nsv-tandem-nsk$UNAME_RELEASE
;;
NSX-*:NONSTOP_KERNEL:*:*)
GUESS=nsx-tandem-nsk$UNAME_RELEASE
;;
*:NonStop-UX:*:*)
GUESS=mips-compaq-nonstopux
;;
BS2000:POSIX*:*:*)
GUESS=bs2000-siemens-sysv
;;
DS/*:UNIX_System_V:*:*)
GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
;;
*:Plan9:*:*)
# "uname -m" is not consistent, so use $cputype instead. 386
# is converted to i386 for consistency with other x86
# operating systems.
if test "${cputype-}" = 386; then
UNAME_MACHINE=i386
elif test "x${cputype-}" != x; then
UNAME_MACHINE=$cputype
fi
GUESS=$UNAME_MACHINE-unknown-plan9
;;
*:TOPS-10:*:*)
GUESS=pdp10-unknown-tops10
;;
*:TENEX:*:*)
GUESS=pdp10-unknown-tenex
;;
KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
GUESS=pdp10-dec-tops20
;;
XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
GUESS=pdp10-xkl-tops20
;;
*:TOPS-20:*:*)
GUESS=pdp10-unknown-tops20
;;
*:ITS:*:*)
GUESS=pdp10-unknown-its
;;
SEI:*:*:SEIUX)
GUESS=mips-sei-seiux$UNAME_RELEASE
;;
*:DragonFly:*:*)
DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
;;
*:*VMS:*:*)
UNAME_MACHINE=`(uname -p) 2>/dev/null`
case $UNAME_MACHINE in
A*) GUESS=alpha-dec-vms ;;
I*) GUESS=ia64-dec-vms ;;
V*) GUESS=vax-dec-vms ;;
esac ;;
*:XENIX:*:SysV)
GUESS=i386-pc-xenix
;;
i*86:skyos:*:*)
SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
;;
i*86:rdos:*:*)
GUESS=$UNAME_MACHINE-pc-rdos
;;
i*86:Fiwix:*:*)
GUESS=$UNAME_MACHINE-pc-fiwix
;;
*:AROS:*:*)
GUESS=$UNAME_MACHINE-unknown-aros
;;
x86_64:VMkernel:*:*)
GUESS=$UNAME_MACHINE-unknown-esx
;;
amd64:Isilon\ OneFS:*:*)
GUESS=x86_64-unknown-onefs
;;
*:Unleashed:*:*)
GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
;;
esac
# Do we have a guess based on uname results?
if test "x$GUESS" != x; then
echo "$GUESS"
exit
fi
# No uname command or uname output not recognized.
set_cc_for_build
cat > "$dummy.c" <
#include
#endif
#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
#include
#if defined(_SIZE_T_) || defined(SIGLOST)
#include
#endif
#endif
#endif
main ()
{
#if defined (sony)
#if defined (MIPSEB)
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
I don't know.... */
printf ("mips-sony-bsd\n"); exit (0);
#else
#include
printf ("m68k-sony-newsos%s\n",
#ifdef NEWSOS4
"4"
#else
""
#endif
); exit (0);
#endif
#endif
#if defined (NeXT)
#if !defined (__ARCHITECTURE__)
#define __ARCHITECTURE__ "m68k"
#endif
int version;
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
if (version < 4)
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
else
printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
exit (0);
#endif
#if defined (MULTIMAX) || defined (n16)
#if defined (UMAXV)
printf ("ns32k-encore-sysv\n"); exit (0);
#else
#if defined (CMU)
printf ("ns32k-encore-mach\n"); exit (0);
#else
printf ("ns32k-encore-bsd\n"); exit (0);
#endif
#endif
#endif
#if defined (__386BSD__)
printf ("i386-pc-bsd\n"); exit (0);
#endif
#if defined (sequent)
#if defined (i386)
printf ("i386-sequent-dynix\n"); exit (0);
#endif
#if defined (ns32000)
printf ("ns32k-sequent-dynix\n"); exit (0);
#endif
#endif
#if defined (_SEQUENT_)
struct utsname un;
uname(&un);
if (strncmp(un.version, "V2", 2) == 0) {
printf ("i386-sequent-ptx2\n"); exit (0);
}
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
printf ("i386-sequent-ptx1\n"); exit (0);
}
printf ("i386-sequent-ptx\n"); exit (0);
#endif
#if defined (vax)
#if !defined (ultrix)
#include
#if defined (BSD)
#if BSD == 43
printf ("vax-dec-bsd4.3\n"); exit (0);
#else
#if BSD == 199006
printf ("vax-dec-bsd4.3reno\n"); exit (0);
#else
printf ("vax-dec-bsd\n"); exit (0);
#endif
#endif
#else
printf ("vax-dec-bsd\n"); exit (0);
#endif
#else
#if defined(_SIZE_T_) || defined(SIGLOST)
struct utsname un;
uname (&un);
printf ("vax-dec-ultrix%s\n", un.release); exit (0);
#else
printf ("vax-dec-ultrix\n"); exit (0);
#endif
#endif
#endif
#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
#if defined(_SIZE_T_) || defined(SIGLOST)
struct utsname *un;
uname (&un);
printf ("mips-dec-ultrix%s\n", un.release); exit (0);
#else
printf ("mips-dec-ultrix\n"); exit (0);
#endif
#endif
#endif
#if defined (alliant) && defined (i860)
printf ("i860-alliant-bsd\n"); exit (0);
#endif
exit (1);
}
EOF
$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
{ echo "$SYSTEM_NAME"; exit; }
# Apollos put the system type in the environment.
test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
echo "$0: unable to guess system type" >&2
case $UNAME_MACHINE:$UNAME_SYSTEM in
mips:Linux | mips64:Linux)
# If we got here on MIPS GNU/Linux, output extra information.
cat >&2 <&2 <&2 </dev/null || echo unknown`
uname -r = `(uname -r) 2>/dev/null || echo unknown`
uname -s = `(uname -s) 2>/dev/null || echo unknown`
uname -v = `(uname -v) 2>/dev/null || echo unknown`
/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
hostinfo = `(hostinfo) 2>/dev/null`
/bin/universe = `(/bin/universe) 2>/dev/null`
/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
/bin/arch = `(/bin/arch) 2>/dev/null`
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
UNAME_MACHINE = "$UNAME_MACHINE"
UNAME_RELEASE = "$UNAME_RELEASE"
UNAME_SYSTEM = "$UNAME_SYSTEM"
UNAME_VERSION = "$UNAME_VERSION"
EOF
fi
exit 1
# Local variables:
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
# End:
form-5.0.1/build-aux/compile 0000755 0001751 0001751 00000016350 15217035732 011425 #! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
# Written by Tom Tromey .
#
# 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, see .
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to or send patches to
# .
nl='
'
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent tools from complaining about whitespace usage.
IFS=" "" $nl"
file_conv=
# func_file_conv build_file lazy
# Convert a $build file to $host form and store it in $file
# Currently only supports Windows hosts. If the determined conversion
# type is listed in (the comma separated) LAZY, no conversion will
# take place.
func_file_conv ()
{
file=$1
case $file in
/ | /[!/]*) # absolute file, and not a UNC file
if test -z "$file_conv"; then
# lazily determine how to convert abs files
case `uname -s` in
MINGW*)
file_conv=mingw
;;
CYGWIN* | MSYS*)
file_conv=cygwin
;;
*)
file_conv=wine
;;
esac
fi
case $file_conv/,$2, in
*,$file_conv,*)
;;
mingw/*)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin/* | msys/*)
file=`cygpath -m "$file" || echo "$file"`
;;
wine/*)
file=`winepath -w "$file" || echo "$file"`
;;
esac
;;
esac
}
# func_cl_dashL linkdir
# Make cl look for libraries in LINKDIR
func_cl_dashL ()
{
func_file_conv "$1"
if test -z "$lib_path"; then
lib_path=$file
else
lib_path="$lib_path;$file"
fi
linker_opts="$linker_opts -LIBPATH:$file"
}
# func_cl_dashl library
# Do a library search-path lookup for cl
func_cl_dashl ()
{
lib=$1
found=no
save_IFS=$IFS
IFS=';'
for dir in $lib_path $LIB
do
IFS=$save_IFS
if $shared && test -f "$dir/$lib.dll.lib"; then
found=yes
lib=$dir/$lib.dll.lib
break
fi
if test -f "$dir/$lib.lib"; then
found=yes
lib=$dir/$lib.lib
break
fi
if test -f "$dir/lib$lib.a"; then
found=yes
lib=$dir/lib$lib.a
break
fi
done
IFS=$save_IFS
if test "$found" != yes; then
lib=$lib.lib
fi
}
# func_cl_wrapper cl arg...
# Adjust compile command to suit cl
func_cl_wrapper ()
{
# Assume a capable shell
lib_path=
shared=:
linker_opts=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
eat=1
case $2 in
*.o | *.[oO][bB][jJ])
func_file_conv "$2"
set x "$@" -Fo"$file"
shift
;;
*)
func_file_conv "$2"
set x "$@" -Fe"$file"
shift
;;
esac
;;
-I)
eat=1
func_file_conv "$2" mingw
set x "$@" -I"$file"
shift
;;
-I*)
func_file_conv "${1#-I}" mingw
set x "$@" -I"$file"
shift
;;
-l)
eat=1
func_cl_dashl "$2"
set x "$@" "$lib"
shift
;;
-l*)
func_cl_dashl "${1#-l}"
set x "$@" "$lib"
shift
;;
-L)
eat=1
func_cl_dashL "$2"
;;
-L*)
func_cl_dashL "${1#-L}"
;;
-static)
shared=false
;;
-Wl,*)
arg=${1#-Wl,}
save_ifs="$IFS"; IFS=','
for flag in $arg; do
IFS="$save_ifs"
linker_opts="$linker_opts $flag"
done
IFS="$save_ifs"
;;
-Xlinker)
eat=1
linker_opts="$linker_opts $2"
;;
-*)
set x "$@" "$1"
shift
;;
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
func_file_conv "$1"
set x "$@" -Tp"$file"
shift
;;
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
func_file_conv "$1" mingw
set x "$@" "$file"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -n "$linker_opts"; then
linker_opts="-link$linker_opts"
fi
exec "$@" $linker_opts
exit 1
}
eat=
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand '-c -o'.
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file 'INSTALL'.
Report bugs to .
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
func_cl_wrapper "$@" # Doesn't return...
;;
esac
ofile=
cfile=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
# So we strip '-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no '-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# '.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
# Create the lock directory.
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
form-5.0.1/build-aux/config.sub 0000755 0001751 0001751 00000105116 15217035732 012031 #! /bin/sh
# Configuration validation subroutine script.
# Copyright 1992-2022 Free Software Foundation, Inc.
# shellcheck disable=SC2006,SC2268 # see below for rationale
timestamp='2022-01-03'
# This file 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 3 of the License, 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, see .
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that
# program. This Exception is an additional permission under section 7
# of the GNU General Public License, version 3 ("GPLv3").
# Please send patches to .
#
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
# If it is invalid, we print an error message on stderr and exit with code 1.
# Otherwise, we print the canonical config type on stdout and succeed.
# You can get the latest version of this script from:
# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
# that are meaningful with *any* GNU software.
# Each package is responsible for reporting which valid configurations
# it does not support. The user should be able to distinguish
# a failure to support a valid configuration from a meaningless
# configuration.
# The goal of this file is to map all the various variations of a given
# machine specification into a single specification in the form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
# or in some cases, the newer four-part form:
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# It is wrong to echo any other type of specification.
# The "shellcheck disable" line above the timestamp inhibits complaints
# about features and limitations of the classic Bourne shell that were
# superseded or lifted in POSIX. However, this script identifies a wide
# variety of pre-POSIX systems that do not have POSIX shells at all, and
# even some reasonably current systems (Solaris 10 as case-in-point) still
# have a pre-POSIX /bin/sh.
me=`echo "$0" | sed -e 's,.*/,,'`
usage="\
Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
Canonicalize a configuration name.
Options:
-h, --help print this help, then exit
-t, --time-stamp print date of last modification, then exit
-v, --version print version number, then exit
Report bugs and patches to ."
version="\
GNU config.sub ($timestamp)
Copyright 1992-2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
help="
Try \`$me --help' for more information."
# Parse command line
while test $# -gt 0 ; do
case $1 in
--time-stamp | --time* | -t )
echo "$timestamp" ; exit ;;
--version | -v )
echo "$version" ; exit ;;
--help | --h* | -h )
echo "$usage"; exit ;;
-- ) # Stop option processing
shift; break ;;
- ) # Use stdin as input.
break ;;
-* )
echo "$me: invalid option $1$help" >&2
exit 1 ;;
*local*)
# First pass through any local machine types.
echo "$1"
exit ;;
* )
break ;;
esac
done
case $# in
0) echo "$me: missing argument$help" >&2
exit 1;;
1) ;;
*) echo "$me: too many arguments$help" >&2
exit 1;;
esac
# Split fields of configuration type
# shellcheck disable=SC2162
saved_IFS=$IFS
IFS="-" read field1 field2 field3 field4 <&2
exit 1
;;
*-*-*-*)
basic_machine=$field1-$field2
basic_os=$field3-$field4
;;
*-*-*)
# Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two
# parts
maybe_os=$field2-$field3
case $maybe_os in
nto-qnx* | linux-* | uclinux-uclibc* \
| uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \
| netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \
| storm-chaos* | os2-emx* | rtmk-nova*)
basic_machine=$field1
basic_os=$maybe_os
;;
android-linux)
basic_machine=$field1-unknown
basic_os=linux-android
;;
*)
basic_machine=$field1-$field2
basic_os=$field3
;;
esac
;;
*-*)
# A lone config we happen to match not fitting any pattern
case $field1-$field2 in
decstation-3100)
basic_machine=mips-dec
basic_os=
;;
*-*)
# Second component is usually, but not always the OS
case $field2 in
# Prevent following clause from handling this valid os
sun*os*)
basic_machine=$field1
basic_os=$field2
;;
zephyr*)
basic_machine=$field1-unknown
basic_os=$field2
;;
# Manufacturers
dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \
| att* | 7300* | 3300* | delta* | motorola* | sun[234]* \
| unicom* | ibm* | next | hp | isi* | apollo | altos* \
| convergent* | ncr* | news | 32* | 3600* | 3100* \
| hitachi* | c[123]* | convex* | sun | crds | omron* | dg \
| ultra | tti* | harris | dolphin | highlevel | gould \
| cbm | ns | masscomp | apple | axis | knuth | cray \
| microblaze* | sim | cisco \
| oki | wec | wrs | winbond)
basic_machine=$field1-$field2
basic_os=
;;
*)
basic_machine=$field1
basic_os=$field2
;;
esac
;;
esac
;;
*)
# Convert single-component short-hands not valid as part of
# multi-component configurations.
case $field1 in
386bsd)
basic_machine=i386-pc
basic_os=bsd
;;
a29khif)
basic_machine=a29k-amd
basic_os=udi
;;
adobe68k)
basic_machine=m68010-adobe
basic_os=scout
;;
alliant)
basic_machine=fx80-alliant
basic_os=
;;
altos | altos3068)
basic_machine=m68k-altos
basic_os=
;;
am29k)
basic_machine=a29k-none
basic_os=bsd
;;
amdahl)
basic_machine=580-amdahl
basic_os=sysv
;;
amiga)
basic_machine=m68k-unknown
basic_os=
;;
amigaos | amigados)
basic_machine=m68k-unknown
basic_os=amigaos
;;
amigaunix | amix)
basic_machine=m68k-unknown
basic_os=sysv4
;;
apollo68)
basic_machine=m68k-apollo
basic_os=sysv
;;
apollo68bsd)
basic_machine=m68k-apollo
basic_os=bsd
;;
aros)
basic_machine=i386-pc
basic_os=aros
;;
aux)
basic_machine=m68k-apple
basic_os=aux
;;
balance)
basic_machine=ns32k-sequent
basic_os=dynix
;;
blackfin)
basic_machine=bfin-unknown
basic_os=linux
;;
cegcc)
basic_machine=arm-unknown
basic_os=cegcc
;;
convex-c1)
basic_machine=c1-convex
basic_os=bsd
;;
convex-c2)
basic_machine=c2-convex
basic_os=bsd
;;
convex-c32)
basic_machine=c32-convex
basic_os=bsd
;;
convex-c34)
basic_machine=c34-convex
basic_os=bsd
;;
convex-c38)
basic_machine=c38-convex
basic_os=bsd
;;
cray)
basic_machine=j90-cray
basic_os=unicos
;;
crds | unos)
basic_machine=m68k-crds
basic_os=
;;
da30)
basic_machine=m68k-da30
basic_os=
;;
decstation | pmax | pmin | dec3100 | decstatn)
basic_machine=mips-dec
basic_os=
;;
delta88)
basic_machine=m88k-motorola
basic_os=sysv3
;;
dicos)
basic_machine=i686-pc
basic_os=dicos
;;
djgpp)
basic_machine=i586-pc
basic_os=msdosdjgpp
;;
ebmon29k)
basic_machine=a29k-amd
basic_os=ebmon
;;
es1800 | OSE68k | ose68k | ose | OSE)
basic_machine=m68k-ericsson
basic_os=ose
;;
gmicro)
basic_machine=tron-gmicro
basic_os=sysv
;;
go32)
basic_machine=i386-pc
basic_os=go32
;;
h8300hms)
basic_machine=h8300-hitachi
basic_os=hms
;;
h8300xray)
basic_machine=h8300-hitachi
basic_os=xray
;;
h8500hms)
basic_machine=h8500-hitachi
basic_os=hms
;;
harris)
basic_machine=m88k-harris
basic_os=sysv3
;;
hp300 | hp300hpux)
basic_machine=m68k-hp
basic_os=hpux
;;
hp300bsd)
basic_machine=m68k-hp
basic_os=bsd
;;
hppaosf)
basic_machine=hppa1.1-hp
basic_os=osf
;;
hppro)
basic_machine=hppa1.1-hp
basic_os=proelf
;;
i386mach)
basic_machine=i386-mach
basic_os=mach
;;
isi68 | isi)
basic_machine=m68k-isi
basic_os=sysv
;;
m68knommu)
basic_machine=m68k-unknown
basic_os=linux
;;
magnum | m3230)
basic_machine=mips-mips
basic_os=sysv
;;
merlin)
basic_machine=ns32k-utek
basic_os=sysv
;;
mingw64)
basic_machine=x86_64-pc
basic_os=mingw64
;;
mingw32)
basic_machine=i686-pc
basic_os=mingw32
;;
mingw32ce)
basic_machine=arm-unknown
basic_os=mingw32ce
;;
monitor)
basic_machine=m68k-rom68k
basic_os=coff
;;
morphos)
basic_machine=powerpc-unknown
basic_os=morphos
;;
moxiebox)
basic_machine=moxie-unknown
basic_os=moxiebox
;;
msdos)
basic_machine=i386-pc
basic_os=msdos
;;
msys)
basic_machine=i686-pc
basic_os=msys
;;
mvs)
basic_machine=i370-ibm
basic_os=mvs
;;
nacl)
basic_machine=le32-unknown
basic_os=nacl
;;
ncr3000)
basic_machine=i486-ncr
basic_os=sysv4
;;
netbsd386)
basic_machine=i386-pc
basic_os=netbsd
;;
netwinder)
basic_machine=armv4l-rebel
basic_os=linux
;;
news | news700 | news800 | news900)
basic_machine=m68k-sony
basic_os=newsos
;;
news1000)
basic_machine=m68030-sony
basic_os=newsos
;;
necv70)
basic_machine=v70-nec
basic_os=sysv
;;
nh3000)
basic_machine=m68k-harris
basic_os=cxux
;;
nh[45]000)
basic_machine=m88k-harris
basic_os=cxux
;;
nindy960)
basic_machine=i960-intel
basic_os=nindy
;;
mon960)
basic_machine=i960-intel
basic_os=mon960
;;
nonstopux)
basic_machine=mips-compaq
basic_os=nonstopux
;;
os400)
basic_machine=powerpc-ibm
basic_os=os400
;;
OSE68000 | ose68000)
basic_machine=m68000-ericsson
basic_os=ose
;;
os68k)
basic_machine=m68k-none
basic_os=os68k
;;
paragon)
basic_machine=i860-intel
basic_os=osf
;;
parisc)
basic_machine=hppa-unknown
basic_os=linux
;;
psp)
basic_machine=mipsallegrexel-sony
basic_os=psp
;;
pw32)
basic_machine=i586-unknown
basic_os=pw32
;;
rdos | rdos64)
basic_machine=x86_64-pc
basic_os=rdos
;;
rdos32)
basic_machine=i386-pc
basic_os=rdos
;;
rom68k)
basic_machine=m68k-rom68k
basic_os=coff
;;
sa29200)
basic_machine=a29k-amd
basic_os=udi
;;
sei)
basic_machine=mips-sei
basic_os=seiux
;;
sequent)
basic_machine=i386-sequent
basic_os=
;;
sps7)
basic_machine=m68k-bull
basic_os=sysv2
;;
st2000)
basic_machine=m68k-tandem
basic_os=
;;
stratus)
basic_machine=i860-stratus
basic_os=sysv4
;;
sun2)
basic_machine=m68000-sun
basic_os=
;;
sun2os3)
basic_machine=m68000-sun
basic_os=sunos3
;;
sun2os4)
basic_machine=m68000-sun
basic_os=sunos4
;;
sun3)
basic_machine=m68k-sun
basic_os=
;;
sun3os3)
basic_machine=m68k-sun
basic_os=sunos3
;;
sun3os4)
basic_machine=m68k-sun
basic_os=sunos4
;;
sun4)
basic_machine=sparc-sun
basic_os=
;;
sun4os3)
basic_machine=sparc-sun
basic_os=sunos3
;;
sun4os4)
basic_machine=sparc-sun
basic_os=sunos4
;;
sun4sol2)
basic_machine=sparc-sun
basic_os=solaris2
;;
sun386 | sun386i | roadrunner)
basic_machine=i386-sun
basic_os=
;;
sv1)
basic_machine=sv1-cray
basic_os=unicos
;;
symmetry)
basic_machine=i386-sequent
basic_os=dynix
;;
t3e)
basic_machine=alphaev5-cray
basic_os=unicos
;;
t90)
basic_machine=t90-cray
basic_os=unicos
;;
toad1)
basic_machine=pdp10-xkl
basic_os=tops20
;;
tpf)
basic_machine=s390x-ibm
basic_os=tpf
;;
udi29k)
basic_machine=a29k-amd
basic_os=udi
;;
ultra3)
basic_machine=a29k-nyu
basic_os=sym1
;;
v810 | necv810)
basic_machine=v810-nec
basic_os=none
;;
vaxv)
basic_machine=vax-dec
basic_os=sysv
;;
vms)
basic_machine=vax-dec
basic_os=vms
;;
vsta)
basic_machine=i386-pc
basic_os=vsta
;;
vxworks960)
basic_machine=i960-wrs
basic_os=vxworks
;;
vxworks68)
basic_machine=m68k-wrs
basic_os=vxworks
;;
vxworks29k)
basic_machine=a29k-wrs
basic_os=vxworks
;;
xbox)
basic_machine=i686-pc
basic_os=mingw32
;;
ymp)
basic_machine=ymp-cray
basic_os=unicos
;;
*)
basic_machine=$1
basic_os=
;;
esac
;;
esac
# Decode 1-component or ad-hoc basic machines
case $basic_machine in
# Here we handle the default manufacturer of certain CPU types. It is in
# some cases the only manufacturer, in others, it is the most popular.
w89k)
cpu=hppa1.1
vendor=winbond
;;
op50n)
cpu=hppa1.1
vendor=oki
;;
op60c)
cpu=hppa1.1
vendor=oki
;;
ibm*)
cpu=i370
vendor=ibm
;;
orion105)
cpu=clipper
vendor=highlevel
;;
mac | mpw | mac-mpw)
cpu=m68k
vendor=apple
;;
pmac | pmac-mpw)
cpu=powerpc
vendor=apple
;;
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
cpu=m68000
vendor=att
;;
3b*)
cpu=we32k
vendor=att
;;
bluegene*)
cpu=powerpc
vendor=ibm
basic_os=cnk
;;
decsystem10* | dec10*)
cpu=pdp10
vendor=dec
basic_os=tops10
;;
decsystem20* | dec20*)
cpu=pdp10
vendor=dec
basic_os=tops20
;;
delta | 3300 | motorola-3300 | motorola-delta \
| 3300-motorola | delta-motorola)
cpu=m68k
vendor=motorola
;;
dpx2*)
cpu=m68k
vendor=bull
basic_os=sysv3
;;
encore | umax | mmax)
cpu=ns32k
vendor=encore
;;
elxsi)
cpu=elxsi
vendor=elxsi
basic_os=${basic_os:-bsd}
;;
fx2800)
cpu=i860
vendor=alliant
;;
genix)
cpu=ns32k
vendor=ns
;;
h3050r* | hiux*)
cpu=hppa1.1
vendor=hitachi
basic_os=hiuxwe2
;;
hp3k9[0-9][0-9] | hp9[0-9][0-9])
cpu=hppa1.0
vendor=hp
;;
hp9k2[0-9][0-9] | hp9k31[0-9])
cpu=m68000
vendor=hp
;;
hp9k3[2-9][0-9])
cpu=m68k
vendor=hp
;;
hp9k6[0-9][0-9] | hp6[0-9][0-9])
cpu=hppa1.0
vendor=hp
;;
hp9k7[0-79][0-9] | hp7[0-79][0-9])
cpu=hppa1.1
vendor=hp
;;
hp9k78[0-9] | hp78[0-9])
# FIXME: really hppa2.0-hp
cpu=hppa1.1
vendor=hp
;;
hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
# FIXME: really hppa2.0-hp
cpu=hppa1.1
vendor=hp
;;
hp9k8[0-9][13679] | hp8[0-9][13679])
cpu=hppa1.1
vendor=hp
;;
hp9k8[0-9][0-9] | hp8[0-9][0-9])
cpu=hppa1.0
vendor=hp
;;
i*86v32)
cpu=`echo "$1" | sed -e 's/86.*/86/'`
vendor=pc
basic_os=sysv32
;;
i*86v4*)
cpu=`echo "$1" | sed -e 's/86.*/86/'`
vendor=pc
basic_os=sysv4
;;
i*86v)
cpu=`echo "$1" | sed -e 's/86.*/86/'`
vendor=pc
basic_os=sysv
;;
i*86sol2)
cpu=`echo "$1" | sed -e 's/86.*/86/'`
vendor=pc
basic_os=solaris2
;;
j90 | j90-cray)
cpu=j90
vendor=cray
basic_os=${basic_os:-unicos}
;;
iris | iris4d)
cpu=mips
vendor=sgi
case $basic_os in
irix*)
;;
*)
basic_os=irix4
;;
esac
;;
miniframe)
cpu=m68000
vendor=convergent
;;
*mint | mint[0-9]* | *MiNT | *MiNT[0-9]*)
cpu=m68k
vendor=atari
basic_os=mint
;;
news-3600 | risc-news)
cpu=mips
vendor=sony
basic_os=newsos
;;
next | m*-next)
cpu=m68k
vendor=next
case $basic_os in
openstep*)
;;
nextstep*)
;;
ns2*)
basic_os=nextstep2
;;
*)
basic_os=nextstep3
;;
esac
;;
np1)
cpu=np1
vendor=gould
;;
op50n-* | op60c-*)
cpu=hppa1.1
vendor=oki
basic_os=proelf
;;
pa-hitachi)
cpu=hppa1.1
vendor=hitachi
basic_os=hiuxwe2
;;
pbd)
cpu=sparc
vendor=tti
;;
pbb)
cpu=m68k
vendor=tti
;;
pc532)
cpu=ns32k
vendor=pc532
;;
pn)
cpu=pn
vendor=gould
;;
power)
cpu=power
vendor=ibm
;;
ps2)
cpu=i386
vendor=ibm
;;
rm[46]00)
cpu=mips
vendor=siemens
;;
rtpc | rtpc-*)
cpu=romp
vendor=ibm
;;
sde)
cpu=mipsisa32
vendor=sde
basic_os=${basic_os:-elf}
;;
simso-wrs)
cpu=sparclite
vendor=wrs
basic_os=vxworks
;;
tower | tower-32)
cpu=m68k
vendor=ncr
;;
vpp*|vx|vx-*)
cpu=f301
vendor=fujitsu
;;
w65)
cpu=w65
vendor=wdc
;;
w89k-*)
cpu=hppa1.1
vendor=winbond
basic_os=proelf
;;
none)
cpu=none
vendor=none
;;
leon|leon[3-9])
cpu=sparc
vendor=$basic_machine
;;
leon-*|leon[3-9]-*)
cpu=sparc
vendor=`echo "$basic_machine" | sed 's/-.*//'`
;;
*-*)
# shellcheck disable=SC2162
saved_IFS=$IFS
IFS="-" read cpu vendor <&2
exit 1
;;
esac
;;
esac
# Here we canonicalize certain aliases for manufacturers.
case $vendor in
digital*)
vendor=dec
;;
commodore*)
vendor=cbm
;;
*)
;;
esac
# Decode manufacturer-specific aliases for certain operating systems.
if test x$basic_os != x
then
# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just
# set os.
case $basic_os in
gnu/linux*)
kernel=linux
os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'`
;;
os2-emx)
kernel=os2
os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'`
;;
nto-qnx*)
kernel=nto
os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'`
;;
*-*)
# shellcheck disable=SC2162
saved_IFS=$IFS
IFS="-" read kernel os <&2
exit 1
;;
esac
# As a final step for OS-related things, validate the OS-kernel combination
# (given a valid OS), if there is a kernel.
case $kernel-$os in
linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \
| linux-musl* | linux-relibc* | linux-uclibc* )
;;
uclinux-uclibc* )
;;
-dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* )
# These are just libc implementations, not actual OSes, and thus
# require a kernel.
echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2
exit 1
;;
kfreebsd*-gnu* | kopensolaris*-gnu*)
;;
vxworks-simlinux | vxworks-simwindows | vxworks-spe)
;;
nto-qnx*)
;;
os2-emx)
;;
*-eabi* | *-gnueabi*)
;;
-*)
# Blank kernel with real OS is always fine.
;;
*-*)
echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2
exit 1
;;
esac
# Here we handle the case where we know the os, and the CPU type, but not the
# manufacturer. We pick the logical manufacturer.
case $vendor in
unknown)
case $cpu-$os in
*-riscix*)
vendor=acorn
;;
*-sunos*)
vendor=sun
;;
*-cnk* | *-aix*)
vendor=ibm
;;
*-beos*)
vendor=be
;;
*-hpux*)
vendor=hp
;;
*-mpeix*)
vendor=hp
;;
*-hiux*)
vendor=hitachi
;;
*-unos*)
vendor=crds
;;
*-dgux*)
vendor=dg
;;
*-luna*)
vendor=omron
;;
*-genix*)
vendor=ns
;;
*-clix*)
vendor=intergraph
;;
*-mvs* | *-opened*)
vendor=ibm
;;
*-os400*)
vendor=ibm
;;
s390-* | s390x-*)
vendor=ibm
;;
*-ptx*)
vendor=sequent
;;
*-tpf*)
vendor=ibm
;;
*-vxsim* | *-vxworks* | *-windiss*)
vendor=wrs
;;
*-aux*)
vendor=apple
;;
*-hms*)
vendor=hitachi
;;
*-mpw* | *-macos*)
vendor=apple
;;
*-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*)
vendor=atari
;;
*-vos*)
vendor=stratus
;;
esac
;;
esac
echo "$cpu-$vendor-${kernel:+$kernel-}$os"
exit
# Local variables:
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
# End:
form-5.0.1/build-aux/missing 0000755 0001751 0001751 00000015336 15217035732 011451 #! /bin/sh
# Common wrapper for a few potentially missing GNU programs.
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
# Originally written by Fran,cois Pinard , 1996.
# 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, see .
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try '$0 --help' for more information"
exit 1
fi
case $1 in
--is-lightweight)
# Used by our autoconf macros to check whether the available missing
# script is modern enough.
exit 0
;;
--run)
# Back-compat with the calling convention used by older automake.
shift
;;
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
to PROGRAM being missing or too old.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
Supported PROGRAM values:
aclocal autoconf autoheader autom4te automake makeinfo
bison yacc flex lex help2man
Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
'g' are ignored when checking the name.
Send bug reports to ."
exit $?
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)"
exit $?
;;
-*)
echo 1>&2 "$0: unknown '$1' option"
echo 1>&2 "Try '$0 --help' for more information"
exit 1
;;
esac
# Run the given program, remember its exit status.
"$@"; st=$?
# If it succeeded, we are done.
test $st -eq 0 && exit 0
# Also exit now if we it failed (or wasn't found), and '--version' was
# passed; such an option is passed most likely to detect whether the
# program is present and works.
case $2 in --version|--help) exit $st;; esac
# Exit code 63 means version mismatch. This often happens when the user
# tries to use an ancient version of a tool on a file that requires a
# minimum version.
if test $st -eq 63; then
msg="probably too old"
elif test $st -eq 127; then
# Program was missing.
msg="missing on your system"
else
# Program was found and executed, but failed. Give up.
exit $st
fi
perl_URL=https://www.perl.org/
flex_URL=https://github.com/westes/flex
gnu_software_URL=https://www.gnu.org/software
program_details ()
{
case $1 in
aclocal|automake)
echo "The '$1' program is part of the GNU Automake package:"
echo "<$gnu_software_URL/automake>"
echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
echo "<$gnu_software_URL/autoconf>"
echo "<$gnu_software_URL/m4/>"
echo "<$perl_URL>"
;;
autoconf|autom4te|autoheader)
echo "The '$1' program is part of the GNU Autoconf package:"
echo "<$gnu_software_URL/autoconf/>"
echo "It also requires GNU m4 and Perl in order to run:"
echo "<$gnu_software_URL/m4/>"
echo "<$perl_URL>"
;;
esac
}
give_advice ()
{
# Normalize program name to check for.
normalized_program=`echo "$1" | sed '
s/^gnu-//; t
s/^gnu//; t
s/^g//; t'`
printf '%s\n' "'$1' is $msg."
configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
case $normalized_program in
autoconf*)
echo "You should only need it if you modified 'configure.ac',"
echo "or m4 files included by it."
program_details 'autoconf'
;;
autoheader*)
echo "You should only need it if you modified 'acconfig.h' or"
echo "$configure_deps."
program_details 'autoheader'
;;
automake*)
echo "You should only need it if you modified 'Makefile.am' or"
echo "$configure_deps."
program_details 'automake'
;;
aclocal*)
echo "You should only need it if you modified 'acinclude.m4' or"
echo "$configure_deps."
program_details 'aclocal'
;;
autom4te*)
echo "You might have modified some maintainer files that require"
echo "the 'autom4te' program to be rebuilt."
program_details 'autom4te'
;;
bison*|yacc*)
echo "You should only need it if you modified a '.y' file."
echo "You may want to install the GNU Bison package:"
echo "<$gnu_software_URL/bison/>"
;;
lex*|flex*)
echo "You should only need it if you modified a '.l' file."
echo "You may want to install the Fast Lexical Analyzer package:"
echo "<$flex_URL>"
;;
help2man*)
echo "You should only need it if you modified a dependency" \
"of a man page."
echo "You may want to install the GNU Help2man package:"
echo "<$gnu_software_URL/help2man/>"
;;
makeinfo*)
echo "You should only need it if you modified a '.texi' file, or"
echo "any other file indirectly affecting the aspect of the manual."
echo "You might want to install the Texinfo package:"
echo "<$gnu_software_URL/texinfo/>"
echo "The spurious makeinfo call might also be the consequence of"
echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
echo "want to install GNU make:"
echo "<$gnu_software_URL/make/>"
;;
*)
echo "You might have modified some files without having the proper"
echo "tools for further handling them. Check the 'README' file, it"
echo "often tells you about the needed prerequisites for installing"
echo "this package. You may also peek at any GNU archive site, in"
echo "case some other package contains this missing '$1' program."
;;
esac
}
give_advice "$1" | sed -e '1s/^/WARNING: /' \
-e '2,$s/^/ /' >&2
# Propagate the correct exit status (expected to be 127 for a program
# not found, 63 for a program that failed due to version mismatch).
exit $st
# Local variables:
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
form-5.0.1/check/ 0000755 0001751 0001751 00000000000 15217035744 007310 5 form-5.0.1/check/examples.frm 0000644 0001751 0001751 00000203734 15217035721 011560 * Tests using the examples in the manual
*
* Some assertions here check for trivial, secondary things like runtime
* information or layout. Usually, this should be avoided. But since we are here
* not only testing FORM but also the code examples in the manual, this extra
* strictness makes sometimes sense.
* In the manual the example code has been given a comment that says it is used
* here. Therefore, if you change something here, consider applying the
* appropriate changes also in the manual.
#ifndef `TEST'
#message Use -D TEST=XXX
#terminate
#else
#include `NAME_' # `TEST'
#endif
.end
*--#[ Var_Symbols_1 :
s x(:10),y;
L F=y^7;
id y=x+x^2;
print;
.end
assert succeeded?
assert bytesize("F") == 27 * wordsize
assert result("F") =~ expr("x^7 + 7*x^8 + 21*x^9 + 35*x^10")
*--#] Var_Symbols_1 :
*--#[ Var_Sets_1 :
Symbols a1,a2,a3,b1,b2,b3,x,n;
CFunctions g1,g2,g3,g;
Local expr =
g(a1)+g(a2)+g(a3)+g(x);
id,g(x?{a1,a2,a3}[n]) = {g1,g2,g3}[n]({b1,b2,b3}[n]);
print;
.end
assert succeeded?
assert result("expr") =~ expr("g1(b1) + g2(b2) + g3(b3) + g(x)")
*--#] Var_Sets_1 :
*--#[ Var_Dummy_indices_1 :
i mu,nu;
f f1,f2;
L F=f1(mu)*f2(mu)+f1(nu)*f2(nu);
sum mu;
sum nu;
print;
.end
assert succeeded?
assert result("F") =~ expr("2*f1(N1_?)*f2(N1_?)")
*--#] Var_Dummy_indices_1 :
*--#[ Var_Dummy_indices_2 :
Index mu,nu;
CFunctions f,g;
Vectors p,q;
Local F = (f(mu)*g(mu))^2;
sum mu;
id f(nu?) = p(nu);
id g(nu?) = q(nu);
print;
.end
assert succeeded?
assert result("F") =~ expr("p.p*q.q")
*--#] Var_Dummy_indices_2 :
*--#[ Var_Dummy_indices_3 :
Index mu,nu;
Symbol x;
CFunctions f,g;
Vectors p,q;
Local F = x^2;
repeat;
id,once,x = f(mu)*g(mu);
sum mu;
endrepeat;
id f(nu?) = p(nu);
id g(nu?) = q(nu);
print;
.end
assert succeeded?
assert result("F") =~ expr("p.q^2")
*--#] Var_Dummy_indices_3 :
*--#[ Var_Dummy_indices_4 :
Indices mu,nu;
CFunctions f;
L F = f(mu,nu)*f(nu,mu);
sum mu, nu;
Print;
.sort
Indices rho,si;
Vectors p1,p2,p3,v;
Tensor g;
Local G = e_(mu,nu,rho,si)*g(mu,nu,p1,v)*g(rho,si,p2,v);
sum mu,nu,rho,si;
Multiply F^3;
id v = e_(p1,p2,p3,?);
print;
.end
assert succeeded?
assert result("G") =~ expr("f(N1_?,N2_?)*f(N2_?,N1_?)*f(N3_?,N4_?)*f(N4_?,N3_?)*f(N5_?,N6_?)*f(N6_?,N5_?)
*g(N7_?,N8_?,p1,N9_?)*g(N10_?,N11_?,p2,N12_?)*e_(p1,p2,p3,N9_?)*e_(p1,p2,p3,N12_?)*e_(N7_?,N8_?,N10_?,N11_?)")
*--#] Var_Dummy_indices_4 :
*--#[ Var_Extra_Symbols_1 :
* NOTE: removed "Generated on `DATE_'"
Vector p,q,p1,p2;
CFunction f;
CFunction Dot,InvDot;
Symbol x,x1,x2;
Set pdot:p,q;
Off Statistics;
Local F = x+x^2+1/x+1/x^2+f(x1)+f(x2)*p.q*x+f(x2)/p.q^2;
id p1?pdot.p2?pdot = Dot(p1,p2);
id 1/p1?pdot.p2?pdot = InvDot(p1,p2);
Print;
.sort
ExtraSymbols,array,Y;
Format DOUBLEFORTRAN;
ToPolynomial;
Print;
.sort
#write " SUBROUTINE sub(Y)"
#write "*"
#write "* Compute the extra symbols."
#write "*"
#write " REAL*8 Y(`EXTRASYMBOLS_')"
#write " REAL*8 Dot,InvDot"
#write " Dot(p1,p2)=p1(1)*p2(1)-p1(2)*p2(2)-p1(3)*p2(3)\
-p1(4)*p2(4)"
#write " InvDot(p1,p2)=1.D0/(Dot(p1,p2))"
#write "*"
#write "* We still have to add definitions here."
#write "* And we have to import all the variables."
#write "*"
#write "%X"
#write "*"
#write " RETURN"
#write " END"
ExtraSymbols,underscore,Z;
Format Normal;
Format 80;
Print;
.sort
FromPolynomial;
Print;
.end
assert succeeded?
if !threaded?
# In TFORM, the output can differ.
assert stdout =~ exact_pattern(<<'EOF')
F =
x^-2 + x^-1 + x + x^2 + f(x1) + f(x2)*Dot(p,q)*x + f(x2)*InvDot(p,q)^2;
ExtraSymbols,array,Y;
Format DOUBLEFORTRAN;
ToPolynomial;
Print;
.sort
F =
& Y(1) + Y(1)**2 + Y(2) + Y(5)**2*Y(3) + x + x*Y(4)*Y(3) + x**2
#write " SUBROUTINE sub(Y)"
#write "*"
#write "* Compute the extra symbols."
#write "*"
#write " REAL*8 Y(`EXTRASYMBOLS_')"
#write " REAL*8 Dot,InvDot"
#write " Dot(p1,p2)=p1(1)*p2(1)-p1(2)*p2(2)-p1(3)*p2(3)\
-p1(4)*p2(4)"
#write " InvDot(p1,p2)=1.D0/(Dot(p1,p2))"
#write "*"
#write "* We still have to add definitions here."
#write "* And we have to import all the variables."
#write "*"
#write "%X"
#write "*"
#write " RETURN"
#write " END"
ExtraSymbols,underscore,Z;
Format Normal;
Format 80;
Print;
.sort
F =
Z1_ + Z1_^2 + Z2_ + Z5_^2*Z3_ + x + x*Z4_*Z3_ + x^2;
FromPolynomial;
Print;
.end
F =
x^-2 + x^-1 + x + x^2 + f(x1) + f(x2)*Dot(p,q)*x + f(x2)*InvDot(p,q)^2;
EOF
assert file("sub.f") == <<-'EOF'
SUBROUTINE sub(Y)
*
* Compute the extra symbols.
*
REAL*8 Y(5)
REAL*8 Dot,InvDot
Dot(p1,p2)=p1(1)*p2(1)-p1(2)*p2(2)-p1(3)*p2(3)-p1(4)*p2(4)
InvDot(p1,p2)=1.D0/(Dot(p1,p2))
*
* We still have to add definitions here.
* And we have to import all the variables.
*
Y(1)=x**(-1)
Y(2)=f(x1)
Y(3)=f(x2)
Y(4)=Dot(p,q)
Y(5)=InvDot(p,q)
*
RETURN
END
EOF
end
*--#] Var_Extra_Symbols_1 :
*--#[ Pre_call_1 :
#define a "1"
#define bc2 "x"
#define bc3 "y"
#define b "c`~a'"
#procedure hop(c,?d);
#redefine a "3"
#message This is the call: `c',`?d'
#endprocedure
#redefine a "2"
#message This is b: `b'
#call hop(`b`!b''`!b'`b'`!b'`b',`~a',`b',`a')
.end
assert succeeded?
assert stdout =~ /#message This is b: `b'\n~~~This is b: c2\n/
assert stdout =~ /#call hop\(`b`!b''`!b'`b'`!b'`b',`~a',`b',`a'\)\n~~~This is the call: xc2c3c2c3,3,c3,2\n/
*--#] Pre_call_1 :
*--#[ Pre_define_1 :
#define c "3"
#define var1(a,b) "(`~a'+`~b'+`c')"
#define var2(a,b) "(`~a'+`~b'+`~c')"
#redefine c "4"
Local F1 = `var1(1,2)';
Local F2 = `var2(1,2)';
Print;
.end
assert succeeded?
assert result("F1") =~ expr("6")
assert result("F2") =~ expr("7")
*--#] Pre_define_1 :
*--#[ Pre_preout_1 :
#PreOut ON
S a1,...,a4;
L F = (a1+...+a4)^2;
id a4 = -a1;
.end
assert succeeded?
assert stdout =~ exact_pattern(<<-EOF
#PreOut ON
S a1,...,a4;
S,a1,a2,a3,a4
L F = (a1+...+a4)^2;
L,F=(a1+a2+a3+a4)^2
id a4 = -a1;
id,a4=-a1
.end
EOF
)
*--#] Pre_preout_1 :
*--#[ Pre_write_1 :
Symbols a,b;
L F = a+b;
#$a1 = a+b;
#$a2 = (a+b)^2;
#$a3 = $a1^3;
#write " One power: %$\\n Two powers: %$\\n Three powers: %$\n%s"\
,$a1,$a2,$a3," The end"
.end
assert succeeded?
assert stdout =~ exact_pattern(<<-EOF
One power: b+a
Two powers: b^2+2*a*b+a^2
Three powers: b^3+3*a*b^2+3*a^2*b+a^3
The end
.end
EOF
)
*--#] Pre_write_1 :
*--#[ Pre_write_2 :
* TODO: change the result in the manual.
S x1,...,x10;
L MyExpression = (x1+...+x10)^4;
.sort
Format Fortran;
#write " FUNCTION fun(x1,x2,x3,x4,x5,x6,x7,x8,x9,x10)"
#write " REAL x1,x2,x3,x4,x5,x6,x7,x8,x9,x10"
#write " fun = %e",MyExpression(fun)
#write " RETURN"
#write " END"
.end
assert succeeded?
assert file("fun.f") == <<-EOF
FUNCTION fun(x1,x2,x3,x4,x5,x6,x7,x8,x9,x10)
REAL x1,x2,x3,x4,x5,x6,x7,x8,x9,x10
fun = x10**4 + 4*x9*x10**3 + 6*x9**2*x10**2 + 4*x9**3*x10 + x9**4
& + 4*x8*x10**3 + 12*x8*x9*x10**2 + 12*x8*x9**2*x10 + 4*x8*x9**3
& + 6*x8**2*x10**2 + 12*x8**2*x9*x10 + 6*x8**2*x9**2 + 4*x8**3*
& x10 + 4*x8**3*x9 + x8**4 + 4*x7*x10**3 + 12*x7*x9*x10**2 + 12*x7
& *x9**2*x10 + 4*x7*x9**3 + 12*x7*x8*x10**2 + 24*x7*x8*x9*x10 + 12
& *x7*x8*x9**2 + 12*x7*x8**2*x10 + 12*x7*x8**2*x9 + 4*x7*x8**3 + 6
& *x7**2*x10**2 + 12*x7**2*x9*x10 + 6*x7**2*x9**2 + 12*x7**2*x8*
& x10 + 12*x7**2*x8*x9 + 6*x7**2*x8**2 + 4*x7**3*x10 + 4*x7**3*x9
& + 4*x7**3*x8 + x7**4 + 4*x6*x10**3 + 12*x6*x9*x10**2 + 12*x6*
& x9**2*x10 + 4*x6*x9**3 + 12*x6*x8*x10**2 + 24*x6*x8*x9*x10 + 12*
& x6*x8*x9**2 + 12*x6*x8**2*x10 + 12*x6*x8**2*x9 + 4*x6*x8**3 + 12
& *x6*x7*x10**2 + 24*x6*x7*x9*x10 + 12*x6*x7*x9**2 + 24*x6*x7*x8*
& x10 + 24*x6*x7*x8*x9 + 12*x6*x7*x8**2 + 12*x6*x7**2*x10 + 12*x6*
& x7**2*x9 + 12*x6*x7**2*x8 + 4*x6*x7**3 + 6*x6**2*x10**2 + 12*
& x6**2*x9*x10 + 6*x6**2*x9**2 + 12*x6**2*x8*x10 + 12*x6**2*x8*x9
& + 6*x6**2*x8**2
fun = fun + 12*x6**2*x7*x10 + 12*x6**2*x7*x9 + 12*x6**2*x7*x8 + 6
& *x6**2*x7**2 + 4*x6**3*x10 + 4*x6**3*x9 + 4*x6**3*x8 + 4*x6**3*
& x7 + x6**4 + 4*x5*x10**3 + 12*x5*x9*x10**2 + 12*x5*x9**2*x10 + 4
& *x5*x9**3 + 12*x5*x8*x10**2 + 24*x5*x8*x9*x10 + 12*x5*x8*x9**2
& + 12*x5*x8**2*x10 + 12*x5*x8**2*x9 + 4*x5*x8**3 + 12*x5*x7*
& x10**2 + 24*x5*x7*x9*x10 + 12*x5*x7*x9**2 + 24*x5*x7*x8*x10 + 24
& *x5*x7*x8*x9 + 12*x5*x7*x8**2 + 12*x5*x7**2*x10 + 12*x5*x7**2*x9
& + 12*x5*x7**2*x8 + 4*x5*x7**3 + 12*x5*x6*x10**2 + 24*x5*x6*x9*
& x10 + 12*x5*x6*x9**2 + 24*x5*x6*x8*x10 + 24*x5*x6*x8*x9 + 12*x5*
& x6*x8**2 + 24*x5*x6*x7*x10 + 24*x5*x6*x7*x9 + 24*x5*x6*x7*x8 +
& 12*x5*x6*x7**2 + 12*x5*x6**2*x10 + 12*x5*x6**2*x9 + 12*x5*x6**2*
& x8 + 12*x5*x6**2*x7 + 4*x5*x6**3 + 6*x5**2*x10**2 + 12*x5**2*x9*
& x10 + 6*x5**2*x9**2 + 12*x5**2*x8*x10 + 12*x5**2*x8*x9 + 6*x5**2
& *x8**2 + 12*x5**2*x7*x10 + 12*x5**2*x7*x9 + 12*x5**2*x7*x8 + 6*
& x5**2*x7**2 + 12*x5**2*x6*x10 + 12*x5**2*x6*x9 + 12*x5**2*x6*x8
& + 12*x5**2*x6*x7
fun = fun + 6*x5**2*x6**2 + 4*x5**3*x10 + 4*x5**3*x9 + 4*x5**3*x8
& + 4*x5**3*x7 + 4*x5**3*x6 + x5**4 + 4*x4*x10**3 + 12*x4*x9*
& x10**2 + 12*x4*x9**2*x10 + 4*x4*x9**3 + 12*x4*x8*x10**2 + 24*x4*
& x8*x9*x10 + 12*x4*x8*x9**2 + 12*x4*x8**2*x10 + 12*x4*x8**2*x9 +
& 4*x4*x8**3 + 12*x4*x7*x10**2 + 24*x4*x7*x9*x10 + 12*x4*x7*x9**2
& + 24*x4*x7*x8*x10 + 24*x4*x7*x8*x9 + 12*x4*x7*x8**2 + 12*x4*
& x7**2*x10 + 12*x4*x7**2*x9 + 12*x4*x7**2*x8 + 4*x4*x7**3 + 12*x4
& *x6*x10**2 + 24*x4*x6*x9*x10 + 12*x4*x6*x9**2 + 24*x4*x6*x8*x10
& + 24*x4*x6*x8*x9 + 12*x4*x6*x8**2 + 24*x4*x6*x7*x10 + 24*x4*x6*
& x7*x9 + 24*x4*x6*x7*x8 + 12*x4*x6*x7**2 + 12*x4*x6**2*x10 + 12*
& x4*x6**2*x9 + 12*x4*x6**2*x8 + 12*x4*x6**2*x7 + 4*x4*x6**3 + 12*
& x4*x5*x10**2 + 24*x4*x5*x9*x10 + 12*x4*x5*x9**2 + 24*x4*x5*x8*
& x10 + 24*x4*x5*x8*x9 + 12*x4*x5*x8**2 + 24*x4*x5*x7*x10 + 24*x4*
& x5*x7*x9 + 24*x4*x5*x7*x8 + 12*x4*x5*x7**2 + 24*x4*x5*x6*x10 +
& 24*x4*x5*x6*x9 + 24*x4*x5*x6*x8 + 24*x4*x5*x6*x7 + 12*x4*x5*
& x6**2
fun = fun + 12*x4*x5**2*x10 + 12*x4*x5**2*x9 + 12*x4*x5**2*x8 +
& 12*x4*x5**2*x7 + 12*x4*x5**2*x6 + 4*x4*x5**3 + 6*x4**2*x10**2 +
& 12*x4**2*x9*x10 + 6*x4**2*x9**2 + 12*x4**2*x8*x10 + 12*x4**2*x8*
& x9 + 6*x4**2*x8**2 + 12*x4**2*x7*x10 + 12*x4**2*x7*x9 + 12*x4**2
& *x7*x8 + 6*x4**2*x7**2 + 12*x4**2*x6*x10 + 12*x4**2*x6*x9 + 12*
& x4**2*x6*x8 + 12*x4**2*x6*x7 + 6*x4**2*x6**2 + 12*x4**2*x5*x10
& + 12*x4**2*x5*x9 + 12*x4**2*x5*x8 + 12*x4**2*x5*x7 + 12*x4**2*
& x5*x6 + 6*x4**2*x5**2 + 4*x4**3*x10 + 4*x4**3*x9 + 4*x4**3*x8 +
& 4*x4**3*x7 + 4*x4**3*x6 + 4*x4**3*x5 + x4**4 + 4*x3*x10**3 + 12*
& x3*x9*x10**2 + 12*x3*x9**2*x10 + 4*x3*x9**3 + 12*x3*x8*x10**2 +
& 24*x3*x8*x9*x10 + 12*x3*x8*x9**2 + 12*x3*x8**2*x10 + 12*x3*x8**2
& *x9 + 4*x3*x8**3 + 12*x3*x7*x10**2 + 24*x3*x7*x9*x10 + 12*x3*x7*
& x9**2 + 24*x3*x7*x8*x10 + 24*x3*x7*x8*x9 + 12*x3*x7*x8**2 + 12*
& x3*x7**2*x10 + 12*x3*x7**2*x9 + 12*x3*x7**2*x8 + 4*x3*x7**3 + 12
& *x3*x6*x10**2 + 24*x3*x6*x9*x10 + 12*x3*x6*x9**2 + 24*x3*x6*x8*
& x10
fun = fun + 24*x3*x6*x8*x9 + 12*x3*x6*x8**2 + 24*x3*x6*x7*x10 +
& 24*x3*x6*x7*x9 + 24*x3*x6*x7*x8 + 12*x3*x6*x7**2 + 12*x3*x6**2*
& x10 + 12*x3*x6**2*x9 + 12*x3*x6**2*x8 + 12*x3*x6**2*x7 + 4*x3*
& x6**3 + 12*x3*x5*x10**2 + 24*x3*x5*x9*x10 + 12*x3*x5*x9**2 + 24*
& x3*x5*x8*x10 + 24*x3*x5*x8*x9 + 12*x3*x5*x8**2 + 24*x3*x5*x7*x10
& + 24*x3*x5*x7*x9 + 24*x3*x5*x7*x8 + 12*x3*x5*x7**2 + 24*x3*x5*
& x6*x10 + 24*x3*x5*x6*x9 + 24*x3*x5*x6*x8 + 24*x3*x5*x6*x7 + 12*
& x3*x5*x6**2 + 12*x3*x5**2*x10 + 12*x3*x5**2*x9 + 12*x3*x5**2*x8
& + 12*x3*x5**2*x7 + 12*x3*x5**2*x6 + 4*x3*x5**3 + 12*x3*x4*
& x10**2 + 24*x3*x4*x9*x10 + 12*x3*x4*x9**2 + 24*x3*x4*x8*x10 + 24
& *x3*x4*x8*x9 + 12*x3*x4*x8**2 + 24*x3*x4*x7*x10 + 24*x3*x4*x7*x9
& + 24*x3*x4*x7*x8 + 12*x3*x4*x7**2 + 24*x3*x4*x6*x10 + 24*x3*x4*
& x6*x9 + 24*x3*x4*x6*x8 + 24*x3*x4*x6*x7 + 12*x3*x4*x6**2 + 24*x3
& *x4*x5*x10 + 24*x3*x4*x5*x9 + 24*x3*x4*x5*x8 + 24*x3*x4*x5*x7 +
& 24*x3*x4*x5*x6 + 12*x3*x4*x5**2 + 12*x3*x4**2*x10 + 12*x3*x4**2*
& x9
fun = fun + 12*x3*x4**2*x8 + 12*x3*x4**2*x7 + 12*x3*x4**2*x6 + 12
& *x3*x4**2*x5 + 4*x3*x4**3 + 6*x3**2*x10**2 + 12*x3**2*x9*x10 + 6
& *x3**2*x9**2 + 12*x3**2*x8*x10 + 12*x3**2*x8*x9 + 6*x3**2*x8**2
& + 12*x3**2*x7*x10 + 12*x3**2*x7*x9 + 12*x3**2*x7*x8 + 6*x3**2*
& x7**2 + 12*x3**2*x6*x10 + 12*x3**2*x6*x9 + 12*x3**2*x6*x8 + 12*
& x3**2*x6*x7 + 6*x3**2*x6**2 + 12*x3**2*x5*x10 + 12*x3**2*x5*x9
& + 12*x3**2*x5*x8 + 12*x3**2*x5*x7 + 12*x3**2*x5*x6 + 6*x3**2*
& x5**2 + 12*x3**2*x4*x10 + 12*x3**2*x4*x9 + 12*x3**2*x4*x8 + 12*
& x3**2*x4*x7 + 12*x3**2*x4*x6 + 12*x3**2*x4*x5 + 6*x3**2*x4**2 +
& 4*x3**3*x10 + 4*x3**3*x9 + 4*x3**3*x8 + 4*x3**3*x7 + 4*x3**3*x6
& + 4*x3**3*x5 + 4*x3**3*x4 + x3**4 + 4*x2*x10**3 + 12*x2*x9*
& x10**2 + 12*x2*x9**2*x10 + 4*x2*x9**3 + 12*x2*x8*x10**2 + 24*x2*
& x8*x9*x10 + 12*x2*x8*x9**2 + 12*x2*x8**2*x10 + 12*x2*x8**2*x9 +
& 4*x2*x8**3 + 12*x2*x7*x10**2 + 24*x2*x7*x9*x10 + 12*x2*x7*x9**2
& + 24*x2*x7*x8*x10 + 24*x2*x7*x8*x9 + 12*x2*x7*x8**2 + 12*x2*
& x7**2*x10
fun = fun + 12*x2*x7**2*x9 + 12*x2*x7**2*x8 + 4*x2*x7**3 + 12*x2*
& x6*x10**2 + 24*x2*x6*x9*x10 + 12*x2*x6*x9**2 + 24*x2*x6*x8*x10
& + 24*x2*x6*x8*x9 + 12*x2*x6*x8**2 + 24*x2*x6*x7*x10 + 24*x2*x6*
& x7*x9 + 24*x2*x6*x7*x8 + 12*x2*x6*x7**2 + 12*x2*x6**2*x10 + 12*
& x2*x6**2*x9 + 12*x2*x6**2*x8 + 12*x2*x6**2*x7 + 4*x2*x6**3 + 12*
& x2*x5*x10**2 + 24*x2*x5*x9*x10 + 12*x2*x5*x9**2 + 24*x2*x5*x8*
& x10 + 24*x2*x5*x8*x9 + 12*x2*x5*x8**2 + 24*x2*x5*x7*x10 + 24*x2*
& x5*x7*x9 + 24*x2*x5*x7*x8 + 12*x2*x5*x7**2 + 24*x2*x5*x6*x10 +
& 24*x2*x5*x6*x9 + 24*x2*x5*x6*x8 + 24*x2*x5*x6*x7 + 12*x2*x5*
& x6**2 + 12*x2*x5**2*x10 + 12*x2*x5**2*x9 + 12*x2*x5**2*x8 + 12*
& x2*x5**2*x7 + 12*x2*x5**2*x6 + 4*x2*x5**3 + 12*x2*x4*x10**2 + 24
& *x2*x4*x9*x10 + 12*x2*x4*x9**2 + 24*x2*x4*x8*x10 + 24*x2*x4*x8*
& x9 + 12*x2*x4*x8**2 + 24*x2*x4*x7*x10 + 24*x2*x4*x7*x9 + 24*x2*
& x4*x7*x8 + 12*x2*x4*x7**2 + 24*x2*x4*x6*x10 + 24*x2*x4*x6*x9 +
& 24*x2*x4*x6*x8 + 24*x2*x4*x6*x7 + 12*x2*x4*x6**2 + 24*x2*x4*x5*
& x10
fun = fun + 24*x2*x4*x5*x9 + 24*x2*x4*x5*x8 + 24*x2*x4*x5*x7 + 24
& *x2*x4*x5*x6 + 12*x2*x4*x5**2 + 12*x2*x4**2*x10 + 12*x2*x4**2*x9
& + 12*x2*x4**2*x8 + 12*x2*x4**2*x7 + 12*x2*x4**2*x6 + 12*x2*
& x4**2*x5 + 4*x2*x4**3 + 12*x2*x3*x10**2 + 24*x2*x3*x9*x10 + 12*
& x2*x3*x9**2 + 24*x2*x3*x8*x10 + 24*x2*x3*x8*x9 + 12*x2*x3*x8**2
& + 24*x2*x3*x7*x10 + 24*x2*x3*x7*x9 + 24*x2*x3*x7*x8 + 12*x2*x3*
& x7**2 + 24*x2*x3*x6*x10 + 24*x2*x3*x6*x9 + 24*x2*x3*x6*x8 + 24*
& x2*x3*x6*x7 + 12*x2*x3*x6**2 + 24*x2*x3*x5*x10 + 24*x2*x3*x5*x9
& + 24*x2*x3*x5*x8 + 24*x2*x3*x5*x7 + 24*x2*x3*x5*x6 + 12*x2*x3*
& x5**2 + 24*x2*x3*x4*x10 + 24*x2*x3*x4*x9 + 24*x2*x3*x4*x8 + 24*
& x2*x3*x4*x7 + 24*x2*x3*x4*x6 + 24*x2*x3*x4*x5 + 12*x2*x3*x4**2
& + 12*x2*x3**2*x10 + 12*x2*x3**2*x9 + 12*x2*x3**2*x8 + 12*x2*
& x3**2*x7 + 12*x2*x3**2*x6 + 12*x2*x3**2*x5 + 12*x2*x3**2*x4 + 4*
& x2*x3**3 + 6*x2**2*x10**2 + 12*x2**2*x9*x10 + 6*x2**2*x9**2 + 12
& *x2**2*x8*x10 + 12*x2**2*x8*x9 + 6*x2**2*x8**2 + 12*x2**2*x7*x10
& + 12*x2**2*x7*x9
fun = fun + 12*x2**2*x7*x8 + 6*x2**2*x7**2 + 12*x2**2*x6*x10 + 12
& *x2**2*x6*x9 + 12*x2**2*x6*x8 + 12*x2**2*x6*x7 + 6*x2**2*x6**2
& + 12*x2**2*x5*x10 + 12*x2**2*x5*x9 + 12*x2**2*x5*x8 + 12*x2**2*
& x5*x7 + 12*x2**2*x5*x6 + 6*x2**2*x5**2 + 12*x2**2*x4*x10 + 12*
& x2**2*x4*x9 + 12*x2**2*x4*x8 + 12*x2**2*x4*x7 + 12*x2**2*x4*x6
& + 12*x2**2*x4*x5 + 6*x2**2*x4**2 + 12*x2**2*x3*x10 + 12*x2**2*
& x3*x9 + 12*x2**2*x3*x8 + 12*x2**2*x3*x7 + 12*x2**2*x3*x6 + 12*
& x2**2*x3*x5 + 12*x2**2*x3*x4 + 6*x2**2*x3**2 + 4*x2**3*x10 + 4*
& x2**3*x9 + 4*x2**3*x8 + 4*x2**3*x7 + 4*x2**3*x6 + 4*x2**3*x5 + 4
& *x2**3*x4 + 4*x2**3*x3 + x2**4 + 4*x1*x10**3 + 12*x1*x9*x10**2
& + 12*x1*x9**2*x10 + 4*x1*x9**3 + 12*x1*x8*x10**2 + 24*x1*x8*x9*
& x10 + 12*x1*x8*x9**2 + 12*x1*x8**2*x10 + 12*x1*x8**2*x9 + 4*x1*
& x8**3 + 12*x1*x7*x10**2 + 24*x1*x7*x9*x10 + 12*x1*x7*x9**2 + 24*
& x1*x7*x8*x10 + 24*x1*x7*x8*x9 + 12*x1*x7*x8**2 + 12*x1*x7**2*x10
& + 12*x1*x7**2*x9 + 12*x1*x7**2*x8 + 4*x1*x7**3 + 12*x1*x6*
& x10**2
fun = fun + 24*x1*x6*x9*x10 + 12*x1*x6*x9**2 + 24*x1*x6*x8*x10 +
& 24*x1*x6*x8*x9 + 12*x1*x6*x8**2 + 24*x1*x6*x7*x10 + 24*x1*x6*x7*
& x9 + 24*x1*x6*x7*x8 + 12*x1*x6*x7**2 + 12*x1*x6**2*x10 + 12*x1*
& x6**2*x9 + 12*x1*x6**2*x8 + 12*x1*x6**2*x7 + 4*x1*x6**3 + 12*x1*
& x5*x10**2 + 24*x1*x5*x9*x10 + 12*x1*x5*x9**2 + 24*x1*x5*x8*x10
& + 24*x1*x5*x8*x9 + 12*x1*x5*x8**2 + 24*x1*x5*x7*x10 + 24*x1*x5*
& x7*x9 + 24*x1*x5*x7*x8 + 12*x1*x5*x7**2 + 24*x1*x5*x6*x10 + 24*
& x1*x5*x6*x9 + 24*x1*x5*x6*x8 + 24*x1*x5*x6*x7 + 12*x1*x5*x6**2
& + 12*x1*x5**2*x10 + 12*x1*x5**2*x9 + 12*x1*x5**2*x8 + 12*x1*
& x5**2*x7 + 12*x1*x5**2*x6 + 4*x1*x5**3 + 12*x1*x4*x10**2 + 24*x1
& *x4*x9*x10 + 12*x1*x4*x9**2 + 24*x1*x4*x8*x10 + 24*x1*x4*x8*x9
& + 12*x1*x4*x8**2 + 24*x1*x4*x7*x10 + 24*x1*x4*x7*x9 + 24*x1*x4*
& x7*x8 + 12*x1*x4*x7**2 + 24*x1*x4*x6*x10 + 24*x1*x4*x6*x9 + 24*
& x1*x4*x6*x8 + 24*x1*x4*x6*x7 + 12*x1*x4*x6**2 + 24*x1*x4*x5*x10
& + 24*x1*x4*x5*x9 + 24*x1*x4*x5*x8 + 24*x1*x4*x5*x7 + 24*x1*x4*
& x5*x6
fun = fun + 12*x1*x4*x5**2 + 12*x1*x4**2*x10 + 12*x1*x4**2*x9 +
& 12*x1*x4**2*x8 + 12*x1*x4**2*x7 + 12*x1*x4**2*x6 + 12*x1*x4**2*
& x5 + 4*x1*x4**3 + 12*x1*x3*x10**2 + 24*x1*x3*x9*x10 + 12*x1*x3*
& x9**2 + 24*x1*x3*x8*x10 + 24*x1*x3*x8*x9 + 12*x1*x3*x8**2 + 24*
& x1*x3*x7*x10 + 24*x1*x3*x7*x9 + 24*x1*x3*x7*x8 + 12*x1*x3*x7**2
& + 24*x1*x3*x6*x10 + 24*x1*x3*x6*x9 + 24*x1*x3*x6*x8 + 24*x1*x3*
& x6*x7 + 12*x1*x3*x6**2 + 24*x1*x3*x5*x10 + 24*x1*x3*x5*x9 + 24*
& x1*x3*x5*x8 + 24*x1*x3*x5*x7 + 24*x1*x3*x5*x6 + 12*x1*x3*x5**2
& + 24*x1*x3*x4*x10 + 24*x1*x3*x4*x9 + 24*x1*x3*x4*x8 + 24*x1*x3*
& x4*x7 + 24*x1*x3*x4*x6 + 24*x1*x3*x4*x5 + 12*x1*x3*x4**2 + 12*x1
& *x3**2*x10 + 12*x1*x3**2*x9 + 12*x1*x3**2*x8 + 12*x1*x3**2*x7 +
& 12*x1*x3**2*x6 + 12*x1*x3**2*x5 + 12*x1*x3**2*x4 + 4*x1*x3**3 +
& 12*x1*x2*x10**2 + 24*x1*x2*x9*x10 + 12*x1*x2*x9**2 + 24*x1*x2*x8
& *x10 + 24*x1*x2*x8*x9 + 12*x1*x2*x8**2 + 24*x1*x2*x7*x10 + 24*x1
& *x2*x7*x9 + 24*x1*x2*x7*x8 + 12*x1*x2*x7**2 + 24*x1*x2*x6*x10 +
& 24*x1*x2*x6*x9
fun = fun + 24*x1*x2*x6*x8 + 24*x1*x2*x6*x7 + 12*x1*x2*x6**2 + 24
& *x1*x2*x5*x10 + 24*x1*x2*x5*x9 + 24*x1*x2*x5*x8 + 24*x1*x2*x5*x7
& + 24*x1*x2*x5*x6 + 12*x1*x2*x5**2 + 24*x1*x2*x4*x10 + 24*x1*x2*
& x4*x9 + 24*x1*x2*x4*x8 + 24*x1*x2*x4*x7 + 24*x1*x2*x4*x6 + 24*x1
& *x2*x4*x5 + 12*x1*x2*x4**2 + 24*x1*x2*x3*x10 + 24*x1*x2*x3*x9 +
& 24*x1*x2*x3*x8 + 24*x1*x2*x3*x7 + 24*x1*x2*x3*x6 + 24*x1*x2*x3*
& x5 + 24*x1*x2*x3*x4 + 12*x1*x2*x3**2 + 12*x1*x2**2*x10 + 12*x1*
& x2**2*x9 + 12*x1*x2**2*x8 + 12*x1*x2**2*x7 + 12*x1*x2**2*x6 + 12
& *x1*x2**2*x5 + 12*x1*x2**2*x4 + 12*x1*x2**2*x3 + 4*x1*x2**3 + 6*
& x1**2*x10**2 + 12*x1**2*x9*x10 + 6*x1**2*x9**2 + 12*x1**2*x8*x10
& + 12*x1**2*x8*x9 + 6*x1**2*x8**2 + 12*x1**2*x7*x10 + 12*x1**2*
& x7*x9 + 12*x1**2*x7*x8 + 6*x1**2*x7**2 + 12*x1**2*x6*x10 + 12*
& x1**2*x6*x9 + 12*x1**2*x6*x8 + 12*x1**2*x6*x7 + 6*x1**2*x6**2 +
& 12*x1**2*x5*x10 + 12*x1**2*x5*x9 + 12*x1**2*x5*x8 + 12*x1**2*x5*
& x7 + 12*x1**2*x5*x6 + 6*x1**2*x5**2 + 12*x1**2*x4*x10 + 12*x1**2
& *x4*x9
fun = fun + 12*x1**2*x4*x8 + 12*x1**2*x4*x7 + 12*x1**2*x4*x6 + 12
& *x1**2*x4*x5 + 6*x1**2*x4**2 + 12*x1**2*x3*x10 + 12*x1**2*x3*x9
& + 12*x1**2*x3*x8 + 12*x1**2*x3*x7 + 12*x1**2*x3*x6 + 12*x1**2*
& x3*x5 + 12*x1**2*x3*x4 + 6*x1**2*x3**2 + 12*x1**2*x2*x10 + 12*
& x1**2*x2*x9 + 12*x1**2*x2*x8 + 12*x1**2*x2*x7 + 12*x1**2*x2*x6
& + 12*x1**2*x2*x5 + 12*x1**2*x2*x4 + 12*x1**2*x2*x3 + 6*x1**2*
& x2**2 + 4*x1**3*x10 + 4*x1**3*x9 + 4*x1**3*x8 + 4*x1**3*x7 + 4*
& x1**3*x6 + 4*x1**3*x5 + 4*x1**3*x4 + 4*x1**3*x3 + 4*x1**3*x2 +
& x1**4
RETURN
END
EOF
*--#] Pre_write_2 :
*--#[ DolVars_1 :
S x,a,b;
Off statistics;
L F = (a+b)^4+a*(a+x)^3;
.sort
#$a = 0;
if ( count(x,1) > $a ) $a = count_(x,1);
Print " >> After %t the maximum power of x is %$",$a;
ModuleOption noparallel; * suppresses noparallel warning
#write " ># $a = `$a'"
.sort
#write " ># $a = `$a'"
.end
assert succeeded?
assert stdout =~ Regexp.new(<<-EOF
># \\$a = 0
\.sort
>> .+0
>> .+0
>> .+0
>> .+0
>> .+0
>> .+1
>> .+2
>> .+3
#write " ># \\$a = `\\$a'"
># \\$a = 3
EOF
)
*--#] DolVars_1 :
*--#[ DolVarsParallel_1 :
S a1,...,a10;
L F = (a1+...+a10)^3;
.sort
#$c = 0;
Print +f "<%w> %t";
Multiply,(a1+...+a10);
$c = $c+1;
ModuleOption,sum,$c;
.sort
#message $c = `$c'
#$max = 0;
#$min = 10;
if ( count(a1,1) > $max ) $max = count_(a1,1);
if ( count(a4,1) < $min ) $min = count_(a4,1);
ModuleOption,maximum,$max;
ModuleOption,minimum,$min;
.sort
#message $max = `$max'
#message $min = `$min'
.end
assert succeeded?
if serial?
assert stdout =~ /\s+\.sort\n(<>\ \ \+\ \S+\n){220}\n/
else
assert stdout =~ /\s+\.sort\n(<\d+>\ \ \+\ \S+\n){220}\n/
end
assert stdout =~ /~~~\$c = 2200/
assert stdout =~ /~~~\$max = 4/
assert stdout =~ /~~~\$min = 0/
*--#] DolVarsParallel_1 :
*--#[ Sta_Also_1 :
Symbols x,y,cosphi,sinphi;
Local F = x+y;
id x = cosphi*x-sinphi*y;
also y = sinphi*x+cosphi*y;
Print;
.end
assert succeeded?
assert result("F") =~ expr("- y*sinphi + y*cosphi + x*sinphi + x*cosphi")
*--#] Sta_Also_1 :
*--#[ Sta_Antibracket_1 :
Symbols x, y;
Local F = (1+x+x^2)*(1+y+y^2);
AntiBracket y;
Print;
.end
assert succeeded?
assert stdout =~ exact_pattern(<<'EOF')
F =
+ x * ( 1 + y + y^2 )
+ x^2 * ( 1 + y + y^2 )
+ 1 + y + y^2;
EOF
*--#] Sta_Antibracket_1 :
*--#[ Sta_Antiputinside_1 :
Symbols x, y, z;
Cfunction f;
Local F = 10 + x + y^2 + y*z;
Antiputinside f,x;
Print;
.end
assert succeeded?
assert result("F") =~ expr("
f(y*z) + f(y^2) + f(1)*x + f(10)
")
*--#] Sta_Antiputinside_1 :
*--#[ Sta_ArgImplode_1 :
CF Z1, ..., Z4;
S x, a, b;
L s = a * (Z1(0,0,0,1,0,0,-1) - Z2(0,0,0,1,0,0,-1))
+ b * (Z3(-2,8,-1,-1) - Z4(-2,8,-1,-1));
ArgImplode Z1;
repeat id Z2(?a,0,x?!{0,0},?b) = Z2(?a,x+sig_(x),?b);
ArgExplode Z3;
repeat id Z4(?a,x?!{1,0,-1},?b) = Z4(?a,0,x-sig_(x),?b);
id Z2(?a) = Z1(?a);
id Z4(?a) = Z3(?a);
Print;
.end
assert succeeded?
assert result("s") =~ expr("0")
*--#] Sta_ArgImplode_1 :
*--#[ Sta_Argtoextrasymbol_1 :
Symbols x, y;
Cfunction f;
Local F = f(x + 1);
Local F1 = f(y,x + 1);
Argtoextrasymbol;
Print;
.end
assert succeeded?
assert result("F") =~ expr("f(Z1_)")
assert result("F1") =~ expr("f(Z2_,Z1_)")
*--#] Sta_Argtoextrasymbol_1 :
*--#[ Sta_Argument_1 :
Symbols x, y, z;
CFunction f;
Local F = f(x + 2*y + z^2);
Argument;
Identify y = x;
Endargument;
Print;
.end
assert succeeded?
assert result("F") =~ expr("
f(z^2 + 3*x)
")
*--#] Sta_Argument_1 :
*--#[ Sta_Argument_2 :
Symbols x,y;
CFunction f, f1, f2, f3;
Local F = f(x,x,x,x) + f1(x,x,x,x) + f2(x,x) + f3(x);
Argument 2,f,1,{f,f1},3,4;
Identify x = y;
Endargument;
Print;
.end
assert succeeded?
assert result("F") =~ expr("
f(y,y,y,y) + f1(x,y,y,y) + f2(x,y) + f3(x)
")
*--#] Sta_Argument_2 :
*--#[ Sta_Bracket_1 :
Symbols x, y;
Local F = (1+x+x^2)*(1+y+y^2);
Bracket y;
Print;
.end
assert succeeded?
assert stdout =~ exact_pattern(<<'EOF')
F =
+ y * ( 1 + x + x^2 )
+ y^2 * ( 1 + x + x^2 )
+ 1 + x + x^2;
EOF
*--#] Sta_Bracket_1 :
*--#[ Sta_Chainin_1 :
Function f;
Symbol x,y,z;
Local F = f(x)*f(y)*f(z);
ChainIn f;
Print;
.end
assert succeeded?
assert result("F") =~ expr("
f(x,y,z)
")
*--#] Sta_Chainin_1 :
*--#[ Sta_Chainout_1 :
Function f;
Symbol x,y,z;
Local F = f(x,y,z);
ChainOut f;
Print;
.end
assert succeeded?
assert result("F") =~ expr("
f(x)*f(y)*f(z)
")
*--#] Sta_Chainout_1 :
*--#[ Sta_Collect_1 :
S a,b,c;
CF cfun;
L F =
a*(b^2+c)
+ a^2*(b+6)
+ b^3 + c*b + 12;
B a;
.sort
Collect cfun;
P;
.end
assert succeeded?
assert result("F") =~ expr("
cfun(6 + b)*a^2 + cfun(12 + b*c + b^3) + cfun(c + b^2)*a
")
*--#] Sta_Collect_1 :
*--#[ Sta_CommuteInSet_1 :
I i1,...,i10;
F A1,...,A10;
CommuteInSet{A1,A3,A5},{A1,g_},{A1,A1};
L F = A5*A1*A5*A1*A5*A2*A3*A5*A1*A5*A3*A1;
L G = g_(2,i1)*g_(2,i2,i3)*A1(i2)*g_(1,i4)*g_(1,5_,i5,i6)
*A1(i1)*A1(i3)*g5_(1)*A3(i5)*A3(i4)*g5_(1);
Print +f +s;
.end
assert succeeded?
assert result("F") =~ expr("
+ A1*A1*A5*A5*A5*A2*A1*A1*A3*A3*A5*A5
")
assert result("G") =~ expr("
+ g_(1,i4,i5,i6)*g_(2,i1,i2,i3)*A1(i1)*A1(i2)*A1(i3)*
A3(i5)*A3(i4)*g_(1,5_)
")
*--#] Sta_CommuteInSet_1 :
*--#[ Sta_Commute_1 :
CFunction f,g;
Symbol x;
Local F = f(x)*g(x) + g(x)*f(x);
Print;
.end
assert succeeded?
assert result("F") =~ expr("
2*f(x)*g(x)
")
*--#] Sta_Commute_1 :
*--#[ Sta_Denominators_1 :
Symbols x, y;
Cfunction rat, den;
PolyRatFun rat;
Local F = 1/(x+y);
Denominators den;
Identify den(x?) = rat(1,x);
Print;
.end
assert succeeded?
assert result("F") =~ expr("
rat(1,x + y)
")
*--#] Sta_Denominators_1 :
*--#[ Sta_Discard_1 :
Symbols x;
Local F = x^3 + x^4 + x^5 + x^6;
if ( count(x,1) > 5 ) Discard;
Print;
.end
assert succeeded?
assert result("F") =~ expr("
x^3 + x^4 + x^5
")
*--#] Sta_Discard_1 :
*--#[ Sta_Do_1 :
Symbol x,y;
CFunction f;
LocalFactorized F = (1+y)*(2+y)*(3+y)*(4+y)*(5+y);
.sort
#$nf = numfactors_(F);
Local G = +...+;
Do $i = 1,$nf;
Identify,only x^$i = f(F[factor_^$i]);
Enddo;
Print;
ModuleOption local $i;
.end
assert succeeded?
assert stdout =~ exact_pattern("
F =
( 1 + y )
* ( 2 + y )
* ( 3 + y )
* ( 4 + y )
* ( 5 + y );
")
assert result("G") =~ expr("
f(1 + y) + f(2 + y) + f(3 + y) + f(4 + y) + f(5 + y)
")
*--#] Sta_Do_1 :
*--#[ Sta_Drop_1 :
Local F1 = 1;
Local F2 = 2;
Local F3 = 3;
.sort
Drop;
Ndrop F1;
Print;
.end
assert succeeded?
assert result("F1") =~ expr("1")
*--#] Sta_Drop_1 :
*--#[ Sta_DropCoefficient_1 :
Symbols x;
Local F = 1 + 10*x + 20*x^2;
DropCoefficient;
Print;
.end
assert succeeded?
assert result("F") =~ expr("
1 + x + x^2
")
*--#] Sta_DropCoefficient_1
*--#[ Sta_DropCoefficient_2 :
Symbols x;
Cfunction f;
Local F = f(1 + 5*x + 10*x^2);
Argument;
DropCoefficient;
Endargument;
Print;
.end
assert succeeded?
assert result("F") =~ expr("
f(1 + x + x^2)
")
*--#] Sta_DropCoefficient_2
*--#[ Sta_DropSymbols_1 :
Symbols x, y, z;
Local F = 1 + x + x^2 + z^3 + 2^2*y^4;
Dropsymbols;
Print;
.end
assert succeeded?
assert result("F") =~ expr("
8
")
*--#] Sta_Dropsymbols_1
*--#[ Sta_FactArg_1 :
*TODO: OldFactArg is needed for the result in the manual.
On OldFactArg;
Symbols a,b,c;
CFunctions f,f1,f2,f3;
Local F = f(-3*a*b)+f(3*a*b)
+f1(-3*a*b)+f1(3*a*b)
+f2(-3*a*b)+f2(3*a*b)
+f3(-3*a*b)+f3(3*a*b);
FactArg,f;
Factarg,(0),f1;
Factarg,(1),f2;
Factarg,(-1),f3;
Print;
.end
assert succeeded?
assert result("F") =~ expr("
f(a,b,-1,3) + f(a,b,3) + 2*f1(a*b) + f2(a*b,-1,3) + f2(a*b,3)
+ f3(a*b,-3) + f3(a*b,3)
")
*--#] Sta_FactArg_1 :
*--#[ Sta_Factorize_1 :
Symbols x;
Local F = x^3 + 3*x^2 + 3*x + 1;
Factorize;
Print;
.end
assert succeeded?
assert result("F") =~ expr("
( 1 + x )
* ( 1 + x )
* ( 1 + x )
")
*--#] Sta_Factorize_1 :
*--#[ Sta_Fill_1 :
Table B(1:1);
Local dummy = 1;
.sort
Fill B(1) = dummy;
Drop dummy;
.sort
* The next line is disabled to prevent a segmentation fault.
* Local F = B(1);
Print;
.end
#pend_if windows?
assert finished?
assert warning?
*--#] Sta_Fill_1 :
*--#[ Sta_Fill_2 :
Table B(1:1);
Local dummy = 1;
.sort
Fill B(1) = dummy;
.sort
Local F = B(1);
Print;
.sort
Drop;
.sort
Local dummy = 2;
.sort
Local F = B(1);
Print;
.end
# RHS expressions in Fill doesn't work in ParFORM. (#17)
# Anyway, the user is warned even in the sequential FORM, and should avoid it.
#pend_if mpi?
assert finished?
assert warning?
assert return_value == 0
assert result("F", 0) =~ expr("1")
assert result("F", 1) =~ expr("2")
*--#] Sta_Fill_2 :
*--#[ Sta_Fill_3 :
Table B(1:1);
Local dummy = 1;
.sort
#$value = dummy;
Fill B(1) = `$value';
Drop dummy;
.sort
Local F = B(1);
Print;
.end
assert succeeded?
assert result("F") =~ expr("1")
*--#] Sta_Fill_3 :
*--#[ Sta_Fill_4 :
Table B(1:1);
Local u = 2;
Local dummy = 1;
.sort
Fill B(1) = dummy;
Drop dummy;
.sort
Local v = 5;
Local F = B(1);
Print;
.end
# RHS expressions in Fill doesn't work in ParFORM. (#17)
# Anyway, the user is warned even in the sequential FORM, and should avoid it.
#pend_if mpi?
assert finished?
assert warning?
assert return_value == 0
assert result("F") =~ expr("5")
*--#] Sta_Fill_4 :
*--#[ Sta_Identify_1 :
Vector Q,p1,...,p5,q1,...,q5;
Cfunction V(s),replace;
Format 60;
* This is a t1 topology:
L F = V(Q,p1,p4)*V(p1,p2,p5)*
V(p2,p3,Q)*V(p3,p4,p5);
$t = term_;
id,all,$t*replace_(,...,) =
$t*replace(,...,);
Print +s;
ModuleOption local $t; * allow parallel execution
.end
assert succeeded?
assert result("F") =~ expr("
+ V(Q,p1,p4)*V(Q,p2,p3)*V(p1,p2,p5)*V(p3,p4,p5)*
replace(p1,q1,p2,q2,p3,q3,p4,q4,p5,q5)
+ V(Q,p1,p4)*V(Q,p2,p3)*V(p1,p2,p5)*V(p3,p4,p5)*
replace(p2,q1,p1,q2,p4,q3,p3,q4,p5,q5)
+ V(Q,p1,p4)*V(Q,p2,p3)*V(p1,p2,p5)*V(p3,p4,p5)*
replace(p3,q1,p4,q2,p1,q3,p2,q4,p5,q5)
+ V(Q,p1,p4)*V(Q,p2,p3)*V(p1,p2,p5)*V(p3,p4,p5)*
replace(p4,q1,p3,q2,p2,q3,p1,q4,p5,q5)
")
*--#] Sta_Identify_1 :
*--#[ Sta_Keep_1 :
CF f,g;
I i1;
S x,y,z;
L F = f(i1,x)*(g(i1,y)+g(i1,z));
B f;
.sort
Keep Brackets;
sum i1;
Print;
.end
assert succeeded?
assert result("F") =~ expr("f(N1_?,x)*g(i1,y)+f(N1_?,x)*g(i1,z)")
*--#] Sta_Keep_1 :
*--#[ Sta_LFactorized_1 :
Symbols x,y,z;
LocalFactorized F1 = 3*(x+y)*(y+z)*((x+z)*(2*x+1));
LocalFactorized F2 = 3*(x+y)*(y+z)+((x+z)*(2*x+1));
Print;
.end
assert succeeded?
assert result("F1") =~ expr("
( 3 )
* ( y + x )
* ( z + y )
* ( z + x + 2*x*z + 2*x^2 )
")
assert result("F2") =~ expr("
( z + 3*y*z + 3*y^2 + x + 5*x*z + 3*x*y + 2*x^2 )
")
*--#] Sta_LFactorized_1 :
*--#[ Sta_MakeInteger_1 :
S a,b,c;
CF f;
L F = f(22/3*a+14/5*b+18/7*c);
MakeInteger,f;
Print +f;
.end
assert succeeded?
assert result("F") =~ expr("2/105*f(135*c + 147*b + 385*a)")
*--#] Sta_MakeInteger_1 :
*--#[ Sta_PolyFun_1 :
Symbol x,y;
CF acc;
PolyFun acc;
Local F = 3*x^2*acc(1+y+y^2)+2*x^2*acc(1-y+y^2);
Print;
.end
assert succeeded?
assert result("F") =~ expr("x^2 * acc(5 + y + 5*y^2)")
*--#] Sta_PolyFun_1 :
*--#[ Sta_PolyRatFun_1 :
S x,y;
CF acc;
PolyRatFun acc;
Local F = 3*x^2*acc(1+y+y^2,1-y)+2*x^2*acc(1-y+y^2,1+y);
P;
.end
assert succeeded?
assert result("F") =~ expr("x^2*acc(-y^3-10*y^2-2*y-5,y^2-1)")
*--#] Sta_PolyRatFun_1 :
*--#[ Sta_PushPopHide_1 :
Local F1 = 1;
.sort
PushHide;
Local F2 = 1;
* This statement does not affect F1:
Multiply 2;
.sort
PushHide;
Local F3 = 1;
* This statement does not affect F1,F2:
Multiply 2;
.sort
PopHide;
* This statement does not affect F1:
Multiply 2;
.sort
PopHide;
* This statement affects all expressions:
Multiply 2;
Print;
.end
assert succeeded?
assert result("F1") =~ expr("2")
assert result("F2") =~ expr("8")
assert result("F3") =~ expr("8")
*--#] Sta_PushPopHide_1 :
*--#[ Sta_PushPopHide_2 :
Local F1 = 1;
.sort
PushHide;
Multiply 2;
.sort
PopHide;
.sort
PopHide;
.end
assert compile_error?("PopHide statement without corresponding PushHide statement")
*--#] Sta_PushPopHide_2 :
*--#[ Sta_Print_1 :
Symbols a,b,c;
Local F = 3*a+2*b;
Print "> %T";
id a = b+c;
Print ">> %t";
Print;
.end
assert succeeded?
assert stdout =~ exact_pattern(<<-'EOF'
> 3*a
>> + 3*b
>> + 3*c
> 2*b
>> + 2*b
EOF
)
assert result("F") =~ expr("3*c + 5*b")
*--#] Sta_Print_1 :
*--#[ Sta_Putinside_1 :
Symbols x, y, z;
Cfunction f;
Local F = 1 + x + 2*x + y^2+ z^3;
Putinside f,x;
Print;
.end
assert succeeded?
assert result("F") =~ expr("
f(2*x) + f(x) + f(1) + f(1)*z^3 + f(1)*y^2")
*--#] Sta_Putinside_1 :
*--#[ Sta_Repeat_1 :
Symbols x, y, z;
CFunction f, g;
Local F = f(x)*g(y)*g(z);
Repeat;
Identify f(?a)*g(?b) = f(?a,?b);
Endrepeat;
Print;
.end
assert succeeded?
assert result("F") =~ expr("f(x,y,z)")
*--#] Sta_Repeat_1 :
*--#[ Sta_ReplaceLoop_1 :
*TODO: change the result in the manual.
Functions f(antisymmetric),ff(cyclesymmetric);
Indices i1,...,i8;
Local F = f(i1,i4,i2)*f(i5,i2,i3)*f(i3,i1,i6)*f(i4,i7,i8);
ReplaceLoop f,arg=3,loop=3,out=ff;
P;
.end
assert succeeded?
assert result("F") =~ expr("- ff(i4,i5,i6)*f(i4,i7,i8)")
*--#] Sta_ReplaceLoop_1 :
*--#[ Sta_ReplaceLoop_2 :
*TODO: change the result in the manual.
Functions f(antisymmetric),ff(cyclesymmetric);
Indices i1,...,i9;
Local F = f(i1,i4,i2)*f(i5,i2,i3)*f(i3,i1,i6)*f(i4,i7,i8)
*f(i6,i7,i8);
ReplaceLoop f,arg=3,loop=all,out=ff;
P;
.end
assert succeeded?
assert result("F") =~ expr("- f(i1,i2,i4)*f(i2,i3,i5)*f(i1,i3,i6)*ff(i4,i6)")
*--#] Sta_ReplaceLoop_2 :
*--#[ Sta_Shuffle_1 :
CF f,ff,g;
S a,b,c,d,x1,x2;
Local F1 = ff*f(a,b)*f(c,d);
Local F2 = g(a,b)*g(c,d);
repeat id f(x1?,?a)*f(x2?,?b)*ff(?c) =
+f(?a)*f(x2,?b)*ff(?c,x1)
+f(x1,?a)*f(?b)*ff(?c,x2);
id f(?a)*f(?b)*ff(?c) = f(?c,?a,?b);
shuffle,g;
Print;
.end
assert succeeded?
assert result("F1") =~ expr("f(a,b,c,d)+f(a,c,b,d)+f(a,c,d,b)+f(c,a,b,d)+f(c,a,d,b)+f(c,d,a,b)")
assert result("F2") =~ expr("g(a,b,c,d)+g(a,c,b,d)+g(a,c,d,b)+g(c,a,b,d)+g(c,a,d,b)+g(c,d,a,b)")
*--#] Sta_Shuffle_1 :
*--#[ Sta_Setexitflag_1 :
CFunction f;
Symbol x;
Local test = +...+;
Identify f(x?even_) = x;
If (Match(f(x?)));
Print "Error: unreplaced f: %t";
SetExitFlag;
EndIf;
.sort
Print;
.end
# For now, this hangs in ParFORM and is not valgrind clean for tform
#pend_if mpi? || ( valgrind? && threaded? )
assert succeeded?
assert stdout =~ exact_pattern("
Error: unreplaced f: + f(1)
Error: unreplaced f: + f(3)
Error: unreplaced f: + f(5)
")
*--#] Sta_Setexitflag_1 :
*--#[ Sta_Splitarg_1 :
CFunction f;
Symbol a,b,c,d;
Local test = f(a+b-5*c*d);
SplitArg f;
Print;
.end
assert succeeded?
assert result("test") =~ expr("f( - 5*c*d,b,a)")
*--#] Sta_Splitarg_1 :
*--#[ Sta_Splitarg_2 :
CFunction f,g,h;
Symbol x,y;
Local test = f(2 + 3*x + 4*x^2) + g(2 + 3*x + 4*x^2) + h(x + x*y + x^2*y);
SplitArg (x) f;
SplitArg (x^2) g;
SplitArg (x*y) h;
Print;
.end
assert succeeded?
assert result("test") =~ expr("f(2 + 4*x^2,3*x) + g(2 + 3*x,4*x^2) + h(x + x^2*y,x*y)")
*--#] Sta_Splitarg_2 :
*--#[ Sta_Splitarg_3 :
CFunction f;
Symbol x,y;
Local test = f(2 + 3*x + 4*x^2 + 5*x*y + 6*y);
SplitArg ((x)) f;
Print;
.end
assert succeeded?
assert result("test") =~ expr("f(2 + 6*y,3*x,5*x*y,4*x^2)")
*--#] Sta_Splitarg_3 :
*--#[ Sta_Splitfirstarg_1 :
CFunction f;
Symbol x;
Local test = f(1 + x + x^2 + x^3);
SplitFirstArg f;
Print;
.end
assert succeeded?
assert result("test") =~ expr("f(x + x^2 + x^3,1)")
*--#] Sta_Splitfirstarg_1 :
*--#[ Sta_Splitlastarg_1 :
CFunction f;
Symbol x;
Local test = f(1 + x + x^2 + x^3);
SplitLastArg f;
Print;
.end
assert succeeded?
assert result("test") =~ expr("f(1 + x + x^2,x^3)")
*--#] Sta_Splitlastarg_1 :
*--#[ Sta_Stuffle_1 :
CF S,R;
Symbols N,n;
L F = S(R(1,-3),N)*S(R(-5,1),N);
id S(R(?a),n?)*S(R(?b),n?) = S(?a)*S(?b)*R(n);
Stuffle,S-;
id S(?a)*R(n?) = S(R(?a),n);
Print +s;
.end
assert succeeded?
assert result("F") =~ expr(<<-'EOF'
+ S(R(-6,-4),N)
- S(R(-6,-3,1),N)
- S(R(-6,1,-3),N)
- S(R(-5,1,-4),N)
+ S(R(-5,1,-3,1),N)
+ 2*S(R(-5,1,1,-3),N)
- S(R(-5,2,-3),N)
- S(R(1,-5,-4),N)
+ S(R(1,-5,-3,1),N)
+ S(R(1,-5,1,-3),N)
+ S(R(1,-3,-5,1),N)
- S(R(1,8,1),N)
EOF
)
*--#] Sta_Stuffle_1 :
*--#[ Sta_Sum_1 :
CFunction f;
Index mu,nu;
Local test1 = f(mu,mu);
Local test2 = f(mu,nu);
Local test3 = f(mu,nu)*f(mu,nu);
Sum mu,0,1,2, nu,0,1,2;
Print;
.end
assert succeeded?
assert result("test1") =~ expr("f(0,0) + f(1,1) + f(2,2)")
assert result("test2") =~ expr("f(0,0) + f(0,1) + f(0,2) + f(1,0) + f(1,1) + f(1,2) + f(2,0) + f(2,1) + f(2,2)")
assert result("test3") =~ expr("f(0,0)^2 + f(0,1)^2 + f(0,2)^2 + f(1,0)^2 + f(1,1)^2 + f(1,2)^2 + f(2,0)^2 + f(2,1)^2 + f(2,2)^2")
*--#] Sta_Sum_1 :
*--#[ Sta_Sum_2 :
CFunction f,g;
Index mu,nu;
Local test1 = f(mu,nu)*g(mu,nu);
Local test2 = f(N2_?,N1_?)*g(N2_?,N1_?);
Sum mu,nu;
Print;
.end
assert succeeded?
assert result("test1") =~ expr("f(N1_?,N2_?)*g(N1_?,N2_?)")
assert result("test2") =~ expr("f(N1_?,N2_?)*g(N1_?,N2_?)")
*--#] Sta_Sum_2 :
*--#[ Sta_Sum_3 :
CFunction f,g;
Index mu,nu;
Local test = f(mu,nu)*g(mu,nu);
Sum mu, nu,0,1,2;
Print;
.end
assert succeeded?
assert result("test") =~ expr("f(N1_?,0)*g(N1_?,0) + f(N1_?,1)*g(N1_?,1) + f(N1_?,2)*g(N1_?,2)")
*--#] Sta_Sum_3 :
*--#[ Sta_Term_1 :
CFunction f;
Symbol x;
Local test = f(10);
Term;
Repeat Identify f(x?{>1}) = f(x-1) + f(x-2);
EndTerm;
Print;
.end
assert succeeded?
assert result("test") =~ expr("34*f(0) + 55*f(1)")
*--#] Sta_Term_1 :
*--#[ Sta_ToTensor_1 :
*NOTE: "functions" option is needed.
Vector p,p1,p2;
Function f;
Index mu;
Tensor tt,t;
Local F = p.p1^2*f(p,p1)*p(mu)*tt(p1,p,p2,p);
ToTensor functions, p,t;
Print;
.end
assert succeeded?
assert result("F") =~ expr("
f(N1_?,p1)*tt(p1,N2_?,p2,N3_?)*t(p1,p1,mu,N1_?,N2_?,N3_?)
")
*--#] Sta_ToTensor_1 :
*--#[ Sta_ToVector_1 :
Tensor t1,t2;
Vector v1,v2;
Index mu1,mu2,mu3;
Local test = t1(mu1,mu2,mu3) + t2(mu1,mu2,mu3);
ToVector t1,v1;
ToVector v2,t2;
Print;
.end
assert succeeded?
assert result("test") =~ expr("v1(mu1)*v1(mu2)*v1(mu3) + v2(mu1)*v2(mu2)*v2(mu3)")
*--#] Sta_ToVector_1 :
*--#[ Sta_Transform_1 :
Symbol x,x1,x2;
CF H,H1;
Off Statistics;
L F = H(3,4,2,6,1,1,1,2);
Transform,H,explode(1,last),
replace(1,last)=(0,1,1,0),
encode(1,last):base=2;
Print;
.end
assert succeeded?
assert result("F") =~ expr("H(907202)")
*--#] Sta_Transform_1 :
*--#[ Sta_Transform_2 :
Symbol x,x1,x2;
CF H,H1;
Off Statistics;
L F = H(3,4,2,6,1,1,1,2);
repeat id H(?a,x?!{0,1},?b) = H(?a,0,x-1,?b);
Print;
.sort
Multiply H1;
repeat id H(x?,?a)*H1(?b) = H(?a)*H1(?b,1-x);
id H1(?a)*H = H(?a);
Print;
.sort
repeat id H(x1?,x2?,?a) = H(2*x1+x2,?a);
Print;
.end
assert succeeded?
assert result("F") =~ expr("H(907202)")
*--#] Sta_Transform_2 :
*--#[ Sta_Transform_3 :
Symbol a;
Vector p;
CFunction f1,f2;
Local test = f1(0,1) + f2(2,a) + f2(2,p);
Transform f1 replace(1,last)=(0,1,1,0);
* This will not affect f2(2,p) because xarg_ does not match vectors:
Transform f2 replace(1,last)=(xarg_,2*xarg_+1);
Print;
.end
assert succeeded?
assert result("test") =~ expr("f1(1,0) + f2(5,1 + 2*a) + f2(5,p)")
*--#] Sta_Transform_3 :
*--#[ Sta_Transform_4 :
CFunction f2,f3;
Local test = f2(1,1,0,1) + f3(1,1,0,1);
Transform f2 encode(1,last):base=2;
Transform f3 encode(1,last):base=3;
Print;
.end
assert succeeded?
assert result("test") =~ expr("f2(13) + f3(37)")
*--#] Sta_Transform_4 :
*--#[ Sta_Transform_5 :
CFunction f2,f3,F2,F3;
Local test = f2(13) + f2(100) + f3(37) + F2(13) + F3(37);
Transform f2 decode(1,5):base=2;
Transform f3 decode(1,5):base=3;
Transform F2 decode(5,1):base=2;
Transform F3 decode(5,1):base=3;
Print;
.end
assert succeeded?
assert result("test") =~ expr("f2(0,1,1,0,1) + f2(100) + f3(0,1,1,0,1) + F2(1,0,1,1,0) + F3(1,0,1,1,0)")
*--#] Sta_Transform_5 :
*--#[ Sta_Transform_6 :
CFunction f;
Symbol a;
Local test = f(0,0,1,0,a,0,0,0,-1);
Transform f implode(1,last);
Print;
.end
assert succeeded?
assert result("test") =~ expr("f(3,2*a,-4)")
*--#] Sta_Transform_6 :
*--#[ Sta_Transform_7 :
CFunction f;
Symbol a;
Local test = f(3,2*a,-4);
Transform f explode(1,last);
Print;
.end
assert succeeded?
assert result("test") =~ expr("f(0,0,1,0,a,0,0,0,-1)")
*--#] Sta_Transform_7 :
*--#[ Sta_Transform_8 :
CFunction f,cyc;
Symbol a1,...,a7;
Local test = f(a1,a2,a3,a4,a5,a6,a7)*cyc(2,6);
Identify cyc(?a$cyc) = 1;
Transform f permute(1,3,5)($cyc);
ModuleOption local $cyc;
Print;
.end
assert succeeded?
assert result("test") =~ expr("f(a3,a6,a5,a4,a1,a2,a7)")
*--#] Sta_Transform_8 :
*--#[ Sta_Transform_9 :
CFunction f;
Local test = f(1,...,10);
Transform f reverse(3,7);
Print;
.end
assert succeeded?
assert result("test") =~ expr("f(1,2,7,6,5,4,3,8,9,10)")
*--#] Sta_Transform_9 :
*--#[ Sta_Transform_10 :
CFunction f,g;
Function h,i;
Symbol x;
Vector p;
Index mu;
Local test = f(100,g(1),g(2)^2,x,x^2,mu,p,p.p,1/p.p,h*i,i*h);
Identify f(?a) = f(?a,?a);
Transform f dedup(1,last);
Print;
.end
assert succeeded?
assert result("test") =~ expr("f(100,g(1),g(2)^2,x,x^2,mu,p,p.p,p.p^-1,h*i,i*h)")
*--#] Sta_Transform_10 :
*--#[ Sta_Transform_11 :
CFunction f,g,h;
Local test = f(1,...,9) + g(1,...,9) + h(1,...,9);
Transform f cycle(3,7)=-1;
Transform g permute(3,...,7);
Transform h cycle(3,7)=+2;
Print;
.end
assert succeeded?
assert result("test") =~ expr("f(1,2,4,5,6,7,3,8,9) + g(1,2,4,5,6,7,3,8,9) + h(1,2,6,7,3,4,5,8,9)")
*--#] Sta_Transform_11 :
*--#[ Sta_Transform_11b :
CFunction h;
Local test = h(1,...,9);
Transform h cycle(3,7)=2;
Print;
.end
assert compile_error?("Cycle in a Transform statement should be followed by =+/-number/$")
*--#] Sta_Transform_11b :
*--#[ Sta_Transform_12 :
CFunction f;
Symbol y,n;
Local test = f(0) + f(1) + f(0,1) + f(0,0,1) + f(0,1,1)
+ f(0,0) + f(1,0) + f(1,1) + f(1,0,0) + f(0,1,0) + f(1,0,1);
Transform f islyndon(1,last)=(y,n);
Print;
.end
assert succeeded?
assert result("test") =~ expr("f(0)*y + f(0,0)*n + f(0,0,1)*y + f(0,1)*y + f(0,1,0)*n + f(0,1,1)*y + f(1)*y + f(1,0)*n + f(1,0,0)*n + f(1,0,1)*n + f(1,1)*n")
*--#] Sta_Transform_12 :
*--#[ Sta_Transform_13 :
CFunction f;
Symbol y,n;
Local test = f(0) + f(1) + f(0,1) + f(0,0,1) + f(0,1,1)
+ f(0,0) + f(1,0) + f(1,1) + f(1,0,0) + f(0,1,0) + f(1,0,1);
Transform f tolyndon(1,last)=(y,n);
Print;
.end
assert succeeded?
assert result("test") =~ expr("f(0)*y + f(0,0)*n + 3*f(0,0,1)*y + 2*f(0,1)*y + 2*f(0,1,1)*y + f(1)*y + f(1,1)*n")
*--#] Sta_Transform_13 :
*--#[ Sta_Transform_14 :
CFunction f;
Symbol x;
Local test = f(,...,);
Transform f addargs(1,last);
Print;
.end
assert succeeded?
assert result("test") =~ expr("f(x + x^2 + x^3 + x^4 + x^5)")
*--#] Sta_Transform_14 :
*--#[ Sta_Transform_15 :
CFunction f;
Symbol x;
Local test = f(,...,);
Transform f mulargs(1,last);
Print;
.end
assert succeeded?
assert result("test") =~ expr("f(x^15)")
*--#] Sta_Transform_15 :
*--#[ Sta_Transform_16 :
CFunction f,g;
Symbol x;
Local test = f(1,...,5) + g(1,...,5);
Transform f dropargs(2,4);
Transform g dropargs(1,last);
Print;
.end
assert succeeded?
assert result("test") =~ expr("f(1,5) + g")
*--#] Sta_Transform_16 :
*--#[ Sta_Transform_17 :
CFunction f,g;
Symbol x;
Local test = f(1,...,5) + g(1,...,5);
Transform f selectargs(2,4);
Transform g selectargs(1,last);
Print;
.end
assert succeeded?
assert result("test") =~ expr("f(2,3,4) + g(1,2,3,4,5)")
*--#] Sta_Transform_17 :
*--#[ Sta_TryReplace_1 :
Symbol x,y,z;
Local test = x+z;
* These will replace x by y but not z by y, because z
* comes before y in the default sort ordering:
TryReplace x,y;
TryReplace z,y;
Print;
.end
assert succeeded?
assert result("test") =~ expr("z+y")
*--#] Sta_TryReplace_1 :
*--#[ Sta_While_1 :
Symbol x,y,z;
Local Fx = (1+x)^6;
Local Fy = (1+y)^6;
Local Fz = (1+z)^6;
While (Count(x,1) > 3);
Multiply 1/x;
EndWhile;
Repeat;
If (Count(y,1) > 3);
Multiply 1/y;
EndIf;
EndRepeat;
While (Count(z,1) > 3) Multiply 1/z;
Print;
.end
assert succeeded?
assert result("Fx") =~ expr("1 + 6*x + 15*x^2 + 42*x^3");
assert result("Fy") =~ expr("1 + 6*y + 15*y^2 + 42*y^3");
assert result("Fz") =~ expr("1 + 6*z + 15*z^2 + 42*z^3");
*--#] Sta_While_1 :
*--#[ Fun_distrib_1 :
Symbols x1,...,x4;
CFunctions f,f1,f2;
Local F = f(x1,...,x4);
id f(?a) = distrib_(-1,2,f1,f2,?a);
Print +s;
.end
assert succeeded?
assert result("F") =~ expr("
+ f1(x1,x2)*f2(x3,x4)
- f1(x1,x3)*f2(x2,x4)
+ f1(x1,x4)*f2(x2,x3)
+ f1(x2,x3)*f2(x1,x4)
- f1(x2,x4)*f2(x1,x3)
+ f1(x3,x4)*f2(x1,x2)
")
*--#] Fun_distrib_1 :
*--#[ Fun_exteuclidean_1 :
Symbols x1,x2,x3,x4;
Local F = exteuclidean_(54,84);
Print;
.sort
id exteuclidean_(x1?,x2?,x3?,x4?) = x1*x3+x2*x4;
Print;
.end
assert succeeded?
assert result("F", 0) =~ expr("exteuclidean_(54,84,-3,2)")
assert result("F", 1) =~ expr("6")
*--#] Fun_exteuclidean_1 :
*--#[ Fun_exteuclidean_2 :
Symbols x1,x2,x3,x4,a,b;
Local F = exteuclidean_(97,101);
Print;
.sort
id exteuclidean_(x1?,x2?,x3?,x4?) = x1*x3+x2*x4
+a*mod2_(1/97,101)+b*mod2_(1/101,97);
Print;
.end
assert succeeded?
assert result("F", 0) =~ expr("exteuclidean_(97,101,25,-24)")
assert result("F", 1) =~ expr("1 - 24*b + 25*a")
*--#] Fun_exteuclidean_2 :
*--#[ Fun_makerational_1 :
#$m = prime_(1);
#write <> "The prime number is %$",$m
L F = MakeRational_(12345678,$m);
Print;
.sort
Modulus `$m';
Print;
.end
assert succeeded?
if wordsize == 2
assert stdout =~ /The prime number is 32719/
assert result("F", 0) =~ expr("127/37")
assert result("F", 1) =~ expr("10615")
elsif wordsize == 4
assert stdout =~ /The prime number is 2147483587/
assert result("F", 0) =~ expr("9719/38790")
assert result("F", 1) =~ expr("12345678")
end
*--#] Fun_makerational_1 :
*--#[ Fun_perm_1 :
CFunction f;
Symbols x1,...,x3;
Local F = perm_(f,x1,x2,x3);
Print +s;
.end
assert succeeded?
assert result("F") =~ expr("""
+ f(x1,x2,x3)
+ f(x1,x3,x2)
+ f(x2,x1,x3)
+ f(x2,x3,x1)
+ f(x3,x1,x2)
+ f(x3,x2,x1)
""")
*--#] Fun_perm_1 :
*--#[ Fun_prime_1 :
Symbols x1,x2,x3,x4;
ON highfirst;
Local F = x1*prime_(1)+x2*prime_(2)
+x3*prime_(3)+x4*prime_(4);
Print;
.end
assert succeeded?
if wordsize == 2
assert result("F") =~ expr("32719*x1 + 32717*x2 + 32713*x3 + 32707*x4")
elsif wordsize == 4
assert result("F") =~ expr("2147483587*x1 + 2147483579*x2 + 2147483563*x3 + 2147483549*x4")
end
*--#] Fun_prime_1 :
*--#[ Fun_putfirst_1 :
S a,a1,...,a10;
CF f,g;
L F = g(a,a1,...,a10);
id g(?a) = putfirst_(f,4,?a);
Print;
.end
assert succeeded?
assert result("F") =~ expr("
f(a3,a,a1,a2,a4,a5,a6,a7,a8,a9,a10)
")
*--#] Fun_putfirst_1 :
*--#[ Fun_ranperm_1 :
Function f;
Symbols x1,...,x5;
Local F = ranperm_(f,1,2,3,4,5,6)
+ranperm_(f,x1,x2,x3+x1,x4,x5);
Print +s;
.end
assert succeeded?
# We can't predict the results!
*--#] Fun_ranperm_1 :
*--#[ Fun_sump_1 :
Symbol i,x;
Local F = sump_(i,0,5,x/i);
Print;
.end
assert succeeded?
assert result("F") =~ expr("1 + x + 1/2*x^2 + 1/6*x^3 + 1/24*x^4 + 1/120*x^5")
*--#] Fun_sump_1 :
*--#[ Brackets_1 :
Symbols a,b,c,x;
L F = a*x^2+b*x+c;
B x;
.sort
L Discriminant = F[x]^2-4*F[x^2]*F[1];
Print;
.end
assert succeeded?
assert result("Discriminant") =~ pattern("b^2-4*a*c");
*--#] Brackets_1 :
*--#[ PolyandFact_1 :
Symbol x,y;
CFunction rat;
PolyRatFun rat;
L F = rat(x+y,x-y)+rat(x-y,x+y);
Print;
.end
assert succeeded?
assert result("F") =~ expr("rat(2*x^2 + 2*y^2,x^2 - y^2)")
*--#] PolyandFact_1 :
*--#[ PolyandFact_2 :
* TODO: change the result in the manual.
Symbol x,y;
CFunction f1,f2;
Local F = f1(x^4-y^4)+f2(3*y^4-3*x^4);
FactArg,f1,f2;
Print;
.end
assert succeeded?
assert result("F") =~ expr("f1(-1,y - x,y + x,y^2 + x^2) + f2(3,y - x,y + x,y^2 + x^2)")
*--#] PolyandFact_2 :
*--#[ PolyandFact_3 :
* TODO: change the the first result in the manual.
Symbol x,y;
CFunction f1,f2;
Local F = f2(3*y^4-3*x^4);
FactArg,f2;
Print;
.sort
ChainOut,f2;
id f2(x?number_) = x;
Print;
.end
assert succeeded?
assert result("F", 0) =~ expr("f2(3,y - x,y + x,y^2 + x^2)")
assert result("F", 1) =~ expr("3*f2(y-x)*f2(y+x)*f2(y^2+x^2)")
*--#] PolyandFact_3 :
*--#[ PolyandFact_4 :
Symbol x,y;
Local F = x^4-y^4;
Print;
.sort
Print;
Factorize F;
.end
assert succeeded?
assert result("F", 0) =~ expr("-y^4+x^4")
assert result("F", 1) =~ expr("(-1)*(y-x)*(y+x)*(y^2+x^2)")
*--#] PolyandFact_4 :
*--#[ PolyandFact_5 :
* TODO: change the the result of F2 in the manual.
Symbol x,y;
Local F1 = x^4-y^4;
Local F2 = 0;
Local F3 = 1;
Local F4 = x^4-y^4;
Print;
Factorize F1,F2,F3;
.sort
#do i = 1,4
#$n`i' = numfactors_(F`i');
#message expression F`i' has `$n`i'' factors
#enddo
.end
assert succeeded?
assert result("F1") =~ expr("(-1)*(y-x)*(y+x)*(y^2+x^2)")
assert result("F2") =~ expr("(0)")
assert result("F3") =~ expr("(1)")
assert result("F4") =~ expr("-y^4+x^4")
assert stdout =~ /~~~expression F1 has 4 factors/
assert stdout =~ /~~~expression F2 has 1 factors/
assert stdout =~ /~~~expression F3 has 1 factors/
assert stdout =~ /~~~expression F4 has 0 factors/
*--#] PolyandFact_5 :
*--#[ PolyandFact_6 :
Symbol x,y;
Local F = x^4-y^4;
Factorize F;
.sort
#$n = numfactors_(F);
#do i = 1,`$n'
Local F`i' = F[factor_^`i'];
#enddo
Print;
.end
assert succeeded?
assert result("F") =~ expr("(-1)*(y-x)*(y+x)*(y^2+x^2)")
assert result("F1") =~ expr("-1")
assert result("F2") =~ expr("y-x")
assert result("F3") =~ expr("y+x")
assert result("F4") =~ expr("y^2+x^2")
*--#] PolyandFact_6 :
*--#[ PolyandFact_7 :
Symbol x,y;
LocalFactorize E = -(x+1)*(x+2)*((x+3)*(x+4));
Print;
.end
assert succeeded?
assert result("E") =~ expr("
( - 1 )
* ( 1 + x )
* ( 2 + x )
* ( 12 + 7*x + x^2 )
")
*--#] PolyandFact_7 :
*--#[ PolyandFact_8 :
Symbol x,y;
LocalFactorize E = -(x+1)*(x+2)*((x+3)*(x+4));
Local F = -(x+1)*(x+2)*((x+3)*(x+4));
Print;
.sort
LF G = (x-1)*(x+2)^2*E^2*F^2;
Print G;
.end
assert succeeded?
assert result("E") =~ expr("
(-1)
*(1+x)
*(2+x)
*(12+7*x+x^2)
")
assert result("F") =~ expr("
-24-50*x-35*x^2-10*x^3-x^4
")
assert result("G") =~ expr("
(-1+x)
*(2+x)
*(2+x)
*(-1)
*(1+x)
*(2+x)
*(12+7*x+x^2)
*(-1)
*(1+x)
*(2+x)
*(12+7*x+x^2)
*(-24-50*x-35*x^2-10*x^3-x^4)
*(-24-50*x-35*x^2-10*x^3-x^4)
")
*--#] PolyandFact_8 :
*--#[ PolyandFact_9 :
Symbol x,y;
LocalFactorize E = -(x+1)*(x+2)*((x+3)*(x+4));
Local F = -(x+1)*(x+2)*((x+3)*(x+4));
.sort
LF G = (x-1)*(x+2)^2*E^2*F^2;
Print G;
Factorize G;
.end
assert succeeded?
assert result("G") =~ expr("
(-1+x)
*(1+x)
*(1+x)
*(1+x)
*(1+x)
*(2+x)
*(2+x)
*(2+x)
*(2+x)
*(2+x)
*(2+x)
*(3+x)
*(3+x)
*(3+x)
*(3+x)
*(4+x)
*(4+x)
*(4+x)
*(4+x)
")
*--#] PolyandFact_9 :
*--#[ PolyandFact_10 :
Symbol x,y;
LocalFactorize E = -0*(x+1)*(x+2)*0*((x+3)*(x+4));
Print;
.end
assert succeeded?
assert result("E") =~ expr("
(-1)
*(0)
*(1+x)
*(2+x)
*(0)
*(12+7*x+x^2)
")
*--#] PolyandFact_10 :
*--#[ PolyandFact_11 :
Symbol x,y;
Format Nospaces;
LocalFactorize E = -0*3*(x+1)*(x+2)/2*0*((x+3)*(x+4));
Print;
.sort
Print;
Factorize(keepzero) E;
.end
assert succeeded?
assert result("E", 0) =~ expr("
(-1)
*(0)
*(3)
*(1+x)
*(2+x)
*(1/2)
*(0)
*(12+7*x+x^2)
")
assert result("E", 1) =~ expr("
(0)
*(-3/2)
*(1+x)
*(2+x)
*(3+x)
*(4+x)
")
*--#] PolyandFact_11 :
*--#[ PolyandFact_12 :
Symbol x,y;
LFactorized F = (x+1)*(x+y)*(y+1);
Print;
.sort
Print;
Bracket x;
UnFactorize F;
.end
assert succeeded?
assert result("F", 0) =~ expr("
(1+x)
*(y+x)
*(1+y)
")
assert result("F", 1) =~ expr("
+x*(1+2*y+y^2)
+x^2*(1+y)
+y+y^2
")
*--#] PolyandFact_12 :
*--#[ PolyandFact_13 :
Symbol x,y;
LFactorized F = (x+1)*(x+y)*(y+1);
Print;
.sort
#$num = numfactors_(F);
Local G = *...*;
Bracket x;
Print;
.end
assert succeeded?
assert result("F", 0) =~ expr("
(1+x)
*(y+x)
*(1+y)
")
assert result("F", 1) =~ expr("
(1+x)
*(y+x)
*(1+y)
")
assert result("G") =~ expr("
+x*(1+2*y+y^2)
+x^2*(1+y)
+y+y^2
")
*--#] PolyandFact_13 :
*--#[ PolyandFact_14 :
Symbol x,y;
CFunction f;
Off Statistics;
#$a = x^4-y^4;
Local F = f(x^4-y^4)+f(x^6-y^6);
Print;
.sort
#factdollar $a;
#do i = 1,`$a[0]'
#write <> "Factor `i' of `$a' is `$a[`i']'"
#enddo
id f(x?$b) = f(x);
FactDollar $b;
do $i = 1,$b[0];
Print "Factor %$ of %$ is %$",$i,$b,$b[$i];
enddo;
Print;
ModuleOption noparallel; * suppresses noparallel warning
.end
assert succeeded?
assert result("F", 0) =~ expr("
f(-y^4+x^4)+f(-y^6+x^6)
")
assert result("F", 1) =~ expr("
f(-y^4+x^4)+f(-y^6+x^6)
")
assert stdout =~ exact_pattern("
Factor 1 of -y^4+x^4 is -1
#enddo
Factor 2 of -y^4+x^4 is y-x
Factor 3 of -y^4+x^4 is y+x
Factor 4 of -y^4+x^4 is y^2+x^2
id f(x?$b) = f(x);
")
assert stdout =~ exact_pattern("
Factor 1 of - y^4 + x^4 is - 1
Factor 2 of - y^4 + x^4 is y - x
Factor 3 of - y^4 + x^4 is y + x
Factor 4 of - y^4 + x^4 is y^2 + x^2
Factor 1 of - y^6 + x^6 is - 1
Factor 2 of - y^6 + x^6 is y - x
Factor 3 of - y^6 + x^6 is y + x
Factor 4 of - y^6 + x^6 is y^2 - x*y + x^2
Factor 5 of - y^6 + x^6 is y^2 + x*y + x^2
")
*--#] PolyandFact_14 :
*--#[ PolyandFact_15 :
Symbol x,y;
CFunction f;
Format Nospaces;
#$a = x^4-y^4;
#factdollar $a;
Local F = f(numfactors_($a))
+f(<$a[1]>,...,<$a[`$a[0]']>);
Print;
.end
assert succeeded?
assert result("F", 0) =~ expr("
f(-1,y-x,y+x,y^2+x^2)+f(4)
")
*--#] PolyandFact_15 :
*--#[ PolyandFact_16 :
Symbol x,y;
Format NoSpaces;
On ShortStats;
Local F1 = x^60-1;
Local F2 = y^60-x^60;
Factorize F1,F2;
Print;
.end
if wordsize < 4
# ERROR: polynomials too large (> WORDSIZE)
else
assert succeeded?
assert result("F1") =~ expr("
(-1+x)
*(1-x+x^2)
*(1-x+x^2-x^3+x^4)
*(1-x+x^3-x^4+x^5-x^7+x^8)
*(1+x)
*(1+x+x^2)
*(1+x+x^2+x^3+x^4)
*(1+x-x^3-x^4-x^5+x^7+x^8)
*(1-x^2+x^4)
*(1-x^2+x^4-x^6+x^8)
*(1+x^2)
*(1+x^2-x^6-x^8-x^10+x^14+x^16)
")
assert result("F2") =~ expr("
(y-x)
*(y+x)
*(y^2-x*y+x^2)
*(y^4-x*y^3+x^2*y^2-x^3*y+x^4)
*(y^4+x*y^3+x^2*y^2+x^3*y+x^4)
*(y^2+x*y+x^2)
*(y^2+x^2)
*(y^8-x*y^7+x^3*y^5-x^4*y^4+x^5*y^3-x^7*y+x^8)
*(y^8+x*y^7-x^3*y^5-x^4*y^4-x^5*y^3+x^7*y+x^8)
*(y^8-x^2*y^6+x^4*y^4-x^6*y^2+x^8)
*(y^4-x^2*y^2+x^4)
*(y^16+x^2*y^14-x^6*y^10-x^8*y^8-x^10*y^6+x^14*y^2+x^16)
")
end
*--#] PolyandFact_16 :
*--#[ PolyandFact_17 :
Symbols a,b;
LF F = (a+b)^2;
multiply 2;
Print;
.end
assert succeeded?
assert result("F") =~ expr("
( 2*b + 2*a )
* ( 2*b + 2*a )
")
*--#] PolyandFact_17 :
*--#[ PolyandFact_18 :
Symbols a,b;
LF F = (a+b)^2;
.sort
LF F = 2*F;
Print;
.end
assert succeeded?
assert result("F") =~ expr("
( 2 )
* ( b + a )
* ( b + a )
")
*--#] PolyandFact_18 :
*--#[ OutputOptimization_1 :
CF f;
S a,b,c;
L H = f(a)+f(b)+(a+b+c)^2;
L G = f(c)+(a+b+c)^3;
Format O2;
Print +f;
.sort
ExtraSymbols,array,w;
Format Fortran;
#optimize G
#write " REAL*8 w(`optimmaxvar_')"
#write "%O"
#write " G = %e",G
#clearoptimize
.sort
#optimize H
#write " REAL*8 w(`optimmaxvar_')"
#write "%O"
#write " H = %e",H
.end
assert succeeded?
if serial?
# TFORM may optimize the expressions in a different way.
assert file("outg.f") == <<-'EOF'
REAL*8 w(4)
w(1)=f(c)
w(2)=c**2
w(3)=3*c + b
w(3)=b*w(3)
w(3)=3*w(2) + w(3)
w(3)=b*w(3)
w(4)=2*c + b
w(4)=b*w(4)
w(2)=w(2) + w(4)
w(4)=c + b
w(4)=3*w(4) + a
w(4)=a*w(4)
w(2)=3*w(2) + w(4)
w(2)=a*w(2)
w(4)=c**3
G = w(1) + w(2) + w(3) + w(4)
EOF
assert file("outh.f") == <<-'EOF'
REAL*8 w(5)
w(1)=f(a)
w(2)=f(b)
w(3)=c**2
w(4)=2*c + b
w(4)=b*w(4)
w(5)=c + b
w(5)=2*w(5) + a
w(5)=a*w(5)
H = w(1) + w(2) + w(3) + w(4) + w(5)
EOF
end
*--#] OutputOptimization_1 :
*--#[ Dictionaries_1 :
Symbols x1,y2,z3,N;
Indices mu,nu,ro,si;
Tensor tens;
CFunction S,R,f;
ExtraSymbols array w;
#OpenDictionary test
#add x1: "x_1"
#add y2: "y^{(2)}"
#add z3: "{\cal Z}"
#add *: " "
#add S(R(1),N): "S_1(N)"
#add S(R(2),N): "S_2(N)"
#add S(R(1,1),N): "S_{1,1}(N)"
#add f: "\ln"
#add mu: "\mu"
#add nu: "\nu"
#add ro: "\rho"
#add si: "\sigma"
#add tens: "T"
#CloseDictionary
Local F = x1*y2*z3
+ S(R(1),N) + S(R(1,1),N) + S(R(2),N)
+ tens(mu,nu,ro,si) + f(x1+1);
#usedictionary test
Print +s;
.end
assert succeeded?
assert result("F") =~ expr("
+ x_1 y^2 {\\cal Z}
+ T(\\mu,\\nu,\\rho,\\sigma)
+ S_1(N)
+ S_{1,1}(N)
+ S_2(N)
+ \\ln(1 + x_1)
")
*--#] Dictionaries_1 :
*--#[ Dictionaries_2 :
Symbol x,n;
Format DoubleFortran;
#OpenDictionary numbers
#add 2: "TWO"
#add 5: "FIVE"
#add 7: "SEVEN"
#CloseDictionary
Local F = (1+x)^7/7;
id x^n? = x*x^n/(n+1);
#UseDictionary numbers
Print;
.end
assert succeeded?
assert stdout =~ exact_pattern("
F =
& 1/SEVEN*x + 1/TWO*x**2 + x**3 + FIVE/4*x**4 + x**5 + 1/TWO*x**6
& + 1/SEVEN*x**7 + 1.D0/56.D0*x**8
")
*--#] Dictionaries_2 :
*--#[ Dictionaries_3 :
Symbol x,n;
Format DoubleFortran;
#OpenDictionary numbers
#add 2: "TWO"
#add 5: "FIVE"
#add 7: "SEVEN"
#add 1/2: "HALF"
#CloseDictionary
Local F = (1+x)^7/7;
id x^n? = x*x^n/(n+1);
#UseDictionary numbers
Print;
.end
assert succeeded?
assert stdout =~ exact_pattern("
F =
& 1/SEVEN*x + HALF*x**2 + x**3 + FIVE/4*x**4 + x**5 + HALF*x**6 +
& 1/SEVEN*x**7 + 1.D0/56.D0*x**8
")
*--#] Dictionaries_3 :
*--#[ Dictionaries_4 :
Symbol x,n;
Format DoubleFortran;
#OpenDictionary numbers
#add 2: "TWO"
#add 5: "FIVE"
#add 7: "SEVEN"
#add 1/2: "HALF"
#CloseDictionary
Local F = (1+x)^7/7;
id x^n? = x*x^n/(n+1);
#UseDictionary numbers (warnings)
Print;
.end
assert succeeded?
assert stdout =~ exact_pattern("
F =
& 1/SEVEN*x + HALF*x**2 + x**3 + FIVE/4*x**4 + x**5 + HALF*x**6 +
>>>>>>>>Could not translate coefficient with dictionary numbers<<<<<<<<<
<<<
& 1/SEVEN*x**7 + 1.D0/56.D0*x**8
")
*--#] Dictionaries_4 :
*--#[ Dictionaries_5 :
Symbol x,n;
Format DoubleFortran;
#OpenDictionary numbers
#add 2: "cd2"
#add 5: "cd5"
#add 7: "cd7"
#add 56: "cd56"
#add 1/2: "c1d2"
#add 5/4: "c5d4"
#CloseDictionary
Local F = (1+x)^7/7;
id x^n? = x*x^n/(n+1);
#UseDictionary numbers (warnings)
Print;
.end
assert succeeded?
assert stdout =~ exact_pattern("
F =
& 1/cd7*x + c1d2*x**2 + x**3 + c5d4*x**4 + x**5 + c1d2*x**6 + 1/
& cd7*x**7 + 1/cd56*x**8
")
*--#] Dictionaries_5 :
*--#[ Dictionaries_6 :
Symbol x;
CFunction f;
#OpenDictionary ranges
#add (1,2): "w(%#)"
#add (3): "ww(%#)"
#add (4,6): "www(%@)"
#CloseDictionary
Local F = +...+;
ToPolynomial;
Print;
.sort
#UseDictionary ranges
Print;
.end
assert succeeded?
assert result("F", 0) =~ expr("
x*Z1_ + x^2*Z2_ + x^3*Z3_ + x^4*Z4_ + x^5*Z5_ + x^6*Z6_
")
assert result("F", 1) =~ expr("
x*w(1) + x^2*w(2) + x^3*ww(3) + x^4*www(1) + x^5*www(2) + x^6*www(3)
")
*--#] Dictionaries_6 :
*--#[ DiracAlgebra_1 :
*
* Symmetric trace of a gamma5 and 12 regular matrices
*
I m1,...,m12;
F G5,g1,g2;
L F = G5(m1,...,m12);
id G5(?a) = distrib_(-1,4,g1,g2,?a);
id g1(?a) = e_(?a);
id g2(?a) = g_(1,?a);
tracen,1;
.end
assert succeeded?
assert stdout =~ /Generated terms = 51975$/
assert stdout =~ /Terms in output = 51975$/
assert bytesize("F") == 459582 * wordsize
*--#] DiracAlgebra_1 :
*--#[ DiracAlgebra_2 :
*
* Regular trace of a gamma5 and 12 regular matrices
*
I m1,...,m12;
L F = g_(1,5_,m1,...,m12);
trace4,1;
.end
assert succeeded?
assert @stdout =~ /Generated terms = 1053$/
assert @stdout =~ /Terms in output = 1029$/
assert bytesize("F") == 10142 * wordsize
*--#] DiracAlgebra_2 :
*--#[ NotesMetric_1 :
Indices m1,m2,m3,n1,n2,n3,i1,i2,i3;
Cfunction eta(symmetric),e(antisymmetric);
Off Statistics;
*
* We have our own Levi-Civita tensor e
*
Local F = e(m1,m2,m3)*e(m1,m2,m3);
*
* We write the contraction as
*
id e(m1?,m2?,m3?)*e(n1?,n2?,n3?) =
e_(m1,m2,m3)*e_(i1,i2,i3)*
eta(n1,i1)*eta(n2,i2)*eta(n3,i3);
*
* Now we can use the internal workings of the contract:
*
Contract;
Print +s;
.sort;
*
* For specifying a metric we need individual components:
*
Sum i1,1,2,3;
Sum i2,1,2,3;
Sum i3,1,2,3;
Print +s;
.sort;
*
* And now we can provide the metric tensor
*
id eta(1,1) = 1;
id eta(2,2) = 1;
id eta(3,3) = -1;
id eta(1,2) = 0;
id eta(1,3) = 0;
id eta(2,3) = 0;
Print +s;
.end
assert succeeded?
assert result("F",0) =~ expr(<<-EOF
+ eta(i1,i1)*eta(i2,i2)*eta(i3,i3)
- eta(i1,i1)*eta(i2,i3)^2
- eta(i1,i2)^2*eta(i3,i3)
+ 2*eta(i1,i2)*eta(i1,i3)*eta(i2,i3)
- eta(i1,i3)^2*eta(i2,i2)
EOF
)
assert result("F",1) =~ expr(<<-EOF
+ 6*eta(1,1)*eta(2,2)*eta(3,3)
- 6*eta(1,1)*eta(2,3)^2
- 6*eta(1,2)^2*eta(3,3)
+ 12*eta(1,2)*eta(1,3)*eta(2,3)
- 6*eta(1,3)^2*eta(2,2)
EOF
)
assert result("F") =~ expr("-6")
*--#] NotesMetric_1 :
*--#[ NotesMetric_2 :
Indices i1,i2,i3;
FixIndex 1:1,2:1,3:-1;
Off Statistics;
*
Local F = e_(i1,i2,i3)*e_(i1,i2,i3);
Sum i1,1,2,3;
Sum i2,1,2,3;
Sum i3,1,2,3;
Print +s;
.sort
Contract;
Print +s;
.end
assert succeeded?
assert result("F",0) =~ expr("+6*e_(1,2,3)*e_(1,2,3)")
assert result("F") =~ expr("-6")
*--#] NotesMetric_2 :
*--#[ NotesMetric_3 :
Indices i1=0,i2=0,i3=0;
FixIndex 1:1,2:1,3:-1;
Off Statistics;
*
Local F = e_(i1,i2,i3)*e_(i1,i2,i3);
Contract;
Print +s;
.sort
Sum i1,1,2,3;
Sum i2,1,2,3;
Sum i3,1,2,3;
Print +s;
.end
assert succeeded?
assert result("F",0) =~ expr(<<-EOF
+ d_(i1,i1)*d_(i2,i2)*d_(i3,i3)
- d_(i1,i1)*d_(i2,i3)*d_(i2,i3)
- d_(i1,i2)*d_(i1,i2)*d_(i3,i3)
+ 2*d_(i1,i2)*d_(i1,i3)*d_(i2,i3)
- d_(i1,i3)*d_(i1,i3)*d_(i2,i2)
EOF
)
assert result("F") =~ expr("-6")
*--#] NotesMetric_3 :
*--#[ ExtComm_1 :
symbol a,b;
#external "n1" cat -u
#external "n2" cat -u
* cat simply repeats its input. The default prompt is an
* empty line. So we use "\n\n" here -- one "\n" is to finish
* the line, and the next "\n" is the prompt:
#toexternal "(a+b)^2\n\n"
#setexternal `n1'
* For this channel the prompt will be "READY\n":
#toexternal "(a+b)^3\nREADY\n"
#setexternal `n2'
* Set the default prompt:
#prompt
Local aPLUSbTO2=
#fromexternal
;
#setexternal `n1'
#prompt READY
Local aPLUSbTO3=
#fromexternal
;
#rmexternal `n1'
#rmexternal `n2'
Print;
.end
#require unix?
# This gives Valgrind errors (3 memory leaks) on Travis CI
# (osx-gcc-valgrind-parvorm), but cleanly works on Linux with mpich 3.2.
# Might be an OS- or implementation-specific bug.
# Update (22 Sep 2017): Now I see even for Linux (both on Travis CI and
# a desktop PC) each child process leads to 1 memory leak. Best to skip this
# test for Valgrind.
#pend_if valgrind?
assert succeeded?
assert result("aPLUSbTO2") =~ expr("b^2 + 2*a*b + a^2")
assert result("aPLUSbTO3") =~ expr("b^3 + 3*a*b^2 + 3*a^2*b + a^3")
*--#] ExtComm_1 :
form-5.0.1/check/diagrams/ 0000755 0001751 0001751 00000000000 15217035744 011077 5 form-5.0.1/check/diagrams/diagrams.h 0000644 0001751 0001751 00000075011 15217035721 012756 **
* Enable verbose output.
*
*#define FormDiagramsVerbose
**
* Enable cache read and write.
*
*#define FormDiagramsCacheRead
*#define FormDiagramsCacheWrite
**
* Skip cache existence check.
*
*#define FormDiagramsCacheSkipCheck
**
* Specify the cache directory.
*
*#define FormDiagramsCacheDir "CACHE_DIRECTORY_PATH"
**
* Terminate with a non-zero status if any validation check fails.
*
*#define FormDiagramsRaiseError
**
* Override options used by DoComparison().
*
* For example, to generate the cache if it does not exist, one can set it
* via the -D option or the environment variable:
* FormDiagramsOptionOverrides=cacheread,cachewrite,nocacheskipcheck,raiseerror
*
*#define FormDiagramsOptionOverrides
#ifndef `FormDiagramsCacheDir'
#define FormDiagramsCacheDir "./.diagrams_cache"
#endif
#ifdef `TESTFILEDIR'
#redefine FormDiagramsCacheDir "`TESTFILEDIR'/.diagrams_cache"
#endif
#define MaxLegs "9"
#define MaxPropagators "19"
#define CurrentModel ""
#define Bosons ""
#define AntiParticles ""
#define QgrafStyleFile "qgraf.sty"
#define QgrafModelFile "qgraf.mdl"
#define QgrafInputFile "qgraf.dat"
#define QgrafOutputFile "qgraf.out"
#define FeynGraphTemplateFile "feyngraph.jinja"
#define FeynGraphInputFile "feyngraph.toml"
#define FeynGraphOutputFile "diagrams.out"
#define QgrafVersion ""
#define FeynGraphVersion ""
Format nospaces;
Format 255;
* Note that the momentum convention is that all momenta are incoming.
* - Incoming particles are assigned momenta p1, p2, ...
* - Outgoing particles are assigned momenta -q1, -q2, ...
* - Internal particles are assigned momenta k1, k2, ...
S n1,n2,x1,x2;
CF topo,node,counter,coeff,vx,vxs(symmetric),acc,replace;
V p1,...,p`MaxLegs',q1,...,q`MaxLegs',k1,...,k`MaxPropagators',l1,...,l`MaxPropagators';
Set kk:k1,...,k`MaxPropagators';
Set ll:l1,...,l`MaxPropagators';
#OpenDictionary wildmom
#do i = 1, `MaxPropagators'
#add k`i': "k`i'?$k`i'"
#enddo
#CloseDictionary
#do i = 1, `MaxPropagators'
#$k`i' = 0;
#enddo
Model TEMP;
Particle f1;
Particle f2;
EndModel;
*--#[ SetupPhi3Model : SetupPhi3Model()
**
* Prepares the PHI3 model.
*
#procedure SetupPhi3Model()
#define filename "`QgrafModelFile'"
#create <`filename'>
#write <`filename'> "[phi,phi,+]"
#write <`filename'> "[phi,phi,phi]"
#close <`filename'>
Model PHI3;
Particle phi,1;
Vertex phi,phi,phi:g;
EndModel;
#redefine CurrentModel "PHI3"
#redefine Bosons "phi"
#redefine AntiParticles ""
#endprocedure
*--#] SetupPhi3Model :
*--#[ SetupPhi4Model : SetupPhi4Model()
**
* Prepares the PHI4 model.
*
#procedure SetupPhi4Model()
#define filename "`QgrafModelFile'"
#create <`filename'>
#write <`filename'> "[phi,phi,+]"
#write <`filename'> "[phi,phi,phi,phi]"
#close <`filename'>
Model PHI4;
Particle phi,1;
Vertex phi,phi,phi,phi:g^2;
EndModel;
#redefine CurrentModel "PHI4"
#redefine Bosons "phi"
#redefine AntiParticles ""
#endprocedure
*--#] SetupPhi4Model :
*--#[ SetupPhi34Model : SetupPhi34Model()
**
* Prepares the PHI34 model.
*
#procedure SetupPhi34Model()
#define filename "`QgrafModelFile'"
#create <`filename'>
#write <`filename'> "[phi,phi,+]"
#write <`filename'> "[phi,phi,phi]"
#write <`filename'> "[phi,phi,phi,phi]"
#close <`filename'>
Model PHI34;
Particle phi,1;
Vertex phi,phi,phi:g;
Vertex phi,phi,phi,phi:g^2;
EndModel;
#redefine CurrentModel "PHI34"
#redefine Bosons "phi"
#redefine AntiParticles ""
#endprocedure
*--#] SetupPhi4Model :
*--#[ SetupQcdModel : SetupQcdModel()
**
* Prepares the QCD model.
*
#procedure SetupQcdModel()
#define filename "`QgrafModelFile'"
#create <`filename'>
#write <`filename'> "[qua,QUA,-]"
#write <`filename'> "[glu,glu,+]"
#write <`filename'> "[gho,GHO,-]"
#write <`filename'> "[QUA,qua,glu]"
#write <`filename'> "[glu,glu,glu]"
#write <`filename'> "[glu,glu,glu,glu]"
#write <`filename'> "[GHO,gho,glu]"
#close <`filename'>
Model QCD;
Particle qua,QUA,-2;
Particle gho,GHO,-1;
Particle glu,+3;
Vertex QUA,qua,glu:g;
Vertex GHO,gho,glu:g;
Vertex glu,glu,glu:g;
Vertex glu,glu,glu,glu:g^2;
EndModel;
#redefine CurrentModel "QCD"
#redefine Bosons "glu"
#redefine AntiParticles "QUA,GHO"
#endprocedure
*--#] SetupQcdModel :
*--#[ SetupQcdbModel : SetupQcdbModel()
**
* Prepares the QCD model with the background field.
*
#procedure SetupQcdbModel()
#define filename "`QgrafModelFile'"
#create <`filename'>
#write <`filename'> "[qua,QUA,-]"
#write <`filename'> "[glu,glu,+]"
#write <`filename'> "[gho,GHO,-]"
#write <`filename'> "[back,back,+,external]"
#write <`filename'> "[QUA,qua,glu]"
#write <`filename'> "[GHO,gho,glu]"
#write <`filename'> "[glu,glu,glu]"
#write <`filename'> "[glu,glu,glu,glu]"
#write <`filename'> "[QUA,qua,back]"
#write <`filename'> "[GHO,gho,back]"
#write <`filename'> "[GHO,gho,back,glu]"
#write <`filename'> "[back,glu,glu]"
#write <`filename'> "[back,glu,glu,glu]"
#close <`filename'>
Model QCDB;
Particle qua,QUA,-2;
Particle gho,GHO,-1;
Particle glu,+3;
Particle back,+3,external;
Vertex QUA,qua,glu:g;
Vertex GHO,gho,glu:g;
Vertex glu,glu,glu:g;
Vertex glu,glu,glu,glu:g^2;
Vertex QUA,qua,back:g;
Vertex GHO,gho,back:g;
Vertex GHO,gho,back,glu:g^2;
Vertex back,glu,glu:g;
Vertex back,glu,glu,glu:g^2;
EndModel;
#redefine CurrentModel "QCDB"
#redefine Bosons "glu,back"
#redefine AntiParticles "QUA,GHO"
#endprocedure
*--#] SetupQcdbModel :
*--#[ MakeDiagrams : MakeDiagrams(numIn,numOut)
**
* Manipulates diagrams for further manipulation.
*
* Parameters
* ----------
* numIn: positive integer
* The number of incoming particles.
* numOut: positive integer
* The number of outgoing particles.
*
* Example Input
* -------------
* topo_(1)
* *node_(1,1,QUA(-p1))
* *node_(2,1,qua(-q1))
* *node_(3,g,QUA(k2),qua(p1),glu(k1))
* *node_(4,g,QUA(q1),qua(-k2),glu(-k1))
*
* vx(QUA(-2),qua(1),glu(2))
* *vx(QUA(1),qua(-1),glu(2))
*
* Example Output
* --------------
* node(QUA(q1),qua(-k2),glu(-k1))
* *node(QUA(k2),qua(p1),glu(k1))
*
#procedure MakeDiagrams(numIn,numOut)
* for diagrams_
multiply replace_(topo_,dummy_);
id node_(n1?,n2?,?a) = node_(?a);
id node_(f1?(p1?)) = 1;
multiply replace_(node_,node);
* for QGRAF
* Incoming fields have indices -1, -3, -5, ..., - 2j+1, ...
* Outgoing fields have indices -2, -4, -6, ..., - 2j, ...
* See the manual of QGRAF section 5.1 "The indices".
#do i = 1, `numIn'
repeat id vx(?a,f1?(1-2*`i'),?b) = vx(?a,f1(p`i'),?b);
#enddo
#do i = 1, `numOut'
repeat id vx(?a,f1?(-2*`i'),?b) = vx(?a,f1(q`i'),?b);
#enddo
repeat id vx(?a,f1?(-1),?b) = vx(?a,f1(p1),?b);
repeat id vx(?a,f1?(-2),?b) = vx(?a,f1(q1),?b);
multiply counter(1);
repeat id vx(?a,f1?(n1?),?b) * vx(?c,f2?(n1?),?d) * counter(n2?)
= vx(?a,f1(kk[n2]),?b) * vx(?c,f2(-kk[n2]),?d) * counter(n2+1);
repeat id vx(?a,f1?(n1?),?b,f2?(n1?),?c) * counter(n2?)
= vx(?a,f1(kk[n2]),?b,f2(-kk[n2]),?c) * counter(n2+1);
multiply replace_(counter,dummy_);
multiply replace_(vx,node);
#ifdef `FormDiagramsVerbose'
P +sss;
#endif
.sort:mkdiag;
#endprocedure
*--#] MakeDiagrams :
*--#[ CanonicalizeDiagrams : CanonicalizeDiagrams()
**
* Canonicalizes diagrams.
*
* This procedure attaches a unique topology ID and reassigns
* the loop momenta k1, k2, ... in a canonical way.
*
* Example Input
* -------------
* node(QUA(q1),qua(-k2),glu(-k1))
* *node(QUA(k2),qua(p1),glu(k1))
*
* Example Output
* --------------
* topo(1)
* *node(QUA(q1),qua(-k1),glu(k2))
* *node(QUA(k1),qua(p1),glu(-k2))
*
#procedure CanonicalizeDiagrams()
#define numactiveexprs "`numactiveexprs_'"
#define activeexprnames "`activeexprnames_'"
* Label each term uniquely.
#$counter = 0;
#define i "0"
#do e = {`activeexprnames',}
#ifdef `e'
#redefine i "{`i'+1}"
#$counter`i' = 0;
inexpression `e';
$counter`i' = $counter`i' + 1;
$counter = $counter`i';
multiply counter($counter`i');
goto end;
endinexpression;
#endif
#enddo
#undefine i
label end;
* Save the current numerical coefficient.
putinside coeff,xarg_;
B node;
ModuleOption maximum, $counter;
#do i = 1, `numactiveexprs'
ModuleOption local, $counter`i';
#enddo
Moduleoption inparallel;
.sort:canondiag-1;
* Extract vertex structure into acc(vxs(v1,...)*...).
Keep Brackets;
id node(?a) = node(?a) * vxs(?a);
argument vxs;
id f1?(p1?) = p1;
endargument;
multiply acc(1);
multiply replace_(vxs,vx);
id vx(?a) = acc(vxs(?a));
repeat id acc(x1?) * acc(x2?) = acc(x1 * x2);
B acc;
.sort:canondiag-2;
#do e = {`activeexprnames',}
#ifdef `e'
CreateSpectator [`e'.spec], "`e'.`PID_'.spec";
#endif
#enddo
#$numtopo = 0;
#do loop = 1, 1
* Find a new topology.
Keep Brackets;
#$found = 0;
if ($found == 0);
if (match(acc(x1?$x1)));
$found = 1;
$numtopo = $numtopo + 1;
$topo = $x1;
inside $x1;
$numv = count_(vxs,1);
endinside;
endif;
endif;
B acc;
ModuleOption noparallel;
.sort:canondiag-3-{`$numtopo'+1};
#if `$found'
* Try to match the topology with the current term in all possible ways.
Keep Brackets;
#$found = 0;
$replaced = 0;
argument acc;
#UseDictionary wildmom($)
if ((count(vxs,1) == `$numv') && match(`$topo'));
#CloseDictionary
$found = 1;
$replaced = 1;
$t = term_;
inside $t;
id all, $topo * replace_(,...,)
= $topo * *...*;
multiply replace_(vxs,dummy_);
id replace(-k1?vector_,k2?) = replace(k1,-k2);
chainin replace;
multiply replace_(,...,);
endinside;
multiply replace_(vxs,dummy_);
multiply topo(`$numtopo');
multiply $t;
endif;
endargument;
if ($replaced);
id acc(x1?) = x1;
endif;
ModuleOption maximum, $found;
ModuleOption local, $t, $replaced, <$k1>,...,<$k`MaxPropagators'>;
.sort:canondiag-4-`$numtopo';
#if `$found'
* Perform all the generated replacements.
#redefine loop "0"
id ifnomatch-> notreplaced, replace(?a) = replace_(?a);
#do e = {`activeexprnames',}
#ifdef `e'
inexpression `e';
tospectator [`e'.spec];
endinexpression;
#endif
#enddo
label notreplaced;
B acc;
.sort:canondiag-5-`$numtopo';
#endif
#endif
#enddo
* Restore expressions from the spectators.
#do e = {`activeexprnames',}
#ifdef `e'
CopySpectator [`e'.copy] = [`e'.spec];
#exchange `e',[`e'.copy]
#endif
#enddo
.sort:canondiag-6;
#do e = {`activeexprnames',}
#ifdef `e'
Drop [`e'.copy];
EmptySpectator [`e'.spec];
#endif
#enddo
* Drop duplicate terms (keep the first one).
#define maxunrolling "100"
#define unrolling
#define i "0"
#do k = 1, `$counter'
#if {`k'+`maxunrolling'-1} <= `$counter'
#redefine unrolling "`maxunrolling'"
#else
#redefine unrolling "{`$counter'-`k'+1}"
#endif
#do j = 0, {`unrolling'-1}
if (match(counter({`k'+`j'})));
#redefine i "0"
#do e = {`activeexprnames',}
#ifdef `e'
#redefine i "{`i'+1}"
#$found`i'x`j' = 0;
inexpression `e';
if ($found`i'x`j');
discard;
else;
$found`i'x`j' = 1;
multiply replace_(counter,dummy_);
tospectator [`e'.spec];
endif;
endinexpression;
#endif
#enddo
endif;
#enddo
#do i = 1, `numactiveexprs'
#do j = 0, {`unrolling'-1}
ModuleOption local, $found`i'x`j';
#enddo
#enddo
ModuleOption inparallel;
.sort:canondiag-7-`k';
#redefine k "{`k'+`unrolling'-1}"
#enddo
#undefine i
#if `$counter' == 0
.sort:canondiag-7;
#endif
* Restore expressions from the spectators.
#do e = {`activeexprnames',}
#ifdef `e'
CopySpectator [`e'.copy] = [`e'.spec];
#exchange `e',[`e'.copy]
#endif
#enddo
.sort:canondiag-8;
#do e = {`activeexprnames',}
#ifdef `e'
Drop [`e'.copy];
RemoveSpectator [`e'.spec];
#endif
#enddo
* Restore the coefficient.
dropcoefficient;
id coeff(x1?) = x1;
* Reorder identical boson fields at each vertex to align the momenta.
#do b = {`Bosons',}
#ifdef `b'
* Assume that they appear in adjacent positions.
repeat id node(?a,`b'(?b),`b'(?c),?d) = node(?a,`b'(?b,?c),?d);
multiply replace_(`b',vxs);
multiply replace_(vxs,`b');
repeat id node(?a,`b'(p1?,p2?,?b),?c) = node(?a,`b'(p1),`b'(p2,?b),?c);
#endif
#enddo
* Align the loop momenta with the flow of particles.
#ifdef `AntiParticles'
#do i = 1, `MaxPropagators'
if (match(node(?a,f1?{`AntiParticles'}(-k`i'),?b)));
multiply replace_(k`i',-k`i');
endif;
#enddo
#endif
.sort:canondiag-9;
#endprocedure
*--#] CanonicalizeDiagrams :
*--#[ CompareDiagrams : CompareDiagrams(F1,F2,F0)
**
* Compares diagrams in two expressions.
*
* The common diagrams are extracted from F1 and F2, and stored in F0.
* Diagrams must consist of "topo" and "node" functions.
*
* Parameters
* ----------
* F1, F2: expression [in/out]
* The expressions to be compared. Common diagrams will be removed from
* these expressions.
* F0: expression [out]
* The extracted common diagrams.
*
#procedure CompareDiagrams(F1,F2,F0)
#call CanonicalizeDiagrams()
B+ topo,node;
.sort:compdiag-1;
Keep Brackets;
L `F0' = 0
#do t = `F1';
#$t = `t';
#inside $t;
dropcoefficient;
#endinside;
#$t1 = `F1'[`$t'];
#$t2 = `F2'[`$t'];
#$tt = $t1 - $t2;
#if termsin($tt) == 0
+ (`t')
#endif
#enddo
;
.sort:compdiag-2;
L `F1' = `F1' - `F0';
L `F2' = `F2' - `F0';
#ifdef `FormDiagramsVerbose'
P +sss;
#endif
.sort:compdiag-3;
#endprocedure
*--#] CompareDiagrams :
*--#[ DoComparison : DoComparison(other,model,options...)
**
* Performs comparison.
*
* Example
* -------
* #call DoComparison(qgraf,qcd,in=qua,out=qua,loops=1,form_options=ONEPI_,FLOOP_,qgraf_options=onepi,floop)
*
#procedure DoComparison(other,model,?a)
#define DiagramGenerator "`tolower_(`other')'"
#switch `DiagramGenerator'
#case qgraf
#define DiagramGeneratorName "QGRAF"
#redefine DiagramGeneratorVersion "`~QgrafVersion'"
#break
#case feyngraph
#define DiagramGeneratorName "FeynGraph"
#redefine DiagramGeneratorVersion "feyngraph `~FeynGraphVersion'"
#break
#default
#message error: unknown diagram generator: `other'
#terminate
#endswitch
#define in ""
#define out ""
#define loops ""
#define formoptions ""
#define qgrafoptions ""
#define feyngraphoptions ""
#define options ""
#define next ""
#do a = {`?a',}
#ifdef `a'
#if "`keepleft_(`a',3)'" == "in="
#redefine next "in"
#redefine a "`takeleft_(`a',3)'"
#elseif "`keepleft_(`a',4)'" == "out="
#redefine next "out"
#redefine a "`takeleft_(`a',4)'"
#elseif "`keepleft_(`a',6)'" == "loops="
#redefine next "loops"
#redefine a "`takeleft_(`a',6)'"
#elseif "`keepleft_(`a',13)'" == "form_options="
#redefine next "formoptions"
#redefine a "`takeleft_(`a',13)'"
#elseif "`keepleft_(`a',14)'" == "qgraf_options="
#redefine next "qgrafoptions"
#redefine a "`takeleft_(`a',14)'"
#elseif "`keepleft_(`a',18)'" == "feyngraph_options="
#redefine next "feyngraphoptions"
#redefine a "`takeleft_(`a',18)'"
#elseif "`keepleft_(`a',8)'" == "options="
#redefine next "options"
#redefine a "`takeleft_(`a',8)'"
#endif
#ifdef `a'
#ifdef `next'
#ifdef ``next''
#redefine `next' "``next'',`a'"
#else
#redefine `next' "`a'"
#endif
#endif
#endif
#endif
#enddo
#ifdef `FormDiagramsOptionOverrides'
#define options "`options',`FormDiagramsOptionOverrides'"
#endif
#ifdef `options'
#do a = {`options',}
#ifdef `a'
#switch `tolower_(`a')'
#case verbose
#define FormDiagramsVerbose
#break
#case noverbose
#define FormDiagramsVerbose ""
#break
#case cacheread
#define FormDiagramsCacheRead
#break
#case nocacheread
#define FormDiagramsCacheRead ""
#break
#case cachewrite
#define FormDiagramsCacheWrite
#break
#case nocachewrite
#define FormDiagramsCacheWrite ""
#break
#case cacheskipcheck
#define FormDiagramsCacheSkipCheck
#break
#case nocacheskipcheck
#define FormDiagramsCacheSkipCheck ""
#break
#case forcecacheread
#define FormDiagramsCacheRead
#define FormDiagramsCacheSkipCheck
#break
#case raiseerror
#define FormDiagramsRaiseError
#break
#case noraiseerror
#define FormDiagramsRaiseError ""
#break
#default
#message warning: unknown option: `a'
#terminate
#endswitch
#endif
#enddo
#endif
#define numIn "0"
#define numOut "0"
#do a = {`in',}
#ifdef `a'
#redefine numIn "{`numIn'+1}"
#endif
#enddo
#do a = {`out',}
#ifdef `a'
#redefine numOut "{`numOut'+1}"
#endif
#enddo
#define momenta ""
#do i = 1, `numIn'
#redefine momenta "`momenta',p`i'"
#enddo
#do i = 1, `numOut'
#redefine momenta "`momenta',q`i'"
#enddo
* Construct the cache key.
#define opt1 "`formoptions'"
#define opt2 "``DiagramGenerator'options'"
#define val1 ""
#define val2 ""
#do i = 1, 2
#do a = {`opt`i'',}
#ifdef `a'
#if `i' == 1
#redefine a "`tolower_(`a')'"
#if "`keepright_(`a',1)'" == "_"
#redefine a "`takeright_(`a',1)'"
#endif
#elseif (`i' == 2) && "`DiagramGenerator'" == "feyngraph"
#if "`keepright_(`a',12)'" == "self_loops=0"
#redefine a "`takeright_(`a',12)'selfloops0"
#elseif "`keepright_(`a',16)'" == "opi_components=1"
#redefine a "`takeright_(`a',16)'opicomponents1"
#endif
#endif
#redefine val`i' "`val`i''`a'"
#endif
#enddo
#ifdef `val`i''
#else
#redefine val`i' "none"
#endif
#enddo
#if "`val1'" == "`val2'"
#redefine val2 ""
#endif
#define cachekey "`DiagramGenerator'_`model'"
#do b = {in,out,loops,val1,val2}
#redefine cachekey "`cachekey'_"
#do a = {``b'',}
#ifdef `a'
#redefine cachekey "`cachekey'`a'"
#endif
#enddo
#if "`keepright_(`cachekey',1)'" == "_"
#redefine cachekey "`takeright_(`cachekey',1)'"
#endif
#enddo
* Cache file names.
#define cachefile "`FormDiagramsCacheDir'/`cachekey'.dat"
#define cachetmpfile "`cachekey'.dat.`PID_'.tmp"
#define cachetmpfile2 "`FormDiagramsCacheDir'/`cachekey'.dat2.`PID_'.tmp"
* Set up the model.
#call Setup`toupper_(`keepleft_(`model',1)')'`takeleft_(`model',1)'Model()
* Generate diagrams.
#ifdef `formoptions'
#define optionvalue "0"
#do a = {`formoptions',}
#ifdef `a'
#redefine optionvalue "`optionvalue'+``a''"
#endif
#enddo
#redefine formoptions "`optionvalue'"
#else
#redefine formoptions "0"
#endif
L F1 = diagrams_(`CurrentModel',{`in'},{`out'},{`momenta'},kk,`loops',`formoptions');
#ifdef `FormDiagramsVerbose'
P +sss;
#endif
.sort:gen-diag;
#$nF1 = termsin_(F1);
* Check if the cache exists.
#ifdef `FormDiagramsCacheRead'
#ifdef `FormDiagramsCacheSkipCheck'
#$cacheexists = 1;
#else
#$cacheexists =
#pipe if [ -f "`cachefile'" ]; then echo 1; else echo 0; fi
;
#endif
#else
#$cacheexists = 0;
#endif
#if `$cacheexists' == 1
* If the cache exists, then compare the generated diagrams with the cache,
* which has already been confirmed to be consistent with the other generator.
#message Read cache file: `cachefile'
Skip;
L F2 =
#include `cachefile'
;
.sort:load-cache-1;
#$nF2 = termsin_(F2);
Drop;
L oldF1 = F1;
L oldF2 = F2;
.sort:load-cache-2;
Drop;
L F0 = 0;
L F1 = oldF1 - oldF2;
L F2 = - F1;
.sort:load-cache-3;
#else
* Otherwise, we must perform a full comparison.
#ifdef `FormDiagramsCacheWrite'
* Output the generated diagrams into a temporary file.
.sort:save-tmp;
#write <`cachetmpfile'> " %+E", F1
#close <`cachetmpfile'>
#endif
Skip;
L F2 =
#switch `DiagramGenerator'
#case qgraf
#call SetupQgrafFormStyle
#call RunQgraf(in=`in',out=`out',loops=`loops',options=`qgrafoptions')
#break
#case feyngraph
#call SetupFeynGraphTemplate
#call RunFeynGraph(in=`in',out=`out',loops=`loops',options=`feyngraphoptions')
#break
#endswitch
;
#ifdef `FormDiagramsVerbose'
P +sss;
#endif
.sort:run-`DiagramGenerator';
#$nF2 = termsin_(F2);
#call MakeDiagrams(`numIn',`numOut')
#call CompareDiagrams(F1,F2,F0)
#ifdef `FormDiagramsCacheWrite'
* If the generated diagrams are consistent with those by the other generator
* then write the cache file.
#if (`ZERO_F1' == 1) && (`ZERO_F2' == 1)
#message Write cache file: `cachefile'
#system mkdir -p "`FormDiagramsCacheDir'"
#system echo "* Compared with `DiagramGeneratorVersion'" >"`cachetmpfile2'"
#system echo "* Number of diagrams: FORM: `$nF1', `DiagramGeneratorName': `$nF2'" >>"`cachetmpfile2'"
* awk filter for normalizing leading spaces.
#system awk "
/topo_/ {
if (NR > 1) print \"\"
sub(/^ */, \" \")
printf \"%s\", \$0
next
}
{
sub(/^ */, \"\")
printf \"%s\", \$0
}
END { print \"\" }
" "`cachetmpfile'" >>"`cachetmpfile2'"
#system mv "`cachetmpfile2'" "`cachefile'"
#endif
#remove <`cachetmpfile'>
#endif
#endif
#define ok
#ifdef `TESTCASE'
#if "`cachekey'" == "`TESTCASE'"
#message INFO: cachekey matches the test case: `cachekey'
#else
#message WARNING: cachekey does not match the test case: `cachekey' vs. `TESTCASE'
#redefine ok ""
#endif
#endif
#if (`ZERO_F1' == 1) && (`ZERO_F2' == 1)
#message INFO: Diagrams generated by FORM and `DiagramGeneratorName' match (`$nF1' terms).
#else
#if `$nF1' != `$nF2'
#message ERROR: Diagrams generated by FORM and `DiagramGeneratorName' do not match (`$nF1' terms vs. `$nF2' terms).
#else
#message ERROR: Diagrams generated by FORM and `DiagramGeneratorName' do not match.
#endif
#redefine ok ""
#endif
#ifdef `FormDiagramsRaiseError'
#ifdef `ok'
#else
#terminate
#endif
#endif
#endprocedure
*--#] DoComparison :
*--#[ RunQgraf : RunQgraf(options...)
**
* Runs QGRAF and reads its output.
*
* Example
* -------
* #call SetupQcdModel()
* #call SetupQgrafFormStyle()
* L F =
* #call RunQgraf(in=qua,out=qua,loops=1,options=nosnail)
* ;
*
* Example Output
* --------------
* F =
* vx(QUA(-2),qua(1),glu(2))*vx(QUA(1),qua(-1),glu(2));
*
#procedure RunQgraf(?a)
#define in ""
#define out ""
#define loops ""
#define loopmomentum ""
#define options ""
#define next "options"
#do a = {`?a',}
#ifdef `a'
#if "`keepleft_(`a',3)'" == "in="
#redefine next "in"
#redefine a "`takeleft_(`a',3)'"
#elseif "`keepleft_(`a',4)'" == "out="
#redefine next "out"
#redefine a "`takeleft_(`a',4)'"
#elseif "`keepleft_(`a',6)'" == "loops="
#redefine next "loops"
#redefine a "`takeleft_(`a',6)'"
#elseif "`keepleft_(`a',14)'" == "loop_momentum="
#redefine next "loopmomentum"
#redefine a "`takeleft_(`a',14)'"
#elseif "`keepleft_(`a',8)'" == "options="
#redefine next "options"
#redefine a "`takeleft_(`a',8)'"
#endif
#ifdef `a'
#ifdef ``next''
#redefine `next' "``next'',`a'"
#else
#redefine `next' "`a'"
#endif
#endif
#endif
#enddo
#ifndef `loopmomentum'
#redefine loopmomentum "k"
#endif
#remove <`QgrafOutputFile'>
#define filename "`QgrafInputFile'"
#create <`filename'>
#write <`filename'> "output = \'`QgrafOutputFile'\';"
#write <`filename'> "style = \'`QgrafStyleFile'\';"
#write <`filename'> "model = \'`QgrafModelFile'\';"
#write <`filename'> "in = `in';"
#write <`filename'> "out = `out';"
#write <`filename'> "loops = `loops';"
#write <`filename'> "loop_momentum = `loopmomentum';"
#write <`filename'> "options = `options';"
#close <`filename'>
#system qgraf
#ifdef `FormDiagramsVerbose'
#system cat `QgrafOutputFile'
#endif
#include `QgrafOutputFile'
#endprocedure
*--#] RunQgraf :
*--#[ SetupQgrafFormStyle : SetupQgrafFormStyle()
**
* Prepares the QGRAF style file for FORM.
*
#procedure SetupQgrafFormStyle()
#define filename "`QgrafStyleFile'"
#create <`filename'>
#write <`filename'> ""
#write <`filename'> "*"
#write <`filename'> "* file generated by "
#write <`filename'> "*"
#write <`filename'> "* *"
#write <`filename'> "*"
#write <`filename'> "#redefine QgrafVersion \"\""
#write <`filename'> "*"
#write <`filename'> ""
#write <`filename'> "*--#[[ d:"
#write <`filename'> " "
#write <`filename'> " *vx((),)"
#write <`filename'> ""
#write <`filename'> "*--#]] d: "
#write <`filename'> ""
#write <`filename'> "*"
#write <`filename'> "* end"
#write <`filename'> "*"
#write <`filename'> ""
#close <`filename'>
#endprocedure
*--#] SetupQgrafFormStyle :
*--#[ RunFeynGraph : RunFeynGraph(options...)
**
* Runs FeynGraph and reads its output.
*
* Example
* -------
* #call SetupQcdModel()
* #call SetupFeynGraphTemplate()
* L F =
* #call RunFeynGraph(in=qua,out=qua,loops=1,options=self_loops=0)
* ;
*
* Example Output
* --------------
* F =
* vx(QUA(-2),qua(3),glu(2))*vx(QUA(3),qua(-1),glu(2));
*
#procedure RunFeynGraph(?a)
#define in ""
#define out ""
#define loops ""
#define loopmomentum ""
#define options ""
#define next "options"
#do a = {`?a',}
#ifdef `a'
#if "`keepleft_(`a',3)'" == "in="
#redefine next "in"
#redefine a "`takeleft_(`a',3)'"
#elseif "`keepleft_(`a',4)'" == "out="
#redefine next "out"
#redefine a "`takeleft_(`a',4)'"
#elseif "`keepleft_(`a',6)'" == "loops="
#redefine next "loops"
#redefine a "`takeleft_(`a',6)'"
#elseif "`keepleft_(`a',14)'" == "loop_momentum="
#redefine next "loopmomentum"
#redefine a "`takeleft_(`a',14)'"
#elseif "`keepleft_(`a',8)'" == "options="
#redefine next "options"
#redefine a "`takeleft_(`a',8)'"
#endif
#ifdef `a'
#ifdef ``next''
#redefine `next' "``next'',`a'"
#else
#redefine `next' "`a'"
#endif
#endif
#endif
#enddo
#ifndef `loopmomentum'
#redefine loopmomentum "k"
#endif
#remove <`FeynGraphOutputFile'>
#define filename "`FeynGraphInputFile'"
#create <`filename'>
#write <`filename'> "template = \"`FeynGraphTemplateFile'\""
#write <`filename'> "[process]"
#write <`filename'> "in = [%"
#do a = {`in',}
#ifdef `a'
#write <`filename'> "\"`a'\", %"
#endif
#enddo
#write <`filename'> "]"
#write <`filename'> "out = [%"
#do a = {`out',}
#ifdef `a'
#write <`filename'> "\"`a'\", %"
#endif
#enddo
#write <`filename'> "]"
#write <`filename'> "loops = `loops'"
#write <`filename'> "model = \"`QgrafModelFile'\""
#write <`filename'> "momenta = [%"
#define i "1"
#do a = {`in',}
#ifdef `a'
#write <`filename'> "\"p`i++'\", %"
#endif
#enddo
#redefine i "1"
#do a = {`out',}
#ifdef `a'
#write <`filename'> "\"q`i++'\", %"
#endif
#enddo
#do i = 1, `loops'
#write <`filename'> "\"k`i'\", %"
#enddo
#write <`filename'> "]"
#write <`filename'> "[filter]"
#do a = {`options',}
#ifdef `a'
#switch `a'
#case onshell
#write <`filename'> "`a' = true"
#break
#default
#write <`filename'> "`a'"
#endswitch
#endif
#enddo
#close <`filename'>
#system feyngraph `FeynGraphInputFile'
#pipe echo \#redefine FeynGraphVersion \"$(feyngraph --version)\"
#ifdef `FormDiagramsVerbose'
#system cat `FeynGraphOutputFile'
#endif
#include `FeynGraphOutputFile'
#endprocedure
*--#] RunFeynGraph :
*--#[ SetupFeynGraphTemplate : SetupFeynGraphTemplate()
**
* Prepares the FeynGraph template file for FORM.
*
#procedure SetupFeynGraphTemplate()
#define filename "`FeynGraphTemplateFile'"
#create <`filename'>
#write <`filename'> "{\%- for diag in diagrams -\%}"
#write <`filename'> " {\%- set n_in = diag.n_in() -\%}"
#write <`filename'> " {\%- set n_ext = diag.n_ext() -\%}"
#write <`filename'> "*--#[[ d{{ loop.index }}:"
#write <`filename'> " {{ \"+\" ~ diag.sign() if diag.sign() >= 0 else diag.sign() -}}"
#write <`filename'> " {{ \"/\" ~ diag.symmetry_factor() if diag.symmetry_factor() != 1 else \"\" }}"
#write <`filename'> "{\%- for vertex in diag.vertices() \%}"
#write <`filename'> " *vx("
#write <`filename'> "{\%- for par in vertex.particles_ordered() -\%}"
#write <`filename'> " {\%- set j = vertex.propagators_ordered()[loop.index0].id() -\%}"
#write <`filename'> " {\%- if j < n_in -\%}"
#write <`filename'> " {\%- set j = - 2 * j - 1 -\%}"
#write <`filename'> " {\%- elif j < n_ext -\%}"
#write <`filename'> " {\%- set j = - 2 * (j - n_in + 1) -\%}"
#write <`filename'> " {\%- endif -\%}"
#write <`filename'> " {{ par.name() }}({{ j }})"
#write <`filename'> " {\%- if not loop.last -\%},{\%- endif -\%}"
#write <`filename'> "{\%- endfor -\%}"
#write <`filename'> ")"
#write <`filename'> "{\%- endfor \%}"
#write <`filename'> "*--#]] d{{ loop.index }}: "
#write <`filename'> "{\% endfor \%}"
#close <`filename'>
#endprocedure
*--#] SetupFeynGraphTemplate :
* vim: ft=form et ts=8 sts=2 sw=2 fdm=marker fmr=#[,#] fdc=4
form-5.0.1/check/check.rb 0000755 0001751 0001751 00000146621 15217035721 010642 #!/bin/sh
# frozen_string_literal: true
# See bbatsov/rubocop#3326
# rubocop:disable all
exec ruby "-S" "-x" "$0" "$@"
#! ruby
# rubocop:enable all
# Check the Ruby version.
if RUBY_VERSION < "2.0.0"
warn("ruby 2.0 required for the test suite")
exit(1)
end
require "fileutils"
require "io/console/size"
require "open3"
require "optparse"
require "ostruct"
require "rbconfig"
require "set"
require "thread"
require "tmpdir"
# Show an error message and exit.
def fatal(message, file = nil, lineno = nil)
if !file.nil? && !lineno.nil?
$stderr.puts("#{file}:#{lineno}: error: #{message}")
elsif !file.nil?
$stderr.puts("#{file}: error: #{message}")
else
$stderr.puts("error: #{message}")
end
exit(1)
end
# Show a warning message.
def warn(message, file = nil, lineno = nil)
if !file.nil? && !lineno.nil?
$stderr.puts("#{file}:#{lineno}: warning: #{message}")
elsif !file.nil?
$stderr.puts("#{file}: warning: #{message}")
else
$stderr.puts("warning: #{message}")
end
end
# Get a string from the given environment variable.
def read_env_str(key, default_value)
value = default_value
if ENV.key?(key)
value = ENV[key]
end
value
end
# Get a positive integer from the given environment variable.
def read_env_positive_int(key, default_value)
if default_value <= 0
raise ArgumentError, "invalid default_value: #{default_value}"
end
value = default_value
if ENV.key?(key)
begin
value = Integer(ENV[key])
raise ArgumentError if value <= 0
rescue ArgumentError, TypeError
warn("environment variable ignored: #{key} is not positive integer: #{ENV[key]}")
value = default_value
end
end
value
end
# Get the total size of the physical memory available on the host machine.
def total_physical_memory
platform = RbConfig::CONFIG["host_os"].downcase
case
when platform.include?("linux")
File.foreach("/proc/meminfo") do |line|
m = line.match(/\bMemTotal\b\D+(\d+)/)
return m[1].to_i * 1024 if m
end
when platform.include?("darwin")
return `sysctl -n hw.memsize`.to_i
when platform.include?("mingw") || platform.include?("mswin")
return `powershell -NoProfile -Command "(Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory"`.to_i
end
nil
end
# The default prefix for the root temporary directory. See TempDir.root.
TMPDIR_PREFIX = "form_check_"
# The default extra options for mpirun.
DEFAULT_MPIRUN_OPTS = read_env_str("FORM_CHECK_MPIRUN_OPTS", nil)
# The default extra options for valgrind.
DEFAULT_VALGRIND_OPTS = read_env_str("FORM_CHECK_VALGRIND_OPTS", nil)
# The default maximal running time in seconds of FORM jobs before they get terminated.
DEFAULT_TIMEOUT = read_env_positive_int("FORM_CHECK_DEFAULT_TIMEOUT", 10)
# The factor multiplied to DEFAULT_TIMEOUT when Valgrind is used.
VALGRIND_TIME_DILATION = read_env_positive_int("FORM_CHECK_VALGRIND_TIME_DILATION", 30)
# The default directory for searching test cases.
TESTDIR = File.dirname(__FILE__)
# Routines for temporary directories.
class TempDir
@root = nil
# Return the root temporary directory name.
def self.root
if @root.nil?
@root = Dir.mktmpdir(TMPDIR_PREFIX)
end
@root
end
# Create a temporary directory under the root temporary directory, and return
# the directory name.
def self.mktmpdir(prefix)
Dir.mktmpdir(prefix, root)
end
# Clean up the all temporary directory.
def self.cleanup
return if @root.nil?
# The first try.
FileUtils.rm_rf(@root)
# Wait up to 5 seconds.
50.times do
# If the directory still remains, try to remove it after 0.1 seconds.
if !FileTest.directory?(@root)
return
end
sleep(0.1)
FileUtils.rm_rf(@root)
end
# Failed.
if FileTest.directory?(@root)
warn("failed to delete the temporary directory '#{@root}'")
end
@root = nil
end
# We need to register the cleanup function before loading test/unit.
at_exit { TempDir.cleanup }
end
# Register a function before loading test/unit.
at_exit { defined?(output_detailed_statistics) && output_detailed_statistics }
# We use test/unit, which is now not in the standard library.
begin
require "test/unit"
rescue LoadError
warn("test/unit required for the test suite")
exit(1)
end
# Try a monkey patch to call output_detailed_statistics() before the test suite summary.
begin
require "test/unit/ui/console/testrunner"
module Test
module Unit
module UI
module Console
class TestRunner
alias old_output_statistics output_statistics
alias _old_output output
alias _old_output_summary_marker output_summary_marker
def output_statistics(*args, **kwargs, &block)
if need_output_detailed_statistics?
output_summary_marker
output_detailed_statistics(method(:output))
output_summary_marker
end
old_output_statistics(*args, **kwargs, &block)
end
end
end
end
end
end
rescue NameError, LoadError
# do nothing
end
# Find the path to a program.
def which(name)
result = nil
if name != File.basename(name)
# Convert the relative path to the absolute path.
result = File.expand_path(name)
else
# Search from $PATH.
ENV["PATH"].split(File::PATH_SEPARATOR).each do |path|
candidate = File.join(path, name)
if File.executable?(candidate)
result = File.expand_path(candidate)
break
end
end
end
result = name if result.nil? # Fallback.
result
end
# Puts a message using ANSI color codes if available.
def puts_colored(output, something, color_name)
c = _make_color(output, color_name)
if !c.nil?
something = format("%s%s%s", c[0], something, c[1])
end
output.puts(something)
end
def _make_color(output, name)
if _guess_color_availability_for(output)
begin
require "test/unit/color-scheme"
return [
Test::Unit::ColorScheme.default[name].escape_sequence,
Test::Unit::Color.new("reset").escape_sequence
]
rescue NameError, LoadError
# do nothing
end
end
nil
end
def _guess_color_availability_for(output)
return true if ENV["GITHUB_ACTIONS"] == "true"
return false unless output.tty?
return true if RUBY_PLATFORM =~ /mswin|mingw/
term = ENV.fetch("TERM", nil)
return true if term && term =~ /(?:term|screen)(?:-(?:256)?color)?\z/
if defined?(Test::Unit::UI::Console::TestRunner::TERM_COLOR_SUPPORT) &&
Test::Unit::UI::Console::TestRunner::TERM_COLOR_SUPPORT
return true
end
return true if ENV["EMACS"] == "t"
false
end
# To be mixed-in all FORM tests.
module FormTest
# Interplay with globals.
@cfg = nil
@tests = nil
def self.cfg=(val)
@cfg = val
end
def self.cfg
@cfg
end
def self.tests=(val)
@tests = val
end
def self.tests
@tests
end
def info
FormTest.tests.classes_info[self.class.name]
end
# Accessors to the configuration.
def timeout
FormTest.cfg.timeout
end
def ncpu
FormTest.cfg.ncpu
end
def serial?
FormTest.cfg.serial?
end
def threaded?
FormTest.cfg.threaded?
end
def mpi?
FormTest.cfg.mpi?
end
def flint?
FormTest.cfg.flint?
end
def valgrind?
if FormTest.cfg.fake_valgrind.nil?
!FormTest.cfg.valgrind.nil?
else
FormTest.cfg.fake_valgrind
end
end
def wordsize
FormTest.cfg.wordsize
end
# Host environment.
def cygwin?
RbConfig::CONFIG["host_os"] =~ /cygwin/i
end
def mac?
RbConfig::CONFIG["host_os"] =~ /darwin|mac os/i
end
def linux?
RbConfig::CONFIG["host_os"] =~ /linux/i
end
def unix?
cygwin? || mac? || linux? || RbConfig::CONFIG["host_os"] =~ /solaris|bsd/i
end
def windows?
# NOTE: "cygwin" is intentionally excluded.
RbConfig::CONFIG["host_os"] =~ /mswin|msys|mingw|bccwin|wince|emc/i
end
def travis?
ENV["TRAVIS"] == "true"
end
def github?
ENV["GITHUB_ACTIONS"] == "true"
end
# Total memory in bytes. -1 if undetermined.
def total_memory
@@total_memory_mutex.synchronize do
if @@cached_total_memory.nil?
result = total_physical_memory
if result.nil?
@@cached_total_memory = -1
else
@@cached_total_memory = result
end
if result.nil? || result <= 0
warn("failed to determine total physical memory")
end
end
@@cached_total_memory
end
end
@@cached_total_memory = nil
@@total_memory_mutex = Mutex.new
def reveal_newlines(str)
if FormTest.cfg.show_newlines
str.gsub("\r", "").gsub("\n", "\n")
else
str
end
end
# Override methods in Test::Unit::TestCase.
def setup
super
@tmpdir = nil
@filename = nil
end
def teardown
cleanup_files
super
end
# Set up the working directory and put FORM files.
def setup_files
cleanup_files
@tmpdir = TempDir.mktmpdir("#{self.class.name}_")
nfiles.times do |i|
File.write(File.join(@tmpdir, "#{i + 1}.frm"), info.sources[i])
end
end
# Delete the working directory.
def cleanup_files
if !@tmpdir.nil?
FileUtils.rm_rf(@tmpdir)
end
@tmpdir = nil
end
# Called from derived classes' test_* methods.
def do_test(&block)
if !requires
info.status = "OMITTED"
if defined?(omit)
omit(requires_str, &block)
elsif defined?(skip)
skip(requires_str)
end
return
end
if !FormTest.cfg.full && pendings
info.status = "SKIPPED"
if defined?(pend)
pend(pendings_str) do
assert(false)
yield
end
elsif defined?(skip)
skip(requires_str)
end
return
end
FormTest.cfg.retries.times do |t|
setup_files
prepare
@stdout = ""
@stderr = ""
old_formpath = ENV.fetch("FORMPATH", nil)
begin
ENV["FORM"] = FormTest.cfg.form_cmd
ENV["FORMPATH"] = add_path(old_formpath, File.dirname(info.full_filename))
ENV["TESTFILE"] = info.full_filename
ENV["TESTFILEDIR"] = File.dirname(info.full_filename)
ENV["TESTCASE"] = info.classname
ENV["TESTTMPDIR"] = @tmpdir
nfiles.times do |i|
@filename = "#{i + 1}.frm"
execute("#{ulimits}#{FormTest.cfg.form_cmd} #{@filename}")
if !finished?
info.status = "TIMEOUT"
assert(false, "timeout (= #{timeout} sec) in #{@filename} of #{info.desc}")
end
if return_value != 0
break
end
end
# On Windows, we convert newline characters in stdout/stderr into
# the Unix-style newline characters used in our test cases.
@raw_stdout = @stdout
@raw_stderr = @stderr
if windows?
@stdout = @stdout.gsub("\r\n", "\n")
@stderr = @stderr.gsub("\r\n", "\n")
end
# MesPrint inevitably inserts newline characters when a line exceeds
# its length limit. To verify error/warning messages, here we remove
# newline characters that seem to be part of continuation lines
# (this simple implementation also removes newline characters that are
# not due to MesPrint).
@cleaned_stdout = @stdout.gsub(/\R(?= ?\S)(?!\S+ Line \d+)/, "")
yield
# NOTE: Here we catch all exceptions, though it is a very bad style. This
# is because, in Ruby 1.9, test/unit is implemented based on
# minitest and MiniTest::Assertion is not a subclass of
# StandardError.
rescue Exception => e # rubocop:disable Lint/RescueException
if info.status == "TIMEOUT" && t < FormTest.cfg.retries - 1
warn("timeout (= #{timeout} sec) in #{@filename} of #{info.desc}, retry")
info.status = nil
info.times = nil
next
end
$stderr.puts
$stderr.puts("=" * 79)
puts_colored($stderr, "#{info.desc} FAILED", "failure")
$stderr.puts("=" * 79)
$stderr.puts(reveal_newlines(@raw_stdout))
$stderr.puts("=" * 79)
$stderr.puts
if info.status.nil?
if (defined?(MiniTest::Assertion) && e.is_a?(MiniTest::Assertion)) ||
(defined?(Test::Unit::AssertionFailedError) && e.is_a?(Test::Unit::AssertionFailedError))
info.status = "FAILED"
else
info.status = "ERROR"
end
end
raise e
else
if FormTest.cfg.verbose
$stderr.puts
$stderr.puts("=" * 79)
$stderr.puts("#{info.desc} SUCCEEDED")
$stderr.puts("=" * 79)
$stderr.puts(reveal_newlines(@raw_stdout))
$stderr.puts("=" * 79)
$stderr.puts
end
info.status = "OK"
ensure
ENV["FORMPATH"] = old_formpath
end
break
end
end
# Execute a FORM job.
def execute(cmdline)
if FormTest.cfg.verbose
$stderr.puts("Command: #{cmdline}")
end
@finished = false
@exit_status = nil
t0 = Time.now
begin
result = execute_impl(cmdline, timeout, @tmpdir)
@finished = result[:finished_in_time]
@exit_status = result[:exit_status]
# We print both stdout and stderr when a test fails. An easy way to
# implement this is to copy messages in stderr to those in stdout,
# namely, use the combined output. Unfortunately their orders
# (how stdout and stderr are merged) may not be preserved.
# Note that we exclude the Valgrind warnings "Warning: set address range perms: ..."
# which can happen when the program allocates big memory chunks.
out = result[:combined_lines]
out = out.reject { |l| l =~ /Warning: set address range perms/ }
@stdout += out.join
@stderr += result[:stderr_lines].join
ensure
t1 = Time.now
dt = t1 - t0
if info.times.nil?
info.times = []
end
info.times.push(dt)
end
end
def execute_impl(cmd, timeout, chdir)
stdout_lines = []
stderr_lines = []
combined_lines = []
exit_status = nil
finished_in_time = false
mutex = Mutex.new
Open3.popen3(cmd, chdir: chdir) do |stdin, stdout, stderr, wait_thr|
stdin.close
stdout_thread = Thread.new do
while (line = stdout.gets)
stdout_lines << line
mutex.synchronize { combined_lines << line }
end
end
stderr_thread = Thread.new do
while (line = stderr.gets)
stderr_lines << line
mutex.synchronize { combined_lines << line }
end
end
if wait_thr.join(timeout)
finished_in_time = true
exit_status = wait_thr.value.exitstatus
stdout_thread.join
stderr_thread.join
else
Process.kill("KILL", wait_thr.pid)
wait_thr.join
mutex.synchronize do
stdout_thread.kill
stderr_thread.kill
end
end
end
{
stdout_lines: stdout_lines,
stderr_lines: stderr_lines,
combined_lines: combined_lines,
exit_status: exit_status,
finished_in_time: finished_in_time
}
end
# Default assertions.
def default_check
if return_value != 0
assert(false, "nonzero return value (= #{return_value}) from #{@filename} of #{info.desc}")
elsif warning?
assert(false, "warning in #{@filename} of #{info.desc}")
else
assert(true)
end
end
# Methods to be overridden in derived classes.
# The number of FORM files attached to the test.
def nfiles
1
end
# The required condition. The test will be skipped if the condition does not
# hold.
def requires
true
end
# The string representation for the required condition.
def requires_str
"true"
end
# The pending condition. The test will be skipped if the condition holds.
def pendings
false
end
# The string representation for the pending condition.
def pendings_str
"false"
end
# The method to be called before the test.
def prepare
# Can be overridden in child classes.
end
# The sequence of ulimit commands to set the resource usage limits.
def ulimits
""
end
# Test-result functions.
# The exit status as a number
def return_value
@exit_status
end
# The verbatim result keeping line breaks and whitespaces.
# Must be in the default output format.
def exact_result(exprname, index = -1)
matches = @stdout.scan(/^[ \t]+#{Regexp.escape(exprname)}\s*=(.+?);/m)
return matches[index].first if !matches.empty? && !matches[index].nil?
""
end
# The result on one line with multiple whitespaces reduced to one.
# Must be in the default output format.
def result(exprname, index = -1)
r = exact_result(exprname, index)
return r.gsub(/\s+/, "") if !r.nil?
""
end
# The number of terms in the given expression.
# Must be in the default statistics format.
def nterms(exprname, index = -1)
matches = @stdout.scan(/^[ \t]+#{exprname}\s*Terms in output\s*=\s*(\d+).*?Bytes used\s*=\s*\d+/m)
return matches[index].first.to_i if !matches.empty? && !matches[index].nil?
-1
end
# The size in byte.
# Must be in the default statistics format.
def bytesize(exprname, index = -1)
matches = @stdout.scan(/^[ \t]+#{exprname}\s*Terms in output\s*=\s*\d+.*?Bytes used\s*=\s*(\d+)/m)
return matches[index].first.to_i if !matches.empty? && !matches[index].nil?
-1
end
# The file contents as a string (in the working directory).
def file(filename)
begin
File.open(File.join(@tmpdir, filename), "r") do |f|
result = f.read
# On Windows, we convert newline characters in the file into
# the Unix-style newline characters used in our test cases.
if windows?
result = result.gsub("\r\n", "\n")
end
return result
end
rescue StandardError
warn("failed to read '#{filename}'")
end
""
end
# Same as file(filename).
def read(filename)
file filename
end
# Write to a file (in the working directory).
def write(filename, text)
fname = File.join(@tmpdir, filename)
FileUtils.mkdir_p(File.dirname(fname))
File.write(fname, text)
end
# The working directory for the test.
def workdir
@tmpdir
end
# The standard output of the FORM job as a string.
def stdout
@stdout
end
# The standard error of the FORM job as a string.
def stderr
@stderr
end
# Test-result functions to be used in assertions.
# true if the FORM job finished in timeout.
def finished?
@finished
end
# true if the FORM job put warning messages.
def warning?(expected_message = nil)
if expected_message.nil?
@stdout.include?("Warning:")
else
@cleaned_stdout =~ Regexp.new("Warning: .*#{Regexp.escape(expected_message)}")
end
end
# true if the FORM job put preprocessor errors.
def preprocess_error?(expected_message = nil)
if expected_message.nil?
@stdout =~ /(^|\R)\S+ Line \d+ ==>/
else
@cleaned_stdout =~ Regexp.new("(^|\\R)\\S+ Line \\d+ ==> .*#{Regexp.escape(expected_message)}")
end
end
# true if the FORM job put compile-time errors.
def compile_error?(expected_message = nil)
if expected_message.nil?
@stdout =~ /(^|\R)\S+ Line \d+ -->/
else
@cleaned_stdout =~ Regexp.new("(^|\\R)\\S+ Line \\d+ --> .*#{Regexp.escape(expected_message)}")
end
end
# true if the FORM job put run-time errors.
# NOTE: indeed this implementation detects abnormal terminations
# via "Terminate()", which also happens for preprocessor/compiler errors.
def runtime_error?(expected_message = nil)
if serial?
result = @stdout =~ /Program terminating at \S+ Line \d+ -->/
elsif threaded?
result = @stdout =~ /Program terminating in thread \d+ at \S+ Line \d+ -->/
elsif mpi?
result = @stdout =~ /Program terminating in process \d+ at \S+ Line \d+ -->/
end
if expected_message.nil?
result
else
# NOTE: it just tests if the output contains the expected message,
# which is probably put before "Terminate()" is called.
result && @cleaned_stdout =~ Regexp.new(Regexp.escape(expected_message))
end
end
# true if the FORM job completed without any warnings/errors and
# the exit code was 0.
def succeeded?
if finished? && !warning? && !preprocess_error? && !compile_error? && !runtime_error? && return_value == 0
if FormTest.cfg.valgrind.nil?
if @stderr.empty?
return true
end
@stdout += "!!! stderr is not empty"
return false
end
# Check for Valgrind errors.
ok = !@stderr.include?("Invalid read") &&
!@stderr.include?("Invalid write") &&
!@stderr.include?("Invalid free") &&
!@stderr.include?("Mismatched free") &&
!@stderr.include?("Use of uninitialised value") &&
!@stderr.include?("Conditional jump or move depends on uninitialised value") &&
!@stderr.include?("points to unaddressable byte") &&
!@stderr.include?("points to uninitialised byte") &&
!@stderr.include?("contains uninitialised byte") &&
!@stderr.include?("Source and destination overlap in memcpy") &&
!@stderr.include?("has a fishy") &&
@stderr !~ /definitely lost: [1-9]/ &&
@stderr !~ /indirectly lost: [1-9]/ &&
@stderr !~ /possibly lost: [1-9]/
if !ok
@stdout += "!!! Valgrind test failed"
end
return ok
end
false
end
# Utility functions for pattern matching.
# A pattern from the given string with escaping any special characters.
def exact_pattern(str)
san_str = Regexp.quote(str)
Regexp.new(san_str)
end
# The same as #exact_pattern but ignores whitespaces.
def pattern(str)
san_str = Regexp.quote(str.gsub(/\s+/, ""))
Regexp.new(san_str)
end
# Same as #pattern but matches only with the whole expression.
# Assumes the default output format.
def expr(str)
san_str = Regexp.quote(str.gsub(/\s+/, ""))
Regexp.new("^#{san_str}$")
end
end
# Information of a test case.
class TestInfo
def initialize
@classname = nil
@full_filename = nil
@where = nil # where the test is defined
@foldname = nil # fold name of the test
@enabled = nil # enabled or not
@sources = [] # FORM sources
@time_dilation = nil
@status = nil # status
@times = nil # elapsed time (array)
end
attr_accessor :classname, :full_filename, :where, :foldname, :enabled, :sources, :time_dilation,
:status, :times
# Return the description of the test.
def desc
"#{@foldname} (#{@where})"
end
end
# List of test cases.
class TestCases
def initialize
@files = [] # Ruby files
@classes = [] # test class names (unsorted)
@classes_info = {} # TestInfo objects, key: Ruby class name
@name_patterns = []
@exclude_patterns = []
end
attr_reader :classes_info
attr_accessor :name_patterns, :exclude_patterns
# Return a list containing info objects for enabled tests.
def classes_info_list
infos = []
@classes.each do |c|
info = @classes_info["Test_#{c}"]
if info.enabled
infos.push(info)
end
end
infos
end
# Convert a .frm file to a .rb file and load it.
def make_ruby_file(filename, fold_markers = nil)
# Handle fold markers.
if fold_markers.nil?
fold_open_pattern = /^\*..#\[/
fold_open_with_name_pattern = /^\*..#\[\s*([^:]*)/
fold_close_pattern = /^\*..#\]/
fold_close_with_name_pattern = /^\*..#\]\s*([^:]*)/
else
fold_open_marker = Regexp.escape(fold_markers[:open])
fold_close_marker = Regexp.escape(fold_markers[:close])
fold_open_pattern = /^#{fold_open_marker}/
fold_open_with_name_pattern = /^#{fold_open_marker}\s*([^:]*)/
fold_close_pattern = /^#{fold_close_marker}/
fold_close_with_name_pattern = /^#{fold_close_marker}\s*([^:]*)/
end
# Check existing files.
full_filename = File.expand_path(filename)
inname = File.basename(filename)
outname = "#{File.basename(filename, '.frm')}.rb"
if @files.include?(outname)
fatal("duplicate output file name", inname)
end
@files.push(outname)
outname = File.join(TempDir.root, outname)
File.open(filename, "r") do |infile|
File.open(outname, "w") do |outfile|
lineno = 0
level = 0
classname = nil
info = nil
block = nil
blockno = 0
fileno = 0
skipping = false
heredoc = nil
requires = nil
pendings = nil
prepares = nil
ulimits = nil
time_dilation = nil
infile.each_line do |line|
line.chop!
lineno += 1
if level == 0
case line
when fold_open_with_name_pattern
# fold open: start a class
fold = $1.strip
if fold.empty?
fatal("empty fold", inname, lineno)
end
classname = canonical_name(fold)
info = TestInfo.new
@classes.push(classname)
@classes_info["Test_#{classname}"] = info
info.classname = classname
info.full_filename = full_filename
info.where = "#{inname}:#{lineno}"
info.foldname = fold
info.enabled = test_enabled?(classname)
level += 1
block = ""
blockno = 0
fileno = 0
skipping = !info.enabled
heredoc = nil
requires = nil
pendings = nil
prepares = nil
ulimits = nil
time_dilation = nil
if skipping
line = ""
else
line = "class Test_#{classname} < Test::Unit::TestCase; include FormTest"
end
when fold_close_pattern
# unexpected fold close
fatal("unexpected fold close", inname, lineno)
else
# as commentary
line = ""
end
elsif heredoc.nil? && line =~ fold_close_with_name_pattern && level == 1
# fold close: end of the class
fold = $1.strip
foldname = info.foldname
if !fold.empty? && fold != foldname
warn("unmatched fold '#{fold}', which should be '#{foldname}'", inname, lineno)
end
line = ""
if !skipping
if fileno == 0
# no .end
blockno.times do
outfile.write("\n")
end
block += ".end\n"
fileno += 1
info.sources.push(block)
line += "def test_#{classname}; do_test { default_check } end; "
else
outfile.write("def test_#{classname}; do_test {\n" + block)
line = "} end; "
end
line += "def nfiles; #{fileno} end; " if fileno != 1
if !requires.nil?
requires = requires.map { |s| "(#{s})" }.join(" && ")
line += "def requires; #{requires} end; "
line += "def requires_str; %(#{requires}) end; "
end
if !pendings.nil?
pendings = pendings.map { |s| "(#{s})" }.join(" || ")
line += "def pendings; #{pendings} end; "
line += "def pendings_str; %(#{pendings}) end; "
end
if !prepares.nil?
prepares = prepares.join("; ")
line += "def prepare; #{prepares} end; "
end
if !ulimits.nil?
ulimits.map! { |s| "ulimit #{s}; " }
ulimits = ulimits.join
line += "def ulimits; %(#{ulimits}) end; "
end
if !time_dilation.nil?
line += "def timeout; super() * #{time_dilation} end;"
end
line += "end"
end
level = 0
classname = nil
info = nil
elsif heredoc.nil? && line =~ /^\s*\.end/
# .end
if skipping
line = ""
else
blockno += 1 if fileno > 0 # previous .end
blockno.times do
outfile.write("\n")
end
block += "#{line}\n"
fileno += 1
info.sources.push(block)
block = ""
blockno = 0
line = nil # later
end
elsif heredoc.nil? && line =~ /^\s*#\s*require\s+(.*)/
# #require
line = ""
if requires.nil?
requires = []
end
requires << $1
elsif heredoc.nil? && line =~ /^\s*#\s*pend_if\s+(.*)/
# #pend_if
line = ""
if pendings.nil?
pendings = []
end
pendings << $1
elsif heredoc.nil? && line =~ /^\s*#\s*prepare\s+(.*)/
# #prepare
line = ""
if prepares.nil?
prepares = []
end
prepares << $1
elsif heredoc.nil? && line =~ /^\s*#\s*ulimit\s+(.*)/
# #ulimit
# Example: #ulimit -v 4_000_000
line = ""
if ulimits.nil?
ulimits = []
end
ulimits << $1.gsub(/(?<=\d)_(?=\d)/, "") # remove decimal marks (underscores)
elsif heredoc.nil? && line =~ /^\s*#\s*time_dilation\s+(.*)/
# #time_dilation
line = ""
if !time_dilation.nil?
fatal("attempted to set time_dilation twice", inname, lineno)
end
time_dilation = $1.to_f
if time_dilation <= 0
fatal("invalid time_dilation", inname, lineno)
end
info.time_dilation = time_dilation
elsif heredoc.nil? && line =~ /^\*\s*#\s*(require|prepare|pend_if|ulimit|time_dilation)\s+(.*)/
# *#, commented out in the FORM way
line = ""
else
if heredoc.nil?
if line =~ fold_open_pattern
# fold open
level += 1
elsif line =~ fold_close_with_name_pattern
# fold close
level -= 1
elsif line =~ /< && (line =~ /<<-?(\w+)/ ||
line =~ /<<-?"(\w+)"/ ||
line =~ /<<-?'(\w+)'/ ||
line =~ /<<-?`(\w+)`/)
# start here document
heredoc = Regexp.new($1)
# NOTE: Currently, we don't support more than one << operators
# in the same line.
end
elsif line =~ heredoc
# end here document
heredoc = nil
end
if skipping
line = ""
else
# some typical assertions
if line =~ /^\s*assert\s+(succeeded\?|finished\?)\s*$/
line = "assert(#{$1}, 'Failed for #{$1}')"
end
block += "#{line}\n"
blockno += 1
line = nil
end
end
if !line.nil?
outfile.write("#{line}\n")
end
end
if level >= 1
fatal("expected fold close", inname, lineno)
end
end
end
require outname
end
# true if the test is enabled
def test_enabled?(name)
# construct regular expressions (wildcards: '*' and '?')
@name_patterns.length.times do |i|
if !@name_patterns[i].is_a?(Regexp)
s = @name_patterns[i].to_s.gsub("*", ".*").tr("?", ".")
s = "^#{s}$"
@name_patterns[i] = Regexp.new(s)
end
end
@exclude_patterns.length.times do |i|
if !@exclude_patterns[i].is_a?(Regexp)
s = @exclude_patterns[i].to_s.gsub("*", ".*").tr("?", ".")
s = "^#{s}$"
@exclude_patterns[i] = Regexp.new(s)
end
end
# check --name NAME
ok = true
if !@name_patterns.empty?
ok = false
@name_patterns.each do |pat|
if name =~ pat
ok = true
break
end
end
end
if !ok
return false
end
# check --exclude NAME
if !@exclude_patterns.empty?
@exclude_patterns.each do |pat|
if name =~ pat
ok = false
break
end
end
end
ok
end
# Return a class name that is valid and unique.
def canonical_name(name)
prefix = name.gsub(/[^a-zA-Z0-9_]/, "_")
s = prefix
i = 0
loop do
if !@classes.include?(s)
break
end
i += 1
s = "#{prefix}_#{i}"
end
s
end
# Delete a test.
def delete(classname)
@classes.delete(classname)
@classes_info.delete("Test_#{classname}")
# It seems difficult to delete a class.
# Instead, remove the test method.
klass = Object.const_get(:"Test_#{classname}")
klass.send(:remove_method, :"test_#{classname}")
end
end
# FORM configuration.
class FormConfig
def initialize(form, mpirun, mpirun_opts, valgrind, valgrind_opts, fake_valgrind, wordsize, ncpu, timeout, retries, stat, full, verbose, show_newlines)
@form = form
@mpirun = mpirun
@mpirun_opts = mpirun_opts
@valgrind = valgrind
@valgrind_opts = valgrind_opts
@fake_valgrind = fake_valgrind
@ncpu = ncpu
@timeout = timeout
@retries = retries
@stat = stat
@full = full
@verbose = verbose
@show_newlines = show_newlines
@form_bin = nil
@mpirun_bin = nil
@valgrind_bin = nil
@valgrind_supp = nil
@head = nil
@is_serial = nil
@is_threaded = nil
@is_mpi = nil
@has_flint = nil
@wordsize = wordsize
@form_cmd = nil
end
attr_reader :form, :mpirun, :mpirun_opts, :valgrind, :valgrind_opts, :fake_valgrind, :ncpu, :timeout, :retries, :stat, :full, :verbose, :show_newlines,
:form_bin, :mpirun_bin, :valgrind_bin, :valgrind_supp, :head, :wordsize, :form_cmd
def serial?
@is_serial
end
def threaded?
@is_threaded
end
def mpi?
@is_mpi
end
def flint?
@has_flint
end
def check_bin(name, bin)
# Check if the executable is available.
if File.executable?(bin)
return
end
if name == bin
fatal("executable '#{name}' not found")
else
fatal("executable '#{name}' ('#{bin}') not found")
end
end
def check
# Check if FORM is available.
@form_bin = which(@form)
check_bin(@form, @form_bin)
# Check if Valgrind is available.
if !@valgrind.nil?
@valgrind_bin = which(@valgrind)
check_bin(@valgrind, @valgrind_bin)
end
# Check the FORM version.
tmpdir = TempDir.mktmpdir("ver_")
begin
frmname = File.join(tmpdir, "ver.frm")
File.write(frmname, <<-TEST_FRM)
#-
Off finalstats;
.end
TEST_FRM
@head = ""
out, _status = Open3.capture2e("#{@form_bin} #{frmname}")
out.split("\n").each do |output_line|
if output_line =~ /FORM/
@head = output_line
break
end
end
case @head
when /^FORM/
@is_serial = true
@is_threaded = false
@is_mpi = false
when /^TFORM/
@is_serial = false
@is_threaded = true
@is_mpi = false
when /^ParFORM/
@is_serial = false
@is_threaded = false
@is_mpi = true
else
system("#{form_bin} #{frmname}")
fatal("failed to get the version of '#{@form}'")
end
# Check if Flint is available.
# Use form -vv which contains either "+flint=VERSION" or "-flint".
feature_out, _status = Open3.capture2e(@form_bin, "-vv")
if feature_out =~ /(?:^|\s)\+flint(?:=|\s|$)/
@has_flint = true
elsif feature_out =~ /(?:^|\s)-flint(?:\s|$)/
@has_flint = false
else
warn("failed to determine FLINT support of '#{@form}'")
@has_flint = false
end
# Check the wordsize.
# Method 1: from the output header.
# Method 2: 2^64 = 0 (mod 2^64) => 64-bit machine => sizeof(WORD) = 4, etc.
wordsize1 = nil
wordsize2 = nil
if @head =~ /FORM[^(]*\([^)]*\)\s*(\d+)-bits/
wordsize1 = $1.to_i / 16
end
frmname2 = File.join(tmpdir, "ws.frm")
File.write(frmname2, <<-TEST_FRM)
#do w={2,4,8}
#message wordtest,`w',{2^(`w'*16-1)},{2^(`w'*16)}
#enddo
.end
TEST_FRM
out, _err, status = Open3.capture3("#{@form_bin} #{frmname2}")
if status.success?
out.split("\n").each do |output_line|
if output_line =~ /~~~wordtest,(\d+),(-?\d+),(-?\d+)/
w = $1.to_i
x = $2.to_i
y = $3.to_i
if x != 0 && y == 0
wordsize2 = w
break
end
end
end
end
if !@wordsize.nil?
if !wordsize1.nil? && @wordsize != wordsize1
warn("--wordsize=#{@wordsize} specified but the header of '#{@form}' indicates the wordsize = #{wordsize1}")
end
if !wordsize2.nil? && @wordsize != wordsize2
warn("--wordsize=#{@wordsize} specified but the preprocessor calculator of '#{@form}' determined wordsize = #{wordsize2}")
end
end
if @wordsize.nil?
if !wordsize1.nil? && !wordsize2.nil? && wordsize1 != wordsize2
warn("the header of '#{@form}' indicates the wordsize = #{wordsize1} but the preprocessor calculator determined wordsize = #{wordsize2}")
elsif !wordsize1.nil?
@wordsize = wordsize1
else
@wordsize = wordsize2
end
end
if @wordsize.nil?
warn("failed to get the wordsize of '#{@form}'")
warn("assuming wordsize = 4")
@wordsize = 4
end
# Prepare for mpirun
if @is_mpi
@mpirun_bin = which(@mpirun)
check_bin(@mpirun, @mpirun_bin)
# Open MPI is known to be not Valgrind-clean. Try to suppress some
# errors. Unfortunately, it would be insufficient.
supp = File.expand_path(File.join(File.dirname(@mpirun_bin),
"..", "share", "openmpi",
"openmpi-valgrind.supp"))
if File.exist?(supp)
@valgrind_supp = supp
end
end
# Construct the command.
cmdlist = []
if @is_mpi
cmdlist << @mpirun_bin << "-np" << @ncpu.to_s
if !@mpirun_opts.nil?
cmdlist << @mpirun_opts
end
end
if !@valgrind_bin.nil?
cmdlist << @valgrind_bin
cmdlist << "--leak-check=full"
if !@valgrind_supp.nil?
cmdlist << "--suppressions=#{@valgrind_supp}"
end
if !@valgrind_opts.nil?
cmdlist << @valgrind_opts
end
end
cmdlist << @form_bin
if @is_threaded
cmdlist << "-w#{@ncpu}"
end
@form_cmd = cmdlist.join(" ")
# Check the output header.
out, err, status = Open3.capture3("#{@form_cmd} #{frmname}")
if status.success?
form_version_line = out.split("\n").first
if form_version_line.nil?
warn("failed to get the actual version of FORM")
else
@head = form_version_line
end
else
system("#{@form_cmd} #{frmname}")
fatal("failed to execute '#{@form_cmd}'")
end
if !@valgrind.nil?
# Include Valgrind version information.
valgrind_version_line = err.split("\n").select { |line| line.include?("Valgrind") }.first
if valgrind_version_line.nil?
warn("failed to get the version of Valgrind")
else
@head += "\n#{valgrind_version_line}"
end
end
ensure
FileUtils.rm_rf(tmpdir)
end
end
end
# Return paths obtained by `oldpath` + `newpath`.
def add_path(oldpath, newpath)
newpath = File.expand_path(newpath)
if oldpath.nil?
return newpath
end
"#{newpath}#{File::PATH_SEPARATOR}#{oldpath}"
end
# Parse `TEST=...`.
def parse_def(pat)
if pat =~ /^TEST=(.*)/
return $1
end
nil
end
# Parse GROUPID/GROUPCOUNT
def parse_group(group)
if group =~ %r{^(\d+)/(\d+)$}
group_id = $1.to_i
group_count = $2.to_i
if group_count <= 0
fatal("group count must be positive: '#{group}'")
end
if group_id <= 0 || group_id > group_count
fatal("group id out of range: '#{group}'")
end
return group_id, group_count
end
fatal("unrecognized group specification: '#{group}'")
end
# Search for the `file`.
def search_file(file, opts)
f = file
return f if File.exist?(f)
if !opts.dir.nil?
f = File.join(opts.dir, file)
return f if File.exist?(f)
end
if !TESTDIR.nil?
f = File.join(TESTDIR, file)
return f if File.exist?(f)
end
fatal("file '#{file}' not found")
end
# Search for the `dir`.
def search_dir(dir, opts)
d = dir
return d if File.directory?(d)
if !opts.dir.nil?
d = File.join(opts.dir, dir)
return d if File.directory?(d)
end
if !TESTDIR.nil?
d = File.join(TESTDIR, dir)
return d if File.directory?(d)
end
fatal("directory '#{dir}' not found")
end
def main
# Parse options.
opts = OpenStruct.new
opts.list = false
opts.path = nil
opts.form = "form"
opts.mpirun = "mpirun"
opts.mpirun_opts = nil
opts.ncpu = 4
opts.timeout = nil
opts.retries = 1
opts.stat = false
opts.full = false
opts.enable_valgrind = false
opts.valgrind = "valgrind"
opts.valgrind_opts = nil
opts.fake_valgrind = nil
opts.wordsize = nil
opts.dir = nil
opts.name_patterns = []
opts.exclude_patterns = []
opts.group_id = nil
opts.group_count = nil
opts.files = []
opts.verbose = false
opts.show_newlines = false
parser = OptionParser.new
parser.banner = "Usage: #{File.basename($0)} [options] [--] [binname] [files|tests..]"
parser.on("-h", "--help",
"Show this help and exit") { puts(parser); exit }
parser.on("-l", "--list",
"List all tests and exit") { opts.list = true }
parser.on("--path PATH",
"Use PATH for executables") { |path| opts.path = add_path(opts.path, path) }
parser.on("--form BIN",
"Use BIN as FORM executable") { |bin| opts.form = bin }
parser.on("--mpirun BIN",
"Use BIN as mpirun executable") { |bin| opts.mpirun = bin }
parser.on("--mpirun-opts OPTS",
"Pass command line options OPTS to mpirun") { |s| opts.mpirun_opts = s }
parser.on("-w", "--ncpu N",
"Use N CPUs") { |n| opts.ncpu = n.to_i }
parser.on("-t", "--timeout N",
"Timeout N in seconds") { |n| opts.timeout = n.to_i }
parser.on("-r", "--retries N",
"Retry up to N times when timeout") { |n| opts.retries = n.to_i }
parser.on("-s", "--stat",
"Print detailed statistics") { opts.stat = true }
parser.on("-f", "--full",
"Full test, ignoring pending") { opts.full = true }
parser.on("--enable-valgrind",
"Enable Valgrind") { opts.enable_valgrind = true }
parser.on("--fake-valgrind",
"Pretend to run under Valgrind") { opts.fake_valgrind = true }
parser.on("--fake-no-valgrind",
"Pretend not to run under Valgrind") { opts.fake_valgrind = false }
parser.on("--valgrind BIN",
"Use BIN as Valgrind executable") { |bin| opts.enable_valgrind = true; opts.valgrind = bin }
parser.on("--valgrind-opts OPTS",
"Pass command line options OPTS to valgrind") { |s| opts.valgrind_opts = s }
parser.on("--wordsize N",
"Set the word size") { |n| opts.wordsize = n.to_i }
parser.on("-C", "--directory DIR",
"Directory for test cases") { |dir| opts.dir = search_dir(dir, opts) }
parser.on("-n", "--name NAME",
"Run tests matching NAME") { |pat| opts.name_patterns << pat }
parser.on("-x", "--exclude NAME",
"Do not run tests matching NAME") { |pat| opts.exclude_patterns << pat }
parser.on("-g", "--group GROUPID/GROUPCOUNT",
"Split tests and run only one group") { |group| opts.group_id, opts.group_count = parse_group(group) }
parser.on("--fold-markers OPEN,CLOSE",
"Set fold markers") { |open_close| a = open_close.split(",", 2); opts.fold_markers = { open: a[0], close: a[1] } }
parser.on("-v", "--verbose",
"Enable verbose output") { opts.verbose = true }
parser.on("--show-newlines",
"Show newline characters") { opts.show_newlines = true }
parser.on("-D TEST=NAME",
"Alternative way to run tests NAME") { |pat| opts.name_patterns << parse_def(pat) }
begin
parser.parse!(ARGV)
rescue OptionParser::ParseError => e
$stderr.puts(e.backtrace.first + ": #{e.message} (#{e.class})")
e.backtrace[1..-1].each { |m| $stderr.puts("\tfrom #{m}") }
puts(parser)
exit(1)
end
# Parse other arguments.
while !ARGV.empty?
if ARGV[0] =~ /\.frm$/
opts.files << search_file(ARGV[0], opts)
elsif ARGV[0] =~ /valgrind/
opts.enable_valgrind = true
opts.valgrind = ARGV[0]
elsif ARGV[0] =~ /mpirun/ || ARGV[0] =~ /mpiexec/
opts.mpirun = ARGV[0]
elsif ARGV[0] =~ /form/ || ARGV[0] =~ /vorm/ || File.executable?(ARGV[0])
opts.form = ARGV[0]
elsif File.exist?(ARGV[0])
opts.files << ARGV[0]
else
opts.name_patterns << ARGV[0]
end
ARGV.shift
end
# Make test cases.
FormTest.tests = TestCases.new
FormTest.tests.name_patterns = opts.name_patterns
FormTest.tests.exclude_patterns = opts.exclude_patterns
if opts.files.empty?
Dir.glob(File.join(opts.dir.nil? ? TESTDIR : opts.dir, "*.frm")).sort.each do |file|
opts.files << search_file(file, opts)
end
end
opts.files.uniq.sort.each do |file|
FormTest.tests.make_ruby_file(file, opts.fold_markers)
end
# Split tests into groups and run only one group.
if opts.group_id
infos = FormTest.tests.classes_info_list
total = infos.length
divided = total / opts.group_count
reminder = total - divided * opts.group_count
test_nos = []
n = 0
(1..opts.group_count).each do |i|
(1..divided).each do
if i == opts.group_id
test_nos.push(n)
end
n += 1
end
if i <= reminder
if i == opts.group_id
test_nos.push(n)
end
n += 1
end
end
infos = FormTest.tests.classes_info_list
infos.each_with_index do |info, i|
if !test_nos.include?(i)
FormTest.tests.delete(info.classname)
end
end
end
# --list option.
if opts.list
infos = FormTest.tests.classes_info_list
infos.each do |info|
puts("#{info.foldname} (#{info.where})")
end
puts("#{infos.length} tests")
exit
end
# --path option.
if !opts.path.nil?
ENV["PATH"] = add_path(ENV.fetch("PATH", nil), opts.path)
end
# Default mpirun_opts.
if opts.mpirun_opts.nil?
opts.mpirun_opts = DEFAULT_MPIRUN_OPTS
end
# Default valgrind_opts.
if opts.valgrind_opts.nil?
opts.valgrind_opts = DEFAULT_VALGRIND_OPTS
end
# Default timeout.
if opts.timeout.nil?
opts.timeout = DEFAULT_TIMEOUT
# Running Valgrind can be really slow.
if opts.enable_valgrind
opts.timeout *= VALGRIND_TIME_DILATION
end
end
# Initialize the FORM configuration.
FormTest.cfg = FormConfig.new(opts.form,
opts.mpirun,
opts.mpirun_opts,
opts.enable_valgrind ? opts.valgrind : nil,
opts.valgrind_opts,
opts.fake_valgrind,
opts.wordsize,
opts.ncpu,
[opts.timeout, 1].max,
[opts.retries, 1].max,
opts.stat,
opts.full,
opts.verbose,
opts.show_newlines)
FormTest.cfg.check
puts("Check #{FormTest.cfg.form_bin}")
puts(FormTest.cfg.head)
end
def need_output_detailed_statistics?
# Check if already done.
$output_detailed_statistics_done ||= false
return false if $output_detailed_statistics_done
# Check if --stat enabled.
return false if FormTest.cfg.nil? || !FormTest.cfg.stat
# Check if enabled test cases exist.
return false if FormTest.tests.classes_info_list.empty?
true
end
def output_detailed_statistics(output = nil)
return if !need_output_detailed_statistics?
$output_detailed_statistics_done = true
# method to output
output ||= method(:puts)
# Print detailed statistics.
term_width = IO.console_size[1]
infos = FormTest.tests.classes_info_list
max_foldname_width = infos.map { |info| info.foldname.length }.max
max_where_width = infos.map { |info| info.where.length }.max + 2
status_width = 7
time_width = 13
bar_width = term_width - max_foldname_width - max_where_width - status_width -
time_width - 5
if bar_width < 12
bar_width = 12
elsif bar_width > 40
bar_width = 40
end
infos.each do |info|
(0..(info.sources.length - 1)).each do |i|
t = 0
if !info.times.nil? && i < info.times.length
t = info.times[i]
end
timeout = FormTest.cfg.timeout
if !info.time_dilation.nil?
timeout *= info.time_dilation
end
if i == 0
s = format("%s %s %s %s%s",
lpad(info.foldname, max_foldname_width),
lpad("(#{info.where})", max_where_width),
lpad(info.status.nil? ? "UNKNOWN" : info.status, status_width),
bar_str(t, timeout, bar_width),
format_time(t, timeout))
else
s = format("%s %s %s %s%s",
lpad("", max_foldname_width),
lpad("", max_where_width),
lpad("", status_width),
bar_str(t, timeout, bar_width),
format_time(t, timeout))
end
color_key = case info.status
when "FAILED", "TIMEOUT" then "failure"
when "SKIPPED" then "pending"
when "OMITTED" then "omission"
end
if !color_key.nil?
begin
output.call(s, color(color_key))
rescue StandardError
output.call(s)
end
else
output.call(s)
end
end
end
output.call("Default timeout: #{FormTest.cfg.timeout}s")
true
end
# Return the string with padding to left.
def lpad(str, len)
if str.length > len
str[0..(len - 1)]
elsif str.length < len
str + " " * (len - str.length)
else
str
end
end
# Return a string for a bar chart.
def bar_str(value, max_value, bar_width)
bar_body_width = bar_width - 2
bar = " " * bar_width
bar[0] = "|"
bar[bar_width - 1] = "|"
pos = (Float(value) / max_value * bar_body_width).round
if pos < 0
pos = 0
elsif pos > bar_body_width
pos = bar_body_width
end
if pos >= 1
(1..pos).each do |i|
bar[i] = "#"
end
end
bar
end
# Format an elapsed time.
def format_time(time, max_time)
overflow = time > max_time
if overflow
t = max_time
else
t = time
end
t = Float(t)
h = Integer(t / 3600)
t %= 3600
m = Integer(t / 60)
t %= 60
s = Integer(t)
t %= 1
ms = Integer(t * 1000)
format("%s%02d:%02d:%02d.%03d", overflow ? ">" : " ", h, m, s, ms)
end
if $0 == __FILE__
main
end
form-5.0.1/check/formunit/ 0000755 0001751 0001751 00000000000 15217035744 011153 5 form-5.0.1/check/formunit/fu.frm 0000644 0001751 0001751 00000003451 15217035721 012211 #-
* Print an estimate for form units per hour on the current machine.
* The definition of 1 form unit is:
*
* 1fu = performing a trace with 14 Dirac's gamma matrices 3600 times.
*
* This program is based on aap1000.frm.
*
* Caveat: the number obtained by this program may (strongly) depend on the
* number of CPUs, buffer sizes as well as other environmental conditions.
* Parallel versions can have relatively large overheads for such simple tasks.
* MPI implementations tend to use busy-wait on blocking operations, which
* suppresses the number. Moreover, here we use the CPU time instead of the real
* time.
*--#[ Fuph :
#ifndef `N'
#define N "192"
#endif
#define NUM "14"
#ifdef `QUIET'
Off stats;
#endif
#procedure FormatFloat(x,str,n)
#$x = `x';
#do i=0,`n'
#$i = integer_($x);
#$x = ($x - $i) * 10;
#if `i' == 0
#redefine `str' "`$i'."
#else
#redefine `str' "``str''`$i'"
#endif
#enddo
#endprocedure
I m1,...,m`NUM';
S x,j;
CF f;
#$t0 = `timer_';
L FF = sum_(j,1,`N',f(j));
.sort
id f(x?) = 1;
multiply g_(1,m1,...,m`NUM');
trace4,1;
.sort
Drop;
#$t = (`timer_' - `$t0') / 1000;
#$fu = `N' / 3600;
#$fuph = $fu / $t * 3600;
#define t
#call FormatFloat($t,t,3)
#define fu
#call FormatFloat($fu,fu,6)
#define fuph
#call FormatFloat($fuph,fuph,2)
Format 120;
#if `NTHREADS_' >= 2
#write " `fu' form units in `t' seconds (total cpu time) with {`NTHREADS_'-1} workers"
#write " corresponding to `fuph' form units per hour per core"
#elseif `NPARALLELTASKS_' >= 2
#write " `fu' form units in `t' seconds (total cpu time) with `NPARALLELTASKS_' processes"
#write " corresponding to `fuph' form units per hour per core"
#else
#write " `fu' form units in `t' seconds (cpu time)"
#write " corresponding to `fuph' form units per hour"
#endif
*--#] Fuph :
.end
form-5.0.1/check/README.md 0000644 0001751 0001751 00000023622 15217035721 010507 # FORM Test Suite
This directory contains a collection of test cases that can be used for
verifying the behaviour of FORM. It also has a script to run the test cases and
check the results.
## Prerequisites
The test runner script is written in [Ruby](https://www.ruby-lang.org/)
and requires Ruby 2.0 or later. The script uses the library commonly referred to as
`test/unit`. In some Linux distributions, it is installed together with
Ruby, while some distributions may have it as an optional package,
or one may need to manually install
[test-unit](http://test-unit.github.io/test-unit/en/) via the `gem` command.
## Usage
### From the build system
To use the test suite from the automatic build system
(see also the [INSTALL](../INSTALL) file),
run the following command:
```bash
# in the root build directory
make check
```
which tests the executables (release versions) compiled by the build system.
### Testing in standalone mode
Alternatively, one can run the test runner script directly:
```bash
# in the "check" directory
./check.rb
```
By default, this runs tests with the `form` executable found in `$PATH`.
To test another executable, specify its path as a command-line argument:
```bash
./check.rb /path/to/form
```
One can also specify a TFORM (or ParFORM) executable in this way.
TFORM and ParFORM will be run with 4 CPUs (can be changed by the `--cpu N`
option).
By default, all test cases in all FORM files (`*.frm`) found in the `check`
directory (not in subdirectories) are used. To select test cases or FORM files
to run, specify their names as command-line arguments. For example:
```bash
./check.rb Issue8
./check.rb 'divmod_*'
./check.rb examples.frm
```
For more advanced options, refer to the help message using the `--help` option.
## Writing tests
### Where to add test cases?
Currently, the standard test set (run by default) includes:
- `examples.frm`: Examples provided in the manual.
- `features.frm`: Test cases for newly added features.
- `fixes.frm`: Test cases for bug fixes.
- `user.frm`: Test cases contributed by users.
Each test case in these files should finish in a short time: the timeout is set
to 10 seconds. Bigger tests that take more time are put in subdirectories
(e.g., `extra`) and should be specified by command-line options when the test
suite is invoked:
```bash
./check.rb -C extra # Extra library files must be available in FORMPATH.
```
### Structure of a test case
A test case is given as a fold in a FORM file.
The following is a simple example:
```
*--#[ Test1 :
S x;
L F = (1+x)^2;
P;
.end
assert succeeded?
assert result("F") =~ expr("1 + 2*x + x^2")
*--#] Test1 :
```
The fold name `Test1` gives the name of the test case, which should be unique.
The part before `.end` is a normal FORM program.
After `.end`, one can write a Ruby program to check the results.
The `assert` method checks whether its argument evaluates to `true`.
In this example:
- The first assertion verifies `succeeded?`, which returns `true` if the FORM finishes successfully.
- The second assertion checks the printed result of the
expression `F` by a regular expression matching (`=~`).
- On the left-hand side, `result("F")` returns the (lastly) printed output
for the expression `F` as a string.
- On the right-hand side, `expr("...")` creates a regular expression
by removing white spaces in its argument.
Since `expr()` removes all white spaces,
one can include new lines in the argument.
For example:
```
*--#[ Test2 :
S x;
L F = (1+x)^2;
P +s;
.end
assert succeeded?
assert result("F") =~ expr("
+ 1
+ 2*x
+ x^2
")
*--#] Test2 :
```
which is convenient to copy and paste a long output from a terminal.
Two or more FORM programs, separated by `.end`, can be put in a test case.
The part after the last `.end` is considered as a Ruby program.
For example:
```
*--#[ Test3 :
S x;
G F = (1+x)^2;
P;
.store
Save out.sav;
.end
Load out.sav;
L G = F;
P;
.end
assert succeeded?
assert result("F") =~ expr("1 + 2*x + x^2")
assert result("G") =~ expr("1 + 2*x + x^2")
*--#] Test3 :
```
Some test cases need to run only under specific conditions.
In such cases, one can use special instructions starting with `#`.
For example:
```
*--#[ Test4 :
S x;
L F =
#pipe echo "(1+x)^2"
;
P;
.end
#require unix?
assert succeeded?
assert result("F") =~ expr("1 + 2*x + x^2")
*--#] Test4 :
```
In this example, `#require unix?` ensures that the test runs
only on Unix, where `#pipe` is expected to work.
### Available environment variables
The following environment variables are accessible in FORM test cases via preprocessor variables.
- `FORM`
Path to the currently used FORM executable, possibly with additional command-line options.
Example: `/home/form-dev/form/build/sources/tvorm -w4`
- `TESTFILE`
Path to the FORM test file.
Example: `/home/form-dev/form/check/examples.frm`
- `TESTFILEDIR`
Path to the directory containing the FORM test file.
This path is prepended to the `FORMPATH` environment variable.
Example: `/home/form-dev/form/check`
- `TESTCASE`
Name of the current test case.
Example: `Var_Symbols_1`
- `TESTTMPDIR`
Path to the temporary directory used as the current working directory.
Example: `/tmp/form_check_20251121-426943-de5rmj/Test_Var_Symbols_1_20251121-426943-cczq26`
### Available methods
The following methods are available in Ruby test programs.
#### Execution configuration
- `timeout → integer or float`
Timeout duration in seconds.
- `ncpu → integer`
Number of assigned CPUs.
- `total_memory → integer`
Total physical memory available in bytes.
- `serial? → bool`
`true` if FORM is the serial version, otherwise `false`.
- `threaded? → bool`
`true` if FORM is the multithreaded version (TFORM), otherwise `false`.
- `mpi? → bool`
`true` if FORM is the MPI version (ParFORM), otherwise `false`.
- `flint? → bool`
`true` if FORM was built with FLINT support, otherwise `false`.
- `valgrind? → bool`
`true` if FORM is running under Valgrind, otherwise `false`.
- `wordsize → integer`
Word size in bytes used by FORM (`4` on 64-bit systems).
- `cygwin? → bool`
`true` if running on Cygwin, otherwise `false`.
- `mac? → bool`
`true` if running on macOS, otherwise `false`.
- `linux? → bool`
`true` if running on Linux, otherwise `false`.
- `unix? → bool`
`true` if running on Unix, otherwise `false`.
- `windows? → bool`
`true` if running on Windows, otherwise `false`.
- `travis? → bool`
`true` if running on Travis CI, otherwise `false`.
- `github? → bool`
`true` if running on GitHub Actions, otherwise `false`.
#### Job status
- `return_value → integer`
Exit status of the FORM job.
- `finished? → bool`
`true` if the FORM job finished within the timeout, otherwise `false`.
- `succeeded? → bool`
`true` if the FORM job finished without any problems, otherwise `false`.
- `warning? → bool`
`true` if the FORM job issued a warning, otherwise `false`.
- `warning?(expected_message : string) → bool`
`true` if the FORM job issued the expected warning, otherwise `false`.
The following methods are similar to `warning?`,
but they check for preprocessor errors, compile-time errors,
and run-time errors, respectively:
- `preprocess_error? → bool`
`preprocess_error?(expected_message : string) → bool`
- `compile_error? → bool`
`compile_error?(expected_message : string) → bool`
- `runtime_error? → bool`
`runtime_error?(expected_message : string) → bool`
#### Standard streams
- `stdout → string`
Standard output of the FORM job.
- `stderr → string`
Standard error of the FORM job.
#### Expressions
The following methods assume the default format for printing expressions:
- `result(expr_name : string) → string`
The last printed output of the specified expression.
- `result(expr_name : string, index : integer) → string`
The printed output of the specified expression at the given index (zero-based).
- `exact_result(expr_name : string) → string`
`exact_result(expr_name : string, index : integer) → string`
Similar to `result`, but returns the exact output, preserving line breaks and whitespaces.
The following methods assume the default format for statistics:
- `nterms(expr_name : string) → integer`
`nterms(expr_name : string, index : integer) → integer`
The number of terms as reported in the statistics for the specified expression.
- `bytesize(expr_name : string) → integer`
`bytesize(expr_name : string, index : integer) → integer`
The size in bytes as reported in the statistics for the specified expression.
#### Helper methods
- `exact_pattern(str : string) → regexp`
Regular expression constructed from the given text with escaping any special characters.
- `pattern(str : string) → regexp`
Similar to `exact_pattern`, but ignores whitespaces.
- `expr(str : string) → regexp`
Similar to `pattern`, but matches only with the whole expression.
- `file(filename : string) → string`
`read(filename : string) → string`
Text in the specified file.
- `write(filename : string, text : string) → nil`
Writes a text into the specified file.
### Available instructions
`check.rb` recognises the following instructions.
- `#require `
Ensures that the test is executed only if the specified `` is met.
- `#pend_if `
Marks the test as pending if the specified `` is met.
- `#prepare `
Executes the given `` before running the test.
For example:
```
#prepare write "foo.prc", "#procedure foo\n#message foo\n#endprocedure"
```
- `#ulimit `
Sets the resource limits. This is done via the `ulimit` command.
For example:
```
#require linux?
#ulimit -v 8_000_000
```
This sets the maximum amount of virtual memory available to
8,000,000 KiB (~ 8GB).
- `#time_dilation `
Multiplies the timeout by the specified `