home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume25 / pty4 / part04 / SYSCONF < prev    next >
Encoding:
Text File  |  1992-02-18  |  3.9 KB  |  107 lines

  1. #!/bin/sh
  2. # Public domain.
  3.  
  4. # Configure, eat your heart out.
  5.  
  6. # make sure we're using sh (stolen from Configure)
  7. PATH='.:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc'
  8. export PATH || (echo "Aargh! This isn't sh. Desperation time. I will now feed myself to sh..."; exec sh $0; sh $0; kill $$)
  9. echo "We're using sh. Good."
  10.  
  11. # make sure cmp works
  12. if cmp README README >/dev/null 2>&1
  13. then if cmp README SYSCONF >/dev/null 2>&1
  14.      then echo 'Aargh! cmp returns a zero exit code for different files. This is hopeless.'
  15.       exit 1
  16.      else echo 'You have a normal cmp. Good.'
  17.      fi
  18. else echo 'Aargh! cmp returns a nonzero exit code for the same file. This is hopeless.'
  19.      exit 1
  20. fi
  21.  
  22. # config/posix.h: test for setsid()
  23. cat > .setsid.$$.c << 'YOW'
  24. extern setsid(); main() { setsid(); }
  25. YOW
  26. if cc -o .setsid.$$ .setsid.$$.c >/dev/null 2>&1
  27. then echo 'You have setsid(). I assume this is a POSIX system. Enabling -DPOSIX_SILLINESS...'
  28.      sed '4s/^#undef POSIX_SILLINESS$/#define POSIX_SILLINESS/' < config/posix.h > config/posix.h.$$
  29.      cp config/posix.h.$$ config/posix.h
  30.      rm config/posix.h.$$
  31. else echo 'This is not a POSIX system. Disabling -DPOSIX_SILLINESS...'
  32.      sed '4s/^#define POSIX_SILLINESS$/#undef POSIX_SILLINESS/' < config/posix.h > config/posix.h.$$
  33.      cp config/posix.h.$$ config/posix.h
  34.      rm config/posix.h.$$
  35. fi
  36. rm -f .setsid.$$ .setsid.$$.c
  37.  
  38. # config/fdsettrouble.h: FD_ZERO
  39. cat > .fdzero.$$.c << 'YOW'
  40. #include <sys/types.h>
  41. #include <sys/time.h>
  42. main() { static fd_set rfds; FD_ZERO(&rfds); exit(0); }
  43. YOW
  44. if cc -o .fdzero.$$ .fdzero.$$.c >/dev/null 2>&1
  45. then echo 'You have FD_ZERO. Enabling it...'
  46.      sed '4s/^#define LACKING_FD_ZERO$/#undef LACKING_FD_ZERO/' < config/fdsettrouble.h > config/fdsettrouble.h.$$
  47.      cp config/fdsettrouble.h.$$ config/fdsettrouble.h
  48.      rm config/fdsettrouble.h.$$
  49. else echo 'You do not have FD_ZERO. Disabling it...'
  50.      sed '4s/^#undef LACKING_FD_ZERO$/#define LACKING_FD_ZERO/' < config/fdsettrouble.h > config/fdsettrouble.h.$$
  51.      cp config/fdsettrouble.h.$$ config/fdsettrouble.h
  52.      rm config/fdsettrouble.h.$$
  53. fi
  54. rm -f .fdzero.$$ .fdzero.$$.c
  55.  
  56. # config/fdsettrouble.h: fd_set
  57. cat > .fdset.$$.c << 'YOW'
  58. #include <sys/types.h>
  59. #include <sys/time.h>
  60. main() { static fd_set rfds; exit(0); }
  61. YOW
  62. if cc -o .fdset.$$ .fdset.$$.c >/dev/null 2>&1
  63. then echo 'You have fd_set. Enabling it...'
  64.      sed '5s/^#define DESPERATE_FD_SET$/#undef DESPERATE_FD_SET/' < config/fdsettrouble.h > config/fdsettrouble.h.$$
  65.      cp config/fdsettrouble.h.$$ config/fdsettrouble.h
  66.      rm config/fdsettrouble.h.$$
  67. else echo 'You do not have fd_set. Disabling it...'
  68.      sed '5s/^#undef DESPERATE_FD_SET$/#define DESPERATE_FD_SET/' < config/fdsettrouble.h > config/fdsettrouble.h.$$
  69.      cp config/fdsettrouble.h.$$ config/fdsettrouble.h
  70.      rm config/fdsettrouble.h.$$
  71. fi
  72. rm -f .fdset.$$ .fdset.$$.c
  73.  
  74. # config/ttyopts.h: TTY_WINDOWS
  75. cat > .winch.$$.c << 'YOW'
  76. #include <signal.h>
  77. main() { int winch = SIGWINCH; exit(0); }
  78. YOW
  79. if cc -o .winch.$$ .winch.$$.c >/dev/null 2>&1
  80. then echo 'You have tty windows. Enabling them...'
  81.      sed '4s/^#undef TTY_WINDOWS$/#define TTY_WINDOWS/' < config/ttyopts.h > config/ttyopts.h.$$
  82.      cp config/ttyopts.h.$$ config/ttyopts.h
  83.      rm config/ttyopts.h.$$
  84. else echo 'You do not have tty windows. Disabling them... (I guess this is BSD 4.2.)'
  85.      sed '4s/^#define TTY_WINDOWS$/#undef TTY_WINDOWS/' < config/ttyopts.h > config/ttyopts.h.$$
  86.      cp config/ttyopts.h.$$ config/ttyopts.h
  87.      rm config/ttyopts.h.$$
  88. fi
  89. rm -f .winch.$$ .winch.$$.c
  90.  
  91. echo ' '
  92. echo 'Okay, now you should make CHECKCONF and run it.'
  93. echo 'If you would like me to do this for you, press return.'
  94. echo 'Otherwise type no and press return, or just interrupt this script.'
  95. read foo
  96. case x"$foo"y in
  97. xy) echo 'make CHECKCONF'
  98.     if make CHECKCONF
  99.     then echo './CHECKCONF'
  100.      ./CHECKCONF
  101.     else echo 'Oops, make CHECKCONF failed. I give up: you figure it out.'
  102.     fi
  103.     ;;
  104. esac
  105.  
  106. exit 0
  107.