~logan/ubuntu/trusty/pinentry/0.8.3-1ubuntu1

« back to all changes in this revision

Viewing changes to m4/curses.m4

  • Committer: Bazaar Package Importer
  • Author(s): Peter Eisentraut
  • Date: 2005-01-27 19:10:07 UTC
  • mfrom: (1.1.1 upstream) (2.1.1 hoary)
  • Revision ID: james.westby@ubuntu.com-20050127191007-83ptn4mcw63mu085
Tags: 0.7.2-1
* New upstream release
* Added new -gtk2 flavor.
* Build dependencies revised accordingly.
* Added more copyright holders to debian/copyright.
* Removed compatibility symlinks.
* Converted to CDBS.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
dnl IU_LIB_NCURSES, IU_LIB_CURSES and IU_LIB_TERMCAP are:
 
2
dnl Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
 
3
dnl Written by Miles Bader <miles@gnu.ai.mit.edu>
 
4
dnl
 
5
dnl This program is free software; you can redistribute it and/or modify
 
6
dnl it under the terms of the GNU General Public License as published by
 
7
dnl the Free Software Foundation; either version 2, or (at your option)
 
8
dnl any later version.
 
9
dnl
 
10
dnl This program is distributed in the hope that it will be useful,
 
11
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
dnl GNU General Public License for more details.
 
14
dnl
 
15
dnl You should have received a copy of the GNU General Public License
 
16
dnl along with this program; if not, write to the Free Software
 
17
dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
18
dnl
 
19
 
 
20
dnl IU_LIB_NCURSES -- check for, and configure, ncurses
 
21
dnl
 
22
dnl If libncurses is found to exist on this system and the --disable-ncurses
 
23
dnl flag wasn't specified, defines LIBNCURSES with the appropriate linker
 
24
dnl specification, and possibly defines NCURSES_INCLUDE with the appropriate
 
25
dnl -I flag to get access to ncurses include files.
 
26
dnl
 
27
AC_DEFUN([IU_LIB_NCURSES], [
 
28
  AC_ARG_ENABLE(ncurses,    [  --disable-ncurses       don't prefer -lncurses over -lcurses],
 
29
              , enable_ncurses=yes)
 
30
  if test "$enable_ncurses" = yes; then
 
31
    AC_CHECK_LIB(ncurses, initscr, LIBNCURSES="-lncurses")
 
32
    if test "$LIBNCURSES"; then
 
33
      # Use ncurses header files instead of the ordinary ones, if possible;
 
34
      # is there a better way of doing this, that avoids looking in specific
 
35
      # directories?
 
36
      AC_ARG_WITH(ncurses-include-dir,
 
37
[  --with-ncurses-include-dir=DIR
 
38
                          Set directory containing the include files for
 
39
                          use with -lncurses, when it isn't installed as
 
40
                          the default curses library.  If DIR is "none",
 
41
                          then no special ncurses include files are used.
 
42
  --without-ncurses-include-dir
 
43
                          Equivalent to --with-ncurses-include-dir=none])dnl
 
44
      if test "${with_ncurses_include_dir+set}" = set; then
 
45
        AC_MSG_CHECKING(for ncurses include dir)
 
46
        case "$with_ncurses_include_dir" in
 
47
          no|none)
 
48
            inetutils_cv_includedir_ncurses=none;;
 
49
          *)
 
50
            inetutils_cv_includedir_ncurses="$with_ncurses_include_dir";;
 
51
        esac
 
52
        AC_MSG_RESULT($inetutils_cv_includedir_ncurses)
 
53
      else
 
54
        AC_CACHE_CHECK(for ncurses include dir,
 
55
                       inetutils_cv_includedir_ncurses,
 
56
          for D in $includedir $prefix/include /local/include /usr/local/include /include /usr/include; do
 
57
            if test -d $D/ncurses; then
 
58
              inetutils_cv_includedir_ncurses="$D/ncurses"
 
59
              break
 
60
            fi
 
61
            test "$inetutils_cv_includedir_ncurses" \
 
62
              || inetutils_cv_includedir_ncurses=none
 
63
          done)
 
64
      fi
 
65
      if test "$inetutils_cv_includedir_ncurses" = none; then
 
66
        NCURSES_INCLUDE=""
 
67
      else
 
68
        NCURSES_INCLUDE="-I$inetutils_cv_includedir_ncurses"
 
69
      fi
 
70
    fi
 
71
  fi
 
72
  AC_SUBST(NCURSES_INCLUDE)
 
73
  AC_SUBST(LIBNCURSES)])dnl
 
