Impressum configure.ac
Sprache: unbekannt
|
|
Spracherkennung für: .ac vermutete Sprache: Unknown {[0] [0] [0]} [Methode: Schwerpunktbildung, einfache Gewichte, sechs Dimensionen]
dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; fill-column: 100 -*-
dnl configure.ac serves as input for the GNU autoconf package
dnl in order to create a configure script.
dnl cspell:enableCompoundWords
dnl cspell:includeRegExp ^\s*#.*$
dnl cspell:includeRegExp ^\s*dnl.*$
dnl cspell:includeRegExp /AC_MSG_[A-Z]*\([^)]*\)/
dnl cspell:ignoreRegExp /[A-Z]{4,}/
dnl cspell:ignoreRegExp /\${?[A-za-z]*/
dnl cspell:ignoreRegExp /[ ']-[fglmBWXZ][a-z][^ ]*/
dnl cspell:ignoreRegExp / -isystem /
# The version number in the second argument to AC_INIT should be four numbers separated by
# periods. Some parts of the code requires the first one to be less than 128 and the others to be les s
# than 256. The four numbers can optionally be followed by a period and a free-form string containing
# no spaces or periods, like "frobozz-mumble-42" or "alpha0". If the free-form string ends with one or
# several non-alphanumeric characters, those are split off and used only for the
# ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea.
AC_INIT([LibreOffice],[25.8.3.2],[],[],[http://documentfoundation.org/])
dnl libnumbertext needs autoconf 2.68, but that can pick up autoconf268 just fine if it is installed
dnl whereas aclocal (as run by autogen.sh) insists on using autoconf and fails hard
dnl so check for the version of autoconf that is actually used to create the configure script
AC_PREREQ([2.59])
m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.68]), -1,
[AC_MSG_ERROR([at least autoconf version 2.68 is needed (you can use AUTOCONF environment variable to point to a suitable one)])])
if test -n "$BUILD_TYPE"; then
AC_MSG_ERROR([You have sourced config_host.mk in this shell. This may lead to trouble, please run in a fresh (login) shell.])
fi
save_CC=$CC
save_CXX=$CXX
first_arg_basename()
{
for i in $1; do
basename "$i"
break
done
}
CC_BASE=`first_arg_basename "$CC"`
CXX_BASE=`first_arg_basename "$CXX"`
BUILD_TYPE="LibO"
SCPDEFS=""
GIT_NEEDED_SUBMODULES=""
LO_PATH= # used by path_munge to construct a PATH variable
FilterLibs()
{
# Return value: $filteredlibs
filteredlibs=
if test "$COM" = "MSC"; then
for f in $1; do
if test "x$f" != "x${f#-L}"; then
filteredlibs="$filteredlibs -LIBPATH:${f:2}"
elif test "x$f" != "x${f#-l}"; then
filteredlibs="$filteredlibs ${f:2}.lib"
else
filteredlibs="$filteredlibs $f"
fi
done
else
for f in $1; do
case "$f" in
# let's start with Fedora's paths for now
-L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
# ignore it: on UNIXoids it is searched by default anyway
# but if it's given explicitly then it may override other paths
# (on macOS it would be an error to use it instead of SDK)
;;
*)
filteredlibs="$filteredlibs $f"
;;
esac
done
fi
}
PathFormat()
{
# Args: $1: A pathname. On Cygwin and WSL, in either the Unix or the Windows format. Note that this
# function is called also on Unix.
#
# Return value: $formatted_path and $formatted_path_unix.
#
# $formatted_path is the argument in Windows format, but using forward slashes instead of
# backslashes, using 8.3 pathname components if necessary (if it otherwise would contains spaces
# or shell metacharacters).
#
# $formatted_path_unix is the argument in a form usable in Cygwin or WSL, using 8.3 components if
# necessary. On Cygwin, it is the same as $formatted_path, but on WSL it is $formatted_path as a
# Unix pathname.
#
# Errors out if 8.3 names are needed but aren't present for some of the path components.
# Examples:
#
# /home/tml/lo/master-optimised => C:/cygwin64/home/tml/lo/master-optimised
#
# C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe => C:/PROGRA~2/MICROS~3/INSTAL~1/vswhere.exe
#
# C:\Program Files (x86)\Microsoft Visual Studio\2019\Community => C:/PROGRA~2/MICROS~3/2019/COMMUN~1
#
# C:/PROGRA~2/WI3CF2~1/10/Include/10.0.18362.0/ucrt => C:/PROGRA~2/WI3CF2~1/10/Include/10.0.18362.0/ucrt
#
# /cygdrive/c/PROGRA~2/WI3CF2~1/10 => C:/PROGRA~2/WI3CF2~1/10
#
# C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\ => C:/PROGRA~2/WI3CF2~1/NETFXSDK/4.8/
#
# /usr/bin/find.exe => C:/cygwin64/bin/find.exe
if test -z "$1"; then
formatted_path=""
formatted_path_unix=""
return
fi
if test -n "$UNITTEST_WSL_PATHFORMAT"; then
printf "PathFormat $1 ==> "
fi
formatted_path="$1"
if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
if test "$build_os" = "wsl"; then
formatted_path=$(echo "$formatted_path" | tr -d '\r')
fi
pf_conv_to_dos=
# spaces,parentheses,brackets,braces are problematic in pathname
# so are backslashes
case "$formatted_path" in
*\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
pf_conv_to_dos="yes"
;;
esac
if test "$pf_conv_to_dos" = "yes"; then
if test "$build_os" = "wsl"; then
case "$formatted_path" in
/*)
formatted_path=$(wslpath -w "$formatted_path")
;;
esac
formatted_path=$($WSL_LO_HELPER --8.3 "$formatted_path")
elif test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
formatted_path=`cygpath -sm "$formatted_path"`
else
formatted_path=`cygpath -d "$formatted_path"`
fi
if test $? -ne 0; then
AC_MSG_ERROR([path conversion failed for "$1".])
fi
fi
fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
if test "$fp_count_slash$fp_count_colon" != "00"; then
if test "$fp_count_colon" = "0"; then
new_formatted_path=`realpath "$formatted_path"`
if test $? -ne 0; then
AC_MSG_WARN([realpath failed for "$formatted_path", not necessarily a problem.])
else
formatted_path="$new_formatted_path"
fi
fi
if test "$build_os" = "wsl"; then
if test "$fp_count_colon" != "0"; then
formatted_path=$(wslpath "$formatted_path")
local final_slash=
case "$formatted_path" in
*/)
final_slash=/
;;
esac
formatted_path=$(wslpath -m $formatted_path)
case "$formatted_path" in
*/)
;;
*)
formatted_path="$formatted_path"$final_slash
;;
esac
else
formatted_path=$(wslpath -m "$formatted_path")
fi
else
formatted_path=`cygpath -m "$formatted_path"`
fi
if test $? -ne 0; then
AC_MSG_ERROR([path conversion failed for "$1".])
fi
fi
fp_count_space=`echo "$formatted_path" | $GREP -c "[ ]"`
if test "$fp_count_space" != "0"; then
AC_MSG_ERROR([converted path "$formatted_path" still contains spaces. Short filenames (8.3 filenames) support was disabled on this system?])
fi
fi
if test "$build_os" = "wsl"; then
# WSL can't run Windows binaries from Windows pathnames so we need a separate return value in Unix format
formatted_path_unix=$(wslpath "$formatted_path")
else
# But Cygwin can
formatted_path_unix="$formatted_path"
fi
if test -n "$WSL_ONLY_AS_HELPER"; then
# if already in unix format, switch to windows format to create shortened path
case "$formatted_path" in
/*)
formatted_path=$(wslpath -m "$formatted_path")
;;
esac
# cd to /mnt/c to avoid wsl/cmd complaining about not supporting UNC paths/the current working directory
formatted_path_unix=$(wslpath -u "$(cd /mnt/c; cmd.exe /c $shortpath_cmd "$formatted_path" | tr -d '\r')")
# WSL can't run Windows binaries from Windows pathnames so we need a separate return value in Unix format
formatted_path=$(wslpath -m "$formatted_path_unix")
fi
}
AbsolutePath()
{
# There appears to be no simple and portable method to get an absolute and
# canonical path, so we try creating the directory if does not exist and
# utilizing the shell and pwd.
# Args: $1: A possibly relative pathname
# Return value: $absolute_path
# Convert to unix path, mkdir would treat c:/path as a relative path.
PathFormat "$1"
local rel="$formatted_path_unix"
absolute_path=""
test ! -e "$rel" && mkdir -p "$rel"
if test -d "$rel" ; then
cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
absolute_path="$(pwd)"
cd - > /dev/null
else
AC_MSG_ERROR([Failed to resolve absolute path. "$rel" does not exist or is not a directory.])
fi
}
WARNINGS_FILE=config.warn
WARNINGS_FILE_FOR_BUILD=config.Build.warn
rm -f "$WARNINGS_FILE" "$WARNINGS_FILE_FOR_BUILD"
have_WARNINGS="no"
add_warning()
{
if test "$have_WARNINGS" = "no"; then
echo "*************************************" > "$WARNINGS_FILE"
have_WARNINGS="yes"
if command -v tput >/dev/null && test "`tput colors 2>/dev/null || echo 0`" -ge 8; then
dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
COLORWARN='*@<:@1;33;40m WARNING @<:@0m:'
else
COLORWARN="* WARNING :"
fi
fi
echo "$COLORWARN $@" >> "$WARNINGS_FILE"
}
dnl Some Mac User have the bad habit of letting a lot of crap
dnl accumulate in their PATH and even adding stuff in /usr/local/bin
dnl that confuse the build.
dnl For the ones that use LODE, let's be nice and protect them
dnl from themselves
mac_sanitize_path()
{
mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
dnl a common but nevertheless necessary thing that may be in a fancy
dnl path location is git, so make sure we have it
mac_git_path=`command -v git`
if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
mac_path="$mac_path:`dirname $mac_git_path`"
fi
dnl a not so common but nevertheless quite helpful thing that may be in a fancy
dnl path location is gpg, so make sure we find it
mac_gpg_path=`command -v gpg`
if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
mac_path="$mac_path:`dirname $mac_gpg_path`"
fi
PATH="$mac_path"
unset mac_path
unset mac_git_path
unset mac_gpg_path
}
dnl semantically test a three digits version
dnl $1 - $3 = minimal version
dnl $4 - $6 = current version
check_semantic_version_three()
{
test "$4" -gt "$1" \
-o \( "$4" -eq "$1" -a "$5" -gt "$2" \) \
-o \( "$4" -eq "$1" -a "$5" -eq "$2" -a "$6" -ge "$3" \)
return $?
}
dnl calls check_semantic_version_three with digits in named variables $1_MAJOR, $1_MINOR, $1_TINY
dnl $1 = current version prefix, e.g. EMSCRIPTEN => EMSCRIPTEN_
dnl $2 = postfix to $1, e.g. MIN => EMSCRIPTEN_MIN_
check_semantic_version_three_prefixed()
{
eval local MIN_MAJOR="\$${1}_${2}_MAJOR"
eval local MIN_MINOR="\$${1}_${2}_MINOR"
eval local MIN_TINY="\$${1}_${2}_TINY"
eval local CUR_MAJOR="\$${1}_MAJOR"
eval local CUR_MINOR="\$${1}_MINOR"
eval local CUR_TINY="\$${1}_TINY"
check_semantic_version_three $MIN_MAJOR $MIN_MINOR $MIN_TINY $CUR_MAJOR $CUR_MINOR $CUR_TINY
return $?
}
echo "********************************************************************"
echo "*"
echo "* Running ${PACKAGE_NAME} build configuration."
echo "*"
echo "********************************************************************"
echo ""
dnl ===================================================================
dnl checks build and host OSes
dnl do this before argument processing to allow for platform dependent defaults
dnl ===================================================================
# are we running in wsl but are called from git-bash/env with mingw64 or clangarm64 in path?
# if so, we aim to run nearly everything in the Windows realm, and only run autogen/configure
# in wsl and run a few tools via wsl
WSL_ONLY_AS_HELPER=
if test -n "$WSL_DISTRO_NAME" && $(echo $PATH |grep -q -e mingw64 -e clangarm64); then
WSL_ONLY_AS_HELPER=TRUE
AC_ARG_WITH([strawberry-perl-portable],
[AS_HELP_STRING([--with-strawberry-perl-portable],
[Specify the base path to strawberry perl portable])],
[],
[AC_MSG_ERROR(
[for the moment strawberry-perl-portable is a requirement, feel free to replace it])])
shortpath_cmd=$(wslpath -m $srcdir/solenv/bin/shortpath.cmd)
PathFormat "$with_strawberry_perl_portable"
if test ! -f "$formatted_path_unix/perl/bin/perl.exe" -o ! -d "$formatted_path_unix/c/bin"; then
AC_MSG_ERROR([$formatted_path doesn't contain perl or the utilities - sure you provided the base path?])
fi
STRAWBERRY_TOOLS="$formatted_path/c/bin"
STRAWBERRY_PERL="$formatted_path/perl/bin/perl.exe"
STRAWBERRY_PERL_UNIX="$formatted_path_unix/perl/bin/perl.exe"
AC_ARG_WITH([wsl-command],
[AS_HELP_STRING([--with-wsl-command],
[Specify your wsl distro command if it isn't the default/the one used with just wsl.exe –
for example: wsl.exe -d MyDistro -u NonDefaultUser])],
[],
[with_wsl_command="wsl.exe"])
WSL="$with_wsl_command"
fi
AC_SUBST([STRAWBERRY_PERL])
AC_SUBST([WSL])
# Check for WSL (version 2, at least). But if --host is explicitly specified (to really do build for
# Linux on WSL) trust that.
if test -z "$host" -a -z "$build" -a "`wslsys -v 2>/dev/null`" != ""; then
ac_cv_host="x86_64-pc-wsl"
ac_cv_host_cpu="x86_64"
ac_cv_host_os="wsl"
ac_cv_build="$ac_cv_host"
ac_cv_build_cpu="$ac_cv_host_cpu"
ac_cv_build_os="$ac_cv_host_os"
# Emulation of Cygwin's cygpath command for WSL.
cygpath()
{
if test -n "$UNITTEST_WSL_CYGPATH"; then
echo -n cygpath "$@" "==> "
fi
# Cygwin's real cygpath has a plethora of options but we use only a few here.
local args="$@"
local opt
local opt_d opt_m opt_u opt_w opt_l opt_s opt_p
OPTIND=1
while getopts dmuwlsp opt; do
case "$opt" in
\?)
AC_MSG_ERROR([Unimplemented cygpath emulation option in invocation: cygpath $args])
;;
?)
eval opt_$opt=yes
;;
esac
done
shift $((OPTIND-1))
if test $# -ne 1; then
AC_MSG_ERROR([Invalid cygpath emulation invocation: Pathname missing]);
fi
local input="$1"
local result
if test -n "$opt_d" -o -n "$opt_m" -o -n "$opt_w"; then
# Print Windows path, possibly in 8.3 form (-d) or with forward slashes (-m)
if test -n "$opt_u"; then
AC_MSG_ERROR([Invalid cygpath invocation: Both Windows and Unix path output requested])
fi
case "$input" in
/mnt/*)
# A Windows file in WSL format
input=$(wslpath -w "$input")
;;
[[a-zA-Z]]:\\* | \\* | [[a-zA-Z]]:/* | /*)
# Already in Windows format
;;
/*)
input=$(wslpath -w "$input")
;;
*)
AC_MSG_ERROR([Invalid cygpath invocation: Path '$input' is not absolute])
;;
esac
if test -n "$opt_d" -o -n "$opt_s"; then
input=$($WSL_LO_HELPER --8.3 "$input")
fi
if test -n "$opt_m"; then
input="${input//\\//}"
fi
echo "$input"
else
# Print Unix path
case "$input" in
[[a-zA-Z]]:\\* | \\* | [[a-zA-Z]]:/* | /*)
wslpath -u "$input"
;;
/)
echo "$input"
;;
*)
AC_MSG_ERROR([Invalid cygpath invocation: Path '$input' is not absolute])
;;
esac
fi
}
if test -n "$UNITTEST_WSL_CYGPATH"; then
BUILDDIR=.
# Nothing special with these file names, just arbitrary ones picked to test with
cygpath -d /usr/lib64/ld-linux-x86-64.so.2
cygpath -w /usr/lib64/ld-linux-x86-64.so.2
cygpath -m /usr/lib64/ld-linux-x86-64.so.2
cygpath -m -s /usr/lib64/ld-linux-x86-64.so.2
# At least on my machine for instance this file does have an 8.3 name
cygpath -d /mnt/c/windows/WindowsUpdate.log
# But for instance this one doesn't
cygpath -w /mnt/c/windows/system32/AboutSettingsHandlers.dll
cygpath -ws /mnt/c/windows/WindowsUpdate.log
cygpath -m /mnt/c/windows/system32/AboutSettingsHandlers.dll
cygpath -ms /mnt/c/windows/WindowsUpdate.log
cygpath -u 'c:\windows\system32\AboutSettingsHandlers.dll'
cygpath -u 'c:/windows/system32/AboutSettingsHandlers.dll'
exit 0
fi
if test -z "$WSL_LO_HELPER"; then
if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/wsl-lo-helper" ; then
WSL_LO_HELPER="$LODE_HOME/opt/bin/wsl-lo-helper"
elif test -x "/opt/lo/bin/wsl-lo-helper"; then
WSL_LO_HELPER="/opt/lo/bin/wsl-lo-helper"
fi
fi
if test -z "$WSL_LO_HELPER"; then
AC_MSG_ERROR([wsl-lo-helper not found. See solenv/wsl/README.])
fi
fi
AC_CANONICAL_HOST
AC_CANONICAL_BUILD
if test -n "$UNITTEST_WSL_PATHFORMAT"; then
BUILDDIR=.
GREP=grep
# Use of PathFormat must be after AC_CANONICAL_BUILD above
PathFormat /
printf "$formatted_path , $formatted_path_unix\n"
PathFormat $PWD
printf "$formatted_path , $formatted_path_unix\n"
PathFormat "$PROGRAMFILESX86"
printf "$formatted_path , $formatted_path_unix\n"
exit 0
fi
AC_MSG_CHECKING([for product name])
PRODUCTNAME="AC_PACKAGE_NAME"
if test -n "$with_product_name" -a "$with_product_name" != no; then
PRODUCTNAME="$with_product_name"
fi
if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
PRODUCTNAME="${PRODUCTNAME}Dev"
fi
AC_MSG_RESULT([$PRODUCTNAME])
AC_SUBST(PRODUCTNAME)
PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
dnl ===================================================================
dnl Our version is defined by the AC_INIT() at the top of this script.
dnl ===================================================================
AC_MSG_CHECKING([for package version])
if test -n "$with_package_version" -a "$with_package_version" != no; then
PACKAGE_VERSION="$with_package_version"
fi
AC_MSG_RESULT([$PACKAGE_VERSION])
set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
LIBO_VERSION_MAJOR=$1
LIBO_VERSION_MINOR=$2
LIBO_VERSION_MICRO=$3
LIBO_VERSION_PATCH=$4
LIBO_VERSION_SUFFIX=$5
# Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
# openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
# they get undoubled before actually passed to sed.
LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
# LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
# The value for key CFBundleVersion in the Info.plist file must be a period-separated list of at most
# three non-negative integers. Please find more information about CFBundleVersion at
# https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleversion
# The value for key CFBundleShortVersionString in the Info.plist file must be a period-separated list
# of at most three non-negative integers. Please find more information about
# CFBundleShortVersionString at
# https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleshortversionstring
# But that is enforced only in the App Store, and we apparently want to break the rules otherwise.
if test "$enable_macosx_sandbox" = yes; then
MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
MACOSX_BUNDLE_VERSION=$MACOSX_BUNDLE_SHORTVERSION
else
MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.$LIBO_VERSION_MICRO.$LIBO_VERSION_PATCH
MACOSX_BUNDLE_VERSION=$MACOSX_BUNDLE_SHORTVERSION$LIBO_VERSION_SUFFIX
fi
AC_SUBST(LIBO_VERSION_MAJOR)
AC_SUBST(LIBO_VERSION_MINOR)
AC_SUBST(LIBO_VERSION_MICRO)
AC_SUBST(LIBO_VERSION_PATCH)
AC_SUBST(LIBO_VERSION_SUFFIX)
AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
AC_SUBST(MACOSX_BUNDLE_VERSION)
AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
git_date=`git log -1 --pretty=format:"%cd" --date=format:'%Y' 2>/dev/null`
LIBO_THIS_YEAR=${git_date:-2025}
AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
dnl ===================================================================
dnl Product version
dnl ===================================================================
AC_MSG_CHECKING([for product version])
PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
AC_MSG_RESULT([$PRODUCTVERSION])
AC_SUBST(PRODUCTVERSION)
AC_PROG_EGREP
# AC_PROG_EGREP doesn't set GREP on all systems as well
AC_PATH_PROG(GREP, grep)
BUILDDIR=`pwd`
cd $srcdir
SRC_ROOT=`pwd`
cd $BUILDDIR
x_Cygwin=[\#]
dnl ======================================
dnl Required GObject introspection version
dnl ======================================
INTROSPECTION_REQUIRED_VERSION=1.32.0
dnl ===================================================================
dnl Search all the common names for GNU Make
dnl ===================================================================
AC_MSG_CHECKING([for GNU Make])
# try to use our own make if it is available and GNUMAKE was not already defined
if test -z "$GNUMAKE"; then
if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
GNUMAKE="$LODE_HOME/opt/bin/make"
elif test -x "/opt/lo/bin/make"; then
GNUMAKE="/opt/lo/bin/make"
fi
fi
GNUMAKE_WIN_NATIVE=
for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
if test -n "$a"; then
$a --version 2> /dev/null | grep GNU 2>&1 > /dev/null
if test $? -eq 0; then
if test "$build_os" = "cygwin"; then
if test -n "$($a -v | grep 'Built for Windows')" ; then
GNUMAKE="$(cygpath -m "$(command -v "$(cygpath -u $a)")")"
GNUMAKE_WIN_NATIVE="TRUE"
else
GNUMAKE=`command -v $a`
fi
else
GNUMAKE=`command -v $a`
fi
break
fi
fi
done
AC_MSG_RESULT($GNUMAKE)
if test -z "$GNUMAKE"; then
AC_MSG_ERROR([not found. install GNU Make.])
else
if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
fi
fi
win_short_path_for_make()
{
local short_path="$1"
if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
cygpath -sm "$short_path"
elif test -n "$WSL_ONLY_AS_HELPER"; then
# when already unix-style path, wslpath doesn't return anything
case "$short_path" in
/*)
echo $short_path
exit
;;
esac
wslpath -m "$(wslpath -u "$short_path")"
else
cygpath -u "$(cygpath -d "$short_path")"
fi
}
if test "$build_os" = "cygwin"; then
PathFormat "$SRC_ROOT"
SRC_ROOT="$formatted_path"
PathFormat "$BUILDDIR"
BUILDDIR="$formatted_path"
x_Cygwin=
AC_MSG_CHECKING(for explicit COMSPEC)
if test -z "$COMSPEC"; then
AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
else
AC_MSG_RESULT([found: $COMSPEC])
fi
fi
AC_SUBST(SRC_ROOT)
AC_SUBST(BUILDDIR)
AC_SUBST(x_Cygwin)
AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
AC_DEFINE_UNQUOTED(SRC_ROOT,"$SRC_ROOT")
AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
fi
# need sed in os checks...
AC_PATH_PROGS(SED, sed)
if test -z "$SED"; then
AC_MSG_ERROR([install sed to run this script])
fi
if test "$build_os" = "cygwin" -o -n "$WSL_ONLY_AS_HELPER"; then
# convenience check for a custom pkgconf used by meson - needs to be a version that uses windows
# style paths. Needs to be checked before the configure-switches that use PKG_CHECK_MODULES as
# that would already set the PKG_CONFIG var and then bypass/skip this autoselection
AC_PATH_PROG(PKG_CONFIG,pkgconf-2.4.3.exe,,[$PATH:$LODE_HOME/opt/bin])
if test -z "$PKG_CONFIG"; then
AC_MSG_ERROR([
A windows version of pkgconf is required to build harfbuzz.
Add PKG_CONFIG=/path/to/pkgconf-2.4.3.exe to autogen.input or put it in PATH])
fi
else
case "$build_os" in
darwin*)
# convenience check for LODE's custom pkgconf used by meson
# Needs to be checked before the configure-switches that use PKG_CHECK_MODULES as
# that would already set the PKG_CONFIG var and then bypass/skip this autoselection
AC_PATH_PROG(PKG_CONFIG,pkgconf,,[$PATH:$LODE_HOME/opt/bin])
if test -z "$PKG_CONFIG"; then
AC_MSG_WARN([pkgconf not found - pkgconf is required to build harfbuzz])
add_warning "please add PKG_CONFIG=/path/to/pkgconf to autogen.input or put it in PATH, pkgconf is required to build harfbuzz"
fi
;;
esac
fi
# Set the ENABLE_LTO variable
# ===================================================================
AC_MSG_CHECKING([whether to use link-time optimization])
if test -n "$enable_lto" -a "$enable_lto" != "no"; then
ENABLE_LTO="TRUE"
AC_MSG_RESULT([yes])
else
ENABLE_LTO=""
AC_MSG_RESULT([no])
fi
AC_SUBST(ENABLE_LTO)
AC_ARG_ENABLE(fuzz-options,
AS_HELP_STRING([--enable-fuzz-options],
[Randomly enable or disable each of those configurable options
that are supposed to be freely selectable without interdependencies,
or where bad interaction from interdependencies is automatically avoided.])
)
dnl ===================================================================
dnl When building for Android, --with-android-ndk and
dnl --with-android-sdk are mandatory
dnl ===================================================================
AC_ARG_WITH(android-ndk,
AS_HELP_STRING([--with-android-ndk],
[Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
,)
AC_ARG_WITH(android-sdk,
AS_HELP_STRING([--with-android-sdk],
[Specify location of the Android SDK. Mandatory when building for Android.]),
,)
AC_ARG_WITH(android-api-level,
AS_HELP_STRING([--with-android-api-level],
[Specify the API level when building for Android. Defaults to 16 for ARM and x86 and to 21 for ARM64 and x86-64]),
,)
ANDROID_NDK_DIR=
if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
with_android_ndk="$SRC_ROOT/external/android-ndk"
fi
if test -n "$with_android_ndk"; then
eval ANDROID_NDK_DIR=$with_android_ndk
ANDROID_API_LEVEL=21
if test -n "$with_android_api_level" ; then
ANDROID_API_LEVEL="$with_android_api_level"
fi
if test $host_cpu = arm; then
LLVM_TRIPLE=armv7a-linux-androideabi
ANDROID_SYSROOT_PLATFORM=arm-linux-androideabi
ANDROID_APP_ABI=armeabi-v7a
ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
elif test $host_cpu = aarch64; then
LLVM_TRIPLE=aarch64-linux-android
ANDROID_SYSROOT_PLATFORM=$LLVM_TRIPLE
ANDROID_APP_ABI=arm64-v8a
elif test $host_cpu = x86_64; then
LLVM_TRIPLE=x86_64-linux-android
ANDROID_SYSROOT_PLATFORM=$LLVM_TRIPLE
ANDROID_APP_ABI=x86_64
else
# host_cpu is something like "i386" or "i686" I guess, NDK uses
# "x86" in some contexts
LLVM_TRIPLE=i686-linux-android
ANDROID_SYSROOT_PLATFORM=$LLVM_TRIPLE
ANDROID_APP_ABI=x86
fi
# Set up a lot of pre-canned defaults
if test ! -f $ANDROID_NDK_DIR/RELEASE.TXT; then
if test ! -f $ANDROID_NDK_DIR/source.properties; then
AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_DIR.])
fi
ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_DIR/source.properties`
else
ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_DIR/RELEASE.TXT`
fi
if test -z "$ANDROID_NDK_VERSION"; then
AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
fi
case $ANDROID_NDK_VERSION in
r9*|r10*)
AC_MSG_ERROR([Building for Android requires NDK version >= 27.*])
;;
11.1.*|12.1.*|13.1.*|14.1.*|16.*|17.*|18.*|19.*|20.*|21.*|22.*|23.*|24.*|25.*|26.*)
AC_MSG_ERROR([Building for Android requires NDK version >= 27.*])
;;
27.*|28.*)
;;
*)
AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only versions 27.* to 28.* have been used successfully. Proceed at your own risk.])
add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only versions 27.* to 28.* have been used successfully. Proceed at your own risk."
;;
esac
AC_MSG_NOTICE([using the Android API level... $ANDROID_API_LEVEL])
# NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
# linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
# manage to link the (app-specific) single huge .so that is built for the app in
# android/source/ if there is debug information in a significant part of the object files.
# (A 64-bit ld.gold grows too much over 10 gigabytes of virtual space when linking such a .so if
# all objects have been built with debug information.)
case $build_os in
linux-gnu*)
android_HOST_TAG=linux-x86_64
;;
darwin*)
android_HOST_TAG=darwin-x86_64
;;
*)
AC_MSG_ERROR([We only support building for Android from Linux or macOS])
# ndk would also support windows and windows-x86_64
;;
esac
ANDROID_TOOLCHAIN=$ANDROID_NDK_DIR/toolchains/llvm/prebuilt/$android_HOST_TAG
ANDROID_COMPILER_BIN=$ANDROID_TOOLCHAIN/bin
test -z "$AR" && AR=$ANDROID_COMPILER_BIN/llvm-ar
test -z "$NM" && NM=$ANDROID_COMPILER_BIN/llvm-nm
test -z "$OBJDUMP" && OBJDUMP=$ANDROID_COMPILER_BIN/llvm-objdump
test -z "$RANLIB" && RANLIB=$ANDROID_COMPILER_BIN/llvm-ranlib
test -z "$STRIP" && STRIP=$ANDROID_COMPILER_BIN/llvm-strip
ANDROIDCFLAGS="$ANDROIDCFLAGS -target ${LLVM_TRIPLE}${ANDROID_API_LEVEL}"
ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes -ffunction-sections -fdata-sections -Qunused-arguments"
if test "$ENABLE_LTO" = TRUE; then
# -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
# $CC and $CXX when building external libraries
ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
fi
ANDROIDCXXFLAGS="$ANDROIDCFLAGS -stdlib=libc++"
if test -z "$CC"; then
CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
CC_BASE="clang"
fi
if test -z "$CXX"; then
CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
CXX_BASE="clang++"
fi
fi
AC_SUBST(ANDROID_NDK_DIR)
AC_SUBST(ANDROID_NDK_VERSION)
AC_SUBST(ANDROID_API_LEVEL)
AC_SUBST(ANDROID_APP_ABI)
AC_SUBST(ANDROID_SYSROOT_PLATFORM)
AC_SUBST(ANDROID_TOOLCHAIN)
dnl ===================================================================
dnl --with-android-sdk
dnl ===================================================================
ANDROID_SDK_DIR=
if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
fi
if test -n "$with_android_sdk"; then
eval ANDROID_SDK_DIR=$with_android_sdk
PATH="$ANDROID_SDK_DIR/platform-tools:$ANDROID_SDK_DIR/tools:$PATH"
fi
AC_SUBST(ANDROID_SDK_DIR)
AC_ARG_ENABLE([android-lok],
AS_HELP_STRING([--enable-android-lok],
[The Android app from the android/ subdir needs several tweaks all
over the place that break the LOK when used in the Online-based
Android app. This switch indicates that the intent of this build is
actually the Online-based, non-modified LOK.])
)
ENABLE_ANDROID_LOK=
if test -n "$ANDROID_NDK_DIR" ; then
if test "$enable_android_lok" = yes; then
ENABLE_ANDROID_LOK=TRUE
AC_DEFINE(HAVE_FEATURE_ANDROID_LOK)
AC_MSG_NOTICE([building the Android version... for the Online-based Android app])
else
AC_MSG_NOTICE([building the Android version... for the app from the android/ subdir])
fi
fi
AC_SUBST([ENABLE_ANDROID_LOK])
libo_FUZZ_ARG_ENABLE([android-editing],
AS_HELP_STRING([--enable-android-editing],
[Enable the experimental editing feature on Android.])
)
ENABLE_ANDROID_EDITING=
if test "$enable_android_editing" = yes; then
ENABLE_ANDROID_EDITING=TRUE
fi
AC_SUBST([ENABLE_ANDROID_EDITING])
disable_database_connectivity_dependencies()
{
enable_evolution2=no
enable_firebird_sdbc=no
enable_mariadb_sdbc=no
enable_postgresql_sdbc=no
enable_report_builder=no
}
# ===================================================================
#
# Start initial platform setup
#
# The using_* variables reflect platform support and should not be
# changed after the "End initial platform setup" block.
# This is also true for most test_* variables.
# ===================================================================
build_crypto=yes
test_clucene=no
test_gdb_index=no
test_openldap=yes
test_split_debug=no
test_webdav=yes
usable_dlapi=yes
# There is currently just iOS not using salplug, so this explicitly enables it.
# must: using_freetype_fontconfig
# may: using_headless_plugin defaults to $using_freetype_fontconfig
# must: using_x11
# Default values, as such probably valid just for Linux, set
# differently below just for Mac OSX, but at least better than
# hardcoding these as we used to do. Much of this is duplicated also
# in solenv for old build system and for gbuild, ideally we should
# perhaps define stuff like this only here in configure.ac?
LINKFLAGSSHL="-shared"
PICSWITCH="-fpic"
DLLPOST=".so"
LINKFLAGSNOUNDEFS="-Wl,-z,defs"
INSTROOTBASESUFFIX=
INSTROOTCONTENTSUFFIX=
SDKDIRNAME=sdk
HOST_PLATFORM="$host"
host_cpu_for_clang="$host_cpu"
case "$host_os" in
solaris*)
using_freetype_fontconfig=yes
using_x11=yes
build_skia=yes
_os=SunOS
dnl ===========================================================
dnl Check whether we're using Solaris 10 - SPARC or Intel.
dnl ===========================================================
AC_MSG_CHECKING([the Solaris operating system release])
_os_release=`echo $host_os | $SED -e s/solaris2\.//`
if test "$_os_release" -lt "10"; then
AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
else
AC_MSG_RESULT([ok ($_os_release)])
fi
dnl Check whether we're using a SPARC or i386 processor
AC_MSG_CHECKING([the processor type])
if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
AC_MSG_RESULT([ok ($host_cpu)])
else
AC_MSG_ERROR([only SPARC and i386 processors are supported])
fi
;;
linux-gnu*|k*bsd*-gnu*|linux-musl*)
using_freetype_fontconfig=yes
using_x11=yes
build_skia=yes
test_gdb_index=yes
test_split_debug=yes
if test "$enable_fuzzers" = yes; then
test_system_freetype=no
fi
_os=Linux
;;
gnu)
using_freetype_fontconfig=yes
using_x11=no
_os=GNU
;;
cygwin*|wsl*)
# When building on Windows normally with MSVC under Cygwin,
# configure thinks that the host platform (the platform the
# built code will run on) is Cygwin, even if it obviously is
# Windows, which in Autoconf terminology is called
# "mingw32". (Which is misleading as MinGW is the name of the
# tool-chain, not an operating system.)
# Somewhat confusing, yes. But this configure script doesn't
# look at $host etc that much, it mostly uses its own $_os
# variable, set here in this case statement.
using_freetype_fontconfig=no
using_x11=no
test_unix_dlapi=no
test_openldap=no
enable_pagein=no
build_skia=yes
_os=WINNT
DLLPOST=".dll"
LINKFLAGSNOUNDEFS=
# bypass check for ninja, it is not in default path, but it can be used nevertheless by default
NINJA="assumed to be available from Visual Studio"
if test "$host_cpu" = "aarch64"; then
build_skia=yes
enable_gpgmepp=no
enable_coinmp=no
enable_firebird_sdbc=no
fi
;;
darwin*) # macOS
using_freetype_fontconfig=no
using_x11=no
build_skia=yes
enable_pagein=no
if test -n "$LODE_HOME" ; then
mac_sanitize_path
AC_MSG_NOTICE([sanitized the PATH to $PATH])
fi
_os=Darwin
INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
INSTROOTCONTENTSUFFIX=/Contents
SDKDIRNAME=${PRODUCTNAME_WITHOUT_SPACES}${PRODUCTVERSION}_SDK
# See "Default values, as such probably valid just for Linux" comment above the case "$host_os"
LINKFLAGSSHL="-dynamiclib"
# -fPIC is default
PICSWITCH=""
DLLPOST=".dylib"
# -undefined error is the default
LINKFLAGSNOUNDEFS=""
case "$host_cpu" in
aarch64|arm64)
# Apple's Clang uses "arm64"
host_cpu_for_clang=arm64
esac
;;
ios*) # iOS
using_freetype_fontconfig=no
using_x11=no
build_crypto=no
test_libcmis=no
test_openldap=no
test_webdav=no
with_gssapi=no
if test -n "$LODE_HOME" ; then
mac_sanitize_path
AC_MSG_NOTICE([sanitized the PATH to $PATH])
fi
enable_gpgmepp=no
_os=iOS
enable_mpl_subset=yes
enable_lotuswordpro=no
disable_database_connectivity_dependencies
enable_coinmp=no
enable_lpsolve=no
enable_extension_integration=no
enable_xmlhelp=no
with_ppds=no
if test "$enable_ios_simulator" = "yes"; then
host=x86_64-apple-darwin
fi
# See "Default values, as such probably valid just for Linux" comment above the case "$host_os"
LINKFLAGSSHL="-dynamiclib"
# -fPIC is default
PICSWITCH=""
DLLPOST=".dylib"
# -undefined error is the default
LINKFLAGSNOUNDEFS=""
# HOST_PLATFORM is used for external projects and their configury typically doesn't like the "ios"
# part, so use aarch64-apple-darwin for now.
HOST_PLATFORM=aarch64-apple-darwin
# Apple's Clang uses "arm64"
host_cpu_for_clang=arm64
;;
freebsd*)
using_freetype_fontconfig=yes
using_x11=yes
build_skia=yes
AC_MSG_CHECKING([the FreeBSD operating system release])
if test -n "$with_os_version"; then
OSVERSION="$with_os_version"
else
OSVERSION=`/sbin/sysctl -n kern.osreldate`
fi
AC_MSG_RESULT([found OSVERSION=$OSVERSION])
AC_MSG_CHECKING([which thread library to use])
if test "$OSVERSION" -lt "500016"; then
PTHREAD_CFLAGS="-D_THREAD_SAFE"
PTHREAD_LIBS="-pthread"
elif test "$OSVERSION" -lt "502102"; then
PTHREAD_CFLAGS="-D_THREAD_SAFE"
PTHREAD_LIBS="-lc_r"
else
PTHREAD_CFLAGS=""
PTHREAD_LIBS="-pthread"
fi
AC_MSG_RESULT([$PTHREAD_LIBS])
_os=FreeBSD
;;
*netbsd*)
using_freetype_fontconfig=yes
using_x11=yes
test_gtk3_kde5=no
build_skia=yes
PTHREAD_LIBS="-pthread -lpthread"
_os=NetBSD
;;
openbsd*)
using_freetype_fontconfig=yes
using_x11=yes
PTHREAD_CFLAGS="-D_THREAD_SAFE"
PTHREAD_LIBS="-pthread"
_os=OpenBSD
;;
dragonfly*)
using_freetype_fontconfig=yes
using_x11=yes
build_skia=yes
PTHREAD_LIBS="-pthread"
_os=DragonFly
;;
linux-android*)
# API exists, but seems not really usable since Android 7 AFAIK
usable_dlapi=no
using_freetype_fontconfig=yes
using_headless_plugin=no
using_x11=no
build_crypto=no
test_openldap=no
test_system_freetype=no
test_webdav=no
with_gssapi=no
disable_database_connectivity_dependencies
enable_lotuswordpro=no
enable_mpl_subset=yes
enable_cairo_canvas=no
enable_coinmp=yes
enable_lpsolve=no
enable_odk=no
enable_python=no
enable_xmlhelp=no
_os=Android
;;
haiku*)
using_freetype_fontconfig=yes
using_x11=no
test_gtk3=no
test_gtk3_kde5=no
test_kf5=yes
test_kf6=yes
enable_odk=no
enable_coinmp=no
enable_pdfium=no
enable_sdremote=no
enable_postgresql_sdbc=no
enable_firebird_sdbc=no
_os=Haiku
;;
emscripten)
# API currently just exists in headers, not code
usable_dlapi=no
using_freetype_fontconfig=yes
using_x11=yes
test_openldap=no
test_qt5=yes
test_split_debug=yes
test_system_freetype=no
enable_compiler_plugins=no
enable_customtarget_components=yes
enable_split_debug=yes
enable_wasm_strip=yes
with_system_zlib=no
with_theme="colibre"
_os=Emscripten
;;
*)
AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
;;
esac
AC_SUBST(HOST_PLATFORM)
if test -z "$using_x11" -o -z "$using_freetype_fontconfig"; then
AC_MSG_ERROR([You must set \$using_freetype_fontconfig and \$using_x11 for your platform])
fi
# Set defaults, if not set by platform
test "${test_cpdb+set}" = set || test_cpdb="$using_x11"
test "${test_cups+set}" = set || test_cups="$using_x11"
test "${test_dbus+set}" = set || test_dbus="$using_x11"
test "${test_gen+set}" = set || test_gen="$using_x11"
test "${test_gstreamer_1_0+set}" = set || test_gstreamer_1_0="$using_x11"
test "${test_gtk3+set}" = set || test_gtk3="$using_x11"
test "${test_gtk4+set}" = set || test_gtk4="$using_x11"
test "${test_kf5+set}" = set || test_kf5="$using_x11"
test "${test_kf6+set}" = set || test_kf6="$using_x11"
# don't handle test_qt5, so it can disable test_kf5 later
test "${test_qt6+set}" = set || test_qt6="$using_x11"
test "${test_randr+set}" = set || test_randr="$using_x11"
test "${test_xrender+set}" = set || test_xrender="$using_x11"
test "${using_headless_plugin+set}" = set || using_headless_plugin="$using_freetype_fontconfig"
test "${test_gtk3_kde5+set}" != set -a "$test_kf5" = yes -a "$test_gtk3" = yes && test_gtk3_kde5="yes"
# Make sure fontconfig and freetype test both either system or not
test "${test_system_fontconfig+set}" != set -a "${test_system_freetype+set}" = set && test_system_fontconfig="$test_system_freetype"
test "${test_system_freetype+set}" != set -a "${test_system_fontconfig+set}" = set && test_system_freetype="$test_system_fontconfig"
# convenience / platform overriding "fixes"
# Don't sort!
test "$test_kf5" = yes -a "$test_qt5" = no && test_kf5=no
test "$test_kf5" = yes && test_qt5=yes
test "$test_gtk3" != yes && enable_gtk3=no
test "$test_gtk3" != yes -o "$test_kf5" != yes && test_gtk3_kde5=no
test "$using_freetype_fontconfig" = no && using_headless_plugin=no
test "$using_freetype_fontconfig" = yes && test_cairo=yes
# Keep in sync with the above $using_x11 depending test default list
disable_x11_tests()
{
test_cpdb=no
test_cups=no
test_dbus=no
test_gen=no
test_gstreamer_1_0=no
test_gtk3_kde5=no
test_gtk3=no
test_gtk4=no
test_kf5=no
test_kf6=no
test_qt5=no
test_qt6=no
test_randr=no
test_xrender=no
}
test "$using_x11" = yes && USING_X11=TRUE
if test "$using_freetype_fontconfig" = yes; then
AC_DEFINE(USE_HEADLESS_CODE)
USE_HEADLESS_CODE=TRUE
if test "$using_headless_plugin" = yes; then
AC_DEFINE(ENABLE_HEADLESS)
ENABLE_HEADLESS=TRUE
fi
else
test_fontconfig=no
test_freetype=no
fi
AC_SUBST(ENABLE_HEADLESS)
AC_SUBST(USE_HEADLESS_CODE)
AC_MSG_NOTICE([VCL platform has a usable dynamic loading API: $usable_dlapi])
AC_MSG_NOTICE([VCL platform uses freetype+fontconfig: $using_freetype_fontconfig])
AC_MSG_NOTICE([VCL platform uses headless plugin: $using_headless_plugin])
AC_MSG_NOTICE([VCL platform uses X11: $using_x11])
# ===================================================================
#
# End initial platform setup
#
# ===================================================================
if test "$_os" = "Android" ; then
# Verify that the NDK and SDK options are proper
if test -z "$with_android_ndk"; then
AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
elif test ! -f "$ANDROID_NDK_DIR/meta/abis.json"; then
AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
fi
if test -z "$ANDROID_SDK_DIR"; then
AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
elif test ! -d "$ANDROID_SDK_DIR/platforms"; then
AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
fi
fi
AC_SUBST(SDKDIRNAME)
AC_SUBST(PTHREAD_CFLAGS)
AC_SUBST(PTHREAD_LIBS)
# Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
# By default use the ones specified by our build system,
# but explicit override is possible.
AC_MSG_CHECKING(for explicit AFLAGS)
if test -n "$AFLAGS"; then
AC_MSG_RESULT([$AFLAGS])
x_AFLAGS=
else
AC_MSG_RESULT(no)
x_AFLAGS=[\#]
fi
AC_MSG_CHECKING(for explicit CFLAGS)
if test -n "$CFLAGS"; then
AC_MSG_RESULT([$CFLAGS])
x_CFLAGS=
else
AC_MSG_RESULT(no)
x_CFLAGS=[\#]
fi
AC_MSG_CHECKING(for explicit CXXFLAGS)
if test -n "$CXXFLAGS"; then
AC_MSG_RESULT([$CXXFLAGS])
x_CXXFLAGS=
else
AC_MSG_RESULT(no)
x_CXXFLAGS=[\#]
fi
AC_MSG_CHECKING(for explicit OBJCFLAGS)
if test -n "$OBJCFLAGS"; then
AC_MSG_RESULT([$OBJCFLAGS])
x_OBJCFLAGS=
else
AC_MSG_RESULT(no)
x_OBJCFLAGS=[\#]
fi
AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
if test -n "$OBJCXXFLAGS"; then
AC_MSG_RESULT([$OBJCXXFLAGS])
x_OBJCXXFLAGS=
else
AC_MSG_RESULT(no)
x_OBJCXXFLAGS=[\#]
fi
AC_MSG_CHECKING(for explicit LDFLAGS)
if test -n "$LDFLAGS"; then
AC_MSG_RESULT([$LDFLAGS])
x_LDFLAGS=
else
AC_MSG_RESULT(no)
x_LDFLAGS=[\#]
fi
AC_SUBST(AFLAGS)
AC_SUBST(CFLAGS)
AC_SUBST(CXXFLAGS)
AC_SUBST(OBJCFLAGS)
AC_SUBST(OBJCXXFLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(x_AFLAGS)
AC_SUBST(x_CFLAGS)
AC_SUBST(x_CXXFLAGS)
AC_SUBST(x_OBJCFLAGS)
AC_SUBST(x_OBJCXXFLAGS)
AC_SUBST(x_LDFLAGS)
dnl These are potentially set for MSVC, in the code checking for UCRT below:
my_original_CFLAGS=$CFLAGS
my_original_CXXFLAGS=$CXXFLAGS
my_original_CPPFLAGS=$CPPFLAGS
dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
dnl AC_PROG_CC internally.
if test "$_os" != "WINNT"; then
# AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that (and avoid -O2 during AC_PROG_CC,
# Clang 12.0.1 occasionally SEGVs on some of the test invocations during AC_PROG_CC with -O2):
save_CFLAGS=$CFLAGS
CFLAGS=-g
AC_PROG_CC
CFLAGS=$save_CFLAGS
if test -z "$CC_BASE"; then
CC_BASE=`first_arg_basename "$CC"`
fi
fi
if test "$_os" != "WINNT"; then
AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
else
ENDIANNESS=little
fi
AC_SUBST(ENDIANNESS)
if test "$usable_dlapi" != no; then
AC_DEFINE([HAVE_DLAPI])
if test "$test_unix_dlapi" != no; then
save_LIBS="$LIBS"
AC_SEARCH_LIBS([dlsym], [dl],
[case "$ac_cv_search_dlsym" in -l*) UNIX_DLAPI_LIBS="$ac_cv_search_dlsym";; esac],
[AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
LIBS="$save_LIBS"
AC_DEFINE([HAVE_UNIX_DLAPI])
fi
fi
AC_SUBST(UNIX_DLAPI_LIBS)
# Check for a (GNU) backtrace implementation
AC_ARG_VAR([BACKTRACE_CFLAGS], [Compiler flags needed to use backtrace(3)])
AC_ARG_VAR([BACKTRACE_LIBS], [Linker flags needed to use backtrace(3)])
AS_IF([test "x$BACKTRACE_LIBS$BACKTRACE_CFLAGS" = x], [
save_LIBS="$LIBS"
AC_SEARCH_LIBS([backtrace], [libexecinfo],
[case "$ac_cv_search_backtrace" in -l*) BACKTRACE_LIBS="$ac_cv_search_backtrace";; esac],
[PKG_CHECK_MODULES([BACKTRACE], [libexecinfo], [ac_cv_search_backtrace=], [:])])
LIBS="$save_LIBS"
])
AS_IF([test "x$ac_cv_search_backtrace" != xno ], [
AC_DEFINE([HAVE_FEATURE_BACKTRACE])
])
dnl ===================================================================
dnl Sanity checks for Emscripten SDK setup
dnl ===================================================================
EMSCRIPTEN_MIN_MAJOR=3
EMSCRIPTEN_MIN_MINOR=1
EMSCRIPTEN_MIN_TINY=46
EMSCRIPTEN_MIN_VERSION="${EMSCRIPTEN_MIN_MAJOR}.${EMSCRIPTEN_MIN_MINOR}.${EMSCRIPTEN_MIN_TINY}"
EMSCRIPTEN_WORKERJS=
if test "$_os" = "Emscripten"; then
AC_MSG_CHECKING([if Emscripten is at least $EMSCRIPTEN_MIN_VERSION])
if test -z "$EMSCRIPTEN_VERSION_H"; then
AS_IF([test -z "$EMSDK"],
[AC_MSG_ERROR([No \$EMSDK environment variable.])])
EMSCRIPTEN_VERSION_H=$EMSDK/upstream/emscripten/cache/sysroot/include/emscripten/version.h
if test ! -f "$EMSCRIPTEN_VERSION_H"; then
EMSCRIPTEN_VERSION_H=$EMSDK/emscripten/main/cache/sysroot/include/emscripten/version.h
fi
fi
if test -f "$EMSCRIPTEN_VERSION_H"; then
EMSCRIPTEN_MAJOR=$($GREP __EMSCRIPTEN_major__ "$EMSCRIPTEN_VERSION_H" | $SED -ne 's/.*__EMSCRIPTEN_major__ //p')
EMSCRIPTEN_MINOR=$($GREP __EMSCRIPTEN_minor__ "$EMSCRIPTEN_VERSION_H" | $SED -ne 's/.*__EMSCRIPTEN_minor__ //p')
EMSCRIPTEN_TINY=$($GREP __EMSCRIPTEN_tiny__ "$EMSCRIPTEN_VERSION_H" | $SED -ne 's/.*__EMSCRIPTEN_tiny__ //p')
else
EMSCRIPTEN_DEFINES=$(echo | emcc -dM -E - | $GREP __EMSCRIPTEN_)
EMSCRIPTEN_MAJOR=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 's/.*__EMSCRIPTEN_major__ //p')
EMSCRIPTEN_MINOR=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 's/.*__EMSCRIPTEN_minor__ //p')
EMSCRIPTEN_TINY=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 's/.*__EMSCRIPTEN_tiny__ //p')
fi
EMSCRIPTEN_VERSION="${EMSCRIPTEN_MAJOR}.${EMSCRIPTEN_MINOR}.${EMSCRIPTEN_TINY}"
check_semantic_version_three_prefixed EMSCRIPTEN MIN
if test $? -eq 0; then
AC_MSG_RESULT([yes ($EMSCRIPTEN_VERSION)])
else
AC_MSG_ERROR([no, found $EMSCRIPTEN_VERSION])
fi
EMSCRIPTEN_ERROR=0
if ! command -v emconfigure >/dev/null 2>&1; then
AC_MSG_WARN([emconfigure must be in your \$PATH])
EMSCRIPTEN_ERROR=1
fi
if test -z "$EMMAKEN_JUST_CONFIGURE"; then
AC_MSG_WARN(["\$EMMAKEN_JUST_CONFIGURE wasn't set by emconfigure. Prefix configure or use autogen.sh])
EMSCRIPTEN_ERROR=1
fi
EMSDK_FILE_PACKAGER="$(em-config EMSCRIPTEN_ROOT)"/tools/file_packager
if ! test -x "$EMSDK_FILE_PACKAGER"; then
AC_MSG_WARN([No file_packager found in $(em-config EMSCRIPTEN_ROOT)/tools/file_packager.])
EMSCRIPTEN_ERROR=1
fi
if test $EMSCRIPTEN_ERROR -ne 0; then
AC_MSG_ERROR(["Please fix your EMSDK setup to build with Emscripten!"])
fi
dnl Some build-side things are conditional on "EMSCRIPTEN in BUILD_TYPE_FOR_HOST":
BUILD_TYPE="$BUILD_TYPE EMSCRIPTEN"
dnl Generation of .worker.js files has been dropped completely from Emscripten 3.1.68, and the
dnl generated files were just unused dummies since Emscripten 3.1.58:
AC_MSG_CHECKING([if Emscripten still depends on a separate .worker.js file])
check_semantic_version_three 3 1 58 "$EMSCRIPTEN_MAJOR" "$EMSCRIPTEN_MINOR" "$EMSCRIPTEN_TINY"
if test $? -ne 0; then
AC_MSG_RESULT([yes])
EMSCRIPTEN_WORKERJS=TRUE
else
AC_MSG_RESULT([no])
fi
fi
AC_SUBST(EMSDK_FILE_PACKAGER)
AC_SUBST(EMSCRIPTEN_EXTRA_QTLOADER_CONFIG)
AC_SUBST(EMSCRIPTEN_EXTRA_SOFFICE_PRE_JS)
AC_SUBST(EMSCRIPTEN_WORKERJS)
###############################################################################
# Extensions switches --enable/--disable
###############################################################################
# By default these should be enabled unless having extra dependencies.
# If there is extra dependency over configure options then the enable should
# be automagic based on whether the requiring feature is enabled or not.
# All this options change anything only with --enable-extension-integration.
# The name of this option and its help string makes it sound as if
# extensions are built anyway, just not integrated in the installer,
# if you use --disable-extension-integration. Is that really the
# case?
AC_ARG_ENABLE(ios-simulator,
AS_HELP_STRING([--enable-ios-simulator],
[build for iOS simulator])
)
libo_FUZZ_ARG_ENABLE(extension-integration,
AS_HELP_STRING([--disable-extension-integration],
[Disable integration of the built extensions in the installer of the
product. Use this switch to disable the integration.])
)
AC_ARG_ENABLE(avmedia,
AS_HELP_STRING([--disable-avmedia],
[Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.]),
,test "${enable_avmedia+set}" = set || enable_avmedia=yes)
AC_ARG_ENABLE(database-connectivity,
AS_HELP_STRING([--disable-database-connectivity],
[Disable various database connectivity. Work in progress, use only if you are hacking on it.])
)
# This doesn't mean not building (or "integrating") extensions
# (although it probably should; i.e. it should imply
# --disable-extension-integration I guess), it means not supporting
# any extension mechanism at all
libo_FUZZ_ARG_ENABLE(extensions,
AS_HELP_STRING([--disable-extensions],
[Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
)
AC_ARG_ENABLE(scripting,
AS_HELP_STRING([--disable-scripting],
[Disable BASIC, Java, Python and .NET. Work in progress, use only if you are hacking on it.]),
,test "${enable_scripting+set}" = set || enable_scripting=yes)
# This is mainly for Android and iOS, but could potentially be used in some
# special case otherwise, too, so factored out as a separate setting
AC_ARG_ENABLE(dynamic-loading,
AS_HELP_STRING([--disable-dynamic-loading],
[Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
)
libo_FUZZ_ARG_ENABLE(report-builder,
AS_HELP_STRING([--disable-report-builder],
[Disable the Report Builder.])
)
libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
AS_HELP_STRING([--enable-ext-wiki-publisher],
[Enable the Wiki Publisher extension.])
)
libo_FUZZ_ARG_ENABLE(lpsolve,
AS_HELP_STRING([--disable-lpsolve],
[Disable compilation of the lp solve solver ])
)
libo_FUZZ_ARG_ENABLE(coinmp,
AS_HELP_STRING([--disable-coinmp],
[Disable compilation of the CoinMP solver ])
)
libo_FUZZ_ARG_ENABLE(pdfimport,
AS_HELP_STRING([--disable-pdfimport],
[Disable building the PDF import feature.])
)
libo_FUZZ_ARG_ENABLE(pdfium,
AS_HELP_STRING([--disable-pdfium],
[Disable building PDFium. Results in insecure PDF signature verification.])
)
libo_FUZZ_ARG_ENABLE(skia,
AS_HELP_STRING([--disable-skia],
[Disable building Skia. Use --enable-skia=debug to build without optimizations.])
)
libo_FUZZ_ARG_ENABLE(skia-vulkan-validation,
AS_HELP_STRING([--enable-skia-vulkan-validation],
[Enable Vulkan validation layers under Skia. The Vulkan SDK must be installed externally.])
)
###############################################################################
dnl ---------- *** ----------
libo_FUZZ_ARG_ENABLE(mergelibs,
AS_HELP_STRING([--enable-mergelibs=yes/no/more],
[Merge several of the smaller libraries into one big "merged" library.
The "more" option will link even more of the smaller libraries.
"more" not appropriate for distros which split up LibreOffice into multiple packages.
It is only appropriate for situations where all of LO is delivered in a single install/package. ])
)
libo_FUZZ_ARG_ENABLE(breakpad,
AS_HELP_STRING([--enable-breakpad],
[Enables breakpad for crash reporting.])
)
libo_FUZZ_ARG_ENABLE(crashdump,
AS_HELP_STRING([--disable-crashdump],
[Disable dump.ini and dump-file, when --enable-breakpad])
)
AC_ARG_ENABLE(fetch-external,
AS_HELP_STRING([--disable-fetch-external],
[Disables fetching external tarballs from web sources.])
)
AC_ARG_ENABLE(fuzzers,
AS_HELP_STRING([--enable-fuzzers],
[Enables building libfuzzer targets for fuzz testing.])
)
libo_FUZZ_ARG_ENABLE(pch,
AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
[Enables precompiled header support for C++. Forced default on Windows/VC build.
Using 'system' will include only external headers, 'base' will add also headers
from base modules, 'normal' will also add all headers except from the module built,
'full' will use all suitable headers even from a module itself.])
)
libo_FUZZ_ARG_ENABLE(epm,
AS_HELP_STRING([--enable-epm],
[LibreOffice includes self-packaging code, that requires epm, however epm is
useless for large scale package building.])
)
libo_FUZZ_ARG_ENABLE(odk,
AS_HELP_STRING([--enable-odk],
[Enable building the Office Development Kit, the part that extensions need to build against])
)
AC_ARG_ENABLE(mpl-subset,
AS_HELP_STRING([--enable-mpl-subset],
[Don't compile any pieces which are not MPL or more liberally licensed])
)
libo_FUZZ_ARG_ENABLE(evolution2,
AS_HELP_STRING([--enable-evolution2],
[Allows the built-in evolution 2 addressbook connectivity build to be
enabled.])
)
AC_ARG_ENABLE(avahi,
AS_HELP_STRING([--enable-avahi],
[Determines whether to use Avahi to advertise Impress to remote controls.])
)
AC_ARG_ENABLE(msvc-analyze,
AS_HELP_STRING([--enable-msvc-analyze],
[Determines whether to enable the Microsoft Visual Studio /analyze flag to provide additional warnings.])
)
libo_FUZZ_ARG_ENABLE(werror,
AS_HELP_STRING([--enable-werror],
[Turn warnings to errors. (Has no effect in modules where the treating
of warnings as errors is disabled explicitly.)]),
,)
libo_FUZZ_ARG_ENABLE(assert-always-abort,
AS_HELP_STRING([--enable-assert-always-abort],
[make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
,)
libo_FUZZ_ARG_ENABLE(dbgutil,
AS_HELP_STRING([--enable-dbgutil],
[Provide debugging support from --enable-debug and include additional debugging
utilities such as object counting or more expensive checks.
This is the recommended option for developers.
Note that this makes the build ABI incompatible, it is not possible to mix object
files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
libo_FUZZ_ARG_ENABLE(debug,
AS_HELP_STRING([--enable-debug],
[Include debugging information, disable compiler optimization and inlining plus
extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
libo_FUZZ_ARG_ENABLE(split-debug,
AS_HELP_STRING([--disable-split-debug],
[Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
libo_FUZZ_ARG_ENABLE(gdb-index,
AS_HELP_STRING([--disable-gdb-index],
[Disables creating debug information in the gdb index format, which makes gdb start faster.
The feature requires a linker that supports the --gdb-index option.]))
libo_FUZZ_ARG_ENABLE(sal-log,
AS_HELP_STRING([--enable-sal-log],
[Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
libo_FUZZ_ARG_ENABLE(symbols,
AS_HELP_STRING([--enable-symbols],
[Generate debug information.
By default, enabled for --enable-debug and --enable-dbgutil, disabled
otherwise. It is possible to explicitly specify gbuild build targets
(where 'all' means everything, '-' prepended means to not enable, '/' appended means
everything in the directory; there is no ordering, more specific overrides
more general, and disabling takes precedence).
Example: --enable-symbols="all -sw/ -Library_sc".]))
libo_FUZZ_ARG_ENABLE(optimized,
AS_HELP_STRING([--enable-optimized=<yes/no/debug>],
[Whether to compile with optimization flags.
By default, disabled for --enable-debug and --enable-dbgutil, enabled
otherwise. Using 'debug' will try to use only optimizations that should
not interfere with debugging. For Emscripten we default to optimized (-O1)
debug build, as otherwise binaries become too large.]))
libo_FUZZ_ARG_ENABLE(runtime-optimizations,
AS_HELP_STRING([--disable-runtime-optimizations],
[Statically disable certain runtime optimizations (like rtl/alloc.h or
JVM JIT) that are known to interact badly with certain dynamic analysis
tools (like -fsanitize=address or Valgrind). By default, disabled iff
CC contains "-fsanitize=*". (For Valgrind, those runtime optimizations
are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
AC_ARG_WITH(valgrind,
AS_HELP_STRING([--with-valgrind],
[Make availability of Valgrind headers a hard requirement.]))
libo_FUZZ_ARG_ENABLE(compiler-plugins,
AS_HELP_STRING([--enable-compiler-plugins],
[Enable compiler plugins that will perform additional checks during
building. Enabled automatically by --enable-dbgutil.
Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
COMPILER_PLUGINS_DEBUG=
if test "$enable_compiler_plugins" = debug; then
enable_compiler_plugins=yes
COMPILER_PLUGINS_DEBUG=TRUE
fi
libo_FUZZ_ARG_ENABLE(compiler-plugins-analyzer-pch,
AS_HELP_STRING([--disable-compiler-plugins-analyzer-pch],
[Disable use of precompiled headers when running the Clang compiler plugin analyzer. Not
relevant in the --disable-compiler-plugins case.]))
libo_FUZZ_ARG_ENABLE(ooenv,
AS_HELP_STRING([--enable-ooenv],
[Enable ooenv for the instdir installation.]))
AC_ARG_ENABLE(lto,
AS_HELP_STRING([--enable-lto],
[Enable link-time optimization. Suitable for (optimised) product builds. Building might take
longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
linker.)]))
AC_ARG_ENABLE(python,
AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
[Enables or disables Python support at run-time.
Also specifies what Python to use at build-time.
'fully-internal' even forces the internal version for uses of Python
during the build.
On macOS the only choices are
'internal' (default) or 'fully-internal'. Otherwise the default is 'auto'.
]))
libo_FUZZ_ARG_ENABLE(gtk3,
AS_HELP_STRING([--disable-gtk3],
[Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
,test "${test_gtk3}" = no -o "${enable_gtk3+set}" = set || enable_gtk3=yes)
AC_ARG_ENABLE(gtk4,
AS_HELP_STRING([--enable-gtk4],
[Determines whether to use Gtk+ 4.0 vclplug on platforms where Gtk+ 4.0 is available.]))
AC_ARG_ENABLE(atspi-tests,
AS_HELP_STRING([--disable-atspi-tests],
[Determines whether to enable AT-SPI2 tests for the GTK3 vclplug.]))
AC_ARG_ENABLE(introspection,
AS_HELP_STRING([--enable-introspection],
[Generate files for GObject introspection. Requires --enable-gtk3. (Typically used by
Linux distributions.)]))
AC_ARG_ENABLE(split-app-modules,
AS_HELP_STRING([--enable-split-app-modules],
[Split file lists for app modules, e.g. base, calc.
Has effect only with make distro-pack-install]),
,)
AC_ARG_ENABLE(split-opt-features,
AS_HELP_STRING([--enable-split-opt-features],
[Split file lists for some optional features, e.g. pyuno, testtool.
Has effect only with make distro-pack-install]),
,)
libo_FUZZ_ARG_ENABLE(cairo-canvas,
AS_HELP_STRING([--disable-cairo-canvas],
[Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
,)
libo_FUZZ_ARG_ENABLE(dbus,
AS_HELP_STRING([--disable-dbus],
[Determines whether to enable features that depend on dbus.
e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
,test "${enable_dbus+set}" = set || enable_dbus=yes)
libo_FUZZ_ARG_ENABLE(sdremote,
AS_HELP_STRING([--disable-sdremote],
[Determines whether to enable Impress remote control (i.e. the server component).]),
,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
AS_HELP_STRING([--disable-sdremote-bluetooth],
[Determines whether to build sdremote with bluetooth support.
Requires dbus on Linux.]))
libo_FUZZ_ARG_ENABLE(gio,
AS_HELP_STRING([--disable-gio],
[Determines whether to use the GIO support.]),
,test "${enable_gio+set}" = set || enable_gio=yes)
AC_ARG_ENABLE(qt5,
AS_HELP_STRING([--enable-qt5],
[Determines whether to use Qt5 vclplug on platforms where Qt5 is
available.]),
,)
AC_ARG_ENABLE(qt6,
AS_HELP_STRING([--enable-qt6],
[Determines whether to use Qt6 vclplug on platforms where Qt6 is
available.]),
,)
AC_ARG_ENABLE(qt6-multimedia,
AS_HELP_STRING([--disable-qt6-multimedia],
[Determines whether to enable media playback using QtMultimedia when using the qt6/kf6 VCL plugins.]))
AC_ARG_ENABLE(kf5,
AS_HELP_STRING([--enable-kf5],
[Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
KF5 are available.]),
,)
AC_ARG_ENABLE(kf6,
AS_HELP_STRING([--enable-kf6],
[Determines whether to use KF6 vclplug on platforms where Qt6 and
KF6 are available.]),
,)
AC_ARG_ENABLE(gtk3_kde5,
AS_HELP_STRING([--enable-gtk3-kde5],
[Determines whether to use Gtk3 vclplug with KF5 file dialogs on
platforms where Gtk3, Qt5 and Plasma is available.]),
,)
AC_ARG_ENABLE(gen,
AS_HELP_STRING([--enable-gen],
[To select the gen backend in case of --disable-dynamic-loading.
Per default auto-enabled when X11 is used.]),
,test "${test_gen}" = no -o "${enable_gen+set}" = set || enable_gen=yes)
AC_ARG_ENABLE(gui,
AS_HELP_STRING([--disable-gui],
[Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
,enable_gui=yes)
libo_FUZZ_ARG_ENABLE(randr,
AS_HELP_STRING([--disable-randr],
[Disable RandR support in the vcl project.]),
,test "${enable_randr+set}" = set || enable_randr=yes)
libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
AS_HELP_STRING([--disable-gstreamer-1-0],
[Disable building with the gstreamer 1.0 avmedia backend.]),
,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
# Enable by default on Linux and macOS only
if test $_os = Darwin -o $_os = Linux -o $_os = WINNT; then
libo_FUZZ_ARG_ENABLE([eot],
[AS_HELP_STRING([--disable-eot],
[Disable support for Embedded OpenType fonts.])],
,test "${enable_eot+set}" = set || enable_eot=yes)
else
libo_FUZZ_ARG_ENABLE([eot],
[AS_HELP_STRING([--enable-eot],
[Enable support for Embedded OpenType fonts.])],
,test "${enable_eot+set}" = set || enable_eot=no)
fi
libo_FUZZ_ARG_ENABLE(cve-tests,
AS_HELP_STRING([--disable-cve-tests],
[Prevent CVE tests to be executed]),
,)
libo_FUZZ_ARG_ENABLE(nan-tests,
AS_HELP_STRING([--disable-nan-tests],
[Prevent NaN payload tests to be executed]),
,)
AC_ARG_ENABLE(build-opensymbol,
AS_HELP_STRING([--enable-build-opensymbol],
[Do not use the prebuilt opens___.ttf. Build it instead. This needs
fontforge installed.]),
,)
AC_ARG_ENABLE(dependency-tracking,
AS_HELP_STRING([--enable-dependency-tracking],
[Do not reject slow dependency extractors.])[
--disable-dependency-tracking
Disables generation of dependency information.
Speed up one-time builds.],
,)
AC_ARG_ENABLE(icecream,
AS_HELP_STRING([--enable-icecream],
[Use the 'icecream' distributed compiling tool to speedup the compilation.
It defaults to /opt/icecream for the location of the icecream gcc/g++
wrappers, you can override that using --with-gcc-home=/the/path switch.]),
,)
AC_ARG_ENABLE(ld,
AS_HELP_STRING([--enable-ld=<linker>],
[Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
By default tries to use the best linker possible, use --disable-ld to use the default linker.
If <linker> contains any ':', the part before the first ':' is used as the value of
-fuse-ld, while the part after the first ':' is used as the value of --ld-path (which is
needed for Clang 12).]),
,)
AC_ARG_ENABLE(cpdb,
AS_HELP_STRING([--enable-cpdb],
[Build CPDB (Common Print Dialog Backends) support.]),
,)
libo_FUZZ_ARG_ENABLE(cups,
AS_HELP_STRING([--disable-cups],
[Do not build cups support.])
)
AC_ARG_ENABLE(ccache,
AS_HELP_STRING([--disable-ccache],
[Do not try to use ccache automatically.
By default we will try to detect if ccache is available; in that case if
CC/CXX are not yet set, and --enable-icecream is not given, we
attempt to use ccache. --disable-ccache disables ccache completely.
Additionally ccache's depend mode is enabled if possible,
use --enable-ccache=nodepend to enable ccache without depend mode.
]),
,)
AC_ARG_ENABLE(z7-debug,
AS_HELP_STRING([--enable-z7-debug],
[Makes the MSVC compiler use -Z7 for debugging instead of the default -Zi. Using this option takes
more disk spaces but allows to use ccache. Final PDB files are created even with this option enabled.
Enabled by default if ccache is detected.]))
libo_FUZZ_ARG_ENABLE(online-update,
AS_HELP_STRING([--enable-online-update],
[Enable the online update service that will check for new versions of
LibreOffice. Disabled by default. Requires --with-privacy-policy-url to be set.]),
,)
libo_FUZZ_ARG_ENABLE(online-update-mar,
AS_HELP_STRING([--enable-online-update-mar],
[Enable the Mozilla-like online update service that will
check for new versions of LibreOffice. Currently only works for
Windows and Linux. Disabled by default.]),
,)
libo_FUZZ_ARG_WITH(online-update-mar-baseurl,
AS_HELP_STRING([--with-online-update-mar-baseurl=...],
[Set the base URL value for --enable-online-update-mar.
(Can be left off for debug purposes, even if that may render the feature
non-functional.)]),
,)
libo_FUZZ_ARG_WITH(online-update-mar-certificateder,
AS_HELP_STRING([--with-online-update-mar-certificateder=...],
[Set the certificate DER value for --enable-online-update-mar.
(Can be left off for debug purposes, even if that may render the feature
non-functional.)]),
,)
libo_FUZZ_ARG_WITH(online-update-mar-certificatename,
AS_HELP_STRING([--with-online-update-mar-certificatename=...],
[Set the certificate name value for --enable-online-update-mar.
(Can be left off for debug purposes, even if that may render the feature
non-functional.)]),
,)
libo_FUZZ_ARG_WITH(online-update-mar-certificatepath,
AS_HELP_STRING([--with-online-update-mar-certificatepath=...],
[Set the certificate path value for --enable-online-update-mar.
(Can be left off for debug purposes, even if that may render the feature
non-functional.)]),
,)
libo_FUZZ_ARG_ENABLE(extension-update,
AS_HELP_STRING([--disable-extension-update],
[Disable possibility to update installed extensions.]),
,)
libo_FUZZ_ARG_ENABLE(release-build,
AS_HELP_STRING([--enable-release-build],
[Enable release build. Note that the "release build" choice is orthogonal to
whether symbols are present, debug info is generated, or optimization
is done.
See https://wiki.documentfoundation.org/Development/DevBuild]),
,)
libo_FUZZ_ARG_ENABLE(hardening-flags,
AS_HELP_STRING([--enable-hardening-flags],
[Enable automatically using hardening compiler flags. Distros typically
instead use their default configuration via CXXFLAGS, etc. But this provides a
convenient set of default hardening flags for non-distros]),
,)
AC_ARG_ENABLE(windows-build-signing,
AS_HELP_STRING([--enable-windows-build-signing],
[Enable signing of windows binaries (*.exe, *.dll)]),
,)
AC_ARG_ENABLE(silent-msi,
AS_HELP_STRING([--enable-silent-msi],
[Enable MSI with LIMITUI=1 (silent install).]),
,)
AC_ARG_ENABLE(wix,
AS_HELP_STRING([--enable-wix],
[Build Windows installer using WiX.]),
,)
AC_ARG_ENABLE(macosx-code-signing,
AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
[Sign executables, dylibs, frameworks and the app bundle. If you
don't provide an identity the first suitable certificate
in your keychain is used.]),
,)
AC_ARG_ENABLE(macosx-package-signing,
AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
[Create a .pkg suitable for uploading to the Mac App Store and sign
it. If you don't provide an identity the first suitable certificate
in your keychain is used.]),
,)
AC_ARG_ENABLE(macosx-sandbox,
AS_HELP_STRING([--enable-macosx-sandbox],
[Make the app bundle run in a sandbox. Requires code signing.
Is required by apps distributed in the Mac App Store, and implies
adherence to App Store rules.]),
,)
AC_ARG_WITH(macosx-bundle-identifier,
AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
[Define the macOS bundle identifier. Default is the somewhat weird
org.libreoffice.script ("script", huh?).]),
,with_macosx_bundle_identifier=org.libreoffice.script)
AC_ARG_WITH(macosx-provisioning-profile,
AS_HELP_STRING([--with-macosx-provisioning-profile=/path/to/mac.provisionprofile],
[Specify the path to a provisioning profile to use]),
,)
AC_ARG_WITH(product-name,
AS_HELP_STRING([--with-product-name='My Own Office Suite'],
[Define the product name. Default is AC_PACKAGE_NAME.]),
,with_product_name=$PRODUCTNAME)
libo_FUZZ_ARG_ENABLE(community-flavor,
AS_HELP_STRING([--disable-community-flavor],
[Disable the Community branding.]),
,)
AC_ARG_WITH(package-version,
AS_HELP_STRING([--with-package-version='3.1.4.5'],
[Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
,)
libo_FUZZ_ARG_ENABLE(readonly-installset,
AS_HELP_STRING([--enable-readonly-installset],
[Prevents any attempts by LibreOffice to write into its installation. That means
at least that no "system-wide" extensions can be added. Partly experimental work in
progress, probably not fully implemented. Always enabled for macOS.]),
,)
libo_FUZZ_ARG_ENABLE(mariadb-sdbc,
AS_HELP_STRING([--disable-mariadb-sdbc],
[Disable the build of the MariaDB/MySQL-SDBC driver.])
)
libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
AS_HELP_STRING([--disable-postgresql-sdbc],
[Disable the build of the PostgreSQL-SDBC driver.])
)
libo_FUZZ_ARG_ENABLE(lotuswordpro,
AS_HELP_STRING([--disable-lotuswordpro],
[Disable the build of the Lotus Word Pro filter.]),
,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
libo_FUZZ_ARG_ENABLE(firebird-sdbc,
AS_HELP_STRING([--disable-firebird-sdbc],
[Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
AC_ARG_ENABLE(bogus-pkg-config,
AS_HELP_STRING([--enable-bogus-pkg-config],
[MACOSX only: on MacOSX pkg-config can cause trouble. by default if one is found in the PATH, an error is issued. This flag turn that error into a warning.]),
)
AC_ARG_ENABLE(openssl,
AS_HELP_STRING([--disable-openssl],
[Disable using libssl/libcrypto from OpenSSL. If disabled,
components will use NSS. Work in progress,
use only if you are hacking on it.]),
,enable_openssl=yes)
libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
AS_HELP_STRING([--enable-cipher-openssl-backend],
[Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
Requires --enable-openssl.]))
AC_ARG_ENABLE(nss,
AS_HELP_STRING([--disable-nss],
[Disable using NSS. If disabled,
components will use openssl. Work in progress,
use only if you are hacking on it.]),
,enable_nss=yes)
AC_ARG_ENABLE(library-bin-tar,
AS_HELP_STRING([--enable-library-bin-tar],
[Enable the building and reused of tarball of binary build for some 'external' libraries.
Some libraries can save their build result in a tarball
stored in TARFILE_LOCATION. That binary tarball is
uniquely identified by the source tarball,
the content of the config_host.mk file and the content
of the top-level directory in core for that library
If this option is enabled, then if such a tarfile exist, it will be untarred
instead of the source tarfile, and the build step will be skipped for that
library.
If a proper tarfile does not exist, then the normal source-based
build is done for that library and a proper binary tarfile is created
for the next time.]),
)
AC_ARG_ENABLE(dconf,
AS_HELP_STRING([--disable-dconf],
[Disable the dconf configuration backend (enabled by default where
available).]))
libo_FUZZ_ARG_ENABLE(formula-logger,
AS_HELP_STRING(
[--enable-formula-logger],
[Enable formula logger for logging formula calculation flow in Calc.]
)
)
AC_ARG_ENABLE(ldap,
AS_HELP_STRING([--disable-ldap],
[Disable LDAP support.]),
,enable_ldap=yes)
AC_ARG_ENABLE(opencl,
AS_HELP_STRING([--disable-opencl],
[Disable OpenCL support.]),
,enable_opencl=yes)
libo_FUZZ_ARG_ENABLE(librelogo,
AS_HELP_STRING([--disable-librelogo],
[Do not build LibreLogo.]),
,enable_librelogo=yes)
AC_ARG_ENABLE(wasm-strip,
AS_HELP_STRING([--enable-wasm-strip],
[Strip the static build like for WASM/emscripten platform.]),
,)
AC_ARG_WITH(wasm-module,
AS_HELP_STRING([--with-wasm-module=<writer/calc/impress>],
[Specify which main module to build for wasm.
Default value is 'calc writer'.]),
, [with_wasm_module='calc writer'])
# Don't include impress by default. Debug builds become too large for Chromium
# with 'calc impress writer' enabled. (buffer source exceeds maximum size)
if test "$_os" = Emscripten; then
AC_ARG_ENABLE(emscripten-jspi,
AS_HELP_STRING([--enable-emscripten-jspi],
[Experimentally enable use of the Emscripten -sJSPI feature.]))
else
enable_emscripten_jspi=
fi
if test "$_os" = Emscripten; then
AC_ARG_ENABLE(emscripten-proxy-to-pthread,
AS_HELP_STRING([--disable-emscripten-proxy-to-pthread],
[Experimentally disable use of the Emscripten -sPROXY_TO_PTHREAD feature.]),,
enable_emscripten_proxy_to_pthread=yes)
else
enable_emscripten_proxy_to_pthread=
fi
if test "$_os" = Emscripten; then
AC_ARG_ENABLE(emscripten-proxy-posix-sockets,
AS_HELP_STRING([--enable-emscripten-proxy-posix-sockets],
[Enable experimental Emscripten support for full POSIX sockets over WebSocket proxy
server (-sPROXY_POSIX_SOCKETS).]))
else
enable_emscripten_proxy_posix_sockets=
fi
AC_ARG_ENABLE(xmlhelp,
AS_HELP_STRING([--disable-xmlhelp],
[Disable XML help support]),
,enable_xmlhelp=yes)
AC_ARG_ENABLE(customtarget-components,
AS_HELP_STRING([--enable-customtarget-components],
[Generates the static UNO object constructor mapping from the build.]))
AC_ARG_ENABLE(cli,
AS_HELP_STRING([--disable-cli],
[Disable the generation of old CLI bindings.]),
,enable_cli=yes)
AC_ARG_WITH(extra-cc-flags,
AS_HELP_STRING([--with-extra-cc-flags=...],
[Specify extra flags (like GCC's -fdiagnostics-color=always, which is useful in combination
with the GNU Make --output-sync option) to add to the end of the CC variable.]))
AC_ARG_WITH(extra-cxx-flags,
AS_HELP_STRING([--with-extra-cxx-flags=...],
[Specify extra flags (like GCC's -fdiagnostics-color=always, which is useful in combination
with the GNU Make --output-sync option) to add to the end of the CXX variable.]))
dnl ===================================================================
dnl Optional Packages (--with/without-)
dnl ===================================================================
AC_ARG_WITH(gcc-home,
AS_HELP_STRING([--with-gcc-home],
[Specify the location of gcc/g++ manually. This can be used in conjunction
with --enable-icecream when icecream gcc/g++ wrappers are installed in a
non-default path.]),
,)
AC_ARG_WITH(gnu-patch,
AS_HELP_STRING([--with-gnu-patch],
[Specify location of GNU patch on Solaris or FreeBSD.]),
,)
AC_ARG_WITH(build-platform-configure-options,
AS_HELP_STRING([--with-build-platform-configure-options],
[Specify options for the configure script run for the *build* platform in a cross-compilation]),
,)
AC_ARG_WITH(gnu-cp,
AS_HELP_STRING([--with-gnu-cp],
[Specify location of GNU cp on Solaris or FreeBSD.]),
,)
AC_ARG_WITH(external-tar,
AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
[Specify an absolute path of where to find (and store) tarfiles.]),
TARFILE_LOCATION=$withval ,
)
AC_ARG_WITH(referenced-git,
AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
[Specify another checkout directory to reference. This makes use of
git submodule update --reference, and saves a lot of diskspace
when having multiple trees side-by-side.]),
GIT_REFERENCE_SRC=$withval ,
)
AC_ARG_WITH(linked-git,
AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
[Specify a directory where the repositories of submodules are located.
This uses a method similar to git-new-workdir to get submodules.]),
GIT_LINK_SRC=$withval ,
)
AC_ARG_WITH(galleries,
AS_HELP_STRING([--with-galleries],
[Specify how galleries should be built. It is possible either to
build these internally from source ("build"),
or to disable them ("no")]),
)
AC_ARG_WITH(templates,
AS_HELP_STRING([--with-templates],
[Specify we build with or without template files. It is possible either to
build with templates ("yes"),
or to disable them ("no")]),
)
AC_ARG_WITH(theme,
AS_HELP_STRING([--with-theme="theme1 theme2..."],
[Choose which themes to include. By default those themes with an '*' are included.
Possible choices: *breeze, *breeze_dark, *breeze_dark_svg, *breeze_svg,
*colibre, *colibre_svg, *colibre_dark, *colibre_dark_svg,
*elementary, *elementary_svg,
*karasa_jaga, *karasa_jaga_svg,
*sifr, *sifr_dark, *sifr_dark_svg, *sifr_svg,
*sukapura, *sukapura_dark, *sukapura_dark_svg, *sukapura_svg.]),
,)
libo_FUZZ_ARG_WITH(helppack-integration,
AS_HELP_STRING([--without-helppack-integration],
[It will not integrate the helppacks to the installer
of the product. Please use this switch to use the online help
or separate help packages.]),
,)
libo_FUZZ_ARG_WITH(fonts,
AS_HELP_STRING([--without-fonts],
[LibreOffice includes some third-party fonts to provide a reliable basis for
help content, templates, samples, etc. When these fonts are already
known to be available on the system then you should use this option.]),
,)
libo_FUZZ_ARG_WITH(docrepair-fonts,
AS_HELP_STRING([--with-docrepair-fonts],
[LibreOffice optionally includes fonts from 'The DocRepair Project' that
provide metrically equivalent fallback fonts for a variety of common fonts
seen in Office Open XML documents. See https://github.com/docrepair-fonts
for more details. This option has no effect when --without-fonts is used.]),
,)
AC_ARG_WITH(epm,
AS_HELP_STRING([--with-epm],
[Decides which epm to use. Default is to use the one from the system if
one is built. When either this is not there or you say =internal epm
will be built.]),
,)
AC_ARG_WITH(package-format,
AS_HELP_STRING([--with-package-format],
[Specify package format(s) for LibreOffice installation sets. The
implicit --without-package-format leads to no installation sets being
generated. Possible values: archive, bsd, deb, dmg, emscripten,
installed, msi, pkg, and rpm.
Example: --with-package-format='deb rpm']),
,)
AC_ARG_WITH(tls,
AS_HELP_STRING([--with-tls],
[Decides which TLS/SSL and cryptographic implementations to use for
LibreOffice's code. Default is to use NSS although OpenSSL is also
possible. Notice that selecting NSS restricts the usage of OpenSSL
in LO's code but selecting OpenSSL doesn't restrict by now the
usage of NSS in LO's code. Possible values: openssl, nss.
Example: --with-tls="nss"]),
,)
AC_ARG_WITH(system-libs,
AS_HELP_STRING([--with-system-libs],
[Use libraries already on system -- enables all --with-system-* flags.]),
,)
AC_ARG_WITH(system-bzip2,
AS_HELP_STRING([--with-system-bzip2],
[Use bzip2 already on system. Used when --enable-online-update-mar
or --enable-python=internal]),,
[with_system_bzip2="$with_system_libs"])
AC_ARG_WITH(system-headers,
AS_HELP_STRING([--with-system-headers],
[Use headers already on system -- enables all --with-system-* flags for
external packages whose headers are the only entities used i.e.
boost/odbc/sane-header(s).]),,
[with_system_headers="$with_system_libs"])
AC_ARG_WITH(system-jars,
AS_HELP_STRING([--without-system-jars],
[When building with --with-system-libs, also the needed jars are expected
on the system. Use this to disable that]),,
[with_system_jars="$with_system_libs"])
AC_ARG_WITH(system-cairo,
AS_HELP_STRING([--with-system-cairo],
[Use cairo libraries already on system. Happens automatically for
(implicit) --enable-gtk3.]))
AC_ARG_WITH(system-epoxy,
AS_HELP_STRING([--with-system-epoxy],
[Use epoxy libraries already on system. Happens automatically for
(implicit) --enable-gtk3.]),,
[with_system_epoxy="$with_system_libs"])
AC_ARG_WITH(myspell-dicts,
AS_HELP_STRING([--with-myspell-dicts],
[Adds myspell dictionaries to the LibreOffice installation set]),
,)
AC_ARG_WITH(system-dicts,
AS_HELP_STRING([--without-system-dicts],
[Do not use dictionaries from system paths.]),
,)
AC_ARG_WITH(external-dict-dir,
AS_HELP_STRING([--with-external-dict-dir],
[Specify external dictionary dir.]),
,)
AC_ARG_WITH(external-hyph-dir,
AS_HELP_STRING([--with-external-hyph-dir],
[Specify external hyphenation pattern dir.]),
,)
AC_ARG_WITH(external-thes-dir,
AS_HELP_STRING([--with-external-thes-dir],
[Specify external thesaurus dir.]),
,)
AC_ARG_WITH(system-zlib,
AS_HELP_STRING([--with-system-zlib],
[Use zlib already on system.]),,
[with_system_zlib=auto])
AC_ARG_WITH(system-zstd,
AS_HELP_STRING([--with-system-zstd=@<:@yes|no|auto@:>@],
[Use zstd already on system [default=auto].]),,
[with_system_zstd=auto])
AC_ARG_WITH(system-jpeg,
AS_HELP_STRING([--with-system-jpeg],
[Use jpeg already on system.]),,
[with_system_jpeg="$with_system_libs"])
AC_ARG_WITH(system-expat,
AS_HELP_STRING([--with-system-expat],
[Use expat already on system.]),,
[with_system_expat="$with_system_libs"])
AC_ARG_WITH(system-libxml,
AS_HELP_STRING([--with-system-libxml],
[Use libxml/libxslt already on system.]),,
[with_system_libxml=auto])
AC_ARG_WITH(system-openldap,
AS_HELP_STRING([--with-system-openldap],
[Use the OpenLDAP LDAP SDK already on system.]),,
[with_system_openldap="$with_system_libs"])
libo_FUZZ_ARG_ENABLE(poppler,
AS_HELP_STRING([--disable-poppler],
[Disable building Poppler.])
)
AC_ARG_WITH(system-poppler,
AS_HELP_STRING([--with-system-poppler],
[Use system poppler (only needed for PDF import).]),,
[with_system_poppler="$with_system_libs"])
AC_ARG_WITH(system-abseil,
AS_HELP_STRING([--with-system-abseil],
[Use the abseil libraries already on system.]),,
[with_system_abseil="$with_system_libs"])
AC_ARG_WITH(system-openjpeg,
AS_HELP_STRING([--with-system-openjpeg],
[Use the OpenJPEG library already on system.]),,
[with_system_openjpeg="$with_system_libs"])
libo_FUZZ_ARG_ENABLE(gpgmepp,
AS_HELP_STRING([--disable-gpgmepp],
[Disable building gpgmepp. Do not use in normal cases unless you want to fix potential problems it causes.])
)
AC_ARG_WITH(system-gpgmepp,
AS_HELP_STRING([--with-system-gpgmepp],
[Use gpgmepp already on system]),,
[with_system_gpgmepp="$with_system_libs"])
AC_ARG_WITH(system-mariadb,
AS_HELP_STRING([--with-system-mariadb],
[Use MariaDB/MySQL libraries already on system.]),,
[with_system_mariadb="$with_system_libs"])
AC_ARG_ENABLE(bundle-mariadb,
AS_HELP_STRING([--enable-bundle-mariadb],
[When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
)
AC_ARG_WITH(system-postgresql,
AS_HELP_STRING([--with-system-postgresql],
[Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
[with_system_postgresql="$with_system_libs"])
AC_ARG_WITH(libpq-path,
AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
[Use this PostgreSQL C interface (libpq) installation for building
the PostgreSQL-SDBC extension.]),
,)
AC_ARG_WITH(system-firebird,
AS_HELP_STRING([--with-system-firebird],
[Use Firebird libraries already on system, for building the Firebird-SDBC
driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
[with_system_firebird="$with_system_libs"])
AC_ARG_WITH(system-libtommath,
AS_HELP_STRING([--with-system-libtommath],
[Use libtommath already on system]),,
[with_system_libtommath="$with_system_libs"])
AC_ARG_WITH(system-hsqldb,
AS_HELP_STRING([--with-system-hsqldb],
[Use hsqldb already on system.]))
AC_ARG_WITH(hsqldb-jar,
AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
[Specify path to jarfile manually.]),
HSQLDB_JAR=$withval)
libo_FUZZ_ARG_ENABLE(scripting-beanshell,
AS_HELP_STRING([--disable-scripting-beanshell],
[Disable support for scripts in BeanShell.]),
,
)
AC_ARG_WITH(system-beanshell,
AS_HELP_STRING([--with-system-beanshell],
[Use beanshell already on system.]),,
[with_system_beanshell="$with_system_jars"])
AC_ARG_WITH(beanshell-jar,
AS_HELP_STRING([--with-beanshell-jar=JARFILE],
[Specify path to jarfile manually.]),
BSH_JAR=$withval)
libo_FUZZ_ARG_ENABLE(scripting-javascript,
AS_HELP_STRING([--disable-scripting-javascript],
[Disable support for scripts in JavaScript.]),
,
)
AC_ARG_WITH(system-rhino,
AS_HELP_STRING([--with-system-rhino],
[Use rhino already on system.]),,
[with_system_rhino="$with_system_jars"])
AC_ARG_WITH(rhino-jar,
AS_HELP_STRING([--with-rhino-jar=JARFILE],
[Specify path to jarfile manually.]),
RHINO_JAR=$withval)
AC_ARG_WITH(system-jfreereport,
AS_HELP_STRING([--with-system-jfreereport],
[Use JFreeReport already on system.]),,
[with_system_jfreereport="$with_system_jars"])
AC_ARG_WITH(sac-jar,
AS_HELP_STRING([--with-sac-jar=JARFILE],
[Specify path to jarfile manually.]),
SAC_JAR=$withval)
AC_ARG_WITH(libxml-jar,
AS_HELP_STRING([--with-libxml-jar=JARFILE],
[Specify path to jarfile manually.]),
LIBXML_JAR=$withval)
AC_ARG_WITH(flute-jar,
AS_HELP_STRING([--with-flute-jar=JARFILE],
[Specify path to jarfile manually.]),
FLUTE_JAR=$withval)
AC_ARG_WITH(jfreereport-jar,
AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
[Specify path to jarfile manually.]),
JFREEREPORT_JAR=$withval)
AC_ARG_WITH(liblayout-jar,
AS_HELP_STRING([--with-liblayout-jar=JARFILE],
[Specify path to jarfile manually.]),
LIBLAYOUT_JAR=$withval)
AC_ARG_WITH(libloader-jar,
AS_HELP_STRING([--with-libloader-jar=JARFILE],
[Specify path to jarfile manually.]),
LIBLOADER_JAR=$withval)
AC_ARG_WITH(libformula-jar,
AS_HELP_STRING([--with-libformula-jar=JARFILE],
[Specify path to jarfile manually.]),
LIBFORMULA_JAR=$withval)
AC_ARG_WITH(librepository-jar,
AS_HELP_STRING([--with-librepository-jar=JARFILE],
[Specify path to jarfile manually.]),
LIBREPOSITORY_JAR=$withval)
AC_ARG_WITH(libfonts-jar,
AS_HELP_STRING([--with-libfonts-jar=JARFILE],
[Specify path to jarfile manually.]),
LIBFONTS_JAR=$withval)
AC_ARG_WITH(libserializer-jar,
AS_HELP_STRING([--with-libserializer-jar=JARFILE],
[Specify path to jarfile manually.]),
LIBSERIALIZER_JAR=$withval)
AC_ARG_WITH(libbase-jar,
AS_HELP_STRING([--with-libbase-jar=JARFILE],
[Specify path to jarfile manually.]),
LIBBASE_JAR=$withval)
AC_ARG_WITH(system-odbc,
AS_HELP_STRING([--with-system-odbc],
[Use the odbc headers already on system.]),,
[with_system_odbc="auto"])
AC_ARG_WITH(system-sane,
AS_HELP_STRING([--with-system-sane],
[Use sane.h already on system.]),,
[with_system_sane="$with_system_headers"])
AC_ARG_WITH(system-bluez,
AS_HELP_STRING([--with-system-bluez],
[Use bluetooth.h already on system.]),,
[with_system_bluez="$with_system_headers"])
AC_ARG_WITH(system-boost,
AS_HELP_STRING([--with-system-boost],
[Use boost already on system.]),,
[with_system_boost="$with_system_headers"])
AC_ARG_WITH(system-dragonbox,
AS_HELP_STRING([--with-system-dragonbox],
[Use dragonbox already on system.]),,
[with_system_dragonbox="$with_system_headers"])
AC_ARG_WITH(system-frozen,
AS_HELP_STRING([--with-system-frozen],
[Use frozen already on system.]),,
[with_system_frozen="$with_system_headers"])
AC_ARG_WITH(system-libfixmath,
AS_HELP_STRING([--with-system-libfixmath],
[Use libfixmath already on system.]),,
[with_system_libfixmath="$with_system_libs"])
AC_ARG_WITH(system-glm,
AS_HELP_STRING([--with-system-glm],
[Use glm already on system.]),,
[with_system_glm="$with_system_headers"])
AC_ARG_WITH(system-hunspell,
AS_HELP_STRING([--with-system-hunspell],
[Use libhunspell already on system.]),,
[with_system_hunspell="$with_system_libs"])
libo_FUZZ_ARG_ENABLE(cairo-rgba,
AS_HELP_STRING([--enable-cairo-rgba],
[Use RGBA order, instead of default BRGA. Not possible with --with-system-cairo]))
libo_FUZZ_ARG_ENABLE(zxing,
AS_HELP_STRING([--disable-zxing],
[Disable use of zxing external library.]))
AC_ARG_WITH(system-zxing,
AS_HELP_STRING([--with-system-zxing],
[Use libzxing already on system.]),,
[with_system_zxing="$with_system_libs"])
AC_ARG_WITH(system-zxcvbn,
AS_HELP_STRING([--with-system-zxcvbn],
[Use libzxcvbn already on system.]),,
[with_system_zxcvbn="$with_system_libs"])
AC_ARG_WITH(system-box2d,
AS_HELP_STRING([--with-system-box2d],
[Use box2d already on system.]),,
[with_system_box2d="$with_system_libs"])
AC_ARG_WITH(system-mythes,
AS_HELP_STRING([--with-system-mythes],
[Use mythes already on system.]),,
[with_system_mythes="$with_system_libs"])
AC_ARG_WITH(system-altlinuxhyph,
AS_HELP_STRING([--with-system-altlinuxhyph],
[Use ALTLinuxhyph already on system.]),,
[with_system_altlinuxhyph="$with_system_libs"])
AC_ARG_WITH(system-lpsolve,
AS_HELP_STRING([--with-system-lpsolve],
[Use lpsolve already on system.]),,
[with_system_lpsolve="$with_system_libs"])
AC_ARG_WITH(system-colamd,
AS_HELP_STRING([--with-system-colamd],
[Use COLAMD already on system.]),,
[with_system_colamd="$with_system_libs"])
AC_ARG_WITH(system-coinmp,
AS_HELP_STRING([--with-system-coinmp],
[Use CoinMP already on system.]),,
[with_system_coinmp="$with_system_libs"])
AC_ARG_WITH(system-liblangtag,
AS_HELP_STRING([--with-system-liblangtag],
[Use liblangtag library already on system.]),,
[with_system_liblangtag="$with_system_libs"])
AC_ARG_WITH(system-lockfile,
AS_HELP_STRING([--with-system-lockfile[=file]],
[Detect a system lockfile program or use the \$file argument.]))
AC_ARG_WITH(webdav,
AS_HELP_STRING([--without-webdav],
[Disable WebDAV support in the UCB.]))
AC_ARG_WITH(linker-hash-style,
AS_HELP_STRING([--with-linker-hash-style],
[Use linker with --hash-style=<style> when linking shared objects.
Possible values: "sysv", "gnu", "both". The default value is "gnu"
if supported on the build system, and "sysv" otherwise.]))
AC_ARG_WITH(jdk-home,
AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
[If you have installed JDK 8 or later on your system please supply the
path here. Note that this is not the location of the java command but the
location of the entire distribution. In case of cross-compiling, this
is the JDK of the host os. Use --with-build-platform-configure-options
to point to a different build platform JDK.]),
,)
AC_ARG_WITH(help,
AS_HELP_STRING([--with-help],
[Enable the build of help. There is a special parameter "common" that
can be used to bundle only the common part, .e.g help-specific icons.
This is useful when you build the helpcontent separately.])
[
Usage: --with-help build the old local help
--without-help no local help (default)
--with-help=html build the new HTML local help
--with-help=online build the new HTML online help
],
,)
AC_ARG_WITH(omindex,
AS_HELP_STRING([--with-omindex],
[Enable the support of xapian-omega index for online help.])
[
Usage: --with-omindex=server prepare the pages for omindex
but let xapian-omega be built in server.
--with-omindex=noxap do not prepare online pages
for xapian-omega
],
,)
libo_FUZZ_ARG_WITH(java,
AS_HELP_STRING([--with-java=<java command>],
[Specify the name of the Java interpreter command. Typically "java"
which is the default.
To build without support for Java components, applets, accessibility
or the XML filters written in Java, use --without-java or --with-java=no.]),
[ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
[ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
)
AC_ARG_WITH(jvm-path,
AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
[Use a specific JVM search path at runtime.
e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
,)
AC_ARG_WITH(ant-home,
AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
[If you have installed Apache Ant on your system, please supply the path here.
Note that this is not the location of the Ant binary but the location
of the entire distribution.]),
,)
AC_ARG_WITH(symbol-config,
AS_HELP_STRING([--with-symbol-config],
[Configuration for the crashreport symbol upload]),
[],
[with_symbol_config=no])
AC_ARG_WITH(export-validation,
AS_HELP_STRING([--without-export-validation],
[Disable validating OOXML and ODF files as exported from in-tree tests.]),
,with_export_validation=auto)
AC_ARG_WITH(bffvalidator,
AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
[Enables export validation for Microsoft Binary formats (doc, xls, ppt).
Requires installed Microsoft Office Binary File Format Validator.
Note: export-validation (--with-export-validation) is required to be turned on.
See https://web.archive.org/web/20200804155745/https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
,with_bffvalidator=no)
libo_FUZZ_ARG_WITH(junit,
AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
[Specifies the JUnit 4 jar file to use for JUnit-based tests.
--without-junit disables those tests. Not relevant in the --without-java case.]),
,with_junit=yes)
AC_ARG_WITH(hamcrest,
AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
[Specifies the hamcrest jar file to use for JUnit-based tests.
--without-junit disables those tests. Not relevant in the --without-java case.]),
,with_hamcrest=yes)
AC_ARG_WITH(yrs,
AS_HELP_STRING([--with-yrs=<absolute path to yrs build>],
[Specifies the built yrs git repo for very experimental experiments.]),
WITH_YRS=$withval
if test "x$withval" != "xno"; then
AC_DEFINE(ENABLE_YRS)
fi)
AC_SUBST(WITH_YRS)
AC_ARG_WITH(perl-home,
AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
[If you have installed Perl 5 Distribution, on your system, please
supply the path here. Note that this is not the location of the Perl
binary but the location of the entire distribution.]),
,)
libo_FUZZ_ARG_WITH(doxygen,
AS_HELP_STRING(
[--with-doxygen=<absolute path to doxygen executable>],
[Only relevant when --enable-odk is set. Specifies the doxygen
executable to use when generating ODK C/C++ documentation.
--without-doxygen disables generation of ODK C/C++ documentation.]),
,with_doxygen=yes)
AC_ARG_WITH(visual-studio,
AS_HELP_STRING([--with-visual-studio=<2019/2022/2022preview>],
[Specify which Visual Studio version to use in case several are
installed. Currently 2019 (default) and 2022 are supported.]),
,)
AC_ARG_WITH(windows-sdk,
AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10.0>],
[Specify which Windows SDK, or "Windows Kit", version to use
in case the one that came with the selected Visual Studio
is not what you want for some reason. Note that not all compiler/SDK
combinations are supported. The intent is that this option should not
be needed.]),
,)
AC_ARG_WITH(lang,
AS_HELP_STRING([--with-lang="es sw tu cs sk"],
[Use this option to build LibreOffice with additional UI language support.
English (US) is always included by default.
Separate multiple languages with space.
For all languages, use --with-lang=ALL.]),
,)
AC_ARG_WITH(locales,
AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
[Use this option to limit the locale information built in.
Separate multiple locales with space.
Very experimental and might well break stuff.
Just a desperate measure to shrink code and data size.
By default all the locales available is included.
Just works with --disable-dynloading. Defaults to "ALL".
This option is completely unrelated to --with-lang.])
[
Affects also our character encoding conversion
tables for encodings mainly targeted for a
particular locale, like EUC-CN and EUC-TW for
zh, ISO-2022-JP for ja.
Affects also our add-on break iterator data for
some languages.
For the default, all locales, don't use this switch at all.
Specifying just the language part of a locale means all matching
locales will be included.
],
,)
# Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
# and also by Mariadb/Mysql and libcurl since LibO 24.8
libo_FUZZ_ARG_WITH(krb5,
AS_HELP_STRING([--with-krb5],
[Enable MIT Kerberos 5 support in modules that support it.
By default automatically enabled on platforms
where a good system Kerberos 5 is available.]),
,)
libo_FUZZ_ARG_WITH(gssapi,
AS_HELP_STRING([--with-gssapi],
[Enable GSSAPI support in modules that support it.
By default automatically enabled on platforms
where a good system GSSAPI is available.]),
,)
libo_FUZZ_ARG_WITH(lxml,
AS_HELP_STRING([--without-lxml],
[gla11y will use python lxml when available, potentially building a local copy if necessary.
--without-lxml tells it to not use python lxml at all, which means that gla11y will only
report widget classes and ids.]),
,)
libo_FUZZ_ARG_WITH(latest-c++,
AS_HELP_STRING([--with-latest-c++],
[Try to enable the latest features of the C++ compiler, even if they are not yet part of a
published standard. This option is ignored when CXXFLAGS_CXX11 is set explicitly.]),,
[with_latest_c__=no])
AC_ARG_WITH(gtk3-build,
AS_HELP_STRING([--with-gtk3-build=<absolute path to GTK3 build>],
[(Windows-only) In order to build GtkTiledViewer on Windows, pass the path
to a GTK3 build, like '--with-gtk3-build=C:/gtk-build/gtk/x64/release'.]))
AC_ARG_WITH(keep-awake,
AS_HELP_STRING([--with-keep-awake],
[command to prefix make with in order to prevent the system from going to sleep/suspend
while building.
If no command is specified, defaults to using Awake (from Microsoft PowerToys) on Windows
and caffeinate on macOS]))
AC_ARG_WITH(dotnet,
AS_HELP_STRING([--with-dotnet=<absolute path to dotnet executable>],
[Specify the dotnet executable used to build .NET bindings and components.
Requires .NET SDK 8 or higher. To disable building .NET components, use
--without-dotnet or --with-dotnet=no.]))
dnl ===================================================================
dnl Branding
dnl ===================================================================
AC_ARG_WITH(branding,
AS_HELP_STRING([--with-branding=/path/to/images],
[Use given path to retrieve branding images set.])
[
Search for intro.png about.svg and logo.svg.
If any is missing, default ones will be used instead.
Search also progress.conf for progress
settings on intro screen :
PROGRESSBARCOLOR="255,255,255" Set color of
progress bar. Comma separated RGB decimal values.
PROGRESSSIZE="407,6" Set size of progress bar.
Comma separated decimal values (width, height).
PROGRESSPOSITION="61,317" Set position of progress
bar from left,top. Comma separated decimal values.
PROGRESSFRAMECOLOR="20,136,3" Set color of progress
bar frame. Comma separated RGB decimal values.
PROGRESSTEXTCOLOR="0,0,0" Set color of progress
bar text. Comma separated RGB decimal values.
PROGRESSTEXTBASELINE="287" Set vertical position of
progress bar text from top. Decimal value.
Default values will be used if not found.
],
,)
AC_ARG_WITH(extra-buildid,
AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
[Show addition build identification in about dialog.]),
,)
AC_ARG_WITH(vendor,
AS_HELP_STRING([--with-vendor="John the Builder"],
[Set vendor of the build.]),
,)
AC_ARG_WITH(privacy-policy-url,
AS_HELP_STRING([--with-privacy-policy-url="https://yourdomain/privacy-policy"],
[The URL to your privacy policy (needed when
enabling online-update or crashreporting via breakpad)]),
[if test "x$with_privacy_policy_url" = "xyes"; then
AC_MSG_FAILURE([you need to specify an argument when using --with-privacy-policy-url])
elif test "x$with_privacy_policy_url" = "xno"; then
with_privacy_policy_url="undefined"
fi]
,[with_privacy_policy_url="undefined"])
AC_ARG_WITH(android-package-name,
AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
[Set Android package name of the build.]),
,)
AC_ARG_WITH(compat-oowrappers,
AS_HELP_STRING([--with-compat-oowrappers],
[Install oo* wrappers in parallel with
lo* ones to keep backward compatibility.
Has effect only with make distro-pack-install]),
,)
AC_ARG_WITH(os-version,
AS_HELP_STRING([--with-os-version=<OSVERSION>],
[For FreeBSD users, use this option to override the detected OSVERSION.]),
,)
AC_ARG_WITH(parallelism,
AS_HELP_STRING([--with-parallelism],
[Number of jobs to run simultaneously during build. Parallel builds can
save a lot of time on multi-cpu machines. Defaults to the number of
CPUs on the machine, unless you configure --enable-icecream - then to
40.]),
,)
AC_ARG_WITH(all-tarballs,
AS_HELP_STRING([--with-all-tarballs],
[Download all external tarballs unconditionally]))
AC_ARG_WITH(gdrive-client-id,
AS_HELP_STRING([--with-gdrive-client-id],
[Provides the client id of the application for OAuth2 authentication
on Google Drive. If either this or --with-gdrive-client-secret is
empty, the feature will be disabled]),
)
AC_ARG_WITH(gdrive-client-secret,
AS_HELP_STRING([--with-gdrive-client-secret],
[Provides the client secret of the application for OAuth2
authentication on Google Drive. If either this or
--with-gdrive-client-id is empty, the feature will be disabled]),
)
AC_ARG_WITH(alfresco-cloud-client-id,
AS_HELP_STRING([--with-alfresco-cloud-client-id],
[Provides the client id of the application for OAuth2 authentication
on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
empty, the feature will be disabled]),
)
AC_ARG_WITH(alfresco-cloud-client-secret,
AS_HELP_STRING([--with-alfresco-cloud-client-secret],
[Provides the client secret of the application for OAuth2
authentication on Alfresco Cloud. If either this or
--with-alfresco-cloud-client-id is empty, the feature will be disabled]),
)
AC_ARG_WITH(onedrive-client-id,
AS_HELP_STRING([--with-onedrive-client-id],
[Provides the client id of the application for OAuth2 authentication
on OneDrive. If either this or --with-onedrive-client-secret is
empty, the feature will be disabled]),
)
AC_ARG_WITH(onedrive-client-secret,
AS_HELP_STRING([--with-onedrive-client-secret],
[Provides the client secret of the application for OAuth2
authentication on OneDrive. If either this or
--with-onedrive-client-id is empty, the feature will be disabled]),
)
dnl Check for coredumpctl support to present information about crashing test processes:
AC_ARG_WITH(coredumpctl,
AS_HELP_STRING([--with-coredumpctl],
[Use coredumpctl (together with systemd-run) to retrieve core dumps of crashing test
processes.]))
AC_ARG_WITH(buildconfig-recorded,
AS_HELP_STRING([--with-buildconfig-recorded],
[Put build config into version info reported by LOK. Incompatible with reproducible builds.]),
)
AC_MSG_CHECKING([whether to record build config])
if test -z "$with_buildconfig_recorded"; then
with_buildconfig_recorded=no
fi
if test "$with_buildconfig_recorded" = no; then
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([yes])
# replace backslashes, to get a valid c++ string
config_args=$(echo $ac_configure_args | tr '\\' '/')
AC_DEFINE_UNQUOTED([BUILDCONFIG],[["$config_args"]],[Options passed to configure script])
AC_DEFINE([BUILDCONFIG_RECORDED],[1],[Options passed to configure script])
fi
dnl ===================================================================
dnl Do we want to use pre-build binary tarball for recompile
dnl ===================================================================
if test "$enable_library_bin_tar" = "yes" ; then
USE_LIBRARY_BIN_TAR=TRUE
else
USE_LIBRARY_BIN_TAR=
fi
AC_SUBST(USE_LIBRARY_BIN_TAR)
dnl ===================================================================
dnl Test whether build target is Release Build
dnl ===================================================================
AC_MSG_CHECKING([whether build target is Release Build])
if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
AC_MSG_RESULT([no])
ENABLE_RELEASE_BUILD=
dnl Pu the value on one line as make (at least on macOS) seems to ignore
dnl the newlines and then complains about spaces.
GET_TASK_ALLOW_ENTITLEMENT='<!-- We want to be able to debug a hardened process when not building for release --><key>com.apple.security.get-task-allow</key><true/>'
else
AC_MSG_RESULT([yes])
ENABLE_RELEASE_BUILD=TRUE
GET_TASK_ALLOW_ENTITLEMENT=
fi
AC_SUBST(ENABLE_RELEASE_BUILD)
AC_SUBST(GET_TASK_ALLOW_ENTITLEMENT)
dnl ===================================================================
dnl Test whether build should auto use hardening compiler flags
dnl ===================================================================
AC_MSG_CHECKING([whether build should auto use hardening compiler flags])
if test "$enable_hardening_flags" = "" -o "$enable_hardening_flags" = "no"; then
AC_MSG_RESULT([no])
ENABLE_HARDENING_FLAGS=
else
AC_MSG_RESULT([yes])
ENABLE_HARDENING_FLAGS=TRUE
fi
AC_SUBST(ENABLE_HARDENING_FLAGS)
AC_MSG_CHECKING([whether to build a Community flavor])
if test -z "$enable_community_flavor" -o "$enable_community_flavor" = "yes"; then
AC_DEFINE(HAVE_FEATURE_COMMUNITY_FLAVOR)
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
dnl ===================================================================
dnl Test whether to sign Windows Build
dnl ===================================================================
AC_MSG_CHECKING([whether to sign windows build])
if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
AC_MSG_RESULT([yes])
WINDOWS_BUILD_SIGNING="TRUE"
else
AC_MSG_RESULT([no])
WINDOWS_BUILD_SIGNING="FALSE"
fi
AC_SUBST(WINDOWS_BUILD_SIGNING)
dnl ===================================================================
dnl MacOSX build and runtime environment options
dnl ===================================================================
AC_ARG_WITH(macosx-version-min-required,
AS_HELP_STRING([--with-macosx-version-min-required=<version>],
[set the minimum OS version needed to run the built LibreOffice])
[
e. g.: --with-macosx-version-min-required=10.15
],
,)
dnl ===================================================================
dnl Check for incompatible options set by fuzzing, and reset those
dnl automatically to working combinations
dnl ===================================================================
if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
"$enable_dbus" != "$enable_avahi"; then
AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
enable_avahi=$enable_dbus
fi
add_lopath_after ()
{
if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
fi
}
add_lopath_before ()
{
local IFS=${P_SEP}
local path_cleanup
local dir
for dir in $LO_PATH ; do
if test "$dir" != "$1" ; then
path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
fi
done
LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
}
dnl ===================================================================
dnl check for required programs (grep, awk, sed, bash)
dnl ===================================================================
pathmunge ()
{
local new_path
if test -n "$1"; then
if test "$build_os" = "cygwin"; then
if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
PathFormat "$1"
new_path=`cygpath -sm "$formatted_path"`
else
PathFormat "$1"
new_path=`cygpath -u "$formatted_path"`
fi
else
new_path="$1"
fi
if test "$2" = "after"; then
add_lopath_after "$new_path"
else
add_lopath_before "$new_path"
fi
fi
}
AC_PROG_AWK
AC_PATH_PROG( AWK, $AWK)
if test -z "$AWK"; then
AC_MSG_ERROR([install awk to run this script])
fi
AC_PATH_PROG(BASH, bash)
if test -z "$BASH"; then
AC_MSG_ERROR([bash not found in \$PATH])
fi
AC_SUBST(BASH)
# prefer parallel compression tools, if available
AC_PATH_PROG(COMPRESSIONTOOL, pigz)
if test -z "$COMPRESSIONTOOL"; then
AC_PATH_PROG(COMPRESSIONTOOL, gzip)
if test -z "$COMPRESSIONTOOL"; then
AC_MSG_ERROR([gzip not found in \$PATH])
fi
fi
AC_SUBST(COMPRESSIONTOOL)
AC_MSG_CHECKING([for GNU or BSD tar])
for a in $GNUTAR gtar gnutar tar bsdtar /usr/sfw/bin/gtar; do
$a --version 2> /dev/null | grep -E "GNU|bsdtar" 2>&1 > /dev/null
if test $? -eq 0; then
GNUTAR=$a
break
fi
done
AC_MSG_RESULT($GNUTAR)
if test -z "$GNUTAR"; then
AC_MSG_ERROR([not found. install GNU or BSD tar.])
fi
AC_SUBST(GNUTAR)
AC_MSG_CHECKING([for tar's option to strip components])
$GNUTAR --help 2> /dev/null | grep -E "bsdtar|strip-components" 2>&1 >/dev/null
if test $? -eq 0; then
STRIP_COMPONENTS="--strip-components"
else
$GNUTAR --help 2> /dev/null | grep -E "strip-path" 2>&1 >/dev/null
if test $? -eq 0; then
STRIP_COMPONENTS="--strip-path"
else
STRIP_COMPONENTS="unsupported"
fi
fi
AC_MSG_RESULT($STRIP_COMPONENTS)
if test x$STRIP_COMPONENTS = xunsupported; then
AC_MSG_ERROR([you need a tar that is able to strip components.])
fi
AC_SUBST(STRIP_COMPONENTS)
dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
dnl desktop OSes from "mobile" ones.
dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
dnl In other words, that when building for an OS that is not a
dnl "desktop" one but a "mobile" one, we are always cross-compiling.
dnl Note the direction of the implication; there is no assumption that
dnl cross-compiling would imply a non-desktop OS.
if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
BUILD_TYPE="$BUILD_TYPE DESKTOP"
AC_DEFINE(HAVE_FEATURE_DESKTOP)
if test "$_os" != Emscripten; then
AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
fi
fi
# explicitly doesn't include enable_gtk3=no and enable_qt5=yes, so it should
# also work with the default gtk3 plugin.
if test "$enable_wasm_strip" = "yes"; then
enable_avmedia=no
enable_libcmis=no
enable_coinmp=no
enable_cups=no
enable_database_connectivity=no
enable_dbus=no
enable_dconf=no
test "${enable_dynamic_loading+set}" = set -o "$_os" != Emscripten || enable_dynamic_loading=no
enable_extension_integration=no
enable_extensions=no
enable_extension_update=no
enable_gio=no
enable_gpgmepp=no
enable_ldap=no
enable_lotuswordpro=no
enable_lpsolve=no
enable_nss=no
enable_odk=no
enable_online_update=no
enable_opencl=no
enable_pdfimport=no
enable_randr=no
enable_report_builder=no
enable_scripting=no
enable_sdremote=no
enable_sdremote_bluetooth=no
enable_skia=no
enable_xmlhelp=no
enable_zxing=no
test_libepubgen=no
test_libcmis=no
with_galleries=no
with_gssapi=no
with_templates=no
with_x=no
test "${with_fonts+set}" = set || with_fonts=yes
dnl AC_DEFINE sets the value to 1 (TRUE) in the C++ header.
AC_DEFINE(ENABLE_WASM_STRIP_ACCESSIBILITY)
# AC_DEFINE(ENABLE_WASM_STRIP_CHART)
AC_DEFINE(ENABLE_WASM_STRIP_EXTRA)
# AC_DEFINE(ENABLE_WASM_STRIP_HUNSPELL)
AC_DEFINE(ENABLE_WASM_STRIP_PINGUSER)
AC_DEFINE(ENABLE_WASM_STRIP_PREMULTIPLY)
AC_DEFINE(ENABLE_WASM_STRIP_RECENT)
AC_DEFINE(ENABLE_WASM_STRIP_RECOVERYUI)
AC_DEFINE(ENABLE_WASM_STRIP_SPLASH)
fi
# Whether to build "avmedia" functionality or not.
if test "$enable_avmedia" = yes; then
BUILD_TYPE="$BUILD_TYPE AVMEDIA"
AC_DEFINE(HAVE_FEATURE_AVMEDIA)
else
test_gstreamer_1_0=no
fi
# Decide whether to build database connectivity stuff (including Base) or not.
if test "$enable_database_connectivity" != no; then
BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
else
if test "$_os" = iOS; then
AC_MSG_ERROR([Presumably can't disable DB connectivity on iOS.])
fi
disable_database_connectivity_dependencies
fi
if test -z "$enable_extensions"; then
# For iOS and Android Viewer, disable extensions unless specifically overridden with --enable-extensions.
if test $_os != iOS && test $_os != Android -o "$ENABLE_ANDROID_LOK" = TRUE ; then
enable_extensions=yes
fi
fi
DISABLE_SCRIPTING=''
if test "$enable_scripting" = yes; then
BUILD_TYPE="$BUILD_TYPE SCRIPTING"
AC_DEFINE(HAVE_FEATURE_SCRIPTING)
else
DISABLE_SCRIPTING='TRUE'
SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
fi
if test $_os = iOS -o $_os = Android -o $_os = Emscripten; then
# Disable dynamic_loading always for iOS and Android
enable_dynamic_loading=no
elif test -z "$enable_dynamic_loading"; then
# Otherwise enable it unless specifically disabled
enable_dynamic_loading=yes
fi
DISABLE_DYNLOADING=''
if test "$enable_dynamic_loading" = yes; then
BUILD_TYPE="$BUILD_TYPE DYNLOADING"
else
DISABLE_DYNLOADING='TRUE'
if test $_os != iOS -a $_os != Android; then
enable_database_connectivity=no
enable_nss=no
enable_odk=no
enable_python=no
enable_skia=no
with_java=no
fi
fi
AC_SUBST(DISABLE_DYNLOADING)
ENABLE_CUSTOMTARGET_COMPONENTS=
if test "$enable_customtarget_components" = yes -a "$DISABLE_DYNLOADING" = TRUE; then
ENABLE_CUSTOMTARGET_COMPONENTS=TRUE
if test -n "$with_locales" -a "$with_locales" != en -a "$with_locales" != ALL; then
AC_MSG_ERROR([Currently just --with-locales=all or en is supported with --enable-customtarget-components])
fi
fi
AC_SUBST(ENABLE_CUSTOMTARGET_COMPONENTS)
if test "$enable_extensions" = yes; then
BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
else
enable_extension_integration=no
enable_extension_update=no
fi
# remember SYSBASE value
AC_SUBST(SYSBASE)
dnl ===================================================================
dnl Sort out various gallery compilation options
dnl ===================================================================
WITH_GALLERY_BUILD=TRUE
AC_MSG_CHECKING([how to build and package galleries])
if test -n "${with_galleries}"; then
if test "$with_galleries" = "build"; then
if test "$enable_database_connectivity" = no; then
AC_MSG_ERROR([DB connectivity is needed for gengal / svx])
fi
AC_MSG_RESULT([build from source images internally])
elif test "$with_galleries" = "no"; then
WITH_GALLERY_BUILD=
AC_MSG_RESULT([disable non-internal gallery build])
else
AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
fi
else
if test $_os != iOS -a $_os != Android; then
AC_MSG_RESULT([internal src images for desktop])
else
WITH_GALLERY_BUILD=
AC_MSG_RESULT([disable src image build])
fi
fi
AC_SUBST(WITH_GALLERY_BUILD)
dnl ===================================================================
dnl Sort out various templates compilation options
dnl ===================================================================
WITH_TEMPLATES=TRUE
AC_MSG_CHECKING([build with or without template files])
if test -n "${with_templates}"; then
if test "$with_templates" = "yes"; then
AC_MSG_RESULT([enable all templates])
elif test "$with_templates" = "no"; then
WITH_TEMPLATES=
AC_MSG_RESULT([disable non-internal templates])
else
AC_MSG_ERROR([unknown value --with-templates=$with_templates])
fi
else
if test $_os != iOS -a $_os != Android -a $_os != Emscripten; then
AC_MSG_RESULT([enable all templates])
else
WITH_TEMPLATES=
AC_MSG_RESULT([disable non-internal templates])
fi
fi
AC_SUBST(WITH_TEMPLATES)
dnl ===================================================================
dnl Checks if ccache is available
dnl ===================================================================
CCACHE_DEPEND_MODE=
if test "$enable_ccache" = "no"; then
CCACHE=""
elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
case "%$CC%$CXX%" in
# If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
# assume that's good then
*%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
CCACHE_DEPEND_MODE=1
;;
*)
# try to use our own ccache if it is available and CCACHE was not already defined
if test -z "$CCACHE"; then
if test "$_os" = "WINNT"; then
ccache_ext=.exe # e.g. openssl build needs ccache.exe, not just ccache
fi
if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/ccache$ccache_ext" ; then
CCACHE="$LODE_HOME/opt/bin/ccache$ccache_ext"
elif test -x "/opt/lo/bin/ccache$ccache_ext"; then
CCACHE="/opt/lo/bin/ccache$ccache_ext"
fi
fi
AC_PATH_PROG([CCACHE],[ccache],[not found])
if test "$CCACHE" != "not found" -a "$_os" = "WINNT"; then
CCACHE=`win_short_path_for_make "$CCACHE"`
# check that it has MSVC support (it should recognize it in CCACHE_COMPILERTYPE)
rm -f conftest.txt
AC_MSG_CHECKING([whether $CCACHE has MSVC support])
CCACHE_COMPILERTYPE=cl CCACHE_LOGFILE=conftest.txt $CCACHE echo >/dev/null 2>/dev/null
if grep -q 'Config: (environment) compiler_type = cl' conftest.txt; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
CCACHE="not found"
fi
rm -f conftest.txt
fi
if test "$CCACHE" = "not found" -a "$_os" = "WINNT"; then
# on windows/VC perhaps sccache is around?
case "%$CC%$CXX%" in
# If $CC and/or $CXX already contain "sccache" (possibly suffixed with some version number etc),
# assume that's good then
*%sccache[[-_' ']]*|*/sccache[[-_' ']]*)
AC_MSG_NOTICE([sccache seems to be included in a pre-defined CC and/or CXX])
CCACHE_DEPEND_MODE=1
SCCACHE=1
;;
*)
# for sharing code below, reuse CCACHE env var
AC_PATH_PROG([CCACHE],[sccache],[not found])
if test "$CCACHE" != "not found"; then
CCACHE=`win_short_path_for_make "$CCACHE"`
SCCACHE=1
CCACHE_DEPEND_MODE=1
fi
;;
esac
fi
if test "$CCACHE" = "not found"; then
CCACHE=""
fi
if test -n "$CCACHE" -a -z "$SCCACHE"; then
CCACHE_DEPEND_MODE=1
# Need to check for ccache version: otherwise prevents
# caching of the results (like "-x objective-c++" for Mac)
if test $_os = Darwin -o $_os = iOS; then
# Check ccache version
AC_MSG_CHECKING([whether version of ccache is suitable])
CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
AC_MSG_RESULT([yes, $CCACHE_VERSION])
else
AC_MSG_RESULT([no, $CCACHE_VERSION])
CCACHE=""
CCACHE_DEPEND_MODE=
fi
fi
fi
if test "$enable_ccache" = yes && test -z "$CCACHE"; then
AC_MSG_ERROR([No suitable ccache found])
fi
;;
esac
else
CCACHE=""
fi
if test "$enable_ccache" = "nodepend"; then
CCACHE_DEPEND_MODE=""
fi
AC_SUBST(CCACHE_DEPEND_MODE)
# sccache defaults are good enough
if test "$CCACHE" != "" -a -z "$SCCACHE"; then
# e.g. (/home/rene/.config/ccache/ccache.conf) max_size = 20.0G
# or (...) max_size = 20.0 G
# -p works with both 4.2 and 4.4
ccache_size_msg=$([$CCACHE -p | $AWK /max_size/'{ print $4 $5 }' | sed -e 's/\.[0-9]*//'])
ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
if test "$ccache_size" = ""; then
ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
if test "$ccache_size" = ""; then
ccache_size=0
fi
# we could not determine the size or it was less than 1GB -> disable auto-ccache
if test $ccache_size -lt 1024; then
CCACHE=""
AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
else
# warn that ccache may be too small for debug build
AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
fi
else
if test $ccache_size -lt 5; then
#warn that ccache may be too small for debug build
AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
fi
fi
fi
ENABLE_Z7_DEBUG=
if test "$enable_z7_debug" != no; then
if test "$enable_z7_debug" = yes -o -n "$CCACHE"; then
ENABLE_Z7_DEBUG=TRUE
fi
else
AC_MSG_WARN([ccache will not work with --disable-z7-debug])
add_warning "ccache will not work with --disable-z7-debug"
fi
AC_SUBST(ENABLE_Z7_DEBUG)
dnl ===================================================================
dnl Checks for C compiler,
dnl The check for the C++ compiler is later on.
dnl ===================================================================
if test "$_os" != "WINNT"; then
GCC_HOME_SET="true"
AC_MSG_CHECKING([gcc home])
if test -z "$with_gcc_home"; then
if test "$enable_icecream" = "yes"; then
if test -d "/usr/lib/icecc/bin"; then
GCC_HOME="/usr/lib/icecc/"
elif test -d "/usr/libexec/icecc/bin"; then
GCC_HOME="/usr/libexec/icecc/"
elif test -d "/opt/icecream/bin"; then
GCC_HOME="/opt/icecream/"
else
AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
fi
else
GCC_HOME=`command -v gcc | $SED -e s,/bin/gcc,,`
GCC_HOME_SET="false"
fi
else
GCC_HOME="$with_gcc_home"
fi
AC_MSG_RESULT($GCC_HOME)
if test "$GCC_HOME_SET" = "true"; then
if test -z "$CC"; then
CC="$GCC_HOME/bin/gcc"
CC_BASE="gcc"
fi
if test -z "$CXX"; then
CXX="$GCC_HOME/bin/g++"
CXX_BASE="g++"
fi
fi
fi
COMPATH=`dirname "$CC"`
if test "$COMPATH" = "."; then
AC_PATH_PROGS(COMPATH, $CC)
dnl double square bracket to get single because of M4 quote...
COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
fi
COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
dnl ===================================================================
dnl Java support
dnl ===================================================================
AC_MSG_CHECKING([whether to build with Java support])
javacompiler="javac"
javadoc="javadoc"
if test "$with_java" != "no"; then
if test "$DISABLE_SCRIPTING" = TRUE; then
AC_MSG_RESULT([no, overridden by --disable-scripting])
ENABLE_JAVA=""
with_java=no
else
AC_MSG_RESULT([yes])
ENABLE_JAVA="TRUE"
AC_DEFINE(HAVE_FEATURE_JAVA)
fi
else
AC_MSG_RESULT([no])
ENABLE_JAVA=""
fi
AC_SUBST(ENABLE_JAVA)
dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
dnl ENABLE_JAVA="" indicate no Java support at all
dnl ===================================================================
dnl Check macOS SDK and compiler
dnl ===================================================================
if test $_os = Darwin; then
# The SDK in the currently selected Xcode should be found.
AC_MSG_CHECKING([what macOS SDK to use])
# XCode only ships with a single SDK for a while now, and using older SDKs alongside is not
# really supported anymore, instead you'd use different copies of Xcode, each with their own
# SDK, and thus xcrun will pick the SDK that matches the currently selected Xcode version
# also restricting the SDK version to "known good" versions doesn't seem necessary anymore, the
# problems that existed in the PPC days with target versions not being respected or random
# failures seems to be a thing of the past or rather: limiting either the Xcode version or the
# SDK version is enough, no need to do both...
MACOSX_SDK_PATH=`xcrun --sdk macosx --show-sdk-path 2> /dev/null`
if test ! -d "$MACOSX_SDK_PATH"; then
AC_MSG_ERROR([Could not find an appropriate macOS SDK])
fi
macosx_sdk=`xcodebuild -version -sdk "$MACOSX_SDK_PATH" SDKVersion`
MACOSX_SDK_BUILD_VERSION=$(xcodebuild -version -sdk "$MACOSX_SDK_PATH" ProductBuildVersion)
# format changed between 10.9 and 10.10 - up to 10.9 it was just four digits (1090), starting
# with macOS 10.10 it was switched to account for x.y.z with six digits, 10.10 is 101000,
# 10.10.2 is 101002
# we don't target the lower versions anymore, so it doesn't matter that we don't generate the
# correct version in case such an old SDK is specified, it will be rejected later anyway
MACOSX_SDK_VERSION=$(echo $macosx_sdk | $AWK -F. '{ print $1*10000+$2*100+$3 }')
# we require Xcode 14.2 or later, and thus macOS SDK 13.1 or later/older versions might work
# but are untested
if test $MACOSX_SDK_VERSION -lt 130300; then
AC_MSG_ERROR([macOS SDK $macosx_sdk is not supported, lowest supported version is 13.3])
fi
AC_MSG_RESULT([macOS SDK $macosx_sdk at $MACOSX_SDK_PATH])
AC_MSG_CHECKING([what minimum version of macOS to require])
if test "$with_macosx_version_min_required" = "" ; then
if test "$host_cpu" = x86_64; then
with_macosx_version_min_required="10.15";
else
with_macosx_version_min_required="11.0";
fi
fi
# see same notes about MACOSX_SDK_VERSION above
MAC_OS_X_VERSION_MIN_REQUIRED=$(echo $with_macosx_version_min_required | $AWK -F. '{ print $1*10000+$2*100+$3 }')
if test $MAC_OS_X_VERSION_MIN_REQUIRED -lt 101500; then
AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, minimum supported version is 10.15])
fi
AC_MSG_RESULT([$with_macosx_version_min_required])
AC_MSG_CHECKING([that macosx-version-min-required is coherent with macos-with-sdk])
if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MACOSX_SDK_VERSION; then
AC_MSG_ERROR([the version minimum required ($with_macosx_version_min_required) cannot be greater than the sdk level ($macosx_sdk)])
else
AC_MSG_RESULT([yes])
fi
# export this so that "xcrun" invocations later return matching values
DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
export DEVELOPER_DIR
FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
AC_MSG_CHECKING([whether Xcode is new enough])
my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
my_xcode_ver2=${my_xcode_ver1#Xcode }
my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
if test "$my_xcode_ver3" -ge 1403; then
AC_MSG_RESULT([yes ($my_xcode_ver2)])
if test $MAC_OS_X_VERSION_MIN_REQUIRED -lt 120000; then
if test "$my_xcode_ver3" -eq 1500; then
dnl the bug was already fixed on 15.1 and 15.2 still has the same OS requirements as 15.0
dnl in other words all affected users could update to a working Xcode version
AC_MSG_WARN([Use a current version of XCode or bump the minimum deployment target])
AC_MSG_WARN([[see https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Linking]])
AC_MSG_ERROR([Xcode 15.0 has a bug in the new linker that causes runtime crashes on macOS 11 - aborting])
fi
fi
else
AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 14.3])
fi
my_xcode_ver1=$(xcrun xcodebuild -version | tail -n 1)
MACOSX_XCODE_BUILD_VERSION=${my_xcode_ver1#Build version }
LIBTOOL=/usr/bin/libtool
INSTALL_NAME_TOOL=install_name_tool
if test -z "$save_CC"; then
stdlib=-stdlib=libc++
AC_MSG_CHECKING([what C compiler to use])
CC="`xcrun -find clang`"
CC_BASE=`first_arg_basename "$CC"`
if test "$host_cpu" = x86_64; then
CC+=" -target x86_64-apple-macos"
else
CC+=" -target arm64-apple-macos"
fi
CC+=" -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
AC_MSG_RESULT([$CC])
AC_MSG_CHECKING([what C++ compiler to use])
CXX="`xcrun -find clang++`"
CXX_BASE=`first_arg_basename "$CXX"`
if test "$host_cpu" = x86_64; then
CXX+=" -target x86_64-apple-macos"
else
CXX+=" -target arm64-apple-macos"
fi
CXX+=" $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
AC_MSG_RESULT([$CXX])
INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
AR=`xcrun -find ar`
NM=`xcrun -find nm`
STRIP=`xcrun -find strip`
LIBTOOL=`xcrun -find libtool`
RANLIB=`xcrun -find ranlib`
fi
AC_MSG_CHECKING([whether to do code signing])
if test -z "$enable_macosx_code_signing" -o "$enable_macosx_code_signing" == "no" ; then
AC_MSG_RESULT([no])
else
if test "$enable_macosx_code_signing" = yes; then
# By default use the first suitable certificate (?).
# https://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
# says that the "Mac Developer" certificate is useful just for self-testing. For distribution
# outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
# the App Store, the "3rd Party Mac Developer" one. I think it works best to the
# "Developer ID Application" one.
identity="Developer ID Application:"
else
identity=$enable_macosx_code_signing
fi
identity=`security find-identity -p codesigning -v 2>/dev/null | $AWK "/$identity/{print \\$2; exit}"`
if test -n "$identity"; then
MACOSX_CODESIGNING_IDENTITY=$identity
pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
MACOSX_CODESIGNING_TEAM_IDENTIFIER=`echo $pretty_name | sed -e 's#.*(\([[:alnum:]]*\))#\1#'`
AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
else
AC_MSG_ERROR([cannot determine identity to use])
fi
fi
AC_MSG_CHECKING([whether to create a Mac App Store package])
if test -z "$enable_macosx_package_signing" || test "$enable_macosx_package_signing" == no; then
AC_MSG_RESULT([no])
elif test -z "$MACOSX_CODESIGNING_IDENTITY"; then
AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
else
if test "$enable_macosx_package_signing" = yes; then
# By default use the first suitable certificate.
# It should be a "3rd Party Mac Developer Installer" one
identity="3rd Party Mac Developer Installer:"
else
identity=$enable_macosx_package_signing
fi
identity=`security find-identity -v 2>/dev/null | $AWK "/$identity/ {print \\$2; exit}"`
if test -n "$identity"; then
MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
else
AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
fi
fi
if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
AC_MSG_ERROR([You should not use the same identity for code and package signing])
fi
AC_MSG_CHECKING([whether to sandbox the application])
if test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
elif test "$enable_macosx_sandbox" = yes; then
ENABLE_MACOSX_SANDBOX=TRUE
AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
AC_MSG_CHECKING([what macOS app bundle identifier to use])
MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
if test -n "$with_macosx_provisioning_profile" ; then
if test ! -f "$with_macosx_provisioning_profile"; then
AC_MSG_ERROR([provisioning profile not found at $with_macosx_provisioning_profile])
else
MACOSX_PROVISIONING_PROFILE=$with_macosx_provisioning_profile
MACOSX_PROVISIONING_INFO=$([security cms -D -i "$MACOSX_PROVISIONING_PROFILE" | \
xmllint --xpath "//key[.='com.apple.application-identifier' or .='com.apple.developer.team-identifier'] \
| //key[.='com.apple.application-identifier' or .='com.apple.developer.team-identifier']/following-sibling::string[1]" - | \
sed -e 's#><#>\n\t<#g' -e 's#^#\t#'])
fi
fi
fi
AC_SUBST(MACOSX_SDK_PATH)
AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
AC_SUBST(INSTALL_NAME_TOOL)
AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
AC_SUBST(MACOSX_CODESIGNING_TEAM_IDENTIFIER)
AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
AC_SUBST(ENABLE_MACOSX_SANDBOX)
AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
AC_SUBST(MACOSX_PROVISIONING_INFO)
AC_SUBST(MACOSX_PROVISIONING_PROFILE)
AC_SUBST(MACOSX_SDK_BUILD_VERSION)
AC_SUBST(MACOSX_XCODE_BUILD_VERSION)
dnl ===================================================================
dnl Check iOS SDK and compiler
dnl ===================================================================
if test $_os = iOS; then
AC_MSG_CHECKING([what iOS SDK to use])
if test "$enable_ios_simulator" = "yes"; then
platformlc=iphonesimulator
versionmin=-mios-simulator-version-min=14.5
else
platformlc=iphoneos
versionmin=-miphoneos-version-min=14.5
fi
sysroot=`xcrun --sdk $platformlc --show-sdk-path`
if ! test -d "$sysroot"; then
AC_MSG_ERROR([Could not find iOS SDK $sysroot])
fi
AC_MSG_RESULT($sysroot)
stdlib="-stdlib=libc++"
AC_MSG_CHECKING([what C compiler to use])
CC="`xcrun -find clang`"
CC_BASE=`first_arg_basename "$CC"`
CC+=" -arch $host_cpu_for_clang -isysroot $sysroot $versionmin"
AC_MSG_RESULT([$CC])
AC_MSG_CHECKING([what C++ compiler to use])
CXX="`xcrun -find clang++`"
CXX_BASE=`first_arg_basename "$CXX"`
CXX+=" -arch $host_cpu_for_clang $stdlib -isysroot $sysroot $versionmin"
AC_MSG_RESULT([$CXX])
INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
AR=`xcrun -find ar`
NM=`xcrun -find nm`
STRIP=`xcrun -find strip`
LIBTOOL=`xcrun -find libtool`
RANLIB=`xcrun -find ranlib`
fi
AC_MSG_CHECKING([whether to treat the installation as read-only])
if test $_os = Darwin; then
enable_readonly_installset=yes
elif test "$enable_extensions" != yes; then
enable_readonly_installset=yes
fi
if test "$enable_readonly_installset" = yes; then
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
else
AC_MSG_RESULT([no])
fi
dnl ===================================================================
dnl Structure of install set
dnl ===================================================================
if test $_os = Darwin; then
LIBO_BIN_FOLDER=MacOS
LIBO_ETC_FOLDER=Resources
LIBO_LIBEXEC_FOLDER=MacOS
LIBO_LIB_FOLDER=Frameworks
LIBO_LIB_PYUNO_FOLDER=Resources
LIBO_SHARE_FOLDER=Resources
LIBO_SHARE_HELP_FOLDER=Resources/help
LIBO_SHARE_DOTNET_FOLDER=Resources/dotnet
LIBO_SHARE_JAVA_FOLDER=Resources/java
LIBO_SHARE_PRESETS_FOLDER=Resources/presets
LIBO_SHARE_READMES_FOLDER=Resources/readmes
LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
LIBO_SHARE_SHELL_FOLDER=Resources/shell
LIBO_URE_BIN_FOLDER=MacOS
LIBO_URE_ETC_FOLDER=Resources/ure/etc
LIBO_URE_LIB_FOLDER=Frameworks
LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
elif test $_os = WINNT; then
LIBO_BIN_FOLDER=program
LIBO_ETC_FOLDER=program
LIBO_LIBEXEC_FOLDER=program
LIBO_LIB_FOLDER=program
LIBO_LIB_PYUNO_FOLDER=program
LIBO_SHARE_FOLDER=share
LIBO_SHARE_HELP_FOLDER=help
LIBO_SHARE_DOTNET_FOLDER=program/dotnet
LIBO_SHARE_JAVA_FOLDER=program/classes
LIBO_SHARE_PRESETS_FOLDER=presets
LIBO_SHARE_READMES_FOLDER=readmes
LIBO_SHARE_RESOURCE_FOLDER=program/resource
LIBO_SHARE_SHELL_FOLDER=program/shell
LIBO_URE_BIN_FOLDER=program
LIBO_URE_ETC_FOLDER=program
LIBO_URE_LIB_FOLDER=program
LIBO_URE_MISC_FOLDER=program
LIBO_URE_SHARE_JAVA_FOLDER=program/classes
else
LIBO_BIN_FOLDER=program
LIBO_ETC_FOLDER=program
LIBO_LIBEXEC_FOLDER=program
LIBO_LIB_FOLDER=program
LIBO_LIB_PYUNO_FOLDER=program
LIBO_SHARE_FOLDER=share
LIBO_SHARE_HELP_FOLDER=help
LIBO_SHARE_DOTNET_FOLDER=program/dotnet
LIBO_SHARE_JAVA_FOLDER=program/classes
LIBO_SHARE_PRESETS_FOLDER=presets
LIBO_SHARE_READMES_FOLDER=readmes
if test "$enable_fuzzers" != yes; then
LIBO_SHARE_RESOURCE_FOLDER=program/resource
else
LIBO_SHARE_RESOURCE_FOLDER=resource
fi
LIBO_SHARE_SHELL_FOLDER=program/shell
LIBO_URE_BIN_FOLDER=program
LIBO_URE_ETC_FOLDER=program
LIBO_URE_LIB_FOLDER=program
LIBO_URE_MISC_FOLDER=program
LIBO_URE_SHARE_JAVA_FOLDER=program/classes
fi
AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
AC_DEFINE_UNQUOTED(LIBO_SHARE_DOTNET_FOLDER,"$LIBO_SHARE_DOTNET_FOLDER")
AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
# Not all of them needed in config_host.mk, add more if need arises
AC_SUBST(LIBO_BIN_FOLDER)
AC_SUBST(LIBO_ETC_FOLDER)
AC_SUBST(LIBO_LIB_FOLDER)
AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
AC_SUBST(LIBO_SHARE_FOLDER)
AC_SUBST(LIBO_SHARE_HELP_FOLDER)
AC_SUBST(LIBO_SHARE_DOTNET_FOLDER)
AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
AC_SUBST(LIBO_SHARE_READMES_FOLDER)
AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
AC_SUBST(LIBO_URE_BIN_FOLDER)
AC_SUBST(LIBO_URE_ETC_FOLDER)
AC_SUBST(LIBO_URE_LIB_FOLDER)
AC_SUBST(LIBO_URE_MISC_FOLDER)
AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
dnl ===================================================================
dnl Windows specific tests and stuff
dnl ===================================================================
reg_get_value()
{
# Return value: $regvalue
unset regvalue
if test "$build_os" = "wsl"; then
regvalue=$($WSL_LO_HELPER --read-registry $1 "$2/$3" 2>/dev/null)
return
elif test -n "$WSL_ONLY_AS_HELPER"; then
regvalue=$(reg.exe query "$(echo $2 | tr '/' '\\')" /v "$3" /reg:$1 |sed -ne "s|\s*$3.*REG_SZ\s*\(.*\)[\s\r]*$|\1|p")
return
fi
local _regentry="/proc/registry${1}/${2}/${3}"
if test -f "$_regentry"; then
# Stop bash complaining about \0 bytes in input, as it can't handle them.
# Registry keys read via /proc/registry* are always \0 terminated!
local _regvalue=$(tr -d '\0' < "$_regentry")
if test $? -eq 0; then
regvalue=$_regvalue
fi
fi
}
# Get a value from the 32-bit side of the Registry
reg_get_value_32()
{
reg_get_value "32" "$1" "$2"
}
# Get a value from the 64-bit side of the Registry
reg_get_value_64()
{
reg_get_value "64" "$1" "$2"
}
reg_list_values()
{
# Return value: $reglist
unset reglist
if test "$build_os" = "wsl"; then
reglist=$($WSL_LO_HELPER --list-registry $1 "$2" 2>/dev/null | tr -d '\r')
return
fi
reglist=$(ls "/proc/registry${1}/${2}")
}
# List values from the 32-bit side of the Registry
reg_list_values_32()
{
reg_list_values "32" "$1"
}
# List values from the 64-bit side of the Registry
reg_list_values_64()
{
reg_list_values "64" "$1"
}
case "$host_os" in
cygwin*|wsl*)
COM=MSC
OS=WNT
RTL_OS=Windows
if test "$GNUMAKE_WIN_NATIVE" = "TRUE" -o -n "$WSL_ONLY_AS_HELPER" ; then
P_SEP=";"
else
P_SEP=:
fi
case "$host_cpu" in
x86_64)
CPUNAME=X86_64
RTL_ARCH=X86_64
PLATFORMID=windows_x86_64
WINDOWS_X64=1
SCPDEFS="$SCPDEFS -DWINDOWS_X64"
WIN_HOST_ARCH="x64"
WIN_MULTI_ARCH="x86"
WIN_HOST_BITS=64
WIN_CLANG_TARGET="x86_64-pc-windows-msvc"
;;
i*86)
CPUNAME=INTEL
RTL_ARCH=x86
PLATFORMID=windows_x86
WIN_HOST_ARCH="x86"
WIN_HOST_BITS=32
WIN_OTHER_ARCH="x64"
WIN_CLANG_TARGET="i686-pc-windows-msvc"
;;
aarch64)
CPUNAME=AARCH64
RTL_ARCH=AARCH64
PLATFORMID=windows_aarch64
WINDOWS_X64=1
SCPDEFS="$SCPDEFS -DWINDOWS_AARCH64"
WIN_HOST_ARCH="arm64"
WIN_HOST_BITS=64
WIN_CLANG_TARGET="arm64-pc-windows-msvc"
;;
*)
AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
;;
esac
case "$build_cpu" in
x86_64) WIN_BUILD_ARCH="x64" ;;
i*86) WIN_BUILD_ARCH="x86" ;;
aarch64) WIN_BUILD_ARCH="arm64" ;;
*)
AC_MSG_ERROR([Unsupported build_cpu $build_cpu for host_os $host_os])
;;
esac
SCPDEFS="$SCPDEFS -D_MSC_VER"
;;
esac
# multi-arch is an arch, which can execute on the host (x86 on x64), while
# other-arch won't, but wouldn't break the build (x64 on x86).
if test -n "$WIN_MULTI_ARCH" -a -n "$WIN_OTHER_ARCH"; then
AC_MSG_ERROR([Broken configure.ac file: can't have set \$WIN_MULTI_ARCH and $WIN_OTHER_ARCH])
fi
if test "$build_cpu" != "$host_cpu" -o "$DISABLE_DYNLOADING" = TRUE; then
# To allow building Windows multi-arch releases without cross-tooling
if test "$DISABLE_DYNLOADING" = TRUE -o \( -z "$WIN_MULTI_ARCH" -a -z "$WIN_OTHER_ARCH" \); then
cross_compiling="yes"
fi
fi
if test "$cross_compiling" = "yes"; then
export CROSS_COMPILING=TRUE
if test "$enable_dynamic_loading" != yes -a "$enable_wasm_strip" = yes; then
ENABLE_WASM_STRIP=TRUE
fi
if test "$_os" = "Emscripten"; then
ENABLE_WASM_STRIP_ACCESSIBILITY=TRUE
ENABLE_WASM_STRIP_BASIC_DRAW_MATH_IMPRESS=TRUE
ENABLE_WASM_STRIP_CALC=TRUE
ENABLE_WASM_STRIP_WRITER=TRUE
for i in $with_wasm_module; do
case "$i" in
calc)
ENABLE_WASM_STRIP_ACCESSIBILITY=
ENABLE_WASM_STRIP_CALC=
;;
writer)
ENABLE_WASM_STRIP_WRITER=
;;
impress)
ENABLE_WASM_STRIP_ACCESSIBILITY=
ENABLE_WASM_STRIP_BASIC_DRAW_MATH_IMPRESS=
;;
*)
AC_MSG_ERROR([Unknown --with-wasm-module "$i"])
esac
done
if test "$ENABLE_WASM_STRIP_BASIC_DRAW_MATH_IMPRESS" = TRUE; then
test_libcdr=no
test_libetonyek=no
test_libfreehand=no
test_libmspub=no
test_libpagemaker=no
test_libqxp=no
test_libvisio=no
test_libzmf=no
fi
fi
else
CROSS_COMPILING=
BUILD_TYPE="$BUILD_TYPE NATIVE"
fi
AC_SUBST(CROSS_COMPILING)
AC_SUBST(ENABLE_WASM_STRIP)
AC_SUBST(ENABLE_WASM_STRIP_WRITER)
AC_SUBST(ENABLE_WASM_STRIP_BASIC_DRAW_MATH_IMPRESS)
AC_SUBST(ENABLE_WASM_STRIP_CALC)
AC_SUBST(ENABLE_WASM_STRIP_ACCESSIBILITY)
if test "$enable_emscripten_jspi" = yes; then
ENABLE_EMSCRIPTEN_JSPI=TRUE
AC_DEFINE(HAVE_EMSCRIPTEN_JSPI)
else
ENABLE_EMSCRIPTEN_JSPI=
fi
AC_SUBST(ENABLE_EMSCRIPTEN_JSPI)
if test "$enable_emscripten_proxy_to_pthread" = yes; then
ENABLE_EMSCRIPTEN_PROXY_TO_PTHREAD=TRUE
AC_DEFINE(HAVE_EMSCRIPTEN_PROXY_TO_PTHREAD)
else
ENABLE_EMSCRIPTEN_PROXY_TO_PTHREAD=
fi
AC_SUBST(ENABLE_EMSCRIPTEN_PROXY_TO_PTHREAD)
if test "$enable_emscripten_proxy_posix_sockets" = yes; then
ENABLE_EMSCRIPTEN_PROXY_POSIX_SOCKETS=TRUE
AC_DEFINE(HAVE_EMSCRIPTEN_PROXY_POSIX_SOCKETS)
else
ENABLE_EMSCRIPTEN_PROXY_POSIX_SOCKETS=
fi
AC_SUBST(ENABLE_EMSCRIPTEN_PROXY_POSIX_SOCKETS)
# Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
# NOTE: must _not_ be used for bundled external libraries!
ISYSTEM=
if test "$GCC" = "yes"; then
AC_MSG_CHECKING( for -isystem )
save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -isystem /usr/include -Werror"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
CFLAGS=$save_CFLAGS
if test -n "$ISYSTEM"; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
fi
if test -z "$ISYSTEM"; then
# fall back to using -I
ISYSTEM=-I
fi
AC_SUBST(ISYSTEM)
dnl ===================================================================
dnl Check which Visual Studio compiler is used
dnl ===================================================================
map_vs_year_to_version()
{
# Return value: $vsversion
unset vsversion
case $1 in
2019)
vsversion=16;;
2022)
vsversion=17;;
2022preview)
vsversion=17.14;;
*)
AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
esac
}
vs_versions_to_check()
{
# Args: $1 (optional) : versions to check, in the order of preference
# Return value: $vsversions
unset vsversions
if test -n "$1"; then
map_vs_year_to_version "$1"
vsversions=$vsversion
else
# Default version is 2019
vsversions="16"
fi
}
win_get_env_from_vsdevcmdbat()
{
local WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
printf '@set VSCMD_SKIP_SENDTELEMETRY=1\r\n' > $WRAPPERBATCHFILEPATH
PathFormat "$VC_PRODUCT_DIR"
printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$formatted_path" >> $WRAPPERBATCHFILEPATH
# use 'echo.%ENV%' syntax (instead of 'echo %ENV%') to avoid outputting "ECHO is off." in case when ENV is empty or a space
printf '@setlocal\r\n@echo.%%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
local result
if test "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
result=$(cd /mnt/c && cmd.exe /c $(wslpath -w $WRAPPERBATCHFILEPATH) | tr -d '\r')
else
chmod +x $WRAPPERBATCHFILEPATH
result=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
fi
rm -f $WRAPPERBATCHFILEPATH
printf '%s' "$result"
}
find_ucrt()
{
reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0" "InstallationFolder"
if test -n "$regvalue"; then
PathFormat "$regvalue"
UCRTSDKDIR=$formatted_path_unix
reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0" "ProductVersion"
if test -n "$regvalue"; then
UCRTVERSION="$regvalue".0
fi
# Rest if not exist
if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
UCRTSDKDIR=
fi
fi
if test -z "$UCRTSDKDIR"; then
ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
ide_env_file="${ide_env_dir}VsDevCmd.bat"
if test -f "$ide_env_file"; then
PathFormat "$(win_get_env_from_vsdevcmdbat UniversalCRTSdkDir)"
UCRTSDKDIR=$formatted_path_unix
UCRTVERSION=$(win_get_env_from_vsdevcmdbat UCRTVersion)
dnl Hack needed at least by tml:
if test "$UCRTVERSION" = 10.0.15063.0 \
-a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
-a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
then
UCRTVERSION=10.0.14393.0
fi
else
AC_MSG_ERROR([No UCRT found])
fi
fi
}
find_msvc()
{
# Find Visual C++
# Args: $1 (optional) : The VS version year
# Return values: $vctest, $vcyear, $vctoolset, $vcnumwithdot, $vcbuildnumber
unset vctest vctoolset vcnumwithdot vcbuildnumber
vs_versions_to_check "$1"
if test "$build_os" = wsl; then
vswhere="$PROGRAMFILESX86"
if test -z "$vswhere"; then
vswhere="c:\\Program Files (x86)"
fi
elif test -n "$WSL_ONLY_AS_HELPER"; then
vswhere="$(perl.exe -e 'print $ENV{"ProgramFiles(x86)"}')"
else
vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
fi
vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
PathFormat "$vswhere"
vswhere=$formatted_path_unix
for ver in $vsversions; do
vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr ${ver%%.*} + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
if test -z "$vswhereoutput"; then
vswhereoutput=`$vswhere -prerelease -version "@<:@ $ver , $(expr ${ver%%.*} + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
fi
# Fall back to all MS products (this includes VC++ Build Tools)
if ! test -n "$vswhereoutput"; then
AC_MSG_CHECKING([VC++ Build Tools and similar])
vswhereoutput=`$vswhere -products \* -version "@<:@ $ver , $(expr ${ver%%.*} + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
fi
if test -n "$vswhereoutput"; then
PathFormat "$vswhereoutput"
vctest=$formatted_path_unix
break
fi
done
if test -n "$vctest"; then
vcnumwithdot="$ver"
if test "${vcnumwithdot%%.*}" = "$vcnumwithdot"; then
vcnumwithdot=$vcnumwithdot.0
fi
case "$vcnumwithdot" in
16.0)
vcyear=2019
vctoolset=v142
;;
17.0 | 17.14)
vcyear=2022
vctoolset=v143
;;
esac
vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
fi
}
test_cl_exe()
{
AC_MSG_CHECKING([$1 compiler])
CL_EXE_PATH="$2/cl.exe"
if test ! -f "$CL_EXE_PATH"; then
if test "$1" = "multi-arch"; then
AC_MSG_WARN([no compiler (cl.exe) in $2])
return 1
else
AC_MSG_ERROR([no compiler (cl.exe) in $2])
fi
fi
dnl ===========================================================
dnl Check for the corresponding mspdb*.dll
dnl ===========================================================
# MSVC 15.0 has libraries from 14.0?
mspdbnum="140"
if test ! -e "$2/mspdb${mspdbnum}.dll"; then
AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $2, Visual Studio installation broken?])
fi
# The compiler has to find its shared libraries
OLD_PATH="$PATH"
PathFormat "$2"
PATH="$formatted_path_unix:$PATH"
if ! "$CL_EXE_PATH" -? </dev/null >/dev/null 2>&1; then
AC_MSG_ERROR([no compiler (cl.exe) in $2])
fi
PATH="$OLD_PATH"
AC_MSG_RESULT([$CL_EXE_PATH])
}
SOLARINC=
MSBUILD_PATH=
DEVENV=
if test "$_os" = "WINNT"; then
AC_MSG_CHECKING([Visual C++])
find_msvc "$with_visual_studio"
if test -z "$vctest"; then
if test -n "$with_visual_studio"; then
AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
else
AC_MSG_ERROR([no Visual Studio installation found])
fi
fi
AC_MSG_RESULT([])
VC_PRODUCT_DIR="$vctest/VC"
COMPATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber"
# $WIN_OTHER_ARCH is a hack to test the x64 compiler on x86, even if it's not multi-arch
if test -n "$WIN_MULTI_ARCH" -o -n "$WIN_OTHER_ARCH"; then
MSVC_MULTI_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/${WIN_MULTI_ARCH}${WIN_OTHER_ARCH}"
test_cl_exe "multi-arch" "$MSVC_MULTI_PATH"
if test $? -ne 0; then
WIN_MULTI_ARCH=""
WIN_OTHER_ARCH=""
fi
fi
if test "$WIN_BUILD_ARCH" = "$WIN_HOST_ARCH"; then
MSVC_BUILD_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_BUILD_ARCH"
test_cl_exe "build" "$MSVC_BUILD_PATH"
fi
if test "$WIN_BUILD_ARCH" != "$WIN_HOST_ARCH"; then
MSVC_HOST_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_HOST_ARCH"
test_cl_exe "host" "$MSVC_HOST_PATH"
else
MSVC_HOST_PATH="$MSVC_BUILD_PATH"
fi
AC_MSG_CHECKING([for short pathname of VC product directory])
VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
AC_MSG_RESULT([$VC_PRODUCT_DIR])
UCRTSDKDIR=
UCRTVERSION=
AC_MSG_CHECKING([for UCRT location])
find_ucrt
# find_ucrt errors out if it doesn't find it
AC_MSG_RESULT([$UCRTSDKDIR ($UCRTVERSION)])
PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
ucrtincpath_formatted=$formatted_path
# SOLARINC is used for external modules and must be set too.
# And no, it's not sufficient to set SOLARINC only, as configure
# itself doesn't honour it.
SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
AC_SUBST(UCRTSDKDIR)
AC_SUBST(UCRTVERSION)
AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
# Find the proper version of MSBuild.exe to use based on the VS version
reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot MSBuildOverrideTasksPath
if test -z "$regvalue" ; then
if test "$WIN_BUILD_ARCH" != "x64"; then
regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
else
regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
fi
fi
if test -d "$regvalue" ; then
MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
AC_MSG_RESULT([$regvalue])
else
AC_MSG_ERROR([MSBuild.exe location not found])
fi
# Find the version of devenv.exe
PathFormat "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe"
DEVENV="$formatted_path"
DEVENV_unix="$formatted_path_unix"
if test ! -e "$DEVENV_unix"; then
AC_MSG_WARN([No devenv.exe found - this is expected for VC++ Build Tools])
fi
dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
dnl needed when building CLR code:
if test -z "$MSVC_CXX"; then
# This gives us a posix path with 8.3 filename restrictions
MSVC_CXX=`win_short_path_for_make "$MSVC_HOST_PATH/cl.exe"`
fi
if test -z "$CC"; then
CC=$MSVC_CXX
CC_BASE=`first_arg_basename "$CC"`
fi
if test -z "$CXX"; then
CXX=$MSVC_CXX
CXX_BASE=`first_arg_basename "$CXX"`
fi
if test -n "$CC"; then
# Remove /cl.exe from CC case insensitive
AC_MSG_NOTICE([found Visual C++ $vcyear])
PathFormat "$COMPATH"
COMPATH="$formatted_path"
COMPATH_unix="$formatted_path_unix"
CPPFLAGS="$CPPFLAGS -I$COMPATH/Include"
VCVER=$vcnumwithdot
VCTOOLSET=$vctoolset
# The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess... Assuming newer ones
# are always "better", we list them in reverse chronological order.
case "$vcnumwithdot" in
16.0 | 17.0 | 17.14)
WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
;;
esac
# The expectation is that --with-windows-sdk should not need to be used
if test -n "$with_windows_sdk"; then
case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
*" "$with_windows_sdk" "*)
WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
;;
*)
AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $vcyear])
;;
esac
fi
# Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
ac_objext=obj
ac_exeext=exe
else
AC_MSG_ERROR([Visual C++ not found after all, huh])
fi
# ERROR if VS version < 16.5
AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.5])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
// See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
// between Visual Studio versions and _MSC_VER:
#if _MSC_VER < 1925
#error
#endif
]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
# WARN if VS version < 16.10
AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.10])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#if _MSC_VER < 1929
#error
#endif
]])],[vs2019_recommended_version=yes],[vs2019_recommended_version=no])
if test $vs2019_recommended_version = yes; then
AC_MSG_RESULT([yes])
else
AC_MSG_WARN([no])
add_warning "You should have at least Visual Studio 2019 version 16.10 to avoid build problems. Otherwise, you may face problems with the build of some modules including dragonbox."
fi
# we used to build 64bit bits for 32bit windows (explorer shell extension, activex, similar)
# dating back when there was no 64bit version of LibreOffice yet (pre 5.0)
# now (since 25.8) we only care about the inverse, building the 32bit twain and activex spsupp
# lib when targeting/building the 64bit version for Windows
# Check for 32-bit compiler to use to build the 32-bit TWAIN shim
# needed to support TWAIN scan on both 32- and 64-bit systems
case "$WIN_HOST_ARCH" in
x64)
CXX_X64_BINARY=$CXX
AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
if test -n "$CXX_X86_BINARY"; then
AC_MSG_RESULT([provided via environment variable])
elif test -n "$WIN_MULTI_ARCH"; then
CXX_X86_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
AC_MSG_RESULT([found])
else
AC_MSG_RESULT([not found])
AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
fi
;;
x86)
CXX_X86_BINARY=$MSVC_CXX
;;
esac
# These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
AC_SUBST(CXX_X64_BINARY)
AC_SUBST(CXX_X86_BINARY)
fi
AC_SUBST(VCVER)
AC_SUBST(VCTOOLSET)
AC_SUBST(DEVENV)
AC_SUBST(MSVC_CXX)
COM_IS_CLANG=
AC_MSG_CHECKING([whether the compiler is actually Clang])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#ifndef __clang__
you lose
#endif
int foo=42;
]])],
[AC_MSG_RESULT([yes])
COM_IS_CLANG=TRUE],
[AC_MSG_RESULT([no])])
AC_SUBST(COM_IS_CLANG)
CLANGVER=
CLANG_16=
if test "$COM_IS_CLANG" = TRUE; then
AC_MSG_CHECKING([whether Clang is new enough])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#if !defined __apple_build_version__
#error
#endif
]])],
[my_apple_clang=yes],[my_apple_clang=])
if test "$my_apple_clang" = yes; then
AC_MSG_RESULT([assumed yes (Apple Clang)])
elif test "$_os" = Emscripten; then
AC_MSG_RESULT([assumed yes (Emscripten Clang)])
else
if test "$_os" = WINNT; then
dnl In which case, assume clang-cl:
my_args="/EP /TC"
else
my_args="-E -P"
fi
clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC $my_args - | sed 's/ //g'`
CLANG_FULL_VERSION=`echo __clang_version__ | $CC $my_args -`
CLANGVER=`echo $clang_version \
| $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
if test "$CLANGVER" -ge 120000; then
AC_MSG_RESULT([yes ($clang_version)])
else
AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 12])
fi
if test "$CLANGVER" -ge 160000; then
CLANG_16=TRUE
fi
AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
fi
fi
AC_SUBST(CLANG_16)
SHOWINCLUDES_PREFIX=
if test "$_os" = WINNT; then
dnl We need to guess the prefix of the -showIncludes output, it can be
dnl localized
AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
echo "#include <stdlib.h>" > conftest.c
SHOWINCLUDES_PREFIX=`VSLANG=1033 $CC $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
rm -f conftest.c conftest.obj
if test -z "$SHOWINCLUDES_PREFIX"; then
AC_MSG_ERROR([cannot determine the -showIncludes prefix])
else
AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
fi
fi
AC_SUBST(SHOWINCLUDES_PREFIX)
#
# prefix C with ccache if needed
#
if test "$CCACHE" != ""; then
AC_MSG_CHECKING([whether $CC_BASE is already ccached])
AC_LANG_PUSH([C])
save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS --ccache-skip -O2"
# msvc does not fail on unknown options, check stdout
if test "$COM" = MSC; then
CFLAGS="$CFLAGS -nologo"
fi
save_ac_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
dnl an empty program will do, we're checking the compiler flags
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
[use_ccache=yes], [use_ccache=no])
CFLAGS=$save_CFLAGS
ac_c_werror_flag=$save_ac_c_werror_flag
if test $use_ccache = yes -a "${CCACHE##*sccache*}" != ""; then
AC_MSG_RESULT([yes])
else
CC="$CCACHE $CC"
CC_BASE="ccache $CC_BASE"
AC_MSG_RESULT([no])
fi
AC_LANG_POP([C])
fi
# ===================================================================
# check various GCC options that Clang does not support now but maybe
# will somewhen in the future, check them even for GCC, so that the
# flags are set
# ===================================================================
HAVE_GCC_GGDB2=
if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Werror -ggdb2"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
CFLAGS=$save_CFLAGS
if test "$HAVE_GCC_GGDB2" = "TRUE"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
if test "$host_cpu" = "m68k"; then
AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
CFLAGS=$save_CFLAGS
if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
AC_MSG_RESULT([yes])
else
AC_MSG_ERROR([no])
fi
fi
fi
AC_SUBST(HAVE_GCC_GGDB2)
dnl ===================================================================
dnl Test the gcc version
dnl ===================================================================
if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
AC_MSG_CHECKING([the GCC version])
_gcc_version=`$CC -dumpfullversion`
gcc_full_version=$(printf '%s' "$_gcc_version" | \
$AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
if test "$gcc_full_version" -lt 120000; then
AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 12])
fi
else
# Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
# GCC version should generally be checked only when handling GCC-specific bugs, for testing
# things like features configure checks should be used, otherwise they may e.g. fail with Clang
# (which reports itself as GCC 4.2.1).
GCC_VERSION=
fi
AC_SUBST(GCC_VERSION)
dnl Set the ENABLE_DBGUTIL variable
dnl ===================================================================
AC_MSG_CHECKING([whether to build with additional debug utilities])
if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
ENABLE_DBGUTIL="TRUE"
# this is an extra var so it can have different default on different MSVC
# versions (in case there are version specific problems with it)
MSVC_USE_DEBUG_RUNTIME="TRUE"
AC_MSG_RESULT([yes])
# cppunit and graphite expose STL in public headers
if test "$with_system_cppunit" = "yes"; then
AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
else
with_system_cppunit=no
fi
if test "$with_system_graphite" = "yes"; then
AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
else
with_system_graphite=no
fi
if test "$with_system_orcus" = "yes"; then
AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
else
with_system_orcus=no
fi
if test "$with_system_libcmis" = "yes"; then
AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
else
with_system_libcmis=no
fi
if test "$with_system_hunspell" = "yes"; then
AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
else
with_system_hunspell=no
fi
if test "$with_system_gpgmepp" = "yes"; then
AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
else
with_system_gpgmepp=no
fi
if test "$with_system_zxing" = "yes"; then
AC_MSG_ERROR([--with-system-zxing conflicts with --enable-dbgutil])
else
with_system_zxing=no
fi
if test "$with_system_poppler" = "yes"; then
AC_MSG_ERROR([--with-system-poppler conflicts with --enable-dbgutil])
else
with_system_poppler=no
fi
# As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
# 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
# mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
# violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
# of those two is using the system variant:
if test "$with_system_libnumbertext" = "yes"; then
AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
else
with_system_libnumbertext=no
fi
if test "$with_system_libwps" = "yes"; then
AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
else
with_system_libwps=no
fi
else
ENABLE_DBGUTIL=""
MSVC_USE_DEBUG_RUNTIME=""
AC_MSG_RESULT([no])
fi
AC_SUBST(ENABLE_DBGUTIL)
AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
dnl Set the ENABLE_DEBUG variable.
dnl ===================================================================
if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
fi
if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
if test -z "$libo_fuzzed_enable_debug"; then
AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
else
AC_MSG_NOTICE([Resetting --enable-debug=yes])
enable_debug=yes
fi
fi
AC_MSG_CHECKING([whether to do a debug build])
if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
ENABLE_DEBUG="TRUE"
if test -n "$ENABLE_DBGUTIL" ; then
AC_MSG_RESULT([yes (dbgutil)])
else
AC_MSG_RESULT([yes])
fi
else
ENABLE_DEBUG=""
AC_MSG_RESULT([no])
fi
AC_SUBST(ENABLE_DEBUG)
dnl ===================================================================
dnl Select the linker to use (gold/lld/ld.bfd/mold).
dnl This is done only after compiler checks (need to know if Clang is
dnl used, for different defaults) and after checking if a debug build
dnl is wanted (non-debug builds get the default linker if not explicitly
dnl specified otherwise).
dnl All checks for linker features/options should come after this.
dnl ===================================================================
check_use_ld()
{
use_ld=-fuse-ld=${1%%:*}
use_ld_path=${1#*:}
if test "$use_ld_path" != "$1"; then
if test "$COM_IS_CLANG" = TRUE; then
if test "$CLANGVER" -ge 120000; then
use_ld="${use_ld} --ld-path=${use_ld_path}"
else
use_ld="-fuse-ld=${use_ld_path}"
fi
else
# I tried to use gcc's '-B<path>' and a directory + symlink setup in
# $BUILDDIR, but libtool always filtered-out that option, so gcc wouldn't
# pickup the alternative linker, when called by libtool for linking.
# For mold, one can use LD_PRELOAD=/usr/lib/mold/mold-wrapper.so instead.
AC_MSG_ERROR([A linker path is just supported with clang, because of libtool's -B filtering!])
fi
fi
use_ld_fail_if_error=$2
use_ld_ok=
AC_MSG_CHECKING([for $use_ld linker support])
use_ld_ldflags_save="$LDFLAGS"
LDFLAGS="$LDFLAGS $use_ld"
AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <stdio.h>
],[
printf ("hello world\n");
])], USE_LD=$use_ld, [])
if test -n "$USE_LD"; then
AC_MSG_RESULT( yes )
use_ld_ok=yes
else
if test -n "$use_ld_fail_if_error"; then
AC_MSG_ERROR( no )
else
AC_MSG_RESULT( no )
fi
fi
if test -n "$use_ld_ok"; then
dnl keep the value of LDFLAGS
return 0
fi
LDFLAGS="$use_ld_ldflags_save"
return 1
}
USE_LD=
if test "$enable_ld" != "no"; then
if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
if test -n "$enable_ld"; then
check_use_ld "$enable_ld" fail_if_error
elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
dnl non-debug builds default to the default linker
true
elif test -n "$COM_IS_CLANG"; then
check_use_ld lld
if test $? -ne 0; then
check_use_ld gold
if test $? -ne 0; then
check_use_ld mold
fi
fi
else
# For gcc first try gold, new versions also support lld/mold.
check_use_ld gold
if test $? -ne 0; then
check_use_ld lld
if test $? -ne 0; then
check_use_ld mold
fi
fi
fi
ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
rm conftest.out
ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD|^mold)')
if test -z "$ld_used"; then
ld_used="unknown"
fi
AC_MSG_CHECKING([for linker that is used])
AC_MSG_RESULT([$ld_used])
if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
if echo "$ld_used" | grep -q "^GNU ld"; then
AC_MSG_WARN([The default GNU linker is slow, consider using LLD, mold or the GNU gold linker.])
add_warning "The default GNU linker is slow, consider using LLD, mold or the GNU gold linker."
fi
fi
else
if test "$enable_ld" = "yes"; then
AC_MSG_ERROR([--enable-ld not supported])
fi
fi
fi
AC_SUBST(USE_LD)
AC_SUBST(LD)
HAVE_LD_BSYMBOLIC_FUNCTIONS=
if test "$GCC" = "yes" -a "$_os" != Emscripten ; then
AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
bsymbolic_functions_ldflags_save=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <stdio.h>
],[
printf ("hello world\n");
])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
AC_MSG_RESULT( found )
else
AC_MSG_RESULT( not found )
fi
LDFLAGS=$bsymbolic_functions_ldflags_save
fi
AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
LD_GC_SECTIONS=
if test "$GCC" = "yes"; then
for flag in "--gc-sections" "-dead_strip"; do
AC_MSG_CHECKING([for $flag linker support])
ldflags_save=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,$flag"
AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <stdio.h>
],[
printf ("hello world\n");
])],[
LD_GC_SECTIONS="-Wl,$flag"
AC_MSG_RESULT( found )
], [
AC_MSG_RESULT( not found )
])
LDFLAGS=$ldflags_save
if test -n "$LD_GC_SECTIONS"; then
break
fi
done
fi
AC_SUBST(LD_GC_SECTIONS)
HAVE_EXTERNAL_DWARF=
if test "$enable_split_debug" != no; then
use_split_debug=
if test -n "$ENABLE_LTO"; then
: # Inherently incompatible, since no debug info is created while compiling, GCC complains.
elif test "$enable_split_debug" = yes; then
use_split_debug=1
dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
elif test "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
use_split_debug=1
fi
if test -n "$use_split_debug"; then
if test "$_os" = "Emscripten"; then
TEST_CC_FLAG='-gsplit-dwarf -gpubnames'
else
TEST_CC_FLAG=-gsplit-dwarf
fi
AC_MSG_CHECKING([whether $CC_BASE supports $TEST_CC_FLAG])
save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Werror $TEST_CC_FLAG"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_EXTERNAL_DWARF=TRUE ],[])
CFLAGS=$save_CFLAGS
if test "$HAVE_EXTERNAL_DWARF" = "TRUE"; then
AC_MSG_RESULT([yes])
else
if test "$enable_split_debug" = yes; then
AC_MSG_ERROR([no])
else
AC_MSG_RESULT([no])
fi
fi
fi
if test -z "$HAVE_EXTERNAL_DWARF" -a "$test_split_debug" = "yes" -a -n "$use_split_debug"; then
AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
fi
fi
AC_SUBST(HAVE_EXTERNAL_DWARF)
HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=
AC_MSG_CHECKING([whether $CC_BASE supports -Xclang -debug-info-kind=constructor])
save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Werror -Xclang -debug-info-kind=constructor"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=TRUE ],[])
CFLAGS=$save_CFLAGS
if test "$HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR" = "TRUE"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
AC_SUBST(HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR)
ENABLE_GDB_INDEX=
if test "$enable_gdb_index" != "no"; then
dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Werror -g -ggnu-pubnames"
have_ggnu_pubnames=
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
if test "$have_ggnu_pubnames" != "TRUE"; then
if test "$enable_gdb_index" = "yes"; then
AC_MSG_ERROR([no, --enable-gdb-index not supported])
else
AC_MSG_RESULT( no )
fi
else
AC_MSG_RESULT( yes )
AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
ldflags_save=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,--gdb-index"
AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <stdio.h>
],[
printf ("hello world\n");
])], ENABLE_GDB_INDEX=TRUE, [])
if test "$ENABLE_GDB_INDEX" = "TRUE"; then
AC_MSG_RESULT( yes )
else
if test "$enable_gdb_index" = "yes"; then
AC_MSG_ERROR( no )
else
AC_MSG_RESULT( no )
fi
fi
LDFLAGS=$ldflags_save
fi
CFLAGS=$save_CFLAGS
fi
if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
fi
fi
AC_SUBST(ENABLE_GDB_INDEX)
if test -z "$enable_sal_log" && test "$ENABLE_DEBUG" = TRUE; then
enable_sal_log=yes
fi
if test "$enable_sal_log" = yes; then
ENABLE_SAL_LOG=TRUE
fi
AC_SUBST(ENABLE_SAL_LOG)
dnl Check for enable symbols option
dnl ===================================================================
AC_MSG_CHECKING([whether to generate debug information])
if test -z "$enable_symbols"; then
if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
enable_symbols=yes
else
enable_symbols=no
fi
fi
if test "$enable_symbols" = yes; then
ENABLE_SYMBOLS_FOR=all
AC_MSG_RESULT([yes])
elif test "$enable_symbols" = no; then
ENABLE_SYMBOLS_FOR=
AC_MSG_RESULT([no])
else
# Selective debuginfo.
ENABLE_SYMBOLS_FOR="$enable_symbols"
AC_MSG_RESULT([for "$enable_symbols"])
fi
AC_SUBST(ENABLE_SYMBOLS_FOR)
if test -n "$with_android_ndk" -a \( -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_SYMBOLS_FOR" = "all"; then
# Building on Android with full symbols: without enough memory the linker never finishes currently.
AC_MSG_CHECKING([whether enough memory is available for linking])
mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
# Check for 15GB, as Linux reports a bit less than the physical memory size.
if test -n "$mem_size" -a $mem_size -lt 15728640; then
AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
else
AC_MSG_RESULT([yes])
fi
fi
ENABLE_OPTIMIZED=
ENABLE_OPTIMIZED_DEBUG=
AC_MSG_CHECKING([whether to compile with optimization flags])
if test -z "$enable_optimized"; then
if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
enable_optimized=no
else
enable_optimized=yes
fi
fi
if test "$enable_optimized" = yes; then
ENABLE_OPTIMIZED=TRUE
AC_MSG_RESULT([yes])
elif test "$enable_optimized" = debug; then
ENABLE_OPTIMIZED_DEBUG=TRUE
AC_MSG_RESULT([yes (debug)])
HAVE_GCC_OG=
if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
AC_MSG_CHECKING([whether $CC_BASE supports -Og])
save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Werror -Og"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_OG=TRUE ],[])
CFLAGS=$save_CFLAGS
if test "$HAVE_GCC_OG" = "TRUE"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
fi
if test -z "$HAVE_GCC_OG" -a "$_os" != "Emscripten"; then
AC_MSG_ERROR([The compiler does not support optimizations suitable for debugging.])
fi
else
AC_MSG_RESULT([no])
fi
AC_SUBST(ENABLE_OPTIMIZED)
AC_SUBST(ENABLE_OPTIMIZED_DEBUG)
#
# determine CPUNAME, OS, ...
#
case "$host_os" in
cygwin*|wsl*)
# Already handled
;;
darwin*)
COM=GCC
OS=MACOSX
RTL_OS=MacOSX
P_SEP=:
case "$host_cpu" in
aarch64|arm64)
if test "$enable_ios_simulator" = "yes"; then
OS=iOS
else
CPUNAME=AARCH64
RTL_ARCH=AARCH64
PLATFORMID=macosx_aarch64
fi
;;
x86_64)
if test "$enable_ios_simulator" = "yes"; then
OS=iOS
fi
CPUNAME=X86_64
RTL_ARCH=X86_64
PLATFORMID=macosx_x86_64
;;
*)
AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
;;
esac
;;
ios*)
COM=GCC
OS=iOS
RTL_OS=iOS
P_SEP=:
case "$host_cpu" in
aarch64|arm64)
if test "$enable_ios_simulator" = "yes"; then
AC_MSG_ERROR([iOS simulator is only available in macOS not iOS])
fi
;;
*)
AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
;;
esac
CPUNAME=AARCH64
RTL_ARCH=AARCH64
PLATFORMID=ios_arm64
;;
dragonfly*)
COM=GCC
OS=DRAGONFLY
RTL_OS=DragonFly
P_SEP=:
case "$host_cpu" in
i*86)
CPUNAME=INTEL
RTL_ARCH=x86
PLATFORMID=dragonfly_x86
;;
x86_64)
CPUNAME=X86_64
RTL_ARCH=X86_64
PLATFORMID=dragonfly_x86_64
;;
*)
AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
;;
esac
;;
freebsd*)
COM=GCC
RTL_OS=FreeBSD
OS=FREEBSD
P_SEP=:
case "$host_cpu" in
aarch64)
CPUNAME=AARCH64
PLATFORMID=freebsd_aarch64
RTL_ARCH=AARCH64
;;
i*86)
CPUNAME=INTEL
RTL_ARCH=x86
PLATFORMID=freebsd_x86
;;
x86_64|amd64)
CPUNAME=X86_64
RTL_ARCH=X86_64
PLATFORMID=freebsd_x86_64
;;
powerpc64)
CPUNAME=POWERPC64
RTL_ARCH=PowerPC_64
PLATFORMID=freebsd_powerpc64
;;
powerpc|powerpcspe)
CPUNAME=POWERPC
RTL_ARCH=PowerPC
PLATFORMID=freebsd_powerpc
;;
*)
AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
;;
esac
;;
haiku*)
COM=GCC
GUIBASE=haiku
RTL_OS=Haiku
OS=HAIKU
P_SEP=:
case "$host_cpu" in
i*86)
CPUNAME=INTEL
RTL_ARCH=x86
PLATFORMID=haiku_x86
;;
x86_64|amd64)
CPUNAME=X86_64
RTL_ARCH=X86_64
PLATFORMID=haiku_x86_64
;;
*)
AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
;;
esac
;;
kfreebsd*)
COM=GCC
OS=LINUX
RTL_OS=kFreeBSD
P_SEP=:
case "$host_cpu" in
i*86)
CPUNAME=INTEL
RTL_ARCH=x86
PLATFORMID=kfreebsd_x86
;;
x86_64)
CPUNAME=X86_64
RTL_ARCH=X86_64
PLATFORMID=kfreebsd_x86_64
;;
*)
AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
;;
esac
;;
linux-gnu*|linux-musl*)
COM=GCC
OS=LINUX
RTL_OS=Linux
P_SEP=:
case "$host_cpu" in
aarch64)
CPUNAME=AARCH64
PLATFORMID=linux_aarch64
RTL_ARCH=AARCH64
EPM_FLAGS="-a arm64"
;;
alpha)
CPUNAME=AXP
RTL_ARCH=ALPHA
PLATFORMID=linux_alpha
;;
arm*)
CPUNAME=ARM
EPM_FLAGS="-a arm"
RTL_ARCH=ARM_EABI
PLATFORMID=linux_arm_eabi
case "$host_cpu" in
arm*-linux)
RTL_ARCH=ARM_OABI
PLATFORMID=linux_arm_oabi
;;
esac
;;
hppa)
CPUNAME=HPPA
RTL_ARCH=HPPA
EPM_FLAGS="-a hppa"
PLATFORMID=linux_hppa
;;
i*86)
CPUNAME=INTEL
RTL_ARCH=x86
PLATFORMID=linux_x86
;;
ia64)
CPUNAME=IA64
RTL_ARCH=IA64
PLATFORMID=linux_ia64
;;
mips)
CPUNAME=MIPS
RTL_ARCH=MIPS_EB
EPM_FLAGS="-a mips"
PLATFORMID=linux_mips_eb
;;
mips64)
CPUNAME=MIPS64
RTL_ARCH=MIPS64_EB
EPM_FLAGS="-a mips64"
PLATFORMID=linux_mips64_eb
;;
mips64el)
CPUNAME=MIPS64
RTL_ARCH=MIPS64_EL
EPM_FLAGS="-a mips64el"
PLATFORMID=linux_mips64_el
;;
mipsel)
CPUNAME=MIPS
RTL_ARCH=MIPS_EL
EPM_FLAGS="-a mipsel"
PLATFORMID=linux_mips_el
;;
riscv64)
CPUNAME=RISCV64
RTL_ARCH=RISCV64
EPM_FLAGS="-a riscv64"
PLATFORMID=linux_riscv64
;;
m68k)
CPUNAME=M68K
RTL_ARCH=M68K
PLATFORMID=linux_m68k
;;
powerpc)
CPUNAME=POWERPC
RTL_ARCH=PowerPC
PLATFORMID=linux_powerpc
;;
powerpc64)
CPUNAME=POWERPC64
RTL_ARCH=PowerPC_64
PLATFORMID=linux_powerpc64
;;
powerpc64le)
CPUNAME=POWERPC64
RTL_ARCH=PowerPC_64_LE
PLATFORMID=linux_powerpc64_le
;;
sparc)
CPUNAME=SPARC
RTL_ARCH=SPARC
PLATFORMID=linux_sparc
;;
sparc64)
CPUNAME=SPARC64
RTL_ARCH=SPARC64
PLATFORMID=linux_sparc64
;;
s390x)
CPUNAME=S390X
RTL_ARCH=S390x
PLATFORMID=linux_s390x
;;
x86_64)
CPUNAME=X86_64
RTL_ARCH=X86_64
PLATFORMID=linux_x86_64
;;
loongarch64)
CPUNAME=LOONGARCH64
RTL_ARCH=LOONGARCH64
PLATFORMID=linux_loongarch64
;;
*)
AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
;;
esac
;;
linux-android*)
COM=GCC
OS=ANDROID
RTL_OS=Android
P_SEP=:
case "$host_cpu" in
arm|armel)
CPUNAME=ARM
RTL_ARCH=ARM_EABI
PLATFORMID=android_arm_eabi
;;
aarch64)
CPUNAME=AARCH64
RTL_ARCH=AARCH64
PLATFORMID=android_aarch64
;;
i*86)
CPUNAME=INTEL
RTL_ARCH=x86
PLATFORMID=android_x86
;;
x86_64)
CPUNAME=X86_64
RTL_ARCH=X86_64
PLATFORMID=android_x86_64
;;
*)
AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
;;
esac
;;
*netbsd*)
COM=GCC
OS=NETBSD
RTL_OS=NetBSD
P_SEP=:
case "$host_cpu" in
i*86)
CPUNAME=INTEL
RTL_ARCH=x86
PLATFORMID=netbsd_x86
;;
powerpc)
CPUNAME=POWERPC
RTL_ARCH=PowerPC
PLATFORMID=netbsd_powerpc
;;
sparc)
CPUNAME=SPARC
RTL_ARCH=SPARC
PLATFORMID=netbsd_sparc
;;
x86_64)
CPUNAME=X86_64
RTL_ARCH=X86_64
PLATFORMID=netbsd_x86_64
;;
*)
AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
;;
esac
;;
openbsd*)
COM=GCC
OS=OPENBSD
RTL_OS=OpenBSD
P_SEP=:
case "$host_cpu" in
i*86)
CPUNAME=INTEL
RTL_ARCH=x86
PLATFORMID=openbsd_x86
;;
x86_64)
CPUNAME=X86_64
RTL_ARCH=X86_64
PLATFORMID=openbsd_x86_64
;;
*)
AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
;;
esac
SOLARINC="$SOLARINC -I/usr/local/include"
;;
solaris*)
COM=GCC
OS=SOLARIS
RTL_OS=Solaris
P_SEP=:
case "$host_cpu" in
i*86)
CPUNAME=INTEL
RTL_ARCH=x86
PLATFORMID=solaris_x86
;;
sparc)
CPUNAME=SPARC
RTL_ARCH=SPARC
PLATFORMID=solaris_sparc
;;
sparc64)
CPUNAME=SPARC64
RTL_ARCH=SPARC64
PLATFORMID=solaris_sparc64
;;
*)
AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
;;
esac
SOLARINC="$SOLARINC -I/usr/local/include"
;;
emscripten*)
COM=GCC
OS=EMSCRIPTEN
RTL_OS=Emscripten
P_SEP=:
case "$host_cpu" in
wasm32|wasm64)
;;
*)
AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
;;
esac
CPUNAME=INTEL
RTL_ARCH=x86
PLATFORMID=linux_x86
;;
*)
AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
;;
esac
dnl ===================================================================
dnl Target-specific options
dnl ===================================================================
ENABLE_LASX="TRUE"
if test "$CPUNAME" == LOONGARCH64; then
AC_ARG_ENABLE(lasx,
AS_HELP_STRING([--enable-lasx],
[build with LASX vectorization])
)
if test "$enable_lasx" != yes; then
ENABLE_LASX=""
fi
fi
AC_SUBST(ENABLE_LASX)
dnl ===================================================================
dnl .NET support
dnl ===================================================================
AC_MSG_CHECKING([whether to build with .NET support])
if test "$with_dotnet" != no; then
if test "$DISABLE_SCRIPTING" = TRUE; then
AC_MSG_RESULT([no, overridden by --disable-scripting])
with_dotnet=no
ENABLE_DOTNET=""
else
AC_MSG_RESULT([yes])
ENABLE_DOTNET=TRUE
fi
else
AC_MSG_RESULT([no])
ENABLE_DOTNET=""
fi
if test "$ENABLE_DOTNET" = TRUE; then
if test -n "$with_dotnet" && test "$with_dotnet" != yes; then
dnl the user explicitly asks for a particular dotnet executable here
AC_MSG_CHECKING([for dotnet])
PathFormat "$with_dotnet"
DOTNET="$formatted_path_unix"
if test -f "$DOTNET"; then
dnl the user provided dotnet is valid
AC_MSG_RESULT([$formatted_path])
else
dnl since the user wants to use a particular dotnet executable,
dnl error out and let them correct the path instead of silently disabling.
AC_MSG_ERROR([$DOTNET is not a valid dotnet executable])
ENABLE_DOTNET=""
fi
else
dnl no specific path to dotnet provided, try looking in $PATH
if test "$OS" = WNT
then
AC_PATH_PROGS(DOTNET, [dotnet.exe])
else
AC_PATH_PROGS(DOTNET, [dotnet])
fi
PathFormat "$DOTNET"
DOTNET="$formatted_path_unix"
if test -z "$DOTNET"; then
dnl since the user does not specify any particular dotnet
dnl silently disable here instead of erroring out, to prevent
dnl breaking their build, as --with-dotnet is enabled by default.
AC_MSG_WARN([dotnet not found, disabling .NET support])
ENABLE_DOTNET=""
fi
fi
if test -n "$DOTNET"; then
dnl the dotnet executable was found, but no guarantees on whether
dnl it contains SDK version 8 or higher unless we check.
AC_MSG_CHECKING([for .NET SDK 8 or higher])
dotnet_sdk_ver_major=`"$DOTNET" --version | "$AWK" -F. '{ print $1 }'`
if test "$dotnet_sdk_ver_major" -ge 8; then
dnl the SDK seems valid, get the root directory
dotnet_sdk_ver=`"$DOTNET" --version | "$SED" 's/\r//g'`
dotnet_sdk_dir=`"$DOTNET" --list-sdks | "$AWK" -F [[]][[]] "/^$dotnet_sdk_ver/"'{ print $2 }' | "$SED" 's/\r//g'`
PathFormat "$dotnet_sdk_dir"
DOTNET_ROOT=`dirname "$formatted_path_unix"`
AC_MSG_RESULT([yes])
else
dnl silently disable for same reason as before
AC_MSG_RESULT([no, disabling .NET support])
ENABLE_DOTNET=""
fi
fi
fi
if test "$ENABLE_DOTNET" != TRUE; then
DOTNET=""
DOTNET_ROOT=""
fi
AC_SUBST(ENABLE_DOTNET)
AC_SUBST(DOTNET)
AC_SUBST(DOTNET_ROOT)
DISABLE_GUI=""
if test "$enable_gui" = "no"; then
if test "$using_x11" != yes; then
AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
fi
USING_X11=
DISABLE_GUI=TRUE
test_epoxy=no
else
AC_DEFINE(HAVE_FEATURE_UI)
fi
AC_SUBST(DISABLE_GUI)
if test "$with_x" = "no"; then
USING_X11=
fi
if test -z "$USING_X11" -a "$enable_qt5" = "yes" -a "$enable_gen" = "yes"; then
AC_MSG_ERROR([Can't select gen VCL plugin, if --without-x is used!])
fi
if test "$using_x11" = yes; then
if test "$USING_X11" = TRUE; then
AC_DEFINE(USING_X11)
else
disable_x11_tests
if test "$DISABLE_DYNLOADING" = TRUE; then
test_qt5=yes
test_qt6=yes
fi
fi
else
if test "$USING_X11" = TRUE; then
AC_MSG_ERROR([Platform doesn't support X11 (\$using_x11), but \$USING_X11 is set!])
fi
fi
WORKDIR="${BUILDDIR}/workdir"
INSTDIR="${BUILDDIR}/instdir"
INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
AC_SUBST(COM)
AC_SUBST(CPUNAME)
AC_SUBST(RTL_OS)
AC_SUBST(RTL_ARCH)
AC_SUBST(EPM_FLAGS)
AC_SUBST(USING_X11)
AC_SUBST([INSTDIR])
AC_SUBST([INSTROOT])
AC_SUBST([INSTROOTBASE])
AC_SUBST(OS)
AC_SUBST(P_SEP)
AC_SUBST(WORKDIR)
AC_SUBST(PLATFORMID)
AC_SUBST(WINDOWS_X64)
AC_DEFINE_UNQUOTED(SDKDIR, "$INSTDIR/$SDKDIRNAME")
AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
if test "$OS" = WNT -a "$COM" = MSC; then
case "$CPUNAME" in
INTEL) CPPU_ENV=msci ;;
X86_64) CPPU_ENV=mscx ;;
AARCH64) CPPU_ENV=msca ;;
*)
AC_MSG_ERROR([Unknown \$CPUNAME '$CPUNAME' for $OS / $COM"])
;;
esac
else
CPPU_ENV=gcc3
fi
AC_SUBST(CPPU_ENV)
dnl ===================================================================
dnl Test which package format to use
dnl ===================================================================
AC_MSG_CHECKING([which package format to use])
if test -n "$with_package_format" -a "$with_package_format" != no; then
for i in $with_package_format; do
case "$i" in
bsd | deb | pkg | rpm | archive | dmg | installed | msi | emscripten)
;;
*)
AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
bsd - FreeBSD, NetBSD, or OpenBSD software distribution
deb - Debian software distribution
pkg - Solaris software distribution
rpm - RedHat software distribution
LibreOffice additionally supports:
archive - .tar.gz or .zip
dmg - macOS .dmg
emscripten - directory with qt_soffice.html etc.
installed - installation tree
msi - Windows .msi
])
;;
esac
done
# fakeroot is needed to ensure correct file ownerships/permissions
# inside deb packages and tar archives created on Linux and Solaris.
if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
AC_PATH_PROG(FAKEROOT, fakeroot, no)
if test "$FAKEROOT" = "no"; then
AC_MSG_ERROR(
[--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
fi
fi
PKGFORMAT="$with_package_format"
AC_MSG_RESULT([$PKGFORMAT])
else
PKGFORMAT=
AC_MSG_RESULT([none])
fi
AC_SUBST(PKGFORMAT)
dnl ===================================================================
dnl handle help related options
dnl
dnl If you change help related options, please update README.help
dnl ===================================================================
ENABLE_HTMLHELP=
HELP_OMINDEX_PAGE=
HELP_ONLINE=
WITH_HELPPACKS=
AC_MSG_CHECKING([which help to build])
if test -n "$with_help" -a "$with_help" != "no"; then
GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
BUILD_TYPE="$BUILD_TYPE HELP"
case "$with_help" in
"html")
ENABLE_HTMLHELP=TRUE
WITH_HELPPACKS=TRUE
SCPDEFS="$SCPDEFS -DWITH_HELPPACKS"
AC_MSG_RESULT([HTML (local)])
;;
"online")
ENABLE_HTMLHELP=TRUE
HELP_ONLINE=TRUE
AC_MSG_RESULT([HTML (online)])
;;
yes)
WITH_HELPPACKS=TRUE
SCPDEFS="$SCPDEFS -DWITH_HELPPACKS"
AC_MSG_RESULT([XML (local)])
;;
*)
AC_MSG_ERROR([Unknown --with-help=$with_help])
;;
esac
else
AC_MSG_RESULT([no])
fi
AC_MSG_CHECKING([if we need to build the help index tooling])
if test \( "$with_help" = yes -o "$enable_extension_integration" != no \) -a -z "$DISABLE_DYNLOADING"; then
BUILD_TYPE="$BUILD_TYPE HELPTOOLS"
test_clucene=yes
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
AC_MSG_CHECKING([whether to enable xapian-omega support for online help])
if test -n "$with_omindex" -a "$with_omindex" != "no"; then
if test "$HELP_ONLINE" != TRUE; then
AC_MSG_ERROR([Can't build xapian-omega index without --help=online])
fi
case "$with_omindex" in
"server")
HELP_OMINDEX_PAGE=TRUE
AC_MSG_RESULT([SERVER])
;;
"noxap")
AC_MSG_RESULT([NOXAP])
;;
*)
AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
;;
esac
else
AC_MSG_RESULT([no])
fi
AC_MSG_CHECKING([whether to include the XML-help support])
if test "$enable_xmlhelp" = yes; then
BUILD_TYPE="$BUILD_TYPE XMLHELP"
test_clucene=yes
AC_DEFINE(HAVE_FEATURE_XMLHELP)
AC_MSG_RESULT([yes])
else
if test "$with_help" = yes; then
add_warning "Building the XML help, but LO with disabled xmlhelp support. Generated help can't be accessed from this LO build!"
fi
AC_MSG_RESULT([no])
fi
dnl Test whether to integrate helppacks into the product's installer
AC_MSG_CHECKING([for helppack integration])
if test -z "$WITH_HELPPACKS" -o "$with_helppack_integration" = no; then
AC_MSG_RESULT([no integration])
else
SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
AC_MSG_RESULT([integration])
fi
AC_SUBST([ENABLE_HTMLHELP])
AC_SUBST([HELP_OMINDEX_PAGE])
AC_SUBST([HELP_ONLINE])
# WITH_HELPPACKS is used only in configure
dnl ===================================================================
dnl Set up a different compiler to produce tools to run on the build
dnl machine when doing cross-compilation
dnl ===================================================================
m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
m4_pattern_allow([PKG_CONFIG_LIBDIR])
if test "$cross_compiling" = "yes"; then
AC_MSG_CHECKING([for BUILD platform configuration])
echo
rm -rf CONF-FOR-BUILD config_build.mk
mkdir CONF-FOR-BUILD
# Here must be listed all files needed when running the configure script. In particular, also
# those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
# keep them in the same order as there.
(cd $SRC_ROOT && tar cf - \
config.guess \
bin/get_config_variables \
solenv/bin/getcompver.awk \
solenv/inc/langlist.mk \
download.lst \
config_host.mk.in \
config_host_lang.mk.in \
Makefile.in \
bin/bffvalidator.sh.in \
bin/odfvalidator.sh.in \
bin/officeotron.sh.in \
instsetoo_native/util/openoffice.lst.in \
config_host/*.in \
sysui/desktop/macosx/Info.plist.in \
sysui/desktop/macosx/LaunchConstraint.plist.in \
sysui/desktop/macosx/hardened_runtime.xcent.in \
sysui/desktop/macosx/lo.xcent.in \
.vscode/vs-code-template.code-workspace.in \
solenv/lockfile/autoconf.h.in \
extensions/source/macosx/quicklookpreview/appex/Info.plist.in \
extensions/source/macosx/quicklookthumbnail/appex/Info.plist.in \
) \
| (cd CONF-FOR-BUILD && tar xf -)
cp configure CONF-FOR-BUILD
test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
(
unset COM USING_X11 OS CPUNAME
unset CC CXX SYSBASE CFLAGS
unset AR LD NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
unset CPPUNIT_CFLAGS CPPUNIT_LIBS
unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
unset PKG_CONFIG_LIBDIR PKG_CONFIG_PATH
if test -n "$CC_FOR_BUILD"; then
export CC="$CC_FOR_BUILD"
CC_BASE=`first_arg_basename "$CC"`
fi
if test -n "$CXX_FOR_BUILD"; then
export CXX="$CXX_FOR_BUILD"
CXX_BASE=`first_arg_basename "$CXX"`
fi
test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
cd CONF-FOR-BUILD
# Handle host configuration, which affects the cross-toolset too
sub_conf_opts=""
test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
test "$with_junit" = "no" && sub_conf_opts="$sub_conf_opts --without-junit"
# While we don't need scripting support, we don't have a PYTHON_FOR_BUILD Java equivalent, so must enable scripting for Java
if test -n "$ENABLE_JAVA"; then
case "$_os" in
Android)
# Hack for Android - the build doesn't need a host JDK, so just forward to build for convenience
test -n "$with_jdk_home" && sub_conf_opts="$sub_conf_opts --with-jdk-home=$with_jdk_home"
;;
*)
if test -z "$with_jdk_home"; then
AC_MSG_ERROR([Missing host JDK! This can't be detected for the build OS, so you have to specify it with --with-jdk-home.])
fi
;;
esac
else
sub_conf_opts="$sub_conf_opts --without-java"
fi
test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
test "$with_galleries" = "no" -o -z "$WITH_GALLERY_BUILD" && sub_conf_opts="$sub_conf_opts --with-galleries=no --disable-database-connectivity"
test "$with_templates" = "no" -o -z "$WITH_TEMPLATES" && sub_conf_opts="$sub_conf_opts --with-templates=no"
test -n "$with_help" -a "$with_help" != "no" && sub_conf_opts="$sub_conf_opts --with-help=$with_help"
test "$enable_extensions" = yes || sub_conf_opts="$sub_conf_opts --disable-extensions"
test "${enable_ld+set}" = set -a "$build_cpu" = "$host_cpu" && sub_conf_opts="$sub_conf_opts --enable-ld=${enable_ld}"
test "${enable_pch+set}" = set && sub_conf_opts="$sub_conf_opts --enable-pch=${enable_pch}"
test "$enable_wasm_strip" = "yes" && sub_conf_opts="$sub_conf_opts --enable-wasm-strip"
test "${with_system_lockfile+set}" = set && sub_conf_opts="$sub_conf_opts --with-system-lockfile=${with_system_lockfile}"
test "${enable_fuzzers}" = yes && sub_conf_opts="$sub_conf_opts --without-system-libxml"
if test "$_os" = "Emscripten"; then
sub_conf_opts="$sub_conf_opts --without-system-libxml --without-system-fontconfig --without-system-freetype --without-system-zlib"
fi
# windows uses full-internal python and that in turn relies on openssl, so also enable openssl
# when cross-compiling for aarch64, overriding the defaults below
test "${PLATFORMID}" = "windows_aarch64" && sub_conf_opts="$sub_conf_opts --enable-openssl --with-tls=openssl"
# cross-compilations don't necessarily enable python support in the product/the sub-configure needs to know
# that the minimum supported python version is 3.7 or later...
test "$with_system_harfbuzz" != "yes" && sub_conf_opts="$sub_conf_opts NEED_MESON=TRUE"
# Don't bother having configure look for stuff not needed for the build platform anyway
# WARNING: any option with an argument containing spaces must be handled separately (see --with-theme)
sub_conf_defaults=" \
--build="$build_alias" \
--disable-cairo-canvas \
--disable-cups \
--disable-customtarget-components \
--disable-firebird-sdbc \
--disable-gpgmepp \
--disable-gstreamer-1-0 \
--disable-gtk3 \
--disable-gtk4 \
--disable-libcmis \
--disable-mariadb-sdbc \
--disable-nss \
--disable-online-update \
--disable-opencl \
--disable-openssl \
--disable-pdfimport \
--disable-postgresql-sdbc \
--disable-skia \
--disable-xmlhelp \
--enable-dynamic-loading \
--enable-icecream="$enable_icecream" \
--without-gssapi \
--without-doxygen \
--without-tls \
--without-webdav \
--without-x \
"
# single quotes added for better readability in case of spaces
echo " Running CONF-FOR-BUILD/configure" \
$sub_conf_defaults \
--with-parallelism="'$with_parallelism'" \
--with-theme="'$with_theme'" \
--with-vendor="'$with_vendor'" \
$sub_conf_opts \
$with_build_platform_configure_options \
--srcdir=$srcdir
./configure \
$sub_conf_defaults \
--with-parallelism="$with_parallelism" \
--with-theme="$with_theme" \
"--with-vendor=$with_vendor" \
$sub_conf_opts \
$with_build_platform_configure_options \
--srcdir=$srcdir \
2>&1 | sed -e 's/^/ /'
if test [${PIPESTATUS[0]}] -ne 0; then
AC_MSG_ERROR([Running the configure script for BUILD side failed, see CONF-FOR-BUILD/config.log])
fi
# filter permitted build targets
PERMITTED_BUILD_TARGETS="
ARGON2
AVMEDIA
BOOST
BZIP2
CAIRO
CLUCENE
CURL
DBCONNECTIVITY
DESKTOP
DRAGONBOX
DYNLOADING
EPOXY
EXPAT
FROZEN
GLM
GRAPHITE
HARFBUZZ
HELPTOOLS
ICU
LCMS2
LIBJPEG_TURBO
LIBLANGTAG
LibO
LIBFFI
LIBEOT
LIBPN
LIBTIFF
LIBWEBP
LIBXML2
LIBXSLT
MDDS
MESON
NATIVE
OPENSSL
ORCUS
PYTHON
REPORTBUILDER
SCRIPTING
ZLIB
ZSTD
ZXCVBN
"
# converts BUILD_TYPE and PERMITTED_BUILD_TARGETS into non-whitespace,
# newlined lists, to use grep as a filter
PERMITTED_BUILD_TARGETS=$(echo "$PERMITTED_BUILD_TARGETS" | sed -e '/^ *$/d' -e 's/ *//')
BUILD_TARGETS="$(sed -n -e '/^export BUILD_TYPE=/ s/.*=//p' config_host.mk | tr ' ' '\n')"
BUILD_TARGETS="$(echo "$BUILD_TARGETS" | grep -F "$PERMITTED_BUILD_TARGETS" | tr '\n' ' ')"
sed -i -e "s/ BUILD_TYPE=.*$/ BUILD_TYPE=$BUILD_TARGETS/" config_host.mk
cp config_host.mk ../config_build.mk
cp config_host_lang.mk ../config_build_lang.mk
mv config.log ../config.Build.log
mkdir -p ../config_build
mv config_host/*.h ../config_build
test -f "$WARNINGS_FILE" && mv "$WARNINGS_FILE" "../$WARNINGS_FILE_FOR_BUILD"
# all these will get a _FOR_BUILD postfix
DIRECT_FOR_BUILD_SETTINGS="
CC
CPPU_ENV
CXX
ILIB
JAVA_HOME
JAVAIFLAGS
JDK
JDK_SECURITYMANAGER_DISALLOWED
LIBO_BIN_FOLDER
LIBO_LIB_FOLDER
LIBO_URE_LIB_FOLDER
LIBO_URE_MISC_FOLDER
OS
SDKDIRNAME
SYSTEM_LIBXML
SYSTEM_LIBXSLT
"
# these overwrite host config with build config
OVERWRITING_SETTINGS="
ANT
ANT_HOME
ANT_LIB
JAVA_SOURCE_VER
JAVA_TARGET_VER
JAVACFLAGS
JAVACOMPILER
JAVADOC
JAVADOCISGJDOC
LOCKFILE
SYSTEM_GENBRK
SYSTEM_GENCCODE
SYSTEM_GENCMN
"
# these need some special handling
EXTRA_HANDLED_SETTINGS="
INSTDIR
INSTROOT
PATH
WORKDIR
"
OLD_PATH=$PATH
. ./bin/get_config_variables $DIRECT_FOR_BUILD_SETTINGS $OVERWRITING_SETTINGS $EXTRA_HANDLED_SETTINGS
BUILD_PATH=$PATH
PATH=$OLD_PATH
line=`echo "LO_PATH_FOR_BUILD='${BUILD_PATH}'" | sed -e 's,/CONF-FOR-BUILD,,g'`
echo "$line" >>build-config
for V in $DIRECT_FOR_BUILD_SETTINGS; do
VV='$'$V
VV=`eval "echo $VV"`
if test -n "$VV"; then
line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
echo "$line" >>build-config
fi
done
for V in $OVERWRITING_SETTINGS; do
VV='$'$V
VV=`eval "echo $VV"`
if test -n "$VV"; then
line=${V}='${'${V}:-$VV'}'
echo "$line" >>build-config
fi
done
for V in INSTDIR INSTROOT WORKDIR; do
VV='$'$V
VV=`eval "echo $VV"`
VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
if test -n "$VV"; then
line="${V}_FOR_BUILD='$VV'"
echo "$line" >>build-config
fi
done
)
test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([setup/configure for BUILD side failed, see CONF-FOR-BUILD/config.log])
test -f config_build.mk || AC_MSG_ERROR([A file called config_build.mk was supposed to have been copied here, but it isn't found])
perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
-e 's,/CONF-FOR-BUILD,,g;' config_build.mk
eval `cat CONF-FOR-BUILD/build-config`
AC_MSG_RESULT([checking for BUILD platform configuration... done])
rm -rf CONF-FOR-BUILD
else
OS_FOR_BUILD="$OS"
CC_FOR_BUILD="$CC"
CPPU_ENV_FOR_BUILD="$CPPU_ENV"
CXX_FOR_BUILD="$CXX"
INSTDIR_FOR_BUILD="$INSTDIR"
INSTROOT_FOR_BUILD="$INSTROOT"
LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
WORKDIR_FOR_BUILD="$WORKDIR"
fi
AC_SUBST(OS_FOR_BUILD)
AC_SUBST(INSTDIR_FOR_BUILD)
AC_SUBST(INSTROOT_FOR_BUILD)
AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
AC_SUBST(SDKDIRNAME_FOR_BUILD)
AC_SUBST(WORKDIR_FOR_BUILD)
AC_SUBST(CC_FOR_BUILD)
AC_SUBST(CXX_FOR_BUILD)
AC_SUBST(CPPU_ENV_FOR_BUILD)
dnl ===================================================================
dnl Check for lockfile deps
dnl ===================================================================
if test -z "$CROSS_COMPILING"; then
test -n "$LOCKFILE" -a "${with_system_lockfile+set}" != set && with_system_lockfile="$LOCKFILE"
test "${with_system_lockfile+set}" = set || with_system_lockfile=no
AC_MSG_CHECKING([which lockfile binary to use])
case "$with_system_lockfile" in
yes)
AC_MSG_RESULT([external])
AC_PATH_PROGS([LOCKFILE],[dotlockfile lockfile])
;;
no)
AC_MSG_RESULT([internal])
;;
*)
if test -x "$with_system_lockfile"; then
LOCKFILE="$with_system_lockfile"
else
AC_MSG_ERROR(['$with_system_lockfile' is not executable.])
fi
AC_MSG_RESULT([$with_system_lockfile])
;;
esac
fi
if test -n "$LOCKFILE" -a "$DISABLE_DYNLOADING" = TRUE; then
add_warning "The default system lockfile has increasing poll intervals up to 60s, so linking executables may be delayed."
fi
AC_CHECK_HEADERS([getopt.h paths.h sys/param.h])
AC_CHECK_FUNCS([utime utimes])
AC_SUBST(LOCKFILE)
dnl ===================================================================
dnl Check for syslog header
dnl ===================================================================
AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
dnl ===================================================================
AC_MSG_CHECKING([whether to turn warnings to errors])
if test -n "$enable_werror" -a "$enable_werror" != "no"; then
ENABLE_WERROR="TRUE"
PYTHONWARNINGS="error"
AC_MSG_RESULT([yes])
else
if test -n "$LODE_HOME" -a -z "$enable_werror"; then
ENABLE_WERROR="TRUE"
PYTHONWARNINGS="error"
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
fi
AC_SUBST(ENABLE_WERROR)
AC_SUBST(PYTHONWARNINGS)
dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
dnl ===================================================================
AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
if test -z "$enable_assert_always_abort"; then
if test "$ENABLE_DEBUG" = TRUE; then
enable_assert_always_abort=yes
else
enable_assert_always_abort=no
fi
fi
if test "$enable_assert_always_abort" = "yes"; then
ASSERT_ALWAYS_ABORT="TRUE"
AC_MSG_RESULT([yes])
else
ASSERT_ALWAYS_ABORT="FALSE"
AC_MSG_RESULT([no])
fi
AC_SUBST(ASSERT_ALWAYS_ABORT)
# Determine whether to use ooenv for the instdir installation
# ===================================================================
if test $_os != "WINNT" -a $_os != "Darwin"; then
AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
if test -z "$enable_ooenv"; then
if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
enable_ooenv=yes
else
enable_ooenv=no
fi
fi
if test "$enable_ooenv" = "no"; then
AC_MSG_RESULT([no])
else
ENABLE_OOENV="TRUE"
AC_MSG_RESULT([yes])
fi
fi
AC_SUBST(ENABLE_OOENV)
if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
if test "$enable_qt5" = "no"; then
AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
else
enable_qt5=yes
fi
fi
if test "$test_kf6" = "yes" -a "$enable_kf6" = "yes"; then
if test "$enable_qt6" = "no"; then
AC_MSG_ERROR([KF6 support depends on QT6, so it conflicts with --disable-qt6])
else
enable_qt6=yes
fi
fi
AC_MSG_CHECKING([whether to build the pagein binaries for oosplash])
if test "${enable_pagein}" != no -a -z "$DISABLE_DYNLOADING"; then
AC_MSG_RESULT([yes])
ENABLE_PAGEIN=TRUE
AC_DEFINE(HAVE_FEATURE_PAGEIN)
else
AC_MSG_RESULT([no])
fi
AC_SUBST(ENABLE_PAGEIN)
AC_MSG_CHECKING([whether to enable CPDB support])
ENABLE_CPDB=""
CPDB_CFLAGS=""
CPDB_LIBS=""
if test "$test_cpdb" = yes -a "x$enable_cpdb" = "xyes"; then
ENABLE_CPDB="TRUE"
AC_MSG_RESULT([yes])
PKG_CHECK_MODULES(CPDB, cpdb-frontend)
CPDB_CFLAGS=$(printf '%s' "$CPDB_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
FilterLibs "${CPDB_LIBS}"
CPDB_LIBS="${filteredlibs}"
AC_DEFINE([ENABLE_CPDB],[1])
else
AC_MSG_RESULT([no])
fi
AC_SUBST(ENABLE_CPDB)
AC_SUBST(CPDB_LIBS)
AC_SUBST(CPDB_CFLAGS)
dnl ===================================================================
dnl check for cups support
dnl ===================================================================
AC_MSG_CHECKING([whether to enable CUPS support])
if test "$test_cups" = yes -a "$enable_cups" != no; then
ENABLE_CUPS=TRUE
AC_MSG_RESULT([yes])
AC_MSG_CHECKING([whether cups support is present])
AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
fi
AC_DEFINE([ENABLE_CUPS],[1])
else
AC_MSG_RESULT([no])
fi
AC_SUBST(ENABLE_CUPS)
libo_CHECK_SYSTEM_MODULE([fontconfig],[FONTCONFIG],[fontconfig >= 2.12.0],,system,TRUE)
dnl whether to find & fetch external tarballs?
dnl ===================================================================
if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
else
TARFILE_LOCATION="$LODE_HOME/ext_tar"
fi
fi
if test -z "$TARFILE_LOCATION"; then
if test -d "$SRC_ROOT/src" ; then
mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
fi
TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
else
AbsolutePath "$TARFILE_LOCATION"
PathFormat "${absolute_path}"
TARFILE_LOCATION="${formatted_path_unix}"
fi
PathFormat "$TARFILE_LOCATION"
TARFILE_LOCATION_NATIVE="$formatted_path"
AC_SUBST(TARFILE_LOCATION)
AC_SUBST(TARFILE_LOCATION_NATIVE)
AC_MSG_CHECKING([whether we want to fetch tarballs])
if test "$enable_fetch_external" != "no"; then
if test "$with_all_tarballs" = "yes"; then
AC_MSG_RESULT([yes, all of them])
DO_FETCH_TARBALLS="ALL"
else
AC_MSG_RESULT([yes, if we use them])
DO_FETCH_TARBALLS="TRUE"
fi
else
AC_MSG_RESULT([no])
DO_FETCH_TARBALLS=
fi
AC_SUBST(DO_FETCH_TARBALLS)
dnl Test whether to include MySpell dictionaries
dnl ===================================================================
AC_MSG_CHECKING([whether to include MySpell dictionaries])
if test "$with_myspell_dicts" = "yes"; then
AC_MSG_RESULT([yes])
WITH_MYSPELL_DICTS=TRUE
BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
else
AC_MSG_RESULT([no])
WITH_MYSPELL_DICTS=
fi
AC_SUBST(WITH_MYSPELL_DICTS)
# There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
if test "$with_system_dicts" = yes; then
AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
fi
with_system_dicts=no
fi
AC_MSG_CHECKING([whether to use dicts from external paths])
if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
AC_MSG_RESULT([yes])
SYSTEM_DICTS=TRUE
AC_MSG_CHECKING([for spelling dictionary directory])
if test -n "$with_external_dict_dir"; then
DICT_SYSTEM_DIR=file://$with_external_dict_dir
else
DICT_SYSTEM_DIR=file:///usr/share/hunspell
if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
DICT_SYSTEM_DIR=file:///usr/share/myspell
fi
fi
AC_MSG_RESULT([$DICT_SYSTEM_DIR])
AC_MSG_CHECKING([for hyphenation patterns directory])
if test -n "$with_external_hyph_dir"; then
HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
else
HYPH_SYSTEM_DIR=file:///usr/share/hyphen
fi
AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
AC_MSG_CHECKING([for thesaurus directory])
if test -n "$with_external_thes_dir"; then
THES_SYSTEM_DIR=file://$with_external_thes_dir
else
THES_SYSTEM_DIR=file:///usr/share/mythes
fi
AC_MSG_RESULT([$THES_SYSTEM_DIR])
else
AC_MSG_RESULT([no])
SYSTEM_DICTS=
fi
AC_SUBST(SYSTEM_DICTS)
AC_SUBST(DICT_SYSTEM_DIR)
AC_SUBST(HYPH_SYSTEM_DIR)
AC_SUBST(THES_SYSTEM_DIR)
dnl ===================================================================
dnl Precompiled headers.
ENABLE_PCH=""
AC_MSG_CHECKING([whether to enable pch feature])
if test -z "$enable_pch"; then
if test "$_os" = "WINNT"; then
# Enabled by default on Windows.
enable_pch=yes
# never use sccache on auto-enabled PCH builds, except if requested explicitly
if test -z "$enable_ccache" -a "$SCCACHE"; then
CCACHE=""
fi
else
enable_pch=no
fi
fi
if test "$enable_pch" != no -a "$_os" = Emscripten; then
AC_MSG_ERROR([PCH currently isn't supported for Emscripten with native EH (nEH) because of missing Sj/Lj support with nEH in clang.])
fi
if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
fi
if test "$enable_pch" = "system"; then
ENABLE_PCH="1"
AC_MSG_RESULT([yes (system headers)])
elif test "$enable_pch" = "base"; then
ENABLE_PCH="2"
AC_MSG_RESULT([yes (system and base headers)])
elif test "$enable_pch" = "normal"; then
ENABLE_PCH="3"
AC_MSG_RESULT([yes (normal)])
elif test "$enable_pch" = "full"; then
ENABLE_PCH="4"
AC_MSG_RESULT([yes (full)])
elif test "$enable_pch" = "yes"; then
# Pick a suitable default.
if test "$GCC" = "yes"; then
# With Clang and GCC higher levels do not seem to make a noticeable improvement,
# while making the PCHs larger and rebuilds more likely.
ENABLE_PCH="2"
AC_MSG_RESULT([yes (system and base headers)])
else
# With MSVC the highest level makes a significant difference,
# and it was the default when there used to be no PCH levels.
ENABLE_PCH="4"
AC_MSG_RESULT([yes (full)])
fi
elif test "$enable_pch" = "no"; then
AC_MSG_RESULT([no])
else
AC_MSG_ERROR([Unknown value for --enable-pch])
fi
AC_SUBST(ENABLE_PCH)
if test -n "$ENABLE_PCH"; then
AC_DEFINE(ENABLE_PCH)
fi
# ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
if test "$CCACHE_BIN" != "not found"; then
AC_MSG_CHECKING([ccache version])
CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
AC_MSG_RESULT([$CCACHE_VERSION])
AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
if test "$CCACHE_NUMVER" -gt "030701"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no (not newer than 3.7.1)])
CCACHE_DEPEND_MODE=
fi
fi
fi
PCH_INSTANTIATE_TEMPLATES=
if test -n "$ENABLE_PCH"; then
AC_MSG_CHECKING([whether $CC supports -fpch-instantiate-templates])
save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Werror -fpch-instantiate-templates"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_INSTANTIATE_TEMPLATES="-fpch-instantiate-templates" ],[])
CFLAGS=$save_CFLAGS
if test -n "$PCH_INSTANTIATE_TEMPLATES"; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
fi
AC_SUBST(PCH_INSTANTIATE_TEMPLATES)
BUILDING_PCH_WITH_OBJ=
if test -n "$ENABLE_PCH"; then
AC_MSG_CHECKING([whether $CC supports -Xclang -building-pch-with-obj])
save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Werror -Xclang -building-pch-with-obj"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ BUILDING_PCH_WITH_OBJ="-Xclang -building-pch-with-obj" ],[])
CFLAGS=$save_CFLAGS
if test -n "$BUILDING_PCH_WITH_OBJ"; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
fi
AC_SUBST(BUILDING_PCH_WITH_OBJ)
PCH_CODEGEN=
PCH_NO_CODEGEN=
fpch_prefix=
if test "$COM" = MSC; then
fpch_prefix="-Xclang "
fi
if test -n "$BUILDING_PCH_WITH_OBJ"; then
AC_MSG_CHECKING([whether $CC supports ${fpch_prefix}-fpch-codegen])
save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fpch-codegen"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],
[ PCH_CODEGEN="${fpch_prefix}-fpch-codegen" ],[])
CFLAGS=$save_CFLAGS
CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fno-pch-codegen"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],
[ PCH_NO_CODEGEN="${fpch_prefix}-fno-pch-codegen" ],[])
CFLAGS=$save_CFLAGS
if test -n "$PCH_CODEGEN"; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
fi
AC_SUBST(PCH_CODEGEN)
AC_SUBST(PCH_NO_CODEGEN)
PCH_DEBUGINFO=
if test -n "$BUILDING_PCH_WITH_OBJ"; then
AC_MSG_CHECKING([whether $CC supports ${fpch_prefix}-fpch-debuginfo])
save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fpch-debuginfo"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_DEBUGINFO="${fpch_prefix}-fpch-debuginfo" ],[])
CFLAGS=$save_CFLAGS
if test -n "$PCH_DEBUGINFO"; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
fi
AC_SUBST(PCH_DEBUGINFO)
TAB=`printf '\t'`
AC_MSG_CHECKING([the GNU Make version])
_make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
_make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
if test "$_make_longver" -ge "040000"; then
AC_MSG_RESULT([$GNUMAKE $_make_version])
else
AC_MSG_ERROR([failed ($GNUMAKE version >= 4.0 needed)])
fi
_make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
STALE_MAKE=
if test "$_make_ver_check" = ""; then
STALE_MAKE=TRUE
fi
HAVE_LD_HASH_STYLE=FALSE
WITH_LINKER_HASH_STYLE=
AC_MSG_CHECKING([for --hash-style gcc linker support])
if test "$GCC" = "yes"; then
if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
hash_styles="gnu sysv"
elif test "$with_linker_hash_style" = "no"; then
hash_styles=
else
hash_styles="$with_linker_hash_style"
fi
for hash_style in $hash_styles; do
test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
hash_style_ldflags_save=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
AC_RUN_IFELSE([AC_LANG_PROGRAM(
[
#include <stdio.h>
],[
printf ("");
])],
[
HAVE_LD_HASH_STYLE=TRUE
WITH_LINKER_HASH_STYLE=$hash_style
],
[HAVE_LD_HASH_STYLE=FALSE],
[HAVE_LD_HASH_STYLE=FALSE])
LDFLAGS=$hash_style_ldflags_save
done
if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
else
AC_MSG_RESULT( no )
fi
LDFLAGS=$hash_style_ldflags_save
else
AC_MSG_RESULT( no )
fi
AC_SUBST(HAVE_LD_HASH_STYLE)
AC_SUBST(WITH_LINKER_HASH_STYLE)
dnl ===================================================================
dnl Check whether there's a Perl version available.
dnl ===================================================================
if test -z "$with_perl_home"; then
AC_PATH_PROG(PERL, perl)
else
test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
_perl_path="$with_perl_home/bin/perl"
if test -x "$_perl_path"; then
PERL=$_perl_path
else
AC_MSG_ERROR([$_perl_path not found])
fi
fi
dnl ===================================================================
dnl Testing for Perl version 5 or greater.
dnl $] is the Perl version variable, it is returned as an integer
dnl ===================================================================
if test "$PERL"; then
AC_MSG_CHECKING([the Perl version])
${PERL} -e "exit($]);"
_perl_version=$?
if test "$_perl_version" -lt 5; then
AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
fi
AC_MSG_RESULT([Perl $_perl_version])
else
AC_MSG_ERROR([Perl not found, install Perl 5])
fi
dnl ===================================================================
dnl Testing for required Perl modules
dnl ===================================================================
AC_MSG_CHECKING([for required Perl modules])
dnl Digest::MD5 seems only be used for packaging, but is basically a given
perl_use_string="use Cwd ; use Digest::MD5"
perl_use_string_spp="use Cwd ; use Digest::MD5"
if test "$_os" = "WINNT"; then
if test -n "$PKGFORMAT"; then
for i in $PKGFORMAT; do
case "$i" in
msi)
# for getting fonts versions to use in MSI
if test -n "$WSL_ONLY_AS_HELPER"; then
# in case of a wsl-as-helper build, the packaging is done using strawberry-perl
# and not the perl provided by git-bash
perl_use_string_spp="$perl_use_string_spp ; use Font::TTF::Font"
else
perl_use_string="$perl_use_string ; use Font::TTF::Font"
fi
;;
esac
done
fi
fi
if test "$with_system_hsqldb" = "yes"; then
perl_use_string="$perl_use_string ; use Archive::Zip"
fi
if test "$enable_openssl" = "yes" -a "$with_system_openssl" != "yes"; then
# OpenSSL needs that to build
if test -n "$WSL_ONLY_AS_HELPER"; then
# OpenSSL is built via spp, FindBin is provided by default, but deps might change in future
perl_use_string_spp="$perl_use_string_spp ; use FindBin ; use Time::Piece"
else
perl_use_string="$perl_use_string ; use FindBin ; use Time::Piece"
fi
fi
dnl in WSL_ONLY_AS_HELPER case the test should be done with git-bash-provided-perl and not perl from
dnl the wsl container, but that can wait until we require a module that's not provided by default
if $PERL -e "$perl_use_string">/dev/null 2>&1; then
AC_MSG_RESULT([all modules found])
if test -n "$WSL_ONLY_AS_HELPER"; then
AC_MSG_CHECKING([for required Perl modules in Strawberry Perl])
if $STRAWBERRY_PERL_UNIX -e "$perl_use_string_spp">/dev/null 2>&1; then
AC_MSG_RESULT([all modules found])
else
AC_MSG_RESULT([failed to find some modules])
# Find out which modules are missing.
for i in $perl_use_string_spp; do
if test "$i" != "use" -a "$i" != ";"; then
if ! $STRAWBERRY_PERL_UNIX -e "use $i;">/dev/null 2>&1; then
missing_perl_modules="$missing_perl_modules $i"
fi
fi
done
PathFormat "$(dirname $STRAWBERRY_PERL_UNIX)"
spp_cpan_command='PATH="$(cygpath.exe -up "'$STRAWBERRY_TOOLS';'$formatted_path'"):$PATH" cpanm'
AC_MSG_ERROR([
The missing Perl modules are: $missing_perl_modules
Install them with »$spp_cpan_command $missing_perl_modules«])
fi
fi
else
AC_MSG_RESULT([failed to find some modules])
# Find out which modules are missing.
for i in $perl_use_string; do
if test "$i" != "use" -a "$i" != ";"; then
if ! $PERL -e "use $i;">/dev/null 2>&1; then
missing_perl_modules="$missing_perl_modules $i"
fi
fi
done
AC_MSG_ERROR([
The missing Perl modules are: $missing_perl_modules
Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
fi
dnl ===================================================================
dnl Check for pkg-config
dnl ===================================================================
# pkgconf/pkg-config detection is already triggered by the configure switches way above
# (more specifically PKG_CHECK_MODULES), so only do some cleanup of the vars here
PathFormat "$(command -v $PKG_CONFIG)"
PKG_CONFIG="$formatted_path"
AC_SUBST(PKG_CONFIG)
AC_SUBST(PKG_CONFIG_PATH)
AC_SUBST(PKG_CONFIG_LIBDIR)
if test "$_os" != "WINNT"; then
# If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
# /path/to/compiler/foo-gcc" you need to set the AR etc env vars
# explicitly. Or put /path/to/compiler in PATH yourself.
toolprefix=gcc
if test "$COM_IS_CLANG" = "TRUE"; then
toolprefix=llvm
fi
AC_CHECK_TOOLS(AR,$toolprefix-ar ar)
AC_CHECK_TOOLS(NM,$toolprefix-nm nm)
AC_CHECK_TOOLS(RANLIB,$toolprefix-ranlib ranlib)
AC_CHECK_TOOLS(OBJDUMP,$toolprefix-objdump objdump)
AC_CHECK_TOOLS(READELF,$toolprefix-readelf readelf)
AC_CHECK_TOOLS(STRIP,$toolprefix-strip strip)
fi
AC_SUBST(AR)
AC_SUBST(NM)
AC_SUBST(OBJDUMP)
AC_SUBST(RANLIB)
AC_SUBST(READELF)
AC_SUBST(STRIP)
dnl ===================================================================
dnl pkg-config checks on macOS
dnl ===================================================================
if test $_os = Darwin; then
AC_MSG_CHECKING([for bogus pkg-config])
if test -n "$PKG_CONFIG"; then
if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
else
if test "$enable_bogus_pkg_config" = "yes"; then
AC_MSG_RESULT([yes, user-approved from unknown origin.])
else
if test -z "$($PKG_CONFIG --list-all |grep -v '^libpkgconf')" ; then
AC_MSG_RESULT([yes, accepted since no packages available in default searchpath])
else
AC_MSG_ERROR([yes, from unknown origin. This *will* break the build. Please modify your PATH variable so that $PKG_CONFIG is no longer found by configure scripts.])
fi
fi
fi
else
AC_MSG_RESULT([no, good])
fi
fi
find_csc()
{
# Return value: $csctest
unset csctest
reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client" "InstallPath"
if test -n "$regvalue"; then
csctest=$regvalue
return
fi
}
find_al()
{
# Return value: $altest
unset altest
# We need this check to detect 4.6.1 or above.
for ver in 4.8.1 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools" "InstallationFolder"
PathFormat "$regvalue"
if test -n "$regvalue" -a \( -f "$formatted_path_unix/al.exe" -o -f "$formatted_path_unix/bin/al.exe" \); then
altest=$regvalue
return
fi
done
reg_list_values_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows"
for x in $reglist; do
reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools" "InstallationFolder"
PathFormat "$regvalue"
if test -n "$regvalue" -a \( -f "$formatted_path_unix/al.exe" -o -f "$formatted_path_unix/bin/al.exe" \); then
altest=$regvalue
return
fi
done
}
find_dotnetsdk()
{
unset frametest
for ver in 4.8.1 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver" "KitsInstallationFolder"
if test -n "$regvalue"; then
frametest=$regvalue
return
fi
done
AC_MSG_ERROR([The Windows NET SDK (minimum 4.6) not found, check the installation])
}
find_winsdk_version()
{
# Args: $1 : SDK version as in "8.0", "8.1A" etc
# Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
unset winsdktest winsdkbinsubdir winsdklibsubdir
case "$1" in
8.0|8.0A)
reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots" "KitsRoot"
if test -n "$regvalue"; then
winsdktest=$regvalue
winsdklibsubdir=win8
return
fi
;;
8.1|8.1A)
reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots" "KitsRoot81"
if test -n "$regvalue"; then
winsdktest=$regvalue
winsdklibsubdir=winv6.3
return
fi
;;
10.0)
reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}" "InstallationFolder"
if test -n "$regvalue"; then
winsdktest=$regvalue
reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}" "ProductVersion"
if test -n "$regvalue"; then
winsdkbinsubdir="$regvalue".0
winsdklibsubdir=$winsdkbinsubdir
local tmppath="$winsdktest\\Include\\$winsdklibsubdir"
PathFormat "$tmppath"
local tmppath_unix=$formatted_path_unix
# test exist the SDK path
if test ! -d "$tmppath_unix"; then
AC_MSG_ERROR([The Windows SDK not found, check the installation])
fi
fi
return
fi
;;
esac
}
find_winsdk()
{
# Return value: From find_winsdk_version
unset winsdktest
for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
find_winsdk_version $ver
if test -n "$winsdktest"; then
return
fi
done
}
find_msms()
{
# Return value: $msmdir
local version="$1"
AC_MSG_CHECKING([for MSVC $version merge modules directory])
local my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/v${version}/MergeModules"
local my_msm_file="$my_msm_dir/Microsoft_VC${version}_CRT_x86.msm"
echo "$as_me:$LINENO: looking for ${my_msm_file}" >&5
if test -e "${my_msm_file}"; then
PathFormat "$my_msm_dir/"
msmdir="$formatted_path"
AC_MSG_RESULT([$msmdir])
else
if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
AC_MSG_FAILURE([not found])
else
AC_MSG_WARN([not found (check config.log)])
add_warning "MSM ${my_msm_file} not found"
fi
fi
}
dnl =========================================
dnl Check for the Windows SDK.
dnl =========================================
if test "$_os" = "WINNT"; then
AC_MSG_CHECKING([for Windows SDK])
if test "$build_os" = "cygwin" -o "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
find_winsdk
WINDOWS_SDK_HOME=$winsdktest
# normalize if found
if test -n "$WINDOWS_SDK_HOME"; then
PathFormat "$WINDOWS_SDK_HOME"
WINDOWS_SDK_HOME=$formatted_path_unix
fi
WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
# The variable also contains the Windows SDK version
echo $WINDOWS_SDK_LIB_SUBDIR
# Assuming maximum of 5 digits for each part and ignoring last part
SDK_NORMALIZED_VER=$(echo $WINDOWS_SDK_LIB_SUBDIR | awk -F. '{printf("%d%05d%05d\n", $1, $2, $3)}')
if test "$SDK_NORMALIZED_VER" -lt 100000022000; then
if test "$WIN_HOST_ARCH" = "arm64" -a \( "$enable_skia" != "no" -o "$enable_pdfium" != "no" \) ; then
AC_MSG_ERROR([You need Windows SDK 10.0.22000 or later to build for Windows arm64 with skia or pdfium. Install a newer version of the SDK or disable skia and pdfium])
fi
# 10.0.20348.0 is the minimum required version,
# but it makes sense to align with arm64 baseline.
# Give people a heads-up to update their systems before enforcing it
if test "$SDK_NORMALIZED_VER" -lt 100000020348; then
AC_MSG_ERROR([You need Windows SDK greater than or equal 10.0.20348.0])
else
add_warning "build requirements might be bumped to Windows SDK >= 10.0.22000 soon"
fi
fi
fi
if test -n "$WINDOWS_SDK_HOME"; then
# Remove a possible trailing backslash
WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
-a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
-a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
have_windows_sdk_headers=yes
elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
-a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
-a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
have_windows_sdk_headers=yes
elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
-a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
-a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
have_windows_sdk_headers=yes
else
have_windows_sdk_headers=no
fi
if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
have_windows_sdk_libs=yes
elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/user32.lib"; then
have_windows_sdk_libs=yes
else
have_windows_sdk_libs=no
fi
if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
the Windows SDK are installed.])
fi
fi
if test -z "$WINDOWS_SDK_HOME"; then
AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
WINDOWS_SDK_VERSION=80
AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
WINDOWS_SDK_VERSION=81
AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
WINDOWS_SDK_VERSION=10
AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
else
AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
fi
PathFormat "$WINDOWS_SDK_HOME"
WINDOWS_SDK_HOME="$formatted_path"
WINDOWS_SDK_HOME_unix="$formatted_path_unix"
if test "$build_os" = "cygwin" -o "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
if test -d "$WINDOWS_SDK_HOME_unix/include/um"; then
SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
elif test -d "$WINDOWS_SDK_HOME_unix/Include/$winsdklibsubdir/um"; then
SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
fi
fi
dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
dnl but not in v8.0), so allow this to be overridden with a
dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
dnl and configuration error if no WiLangId.vbs is found would arguably be
dnl better, but I do not know under which conditions exactly it is needed by
dnl msiglobal.pm:
if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
WINDOWS_SDK_WILANGID_unix=$WINDOWS_SDK_HOME_unix/Samples/sysmgmt/msi/scripts/WiLangId.vbs
if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
WINDOWS_SDK_WILANGID_unix="${WINDOWS_SDK_HOME_unix}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WIN_BUILD_ARCH}/WiLangId.vbs"
fi
if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
WINDOWS_SDK_WILANGID_unix=$WINDOWS_SDK_HOME_unix/bin/$WIN_BUILD_ARCH/WiLangId.vbs
fi
if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
WINDOWS_SDK_WILANGID_unix="C:/Program Files (x86)/Windows Kits/8.1/bin/$WIN_BUILD_ARCH/WiLangId.vbs"
fi
PathFormat "$WINDOWS_SDK_WILANGID_unix"
WINDOWS_SDK_WILANGID="$formatted_path"
fi
if test -n "$with_lang" -a "$with_lang" != "en-US"; then
if test -n "$with_package_format" -a "$with_package_format" != no; then
for i in "$with_package_format"; do
if test "$i" = "msi"; then
if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
fi
fi
done
fi
fi
fi
AC_SUBST(WINDOWS_SDK_HOME)
AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
AC_SUBST(WINDOWS_SDK_VERSION)
AC_SUBST(WINDOWS_SDK_WILANGID)
if test "$build_os" = "cygwin" -o "$build_os" = "wsl" -o -n "$WSL_ONLY_AS_HELPER"; then
dnl Check midl.exe; this being the first check for a tool in the SDK bin
dnl dir, it also determines that dir's path w/o an arch segment if any,
dnl WINDOWS_SDK_BINDIR_NO_ARCH:
AC_MSG_CHECKING([for midl.exe])
find_winsdk
PathFormat "$winsdktest"
winsdktest_unix="$formatted_path_unix"
if test -n "$winsdkbinsubdir" \
-a -f "$winsdktest_unix/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/midl.exe"
then
MIDL_PATH=$winsdktest_unix/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH
WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME_unix/Bin/$winsdkbinsubdir
elif test -f "$winsdktest_unix/Bin/$WIN_BUILD_ARCH/midl.exe"; then
MIDL_PATH=$winsdktest_unix/Bin/$WIN_BUILD_ARCH
WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME_unix/Bin
elif test -f "$winsdktest_unix/Bin/midl.exe"; then
MIDL_PATH=$winsdktest_unix/Bin
WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME_unix/Bin
fi
PathFormat "$MIDL_PATH"
if test ! -f "$formatted_path_unix/midl.exe"; then
AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WIN_BUILD_ARCH, Windows SDK installation broken?])
else
AC_MSG_RESULT([$MIDL_PATH/midl.exe])
fi
# Convert to posix path with 8.3 filename restrictions ( No spaces )
MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
-a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
-a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
-a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
-a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
-a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
-a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
-a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
-a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
-a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
else
AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
fi
PathFormat "$MIDL_PATH"
MIDL_PATH="$formatted_path"
if test "$enable_cli" = yes; then
dnl Check csc.exe
AC_MSG_CHECKING([for csc.exe])
find_csc
PathFormat "$csctest"
csctest_unix="$formatted_path_unix"
if test -f "$csctest_unix/csc.exe"; then
CSC_PATH="$csctest"
fi
if test ! -f "$csctest_unix/csc.exe"; then
AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
else
AC_MSG_RESULT([$CSC_PATH/csc.exe])
fi
CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
dnl Check al.exe
AC_MSG_CHECKING([for al.exe])
if test -n "$winsdkbinsubdir" \
-a -f "$winsdktest_unix/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/al.exe"
then
AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH"
elif test -f "$winsdktest_unix/Bin/$WIN_BUILD_ARCH/al.exe"; then
AL_PATH="$winsdktest/Bin/$WIN_BUILD_ARCH"
elif test -f "$winsdktest_unix/Bin/al.exe"; then
AL_PATH="$winsdktest/Bin"
fi
if test -z "$AL_PATH"; then
find_al
PathFormat "$altest"
altest_unix="$formatted_path_unix"
if test -f "$altest_unix/bin/al.exe"; then
AL_PATH="$altest/bin"
elif test -f "$altest_unix/al.exe"; then
AL_PATH="$altest"
fi
fi
PathFormat "$AL_PATH"
if test ! -f "$formatted_path_unix/al.exe"; then
AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
else
AC_MSG_RESULT([$AL_PATH/al.exe])
fi
AL_PATH=`win_short_path_for_make "$AL_PATH"`
dnl Check mscoree.lib / .NET Framework dir
AC_MSG_CHECKING(.NET Framework)
find_dotnetsdk
PathFormat "$frametest"
frametest="$formatted_path_unix"
if test -f "$frametest/Lib/um/$WIN_BUILD_ARCH/mscoree.lib"; then
DOTNET_FRAMEWORK_HOME="$frametest"
else
if test -f "$winsdktest_unix/lib/mscoree.lib" -o -f "$winsdktest_unix/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/mscoree.lib"; then
DOTNET_FRAMEWORK_HOME="$winsdktest"
fi
fi
PathFormat "$DOTNET_FRAMEWORK_HOME"
if test ! -f "$formatted_path_unix/lib/mscoree.lib" -a ! -f "$formatted_path_unix/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/mscoree.lib" -a ! -f "$formatted_path_unix/Lib/um/$WIN_BUILD_ARCH/mscoree.lib"; then
AC_MSG_ERROR([mscoree.lib not found])
fi
AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
PathFormat "$AL_PATH"
AL_PATH="$formatted_path"
PathFormat "$DOTNET_FRAMEWORK_HOME"
DOTNET_FRAMEWORK_HOME="$formatted_path"
PathFormat "$CSC_PATH"
CSC_PATH="$formatted_path"
ENABLE_CLI="TRUE"
else
ENABLE_CLI=""
fi
else
ENABLE_CLI=""
fi
AC_SUBST(ENABLE_CLI)
dnl ===================================================================
dnl Testing for C++ compiler and version...
dnl ===================================================================
if test "$_os" != "WINNT"; then
# AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that (and avoid -O2 during AC_PROG_CXX,
# see AC_PROG_CC above):
save_CXXFLAGS=$CXXFLAGS
CXXFLAGS=-g
AC_PROG_CXX
CXXFLAGS=$save_CXXFLAGS
if test -z "$CXX_BASE"; then
CXX_BASE=`first_arg_basename "$CXX"`
fi
fi
CC="$CC $with_extra_cc_flags"
CXX="$CXX $with_extra_cxx_flags"
dnl check for GNU C++ compiler version
if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
AC_MSG_CHECKING([the GNU C++ compiler version])
_gpp_version=`$CXX -dumpversion`
_gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
if test "$_gpp_majmin" -lt "1200"; then
AC_MSG_ERROR([You need to use GNU C++ compiler version >= 12.0 to build LibreOffice, you have $_gpp_version.])
else
AC_MSG_RESULT([ok (g++ $_gpp_version)])
fi
dnl see https://issuetracker.google.com/issues/36962819
glibcxx_threads=no
AC_LANG_PUSH([C++])
AC_REQUIRE_CPP
AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
#include <bits/c++config.h>]],[[
#if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
&& !defined(_GLIBCXX__PTHREADS) \
&& !defined(_GLIBCXX_HAS_GTHREADS)
choke me
#endif
]])],[AC_MSG_RESULT([yes])
glibcxx_threads=yes],[AC_MSG_RESULT([no])])
AC_LANG_POP([C++])
if test $glibcxx_threads = yes; then
BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
fi
fi
AC_SUBST(BOOST_CXXFLAGS)
#
# prefix CXX with ccache if needed
#
if test "$CCACHE" != ""; then
AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
AC_LANG_PUSH([C++])
save_CXXFLAGS=$CXXFLAGS
CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
# msvc does not fail on unknown options, check stdout
if test "$COM" = MSC; then
CXXFLAGS="$CXXFLAGS -nologo"
fi
save_ac_cxx_werror_flag=$ac_cxx_werror_flag
ac_cxx_werror_flag=yes
dnl an empty program will do, we're checking the compiler flags
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
[use_ccache=yes], [use_ccache=no])
if test $use_ccache = yes -a "${CCACHE##*sccache*}" != ""; then
AC_MSG_RESULT([yes])
else
CXX="$CCACHE $CXX"
CXX_BASE="ccache $CXX_BASE"
AC_MSG_RESULT([no])
fi
CXXFLAGS=$save_CXXFLAGS
ac_cxx_werror_flag=$save_ac_cxx_werror_flag
AC_LANG_POP([C++])
fi
dnl ===================================================================
dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
dnl ===================================================================
if test "$_os" != "WINNT"; then
AC_PROG_CXXCPP
dnl Check whether there's a C pre-processor.
AC_PROG_CPP
fi
dnl ===================================================================
dnl Find integral type sizes and alignments
dnl ===================================================================
if test "$_os" != "WINNT"; then
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long long)
AC_CHECK_SIZEOF(double)
AC_CHECK_SIZEOF(void*)
AC_CHECK_SIZEOF(size_t)
SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
SIZEOF_SIZE_T=$ac_cv_sizeof_size_t
dnl Allow build without AC_CHECK_ALIGNOF, grrr
m4_pattern_allow([AC_CHECK_ALIGNOF])
m4_ifdef([AC_CHECK_ALIGNOF],
[
AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
],
[
case "$_os-$host_cpu" in
Linux-i686)
test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
;;
Linux-x86_64)
test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
;;
*)
if test -z "$ac_cv_alignof_short" -o \
-z "$ac_cv_alignof_int" -o \
-z "$ac_cv_alignof_long" -o \
-z "$ac_cv_alignof_double"; then
AC_MSG_ERROR([Your Autoconf doesn't have [AC_][CHECK_ALIGNOF]. You need to set the environment variables ac_cv_alignof_short, ac_cv_alignof_int, ac_cv_alignof_long and ac_cv_alignof_double.])
fi
;;
esac
])
SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
if test $ac_cv_sizeof_long -eq 8; then
SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
elif test $ac_cv_sizeof_double -eq 8; then
SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
else
AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
fi
dnl Check for large file support
AC_SYS_LARGEFILE
if test -n "$ac_cv_sys_largefile_opts" -a "$ac_cv_sys_largefile_opts" != "none needed" -a "$ac_cv_sys_largefile_opts" != "support not detected"; then
LFS_CFLAGS="$ac_cv_sys_largefile_opts"
elif test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
fi
if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
fi
else
# Hardcode for MSVC
SAL_TYPES_SIZEOFSHORT=2
SAL_TYPES_SIZEOFINT=4
SAL_TYPES_SIZEOFLONG=4
SAL_TYPES_SIZEOFLONGLONG=8
if test $WIN_HOST_BITS -eq 32; then
SAL_TYPES_SIZEOFPOINTER=4
SIZEOF_SIZE_T=4
else
SAL_TYPES_SIZEOFPOINTER=8
SIZEOF_SIZE_T=8
fi
SAL_TYPES_ALIGNMENT2=2
SAL_TYPES_ALIGNMENT4=4
SAL_TYPES_ALIGNMENT8=8
LFS_CFLAGS=''
fi
AC_SUBST(LFS_CFLAGS)
AC_SUBST(SIZEOF_SIZE_T)
AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
dnl Calc jumbo sheets (1m+ rows) depend on 64 bit tools::Long .
AC_MSG_CHECKING([whether jumbo sheets are supported])
if test "$_os" != "WINNT"; then
if test $SAL_TYPES_SIZEOFLONG -gt 4; then
AC_MSG_RESULT([yes])
ENABLE_JUMBO_SHEETS=TRUE
AC_DEFINE(HAVE_FEATURE_JUMBO_SHEETS)
else
AC_MSG_RESULT([no])
fi
else
if test $WIN_HOST_BITS -gt 32; then
# 64bit windows is special-cased for tools::Long because long is 32bit
AC_MSG_RESULT([yes])
ENABLE_JUMBO_SHEETS=TRUE
AC_DEFINE(HAVE_FEATURE_JUMBO_SHEETS)
else
AC_MSG_RESULT([no])
fi
fi
AC_SUBST(ENABLE_JUMBO_SHEETS)
dnl ===================================================================
dnl Check whether to enable runtime optimizations
dnl ===================================================================
ENABLE_RUNTIME_OPTIMIZATIONS=
AC_MSG_CHECKING([whether to enable runtime optimizations])
if test -z "$enable_runtime_optimizations"; then
for i in $CC; do
case $i in
-fsanitize=*)
enable_runtime_optimizations=no
break
;;
esac
done
fi
if test "$enable_runtime_optimizations" != no; then
ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
dnl ===================================================================
dnl Check if valgrind headers are available
dnl ===================================================================
ENABLE_VALGRIND=
if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
prev_cppflags=$CPPFLAGS
# Is VALGRIND_CFLAGS something one is supposed to have in the environment,
# or where does it come from?
CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
AC_CHECK_HEADER([valgrind/valgrind.h],
[ENABLE_VALGRIND=TRUE])
CPPFLAGS=$prev_cppflags
fi
AC_SUBST([ENABLE_VALGRIND])
if test -z "$ENABLE_VALGRIND"; then
if test "$with_valgrind" = yes; then
AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
fi
VALGRIND_CFLAGS=
fi
AC_SUBST([VALGRIND_CFLAGS])
dnl ===================================================================
dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
dnl ===================================================================
# We need at least the sys/sdt.h include header.
AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
if test "$SDT_H_FOUND" = "TRUE"; then
# Found sys/sdt.h header, now make sure the c++ compiler works.
# Old g++ versions had problems with probes in constructors/destructors.
AC_MSG_CHECKING([working sys/sdt.h and c++ support])
AC_LANG_PUSH([C++])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <sys/sdt.h>
class ProbeClass
{
private:
int& ref;
const char *name;
public:
ProbeClass(int& v, const char *n) : ref(v), name(n)
{
DTRACE_PROBE2(_test_, cons, name, ref);
}
void method(int min)
{
DTRACE_PROBE3(_test_, meth, name, ref, min);
ref -= min;
}
~ProbeClass()
{
DTRACE_PROBE2(_test_, dest, name, ref);
}
};
]],[[
int i = 64;
DTRACE_PROBE1(_test_, call, i);
ProbeClass inst = ProbeClass(i, "call");
inst.method(24);
]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
[AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
AC_LANG_POP([C++])
fi
AC_CONFIG_HEADERS([config_host/config_probes.h])
dnl ===================================================================
dnl GCC features
dnl ===================================================================
HAVE_GCC_STACK_CLASH_PROTECTION=
HARDENING_CFLAGS=
HARDENING_OPT_CFLAGS=
if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
AC_MSG_CHECKING([whether $CC_BASE supports -grecord-gcc-switches])
save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Werror -grecord-gcc-switches"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(, [[return 0;]])],
[AC_MSG_RESULT([yes]); HARDENING_CFLAGS="$HARDENING_CFLAGS -grecord-gcc-switches"],
[AC_MSG_RESULT([no])])
CFLAGS=$save_CFLAGS
AC_MSG_CHECKING([whether $CC_BASE supports -D_FORTIFY_SOURCE=2])
save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Werror -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=2"
if test "$ENABLE_OPTIMIZED" = TRUE; then
CFLAGS="$CFLAGS -O2"
fi
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include <string.h>]], [[return 0;]])],
[AC_MSG_RESULT([yes]); HARDENING_OPT_CFLAGS="$HARDENING_OPT_CFLAGS -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=2"],
[AC_MSG_RESULT([no])])
CFLAGS=$save_CFLAGS
AC_MSG_CHECKING([whether $CC_BASE supports -D_GLIBCXX_ASSERTIONS])
save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Werror -Wp,-D_GLIBCXX_ASSERTIONS"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(, [[return 0;]])],
[AC_MSG_RESULT([yes]); HARDENING_CFLAGS="$HARDENING_CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS"],
[AC_MSG_RESULT([no])])
CFLAGS=$save_CFLAGS
AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Werror -fstack-clash-protection"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(, [[return 0;]])],
[AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE; HARDENING_CFLAGS="$HARDENING_CFLAGS -fstack-clash-protection"],
[AC_MSG_RESULT([no])])
CFLAGS=$save_CFLAGS
AC_MSG_CHECKING([whether $CC_BASE supports -fcf-protection])
save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Werror -fcf-protection"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(, [[return 0;]])],
[AC_MSG_RESULT([yes]); HARDENING_CFLAGS="$HARDENING_CFLAGS -fcf-protection"],
[AC_MSG_RESULT([no])])
CFLAGS=$save_CFLAGS
AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Werror -mno-avx"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
CFLAGS=$save_CFLAGS
if test "$HAVE_GCC_AVX" = "TRUE"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
int v = 0;
if (__sync_add_and_fetch(&v, 1) != 1 ||
__sync_sub_and_fetch(&v, 1) != 0)
return 1;
__sync_synchronize();
if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
v != 1)
return 1;
return 0;
]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
else
AC_MSG_RESULT([no])
fi
AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <cstddef>
#include <cxxabi.h>
std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
])], [
AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
AC_MSG_RESULT([yes])
], [AC_MSG_RESULT([no])])
AC_LANG_POP([C++])
AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <cstddef>
#include <cxxabi.h>
std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
])], [
AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
AC_MSG_RESULT([yes])
], [AC_MSG_RESULT([no])])
AC_LANG_POP([C++])
AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <cxxabi.h>
void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
])], [
AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
AC_MSG_RESULT([yes])
], [AC_MSG_RESULT([no])])
AC_LANG_POP([C++])
AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <cstddef>
#include <cxxabi.h>
std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
])], [
AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
AC_MSG_RESULT([yes])
], [AC_MSG_RESULT([no])])
AC_LANG_POP([C++])
AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exception in cxxabi.h])
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <cstddef>
#include <cxxabi.h>
std::size_t f() { return sizeof(__cxxabiv1::__cxa_exception); }
])], [
AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTION],[1])
AC_MSG_RESULT([yes])
], [AC_MSG_RESULT([no])])
AC_LANG_POP([C++])
AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <cxxabi.h>
void * f() { return __cxxabiv1::__cxa_get_globals(); }
])], [
AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
AC_MSG_RESULT([yes])
], [AC_MSG_RESULT([no])])
AC_LANG_POP([C++])
AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <cxxabi.h>
void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
])], [
AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
AC_MSG_RESULT([yes])
], [AC_MSG_RESULT([no])])
AC_LANG_POP([C++])
AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <cxxabi.h>
void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
])], [
AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
AC_MSG_RESULT([yes])
], [AC_MSG_RESULT([no])])
AC_LANG_POP([C++])
AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <cstddef>
#include <cxxabi.h>
std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
])], [
AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
AC_MSG_RESULT([yes])
], [AC_MSG_RESULT([no])])
AC_LANG_POP([C++])
AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <cstddef>
#include <cxxabi.h>
std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
])], [
AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
AC_MSG_RESULT([yes])
], [AC_MSG_RESULT([no])])
AC_LANG_POP([C++])
fi
AC_SUBST(HAVE_GCC_AVX)
AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
AC_SUBST(HARDENING_CFLAGS)
AC_SUBST(HARDENING_OPT_CFLAGS)
dnl ===================================================================
dnl Identify the C++ library
dnl ===================================================================
AC_MSG_CHECKING([what the C++ library is])
HAVE_LIBSTDCPP=
HAVE_LIBCPP=
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <utility>
#ifndef __GLIBCXX__
foo bar
#endif
]])],
[CPP_LIBRARY=GLIBCXX
cpp_library_name="GNU libstdc++"
HAVE_LIBSTDCPP=TRUE
],
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <utility>
#ifndef _LIBCPP_VERSION
foo bar
#endif
]])],
[CPP_LIBRARY=LIBCPP
cpp_library_name="LLVM libc++"
AC_DEFINE([HAVE_LIBCPP])
HAVE_LIBCPP=TRUE
],
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <utility>
#ifndef _MSC_VER
foo bar
#endif
]])],
[CPP_LIBRARY=MSVCRT
cpp_library_name="Microsoft"
],
AC_MSG_ERROR([Could not figure out what C++ library this is]))))
AC_MSG_RESULT([$cpp_library_name])
AC_LANG_POP([C++])
AC_SUBST([HAVE_LIBSTDCPP])
AC_SUBST([HAVE_LIBCPP])
if test -z "${LIBCPP_DEBUG+x}" -a -z "$CROSS_COMPILING" -a -n "$HAVE_LIBCPP" -a -n "$ENABLE_DBGUTIL"
then
# Libc++ has two levels of debug mode, assertions mode enabled with -D_LIBCPP_DEBUG=0,
# and actual debug mode enabled with -D_LIBCPP_DEBUG=1 (and starting with LLVM15
# assertions mode will be separate and controlled by -D_LIBCPP_ENABLE_ASSERTIONS=1,
# although there will be backwards compatibility).
# Debug mode is supported by libc++ only if built for it, e.g. Mac libc++ isn't,
# and there would be undefined references to debug functions.
# Moreover std::to_string() has a bug (https://reviews.llvm.org/D125184).
# So check if debug mode can be used and disable or downgrade it to assertions
# if needed.
AC_MSG_CHECKING([if libc++ has a usable debug mode])
AC_LANG_PUSH([C++])
libcpp_debug_links=
AC_LINK_IFELSE([AC_LANG_SOURCE([[
#define _LIBCPP_DEBUG 0 // only assertions
#include <vector>
int main()
{
std::vector<int> v;
v.push_back( 1 );
return v[ 3 ];
}
]])], [libcpp_debug_links=1])
if test -n "$libcpp_debug_links"; then
# we can use at least assertions, check if debug mode works
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#define _LIBCPP_DEBUG 1 // debug mode
#include <string>
#include <vector>
int foo(const std::vector<int>& v) { return *v.begin(); }
int main()
{
std::vector<int> v;
v.push_back( 1 );
std::string s = "xxxxxxxxxxxxxxxxxxxxxxxxx" + std::to_string(10);
return (foo(v) + s.size()) != 0 ? 0 : 1;
}
]])],
[AC_MSG_RESULT(yes)
LIBCPP_DEBUG=-D_LIBCPP_DEBUG=1
],
[AC_MSG_RESULT(no, using only assertions)
LIBCPP_DEBUG=-D_LIBCPP_DEBUG=0
]
)
else
AC_MSG_RESULT(no)
fi
AC_LANG_POP([C++])
fi
AC_SUBST([LIBCPP_DEBUG])
dnl ===================================================================
dnl Check for gperf
dnl ===================================================================
AC_PATH_PROG(GPERF, gperf)
if test -z "$GPERF"; then
AC_MSG_ERROR([gperf not found but needed. Install it.])
fi
if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
GPERF=`cygpath -m $GPERF`
fi
AC_MSG_CHECKING([whether gperf is new enough])
my_gperf_ver1=$($GPERF --version | head -n 1)
my_gperf_ver2=${my_gperf_ver1#GNU gperf }
my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
if test "$my_gperf_ver3" -ge 301; then
AC_MSG_RESULT([yes ($my_gperf_ver2)])
else
AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
fi
AC_SUBST(GPERF)
dnl ===================================================================
dnl Check for system libcmis
dnl ===================================================================
libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.6 >= 0.6.1],enabled)
dnl ===================================================================
dnl C++11
dnl ===================================================================
if test -z "${CXXFLAGS_CXX11+x}"; then
AC_MSG_CHECKING([whether $CXX_BASE supports C++20])
if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
if test "$with_latest_c__" = yes; then
CXXFLAGS_CXX11=-std:c++latest
else
CXXFLAGS_CXX11=-std:c++20
fi
CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -permissive- -Zc:__cplusplus,preprocessor"
elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
my_flags='-std=c++20 -std=c++2a'
if test "$with_latest_c__" = yes; then
my_flags="-std=c++26 -std=c++2c -std=c++23 -std=c++2b $my_flags"
fi
for flag in $my_flags; do
if test "$COM" = MSC; then
flag="-Xclang $flag"
fi
save_CXXFLAGS=$CXXFLAGS
CXXFLAGS="$CXXFLAGS $flag -Werror"
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <algorithm>
#include <functional>
#include <vector>
void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
std::sort(v.begin(), v.end(), fn);
}
]])],[CXXFLAGS_CXX11=$flag])
AC_LANG_POP([C++])
CXXFLAGS=$save_CXXFLAGS
if test -n "$CXXFLAGS_CXX11"; then
break
fi
done
fi
if test -n "$CXXFLAGS_CXX11"; then
AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
else
AC_MSG_ERROR(no)
fi
fi
AC_SUBST(CXXFLAGS_CXX11)
if test "$GCC" = "yes"; then
save_CXXFLAGS=$CXXFLAGS
CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
CHECK_L_ATOMIC
CXXFLAGS=$save_CXXFLAGS
AC_SUBST(ATOMIC_LIB)
fi
AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
save_CXXFLAGS=$CXXFLAGS
CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <stddef.h>
template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
namespace
{
struct b
{
int i;
int j;
};
}
]], [[
struct a
{
int i;
int j;
};
a thinga[]={{0,0}, {1,1}};
b thingb[]={{0,0}, {1,1}};
size_t i = sizeof(sal_n_array_size(thinga));
size_t j = sizeof(sal_n_array_size(thingb));
return !(i != 0 && j != 0);
]])
], [ AC_MSG_RESULT(yes) ],
[ AC_MSG_ERROR(no)])
AC_LANG_POP([C++])
CXXFLAGS=$save_CXXFLAGS
HAVE_GCC_FNO_SIZED_DEALLOCATION=
if test "$GCC" = yes; then
AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
AC_LANG_PUSH([C++])
save_CXXFLAGS=$CXXFLAGS
CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
CXXFLAGS=$save_CXXFLAGS
AC_LANG_POP([C++])
if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
fi
AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
AC_LANG_PUSH([C++])
save_CXXFLAGS=$CXXFLAGS
CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <algorithm>
#include <initializer_list>
#include <vector>
template<typename T> class S {
private:
std::vector<T> v_;
public:
constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
};
constinit S<int> s{3, 2, 1};
])], [
AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
AC_MSG_RESULT([yes])
], [AC_MSG_RESULT([no])])
CXXFLAGS=$save_CXXFLAGS
AC_LANG_POP([C++])
AC_MSG_CHECKING([whether $CXX_BASE implements C++ DR P1155R3])
AC_LANG_PUSH([C++])
save_CXXFLAGS=$CXXFLAGS
CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
struct S1 { S1(S1 &&); };
struct S2: S1 {};
S1 f(S2 s) { return s; }
])], [
AC_DEFINE([HAVE_P1155R3],[1])
AC_MSG_RESULT([yes])
], [AC_MSG_RESULT([no])])
CXXFLAGS=$save_CXXFLAGS
AC_LANG_POP([C++])
AC_MSG_CHECKING([whether $CXX_BASE supports C++20 std::atomic_ref])
HAVE_CXX20_ATOMIC_REF=
AC_LANG_PUSH([C++])
save_CXXFLAGS=$CXXFLAGS
CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <atomic>
int x;
std::atomic_ref<int> y(x);
])], [
HAVE_CXX20_ATOMIC_REF=TRUE
AC_MSG_RESULT([yes])
], [AC_MSG_RESULT([no])])
CXXFLAGS=$save_CXXFLAGS
AC_LANG_POP([C++])
AC_SUBST([HAVE_CXX20_ATOMIC_REF])
dnl Supported since GCC 9 and Clang 10 (which each also started to support -Wdeprecated-copy, but
dnl which is included in -Wextra anyway):
HAVE_WDEPRECATED_COPY_DTOR=
if test "$GCC" = yes; then
AC_MSG_CHECKING([whether $CXX_BASE supports -Wdeprecated-copy-dtor])
AC_LANG_PUSH([C++])
save_CXXFLAGS=$CXXFLAGS
CXXFLAGS="$CXXFLAGS -Werror -Wdeprecated-copy-dtor"
AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
HAVE_WDEPRECATED_COPY_DTOR=TRUE
AC_MSG_RESULT([yes])
], [AC_MSG_RESULT([no])])
CXXFLAGS=$save_CXXFLAGS
AC_LANG_POP([C++])
fi
AC_SUBST([HAVE_WDEPRECATED_COPY_DTOR])
dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
dnl uninitialized warning for code like
dnl
dnl OString f();
dnl boost::optional<OString> * g(bool b) {
dnl boost::optional<OString> o;
dnl if (b) o = f();
dnl return new boost::optional<OString>(o);
dnl }
dnl
dnl (as is e.g. present, in a slightly more elaborate form, in
dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
dnl code is meant to be a faithfully stripped-down and self-contained version of the above code: | |