[PATCH] Fixing configure script and removing LOTS of GCC warnings on HP-UX

"Gavrichenkov, Artyom" <[email protected]> Tue, 11 Nov 2008 20:03:46 +0000
Newsgroups gmane.comp.gnu.screen
Message-ID <233101CD2D78D64E8C6691E90030E5C81B6F01FC27__4353.39447944916$1238089135$gmane$org@GVW1120EXC.americas.hpqcorp.net>
Hi all,

While compiling GNU Screen sources on HP-UX operating system I faced two is=
sues:
- configure script failed to locate termcap shared libraries;
- GCC produced a batch of warnings about "incompatible implicit declaration=
" of strlen and (less frequent) strcpy functions.

It's interesting for me that all these warnings seem to be intended -- ther=
e's even special #ifdef to generate them, but for what reason? Maybe the an=
swer is changes in HP-UX system headers since "os.h" header has been writte=
n, but I don't know exactly.

I'm providing a fix for all this. The following patch is tested on HP-UX on=
 both IA64 (OS v11.23) and PA-RISC (OS v11.11) architectures with GNU Scree=
n 4.0.3 and works good.

Artyom Gavrichenkov | Engineer, HP Global Delivery Russia Center | Mailto: =
[email protected] | Tel. No: +7 916 515 4958

---
diff -Nurp screen-4.0.3/configure screen-4.0.3.hpux/configure
--- screen-4.0.3/configure      2003-12-05 16:46:53.000000000 +0300
+++ screen-4.0.3.hpux/configure 2008-11-11 22:16:48.000000000 +0300
@@ -4789,6 +4789,9 @@ else
 sed 's/^/| /' conftest.$ac_ext >&5

 LIBS=3D"-ltermcap $olibs"
+if [ `uname` =3D "HP-UX" ]; then
+  LIBS=3D"-L/usr/local/lib/hpux32 "$LIBS
+fi
 { echo "$as_me:$LINENO: checking libtermcap..." >&5
 echo "$as_me: checking libtermcap..." >&6;}
 cat >conftest.$ac_ext <<_ACEOF
@@ -7945,6 +7948,9 @@ if test -z "$old_CFLAGS"; then
   fi
 fi
 test -n "$seqptx" && LIBS=3D"-ltermcap -lc -lsocket -linet -lnsl -lsec -ls=
eq"
+if [ `uname` =3D "HP-UX" ]; then
+  LIBS=3D"-L/usr/local/lib/hpux32 "$LIBS
+fi

 if test "$cross_compiling" =3D yes; then
   { { echo "$as_me:$LINENO: error: cannot run test program while cross com=
piling
diff -Nurp screen-4.0.3/os.h screen-4.0.3.hpux/os.h
--- screen-4.0.3/os.h   2002-01-08 18:42:33.000000000 +0300
+++ screen-4.0.3.hpux/os.h      2008-11-11 22:18:00.000000000 +0300
@@ -83,7 +83,7 @@ extern int errno;
 #  define strlen ___strlen___
 #  include <string.h>
 #  undef strlen
-#  if !defined(NEWSOS) && !defined(__hpux)
+#  if !defined(NEWSOS)
     extern size_t strlen(const char *);
 #  endif
 # else /* SVR4 */