1dnl Process this file with autoconf to produce a configure script.
2AC_INIT([qico],[0.59.1],[jame at rocasa dot us])
3AC_PREREQ(2.53)
4AC_CONFIG_SRCDIR([src/main.c])
5AM_CONFIG_HEADER([config.h])
6AM_INIT_AUTOMAKE([subdir-objects])
7
8dnl Checks for programs.
9AC_PROG_CC
10AC_PROG_AWK
11AC_PROG_RANLIB
12AC_PROG_INSTALL
13AM_PROG_LEX
14AC_PROG_YACC
15AC_PROG_MAKE_SET
16AC_PROG_GCC_TRADITIONAL
17
18dnl Checks for header files.
19AC_HEADER_STDC
20AC_HEADER_DIRENT
21AC_HEADER_TIME
22AC_HEADER_SYS_WAIT
23AC_HEADER_TIOCGWINSZ
24AC_CHECK_HEADERS([arpa/inet.h errno.h fcntl.h libgen.h libutil.h locale.h malloc.h])
25AC_CHECK_HEADERS([netdb.h netinet/in.h sgtty.h stddef.h stdlib.h])
26AC_CHECK_HEADERS([string.h sys/fs/s5param.h sys/ioctl.h sys/param.h])
27AC_CHECK_HEADERS([sys/socket.h sys/statfs.h sys/statvfs.h sys/time.h])
28AC_CHECK_HEADERS([sys/vfs.h syslog.h termio.h termios.h unistd.h utime.h])
29
30
31dnl Checks for library functions.
32AC_FUNC_FNMATCH
33AC_FUNC_FORK
34AC_FUNC_FSEEKO
35AC_FUNC_MEMCMP
36AC_FUNC_STRFTIME
37AC_FUNC_UTIME_NULL
38AC_FUNC_VPRINTF
39
40AC_CHECK_FUNCS([alarm dup2 getcwd])
41AC_CHECK_FUNCS([getpagesize getpass gettimeofday])
42AC_CHECK_FUNCS([memcpy memmove memset mkdir recv rmdir])
43AC_CHECK_FUNCS([select send setlocale statfs statvfs])
44AC_CHECK_FUNCS([strcasecmp strchr strerror])
45AC_CHECK_FUNCS([strncasecmp strrchr strspn strstr])
46AC_CHECK_FUNCS([strtol strtoul uname utime vsnprintf waitpid])
47
48dnl Socket functions are in libnsl.a on SunOS 5.5
49AC_CHECK_FUNCS([accept],,[AC_CHECK_LIB(socket,accept)])
50AC_CHECK_FUNCS([bind],,[AC_CHECK_LIB(socket,bind)])
51AC_CHECK_FUNCS([connect],,[AC_CHECK_LIB(socket,connect)])
52AC_CHECK_FUNCS([gethostbyaddr],,[AC_CHECK_LIB(socket,gethostbyaddr)])
53AC_CHECK_FUNCS([gethostbyname],,[AC_CHECK_LIB(nsl,gethostbyname)])
54AC_CHECK_FUNCS([getpeername],,[AC_CHECK_LIB(socket,getpeername)])
55AC_CHECK_FUNCS([getservbyname],,[AC_CHECK_LIB(socket,getservbyname)])
56AC_CHECK_FUNCS([inet_addr],,[AC_CHECK_LIB(nsl,inet_addr)])
57AC_CHECK_FUNCS([inet_ntoa],,[AC_CHECK_LIB(nsl,inet_ntoa)])
58AC_CHECK_FUNCS([listen],,[AC_CHECK_LIB(socket,listen)])
59AC_CHECK_FUNCS([shutdown],,[AC_CHECK_LIB(socket,shutdown)])
60AC_CHECK_FUNCS([socket],,[AC_CHECK_LIB(socket,socket)])
61
62AC_REPLACE_FUNCS([strsep strcasestr strcspn getsid])
63
64dnl Checks for typedefs, structures, and compiler characteristics.
65AC_C_BIGENDIAN
66AC_C_CONST
67AC_TYPE_OFF_T
68AC_TYPE_PID_T
69AC_TYPE_SIZE_T
70AC_TYPE_SIGNAL
71AC_HEADER_TIME
72AC_STRUCT_TM
73AC_CHECK_SIZEOF([char],[1])
74AC_CHECK_SIZEOF([short],[2])
75AC_CHECK_SIZEOF([int],[4])
76AC_CHECK_SIZEOF([long],[4])
77AC_CHECK_TYPE([socklen_t],
78	,
79	AC_DEFINE(socklen_t,[unsigned int],[Define to `unsigned int' if <sys/types.h> does not define it]))
80
81
82AC_CHECK_MEMBER([struct statfs.f_bavail],[AC_DEFINE(STATFS_HAVE_F_BAVAIL,1,[Define to 1 if 'struct statfs' has 'f_bavail' field])],,[#include <sys/statfs.h>])
83AC_CHECK_MEMBER([struct statvfs.f_bavail],[AC_DEFINE(STATVFS_HAVE_F_BAVAIL,1,[Define to 1 if 'struct statvfs' has 'f_bavail' field])],,[#include <sys/statvfs.h>])
84
85
86AC_CHECK_DECL([facilitynames],
87	[AC_DEFINE(HAVE_SYSLOG_FAC_NAMES,1,[Define to 1 if 'facilitynames' defined in syslog headers])],
88	,
89	[
90#include <stdlib.h>
91#define SYSLOG_NAMES
92#include <syslog.h>
93#ifdef HAVE_SYSLOG_AND_SYS_SYSLOG
94# include <sys/syslog.h>
95#endif])
96
97
98AC_CHECK_DECL([prioritynames],
99	[AC_DEFINE(HAVE_SYSLOG_PRI_NAMES,1,[Define to 1 if 'prioritynames' defined in syslog headers])],
100	,
101	[
102#include <stdlib.h>
103#define SYSLOG_NAMES
104#include <syslog.h>
105#ifdef HAVE_SYSLOG_AND_SYS_SYSLOG
106# include <sys/syslog.h>
107#endif])
108
109
110AC_CHECK_DECL([TIOCSCTTY],
111	[AC_DEFINE(HAVE_TIOCSCTTY,1,[Define to 1 if system has 'TIOCSCTTY' ioctl()])],
112	,
113	[
114#include <stdlib.h>
115#include <sys/ioctl.h>
116#include <termios.h>])
117
118
119AC_CHECK_DECL([EIDRM],
120	AC_DEFINE(HAVE_EIDRM,1,[Define to 1 if system defines 'EIDRM' errno value]),
121	,
122	[
123#include <stdlib.h>
124#include <errno.h>])
125
126
127AC_CHECK_DECLS([STDIN_FILENO,STDOUT_FILENO,STDERR_FILENO],
128	AC_DEFINE(HAVE_STDXXX_FILENO,1,[Define to 1 if system defines 'STDxxx_FILENO' constants]),
129	,
130	[
131#include <unistd.h>])
132
133
134dnl Checking for FreeBSD setproctitle in libutil
135AC_CHECK_FUNC([setproctitle],
136	[AC_DEFINE(HAVE_SETPROCTITLE,1,[Define to 1 if system have setproctitle() call])],
137	[AC_CHECK_LIB(util,setproctitle,
138		[AC_DEFINE(HAVE_SETPROCTITLE,1,[Define to 1 if system have setproctitle() call])])])
139
140
141AC_CHECK_LIB(md,[MD5Init])
142
143
144dnl Signal handling
145AC_MSG_CHECKING(for reliable signals)
146AC_TRY_RUN([
147#include <sys/types.h>
148#include <signal.h>
149
150#ifndef SIGCHLD
151# define SIGCHLD SIGCLD
152#endif
153#ifdef USE_SIGSET
154# define signal sigset
155#endif
156
157int got;
158
159#ifdef SIGVOID
160void
161#endif
162hand()
163{
164	got++;
165}
166
167main()
168{
169	(void) signal( SIGCHLD, hand );
170	kill( getpid(), SIGCHLD );
171	kill( getpid(), SIGCHLD );
172	if ( got < 2 )
173		exit( 1 );
174	exit( 0 );
175}
176], AC_MSG_RESULT(yes),
177AC_DEFINE(SYS5SIGNALS,1,[Non-reliable signals]) AC_MSG_RESULT(no),
178AC_DEFINE(SYS5SIGNALS,1,[Non-reliable signals]) AC_MSG_RESULT(cross-compiling. No assumptions made)
179)
180
181
182AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
183dnl maintainer-mode is disabled by default
184AC_ARG_ENABLE(maintainer-mode,
185	AC_HELP_STRING([--enable-maintainer-mode],
186		[enable make rules and dependencies not useful (and sometimes confusing) to the casual installer]),
187	USE_MAINTAINER_MODE=$enableval,
188	USE_MAINTAINER_MODE=no)
189AC_MSG_RESULT([$USE_MAINTAINER_MODE])
190
191
192dnl Enable optional modules
193AC_ARG_ENABLE(dlmalloc,
194	AC_HELP_STRING([--enable-dlmalloc],[Compile & use the malloc package by Doug Lea]),
195[
196 case "$enableval" in
197 'yes')
198    use_dlmalloc="yes"
199    LIBDLMALLOC="libdlmalloc.a"
200    LIB_MALLOC="-L../lib -ldlmalloc"
201    echo "dlmalloc enabled"
202    ;;
203 'no')
204    use_dlmalloc="no"
205    echo "dlmalloc disabled"
206    ;;
207 *) use_dlmalloc="yes"
208    LIB_MALLOC="$enableval"
209    echo "dlmalloc enabled with $LIB_MALLOC"
210 esac
211])
212if test "${use_dlmalloc-unset}" = unset; then
213    case "$host" in
214	i386-*-solaris2.*)
215		echo "Enabling dlmalloc for $host"
216		use_dlmalloc="yes"
217		LIBDLMALLOC="libdlmalloc.a"
218		LIB_MALLOC="-L../lib -ldlmalloc"
219		;;
220	*-sgi-irix*)
221		echo "Enabling dlmalloc for $host"
222		use_dlmalloc="yes"
223		LIBDLMALLOC="libdlmalloc.a"
224		LIB_MALLOC="-L../lib -ldlmalloc"
225		;;
226    esac
227fi
228if test "x$ac_cv_enabled_dlmalloc" = "xyes"; then
229    # Ok. dlmalloc was enabled before, but state may be changed.
230    # we have to test these again
231    unset ac_cv_func_mallinfo
232    unset ac_cv_func_mallocblksize
233    unset ac_cv_func_free
234    unset ac_cv_func_realloc
235    unset ac_cv_func_memalign
236    unset ac_cv_func_valloc
237    unset ac_cv_func_pvalloc
238    unset ac_cv_func_calloc
239    unset ac_cv_func_cfree
240    unset ac_cv_func_malloc_trim
241    unset ac_cv_func_malloc_usable_size
242    unset ac_cv_func_malloc_stats
243    unset ac_cv_func_mallinfo
244    unset ac_cv_func_mallopt
245    unset ac_cv_lib_gnumalloc
246    unset ac_cv_header_gnumalloc_h
247    unset ac_cv_lib_malloc
248    unset ac_cv_enabled_dlmalloc
249fi
250if test "$use_dlmalloc" = yes; then
251    ac_cv_func_mallinfo="yes"
252    ac_cv_func_mallocblksize="no"
253    ac_cv_func_free="yes"
254    ac_cv_func_realloc="yes"
255    ac_cv_func_memalign="yes"
256    ac_cv_func_valloc="yes"
257    ac_cv_func_pvalloc="yes"
258    ac_cv_func_calloc="yes"
259    ac_cv_func_cfree="yes"
260    ac_cv_func_malloc_trim="yes"
261    ac_cv_func_malloc_usable_size="yes"
262    ac_cv_func_malloc_stats="yes"
263    ac_cv_func_mallopt="yes"
264    ac_cv_lib_gnumalloc="no"
265    ac_cv_header_gnumalloc_h="no"
266    ac_cv_lib_malloc="no"
267    ac_cv_enabled_dlmalloc="yes"
268else
269AC_FUNC_MALLOC
270fi
271
272AC_SUBST(LIBDLMALLOC)
273AC_SUBST(LIB_MALLOC)
274
275dnl whether syslog.h and sys/syslog.h may both be included
276AC_CHECK_HEADER([sys/syslog.h],
277	[AC_DEFINE(HAVE_SYSLOG_AND_SYS_SYSLOG,1,[Could <syslog.h> and <sys/syslog.h> be included in one file])],
278	,
279	[
280#define SYSLOG_NAMES
281#include <syslog.h>])
282
283
284dnl Checking for config path
285AC_MSG_CHECKING([for config path])
286AC_ARG_WITH([config],
287	AC_HELP_STRING([--with-config=config],
288		[specifies config filename (default is ${sysconfdir}/qico.conf)]),
289	with_config=$withval,
290	with_config=NONE)
291
292if test "${with_config}x" = "NONEx"; then
293	if test x`eval echo ${sysconfdir}` = "xNONE/etc"; then
294	    if test "${prefix}x" = "NONEx"; then
295		syscdir="${ac_default_prefix}/etc"
296	    else
297		syscdir="${prefix}/etc"
298	    fi
299	else
300	    syscdir="${sysconfdir}"
301	fi
302	with_config="${syscdir}/qico.conf"
303fi
304with_config=`eval echo ${with_config}`
305AC_MSG_RESULT($with_config)
306
307
308dnl TCP Speed
309AC_MSG_CHECKING([for TCP connection speed])
310AC_ARG_WITH([tcp-speed],
311	AC_HELP_STRING([--with-tcp-speed],[specifies TCP connection speed (default is 115200)]),
312	with_tcp_speed=$withval,
313	with_tcp_speed=115200)
314AC_DEFINE_UNQUOTED(TCP_SPEED,$with_tcp_speed,[Speed for TCP connections in bps])
315AC_MSG_RESULT($with_tcp_speed)
316
317changequote(,)dnl
318if test "x`expr "$with_tcp_speed" : '[0-9]*'`" != "x`expr "$with_tcp_speed" : '.*'`"; then
319	changequote([,])dnl
320	AC_MSG_ERROR([Parameter for --with-tcp-speed must be a number])
321fi
322
323
324dnl Default Speed
325AC_MSG_CHECKING([for default port locking speed])
326AC_ARG_WITH([default-speed],
327	AC_HELP_STRING([--with-default-speed],[specifies default port locking speed (default is 9600)]),
328	with_default_speed=$withval,
329	with_default_speed=9600)
330AC_DEFINE_UNQUOTED(DEFAULT_SPEED,$with_default_speed,[Default speed for modem connections])
331AC_MSG_RESULT($with_default_speed)
332
333changequote(,)dnl
334if test "x`expr "$with_default_speed" : '[0-9]*'`" != "x`expr "$with_default_speed" : '.*'`"; then
335	changequote([,])dnl
336	AC_MSG_ERROR([Parameter for --with-default-speed must be a number])
337fi
338
339
340dnl Shell
341AC_MSG_CHECKING([for shell])
342AC_ARG_WITH([shell],
343	AC_HELP_STRING([--with-shell],[specifies shell (default is /bin/sh)]),
344	with_shell=$withval,
345	with_shell=/bin/sh)
346AC_DEFINE_UNQUOTED(SHELL,"$with_shell",[Path to system shell])
347AC_MSG_RESULT($with_shell)
348
349if test "x`expr "$with_shell" : '/.*'`" != "x`expr "$with_shell" : '.*'`"; then
350	AC_MSG_ERROR([Parameter for --with-shell must be absolute pathname])
351fi
352if test ! \( -x "$with_shell" -a \( -f "$with_shell" -o -L "$with_shell" \) \); then
353	AC_MSG_ERROR([Parameter for --with-shell must be name of executable file])
354fi
355
356
357dnl Lock creation style
358AC_MSG_CHECKING([for lock creation style])
359AC_ARG_WITH([lock-style],
360	AC_HELP_STRING([--with-lock-style],[select lock creation style (open or link)]),
361	with_lock_style=$withval,
362	with_lock_style=LINK)
363
364case "$with_lock_style" in
365	link | LINK | NFS | nfs )
366		AC_MSG_RESULT(link)
367		;;
368	open | OPEN | VFAT | vfat )
369		AC_MSG_RESULT(open)
370		AC_DEFINE(LOCKSTYLE_OPEN,1,[Create lock files with open(), not link()])
371		;;
372	*)
373		AC_MSG_RESULT(unknown)
374		AC_MSG_ERROR([Lock style '$with_lock_style' is unknown. Valid ones are 'link' or 'open])
375		;;
376esac
377
378
379dnl qcc support
380AC_ARG_ENABLE(qcc,
381	AC_HELP_STRING([--disable-qcc],[disable building of qcc]),
382	enable_qcc=$enableval,
383	enable_qcc=yes)
384
385if test "${enable_qcc}x" != "nox"; then
386	AC_CHECK_LIB(ncurses,main,[AC_DEFINE(HAVE_LIBNCURSES,1,[Define to 1 if system have ncurses])
387	CURSES=ncurses],[AC_CHECK_LIB(curses,main,[AC_DEFINE(HAVE_LIBCURSES,1,[Define to 1 if system have curses])
388	CURSES=curses])])
389	AC_CHECK_HEADERS([ncurses.h curses.h])
390	AC_CHECK_HEADERS([$CURSES.h],,CURSES=)
391	if test $CURSES; then
392		AC_CHECK_LIB($CURSES,mvvline,[AC_DEFINE(CURS_HAVE_MVVLINE,1,[Define to 1 if system (n)curses have mvvline()])])
393		AC_CHECK_LIB($CURSES,resizeterm,[AC_DEFINE(CURS_HAVE_RESIZETERM,1,[Define to 1 if system (n)curses have wresize()])])
394		QCC=qcc
395		QCCLIBS=-l$CURSES
396		AC_DEFINE(QCC,1,[Build qcc (interface program)])
397		AC_MSG_CHECKING([for qcc support])
398		AC_MSG_RESULT(yes)
399	else
400		QCC=
401		AC_MSG_CHECKING([for qcc support])
402		AC_MSG_RESULT(unsupported)
403		AC_MSG_WARN([there's no any curses library here])
404	fi
405else
406	AC_MSG_CHECKING([for qcc support])
407	AC_MSG_RESULT(disabled)
408	QCC=
409fi
410
411
412dnl Compile in debug messages
413AC_MSG_CHECKING([for debug logging])
414AC_ARG_ENABLE(debug,
415	AC_HELP_STRING([--disable-debug],[disable adding debug messages]),
416	enable_debug=$enableval,
417	enable_debug=yes)
418
419if test "x${enable_debug}" = "xyes"; then
420	AC_MSG_RESULT([yes, use loglevels in config to tune])
421	AC_DEFINE(NEED_DEBUG,1,[Build debug loglevels support])
422else
423	AC_MSG_RESULT([no, logleves in config are useless])
424fi
425
426
427dnl Check for DNOTIFY
428AC_MSG_CHECKING([for DNOTIFY (for ASO auto-rescan)])
429AC_ARG_ENABLE(notify,
430	AC_HELP_STRING([--disable-notify],[disable use DNOTIFY for ASO auto-rescan]),
431	enable_notify=$enableval,
432	enable_notify=yes)
433
434if test "${enable_notify}x" != "nox"; then
435	AC_TRY_RUN([
436#define _GNU_SOURCE
437#include <stdio.h>
438#include <unistd.h>
439#include <signal.h>
440#include <fcntl.h>
441
442volatile int done = 0;
443#ifdef SIGVOID
444void
445#endif
446sigrt()
447{
448	done = 1;
449}
450
451int main() {
452	int fd, rc = 1;
453	FILE *f;
454
455	mkdir("ac_xtst",S_IRWXU);
456	fd = open("ac_xtst",O_RDONLY);
457	if ( fd < 0 ) {
458		rmdir("ac_xtst");
459		return 1;
460	}
461	signal(SIGRTMIN,sigrt);
462	if ( fcntl(fd,F_SETSIG,SIGRTMIN) < 0 ||
463			fcntl(fd,F_NOTIFY,DN_CREATE|DN_DELETE|DN_MULTISHOT) < 0 )
464		goto bad;
465	f = fopen("ac_xtst/ac","w");
466	if ( !f )
467		goto bad;
468	fclose( f );
469	sleep( 1 );
470	if ( !done)
471		goto bad;
472	done = 0;
473	unlink("ac_xtst/ac");
474	sleep( 1 );
475	if ( done )
476		rc = 0;
477bad:
478	close( fd );
479	rmdir("ac_xtst");
480	return rc;
481}],
482AC_MSG_RESULT(yes) AC_DEFINE(HAVE_DNOTIFY,1,[Allow use DNOTIFY for ASO auto-recan]),
483AC_MSG_RESULT(no),
484AC_MSG_RESULT(no))
485
486else
487
488AC_MSG_RESULT(no)
489
490fi
491
492
493dnl HYDRA4/8/16K support (disabled by default)
494AC_MSG_CHECKING([for Hydra4k/8k/16k support])
495AC_ARG_ENABLE([hydra8k],
496	AC_HELP_STRING([--enable-hydra8k],[enable Hydra4k/8k/16k protocols support]),
497	enable_hydra8k=$enableval,
498	enable_hydra8k=no)
499
500if test "x$enable_hydra8k" = "xyes"; then
501	AC_DEFINE(HYDRA8K16K,1,[Allow Hydra-4K, Hydra-8K and Hydra-16K protocols])
502fi
503AC_MSG_RESULT($enable_hydra8k)
504
505
506dnl Check for Binkp protocol support
507AC_MSG_CHECKING([for BinkP protocol support])
508AC_ARG_ENABLE(binkp,
509	AC_HELP_STRING([--disable-binkp],[disable BinkP protocol support]),
510	want_binkp=$enableval,
511	want_binkp=yes)
512
513if test "x$want_binkp" = "xyes"; then
514	AC_DEFINE(WITH_BINKP,1,[Support for BinkP protocol])
515	BINKP_O='binkp.$(OBJEXT)'
516fi
517AC_MSG_RESULT($want_binkp)
518
519
520dnl Check for perl support
521AC_MSG_CHECKING(for perl support)
522AC_ARG_ENABLE(perl,
523	AC_HELP_STRING([--enable-perl],[Enable perl hooks support]),
524	enable_perl=$enableval,
525	enable_perl=no)
526
527if test "${enable_perl}x" != "nox"; then
528	AC_MSG_RESULT(yes)
529	AC_PATH_PROG(PERL,perl,perl)
530	AC_MSG_CHECKING(for libperl)
531	PERLDIR=`$PERL -MConfig -e 'print $Config{archlib}' 2>/dev/null`
532	if PERLCFLAGS=`$PERL -MExtUtils::Embed -e ccopts 2>/dev/null`; then
533		PERLLDFLAGS=`$PERL -MExtUtils::Embed -e ldopts 2>/dev/null`
534		case x$PERLDIR in
535		    x) AC_MSG_RESULT(yes);;
536		    *) AC_MSG_RESULT($PERLDIR);;
537		esac
538	else
539		case x$PERLDIR in
540		    x) AC_MSG_RESULT(no);;
541		    *)
542			PERLCFLAGS="-I $PERLDIR/CORE"
543			PERLLDFLAGS="$PERLDIR/auto/DynaLoader/DynaLoader.a -L$PERLDIR/CORE -lperl -ldl -lcrypt -lm"
544			AC_CHECK_LIB(dl,main,PERLLDFLAGS="$PERLLDFLAGS -ldl")
545			AC_CHECK_LIB(crypt,main,PERLLDFLAGS="$PERLLDFLAGS -lcrypt")
546			AC_CHECK_LIB(m,main,PERLLDFLAGS="$PERLLDFLAGS -lm")
547			AC_MSG_RESULT($PERLDIR)
548			;;
549		esac
550	fi
551	case x$PERLCFLAGS in
552		x) ;;
553		*)
554		    AC_MSG_CHECKING(for working libperl)
555		    OLD_LIBS=$LIBS
556		    OLD_CFLAGS=$CFLAGS
557		    LIBS="$LIBS $PERLLDFLAGS"
558		    CFLAGS="$CFLAGS $PERLCFLAGS"
559		    AC_TRY_RUN([
560#include <EXTERN.h>
561#include <perl.h>
562#include <XSUB.h>
563int main(int argc, char** argv, char** env) {
564return perl_alloc() ? 0 : 1;
565}],
566		    AC_DEFINE(WITH_PERL,1,[Support for perl hooks])
567		    PERL_O='perl.$(OBJEXT)'
568		    AC_MSG_RESULT(yes),AC_MSG_RESULT(no),AC_MSG_RESULT(no))
569		    CFLAGS=$OLD_CFLAGS; LIBS=$OLD_LIBS
570		    ;;
571	esac
572else
573	AC_MSG_RESULT(no)
574fi
575
576
577dnl calculate real config -- prefix already known, so we could eval config
578if test "x`expr "$with_config" : '/.*'`" != "x`expr "$with_config" : '.*'`"; then
579	AC_MSG_ERROR([Parameter for --with-config must be absolute filename])
580fi
581if test -d "$with_config"; then
582	AC_MSG_WARN([Parameter for --with-config must be filename, not a directory])
583fi
584AC_DEFINE_UNQUOTED(CONFIG,"$with_config",[Default path to config])
585CONFIG=$with_config
586
587
588dnl Check for __attribute__((__packed__))
589AC_CACHE_CHECK([for __attribute__((__packed__))],
590ac_cv_attr_packed,
591[AC_TRY_RUN([
592typedef struct {
593	short	a;
594	int	b;
595} __attribute__((__packed__)) tst_t;
596
597int main(int argc, char **argv)
598{
599	return (sizeof( tst_t ) != (sizeof( short ) + sizeof( int )));
600}
601],
602[ac_cv_attr_packed=yes],
603[ac_cv_attr_packed=no],
604[ac_cv_attr_packed=no])]
605)
606
607if test "x$ac_cv_attr_packed" = "xyes"; then
608	AC_DEFINE([HAVE_ATTR_PACKED],1,[Define to 1 if compiler has __attribute__((__packed__))])
609fi
610
611
612dnl My defines -- from acconfig.h, hack for new autoconf
613AC_DEFINE_UNQUOTED(MAX_STRING,512,[Maximum length of standard string])
614AC_DEFINE_UNQUOTED(MAX_NODELIST,32,[Maximum number of compiled nodelists])
615
616
617dnl My substs
618AC_SUBST(QCCLIBS)
619AC_SUBST(QCC)
620AC_SUBST(TCP_SPEED)
621AC_SUBST(DEFAULT_SPEED)
622AC_SUBST(SHELL)
623AC_SUBST(CONFIG)
624AC_SUBST(BINKP_O)
625AC_SUBST(PERLCFLAGS)
626AC_SUBST(PERLLDFLAGS)
627AC_SUBST(PERL_O)
628
629
630dnl add warn flags in maintainer mode
631CFLAGS="$CFLAGS -Wall"
632if test "x$USE_MAINTAINER_MODE" = "xyes"; then
633    CFLAGS="$CFLAGS -pedantic -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls"
634fi
635
636
637dnl creating files
638AC_CONFIG_FILES([
639	Makefile
640	lib/Makefile
641	src/Makefile
642	man/Makefile
643	stuff/Makefile
644])
645AC_OUTPUT
646
647echo "Do 'make' and 'make install' to compile and install qico."
648echo ""
649