aboutsummaryrefslogtreecommitdiff
path: root/ircd/buildm4
blob: bba769c79911e4a19598aab9d819e8966dbcdb58 (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
#! /bin/sh
# IRC - Internet Relay Chat, ircd/buildm4
# Copyright (C) 1993, 1994 Darren Reed
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 1, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# $Id: buildm4,v 1.11 1999/02/21 00:33:45 kalt Exp $
#

#
# If only this was a perl script...*sigh*
#
INCLUDE=`../support/config.guess`
# Installation with absolute path now (Kratz)
M4=$1
/bin/rm -f $M4
egrep "^#def[^P]*PATCHLEVEL" ../common/patchlevel.h | \
sed -e 's/[^\"]*\"\([^\"]*\)\"/define(VERSION,\1)/' >>$M4
DEBUG=`egrep "^#define[		]*DEBUGMODE" config.h`
if [ -n "$DEBUG" ] ; then
	echo "define(DEBUGMODE,1)" >>$M4
else
	echo "undefine(DEBUGMODE)" >>$M4
fi
HOST="`hostname | sed -e 's/\([a-zA-Z0-9\-]*\).*/\1/'`"
echo "define(HOSTNAME,$HOST)" >> $M4

echo "define(USER,$USER)" >>$M4

PORT=`egrep '^#define[ 	]*PORT[ 	]*[0-9]*' ../$INCLUDE/config.h | \
	sed -e 's/[^0-9]*\([0-9]*\).*/\1/'`
echo "define(PORT,$PORT)" >> $M4

PING=`egrep '^#define[ 	]*PINGFREQUENCY[ 	]*[0-9]*' ../$INCLUDE/config.h\
	| sed -e 's/[^0-9]*\([0-9]*\).*/\1/'`
echo "define(PFREQ,$PING)" >> $M4

CONT=`egrep '^#define[ 	]*CONNECTFREQUENCY[ 	]*[0-9]*' ../$INCLUDE/config.h\
	| sed -e 's/[^0-9]*\([0-9]*\).*/\1/'`
echo "define(CFREQ,$CONT)" >> $M4

MAXL=`egrep '^#define[ 	]*MAXIMUM_LINKS[ 	]*[0-9]* | head -1' \
	../$INCLUDE/config.h | sed -e 's/[^0-9]*\([0-9]*\).*/\1/'`
echo "define(MAXLINKS,$MAXL)" >> $M4

DOM=`egrep '^domain' /etc/resolv.conf | \
	sed -e 's/^domain[ 	]*\([^	 ]*\).*/\1/'`
echo "define(DOMAIN,$DOM)" >> $M4

cat >>$M4 <<_EOF_
define(CL,\`ifelse(len(\$1),0,0,\$1)')
define(MAXSENDQ,0)
define(HOST,\$1)
define(HOSTM,\$1)
define(ID,*@\$1)
define(PASS,\$1)
define(PING,\`ifelse(len(\$1),0,PFREQ,\$1)')
define(APORT,\`ifelse(len(\$1),0,PORT,\$1)')
define(FREQ,\`ifelse(len(\$1),0,CFREQ,\$1)')
define(SENDQ,\`ifelse(len(\$1),0,MAXSENDQ,\$1)')
define(MAX,\`ifelse(len(\$1),0,MAXLINKS,\$1)')
define(UID,\`ifelse(len(\$1),0,unknown,\$1)')
define(CPORT,\$1)
define(SERV,\$1)
define(ADMIN,A:\$1:\$2:\$3:\$4:\$5)
define(ALLOW,N:\`HOST(\$1)':\`PASS(\$2)':\`SERV(\$3)':\`HOSTM(\$4)':\`CL(\$5)')
define(BAN,K:\$1:\$2:\$3:\$4:)
define(BANIDENT,k:\$1:\$2:\`UID(\$3)':\$4:)
define(CLASS,Y:\$1:\`PING(\$2)':\$3:\`MAX(\$4)':\`SENDQ(\$5)':\$6:\$7)
define(CLIENT,I:\`HOST(\$1)':\`PASS(\$2)':\`ifelse(len(HOST(\$3)),0,\$1,\$3)':\
\`APORT(\$4)':\`CL(\$5)')
define(RESTRICTED,I:\`HOST(\$1)':\`PASS(\$2)':\
\`ifelse(len(HOST(\$3)),0,\$1,\$3)':\`APORT(\$4)':\`CL(\$5)')
define(BOUNCE,B:\$1::\$2:\$3:)
define(CONNECT,C:\`HOST(\$1)':\`PASS(\$2)':\`SERV(\$3)':\
\`CPORT(\$4)':\`CL(\$5)')
define(EXCLUDEVERSION,V:\$1:\$2:\`ifelse(len(\$3),0,*,\$3)'::)
define(ME,M:\$1:\$2:\$3:\$4:\$5
P:*:*:*:\$4)
define(HUB,H:\`ifelse(len(\$2),0,*,\$2)':*:\$1)
define(LEAF,L:\`ifelse(len(\$2),0,*,\$2)':*:\$1:1)
define(SERVER,\`
CONNECT(\$1,\$2,\$3,\$5,\$6)
ALLOW(\$1,\$2,\$3,\$4,\$6)
')
_EOF_