diff options
author | Guy Harris <guy@alum.mit.edu> | 2013-07-06 23:29:50 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2013-07-06 23:29:50 +0000 |
commit | a39004e4aa6457b43b5a39a8000e32def8beac9a (patch) | |
tree | 235fe228f6114e63c3063f2c4a2595851ff4138c /configure.ac | |
parent | 455f10f4c4d1012d9ccd5390630d0429fb9bfedf (diff) |
Check for an OS X deployment target early, so that as many
tests using the compiler are done using the flags that
we'll be using when building.
Add a -mmacosx-version-min flag to CFLAGS/CPPFLAGS/LDFLAGS so that the
compiler tests use them. This may, or may not, obviate the need to set
MACOSX_DEPLOYMENT_TARGET in OSX_DEPLOY_TARGET.
svn path=/trunk/; revision=50426
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 195 |
1 files changed, 105 insertions, 90 deletions
diff --git a/configure.ac b/configure.ac index cdbce88b80..c6d0fb1773 100644 --- a/configure.ac +++ b/configure.ac @@ -260,6 +260,111 @@ AM_CONDITIONAL(HAVE_DOXYGEN, test x$HAVE_DOXYGEN = xyes) PKG_PROG_PKG_CONFIG # +# Check for an OS X deployment target early, so that as many +# tests using the compiler are done using the flags that +# we'll be using when building. +# +case "$host_os" in +darwin*) + # + # Get the OS X major version number. + # (We quote the command so that we can use autoconf's M4 + # quoting characters, [ and ], in the sed expression.) + # + [os_version=`sw_vers -productVersion | sed 's/\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.[0-9]*/\1.\2/'`] + + AC_ARG_ENABLE(osx-deploy-target, + AC_HELP_STRING( [--enable-osx-deploy-target], + [choose an OS X deployment target @<:@default=none@:>@]), + [ + if test $enableval = no + then + deploy_target= + elif test $enableval = yes + then + deploy_target=$os_version + else + deploy_target="$enableval" + fi + ],[ + deploy_target= + ]) + AC_MSG_CHECKING([what deployment target to use]) + if test -z "$deploy_target" + then + AC_MSG_RESULT(none) + OSX_DEPLOY_TARGET= + else + AC_MSG_RESULT($deploy_target) + + case $deploy_target in + + 10.0|10.1|10.2) + # + # I'm not sure this would even work. + # + AC_ERROR([$deploy_target not supported as a deployment target]) + ;; + + 10.3) + # + # XXX - never tested. + # + SDKPATH="/Developer/SDKs/MacOSX10.3.9.sdk" + ;; + + *) + # + # XXX - for 10.4, do we need 10.4u? We're + # not currently doing fat builds (we'd need + # fat versions of the support libraries for + # that to be useful), but, if we do, we'd + # need to use 10.4u. + # + for i in /Developer/SDKs \ + /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \ + /Library/Developer/CommandLineTools/SDKs + do + if test -d "$i"/"MacOSX$deploy_target.sdk" + then + SDKPATH="$i"/"MacOSX$deploy_target.sdk" + break + fi + done + if test -z "$SDKPATH" + then + AC_MSG_ERROR([couldn't find the SDK for OS X $deploy_target]) + fi + ;; + esac + + # + # Add a -mmacosx-version-min flag to force tests that + # use the compiler, as well as the build itself, not to, + # for example, use compiler or linker features not supported + # by the minimum targeted version of the OS. + # + # Add an -isysroot flag to use the SDK. + # + CFLAGS="-mmacosx-version-min=$deploy_target -isysroot $SDKPATH $CFLAGS" + CPPFLAGS="-mmacosx-version-min=$deploy_target -isysroot $SDKPATH $CPPFLAGS" + LDFLAGS="-mmacosx-version-min=$deploy_target -isysroot $SDKPATH $LDFLAGS" + + # + # Add a -sdkroot flag to use with osx-app.sh. + # + OSX_APP_FLAGS="-sdkroot $SDKPATH" + + # + # XXX - do we need this to build the Wireshark wrapper? + # XXX - is this still necessary with the -mmacosx-version-min + # flag being set? + # + OSX_DEPLOY_TARGET="MACOSX_DEPLOYMENT_TARGET=$deploy_target" + fi +esac + +# # Try to arrange for large file support. # AC_SYS_LARGEFILE @@ -931,96 +1036,6 @@ darwin*) LIBS="$LIBS $COREFOUNDATION_FRAMEWORKS" AC_CHECK_FUNCS(CFPropertyListCreateWithStream) LIBS="$ac_save_LIBS" - - # - # Get the OS X major version number. - # (We quote the command so that we can use autoconf's M4 - # quoting characters, [ and ], in the sed expression.) - # - [os_version=`sw_vers -productVersion | sed 's/\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.[0-9]*/\1.\2/'`] - - AC_ARG_ENABLE(osx-deploy-target, - AC_HELP_STRING( [--enable-osx-deploy-target], - [choose an OS X deployment target @<:@default=none@:>@]), - [ - if test $enableval = no - then - deploy_target= - elif test $enableval = yes - then - deploy_target=$os_version - else - deploy_target="$enableval" - fi - ],[ - deploy_target= - ]) - AC_MSG_CHECKING([what deployment target to use]) - if test -z "$deploy_target" - then - AC_MSG_RESULT(none) - OSX_DEPLOY_TARGET= - else - AC_MSG_RESULT($deploy_target) - - case $deploy_target in - - 10.0|10.1|10.2) - # - # I'm not sure this would even work. - # - AC_ERROR([$deploy_target not supported as a deployment target]) - ;; - - 10.3) - # - # XXX - never tested. - # - SDKPATH="/Developer/SDKs/MacOSX10.3.9.sdk" - ;; - - *) - # - # XXX - for 10.4, do we need 10.4u? We're - # not currently doing fat builds (we'd need - # fat versions of the support libraries for - # that to be useful), but, if we do, we'd - # need to use 10.4u. - # - for i in /Developer/SDKs \ - /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \ - /Library/Developer/CommandLineTools/SDKs - do - if test -d "$i"/"MacOSX$deploy_target.sdk" - then - SDKPATH="$i"/"MacOSX$deploy_target.sdk" - break - fi - done - if test -z "$SDKPATH" - then - AC_MSG_ERROR([couldn't find the SDK for OS X $deploy_target]) - fi - ;; - esac - - # - # Add -isysroot flags to use the SDK. - # - CFLAGS="-isysroot $SDKPATH $CFLAGS" - CPPFLAGS="-isysroot $SDKPATH $CPPFLAGS" - LDFLAGS="-isysroot $SDKPATH $LDFLAGS" - - # - # Add a -sdkroot flag to use with osx-app.sh. - # - OSX_APP_FLAGS="-sdkroot $SDKPATH" - - # - # XXX - do we need this to build the Wireshark wrapper? - # - OSX_DEPLOY_TARGET="MACOSX_DEPLOYMENT_TARGET=$deploy_target" - fi ;; esac AC_SUBST(APPLICATIONSERVICES_FRAMEWORKS) |