Fix PROCDURE -> PROCEDURE.
[dragonfly.git] / contrib / ncurses-5.4 / test / configure
1 #! /bin/sh
2
3 # Guess values for system-dependent variables and create Makefiles.
4 # Generated automatically using autoconf version 2.13.20030927 
5 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
6 #
7 # This configure script is free software; the Free Software Foundation
8 # gives unlimited permission to copy, distribute and modify it.
9
10 # Defaults:
11 ac_help=
12 ac_default_prefix=/usr/local
13 # Any additions from configure.in:
14
15 # Initialize some variables set by options.
16 # The variables have the same names as the options, with
17 # dashes changed to underlines.
18 build=NONE
19 cache_file=./config.cache
20 exec_prefix=NONE
21 host=NONE
22 no_create=
23 nonopt=NONE
24 no_recursion=
25 prefix=NONE
26 program_prefix=NONE
27 program_suffix=NONE
28 program_transform_name=s,x,x,
29 silent=
30 site=
31 srcdir=
32 target=NONE
33 verbose=
34 x_includes=NONE
35 x_libraries=NONE
36 bindir='${exec_prefix}/bin'
37 sbindir='${exec_prefix}/sbin'
38 libexecdir='${exec_prefix}/libexec'
39 datadir='${prefix}/share'
40 sysconfdir='${prefix}/etc'
41 sharedstatedir='${prefix}/com'
42 localstatedir='${prefix}/var'
43 libdir='${exec_prefix}/lib'
44 includedir='${prefix}/include'
45 oldincludedir='/usr/include'
46 infodir='${prefix}/info'
47 mandir='${prefix}/man'
48
49 # Initialize some other variables.
50 subdirs=
51 MFLAGS= MAKEFLAGS=
52 SHELL=${CONFIG_SHELL-/bin/sh}
53 # Maximum number of lines to put in a shell here document.
54 ac_max_here_lines=12
55
56 ac_prev=
57 for ac_option
58 do
59
60   # If the previous option needs an argument, assign it.
61   if test -n "$ac_prev"; then
62     eval "$ac_prev=\$ac_option"
63     ac_prev=
64     continue
65   fi
66
67   case "$ac_option" in
68   -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
69   *) ac_optarg= ;;
70   esac
71
72   # Accept the important Cygnus configure options, so we can diagnose typos.
73
74   case "$ac_option" in
75
76   -bindir | --bindir | --bindi | --bind | --bin | --bi)
77     ac_prev=bindir ;;
78   -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
79     bindir="$ac_optarg" ;;
80
81   -build | --build | --buil | --bui | --bu)
82     ac_prev=build ;;
83   -build=* | --build=* | --buil=* | --bui=* | --bu=*)
84     build="$ac_optarg" ;;
85
86   -cache-file | --cache-file | --cache-fil | --cache-fi \
87   | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
88     ac_prev=cache_file ;;
89   -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
90   | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
91     cache_file="$ac_optarg" ;;
92
93   -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
94     ac_prev=datadir ;;
95   -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
96   | --da=*)
97     datadir="$ac_optarg" ;;
98
99   -disable-* | --disable-*)
100     ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
101     # Reject names that are not valid shell variable names.
102     if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
103       { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
104     fi
105     ac_feature=`echo $ac_feature| sed 's/-/_/g'`
106     eval "enable_${ac_feature}=no" ;;
107
108   -enable-* | --enable-*)
109     ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
110     # Reject names that are not valid shell variable names.
111     if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
112       { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
113     fi
114     ac_feature=`echo $ac_feature| sed 's/-/_/g'`
115     case "$ac_option" in
116       *=*) ;;
117       *) ac_optarg=yes ;;
118     esac
119     eval "enable_${ac_feature}='$ac_optarg'" ;;
120
121   -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
122   | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
123   | --exec | --exe | --ex)
124     ac_prev=exec_prefix ;;
125   -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
126   | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
127   | --exec=* | --exe=* | --ex=*)
128     exec_prefix="$ac_optarg" ;;
129
130   -gas | --gas | --ga | --g)
131     # Obsolete; use --with-gas.
132     with_gas=yes ;;
133
134   -help | --help | --hel | --he)
135     # Omit some internal or obsolete options to make the list less imposing.
136     # This message is too long to be a string in the A/UX 3.1 sh.
137     cat << EOF
138 Usage: configure [options] [host]
139 Options: [defaults in brackets after descriptions]
140 Configuration:
141   --cache-file=FILE       cache test results in FILE
142   --help                  print this message
143   --no-create             do not create output files
144   --quiet, --silent       do not print \`checking...' messages
145   --version               print the version of autoconf that created configure
146 Directory and file names:
147   --prefix=PREFIX         install architecture-independent files in PREFIX
148                           [$ac_default_prefix]
149   --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
150                           [same as prefix]
151   --bindir=DIR            user executables in DIR [EPREFIX/bin]
152   --sbindir=DIR           system admin executables in DIR [EPREFIX/sbin]
153   --libexecdir=DIR        program executables in DIR [EPREFIX/libexec]
154   --datadir=DIR           read-only architecture-independent data in DIR
155                           [PREFIX/share]
156   --sysconfdir=DIR        read-only single-machine data in DIR [PREFIX/etc]
157   --sharedstatedir=DIR    modifiable architecture-independent data in DIR
158                           [PREFIX/com]
159   --localstatedir=DIR     modifiable single-machine data in DIR [PREFIX/var]
160   --libdir=DIR            object code libraries in DIR [EPREFIX/lib]
161   --includedir=DIR        C header files in DIR [PREFIX/include]
162   --oldincludedir=DIR     C header files for non-gcc in DIR [/usr/include]
163   --infodir=DIR           info documentation in DIR [PREFIX/info]
164   --mandir=DIR            man documentation in DIR [PREFIX/man]
165   --srcdir=DIR            find the sources in DIR [configure dir or ..]
166   --program-prefix=PREFIX prepend PREFIX to installed program names
167   --program-suffix=SUFFIX append SUFFIX to installed program names
168   --program-transform-name=PROGRAM
169                           run sed PROGRAM on installed program names
170 EOF
171     cat << EOF
172 Host type:
173   --build=BUILD           configure for building on BUILD [BUILD=HOST]
174   --host=HOST             configure for HOST [guessed]
175   --target=TARGET         configure for TARGET [TARGET=HOST]
176 Features and packages:
177   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
178   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
179   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
180   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
181   --x-includes=DIR        X include files are in DIR
182   --x-libraries=DIR       X library files are in DIR
183 EOF
184 cat <<\EOF
185 --enable and --with options recognized:
186   --with-curses-dir=DIR   directory in which (n)curses is installed
187   --with-5lib             use SunOS sysv-libraries
188   --with-ncursesw         use wide ncurses-libraries (installed)
189   --with-ncurses          use ncurses-libraries (installed)
190 EOF
191     exit 0 ;;
192
193   -host | --host | --hos | --ho)
194     ac_prev=host ;;
195   -host=* | --host=* | --hos=* | --ho=*)
196     host="$ac_optarg" ;;
197
198   -includedir | --includedir | --includedi | --included | --include \
199   | --includ | --inclu | --incl | --inc)
200     ac_prev=includedir ;;
201   -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
202   | --includ=* | --inclu=* | --incl=* | --inc=*)
203     includedir="$ac_optarg" ;;
204
205   -infodir | --infodir | --infodi | --infod | --info | --inf)
206     ac_prev=infodir ;;
207   -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
208     infodir="$ac_optarg" ;;
209
210   -libdir | --libdir | --libdi | --libd)
211     ac_prev=libdir ;;
212   -libdir=* | --libdir=* | --libdi=* | --libd=*)
213     libdir="$ac_optarg" ;;
214
215   -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
216   | --libexe | --libex | --libe)
217     ac_prev=libexecdir ;;
218   -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
219   | --libexe=* | --libex=* | --libe=*)
220     libexecdir="$ac_optarg" ;;
221
222   -localstatedir | --localstatedir | --localstatedi | --localstated \
223   | --localstate | --localstat | --localsta | --localst \
224   | --locals | --local | --loca | --loc | --lo)
225     ac_prev=localstatedir ;;
226   -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
227   | --localstate=* | --localstat=* | --localsta=* | --localst=* \
228   | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
229     localstatedir="$ac_optarg" ;;
230
231   -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
232     ac_prev=mandir ;;
233   -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
234     mandir="$ac_optarg" ;;
235
236   -nfp | --nfp | --nf)
237     # Obsolete; use --without-fp.
238     with_fp=no ;;
239
240   -no-create | --no-create | --no-creat | --no-crea | --no-cre \
241   | --no-cr | --no-c)
242     no_create=yes ;;
243
244   -no-recursion | --no-recursion | --no-recursio | --no-recursi \
245   | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
246     no_recursion=yes ;;
247
248   -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
249   | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
250   | --oldin | --oldi | --old | --ol | --o)
251     ac_prev=oldincludedir ;;
252   -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
253   | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
254   | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
255     oldincludedir="$ac_optarg" ;;
256
257   -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
258     ac_prev=prefix ;;
259   -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
260     prefix="$ac_optarg" ;;
261
262   -program-prefix | --program-prefix | --program-prefi | --program-pref \
263   | --program-pre | --program-pr | --program-p)
264     ac_prev=program_prefix ;;
265   -program-prefix=* | --program-prefix=* | --program-prefi=* \
266   | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
267     program_prefix="$ac_optarg" ;;
268
269   -program-suffix | --program-suffix | --program-suffi | --program-suff \
270   | --program-suf | --program-su | --program-s)
271     ac_prev=program_suffix ;;
272   -program-suffix=* | --program-suffix=* | --program-suffi=* \
273   | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
274     program_suffix="$ac_optarg" ;;
275
276   -program-transform-name | --program-transform-name \
277   | --program-transform-nam | --program-transform-na \
278   | --program-transform-n | --program-transform- \
279   | --program-transform | --program-transfor \
280   | --program-transfo | --program-transf \
281   | --program-trans | --program-tran \
282   | --progr-tra | --program-tr | --program-t)
283     ac_prev=program_transform_name ;;
284   -program-transform-name=* | --program-transform-name=* \
285   | --program-transform-nam=* | --program-transform-na=* \
286   | --program-transform-n=* | --program-transform-=* \
287   | --program-transform=* | --program-transfor=* \
288   | --program-transfo=* | --program-transf=* \
289   | --program-trans=* | --program-tran=* \
290   | --progr-tra=* | --program-tr=* | --program-t=*)
291     program_transform_name="$ac_optarg" ;;
292
293   -q | -quiet | --quiet | --quie | --qui | --qu | --q \
294   | -silent | --silent | --silen | --sile | --sil)
295     silent=yes ;;
296
297   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
298     ac_prev=sbindir ;;
299   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
300   | --sbi=* | --sb=*)
301     sbindir="$ac_optarg" ;;
302
303   -sharedstatedir | --sharedstatedir | --sharedstatedi \
304   | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
305   | --sharedst | --shareds | --shared | --share | --shar \
306   | --sha | --sh)
307     ac_prev=sharedstatedir ;;
308   -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
309   | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
310   | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
311   | --sha=* | --sh=*)
312     sharedstatedir="$ac_optarg" ;;
313
314   -site | --site | --sit)
315     ac_prev=site ;;
316   -site=* | --site=* | --sit=*)
317     site="$ac_optarg" ;;
318
319   -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
320     ac_prev=srcdir ;;
321   -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
322     srcdir="$ac_optarg" ;;
323
324   -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
325   | --syscon | --sysco | --sysc | --sys | --sy)
326     ac_prev=sysconfdir ;;
327   -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
328   | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
329     sysconfdir="$ac_optarg" ;;
330
331   -target | --target | --targe | --targ | --tar | --ta | --t)
332     ac_prev=target ;;
333   -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
334     target="$ac_optarg" ;;
335
336   -v | -verbose | --verbose | --verbos | --verbo | --verb)
337     verbose=yes ;;
338
339   -version | --version | --versio | --versi | --vers)
340     echo "configure generated by autoconf version 2.13.20030927"
341     exit 0 ;;
342
343   -with-* | --with-*)
344     ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
345     # Reject names that are not valid shell variable names.
346     if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
347       { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
348     fi
349     ac_package=`echo $ac_package| sed 's/-/_/g'`
350     case "$ac_option" in
351       *=*) ;;
352       *) ac_optarg=yes ;;
353     esac
354     eval "with_${ac_package}='$ac_optarg'" ;;
355
356   -without-* | --without-*)
357     ac_package=`echo $ac_option|sed -e 's/-*without-//'`
358     # Reject names that are not valid shell variable names.
359     if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
360       { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
361     fi
362     ac_package=`echo $ac_package| sed 's/-/_/g'`
363     eval "with_${ac_package}=no" ;;
364
365   --x)
366     # Obsolete; use --with-x.
367     with_x=yes ;;
368
369   -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
370   | --x-incl | --x-inc | --x-in | --x-i)
371     ac_prev=x_includes ;;
372   -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
373   | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
374     x_includes="$ac_optarg" ;;
375
376   -x-libraries | --x-libraries | --x-librarie | --x-librari \
377   | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
378     ac_prev=x_libraries ;;
379   -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
380   | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
381     x_libraries="$ac_optarg" ;;
382
383   -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
384     ;;
385
386   *)
387     if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
388       echo "configure: warning: $ac_option: invalid host type" 1>&2
389     fi
390     if test "x$nonopt" != xNONE; then
391       { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
392     fi
393     nonopt="$ac_option"
394     ;;
395
396   esac
397 done
398
399 if test -n "$ac_prev"; then
400   { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
401 fi
402
403 trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
404
405 # File descriptor usage:
406 # 0 standard input
407 # 1 file creation
408 # 2 errors and warnings
409 # 3 some systems may open it to /dev/tty
410 # 4 used on the Kubota Titan
411 # 6 checking for... messages and results
412 # 5 compiler messages saved in config.log
413 if test "$silent" = yes; then
414   exec 6>/dev/null
415 else
416   exec 6>&1
417 fi
418 exec 5>./config.log
419
420 echo "\
421 This file contains any messages produced by compilers while
422 running configure, to aid debugging if configure makes a mistake.
423 " 1>&5
424
425 # Strip out --no-create and --no-recursion so they do not pile up.
426 # Also quote any args containing shell metacharacters.
427 ac_configure_args=
428 for ac_arg
429 do
430   case "$ac_arg" in
431   -no-create | --no-create | --no-creat | --no-crea | --no-cre \
432   | --no-cr | --no-c) ;;
433   -no-recursion | --no-recursion | --no-recursio | --no-recursi \
434   | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
435   *" "*|*"      "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
436   ac_configure_args="$ac_configure_args '$ac_arg'" ;;
437   *) ac_configure_args="$ac_configure_args $ac_arg" ;;
438   esac
439 done
440
441 # NLS nuisances.
442 # Only set these to C if already set.  These must not be set unconditionally
443 # because not all systems understand e.g. LANG=C (notably SCO).
444 # Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
445 # Non-C LC_CTYPE values break the ctype check.
446 if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
447 if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
448 if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
449 if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
450
451 # confdefs.h avoids OS command line length limits that DEFS can exceed.
452 rm -rf conftest* confdefs.h
453 # AIX cpp loses on an empty file, so make sure it contains at least a newline.
454 echo > confdefs.h
455
456 # A filename unique to this package, relative to the directory that
457 # configure is in, which we can look for to find out if srcdir is correct.
458 ac_unique_file=ncurses.c
459
460 # Find the source files, if location was not specified.
461 if test -z "$srcdir"; then
462   ac_srcdir_defaulted=yes
463   # Try the directory containing this script, then its parent.
464   ac_prog=$0
465   ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
466   test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
467   srcdir=$ac_confdir
468   if test ! -r $srcdir/$ac_unique_file; then
469     srcdir=..
470   fi
471 else
472   ac_srcdir_defaulted=no
473 fi
474 if test ! -r $srcdir/$ac_unique_file; then
475   if test "$ac_srcdir_defaulted" = yes; then
476     { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
477   else
478     { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
479   fi
480 fi
481 srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
482
483 # Prefer explicitly selected file to automatically selected ones.
484 if test -z "$CONFIG_SITE"; then
485   if test "x$prefix" != xNONE; then
486     CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
487   else
488     CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
489   fi
490 fi
491 for ac_site_file in $CONFIG_SITE; do
492   if test -r "$ac_site_file"; then
493     echo "loading site script $ac_site_file"
494     . "$ac_site_file"
495   fi
496 done
497
498 if test -r "$cache_file"; then
499   echo "loading cache $cache_file"
500   . $cache_file
501 else
502   echo "creating cache $cache_file"
503   > $cache_file
504 fi
505
506 ac_ext=c
507 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
508 ac_cpp='$CPP $CPPFLAGS'
509 ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
510 ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
511 cross_compiling=$ac_cv_prog_cc_cross
512
513 ac_exeext=
514 ac_objext=o
515 if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
516   # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
517   if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
518     ac_n= ac_c='
519 ' ac_t='        '
520   else
521     ac_n=-n ac_c= ac_t=
522   fi
523 else
524   ac_n= ac_c='\c' ac_t=
525 fi
526
527
528
529
530
531 test -f config.guess || ( test -f ../config.guess && cp ../config.guess ./ )
532
533
534 test -f config.sub || ( test -f ../config.sub && cp ../config.sub ./ )
535
536 ac_aux_dir=
537 for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
538   if test -f $ac_dir/install-sh; then
539     ac_aux_dir=$ac_dir
540     ac_install_sh="$ac_aux_dir/install-sh -c"
541     break
542   elif test -f $ac_dir/install.sh; then
543     ac_aux_dir=$ac_dir
544     ac_install_sh="$ac_aux_dir/install.sh -c"
545     break
546   fi
547 done
548 if test -z "$ac_aux_dir"; then
549   { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
550 fi
551 ac_config_guess=$ac_aux_dir/config.guess
552 ac_config_sub=$ac_aux_dir/config.sub
553 ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
554
555
556 if test -f $srcdir/config.guess ; then
557         
558 # Make sure we can run config.sub.
559 if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
560 else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
561 fi
562
563 echo $ac_n "checking host system type""... $ac_c" 1>&6
564 echo "configure:565: checking host system type" >&5
565
566 host_alias=$host
567 case "$host_alias" in
568 NONE)
569   case $nonopt in
570   NONE)
571     if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
572     else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
573     fi ;;
574   *) host_alias=$nonopt ;;
575   esac ;;
576 esac
577
578 host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
579 host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
580 host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
581 host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
582 echo "$ac_t""$host" 1>&6
583
584         system_name="$host_os"
585 else
586         system_name="`(uname -s -r) 2>/dev/null`"
587         if test -z "$system_name" ; then
588                 system_name="`(hostname) 2>/dev/null`"
589         fi
590 fi
591 test -n "$system_name" && cat >> confdefs.h <<EOF
592 #define SYSTEM_NAME "$system_name"
593 EOF
594
595 if eval "test \"`echo '$''{'cf_cv_system_name'+set}'`\" = set"; then
596   echo $ac_n "(cached) $ac_c" 1>&6
597 else
598   cf_cv_system_name="$system_name"
599 fi
600
601
602 test -z "$system_name" && system_name="$cf_cv_system_name"
603 test -n "$cf_cv_system_name" && echo "$ac_t""Configuring for $cf_cv_system_name" 1>&6
604
605 if test ".$system_name" != ".$cf_cv_system_name" ; then
606         echo "$ac_t""Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" 1>&6
607         { echo "configure: error: "Please remove config.cache and try again."" 1>&2; exit 1; }
608 fi
609
610
611 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
612 echo "configure:613: checking whether ${MAKE-make} sets \${MAKE}" >&5
613 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
614 if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
615   echo $ac_n "(cached) $ac_c" 1>&6
616 else
617   cat > conftestmake <<\EOF
618 all:
619         @echo 'ac_maketemp="${MAKE}"'
620 EOF
621 # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
622 eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
623 if test -n "$ac_maketemp"; then
624   eval ac_cv_prog_make_${ac_make}_set=yes
625 else
626   eval ac_cv_prog_make_${ac_make}_set=no
627 fi
628 rm -f conftestmake
629 fi
630 if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
631   echo "$ac_t""yes" 1>&6
632   SET_MAKE=
633 else
634   echo "$ac_t""no" 1>&6
635   SET_MAKE="MAKE=${MAKE-make}"
636 fi
637
638 # Extract the first word of "gcc", so it can be a program name with args.
639 set dummy gcc; ac_word=$2
640 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
641 echo "configure:642: checking for $ac_word" >&5
642 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
643   echo $ac_n "(cached) $ac_c" 1>&6
644 else
645   if test -n "$CC"; then
646   ac_cv_prog_CC="$CC" # Let the user override the test.
647 else
648   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
649   ac_dummy="$PATH"
650   for ac_dir in $ac_dummy; do
651     test -z "$ac_dir" && ac_dir=.
652     if test -f $ac_dir/$ac_word; then
653       ac_cv_prog_CC="gcc"
654       break
655     fi
656   done
657   IFS="$ac_save_ifs"
658 fi
659 fi
660 CC="$ac_cv_prog_CC"
661 if test -n "$CC"; then
662   echo "$ac_t""$CC" 1>&6
663 else
664   echo "$ac_t""no" 1>&6
665 fi
666
667 if test -z "$CC"; then
668   # Extract the first word of "cc", so it can be a program name with args.
669 set dummy cc; ac_word=$2
670 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
671 echo "configure:672: checking for $ac_word" >&5
672 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
673   echo $ac_n "(cached) $ac_c" 1>&6
674 else
675   if test -n "$CC"; then
676   ac_cv_prog_CC="$CC" # Let the user override the test.
677 else
678   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
679   ac_prog_rejected=no
680   ac_dummy="$PATH"
681   for ac_dir in $ac_dummy; do
682     test -z "$ac_dir" && ac_dir=.
683     if test -f $ac_dir/$ac_word; then
684       if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
685         ac_prog_rejected=yes
686         continue
687       fi
688       ac_cv_prog_CC="cc"
689       break
690     fi
691   done
692   IFS="$ac_save_ifs"
693 if test $ac_prog_rejected = yes; then
694   # We found a bogon in the path, so make sure we never use it.
695   set dummy $ac_cv_prog_CC
696   shift
697   if test $# -gt 0; then
698     # We chose a different compiler from the bogus one.
699     # However, it has the same basename, so the bogon will be chosen
700     # first if we set CC to just the basename; use the full file name.
701     shift
702     set dummy "$ac_dir/$ac_word" "$@"
703     shift
704     ac_cv_prog_CC="$@"
705   fi
706 fi
707 fi
708 fi
709 CC="$ac_cv_prog_CC"
710 if test -n "$CC"; then
711   echo "$ac_t""$CC" 1>&6
712 else
713   echo "$ac_t""no" 1>&6
714 fi
715
716   if test -z "$CC"; then
717     case "`uname -s`" in
718     *win32* | *WIN32*)
719       # Extract the first word of "cl", so it can be a program name with args.
720 set dummy cl; ac_word=$2
721 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
722 echo "configure:723: checking for $ac_word" >&5
723 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
724   echo $ac_n "(cached) $ac_c" 1>&6
725 else
726   if test -n "$CC"; then
727   ac_cv_prog_CC="$CC" # Let the user override the test.
728 else
729   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
730   ac_dummy="$PATH"
731   for ac_dir in $ac_dummy; do
732     test -z "$ac_dir" && ac_dir=.
733     if test -f $ac_dir/$ac_word; then
734       ac_cv_prog_CC="cl"
735       break
736     fi
737   done
738   IFS="$ac_save_ifs"
739 fi
740 fi
741 CC="$ac_cv_prog_CC"
742 if test -n "$CC"; then
743   echo "$ac_t""$CC" 1>&6
744 else
745   echo "$ac_t""no" 1>&6
746 fi
747  ;;
748     esac
749   fi
750   test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
751 fi
752
753 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
754 echo "configure:755: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
755
756 ac_ext=c
757 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
758 ac_cpp='$CPP $CPPFLAGS'
759 ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
760 ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
761 cross_compiling=$ac_cv_prog_cc_cross
762
763 cat > conftest.$ac_ext << EOF
764
765 #line 766 "configure"
766 #include "confdefs.h"
767
768 main(){return(0);}
769 EOF
770 if { (eval echo configure:771: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
771   ac_cv_prog_cc_works=yes
772   # If we can't run a trivial program, we are probably using a cross compiler.
773   if (./conftest; exit) 2>/dev/null; then
774     ac_cv_prog_cc_cross=no
775   else
776     ac_cv_prog_cc_cross=yes
777   fi
778 else
779   echo "configure: failed program was:" >&5
780   cat conftest.$ac_ext >&5
781   ac_cv_prog_cc_works=no
782 fi
783 rm -fr conftest*
784 ac_ext=c
785 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
786 ac_cpp='$CPP $CPPFLAGS'
787 ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
788 ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
789 cross_compiling=$ac_cv_prog_cc_cross
790
791 echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
792 if test $ac_cv_prog_cc_works = no; then
793   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
794 fi
795 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
796 echo "configure:797: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
797 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
798 cross_compiling=$ac_cv_prog_cc_cross
799
800 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
801 echo "configure:802: checking whether we are using GNU C" >&5
802 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
803   echo $ac_n "(cached) $ac_c" 1>&6
804 else
805   cat > conftest.c <<EOF
806 #ifdef __GNUC__
807   yes;
808 #endif
809 EOF
810 if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:811: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
811   ac_cv_prog_gcc=yes
812 else
813   ac_cv_prog_gcc=no
814 fi
815 fi
816
817 echo "$ac_t""$ac_cv_prog_gcc" 1>&6
818
819 if test $ac_cv_prog_gcc = yes; then
820   GCC=yes
821 else
822   GCC=
823 fi
824
825 ac_test_CFLAGS="${CFLAGS+set}"
826 ac_save_CFLAGS="$CFLAGS"
827 CFLAGS=
828 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
829 echo "configure:830: checking whether ${CC-cc} accepts -g" >&5
830 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
831   echo $ac_n "(cached) $ac_c" 1>&6
832 else
833   echo 'void f(){}' > conftest.c
834 if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
835   ac_cv_prog_cc_g=yes
836 else
837   ac_cv_prog_cc_g=no
838 fi
839 rm -f conftest*
840
841 fi
842
843 echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
844 if test "$ac_test_CFLAGS" = set; then
845   CFLAGS="$ac_save_CFLAGS"
846 elif test $ac_cv_prog_cc_g = yes; then
847   if test "$GCC" = yes; then
848     CFLAGS="-g -O2"
849   else
850     CFLAGS="-g"
851   fi
852 else
853   if test "$GCC" = yes; then
854     CFLAGS="-O2"
855   else
856     CFLAGS=
857   fi
858 fi
859
860 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
861 echo "configure:862: checking how to run the C preprocessor" >&5
862 # On Suns, sometimes $CPP names a directory.
863 if test -n "$CPP" && test -d "$CPP"; then
864   CPP=
865 fi
866 if test -z "$CPP"; then
867 if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
868   echo $ac_n "(cached) $ac_c" 1>&6
869 else
870     # This must be in double quotes, not single quotes, because CPP may get
871   # substituted into the Makefile and "${CC-cc}" will confuse make.
872   CPP="${CC-cc} -E"
873   # On the NeXT, cc -E runs the code through the compiler's parser,
874   # not just through cpp.
875   cat > conftest.$ac_ext <<EOF
876 #line 877 "configure"
877 #include "confdefs.h"
878 #include <assert.h>
879 Syntax Error
880 EOF
881 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
882 { (eval echo configure:883: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
883 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
884 if test -z "$ac_err"; then
885   :
886 else
887   echo "$ac_err" >&5
888   echo "configure: failed program was:" >&5
889   cat conftest.$ac_ext >&5
890   rm -rf conftest*
891   CPP="${CC-cc} -E -traditional-cpp"
892   cat > conftest.$ac_ext <<EOF
893 #line 894 "configure"
894 #include "confdefs.h"
895 #include <assert.h>
896 Syntax Error
897 EOF
898 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
899 { (eval echo configure:900: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
900 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
901 if test -z "$ac_err"; then
902   :
903 else
904   echo "$ac_err" >&5
905   echo "configure: failed program was:" >&5
906   cat conftest.$ac_ext >&5
907   rm -rf conftest*
908   CPP="${CC-cc} -nologo -E"
909   cat > conftest.$ac_ext <<EOF
910 #line 911 "configure"
911 #include "confdefs.h"
912 #include <assert.h>
913 Syntax Error
914 EOF
915 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
916 { (eval echo configure:917: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
917 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
918 if test -z "$ac_err"; then
919   :
920 else
921   echo "$ac_err" >&5
922   echo "configure: failed program was:" >&5
923   cat conftest.$ac_ext >&5
924   rm -rf conftest*
925   CPP=/lib/cpp
926 fi
927 rm -f conftest*
928 fi
929 rm -f conftest*
930 fi
931 rm -f conftest*
932   ac_cv_prog_CPP="$CPP"
933 fi
934   CPP="$ac_cv_prog_CPP"
935 else
936   ac_cv_prog_CPP="$CPP"
937 fi
938 echo "$ac_t""$CPP" 1>&6
939
940
941 CC_G_OPT="-g"                           
942 CC_SHARED_OPTS=unknown                  
943 CPPFLAGS="$CPPFLAGS"                    
944 DFT_DEP_SUFFIX=""                       
945 DFT_OBJ_SUBDIR=`pwd|sed -e's:.*/::'`    
946 DFT_UPR_MODEL="NORMAL"                  
947 ECHO_LINK='@ echo linking $@ ... ;'     
948 EXTRA_LIBS=""                           
949 LD="ld"                                 
950 LDFLAGS_SHARED=""                       
951 LD_MODEL=""                             
952 LD_SHARED_OPTS=""                       
953 LIBTOOL=""                              
954 LIB_CLEAN=""                            
955 LIB_COMPILE=""                          
956 LIB_LINK=""                             
957 LIB_NAME=curses                         
958 LIB_PREFIX="-l"                         
959 LINK_TESTS=""                           
960 LINT=lint                               
961 LINT_OPTS=""                            
962 LOCAL_LDFLAGS=""                        
963 MATH_LIB="-lm"                          
964 TEST_ARGS=""                            
965 TEST_DEPS=""                            
966 cf_cv_abi_version=""                    
967 cf_cv_rel_version=""                    
968
969 cf_cv_screen=curses
970 cf_cv_libtype=
971
972 echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
973 echo "configure:974: checking for Cygwin environment" >&5
974 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
975   echo $ac_n "(cached) $ac_c" 1>&6
976 else
977   cat > conftest.$ac_ext <<EOF
978 #line 979 "configure"
979 #include "confdefs.h"
980
981 int main() {
982
983 #ifndef __CYGWIN__
984 #define __CYGWIN__ __CYGWIN32__
985 #endif
986 return __CYGWIN__;
987 ; return 0; }
988 EOF
989 if { (eval echo configure:990: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
990   rm -rf conftest*
991   ac_cv_cygwin=yes
992 else
993   echo "configure: failed program was:" >&5
994   cat conftest.$ac_ext >&5
995   rm -rf conftest*
996   ac_cv_cygwin=no
997 fi
998 rm -f conftest*
999 rm -f conftest*
1000 fi
1001
1002 echo "$ac_t""$ac_cv_cygwin" 1>&6
1003 CYGWIN=
1004 test "$ac_cv_cygwin" = yes && CYGWIN=yes
1005 echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
1006 echo "configure:1007: checking for mingw32 environment" >&5
1007 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
1008   echo $ac_n "(cached) $ac_c" 1>&6
1009 else
1010   cat > conftest.$ac_ext <<EOF
1011 #line 1012 "configure"
1012 #include "confdefs.h"
1013
1014 int main() {
1015 return __MINGW32__;
1016 ; return 0; }
1017 EOF
1018 if { (eval echo configure:1019: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1019   rm -rf conftest*
1020   ac_cv_mingw32=yes
1021 else
1022   echo "configure: failed program was:" >&5
1023   cat conftest.$ac_ext >&5
1024   rm -rf conftest*
1025   ac_cv_mingw32=no
1026 fi
1027 rm -f conftest*
1028 rm -f conftest*
1029 fi
1030
1031 echo "$ac_t""$ac_cv_mingw32" 1>&6
1032 MINGW32=
1033 test "$ac_cv_mingw32" = yes && MINGW32=yes
1034
1035
1036 echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
1037 echo "configure:1038: checking for executable suffix" >&5
1038 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
1039   echo $ac_n "(cached) $ac_c" 1>&6
1040 else
1041   if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
1042   ac_cv_exeext=.exe
1043 else
1044   rm -f conftest*
1045   echo 'int main () { return 0; }' > conftest.$ac_ext
1046   ac_cv_exeext=
1047   if { (eval echo configure:1048: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
1048     for file in conftest.*; do
1049       case $file in
1050       *.c | *.o | *.obj) ;;
1051       *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
1052       esac
1053     done
1054   else
1055     { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; }
1056   fi
1057   rm -f conftest*
1058   test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
1059 fi
1060 fi
1061
1062 EXEEXT=""
1063 test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
1064 echo "$ac_t""${ac_cv_exeext}" 1>&6
1065 ac_exeext=$EXEEXT
1066
1067 echo $ac_n "checking for object suffix""... $ac_c" 1>&6
1068 echo "configure:1069: checking for object suffix" >&5
1069 if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then
1070   echo $ac_n "(cached) $ac_c" 1>&6
1071 else
1072   rm -f conftest*
1073 echo 'int i = 1;' > conftest.$ac_ext
1074 if { (eval echo configure:1075: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1075   for ac_file in conftest.*; do
1076     case $ac_file in
1077     *.c) ;;
1078     *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;;
1079     esac
1080   done
1081 else
1082   { echo "configure: error: installation or configuration problem; compiler does not work" 1>&2; exit 1; }
1083 fi
1084 rm -f conftest*
1085 fi
1086
1087 echo "$ac_t""$ac_cv_objext" 1>&6
1088 OBJEXT=$ac_cv_objext
1089 ac_objext=$ac_cv_objext
1090
1091
1092 echo $ac_n "checking if we must define _GNU_SOURCE""... $ac_c" 1>&6
1093 echo "configure:1094: checking if we must define _GNU_SOURCE" >&5
1094 if eval "test \"`echo '$''{'cf_cv_gnu_source'+set}'`\" = set"; then
1095   echo $ac_n "(cached) $ac_c" 1>&6
1096 else
1097   
1098 cat > conftest.$ac_ext <<EOF
1099 #line 1100 "configure"
1100 #include "confdefs.h"
1101 #include <sys/types.h>
1102 int main() {
1103
1104 #ifndef _XOPEN_SOURCE
1105 make an error
1106 #endif
1107 ; return 0; }
1108 EOF
1109 if { (eval echo configure:1110: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1110   rm -rf conftest*
1111   cf_cv_gnu_source=no
1112 else
1113   echo "configure: failed program was:" >&5
1114   cat conftest.$ac_ext >&5
1115   rm -rf conftest*
1116   cf_save="$CPPFLAGS"
1117          CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
1118          cat > conftest.$ac_ext <<EOF
1119 #line 1120 "configure"
1120 #include "confdefs.h"
1121 #include <sys/types.h>
1122 int main() {
1123
1124 #ifdef _XOPEN_SOURCE
1125 make an error
1126 #endif
1127 ; return 0; }
1128 EOF
1129 if { (eval echo configure:1130: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1130   rm -rf conftest*
1131   cf_cv_gnu_source=no
1132 else
1133   echo "configure: failed program was:" >&5
1134   cat conftest.$ac_ext >&5
1135   rm -rf conftest*
1136   cf_cv_gnu_source=yes
1137 fi
1138 rm -f conftest*
1139         CPPFLAGS="$cf_save"
1140         
1141 fi
1142 rm -f conftest*
1143
1144 fi
1145
1146 echo "$ac_t""$cf_cv_gnu_source" 1>&6
1147 test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
1148
1149
1150
1151 # Check whether --with-curses-dir or --without-curses-dir was given.
1152 if test "${with_curses_dir+set}" = set; then
1153   withval="$with_curses_dir"
1154   
1155 case ".$withval" in #(vi
1156 .\$\(*\)*|.\'*\'*) #(vi
1157   ;;
1158 ..|./*|.\\*) #(vi
1159   ;;
1160 .[a-zA-Z]:[\\/]*) #(vi OS/2 EMX
1161   ;;
1162 .\${*prefix}*) #(vi
1163   eval withval="$withval"
1164   case ".$withval" in #(vi
1165   .NONE/*)
1166     withval=`echo $withval | sed -e s%NONE%$ac_default_prefix%`
1167     ;;
1168   esac
1169   ;; #(vi
1170 .NONE/*)
1171   withval=`echo $withval | sed -e s%NONE%$ac_default_prefix%`
1172   ;;
1173 *)
1174   { echo "configure: error: expected a pathname, not \"$withval\"" 1>&2; exit 1; }
1175   ;;
1176 esac
1177
1178          cf_cv_curses_dir=$withval
1179 else
1180   cf_cv_curses_dir=no
1181 fi
1182
1183
1184
1185
1186 # Check whether --with-5lib or --without-5lib was given.
1187 if test "${with_5lib+set}" = set; then
1188   withval="$with_5lib"
1189   LIBS="-L/usr/5lib $LIBS"
1190          CPPFLAGS="$CPPFLAGS -I/usr/5include"
1191 fi
1192
1193
1194
1195 # Check whether --with-ncursesw or --without-ncursesw was given.
1196 if test "${with_ncursesw+set}" = set; then
1197   withval="$with_ncursesw"
1198   cf_cv_screen=ncursesw
1199 fi
1200
1201
1202
1203 # Check whether --with-ncurses or --without-ncurses was given.
1204 if test "${with_ncurses+set}" = set; then
1205   withval="$with_ncurses"
1206   cf_cv_screen=ncurses
1207 fi
1208
1209
1210 case $cf_cv_screen in
1211 curses)
1212         
1213
1214 echo $ac_n "checking for extra include directories""... $ac_c" 1>&6
1215 echo "configure:1216: checking for extra include directories" >&5
1216 if eval "test \"`echo '$''{'cf_cv_curses_incdir'+set}'`\" = set"; then
1217   echo $ac_n "(cached) $ac_c" 1>&6
1218 else
1219   
1220 cf_cv_curses_incdir=no
1221 case $host_os in #(vi
1222 hpux10.*|hpux11.*) #(vi
1223         test -d /usr/include/curses_colr && \
1224         cf_cv_curses_incdir="-I/usr/include/curses_colr"
1225         ;;
1226 sunos3*|sunos4*)
1227         test -d /usr/5lib && \
1228         test -d /usr/5include && \
1229         cf_cv_curses_incdir="-I/usr/5include"
1230         ;;
1231 esac
1232
1233 fi
1234
1235 echo "$ac_t""$cf_cv_curses_incdir" 1>&6
1236 test "$cf_cv_curses_incdir" != no && CPPFLAGS="$cf_cv_curses_incdir $CPPFLAGS"
1237
1238 echo $ac_n "checking if we have identified curses headers""... $ac_c" 1>&6
1239 echo "configure:1240: checking if we have identified curses headers" >&5
1240 if eval "test \"`echo '$''{'cf_cv_ncurses_header'+set}'`\" = set"; then
1241   echo $ac_n "(cached) $ac_c" 1>&6
1242 else
1243   
1244 cf_cv_ncurses_header=none
1245 for cf_header in \
1246         curses.h \
1247         ncurses.h \
1248         ncurses/curses.h \
1249         ncurses/ncurses.h
1250 do
1251 cat > conftest.$ac_ext <<EOF
1252 #line 1253 "configure"
1253 #include "confdefs.h"
1254 #include <${cf_header}>
1255 int main() {
1256 initscr(); tgoto("?", 0,0)
1257 ; return 0; }
1258 EOF
1259 if { (eval echo configure:1260: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1260   rm -rf conftest*
1261   cf_cv_ncurses_header=$cf_header; break
1262 else
1263   echo "configure: failed program was:" >&5
1264   cat conftest.$ac_ext >&5
1265 fi
1266 rm -f conftest*
1267 done
1268
1269 fi
1270
1271 echo "$ac_t""$cf_cv_ncurses_header" 1>&6
1272
1273 if test "$cf_cv_ncurses_header" = none ; then
1274         { echo "configure: error: No curses header-files found" 1>&2; exit 1; }
1275 fi
1276
1277 # cheat, to get the right #define's for HAVE_NCURSES_H, etc.
1278 for ac_hdr in $cf_cv_ncurses_header
1279 do
1280 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
1281 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
1282 echo "configure:1283: checking for $ac_hdr" >&5
1283 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
1284   echo $ac_n "(cached) $ac_c" 1>&6
1285 else
1286   cat > conftest.$ac_ext <<EOF
1287 #line 1288 "configure"
1288 #include "confdefs.h"
1289 #include <$ac_hdr>
1290 EOF
1291 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
1292 { (eval echo configure:1293: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1293 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
1294 if test -z "$ac_err"; then
1295   rm -rf conftest*
1296   eval "ac_cv_header_$ac_safe=yes"
1297 else
1298   echo "$ac_err" >&5
1299   echo "configure: failed program was:" >&5
1300   cat conftest.$ac_ext >&5
1301   rm -rf conftest*
1302   eval "ac_cv_header_$ac_safe=no"
1303 fi
1304 rm -f conftest*
1305 fi
1306 if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
1307   echo "$ac_t""yes" 1>&6
1308     ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
1309   cat >> confdefs.h <<EOF
1310 #define $ac_tr_hdr 1
1311 EOF
1312  
1313 else
1314   echo "$ac_t""no" 1>&6
1315 fi
1316 done
1317
1318
1319
1320         
1321 echo $ac_n "checking for ncurses version""... $ac_c" 1>&6
1322 echo "configure:1323: checking for ncurses version" >&5
1323 if eval "test \"`echo '$''{'cf_cv_ncurses_version'+set}'`\" = set"; then
1324   echo $ac_n "(cached) $ac_c" 1>&6
1325 else
1326   
1327         cf_cv_ncurses_version=no
1328         cf_tempfile=out$$
1329         rm -f $cf_tempfile
1330         if test "$cross_compiling" = yes; then
1331   
1332
1333         # This will not work if the preprocessor splits the line after the
1334         # Autoconf token.  The 'unproto' program does that.
1335         cat > conftest.$ac_ext <<EOF
1336 #include <${cf_cv_ncurses_header-curses.h}>
1337 #undef Autoconf
1338 #ifdef NCURSES_VERSION
1339 Autoconf NCURSES_VERSION
1340 #else
1341 #ifdef __NCURSES_H
1342 Autoconf "old"
1343 #endif
1344 ;
1345 #endif
1346 EOF
1347         cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out"
1348         { (eval echo configure:1349: \"$cf_try\") 1>&5; (eval $cf_try) 2>&5; }
1349         if test -f conftest.out ; then
1350                 cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'`
1351                 test -n "$cf_out" && cf_cv_ncurses_version="$cf_out"
1352                 rm -f conftest.out
1353         fi
1354
1355 else
1356   cat > conftest.$ac_ext <<EOF
1357 #line 1358 "configure"
1358 #include "confdefs.h"
1359
1360 #include <${cf_cv_ncurses_header-curses.h}>
1361 #include <stdio.h>
1362 int main()
1363 {
1364         FILE *fp = fopen("$cf_tempfile", "w");
1365 #ifdef NCURSES_VERSION
1366 # ifdef NCURSES_VERSION_PATCH
1367         fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH);
1368 # else
1369         fprintf(fp, "%s\n", NCURSES_VERSION);
1370 # endif
1371 #else
1372 # ifdef __NCURSES_H
1373         fprintf(fp, "old\n");
1374 # else
1375         make an error
1376 # endif
1377 #endif
1378         exit(0);
1379 }
1380 EOF
1381 if { (eval echo configure:1382: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
1382 then
1383   
1384         cf_cv_ncurses_version=`cat $cf_tempfile`
1385 else
1386   echo "configure: failed program was:" >&5
1387   cat conftest.$ac_ext >&5
1388 fi
1389 rm -fr conftest*
1390 fi
1391
1392         rm -f $cf_tempfile
1393
1394 fi
1395
1396 echo "$ac_t""$cf_cv_ncurses_version" 1>&6
1397 test "$cf_cv_ncurses_version" = no || cat >> confdefs.h <<\EOF
1398 #define NCURSES 1
1399 EOF
1400
1401
1402         
1403
1404 echo $ac_n "checking if we have identified curses libraries""... $ac_c" 1>&6
1405 echo "configure:1406: checking if we have identified curses libraries" >&5
1406 cat > conftest.$ac_ext <<EOF
1407 #line 1408 "configure"
1408 #include "confdefs.h"
1409 #include <${cf_cv_ncurses_header-curses.h}>
1410 int main() {
1411 initscr(); tgoto("?", 0,0)
1412 ; return 0; }
1413 EOF
1414 if { (eval echo configure:1415: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1415   rm -rf conftest*
1416   cf_result=yes
1417 else
1418   echo "configure: failed program was:" >&5
1419   cat conftest.$ac_ext >&5
1420   rm -rf conftest*
1421   cf_result=no
1422 fi
1423 rm -f conftest*
1424 echo "$ac_t""$cf_result" 1>&6
1425
1426 if test "$cf_result" = no ; then
1427 case $host_os in #(vi
1428 freebsd*) #(vi
1429         echo $ac_n "checking for tgoto in -lmytinfo""... $ac_c" 1>&6
1430 echo "configure:1431: checking for tgoto in -lmytinfo" >&5
1431 ac_lib_var=`echo mytinfo'_'tgoto | sed 'y%./+-%__p_%'`
1432 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
1433   echo $ac_n "(cached) $ac_c" 1>&6
1434 else
1435   ac_save_LIBS="$LIBS"
1436 LIBS="-lmytinfo  $LIBS"
1437 cat > conftest.$ac_ext <<EOF
1438 #line 1439 "configure"
1439 #include "confdefs.h"
1440 /* Override any gcc2 internal prototype to avoid an error.  */
1441 /* We use char because int might match the return type of a gcc2
1442     builtin and then its argument prototype would still apply.  */
1443 char tgoto();
1444
1445 int main() {
1446 tgoto()
1447 ; return 0; }
1448 EOF
1449 if { (eval echo configure:1450: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1450   rm -rf conftest*
1451   eval "ac_cv_lib_$ac_lib_var=yes"
1452 else
1453   echo "configure: failed program was:" >&5
1454   cat conftest.$ac_ext >&5
1455   rm -rf conftest*
1456   eval "ac_cv_lib_$ac_lib_var=no"
1457 fi
1458 rm -f conftest*
1459 LIBS="$ac_save_LIBS"
1460
1461 fi
1462 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
1463   echo "$ac_t""yes" 1>&6
1464   LIBS="-lmytinfo $LIBS"
1465 else
1466   echo "$ac_t""no" 1>&6
1467 fi
1468
1469         ;;
1470 hpux10.*|hpux11.*) #(vi
1471         echo $ac_n "checking for initscr in -lcur_colr""... $ac_c" 1>&6
1472 echo "configure:1473: checking for initscr in -lcur_colr" >&5
1473 ac_lib_var=`echo cur_colr'_'initscr | sed 'y%./+-%__p_%'`
1474 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
1475   echo $ac_n "(cached) $ac_c" 1>&6
1476 else
1477   ac_save_LIBS="$LIBS"
1478 LIBS="-lcur_colr  $LIBS"
1479 cat > conftest.$ac_ext <<EOF
1480 #line 1481 "configure"
1481 #include "confdefs.h"
1482 /* Override any gcc2 internal prototype to avoid an error.  */
1483 /* We use char because int might match the return type of a gcc2
1484     builtin and then its argument prototype would still apply.  */
1485 char initscr();
1486
1487 int main() {
1488 initscr()
1489 ; return 0; }
1490 EOF
1491 if { (eval echo configure:1492: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1492   rm -rf conftest*
1493   eval "ac_cv_lib_$ac_lib_var=yes"
1494 else
1495   echo "configure: failed program was:" >&5
1496   cat conftest.$ac_ext >&5
1497   rm -rf conftest*
1498   eval "ac_cv_lib_$ac_lib_var=no"
1499 fi
1500 rm -f conftest*
1501 LIBS="$ac_save_LIBS"
1502
1503 fi
1504 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
1505   echo "$ac_t""yes" 1>&6
1506   
1507                 LIBS="-lcur_colr $LIBS"
1508                 ac_cv_func_initscr=yes
1509                 
1510 else
1511   echo "$ac_t""no" 1>&6
1512
1513         echo $ac_n "checking for initscr in -lHcurses""... $ac_c" 1>&6
1514 echo "configure:1515: checking for initscr in -lHcurses" >&5
1515 ac_lib_var=`echo Hcurses'_'initscr | sed 'y%./+-%__p_%'`
1516 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
1517   echo $ac_n "(cached) $ac_c" 1>&6
1518 else
1519   ac_save_LIBS="$LIBS"
1520 LIBS="-lHcurses  $LIBS"
1521 cat > conftest.$ac_ext <<EOF
1522 #line 1523 "configure"
1523 #include "confdefs.h"
1524 /* Override any gcc2 internal prototype to avoid an error.  */
1525 /* We use char because int might match the return type of a gcc2
1526     builtin and then its argument prototype would still apply.  */
1527 char initscr();
1528
1529 int main() {
1530 initscr()
1531 ; return 0; }
1532 EOF
1533 if { (eval echo configure:1534: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1534   rm -rf conftest*
1535   eval "ac_cv_lib_$ac_lib_var=yes"
1536 else
1537   echo "configure: failed program was:" >&5
1538   cat conftest.$ac_ext >&5
1539   rm -rf conftest*
1540   eval "ac_cv_lib_$ac_lib_var=no"
1541 fi
1542 rm -f conftest*
1543 LIBS="$ac_save_LIBS"
1544
1545 fi
1546 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
1547   echo "$ac_t""yes" 1>&6
1548   
1549                 # HP's header uses __HP_CURSES, but user claims _HP_CURSES.
1550                 LIBS="-lHcurses $LIBS"
1551                 CPPFLAGS="-D__HP_CURSES -D_HP_CURSES $CPPFLAGS"
1552                 ac_cv_func_initscr=yes
1553                 
1554 else
1555   echo "$ac_t""no" 1>&6
1556 fi
1557
1558 fi
1559
1560         ;;
1561 linux*) # Suse Linux does not follow /usr/lib convention
1562         LIBS="$LIBS -L/lib"
1563         ;;
1564 sunos3*|sunos4*)
1565         test -d /usr/5lib && \
1566         LIBS="$LIBS -L/usr/5lib -lcurses -ltermcap"
1567         ac_cv_func_initscr=yes
1568         ;;
1569 esac
1570
1571 if test ".$ac_cv_func_initscr" != .yes ; then
1572         cf_save_LIBS="$LIBS"
1573         cf_term_lib=""
1574         cf_curs_lib=""
1575
1576         if test ".${cf_cv_ncurses_version-no}" != .no
1577         then
1578                 cf_check_list="ncurses curses cursesX"
1579         else
1580                 cf_check_list="cursesX curses ncurses"
1581         fi
1582
1583         # Check for library containing tgoto.  Do this before curses library
1584         # because it may be needed to link the test-case for initscr.
1585         echo $ac_n "checking for tgoto""... $ac_c" 1>&6
1586 echo "configure:1587: checking for tgoto" >&5
1587 if eval "test \"`echo '$''{'ac_cv_func_tgoto'+set}'`\" = set"; then
1588   echo $ac_n "(cached) $ac_c" 1>&6
1589 else
1590   cat > conftest.$ac_ext <<EOF
1591 #line 1592 "configure"
1592 #include "confdefs.h"
1593 /* System header to define __stub macros and hopefully few prototypes,
1594     which can conflict with char tgoto(); below.  */
1595 #include <assert.h>
1596 /* Override any gcc2 internal prototype to avoid an error.  */
1597 /* We use char because int might match the return type of a gcc2
1598     builtin and then its argument prototype would still apply.  */
1599 char tgoto();
1600
1601 int main() {
1602
1603 /* The GNU C library defines this for functions which it implements
1604     to always fail with ENOSYS.  Some functions are actually named
1605     something starting with __ and the normal name is an alias.  */
1606 #if defined (__stub_tgoto) || defined (__stub___tgoto)
1607 choke me
1608 #else
1609 tgoto();
1610 #endif
1611
1612 ; return 0; }
1613 EOF
1614 if { (eval echo configure:1615: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1615   rm -rf conftest*
1616   eval "ac_cv_func_tgoto=yes"
1617 else
1618   echo "configure: failed program was:" >&5
1619   cat conftest.$ac_ext >&5
1620   rm -rf conftest*
1621   eval "ac_cv_func_tgoto=no"
1622 fi
1623 rm -f conftest*
1624 fi
1625
1626 if eval "test \"`echo '$ac_cv_func_'tgoto`\" = yes"; then
1627   echo "$ac_t""yes" 1>&6
1628   cf_term_lib=predefined
1629 else
1630   echo "$ac_t""no" 1>&6
1631
1632                 for cf_term_lib in $cf_check_list termcap termlib unknown
1633                 do
1634                         echo $ac_n "checking for tgoto in -l$cf_term_lib""... $ac_c" 1>&6
1635 echo "configure:1636: checking for tgoto in -l$cf_term_lib" >&5
1636 ac_lib_var=`echo $cf_term_lib'_'tgoto | sed 'y%./+-%__p_%'`
1637 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
1638   echo $ac_n "(cached) $ac_c" 1>&6
1639 else
1640   ac_save_LIBS="$LIBS"
1641 LIBS="-l$cf_term_lib  $LIBS"
1642 cat > conftest.$ac_ext <<EOF
1643 #line 1644 "configure"
1644 #include "confdefs.h"
1645 /* Override any gcc2 internal prototype to avoid an error.  */
1646 /* We use char because int might match the return type of a gcc2
1647     builtin and then its argument prototype would still apply.  */
1648 char tgoto();
1649
1650 int main() {
1651 tgoto()
1652 ; return 0; }
1653 EOF
1654 if { (eval echo configure:1655: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1655   rm -rf conftest*
1656   eval "ac_cv_lib_$ac_lib_var=yes"
1657 else
1658   echo "configure: failed program was:" >&5
1659   cat conftest.$ac_ext >&5
1660   rm -rf conftest*
1661   eval "ac_cv_lib_$ac_lib_var=no"
1662 fi
1663 rm -f conftest*
1664 LIBS="$ac_save_LIBS"
1665
1666 fi
1667 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
1668   echo "$ac_t""yes" 1>&6
1669   break
1670 else
1671   echo "$ac_t""no" 1>&6
1672 fi
1673
1674                 done
1675         
1676 fi
1677
1678
1679         # Check for library containing initscr
1680         test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS"
1681         for cf_curs_lib in $cf_check_list xcurses jcurses unknown
1682         do
1683                 echo $ac_n "checking for initscr in -l$cf_curs_lib""... $ac_c" 1>&6
1684 echo "configure:1685: checking for initscr in -l$cf_curs_lib" >&5
1685 ac_lib_var=`echo $cf_curs_lib'_'initscr | sed 'y%./+-%__p_%'`
1686 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
1687   echo $ac_n "(cached) $ac_c" 1>&6
1688 else
1689   ac_save_LIBS="$LIBS"
1690 LIBS="-l$cf_curs_lib  $LIBS"
1691 cat > conftest.$ac_ext <<EOF
1692 #line 1693 "configure"
1693 #include "confdefs.h"
1694 /* Override any gcc2 internal prototype to avoid an error.  */
1695 /* We use char because int might match the return type of a gcc2
1696     builtin and then its argument prototype would still apply.  */
1697 char initscr();
1698
1699 int main() {
1700 initscr()
1701 ; return 0; }
1702 EOF
1703 if { (eval echo configure:1704: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1704   rm -rf conftest*
1705   eval "ac_cv_lib_$ac_lib_var=yes"
1706 else
1707   echo "configure: failed program was:" >&5
1708   cat conftest.$ac_ext >&5
1709   rm -rf conftest*
1710   eval "ac_cv_lib_$ac_lib_var=no"
1711 fi
1712 rm -f conftest*
1713 LIBS="$ac_save_LIBS"
1714
1715 fi
1716 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
1717   echo "$ac_t""yes" 1>&6
1718   break
1719 else
1720   echo "$ac_t""no" 1>&6
1721 fi
1722
1723         done
1724         test $cf_curs_lib = unknown && { echo "configure: error: no curses library found" 1>&2; exit 1; }
1725
1726         LIBS="-l$cf_curs_lib $cf_save_LIBS"
1727         if test "$cf_term_lib" = unknown ; then
1728                 echo $ac_n "checking if we can link with $cf_curs_lib library""... $ac_c" 1>&6
1729 echo "configure:1730: checking if we can link with $cf_curs_lib library" >&5
1730                 cat > conftest.$ac_ext <<EOF
1731 #line 1732 "configure"
1732 #include "confdefs.h"
1733 #include <${cf_cv_ncurses_header-curses.h}>
1734 int main() {
1735 initscr()
1736 ; return 0; }
1737 EOF
1738 if { (eval echo configure:1739: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1739   rm -rf conftest*
1740   cf_result=yes
1741 else
1742   echo "configure: failed program was:" >&5
1743   cat conftest.$ac_ext >&5
1744   rm -rf conftest*
1745   cf_result=no
1746 fi
1747 rm -f conftest*
1748                 echo "$ac_t""$cf_result" 1>&6
1749                 test $cf_result = no && { echo "configure: error: Cannot link curses library" 1>&2; exit 1; }
1750         elif test "$cf_curs_lib" = "$cf_term_lib" ; then
1751                 :
1752         elif test "$cf_term_lib" != predefined ; then
1753                 echo $ac_n "checking if we need both $cf_curs_lib and $cf_term_lib libraries""... $ac_c" 1>&6
1754 echo "configure:1755: checking if we need both $cf_curs_lib and $cf_term_lib libraries" >&5
1755                 cat > conftest.$ac_ext <<EOF
1756 #line 1757 "configure"
1757 #include "confdefs.h"
1758 #include <${cf_cv_ncurses_header-curses.h}>
1759 int main() {
1760 initscr(); tgoto((char *)0, 0, 0);
1761 ; return 0; }
1762 EOF
1763 if { (eval echo configure:1764: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1764   rm -rf conftest*
1765   cf_result=no
1766 else
1767   echo "configure: failed program was:" >&5
1768   cat conftest.$ac_ext >&5
1769   rm -rf conftest*
1770   
1771                         LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS"
1772                         cat > conftest.$ac_ext <<EOF
1773 #line 1774 "configure"
1774 #include "confdefs.h"
1775 #include <${cf_cv_ncurses_header-curses.h}>
1776 int main() {
1777 initscr()
1778 ; return 0; }
1779 EOF
1780 if { (eval echo configure:1781: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1781   rm -rf conftest*
1782   cf_result=yes
1783 else
1784   echo "configure: failed program was:" >&5
1785   cat conftest.$ac_ext >&5
1786   rm -rf conftest*
1787   cf_result=error
1788 fi
1789 rm -f conftest*
1790                         
1791 fi
1792 rm -f conftest*
1793                 echo "$ac_t""$cf_result" 1>&6
1794         fi
1795 fi
1796 fi
1797
1798
1799         ;;
1800 ncurses)
1801         
1802
1803 cf_ncuhdr_root=ncurses
1804
1805 test -n "$cf_cv_curses_dir" && \
1806 test "$cf_cv_curses_dir" != "no" && \
1807 CPPFLAGS="-I$cf_cv_curses_dir/include -I$cf_cv_curses_dir/include/$cf_ncuhdr_root $CPPFLAGS"
1808
1809 echo $ac_n "checking for $cf_ncuhdr_root header in include-path""... $ac_c" 1>&6
1810 echo "configure:1811: checking for $cf_ncuhdr_root header in include-path" >&5
1811 if eval "test \"`echo '$''{'cf_cv_ncurses_h'+set}'`\" = set"; then
1812   echo $ac_n "(cached) $ac_c" 1>&6
1813 else
1814   
1815         cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h"
1816         ( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h"
1817         for cf_header in $cf_header_list
1818         do
1819                 
1820         cat > conftest.$ac_ext <<EOF
1821 #line 1822 "configure"
1822 #include "confdefs.h"
1823
1824
1825 #include <$cf_header>
1826 int main() {
1827
1828 #ifdef NCURSES_VERSION
1829
1830 printf("%s\n", NCURSES_VERSION);
1831 #else
1832 #ifdef __NCURSES_H
1833 printf("old\n");
1834 #else
1835         make an error
1836 #endif
1837 #endif
1838         
1839         
1840 ; return 0; }
1841 EOF
1842 if { (eval echo configure:1843: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1843   rm -rf conftest*
1844   cf_cv_ncurses_h=$cf_header
1845         
1846 else
1847   echo "configure: failed program was:" >&5
1848   cat conftest.$ac_ext >&5
1849   rm -rf conftest*
1850   cf_cv_ncurses_h=no
1851 fi
1852 rm -f conftest*
1853
1854                 test "$cf_cv_ncurses_h" != no && break
1855         done
1856
1857 fi
1858
1859 echo "$ac_t""$cf_cv_ncurses_h" 1>&6
1860
1861 if test "$cf_cv_ncurses_h" != no ; then
1862         cf_cv_ncurses_header=$cf_cv_ncurses_h
1863 else
1864 echo $ac_n "checking for $cf_ncuhdr_root include-path""... $ac_c" 1>&6
1865 echo "configure:1866: checking for $cf_ncuhdr_root include-path" >&5
1866 if eval "test \"`echo '$''{'cf_cv_ncurses_h2'+set}'`\" = set"; then
1867   echo $ac_n "(cached) $ac_c" 1>&6
1868 else
1869   
1870         test -n "$verbose" && echo
1871         cf_search=""
1872
1873 test -d $HOME && {
1874         test -n "$verbose" && echo "    ... testing include-directories under $HOME"
1875         test -d $HOME/include &&          cf_search="$cf_search $HOME/include"
1876         test -d $HOME/include/$cf_ncuhdr_root &&       cf_search="$cf_search $HOME/include/$cf_ncuhdr_root"
1877         test -d $HOME/include/$cf_ncuhdr_root/include &&    cf_search="$cf_search $HOME/include/$cf_ncuhdr_root/include"
1878 }
1879
1880 # For other stuff under the home directory, it should be sufficient to put
1881 # a symbolic link for $HOME/$cf_ncuhdr_root to the actual package location:
1882 test -d $HOME/$cf_ncuhdr_root && {
1883         test -n "$verbose" && echo "    ... testing include-directories under $HOME/$cf_ncuhdr_root"
1884         test -d $HOME/$cf_ncuhdr_root/include &&       cf_search="$cf_search $HOME/$cf_ncuhdr_root/include"
1885         test -d $HOME/$cf_ncuhdr_root/include/$cf_ncuhdr_root &&    cf_search="$cf_search $HOME/$cf_ncuhdr_root/include/$cf_ncuhdr_root"
1886 }
1887
1888 test "$prefix" != /usr/local && \
1889 test -d /usr/local && {
1890         test -n "$verbose" && echo "    ... testing include-directories under /usr/local"
1891         test -d /usr/local/include &&       cf_search="$cf_search /usr/local/include"
1892         test -d /usr/local/include/$cf_ncuhdr_root &&    cf_search="$cf_search /usr/local/include/$cf_ncuhdr_root"
1893         test -d /usr/local/include/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/local/include/$cf_ncuhdr_root/include"
1894         test -d /usr/local/$cf_ncuhdr_root/include &&    cf_search="$cf_search /usr/local/$cf_ncuhdr_root/include"
1895         test -d /usr/local/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/local/$cf_ncuhdr_root/include/$cf_ncuhdr_root"
1896 }
1897
1898 test "$prefix" != NONE && \
1899 test -d $prefix && {
1900         test -n "$verbose" && echo "    ... testing include-directories under $prefix"
1901         test -d $prefix/include &&          cf_search="$cf_search $prefix/include"
1902         test -d $prefix/include/$cf_ncuhdr_root &&       cf_search="$cf_search $prefix/include/$cf_ncuhdr_root"
1903         test -d $prefix/include/$cf_ncuhdr_root/include &&    cf_search="$cf_search $prefix/include/$cf_ncuhdr_root/include"
1904         test -d $prefix/$cf_ncuhdr_root/include &&       cf_search="$cf_search $prefix/$cf_ncuhdr_root/include"
1905         test -d $prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root &&    cf_search="$cf_search $prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root"
1906 }
1907
1908 test "$prefix" != /opt && \
1909 test -d /opt && {
1910         test -n "$verbose" && echo "    ... testing include-directories under /opt"
1911         test -d /opt/include &&             cf_search="$cf_search /opt/include"
1912         test -d /opt/include/$cf_ncuhdr_root &&          cf_search="$cf_search /opt/include/$cf_ncuhdr_root"
1913         test -d /opt/include/$cf_ncuhdr_root/include &&       cf_search="$cf_search /opt/include/$cf_ncuhdr_root/include"
1914         test -d /opt/$cf_ncuhdr_root/include &&          cf_search="$cf_search /opt/$cf_ncuhdr_root/include"
1915         test -d /opt/$cf_ncuhdr_root/include/$cf_ncuhdr_root &&       cf_search="$cf_search /opt/$cf_ncuhdr_root/include/$cf_ncuhdr_root"
1916 }
1917
1918 test "$prefix" != /usr && \
1919 test -d /usr && {
1920         test -n "$verbose" && echo "    ... testing include-directories under /usr"
1921         test -d /usr/include &&             cf_search="$cf_search /usr/include"
1922         test -d /usr/include/$cf_ncuhdr_root &&          cf_search="$cf_search /usr/include/$cf_ncuhdr_root"
1923         test -d /usr/include/$cf_ncuhdr_root/include &&       cf_search="$cf_search /usr/include/$cf_ncuhdr_root/include"
1924         test -d /usr/$cf_ncuhdr_root/include &&          cf_search="$cf_search /usr/$cf_ncuhdr_root/include"
1925 }
1926
1927 test "$includedir" != NONE && \
1928 test "$includedir" != "/usr/include" && \
1929 test -d "$includedir" && {
1930         test -d $includedir &&    cf_search="$cf_search $includedir"
1931         test -d $includedir/$cf_ncuhdr_root && cf_search="$cf_search $includedir/$cf_ncuhdr_root"
1932 }
1933
1934 test "$oldincludedir" != NONE && \
1935 test "$oldincludedir" != "/usr/include" && \
1936 test -d "$oldincludedir" && {
1937         test -d $oldincludedir    && cf_search="$cf_search $oldincludedir"
1938         test -d $oldincludedir/$cf_ncuhdr_root && cf_search="$cf_search $oldincludedir/$cf_ncuhdr_root"
1939 }
1940
1941
1942         test -n "$verbose" && echo search path $cf_search
1943         cf_save2_CPPFLAGS="$CPPFLAGS"
1944         for cf_incdir in $cf_search
1945         do
1946                 
1947 for cf_add_incdir in $cf_incdir
1948 do
1949         while true
1950         do
1951                 case $cf_add_incdir in
1952                 /usr/include) # (vi
1953                         ;;
1954                 /usr/local/include) # (vi
1955                         if test "$GCC" = yes
1956                         then
1957                                 cf_save_CPPFLAGS="$CPPFLAGS"
1958                                 CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
1959                                 cat > conftest.$ac_ext <<EOF
1960 #line 1961 "configure"
1961 #include "confdefs.h"
1962 #include <stdio.h>
1963 int main() {
1964 printf("Hello")
1965 ; return 0; }
1966 EOF
1967 if { (eval echo configure:1968: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
1968   :
1969 else
1970   echo "configure: failed program was:" >&5
1971   cat conftest.$ac_ext >&5
1972   rm -rf conftest*
1973   CPPFLAGS="$cf_save_CPPFLAGS"
1974 fi
1975 rm -f conftest*
1976                         fi
1977                         ;;
1978                 *) # (vi
1979                         CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
1980                         ;;
1981                 esac
1982                 cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'`
1983                 test "$cf_top_incdir" = "$cf_add_incdir" && break
1984                 cf_add_incdir="$cf_top_incdir"
1985         done
1986 done
1987
1988                 for cf_header in \
1989                         ncurses.h \
1990                         curses.h
1991                 do
1992                         
1993         cat > conftest.$ac_ext <<EOF
1994 #line 1995 "configure"
1995 #include "confdefs.h"
1996
1997
1998 #include <$cf_header>
1999 int main() {
2000
2001 #ifdef NCURSES_VERSION
2002
2003 printf("%s\n", NCURSES_VERSION);
2004 #else
2005 #ifdef __NCURSES_H
2006 printf("old\n");
2007 #else
2008         make an error
2009 #endif
2010 #endif
2011         
2012         
2013 ; return 0; }
2014 EOF
2015 if { (eval echo configure:2016: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
2016   rm -rf conftest*
2017   cf_cv_ncurses_h2=$cf_header
2018         
2019 else
2020   echo "configure: failed program was:" >&5
2021   cat conftest.$ac_ext >&5
2022   rm -rf conftest*
2023   cf_cv_ncurses_h2=no
2024 fi
2025 rm -f conftest*
2026
2027                         if test "$cf_cv_ncurses_h2" != no ; then
2028                                 cf_cv_ncurses_h2=$cf_incdir/$cf_header
2029                                 test -n "$verbose" && echo $ac_n "      ... found $ac_c" 1>&6
2030                                 break
2031                         fi
2032                         test -n "$verbose" && echo "    ... tested $cf_incdir/$cf_header" 1>&6
2033                 done
2034                 CPPFLAGS="$cf_save2_CPPFLAGS"
2035                 test "$cf_cv_ncurses_h2" != no && break
2036         done
2037         test "$cf_cv_ncurses_h2" = no && { echo "configure: error: not found" 1>&2; exit 1; }
2038         
2039 fi
2040
2041 echo "$ac_t""$cf_cv_ncurses_h2" 1>&6
2042
2043         cf_1st_incdir=`echo $cf_cv_ncurses_h2 | sed -e 's%/[^/]*$%%'`
2044         cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2`
2045         if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then
2046                 cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header
2047         fi
2048         
2049 for cf_add_incdir in $cf_1st_incdir
2050 do
2051         while true
2052         do
2053                 case $cf_add_incdir in
2054                 /usr/include) # (vi
2055                         ;;
2056                 /usr/local/include) # (vi
2057                         if test "$GCC" = yes
2058                         then
2059                                 cf_save_CPPFLAGS="$CPPFLAGS"
2060                                 CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
2061                                 cat > conftest.$ac_ext <<EOF
2062 #line 2063 "configure"
2063 #include "confdefs.h"
2064 #include <stdio.h>
2065 int main() {
2066 printf("Hello")
2067 ; return 0; }
2068 EOF
2069 if { (eval echo configure:2070: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
2070   :
2071 else
2072   echo "configure: failed program was:" >&5
2073   cat conftest.$ac_ext >&5
2074   rm -rf conftest*
2075   CPPFLAGS="$cf_save_CPPFLAGS"
2076 fi
2077 rm -f conftest*
2078                         fi
2079                         ;;
2080                 *) # (vi
2081                         CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
2082                         ;;
2083                 esac
2084                 cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'`
2085                 test "$cf_top_incdir" = "$cf_add_incdir" && break
2086                 cf_add_incdir="$cf_top_incdir"
2087         done
2088 done
2089
2090
2091 fi
2092
2093 cat >> confdefs.h <<\EOF
2094 #define NCURSES 1
2095 EOF
2096
2097
2098 case $cf_cv_ncurses_header in # (vi
2099 *ncurses.h)
2100         cat >> confdefs.h <<\EOF
2101 #define HAVE_NCURSES_H 1
2102 EOF
2103
2104         ;;
2105 esac
2106
2107 case $cf_cv_ncurses_header in # (vi
2108 ncurses/curses.h|ncurses/ncurses.h)
2109         cat >> confdefs.h <<\EOF
2110 #define HAVE_NCURSES_NCURSES_H 1
2111 EOF
2112
2113         ;;
2114 ncursesw/curses.h|ncursesw/ncurses.h)
2115         cat >> confdefs.h <<\EOF
2116 #define HAVE_NCURSESW_NCURSES_H 1
2117 EOF
2118
2119         ;;
2120 esac
2121
2122
2123 echo $ac_n "checking for ncurses version""... $ac_c" 1>&6
2124 echo "configure:2125: checking for ncurses version" >&5
2125 if eval "test \"`echo '$''{'cf_cv_ncurses_version'+set}'`\" = set"; then
2126   echo $ac_n "(cached) $ac_c" 1>&6
2127 else
2128   
2129         cf_cv_ncurses_version=no
2130         cf_tempfile=out$$
2131         rm -f $cf_tempfile
2132         if test "$cross_compiling" = yes; then
2133   
2134
2135         # This will not work if the preprocessor splits the line after the
2136         # Autoconf token.  The 'unproto' program does that.
2137         cat > conftest.$ac_ext <<EOF
2138 #include <${cf_cv_ncurses_header-curses.h}>
2139 #undef Autoconf
2140 #ifdef NCURSES_VERSION
2141 Autoconf NCURSES_VERSION
2142 #else
2143 #ifdef __NCURSES_H
2144 Autoconf "old"
2145 #endif
2146 ;
2147 #endif
2148 EOF
2149         cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out"
2150         { (eval echo configure:2151: \"$cf_try\") 1>&5; (eval $cf_try) 2>&5; }
2151         if test -f conftest.out ; then
2152                 cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'`
2153                 test -n "$cf_out" && cf_cv_ncurses_version="$cf_out"
2154                 rm -f conftest.out
2155         fi
2156
2157 else
2158   cat > conftest.$ac_ext <<EOF
2159 #line 2160 "configure"
2160 #include "confdefs.h"
2161
2162 #include <${cf_cv_ncurses_header-curses.h}>
2163 #include <stdio.h>
2164 int main()
2165 {
2166         FILE *fp = fopen("$cf_tempfile", "w");
2167 #ifdef NCURSES_VERSION
2168 # ifdef NCURSES_VERSION_PATCH
2169         fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH);
2170 # else
2171         fprintf(fp, "%s\n", NCURSES_VERSION);
2172 # endif
2173 #else
2174 # ifdef __NCURSES_H
2175         fprintf(fp, "old\n");
2176 # else
2177         make an error
2178 # endif
2179 #endif
2180         exit(0);
2181 }
2182 EOF
2183 if { (eval echo configure:2184: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
2184 then
2185   
2186         cf_cv_ncurses_version=`cat $cf_tempfile`
2187 else
2188   echo "configure: failed program was:" >&5
2189   cat conftest.$ac_ext >&5
2190 fi
2191 rm -fr conftest*
2192 fi
2193
2194         rm -f $cf_tempfile
2195
2196 fi
2197
2198 echo "$ac_t""$cf_cv_ncurses_version" 1>&6
2199 test "$cf_cv_ncurses_version" = no || cat >> confdefs.h <<\EOF
2200 #define NCURSES 1
2201 EOF
2202
2203
2204
2205         
2206
2207 cf_nculib_root=ncurses
2208         # This works, except for the special case where we find gpm, but
2209         # ncurses is in a nonstandard location via $LIBS, and we really want
2210         # to link gpm.
2211 cf_ncurses_LIBS=""
2212 cf_ncurses_SAVE="$LIBS"
2213 echo $ac_n "checking for Gpm_Open in -lgpm""... $ac_c" 1>&6
2214 echo "configure:2215: checking for Gpm_Open in -lgpm" >&5
2215 ac_lib_var=`echo gpm'_'Gpm_Open | sed 'y%./+-%__p_%'`
2216 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
2217   echo $ac_n "(cached) $ac_c" 1>&6
2218 else
2219   ac_save_LIBS="$LIBS"
2220 LIBS="-lgpm  $LIBS"
2221 cat > conftest.$ac_ext <<EOF
2222 #line 2223 "configure"
2223 #include "confdefs.h"
2224 /* Override any gcc2 internal prototype to avoid an error.  */
2225 /* We use char because int might match the return type of a gcc2
2226     builtin and then its argument prototype would still apply.  */
2227 char Gpm_Open();
2228
2229 int main() {
2230 Gpm_Open()
2231 ; return 0; }
2232 EOF
2233 if { (eval echo configure:2234: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
2234   rm -rf conftest*
2235   eval "ac_cv_lib_$ac_lib_var=yes"
2236 else
2237   echo "configure: failed program was:" >&5
2238   cat conftest.$ac_ext >&5
2239   rm -rf conftest*
2240   eval "ac_cv_lib_$ac_lib_var=no"
2241 fi
2242 rm -f conftest*
2243 LIBS="$ac_save_LIBS"
2244
2245 fi
2246 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
2247   echo "$ac_t""yes" 1>&6
2248   echo $ac_n "checking for initscr in -lgpm""... $ac_c" 1>&6
2249 echo "configure:2250: checking for initscr in -lgpm" >&5
2250 ac_lib_var=`echo gpm'_'initscr | sed 'y%./+-%__p_%'`
2251 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
2252   echo $ac_n "(cached) $ac_c" 1>&6
2253 else
2254   ac_save_LIBS="$LIBS"
2255 LIBS="-lgpm  $LIBS"
2256 cat > conftest.$ac_ext <<EOF
2257 #line 2258 "configure"
2258 #include "confdefs.h"
2259 /* Override any gcc2 internal prototype to avoid an error.  */
2260 /* We use char because int might match the return type of a gcc2
2261     builtin and then its argument prototype would still apply.  */
2262 char initscr();
2263
2264 int main() {
2265 initscr()
2266 ; return 0; }
2267 EOF
2268 if { (eval echo configure:2269: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
2269   rm -rf conftest*
2270   eval "ac_cv_lib_$ac_lib_var=yes"
2271 else
2272   echo "configure: failed program was:" >&5
2273   cat conftest.$ac_ext >&5
2274   rm -rf conftest*
2275   eval "ac_cv_lib_$ac_lib_var=no"
2276 fi
2277 rm -f conftest*
2278 LIBS="$ac_save_LIBS"
2279
2280 fi
2281 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
2282   echo "$ac_t""yes" 1>&6
2283   LIBS="$cf_ncurses_SAVE"
2284 else
2285   echo "$ac_t""no" 1>&6
2286 cf_ncurses_LIBS="-lgpm"
2287 fi
2288
2289 else
2290   echo "$ac_t""no" 1>&6
2291 fi
2292
2293
2294 case $host_os in #(vi
2295 freebsd*)
2296         # This is only necessary if you are linking against an obsolete
2297         # version of ncurses (but it should do no harm, since it's static).
2298         echo $ac_n "checking for tgoto in -lmytinfo""... $ac_c" 1>&6
2299 echo "configure:2300: checking for tgoto in -lmytinfo" >&5
2300 ac_lib_var=`echo mytinfo'_'tgoto | sed 'y%./+-%__p_%'`
2301 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
2302   echo $ac_n "(cached) $ac_c" 1>&6
2303 else
2304   ac_save_LIBS="$LIBS"
2305 LIBS="-lmytinfo  $LIBS"
2306 cat > conftest.$ac_ext <<EOF
2307 #line 2308 "configure"
2308 #include "confdefs.h"
2309 /* Override any gcc2 internal prototype to avoid an error.  */
2310 /* We use char because int might match the return type of a gcc2
2311     builtin and then its argument prototype would still apply.  */
2312 char tgoto();
2313
2314 int main() {
2315 tgoto()
2316 ; return 0; }
2317 EOF
2318 if { (eval echo configure:2319: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
2319   rm -rf conftest*
2320   eval "ac_cv_lib_$ac_lib_var=yes"
2321 else
2322   echo "configure: failed program was:" >&5
2323   cat conftest.$ac_ext >&5
2324   rm -rf conftest*
2325   eval "ac_cv_lib_$ac_lib_var=no"
2326 fi
2327 rm -f conftest*
2328 LIBS="$ac_save_LIBS"
2329
2330 fi
2331 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
2332   echo "$ac_t""yes" 1>&6
2333   cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"
2334 else
2335   echo "$ac_t""no" 1>&6
2336 fi
2337
2338         ;;
2339 esac
2340
2341 LIBS="$cf_ncurses_LIBS $LIBS"
2342
2343 if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
2344 then
2345         LIBS="-L$cf_cv_curses_dir/lib -l$cf_nculib_root $LIBS"
2346 else
2347         
2348         eval 'cf_cv_have_lib_'$cf_nculib_root'=no'
2349         cf_libdir=""
2350         echo $ac_n "checking for initscr""... $ac_c" 1>&6
2351 echo "configure:2352: checking for initscr" >&5
2352 if eval "test \"`echo '$''{'ac_cv_func_initscr'+set}'`\" = set"; then
2353   echo $ac_n "(cached) $ac_c" 1>&6
2354 else
2355   cat > conftest.$ac_ext <<EOF
2356 #line 2357 "configure"
2357 #include "confdefs.h"
2358 /* System header to define __stub macros and hopefully few prototypes,
2359     which can conflict with char initscr(); below.  */
2360 #include <assert.h>
2361 /* Override any gcc2 internal prototype to avoid an error.  */
2362 /* We use char because int might match the return type of a gcc2
2363     builtin and then its argument prototype would still apply.  */
2364 char initscr();
2365
2366 int main() {
2367
2368 /* The GNU C library defines this for functions which it implements
2369     to always fail with ENOSYS.  Some functions are actually named
2370     something starting with __ and the normal name is an alias.  */
2371 #if defined (__stub_initscr) || defined (__stub___initscr)
2372 choke me
2373 #else
2374 initscr();
2375 #endif
2376
2377 ; return 0; }
2378 EOF
2379 if { (eval echo configure:2380: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
2380   rm -rf conftest*
2381   eval "ac_cv_func_initscr=yes"
2382 else
2383   echo "configure: failed program was:" >&5
2384   cat conftest.$ac_ext >&5
2385   rm -rf conftest*
2386   eval "ac_cv_func_initscr=no"
2387 fi
2388 rm -f conftest*
2389 fi
2390
2391 if eval "test \"`echo '$ac_cv_func_'initscr`\" = yes"; then
2392   echo "$ac_t""yes" 1>&6
2393   eval 'cf_cv_have_lib_'$cf_nculib_root'=yes'
2394 else
2395   echo "$ac_t""no" 1>&6
2396
2397                 cf_save_LIBS="$LIBS"
2398                 echo $ac_n "checking for initscr in -l$cf_nculib_root""... $ac_c" 1>&6
2399 echo "configure:2400: checking for initscr in -l$cf_nculib_root" >&5
2400                 LIBS="-l$cf_nculib_root $LIBS"
2401                 cat > conftest.$ac_ext <<EOF
2402 #line 2403 "configure"
2403 #include "confdefs.h"
2404 #include <${cf_cv_ncurses_header-curses.h}>
2405 int main() {
2406 initscr()
2407 ; return 0; }
2408 EOF
2409 if { (eval echo configure:2410: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
2410   rm -rf conftest*
2411   echo "$ac_t""yes" 1>&6
2412                          eval 'cf_cv_have_lib_'$cf_nculib_root'=yes'
2413                         
2414 else
2415   echo "configure: failed program was:" >&5
2416   cat conftest.$ac_ext >&5
2417   rm -rf conftest*
2418   echo "$ac_t""no" 1>&6
2419                         cf_search=""
2420
2421 test -d $HOME && {
2422         test -n "$verbose" && echo "    ... testing lib-directories under $HOME"
2423         test -d $HOME/lib &&          cf_search="$cf_search $HOME/lib"
2424         test -d $HOME/lib/$cf_nculib_root &&       cf_search="$cf_search $HOME/lib/$cf_nculib_root"
2425         test -d $HOME/lib/$cf_nculib_root/lib &&    cf_search="$cf_search $HOME/lib/$cf_nculib_root/lib"
2426 }
2427
2428 # For other stuff under the home directory, it should be sufficient to put
2429 # a symbolic link for $HOME/$cf_nculib_root to the actual package location:
2430 test -d $HOME/$cf_nculib_root && {
2431         test -n "$verbose" && echo "    ... testing lib-directories under $HOME/$cf_nculib_root"
2432         test -d $HOME/$cf_nculib_root/lib &&       cf_search="$cf_search $HOME/$cf_nculib_root/lib"
2433         test -d $HOME/$cf_nculib_root/lib/$cf_nculib_root &&    cf_search="$cf_search $HOME/$cf_nculib_root/lib/$cf_nculib_root"
2434 }
2435
2436 test "$prefix" != /usr/local && \
2437 test -d /usr/local && {
2438         test -n "$verbose" && echo "    ... testing lib-directories under /usr/local"
2439         test -d /usr/local/lib &&       cf_search="$cf_search /usr/local/lib"
2440         test -d /usr/local/lib/$cf_nculib_root &&    cf_search="$cf_search /usr/local/lib/$cf_nculib_root"
2441         test -d /usr/local/lib/$cf_nculib_root/lib && cf_search="$cf_search /usr/local/lib/$cf_nculib_root/lib"
2442         test -d /usr/local/$cf_nculib_root/lib &&    cf_search="$cf_search /usr/local/$cf_nculib_root/lib"
2443         test -d /usr/local/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search /usr/local/$cf_nculib_root/lib/$cf_nculib_root"
2444 }
2445
2446 test "$prefix" != NONE && \
2447 test -d $prefix && {
2448         test -n "$verbose" && echo "    ... testing lib-directories under $prefix"
2449         test -d $prefix/lib &&          cf_search="$cf_search $prefix/lib"
2450         test -d $prefix/lib/$cf_nculib_root &&       cf_search="$cf_search $prefix/lib/$cf_nculib_root"
2451         test -d $prefix/lib/$cf_nculib_root/lib &&    cf_search="$cf_search $prefix/lib/$cf_nculib_root/lib"
2452         test -d $prefix/$cf_nculib_root/lib &&       cf_search="$cf_search $prefix/$cf_nculib_root/lib"
2453         test -d $prefix/$cf_nculib_root/lib/$cf_nculib_root &&    cf_search="$cf_search $prefix/$cf_nculib_root/lib/$cf_nculib_root"
2454 }
2455
2456 test "$prefix" != /opt && \
2457 test -d /opt && {
2458         test -n "$verbose" && echo "    ... testing lib-directories under /opt"
2459         test -d /opt/lib &&             cf_search="$cf_search /opt/lib"
2460         test -d /opt/lib/$cf_nculib_root &&          cf_search="$cf_search /opt/lib/$cf_nculib_root"
2461         test -d /opt/lib/$cf_nculib_root/lib &&       cf_search="$cf_search /opt/lib/$cf_nculib_root/lib"
2462         test -d /opt/$cf_nculib_root/lib &&          cf_search="$cf_search /opt/$cf_nculib_root/lib"
2463         test -d /opt/$cf_nculib_root/lib/$cf_nculib_root &&       cf_search="$cf_search /opt/$cf_nculib_root/lib/$cf_nculib_root"
2464 }
2465
2466 test "$prefix" != /usr && \
2467 test -d /usr && {
2468         test -n "$verbose" && echo "    ... testing lib-directories under /usr"
2469         test -d /usr/lib &&             cf_search="$cf_search /usr/lib"
2470         test -d /usr/lib/$cf_nculib_root &&          cf_search="$cf_search /usr/lib/$cf_nculib_root"
2471         test -d /usr/lib/$cf_nculib_root/lib &&       cf_search="$cf_search /usr/lib/$cf_nculib_root/lib"
2472         test -d /usr/$cf_nculib_root/lib &&          cf_search="$cf_search /usr/$cf_nculib_root/lib"
2473 }
2474
2475                         for cf_libdir in $cf_search
2476                         do
2477                                 echo $ac_n "checking for -l$cf_nculib_root in $cf_libdir""... $ac_c" 1>&6
2478 echo "configure:2479: checking for -l$cf_nculib_root in $cf_libdir" >&5
2479                                 LIBS="-L$cf_libdir -l$cf_nculib_root $cf_save_LIBS"
2480                                 cat > conftest.$ac_ext <<EOF
2481 #line 2482 "configure"
2482 #include "confdefs.h"
2483 #include <${cf_cv_ncurses_header-curses.h}>
2484 int main() {
2485 initscr()
2486 ; return 0; }
2487 EOF
2488 if { (eval echo configure:2489: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
2489   rm -rf conftest*
2490   echo "$ac_t""yes" 1>&6
2491                                          eval 'cf_cv_have_lib_'$cf_nculib_root'=yes'
2492                                          break
2493 else
2494   echo "configure: failed program was:" >&5
2495   cat conftest.$ac_ext >&5
2496   rm -rf conftest*
2497   echo "$ac_t""no" 1>&6
2498                                          LIBS="$cf_save_LIBS"
2499 fi
2500 rm -f conftest*
2501                         done
2502                         
2503 fi
2504 rm -f conftest*
2505                 
2506 fi
2507
2508 eval 'cf_found_library=$cf_cv_have_lib_'$cf_nculib_root
2509
2510 if test $cf_found_library = no ; then
2511         { echo "configure: error: Cannot link $cf_nculib_root library" 1>&2; exit 1; }
2512 fi
2513
2514
2515 fi
2516
2517 if test -n "$cf_ncurses_LIBS" ; then
2518         echo $ac_n "checking if we can link $cf_nculib_root without $cf_ncurses_LIBS""... $ac_c" 1>&6
2519 echo "configure:2520: checking if we can link $cf_nculib_root without $cf_ncurses_LIBS" >&5
2520         cf_ncurses_SAVE="$LIBS"
2521         for p in $cf_ncurses_LIBS ; do
2522                 q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"`
2523                 if test "$q" != "$LIBS" ; then
2524                         LIBS="$q"
2525                 fi
2526         done
2527         cat > conftest.$ac_ext <<EOF
2528 #line 2529 "configure"
2529 #include "confdefs.h"
2530 #include <${cf_cv_ncurses_header-curses.h}>
2531 int main() {
2532 initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);
2533 ; return 0; }
2534 EOF
2535 if { (eval echo configure:2536: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
2536   rm -rf conftest*
2537   echo "$ac_t""yes" 1>&6
2538 else
2539   echo "configure: failed program was:" >&5
2540   cat conftest.$ac_ext >&5
2541   rm -rf conftest*
2542   echo "$ac_t""no" 1>&6
2543                  LIBS="$cf_ncurses_SAVE"
2544 fi
2545 rm -f conftest*
2546 fi
2547
2548
2549 cf_nculib_ROOT=`echo "HAVE_LIB$cf_nculib_root" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
2550
2551 cat >> confdefs.h <<EOF
2552 #define $cf_nculib_ROOT 1
2553 EOF
2554
2555
2556         LIB_NAME=ncurses
2557         ;;
2558 ncursesw)
2559         cf_cv_libtype=w
2560         
2561 echo $ac_n "checking for multibyte character support""... $ac_c" 1>&6
2562 echo "configure:2563: checking for multibyte character support" >&5
2563 if eval "test \"`echo '$''{'cf_cv_utf8_lib'+set}'`\" = set"; then
2564   echo $ac_n "(cached) $ac_c" 1>&6
2565 else
2566   
2567         cf_save_LIBS="$LIBS"
2568         cat > conftest.$ac_ext <<EOF
2569 #line 2570 "configure"
2570 #include "confdefs.h"
2571
2572 #include <stdlib.h>
2573 int main() {
2574 putwc(0,0);
2575 ; return 0; }
2576 EOF
2577 if { (eval echo configure:2578: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
2578   rm -rf conftest*
2579   cf_cv_utf8_lib=yes
2580 else
2581   echo "configure: failed program was:" >&5
2582   cat conftest.$ac_ext >&5
2583   rm -rf conftest*
2584   LIBS="-lutf8 $LIBS"
2585          cat > conftest.$ac_ext <<EOF
2586 #line 2587 "configure"
2587 #include "confdefs.h"
2588
2589 #include <libutf8.h>
2590 int main() {
2591 putwc(0,0);
2592 ; return 0; }
2593 EOF
2594 if { (eval echo configure:2595: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
2595   rm -rf conftest*
2596   cf_cv_utf8_lib=add-on
2597 else
2598   echo "configure: failed program was:" >&5
2599   cat conftest.$ac_ext >&5
2600   rm -rf conftest*
2601   cf_cv_utf8_lib=no
2602 fi
2603 rm -f conftest*
2604         LIBS="$cf_save_LIBS"
2605
2606 fi
2607 rm -f conftest*
2608 fi
2609
2610 echo "$ac_t""$cf_cv_utf8_lib" 1>&6
2611
2612 # HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between
2613 # ncurses/ncursesw:
2614 if test "$cf_cv_utf8_lib" = "add-on" ; then
2615         cat >> confdefs.h <<\EOF
2616 #define HAVE_LIBUTF8_H 1
2617 EOF
2618
2619         LIBS="-lutf8 $LIBS"
2620 fi
2621
2622         
2623 echo $ac_n "checking if we must define _XOPEN_SOURCE""... $ac_c" 1>&6
2624 echo "configure:2625: checking if we must define _XOPEN_SOURCE" >&5
2625 cat > conftest.$ac_ext <<EOF
2626 #line 2627 "configure"
2627 #include "confdefs.h"
2628 #include <sys/types.h>
2629
2630 int main() {
2631
2632 #ifndef _XOPEN_SOURCE
2633 make an error
2634 #endif
2635 ; return 0; }
2636 EOF
2637 if { (eval echo configure:2638: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
2638   rm -rf conftest*
2639   cf_result=no
2640 else
2641   echo "configure: failed program was:" >&5
2642   cat conftest.$ac_ext >&5
2643   rm -rf conftest*
2644   cf_result=yes
2645 fi
2646 rm -f conftest*
2647 echo "$ac_t""$cf_result" 1>&6
2648
2649 if test "$cf_result" = yes ; then
2650         CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
2651 elif test "x500" != "x" ; then
2652         echo $ac_n "checking checking for compatible value versus 500""... $ac_c" 1>&6
2653 echo "configure:2654: checking checking for compatible value versus 500" >&5
2654         cat > conftest.$ac_ext <<EOF
2655 #line 2656 "configure"
2656 #include "confdefs.h"
2657 #include <sys/types.h>
2658
2659 int main() {
2660
2661 #if _XOPEN_SOURCE-500 < 0
2662 make an error
2663 #endif
2664 ; return 0; }
2665 EOF
2666 if { (eval echo configure:2667: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
2667   rm -rf conftest*
2668   cf_result=yes
2669 else
2670   echo "configure: failed program was:" >&5
2671   cat conftest.$ac_ext >&5
2672   rm -rf conftest*
2673   cf_result=no
2674 fi
2675 rm -f conftest*
2676         echo "$ac_t""$cf_result" 1>&6
2677         if test "$cf_result" = no ; then
2678                 # perhaps we can override it - try...
2679                 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
2680         fi
2681 fi
2682
2683         
2684 echo $ac_n "checking if we must define _XOPEN_SOURCE_EXTENDED""... $ac_c" 1>&6
2685 echo "configure:2686: checking if we must define _XOPEN_SOURCE_EXTENDED" >&5
2686 cat > conftest.$ac_ext <<EOF
2687 #line 2688 "configure"
2688 #include "confdefs.h"
2689 #include <sys/types.h>
2690
2691 int main() {
2692
2693 #ifndef _XOPEN_SOURCE_EXTENDED
2694 make an error
2695 #endif
2696 ; return 0; }
2697 EOF
2698 if { (eval echo configure:2699: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
2699   rm -rf conftest*
2700   cf_result=no
2701 else
2702   echo "configure: failed program was:" >&5
2703   cat conftest.$ac_ext >&5
2704   rm -rf conftest*
2705   cf_result=yes
2706 fi
2707 rm -f conftest*
2708 echo "$ac_t""$cf_result" 1>&6
2709
2710 if test "$cf_result" = yes ; then
2711         CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
2712 elif test "x" != "x" ; then
2713         echo $ac_n "checking checking for compatible value versus ""... $ac_c" 1>&6
2714 echo "configure:2715: checking checking for compatible value versus " >&5
2715         cat > conftest.$ac_ext <<EOF
2716 #line 2717 "configure"
2717 #include "confdefs.h"
2718 #include <sys/types.h>
2719
2720 int main() {
2721
2722 #if _XOPEN_SOURCE_EXTENDED- < 0
2723 make an error
2724 #endif
2725 ; return 0; }
2726 EOF
2727 if { (eval echo configure:2728: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
2728   rm -rf conftest*
2729   cf_result=yes
2730 else
2731   echo "configure: failed program was:" >&5
2732   cat conftest.$ac_ext >&5
2733   rm -rf conftest*
2734   cf_result=no
2735 fi
2736 rm -f conftest*
2737         echo "$ac_t""$cf_result" 1>&6
2738         if test "$cf_result" = no ; then
2739                 # perhaps we can override it - try...
2740                 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED="
2741         fi
2742 fi
2743
2744         
2745
2746 cf_ncuhdr_root=ncursesw
2747
2748 test -n "$cf_cv_curses_dir" && \
2749 test "$cf_cv_curses_dir" != "no" && \
2750 CPPFLAGS="-I$cf_cv_curses_dir/include -I$cf_cv_curses_dir/include/$cf_ncuhdr_root $CPPFLAGS"
2751
2752 echo $ac_n "checking for $cf_ncuhdr_root header in include-path""... $ac_c" 1>&6
2753 echo "configure:2754: checking for $cf_ncuhdr_root header in include-path" >&5
2754 if eval "test \"`echo '$''{'cf_cv_ncurses_h'+set}'`\" = set"; then
2755   echo $ac_n "(cached) $ac_c" 1>&6
2756 else
2757   
2758         cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h"
2759         ( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h"
2760         for cf_header in $cf_header_list
2761         do
2762                 
2763         cat > conftest.$ac_ext <<EOF
2764 #line 2765 "configure"
2765 #include "confdefs.h"
2766
2767
2768 #define _XOPEN_SOURCE_EXTENDED
2769 #undef  HAVE_LIBUTF8_H  /* in case we used CF_UTF8_LIB */
2770 #define HAVE_LIBUTF8_H  /* to force ncurses' header file to use cchar_t */
2771
2772 #include <$cf_header>
2773 int main() {
2774
2775 #ifdef NCURSES_VERSION
2776
2777 #ifndef WACS_BSSB
2778         make an error
2779 #endif
2780
2781 printf("%s\n", NCURSES_VERSION);
2782 #else
2783 #ifdef __NCURSES_H
2784 printf("old\n");
2785 #else
2786         make an error
2787 #endif
2788 #endif
2789         
2790         
2791 ; return 0; }
2792 EOF
2793 if { (eval echo configure:2794: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
2794   rm -rf conftest*
2795   cf_cv_ncurses_h=$cf_header
2796         
2797 else
2798   echo "configure: failed program was:" >&5
2799   cat conftest.$ac_ext >&5
2800   rm -rf conftest*
2801   cf_cv_ncurses_h=no
2802 fi
2803 rm -f conftest*
2804
2805                 test "$cf_cv_ncurses_h" != no && break
2806         done
2807
2808 fi
2809
2810 echo "$ac_t""$cf_cv_ncurses_h" 1>&6
2811
2812 if test "$cf_cv_ncurses_h" != no ; then
2813         cf_cv_ncurses_header=$cf_cv_ncurses_h
2814 else
2815 echo $ac_n "checking for $cf_ncuhdr_root include-path""... $ac_c" 1>&6
2816 echo "configure:2817: checking for $cf_ncuhdr_root include-path" >&5
2817 if eval "test \"`echo '$''{'cf_cv_ncurses_h2'+set}'`\" = set"; then
2818   echo $ac_n "(cached) $ac_c" 1>&6
2819 else
2820   
2821         test -n "$verbose" && echo
2822         cf_search=""
2823
2824 test -d $HOME && {
2825         test -n "$verbose" && echo "    ... testing include-directories under $HOME"
2826         test -d $HOME/include &&          cf_search="$cf_search $HOME/include"
2827         test -d $HOME/include/$cf_ncuhdr_root &&       cf_search="$cf_search $HOME/include/$cf_ncuhdr_root"
2828         test -d $HOME/include/$cf_ncuhdr_root/include &&    cf_search="$cf_search $HOME/include/$cf_ncuhdr_root/include"
2829 }
2830
2831 # For other stuff under the home directory, it should be sufficient to put
2832 # a symbolic link for $HOME/$cf_ncuhdr_root to the actual package location:
2833 test -d $HOME/$cf_ncuhdr_root && {
2834         test -n "$verbose" && echo "    ... testing include-directories under $HOME/$cf_ncuhdr_root"
2835         test -d $HOME/$cf_ncuhdr_root/include &&       cf_search="$cf_search $HOME/$cf_ncuhdr_root/include"
2836         test -d $HOME/$cf_ncuhdr_root/include/$cf_ncuhdr_root &&    cf_search="$cf_search $HOME/$cf_ncuhdr_root/include/$cf_ncuhdr_root"
2837 }
2838
2839 test "$prefix" != /usr/local && \
2840 test -d /usr/local && {
2841         test -n "$verbose" && echo "    ... testing include-directories under /usr/local"
2842         test -d /usr/local/include &&       cf_search="$cf_search /usr/local/include"
2843         test -d /usr/local/include/$cf_ncuhdr_root &&    cf_search="$cf_search /usr/local/include/$cf_ncuhdr_root"
2844         test -d /usr/local/include/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/local/include/$cf_ncuhdr_root/include"
2845         test -d /usr/local/$cf_ncuhdr_root/include &&    cf_search="$cf_search /usr/local/$cf_ncuhdr_root/include"
2846         test -d /usr/local/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/local/$cf_ncuhdr_root/include/$cf_ncuhdr_root"
2847 }
2848
2849 test "$prefix" != NONE && \
2850 test -d $prefix && {
2851         test -n "$verbose" && echo "    ... testing include-directories under $prefix"
2852         test -d $prefix/include &&          cf_search="$cf_search $prefix/include"
2853         test -d $prefix/include/$cf_ncuhdr_root &&       cf_search="$cf_search $prefix/include/$cf_ncuhdr_root"
2854         test -d $prefix/include/$cf_ncuhdr_root/include &&    cf_search="$cf_search $prefix/include/$cf_ncuhdr_root/include"
2855         test -d $prefix/$cf_ncuhdr_root/include &&       cf_search="$cf_search $prefix/$cf_ncuhdr_root/include"
2856         test -d $prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root &&    cf_search="$cf_search $prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root"
2857 }
2858
2859 test "$prefix" != /opt && \
2860 test -d /opt && {
2861         test -n "$verbose" && echo "    ... testing include-directories under /opt"
2862         test -d /opt/include &&             cf_search="$cf_search /opt/include"
2863         test -d /opt/include/$cf_ncuhdr_root &&          cf_search="$cf_search /opt/include/$cf_ncuhdr_root"
2864         test -d /opt/include/$cf_ncuhdr_root/include &&       cf_search="$cf_search /opt/include/$cf_ncuhdr_root/include"
2865         test -d /opt/$cf_ncuhdr_root/include &&          cf_search="$cf_search /opt/$cf_ncuhdr_root/include"
2866         test -d /opt/$cf_ncuhdr_root/include/$cf_ncuhdr_root &&       cf_search="$cf_search /opt/$cf_ncuhdr_root/include/$cf_ncuhdr_root"
2867 }
2868
2869 test "$prefix" != /usr && \
2870 test -d /usr && {
2871         test -n "$verbose" && echo "    ... testing include-directories under /usr"
2872         test -d /usr/include &&             cf_search="$cf_search /usr/include"
2873         test -d /usr/include/$cf_ncuhdr_root &&          cf_search="$cf_search /usr/include/$cf_ncuhdr_root"
2874         test -d /usr/include/$cf_ncuhdr_root/include &&       cf_search="$cf_search /usr/include/$cf_ncuhdr_root/include"
2875         test -d /usr/$cf_ncuhdr_root/include &&          cf_search="$cf_search /usr/$cf_ncuhdr_root/include"
2876 }
2877
2878 test "$includedir" != NONE && \
2879 test "$includedir" != "/usr/include" && \
2880 test -d "$includedir" && {
2881         test -d $includedir &&    cf_search="$cf_search $includedir"
2882         test -d $includedir/$cf_ncuhdr_root && cf_search="$cf_search $includedir/$cf_ncuhdr_root"
2883 }
2884
2885 test "$oldincludedir" != NONE && \
2886 test "$oldincludedir" != "/usr/include" && \
2887 test -d "$oldincludedir" && {
2888         test -d $oldincludedir    && cf_search="$cf_search $oldincludedir"
2889         test -d $oldincludedir/$cf_ncuhdr_root && cf_search="$cf_search $oldincludedir/$cf_ncuhdr_root"
2890 }
2891
2892
2893         test -n "$verbose" && echo search path $cf_search
2894         cf_save2_CPPFLAGS="$CPPFLAGS"
2895         for cf_incdir in $cf_search
2896         do
2897                 
2898 for cf_add_incdir in $cf_incdir
2899 do
2900         while true
2901         do
2902                 case $cf_add_incdir in
2903                 /usr/include) # (vi
2904                         ;;
2905                 /usr/local/include) # (vi
2906                         if test "$GCC" = yes
2907                         then
2908                                 cf_save_CPPFLAGS="$CPPFLAGS"
2909                                 CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
2910                                 cat > conftest.$ac_ext <<EOF
2911 #line 2912 "configure"
2912 #include "confdefs.h"
2913 #include <stdio.h>
2914 int main() {
2915 printf("Hello")
2916 ; return 0; }
2917 EOF
2918 if { (eval echo configure:2919: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
2919   :
2920 else
2921   echo "configure: failed program was:" >&5
2922   cat conftest.$ac_ext >&5
2923   rm -rf conftest*
2924   CPPFLAGS="$cf_save_CPPFLAGS"
2925 fi
2926 rm -f conftest*
2927                         fi
2928                         ;;
2929                 *) # (vi
2930                         CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
2931                         ;;
2932                 esac
2933                 cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'`
2934                 test "$cf_top_incdir" = "$cf_add_incdir" && break
2935                 cf_add_incdir="$cf_top_incdir"
2936         done
2937 done
2938
2939                 for cf_header in \
2940                         ncurses.h \
2941                         curses.h
2942                 do
2943                         
2944         cat > conftest.$ac_ext <<EOF
2945 #line 2946 "configure"
2946 #include "confdefs.h"
2947
2948
2949 #define _XOPEN_SOURCE_EXTENDED
2950 #undef  HAVE_LIBUTF8_H  /* in case we used CF_UTF8_LIB */
2951 #define HAVE_LIBUTF8_H  /* to force ncurses' header file to use cchar_t */
2952
2953 #include <$cf_header>
2954 int main() {
2955
2956 #ifdef NCURSES_VERSION
2957
2958 #ifndef WACS_BSSB
2959         make an error
2960 #endif
2961
2962 printf("%s\n", NCURSES_VERSION);
2963 #else
2964 #ifdef __NCURSES_H
2965 printf("old\n");
2966 #else
2967         make an error
2968 #endif
2969 #endif
2970         
2971         
2972 ; return 0; }
2973 EOF
2974 if { (eval echo configure:2975: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
2975   rm -rf conftest*
2976   cf_cv_ncurses_h2=$cf_header
2977         
2978 else
2979   echo "configure: failed program was:" >&5
2980   cat conftest.$ac_ext >&5
2981   rm -rf conftest*
2982   cf_cv_ncurses_h2=no
2983 fi
2984 rm -f conftest*
2985
2986                         if test "$cf_cv_ncurses_h2" != no ; then
2987                                 cf_cv_ncurses_h2=$cf_incdir/$cf_header
2988                                 test -n "$verbose" && echo $ac_n "      ... found $ac_c" 1>&6
2989                                 break
2990                         fi
2991                         test -n "$verbose" && echo "    ... tested $cf_incdir/$cf_header" 1>&6
2992                 done
2993                 CPPFLAGS="$cf_save2_CPPFLAGS"
2994                 test "$cf_cv_ncurses_h2" != no && break
2995         done
2996         test "$cf_cv_ncurses_h2" = no && { echo "configure: error: not found" 1>&2; exit 1; }
2997         
2998 fi
2999
3000 echo "$ac_t""$cf_cv_ncurses_h2" 1>&6
3001
3002         cf_1st_incdir=`echo $cf_cv_ncurses_h2 | sed -e 's%/[^/]*$%%'`
3003         cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2`
3004         if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then
3005                 cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header
3006         fi
3007         
3008 for cf_add_incdir in $cf_1st_incdir
3009 do
3010         while true
3011         do
3012                 case $cf_add_incdir in
3013                 /usr/include) # (vi
3014                         ;;
3015                 /usr/local/include) # (vi
3016                         if test "$GCC" = yes
3017                         then
3018                                 cf_save_CPPFLAGS="$CPPFLAGS"
3019                                 CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
3020                                 cat > conftest.$ac_ext <<EOF
3021 #line 3022 "configure"
3022 #include "confdefs.h"
3023 #include <stdio.h>
3024 int main() {
3025 printf("Hello")
3026 ; return 0; }
3027 EOF
3028 if { (eval echo configure:3029: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
3029   :
3030 else
3031   echo "configure: failed program was:" >&5
3032   cat conftest.$ac_ext >&5
3033   rm -rf conftest*
3034   CPPFLAGS="$cf_save_CPPFLAGS"
3035 fi
3036 rm -f conftest*
3037                         fi
3038                         ;;
3039                 *) # (vi
3040                         CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
3041                         ;;
3042                 esac
3043                 cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'`
3044                 test "$cf_top_incdir" = "$cf_add_incdir" && break
3045                 cf_add_incdir="$cf_top_incdir"
3046         done
3047 done
3048
3049
3050 fi
3051
3052 cat >> confdefs.h <<\EOF
3053 #define NCURSES 1
3054 EOF
3055
3056
3057 case $cf_cv_ncurses_header in # (vi
3058 *ncurses.h)
3059         cat >> confdefs.h <<\EOF
3060 #define HAVE_NCURSES_H 1
3061 EOF
3062
3063         ;;
3064 esac
3065
3066 case $cf_cv_ncurses_header in # (vi
3067 ncurses/curses.h|ncurses/ncurses.h)
3068         cat >> confdefs.h <<\EOF
3069 #define HAVE_NCURSES_NCURSES_H 1
3070 EOF
3071
3072         ;;
3073 ncursesw/curses.h|ncursesw/ncurses.h)
3074         cat >> confdefs.h <<\EOF
3075 #define HAVE_NCURSESW_NCURSES_H 1
3076 EOF
3077
3078         ;;
3079 esac
3080
3081
3082 echo $ac_n "checking for ncurses version""... $ac_c" 1>&6
3083 echo "configure:3084: checking for ncurses version" >&5
3084 if eval "test \"`echo '$''{'cf_cv_ncurses_version'+set}'`\" = set"; then
3085   echo $ac_n "(cached) $ac_c" 1>&6
3086 else
3087   
3088         cf_cv_ncurses_version=no
3089         cf_tempfile=out$$
3090         rm -f $cf_tempfile
3091         if test "$cross_compiling" = yes; then
3092   
3093
3094         # This will not work if the preprocessor splits the line after the
3095         # Autoconf token.  The 'unproto' program does that.
3096         cat > conftest.$ac_ext <<EOF
3097 #include <${cf_cv_ncurses_header-curses.h}>
3098 #undef Autoconf
3099 #ifdef NCURSES_VERSION
3100 Autoconf NCURSES_VERSION
3101 #else
3102 #ifdef __NCURSES_H
3103 Autoconf "old"
3104 #endif
3105 ;
3106 #endif
3107 EOF
3108         cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out"
3109         { (eval echo configure:3110: \"$cf_try\") 1>&5; (eval $cf_try) 2>&5; }
3110         if test -f conftest.out ; then
3111                 cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'`
3112                 test -n "$cf_out" && cf_cv_ncurses_version="$cf_out"
3113                 rm -f conftest.out
3114         fi
3115
3116 else
3117   cat > conftest.$ac_ext <<EOF
3118 #line 3119 "configure"
3119 #include "confdefs.h"
3120
3121 #include <${cf_cv_ncurses_header-curses.h}>
3122 #include <stdio.h>
3123 int main()
3124 {
3125         FILE *fp = fopen("$cf_tempfile", "w");
3126 #ifdef NCURSES_VERSION
3127 # ifdef NCURSES_VERSION_PATCH
3128         fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH);
3129 # else
3130         fprintf(fp, "%s\n", NCURSES_VERSION);
3131 # endif
3132 #else
3133 # ifdef __NCURSES_H
3134         fprintf(fp, "old\n");
3135 # else
3136         make an error
3137 # endif
3138 #endif
3139         exit(0);
3140 }
3141 EOF
3142 if { (eval echo configure:3143: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
3143 then
3144   
3145         cf_cv_ncurses_version=`cat $cf_tempfile`
3146 else
3147   echo "configure: failed program was:" >&5
3148   cat conftest.$ac_ext >&5
3149 fi
3150 rm -fr conftest*
3151 fi
3152
3153         rm -f $cf_tempfile
3154
3155 fi
3156
3157 echo "$ac_t""$cf_cv_ncurses_version" 1>&6
3158 test "$cf_cv_ncurses_version" = no || cat >> confdefs.h <<\EOF
3159 #define NCURSES 1
3160 EOF
3161
3162
3163
3164         
3165
3166 cf_nculib_root=ncursesw
3167         # This works, except for the special case where we find gpm, but
3168         # ncurses is in a nonstandard location via $LIBS, and we really want
3169         # to link gpm.
3170 cf_ncurses_LIBS=""
3171 cf_ncurses_SAVE="$LIBS"
3172 echo $ac_n "checking for Gpm_Open in -lgpm""... $ac_c" 1>&6
3173 echo "configure:3174: checking for Gpm_Open in -lgpm" >&5
3174 ac_lib_var=`echo gpm'_'Gpm_Open | sed 'y%./+-%__p_%'`
3175 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
3176   echo $ac_n "(cached) $ac_c" 1>&6
3177 else
3178   ac_save_LIBS="$LIBS"
3179 LIBS="-lgpm  $LIBS"
3180 cat > conftest.$ac_ext <<EOF
3181 #line 3182 "configure"
3182 #include "confdefs.h"
3183 /* Override any gcc2 internal prototype to avoid an error.  */
3184 /* We use char because int might match the return type of a gcc2
3185     builtin and then its argument prototype would still apply.  */
3186 char Gpm_Open();
3187
3188 int main() {
3189 Gpm_Open()
3190 ; return 0; }
3191 EOF
3192 if { (eval echo configure:3193: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
3193   rm -rf conftest*
3194   eval "ac_cv_lib_$ac_lib_var=yes"
3195 else
3196   echo "configure: failed program was:" >&5
3197   cat conftest.$ac_ext >&5
3198   rm -rf conftest*
3199   eval "ac_cv_lib_$ac_lib_var=no"
3200 fi
3201 rm -f conftest*
3202 LIBS="$ac_save_LIBS"
3203
3204 fi
3205 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
3206   echo "$ac_t""yes" 1>&6
3207   echo $ac_n "checking for initscr in -lgpm""... $ac_c" 1>&6
3208 echo "configure:3209: checking for initscr in -lgpm" >&5
3209 ac_lib_var=`echo gpm'_'initscr | sed 'y%./+-%__p_%'`
3210 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
3211   echo $ac_n "(cached) $ac_c" 1>&6
3212 else
3213   ac_save_LIBS="$LIBS"
3214 LIBS="-lgpm  $LIBS"
3215 cat > conftest.$ac_ext <<EOF
3216 #line 3217 "configure"
3217 #include "confdefs.h"
3218 /* Override any gcc2 internal prototype to avoid an error.  */
3219 /* We use char because int might match the return type of a gcc2
3220     builtin and then its argument prototype would still apply.  */
3221 char initscr();
3222
3223 int main() {
3224 initscr()
3225 ; return 0; }
3226 EOF
3227 if { (eval echo configure:3228: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
3228   rm -rf conftest*
3229   eval "ac_cv_lib_$ac_lib_var=yes"
3230 else
3231   echo "configure: failed program was:" >&5
3232   cat conftest.$ac_ext >&5
3233   rm -rf conftest*
3234   eval "ac_cv_lib_$ac_lib_var=no"
3235 fi
3236 rm -f conftest*
3237 LIBS="$ac_save_LIBS"
3238
3239 fi
3240 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
3241   echo "$ac_t""yes" 1>&6
3242   LIBS="$cf_ncurses_SAVE"
3243 else
3244   echo "$ac_t""no" 1>&6
3245 cf_ncurses_LIBS="-lgpm"
3246 fi
3247
3248 else
3249   echo "$ac_t""no" 1>&6
3250 fi
3251
3252
3253 case $host_os in #(vi
3254 freebsd*)
3255         # This is only necessary if you are linking against an obsolete
3256         # version of ncurses (but it should do no harm, since it's static).
3257         echo $ac_n "checking for tgoto in -lmytinfo""... $ac_c" 1>&6
3258 echo "configure:3259: checking for tgoto in -lmytinfo" >&5
3259 ac_lib_var=`echo mytinfo'_'tgoto | sed 'y%./+-%__p_%'`
3260 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
3261   echo $ac_n "(cached) $ac_c" 1>&6
3262 else
3263   ac_save_LIBS="$LIBS"
3264 LIBS="-lmytinfo  $LIBS"
3265 cat > conftest.$ac_ext <<EOF
3266 #line 3267 "configure"
3267 #include "confdefs.h"
3268 /* Override any gcc2 internal prototype to avoid an error.  */
3269 /* We use char because int might match the return type of a gcc2
3270     builtin and then its argument prototype would still apply.  */
3271 char tgoto();
3272
3273 int main() {
3274 tgoto()
3275 ; return 0; }
3276 EOF
3277 if { (eval echo configure:3278: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
3278   rm -rf conftest*
3279   eval "ac_cv_lib_$ac_lib_var=yes"
3280 else
3281   echo "configure: failed program was:" >&5
3282   cat conftest.$ac_ext >&5
3283   rm -rf conftest*
3284   eval "ac_cv_lib_$ac_lib_var=no"
3285 fi
3286 rm -f conftest*
3287 LIBS="$ac_save_LIBS"
3288
3289 fi
3290 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
3291   echo "$ac_t""yes" 1>&6
3292   cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"
3293 else
3294   echo "$ac_t""no" 1>&6
3295 fi
3296
3297         ;;
3298 esac
3299
3300 LIBS="$cf_ncurses_LIBS $LIBS"
3301
3302 if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
3303 then
3304         LIBS="-L$cf_cv_curses_dir/lib -l$cf_nculib_root $LIBS"
3305 else
3306         
3307         eval 'cf_cv_have_lib_'$cf_nculib_root'=no'
3308         cf_libdir=""
3309         echo $ac_n "checking for initscr""... $ac_c" 1>&6
3310 echo "configure:3311: checking for initscr" >&5
3311 if eval "test \"`echo '$''{'ac_cv_func_initscr'+set}'`\" = set"; then
3312   echo $ac_n "(cached) $ac_c" 1>&6
3313 else
3314   cat > conftest.$ac_ext <<EOF
3315 #line 3316 "configure"
3316 #include "confdefs.h"
3317 /* System header to define __stub macros and hopefully few prototypes,
3318     which can conflict with char initscr(); below.  */
3319 #include <assert.h>
3320 /* Override any gcc2 internal prototype to avoid an error.  */
3321 /* We use char because int might match the return type of a gcc2
3322     builtin and then its argument prototype would still apply.  */
3323 char initscr();
3324
3325 int main() {
3326
3327 /* The GNU C library defines this for functions which it implements
3328     to always fail with ENOSYS.  Some functions are actually named
3329     something starting with __ and the normal name is an alias.  */
3330 #if defined (__stub_initscr) || defined (__stub___initscr)
3331 choke me
3332 #else
3333 initscr();
3334 #endif
3335
3336 ; return 0; }
3337 EOF
3338 if { (eval echo configure:3339: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
3339   rm -rf conftest*
3340   eval "ac_cv_func_initscr=yes"
3341 else
3342   echo "configure: failed program was:" >&5
3343   cat conftest.$ac_ext >&5
3344   rm -rf conftest*
3345   eval "ac_cv_func_initscr=no"
3346 fi
3347 rm -f conftest*
3348 fi
3349
3350 if eval "test \"`echo '$ac_cv_func_'initscr`\" = yes"; then
3351   echo "$ac_t""yes" 1>&6
3352   eval 'cf_cv_have_lib_'$cf_nculib_root'=yes'
3353 else
3354   echo "$ac_t""no" 1>&6
3355
3356                 cf_save_LIBS="$LIBS"
3357                 echo $ac_n "checking for initscr in -l$cf_nculib_root""... $ac_c" 1>&6
3358 echo "configure:3359: checking for initscr in -l$cf_nculib_root" >&5
3359                 LIBS="-l$cf_nculib_root $LIBS"
3360                 cat > conftest.$ac_ext <<EOF
3361 #line 3362 "configure"
3362 #include "confdefs.h"
3363 #include <${cf_cv_ncurses_header-curses.h}>
3364 int main() {
3365 initscr()
3366 ; return 0; }
3367 EOF
3368 if { (eval echo configure:3369: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
3369   rm -rf conftest*
3370   echo "$ac_t""yes" 1>&6
3371                          eval 'cf_cv_have_lib_'$cf_nculib_root'=yes'
3372                         
3373 else
3374   echo "configure: failed program was:" >&5
3375   cat conftest.$ac_ext >&5
3376   rm -rf conftest*
3377   echo "$ac_t""no" 1>&6
3378                         cf_search=""
3379
3380 test -d $HOME && {
3381         test -n "$verbose" && echo "    ... testing lib-directories under $HOME"
3382         test -d $HOME/lib &&          cf_search="$cf_search $HOME/lib"
3383         test -d $HOME/lib/$cf_nculib_root &&       cf_search="$cf_search $HOME/lib/$cf_nculib_root"
3384         test -d $HOME/lib/$cf_nculib_root/lib &&    cf_search="$cf_search $HOME/lib/$cf_nculib_root/lib"
3385 }
3386
3387 # For other stuff under the home directory, it should be sufficient to put
3388 # a symbolic link for $HOME/$cf_nculib_root to the actual package location:
3389 test -d $HOME/$cf_nculib_root && {
3390         test -n "$verbose" && echo "    ... testing lib-directories under $HOME/$cf_nculib_root"
3391         test -d $HOME/$cf_nculib_root/lib &&       cf_search="$cf_search $HOME/$cf_nculib_root/lib"
3392         test -d $HOME/$cf_nculib_root/lib/$cf_nculib_root &&    cf_search="$cf_search $HOME/$cf_nculib_root/lib/$cf_nculib_root"
3393 }
3394
3395 test "$prefix" != /usr/local && \
3396 test -d /usr/local && {
3397         test -n "$verbose" && echo "    ... testing lib-directories under /usr/local"
3398         test -d /usr/local/lib &&       cf_search="$cf_search /usr/local/lib"
3399         test -d /usr/local/lib/$cf_nculib_root &&    cf_search="$cf_search /usr/local/lib/$cf_nculib_root"
3400         test -d /usr/local/lib/$cf_nculib_root/lib && cf_search="$cf_search /usr/local/lib/$cf_nculib_root/lib"
3401         test -d /usr/local/$cf_nculib_root/lib &&    cf_search="$cf_search /usr/local/$cf_nculib_root/lib"
3402         test -d /usr/local/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search /usr/local/$cf_nculib_root/lib/$cf_nculib_root"
3403 }
3404
3405 test "$prefix" != NONE && \
3406 test -d $prefix && {
3407         test -n "$verbose" && echo "    ... testing lib-directories under $prefix"
3408         test -d $prefix/lib &&          cf_search="$cf_search $prefix/lib"
3409         test -d $prefix/lib/$cf_nculib_root &&       cf_search="$cf_search $prefix/lib/$cf_nculib_root"
3410         test -d $prefix/lib/$cf_nculib_root/lib &&    cf_search="$cf_search $prefix/lib/$cf_nculib_root/lib"
3411         test -d $prefix/$cf_nculib_root/lib &&       cf_search="$cf_search $prefix/$cf_nculib_root/lib"
3412         test -d $prefix/$cf_nculib_root/lib/$cf_nculib_root &&    cf_search="$cf_search $prefix/$cf_nculib_root/lib/$cf_nculib_root"
3413 }
3414
3415 test "$prefix" != /opt && \
3416 test -d /opt && {
3417         test -n "$verbose" && echo "    ... testing lib-directories under /opt"
3418         test -d /opt/lib &&             cf_search="$cf_search /opt/lib"
3419         test -d /opt/lib/$cf_nculib_root &&          cf_search="$cf_search /opt/lib/$cf_nculib_root"
3420         test -d /opt/lib/$cf_nculib_root/lib &&       cf_search="$cf_search /opt/lib/$cf_nculib_root/lib"
3421         test -d /opt/$cf_nculib_root/lib &&          cf_search="$cf_search /opt/$cf_nculib_root/lib"
3422         test -d /opt/$cf_nculib_root/lib/$cf_nculib_root &&       cf_search="$cf_search /opt/$cf_nculib_root/lib/$cf_nculib_root"
3423 }
3424
3425 test "$prefix" != /usr && \
3426 test -d /usr && {
3427         test -n "$verbose" && echo "    ... testing lib-directories under /usr"
3428         test -d /usr/lib &&             cf_search="$cf_search /usr/lib"
3429         test -d /usr/lib/$cf_nculib_root &&          cf_search="$cf_search /usr/lib/$cf_nculib_root"
3430         test -d /usr/lib/$cf_nculib_root/lib &&       cf_search="$cf_search /usr/lib/$cf_nculib_root/lib"
3431         test -d /usr/$cf_nculib_root/lib &&          cf_search="$cf_search /usr/$cf_nculib_root/lib"
3432 }
3433
3434                         for cf_libdir in $cf_search
3435                         do
3436                                 echo $ac_n "checking for -l$cf_nculib_root in $cf_libdir""... $ac_c" 1>&6
3437 echo "configure:3438: checking for -l$cf_nculib_root in $cf_libdir" >&5
3438                                 LIBS="-L$cf_libdir -l$cf_nculib_root $cf_save_LIBS"
3439                                 cat > conftest.$ac_ext <<EOF
3440 #line 3441 "configure"
3441 #include "confdefs.h"
3442 #include <${cf_cv_ncurses_header-curses.h}>
3443 int main() {
3444 initscr()
3445 ; return 0; }
3446 EOF
3447 if { (eval echo configure:3448: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
3448   rm -rf conftest*
3449   echo "$ac_t""yes" 1>&6
3450                                          eval 'cf_cv_have_lib_'$cf_nculib_root'=yes'
3451                                          break
3452 else
3453   echo "configure: failed program was:" >&5
3454   cat conftest.$ac_ext >&5
3455   rm -rf conftest*
3456   echo "$ac_t""no" 1>&6
3457                                          LIBS="$cf_save_LIBS"
3458 fi
3459 rm -f conftest*
3460                         done
3461                         
3462 fi
3463 rm -f conftest*
3464                 
3465 fi
3466
3467 eval 'cf_found_library=$cf_cv_have_lib_'$cf_nculib_root
3468
3469 if test $cf_found_library = no ; then
3470         { echo "configure: error: Cannot link $cf_nculib_root library" 1>&2; exit 1; }
3471 fi
3472
3473
3474 fi
3475
3476 if test -n "$cf_ncurses_LIBS" ; then
3477         echo $ac_n "checking if we can link $cf_nculib_root without $cf_ncurses_LIBS""... $ac_c" 1>&6
3478 echo "configure:3479: checking if we can link $cf_nculib_root without $cf_ncurses_LIBS" >&5
3479         cf_ncurses_SAVE="$LIBS"
3480         for p in $cf_ncurses_LIBS ; do
3481                 q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"`
3482                 if test "$q" != "$LIBS" ; then
3483                         LIBS="$q"
3484                 fi
3485         done
3486         cat > conftest.$ac_ext <<EOF
3487 #line 3488 "configure"
3488 #include "confdefs.h"
3489 #include <${cf_cv_ncurses_header-curses.h}>
3490 int main() {
3491 initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);
3492 ; return 0; }
3493 EOF
3494 if { (eval echo configure:3495: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
3495   rm -rf conftest*
3496   echo "$ac_t""yes" 1>&6
3497 else
3498   echo "configure: failed program was:" >&5
3499   cat conftest.$ac_ext >&5
3500   rm -rf conftest*
3501   echo "$ac_t""no" 1>&6
3502                  LIBS="$cf_ncurses_SAVE"
3503 fi
3504 rm -f conftest*
3505 fi
3506
3507
3508 cf_nculib_ROOT=`echo "HAVE_LIB$cf_nculib_root" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
3509
3510 cat >> confdefs.h <<EOF
3511 #define $cf_nculib_ROOT 1
3512 EOF
3513
3514
3515         LIB_NAME=ncursesw
3516         ;;
3517 esac
3518
3519
3520
3521 echo $ac_n "checking for form_driver in -lform$cf_cv_libtype""... $ac_c" 1>&6
3522 echo "configure:3523: checking for form_driver in -lform$cf_cv_libtype" >&5
3523 ac_lib_var=`echo form$cf_cv_libtype'_'form_driver | sed 'y%./+-%__p_%'`
3524 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
3525   echo $ac_n "(cached) $ac_c" 1>&6
3526 else
3527   ac_save_LIBS="$LIBS"
3528 LIBS="-lform$cf_cv_libtype  $LIBS"
3529 cat > conftest.$ac_ext <<EOF
3530 #line 3531 "configure"
3531 #include "confdefs.h"
3532 /* Override any gcc2 internal prototype to avoid an error.  */
3533 /* We use char because int might match the return type of a gcc2
3534     builtin and then its argument prototype would still apply.  */
3535 char form_driver();
3536
3537 int main() {
3538 form_driver()
3539 ; return 0; }
3540 EOF
3541 if { (eval echo configure:3542: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
3542   rm -rf conftest*
3543   eval "ac_cv_lib_$ac_lib_var=yes"
3544 else
3545   echo "configure: failed program was:" >&5
3546   cat conftest.$ac_ext >&5
3547   rm -rf conftest*
3548   eval "ac_cv_lib_$ac_lib_var=no"
3549 fi
3550 rm -f conftest*
3551 LIBS="$ac_save_LIBS"
3552
3553 fi
3554 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
3555   echo "$ac_t""yes" 1>&6
3556     ac_tr_lib=HAVE_LIB`echo form$cf_cv_libtype | sed -e 's/[^a-zA-Z0-9_]/_/g' \
3557     -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
3558   cat >> confdefs.h <<EOF
3559 #define $ac_tr_lib 1
3560 EOF
3561
3562   LIBS="-lform$cf_cv_libtype $LIBS"
3563
3564 else
3565   echo "$ac_t""no" 1>&6
3566 fi
3567
3568 echo $ac_n "checking for menu_driver in -lmenu$cf_cv_libtype""... $ac_c" 1>&6
3569 echo "configure:3570: checking for menu_driver in -lmenu$cf_cv_libtype" >&5
3570 ac_lib_var=`echo menu$cf_cv_libtype'_'menu_driver | sed 'y%./+-%__p_%'`
3571 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
3572   echo $ac_n "(cached) $ac_c" 1>&6
3573 else
3574   ac_save_LIBS="$LIBS"
3575 LIBS="-lmenu$cf_cv_libtype  $LIBS"
3576 cat > conftest.$ac_ext <<EOF
3577 #line 3578 "configure"
3578 #include "confdefs.h"
3579 /* Override any gcc2 internal prototype to avoid an error.  */
3580 /* We use char because int might match the return type of a gcc2
3581     builtin and then its argument prototype would still apply.  */
3582 char menu_driver();
3583
3584 int main() {
3585 menu_driver()
3586 ; return 0; }
3587 EOF
3588 if { (eval echo configure:3589: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
3589   rm -rf conftest*
3590   eval "ac_cv_lib_$ac_lib_var=yes"
3591 else
3592   echo "configure: failed program was:" >&5
3593   cat conftest.$ac_ext >&5
3594   rm -rf conftest*
3595   eval "ac_cv_lib_$ac_lib_var=no"
3596 fi
3597 rm -f conftest*
3598 LIBS="$ac_save_LIBS"
3599
3600 fi
3601 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
3602   echo "$ac_t""yes" 1>&6
3603     ac_tr_lib=HAVE_LIB`echo menu$cf_cv_libtype | sed -e 's/[^a-zA-Z0-9_]/_/g' \
3604     -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
3605   cat >> confdefs.h <<EOF
3606 #define $ac_tr_lib 1
3607 EOF
3608
3609   LIBS="-lmenu$cf_cv_libtype $LIBS"
3610
3611 else
3612   echo "$ac_t""no" 1>&6
3613 fi
3614
3615 echo $ac_n "checking for new_panel in -lpanel$cf_cv_libtype""... $ac_c" 1>&6
3616 echo "configure:3617: checking for new_panel in -lpanel$cf_cv_libtype" >&5
3617 ac_lib_var=`echo panel$cf_cv_libtype'_'new_panel | sed 'y%./+-%__p_%'`
3618 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
3619   echo $ac_n "(cached) $ac_c" 1>&6
3620 else
3621   ac_save_LIBS="$LIBS"
3622 LIBS="-lpanel$cf_cv_libtype  $LIBS"
3623 cat > conftest.$ac_ext <<EOF
3624 #line 3625 "configure"
3625 #include "confdefs.h"
3626 /* Override any gcc2 internal prototype to avoid an error.  */
3627 /* We use char because int might match the return type of a gcc2
3628     builtin and then its argument prototype would still apply.  */
3629 char new_panel();
3630
3631 int main() {
3632 new_panel()
3633 ; return 0; }
3634 EOF
3635 if { (eval echo configure:3636: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
3636   rm -rf conftest*
3637   eval "ac_cv_lib_$ac_lib_var=yes"
3638 else
3639   echo "configure: failed program was:" >&5
3640   cat conftest.$ac_ext >&5
3641   rm -rf conftest*
3642   eval "ac_cv_lib_$ac_lib_var=no"
3643 fi
3644 rm -f conftest*
3645 LIBS="$ac_save_LIBS"
3646
3647 fi
3648 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
3649   echo "$ac_t""yes" 1>&6
3650     ac_tr_lib=HAVE_LIB`echo panel$cf_cv_libtype | sed -e 's/[^a-zA-Z0-9_]/_/g' \
3651     -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
3652   cat >> confdefs.h <<EOF
3653 #define $ac_tr_lib 1
3654 EOF
3655
3656   LIBS="-lpanel$cf_cv_libtype $LIBS"
3657
3658 else
3659   echo "$ac_t""no" 1>&6
3660 fi
3661
3662
3663 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
3664 echo "configure:3665: checking return type of signal handlers" >&5
3665 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
3666   echo $ac_n "(cached) $ac_c" 1>&6
3667 else
3668   cat > conftest.$ac_ext <<EOF
3669 #line 3670 "configure"
3670 #include "confdefs.h"
3671 #include <sys/types.h>
3672 #include <signal.h>
3673 #ifdef signal
3674 #undef signal
3675 #endif
3676 #ifdef __cplusplus
3677 extern "C" void (*signal (int, void (*)(int)))(int);
3678 #else
3679 void (*signal ()) ();
3680 #endif
3681
3682 int main() {
3683 int i;
3684 ; return 0; }
3685 EOF
3686 if { (eval echo configure:3687: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
3687   rm -rf conftest*
3688   ac_cv_type_signal=void
3689 else
3690   echo "configure: failed program was:" >&5
3691   cat conftest.$ac_ext >&5
3692   rm -rf conftest*
3693   ac_cv_type_signal=int
3694 fi
3695 rm -f conftest*
3696 fi
3697
3698 echo "$ac_t""$ac_cv_type_signal" 1>&6
3699 cat >> confdefs.h <<EOF
3700 #define RETSIGTYPE $ac_cv_type_signal
3701 EOF
3702
3703
3704
3705 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
3706 echo "configure:3707: checking for ANSI C header files" >&5
3707 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
3708   echo $ac_n "(cached) $ac_c" 1>&6
3709 else
3710   cat > conftest.$ac_ext <<EOF
3711 #line 3712 "configure"
3712 #include "confdefs.h"
3713 #include <stdlib.h>
3714 #include <stdarg.h>
3715 #include <string.h>
3716 #include <float.h>
3717 EOF
3718 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
3719 { (eval echo configure:3720: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
3720 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
3721 if test -z "$ac_err"; then
3722   rm -rf conftest*
3723   ac_cv_header_stdc=yes
3724 else
3725   echo "$ac_err" >&5
3726   echo "configure: failed program was:" >&5
3727   cat conftest.$ac_ext >&5
3728   rm -rf conftest*
3729   ac_cv_header_stdc=no
3730 fi
3731 rm -f conftest*
3732
3733 if test $ac_cv_header_stdc = yes; then
3734   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
3735 cat > conftest.$ac_ext <<EOF
3736 #line 3737 "configure"
3737 #include "confdefs.h"
3738 #include <string.h>
3739 EOF
3740 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
3741   egrep "memchr" >/dev/null 2>&1; then
3742   :
3743 else
3744   rm -rf conftest*
3745   ac_cv_header_stdc=no
3746 fi
3747 rm -f conftest*
3748
3749 fi
3750
3751 if test $ac_cv_header_stdc = yes; then
3752   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
3753 cat > conftest.$ac_ext <<EOF
3754 #line 3755 "configure"
3755 #include "confdefs.h"
3756 #include <stdlib.h>
3757 EOF
3758 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
3759   egrep "free" >/dev/null 2>&1; then
3760   :
3761 else
3762   rm -rf conftest*
3763   ac_cv_header_stdc=no
3764 fi
3765 rm -f conftest*
3766
3767 fi
3768
3769 if test $ac_cv_header_stdc = yes; then
3770   # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
3771 if test "$cross_compiling" = yes; then
3772   :
3773 else
3774   cat > conftest.$ac_ext <<EOF
3775 #line 3776 "configure"
3776 #include "confdefs.h"
3777 #include <ctype.h>
3778 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
3779 #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
3780 #define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
3781 int main () { int i; for (i = 0; i < 256; i++)
3782 if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
3783 exit (0); }
3784
3785 EOF
3786 if { (eval echo configure:3787: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
3787 then
3788   :
3789 else
3790   echo "configure: failed program was:" >&5
3791   cat conftest.$ac_ext >&5
3792   rm -fr conftest*
3793   ac_cv_header_stdc=no
3794 fi
3795 rm -fr conftest*
3796 fi
3797
3798 fi
3799 fi
3800
3801 echo "$ac_t""$ac_cv_header_stdc" 1>&6
3802 if test $ac_cv_header_stdc = yes; then
3803   cat >> confdefs.h <<\EOF
3804 #define STDC_HEADERS 1
3805 EOF
3806
3807 fi
3808
3809 echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
3810 echo "configure:3811: checking whether time.h and sys/time.h may both be included" >&5
3811 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
3812   echo $ac_n "(cached) $ac_c" 1>&6
3813 else
3814   cat > conftest.$ac_ext <<EOF
3815 #line 3816 "configure"
3816 #include "confdefs.h"
3817 #include <sys/types.h>
3818 #include <sys/time.h>
3819 #include <time.h>
3820 int main() {
3821 struct tm *tp;
3822 ; return 0; }
3823 EOF
3824 if { (eval echo configure:3825: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
3825   rm -rf conftest*
3826   ac_cv_header_time=yes
3827 else
3828   echo "configure: failed program was:" >&5
3829   cat conftest.$ac_ext >&5
3830   rm -rf conftest*
3831   ac_cv_header_time=no
3832 fi
3833 rm -f conftest*
3834 fi
3835
3836 echo "$ac_t""$ac_cv_header_time" 1>&6
3837 if test $ac_cv_header_time = yes; then
3838   cat >> confdefs.h <<\EOF
3839 #define TIME_WITH_SYS_TIME 1
3840 EOF
3841
3842 fi
3843
3844 for ac_hdr in \
3845 form.h \
3846 getopt.h \
3847 locale.h \
3848 menu.h \
3849 nc_alloc.h \
3850 nomacros.h \
3851 panel.h \
3852 sys/ioctl.h \
3853 sys/select.h \
3854 sys/time.h \
3855 termios.h \
3856 unistd.h \
3857
3858 do
3859 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
3860 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
3861 echo "configure:3862: checking for $ac_hdr" >&5
3862 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
3863   echo $ac_n "(cached) $ac_c" 1>&6
3864 else
3865   cat > conftest.$ac_ext <<EOF
3866 #line 3867 "configure"
3867 #include "confdefs.h"
3868 #include <$ac_hdr>
3869 EOF
3870 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
3871 { (eval echo configure:3872: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
3872 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
3873 if test -z "$ac_err"; then
3874   rm -rf conftest*
3875   eval "ac_cv_header_$ac_safe=yes"
3876 else
3877   echo "$ac_err" >&5
3878   echo "configure: failed program was:" >&5
3879   cat conftest.$ac_ext >&5
3880   rm -rf conftest*
3881   eval "ac_cv_header_$ac_safe=no"
3882 fi
3883 rm -f conftest*
3884 fi
3885 if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
3886   echo "$ac_t""yes" 1>&6
3887     ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
3888   cat >> confdefs.h <<EOF
3889 #define $ac_tr_hdr 1
3890 EOF
3891  
3892 else
3893   echo "$ac_t""no" 1>&6
3894 fi
3895 done
3896
3897
3898 for ac_func in \
3899 color_set \
3900 getnstr \
3901 gettimeofday \
3902 napms \
3903 resize_term \
3904 resizeterm \
3905 slk_color \
3906 strdup \
3907 use_default_colors \
3908 vsscanf \
3909 wchgat \
3910 wresize \
3911
3912 do
3913 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
3914 echo "configure:3915: checking for $ac_func" >&5
3915 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
3916   echo $ac_n "(cached) $ac_c" 1>&6
3917 else
3918   cat > conftest.$ac_ext <<EOF
3919 #line 3920 "configure"
3920 #include "confdefs.h"
3921 /* System header to define __stub macros and hopefully few prototypes,
3922     which can conflict with char $ac_func(); below.  */
3923 #include <assert.h>
3924 /* Override any gcc2 internal prototype to avoid an error.  */
3925 /* We use char because int might match the return type of a gcc2
3926     builtin and then its argument prototype would still apply.  */
3927 char $ac_func();
3928
3929 int main() {
3930
3931 /* The GNU C library defines this for functions which it implements
3932     to always fail with ENOSYS.  Some functions are actually named
3933     something starting with __ and the normal name is an alias.  */
3934 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
3935 choke me
3936 #else
3937 $ac_func();
3938 #endif
3939
3940 ; return 0; }
3941 EOF
3942 if { (eval echo configure:3943: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
3943   rm -rf conftest*
3944   eval "ac_cv_func_$ac_func=yes"
3945 else
3946   echo "configure: failed program was:" >&5
3947   cat conftest.$ac_ext >&5
3948   rm -rf conftest*
3949   eval "ac_cv_func_$ac_func=no"
3950 fi
3951 rm -f conftest*
3952 fi
3953
3954 if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
3955   echo "$ac_t""yes" 1>&6
3956     ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
3957   cat >> confdefs.h <<EOF
3958 #define $ac_tr_func 1
3959 EOF
3960  
3961 else
3962   echo "$ac_t""no" 1>&6
3963 fi
3964 done
3965
3966
3967 cat > conftest.$ac_ext <<EOF
3968 #line 3969 "configure"
3969 #include "confdefs.h"
3970
3971 #include <${cf_cv_ncurses_header-curses.h}>
3972 int main() {
3973
3974         (void) assume_default_colors (0, 0);
3975         (void) curses_version ();
3976         (void) define_key (0, 0);
3977         (void) is_term_resized (0, 0);
3978         (void) key_defined (0);
3979         (void) keybound (0, 0);
3980         (void) keyok (0, 0);
3981         (void) resize_term (0, 0);
3982         (void) resizeterm (0, 0);
3983         (void) use_default_colors ();
3984         (void) use_extended_names (0);
3985         (void) wresize (0, 0, 0);
3986         
3987 ; return 0; }
3988 EOF
3989 if { (eval echo configure:3990: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
3990   rm -rf conftest*
3991   cat >> confdefs.h <<\EOF
3992 #define NCURSES_EXT_FUNCS 1
3993 EOF
3994
3995 else
3996   echo "configure: failed program was:" >&5
3997   cat conftest.$ac_ext >&5
3998 fi
3999 rm -f conftest*
4000
4001
4002 echo $ac_n "checking if sys/time.h works with sys/select.h""... $ac_c" 1>&6
4003 echo "configure:4004: checking if sys/time.h works with sys/select.h" >&5
4004 if eval "test \"`echo '$''{'cf_cv_sys_time_select'+set}'`\" = set"; then
4005   echo $ac_n "(cached) $ac_c" 1>&6
4006 else
4007   
4008 cat > conftest.$ac_ext <<EOF
4009 #line 4010 "configure"
4010 #include "confdefs.h"
4011
4012 #include <sys/types.h>
4013 #ifdef HAVE_SYS_TIME_H
4014 #include <sys/time.h>
4015 #endif
4016 #ifdef HAVE_SYS_SELECT_H
4017 #include <sys/select.h>
4018 #endif
4019
4020 int main() {
4021
4022 ; return 0; }
4023 EOF
4024 if { (eval echo configure:4025: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
4025   rm -rf conftest*
4026   cf_cv_sys_time_select=yes
4027 else
4028   echo "configure: failed program was:" >&5
4029   cat conftest.$ac_ext >&5
4030   rm -rf conftest*
4031   cf_cv_sys_time_select=no
4032 fi
4033 rm -f conftest*
4034      
4035 fi
4036
4037 echo "$ac_t""$cf_cv_sys_time_select" 1>&6
4038 test "$cf_cv_sys_time_select" = yes && cat >> confdefs.h <<\EOF
4039 #define HAVE_SYS_TIME_SELECT 1
4040 EOF
4041
4042
4043
4044 echo $ac_n "checking for function curses_version""... $ac_c" 1>&6
4045 echo "configure:4046: checking for function curses_version" >&5
4046 if eval "test \"`echo '$''{'cf_cv_func_curses_version'+set}'`\" = set"; then
4047   echo $ac_n "(cached) $ac_c" 1>&6
4048 else
4049   
4050 if test "$cross_compiling" = yes; then
4051   cf_cv_func_curses_version=unknown
4052 else
4053   cat > conftest.$ac_ext <<EOF
4054 #line 4055 "configure"
4055 #include "confdefs.h"
4056
4057 #include <${cf_cv_ncurses_header-curses.h}>
4058 int main()
4059 {
4060         char temp[1024];
4061         sprintf(temp, "%s\n", curses_version());
4062         exit(0);
4063 }
4064
4065 EOF
4066 if { (eval echo configure:4067: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
4067 then
4068   cf_cv_func_curses_version=yes
4069
4070 else
4071   echo "configure: failed program was:" >&5
4072   cat conftest.$ac_ext >&5
4073   rm -fr conftest*
4074   cf_cv_func_curses_version=no
4075
4076 fi
4077 rm -fr conftest*
4078 fi
4079
4080 rm -f core
4081 fi
4082
4083 echo "$ac_t""$cf_cv_func_curses_version" 1>&6
4084 test "$cf_cv_func_curses_version" = yes && cat >> confdefs.h <<\EOF
4085 #define HAVE_CURSES_VERSION 1
4086 EOF
4087
4088
4089
4090 echo $ac_n "checking for alternate character set array""... $ac_c" 1>&6
4091 echo "configure:4092: checking for alternate character set array" >&5
4092 if eval "test \"`echo '$''{'cf_cv_curses_acs_map'+set}'`\" = set"; then
4093   echo $ac_n "(cached) $ac_c" 1>&6
4094 else
4095   
4096 cf_cv_curses_acs_map=unknown
4097 for name in acs_map _acs_map __acs_map _nc_acs_map
4098 do
4099 cat > conftest.$ac_ext <<EOF
4100 #line 4101 "configure"
4101 #include "confdefs.h"
4102
4103 #include <${cf_cv_ncurses_header-curses.h}>
4104
4105 int main() {
4106
4107 $name['k'] = ACS_PLUS
4108
4109 ; return 0; }
4110 EOF
4111 if { (eval echo configure:4112: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
4112   rm -rf conftest*
4113   cf_cv_curses_acs_map=$name; break
4114 else
4115   echo "configure: failed program was:" >&5
4116   cat conftest.$ac_ext >&5
4117 fi
4118 rm -f conftest*
4119 done
4120
4121 fi
4122
4123 echo "$ac_t""$cf_cv_curses_acs_map" 1>&6
4124
4125 test "$cf_cv_curses_acs_map" != unknown && cat >> confdefs.h <<EOF
4126 #define CURSES_ACS_ARRAY $cf_cv_curses_acs_map
4127 EOF
4128
4129
4130
4131 echo $ac_n "checking for wide alternate character set array""... $ac_c" 1>&6
4132 echo "configure:4133: checking for wide alternate character set array" >&5
4133 if eval "test \"`echo '$''{'cf_cv_curses_wacs_map'+set}'`\" = set"; then
4134   echo $ac_n "(cached) $ac_c" 1>&6
4135 else
4136   
4137         cf_cv_curses_wacs_map=unknown
4138         for name in wacs_map _wacs_map __wacs_map _nc_wacs
4139         do
4140         cat > conftest.$ac_ext <<EOF
4141 #line 4142 "configure"
4142 #include "confdefs.h"
4143
4144 #ifndef _XOPEN_SOURCE_EXTENDED
4145 #define _XOPEN_SOURCE_EXTENDED
4146 #endif
4147 #include <${cf_cv_ncurses_header-curses.h}>
4148 int main() {
4149 $name['k'] = *WACS_PLUS
4150 ; return 0; }
4151 EOF
4152 if { (eval echo configure:4153: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
4153   rm -rf conftest*
4154   cf_cv_curses_wacs_map=$name
4155          break
4156 else
4157   echo "configure: failed program was:" >&5
4158   cat conftest.$ac_ext >&5
4159 fi
4160 rm -f conftest*
4161         done
4162 fi
4163
4164 echo "$ac_t""$cf_cv_curses_wacs_map" 1>&6
4165
4166
4167 echo $ac_n "checking for type attr_t in ${cf_cv_ncurses_header-curses.h}""... $ac_c" 1>&6
4168 echo "configure:4169: checking for type attr_t in ${cf_cv_ncurses_header-curses.h}" >&5
4169 cat > conftest.$ac_ext <<EOF
4170 #line 4171 "configure"
4171 #include "confdefs.h"
4172
4173 #ifndef _XOPEN_SOURCE_EXTENDED
4174 #define _XOPEN_SOURCE_EXTENDED
4175 #endif
4176 #include <${cf_cv_ncurses_header-curses.h}>
4177 int main() {
4178
4179 attr_t foo
4180
4181 ; return 0; }
4182 EOF
4183 if { (eval echo configure:4184: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
4184   rm -rf conftest*
4185   cf_result=yes
4186 else
4187   echo "configure: failed program was:" >&5
4188   cat conftest.$ac_ext >&5
4189   rm -rf conftest*
4190   cf_result=no
4191 fi
4192 rm -f conftest*
4193 echo "$ac_t""$cf_result" 1>&6
4194 if test $cf_result = yes ; then
4195         
4196 cf_result=`echo "have_type_attr_t" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
4197
4198         cat >> confdefs.h <<EOF
4199 #define $cf_result 1
4200 EOF
4201
4202 else
4203         cat >> confdefs.h <<EOF
4204 #define attr_t long
4205 EOF
4206
4207 fi
4208
4209
4210 echo $ac_n "checking for type mbstate_t in ${cf_cv_ncurses_header-curses.h}""... $ac_c" 1>&6
4211 echo "configure:4212: checking for type mbstate_t in ${cf_cv_ncurses_header-curses.h}" >&5
4212 cat > conftest.$ac_ext <<EOF
4213 #line 4214 "configure"
4214 #include "confdefs.h"
4215
4216 #ifndef _XOPEN_SOURCE_EXTENDED
4217 #define _XOPEN_SOURCE_EXTENDED
4218 #endif
4219 #include <${cf_cv_ncurses_header-curses.h}>
4220 int main() {
4221
4222 mbstate_t foo
4223
4224 ; return 0; }
4225 EOF
4226 if { (eval echo configure:4227: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
4227   rm -rf conftest*
4228   cf_result=yes
4229 else
4230   echo "configure: failed program was:" >&5
4231   cat conftest.$ac_ext >&5
4232   rm -rf conftest*
4233   cf_result=no
4234 fi
4235 rm -f conftest*
4236 echo "$ac_t""$cf_result" 1>&6
4237 if test $cf_result = yes ; then
4238         
4239 cf_result=`echo "have_type_mbstate_t" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
4240
4241         cat >> confdefs.h <<EOF
4242 #define $cf_result 1
4243 EOF
4244
4245 else
4246         cat >> confdefs.h <<EOF
4247 #define mbstate_t long
4248 EOF
4249
4250 fi
4251
4252
4253
4254 trap '' 1 2 15
4255 cat > confcache <<\EOF
4256 # This file is a shell script that caches the results of configure
4257 # tests run on this system so they can be shared between configure
4258 # scripts and configure runs.  It is not useful on other systems.
4259 # If it contains results you don't want to keep, you may remove or edit it.
4260 #
4261 # By default, configure uses ./config.cache as the cache file,
4262 # creating it if it does not exist already.  You can give configure
4263 # the --cache-file=FILE option to use a different cache file; that is
4264 # what configure does when it calls configure scripts in
4265 # subdirectories, so they share the cache.
4266 # Giving --cache-file=/dev/null disables caching, for debugging configure.
4267 # config.status only pays attention to the cache file if you give it the
4268 # --recheck option to rerun configure.
4269 #
4270 EOF
4271 # The following way of writing the cache mishandles newlines in values,
4272 # but we know of no workaround that is simple, portable, and efficient.
4273 # So, don't put newlines in cache variables' values.
4274 # Ultrix sh set writes to stderr and can't be redirected directly,
4275 # and sets the high bit in the cache file unless we assign to the vars.
4276 (set) 2>&1 |
4277   case `(ac_space=' '; set | grep ac_space) 2>&1` in
4278   *ac_space=\ *)
4279     # `set' does not quote correctly, so add quotes (double-quote substitution
4280     # turns \\\\ into \\, and sed turns \\ into \).
4281     sed -n \
4282       -e "s/'/'\\\\''/g" \
4283       -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
4284     ;;
4285   *)
4286     # `set' quotes correctly as required by POSIX, so do not add quotes.
4287     sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
4288     ;;
4289   esac >> confcache
4290 if cmp -s $cache_file confcache; then
4291   :
4292 else
4293   if test -w $cache_file; then
4294     echo "updating cache $cache_file"
4295     cat confcache > $cache_file
4296   else
4297     echo "not updating unwritable cache $cache_file"
4298   fi
4299 fi
4300 rm -f confcache
4301
4302 trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
4303
4304 test "x$prefix" = xNONE && prefix=$ac_default_prefix
4305 # Let make expand exec_prefix.
4306 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
4307
4308 # Any assignment to VPATH causes Sun make to only execute
4309 # the first set of double-colon rules, so remove it if not needed.
4310 # If there is a colon in the path, we need to keep it.
4311 if test "x$srcdir" = x.; then
4312   ac_vpsub='/^[         ]*VPATH[        ]*=[^:]*$/d'
4313 fi
4314
4315 trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
4316
4317 DEFS=-DHAVE_CONFIG_H
4318
4319 # Without the "./", some shells look in PATH for config.status.
4320 : ${CONFIG_STATUS=./config.status}
4321
4322 echo creating $CONFIG_STATUS
4323 rm -f $CONFIG_STATUS
4324 cat > $CONFIG_STATUS <<EOF
4325 #! /bin/sh
4326 # Generated automatically by configure.
4327 # Run this file to recreate the current configuration.
4328 # This directory was configured as follows,
4329 # on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
4330 #
4331 # $0 $ac_configure_args
4332 #
4333 # Compiler output produced by configure, useful for debugging
4334 # configure, is in ./config.log if it exists.
4335
4336 ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
4337 for ac_option
4338 do
4339   case "\$ac_option" in
4340   -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
4341     echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
4342     exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
4343   -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
4344     echo "$CONFIG_STATUS generated by autoconf version 2.13.20030927"
4345     exit 0 ;;
4346   -help | --help | --hel | --he | --h)
4347     echo "\$ac_cs_usage"; exit 0 ;;
4348   *) echo "\$ac_cs_usage"; exit 1 ;;
4349   esac
4350 done
4351
4352 ac_given_srcdir=$srcdir
4353
4354 trap 'rm -fr `echo "Makefile ncurses_cfg.h:ncurses_tst.hin" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
4355 EOF
4356 cat >> $CONFIG_STATUS <<EOF
4357
4358 # Protect against being on the right side of a sed subst in config.status.
4359 sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
4360  s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
4361 $ac_vpsub
4362 $extrasub
4363 s%@SHELL@%$SHELL%g
4364 s%@CFLAGS@%$CFLAGS%g
4365 s%@CPPFLAGS@%$CPPFLAGS%g
4366 s%@CXXFLAGS@%$CXXFLAGS%g
4367 s%@FFLAGS@%$FFLAGS%g
4368 s%@DEFS@%$DEFS%g
4369 s%@LDFLAGS@%$LDFLAGS%g
4370 s%@LIBS@%$LIBS%g
4371 s%@exec_prefix@%$exec_prefix%g
4372 s%@prefix@%$prefix%g
4373 s%@program_transform_name@%$program_transform_name%g
4374 s%@bindir@%$bindir%g
4375 s%@sbindir@%$sbindir%g
4376 s%@libexecdir@%$libexecdir%g
4377 s%@datadir@%$datadir%g
4378 s%@sysconfdir@%$sysconfdir%g
4379 s%@sharedstatedir@%$sharedstatedir%g
4380 s%@localstatedir@%$localstatedir%g
4381 s%@libdir@%$libdir%g
4382 s%@includedir@%$includedir%g
4383 s%@oldincludedir@%$oldincludedir%g
4384 s%@infodir@%$infodir%g
4385 s%@mandir@%$mandir%g
4386 s%@host@%$host%g
4387 s%@host_alias@%$host_alias%g
4388 s%@host_cpu@%$host_cpu%g
4389 s%@host_vendor@%$host_vendor%g
4390 s%@host_os@%$host_os%g
4391 s%@SET_MAKE@%$SET_MAKE%g
4392 s%@CC@%$CC%g
4393 s%@CPP@%$CPP%g
4394 s%@CC_G_OPT@%$CC_G_OPT%g
4395 s%@CC_SHARED_OPTS@%$CC_SHARED_OPTS%g
4396 s%@DFT_DEP_SUFFIX@%$DFT_DEP_SUFFIX%g
4397 s%@DFT_OBJ_SUBDIR@%$DFT_OBJ_SUBDIR%g
4398 s%@DFT_UPR_MODEL@%$DFT_UPR_MODEL%g
4399 s%@ECHO_LINK@%$ECHO_LINK%g
4400 s%@EXTRA_LIBS@%$EXTRA_LIBS%g
4401 s%@LD@%$LD%g
4402 s%@LDFLAGS_SHARED@%$LDFLAGS_SHARED%g
4403 s%@LD_MODEL@%$LD_MODEL%g
4404 s%@LD_SHARED_OPTS@%$LD_SHARED_OPTS%g
4405 s%@LIBTOOL@%$LIBTOOL%g
4406 s%@LIB_CLEAN@%$LIB_CLEAN%g
4407 s%@LIB_COMPILE@%$LIB_COMPILE%g
4408 s%@LIB_LINK@%$LIB_LINK%g
4409 s%@LIB_NAME@%$LIB_NAME%g
4410 s%@LIB_PREFIX@%$LIB_PREFIX%g
4411 s%@LINK_TESTS@%$LINK_TESTS%g
4412 s%@LINT@%$LINT%g
4413 s%@LINT_OPTS@%$LINT_OPTS%g
4414 s%@LOCAL_LDFLAGS@%$LOCAL_LDFLAGS%g
4415 s%@MATH_LIB@%$MATH_LIB%g
4416 s%@TEST_ARGS@%$TEST_ARGS%g
4417 s%@TEST_DEPS@%$TEST_DEPS%g
4418 s%@cf_cv_abi_version@%$cf_cv_abi_version%g
4419 s%@cf_cv_rel_version@%$cf_cv_rel_version%g
4420 s%@EXEEXT@%$EXEEXT%g
4421 s%@OBJEXT@%$OBJEXT%g
4422
4423 CEOF
4424 EOF
4425
4426 cat >> $CONFIG_STATUS <<\EOF
4427
4428 # Split the substitutions into bite-sized pieces for seds with
4429 # small command number limits, like on Digital OSF/1 and HP-UX.
4430 ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
4431 ac_file=1 # Number of current file.
4432 ac_beg=1 # First line for current file.
4433 ac_end=$ac_max_sed_cmds # Line after last line for current file.
4434 ac_more_lines=:
4435 ac_sed_cmds=""
4436 while $ac_more_lines; do
4437   if test $ac_beg -gt 1; then
4438     sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
4439   else
4440     sed "${ac_end}q" conftest.subs > conftest.s$ac_file
4441   fi
4442   if test ! -s conftest.s$ac_file; then
4443     ac_more_lines=false
4444     rm -f conftest.s$ac_file
4445   else
4446     if test -z "$ac_sed_cmds"; then
4447       ac_sed_cmds="sed -f conftest.s$ac_file"
4448     else
4449       ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
4450     fi
4451     ac_file=`expr $ac_file + 1`
4452     ac_beg=$ac_end
4453     ac_end=`expr $ac_end + $ac_max_sed_cmds`
4454   fi
4455 done
4456 if test -z "$ac_sed_cmds"; then
4457   ac_sed_cmds=cat
4458 fi
4459 EOF
4460
4461 cat >> $CONFIG_STATUS <<EOF
4462
4463 CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
4464 EOF
4465 cat >> $CONFIG_STATUS <<\EOF
4466 for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
4467   # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
4468   case "$ac_file" in
4469   *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
4470        ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
4471   *) ac_file_in="${ac_file}.in" ;;
4472   esac
4473
4474   # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
4475
4476   # Remove last slash and all that follows it.  Not all systems have dirname.
4477   ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
4478   if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
4479     # The file is in a subdirectory.
4480     test ! -d "$ac_dir" && mkdir "$ac_dir"
4481     ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
4482     # A "../" for each directory in $ac_dir_suffix.
4483     ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
4484   else
4485     ac_dir_suffix= ac_dots=
4486   fi
4487
4488   case "$ac_given_srcdir" in
4489   .)  srcdir=.
4490       if test -z "$ac_dots"; then top_srcdir=.
4491       else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
4492   /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
4493   *) # Relative path.
4494     srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
4495     top_srcdir="$ac_dots$ac_given_srcdir" ;;
4496   esac
4497
4498
4499   echo creating "$ac_file"
4500   rm -f "$ac_file"
4501   configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
4502   case "$ac_file" in
4503   *Makefile*) ac_comsub="1i\\
4504 # $configure_input" ;;
4505   *) ac_comsub= ;;
4506   esac
4507
4508   ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
4509   sed -e "$ac_comsub
4510 s%@configure_input@%$configure_input%g
4511 s%@srcdir@%$srcdir%g
4512 s%@top_srcdir@%$top_srcdir%g
4513 " $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
4514 fi; done
4515 rm -f conftest.s*
4516
4517 # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
4518 # NAME is the cpp macro being defined and VALUE is the value it is being given.
4519 #
4520 # ac_d sets the value in "#define NAME VALUE" lines.
4521 ac_dA='s%^\([   ]*\)#\([        ]*define[       ][      ]*\)'
4522 ac_dB='\([      ][      ]*\)[^  ]*%\1#\2'
4523 ac_dC='\3'
4524 ac_dD='%g'
4525 # ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
4526 ac_uA='s%^\([   ]*\)#\([        ]*\)undef\([    ][      ]*\)'
4527 ac_uB='\([      ]\)%\1#\2define\3'
4528 ac_uC=' '
4529 ac_uD='\4%g'
4530 # ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
4531 ac_eA='s%^\([   ]*\)#\([        ]*\)undef\([    ][      ]*\)'
4532 ac_eB='$%\1#\2define\3'
4533 ac_eC=' '
4534 ac_eD='%g'
4535
4536 if test "${CONFIG_HEADERS+set}" != set; then
4537 EOF
4538 cat >> $CONFIG_STATUS <<EOF
4539   CONFIG_HEADERS="ncurses_cfg.h:ncurses_tst.hin"
4540 EOF
4541 cat >> $CONFIG_STATUS <<\EOF
4542 fi
4543 for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
4544   # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
4545   case "$ac_file" in
4546   *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
4547        ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
4548   *) ac_file_in="${ac_file}.in" ;;
4549   esac
4550
4551   echo creating $ac_file
4552
4553   rm -f conftest.frag conftest.in conftest.out
4554   ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
4555   cat $ac_file_inputs > conftest.in
4556
4557 EOF
4558
4559
4560 # Transform confdefs.h into a list of #define's.  We won't use it as a sed
4561 # script, but as data to insert where we see @DEFS@.  We expect AC_SAVE_DEFS to
4562 # be either 'cat' or 'sort'.
4563 sort confdefs.h >conftest.vals
4564
4565 # Break up conftest.vals because some shells have a limit on
4566 # the size of here documents, and old seds have small limits too.
4567
4568 rm -f conftest.tail
4569 echo '  rm -f conftest.frag' >> $CONFIG_STATUS
4570 while :
4571 do
4572   ac_lines=`grep -c . conftest.vals`
4573   # grep -c gives empty output for an empty file on some AIX systems.
4574   if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
4575   # Write chunks of a limited-size here document to conftest.frag.
4576   echo '  cat >> conftest.frag <<CEOF' >> $CONFIG_STATUS
4577   sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
4578   echo 'CEOF' >> $CONFIG_STATUS
4579   sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
4580   rm -f conftest.vals
4581   mv conftest.tail conftest.vals
4582 done
4583 rm -f conftest.vals
4584
4585 # Run sed to substitute the contents of conftest.frag into conftest.in at the
4586 # marker @DEFS@.
4587 echo '  cat >> conftest.edit <<CEOF
4588 /@DEFS@/r conftest.frag
4589 /@DEFS@/d
4590 CEOF
4591 sed -f conftest.edit conftest.in > conftest.out
4592 rm -f conftest.in
4593 mv conftest.out conftest.in
4594 rm -f conftest.edit conftest.frag
4595 ' >> $CONFIG_STATUS
4596
4597
4598 cat >> $CONFIG_STATUS <<\EOF
4599   rm -f conftest.frag conftest.h
4600   echo "/* $ac_file.  Generated automatically by configure.  */" > conftest.h
4601   cat conftest.in >> conftest.h
4602   rm -f conftest.in
4603   if cmp -s $ac_file conftest.h 2>/dev/null; then
4604     echo "$ac_file is unchanged"
4605     rm -f conftest.h
4606   else
4607     # Remove last slash and all that follows it.  Not all systems have dirname.
4608       ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
4609       if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
4610       # The file is in a subdirectory.
4611       test ! -d "$ac_dir" && mkdir "$ac_dir"
4612     fi
4613     rm -f $ac_file
4614     mv conftest.h $ac_file
4615   fi
4616 fi; done
4617
4618 EOF
4619 cat >> $CONFIG_STATUS <<EOF
4620 # Extra initialization commands, if any
4621
4622 EOF
4623 cat >> $CONFIG_STATUS <<\EOF
4624 # Extra commands, if any
4625
4626         cat >>Makefile <<TEST_EOF
4627
4628 # These rules are generated so we do not rely on suffix rules, which do not
4629 # work consistently for different make-programs (the '\$(MODEL)/' confuses
4630 # some, and the '\$x' confuses others).
4631 TEST_EOF
4632 LIST=`sed -e 's/[       ].*//' -e '/^[#@]/d' $srcdir/modules`
4633 for N in $LIST
4634 do
4635         cat >>Makefile <<TEST_EOF
4636
4637 \$(MODEL)/$N.o : $N.c \\
4638         test.priv.h \\
4639         ncurses_cfg.h
4640         @echo compiling $N; \$(CC) -c \$(CFLAGS_DEFAULT) $N.c
4641 TEST_EOF
4642 done
4643
4644 exit 0
4645 EOF
4646 chmod +x $CONFIG_STATUS
4647 rm -fr confdefs* $ac_clean_files
4648 test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
4649