Optimize automation-event process splitting
[ardour.git] / gtk2_ardour / ardour.sh.in
1 #!/bin/sh
2
3 #
4 # This script runs an installed version of Ardour. It sets a few environment variables
5 # and does a few checks before exec'ing the real executable.
6
7
8 export GTK_PATH=@CONFDIR@:@LIBDIR@${GTK_PATH:+:$GTK_PATH}
9
10 export LD_LIBRARY_PATH=@LIBDIR@${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
11
12 ## Memlock check
13
14 MLOCK_LIMIT=$(ulimit -l)
15 if [ "$MLOCK_LIMIT" != "unlimited" ]; then
16         echo "WARNING: Your system has a limit for maximum amount of locked memory!"
17         echo "         This might cause Ardour to run out of memory before your system runs"
18         echo "         out of memory. You can view the memory limit with 'ulimit -l', and it"
19         echo "         is normally controlled by /etc/security/limits.conf"
20         echo ""
21
22 fi
23
24 ## Glib atomic test
25
26 GLIB=$(ldd @LIBDIR@/ardour-@VERSION@ 2> /dev/null | grep glib-2.0 | sed 's/.*=> \([^ ]*\)/\1/;s/ .*//')
27
28 if ! type nm >/dev/null 2>&1 || [ "$GLIB" = "" ]; then
29         echo "WARNING: Could not check your glib-2.0 for mutex locking atomic operations."
30         echo ""
31 elif [ $(nm -D --radix=dec --defined-only -S $GLIB | grep -w g_atomic_int_add | cut -d ' ' -f 2) -gt 32 ]; then
32         echo "WARNING: Your system contains a suspect libglib-2.0. Your version might be built"
33         echo "         to use mutex locking atomic operations. This is a fallback solution to"
34         echo "         a more robust hardware supported atomicity. It might cause reduced "
35         echo "         performance and/or deadlocks. Please contact your distribution support"
36         echo "         about this issue."
37         echo "         Unfortunately this check is not 100% accurate, so this might not be"
38         echo "         the case with your system."
39         echo ""
40 fi
41
42 #
43 # Running Ardour requires these 3 variables to be set
44 #
45
46 export ARDOUR_DATA_PATH=@DATADIR@
47 export ARDOUR_CONFIG_PATH=@CONFDIR@
48 export ARDOUR_DLL_PATH=@LIBDIR@
49
50 #
51 # NSM needs a path to this script
52 #
53
54 export ARDOUR_SELF=$(basename "$0")
55
56 #
57 # VAMP has its own lookup path
58
59
60 export VAMP_PATH=@LIBDIR@/vamp${VAMP_PATH:+:$VAMP_PATH}
61
62 if [ $# -gt 0 ] ; then
63     case $1 in
64         -g|--gdb) GDB=gdb; shift ;;
65     esac
66 fi
67
68 exec $GDB @LIBDIR@/ardour-@VERSION@ "$@"