File: configure.sh

package info (click to toggle)
sendmail 8.18.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,268 kB
  • sloc: ansic: 106,906; perl: 7,504; sh: 5,488; makefile: 888
file content (192 lines) | stat: -rwxr-xr-x 3,308 bytes parent folder | download | duplicates (3)
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
187
188
189
190
191
192
#!/bin/sh

# Copyright (c) 1998-2001 Proofpoint, Inc. and its suppliers.
#	All rights reserved.
#
# By using this file, you agree to the terms and conditions set
# forth in the LICENSE file which can be found at the top level of
# the sendmail distribution.
#
#
#	$Id: configure.sh,v 8.48 2013-12-02 22:11:07 gshapiro Exp $

#
#  Special script to autoconfigure for M4 generation of Makefile
#

SHELL=/bin/sh
os=""
resolver=""
sflag=""
bin_dir=`echo $0 | sed -e 's%\/[^/]*$%%'`
if [ ! -d $bin_dir ]
then
	bin_dir="."
fi
find_prog=$bin_dir/find_in_path.sh

while [ ! -z "$1" ]
do
	case $1
	in
	  -s)	# skip auto-configure
		sflag=1
		shift
		;;

	  *)	# OS definition
		os=$1
		shift
		;;
	esac
done

usewhoami=0
usehostname=0
for p in `echo $PATH | sed 's/:/ /g'`
do
	if [ "x$p" = "x" ]
	then
		p="."
	fi
	if [ -f $p/whoami ]
	then
		usewhoami=1
		if [ $usehostname -ne 0 ]
		then
			break;
		fi
	fi
	if [ -f $p/hostname ]
	then
		usehostname=1
		if [ $usewhoami -ne 0 ]
		then
			break;
		fi
	fi
done
if [ $usewhoami -ne 0 ]
then
	user=`whoami`
else
	user=$LOGNAME
fi

if [ $usehostname -ne 0 ]
then
	host=`hostname`
else
	host=`uname -n`
fi

if [ -z "$SOEXT" ]
then
	SOEXT=".so"
fi

echo "PUSHDIVERT(0)"
echo "####################################################################"
echo "##### This file is automatically generated -- edit at your own risk"
echo '#####' Built by $user@$host
echo '#####' on `date` using template OS/$os
if [ ! -z "$SITECONFIG" ]
then
	echo '#####' including $SITECONFIG
fi
echo '#####' in `pwd` | sed 's/\/tmp_mnt//'
echo "####################################################################"
echo ""
echo "POPDIVERT"
echo "define(\`__HOST__', \`$host')dnl"
echo "ifdef(\`confMAPDEF',, \`define(\`confMAPDEF', \`')')dnl"
echo "ifdef(\`confLIBS',, \`define(\`confLIBS', \`')')dnl"

LIBDIRS="$LIBDIRS $LIBPATH"
libs=""
mapdef=""
for l in $LIBSRCH
do
	for p in `echo $LIBDIRS | sed -e 's/:/ /g' -e 's/^-L//g' -e 's/ -L/ /g'`
	do
		if [ "x$p" = "x" ]
		then
			p = "."
		fi
		if [ -f $p/lib$l.a -o -f $p/lib$l$SOEXT ]
		then
			case $l in
			  db)
				mapdef="$mapdef -DNEWDB"
				;;
			  cdb)
				mapdef="$mapdef -DCDB"
				;;
			  bind|resolv)
				if [ -n "$resolver" ]
				then
					continue
				else
					resolver=$l
				fi
				;;
			  44bsd)
				if [ "x$resolver" != "xresolv" ]
				then
					continue
				fi
				;;
			esac
			libs="$libs -l$l"
			break
		fi
	done
done

for p in `echo $PATH | sed 's/:/ /g'`
do
	pbase=`echo $p | sed -e 's,/bin,,'`
	if [ "x$p" = "x" ]
	then
		p="."
	fi
	if [ -f $p/mkdep ]
	then
		echo "ifdef(\`confDEPEND_TYPE',, \`define(\`confDEPEND_TYPE', \`BSD')')dnl"
	fi
done

if [ -z "$sflag" ]
then
	echo "define(\`confMAPDEF', \`$mapdef' confMAPDEF)dnl"
	echo "define(\`confLIBS', \`$libs' confLIBS)dnl"
fi

if [ ! -z "`$SHELL $find_prog ranlib`" ]
then
	echo "define(\`confRANLIB', \`ranlib')dnl"
fi

roff_progs="groff nroff mandoc"
for roff_prog in $roff_progs
do
	if [ ! -z "`$SHELL $find_prog $roff_prog`" ]
	then
		found_roff=$roff_prog
		break;
	fi
done

case $found_roff
in
	groff|mandoc)
		echo "ifdef(\`confNROFF',,\`define(\`confNROFF', \`$found_roff -Tascii')')dnl"
		;;
	nroff)
		echo "ifdef(\`confNROFF',,\`define(\`confNROFF', \`$found_roff')')dnl"
		;;
	*)
		echo "ifdef(\`confNROFF',,\`define(\`confNO_MAN_BUILD')')dnl"
		;;
esac