home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / ncurses-1.9.9e-src.tgz / tar.out / fsf / ncurses / configure.in < prev    next >
Text File  |  1996-09-28  |  11KB  |  367 lines

  1. dnl Process this file with autoconf to produce a configure script.
  2. AC_PREREQ(2.0)
  3. AC_INIT(ncurses/lib_initscr.c)
  4.  
  5. NC_VERSION
  6. NC_SYSTYPE
  7.  
  8. ###    Default install-location
  9. AC_PREFIX_DEFAULT(/usr/local)
  10.  
  11. ###    Checks for programs.
  12. AC_PROG_CC
  13. AC_PROG_CPP
  14. AC_PROG_GCC_TRADITIONAL
  15. dnl PROBLEM ON NEXT MACHINES:  g++ exists but is called cc++.  AC_PROG_CXX doesn't check
  16. dnl                            for that name,
  17. AC_PROG_CXX
  18. AC_PROG_AWK
  19. AC_PROG_MAKE_SET
  20. AC_PROG_INSTALL
  21. AC_PROG_LN_S
  22. AC_PROG_RANLIB
  23.  
  24. NC_MAKEFLAGS
  25.  
  26. ### Options to allow the user to specify the set of libraries which are used.
  27. ### Use "--without-normal --with-shared" to allow the default model to be
  28. ### shared, for example.
  29. nc_list_models=""
  30. AC_ARG_WITH(shared,
  31.     [  --with-shared           generate shared-libraries],
  32.     [test "$withval" = "yes" && nc_list_models="$nc_list_models shared"])
  33. AC_ARG_WITH(normal,
  34.     [  --with-normal           generate normal-libraries (default)],
  35.     [test "$withval" = "yes" && nc_list_models="$nc_list_models normal"],
  36.     [nc_list_models="$nc_list_models normal"])
  37. AC_ARG_WITH(debug,
  38.     [  --with-debug            generate debug-libraries (default)],
  39.     [test "$withval" = "yes" && nc_list_models="$nc_list_models debug"],
  40.     [nc_list_models="$nc_list_models debug"])
  41. AC_ARG_WITH(profile,
  42.     [  --with-profile          generate profile-libraries],
  43.     [test "$withval" = "yes" && nc_list_models="$nc_list_models profile"])
  44.  
  45. AC_MSG_CHECKING(for specified models)
  46. test -z "$nc_list_models" && nc_list_models=normal
  47. AC_MSG_RESULT($nc_list_models)
  48.  
  49. ### Use the first model as the default, and save its suffix for use in building
  50. ### up test-applications.
  51. DFT_LWR_MODEL=`echo $nc_list_models | $AWK '{print $1}'`
  52. NC_UPPERCASE($DFT_LWR_MODEL,DFT_UPR_MODEL)dnl
  53. NC_LIB_SUFFIX($DFT_LWR_MODEL,DFT_DEP_SUFFIX)dnl
  54. NC_LIB_TYPE($DFT_LWR_MODEL,DFT_ARG_SUFFIX)dnl
  55. NC_OBJ_SUBDIR($DFT_LWR_MODEL,DFT_OBJ_SUBDIR)dnl
  56. AC_SUBST(DFT_OBJ_SUBDIR)dnl    the default object-directory ("obj")
  57. AC_SUBST(DFT_LWR_MODEL)dnl    the default model ("normal")
  58. AC_SUBST(DFT_UPR_MODEL)dnl    the default model ("NORMAL")
  59. AC_SUBST(DFT_DEP_SUFFIX)dnl    the corresponding library-suffix (".a")
  60. AC_SUBST(DFT_ARG_SUFFIX)dnl    the string to append to "-lncurses" ("")
  61. AC_SUBST(nc_list_models)dnl    the complete list of models ("normal debug")
  62.  
  63. LIB_NAME=ncurses
  64. AC_SUBST(LIB_NAME)
  65.  
  66. LIB_PREFIX=../lib/lib
  67. AC_SUBST(LIB_PREFIX)
  68.  
  69. dnl Not all ports of gcc support the -g option
  70. CC_G_OPT='-g'
  71. test -n "$GCC" && test "$ac_cv_prog_gcc_g" != yes && CC_G_OPT=''
  72. AC_SUBST(CC_G_OPT)
  73.  
  74. CXX_G_OPT='-g'
  75. test -n "$GXX" && test "$ac_cv_prog_gxx_g" != yes && CXX_G_OPT=''
  76. AC_SUBST(CXX_G_OPT)
  77.  
  78. case $DFT_LWR_MODEL in
  79. normal)  LD_MODEL=''   ;;
  80. debug)   LD_MODEL=$CC_G_OPT ;;
  81. profile) LD_MODEL='-pg';;
  82. shared)  LD_MODEL=''   ;;
  83. esac
  84. AC_SUBST(LD_MODEL)dnl        the type of link (e.g., -g or -pg)
  85. NC_SHARED_OPTS
  86.  
  87. if test "$CC_SHARED_OPTS" = "unknown"; then
  88.     for model in $nc_list_models; do
  89.         if test "$model" = "shared"; then
  90.             echo '** Shared libraries are not supported in this version'
  91.             exit 1
  92.         fi
  93.     done
  94. fi
  95.  
  96. ###    use option --with-datadir=DIR to specify an alternate data-directory
  97. AC_ARG_WITH(datadir,
  98.     [  --with-datadir=DIR      specify alternate terminfo data-directory],
  99.     [datadir=$withval],
  100.     [datadir='$(exec_prefix)/lib/terminfo'])
  101. AC_SUBST(datadir)
  102.  
  103. ###    use option --with-includedir=DIR to specify an alternate includedir
  104. AC_ARG_WITH(includedir,
  105.     [  --with-includedir=DIR   specify alternate include-directory],
  106.     [includedir=$withval],
  107.     [includedir='$(exec_prefix)/include'])
  108. AC_SUBST(includedir)
  109.  
  110. ###    use option --disable-overwrite to leave out the link to -lcurses
  111. AC_ARG_ENABLE(overwrite,
  112.     [  --disable-overwrite     leave out the link to -lcurses],
  113.     [with_overwrite=$enableval
  114.      test "$with_overwrite" = no && \
  115.      test -z "$with_includedir" && \
  116.          includedir='$(exec_prefix)/include/ncurses'
  117.     ],
  118.     [with_overwrite=yes])
  119.  
  120. ###    use option --disable-termcap to leave out the termcap fallback support
  121. AC_ARG_ENABLE(termcap,
  122.     [  --disable-termcap       leave out the termcap fallback support],
  123.     [with_termcap=$enableval],
  124.     [with_termcap=yes])
  125. test "$with_termcap" != "yes" && AC_DEFINE(PURE_TERMINFO)
  126.  
  127. ###    use option --enable-getcap to use a hacked getcap for reading termcaps
  128. AC_ARG_ENABLE(getcap,
  129.     [  --enable-getcap         fast termcap load, no xrefs to terminfo],
  130.     [with_getcap=$enableval],
  131.     [with_getcap=no])
  132. test "$with_getcap" = "yes" && AC_DEFINE(USE_GETCAP)
  133.  
  134. ###   use option --enable-symlinks to make tic use symlinks, not hard links
  135. AC_ARG_ENABLE(symlinks,
  136.     [  --enable-symlinks       make tic use symbolic links not hard links],
  137.     [with_symlinks=$enableval]
  138.     [AC_DEFINE(USE_SYMLINKS)])
  139.  
  140. ###   use option --enable-bsdpad to have tputs process BSD-style prefix padding
  141. AC_ARG_ENABLE(bsdpad,
  142.     [  --enable-bsdpad         recognize BSD-style prefix padding],
  143.     [with_bsdpad=$enableval]
  144.     [AC_DEFINE(BSD_TPUTS)])
  145.  
  146. ###    use option --disable-echo to suppress full display compiling commands
  147. AC_ARG_ENABLE(echo,
  148.     [  --enable-echo           display \"compiling\" commands (default)],
  149.     [with_echo=$enableval],
  150.     [with_echo=yes])
  151. if test "$with_echo" = yes; then
  152.     ECHO_LINK=
  153. else
  154.     ECHO_LINK='@ echo linking $@ ... ;'
  155. fi
  156. AC_SUBST(ECHO_LINK)
  157.  
  158. ###    use option --with-warnings to turn on all gcc warnings
  159. AC_ARG_ENABLE(warnings,
  160.     [  --enable-warnings       turn on GCC compiler warnings],
  161.     [with_warnings=$enableval])
  162. if test -n "$GCC"
  163. then
  164.     # gcc 2.5.8 doesn't recognize some other useful options that could
  165.     # be configured if you have gcc 2.6.3:
  166.     # -Wbad-function-cast
  167.     # -Wmissing-declarations
  168.     if test -n "$with_warnings"
  169.     then
  170.         CFLAGS="$CFLAGS -Wall -Winline -Wshadow -Wstrict-prototypes -Wmissing-prototypes"
  171.     fi
  172. fi
  173.  
  174. ###    use option --with-assertions to turn on generation of assertion code
  175. AC_ARG_ENABLE(assertions,
  176.     [  --enable-assertions     turn on generation of assertion code],
  177.     [with_assertions=$enableval])
  178. if test -n "$GCC"
  179. then
  180.     # gcc 2.5.8 doesn't recognize some other useful options that could
  181.     # be configured if you have gcc 2.6.3:
  182.     # -Wbad-function-cast
  183.     # -Wmissing-declarations
  184.     if test -z "$with_assertions"
  185.     then
  186.         CPPFLAGS="$CPPFLAGS -DNDEBUG"
  187.     fi
  188. fi
  189.  
  190. ###    Checks for libraries.
  191. AC_CHECK_LIB(bsd, gettimeofday)dnl CLIX: bzero, select, gettimeofday
  192.  
  193. ###    Checks for header files.
  194. AC_STDC_HEADERS
  195. AC_HEADER_DIRENT
  196.  
  197. dnl These are some other potentially nonportable headers.
  198. dnl PROBLEMS ON RECENT NS3.2+ MACHINES:  regex.h and termios.h exist but don't define posix
  199. dnl                                      functions.  For now user will have to remove those
  200. dnl                                      defines in config.status or config.h
  201.  
  202. AC_CHECK_HEADERS( \
  203. fcntl.h \
  204. getopt.h \
  205. libc.h \
  206. limits.h \
  207. regex.h \
  208. regexp.h \
  209. sys/ioctl.h \
  210. sys/param.h \
  211. sys/select.h \
  212. sys/time.h \
  213. termios.h \
  214. ttyent.h \
  215. unistd.h \
  216. values.h \
  217. )
  218.  
  219. # check for SCO.  this is a hack, and should be split into individual
  220. # features -- the sys/time.h and select.h conflict, and the need for
  221. # ptem.h due to winsize struct.
  222. AC_CHECKING([for SCO by checking on /usr/bin/scosh])
  223. AC_PROGRAM_CHECK(COULD_BE_SCO, [scosh], maybe, maybenot)
  224. if test "$COULD_BE_SCO" = "maybe"
  225. then
  226.     AC_DEFINE(SYSTEM_LOOKS_LIKE_SCO)
  227. fi
  228.  
  229. ###    checks for compiler characteristics
  230. AC_LANG_C
  231. AC_C_CONST
  232. AC_C_INLINE
  233. test $ac_cv_c_inline != no && AC_DEFINE(CC_HAS_INLINE_FUNCS)
  234.  
  235. ###    Checks for external-data
  236. NC_ERRNO
  237. NC_SYS_ERRLIST
  238. NC_LINK_DATAONLY
  239. NC_SPEED_TYPE
  240.  
  241. ###    Checks for library functions.
  242. AC_CHECK_FUNCS( \
  243. gettimeofday \
  244. getttynam \
  245. memccpy \
  246. setbuffer \
  247. setvbuf \
  248. sigaction \
  249. strdup \
  250. usleep \
  251. vsscanf \
  252. )
  253.  
  254. if test $ac_cv_func_sigaction = yes; then
  255. AC_MSG_CHECKING(whether sigaction needs _POSIX_SOURCE)
  256. AC_TRY_COMPILE([#include <sys/types.h>
  257. #include <signal.h>], [struct sigaction act;],
  258.   sigact_bad=no, sigact_bad=yes AC_DEFINE(SVR4_ACTION))
  259. fi
  260. AC_MSG_RESULT($sigact_bad)
  261.  
  262. NC_TYPE_SIGACTION
  263. NC_TIOCGWINSZ
  264.  
  265. dnl FIXME checks we don't do (but neither does the old Configure script):
  266. dnl -DGOOD_SELECT
  267.  
  268. dnl We'll do our own -g libraries
  269. NC_STRIP_G_OPT(CFLAGS)
  270. NC_STRIP_G_OPT(CXXFLAGS)
  271.  
  272. dnl Check for C++ compiler characteristics (and ensure that it's there!)
  273. AC_CHECK_PROG(CXX_EXISTS, $CXX, yes, no)
  274. if test "$ac_cv_prog_CXX_EXISTS" = yes; then
  275.     AC_LANG_CPLUSPLUS
  276.     NC_CXX_LIBRARY
  277.     NC_BOOL_DECL
  278.     NC_BOOL_SIZE
  279. else
  280.     nc_cxx_library=no
  281.     AC_CACHE_VAL(nc_cv_builtin_bool,[nc_cv_builtin_bool=0])
  282.     AC_CACHE_VAL(nc_cv_sizeof_bool,[nc_cv_sizeof_bool=int])
  283. fi
  284.  
  285. ### It's not possible to appease gcc 2.6.3's conversion-warnings if we're
  286. ### using a 'char' for bools.  gcc 2.7.0's conversion-warnings are broken too
  287. ### badly to consider using for development purposes, but 2.5.8 is okay.
  288. if test -n "$with_warnings"; then
  289.     if test -n "$GCC"; then
  290.         case "`gcc --version`" in
  291.         2.6.3)
  292.             if test "$nc_cv_sizeof_bool" != "char"; then
  293.                 CFLAGS="$CFLAGS -Wconversion"
  294.             fi
  295.             ;;
  296.         2.5*)
  297.             CFLAGS="$CFLAGS -Wconversion"
  298.             ;;
  299.         esac
  300.     fi
  301. fi
  302.  
  303. ### Construct the list of include-directories to be generated
  304. NC_INCLUDE_DIRS
  305.  
  306. ### Construct the list of subdirectories for which we'll customize makefiles
  307. ### with the appropriate compile-rules.
  308. NC_SRC_MODULES(ncurses progs panel menu form)
  309. NC_DIRS_TO_MAKE
  310.  
  311. ################################################################################
  312. changequote({,})dnl
  313. AC_OUTPUT(include/config_h $SUB_MAKEFILES Makefile,{
  314.  
  315. NC_LIB_RULES
  316.  
  317. ### Special editing.  We generate config.h directly to allow all filenames
  318. ### to be MSDOS-compatible, as well as to make the list of definitions be
  319. ### dynamically determined by the configuration script -- a consideration when
  320. ### doing type-clean development testing.
  321.  
  322. echo creating include/config.h
  323. rm -f include/config.h
  324. echo "/* generated by configure-script
  325.  * On host: $SYS_NAME
  326.  */
  327. #ifndef NC_CONFIG_H
  328. #define NC_CONFIG_H" >include/config.h
  329. sed    -e '/^ -D/!d' \
  330.     -e 's/ -D/\
  331. #define /g' \
  332.     -e 's/\(#define [A-Za-z_][A-Za-z0-9_]*\)=/\1    /g' \
  333.     -e 's/\\//g' \
  334.     include/config_h | sort >>include/config.h
  335. echo "
  336.     /* The C compiler may not treat these properly, but C++ has to */
  337. #ifdef __cplusplus
  338. #undef const
  339. #undef inline
  340. #endif
  341.  
  342. #endif /* NC_CONFIG_H */" >> include/config.h
  343. echo removing include/config_h
  344. rm include/config_h
  345. },{
  346. ### Special initialization commands, used to pass information from the
  347. ### configuration-run into config.status
  348.  
  349. SYS_NAME="`(uname -a || hostname) 2>/dev/null | sed 1q`"
  350. if test -z "\$SYS_NAME"; then SYS_NAME=unknown;fi
  351.  
  352. AWK=$AWK
  353. DFT_LWR_MODEL="$DFT_LWR_MODEL"
  354. NC_LIST_MODELS="$nc_list_models"
  355. WITH_ECHO="$with_echo"
  356. WITH_OVERWRITE="$with_overwrite"
  357. SRC_SUBDIRS="$SRC_SUBDIRS"
  358. nc_cxx_library="$nc_cxx_library"
  359. nc_cv_systype="$nc_cv_systype"
  360. nc_cv_rel_version="$nc_cv_rel_version"
  361. nc_cv_abi_version="$nc_cv_abi_version"
  362. nc_cv_do_symlinks="$nc_cv_do_symlinks"
  363. nc_cv_rm_so_locs="$nc_cv_rm_so_locs"
  364.  
  365. })
  366. changequote([,])dnl
  367.