aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2016-10-19 14:36:32 +0200
committerDaniel Stenberg <daniel@haxx.se>2016-10-20 10:17:04 +0200
commit4f8d0b6f02aa7043656bd354e7d55d2bbed0b5e3 (patch)
treeadd48626e8f79de3ab29021ebfda567c2bdb0b29
parent5c3d8d20a6cf21daef2c265daa840afde9d7de3f (diff)
configure: set min version flags for builds on mac
This helps building binaries that can work on multiple macOS versions. Help-by: Martin Storsjö Fixes #1069
-rw-r--r--acinclude.m439
-rw-r--r--configure.ac2
2 files changed, 40 insertions, 1 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index 312efcb47..ea97400b4 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -5,7 +5,7 @@
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
-# Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+# Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
@@ -3199,3 +3199,40 @@ TEST EINVAL TEST
CPPPFLAG=""
fi
])
+
+
+dnl CURL_MAC_CFLAGS
+dnl
+dnl Check if -mmacosx-version-min or -miphoneos-version-min are set manually,
+dnl otherwise do. And set -Werror=partial-availability.
+dnl
+
+AC_DEFUN([CURL_MAC_CFLAGS], [
+
+ tst_cflags="no"
+ case $host_os in
+ darwin*)
+ tst_cflags="yes"
+ ;;
+ esac
+
+ AC_MSG_CHECKING([for good-to-use Mac CFLAGS])
+ AC_MSG_RESULT([$tst_cflags]);
+
+ if test "$tst_cflags" = "yes"; then
+ AC_MSG_CHECKING([for *version-min in CFLAGS])
+ min=""
+ if test -z "$(echo $CFLAGS | grep mmacosx-version-min)" -a
+ test -z "$(echo $CFLAGS | grep miphoneos-version-min)"; then
+ min="-mmacosx-version-min=10.5"
+ CFLAGS="$CFLAGS $min"
+ fi
+ if test -z "$min"; then
+ AC_MSG_RESULT([set by user])
+ else
+ AC_MSG_RESULT([$min set])
+ fi
+ CFLAGS="$CFLAGS -Werror=partial-availability"
+ fi
+
+])
diff --git a/configure.ac b/configure.ac
index 0626b3810..83cfbff9a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -357,6 +357,8 @@ case X-"$curl_cv_native_windows" in
esac
CURL_CHECK_WIN32_LARGEFILE
+CURL_MAC_CFLAGS
+
dnl ************************************************************
dnl switch off particular protocols
dnl