Subject: HP-UX crossbuild: tools/compat/configure zlib autoconf tests &&
To: None <current-users@netbsd.org>
From: Brian A. Seklecki <lavalamp@spiritual-machines.org>
List: current-users
Date: 09/07/2003 23:51:05
tonight, for some reason, i found myself trying to cross compile on an
HP-UX machine and a Tru64 machine at the Compaq testdrive, and ran into
some obscure problems:

well, for starters, Tru64 /bin/sh doesn't even run build.sh, so:
s/\/bin\/sh/\/usr\/local\/bin\/bash\ --posix/g

Then i had to roll zlib, of couse:

HOST_CFLAGS='-I/usr/local/include -I/usr/include'
HOST_CPPFLAGS='-I/usr/local/include -I/usr/include'

but anyway, their compiler works well, however src/tools/compat fails in
gnu autoconf.  apparently HOST_CPPFLAGS isn't getting honored.

in config.log i also see:

	ac_cv_prog_CPP='cc -E'

So I had to manually define it.  It's odd because CFLAGS is getting
honored as per the config.log seen here:


[...snip...]
conftest.c >&5
configure:2840: $? = 0
configure:2843: test -s conftest.o
configure:2846: $? = 0
configure:2857: result: yes
configure:2820: checking for unistd.h
configure:2837: cc -c -I/usr/local/include -I/usr/include  conftest.c
>&5
configure:2840: $? = 0
configure:2843: test -s conftest.o
configure:2846: $? = 0
configure:2857: result: yes
configure:2879: checking zlib.h usability
configure:2892: cc -c -I/usr/local/include -I/usr/include  conftest.c
>&5
configure:2895: $? = 0
configure:2898: test -s conftest.o
configure:2901: $? = 0
configure:2911: result: yes
configure:2915: checking zlib.h presence
configure:2926: cc -E  conftest.c
cc: Error: configure, line 2936: Cannot find file <zlib.h> specified in
#include directive. (noinclfile)
#include <zlib.h>


Everything is fine until another src/tools/compat problem with
src/include/pwd.h:


Using the HP Compiler:

HOST_CC=/usr/bin/gcc

/usr/bin/cc -I/house/seklecki/opt-hpux-hppa/include  -I. -I./include
-I/tmp/src_extract/src/tools/compat -DHAVE_CONFIG_H 
-D_FILE_OFFSET_BITS=64 -D_NETBSD_SOURCE -D__DBINTERFACE_PRIVATE -c -o
pw_scan.lo.o
/tmp/src_extract/src/tools/compat/../../lib/libc/gen/pw_scan.c
cc: "/tmp/src_extract/src/tools/compat/../../include/pwd.h", line 116:
error 1587: Redeclaration of tag "passwd".
cc: "/tmp/src_extract/src/tools/compat/../../include/pwd.h", line 116:
error 1595: Redeclaration of members.

Using GCC 3.2.3:

HOST_CC=/usr/local/pa20_64/bin/gcc

/usr/local/pa20_64/bin/gcc -I/house/seklecki/opt-hpux-hppa/include  -I.
-I./include -I/tmp/src_extract/src/tools/compat -DHAVE_CONFIG_H 
-D_FILE_OFFSET_BITS=64 -D_NETBSD_SOURCE -D__DBINTERFACE_PRIVATE -c -o
pw_scan.lo.o /tmp/src_extract/src/lib/libc/gen/pw_scan.c
In file included from /tmp/src_extract/src/tools/compat/compat_pwd.h:49,
                 from /tmp/src_extract/src/lib/libc/gen/pw_scan.c:34:
/tmp/src_extract/src/include/pwd.h:116: redefinition of `struct passwd'


...so I'm assuming that (at the risk of HP or SCO suing me here as i
paste this in), this error is being caused by /usr/include/pwd.h and
src/include/pwd.h struct differences:

# more /usr/incclude/pwd.h
[...]
#ifdef _INCLUDE_POSIX_SOURCE

   struct passwd {
        char    *pw_name;
        char    *pw_passwd;
        uid_t   pw_uid;
        gid_t   pw_gid;
        char    *pw_age;
        char    *pw_comment;
        char    *pw_gecos;
        char    *pw_dir;
        char    *pw_shell;
        int32_t pw_audid;
        int     pw_audflg;
   };


...there are notes in src/compat/README about compiling on HPUX, so has
anyone done it before?

-lava