File: makeconfig

package info (click to toggle)
sendfile 2.1b.20080616-5.2
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 1,568 kB
  • sloc: ansic: 13,128; sh: 4,043; perl: 844; makefile: 145; java: 36; csh: 3
file content (253 lines) | stat: -rwxr-xr-x 6,104 bytes parent folder | download | duplicates (4)
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
#!/bin/sh

# Here are the default settings for compiling sendfile.
#
# You can change them by editing this file or put your variables in one of 
# these files:
# 	$SF_DEVELENV
# 	.develenv
#	$HOME/.develenv
# or simply call: makeconfig CC=gcc ...

# default compiling settings
CC=gcc
LDFLAGS=

case $DEB_BUILD_OPTIONS in
    *debug*)	CFLAGS="-g";;
    *)		CFLAGS="-O2";;
esac


# default installation settings
SPOOL=/var/spool/sendfile
BINDIR=/usr/local/bin
MANDIR=/usr/local/man
CONFIG=/usr/local/etc
SERVERDIR=/usr/local/sbin
INETDCONF=/etc/inetd.conf # xinetd will be automaticly recognized
SERVICES=/etc/services

############################# OPTIONAL SETTINGS ##############################

# Normaly these programs will be called via $PATH, so define them ONLY, if you
# really need absolute paths.

#TAR=/usr/bin/tar
#GZIP=/usr/bin/gzip
#BZIP2=/usr/local/bin/bzip2
#PGP=/usr/local/bin/pgp
#RECODE=/usr/local/bin/recode
#METAMAIL=/usr/local/bin/metamail
#SENDMAIL=/usr/lib/sendmail
           
######################### END OF USER CONFIGURATION ##########################

export CC CFLAGS LINK LDFLAGS BINDIR SERVERDIR MANDIR CONFIG SPOOL FIFODIR
export INETDCONF SERVICES VERSION
export TAR GZIP BZIP2 PGP RECODE METAMAIL SENDMAIL

topmake() {
  sed "s/!SYSTEM/$SYSTEM/g
       s/!VERSION/$VERSION/g
      " develop/makefile.top > Makefile
}

# determine sendfile version and revision
eval `grep VERSION= develop/configure.in`

# only create new toplevel Makefile?
if [ "$1" = clean ]; then
  topmake
  exit
fi

# source in developer environment variables if found
if [ -f "$SF_DEVELENV" ]; then
  . $SF_DEVELENV
elif [ -f .develenv ]; then
  . .develenv
elif [ -f $HOME/.develenv ]; then
  . $HOME/.develenv  
fi

# check at last if there are env-settings in $*
case "$1" in 
  *=*) eval "$@";;
esac  

LINK=${LINK:-$CC}

cd develop
rm -f config.cache
./configure \
    --libexecdir=$SERVERDIR \
    --bindir=$BINDIR \
    --mandir=$MANDIR \
    --sysconfdir=$CONFIG \
  || exit $?

if [ -d /var/run ]; then FIFODIR=/var/run/sfm; fi

SYSTEM=`./config.guess`

case "$SYSTEM" in
  *linux*)	SYSTEM=LINUX;;
  *sunos4*)	SYSTEM=SOLARIS1
  		if [ -f /lib/lib44bsd.a -o -f /usr/lib/lib44bsd.a ]; then
		  LIBS="-l44bsd"
		fi;;
  *solaris2*)	SYSTEM=SOLARIS2;;
  *hp-ux*)	SYSTEM=HPUX;;
  *aix*)	SYSTEM=AIX;;
  *irix*)	SYSTEM=IRIX;;
  *next*)	SYSTEM=NEXT;;
  *convex*)	SYSTEM=CONVEXOS;;
  *osf*)	SYSTEM=OSF1;;
  *bsd*)	SYSTEM=BSD;;
  *darwin*)	SYSTEM=DARWIN;;
  *)		SYSTEM=UNKNOWN;;
#  *)		SYSTEM=`uname -a | tr '[a-z]' '[A-Z]'`
#  		case "$SYSTEM" in
#		  *SUNOS*)  case `echo $SYSTEM | $AWK '{print $3}'` in
#			      4*) SYSTEM=SOLARIS1;;
#			    esac;;
#		  *)	    SYSTEM=UNKNOWN;;
#		esac;;
esac

cd ../src
echo now in `pwd`

if [ "$SYSTEM" != "LINUX" ]
then
for i in nsl socket readline; do
  if grep -i "have_lib$i 1" config.h >/dev/null; then LIBS="$LIBS -l$i"; fi
done
case "$LIBS" in
  *readline*) LIBS="$LIBS -L/usr/lib/termcap -ltermcap";;
esac
fi

echo creating globals.h

