Codebase list ircii / HEAD configure.in
HEAD

Tree @HEAD (Download .tar.gz)

configure.in @HEADraw · history · blame

  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
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
# configure.in for ircii
dnl
dnl Copyright (c) 1993-2021 Matthew R. Green.
dnl All rights reserved.
dnl
dnl Redistribution and use in source and binary forms, with or without
dnl modification, are permitted provided that the following conditions
dnl are met:
dnl 1. Redistributions of source code must retain the above copyright
dnl    notice, this list of conditions and the following disclaimer.
dnl 2. Redistributions in binary form must reproduce the above copyright
dnl    notice, this list of conditions and the following disclaimer in the
dnl    documentation and/or other materials provided with the distribution.
dnl 3. The name of the author may not be used to endorse or promote products
dnl    derived from this software without specific prior written permission.
dnl
dnl THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
dnl IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
dnl OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
dnl IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
dnl INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
dnl BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
dnl LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
dnl AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
dnl OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
dnl OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
dnl SUCH DAMAGE.
dnl
dnl certain portions have other attributions, see below.
dnl
dnl thanks to the screen 3.3 configure.in for giving me examples to
dnl work from and steal ;)
dnl
dnl @(#)$eterna: configure.in,v 1.228 2021/03/14 18:22:31 mrg Exp $

AC_PREREQ([2.69])
AC_REVISION($Revision: 1.228 $)dnl
AC_INIT(${srcdir}/source/irc.c)
AC_CONFIG_HEADER(defs.h:include/defs.h.in)

dnl
dnl grok the version number - from source/irc.c
dnl

VERSION=`sed -n -e 's/"[[^"]]*$//' -e '/#define[ 	]*IRCII_VERSION[ 	]*"/s///p' -e '/#define IRCII_VERSION/q' < ${srcdir}/source/irc.c` 
echo this is ircii version $VERSION
echo
AC_SUBST(VERSION)

CATEGORIES='build change-request doc pending runtime'
AC_SUBST(CATEGORIES)

dnl so that the generated configure has an id.
echo '$eterna: configure.in,v 1.228 2021/03/14 18:22:31 mrg Exp $' > /dev/null

dnl So many systems seem to need this that it is better do it here automatically.
AC_MSG_CHECKING(for prefix paths)
AC_ARG_WITH(prefix_paths,
[  --with-prefix-paths                  Add include and library diectories from prefix],
[ case "$withval" in
  no)
    AC_MSG_RESULT(no)
    ;;		
  *)
    AC_MSG_RESULT(yes)
    if test "x$prefix" != xNONE; then
      if test -d "$prefix/lib"; then
        LIBS="-L${prefix}/lib $LIBS"
      fi
      if test -d "$prefix/include"; then
        CFLAGS="-I${prefix}/include $CFLAGS"
      fi
    else
      if test -d "$ac_default_prefix/lib"; then
        LIBS="-L${ac_default_prefix}/lib $LIBS"
      fi
      if test -d "$ac_default_prefix/include"; then
        CFLAGS="-I${ac_default_prefix}/include $CFLAGS"
      fi
    fi
    ;;
  esac ]
  AC_MSG_RESULT(no)
)

dnl
dnl initial stuff
dnl

AC_PROG_CC
AC_PROG_CPP

dnl
dnl setup variables
dnl
srcdir=`(cd $srcdir; pwd)`
AC_SUBST(srcdir)
objdir=`pwd`
AC_SUBST(objdir)

dnl AC_AIX is broken.  blah.

AC_PROG_GCC_TRADITIONAL
if test $ac_cv_prog_gcc = yes; then
  CFLAGS="-pipe $CFLAGS"
fi

AC_MSG_CHECKING(for qnx)
case "`uname -s`" in
dnl bleck - wish i could ditch this qnx test, but we need to bump the stack
  QNX*)
    AC_MSG_RESULT(yes)
    if test -z "$GCC"; then
      LDFLAGS="-N256k -M"
      CFLAGS="-w4 -Otax -zc -Wc,-fr= -Wc,-wcd=121"
    fi
    ;;
  *)
    AC_MSG_RESULT(no)
