How to run autoconf in OSX linking to specified OS SDK

Posted by kroko on Stack Overflow See other posts from Stack Overflow or by kroko
Published on 2010-04-25T22:12:21Z Indexed on 2010/04/25 22:43 UTC
Read the original article Hit count: 463

Filed under:
|
|

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.

© Stack Overflow or respective owner

Related posts about autoconf

Related posts about osx