From 559305882501d969884130c8cc8264aa70140595 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Wed, 31 Jul 2013 07:17:45 +0000 Subject: If you use --enable-osx-deploy-target or --disable-osx-deploy-target on anything other than OS X, fail; whatever it is you're trying to do won't work (unless and until there exists a platform that fully supports cross-development for OS X, *including* building against SDKs and building with -mmacosx-version-min). If you use neither on OS X, default to the OS major version on which you're building. If you use --disable-osx-deploy-target, don't build against an SDK and don't use -mmacosx-version-min. svn path=/trunk/; revision=51057 --- configure.ac | 247 +++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 147 insertions(+), 100 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index d06814da2c..a82c0c4424 100644 --- a/configure.ac +++ b/configure.ac @@ -259,130 +259,177 @@ AM_CONDITIONAL(HAVE_DOXYGEN, test x$HAVE_DOXYGEN = xyes) # PKG_PROG_PKG_CONFIG -# -# Let the user specify an OS X release to use as a deplayment target; -# if they specify that we should have a deployment target but don't -# specify the deployment target, pick the OS version on which the build -# is being done. This also causes the build to be done against an SDK -# rather than against the headers and libraries in /usr/include and /usr/lib. -# -# 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*) +AC_ARG_ENABLE(osx-deploy-target, + AC_HELP_STRING( [--enable-osx-deploy-target], + [choose an OS X deployment target @<:@default=major release on which you're building@:>@]), +[ # - # 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.) + # Is this OS X? # - [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@:>@]), - [ + case "$host_os" in + darwin*) + # + # Yes. + # + # Let the user specify an OS X release to use as a + # deplayment target; if they specify that we should + # have a deployment target but don't specify the + # deployment target, pick the OS version on which the + # build is being done. This also causes the build to + # be done against an SDK rather than against the headers + # and libraries in /usr/include and /usr/lib. + # + # 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. + # if test $enableval = no then + # + # The user explicitly said + # --disable-osx-deploy-target, so don't build + # against an SDK. + # deploy_target= elif test $enableval = yes then - deploy_target=$os_version + # + # The user said --enable-osx-deploy-target, but + # didn't say what version to target; target the + # major version number of the version of OS X on + # which we're running. + # + # (We quote the command so that we can use + # autoconf's M4 quoting characters, [ and ], in + # the sed expression.) + # + [deploy_target=`sw_vers -productVersion | sed 's/\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.[0-9]*/\1.\2/'`] 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]) - ;; + *) + # + # No. Fail, because whatever the user intended for us to + # do, we can't do it. + # + AC_MSG_ERROR([--enable-osx-deploy-target specified on an OS other than OS X]) + ;; + esac +],[ + # + # Is this OS X? + # + case "$host_os" in + darwin*) + # + # Yes. + # + # Default to targeting the major version number of + # the version of OS X on which we're running. + # + # (We quote the command so that we can use autoconf's + # M4 quoting characters, [ and ], in the sed expression.) + # + [deploy_target=`sw_vers -productVersion | sed 's/\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.[0-9]*/\1.\2/'`] + ;; - 10.3) - # - # XXX - never tested. - # - SDKPATH="/Developer/SDKs/MacOSX10.3.9.sdk" - ;; + *) + # + # No. There's nothing to do. + # + ;; + esac +]) - *) - # - # 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 +if test ! -z "$deploy_target" +then + AC_MSG_CHECKING([whether we can build for OS X $deploy_target]) + case $deploy_target in + 10.0|10.1|10.2) # - # 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. + # I'm not sure this would even work. # - CFLAGS="-mmacosx-version-min=$deploy_target -isysroot $SDKPATH $CFLAGS" - CXXFLAGS="-mmacosx-version-min=$deploy_target -isysroot $SDKPATH $CXXFLAGS" - LDFLAGS="-mmacosx-version-min=$deploy_target -isysroot $SDKPATH $LDFLAGS" + AC_MSG_RESULT(no) + AC_ERROR([We don't support building for OS X $deploy_target]) + ;; + 10.3) # - # Add a -sdkroot flag to use with osx-app.sh. + # XXX - never tested. # - OSX_APP_FLAGS="-sdkroot $SDKPATH" + AC_MSG_RESULT(yes) + SDKPATH="/Developer/SDKs/MacOSX10.3.9.sdk" + ;; + *) # - # XXX - do we need this to build the Wireshark wrapper? - # XXX - is this still necessary with the -mmacosx-version-min - # flag being set? + # 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. # - OSX_DEPLOY_TARGET="MACOSX_DEPLOYMENT_TARGET=$deploy_target" + 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_RESULT(no) + AC_MSG_ERROR([We couldn't find the SDK for OS X $deploy_target]) + fi + AC_MSG_RESULT(yes) + ;; + esac - case $deploy_target in + # + # 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" + CXXFLAGS="-mmacosx-version-min=$deploy_target -isysroot $SDKPATH $CXXFLAGS" + LDFLAGS="-mmacosx-version-min=$deploy_target -isysroot $SDKPATH $LDFLAGS" - 10.4|10.5) - # - # Only 32-bit builds are supported. 10.5 - # (and 10.4?) had a bug that causes some BPF - # functions not to work with 64-bit userland - # code, so capturing won't work. - # - CFLAGS="-arch i386 $CFLAGS" - CXXFLAGS="-arch i386 $CXXFLAGS" - LDFLAGS="-arch i386 $LDFLAGS" - ;; - esac - fi -esac + # + # 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" + + case $deploy_target in + + 10.4|10.5) + # + # Only 32-bit builds are supported. 10.5 + # (and 10.4?) had a bug that causes some BPF + # functions not to work with 64-bit userland + # code, so capturing won't work. + # + CFLAGS="-arch i386 $CFLAGS" + CXXFLAGS="-arch i386 $CXXFLAGS" + LDFLAGS="-arch i386 $LDFLAGS" + ;; + esac +fi # # Try to arrange for large file support. -- cgit v1.2.3