esac
AC_MSG_CHECKING(for solaris)
if /bin/sun 2> /dev/null
then
  uname=`uname -r`
  case "$uname" in
    5.*)
      AC_MSG_RESULT(yes)
      svr4=1
      ;;
  esac
else
  AC_MSG_RESULT(no)
  AC_MSG_CHECKING(for SVR4)
  AC_EGREP_CPP(yes,
[#if defined(SVR4) || defined(__svr4__) || defined(__SVR4)
  yes
#endif
],AC_MSG_RESULT(yes)
  svr4=1)
fi

if test -n "$svr4"
then
  LIBS="-L/usr/ccs/lib -lnsl -lsocket $LIBS"
else
  AC_MSG_RESULT(no)
fi

dnl
dnl linux ncurses
dnl
case "`uname -s`" in
  Linux*)
    if test -d /usr/include/ncurses; then
      CFLAGS="-I/usr/include/ncurses $CFLAGS"
    fi
    ;;
esac

AC_CHECK_HEADERS(sys/un.h sys/select.h sys/fcntl.h sys/ioctl.h sys/file.h sys/time.h sys/uio.h)dnl sys/ ones
AC_CHECK_HEADERS(fcntl.h memory.h netdb.h crypt.h)dnl non sys/ ones
AC_CHECK_HEADERS(process.h termcap.h iconv.h)dnl others

AC_CHECK_FUNC(fchmod,, AC_DEFINE([NEED_FCHMOD], 1, [define this if you need fchmod()]))

AC_CHECK_FUNCS(\
	getpgid getsid memmove scandir setsid strftime writev \
	snprintf vsnprintf fputc fwrite setenv unsetenv \
	tzset waitpid iconv_open)

dnl
dnl look for get*info in libmedia
dnl

AC_CHECK_LIB(media, getaddrinfo, LIBS="$LIBS -lmedia")

AC_HEADER_TIME

AC_TYPE_MODE_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UID_T
AC_CHECK_TYPES([ssize_t], [AC_DEFINE([HAVE_SSIZE_T], 1, [define this if you have ssize_t type])])

AC_MSG_TRY_COMPILE(for sockaddr_in.sin_len, ircii_cv_HAVE_SOCKADDR_SA_LEN, [
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h> ],
  [ struct sockaddr_in sin;
    int X = sin.sin_len ],
  [AC_DEFINE([HAVE_SOCKADDR_SA_LEN], 1, [define this if your struct sockaddr has a sa_len member])])

