1#!/bin/sh
2#
3# Script used to create the button.swf file on Unix machines
4# Written by Alexis Wilke for Made to Order Software Corp. (c) 2002-2009
5#
6# Copyright (c) 2002-2009 Made to Order Software Corp.
7#
8# Permission is hereby granted, free of charge, to any
9# person obtaining a copy of this software and
10# associated documentation files (the "Software"), to
11# deal in the Software without restriction, including
12# without limitation the rights to use, copy, modify,
13# merge, publish, distribute, sublicense, and/or sell
14# copies of the Software, and to permit persons to whom
15# the Software is furnished to do so, subject to the
16# following conditions:
17#
18# The above copyright notice and this permission notice
19# shall be included in all copies or substantial
20# portions of the Software.
21#
22# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
23# ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
24# LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
25# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
26# EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
28# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
29# ARISING FROM, OUT OF OR IN CONNECTION WITH THE
30# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31# SOFTWARE.
32#
33set -e
34
35# Try to find the sswf binary
36#	AMake puts the result in a bin folder
37#	./configure leaves them in the source directory
38#	A binary installation puts them in some bin directory
39SSWF=
40for x in ../../bin/sswf ../../../bin/sswf ../../../../bin/sswf \
41		../../src/sswf/sswf \
42		`whereis sswf` /usr/bin/sswf /usr/local/bin/sswf
43do
44	# Note: if whereis returns a path with a space, this search is
45	#	totally broken!
46	if test -x $x -a ! -d $x
47	then
48		SSWF=$x
49		break
50	fi
51done
52if test "$SSWF" = ""
53then
54	# This is a default in case it was installed in some unconvential
55	# place it still will work (unconventional for even whereis to
56	# not find it that is...)
57	SSWF=sswf
58fi
59
60# Now try to locate our include files
61INC=
62for i in ../../include/sswf/scripts ../../../include/sswf/scripts \
63		../../../../include/sswf/scripts ../../scripts \
64		../../../share/sswf/scripts ../../../../share/sswf/scripts \
65		/usr/include/sswf/scripts /usr/share/sswf/scripts \
66		/usr/local/include/sswf/scripts /usr/local/share/sswf/scripts
67do
68	if test -d $i
69	then
70		INC=$i
71		break
72	fi
73done
74if test "$INC" = ""
75then
76	# This we can't do anything more...
77	echo "ERROR: can't locate the sswf/scripts include directory"
78	exit 1
79fi
80
81# Print info about what we just found
82echo "INFO: running sswf found here: \"$SSWF\"."
83echo "INFO: using the include scripts from: \"$INC\"."
84