Bug 76171 - HP-UX 11.x portability fixes
Summary: HP-UX 11.x portability fixes
Status: RESOLVED WORKSFORME
Alias: None
Product: configure
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Other
: NOR normal
Target Milestone: ---
Assignee: Stephan Kulow
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-02-26 09:47 UTC by The Written Word
Modified: 2006-01-28 03:30 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Patch (20.93 KB, patch)
2004-02-26 09:48 UTC, The Written Word
Details
Updated patch (20.12 KB, patch)
2004-03-08 01:48 UTC, The Written Word
Details
Updated comprehensive patch. (29.34 KB, patch)
2004-03-22 17:26 UTC, The Written Word
Details
kdecore/kpty.cpp (1.96 KB, patch)
2004-04-01 00:45 UTC, The Written Word
Details

Note You need to log in before you can comment on or make changes to this bug.
Description The Written Word 2004-02-26 09:47:57 UTC
Version:           3.2.0 (using KDE KDE 3.2.0)
Installed from:    Compiled From Sources
Compiler:          GCC 3.3.2 
OS:          HP/UX

1. [kio/proxytype.pl.in, kio/useragent.pl.in, configure.in]
   Don't assume perl is in /usr/bin.

2. [kio/kio/slaveinterface.h, kio/kio/observer.h,
   kio/misc/uiserver.h, kio/kpasswdserver/kpasswdserver.h]
   Forgot to include <qstringlist.h>

3. [kjs/operations.cpp]
   Fix for isinf() on HP-UX 11.x. isinf() isn't a function on HP-UX 11.x but a macro defined in <math.h>. Created a stub isinf() function in this case to make using it easier.

   Ignore <sunmath.h>. Won't do any good unless you have the Sun C++ compiler which doesn't build KDE anyway.

4. [dcop/dcopidl2cpp/Makefile.am]
   Don't assume a system has md5sum (maybe they have gmd5sum).

5. [kabc/Makefile.am]
   Why not honor $(datadir)?

6. [kdecore/klargefile.h]
   HP-UX has LFS but not readdir64().

7. [kdecore/netsupp.h]
   Don't need forward declaration of struct addrinfo.

8. [kdecore/kextsock.cpp, kdecore/ksocks.cpp, kdesu/client.cpp,
   kinit/kinit.cpp, kinit/wrapper.c]
   On HP-UX 11i, we had to replace socklen_t with kde_socklen_t which is defined to socklen_t if it exists or some appropriate definition otherwise. The problem is that <sys/socket.h> defines socklen_t but _uses_ it only when _XOPEN_SOURCE_EXTENDED is defined:
     typedef size_t socklen_t;
   So, the test fails, defining socklen_t to 'int' which generates a failure because of the 'typedef size_t socklen_t' entry in <sys/socket.h>. So, we work around this by coming up with a new name, kde_socklen_t.

   We also killed ksize_t as we renamed it everywhere to kde_socklen_t.

9. [kdecore/kpty.cpp]
   Port to HP-UX 11.x. This makes kconsole mostly work.

10. [kdeui/ktoolbar.cpp]
    <config.h> should always come first.

11. [khtml/misc/Makefile.am]
    JPEG library might be in $(USER_LDFLAGS)

12. [khtml/rendering/font.cpp]
    Handle alloca correctly on AIX.