AC_MSG_TRY_COMPILE(for socklen_t, ircii_cv_HAVE_SOCKLEN_T, [
#include <sys/types.h>
#include <sys/socket.h> ], [ socklen_t X ], [AC_DEFINE([HAVE_SOCKLEN_T], 1, [define this if you have socklen_t])])

dnl
dnl checking for select()
dnl

olibs="$LIBS"
AC_CHECK_FUNC(select, ,
  AC_CHECK_LIB(socket, select, LIBS="$LIBS -lsocket",
    AC_CHECK_LIB(nsl, select, LIBS="$LIBS -lnsl",
      AC_CHECK_LIB(inet, select, LIBS="$LIBS -linet",
        AC_CHECK_LIB(cposix, select, LIBS="$LIBS -lcposix",
          AC_CHECK_LIB(net, select, LIBS="$LIBS -lnet",
            AC_MSG_WARN(i can not find select.  you might need to help me)))))))

dnl
dnl termcap or curses
dnl if termcap, check for tputs declaration
dnl
if test x$aix = x1
then
  LIBS="$LIBS -lcurses"
  include_curses_h=1
else
  olibs="$LIBS"
  AC_CHECK_LIB(termcap, tgetent, LIBS="-ltermcap $olibs",
    AC_CHECK_LIB(tinfo, tgetent, LIBS="-ltinfo $olibs",
      AC_CHECK_LIB(termlib, tgetent, LIBS="$olibs -ltermlib",
        AC_CHECK_LIB(curses, tgetent, LIBS="$olibs -lcurses",
          AC_CHECK_LIB(xtermcap, tgetent, LIBS="$olibs -lxtermcap",
            AC_CHECK_LIB(ncurses, tgetent, LIBS="$olibs -lncurses",
              AC_MSG_WARN(i can not find tgetent.  you might need to help me)))))))
  AC_MSG_CHECKING(for tputs in curses.h)
  AC_EGREP_CPP([tputs( |	|\()],[#include <curses.h>
], include_curses_h=1
   AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
fi

if test -n "$include_curses_h"
then
  AC_DEFINE([INCLUDE_CURSES_H], 1, [define this if you have usable curses.h])
fi


dnl
dnl check the type of iconv(3)'s 2nd argument
dnl

AC_MSG_CHECKING(for const iconv 2nd argument)
AC_EGREP_HEADER([\\<iconv\\>.*\\(.*const], iconv.h,
  AC_MSG_RESULT(yes)
  AC_DEFINE([ICONV_CONST_ARG2], 1,
    [define this if your iconv(3)'s 2nd argument is const]),
  AC_MSG_RESULT(no))


dnl
dnl check the type of scandir(3)'s comparision function
dnl actually, we check alphasort since that is almost certainly
dnl on the same line. ugh.
dnl

AC_MSG_CHECKING(for scandir void * comparision function)
AC_EGREP_HEADER([\\<alphasort\\>.*\\(.*void], dirent.h,
  AC_MSG_RESULT(yes)
  AC_DEFINE([ALPHASORT_VOID_ARG], 1,
    [define this if your scandir(3)'s comparision takes void * or dirent *]),
  AC_MSG_RESULT(no))


dnl
dnl libraries
dnl

dnl work out UNIX mail dir..

AC_MSG_CHECKING(for unix mail directory)

for foo in /var/spool/mail /usr/spool/mail /var/mail /usr/mail
do
  if test -d $foo; then
    mdir=$foo
    break
  fi
done

if test -n "$mdir"; then
  UNIX_MAIL=\"$mdir\"
  AC_MSG_RESULT($mdir)
  AC_DEFINE_UNQUOTED([UNIX_MAIL], ["$mdir"], [define this to the location of normal unix mail])
else
  AC_MSG_RESULT(none)
fi

if test -z "$CFLAGS"; then CFLAGS=-O ; fi
if test -z "$LDFLAGS"; then LDFLAGS= ; fi
RM="rm -f"
LN="ln -s"

if test ! -n "$bindir";
then
	bindir=\${exec_prefix}/bin
fi
AC_SUBST(bindir)

if test ! -n "$IRCLIB";
then
	IRCLIB=\${datarootdir}/irc
fi
AC_SUBST(IRCLIB)

if test "x$libexecdir" = "x"; then
  if test "x$exec_prefix" = "xNONE"; then
    if test "x$prefix" = "xNONE"; then
      libexecdir="$ac_default_prefix/libexec"
    else
      libexecdir="$prefix/libexec"
    fi
  else
    libexecdir="$exec_prefix/libexec"
  fi
fi
AC_SUBST(libexecdir)

AC_MSG_CHECKING(for ElectricFence library)
AC_ARG_WITH(efence,
[changequote(, )  --with-efence[=PATH]                 Compile with the ElectricFence debugging library.changequote([, ])],
[ case "$withval" in
  no)
    AC_MSG_RESULT(no)
    ;;		
  *)
    AC_MSG_RESULT(yes)
    if test "x$withval" = xyes; then
      withval="-lefence"
    else
      if test -d "$withval"; then
        if test -d "$withval/lib"; then
	  withval="-L$withval/lib -R$withval/lib -lefence"
	else
	  withval="-L$withval -lefence"
	fi
      fi
    fi
    LIBS="$withval $LIBS"
    ;;
  esac
], [
  AC_MSG_RESULT(no)
])

AC_MSG_CHECKING(for OpenSSL library)
checkopenssl=no
ssl_path=
AC_ARG_WITH(openssl,
[changequote(, )  --with-openssl[=PATH]                Compile with OpenSSL.changequote([, ])],
[ case "$withval" in
  no)
    ;;		
  *)
    if test "x$withval" != "xyes"; then
      ssl_path="$withval"
    fi
    checkopenssl=yes
    ;;
  esac
], [
  checkopenssl=maybe
])

ssl_libs=""
ssl_cflags=""
if test "x$checkopenssl" != xno; then
  if test "x$ssl_path" = x; then
    ssl_libs="-lssl -lcrypto"
  else
    if test -d "$ssl_path"; then
      if test -d "$ssl_path/lib"; then
        ssl_libs="-L$ssl_path/lib -lssl -lcrypto"
	ssl_cflags="-I$ssl_path/include"
      else
        ssl_libs="-L$ssl_path -lssl -lcrypto"
	ssl_cflags="-I$ssl_path/../include"
      fi
    fi
  fi
fi

if test "x$ssl_libs" != x; then
  AC_MSG_RESULT(yes)
  LIBS="$LIBS $ssl_libs"
  CFLAGS="$CFLAGS $ssl_cflags"
  AC_DEFINE([USE_OPENSSL], 1, [define this if you want to use OpenSSL])
else
  AC_MSG_RESULT(no)
fi

AC_MSG_CHECKING(for debug flags)
AC_ARG_WITH(debugging,
[changequote(, )  --with-debugging[=flags]             Build with debugging support.changequote([, ])],
[ case "$withval" in
  no)
    AC_MSG_RESULT(no)
    DEBUGFLAGS=
    ;;		
  *)
    AC_MSG_RESULT(yes)
    if test "x$withval" = xyes; then
      withval=-g
    fi
    DEBUGFLAGS="$withval"
    for flag in $CFLAGS; do
      case "$CFLAGS" in
        -DDEBUG|-DDEBUG=*)
	  found=1
	  break
	  ;;
        *)
          found=0
	  ;;
      esac
    done
    if test $found -eq 0; then
      CFLAGS="$CFLAGS -DDEBUG"
    fi
    ;;
  esac ],
  AC_MSG_RESULT(no)
)
AC_SUBST(DEBUGFLAGS)

AC_MSG_CHECKING(for warning flags)
AC_ARG_WITH(warnings,
[changequote(, )  --with-warnings[=flags]              Build with GCC warnings.changequote([, ])],
[ case "$withval" in
  no)
    AC_MSG_RESULT(no)
    WARNINGFLAGS=
    ;;		
  *)
    AC_MSG_RESULT(yes)
    if test "x$withval" = xyes; then
      withval='-Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wmissing-declarations -Wnested-externs -Wpointer-arith -Wformat -Wformat-security'
    fi
    WARNINGFLAGS="$withval"
    ;;
  esac ],
  AC_MSG_RESULT(no)
)
AC_SUBST(WARNINGFLAGS)

