How to run autoconf on OSX binding for specified OS SDK

I wrote a small command line tool that contains some GPL code. Everything is breathing wildly. Using os 10.6.

The external code used has a config.h header file generated when autoconf is called. I would like to deploy a tool for different OS versions. So config.h might 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 / when creating config.h?
To test it, I ran

#!/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 the configure script is looking for libintl.h which is not in "out of the box 10.6 / SDK" but is present on the local machine in the / usr / local directory The config.h header file created with the method above contains information that libintl.h is on the system, so "autoconf" only failed in SDK failed.

This is because ... "we don't have a crystal ball"? :). Or is it an incorrect "setup" / flag -export before running autoconf, and I hope it is? If so, what would be the correct way to set up envvariables?
Thank you very much in advance.


Edit. Look 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.

+2


a source to share


1 answer


config.h is not generated by autoconf. It may be a typo in your question, or it may be a fundamental misunderstanding. config.h is generated by a shell script named config.status, which is written by a shell script named configure. The config script is what autoconf generates, and the resulting config.h will differ depending on what machine the config is running on, the environment it runs in, and the arguments passed to it.



If you have many parameters to pass in for customization, it is often convenient to provide values โ€‹โ€‹in the config.site file. You can either put config.site in $ prefix / share (for example / usr / local / share / config.site) or specify the path in the CONFIG_SITE environment variable. It is usually preferable to set this in environment settings.

+1


a source







All Articles