configure.in 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. dnl***************************************************************************
  2. dnl Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
  3. dnl *
  4. dnl Permission is hereby granted, free of charge, to any person obtaining a *
  5. dnl copy of this software and associated documentation files (the *
  6. dnl "Software"), to deal in the Software without restriction, including *
  7. dnl without limitation the rights to use, copy, modify, merge, publish, *
  8. dnl distribute, distribute with modifications, sublicense, and/or sell *
  9. dnl copies of the Software, and to permit persons to whom the Software is *
  10. dnl furnished to do so, subject to the following conditions: *
  11. dnl *
  12. dnl The above copyright notice and this permission notice shall be included *
  13. dnl in all copies or substantial portions of the Software. *
  14. dnl *
  15. dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
  16. dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
  17. dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
  18. dnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
  19. dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
  20. dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
  21. dnl THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
  22. dnl *
  23. dnl Except as contained in this notice, the name(s) of the above copyright *
  24. dnl holders shall not be used in advertising or otherwise to promote the *
  25. dnl sale, use or other dealings in this Software without prior written *
  26. dnl authorization. *
  27. dnl***************************************************************************
  28. dnl
  29. dnl Author: Thomas E. Dickey 1996, etc.
  30. dnl
  31. dnl $Id: configure.in,v 1.67 2008/09/06 22:10:23 tom Exp $
  32. dnl This is a simple configuration-script for the ncurses test programs that
  33. dnl allows the test-directory to be separately configured against a reference
  34. dnl system (i.e., sysvr4 curses)
  35. dnl
  36. dnl If you're configuring ncurses, you shouldn't need to use this script.
  37. dnl It's only for testing purposes.
  38. dnl
  39. dnl See http://invisible-island.net/autoconf/ for additional information.
  40. dnl ---------------------------------------------------------------------------
  41. AC_PREREQ(2.13.20020210)
  42. AC_INIT(ncurses.c)
  43. AC_CONFIG_HEADER(ncurses_cfg.h:ncurses_tst.hin)
  44. CF_INHERIT_SCRIPT(config.guess)
  45. CF_INHERIT_SCRIPT(config.sub)
  46. CF_CHECK_CACHE
  47. AC_PROG_MAKE_SET
  48. AC_PROG_CC
  49. AC_PROG_CPP
  50. AC_PROG_AWK
  51. dnl Things that we don't need (or must override) if we're not building ncurses
  52. CC_G_OPT="-g" AC_SUBST(CC_G_OPT)
  53. CC_SHARED_OPTS=unknown AC_SUBST(CC_SHARED_OPTS)
  54. CPPFLAGS="$CPPFLAGS" AC_SUBST(CPPFLAGS)
  55. DFT_DEP_SUFFIX="" AC_SUBST(DFT_DEP_SUFFIX)
  56. DFT_OBJ_SUBDIR=`pwd|sed -e's:.*/::'` AC_SUBST(DFT_OBJ_SUBDIR)
  57. DFT_UPR_MODEL="NORMAL" AC_SUBST(DFT_UPR_MODEL)
  58. LD="ld" AC_SUBST(LD)
  59. LDFLAGS_SHARED="" AC_SUBST(LDFLAGS_SHARED)
  60. LDFLAGS_STATIC="" AC_SUBST(LDFLAGS_STATIC)
  61. LD_MODEL="" AC_SUBST(LD_MODEL)
  62. LD_SHARED_OPTS="" AC_SUBST(LD_SHARED_OPTS)
  63. LIBTOOL="" AC_SUBST(LIBTOOL)
  64. LIB_CLEAN="" AC_SUBST(LIB_CLEAN)
  65. LIB_COMPILE="" AC_SUBST(LIB_COMPILE)
  66. LIB_LINK='${CC}' AC_SUBST(LIB_LINK)
  67. LINK_TESTS="" AC_SUBST(LINK_TESTS)
  68. LINT=lint AC_SUBST(LINT)
  69. LINT_OPTS="" AC_SUBST(LINT_OPTS)
  70. LOCAL_LDFLAGS="" AC_SUBST(LOCAL_LDFLAGS)
  71. MATH_LIB="-lm" AC_SUBST(MATH_LIB)
  72. PTHREAD="-lm" AC_SUBST(PTHREAD)
  73. TEST_ARGS="" AC_SUBST(TEST_ARGS)
  74. TEST_DEPS="" AC_SUBST(TEST_DEPS)
  75. TEST_LIBS="" AC_SUBST(TEST_LIBS)
  76. TINFO_ARGS='$(LIBS_CURSES)' AC_SUBST(TINFO_ARGS)
  77. cf_cv_abi_version="" AC_SUBST(cf_cv_abi_version)
  78. cf_cv_rel_version="" AC_SUBST(cf_cv_rel_version)
  79. cf_cv_screen=curses
  80. cf_cv_libtype=
  81. AC_EXEEXT
  82. AC_OBJEXT
  83. CF_ANSI_CC_REQD
  84. CF_GCC_ATTRIBUTES
  85. CF_XOPEN_SOURCE
  86. AC_C_CONST
  87. CF_SIG_ATOMIC_T
  88. CF_DISABLE_ECHO
  89. CF_ENABLE_WARNINGS
  90. CF_WITH_CURSES_DIR
  91. dnl SunOS 4.x
  92. AC_ARG_WITH(5lib,
  93. [ --with-5lib use SunOS sysv-libraries],
  94. [LIBS="-L/usr/5lib $LIBS"
  95. CPPFLAGS="$CPPFLAGS -I/usr/5include"])
  96. dnl ---------------------------------------------------------------------------
  97. dnl NcursesW, installed in conventional location
  98. AC_ARG_WITH(ncursesw,
  99. [ --with-ncursesw use wide ncurses-libraries (installed)],
  100. [cf_cv_screen=ncursesw],[
  101. dnl Ncurses, installed in conventional location
  102. AC_ARG_WITH(ncurses,
  103. [ --with-ncurses use ncurses-libraries (installed)],
  104. [cf_cv_screen=ncurses],[
  105. AC_ARG_WITH(pdcurses,
  106. [ --with-pdcurses compile/link with pdcurses X11 library],
  107. [cf_cv_screen=pdcurses])])])
  108. case $cf_cv_screen in
  109. curses)
  110. CF_CURSES_CPPFLAGS
  111. CF_NCURSES_VERSION
  112. CF_CURSES_LIBS
  113. ;;
  114. ncurses)
  115. CF_NCURSES_CPPFLAGS
  116. CF_NCURSES_LIBS
  117. ;;
  118. ncursesw)
  119. cf_cv_libtype=w
  120. CF_UTF8_LIB
  121. CF_NCURSES_CPPFLAGS(ncursesw)
  122. CF_NCURSES_LIBS(ncursesw)
  123. ;;
  124. pdcurses) #(vi
  125. CF_PDCURSES_X11
  126. ;;
  127. esac
  128. dnl If we've not specified a library, assume we're using sysvr4 libraries
  129. dnl installed conventionally (e.g., SunOS 5.x - solaris).
  130. dnl Autoconf builds up the $LIBS in reverse order
  131. case $cf_cv_screen in #(vi
  132. pdcurses) #(vi
  133. ;;
  134. *)
  135. # look for curses-related libraries
  136. AC_CHECK_LIB(panel$cf_cv_libtype,new_panel)
  137. AC_CHECK_LIB(menu$cf_cv_libtype,menu_driver)
  138. AC_CHECK_LIB(form$cf_cv_libtype,form_driver)
  139. # look for curses-related headers
  140. AC_CHECK_HEADERS( \
  141. nc_alloc.h \
  142. nomacros.h \
  143. form.h \
  144. menu.h \
  145. panel.h \
  146. )
  147. ;;
  148. esac
  149. AC_TYPE_SIGNAL
  150. AC_STDC_HEADERS
  151. AC_HEADER_TIME
  152. AC_CHECK_HEADERS( \
  153. getopt.h \
  154. locale.h \
  155. stdarg.h \
  156. sys/ioctl.h \
  157. sys/select.h \
  158. sys/time.h \
  159. termios.h \
  160. unistd.h \
  161. )
  162. AC_CHECK_FUNCS( \
  163. gettimeofday \
  164. mblen \
  165. mbrlen \
  166. mbrtowc \
  167. mbsrtowcs \
  168. mbstowcs \
  169. mbtowc \
  170. strdup \
  171. wcsrtombs \
  172. wcstombs \
  173. )
  174. CF_CURSES_FUNCS( \
  175. chgat \
  176. color_set \
  177. filter \
  178. getbegx \
  179. getcurx \
  180. getmaxx \
  181. getnstr \
  182. getparx \
  183. getwin \
  184. mvvline \
  185. mvwvline \
  186. napms \
  187. putwin \
  188. resize_term \
  189. resizeterm \
  190. ripoffline \
  191. setupterm \
  192. slk_color \
  193. slk_init \
  194. termattrs \
  195. tgetent \
  196. tigetnum \
  197. tigetstr \
  198. typeahead \
  199. use_default_colors \
  200. vsscanf \
  201. wchgat \
  202. winsstr \
  203. wresize \
  204. )
  205. AC_CACHE_CHECK(for ncurses extended functions,cf_cv_ncurses_ext_funcs,[
  206. AC_TRY_LINK([
  207. #include <${cf_cv_ncurses_header-curses.h}>],
  208. [
  209. (void) assume_default_colors (0, 0);
  210. (void) curses_version ();
  211. (void) define_key (0, 0);
  212. (void) is_term_resized (0, 0);
  213. (void) key_defined (0);
  214. (void) keybound (0, 0);
  215. (void) keyok (0, 0);
  216. (void) resize_term (0, 0);
  217. (void) resizeterm (0, 0);
  218. (void) use_default_colors ();
  219. (void) use_extended_names (0);
  220. (void) wresize (0, 0, 0);],
  221. [cf_cv_ncurses_ext_funcs=yes],
  222. [cf_cv_ncurses_ext_funcs=no])
  223. ])
  224. test "$cf_cv_ncurses_ext_funcs" != no && AC_DEFINE(NCURSES_EXT_FUNCS)
  225. AC_CACHE_CHECK(for wide-character functions,cf_cv_widechar_funcs,[
  226. AC_TRY_LINK([
  227. #include <${cf_cv_ncurses_header-curses.h}>],
  228. [
  229. static wchar_t src_wchar[2];
  230. static cchar_t dst_cchar;
  231. setcchar(&dst_cchar, src_wchar, A_NORMAL, 0, (void *) 0);
  232. ],
  233. [cf_cv_widechar_funcs=yes],
  234. [cf_cv_widechar_funcs=no])
  235. ])
  236. if test "$cf_cv_widechar_funcs" != no ; then
  237. AC_DEFINE(USE_WIDEC_SUPPORT,1)
  238. else
  239. AC_DEFINE(USE_WIDEC_SUPPORT,0)
  240. fi
  241. CF_SYS_TIME_SELECT
  242. CF_FUNC_CURSES_VERSION
  243. CF_CURSES_ACS_MAP
  244. CF_CURSES_WACS_MAP
  245. CF_CURSES_CHECK_TYPE(attr_t,long)
  246. CF_CURSES_CHECK_TYPE(mbstate_t,long)
  247. TEST_ARGS="$LIBS"
  248. LIBS=
  249. dnl ---------------------------------------------------------------------------
  250. AC_OUTPUT(Makefile,[
  251. CF_PRG_RULES([$srcdir/mk-test.awk ECHO_LINK="$ECHO_LD"], .)
  252. cat >>Makefile <<TEST_EOF
  253. # These rules are generated so we do not rely on suffix rules, which do not
  254. # work consistently for different make-programs (the '\$(MODEL)/' confuses
  255. # some, and the '\$x' confuses others).
  256. TEST_EOF
  257. LIST=`sed -e 's/[[ ]].*//' -e '/^[[#@]]/d' $srcdir/modules`
  258. for N in $LIST
  259. do
  260. cat >>Makefile <<TEST_EOF
  261. \$(MODEL)/$N.o : $N.c \\
  262. test.priv.h \\
  263. ncurses_cfg.h
  264. @echo compiling $N; \$(CC) -c \$(CFLAGS_DEFAULT) $N.c
  265. TEST_EOF
  266. done
  267. ],[
  268. AWK="$AWK"
  269. ECHO_LD="$ECHO_LD"
  270. ],cat)