Skip to content

Instantly share code, notes, and snippets.

@dnozay
Last active October 20, 2021 03:17
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dnozay/a08d4ee903af37832174 to your computer and use it in GitHub Desktop.
Save dnozay/a08d4ee903af37832174 to your computer and use it in GitHub Desktop.
fix apxs on OSX10.9
#!/bin/bash
# apxs may fail with .../usr/bin/cc: not a directory
# solution: use your own apxs script.
# fix based on the configure.ac from mod_wsgi
# https://github.com/GrahamDumpleton/mod_wsgi
XCODE_PREFIX="/Applications/Xcode.app/Contents/Developer/Toolchains/"
XCODE_CC="${XCODE_PREFIX}XcodeDefault.xctoolchain/usr/bin/cc"
APXS=$(which apxs)
APXS_CC=`${APXS} -q CC`
APXS_LIBTOOL=`${APXS} -q LIBTOOL | sed -e "s/ .*$//"`
if [[ ${APXS_CC} = ${XCODE_PREFIX}* ]]; then
cat "${APXS_LIBTOOL}" | sed -e \
"s/OSX10.[89].xctoolchain/XcodeDefault.xctoolchain/" > ./libtool
cat "${APXS}" | sed -e "s%get_vars(\"CC\")%\"${XCODE_CC}\"%" \
-e 's%^my $libtool = .*;%my $libtool = \"./libtool\";%' > ./apxs
chmod +x ./apxs ./libtool
APXS=./apxs
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment