This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Correct two subtle typos.
[perl5.git] / hints / qnx.sh
index 482c8ab..178f216 100644 (file)
@@ -9,7 +9,12 @@
 #  socket3r.lib Nov21 1996.
 # perl-5.7.3 fails 2 known tests under QNX6.1.0
 #
-# As with many unix ports, this one depends on a few "standard"
+# perl-5.10.0-tobe compiles with Watcom C 10.6
+#                and QNX 4.25 patch G w/TCPSDK installed
+#  Some tests still fail, mostly to do with dynamic/static
+#  or unsupported features in QNX.
+# 
+## As with many unix ports, this one depends on a few "standard"
 # unix utilities which are not necessarily standard for QNX4.
 #
 # /bin/sh  This is used heavily by Configure and then by
@@ -50,7 +55,7 @@
 #   they both point to the correct library, that is,
 #   /usr/tcptk/current/usr/lib/socket3r.lib.
 # 
-#   ext/Cwd/Cwd.t will complain if `pwd` and cwd don't give
+#   dist/Cwd/Cwd.t will complain if `pwd` and cwd don't give
 #   the same results. cwd calls `fullpath -t`, so if you
 #   cd `fullpath -t` before running the test, it will
 #   pass.
@@ -101,7 +106,7 @@ echo ""
 # making an unnecessary distinction between AT-qnx and PCI-qnx,
 # for example. I will use uname's architecture for Neutrino.
 #----------------------------------------------------------------
-set X `uname -a`
+set X `$run uname -a`
 shift
 [ "$1" != "QNX" ] && echo "uname doesn't look like QNX!"
 case $4 in
@@ -229,21 +234,74 @@ if [ "$osname" = "qnx" ]; then
          /usr/local/bin or some other suitable location.
        EOF
   fi
+
+  # includes a matherr() to silence noise from watcom libc
+  archobjs="qnx.o"
+  test -f qnx.c || cp qnx/qnx.c .
+
 else
   # $^O eq nto
 
-  ccflags='-DDLOPEN_WONT_DO_RELATIVE_PATHS'
+  ccflags="$ccflags -U__STRICT_ANSI__"
 
   # Options required to get dynamic linking to work
-  lddlflags='-shared'
-  ccdlflags='-Wl,-E'
+  lddlflags="$lddlflags -shared"
+  ccdlflags="$ccdlflags -Wl,-E"
 
-  # Somewhere in the build, something tries to throw a gcc
-  # option to $cc if it knows it invokes gcc. Our cc doesn't
-  # recognize that option, so we're better off setting cc=gcc.
-  cc='gcc'
+  case "$usecrosscompile" in
+  define)
+    # TODO this else should probably be an elif on $2 including
+    # "Blackberry" or similar
+    
+    # Configure detects these, but they won't link for some reason:
+    d_eaccess="$undef"
+    d_dirfd="$undef"
+    d_getspnam="$undef"
+    d_setlinebuf="$undef"
+    
+    # Default to USE_SHELL_ALWAYS -- like with Android, Blackberry's
+    # shell has several commands built-in, and this works around the
+    # issue.
+    d_useshellcmds='define'
+    
+    # By this point, targetarch will be:
+    # For x86 builds, 'ntox86' or 'i486-pc-nto-qnx8.0.0-gcc'
+    # For arm builds, 'ntoarmv7' 'arm-unknown-nto-qnx8.0.0eabi'
+    # This will change those to plain x86 and armle-v7, respectively.
+    case "`$run uname -m`" in
+        *x86*) targetarch=x86;;
+        *) targetarch=armle-v7;;
+    esac
+    
+    libc="$QNX_TARGET/$targetarch/lib/libc.so"
+    
+    ldflags="$ldflags -L${QNX_TARGET}/$targetarch/lib -L${QNX_TARGET}/$targetarch/usr/lib -L${QNX_TARGET}/$targetarch/lib/gcc/4.6.3"
+    
+    ldflags="$ldflags -lc -lm -lsocket"
+    lddlflags="$lddlflags -lc -lm -lsocket "    
+    libpth="$libpth /proc/boot"
+    targetenv="export LC_ALL=C; $targetenv"
+    ;;
+  *)
+    # Somewhere in the build, something tries to throw a gcc
+    # option to $cc if it knows it invokes gcc. Our cc doesn't
+    # recognize that option, so we're better off setting cc=gcc.
+    # Of course, only do this when not cross-compiling, for
+    # obvious reasons.
+    cc='gcc'
+    ;;
+  esac
+
+  # gcc uses $QNX_TARGET/usr/include as the include directory.
+  usrinc="$QNX_TARGET/usr/include"
 
   # If we use perl's malloc, it dies with an invalid sbrk.
   # This is probably worth tracking down someday.
   usemymalloc='false'
+  
+  libswanted=`echo " $libswanted "| sed 's/ malloc / /'`
+
+  # Some routines are only in our static libc.
+  # eg crypt() getlogin() getlogin_r()
+  usenm=false
 fi