AC_MSG_CHECKING(for warnings as errors)
AC_ARG_WITH(warning-errors,
[changequote(, )  --with-warning-errors[=flags]        Turn warnings into errors.changequote([, ])],
[ case "$withval" in
  no)
    AC_MSG_RESULT(no)
    ERRORFLAGS=
    ;;		
  *)
    AC_MSG_RESULT(yes)
    if test "x$withval" = xyes; then
      withval='-Werror'
    fi
    ERRORFLAGS="$withval"
    ;;
  esac ],
  AC_MSG_RESULT(no)
)
AC_SUBST(ERRORFLAGS)

AC_MSG_CHECKING(for sanitizers)
AC_ARG_WITH(sanitizer,
[changequote(, )  --with-sanitizer[=<list>]            Use sanitizers, default ASAN.changequote([, ])],
[ case "$withval" in
  no)
    AC_MSG_RESULT(no)
    LIBSANI=
    ;;		
  *)
    if test "x$withval" = xyes; then
      withval='address'
    fi
    have_asan=0
    have_lsan=0
    have_ubsan=0
    for val in `echo "$withval" | sed "s/,/ /"`
    do
      LIBSANI=
      case "$val" in
      asan|address)
        FSANI=address
        LIBSANI=asan
        have_asan=1
        ;;
      lsan|leak)
        FSANI=leak
        LIBSANI=lsan
        have_lsan=1
        ;;
      ubsan|undefined)
        FSANI=undefined
        LIBSANI=ubsan
        have_ubsan=1
        ;;
      *)
        AC_MSG_ERROR(Sanitizer support for address, leak, and undefined behaviour only.)
        ;;
      esac
    done
    if test "$have_asan" -eq 1 -a "$have_lsan" -eq 1; then
      AC_MSG_ERROR(Do not combine address and leak sanitizers.)
    fi
    list=""
    sep=""
    if test "$have_asan" -eq 1; then
      CFLAGS="$CFLAGS -fsanitize=address"
      LIBS="$LIBS -lasan"
      list="$list$sep"address
      sep=" "
    fi
    if test "$have_lsan" -eq 1; then
      CFLAGS="$CFLAGS -fsanitize=leak"
      LIBS="$LIBS -llsan"
      list="$list$sep"leak
      sep=" "
    fi
    if test "$have_ubsan" -eq 1; then
      CFLAGS="$CFLAGS -fsanitize=undefined"
      LIBS="$LIBS -lubsan"
      list="$list$sep"undefined
      sep=" "
    fi
    AC_MSG_RESULT($list)
    ;;
  esac ],
  AC_MSG_RESULT(no)
)

