summaryrefslogtreecommitdiff
path: root/U/Extensions.U
blob: 2cba1999299580eeaf079ef59979022d783cd385 (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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
?RCS: $Id: Extensions.U,v$
?RCS:
?RCS: You may redistribute only under the terms of the Artistic Licence,
?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 Licence; a copy of which may be found at the root
?RCS: of the source tree for dist 3.0.
?RCS:
?RCS: $Log: Extensions.U,v $
?RCS:
?MAKE:known_extensions extensions dynamic_ext static_ext useposix : \
	Myread usedl d_socket i_db i_dbm i_ndbm i_gdbm package test cat
?MAKE:	-pick add $@ %<
?S:known_extensions:
?S:	This variable holds a list of all extensions included in 
?S:	the package.
?S:.
?S:dynamic_ext:
?S:	This variable holds a list of extension files we want to
?S:	link dynamically into the package.  It is used by Makefile.
?S:.
?S:static_ext:
?S:	This variable holds a list of extension files we want to
?S:	link statically into the package.  It is used by Makefile.
?S:.
?S:extensions:
?S:	This variable holds a list of all extension files
?S:	linked into the package.  It is propagated to Config.pm
?S:	and is typically used to test whether a particular extesion 
?S:	is available.
?S:.
?S:useposix:
?S:	This variable holds either 'true' or 'false' to indicate
?S:	whether the POSIX extension should be used.  The sole
?S:	use for this currently is to allow an easy mechanism
?S:	for hints files to indicate that POSIX will not compile
?S:	on a particular system.
?S:.
?T:xxx yyy avail_ext
?INIT:: set useposix=false in your hint file to disable the POSIX extension.
?INIT:useposix=true
echo " "
echo "Looking for extensions..." >&4
cd ../ext
: If we are using the old config.sh, known_extensions may contain
: old or inaccurate or duplicate values.
known_extensions=''
: We do not use find because it might not be available.
: We do not just use MANIFEST because the user may have dropped
: some additional extensions into the source tree and expect them
: to be built.
for xxx in * ; do
	if $test -f $xxx/$xxx.xs; then
		known_extensions="$known_extensions $xxx"
	else
		if $test -d $xxx; then
			cd $xxx
			for yyy in * ; do
				if $test -f $yyy/$yyy.xs; then
					known_extensions="$known_extensions $xxx/$yyy"
				fi
			done
			cd ..
		fi
	fi
done
set X $known_extensions
shift
known_extensions="$*"
cd ../UU

: Now see which are supported on this system.
avail_ext=''
for xxx in $known_extensions ; do
    case "$xxx" in
    DB_File) case "$i_db" in 
	    $define) avail_ext="$avail_ext $xxx" ;;
	    esac
	    ;;
    GDBM_File) case "$i_gdbm" in 
	    $define) avail_ext="$avail_ext $xxx" ;;
	    esac
	    ;;
    NDBM_File) case "$i_ndbm" in 
	    $define) avail_ext="$avail_ext $xxx" ;;
	    esac
	    ;;
    ODBM_File) case "$i_dbm" in 
	    $define) avail_ext="$avail_ext $xxx" ;;
	    esac
	    ;;
    POSIX) case "$useposix" in 
	    true|define|y) avail_ext="$avail_ext $xxx" ;;
	    esac
	    ;;
    Socket) case "$d_socket" in 
	    $define) avail_ext="$avail_ext $xxx" ;;
	    esac
	    ;;
    *)      avail_ext="$avail_ext $xxx"
	    ;;
    esac
done

set X $avail_ext
shift
avail_ext="$*"

case $usedl in
$define)
	$cat <<EOM
A number of extensions are supplied with $package.  You may choose to
compile these extensions for dynamic loading (the default), compile
them into the $package executable (static loading), or not include
them at all.  Answer "none" to include no extensions.

EOM
	case "$dynamic_ext" in
	''|' ') dflt="$avail_ext" ;;
	*)	dflt="$dynamic_ext" ;;
	esac
	case "$dflt" in
	'')	dflt=none;;
	esac
	rp="What extensions do you wish to load dynamically?"
	. ./myread
	case "$ans" in
	none) dynamic_ext='' ;;
	*) dynamic_ext="$ans" ;;
	esac

	case "$static_ext" in
	''|' ')
		: Exclude those already listed in dynamic linking
		dflt=''
		for xxx in $avail_ext; do
			case " $dynamic_ext " in
			*" $xxx "*) ;;
			*) dflt="$dflt $xxx" ;;
			esac
		done
		set X $dflt
		shift
		dflt="$*"
		;;
	*)  dflt="$static_ext" 
		;;
	esac

	case "$dflt" in
	'')	dflt=none;;
	esac
	rp="What extensions do you wish to load statically?"
	. ./myread
	case "$ans" in
	none) static_ext='' ;;
	*) static_ext="$ans" ;;
	esac
	;;
*)
	$cat <<EOM
A number of extensions are supplied with $package.  Answer "none" 
to include no extensions. 

EOM
	case "$static_ext" in
	''|' ') dflt="$avail_ext" ;;
	*)	dflt="$static_ext" ;;
	esac

	case "$dflt" in
	'')	dflt=none;;
	esac
	rp="What extensions do you wish to include?"
	. ./myread
	case "$ans" in
	none) static_ext='' ;;
	*) static_ext="$ans" ;;
	esac
	;;
esac

set X $dynamic_ext $static_ext
shift
extensions="$*"