summaryrefslogtreecommitdiff
path: root/mcon/U/d_havetlib.U
blob: 4282042a46d58681c3bb7407939ee90dfaf4fad2 (plain)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
?RCS: $Id: d_havetlib.U 167 2013-05-08 17:58:00Z rmanfredi $
?RCS:
?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
?RCS: 
?RCS: You may redistribute only under the terms of the Artistic License,
?RCS: as specified in the README file that comes with the distribution.
?RCS: You may reuse parts of this distribution only within the terms of
?RCS: that same Artistic License; a copy of which may be found at the root
?RCS: of the source tree for dist 4.0.
?RCS:
?RCS: $Log: d_havetlib.U,v $
?RCS: Revision 3.0.1.2  1997/02/28  15:36:31  ram
?RCS: patch61: replaced .a with $_a all over the place
?RCS: patch61: likewise for .o replaced by $_o
?RCS:
?RCS: Revision 3.0.1.1  1994/05/06  14:44:06  ram
?RCS: patch23: added AIX support to accept shared lib stub as termlib (WED)
?RCS:
?RCS: Revision 3.0  1993/08/18  12:06:19  ram
?RCS: Baseline for dist 3.0 netwide release.
?RCS:
?MAKE:d_havetlib termlib: cat contains Myread Loc Filexp Oldconfig libpth \
	test uname _a _o
?MAKE:	-pick add $@ %<
?S:d_havetlib:
?S:	This variable conditionally defines the HAS_TERMLIB symbol, which
?S:	indicates to the C program that termlib-style routines are available.
?S:.
?S:termlib:
?S:	This variable contains the argument to pass to the loader to get
?S:	termlib-style routines.  It is up to the Makefile.SH to make sure
?S:	the value gets to the right command.  Note that on many systems the
?S:	termlib routines are emulated by the curses or terminfo library.
?S:.
?C:HAS_TERMLIB (HAVETERMLIB):
?C:	This symbol, when defined, indicates that termlib-style routines
?C:	are available.  There is nothing to include.
?C:.
?H:#$d_havetlib	HAS_TERMLIB	/**/
?H:.
?T:xxx
: where do we get termlib routines from
echo " "
xxx=`./loc libcurses$_a x $libpth`
case "$xxx" in
/*)
	ar t $xxx >grimble
	if $contains tputs$_o grimble >/dev/null 2>&1; then
		termlib='-lcurses'
		d_havetlib="$define"
		echo "Terminfo library found." >&4
	elif $test "x`$uname 2>/dev/null`" = xAIX; then
		# Ok, do the AIX shr.o fun thing
		/usr/ccs/bin/nm -en $xxx 2>/dev/null >grimble
		if $contains '^tputs .*|extern|' grimble >/dev/null 2>&1; then
			termlib='-lcurses'
			d_havetlib="$define"
			echo "AIX Terminfo library found." >&4
		else
			xxx=x
		fi
	else
		xxx=x
	fi
	rm -f grimble
	;;
esac
case "$xxx" in
x)
	xxx=`./loc libtermlib$_a x $libpth`
	case "$xxx" in
	/usr/lib*|/lib*)
		termlib='-ltermlib'
		d_havetlib="$define"
		echo "Termlib library found." >&4
		;;
	/*)
		termlib="$xxx"
		d_havetlib="$define"
		echo "Termlib library found." >&4
		;;
	*)
		xxx=`./loc libtermcap$_a x $libpth`
		case "$xxx" in
		/usr/lib*|/lib*)
			termlib='-ltermcap'
			d_havetlib="$define"
			echo "Termcap library found." >&4
			;;
		/*)
			termlib="$xxx"
			d_havetlib="$define"
			echo "Termcap library found." >&4
			;;
		*)
			case "$termlib" in
			'')
				dflt=y
rp="Your system appears to NOT have termlib-style routines. Is this true?"
				. ./myread
				case "$ans" in
				n*|f*) d_havetlib="$define"
					$cat <<'EOM'
Then where are the termlib-style routines kept? Specify either -llibname
or a full pathname (~name ok).

EOM
					dflt=''
					rp='Specify termlib path:'
					. ./myread
					termlib=`./filexp $ans`
					;;
				*)
					d_havetlib="$undef"
					termlib=''
					echo "You will have to play around with term.c then." >&4
					;;
				esac
			echo " ";;
			*)  echo "You said termlib was $termlib before." >&4;;
			esac;;
		esac;;
	esac;;
esac