13. [configure.in]
    Need AC_CHECK_RES_QUERY, AC_CHECK_DN_SKIPNAME for HP-UX; better autoconf test for isinf(), finite(); check for path to Perl (#1) and md5sum (#4).

14. [acinclude.m4]
    Redo res_init() check using KDE_CHECK_FUNC_EXT macro; tests for AC_CHECK_RES_QUERY, AC_CHECK_DN_SKIPNAME; better socklen_t test (#8); better KDE_CHECK_LIBPTHREAD test on Tru64 UNIX (you cannot just check for pthread_create in -lpthread because Tru64 UNIX #defines this function to something else for backward compatilibity.
Comment 1 The Written Word 2004-02-26 09:48:17 UTC
Created attachment 4895 [details]
Patch
Comment 2 Stephan Kulow 2004-02-26 10:02:47 UTC
Hmm, you really should do these kind of portability work on beta versions. I
don't really feel like adding it to the stable branch, but I'll review it for the branch becoming 3.3 soon
Comment 3 The Written Word 2004-02-26 15:57:02 UTC
Yes, we should try to develop patches to the beta releases but we're just too swamped. It's hard enough for us to keep up with the released tarballs. We have HP-UX portability patches for the remaining KDE tarballs as well. We'll be creating problem reports for all of them today and tomorrow.
Comment 4 The Written Word 2004-03-08 01:48:55 UTC
Created attachment 5073 [details]
Updated patch

Update patch to correctly detect finite/isinf/isfinite on HP-UX 11.x in
addition to Tru64 UNIX, IRIX, and Solaris.

Removed kio/proxytype.pl.in, kio/useragent.pl.in, and corresponding
configure.in entry.
Comment 5 The Written Word 2004-03-22 17:25:52 UTC
Ok, I now have kdelibs-3.2.1 built on HP-UX 11.x, Tru64 UNIX 5.1, and IRIX 6.5. So, updated patch attached:
1. [kio/kio/slaveinterface.h, kio/kio/observer.h, kio/misc/uiserver.h,
   kio/kpasswdserver/kpasswdserver.h]
SGI C++ compiler wants <qstringlist.h>

2. [kjs/operations.cpp]
Fix for isinf() on HP-UX 11.x. isinf() isn't a function on HP-UX 11.x but a macro defined in <math.h>. Created a stub isinf() function in this case to make using it easier.

Ignore <sunmath.h>. Won't do any good unless you have the Sun C++ compiler which doesn't build KDE anyway.

3. [dcop/dcopidl2cpp/Makefile.am]
Don't assume a system has md5sum (maybe they have gmd5sum).

4. [kate/part/katehighlight.h, kate/part/katehighlight.cpp]
SGI C++ compiler wants <qpopmenu.h> for the QPopupMenu class definition and wants to see the class definition for EmbeddedHlInfo.

5. [kdecore/klargefile.h]
HP-UX has LFS but not readdir64().

6. [kdecore/netsupp.h]
Don't need forward declaration of struct addrinfo.

7. [kdecore/kextsock.cpp, kdecore/ksocks.cpp, kdesu/client.cpp,
kinit/kinit.cpp, kinit/wrapper.c]
On HP-UX 11i, we had to replace socklen_t with kde_socklen_t which is defined to socklen_t if it exists or some appropriate definition otherwise. The problem is that <sys/socket.h> defines socklen_t but _uses_ it only when _XOPEN_SOURCE_EXTENDED is defined:
typedef size_t socklen_t;
So, the test fails, defining socklen_t to 'int' which generates a failure because of the 'typedef size_t socklen_t' entry in <sys/socket.h>. So, we work around this by coming up with a new name, kde_socklen_t.

8. [kdecore/kpty.cpp]
Port to HP-UX 11.x. This makes kconsole mostly work.

9. [kdesu/kdesu_pty.cpp]
IRIX 6.5 needs _XOPEN_SOURCE as well.

10. [kdeui/ktoolbar.cpp]
<config.h> should always come first.

11. [kdeui/kkeydialog.h]
There is an invalid ^M before the ";" in the promptForReassign definition. The Tru64 UNIX compiler fails because of this.

12. [kdeui/kdockwidget.cpp, khtml/xml/dom_textimpl.cpp,
    khtml/rendering/render_layer.cpp, kmdi/kmdimainfrm.cpp]
#warning is a GCC'ism so wrap it around #ifdef __GNUC__. This causes the SGI C++ compiler to fail.

13. [khtml/misc/Makefile.am]
JPEG library might be in $(USER_LDFLAGS).

14. [khtml/kmultipart/Makefile.am, kioslave/http/Makefile.am,
    kutils/Makefile.am]
Link order important on IRIX. Libraries with dependencies must go first.

15. [khtml/rendering/font.cpp]
Handle alloca correctly on AIX.

16. [kwallet/backend/blowfish.h]
Don't assume uint32_t is in <stdint.h>. On Tru64 UNIX, it is in <sys/bitypes.h>. Just to be sure, for those systems with <sys/bitypes.h> but no uint32_t defined therein, we create an autoconf test and define UINT32_T_IN_SYS_BITYPES_H accordingly.

17. [configure.in]
Add $LDFLAGS to $ac_link line when testing for CUPS as runtime path might be in LDFLAGS; need AC_CHECK_RES_QUERY, AC_CHECK_DN_SKIPNAME for HP-UX; better autoconf test for isinf(), finite() [#2]; check for path to md5sum [#3]; test for uint32_t in <sys/bitypes.h> [#16]; add new call to AC_CHECK_REVOKE for revoke() call in kdecore/kpty.cpp as Tru64 UNIX has function but lacks prototype.

18. [acinclude.m4]
IRIX wants to see the prototype for ${x_direct_test_function}; change link order for all_libraries so libraries we add are prepended to $all_libraries -- needed for IRIX; revoke() exists on Tru64 UNIX but contains no prototype so create AC_CHECK_REVOKE (revoke() called in kdecore/kpty.cpp); redo res_init() check using KDE_CHECK_FUNC_EXT macro; tests for AC_CHECK_RES_QUERY, AC_CHECK_DN_SKIPNAME needed for HP-UX 11.x; better socklen_t test (#8); better KDE_CHECK_LIBPTHREAD test on Tru64 UNIX (you cannot just check for pthread_create in -lpthread because Tru64 UNIX #defines this function to something else for backward compatilibity; don't add $CFLAGS to $CXXFLAGS as not all C/C++ compiler shared the same flags.
Comment 6 The Written Word 2004-03-22 17:26:29 UTC
Created attachment 5333 [details]
Updated comprehensive patch.
Comment 7 Waldo Bastian 2004-03-30 14:27:43 UTC
> 1. [kio/kio/slaveinterface.h, kio/kio/observer.h, kio/misc/uiserver.h, 
> kio/kpasswdserver/kpasswdserver.h]
> SGI C++ compiler wants <qstringlist.h>

For what? Apart from uiserver.h, these files don't seem to use QStringList at all.

> 3. [dcop/dcopidl2cpp/Makefile.am]
> Don't assume a system has md5sum (maybe they have gmd5sum).

Applied.

> 5. [kdecore/klargefile.h] 
> HP-UX has LFS but not readdir64().

You can't include config.h in an installed header file.

> 8. [kdecore/kpty.cpp] 
> Port to HP-UX 11.x. This makes kconsole mostly work. 

Playing with SIGCHLD this way can result in SIGCHLD's from other processes getting missed.

> 10. [kdeui/ktoolbar.cpp] 
> <config.h> should always come first. 

Agreed, applied.

> 11. [kdeui/kkeydialog.h] 
> There is an invalid ^M before the ";" in the promptForReassign definition.
> The Tru64 UNIX compiler fails because of this.

Fixed already.

> 12. [kdeui/kdockwidget.cpp, khtml/xml/dom_textimpl.cpp, 
> khtml/rendering/render_layer.cpp, kmdi/kmdimainfrm.cpp] 
> #warning is a GCC'ism so wrap it around #ifdef __GNUC__. 
> This causes the SGI C++ compiler to fail. 

Applied.


 


 
Comment 8 Waldo Bastian 2004-03-30 16:50:00 UTC
> 9. [kdesu/kdesu_pty.cpp]
> IRIX 6.5 needs _XOPEN_SOURCE as well.
 
Needs? Your patch suggests that it doesn't need it.

> 16. [kwallet/backend/blowfish.h]

Included sys/bitypes.h when available.
Comment 9 The Written Word 2004-03-30 22:23:25 UTC
Ok, ignore #1. Sorry, I just rebuilt on IRIX against Qt 3.3.1 and it doesn't need it.

How do I fix the issue of LFS being available on HP-UX but readdir64 not being available? Should I have configure generate kdecore/klargefile.h from kdecore/klargefile.h.in?
Comment 10 The Written Word 2004-04-01 00:45:17 UTC
Created attachment 5482 [details]
kdecore/kpty.cpp

Updated kdecore/kpty.cpp patch without SIGCHLD changes.
Comment 11 The Written Word 2004-04-01 00:48:41 UTC
Re #9, "IRIX 6.5 needs _XOPEN_SOURCE as well". You are correct, IRIX 6.5 does _not_ need _XOPEN_SOURCE.
Comment 12 Stephan Kulow 2004-07-25 21:44:10 UTC
CVS commit by coolo: 

commiting parts of the patch 
CCMAIL: 76171-done@bugs.kde.org


  M +91 -55    kde-common/admin/acinclude.m4.in   2.459
  M +4 -4      kdelibs/kinit/kinit.cpp   1.141
  M +1 -3      kdelibs/kinit/wrapper.c   1.38



Comment 13 Stephan Kulow 2004-07-25 21:47:29 UTC
I somewhat forgot about this ;(

Can you somehow update your patches against CVS checking what's needed?
Comment 14 The Written Word 2004-07-25 21:50:27 UTC
Unfortunately, we don't have the time right now. I doubt we'll have time until after 3.3 is released.
Comment 15 groot 2004-10-27 23:36:46 UTC
CVS commit by adridg: 

Restore FreeBSD pthread detection stuff that was removed in r. 2.459;
leave the Tru64 pthread check in after the "simple" detection attempt.
CCMAIL: 76171@bugs.kde.org


  M +31 -8     acinclude.m4.in   2.472


--- kde-common/admin/acinclude.m4.in  #2.471:2.472
@@ -4019,12 +4019,35 @@
 AC_DEFUN([KDE_CHECK_LIBPTHREAD],
 [
-  AC_MSG_CHECKING([for pthread_create in -lpthread])
-  kde_safe_libs=$LIBS
-  LIBS="$LIBS -lpthread"
-  AC_TRY_LINK([#include <pthread.h>],[(void)pthread_create(0,0,0,0);],[
-      AC_MSG_RESULT(yes)
-      LIBPTHREAD="-lpthread"],[
-      AC_MSG_RESULT(no)])
-  LIBS=$kde_safe_libs
+  dnl This code is here specifically to handle the
+  dnl various flavors of threading library on FreeBSD
+  dnl 4-, 5-, and 6-, and the (weird) rules around it.
+  dnl There may be an environment PTHREAD_LIBS that 
+  dnl specifies what to use; otherwise, search for it.
+  LIBPTHREAD=""
+
+  if test -n "$PTHREAD_LIBS"; then
+    PTHREAD_LIBS_save="$PTHREAD_LIBS"
+    PTHREAD_LIBS=`echo "$PTHREAD_LIBS_save" | sed -e 's,^-l,,g'`
+    AC_MSG_CHECKING([for pthread_create in $PTHREAD_LIBS])
+    KDE_CHECK_LIB($PTHREAD_LIBS, pthread_create, [
+        LIBPTHREAD="$PTHREAD_LIBS_save"])
+    PTHREAD_LIBS="$PTHREAD_LIBS_save"
+  fi
+
+  if test -z "$LIBPTHREAD"; then
+    AC_CHECK_LIB(pthread, pthread_create, [LIBPTHREAD="-lpthread"])
+  fi
+
+  dnl This is a special Tru64 check, see BR 76171 issue #18.
+  if test -z "$LIBPTHREAD" ; then
+    AC_MSG_CHECKING([for pthread_create in -lpthread])
+    kde_safe_libs=$LIBS
+    LIBS="$LIBS -lpthread"
+    AC_TRY_LINK([#include <pthread.h>],[(void)pthread_create(0,0,0,0);],[
+        AC_MSG_RESULT(yes)
+        LIBPTHREAD="-lpthread"],[
+        AC_MSG_RESULT(no)])
+    LIBS=$kde_safe_libs
+  fi
 
   AC_SUBST(LIBPTHREAD)


Comment 16 The Written Word 2006-01-28 03:30:16 UTC
Close. We'll update our patches with a more recent KDE release.