[cfarm-users] AIX portability

Bruno Haible bruno at clisp.org
Wed Sep 21 10:32:26 CEST 2022


Kaz Kylheku wrote:
> gcc -E - -D_XOPEN_SOURCE=500

Defining _XOPEN_SOURCE — or worse, _POSIX_SOURCE — on arbitrary platforms
is a recipe for producing compilation errors.

On HP-UX/hppa, -D_XOPEN_SOURCE=500 is useful.
On HP-UX/ia64, -D_XOPEN_SOURCE=600 is useful, but only in combination with
-D_HPUX_SOURCE.
On Solaris 11, -D_XOPEN_SOURCE=700 is useful.

As you have just discovered, -D_XOPEN_SOURCE=500 is not useful on AIX. Then
don't use it. You don't need to compile an application on AIX the same way
as you do on HP-UX or Solaris, since AIX is not HP-UX nor Solaris. And you
need only one set of working compiler options on each platform. [1]

Also, note that while preprocessor defines such as _XOPEN_SOURCE may alleviate
some (few) problems in the header files, they cannot fix/work around problems
in the libc functions. To get these fixed, you need GNU gnulib [2].

Bruno

[1] https://gitlab.com/ghwiki/gnow-how/-/wikis/Platforms/Configuration
[2] https://www.gnu.org/software/gnulib/manual/html_node/Function-Substitutes.html





More information about the cfarm-users mailing list