home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / ircd4652.zip / ircd-df-4.6.5-os2 / myconfig < prev    next >
Text File  |  1998-05-28  |  43KB  |  1,899 lines

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