-#!/bin/bash
+#!/usr/bin/env bash
#
source "$(dirname "$0")/get-script-header.sh"
ANTLR_HOME_DIR=antlr-3.4
# Use an absolute path for the installation directory to avoid spurious libtool
# warnings about the ANTLR library having moved
-PREFIX=$(python -c "import os; print(os.path.realpath('$(pwd)/../..'))")
+PREFIX=$($PYTHON -c "import os; print(os.path.realpath('$(pwd)/../..'))")
# Make antlr3debughandlers.c empty to avoid unreferenced symbols
rm -rf src/antlr3debughandlers.c && touch src/antlr3debughandlers.c
-#!/bin/bash
+#!/usr/bin/env bash
#
-set -e
+set -e -o pipefail
cd "$(dirname "$0")/.."
exit 1
fi
}
+
+for cmd in python python2 python3; do
+ if [ -x "$(command -v $cmd)" ]; then
+ PYTHON="$cmd"
+ break
+ fi
+done
+
+if [ -z "$PYTHON" ]; then
+ echo "Error: Couldn't find python, python2, or python3." >&2
+ exit 1
+fi