+if [ -d "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs" ]; then
+ DEVELOPER_SDKS="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs"
+ XCODE_DEVELOPER="/Applications/Xcode.app/Contents/Developer"
+ MACOSX_DEPLOYMENT_TARGET="10.7" # Tiger support is default
+ SDKROOT="${DEVELOPER_SDKS}/MacOSX10.7.sdk" # Leopard build is default
+elif [ -d "/Developer/SDKs" ]; then
+ DEVELOPER_SDKS="/Developer/SDKs"
+ XCODE_DEVELOPER="/Developer"
+ MACOSX_DEPLOYMENT_TARGET="10.4" # Tiger support is default
+ SDKROOT="${DEVELOPER_SDKS}/MacOSX10.5.sdk" # Leopard build is default
+fi
+
+# detection of script home
+LyxSourceDir=$(dirname "$0")
+if [ ! -d "${LyxSourceDir}" ]; then
+ echo Missing LyX source directory.
+ exit 2
+fi
+case "${LyxSourceDir}" in
+/*/development)
+ LyxSourceDir=$(dirname "${LyxSourceDir}")
+ ;;
+/*)
+ ;;
+*/development|development)
+ LyxSourceDir=$(dirname "${LyxSourceDir}")
+ LyxSourceDir=$(cd "${LyxSourceDir}";pwd)
+ ;;
+*)
+ LyxSourceDir=$(cd "${LyxSourceDir}";pwd)
+ ;;
+esac