cat <<EOD>globals.h
/*
 * Do not edit this file!
 * It is autogenerated by "makeconfig" and will be overwritten next time!
 * If you want to change some values, so do it in "makeconfig".
 */

#define BINDIR		"$BINDIR"
#define MANDIR		"$MANDIR"
#define SERVERDIR	"$SERVERDIR"

#define CONFIG		"$CONFIG/sendfile.cf"
#define ALIASES		"$CONFIG/sendfile.aliases"
#define ALLOW		"$CONFIG/sendfile.allow"
#define DENY		"$CONFIG/sendfile.deny"

#define SPOOL    	"$SPOOL"
#define OUTGOING	"$SPOOL/OUTGOING"
#define INLOG		"$SPOOL/LOG/in"
#define OUTLOG		"$SPOOL/LOG/out"

#define RECEIVE	 	"$BINDIR/receive"
#define TAR	 	"${TAR:-tar}"
#define GZIP	 	"${GZIP:-gzip}"
#define BZIP2	 	"${BZIP2:-bzip2}"
#define PGP	 	"${PGP:-pgp}"
#define RECODE	 	"${RECODE:-recode}"
#define METAMAIL 	"${METAMAIL:-metamail}"
#define SENDMAIL 	"${SENDMAIL:-/usr/lib/sendmail}"
#define FIFODIR  	"${FIFODIR:-/tmp/sfm}"	

#define DBF		 "/var/log/sendfiled.dbg"

#define DATEFORMAT	"%Y-%m-%d %H:%M:%S"	/* see strftime(3) */
#define CHARSET		"ISO_8859-1:1987"	/* this is ISO Latin 1 */
#define PROTOCOL 	"SAFT"
#define SAFT	  	487	/* SAFT tcp port */
#define DAYSEC 		86400	/* seconds per day */
#define OVERSIZE  	32768	/* string oversize length */
#define MAXLEN	  	4096	/* max length of various strings */
#define FLEN	  	256	/* file name length */
#define DLEN	  	30	/* date string length */
#define PACKET	  	512	/* data size per packet */

#undef  DEBUG			/* more debugging output */
#undef  ALT_MESSAGES		/* alternative user message format */
#undef  RESPECT_MAIL_ALIASES	/* look for elm aliases, too */
#undef  ENABLE_MULTIPROTOCOL	/* ipv6 support for Linux */

#ifdef ENABLE_MULTIPROTOCOL
#define SERVICE         "saft"  /* service entry for saft */
#define PORT_STRING     "487"   /* SAFT tcp port in ASCII text */
#endif
EOD

cat <<EOD>>config.h
#define SYSTEM "$SYSTEM"

#ifdef NEXT
  #define _POSIX_SOURCE
  #define S_IRUSR _S_IRUSR
  #define S_IWUSR _S_IWUSR
  #define S_IWGRP 0000020
  #define S_IXUSR _S_IXUSR
  #define S_IRWXG 0000070
  #define S_IRWXO 0000007
  #define S_IRWXU 0000700
  #define S_ISDIR(mode)   (((mode) & (_S_IFMT)) == (_S_IFDIR))
  #define S_ISREG(mode)   (((mode) & (_S_IFMT)) == (_S_IFREG))
#endif

#if defined(SOLARIS2)
  #define __EXTENSIONS__
#endif

#if defined(LINUX) || defined(BSD)
  #ifndef HAVE_STRERROR
    #define HAVE_STRERROR
  #endif
  #ifndef _POSIX_SOURCE
    #define _POSIX_SOURCE
  #endif
  #ifndef __USE_BSD
    #define __USE_BSD
  #endif
#endif

#ifndef _GNU_SOURCE
  #define _GNU_SOURCE
#endif

/* from /usr/include/features.h */
#ifndef _LARGEFILE_SOURCE
  #define _LARGEFILE_SOURCE
  #define _LARGEFILE64_SOURCE
  #define _FILE_OFFSET_BITS 64
#endif

EOD

case $CC in
  gcc*)  CFLAGS="$CFLAGS -Wall"
esac

#case `uname -a 2>/dev/null` in
#  *\ moep\ *|*\ juhu\ *) CFLAGS="-Wall -ansi -pedantic -DBETA";;
#  *\ bofh.*)		 CFLAGS="-Wall -ansi -pedantic -O2 -DBETA";;
#esac

echo creating Makefile
sed "s^!CC^$CC^g
     s^!CFLAGS^$CFLAGS^g
     s^!SYSTEM^$SYSTEM^g
     s^!LINK^$LINK^g
     s^!LDFLAGS^$LDFLAGS^g
     s^!LIBS^$LIBS^g
   " ../develop/makefile.src > Makefile

cd ..
topmake