AC_MSG_CHECKING(for emacs meta keys)
AC_ARG_WITH(emacs-meta-keys,
[changequote(, )  --with-emacs-meta-keys               Enable Emacs meta key support.changequote([, ])],
[ case "$withval" in
  no)
    AC_MSG_RESULT(no)
    ;;		
  *)
    AC_MSG_RESULT(yes)
    AC_DEFINE([WITH_EMACS_META_KEYS], 1, [define this if you want Emacs metakey support])
    ;;
  esac ],
  AC_MSG_RESULT(no)
)

AC_MSG_CHECKING(paranoia status)
AC_ARG_WITH(paranoid,
[changequote(, )  --with-paranoid                      Sets the compile-time paranoid flag.changequote([, ])],
[ AC_MSG_RESULT(yes)
  AC_DEFINE_UNQUOTED([PARANOID], 1, [define this if you want to be paranoid]) ],
  AC_MSG_RESULT(none)
)

AC_MSG_CHECKING(for /dev/urandom)
if test -c /dev/urandom; then
  AC_MSG_RESULT(yes)
  have_dev_random=1
  dev_random_path="/dev/urandom"
else
  AC_MSG_RESULT(no)
  AC_MSG_CHECKING(for /dev/random)
  if test -c /dev/random; then
    AC_MSG_RESULT(yes)
    have_dev_random=1
    dev_random_path="/dev/random"
  else
    AC_MSG_RESULT(no)
  fi
fi

if test -n "$have_dev_random"
then
  AC_DEFINE([HAVE_DEV_RANDOM], 1, [Define this if you have /dev/random])
  AC_DEFINE_UNQUOTED([DEV_RANDOM_PATH], ["$dev_random_path"], [Define this to the random device to use])
fi

AC_MSG_CHECKING(for default server)
AC_ARG_WITH(default-server,
[changequote(, )  --with-default-server=SERVER[:PORT]  Connect to SERVER by default.changequote([, ])],
[ if test "$withval"; then
    AC_MSG_RESULT($withval)
    AC_DEFINE_UNQUOTED([DEFAULT_SERVER], ["$withval"], [define this to be the name<:port> of the default server])
  else
    AC_MSG_RESULT(none)
  fi ],
  AC_MSG_RESULT(none)
)

dnl
dnl transitory option to disable the new window resizer
dnl

AC_MSG_CHECKING(for default window resize method)
defval=1
AC_ARG_WITH(default-resize-method,
[  --with-default-resize-method[=type]    Either "old" or "new"],
[ case "$withval" in
  new|old)
    AC_MSG_RESULT($withval)
    if test "$withval" = old; then
      defval=0;
    fi
    ;;
  *)
    AC_MSG_ERROR(Window resize method must be either "old" or "new".)
    ;;
  esac ],
  AC_MSG_RESULT("new")
)
if test $defval -eq 1; then
  AC_DEFINE_UNQUOTED([DEFAULT_RESIZE_METHOD], [$defval], [Use default window resize method. 0 for old method.])
