home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / ircd4652.zip / ircd-df-4.6.5-os2 / Config < prev    next >
Text File  |  1998-06-08  |  42KB  |  1,889 lines

  1. #!/bin/sh
  2. #
  3. # Copyright 1996,1997 Michael Graff <explorer@flame.org>
  4. # You may distribute this file without changes freely providing this notice
  5. # remains intact. 
  6. #
  7. IRCD_VERSION="dal4.6.5.DreamForge+Nighthawk+OS/2"
  8. CONF_DATE=`date`
  9. LAST_VERSION="very very old"
  10. #
  11. trap "" 13 14 15
  12. MV=mv
  13. RM=rm
  14. SETUP=include/setup.h
  15. OPTIONS_H=include/options.h
  16. OPTIONS=Options
  17. AUTO_CONFIG=""
  18. #
  19. STDLIBH=undef
  20. STDDEFH=undef
  21. SYSSYSLOGH=undef
  22. MALLOCH=undef
  23. PARAMH=undef
  24. UNISTDH=undef
  25. STRINGH=undef
  26. STRINGSH=undef
  27. RUSAGEH=undef
  28. NOINDEX=undef
  29. NSTRERROR=undef
  30. NSTRTOKEN=undef
  31. NSTRTOK=undef
  32. NINETADDR=undef
  33. NINETNTOA=undef
  34. NINETNETOF=undef
  35. GETTIMEOFDAY=undef
  36. LRAND48=undef
  37. STRTOUL=undef
  38. NEEDSKIPNAME=""
  39. CCPATH=''
  40. SIGNAL=''
  41. BLOCKING=''
  42. TMP=/tmp/.Configtmp$$.c
  43. EXEC=/tmp/.Configtmp$$
  44. PLATE=/tmp/.ConPlate$$
  45. c=''
  46. n=''
  47. #
  48. # Some reasonable defaults
  49. #
  50. DEFOPT="-O -g"
  51. DEFCFLAGS="$DEFOPT"
  52. DEFLIBS="none"
  53. OSNAME="an unrecgonized operating system"
  54. #
  55. NOSPOOF="1"
  56. NOSPOOF_SEED01="0x12345678"
  57. NOSPOOF_SEED02="0x9abcdef0"
  58. CONTACT_URL=""
  59. CONTACT_EMAIL=""
  60. SERVICES_NAME="none"
  61. KLINE_ADDRESS=""
  62. DPATH="/usr/local/lib/ircd"
  63. SPATH="/usr/local/bin/ircd"
  64. HUB=""
  65. CRYPT_OPER_PASSWORD="1"
  66. CRYPT_LINK_PASSWORD=""
  67. LISTEN_SIZE="5"
  68. MAXSENDQLENGTH="3000000"
  69. BUFFERPOOL="(9 * MAXSENDQLENGTH)"
  70. NICKNAMEHISTORYLENGTH="2000"
  71. UNIXPORT=""
  72. MAXCONNECTIONS="1024"
  73. SHOWOPERS="Yes"
  74.  
  75. #
  76. # load $OPTIONS if present
  77. #
  78. if [ -r "$OPTIONS" ] ; then
  79.     . $OPTIONS
  80. fi
  81.  
  82. #
  83. 2>/dev/null
  84. if [ "`eval echo -n 'a'`" = "-n a" ] ; then
  85.     c='\c'
  86. else
  87.     n='-n'
  88. fi
  89.  
  90. clear
  91.  
  92. if [ "$LAST_VERSION" != "$IRCD_VERSION" ] ; then
  93.     if [ -r doc/CHANGES.NEW ] ; then
  94.     more doc/CHANGES.NEW
  95.     echo $n "[Enter to begin]"
  96.     read cc
  97.     fi
  98. fi
  99.  
  100. if [ "$1" = "-n" ] ; then
  101.     if [ "$LAST_VERSION" != "$IRCD_VERSION" ] ; then
  102.     echo "You specified the no-questions-asked configure, but the version"
  103.     echo "of Config which created your Options file was $LAST_VERSION,"
  104.     echo "And the current version is $IRCD_VERSION."
  105.     echo " "
  106.     echo "Please read the prompts carefully since some of them may have"
  107.     echo "changed."
  108.     echo " "
  109.     else
  110.     AUTO_CONFIG=Yes
  111.     fi
  112. fi
  113.  
  114. #
  115. # Take a wild stab at the OS, and take reasonable defaults for each
  116. #
  117. OS=`uname -a`
  118. case "$OS" in
  119.     *NetBSD*)
  120.     DEFCFLAGS="$DEFOPT"
  121.     DEFLIBS="-lcrypt"
  122.     OSNAME="NetBSD"
  123.     ;;
  124.     *FreeBSD*2.2*)
  125.         DEFCFLAGS="$DEFOPT"
  126.         DEFLIBS="none"
  127.         OSNAME="FreeBSD 2.2"
  128.         CRYPT_OPER_PASSWORD=""
  129.         CRYPT_LINK_PASSWORD=""
  130.         echo "You are using FreeBSD 2.2; do NOT crypt passwords at this time"
  131.         ;;
  132.     *FreeBSD*)
  133.     DEFCFLAGS="$DEFOPT"
  134.     DEFLIBS="none"
  135.     OSNAME="FreeBSD"
  136.     CRYPT_OPER_PASSWORD=""
  137.     CRYPT_LINK_PASSWORD=""
  138.     echo "You are using FreeBSD ; do NOT crypt passwords at this time"
  139.     ;;
  140.     *SCO_SV*)
  141.     DEFCFLAGS="$DEFOPT -DSCOUNIX"
  142.     DEFLIBS="-lsocket"
  143.     OSNAME="SCO Openserver"
  144.     NEEDSKIPNAME="Yep"
  145.     echo "You're using SCO Unix. For more support, contact darkrot@dal.net"
  146.     ;;
  147.     *OSF1*alpha*)
  148.     DEFCFLAGS="$DEFOPT"
  149.     DEFLIBS="none"
  150.     OSNAME="OSF/1 or Digital Unix"
  151.     ;;
  152.     *SunOS*4.*)
  153.     DEFCFLAGS="$DEFOPT"
  154.     DEFLIBS="none"
  155.     OSNAME="SunOS 4.x"
  156.     ;;
  157.     *SunOS*5.*)
  158.     DEFCFLAGS="$DEFOPT -DSOL20"
  159.     DEFLIBS="-lsocket -lnsl -lresolv"
  160.     OSNAME="Solaris 2.x (or SunOS 5.x)"
  161.     ;;
  162.     *Linux*)
  163. #
  164. # Linux, now we need to do some cludging because certain tests don't work
  165. # well in RedHat 5.
  166. #
  167.     DEFCFLAGS="$DEFOPT"
  168.     DEFLIBS=""
  169.     OSNAME="Linux"
  170.     if [ -r /etc/redhat-release -a -n "`grep \"release 5.0\"  /etc/redhat-release`" ]
  171.     then
  172.         OSNAME="Linux RedHat 5.0"
  173.         DEFLIBS="-lcrypt -lresolv"
  174.     fi
  175.     ;;
  176.     *HP-UX*.09.*)
  177.     DEFCFLAGS="$DEFOPT"
  178.     DEFLIBS=""
  179.     OSNAME="HPUX 9.x"
  180.     ;;
  181.     *HP-UX*.10.*)
  182.     DEFCFLAGS="$DEFOPT"
  183.     DEFLIBS=""
  184.     OSNAME="HPUX 10.x"
  185.     ;;
  186. esac
  187.  
  188. echo " "
  189. echo You are running $OSNAME...
  190. echo " "
  191.     
  192. # Create Makefile if it doesn't exist...
  193. if [ ! -f Makefile ] ; then
  194.   cp Makefile.dist Makefile
  195. fi
  196. cat << __EOF__
  197. Welcome to autoconfigure for the DALnet IRC server version $IRCD_VERSION.
  198.  
  199. Config will generate a system-specific $SETUP file, a top
  200. level Makefile, $OPTIONS_H, and a persistant options file named
  201. $OPTIONS
  202.  
  203. Enter "none" at any prompt to effect a null entry.
  204.  
  205. __EOF__
  206.  
  207. runonce=""
  208. FOO=`egrep "^CC=" Makefile 2>/dev/null | sed -e 's/^[^=]*[     ]*=\(.*\)/\1/'`
  209. while [ -z "$CCPATH" ] ; do
  210.     MYP=`echo "$PATH" | sed -e 's/:/ /g'`
  211.     echo "Which compiler do you use, gcc or cc or...?"
  212.     echo $n "[$FOO] -> $c"
  213.     if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
  214.         read cc
  215.     else
  216.         cc=""
  217.     fi
  218.     if [ -z "$cc" ] ; then
  219.         cc=$FOO
  220.         CCPATH=$FOO
  221.     elif [ -f $cc ] ; then
  222.         CCPATH=$cc
  223.     else
  224.         for i in $MYP; do
  225.             if [ -f $i/$cc -a -z "$CCPATH" ] ; then
  226.                 CCPATH=$i/$cc
  227.             fi
  228.         done
  229.     fi
  230.     if [ -z "$CCPATH" ]; then runonce="Yes"; fi
  231. done
  232. if [ "$FOO" != "$cc" ] ; then
  233.     MYP=`echo "$CCPATH" | sed -e 's@/@ @g'`
  234.     set $MYP
  235.     if [ $2 ] ; then
  236.         while [ $2 ] ; do
  237.             shift
  238.         done
  239.     fi
  240.     if [ $1 = "gcc" ] ; then
  241.         CCPATH="$CCPATH"
  242.     fi
  243. fi
  244. echo "Compiler selected: $CCPATH"
  245. echo " "
  246. # Check it out
  247. cat > $TMP <<__EOF__
  248. main() {}
  249. __EOF__
  250. $CCPATH $TMP -o $EXEC >/dev/null 2>&1
  251. if [ ! -f $EXEC ] ; then
  252.         echo "You don't have $CCPATH or it's broken!"
  253.         exit 1
  254. fi
  255. # Fix Makefile
  256. #
  257. $RM -f Makefile.tmp
  258. sed -e "s@^CC=\(.*\)@CC=$CCPATH@" Makefile > Makefile.tmp
  259. cp Makefile.tmp Makefile
  260. $RM -f Makefile.tmp
  261. #
  262. echo "Enter additional flags to give to $CCPATH"
  263. FOO=`egrep "^XCFLAGS=" Makefile 2>/dev/null | sed -e 's/^[^=]*=[     ]*\(.*\)/\1/'`
  264. if [ -z "$FOO" ] ; then
  265.     echo "I recommend $DEFCFLAGS"
  266.     FOO="$DEFCFLAGS"
  267. fi
  268. echo $n "[$FOO] -> $c"
  269. if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
  270.     read cc
  271. else
  272.     cc=""
  273. fi
  274. if [ -z "$cc" ] ; then
  275.     cc="$FOO"
  276. fi
  277. if [ "$cc" = "none" ] ; then
  278.     cc=''
  279. fi
  280. XCFLAGS=$cc
  281. # Fix Makefile
  282. #
  283. $RM -f Makefile.tmp
  284. sed -e "s@^XCFLAGS=\(.*\)@XCFLAGS=$XCFLAGS@" Makefile > Makefile.tmp
  285. cp Makefile.tmp Makefile
  286. $RM -f Makefile.tmp
  287. #
  288. cat <<__EOF__
  289.  
  290. If you need to use any extra libraries when compiling the server,
  291. please tell me now (might need to look at the Makefiles) and please
  292. include all the -l and -L flags.
  293.  
  294. You should use the recommended value unless you have a compelling reason
  295. not to...
  296. __EOF__
  297. LIBS=`egrep "^IRCDLIBS=" Makefile 2>/dev/null | sed -e 's/^[^=]*=\(.*\)/\1/' | tr -d "\012"`
  298. if [ -z "$LIBS" ] ; then
  299.     echo "I suggest: $DEFLIBS"
  300.     LIBS="$DEFLIBS"
  301. fi
  302. echo $n "[$LIBS] -> $c"
  303. if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
  304.     read cc
  305. else
  306.     cc=""
  307. fi
  308. if [ -z "$cc" ] ; then
  309.     cc="$LIBS"
  310. fi
  311. if [ "$cc" = "none" ] ; then
  312.     cc=''
  313. fi
  314. LIBS=$cc
  315. # Fix Makefile
  316. #
  317. $RM -f Makefile.tmp
  318. sed -e "s@^IRCDLIBS=\(.*\)@IRCDLIBS=$LIBS@" Makefile > Makefile.tmp
  319. cp Makefile.tmp Makefile
  320. $RM -f Makefile.tmp
  321. #
  322. COMP="$CCPATH $XCFLAGS $TMP -o $EXEC $LIBS"
  323. #
  324. echo 'Checking out /usr/include'
  325. echo $n "...Looking for /usr/include/stdlib.h...$c"
  326. if [ -r /usr/include/stdlib.h ] ; then
  327.     STDLIBH=define
  328.     echo  'found!'
  329. else
  330.     echo 'not found :('
  331. fi
  332. echo $n "...Looking for stddef.h...$c"
  333. if [ -r /usr/include/stddef.h ] ; then
  334.         STDDEFH=define
  335.     echo  'found!'
  336. else
  337.     echo 'not found :('
  338. fi
  339. echo $n "...Looking for /usr/include/sys/syslog.h...$c"
  340. if [ -r /usr/include/sys/syslog.h ] ; then
  341.     SYSSYSLOGH=define
  342.     echo  'found!'
  343. else
  344.     echo 'not found :('
  345. fi
  346. #echo $n "...Looking for malloc.h...$c"
  347. #if [ -r /usr/include/malloc.h ] ; then
  348. #    MALLOCH=malloc.h
  349. #    echo  'found!'
  350. #elif [ -r /usr/include/sys/malloc.h ] ; then
  351. #    MALLOCH=sys/malloc.h
  352. #    echo  'found!'
  353. #else
  354. #    echo 'not found :('
  355. #    MALLOCH=undef
  356. #fi
  357.  
  358. echo $n "...Looking for /usr/include/sys/param.h...$c"
  359. if [ -r /usr/include/sys/param.h ] ; then
  360.     PARAMH=define
  361.     echo  'found!'
  362. else
  363.     echo 'not found :('
  364. fi
  365. echo $n "...Looking for /usr/include/unistd.h...$c"
  366. if [ -r /usr/include/unistd.h ] ; then
  367.     UNISTDH=define
  368.     echo  'found!'
  369. else
  370.     echo 'not found :('
  371. fi
  372. echo $n "...Looking for /usr/include/string.h...$c"
  373. if [ -r /usr/include/string.h ] ; then
  374.     STRINGH=define
  375.     echo  'found!'
  376. else
  377.     echo 'not found :('
  378. fi
  379. echo $n "...Looking for /usr/include/strings.h...$c"
  380. if [ -r /usr/include/strings.h ] ; then
  381.     STRINGSH=define
  382.     echo  'found!'
  383. else
  384.     echo 'not found :('
  385. fi
  386. echo $n "...Looking for /usr/include/sys/rusage.h...$c"
  387. if [ -r /usr/include/sys/rusage.h ] ; then
  388.     RUSAGEH=define
  389.     echo  'found!'
  390. else
  391.     echo 'not found (good!)'
  392. fi
  393. #
  394. # to b or not to b
  395. #
  396. echo " "
  397. echo $n "To be or not to be...$c"
  398. cat > $TMP <<__EOF__
  399. main()
  400. {
  401.     char    a[3], b[3];
  402.     bzero(b,3);
  403.     bcopy(a,b,3);
  404.     (void)bcmp(a,b,3);
  405.     exit(0);
  406. }
  407. __EOF__
  408. $COMP >/dev/null 2>&1
  409. if [ $? -eq 0 ] ; then
  410.     echo "and so it shall be! bcopy/bzero/bcmp are about!"
  411.     BZERO=bzero
  412. else
  413.     echo "and it wasn't.  No bcopy/bzero/bcmp...hmpf"
  414.     BZERO=memset
  415. fi
  416. echo " "
  417. echo $n "Which one, gettimeofday, or lrand48..$c"
  418. cat > $TMP <<__EOF__
  419. #include <stdio.h>
  420. #include <sys/time.h>
  421. main()
  422.  {
  423.    struct timeval tv;
  424.    (void) gettimeofday(&tv, NULL);
  425.  }
  426. __EOF__
  427. $COMP >/dev/null 2>&1
  428. if [ $? -eq 0 ] ; then
  429.     echo "We have a winner! gettimeofday found."
  430.     GETTIMEOFDAY=define
  431. else
  432.     echo "No gettimeofday. Lets try lrand48."
  433. cat > $TMP <<__EOF__
  434. main()
  435. {
  436.    int a;
  437.    a=lrand48();
  438. }
  439. __EOF__
  440.     $COMP >/dev/null 2>&1
  441.     if [ $? -eq 0 ] ; then
  442.          echo "Bingo! lrand48!"
  443.         LRAND48=define
  444.     fi
  445. fi
  446. #
  447. # check for non-blocking fd style available..
  448. #
  449. echo " "
  450. echo 'Checking for POSIX/BSD/SYSV non-blocking stuff'
  451. if [ -f $TMP -o -d $TMP ] ; then
  452.     $RM -f $TMP
  453. fi
  454. cat > $PLATE <<__EOF__
  455. #include <sys/types.h>
  456. #include <sys/socket.h>
  457. #include <fcntl.h>
  458. #include <sys/ioctl.h>
  459. #include <sys/file.h>
  460. #include <signal.h>
  461. alarmed()
  462. {
  463.     exit(1);
  464. }
  465. main()
  466. {
  467.     char b[12], x[32];
  468.     int f, l = sizeof(x);
  469.     f = socket(AF_INET, SOCK_DGRAM, 0);
  470.     if (f >= 0 && !(fcntl(f, F_SETFL, BLOCKING))) {
  471.         signal(SIGALRM, alarmed);
  472.         alarm(3);
  473.         recvfrom(f, b, 12, 0, x, &l);
  474.         alarm(0);
  475.         exit(0);
  476.     }
  477.     exit(1);
  478. }
  479. __EOF__
  480. sed -e 's/BLOCKING/O_NONBLOCK/' $PLATE > $TMP
  481. $COMP >/dev/null 2>&1
  482. if [ 0 -eq $? ] ; then
  483.     $EXEC
  484. fi
  485. if [ 0 -eq $? ] ; then
  486.     BLOCK=O_NONBLOCK
  487. else
  488.     echo 'O_NONBLOCK not present/working in fcntl.h or sys/ioctl.h'
  489.     if [ -f $TMP -o -d $TMP ] ; then
  490.         $RM -f $TMP $EXEC;
  491.     fi
  492.     sed -e 's/BLOCKING/O_NDELAY/' $PLATE > $TMP
  493.     $COMP >/dev/null 2>&1
  494.     if [ 0 -eq $? ] ; then
  495.         $EXEC
  496.     fi
  497.     if [ 0 -eq $? ] ; then
  498.         BLOCK=O_NDELAY
  499.     else
  500.         echo 'O_NDELAY not present/working in fcntl.h or sys/ioctl.h'
  501.         if [ -f $TMP -o -d $TMP ] ; then
  502.             $RM -f $TMP $EXEC;
  503.         fi
  504.         sed -e 's/BLOCKING/FIONBIO/' $PLATE > $TMP
  505.         $COMP >/dev/null 2>&1
  506.         if [ 0 -eq $? ] ; then
  507.             echo 'FIONBIO not found!  No option found!'
  508.             BLOCK=none
  509.         else
  510.             BLOCK=FIONBIO
  511.         fi
  512.     fi
  513. fi
  514. $RM -f $TMP $PLATE $EXEC
  515. echo "Blocking selected: $BLOCK";
  516. #
  517. # reliable signals ?
  518. #
  519. echo 'Looking for reliable signals...'
  520. echo "Hmmm...wonder if you have 'action from POSIX..."
  521. cat > $TMP <<__EOF__
  522. #include <signal.h>
  523.  
  524. main()
  525. {    /* poor replacement for NULL but who cares here ? */
  526.     sigaction(SIGTERM, (struct sigaction *)0L, (struct sigaction *)0L);
  527. }
  528. __EOF__
  529. $COMP >/dev/null 2>&1
  530. if [ $? -eq 0 ] ; then
  531.     echo "Ooooh, you are a lucky one! 'action from POSIX!"
  532.     SIGNAL=posix
  533. else
  534.     $RM -f $EXEC $TMP
  535.     cat > $TMP <<__EOF__
  536. #include <signal.h>
  537. int    calls = 0;
  538. void    handler()
  539. {
  540.     if (calls)
  541.         return;
  542.     calls++;
  543.     kill(getpid(), SIGTERM);
  544.     sleep(1);
  545. }
  546. main()
  547. {
  548.     signal(SIGTERM, handler);
  549.     kill(getpid(), SIGTERM);
  550.     exit (0);
  551. }
  552. __EOF__
  553.     echo $n "Nope, but you have...$c"
  554.     $COMP >/dev/null 2>&1
  555.     $EXEC
  556.     if [ $? -eq 0 ] ; then
  557.         echo 'reliable signals! Cheers BSD!'
  558.         SIGNAL=bsd
  559.     else
  560.         echo "yucky, unreliable SYSV!"
  561.         SIGNAL=sysv
  562.     fi
  563. fi
  564. $RM -f $EXEC $TMP
  565. #
  566. echo 'Now those strings libraries...hmm...which one is it...'
  567. cat > $TMP <<__EOF__
  568. #$STRINGH STRINGH
  569. #$STRINGSH STRINGSH
  570. #ifdef STRINGH
  571. #include <string.h>
  572. #endif
  573. #ifdef STRINGSH
  574. #include <strings.h>
  575. #endif
  576. main()
  577. {
  578.     char *s = index("foo", 'o');
  579.     exit(0);
  580. }
  581. __EOF__
  582. $COMP >/dev/null 2>&1
  583. if [ $? -eq 0 ] ; then
  584.     echo "Cool...you have index()!"
  585. else
  586.     NOINDEX=define
  587.     echo "Grmpf...I guess there is a strchr() out there somewhere..."
  588. fi
  589. $RM -f $EXEC $TMP
  590. #
  591. # getrusage or times ?
  592. #
  593. echo $n "One for debugging, mainly, getrusage(2) or times(2)...$c"
  594. cat > $TMP <<__EOF__
  595. #include <sys/types.h>
  596. #include <sys/time.h>
  597. #include <sys/resource.h>
  598. main()
  599. {
  600.     struct    rusage    rus;
  601.     (void)getrusage(RUSAGE_SELF, &rus);
  602. }
  603. __EOF__
  604. $COMP >/dev/null 2>&1
  605. if [ $? -eq 0 ] ; then
  606.     TIMES=getrusage
  607.     echo "getrusage()"
  608. else
  609.     $RM -f $EXEC $TMP
  610.     cat > $TMP <<__EOF__
  611. #include <sys/types.h>
  612. #include <sys/time.h>
  613. #include <sys/times.h>
  614. main()
  615. {
  616.     struct    tms    tmsbuf;
  617.     (void)times(&tmsbuf);
  618. }
  619. __EOF__
  620.     $COMP >/dev/null 2>&1
  621.     if [ $? -eq 0 ] ; then
  622.         TIMES=times
  623.         echo "times()"
  624.     else
  625.         echo "couldn't get either ?!"
  626.         TIMES=none
  627.     fi
  628. fi
  629. #
  630. # what do we need that isn't here already ?
  631. #
  632. echo "What else do I need that you don't have..."
  633. echo $n "Lets see...$c"
  634. cat > $TMP <<__EOF__
  635. main()
  636. {
  637.     unsigned long foo;
  638.  
  639.     char  *s = strtoul("0x12345", &foo, 16);
  640.     exit(0);
  641. }
  642. __EOF__
  643. $COMP >/dev/null 2>&1
  644. if [ $? -ne 0 ] ; then
  645.     echo $n " strtoul$c"
  646.     $RM -f Makefile.tmp
  647.     sed -e "s@^STRTOUL=\(.*\)@STRTOUL=strtoul.o@" Makefile > Makefile.tmp
  648.     cp Makefile.tmp Makefile
  649.     $RM -f Makefile.tmp
  650. else
  651.     $RM -f Makefile.tmp
  652.     sed -e "s@^STRTOUL=\(.*\)@STRTOUL=@" Makefile > Makefile.tmp
  653.     cp Makefile.tmp Makefile
  654.     $RM -f Makefile.tmp
  655. fi
  656. $RM -f $EXEC $TMP
  657. cat > $TMP <<__EOF__
  658. main()
  659. {
  660.     char  *s = strerror(0);
  661.     exit(0);
  662. }
  663. __EOF__
  664. $COMP >/dev/null 2>&1
  665. if [ $? -ne 0 ] ; then
  666.     echo $n " strerror$c"
  667.     NSTRERROR=define
  668. fi
  669. $RM -f $EXEC $TMP
  670. cat > $TMP <<__EOF__
  671. #include <sys/types.h>
  672. #include <netinet/in.h>
  673. #include <arpa/nameser.h>
  674. #include <resolv.h>
  675.  
  676. main()
  677. {
  678.     dn_skipname("","");
  679.     exit(0);
  680. }
  681. __EOF__
  682. $COMP >/dev/null 2>&1
  683. # dn_skipname passes the small test but won't resolve when ircd is linked.
  684. # Hmmm...
  685. if [ $? -ne 0 -o "$OSNAME" = "Linux RedHat 5.0" -o -n "$NEEDSKIPNAME" ] ; then
  686.     echo $n " dn_skipname$c"
  687.     $RM -f Makefile.tmp
  688.     sed -e "s@^RES=\(.*\)@RES=res_skipname.o@" Makefile > Makefile.tmp
  689.     cp Makefile.tmp Makefile
  690.     $RM -f Makefile.tmp
  691. else
  692.     $RM -f Makefile.tmp
  693.     sed -e "s@^RES=\(.*\)@RES=@" Makefile > Makefile.tmp
  694.     cp Makefile.tmp Makefile
  695.     $RM -f Makefile.tmp
  696. fi
  697. $RM -f $EXEC $TMP
  698. cat > $TMP <<__EOF__
  699. #include <sys/types.h>
  700. main()
  701. {
  702.     u_int32_t foo;
  703.     exit(0);
  704. }
  705. __EOF__
  706. $COMP >/dev/null 2>&1
  707. if [ $? -ne 0 ] ; then
  708.     echo $n " u_int32_t$c"
  709.     $RM -f Makefile.tmp
  710.     sed -e "s@^NEED_U_INT32_T=\(.*\)@NEED_U_INT32_T=-DNEED_U_INT32_T@" Makefile > Makefile.tmp
  711.     cp Makefile.tmp Makefile
  712.     $RM -f Makefile.tmp
  713. else
  714.     $RM -f Makefile.tmp
  715.     sed -e "s@^NEED_U_INT32_T=\(.*\)@NEED_U_INT32_T=@" Makefile > Makefile.tmp
  716.     cp Makefile.tmp Makefile
  717.     $RM -f Makefile.tmp
  718. fi
  719. $RM -f $EXEC $TMP
  720. cat > $TMP <<__EOF__
  721. #$STRINGH STRINGH
  722. #$STRINGSH STRINGSH
  723. #ifdef STRINGH
  724. #include <string.h>
  725. #endif
  726. #ifdef STRINGSH
  727. #include <strings.h>
  728. #endif
  729. main()
  730. {
  731.     char  t[] = "a", **p = NULL, *s = strtoken(&p, t, ",");
  732.     if (!strcmp(t, s))
  733.         exit(0);
  734.     exit(1);
  735. }
  736. __EOF__
  737. $COMP >/dev/null 2>&1
  738. if [ $? -ne 0 ] ; then
  739.     echo $n " strtoken$c"
  740.     NSTRTOKEN=define
  741. else
  742.     $EXEC
  743.     if [ $? -ne 0 ] ; then
  744.         echo $n " strtoken$c"
  745.         NSTRTOKEN=define
  746.     fi
  747. fi
  748. $RM -f $EXEC $TMP
  749. cat > $TMP <<__EOF__
  750. #$STRINGH STRINGH
  751. #$STRINGSH STRINGSH
  752. #ifdef STRINGH
  753. #include <string.h>
  754. #endif
  755. #ifdef STRINGSH
  756. #include <strings.h>
  757. #endif
  758. main()
  759. {
  760.     char  t[] = "a", *s = strtok(t, ",");
  761.     if (!strcmp(t, s))
  762.         exit(0);
  763.     exit(1);
  764. }
  765. __EOF__
  766. $COMP >/dev/null 2>&1
  767. if [ $? -ne 0 ] ; then
  768.     echo $n " strtok$c"
  769.     NSTRTOK=define
  770. else
  771.     $EXEC
  772.     if [ $? -ne 0 ] ; then
  773.         echo $n " strtok$c"
  774.         NSTRTOK=define
  775.     fi
  776. fi
  777. $RM -f $EXEC $TMP
  778. cat > $TMP << __EOF__
  779. #include <sys/types.h>
  780. #include <netinet/in.h>
  781. main()
  782. {
  783.     struct    in_addr in;
  784.     (void)inet_addr("1.2.3.4");
  785. }
  786. __EOF__
  787. $COMP >/dev/null 2>&1
  788. if [ $? -ne 0 ] ; then
  789.     echo $n " inet_addr$c"
  790.     NINETADDR=define
  791. fi
  792. $RM -f $EXEC $TMP
  793. cat > $TMP << __EOF__
  794. #include <sys/types.h>
  795. #include <netinet/in.h>
  796. main()
  797. {
  798.     struct    in_addr    in;
  799.     in.s_addr = 0x12345678;
  800.     (void)inet_ntoa(in);
  801. }
  802. __EOF__
  803. $COMP >/dev/null 2>&1
  804. if [ $? -ne 0 ] ; then
  805.     echo $n " inet_ntoa$c"
  806. fi
  807. $RM -f $EXEC $TMP
  808. cat > $TMP << __EOF__
  809. #include <sys/types.h>
  810. #include <netinet/in.h>
  811. main()
  812. {
  813.     struct    in_addr    in;
  814.     in.s_addr = 0x87654321;
  815.     (void)inet_netof(in);
  816. }
  817. __EOF__
  818. $COMP >/dev/null 2>&1
  819. if [ $? -ne 0 ] ; then
  820.     echo $n " inet_netof$c"
  821.     NINETNETOF=define
  822. fi
  823. $RM -f $EXEC $TMP
  824. echo " "
  825. #
  826. #
  827. #
  828. echo " "
  829. echo "Ok, here's your chance...I think you should use $BLOCK, you want"
  830. echo "which of these ? O_NONBLOCK (POSIX) O_NDELAY (BSD) FIONBIO (SYSV)"
  831. echo $n "[$BLOCK] -> $c"
  832. if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
  833.     read cc
  834. else
  835.     cc=""
  836. fi
  837. if [ "$cc" = "none" ] ; then
  838.     cc=''
  839. elif [ -z "$cc" ] ; then
  840.     cc=$BLOCK
  841. fi
  842. BLOCK=$cc
  843. echo "I found $SIGNAL signals."
  844. if [ "$cc" = "none" ] ; then
  845.     cc=''
  846. elif [ "$SIGNAL" = "posix" ] ; then
  847.     echo "Hmmm...I'm not sure if signal() is reliable or not either..."
  848. fi
  849. echo "You can choose between posix, bsd and sysv.  What'll it be ?"
  850. echo $n "[$SIGNAL] -> $c"
  851. if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
  852.     read cc
  853. else
  854.     cc=""
  855. fi
  856. if [ "$cc" = "none" ] ; then
  857.     cc=''
  858. elif [ -z "$cc" ] ; then
  859.     cc=$SIGNAL
  860. fi
  861. SIGNAL=$cc
  862. if [ "$TIMES" = "none" ] ; then
  863.     echo "I didn't find either getrusage or times earlier...If you do have"
  864.     echo "either of these, please tell me now."
  865. else
  866.     echo "I found $TIMES, out of getrusage and times.  getrusage is"
  867.     echo "more informative.  If you wish to swap your choice, please"
  868.     echo "do so now."
  869. fi
  870. echo $n "[$TIMES] -> $c"
  871. if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
  872.     read cc
  873. else
  874.     cc=""
  875. fi
  876. if [ "$cc" = "none" ] ; then
  877.     cc=''
  878. elif [ -z "$cc" ] ; then
  879.     cc=$TIMES
  880. fi
  881. TIMES=$cc
  882.  
  883. $RM -f $EXEC $TMP $PLATE
  884. cat > $SETUP  <<__EOF__
  885. #ifndef __setup_include__
  886. #define __setup_include__
  887. #$PARAMH    PARAMH
  888. #$UNISTDH    UNISTDH
  889. #$STRINGH    STRINGH
  890. #$STRINGSH    STRINGSH
  891. #$STDLIBH    STDLIBH
  892. #$STDDEFH    STDDEFH
  893. #$SYSSYSLOGH    SYSSYSLOGH
  894. #$NOINDEX    NOINDEX
  895. #$NSTRERROR    NEED_STRERROR
  896. #$NSTRTOKEN    NEED_STRTOKEN
  897. #$NSTRTOK    NEED_STRTOK
  898. #$NINETADDR    NEED_INET_ADDR
  899. #$NINETNTOA    NEED_INET_NTOA
  900. #$NINETNETOF    NEED_INET_NETOF
  901. #$GETTIMEOFDAY    GETTIMEOFDAY
  902. #$LRAND48    LRAND48
  903. __EOF__
  904. if [ "$MALLOCH" = "undef" ] ; then
  905.     echo "#undef    MALLOCH" >> $SETUP
  906. else
  907.     echo "#define    MALLOCH    <$MALLOCH>" >> $SETUP
  908. fi
  909. if [ "$BZERO" = "memset" ] ; then
  910.     cat >> $SETUP <<__EOF__
  911. #define    bzero(a,b)    memset(a,0,b)
  912. #define    bcopy(a,b,c)    memcpy(b,a,c)
  913. #define    bcmp    memcmp
  914. __EOF__
  915. fi
  916. if [ "$BLOCK" = "O_NONBLOCK" ] ; then
  917.     echo "#define    NBLOCK_POSIX" >> $SETUP
  918. elif [ "$BLOCK" = "O_NDELAY" ] ; then
  919.     echo "#define    NBLOCK_BSD" >> $SETUP
  920. else
  921.     echo "#define    NBLOCK_SYSV" >> $SETUP
  922. fi
  923. if [ "$SIGNAL" = "posix" ] ; then
  924.     echo "#define    POSIX_SIGNALS" >> $SETUP
  925. elif [ "$SIGNAL" = "bsd" ] ; then
  926.     echo "#define    BSD_RELIABLE_SIGNALS" >> $SETUP
  927. else
  928.     echo "#define    SYSV_UNRELIABLE_SIGNALS" >> $SETUP
  929. fi
  930. if [ "$TIMES" = "times" ] ; then
  931.     echo "#define    TIMES_2" >> $SETUP
  932.     echo "#undef    GETRUSAGE_2" >> $SETUP
  933. elif [ "$TIMES" = "getrusage" ] ; then
  934.     echo "#undef    TIMES_2" >> $SETUP
  935.     echo "#define    GETRUSAGE_2" >> $SETUP
  936. else
  937.     echo "#undef    TIMES_2" >> $SETUP
  938.     echo "#undef    GETRUSAGE_2" >> $SETUP
  939. fi
  940. echo "#endif" >> $SETUP
  941.  
  942. #
  943. # Now, get site specific options.
  944. #
  945.  
  946. FOO=""
  947. runonce=""
  948. while [ -z "$FOO" ] ; do
  949.     if [ -n "$NOSPOOF" ] ; then
  950.     FOO="Yes"
  951.     else
  952.     FOO="No"
  953.     fi
  954.     echo ""
  955.     echo "Many operating systems are running with insecure TCP stacks."
  956.     echo "This allows IP spoofing attacks, which are very difficult for"
  957.     echo "operators to track down and ban."
  958.     echo ""
  959.     echo "If you are CERTAIN your operating system has secure TCP stacks"
  960.     echo "you do not need to define this.  If you are not certain, define"
  961.     echo "this and find out if you need it later or not.  You can mail the"
  962.     echo "source mailing list later; someone there can help you determine"
  963.     echo "if your OS is secure or not."
  964.     echo ""
  965.  
  966.         if [ "$OSNAME" = "FreeBSD 2.2" ]; then
  967.         echo "Your version of FreeBSD is 2.2-Release or later, so you do not"
  968.         echo "need to run nospoof."
  969.         echo ""
  970.         FOO=No
  971.         fi
  972.  
  973.         if [ "$OSNAME" = "FreeBSD" ]; then
  974.         echo "If your version of FreeBSD is 2.2-Release or later, you do not"
  975.         echo "need to run nospoof."
  976.         echo ""
  977.         fi
  978.  
  979.     echo "Do you have an insecure operating system and therefore want to"
  980.     echo "use the server anti-spoof protection?"
  981.     echo $n "[$FOO] -> $c"
  982.     if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
  983.     read cc
  984.     else
  985.     cc=""
  986.     runonce=Yes
  987.     fi
  988.     if [ -z "$cc" ] ; then
  989.     cc=$FOO
  990.     fi
  991.     case "$cc" in
  992.     [Yy]*)
  993.         NOSPOOF="1"
  994.         ;;
  995.     [Nn]*)
  996.         NOSPOOF=""
  997.         ;;
  998.     *)
  999.         echo ""
  1000.         echo "You need to enter either Yes or No here..."
  1001.         echo ""
  1002.         FOO=""
  1003.         ;;
  1004.     esac
  1005. done
  1006.  
  1007. if [ -n "$NOSPOOF" ] ; then
  1008.  
  1009. FOO=""
  1010. runonce=""
  1011. while [ -z "$FOO" ] ; do
  1012.     FOO="$NOSPOOF_SEED01"
  1013.     echo "For security, the nospoof code uses two special values, called"
  1014.     echo "seeds.  Here, please enter one of them.  The values are in"
  1015.     echo "hexidecimal (base 16) using the digits 0123456789abcdef.  Each"
  1016.     echo "value can contain up to 8 digits, and should be specified in the"
  1017.     echo "form 0x12345678.  If you use the defaults, that should be ok, but"
  1018.     echo "it is more secure if you choose your own special values and keep"
  1019.     echo "them secret."
  1020.     echo $n "[$FOO] -> $c"
  1021.     if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
  1022.     read cc
  1023.     else
  1024.     cc=""
  1025.     runonce=Yes
  1026.     fi
  1027.     if [ -z "$cc" ] ; then
  1028.     cc=$FOO
  1029.     fi
  1030.     case "$cc" in
  1031.     0x[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])
  1032.         NOSPOOF_SEED01=$cc
  1033.         ;;
  1034.     [0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])
  1035.         NOSPOOF_SEED01=0x$cc
  1036.         ;;
  1037.     *)
  1038.         echo " "
  1039.         echo "Read the instructions and try again...  You did not enter the"
  1040.         echo "value correctly."
  1041.         echo ""
  1042.         FOO=""
  1043.         ;;
  1044.     esac
  1045. done
  1046.  
  1047. FOO=""
  1048. runonce=""
  1049. while [ -z "$FOO" ] ; do
  1050.     FOO="$NOSPOOF_SEED02"
  1051.     echo "For security, the nospoof code uses two special values, called"
  1052.     echo "seeds.  Here, please enter one of them.  The values are in"
  1053.     echo "hexidecimal (base 16) using the digits 0123456789abcdef.  Each"
  1054.     echo "value can contain up to 8 digits, and should be specified in the"
  1055.     echo "form 0x12345678.  If you use the defaults, that should be ok, but"
  1056.     echo "it is more secure if you choose your own special values and keep"
  1057.     echo "them secret."
  1058.     echo $n "[$FOO] -> $c"
  1059.     if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
  1060.     read cc
  1061.     else
  1062.     cc=""
  1063.     runonce=Yes
  1064.     fi
  1065.     if [ -z "$cc" ] ; then
  1066.     cc=$FOO
  1067.     fi
  1068.     case "$cc" in
  1069.     0x[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])
  1070.         NOSPOOF_SEED02=$cc
  1071.         ;;
  1072.     [0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])
  1073.         NOSPOOF_SEED02=0x$cc
  1074.         ;;
  1075.     *)
  1076.         echo " "
  1077.         echo "Read the instructions and try again...  You did not enter the"
  1078.         echo "value correctly."
  1079.         echo ""
  1080.         FOO=""
  1081.         ;;
  1082.     esac
  1083. done
  1084.  
  1085. # this matches a NOSPOOF check waaaaaay up there
  1086. fi
  1087.  
  1088. FOO=""
  1089. runonce=""
  1090. while [ -z "$FOO" ] ; do
  1091.     if [ -z "$CONTACT_URL" ] ; then
  1092.     if [ -z "$CONTACT_EMAIL" ] ; then
  1093.             if [ "$NS_ADDRESS" = "nospoof@dal.net" ] ; then
  1094.         CONTACT_INFO="http://www.dal.net/connect/"
  1095.         else
  1096.         CONTACT_INFO="none"
  1097.         fi
  1098.     else
  1099.         CONTACT_INFO="$CONTACT_EMAIL"
  1100.     fi
  1101.     else
  1102.     CONTACT_INFO="$CONTACT_URL"
  1103.     fi
  1104.     FOO="$CONTACT_INFO"
  1105.     echo " "
  1106.     echo "Where should users turn to when they have connection"
  1107.     echo "problems, nospoof or otherwise? This can be any valid"
  1108.     echo "email address, ftp URL, or http URL. It can also be"
  1109.     echo "set as 'none', causing the connection problems contact"
  1110.     echo "section of the connect-time messages to be omitted completely."
  1111.     echo " "
  1112.     echo "Entries must follow one of the following formats:"
  1113.     echo "email address:  admin@server.net"
  1114.     echo "      ftp URL:  ftp://ftp.borg.com/pub/connection.txt"
  1115.     echo "     http URL:  http://www.dal.net/connect/"
  1116.     echo " "
  1117.     echo "For DALnet servers, this should be set to"
  1118.     echo "http://www.dal.net/connect/"
  1119.     echo "If your server is NOT part of DALnet, please enter"
  1120.     echo "another point of help (such as the admin's email address),"
  1121.     echo "or set this to 'none'."
  1122.     echo $n "[$FOO] -> $c"
  1123.     if [ -z "$AUTO_CONFIG" -o -n "$runonce" -o -z "$FOO" ] ; then
  1124.     read cc
  1125.     else
  1126.     cc=""
  1127.     runonce=Yes
  1128.     fi
  1129.     if [ -z "$cc" ] ; then
  1130.     cc=$FOO
  1131.     fi
  1132.     case "$cc" in
  1133.     none)
  1134.         CONTACT_URL=''
  1135.         CONTACT_EMAIL=''
  1136.         FOO=$cc
  1137.         ;;
  1138.     nospoof@dal.net)
  1139.         echo " "
  1140.         echo "You have entered the former contact point for DALnet"
  1141.         echo "servers. This address is no longer the main point of"
  1142.         echo "help for connections. If this is indeed a DALnet"
  1143.         echo "server, please use the URL listed in the instructions."
  1144.         echo "If this is NOT a DALnet server, please provide another"
  1145.         echo "point of contact, or enter 'none'"
  1146.         echo " "
  1147.         echo $n "[Enter to Continue]"
  1148.         read cc
  1149.         FOO=""
  1150.         ;;
  1151.     http://*.*)
  1152.         CONTACT_URL=$cc
  1153.         CONTACT_EMAIL=''
  1154.         FOO=$CONTACT_INFO
  1155.         ;;
  1156.     ftp://*.*)
  1157.         CONTACT_URL=$cc
  1158.         CONTACT_EMAIL=''
  1159.         FOO=$CONTACT_INFO
  1160.         ;;
  1161.     *@*.*)
  1162.         CONTACT_URL=''
  1163.         CONTACT_EMAIL=$cc
  1164.         FOO=$CONTACT_INFO
  1165.         ;;
  1166.     *)
  1167.         echo " "
  1168.         echo "Read the instructions and examples, then try again..."
  1169.         echo "Your entry here must be blank or one of the valid"
  1170.         echo "types."
  1171.         echo " "
  1172.         FOO=""
  1173.         ;;
  1174.     esac
  1175. done
  1176.  
  1177. FOO=""
  1178. runonce=""
  1179. while [ -z "$FOO" ] ; do
  1180.     FOO="$KLINE_ADDRESS"
  1181.     echo " "
  1182.     echo "What is the contact address for connect problems due to the"
  1183.     echo "user being K:lined, shown to the user when they attempt to"
  1184.     echo "connect?  This should be a valid email address."
  1185.     echo " "
  1186.     echo "For DALnet servers, note that this message is displayed when"
  1187.     echo "the user is affected by a local K:line or k:line.  With"
  1188.     echo "Services-based autokills, the message is set up automatically"
  1189.     echo "by Services to ask the user to email kline@dal.net.  It is"
  1190.     echo "recommended that you set this up to give a valid email address"
  1191.     echo "for the server's admin, not kline@dal.net."
  1192.     echo $n "[$FOO] -> $c"
  1193.     if [ -z "$AUTO_CONFIG" -o -n "$runonce" -o -z "$FOO" ] ; then
  1194.     read cc
  1195.     else
  1196.     cc=""
  1197.     runonce=Yes
  1198.     fi
  1199.     if [ -z "$cc" ] ; then
  1200.     cc=$FOO
  1201.     fi
  1202.     case "$cc" in
  1203.     [Kk][Ll][Ii][Nn][Ee]@[Dd][Aa][Ll].[Nn][Ee][Tt])
  1204.         KLINE_ADDRESS=$cc
  1205.         FOO=""
  1206.         echo " "
  1207.         while [ -z "$FOO" ] ; do
  1208.         FOO="No"
  1209.         echo "Please note that kline@dal.net does not handle server-specific"
  1210.         echo "K:lines."
  1211.         echo "Are you sure you want to set the address to kline@dal.net?"
  1212.         echo $n "[$FOO] -> $c"
  1213.         if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
  1214.             read cc
  1215.         else
  1216.             cc=""
  1217.             runonce=Yes
  1218.         fi
  1219.         if [ -z "$cc" ] ; then
  1220.             cc=$FOO
  1221.         fi
  1222.         case "$cc" in
  1223.             [Yy]*)
  1224.             ;;
  1225.             [Nn]*)
  1226.             KLINE_ADDRESS=""
  1227.             ;;
  1228.             *)
  1229.             echo ""
  1230.             echo "You need to enter either Yes or No here..."
  1231.             echo ""
  1232.             FOO=""
  1233.             ;;
  1234.         esac
  1235.         done
  1236.         FOO="$KLINE_ADDRESS"
  1237.         ;;
  1238.     *@*.*)
  1239.         KLINE_ADDRESS=$cc
  1240.         FOO="$KLINE_ADDRESS"
  1241.         ;;
  1242.     *)
  1243.         echo " "
  1244.         echo "Read the instructions and try again...  You did not enter a"
  1245.         echo "proper email address (user@host.domain)."
  1246.         FOO=""
  1247.         ;;
  1248.     esac
  1249. done
  1250.  
  1251. FOO=""
  1252. runonce=""
  1253. while [ -z "$FOO" ] ; do
  1254.     FOO="$SERVICES_NAME"
  1255.     echo " "
  1256.     echo "If you have network services and would like to make use of "
  1257.     echo "the built in secure services aliasing features, type in the "
  1258.     echo "name of your network services server here. If you are a "
  1259.     echo "DALnet admin, you would type in \"services.dal.net\" below."
  1260.     echo $n "[$FOO] -> $c"
  1261.     if [ -z "$AUTO_CONFIG" -o -n "$runonce" -o -z "$SERVICES_NAME" ] ; then
  1262.     read cc
  1263.     runonce=Yes
  1264.     else
  1265.     cc=""
  1266.     fi
  1267.     if [ -z "$cc" ] ; then
  1268.     cc=$FOO
  1269.     fi
  1270. done
  1271. SERVICES_NAME=$cc
  1272.  
  1273. FOO=""
  1274. runonce=""
  1275. while [ -z "$FOO" ] ; do
  1276.     FOO="$DPATH"
  1277.     echo ""
  1278.     echo "What directory are all the server configuration files in?"
  1279.     echo $n "[$FOO] -> $c"
  1280.     if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
  1281.     read cc
  1282.     else
  1283.     cc=""
  1284.     runonce=Yes
  1285.     fi
  1286.     if [ -z "$cc" ] ; then
  1287.     cc=$FOO
  1288.     fi
  1289. done
  1290. DPATH=$cc
  1291.  
  1292. FOO=""
  1293. runonce=""
  1294. while [ -z "$FOO" ] ; do
  1295.     FOO="$SPATH"
  1296.     echo ""
  1297.     echo "What is the explicit path to where the ircd binary will be"
  1298.     echo "installed?  This should point to a file, not a directory"
  1299.     echo $n "[$FOO] -> $c"
  1300.     if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
  1301.     read cc
  1302.     else
  1303.     cc=""
  1304.     runonce=Yes
  1305.     fi
  1306.     if [ -z "$cc" ] ; then
  1307.     cc=$FOO
  1308.     fi
  1309. done
  1310. SPATH=$cc
  1311.  
  1312. FOO=""
  1313. runonce=""
  1314. while [ -z "$FOO" ] ; do
  1315.     FOO="$DOMAINNAME"
  1316.     echo ""
  1317.     echo "What is your local domain name?  This is used for /stats w to"
  1318.     echo "report local clients vs. remote clients."
  1319.  
  1320.         if [ "$OSNAME" = "FreeBSD" -o "$OSNAME" = "FreeBSD 2.2" ]; then
  1321.         MACHINENAME=`hostname -s`
  1322.         HOSTNAME=${hostname}
  1323.         FOO=${HOSTNAME#$MACHINENAME.}
  1324.         fi
  1325.  
  1326.     echo $n "[$FOO] -> $c"
  1327.     if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
  1328.     read cc
  1329.     else
  1330.     cc=""
  1331.     runonce=Yes
  1332.     fi
  1333.     if [ -z "$cc" ] ; then
  1334.     cc=$FOO
  1335.     fi
  1336.     FOO=$cc
  1337. done
  1338. DOMAINNAME=$cc
  1339.  
  1340. FOO=""
  1341. runonce=""
  1342. while [ -z "$FOO" ] ; do
  1343.     if [ -n "$SHOWOPERS" ] ; then
  1344.     FOO="Yes"
  1345.     else
  1346.     FOO="No"
  1347.     fi
  1348.     echo ""
  1349.     echo "Would you like non opers to see your O:lines?"
  1350.     echo $n "[$FOO] -> $c"
  1351.     if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
  1352.     read cc
  1353.     runonce=Yes
  1354.     else
  1355.     cc=""
  1356.     fi
  1357.     if [ -z "$cc" ] ; then
  1358.     cc=$FOO
  1359.     fi
  1360.     case "$cc" in
  1361.     [Yy]*)
  1362.         SHOWOPERS="YES"
  1363.         ;;
  1364.     [Nn]*)
  1365.         SHOWOPERS=""
  1366.         ;;
  1367.     *)
  1368.         echo ""
  1369.         echo "You need to enter either Yes or No here..."
  1370.         echo ""
  1371.         FOO=""
  1372.         ;;
  1373.     esac
  1374. done
  1375.  
  1376. FOO=""
  1377. runonce=""
  1378. while [ -z "$FOO" ] ; do
  1379.     if [ -n "$HUB" ] ; then
  1380.     FOO="Yes"
  1381.     else
  1382.     FOO="No"
  1383.     fi
  1384.     echo ""
  1385.     echo "Are you running as a HUB?"
  1386.     echo $n "[$FOO] -> $c"
  1387.     if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
  1388.     read cc
  1389.     else
  1390.     cc=""
  1391.     runonce=Yes
  1392.     fi
  1393.     if [ -z "$cc" ] ; then
  1394.     cc=$FOO
  1395.     fi
  1396.     case "$cc" in
  1397.     [Yy]*)
  1398.         HUB="1"
  1399.         ;;
  1400.     [Nn]*)
  1401.         HUB=""
  1402.         ;;
  1403.     *)
  1404.         echo ""
  1405.         echo "You need to enter either Yes or No here..."
  1406.         echo ""
  1407.         FOO=""
  1408.         ;;
  1409.     esac
  1410. done
  1411.  
  1412.  
  1413. FOO=""
  1414. runonce=""
  1415. while [ -z "$FOO" ] ; do
  1416.     if [ -n "$UNIXPORT" ] ; then
  1417.     FOO="Yes"
  1418.     else
  1419.     FOO="No"
  1420.     fi
  1421.     echo ""
  1422.     echo "Would you like clients local to the SERVER MACHINE to be able to"
  1423.     echo "use Unix domain sockets?"
  1424.     echo $n "[$FOO] -> $c"
  1425.     if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
  1426.     read cc
  1427.     else
  1428.     cc=""
  1429.     runonce=Yes
  1430.     fi
  1431.     if [ -z "$cc" ] ; then
  1432.     cc=$FOO
  1433.     fi
  1434.     case "$cc" in
  1435.     [Yy]*)
  1436.         UNIXPORT="1"
  1437.         ;;
  1438.     [Nn]*)
  1439.         UNIXPORT=""
  1440.         ;;
  1441.     *)
  1442.         echo ""
  1443.         echo "You need to enter either Yes or No here..."
  1444.         echo ""
  1445.         FOO=""
  1446.         ;;
  1447.     esac
  1448. done
  1449.  
  1450. FOO=""
  1451. runonce=""
  1452. while [ -z "$FOO" ] ; do
  1453.     if [ -n "$CRYPT_OPER_PASSWORD" ] ; then
  1454.     FOO="Yes"
  1455.     else
  1456.     FOO="No"
  1457.     fi
  1458.     echo ""
  1459.     echo "Do you use encrypted operator passwords?"
  1460.     echo $n "[$FOO] -> $c"
  1461.     if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
  1462.     read cc
  1463.     else
  1464.     cc=""
  1465.     runonce=Yes
  1466.     fi
  1467.     if [ -z "$cc" ] ; then
  1468.     cc=$FOO
  1469.     fi
  1470.     case "$cc" in
  1471.     [Yy]*)
  1472.         CRYPT_OPER_PASSWORD="1"
  1473.         ;;
  1474.     [Nn]*)
  1475.         CRYPT_OPER_PASSWORD=""
  1476.         ;;
  1477.     *)
  1478.         echo ""
  1479.         echo "You need to enter either Yes or No here..."
  1480.         echo ""
  1481.         FOO=""
  1482.         ;;
  1483.     esac
  1484. done
  1485.  
  1486. FOO=""
  1487. runonce=""
  1488. while [ -z "$FOO" ] ; do
  1489.     if [ -n "$CRYPT_LINK_PASSWORD" ] ; then
  1490.     FOO="Yes"
  1491.     else
  1492.     FOO="No"
  1493.     fi
  1494.     echo ""
  1495.     echo "Do you use encrypted incoming link passwords? (N lines only,"
  1496.     echo "C lines must remain unencrypted always)"
  1497.     echo $n "[$FOO] -> $c"
  1498.     if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
  1499.     read cc
  1500.     else
  1501.     cc=""
  1502.     runonce=Yes
  1503.     fi
  1504.     if [ -z "$cc" ] ; then
  1505.     cc=$FOO
  1506.     fi
  1507.     case "$cc" in
  1508.     [Yy]*)
  1509.         CRYPT_LINK_PASSWORD="1"
  1510.         ;;
  1511.     [Nn]*)
  1512.         CRYPT_LINK_PASSWORD=""
  1513.         ;;
  1514.     *)
  1515.         echo ""
  1516.         echo "You need to enter either Yes or No here..."
  1517.         echo ""
  1518.         FOO=""
  1519.         ;;
  1520.     esac
  1521. done
  1522.  
  1523. FOO=""
  1524. runonce=""
  1525. while [ -z "$FOO" ] ; do
  1526.     FOO="$LISTEN_SIZE"
  1527.     echo ""
  1528.     echo "What listen() backlog value do you wish to use?  Some servers"
  1529.     echo "have problems with more than 5, others work fine with many, many"
  1530.     echo "more."
  1531.     echo $n "[$FOO] -> $c"
  1532.     if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
  1533.     read cc
  1534.     else
  1535.     cc=""
  1536.     runonce=Yes
  1537.     fi
  1538.     if [ -z "$cc" ] ; then
  1539.     cc=$FOO
  1540.     fi
  1541.     case "$cc" in
  1542.     [1-9]*)
  1543.         LISTEN_SIZE="$cc"
  1544.         ;;
  1545.     *)
  1546.         echo ""
  1547.         echo "You need to enter a number here."
  1548.         echo ""
  1549.         FOO=""
  1550.         ;;
  1551.     esac
  1552. done
  1553.  
  1554. FOO=""
  1555. runonce=""
  1556. while [ -z "$FOO" ] ; do
  1557.     FOO="$NICKNAMEHISTORYLENGTH"
  1558.     echo ""
  1559.     echo "How far back do you want to keep the nickname history?"
  1560.     echo $n "[$FOO] -> $c"
  1561.     if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
  1562.     read cc
  1563.     else
  1564.     cc=""
  1565.     runonce=Yes
  1566.     fi
  1567.     if [ -z "$cc" ] ; then
  1568.     cc=$FOO
  1569.     fi
  1570.     case "$cc" in
  1571.     [1-9]*)
  1572.         NICKNAMEHISTORYLENGTH="$cc"
  1573.         ;;
  1574.     *)
  1575.         echo ""
  1576.         echo "You need to enter a number here."
  1577.         echo ""
  1578.         FOO=""
  1579.         ;;
  1580.     esac
  1581. done
  1582.  
  1583. FOO=""
  1584. runonce=""
  1585. while [ -z "$FOO" ] ; do
  1586.     FOO="$MAXSENDQLENGTH"
  1587.     echo ""
  1588.     echo "What sendq length do you wish to have?"
  1589.     echo $n "[$FOO] -> $c"
  1590.     if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
  1591.     read cc
  1592.     else
  1593.     cc=""
  1594.     runonce=Yes
  1595.     fi
  1596.     if [ -z "$cc" ] ; then
  1597.     cc=$FOO
  1598.     fi
  1599.     case "$cc" in
  1600.     [1-9]*)
  1601.         MAXSENDQLENGTH="$cc"
  1602.         ;;
  1603.     *)
  1604.         echo ""
  1605.         echo "You need to enter a number here."
  1606.         echo ""
  1607.         FOO=""
  1608.         ;;
  1609.     esac
  1610. done
  1611.  
  1612. FOO=""
  1613. runonce=""
  1614. while [ -z "$FOO" ] ; do
  1615.     FOO="$BUFFERPOOL"
  1616.     echo ""
  1617.     echo "What size of a bufferpool (total of ALL sendq's in use) do you"
  1618.     echo "do you wish to have?"
  1619.     echo $n "[$FOO] -> $c"
  1620.     if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
  1621.     read cc
  1622.     else
  1623.     cc=""
  1624.     runonce=Yes
  1625.     fi
  1626.     if [ -z "$cc" ] ; then
  1627.     cc=$FOO
  1628.     fi
  1629.     case "$cc" in
  1630.     \([1-9]*\))
  1631.         BUFFERPOOL="$cc"
  1632.         ;;
  1633.     *)
  1634.         echo ""
  1635.         echo "You need to enter a number here, either based on"
  1636.         echo "MAXSENDQLENGTH or a literal value.  Also, this value"
  1637.         echo "MUST be enclosed in parens -- (9*MAXSENDQLENGTH), for example."
  1638.         echo ""
  1639.         FOO=""
  1640.         ;;
  1641.     esac
  1642. done
  1643.  
  1644. FOO=""
  1645. runonce=""
  1646. while [ -z "$FOO" ] ; do
  1647.     FOO="$MAXCONNECTIONS"
  1648.     echo ""
  1649.     echo "How many file descriptors (or sockets) can the irc server use?"
  1650.     echo $n "[$FOO] -> $c"
  1651.     if [ -z "$AUTO_CONFIG" -o -n "$runonce" ] ; then
  1652.     read cc
  1653.     else
  1654.     cc=""
  1655.     runonce=Yes
  1656.     fi
  1657.     if [ -z "$cc" ] ; then
  1658.     cc=$FOO
  1659.     fi
  1660.     case "$cc" in
  1661.     [1-9][0-9][0-9]*)
  1662.         MAXCONNECTIONS="$cc"
  1663.         ;;
  1664.     *)
  1665.         echo ""
  1666.         echo "You need to enter a number here, greater or equal to 100."
  1667.         echo ""
  1668.         FOO=""
  1669.         ;;
  1670.     esac
  1671. done
  1672.  
  1673. #
  1674. # check FD_SETSIZE and override if needed.
  1675. #
  1676.  
  1677. cat > $TMP <<__EOF__
  1678. #include <stdio.h>
  1679. #include <sys/types.h>
  1680.  
  1681. #ifndef FD_SETSIZE
  1682. #define FD_SETSIZE -1
  1683. #endif
  1684.  
  1685. /*
  1686.  * Prints "notdef" if FD_SETSIZE is undefined,
  1687.  *        "ok"     if FD_SETSIZE is at least as large as provided on the
  1688.  *                 compile command line (-DMAXCONNECTIONS=1234)
  1689.  *        "###"    if it is less.  (### is the FD_SETSIZE value)
  1690.  */
  1691. int
  1692. main(int argc, char *argv[])
  1693. {
  1694.     if (FD_SETSIZE == -1)
  1695.         printf("notdef\n");
  1696.     else if (FD_SETSIZE >= MAXCONNECTIONS)
  1697.         printf("ok\n");
  1698.     else
  1699.         printf("%d\n", FD_SETSIZE);
  1700.  
  1701.     return 0;
  1702. }
  1703. __EOF__
  1704. $COMP "-DMAXCONNECTIONS=$MAXCONNECTIONS" >/dev/null 2>&1
  1705. if [ $? -ne 0 ] ; then
  1706.     echo " "
  1707.     echo "I could not derrive what your system allows for the maximum number"
  1708.     echo "of connections becuase the test program did not compile."
  1709.     echo " "
  1710.     FD_SETSIZE=""
  1711. else
  1712.     fd_setsize_ok=`$EXEC`
  1713.     case $fd_setsize_ok in
  1714.     notdef)
  1715.         echo " "
  1716.         echo "I could not derrive what your system allows for the maximum"
  1717.         echo "number of connections because the test program did not find"
  1718.         echo "a system-supplied value for FD_SETSIZE.  Assuming it is"
  1719.         echo "defined correctly but the test program cannot find it."
  1720.         echo " "
  1721.         FD_SETSIZE=""
  1722.         ;;
  1723.     ok)
  1724.         echo " "
  1725.         echo "Your system-supplied value for FD_SETSIZE is large enough"
  1726.         echo "for ircd to leave it untouched."
  1727.         echo " "
  1728.         FD_SETSIZE=""
  1729.         ;;
  1730.     *)
  1731.         echo " "
  1732.         echo "Your system-supplied value for FD_SETSIZE is $fd_setsize_ok"
  1733.         echo "but you requested $MAXCONNECTIONS for ircd.  FD_SETSIZE will"
  1734.         echo "be overridden using -DFD_SETSIZE=$MAXCONNECTIONS when"
  1735.         echo "compiling ircd."
  1736.         echo " "
  1737.         FD_SETSIZE=$MAXCONNECTIONS
  1738.         ;;
  1739.     esac
  1740. fi
  1741.  
  1742. if [ -n "$FD_SETSIZE" ] ; then
  1743.     $RM -f Makefile.tmp
  1744.     sed -e "s@^FD_SETSIZE=\(.*\)@FD_SETSIZE=-DFD_SETSIZE=$FD_SETSIZE@" Makefile > Makefile.tmp
  1745.     cp Makefile.tmp Makefile
  1746.     $RM -f Makefile.tmp
  1747. else
  1748.     $RM -f Makefile.tmp
  1749.     sed -e "s@^FD_SETSIZE=\(.*\)@FD_SETSIZE=@" Makefile > Makefile.tmp
  1750.     cp Makefile.tmp Makefile
  1751.     $RM -f Makefile.tmp
  1752. fi
  1753.  
  1754. $RM -f $EXEC $TMP
  1755.  
  1756.  
  1757. cat <<__EOF__
  1758.  
  1759. The file "$OPTIONS" was either created or rewritten to contain your
  1760. answers to the above questions.
  1761.  
  1762. This file is automatically generated and will be updated each time you
  1763. run Config.  You should retain a copy of this to help migrate to future
  1764. versions of the DALnet server with ease.
  1765.  
  1766. __EOF__
  1767.  
  1768. #
  1769. # create the $OPTIONS_H file
  1770. #
  1771. rm -f $OPTIONS_H
  1772. cat > $OPTIONS_H << __EOF__
  1773. /*
  1774.  * VERSION: $IRCD_VERSION
  1775.  * DATE:    $CONF_DATE
  1776.  *
  1777.  * This file is automatically generated and will be updated each time you
  1778.  * run Config.  YOU SHOULD NOT EDIT THIS FILE.  Instead, edit "$OPTIONS" in
  1779.  * the same directory as Config, and rerun to regenerate this file.
  1780.  */
  1781.  
  1782. #define DPATH "$DPATH"
  1783. #define SPATH "$SPATH"
  1784. #define LISTEN_SIZE $LISTEN_SIZE
  1785. #define MAXSENDQLENGTH $MAXSENDQLENGTH
  1786. #define BUFFERPOOL $BUFFERPOOL
  1787. #define MAXCONNECTIONS $MAXCONNECTIONS
  1788. #define NICKNAMEHISTORYLENGTH $NICKNAMEHISTORYLENGTH
  1789. __EOF__
  1790. if [ -n "$SHOWOPERS" ] ; then
  1791.     echo "#define SHOWOPERS" >> $OPTIONS_H
  1792. else
  1793.     echo "#undef SHOWOPERS" >> $OPTIONS_H
  1794. fi
  1795. if [ -n "$HUB" ] ; then
  1796.     echo "#define HUB 1" >> $OPTIONS_H
  1797. else
  1798.     echo "#undef HUB" >> $OPTIONS_H
  1799. fi
  1800. if [ -n "$CRYPT_OPER_PASSWORD" ] ; then
  1801.     echo "#define CRYPT_OPER_PASSWORD 1" >> $OPTIONS_H
  1802. else
  1803.     echo "#undef CRYPT_OPER_PASSWORD" >> $OPTIONS_H
  1804. fi
  1805. if [ -n "$CRYPT_LINK_PASSWORD" ] ; then
  1806.     echo "#define CRYPT_LINK_PASSWORD 1" >> $OPTIONS_H
  1807. else
  1808.     echo "#undef CRYPT_LINK_PASSWORD" >> $OPTIONS_H
  1809. fi
  1810. if [ -n "$UNIXPORT" ] ; then
  1811.     echo "#define UNIXPORT 1" >> $OPTIONS_H
  1812. else
  1813.     echo "#undef UNIXPORT" >> $OPTIONS_H
  1814. fi
  1815. if [ -n "$NOSPOOF" ] ; then
  1816.     echo "#define NOSPOOF 1" >> $OPTIONS_H
  1817. else
  1818.     echo "#undef NOSPOOF" >> $OPTIONS_H
  1819. fi
  1820. if [ -n "$NOSPOOF_SEED01" ] ; then
  1821.     echo "#define NOSPOOF_SEED01 $NOSPOOF_SEED01" >> $OPTIONS_H
  1822. fi
  1823. if [ -n "$NOSPOOF_SEED02" ] ; then
  1824.     echo "#define NOSPOOF_SEED02 $NOSPOOF_SEED02" >> $OPTIONS_H
  1825. fi
  1826. if [ -n "$CONTACT_URL" ] ; then
  1827.     echo "#define CONTACT_URL \"$CONTACT_URL\"" >> $OPTIONS_H
  1828. fi
  1829. if [ -n "$CONTACT_EMAIL" ] ; then
  1830.     echo "#define CONTACT_EMAIL \"$CONTACT_EMAIL\"" >> $OPTIONS_H
  1831. fi
  1832. if [ -n "$SERVICES_NAME" ] ; then
  1833.     echo "#define SERVICES_NAME \"$SERVICES_NAME\"" >> $OPTIONS_H
  1834. fi
  1835. if [ -n "$KLINE_ADDRESS" ] ; then
  1836.     echo "#define KLINE_ADDRESS \"$KLINE_ADDRESS\"" >> $OPTIONS_H
  1837. fi
  1838. if [ -n "$DOMAINNAME" ] ; then
  1839.     echo "#define DOMAINNAME \"$DOMAINNAME\"" >> $OPTIONS_H
  1840. else
  1841.     echo "undef DOMAINNAME" >> $OPTIONS_H
  1842. fi
  1843.  
  1844. #
  1845. # create the persistant file
  1846. #
  1847. rm -f $OPTIONS
  1848. cat > $OPTIONS << __EOF__
  1849. #
  1850. # VERSION: $IRCD_VERSION
  1851. # DATE:    $CONF_DATE
  1852. #
  1853. # This file is automatically generated and will be updated each time you
  1854. # run Config.  You should retain a copy of this to help migrate to future
  1855. # versions of the DALnet server with ease.
  1856. #
  1857. LAST_VERSION="$IRCD_VERSION"
  1858. NOSPOOF="$NOSPOOF"
  1859. NOSPOOF_SEED01="$NOSPOOF_SEED01"
  1860. NOSPOOF_SEED02="$NOSPOOF_SEED02"
  1861. CONTACT_URL="$CONTACT_URL"
  1862. CONTACT_EMAIL="$CONTACT_EMAIL"
  1863. SERVICES_NAME="$SERVICES_NAME"
  1864. KLINE_ADDRESS="$KLINE_ADDRESS"
  1865. DPATH="$DPATH"
  1866. SPATH="$SPATH"
  1867. HUB="$HUB"
  1868. CRYPT_OPER_PASSWORD="$CRYPT_OPER_PASSWORD"
  1869. CRYPT_LINK_PASSWORD="$CRYPT_LINK_PASSWORD"
  1870. LISTEN_SIZE="$LISTEN_SIZE"
  1871. MAXSENDQLENGTH="$MAXSENDQLENGTH"
  1872. BUFFERPOOL="$BUFFERPOOL"
  1873. UNIXPORT="$UNIXPORT"
  1874. MAXCONNECTIONS="$MAXCONNECTIONS"
  1875. DOMAINNAME="$DOMAINNAME"
  1876. NICKNAMEHISTORYLENGTH="$NICKNAMEHISTORYLENGTH"
  1877.  
  1878. __EOF__
  1879.  
  1880. cat <<__EOF__
  1881.  
  1882.  Config is complete.
  1883.  
  1884.  Before compiling, check the contents of include/config.h for any strange
  1885.  things you usually set.  If you want them to be included in the future,
  1886.  ask them to be moved to the options.h file on dalnet-src@dal.net.
  1887.  
  1888. __EOF__
  1889.