[Build-System] Fix build for m1 and m2 chips on macOS

This commit is contained in:
Seven Du 2025-01-14 19:06:11 +08:00 committed by GitHub
parent ca9430eaeb
commit b8a9c8be9b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 2 deletions

View File

@ -740,6 +740,8 @@ case "$host" in
APR_REMOVEFROM(SWITCH_AM_CFLAGS, -fPIC)
APR_ADDTO(CPPFLAGS, -I/usr/local/opt/openssl/include)
APR_ADDTO(LDFLAGS, -L/usr/local/opt/openssl/lib)
APR_ADDTO(CPPFLAGS, -I/opt/homebrew/include)
APR_ADDTO(LDFLAGS, -L/opt/homebrew/lib)
if test "x$enable_core_odbc_support" != "xno"; then
APR_ADDTO([PLATFORM_CORE_LDFLAGS], [--framework CoreFoundation])
fi
@ -838,6 +840,8 @@ AM_CONDITIONAL([SYSTEM_APR],[test "${use_system_apr}" = "yes"])
save_LIBS="$LIBS"
LIBS=
AC_CHECK_HEADERS([jpeglib.h])
AC_CHECK_LIB(jpeg, jpeg_std_error,, AC_MSG_ERROR([no usable libjpeg; please install libjpeg devel package or equivalent]))
AC_CHECK_LIB(jbig, jbg_enc_out, have_libjbig=yes, have_libjbig=no)
@ -1262,6 +1266,8 @@ case $host in
path_push_unique PKG_CONFIG_PATH /usr/local/opt/sqlite/lib/pkgconfig/
path_push_unique PKG_CONFIG_PATH /usr/local/opt/ldns/lib/pkgconfig/
path_push_unique PKG_CONFIG_PATH /usr/local/opt/ffmpeg/lib/pkgconfig/
path_push_unique PKG_CONFIG_PATH /opt/homebrew/lib/pkgconfig/
path_push_unique PKG_CONFIG_PATH /opt/homebrew/opt/sqlite/lib/pkgconfig/
;;
esac

View File

@ -767,6 +767,10 @@ process_common_toolchain() {
# detect tgt_os
case "$gcctarget" in
arm64-apple-darwin*)
tgt_isa=arm64
tgt_os=darwin
;;
*darwin*)
tgt_isa=x86_64
tgt_os=darwin
@ -845,7 +849,7 @@ process_common_toolchain() {
# Handle darwin variants. Newer SDKs allow targeting older
# platforms, so use the newest one available.
case ${toolchain} in
arm*-darwin*)
DISABLE-arm*-darwin*)
add_cflags "-miphoneos-version-min=${IOS_VERSION_MIN}"
iphoneos_sdk_dir="$(show_darwin_sdk_path iphoneos)"
if [ -d "${iphoneos_sdk_dir}" ]; then
@ -1046,7 +1050,7 @@ EOF
soft_enable unit_tests
;;
darwin*)
DISABLE-darwin*)
XCRUN_FIND="xcrun --sdk iphoneos --find"
CXX="$(${XCRUN_FIND} clang++)"
CC="$(${XCRUN_FIND} clang)"