Hello!
I have written a small command line tool that includes some GPL code. Everything runs smothly. Using os 10.6.
The external code used has a config.h header file, made by calling autoconf. I'd like to deploy the tool to different OS versions. Thus config.h could look like
// config.h
#if MAC_OS_X_VERSION_MAX_ALLOWED == MAC_OS_X_VERSION_10_4
// autoconf created config.h content for 10.4 comes here
#elif MAC_OS_X_VERSION_MAX_ALLOWED == MAC_OS_X_VERSION_10_5
// autoconf created config.h content for 10.5 comes here
#elif MAC_OS_X_VERSION_MAX_ALLOWED == MAC_OS_X_VERSION_10_6
// autoconf created config.h content for 10.6 comes here
#else
#error "muahahaha"
#endif
What is the way to tell autoconf to use /Developer/SDKs/MacOSX10.XXXX.sdk/usr/ while generating the config.h?
In order to test it I have run
#!/bin/bash
# for 10.6
export CC="/usr/bin/gcc-4.2"
export CXX="/usr/bin/g++-4.2"
export MACOSX_DEPLOYMENT_TARGET="10.6"
export OSX_SDK="/Developer/SDKs/MacOSX10.6.sdk"
export OSX_CFLAGS="-isysroot $OSX_SDK -arch x86_64 -arch i386"
export OSX_LDFLAGS="-Wl,-syslibroot,$OSX_SDK -arch x86_64 -arch i386"
export CFLAGS=$OSX_CFLAGS
export CXXFLAGS=$OSX_CFLAGS
export LDFLAGS=$OSX_LDFLAGS
before calling ./configure on OS 10.6. I know that the configure script looks for libintl.h, which is not in the "out of box 10.6 / SDK", but is present in the local machine under /usr/local The config.h header file produced with method described above has info that libintl.h is in the system- thus "linking" autoconf only to SDK has failed.
Is it happening because... "we don't have a crystal ball"? :). Or is it incorrect "setup"/flag-export before running autoconf, which I hope is the case? If so, then what would be the correct way to set up envvariables?
Many thanks in advance.
Edit. Looks like
#!/bin/bash
#set to gcc-4.0 for 10.4
export GCC_VERSION="gcc-4.2"
#set to g++-4.0 for 10.4
export GPLUSPLUS_VERSION="g++-4.2"
# MacOSX10.4u. MacOSX10.5, MacOSX10.6
export OSX_SDK="/Developer/SDKs/MacOSX10.6.sdk"
# 10.4, 10.6, 10.6
export MACOSX_DEPLOYMENT_TARGET="10.6"
export CC="$GCC_VERSION -isysroot $OSX_SDK -mmacosx-version-min=$MACOSX_DEPLOYMENT_TARGET"
export CCX="$GPLUSPLUS_VERSION -isysroot $OSX_SDK -mmacosx-version-min=$MACOSX_DEPLOYMENT_TARGET"
export CFLAGS="$CFLAGS -isysroot $OSX_SDK -mmacosx-version-min=$MACOSX_DEPLOYMENT_TARGET"
export CXXFLAGS="$CXXFLAGS -isysroot $OSX_SDK -mmacosx-version-min=$MACOSX_DEPLOYMENT_TARGET"
export LDFLAGS="$LDFLAGS -isysroot $OSX_SDK -mmacosx-version-min=$MACOSX_DEPLOYMENT_TARGET"
did the trick :) Thanks anyway.