fi

dnl
dnl check for -lcrypt
dnl

AC_CHECK_LIB(c, crypt,
  [have_crypt=1],
  AC_CHECK_LIB(crypt, crypt,
    [have_crypt=1
     LIBS="$LIBS -lcrypt"],
    AC_CHECK_LIB(des, des,
      [have_crypt=1
       LIBS="$LIBS -ldes"])))

if test -n "$have_crypt"
then
  AC_DEFINE([HAVE_CRYPT], 1, [define this if you have crypt(3)])
fi

dnl
dnl check for SOCKS
dnl

AC_MSG_CHECKING(whether to support SOCKS)
AC_ARG_WITH(socks,
[  --with-socks                         Compile with SOCKS firewall traversal support],
[ case "$withval" in
  no)
    AC_MSG_RESULT(no)
    ;;
  yes)
    AC_MSG_RESULT(yes)
    AC_CHECK_LIB(socks5, SOCKSconnect, [
	    socks=5
	    LIBS="$LIBS -lsocks5"], [
	AC_CHECK_LIB(socks, Rconnect, [
	    socks=4
	    LIBS="$LIBS -lsocks"], [
		AC_MSG_ERROR(Could not find socks library.  You must first install socks.) ] ) ] )
    ;;
  esac ],
  AC_MSG_RESULT(no)
)

if test "x$socks" = "x"; then
	AC_MSG_CHECKING(whether to support SOCKS5)
	AC_ARG_WITH(socks5,
	[changequote(, )  --with-socks5[=PATH]                 Compile with SOCKS5 firewall traversal support.changequote([, ])],
	[ case "$withval" in
	  no)
	    AC_MSG_RESULT(no)
	    ;;
	  *)
	    AC_MSG_RESULT(yes)
	    socks=5
	    socks5lib=""
	    if test "x$withval" = "xyes"; then
	      socks5lib="-lsocks5"
	    else
	      if test -d "$withval"; then
		if test -d "$withval/include"; then
		  CFLAGS="$CFLAGS -I$withval/include"
		else
		  CFLAGS="$CFLAGS -I$withval"
		fi
	        if test -d "$withval/lib"; then
		  socks5lib="-L$withval/lib -lsocks5"
		else
		  socks5lib="-L$withval -lsocks5"
		fi
	      else
		socks5lib="$withval"
	      fi
	    fi
	    LIBS="$socks5lib $LIBS"
	    # If Socks was compiled with Kerberos support, we will need
	    # to link against kerberos libraries.  Temporarily append
	    # to LIBS.  This is harmless if there is no kerberos support.
	    TMPLIBS="$LIBS"
	    LIBS="$LIBS $KERBEROS_LIBS"
	    AC_TRY_LINK([],
	                [ SOCKSconnect(); ],
			[],
			[ AC_MSG_ERROR(Could not find the $withval library.  You must first install socks5.) ])
	    LIBS="$TMPLIBS"
	    ;;
	  esac ],
	  AC_MSG_RESULT(no)
	)
fi

if test "x$socks" = "x"; then
	AC_MSG_CHECKING(whether to support SOCKS4)
	AC_ARG_WITH(socks4,
	[changequote(, )  --with-socks4[=PATH]                 Compile with SOCKS4 firewall traversal support.changequote([, ])],
	[ case "$withval" in
	  no)
	    AC_MSG_RESULT(no)
	    ;;
	  *)
	    AC_MSG_RESULT(yes)
	    socks=4
	    if test "x$withval" = "xyes"; then
	      withval="-lsocks"
	    else
	      if test -d "$withval"; then
	        withval="-L$withval -lsocks"
	      fi
	    fi
	    LIBS="$withval $LIBS"
	    AC_TRY_LINK([],
	                [ Rconnect(); ],
			[],
			[ AC_MSG_ERROR(Could not find the $withval library.  You must first install socks.) ])
	    ;;
	  esac ],
	  AC_MSG_RESULT(no)
	)
fi

if test -n "$socks"; then
  AC_DEFINE([SOCKS], 1, [Define this if compiling with SOCKS (the firewall traversal library)])
