-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.in
408 lines (382 loc) · 14 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
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
dnl Process this file with autoconf to produce a configure script.
AC_INIT([qico],[0.55si],[sisoft@bk.ru])
AC_REVISION([$Id: configure.in,v 1.30 2004/06/19 22:31:57 sisoft Exp $])
AC_PREREQ(2.53)
AM_CONFIG_HEADER([config.h])
AC_CONFIG_SRCDIR([src/main.c])
AM_INIT_AUTOMAKE([qico],[0.55si])
AM_MAINTAINER_MODE
dnl Checks for programs.
AC_PROG_CC
AC_PROG_AWK
AC_PROG_INSTALL
AM_PROG_LEX
AC_PROG_YACC
AC_PROG_MAKE_SET
AC_PROG_GCC_TRADITIONAL
AM_WITH_DMALLOC
dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_DIRENT
AC_HEADER_TIME
AC_HEADER_SYS_WAIT
AC_HEADER_TIOCGWINSZ
AM_SYS_POSIX_TERMIOS
AC_CHECK_HEADERS([stddef.h arpa/inet.h fcntl.h locale.h netdb.h netinet/in.h])
AC_CHECK_HEADERS([sys/cdefs.h sys/ioctl.h sys/socket.h sys/time.h syslog.h])
AC_CHECK_HEADERS([termios.h unistd.h utime.h libutil.h libgen.h sys/param.h])
AC_CHECK_HEADERS([errno.h sys/vfs.h sys/statfs.h sys/statvfs.h sys/mount.h])
dnl whether syslog.h and sys/syslog.h may both be included
AC_CHECK_HEADER([sys/syslog.h],[AC_DEFINE(HAVE_SYSLOG_AND_SYS_SYSLOG,1,[Could <syslog.h> and <sys/syslog.h> be included in one file])],,[
#define SYSLOG_NAMES
#include <syslog.h>])
dnl Checks for library functions.
AC_FUNC_FNMATCH
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_STRFTIME
AC_FUNC_UTIME_NULL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([getcwd getpass gettimeofday memmove mktime])
AC_CHECK_FUNCS([setlocale statfs statvfs strcasecmp strerror])
AC_CHECK_FUNCS([strncasecmp strspn strtol strtoul uname vsnprintf])
AC_REPLACE_FUNCS([strsep usleep getsid strcspn])
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SIGNAL
AC_STRUCT_TM
AC_CHECK_SIZEOF([char],[1])
AC_CHECK_SIZEOF([short],[2])
AC_CHECK_SIZEOF([int],[4])
AC_CHECK_SIZEOF([long],[4])
AC_CHECK_TYPE([socklen_t],,AC_DEFINE(socklen_t,[unsigned int],[Define to `unsigned int' if <sys/types.h> does not define]))
AC_C_BIGENDIAN
AC_CHECK_MEMBER([struct tm.tm_gmtoff],[AC_DEFINE(TM_HAVE_GMTOFF,1,[Define to 1 if 'struct tm' have 'tm_gmtoff' field])],,[
#ifdef TIME_WITH_SYS_TIME
#include <sys/time.h>
#include <time.h>
#else
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#else
#include <time.h>
#endif
#endif
])
AC_CHECK_MEMBER([struct statfs.f_bavail],[AC_DEFINE(STATFS_HAVE_F_BAVAIL,1,[Define to 1 if 'struct statfs' have 'f_bavail' field])],,[#include <sys/statfs.h>])
AC_CHECK_MEMBER([struct statvfs.f_bavail],[AC_DEFINE(STATVFS_HAVE_F_BAVAIL,1,[Define to 1 if 'struct statvfs' have 'f_bavail' field])],,[#include <sys/statvfs.h>])
AC_CHECK_DECL([facilitynames],[AC_DEFINE(HAVE_SYSLOG_FAC_NAMES,1,[Define to 1 if 'facilitynames' defined in syslog headers])],,[
#include <stdlib.h>
#define SYSLOG_NAMES
#include <syslog.h>
#ifdef HAVE_SYSLOG_AND_SYS_SYSLOG
# include <sys/syslog.h>
#endif])
AC_CHECK_DECL([prioritynames],[AC_DEFINE(HAVE_SYSLOG_PRI_NAMES,1,[Define to 1 if 'facilitynames' defined in syslog headers])],,[
#include <stdlib.h>
#define SYSLOG_NAMES
#include <syslog.h>
#ifdef HAVE_SYSLOG_AND_SYS_SYSLOG
# include <sys/syslog.h>
#endif])
AC_CHECK_DECL([TIOCSCTTY],[AC_DEFINE(HAVE_TIOCSCTTY,1,[Define to 1 if system have 'TIOCSCTTY' ioctl()])],,[
#include <stdlib.h>
#include <sys/ioctl.h>
#include <termios.h>])
AC_CHECK_DECL([EIDRM],AC_DEFINE(HAVE_EIDRM,1,[Define to 1 if system defines 'EIDRM' errno value]),,[
#include <stdlib.h>
#include <errno.h>])
AC_CHECK_DECLS([STDIN_FILENO,STDOUT_FILENO,STDERR_FILENO],AC_DEFINE(HAVE_STDXXX_FILENO,1,[Define to 1 if system defines 'STDxxx_FILENO' constants]),,[
#include <unistd.h>])
dnl Checking for broken basename
AC_CACHE_CHECK([for nonbroken basename implementation], ac_cv_func_basename_nonbroken,[AC_TRY_RUN([
#if HAVE_LIBGEN_H
# include <libgen.h>
#endif
static char *fl = "/usr/local/bin/some.file";
int main(int argc, char **argv) {
char *b = basename(fl); return ((*b != '/')?0:1);
}],[ac_cv_func_basename_nonbroken=yes], [ac_cv_func_basename_nonbroken=no], [ac_cv_func_basename_nonbroken=no])])
if test $ac_cv_func_basename_nonbroken = yes; then
AC_DEFINE([HAVE_BASENAME],1,[Define to 1 if basename() is nonbroken])
else
AC_LIBOBJ(basename)
fi
dnl Checking for FreeBSD setproctitle in libutil
AC_CHECK_FUNC([setproctitle],[AC_DEFINE(HAVE_SETPROCTITLE,1,[Define to 1 if system have setproctitle() call])],[AC_CHECK_LIB(util,setproctitle,[AC_DEFINE(HAVE_SETPROCTITLE,1,[Define to 1 if system have setproctitle() call])])])
dnl Socket functions are in libnsl.a on SunOS 5.5
AC_CHECK_FUNCS([socket],,[AC_CHECK_LIB(socket,socket)])
AC_CHECK_FUNCS([getpeername],,[AC_CHECK_LIB(socket,getpeername)])
AC_CHECK_FUNCS([gethostbyname],,[AC_CHECK_LIB(nsl,gethostbyname)])
AC_CHECK_FUNCS([getservbyname],,[AC_CHECK_LIB(socket,getservbyname)])
AC_CHECK_FUNCS([inet_addr],,[AC_CHECK_LIB(nsl,inet_addr)])
AC_CHECK_FUNCS([inet_ntoa],,[AC_CHECK_LIB(nsl,inet_ntoa)])
AC_CHECK_FUNCS([connect],,[AC_CHECK_LIB(socket,connect)])
AC_CHECK_FUNCS([bind],,[AC_CHECK_LIB(socket,bind)])
AC_CHECK_FUNCS([listen],,[AC_CHECK_LIB(socket,listen)])
AC_CHECK_FUNCS([accept],,[AC_CHECK_LIB(socket,accept)])
AC_CHECK_FUNCS([shutdown],,[AC_CHECK_LIB(socket,shutdown)])
AC_CHECK_FUNCS([recv send])
dnl Checking for config path
AC_MSG_CHECKING([for config path])
AC_ARG_WITH([config],AC_HELP_STRING([--with-config=config],[specifies config path (default is \${sysconfdir}/qico.conf)]),,with_config=NONE)
if test "${with_config}x" = "NONEx"; then
if test x`eval echo ${sysconfdir}` = "xNONE/etc"; then
if test "${prefix}x" = "NONEx"; then
syscdir="${ac_default_prefix}/etc"
else
syscdir="${prefix}/etc"
fi
else
syscdir="${sysconfdir}"
fi
with_config="${syscdir}/qico.conf"
fi
with_config=`eval echo ${with_config}`
AC_MSG_RESULT($with_config)
dnl TCP Speed
AC_MSG_CHECKING([for TCP connection speed])
AC_ARG_WITH(tcp-speed,AC_HELP_STRING([--with-tcp-speed],[specifies TCP connection speed (default is 115200)]),,with_tcp_speed=115200)
AC_DEFINE_UNQUOTED(TCP_SPEED,$with_tcp_speed,[Speed for TCP connections in bps])
AC_MSG_RESULT($with_tcp_speed)
changequote(,)dnl
if test "x`expr "$with_tcp_speed" : '[0-9]*'`" != "x`expr "$with_tcp_speed" : '.*'`"; then
changequote([,])dnl
AC_MSG_ERROR([Parameter for --with-tcp-speed must be a number])
fi
dnl Default Speed
AC_MSG_CHECKING([for default port locking speed])
AC_ARG_WITH(default-speed,AC_HELP_STRING([--with-default-speed],[specifies default port locking speed (default is 9600)]),,with_default_speed=9600)
AC_DEFINE_UNQUOTED(DEFAULT_SPEED,$with_default_speed,[Default speed for modem connections])
AC_MSG_RESULT($with_default_speed)
changequote(,)dnl
if test "x`expr "$with_default_speed" : '[0-9]*'`" != "x`expr "$with_default_speed" : '.*'`"; then
changequote([,])dnl
AC_MSG_ERROR([Parameter for --with-default-speed must be a number])
fi
dnl Shell
AC_MSG_CHECKING([for shell])
AC_ARG_WITH(shell,AC_HELP_STRING([--with-shell],[specifies shell (default is /bin/sh)]),,with_shell=/bin/sh)
AC_DEFINE_UNQUOTED(SHELL,"$with_shell",[Path to system shell])
AC_MSG_RESULT($with_shell)
if test "x`expr "$with_shell" : '/.*'`" != "x`expr "$with_shell" : '.*'`"; then
AC_MSG_ERROR([Parameter for --with-shell must be absolute pathname])
fi
if test ! \( -x "$with_shell" -a \( -f "$with_shell" -o -L "$with_shell" \) \); then
AC_MSG_ERROR([Parameter for --with-shell must be name of executable file])
fi
dnl Lock creation style
AC_MSG_CHECKING([for lock creation style])
AC_ARG_WITH(lock-style,AC_HELP_STRING([--with-lock-style],[select lock creation style (open or link)]),,with_lock_style=LINK)
case "$with_lock_style" in
link | LINK | NFS | nfs )
AC_MSG_RESULT(link)
;;
open | OPEN | VFAT | vfat )
AC_MSG_RESULT(open)
AC_DEFINE(LOCKSTYLE_OPEN,1,[Create lock files with open(), not link()])
;;
*)
AC_MSG_RESULT(unknown)
AC_MSG_ERROR([Lock style '$with_lock_style' is unknown. Valid ones are 'link' or 'open])
;;
esac
dnl HYDRA4/8/16K support (disable by default)
AC_MSG_CHECKING([for Hydra4k/8k/16k support])
AC_ARG_ENABLE(hydra8k,AC_HELP_STRING([--enable-hydra8k],[enable Hydra4k/8k/16k protocols support]),,enable_hydra8k=no)
if test "${enable_hydra8k}x" != "nox"; then
AC_MSG_RESULT(yes)
AC_DEFINE(HYDRA8K16K,1,[Allow Hydra-4K, Hydra-8K and Hydra-16K protocols])
else
AC_MSG_RESULT(no)
fi
dnl qcc support
AC_ARG_ENABLE(qcc,AC_HELP_STRING([--disable-qcc],[disable building of qcc]),,enable_qcc=yes)
if test "${enable_qcc}x" != "nox"; then
AC_CHECK_LIB(ncurses,main,[AC_DEFINE(HAVE_LIBNCURSES,1,[Define to 1 if system have ncurses])
CURSES=ncurses],[AC_CHECK_LIB(curses,main,[AC_DEFINE(HAVE_LIBCURSES,1,[Define to 1 if system have curses])
CURSES=curses])])
AC_CHECK_HEADERS([ncurses.h curses.h])
AC_CHECK_HEADERS([$CURSES.h],,CURSES=)
if test $CURSES; then
AC_CHECK_LIB($CURSES,mvvline,[AC_DEFINE(CURS_HAVE_MVVLINE,1,[Define to 1 if system (n)curses have mvvline()])])
AC_CHECK_LIB($CURSES,resizeterm,[AC_DEFINE(CURS_HAVE_RESIZETERM,1,[Define to 1 if system (n)curses have wresize()])])
QCC=qcc
QCCLIBS=-l$CURSES
AC_DEFINE(QCC,1,[Build qcc (interface program)])
AC_MSG_CHECKING([for qcc support])
AC_MSG_RESULT(yes)
else
QCC=
AC_MSG_WARN([there's no any curses library here])
AC_MSG_CHECKING([for qcc support])
AC_MSG_RESULT(no)
fi
else
AC_MSG_CHECKING([for qcc support])
AC_MSG_RESULT(no)
QCC=
fi
dnl Compile in debug messages
AC_MSG_CHECKING([for debug logging])
AC_ARG_ENABLE(debug,AC_HELP_STRING([--disable-debug],[disable adding debug messages]),,enable_debug=yes)
if test "${enable_debug}x" != "nox"; then
AC_MSG_RESULT([yes, use loglevels in config to tune])
AC_DEFINE(NEED_DEBUG,1,[Build debug loglevels support])
NEED_DEBUG=1
else
AC_MSG_RESULT([no, logleves in config is useless])
NEED_DEBUG=0
fi
dnl Electric Fence malloc() debbuger support
AC_MSG_CHECKING([for Electric Fence malloc() debbuger])
AC_ARG_ENABLE(efence,AC_HELP_STRING([--enable-efence],[enable linking with libefence malloc() debugger ]),,enable_efence=no)
if test "${enable_efence}x" != "nox"; then
AC_MSG_RESULT(yes)
AC_CHECK_LIB(efence,malloc,[LIBS="${LIBS} -L/usr/local/lib -lefence"],enable_efence=no,["-L/usr/local/lib"])
if test "${enable_fence}x" = "nox"; then
AC_MSG_WARN([No Electric Fence library found -- turn --enable-efence off])
fi
else
AC_MSG_RESULT(no)
fi
dnl Check for DNOTIFY
AC_MSG_CHECKING([for DNOTIFY (for ASO auto-rescan)])
AC_ARG_ENABLE(notify,AC_HELP_STRING([--disable-notify],[disable use DNOTIFY for ASO auto-rescan]),,enable_notify=yes)
if test "${enable_notify}x" != "nox"; then
AC_TRY_RUN([
#define _GNU_SOURCE
#include <stdio.h>
#include <unistd.h>
#include <signal.h>
#include <fcntl.h>
int done;
void sigrt(int sig) { done=1; }
int main(void) {
int fd,rc=1;
FILE *f;
mkdir("ac_xtst",S_IRWXU);
fd=open("ac_xtst",O_RDONLY);
if(fd<0) { rmdir("ac_xtst"); return 1; }
signal(SIGRTMIN,sigrt);
if(fcntl(fd,F_SETSIG,SIGRTMIN)<0 ||
fcntl(fd,F_NOTIFY,DN_CREATE|DN_DELETE|DN_MULTISHOT)<0) goto bad;
done=0;
f=fopen("ac_xtst/ac","w");
if(!f) goto bad;
fclose(f);
usleep(100000L);
if(!done) goto bad;
done=0;
unlink("ac_xtst/ac");
usleep(100000L);
if(done) rc=0;
bad:close(fd);
rmdir("ac_xtst");
return rc;
}],AC_MSG_RESULT(yes);
AC_DEFINE(HAVE_DNOTIFY,1,[Allow use DNOTIFY for ASO auto-recan]),
AC_MSG_RESULT(no),AC_MSG_RESULT(no))
else
AC_MSG_RESULT(no)
fi
dnl Check for Binkp protocol support
AC_MSG_CHECKING([for BinkP protocol support])
AC_ARG_ENABLE(binkp,AC_HELP_STRING([--disable-binkp],[disable BinkP protocol support]),,enable_binkp=yes)
if test "${enable_binkp}x" != "nox"; then
AC_DEFINE(WITH_BINKP,1,[Support for BinkP protocol])
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl Check for perl support
AC_MSG_CHECKING(for perl support);
AC_ARG_ENABLE(perl,AC_HELP_STRING([--enable-perl],[Enable perl hooks support]),,enable_perl=no)
if test "${enable_perl}x" != "nox"; then
AC_MSG_RESULT(yes)
AC_PATH_PROG(PERL,perl,perl)
AC_MSG_CHECKING(for libperl)
PERLDIR=`$PERL -MConfig -e 'print $Config{archlib}' 2>/dev/null`
if PERLCFLAGS=`$PERL -MExtUtils::Embed -e ccopts 2>/dev/null`; then
PERLLDFLAGS=`$PERL -MExtUtils::Embed -e ldopts 2>/dev/null`
case x$PERLDIR in
x) AC_MSG_RESULT(yes);;
*) AC_MSG_RESULT($PERLDIR);;
esac
else
case x$PERLDIR in
x) AC_MSG_RESULT(no);;
*)
PERLCFLAGS="-I $PERLDIR/CORE"
PERLLDFLAGS="$PERLDIR/auto/DynaLoader/DynaLoader.a -L$PERLDIR/CORE -lperl -ldl -lcrypt -lm"
AC_CHECK_LIB(dl,main,PERLLDFLAGS="$PERLLDFLAGS -ldl")
AC_CHECK_LIB(crypt,main,PERLLDFLAGS="$PERLLDFLAGS -lcrypt")
AC_CHECK_LIB(m,main,PERLLDFLAGS="$PERLLDFLAGS -lm")
AC_MSG_RESULT($PERLDIR)
;;
esac
fi
case x$PERLCFLAGS in
x) ;;
*)
AC_MSG_CHECKING(for working libperl)
OLD_LIBS=$LIBS
OLD_CFLAGS=$CFLAGS
LIBS="$LIBS $PERLLDFLAGS"
CFLAGS="$CFLAGS $PERLCFLAGS"
AC_TRY_RUN([
#include <EXTERN.h>
#include <perl.h>
#include <XSUB.h>
int main(int argc, char** argv, char** env) {
return perl_alloc() ? 0 : 1;
}],
AC_DEFINE(WITH_PERL,1,[Support for perl hooks])
AC_MSG_RESULT(yes),AC_MSG_RESULT(no),AC_MSG_RESULT(no))
CFLAGS=$OLD_CFLAGS; LIBS=$OLD_LIBS
;;
esac
else
AC_MSG_RESULT(no)
fi
dnl calculate real config -- prefix already known, so we could eval config
if test "x`expr "$with_config" : '/.*'`" != "x`expr "$with_config" : '.*'`"; then
AC_MSG_ERROR([Parameter for --with-config must be absolute filename])
fi
if test -d "$with_config"; then
AC_MSG_WARN([Parameter for --with-config must be filename, not a directory])
fi
AC_DEFINE_UNQUOTED(CONFIG,"$with_config",[Default path to config])
CONFIG=$with_config
dnl My defines -- from acconfig.h, hack for new autoconf
AC_DEFINE_UNQUOTED(MAX_PATH,256,[Maximum length of file path])
AC_DEFINE_UNQUOTED(MAX_STRING,256,[Maximum length of standard string])
AC_DEFINE_UNQUOTED(MAX_NODELIST,32,[Maximum number of compiled nodelists])
dnl My substs
AC_SUBST(QCCLIBS)
AC_SUBST(QCC)
AC_SUBST(TCP_SPEED)
AC_SUBST(DEFAULT_SPEED)
AC_SUBST(SHELL)
AC_SUBST(CONFIG)
AC_SUBST(PERLCFLAGS)
AC_SUBST(PERLLDFLAGS)
dnl add warn flags in maintainer mode
CFLAGS="$CFLAGS -Wall"
if test "x$USE_MAINTAINER_MODE" = "xyes"; then
CFLAGS="$CFLAGS -pedantic"
fi
dnl creating files
AC_CONFIG_FILES([
Makefile
src/Makefile
stuff/Makefile
debian/Makefile
])
AC_OUTPUT
echo "Do 'make' and 'make install' to compile and install qicosi."
echo ""