3 # It is used to compile on remote hosts
9 # Where to install the stuff into (REMOTE_PREFIX gets fixed by the makefile)
11 if echo $PREFIX | egrep '^/' > /dev/null ; then
12 echo "Prefix is an absolute path. Good, it makes configure happy"
14 echo "Change prefix to an absolute path to keep configure happy"
15 PREFIX="$HOME/$PREFIX"
17 echo "(PREFIX=$PREFIX)"
19 # Where extra libraries are installed (if any)
20 LD_LIBRARY_PATH="$PREFIX/lib"
22 # Extra environment to pass to configure
25 # Argument of configure
26 CONFIGURE_ARGS="--prefix=$PREFIX/@PACKAGE@"
36 # Magic to search a working shell (from autobook)
38 # Zsh is not Bourne compatible without the following:
39 if test -n "$ZSH_VERSION"; then
44 # Bash is not POSIX compliant without the following:
45 test -n "$BASH_VERSION" && set -o posix
47 SHELL="${SHELL-/bin/sh}"
48 if test x"$1" = x--re-executed; then
49 # Functional shell was found. Remove option and continue
51 elif "$SHELL" -c 'foo () { exit 0; }; foo' 2>/dev/null &&
52 "$SHELL" -c 'export toto=tutu' 2>/dev/null ; then
53 # The current shell works already!
54 echo "Current shell ($SHELL) working"
56 # Try alternative shells that (sometimes) support functions
57 for cmd in bash sh ash bsh ksh zsh sh5
59 for dir in `echo $PATH | sed -e 's/:/ /g'` /bin /usr/bin
62 if (test -f "$shell" || test -f "$shell.exe") &&
63 "$shell" -c 'foo () { exit 0; }; foo' 2>/dev/null &&
64 "$shell" -c 'export toto=tutu' 2>/dev/null
66 # Re-execute with discovered functional shell
67 echo "Reexecute $0 $@ with shell $shell"
68 SHELL="$shell" exec "$shell" "$0" --re-executed ${1+"$@"}
72 echo "Unable to locate a shell interpreter with function support and export syntax" >&2
81 if [ "x$CC" = x ] ; then
82 echo "CC not set. Search for xlC"
84 if [ "x$xlC" != x ] ; then
85 echo "Found (in $xlC)"
86 CONFIGURE_ARGS="$CONFIGURE_ARGS CC=xlC"
88 echo "Not found. Stick to the defaults"
92 # expend the path for solaris
93 PATH="$PATH:/usr/xpg4/bin"
98 echo CONFIG-LOG-DUMP-BEGIN
100 echo CONFIG-LOG-DUMP-END
107 cd $PREFIX/src || fail "Cannot cd to $PREFIX/src"
111 eval `echo $1` 2>&1 || fail "$2"
115 if echo $@ | grep clean >/dev/null ; then
116 for name in @PACKAGE@* ; do
117 if test "$name" != "@PACKAGE@-@VERSION@.tar.gz" ; then
118 echo "XXX Remove $name";
123 echo "XXX Untar @PACKAGE@-@VERSION@"
124 do_cmd "gunzip @PACKAGE@-@VERSION@.tar.gz" "Cannot gunzip"
125 do_cmd "tar xf @PACKAGE@-@VERSION@.tar" "Cannot untar"
128 if echo $@ | grep touch >/dev/null ; then
129 echo "XXX Touch everything within the tarball"
130 find @PACKAGE@-@VERSION@ -type f | while read f; do touch $f;done
133 cd @PACKAGE@-@VERSION@ || fail "Cannot cd to @PACKAGE@-@VERSION@"
135 if echo $@ | grep config >/dev/null ; then
136 do_cmd "env $CONFIGURE_ENV \
137 ./configure $CONFIGURE_ARGS" "Cannot configure"
140 if echo $@ | grep compile >/dev/null ; then
141 do_cmd "make $MAKE_ALL" "Cannot make"
144 if echo $@ | grep install >/dev/null ; then
145 do_cmd "make $MAKE_INSTALL" "Cannot make install"
148 if echo $@ | grep check >/dev/null ; then
149 do_cmd "make $MAKE_CHECK 2>&1" || fail "Cannot make check"
152 echo Remote compilation sucessful.
155 echo CONFIG-LOG-DUMP-BEGIN
157 echo CONFIG-LOG-DUMP-END
160 echo Remote compilation sucessful.