summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2020-06-23 21:49:26 +0300
committerCaolán McNamara <caolanm@redhat.com>2020-11-23 10:05:14 +0100
commitbd9cc042e0f00390403c5d1e0c26afe215712eee (patch)
tree014e32496a6d135c6200d2da9a848b9985d61255 /configure.ac
parent8d75d466b2c86df381c1aec107b5ec462e249b03 (diff)
Initial WIP steps for building for macOS on Apple Silicon
Don't use $host_os="darwin" for both macOS and iOS depending on $host_cpu. Soon macOS will run on either x86_64 or arm64. Instead, use "darwin" (or "macos") for macOS and "ios" for iOS. Some other early changes for arm64-apple-macos, too. Change-Id: Id89987d854ceba2cd87c6222db2081ccdec0c73e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96976 Tested-by: Jenkins Reviewed-by: Tor Lillqvist <tml@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105868 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106368 Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac134
1 files changed, 96 insertions, 38 deletions
diff --git a/configure.ac b/configure.ac
index ad81ece7b21c..e739513c0b33 100644
--- a/configure.ac
+++ b/configure.ac
@@ -597,6 +597,8 @@ INSTROOTBASESUFFIX=
INSTROOTCONTENTSUFFIX=
SDKDIRNAME=sdk
+HOST_PLATFORM="$host"
+
case "$host_os" in
solaris*)
@@ -675,7 +677,7 @@ cygwin*|interix*)
LINKFLAGSNOUNDEFS=
;;
-darwin*) # macOS or iOS
+darwin*|macos*) # macOS
test_randr=no
test_xrender=no
test_freetype=no
@@ -685,26 +687,45 @@ darwin*) # macOS or iOS
mac_sanitize_path
AC_MSG_NOTICE([sanitized the PATH to $PATH])
fi
- if test "$host_cpu" = "arm64" -o "$enable_ios_simulator" = "yes"; then
- build_for_ios=YES
- _os=iOS
- test_cups=no
- enable_mpl_subset=yes
- enable_lotuswordpro=no
- enable_coinmp=no
- enable_lpsolve=no
- enable_postgresql_sdbc=no
- enable_extension_integration=no
- enable_report_builder=no
- with_ppds=no
- if test "$enable_ios_simulator" = "yes"; then
- host=x86_64-apple-darwin
- fi
- else
- _os=Darwin
- INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
- INSTROOTCONTENTSUFFIX=/Contents
- SDKDIRNAME=${PRODUCTNAME_WITHOUT_SPACES}${PRODUCTVERSION}_SDK
+ _os=Darwin
+ INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
+ INSTROOTCONTENTSUFFIX=/Contents
+ SDKDIRNAME=${PRODUCTNAME_WITHOUT_SPACES}${PRODUCTVERSION}_SDK
+ # See comment above the case "$host_os"
+ LINKFLAGSSHL="-dynamiclib -single_module"
+
+ # -fPIC is default
+ PICSWITCH=""
+
+ DLLPOST=".dylib"
+
+ # -undefined error is the default
+ LINKFLAGSNOUNDEFS=""
+;;
+
+ios*) # iOS
+ test_randr=no
+ test_xrender=no
+ test_freetype=no
+ test_fontconfig=no
+ test_dbus=no
+ if test -n "$LODE_HOME" ; then
+ mac_sanitize_path
+ AC_MSG_NOTICE([sanitized the PATH to $PATH])
+ fi
+ build_for_ios=YES
+ _os=iOS
+ test_cups=no
+ enable_mpl_subset=yes
+ enable_lotuswordpro=no
+ enable_coinmp=no
+ enable_lpsolve=no
+ enable_postgresql_sdbc=no
+ enable_extension_integration=no
+ enable_report_builder=no
+ with_ppds=no
+ if test "$enable_ios_simulator" = "yes"; then
+ host=x86_64-apple-darwin
fi
# See comment above the case "$host_os"
LINKFLAGSSHL="-dynamiclib -single_module"
@@ -716,6 +737,10 @@ darwin*) # macOS or iOS
# -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 arm64-apple-darwin as before for now.
+ HOST_PLATFORM=arm64-apple-darwin
;;
freebsd*)
@@ -827,6 +852,8 @@ haiku*)
;;
esac
+AC_SUBST(HOST_PLATFORM)
+
if test "$_os" = "Android" ; then
# Verify that the NDK and SDK options are proper
if test -z "$with_android_ndk"; then
@@ -2851,8 +2878,16 @@ if test $_os = Darwin; then
;;
esac
+ if test "$host_cpu" = arm64 -a $MACOSX_SDK_VERSION -lt 110000; then
+ AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value for Apple Silicon])
+ fi
+
if test "$with_macosx_version_min_required" = "" ; then
- with_macosx_version_min_required="10.10";
+ if test "$host_cpu" = x86_64; then
+ with_macosx_version_min_required="10.10";
+ else
+ with_macosx_version_min_required="11.0";
+ fi
fi
if test "$with_macosx_version_max_allowed" = "" ; then
@@ -2914,13 +2949,23 @@ if test $_os = Darwin; then
AC_MSG_CHECKING([what C compiler to use])
CC="`xcrun -find clang`"
CC_BASE=`first_arg_basename "$CC"`
- CC+=" -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
+ if test "$host_cpu" = x86_64; then
+ CC+=" -target x86_64-apple-macos"
+ else
+ CC+=" -target arm64-apple-macos"
+ fi
+ CC+=" $lto -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"`
- CXX+=" -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
+ if test "$host_cpu" = x86_64; then
+ CXX+=" -target x86_64-apple-macos"
+ else
+ CXX+=" -target arm64-apple-macos"
+ fi
+ CXX+=" $lto $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`
@@ -3271,10 +3316,9 @@ if test "$_os" = "WINNT"; then
BITNESS_OVERRIDE=64
fi
fi
-if test "$_os" = "iOS"; then
+if test "$_os" = "iOS" -o "$build_cpu" != "$host_cpu"; then
cross_compiling="yes"
fi
-
if test "$cross_compiling" = "yes"; then
export CROSS_COMPILING=TRUE
else
@@ -4277,7 +4321,7 @@ cygwin*)
SCPDEFS="$SCPDEFS -D_MSC_VER"
;;
-darwin*)
+darwin*|macos*)
COM=GCC
USING_X11=
OS=MACOSX
@@ -4285,23 +4329,15 @@ darwin*)
P_SEP=:
case "$host_cpu" in
- arm)
- AC_MSG_ERROR([Can't build 32-bit code for iOS])
- ;;
arm64)
- OS=iOS
- RTL_OS=iOS
if test "$enable_ios_simulator" = "yes"; then
- AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
+ OS=iOS
else
CPUNAME=ARM64
- RTL_ARCH=ARM_EABI
- PLATFORMID=ios_arm64
+ RTL_ARCH=AARCH
+ PLATFORMID=macosx_arm64
fi
;;
- i*86)
- AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
- ;;
x86_64)
if test "$enable_ios_simulator" = "yes"; then
OS=iOS
@@ -4316,6 +4352,28 @@ darwin*)
esac
;;
+ios*)
+ COM=GCC
+ USING_X11=
+ OS=iOS
+ RTL_OS=iOS
+ P_SEP=:
+
+ case "$host_cpu" in
+ 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=ARM64
+ RTL_ARCH=ARM_EABI
+ PLATFORMID=ios_arm64
+ ;;
+
dragonfly*)
COM=GCC
USING_X11=TRUE