1
  
2
  
3
  
4
  
5
  
6
  
7
  
8
  
9
  
10
  
11
  
12
  
13
  
14
  
15
  
16
  
17
  
18
  
19
  
20
  
21
  
22
  
23
  
24
  
25
  
26
  
27
  
28
  
29
  
30
  
31
  
32
  
33
  
34
  
35
  
36
  
37
  
38
  
39
  
40
  
41
  
42
  
43
  
44
  
45
  
46
  
47
  
48
  
49
  
50
  
51
  
52
  
53
  
54
  
55
  
56
  
57
  
58
  
59
  
60
  
61
  
62
  
63
  
64
  
65
  
66
  
67
  
68
  
69
  
70
  
71
  
72
  
73
  
74
  
75
  
76
  
77
  
78
  
79
  
80
  
81
  
82
  
83
  
84
  
85
  
86
  
87
  
88
  
89
  
90
  
91
  
92
  
93
  
94
  
95
  
96
  
97
  
98
  
99
  
100
  
101
  
102
  
103
  
104
  
105
  
106
  
107
  
108
  
109
  
110
  
111
  
112
  
113
  
114
  
115
  
116
  
117
  
118
  
119
  
120
  
121
  
122
  
123
  
124
  
125
  
126
  
127
  
128
  
129
  
130
  
131
  
132
  
133
  
134
  
135
  
136
  
137
  
138
  
139
  
140
  
141
  
142
  
143
  
144
  
145
  
146
  
147
  
148
  
149
  
150
  
151
  
152
  
153
  
154
  
155
  
156
  
157
  
158
  
159
  
160
  
161
  
162
  
163
  
164
  
165
  
166
  
167
  
168
  
169
  
170
  
171
  
172
  
173
  
174
  
175
  
176
  
177
  
#!/bin/sh 
 
#set -x 
if [ x"$1" = x--cache ]; then 
  shift 1 
fi 
 
exec 5>&1 1>&2 
 
TMP_BUILDDIR="@BUILDDIR@" 
TMP_BINDIR="@BINDIR@" 
LIBDIR_SRC="@LIBDIR@" 
SRCDIR="@srcdir@" 
 
export TMP_BUILDDIR 
export LIBDIR_SRC 
export TMP_BUILDDIR 
export SRCDIR 
 
# NB: /usr/bin/id on Solaris doesn't support -u. 
for ID in /usr/xpg4/bin/id /usr/bin/id /bin/id id; do 
    if [ -x "$ID" ]; then 
        if "$ID" -u >/dev/null 2>&1; then 
            break; 
        fi 
    fi 
done 
export ID 
 
TMP_OUT="${TMPDIR-/tmp}/precompile-`$ID -u 2>/dev/null`-$$.out" 
export TMP_OUT 
 
# Attempt to avoid leaving droppings on user abort. 
signal_exit() 
{ 
    echo "Aborted by signal." >&2 
    rm -f "${TMP_OUT}" 
    exit 1 
} 
# HUP, INT, TERM 
trap signal_exit 1 2 15 
 
retries=. 
 
if test "@CROSS@" = "yes"; then 
  method="QQQQQ" 
  retries="....." 
else :; fi 
 
OLD_RUNPIKE="$RUNPIKE" 
 
SCRIPT="$1" 
shift 1 
 
case "$SCRIPT" in 
  /*|./*) 
    if test -f "$SCRIPT"; then :; else 
      echo "Script $SCRIPT not found." 
      exit 1 
    fi 
  ;; 
  *) 
    if test -f ./$SCRIPT ; then 
      : 
    elif test -f "$TMP_BINDIR/$SCRIPT"; then 
      SCRIPT="$TMP_BINDIR/$SCRIPT" 
    else 
      echo "Script $SCRIPT neither found in the current directory nor in $TMP_BINDIR." 
      exit 1 
    fi 
  ;; 
esac 
 
while test "$retries" != .............. ; do 
 
RUNPIKE= 
case $method in 
  Q) 
    RUNPIKE="$TMP_BUILDDIR/pike -DNOT_INSTALLED -DPRECOMPILED_SEARCH_MORE -m$TMP_BUILDDIR/master.pike $PIKEOPTS" 
  ;; 
  QQ) 
    RUNPIKE="$TMP_BUILDDIR/tpike -DNOT_INSTALLED -DPRECOMPILED_SEARCH_MORE -m$TMP_BUILDDIR/master.pike $PIKEOPTS" 
  ;; 
  QQQ) 
    RUNPIKE=$TMP_BUILDDIR/test-pike 
  ;; 
  QQQQ) 
    if test x"$OLD_RUNPIKE" != x; then 
      LAST_PIKE="$OLD_RUNPIKE" 
      method=QQQQQ 
      RUNPIKE="$OLD_RUNPIKE" 
    else 
      RUNPIKE="" 
    fi 
  ;; 
  QQQQQ) 
    LAST_PIKE=pike 
    method=QQQQQQ 
    RUNPIKE="$LAST_PIKE" 
  ;; 
  QQQQQQ) 
    RUNPIKE="$LAST_PIKE" 
    LAST_PIKE=pike 
  ;; 
  QQQQQQQ) 
   if [ "x$UNIQPATH" = "x" ] ; then 
    UNIQPATH="" 
    ifs_save="${IFS-  }" 
    IFS=" @PATH_SEPARATOR@" 
    for dir in $PATH; do 
     if echo "@PATH_SEPARATOR@$UNIQPATH@PATH_SEPARATOR@" | \ 
        grep "@PATH_SEPARATOR@$dir@PATH_SEPARATOR@" >/dev/null; then :; else 
       if [ ":$UNIQPATH:" = "::" ]; then 
         UNIQPATH="$dir" 
       else 
         UNIQPATH="$UNIQPATH@PATH_SEPARATOR@$dir" 
       fi 
     fi 
     done 
   fi 
    for p in pike80 pike pike79 pike78 pike77 pike76 pike7 
    do 
      for dir in $UNIQPATH 
      do 
        if [ -x $dir/$p ]; then 
          if [ "x$LAST_PIKE" = xpike ] ; then 
            LAST_PIKE=$dir/$p 
            RUNPIKE="$dir/$p" 
            break 
          fi 
 
          if [ "x$LAST_PIKE" = "x$dir/$p" ]; then 
            LAST_PIKE=pike 
          fi 
        fi 
      done 
      if [ "x$RUNPIKE" != x ]; then 
        # We found a binary, so retry this method on failure. 
      method=QQQQQQ 
        break 
      fi 
    done 
    IFS="${ifs_save}" 
  ;; 
  QQQQQQQQ) 
    method= 
  ;; 
esac 
 
 
 
if test "x${RUNPIKE-}" != x ; then 
  echo "precompile: $RUNPIKE $SCRIPT $@ (method=$method)" 
 
# Do not output directly, if this generates data but the command 
# fails we have an issue. So, first output to a temporary file. 
 
  $RUNPIKE $SCRIPT "$@" >${TMP_OUT} 
 
  if [ $? = 0 ]; then 
    cat ${TMP_OUT} >&5 
    rm -f ${TMP_OUT} 
    exit 0 
  fi 
  rm -f ${TMP_OUT} 
fi 
 
method="Q$method" 
retries=".$retries" 
 
done # retry 
# Total failure 
 
echo "Failed to find a Pike executable that could run $SCRIPT." 
 
exit 1