forked from bmybbs/bmybbs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.in
373 lines (319 loc) · 9.94 KB
/
configure.in
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
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
dnl ====================================================
dnl configure.in for Firebird BBS v3.0K
dnl
dnl ====================================================
AC_INIT("include/bbs.h")
dnl ------------------------------------------
dnl ---- Checking C compiler ----
dnl ------------------------------------------
echo " ........................... "
echo " ... testing C Compiler ... "
echo " ........................... "
AC_PROG_CC
CFLAGS="-O"
AC_PROG_INSTALL
AC_LANG_C
dnl ------------------------------------------
dnl ---- Checking system type ----
dnl ------------------------------------------
echo " ........................... "
echo " ... testing system type ... "
echo " ........................... "
AC_CANONICAL_SYSTEM
case ${target} in
*sun-sunos*)
systype=SunOS
OS_DEF=""
# CC="cc"
# CFLAGS="-O2"
;;
*sun-solaris*)
systype=Solaris
OS_DEF="-DSOLARIS -DSYSV"
# CC="gcc"
# CFLAGS="-traditional -O2"
LIBS="-lsocket -lnsl -L/usr/ucblib -lucb"
;;
*-freebsd*|*-openbsd*|*-netbsd*|*-bsdi*)
systype=NetBSD_OR_FreeBSD
OS_DEF="-DBSD44"
# CC="cc"
# CFLAGS=""
LIBS=""
;;
*hp-hpux*)
systype=HP_UX
OS_DEF="-DHP_UX -DSYSV"
# CC="gcc"
# CFLAGS="-traditional -O2"
LIBS=""
;;
*ibm-aix*)
systype=IBM_AIX
OS_DEF="-DAIX -DSYSV"
# CC="cc"
# CFLAGS="-O"
LIBS="-lbsd"
;;
*sgi-irix*)
systype=SGI_IRIX
OS_DEF="-DIRIX -DSYSV"
# CC="cc"
# CFLAGS="-O"
LIBS=""
;;
*dec-osf*)
systype=DEC_OSF
OS_DEF=""
# CC="gcc"
# CFLAGS="-O2"
LIBS="-lbsd"
;;
*-linux*)
systype=LINUX
OS_DEF="-DLINUX"
CC="gcc"
CFLAGS="-O2"
AC_DEFUN(TRY_COMPILE_OPTIONS,[
TEMP_CFLAGS=${CFLAGS}
CFLAGS="${CFLAGS} -$1"
AC_TRY_COMPILE(,,,echo "-$1 is not supported by this gcc version!";CFLAGS="${TEMP_CFLAGS} $2";if test $2 != "" ; then echo "use $2 instead!";fi)])
if test -e "/proc/cpuinfo" ; then
intel="i386: 30 32 34 \n\
i486: 40 41 42 43 44 45 47 48 \n\
pentium: 51 52 \n\
pentium-mmx: 54 \n\
pentiumpro: 61 \n\
pentium2: 63 65 66 \n\
pentium3: 67 68 610 611 \n\
pentium4: 150 151 152 "
amd="i586: 50 51 52 53 \n\
k6: 56 57 \n\
k6-2: 58 \n\
k6-3: 59 \n\
athlon: 61 62 63 64 66 67 68 "
CPU_TYPE="known"
CPU_FAMILY=`cat /proc/cpuinfo | grep "cpu family"| cut -b 14- | head -1`
CPU_MODEL=`cat /proc/cpuinfo |grep -v "model name"| grep model|cut -b 10- | head -1`
CPU_NAME=`cat /proc/cpuinfo | grep "model name"|cut -d ':' -f 2|head -1`
CPU_VENDOR=`cat /proc/cpuinfo | grep "vendor_id"|cut -d ':' -f 2|head -1`
CPU_FAMILY=${CPU_FAMILY}
CPU_MODEL=${CPU_MODEL}
CPU_NAME=${CPU_NAME}
CPU_VENDOR=${CPU_VENDOR}
if test $CPU_VENDOR = "GenuineIntel" ; then
CPU_OPTIONS=`echo -e $intel|grep ${CPU_FAMILY}${CPU_MODEL}|cut -d : -f 1`
fi
if test $CPU_VENDOR = "AuthenticAMD" ; then
CPU_OPTIONS=`echo -e $amd|grep ${CPU_FAMILY}${CPU_MODEL}|cut -d : -f 1`
fi
CPU_OPTIONS="$CPU_OPTIONS"
fi
echo "Detected CPU: $CPU_OPTIONS"
TRY_COMPILE_OPTIONS("mcpu=${CPU_OPTIONS}",-mcpu=i686)
TRY_COMPILE_OPTIONS("march=${CPU_OPTIONS}",-march=i686)
if cat /proc/cpuinfo|grep 'flags'|grep ' mmx'; then
TRY_COMPILE_OPTIONS(mmmx)
fi
if cat /proc/cpuinfo|grep 'flags'|grep ' sse'; then
TRY_COMPILE_OPTIONS(msse)
fi
TRY_COMPILE_OPTIONS(pipe);
;;
*)
systype=UNKNOWN
LIBS="-lbsd"
;;
esac
dnl ------------------------------------------
dnl ---- set RPC library option for bbsrf ----
dnl ------------------------------------------
dnl if test ${systype} = "LINUX" ; then
dnl RPCSVC=""
dnl else
dnl RPCSVC="-lrpcsvc"
dnl fi
default_directory="/usr /usr/local"
dnl ------------------------------------------
dnl ---- check library and function ----------
dnl ------------------------------------------
dnl ------------------------------------------
dnl - check for mysql , copy from snort 1.81 -
dnl ------------------------------------------
AC_DEFUN(FAIL_MESSAGE,[
echo
echo
echo "**********************************************"
echo " ERROR: unable to find" $1
echo " checked in the following places"
for i in `echo $2`; do
echo " $i"
done
echo "**********************************************"
echo
exit
])
AC_ARG_WITH(mysql, [ --with-mysql=DIR support for mysql])
if test "$with_mysql" != "no"; then
if test "$with_mysql" = "yes"; then
mysql_directory="$"; mysql_fail="yes"
elif test "$with_mysql" = ""; then
mysql_directory="$default_directory"; mysql_fail="no"
else
mysql_directory="$with_mysql"; mysql_fail="yes"
fi
AC_MSG_CHECKING("for mysql")
for i in $mysql_directory; do
if test -r $i/include/mysql/mysql.h; then
MYSQL_DIR=$i
MYSQL_INC_DIR=$i/include/mysql
elif test -r $i/include/mysql.h; then
MYSQL_DIR=$i
MYSQL_INC_DIR=$i/include
fi
done
if test -z "$MYSQL_DIR"; then
if test "$mysql_fail" != "no"; then
tmp=""
for i in $mysql_directory; do
tmp="$tmp $i/include $i/include/mysql"
done
FAIL_MESSAGE("mysql headers (mysql.h)", $tmp)
else
AC_MSG_RESULT(no)
fi
else
for i in lib lib/mysql; do
str="$MYSQL_DIR/$i/libmysqlclient.so"
for j in `echo $str`; do
if test -r $j; then
MYSQL_LIB_DIR="$MYSQL_DIR/$i"
break 2
fi
done
done
if test -z "$MYSQL_LIB_DIR"; then
if test "$mysql_fail" != "no"; then
FAIL_MESSAGE("mysqlclient library",
"$MYSQL_DIR/lib $MYSQL_DIR/lib/mysql")
else
AC_MSG_RESULT(no)
fi
else
AC_MSG_RESULT(yes)
CPPFLAGS="${CPPFLAGS} -I${MYSQL_INC_DIR} -DENABLE_MYSQL"
LIBSQL="-L${MYSQL_LIB_DIR} -lmysqlclient"
fi
fi
fi
AC_CHECK_HEADER(pty.h,[
AC_TRY_COMPILE(
[#include <pty.h>],
[int m,s;
char * line;
openpty(&m,&s,line,0,0);],
[CFLAGS="$CFLAGS -DCONF_HAVE_OPENPTY"],
[])],[])
AC_CHECK_LIB(iconv, iconv_open, [WWW_LIBS="${WWW_LIBS} -liconv"])
AC_CHECK_LIB(ghthash, ght_create, [WWW_LIBS="${WWW_LIBS} -lghthash"
WWW_CPPFLAGS="${WWW_CPPFLAGS} -DENABLE_GHTHASH"])
AC_CHECK_LIB(fcgi, FCGI_Accept, [WWW_LIBS="${WWW_LIBS} -lfcgi"
WWW_CPPFLAGS="${WWW_CPPFLAGS} -DENABLE_FASTCGI"])
dnl ------------------------------------------
dnl default argument,copy from ucd-snmp-4.2.2
dnl ------------------------------------------
AC_ARG_WITH(defaults,
[
Miscellaneous:
--with-defaults Use defaults for prompted values.],
defaults="yes",defaults="no")
AC_DEFUN(ASK4,[
echo -n "$2 --> [[$3]] "
if test "x$defaults" = "xno" ; then read $1;else echo;fi
$1=${$1:-$3}])
dnl ------------------------------------------
dnl Asking about local BBS configuration
dnl ------------------------------------------
echo " .................................. "
echo " Please fill data for your BBS "
echo " .................................. "
if test -f site/bbsconfig; then
. site/bbsconfig
else
. bbsconfig
fi
ASK4(BBS_HOME,Home directory of BBS,$LAST_BBS_HOME)
ASK4(BBS_UID,UID of BBS,$LAST_BBS_UID)
ASK4(BBS_GID,GID of BBS,$LAST_BBS_GID)
ASK4(BBS_USER,USER of BBS,$LAST_BBS_USER)
ASK4(BBS_ID,The ID of your site,$LAST_BBS_ID)
ASK4(BBS_CNAME,The name of your site,$LAST_BBS_CNAME)
ASK4(BBS_DOMAIN,The domain name of your site,$LAST_BBS_DOMAIN)
ASK4(BBS_IP,The ip address of your site,$LAST_BBS_IP)
ASK4(BBS_LOC,The location of your site,$LAST_BBS_LOC)
ASK4(MAXUSERS,Maximum number of users,$LAST_MAXUSERS)
ASK4(MAXBOARD,Maximum number of boards,$LAST_MAXBOARD)
ASK4(MAXACTIVE,Maximum number of on-line users,$LAST_MAXACTIVE)
ASK4(MAXACTIVERUN,Runtime Maximum number of on-line users,$LAST_MAXACTIVERUN)
ASK4(BBS_PORT,BBS listen port,$LAST_BBS_PORT)
ASK4(BBS_BIG5_PORT,BBS listen port(BIG5),$LAST_BBS_BIG5_PORT)
if test "$with_mysql" != "no"; then
ASK4(BBS_SQLDB,MySQL DATABASE NAME,$LAST_BBS_SQLDB)
ASK4(BBS_SQLUSER,MySQL USER NAME,$LAST_BBS_SQLUSER)
ASK4(BBS_SQLPASSWD,MySQL USER PASSWORD,$LAST_BBS_SQLPASSWD)
fi
ASK4(CGIPATH,cgi install directory,$LAST_CGIPATH)
ASK4(HTMPATH,html install directory,$LAST_HTMPATH)
ASK4(SMAGIC,the initial mark string for webpage,$LAST_SMAGIC)
echo "........................................"
#CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64"
CTESTFLAGS=`echo $CFLAGS|sed -e 's/-O[[]1-9[]]* //g' |sed -e 's/-m[[^ ]]* //g'`
dnl ---------------------------------------------------
dnl ---- Substitute system configuration variables ----
dnl ---------------------------------------------------
AC_SUBST(systype)
AC_SUBST(RPCSVC)
AC_SUBST(OS_DEF)
AC_SUBST(CC)
AC_SUBST(CFLAGS)
AC_SUBST(CTESTFLAGS)
AC_SUBST(LIBS)
AC_SUBST(WWW_LIBS)
AC_SUBST(WWW_CPPFLAGS)
AC_SUBST(OS_DEF)
AC_SUBST(BBS_HOME)
AC_SUBST(BBS_USER)
AC_SUBST(BBS_UID)
AC_SUBST(BBS_GID)
AC_SUBST(CSIE_DEF)
AC_SUBST(BBS_CNAME)
AC_SUBST(BBS_ID)
AC_SUBST(BBS_DOMAIN)
AC_SUBST(BBS_IP)
AC_SUBST(BBS_LOC)
AC_SUBST(MAXUSERS)
AC_SUBST(MAXBOARD)
AC_SUBST(MAXACTIVE)
AC_SUBST(MAXACTIVERUN)
AC_SUBST(BBS_PORT)
AC_SUBST(BBS_BIG5_PORT)
AC_SUBST(PTYEXEC)
AC_SUBST(LIBSQL)
AC_SUBST(BBS_SQLDB)
AC_SUBST(BBS_SQLUSER)
AC_SUBST(BBS_SQLPASSWD)
AC_SUBST(CGIPATH)
AC_SUBST(HTMPATH)
AC_SUBST(SMAGIC)
dnl ------------------------------------------
dnl ---- Output file ----
dnl ------------------------------------------
AC_OUTPUT(Makefile Makefile.Base src/Makefile include/config.h Install.sh mail2bbs/bbsmail_wrap yftpd/ftpmotd, [chmod 700 Install.sh])
cat << EOF
........................................................................
You may review the Makefile now. Then, type 'make' to build your system.
........................................................................
EOF
dnl --------------------
dnl END of configure.in
dnl --------------------