Import sendmail 8.13.7
[dragonfly.git] / contrib / sendmail-8.13.7 / devtools / bin / configure.sh
bloba253b1c8f162d38dbddc4d8e9fbf623cbeec9dc0
1 #!/bin/sh
3 # Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
4 # All rights reserved.
6 # By using this file, you agree to the terms and conditions set
7 # forth in the LICENSE file which can be found at the top level of
8 # the sendmail distribution.
11 # $Id: configure.sh,v 8.46 2003/08/20 18:08:35 gshapiro Exp $
14 # Special script to autoconfigure for M4 generation of Makefile
17 SHELL=/bin/sh
18 os=""
19 resolver=""
20 sflag=""
21 bin_dir=`echo $0 | sed -e 's%\/[^/]*$%%'`
22 if [ ! -d $bin_dir ]
23 then
24 bin_dir="."
26 find_prog=$bin_dir/find_in_path.sh
28 while [ ! -z "$1" ]
30 case $1
32 -s) # skip auto-configure
33 sflag=1
34 shift
37 *) # OS definition
38 os=$1
39 shift
41 esac
42 done
44 usewhoami=0
45 usehostname=0
46 for p in `echo $PATH | sed 's/:/ /g'`
48 if [ "x$p" = "x" ]
49 then
50 p="."
52 if [ -f $p/whoami ]
53 then
54 usewhoami=1
55 if [ $usehostname -ne 0 ]
56 then
57 break;
60 if [ -f $p/hostname ]
61 then
62 usehostname=1
63 if [ $usewhoami -ne 0 ]
64 then
65 break;
68 done
69 if [ $usewhoami -ne 0 ]
70 then
71 user=`whoami`
72 else
73 user=$LOGNAME
76 if [ $usehostname -ne 0 ]
77 then
78 host=`hostname`
79 else
80 host=`uname -n`
82 echo "PUSHDIVERT(0)"
83 echo "####################################################################"
84 echo "##### This file is automatically generated -- edit at your own risk"
85 echo '#####' Built by $user@$host
86 echo '#####' on `date` using template OS/$os
87 if [ ! -z "$SITECONFIG" ]
88 then
89 echo '#####' including $SITECONFIG
91 echo '#####' in `pwd` | sed 's/\/tmp_mnt//'
92 echo "####################################################################"
93 echo ""
94 echo "POPDIVERT"
95 echo "define(\`__HOST__', \`$host')dnl"
96 echo "ifdef(\`confMAPDEF',, \`define(\`confMAPDEF', \`')')dnl"
97 echo "ifdef(\`confLIBS',, \`define(\`confLIBS', \`')')dnl"
99 LIBDIRS="$LIBDIRS $LIBPATH"
100 libs=""
101 mapdef=""
102 for l in $LIBSRCH
104 for p in `echo $LIBDIRS | sed -e 's/:/ /g' -e 's/^-L//g' -e 's/ -L/ /g'`
106 if [ "x$p" = "x" ]
107 then
108 p = "."
110 if [ -f $p/lib$l.a -o -f $p/lib$l.so ]
111 then
112 case $l
115 mapdef="$mapdef -DNEWDB"
117 bind|resolv)
118 if [ -n "$resolver" ]
119 then
120 continue
121 else
122 resolver=$l
125 44bsd)
126 if [ "x$resolver" != "xresolv" ]
127 then
128 continue
131 esac
132 libs="$libs -l$l"
133 break
135 done
136 done
138 for p in `echo $PATH | sed 's/:/ /g'`
140 pbase=`echo $p | sed -e 's,/bin,,'`
141 if [ "x$p" = "x" ]
142 then
143 p="."
145 if [ -f $p/mkdep ]
146 then
147 echo "ifdef(\`confDEPEND_TYPE',, \`define(\`confDEPEND_TYPE', \`BSD')')dnl"
149 done
151 if [ -z "$sflag" ]
152 then
153 echo "define(\`confMAPDEF', \`$mapdef' confMAPDEF)dnl"
154 echo "define(\`confLIBS', \`$libs' confLIBS)dnl"
157 if [ ! -z "`$SHELL $find_prog ranlib`" ]
158 then
159 echo "define(\`confRANLIB', \`ranlib')dnl"
162 roff_progs="groff nroff"
163 for roff_prog in $roff_progs
165 if [ ! -z "`$SHELL $find_prog $roff_prog`" ]
166 then
167 found_roff=$roff_prog
168 break;
170 done
172 case $found_roff
174 groff)
175 echo "ifdef(\`confNROFF',,\`define(\`confNROFF', \`$found_roff -Tascii')')dnl"
177 nroff)
178 echo "ifdef(\`confNROFF',,\`define(\`confNROFF', \`$found_roff')')dnl"
181 echo "ifdef(\`confNROFF',,\`define(\`confNO_MAN_BUILD')')dnl"
183 esac