File: tputs.m4

package info (click to toggle)
nmh 1.6-2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 6,204 kB
  • ctags: 3,851
  • sloc: ansic: 48,922; sh: 16,422; makefile: 559; perl: 509; lex: 402; awk: 74
file content (30 lines) | stat: -rw-r--r-- 1,119 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
dnl
dnl Some systems have different arguments to the tputs callback; it can
dnl be int (*)(int), or int (*)(char).  Try to probe to see which one it
dnl actually is, so our callback can match the prototype.
dnl
dnl The first argument to tputs sometimes is char *, other times is
dnl const char *, so we have to include that in the test as well, but
dnl we don't provide any definitions for it (since it's not necessary)
dnl

AC_DEFUN([NMH_TPUTS_PUTC_ARG],
[AC_CACHE_CHECK([the argument of the tputs() callback],
		[nmh_cv_tputs_putc_arg],
  [for tputs_arg1 in 'const char *' 'char *'; do
    for tputs_putc_arg in 'int' 'char'; do
      AC_COMPILE_IFELSE(
      	[AC_LANG_PROGRAM(
[AC_INCLUDES_DEFAULT
#include <curses.h>
#include <term.h>
],
	  [extern int tputs($tputs_arg1, int, int (*)($tputs_putc_arg));])],
	[nmh_cv_tputs_putc_arg="$tputs_putc_arg"; break 2])
    done
  done
  AS_IF([test "X$nmh_cv_tputs_putc_arg" = X],
    [AC_MSG_FAILURE([cannot determine tputs callback argument])])])
AC_DEFINE_UNQUOTED([TPUTS_PUTC_ARG], [$nmh_cv_tputs_putc_arg],
		   [The type of the argument of the tputs() callback])
])