home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-386-Vol-2of3.iso / b / bc-102.zip / bc-1.02 / configure < prev    next >
Text File  |  1991-11-24  |  3KB  |  120 lines

  1. #!/bin/sh
  2. #
  3. # The shell script for bc to automatically create the config.h file.
  4. # Syntax:  configure [ include-dir [ lib-file [ c-compiler ]]]
  5. #
  6. # Set some standard things.
  7. #
  8. INCLUDE=${1-/usr/include}
  9. LIBFILE=${2-libmath.b}
  10. CC=${3-cc}
  11. #
  12. # Initialize the exit status
  13. #
  14. EXIT=0
  15. #
  16. # Remove the current copy and make sure there is at least an empty file
  17. #
  18. rm -f config.h
  19. echo "/* config.h */" > config.h
  20. #
  21. # Check for the argument passing mechanism.
  22. #
  23. if test -r $INCLUDE/varargs.h
  24. then
  25. echo "Using varargs.h for variable arguments (non ansi compilers). "
  26. echo "#ifndef __STDC__" >> config.h
  27. echo "#define VARARGS" >> config.h
  28. echo "#endif" >> config.h
  29. else
  30. if test -r $INCLUDE/stdarg.h
  31. then
  32. echo "Using stdarg.h for variable arguments. "
  33. else
  34. echo "Unknown variable argument mechanism. "
  35. EXIT=1
  36. fi
  37. fi
  38. #
  39. # Limits file?
  40. #
  41. if test -r $INCLUDE/limits.h
  42. then
  43. echo "You have a limits.h file."
  44. else
  45. echo "You need to check the limits in const.h."
  46. echo "#define NO_LIMITS" >> config.h
  47. fi
  48. #
  49. # unistd?
  50. #
  51. if test -r $INCLUDE/unistd.h
  52. then
  53. echo "You have a unistd.h file."
  54. else
  55. echo "#define NO_UNISTD" >> config.h
  56. fi
  57. #
  58. # Stdlib?
  59. #
  60. if test -r $INCLUDE/stdlib.h
  61. then
  62. echo "You have a stdlib.h file."
  63. else
  64. echo "#define NO_STDLIB" >> config.h
  65. fi
  66. #
  67. # Strinog?
  68. #
  69. if test -r $INCLUDE/string.h
  70. then
  71. echo "You have a string.h file."
  72. else
  73. echo "#define STRINGS_H" >> config.h
  74. fi
  75. #
  76. # At least one BSD system did not define "extern int errno;" in errno.h
  77. #
  78. if grep -s extern $INCLUDE/errno.h
  79. then
  80. true
  81. else
  82. echo "extern int errno;" >> config.h
  83. fi
  84. #
  85. # On MINIX pc systems we want to define some extra files.
  86. #
  87. if test -r $INCLUDE/minix
  88. then
  89. # We must be on a minix system.  Check for the machine type.
  90. if test `machine` = IBM_PC
  91. then
  92. echo "#define SMALL_BUF" >> config.h
  93. echo "#define BC_MATH_FILE \"$LIBFILE\"" >> config.h
  94. echo "#define SHORTNAMES" >> config.h
  95. else
  96. echo "Your Minix is not on a PC.  The bc library will be loaded in the"
  97. echo "executable file.  You will not have to install a library file."
  98. fi
  99. else
  100. # Test to see if the compiler will compile long strings...
  101. echo "char libmath[] =" > JUNK.c
  102. echo "#include \"math.h\"" >> JUNK.c
  103. echo ";" >> JUNK.c
  104. if $CC -c JUNK.c >/dev/null 2>&1
  105. then
  106. echo "The bc library will be loaded in the executable file.  You will"
  107. echo "not have to install a library file."
  108. else
  109. echo "Your C compiler does not like long strings.  You will have to"
  110. echo "load the math library from a file."
  111. echo "#define BC_MATH_FILE \"$LIBFILE\"" >> config.h
  112. fi
  113. rm -f JUNK.c JUNK.o
  114. fi
  115. #
  116. # exit
  117. #
  118. exit $EXIT
  119.