xref: /openbsd/gnu/usr.bin/perl/hints/qnx.sh (revision 73471bf0)
1#----------------------------------------------------------------
2# QNX hints
3#
4# Most of the hints in this file are for QNX4, which needed
5# more help. The QNX6 hints are located toward the bottom.
6#
7# perl-5.7.3 passes all tests under QNX4.24G
8#  Watcom 10.6 with Beta/970211.wcc.update.tar.F
9#  socket3r.lib Nov21 1996.
10# perl-5.7.3 fails 2 known tests under QNX6.1.0
11#
12# perl-5.10.0-tobe compiles with Watcom C 10.6
13#                and QNX 4.25 patch G w/TCPSDK installed
14#  Some tests still fail, mostly to do with dynamic/static
15#  or unsupported features in QNX.
16#
17## As with many unix ports, this one depends on a few "standard"
18# unix utilities which are not necessarily standard for QNX4.
19#
20# /bin/sh  This is used heavily by Configure and then by
21#          perl itself. QNX4's version is fine, but Configure
22#          will choke on the 16-bit version, so if you are
23#          running QNX 4.22, link /bin/sh to /bin32/ksh
24# ar       This is the standard unix library builder.
25#          We use wlib. With Watcom 10.6, when wlib is
26#          linked as "ar", it behaves like ar and all is
27#          fine. Under 9.5, a cover is required. One is
28#          included in ../qnx
29# nm       This is used (optionally) by configure to list
30#          the contents of libraries. I will generate
31#          a cover function on the fly in the UU directory.
32# cpp      Configure and perl need a way to invoke a C
33#          preprocessor. I have created a simple cover
34#          for cc which does the right thing. Without this,
35#          Configure will create its own wrapper which works,
36#          but it doesn't handle some of the command line arguments
37#          that perl will throw at it.
38# make     You really need GNU make to compile this. GNU make
39#          ships by default with QNX 4.23, but you can get it
40#          from quics for earlier versions.
41#----------------------------------------------------------------
42# Outstanding Issues for QNX4:
43#   There is no support for dynamically linked libraries in
44#   QNX4.
45#
46#   If you wish to compile with the Socket extension, you need
47#   to have the TCP/IP toolkit, and you need to make sure that
48#   -lsocket locates the correct copy of socket3r.lib. Beware
49#   that the Watcom compiler ships with a stub version of
50#   socket3r.lib which has very little functionality. Also
51#   beware the order in which wlink searches directories for
52#   libraries. You may have /usr/lib/socket3r.lib pointing to
53#   the correct library, but wlink may pick up
54#   /usr/watcom/10.6/usr/lib/socket3r.lib instead. Make sure
55#   they both point to the correct library, that is,
56#   /usr/tcptk/current/usr/lib/socket3r.lib.
57#
58#   dist/Cwd/Cwd.t will complain if `pwd` and cwd don't give
59#   the same results. cwd calls `fullpath -t`, so if you
60#   cd `fullpath -t` before running the test, it will
61#   pass.
62#
63#   lib/File/Find/taint.t will complain if '.' is in your
64#   PATH. The PATH test is triggered because cwd calls
65#   `fullpath -t`.
66#
67#   ext/IO/lib/IO/t/io_sock.t: Subtest 14 is skipped due to
68#   the fact that the functionality to read back the non-blocking
69#   status of a socket is not implemented in QNX's TCP/IP. This
70#   has been reported to QNX and it may work with later versions
71#   of TCP/IP.
72#
73# Older issues:
74#   lib/posix.t test failed on test 17 because acos(1) != 0.
75#      Resolved in 970211 Beta
76#   lib/io_udp.t test hangs because of a bug in getsockname().
77#      Fixed in latest BETA socket3r.lib
78#----------------------------------------------------------------
79# Outstanding Issues for QNX6:
80#  The following tests are still failing as of 5.7.3:
81#
82#   op/sprintf.........................FAILED at test 91
83#   lib/Benchmark......................FAILED at test 26
84#
85# This is due to a bug in the C library's printf routine.
86# printf("'%e'", 0. ) produces '0.000000e+0', but ANSI requires
87# '0.000000e+00'. QNX has acknowledged the bug and it should be
88# fixed in 6.2.0.
89#
90#----------------------------------------------------------------
91# These hints were submitted by:
92#   Norton T. Allen
93#   Harvard University Atmospheric Research Project
94#   allen@huarp.harvard.edu
95#
96# If you have suggestions or changes, please let me know.
97#----------------------------------------------------------------
98
99echo ""
100echo "Some tests may fail. Please read the hints/qnx.sh file."
101echo ""
102
103#----------------------------------------------------------------
104# At present, all QNX4 systems are equivalent architectures,
105# so it is reasonable to call archname=x86-qnx rather than
106# making an unnecessary distinction between AT-qnx and PCI-qnx,
107# for example. I will use uname's architecture for Neutrino.
108#----------------------------------------------------------------
109set X `$run uname -a`
110shift
111[ "$1" != "QNX" ] && echo "uname doesn't look like QNX!"
112case $4 in
113  42[2-9]) archname='x86-qnx';;
114  *) osname='nto'
115	 osvers=$3
116     archname="$5-nto";;
117esac
118
119if [ "$osname" = "qnx" ]; then
120  #----------------------------------------------------------------
121  # QNX doesn't come with a csh and the ports of tcsh I've used
122  # don't work reliably:
123  #----------------------------------------------------------------
124  csh=''
125  d_csh='undef'
126  full_csh=''
127
128  #----------------------------------------------------------------
129  # setuid scripts are secure under QNX.
130  #  (Basically, the same race conditions apply, but assuming
131  #  the scripts are located in a secure directory, the methods
132  #  for exploiting the race condition are defeated because
133  #  the loader expands the script name fully before executing
134  #  the interpreter.)
135  #----------------------------------------------------------------
136  d_suidsafe='define'
137
138  #----------------------------------------------------------------
139  # difftime is implemented as a preprocessor macro, so it doesn't show
140  # up in the libraries:
141  #----------------------------------------------------------------
142  d_difftime='define'
143
144  #----------------------------------------------------------------
145  # strtod is in the math library, but we can't tell Configure
146  # about the math library or it will confuse the linker
147  #----------------------------------------------------------------
148  d_strtod='define'
149
150  lib_ext='3r.lib'
151  libc='/usr/lib/clib3r.lib'
152
153  #----------------------------------------------------------------
154  # ccflags:
155  # I like to turn the warnings up high, but a few common
156  # constructs make a lot of noise, so I turn those warnings off.
157  # A few still remain...
158  #
159  # unix.h is required as a general rule for unixy applications.
160  #----------------------------------------------------------------
161  ccflags='-mf -w4 -Wc,-wcd=202 -Wc,-wcd=203 -Wc,-wcd=302 -Wc,-fi=unix.h'
162
163  #----------------------------------------------------------------
164  # ldflags:
165  # If you want debugging information, you must specify -g on the
166  # link as well as the compile. If optimize != -g, you should
167  # remove this.
168  #----------------------------------------------------------------
169  ldflags="-g -N1M"
170
171  so='none'
172  selecttype='fd_set *'
173
174  #----------------------------------------------------------------
175  # Add -lunix to list of libs. This is needed mainly so the nm
176  # search will find funcs in the unix lib. Including unix.h should
177  # automatically include the library without -l.
178  #----------------------------------------------------------------
179  libswanted="$libswanted unix"
180
181  if [ -z "`which ar 2>/dev/null`" ]; then
182	cat <<-'EOF' >&4
183	  I don't see an 'ar', so I'm guessing you are running
184	  Watcom 9.5 or earlier. You may want to install the ar
185	  cover found in the qnx subdirectory of this distribution.
186	  It might reasonably be placed in /usr/local/bin.
187
188	EOF
189  fi
190  #----------------------------------------------------------------
191  # Here is a nm script which fixes up wlib's output to look
192  # something like nm's, at least enough so that Configure can
193  # use it.
194  #----------------------------------------------------------------
195  if [ -z "`which nm 2>/dev/null`" ]; then
196	cat <<-EOF
197	  Creating a quick-and-dirty nm cover for	Configure to use:
198
199	EOF
200	cat >./UU/nm <<-'EOF'
201	  #! /bin/sh
202	  #__USAGE
203	  #%C	<lib> [<lib> ...]
204	  #	Designed to mimic Unix's nm utility to list
205	  #	defined symbols in a library
206	  unset WLIB
207	  for i in $*; do wlib $i; done |
208		awk '
209		  /^  / {
210			for (i = 1; i <= NF; i++) {
211			  sub("_$", "", $i)
212			  print "000000  T " $i
213			}
214		  }'
215	EOF
216	chmod +x ./UU/nm
217  fi
218
219  cppstdin=`which cpp 2>/dev/null`
220  if [ -n "$cppstdin" ]; then
221	cat <<-EOF >&4
222	  I found a cpp at $cppstdin and will assume it is a good
223	  thing to use. If this proves to be false, there is a
224	  thin cover for cpp in the qnx subdirectory of this
225	  distribution which you could move into your path.
226	EOF
227	cpprun="$cppstdin"
228  else
229	cat <<-EOF >&4
230	
231	  There is a cpp cover in the qnx subdirectory of this
232	  distribution which works a little better than the
233	  Configure default. You may wish to copy it to
234	  /usr/local/bin or some other suitable location.
235	EOF
236  fi
237
238  # includes a matherr() to silence noise from watcom libc
239  archobjs="qnx.o"
240  test -f qnx.c || cp qnx/qnx.c .
241
242else
243  # $^O eq nto
244
245  ccflags="$ccflags -U__STRICT_ANSI__"
246
247  # Options required to get dynamic linking to work
248  lddlflags="$lddlflags -shared"
249  ccdlflags="$ccdlflags -Wl,-E"
250
251  case "$usecrosscompile" in
252  define)
253    # TODO this else should probably be an elif on $2 including
254    # "Blackberry" or similar
255
256    # Configure detects these, but they won't link for some reason:
257    d_eaccess="$undef"
258    d_dirfd="$undef"
259    d_getspnam="$undef"
260    d_setlinebuf="$undef"
261
262    # Default to USE_SHELL_ALWAYS -- like with Android, Blackberry's
263    # shell has several commands built-in, and this works around the
264    # issue.
265    d_useshellcmds='define'
266
267    # By this point, targetarch will be:
268    # For x86 builds, 'ntox86' or 'i486-pc-nto-qnx8.0.0-gcc'
269    # For arm builds, 'ntoarmv7' 'arm-unknown-nto-qnx8.0.0eabi'
270    # This will change those to plain x86 and armle-v7, respectively.
271    case "`$run uname -m`" in
272        *x86*) targetarch=x86;;
273        *) targetarch=armle-v7;;
274    esac
275
276    libc="$QNX_TARGET/$targetarch/lib/libc.so"
277
278    ldflags="$ldflags -L${QNX_TARGET}/$targetarch/lib -L${QNX_TARGET}/$targetarch/usr/lib -L${QNX_TARGET}/$targetarch/lib/gcc/4.6.3"
279
280    ldflags="$ldflags -lc -lm -lsocket"
281    lddlflags="$lddlflags -lc -lm -lsocket "
282    libpth="$libpth /proc/boot"
283    targetenv="export LC_ALL=C; $targetenv"
284    ;;
285  *)
286    # Somewhere in the build, something tries to throw a gcc
287    # option to $cc if it knows it invokes gcc. Our cc doesn't
288    # recognize that option, so we're better off setting cc=gcc.
289    # Of course, only do this when not cross-compiling, for
290    # obvious reasons.
291    cc='gcc'
292    ;;
293  esac
294
295  # gcc uses $QNX_TARGET/usr/include as the include directory.
296  usrinc="$QNX_TARGET/usr/include"
297
298  # If we use perl's malloc, it dies with an invalid sbrk.
299  # This is probably worth tracking down someday.
300  usemymalloc='false'
301
302  libswanted=`echo " $libswanted "| sed 's/ malloc / /'`
303
304  # Some routines are only in our static libc.
305  # eg crypt() getlogin() getlogin_r()
306  usenm=false
307fi
308