Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] Compilation fix for AIX (missing consts)



Hello,

Sorry, I've been away from AIX for a few days…

2011/4/27 Wayne Davison <wayned@xxxxxxxxxxxxxxxxxxxxx>:
> 2011/4/27 Jérémie Roquet <arkanosis@xxxxxxxxx>:
>> That's from the man for Linux and FreeBSD and from the source for AIX.
>
> In Linux they now have the extra "const"s in the include files, though
> not in the man pages.
>
>> Yes, it's conflicting with the available header.
>
> So, where are those defined in your /usr/include files?  The best fix
> is to avoid manual prototypes on systems that have them already
> defined.  So we should work out a rule that avoids including that
> section on AIX.  What do the various TERM vars get defined as in
> config.h?

So… I have /usr/include/term.h and :

$ grep TERM config.h
/* #undef HAVE_NCURSESW_TERM_H */
/* #undef HAVE_NCURSES_TERM_H */
#define HAVE_SETUPTERM 1
/* #undef HAVE_TERMCAP_H */
#define HAVE_TERMIOS_H 1
#define HAVE_TERMIO_H 1
#define HAVE_TERM_H 1
#define ZSH_HAVE_TERM_H 1

$ grep CURSES config.h
#define HAVE_CURSES_H 1
#define HAVE_NCURSESW_NCURSES_H 1
#define HAVE_NCURSESW_TERM_H 1
#define HAVE_NCURSES_H 1
/* #undef HAVE_NCURSES_NCURSES_H */
/* #undef HAVE_NCURSES_TERM_H */
#define ZSH_HAVE_CURSES_H 1

$ grep TGETENT config.h
#define HAVE_TGETENT 1
#define TGETENT_ACCEPTS_NULL 1
#define TGETENT_SUCCESS 1

Which I think is fine.

But prototypes.h declares the prototypes whenever it is included if
!(defined(USES_TERMCAP_H) || defined(USES_TERM_H)); which means the
files that include it (ie. the files that include zsh.mdh, since it's
the only file to directly include prototypes.h) have to define one of
these macros before the inclusion.

That's what termcap.c does:

#include "../../config.h"

#ifdef HAVE_TGETENT
# if defined(ZSH_HAVE_CURSES_H) && defined(ZSH_HAVE_TERM_H)
#  define USES_TERM_H 1
# else
#  ifdef HAVE_TERMCAP_H
#   define USES_TERMCAP_H 1
#  endif
# endif
#endif

#include "termcap.mdh"

… but termcap.c is the only one to do that (along wtih terminfo.c
which always define the macro, regardless of the values in config.h).

Every other single file that include zsh.mdh (and prototypes.h) does
not set USES_*.
For example, loop.c, prompt.c, sort.c… (there are about ~30 of them)
include zsh.mdh (and prototypes.h) without defining USES_* so they
declare the prototypes even when the HAVE_* macros are defined.

I may have missed something, but I think it's the whole problem.

Best regards,

-- 
Jérémie



Messages sorted by: Reverse Date, Date, Thread, Author