74
 
 
75
dnl IU_LIB_TERMCAP -- check for various termcap libraries
 
76
dnl
 
77
dnl Checks for various common libraries implementing the termcap interface,
 
78
dnl including ncurses (unless --disable ncurses is specified), curses (which
 
79
dnl does on some systems), termcap, and termlib.  If termcap is found, then
 
80
dnl LIBTERMCAP is defined with the appropriate linker specification.
 
81
dnl 
 
82
AC_DEFUN([IU_LIB_TERMCAP], [
 
83
  AC_REQUIRE([IU_LIB_NCURSES])
 
84
  if test "$LIBNCURSES"; then
 
85
    LIBTERMCAP="$LIBNCURSES"
 
86
  else
 
87
    AC_CHECK_LIB(curses, tgetent, LIBTERMCAP=-lcurses)
 
88
    if test "$ac_cv_lib_curses_tgetent" = no; then
 
89
      AC_CHECK_LIB(termcap, tgetent, LIBTERMCAP=-ltermcap)
 
90
    fi
 
91
    if test "$ac_cv_lib_termcap_tgetent" = no; then
 
92
      AC_CHECK_LIB(termlib, tgetent, LIBTERMCAP=-ltermlib)
 
93
    fi
 
94
  fi
 
95
  AC_SUBST(LIBTERMCAP)])dnl
 
96
 
 
97
dnl IU_LIB_CURSES -- checke for curses, and associated libraries
 
98
dnl
 
99
dnl Checks for varions libraries implementing the curses interface, and if
 
100
dnl found, defines LIBCURSES to be the appropriate linker specification,
 
101
dnl *including* any termcap libraries if needed (some versions of curses
 
102
dnl don't need termcap).
 
103
dnl
 
104
AC_DEFUN([IU_LIB_CURSES], [
 
105
  AC_REQUIRE([IU_LIB_TERMCAP])
 
106
  AC_REQUIRE([IU_LIB_NCURSES])
 
107
  if test "$LIBNCURSES"; then
 
108
    LIBCURSES="$LIBNCURSES"     # ncurses doesn't require termcap
 
109
  else
 
110
    _IU_SAVE_LIBS="$LIBS"
 
111
    LIBS="$LIBTERMCAP"
 
112
    AC_CHECK_LIB(curses, initscr, LIBCURSES="-lcurses")
 
113
    if test "$LIBCURSES" -a "$LIBTERMCAP" -a "$LIBCURSES" != "$LIBTERMCAP"; then
 
114
      AC_CACHE_CHECK(whether curses needs $LIBTERMCAP,
 
115
                     inetutils_cv_curses_needs_termcap,
 
116
        LIBS="$LIBCURSES"
 
117
        AC_TRY_LINK([#include <curses.h>], [initscr ();],
 
118
                    [inetutils_cv_curses_needs_termcap=no],
 
119
                    [inetutils_cv_curses_needs_termcap=yes]))
 
120
      if test $inetutils_cv_curses_needs_termcap = yes; then
 
121
          LIBCURSES="$LIBCURSES $LIBTERMCAP"
 
122
      fi
 
123
    fi
 
124
    LIBS="$_IU_SAVE_LIBS"
 
125
  fi
 
126
  AC_SUBST(LIBCURSES)])dnl