File: configure.client

package info (click to toggle)
xymon 4.3.30-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,384 kB
  • sloc: ansic: 69,137; sh: 3,601; makefile: 863; javascript: 452; perl: 48
file content (260 lines) | stat: -rwxr-xr-x 6,911 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
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
254
255
256
257
258
259
260
#!/bin/sh

# Configure script for Xymon client
# $Id: configure.client 8052 2019-04-22 18:20:02Z jccleaver $

echo ""
echo "Configuration script for Xymon client"
echo ""

while test "$1" != ""
do
	OPT="$1"; shift

	case "$OPT" in
	  "--help")
	  	cat <<EOF
  To configure Xymon, the following options are available:
     --pcreinclude DIRECTORY  : Specify location of PCRE include files
     --pcrelib DIRECTORY      : Specify location of PCRE libraries
     --make /path/to/gnumake  : Specify location of the GNU make program

  The script will search a number of standard directories for
  all of these files, so you normally do not have to specify any options.
EOF
		exit 0
		;;
	  "--pcreinclude")
	  	USERPCREINC="$1"; shift
		;;
	  "--pcrelib")
	  	USERPCRELIB="$1"; shift
		;;
	  "--make")
	  	MAKE="$1"; shift
		;;
	esac
done

if test -r Makefile
then
	echo "Already configured - remove Makefile to re-configure"
	exit 1
fi

echo "This script asks a few questions and builds a Makefile to compile Xymon"
echo ""

if test "$MAKE" = ""; then
	MAKE=make
fi
echo "Checking your make-utility"
MAKEVER=`$MAKE -version 2>&1 | head -n 1 | awk '{print $1 " " $2}'`
if test "$MAKEVER" != "GNU Make"
then
	echo "GNU make is required to build Xymon."
	echo "If it is available as \"gmake\", run configure as: 'MAKE=gmake $0'"
	exit 1
fi


echo "Xymon normally keeps all of the client configuration files"
echo "on the Xymon server. If you prefer, it is possible to use"
echo "a local client configuration file instead - if so, answer"
echo "'client' to the next question."
echo "NB: Local configuration requires the PCRE libs on each host."
echo ""
echo "Server side client configuration, or client side [server] ?"
if test -z "$CONFTYPE"
then
	read CONFTYPE
fi
if test -z "$CONFTYPE"
then
	CONFTYPE="server"
fi
echo ""

if test "$CONFTYPE" = "client"
then
	echo "Checking for the PCRE libraries"
	. build/pcre.sh
	echo ""
fi
echo ""

MAKE="$MAKE -s" ./build/lfs.sh
if test $? -eq 0; then
	LFS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
else
	LFS=""
fi
echo ""; echo ""

MAKE="$MAKE -s" . ./build/clock-gettime-librt.sh
echo ""; echo ""

echo "What userid will be running Xymon [xymon] ?"
if test -z "$XYMONUSER"
then
	read XYMONUSER
fi
if test -z "$XYMONUSER"
then
	XYMONUSER="xymon"
fi

if test -z "$XYMONTOPDIR"
then
	if test "`uname -s`" = "Darwin"
	then
		# Use "dscl" for locating user information. From Isaac Vetter
		# http://www.xymon.com/archive/2008/02/msg00173.html
		USERDATA="`dscl . -list /Users  | grep $XYMONUSER`"
		if test "$USERDATA" != ""
		then
			echo "Found Directory entry for user: $USERDATA"
		else
			echo "FAILURE: The user $XYMONUSER does not exist locally. Create user and try again."
			exit 1
		fi
		echo ""; echo ""
		HOMEDIR="`dscl . -read /Users/$XYMONUSER | grep HomeDirectory | awk '{print $2}'`"
	else
		USERDATA=`getent passwd $XYMONUSER 2>/dev/null || ypmatch "${XYMONUSER}" passwd || grep "^${XYMONUSER}:" /etc/passwd`
		if test $? -eq 0
		then
			echo "Found passwd entry for user $USERDATA"
		else
			echo "FAILURE: The user $XYMONUSER does not exist. Create user and try again."
			exit 1
		fi
		echo ""; echo ""
		HOMEDIR="`echo $USERDATA|cut -d: -f6`"
	fi
else
	HOMEDIR="$XYMONTOPDIR"
fi

echo "Where do you want the Xymon installation [${HOMEDIR}] ?"
if test -z "$XYMONTOPDIR"
then
	read XYMONTOPDIR
fi
if test -z "$XYMONTOPDIR"
then
	XYMONTOPDIR=${HOMEDIR}