fi

if test "x$socks" = "x4"; then
    AC_DEFINE([SOCKS4], 1, [Define this if using the SOCKS version 4 library])
fi

if test "x$socks" = "x5"; then
    AC_DEFINE([SOCKS5], 1, [Define this if using the SOCKS version 5 library])
fi

AC_MSG_CHECKING(for non-blocking)
AC_ARG_WITH(non-blocking,
[changequote(, )  --with-non-blocking=[TYPE]           Use TYPE non-blocking, yes or no.changequote([, ])],
[
  case "$withval" in
  no|none)
    AC_MSG_RESULT(no)
    ;;
  *)
    if test -z "$socks"; then
      withval=no
      AC_MSG_RESULT(no, disabled due to SOCKS support)
    else
      AC_MSG_RESULT(yes)
      non_blocking_connects=1
    fi
    ;;
  esac ],
[ 
  AC_MSG_RESULT(yes)
  non_blocking_connects=1
])

if test -n "$non_blocking_connects"
then
  AC_DEFINE([NON_BLOCKING_CONNECTS], 1, [define this to use non-blocking connects. Precluded by SOCKS])
fi

if test -n "$hpux"
then
	# HP-UX's pax is broken
	AC_CHECK_PROGS(COPY_DIRECTORY, tar cpio)
else
	AC_CHECK_PROGS(COPY_DIRECTORY, pax tar cpio)
fi
if test "x$COPY_DIRECTORY" = "xpax";
then
    INSTALL_HELP_CMD='cd $(topdir)/help; pax -r -w -s ";.*/CVS$$;;" -s ";.*/\.CVS$$;;" -s ";.*/CVS/.*;;" -s ";.*/\.CVS/.*;;" . $(HELP_DIR)'
else
    if test "x$COPY_DIRECTORY" = "xtar";
    then
	INSTALL_HELP_CMD='cd $(topdir)/help; tar -cf - . | ( cd $(HELP_DIR); tar -xf - )'
    else
	if test "x$COPY_DIRECTORY" = "xcpio";
	then
	    INSTALL_HELP_CMD='cd $(topdir)/help; find . -print | cpio -pdu $(HELP_DIR)'
	else
	    INSTALL_HELP_CMD="@echo \"I couldn't figure out a way to install the help files.\""
	fi
    fi
fi
AC_SUBST(INSTALL_HELP_CMD)

AC_CHECK_PROGS(ZCAT, gzcat zcat gunzip gzip uncompress uncompress)
case "x$ZCAT" in
  xgzcat)
    ZSUFFIX=".gz"
    ZARGS=
    ;;
  xzcat)
    ZSUFFIX=".Z"
    ZARGS=
    ;;
  xgunzip)
    ZSUFFIX=".gz"
    ZARGS="-c"
    ;;
  xgzip)
    ZSUFFIX=".gz"
    ZARGS="-dc"
    ;;
  xuncompress)
    ZSUFFIX=".Z"
    ZARGS="-c"
    ;;
  xcompress)
    ZSUFFIX=".Z"
    ZARGS="-dc"
    ;;
esac
AC_DEFINE_UNQUOTED([ZCAT],["$ZCAT"], [define this to the ZCAT program of your choice])
AC_DEFINE_UNQUOTED([ZSUFFIX],["$ZSUFFIX"], [define these to the ZCAT suffer of your choice(.gz)])
if test x"$ZARGS" != x; then
  AC_DEFINE_UNQUOTED([ZARGS],["$ZARGS"], [define these to the ZCAT args of your choice])
fi

AC_FIND_PROGRAM(SENDMAIL,sendmail,/usr/sbin:/usr/lib:/usr/ucblib:/usr/local/sbin:/usr/pkg/sbin)

AC_SUBST(RM)
AC_SUBST(LN)
AC_OUTPUT(Makefile ircbug)

if test ! -f config.h; then
  cp ${srcdir}/include/config.h.dist config.h
fi

echo
echo well there we are, you now might want to look in config.h and 
echo see if there is anything you might want to tune, else you can
echo just run a make here..  good luck!
echo