Commit 734e03fdcf375d93db48947a2150b3b9cf5022c8

Authored by Jürgen Knödlseder
1 parent 07659949

Export MACOSX_DEPLOYMENT_TARGET only if --enable-universalsdk option is selected.

The export of MACOSX_DEPLOYMENT_TARGET led to some problems when trying to compile GammaLib on Mac OS X using the MacPorts gcc 4.4 compiler. The problems were uncatched exceptions that occured in some of the unit tests. After some debugging I discovered (by chance) that commenting the export of MACOSX_DEPLOYMENT_TARGET solved the problem.

Going into the Apple documentation (http://developer.apple.com/library/mac/#technotes/tn2064/_index.html) it appears that weak linking could be the root cause of the problems. With the current configuration on the Mac OS X 10.6 system on which the tests were done, MACOSX_DEPLOYMENT_TARGET=10.4. Following Apple's documentation, weak linking is implement from Mac OS X 10.2 on. Not specifying MACOSX_DEPLOYMENT_TARGET will automatically set the version to 10.1, hence no weak linking will be used.

Although I'm not 100% sure that weak linking indeed was the issue, removing the export of MACOSX_DEPLOYMENT_TARGET also removed the problems. I thus moved the export of MACOSX_DEPLOYMENT_TARGET into the --enable-universalsdk block, i.e. the export will only be done of the --enable-universalsdk option is selected. It remains to be seen whether this is the wanted behaviour.
Showing 1 changed file with 9 additions and 8 deletions
configure.ac
@@ -387,16 +387,17 @@ yes) @@ -387,16 +387,17 @@ yes)
387 ;; 387 ;;
388 esac 388 esac
389 389
390 - # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the  
391 - # environment with a value that is the same as what we'll use  
392 - # in the Makefile to ensure that we'll get the same compiler  
393 - # environment during configure and build time.  
394 - MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"  
395 - export MACOSX_DEPLOYMENT_TARGET  
396 - EXPORT_MACOSX_DEPLOYMENT_TARGET=''  
397 -  
398 # Set compile, link and pre-processor flags dependent on architecture 390 # Set compile, link and pre-processor flags dependent on architecture
399 if test "${enable_universalsdk}"; then 391 if test "${enable_universalsdk}"; then
  392 +
  393 + # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the
  394 + # environment with a value that is the same as what we'll use
  395 + # in the Makefile to ensure that we'll get the same compiler
  396 + # environment during configure and build time.
  397 + MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
  398 + export MACOSX_DEPLOYMENT_TARGET
  399 + EXPORT_MACOSX_DEPLOYMENT_TARGET=''
  400 +
400 UNIVERSAL_ARCH_FLAGS="" 401 UNIVERSAL_ARCH_FLAGS=""
401 if test "$UNIVERSAL_ARCHS" = "32-bit" ; then 402 if test "$UNIVERSAL_ARCHS" = "32-bit" ; then
402 UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386" 403 UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"