* configure.ac (CURSES_H_FILE): Only define if we have one.
(TERMCAP_H_FILE): Ditto.
(TERM_H_FILE): Ditto.
(HAVE_TPARM_PROTOTYPE): Detect we tparm prototype is available.
* src/ui/TTY/terminfo.c: Only include TERM_H_FILE is we have it.
Properly decide when to define a tparm prototype, based on when
configure detected it.
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
if test -n "$curses_h_file"; then
AC_DEFINE_UNQUOTED([HAVE_CURSES_H], [1],
[There is a curses.h header file available])
if test -n "$curses_h_file"; then
AC_DEFINE_UNQUOTED([HAVE_CURSES_H], [1],
[There is a curses.h header file available])
+ AC_DEFINE_UNQUOTED([CURSES_H_FILE], ["${curses_h_file-curses.h}"],
+ [The curses.h header file])
fi
if test -n "$termcap_h_file"; then
AC_DEFINE_UNQUOTED([HAVE_TERMCAP_H], [1],
[There is a termcap.h header available])
fi
if test -n "$termcap_h_file"; then
AC_DEFINE_UNQUOTED([HAVE_TERMCAP_H], [1],
[There is a termcap.h header available])
+ AC_DEFINE_UNQUOTED([TERMCAP_H_FILE], ["${termcap_h_file-termcap.h}"],
+ [The termcap.h header file])
fi
if test -n "$term_h_file"; then
AC_DEFINE_UNQUOTED([HAVE_TERM_H], [1],
[There is a term.h header available])
fi
if test -n "$term_h_file"; then
AC_DEFINE_UNQUOTED([HAVE_TERM_H], [1],
[There is a term.h header available])
+ AC_DEFINE_UNQUOTED([TERM_H_FILE], ["${term_h_file-term.h}"],
+ [The term.h header file])
- AC_DEFINE_UNQUOTED([CURSES_H_FILE], ["${curses_h_file-curses.h}"],
- [The curses.h header file])
- AC_DEFINE_UNQUOTED([TERMCAP_H_FILE], ["${termcap_h_file-termcap.h}"],
- [The termcap.h header file])
- AC_DEFINE_UNQUOTED([TERM_H_FILE], ["${term_h_file-term.h}"],
- [The term.h header file])
+ # Finally let's see if we have prototype for the elusive tparm
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#ifdef TERM_H_FILE
+#include TERM_H_FILE
+#endif
+#ifdef TERMCAP_H_FILE
+#include TERMCAP_H_FILE
+#endif
+#ifdef CURSES_H_FILE
+#include CURSES_H_FILE
+#endif
+
+/* Completely incompatible prototype with all tparm ones
+ if files above define it, compilation should fail
+*/
+extern void tparm(void);
+ ]], [[ tparm(); ]])],
+ [], [ AC_DEFINE_UNQUOTED([HAVE_TPARM_PROTOTYPE], [1],
+ [tparm has a prototype defined])])
+
],[
for feature in ncurses curses termcap terminfo termlib gpm; do
if eval "test -n \"\$with_${feature}\" -a \"\$with_${feature}\" != no" ; then
],[
for feature in ncurses curses termcap terminfo termlib gpm; do
if eval "test -n \"\$with_${feature}\" -a \"\$with_${feature}\" != no" ; then
is equally lame in that it supplies "fixed" headers for curses.h
but not term.h.) However, it seems to work to just not include
term.h under Solaris, so we try that. KLUDGE! */
is equally lame in that it supplies "fixed" headers for curses.h
but not term.h.) However, it seems to work to just not include
term.h under Solaris, so we try that. KLUDGE! */
#ifdef TERM_H_FILE
#if !(defined (__GNUC__) && defined (SOLARIS2))
#include TERM_H_FILE
#endif
#endif
#ifdef TERM_H_FILE
#if !(defined (__GNUC__) && defined (SOLARIS2))
#include TERM_H_FILE
#endif
#endif
extern void *xmalloc_atomic(int size);
extern void *xmalloc_atomic(int size);
-#if 0 /* If this isn't declared somewhere, too bad */
+#ifndef HAVE_TPARM_PROTOTYPE
+/* Canonical for one, in their infinite wisdom ships the tinfo library without
+ any headers of which we'd need for proper tparm prototype.
+ If it is not defined, let's define it here, since if we are linking this
+ configure has determined we have a linkable tparm
+*/
extern char *tparm(const char *string, int arg1, int arg2, int arg3,
int arg4, int arg5, int arg6, int arg7, int arg8, int arg9);
#endif
extern char *tparm(const char *string, int arg1, int arg2, int arg3,
int arg4, int arg5, int arg6, int arg7, int arg8, int arg9);
#endif