Re: [hpux] Fix build problem on hpux

Randolph Chung
2006-03-29T00:04:23Z

Daniel Jacobowitz wrote:
> On Sun, Mar 26, 2006 at 03:55:48PM +0800, Randolph Chung wrote:
>
>>+# When building on HPUX, we need to define _XOPEN_SOURCE_EXTENDED to get
>>+# proper prototypes.
>>+case $host_os in
>>+hpux*)
>>+ AH_VERBATIM([_XOPEN_SOURCE_EXTENDED],
>>+ [/* Define to 1 if on HPUX. */
>>+#ifndef _XOPEN_SOURCE_EXTENDED
>>+# undef _XOPEN_SOURCE_EXTENDED
>>+#endif])dnl
>>+ AC_DEFINE([_XOPEN_SOURCE_EXTENDED])
>>+ ;;
>>+esac
>
>
> I am most confused as to what you are trying to do. You should leave
> _XOPEN_SOURCE_EXTENDED alone on non-HP/UX, and make sure it is
> appropriately defined on HP/UX.

Yes, this is exactly what I am trying to do. What is confusing.

> #ifndef followed by #undef doesn't
> do much. And I don't think AH_VERBATIM does what you think; it changes
> the generated config.in, not the generated config.h, so it affects all
> platforms.

Yes, I know. Normally autoheader will generate just the #undef line;
the above makes it generate the #undef inside the #ifndef. This is the
same logic used to generate the _GNU_SOURCE #define in config.in. The
#undef is changed into a #define by configure on hpux. On other systems,
you are right that the three lines don't do anything, and that is the
desired effect.

The problem is that we are trying to avoid a redefinition of
_XOPEN_SOURCE_EXTENDED, in case this define is by default enabled on a
particular platform.

randolph