diff --git a/config-scripts/cups-compiler.m4 b/config-scripts/cups-compiler.m4 index 802bf5382..918054646 100644 --- a/config-scripts/cups-compiler.m4 +++ b/config-scripts/cups-compiler.m4 @@ -225,6 +225,7 @@ AS_IF([test -n "$GCC"], [ ]) # Add general compiler options per platform... +AC_MSG_CHECKING([for OS-specific compiler options]) AS_CASE([$host_os_name], [linux*], [ # glibc 2.8 and higher breaks peer credentials unless you # define _GNU_SOURCE... 32-bit Linux needs 64-bit time/file offsets... @@ -235,4 +236,25 @@ AS_CASE([$host_os_name], [linux*], [ AS_IF([test x$enable_relro = xyes], [ RELROFLAGS="-Wl,-z,relro,-z,now" ]) + + AC_MSG_RESULT([-D_GNU_SOURCE -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 $RELROFLAGS]) +], [darwin*], [ + # When not building for debug, target macOS 11 or later, "universal" + # binaries when possible... + AS_IF([echo "$CPPFLAGS $CFLAGS $LDFLAGS $OPTIM" | grep -q "\\-arch "], [ + # Don't add architecture/min-version flags if they are already present + AC_MSG_RESULT([none]) + ], [echo "$CPPFLAGS $CFLAGS $LDFLAGS $OPTIM" | grep -q "\\-mmacosx-version-"], [ + # Don't add architecture/min-version flags if they are already present + AC_MSG_RESULT([none]) + ], [test "$host_os_version" -ge 200 -a x$enable_debug != xyes], [ + # macOS 11.0 and higher support the Apple Silicon (arm64) CPUs + OPTIM="$OPTIM -mmacosx-version-min=11.0 -arch x86_64 -arch arm64" + AC_MSG_RESULT([-mmacosx-version-min=11.0 -arch x86_64 -arch arm64]) + ], [ + # Don't add architecture/min-version flags if debug enabled + AC_MSG_RESULT([none]) + ]) +], [*], [ + AC_MSG_RESULT([none]) ]) diff --git a/configure b/configure index 08d0d5546..9469bf370 100755 --- a/configure +++ b/configure @@ -8255,6 +8255,8 @@ esac fi # Add general compiler options per platform... +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OS-specific compiler options" >&5 +printf %s "checking for OS-specific compiler options... " >&6; } case $host_os_name in #( linux*) : @@ -8270,6 +8272,48 @@ then : RELROFLAGS="-Wl,-z,relro,-z,now" fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: -D_GNU_SOURCE -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 $RELROFLAGS" >&5 +printf "%s\n" "-D_GNU_SOURCE -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 $RELROFLAGS" >&6; } + ;; #( + darwin*) : + + # When not building for debug, target macOS 11 or later, "universal" + # binaries when possible... + if echo "$CPPFLAGS $CFLAGS $LDFLAGS $OPTIM" | grep -q "\\-arch " +then : + + # Don't add architecture/min-version flags if they are already present + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none" >&5 +printf "%s\n" "none" >&6; } + +elif echo "$CPPFLAGS $CFLAGS $LDFLAGS $OPTIM" | grep -q "\\-mmacosx-version-" +then : + + # Don't add architecture/min-version flags if they are already present + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none" >&5 +printf "%s\n" "none" >&6; } + +elif test "$host_os_version" -ge 200 -a x$enable_debug != xyes +then : + + # macOS 11.0 and higher support the Apple Silicon (arm64) CPUs + OPTIM="$OPTIM -mmacosx-version-min=11.0 -arch x86_64 -arch arm64" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: -mmacosx-version-min=11.0 -arch x86_64 -arch arm64" >&5 +printf "%s\n" "-mmacosx-version-min=11.0 -arch x86_64 -arch arm64" >&6; } + +else $as_nop + + # Don't add architecture/min-version flags if debug enabled + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none" >&5 +printf "%s\n" "none" >&6; } + +fi + ;; #( + *) : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none" >&5 +printf "%s\n" "none" >&6; } ;; #( *) : ;;