OSDN Git Service

2004-02-22 Zack Weinberg <zack@codesourcery.com>
[pf3gnuchains/gcc-fork.git] / libjava / libltdl / config.sub
1 #! /bin/sh
2
3 # Copyright (C) 2004 Free Software Foundation, Inc.
4 #
5 # This script is free software; the Free Software Foundation gives
6 # unlimited permission to copy, distribute and modify it.
7
8 # Invoke a shell script with the same name two directories up from this
9 # file.  Robust against all kinds of pathological file and directory
10 # names, as well as all kinds of pathological shells.
11 # By Nathanael Nerode, Zack Weinberg, and Alexandre Oliva.
12
13 # Insert "../../" just before the last slash in the pathname.
14 # We use a here-document to avoid problems with "echo" and
15 # pathnames containing backslashes or a leading dash.
16
17 script=`sed 's,[^/]*$,../../&,' << EOF
18 $0
19 EOF
20 `
21
22 # Must honor CONFIG_SHELL if set.
23 # Simple "$@" does the wrong thing for zero arguments with 
24 # OSF/1 4.0 /bin/sh, possibly others.
25 # ${1+"$@"} does the wrong thing with zsh (== /bin/sh in
26 # some iterations of Darwin).
27
28 case $# in
29    0) exec ${CONFIG_SHELL-/bin/sh} "$script" ;;
30    *) exec ${CONFIG_SHELL-/bin/sh} "$script" "$@" ;;
31 esac
32