+# Get source version from configure script
+eval "$(grep '^PACKAGE_VERSION=' ./configure)"
+PACKAGE_VERSION=${PACKAGE_VERSION//\-pre*/}
+
+# Enable dev mode by default for BT 2.0 builds
+export BABELTRACE_DEBUG_MODE=1
+export BABELTRACE_DEV_MODE=1
+export BABELTRACE_MINIMAL_LOG_LEVEL=TRACE
+
+# Set configure options and environment variables for each build
+# configuration.
+CONF_OPTS=("--prefix=$PREFIX")
+case "$conf" in
+static)
+ echo "Static lib only configuration"
+
+ CONF_OPTS+=("--enable-static" "--disable-shared")
+
+ if vergte "$PACKAGE_VERSION" "2.0"; then
+ CONF_OPTS+=("--enable-built-in-plugins")
+ fi
+ ;;
+
+python-bindings)
+ echo "Python bindings configuration"
+
+ CONF_OPTS+=("--enable-python-bindings")
+
+ if vergte "$PACKAGE_VERSION" "2.0"; then
+ CONF_OPTS+=("--enable-python-bindings-doc" "--enable-python-plugins")
+ fi
+ ;;
+
+prod)
+ echo "Production configuration"
+
+ # Unset the developper variables
+ unset BABELTRACE_DEBUG_MODE
+ unset BABELTRACE_DEV_MODE
+ unset BABELTRACE_MINIMAL_LOG_LEVEL
+
+ # Enable the python bindings
+ CONF_OPTS+=("--enable-python-bindings" "--enable-python-bindings-doc" "--enable-python-plugins")
+ ;;
+
+min)
+ echo "Minimal configuration"
+ ;;
+
+*)
+ echo "Standard configuration"
+
+ # Enable the python bindings / plugins by default with babeltrace2,
+ # the test suite is mostly useless without it.
+ if vergte "$PACKAGE_VERSION" "2.0"; then
+ CONF_OPTS+=("--enable-python-bindings" "--enable-python-plugins")
+ fi
+ ;;
+esac