summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2020-06-23 21:49:26 +0300
committerTor Lillqvist <tml@collabora.com>2020-11-15 09:01:32 +0100
commitc685184de261875980b2dda7d6c96c1a73d27703 (patch)
tree1b97f1b1f4aaf0f51f45a88cefe99bf6a2e66548 /configure.ac
parent1a4f7443491e809959b53838fb0cfad287317a88 (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>
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 75f36372e32b..31d91858ca04 100644
--- a/configure.ac
+++ b/configure.ac
@@ -605,6 +605,8 @@ INSTROOTBASESUFFIX=
INSTROOTCONTENTSUFFIX=
SDKDIRNAME=sdk
+HOST_PLATFORM="$host"
+
case "$host_os" in
solaris*)
@@ -680,7 +682,7 @@ cygwin*|interix*)
LINKFLAGSNOUNDEFS=
;;
-darwin*) # macOS or iOS
+darwin*|macos*) # macOS
test_randr=no
test_xrender=no
test_freetype=no
@@ -690,26 +692,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=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
+ _os=Darwin
+ INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
+ INSTROOTCONTENTSUFFIX=/Contents
+ SDKDIRNAME=AC_PACKAGE_NAME${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"
@@ -721,6 +742,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*)
@@ -829,6 +854,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
@@ -2849,8 +2876,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
@@ -2913,13 +2948,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`
@@ -3282,10 +3327,9 @@ if test "$_os" = "WINNT"; then
fi
fi
AC_SUBST(WINDOWS_SDK_ARCH)
-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
@@ -4261,7 +4305,7 @@ cygwin*)
SCPDEFS="$SCPDEFS -D_MSC_VER"
;;
-darwin*)
+darwin*|macos*)
COM=GCC
USING_X11=
OS=MACOSX
@@ -4269,23 +4313,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
@@ -4300,6 +4336,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