fi
if test -d "$XYMONTOPDIR"
then
	echo "OK, will configure to use $XYMONTOPDIR as the Xymon toplevel directory"
else
	echo "WARNING: $XYMONTOPDIR does not exist."
fi
echo ""; echo ""

echo "What is the IP-address of your Xymon server [127.0.0.1] ? "
if test -z "$XYMONHOSTIP"
then
	read XYMONHOSTIP
fi
if test -z "$XYMONHOSTIP"
then
	echo "** NOTE: Using 127.0.0.1 (loopback), but it is probably not what you want **"
	XYMONHOSTIP=127.0.0.1
fi
echo ""; echo ""

XYMONHOSTOS=`uname -s | tr '[A-Z]' '[a-z]'`

echo "# Toplevel Makefile for Xymon"    > Makefile

echo "BUILDTOPDIR=\`pwd\`"               >>Makefile
echo "CLIENTONLY = yes"                  >>Makefile
if test "$CONFTYPE" = "client"
then
	echo "LOCALCLIENT = yes"         >>Makefile
else
	echo "LOCALCLIENT = no"          >>Makefile
fi
echo ""                                  >>Makefile
echo "# configure settings for Xymon"    >>Makefile
echo "#"                                 >>Makefile
echo "# Toplevel dir"                    >>Makefile
echo "XYMONTOPDIR = $XYMONTOPDIR"        >>Makefile
echo ""                                  >>Makefile
echo "# Xymon settings follows"          >>Makefile
echo "#"                                 >>Makefile
echo "# Username running Xymon"          >>Makefile
echo "XYMONUSER = $XYMONUSER"            >>Makefile
echo "# Xymon server IP-address"         >>Makefile
echo "XYMONHOSTIP = $XYMONHOSTIP"        >>Makefile
echo "# Large File Support settings"     >>Makefile
echo "LFSDEF = $LFS"                     >>Makefile
echo "LIBRTDEF = $LIBRTDEF"              >>Makefile

echo "" >>Makefile
if test -r build/Makefile.`uname -s | tr '/' '_'`
then
	echo "include build/Makefile.`uname -s | tr '/' '_'`" >>Makefile
	echo ""
	echo "Using `uname -s | tr '/' '_'` Makefile settings"
	echo ""
else
	echo "include build/Makefile.generic" >>Makefile
	echo ""
	echo "Using GENERIC Makefile settings (uname -s is `uname -s`)"
	echo ""
	echo "If this fails, change the compile settings in Makefile"
	echo ""
	echo "I would appreciate it if you send the changes to"
	echo "xymon-owner@xymon.com so I can include it in the next version."
	echo ""
fi
echo "" >>Makefile
if test "$INSTALLBINDIR" != ""; then
	echo "INSTALLBINDIR = $INSTALLBINDIR"   >>Makefile
fi
if test "$INSTALLETCDIR" != ""; then
	echo "INSTALLETCDIR = $INSTALLETCDIR"   >>Makefile
fi
if test "$INSTALLEXTDIR" != ""; then
	echo "INSTALLEXTDIR = $INSTALLEXTDIR"   >>Makefile
fi
if test "$INSTALLTMPDIR" != ""; then
	echo "INSTALLTMPDIR = $INSTALLTMPDIR"   >>Makefile
fi
if test "$INSTALLWEBDIR" != ""; then
	echo "INSTALLWEBDIR = $INSTALLWEBDIR"   >>Makefile
fi
if test "$INSTALLWWWDIR" != ""; then
	echo "INSTALLWWWDIR = $INSTALLWWWDIR"   >>Makefile
fi
echo "" >>Makefile
if test "$CONFTYPE" = "client"
then
	if test "$PCREINC" != ""; then
		echo "PCREINCDIR = -I$PCREINC"   >>Makefile
    	fi
    	if test "$PCRELIB" != ""; then
		echo "PCRELIBS = -L$PCRELIB -lpcre" >>Makefile
		echo "RPATHVAL += ${PCRELIB}"       >>Makefile
	else
		echo "PCRELIBS = -lpcre"         >>Makefile
    	fi
fi
echo "#"                                 >>Makefile
echo "# Add local CFLAGS etc. settings here" >>Makefile
echo "" >>Makefile
echo "include build/Makefile.rules" >> Makefile
echo "" >> Makefile

echo ""; echo ""
echo "Created Makefile with the necessary information to build Xymon"
echo "Some defaults are used, so do look at the Makefile before continuing."
echo ""

echo "Configuration complete - now run $MAKE (GNU make) to build the tools"

exit 0