1 # Local configure fragment for ncurses/sysdeps/unix/sysv/linux.
3 nc_given_srcdir=${srcdir}/ncurses
5 NCURSES_MAJOR="`egrep '^NCURSES_MAJOR[ ]*=' $nc_given_srcdir/dist.mk | sed -e 's/^[^0-9]*//'`"
6 NCURSES_MINOR="`egrep '^NCURSES_MINOR[ ]*=' $nc_given_srcdir/dist.mk | sed -e 's/^[^0-9]*//'`"
7 NCURSES_PATCH="`egrep '^NCURSES_PATCH[ ]*=' $nc_given_srcdir/dist.mk | sed -e 's/^[^0-9]*//'`"
8 cf_cv_abi_version=${NCURSES_MAJOR}
9 cf_cv_rel_version=${NCURSES_MAJOR}.${NCURSES_MINOR}
12 if [ x${cf_cv_type_of_bool} = x ]
14 cf_cv_type_of_bool=char
17 rm -f ncurses/MKterm.h.awk \
19 ncurses/comp_captab.c \
26 ncurses/init_keytry.h \
28 ncurses/lib_keyname.c \
30 ncurses/ncurses_cfg.h \
32 ncurses/parametrized.h \
40 # Protect against being on the right side of a sed subst in config.status.
41 sed 's/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\&%]/\\&/g;
42 s/@@/%@/; s/@@/@%/; s/@g$/%g/' > conftest.subs <<EOF
45 s%@DEFS@%-DHAVE_CONFIG_H%g
46 s%@NCURSES_MAJOR@%$NCURSES_MAJOR%g
47 s%@NCURSES_MINOR@%$NCURSES_MINOR%g
48 s%@NCURSES_PATCH@%$NCURSES_PATCH%g
50 s%@NCURSES_XNAMES@%1%g
51 s%@OSPEED_TYPE@%speed_t%g
52 s%@OSPEED_INCLUDES@%#include <termios.h>%g
53 s%@cf_cv_rel_version@%$cf_cv_rel_version%g
54 s%@cf_cv_abi_version@%$cf_cv_abi_version%g
55 s%@cf_cv_builtin_bool@%1%g
56 s%@cf_cv_type_of_bool@%$cf_cv_type_of_bool%g
57 s%@cf_cv_shift_limit@%32%g
58 s%@cf_cv_widec_shift@%8%g
59 s%@cf_cv_typeof_chtype@%long%g
61 s%@cf_cv_cc_bool_type@%0%g
65 # Split the substitutions into bite-sized pieces for seds with
66 # small command number limits, like on Digital OSF/1 and HP-UX.
67 nc_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
68 nc_file=1 # Number of current file.
69 nc_beg=1 # First line for current file.
70 nc_end=$nc_max_sed_cmds # Line after last line for current file.
73 while $nc_more_lines; do
74 if test $nc_beg -gt 1; then
75 sed "1,${nc_beg}d; ${nc_end}q" conftest.subs > conftest.s$nc_file
77 sed "${nc_end}q" conftest.subs > conftest.s$nc_file
79 if test ! -s conftest.s$nc_file; then
81 rm -f conftest.s$nc_file
83 if test -z "$nc_sed_cmds"; then
84 nc_sed_cmds="sed -f conftest.s$nc_file"
86 nc_sed_cmds="$nc_sed_cmds | sed -f conftest.s$nc_file"
88 nc_file=`expr $nc_file + 1`
90 nc_end=`expr $nc_end + $nc_max_sed_cmds`
93 if test -z "$nc_sed_cmds"; then
97 NC_CONFIG_FILES=${NC_CONFIG_FILES-"ncurses/MKterm.h.awk ncurses/curses.h ncurses/termcap.h ncurses/unctrl.h"}
98 for nc_file in .. $NC_CONFIG_FILES; do if test "x$nc_file" != x..; then
99 # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
101 *:*) nc_file_in=`echo "$nc_file"|sed 's%[^:]*:%%'`
102 nc_file=`echo "$nc_file"|sed 's%:.*%%'` ;;
103 *) nc_file_in=`echo "${nc_file}" | sed 's%ncurses%include%'`.in ;;
106 # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
108 # Remove last slash and all that follows it. Not all systems have dirname.
109 nc_dir=`echo $nc_file|sed 's%/[^/][^/]*$%%'`
110 if test "$nc_dir" != "$nc_file" && test "$nc_dir" != .; then
111 # The file is in a subdirectory.
112 test ! -d "$nc_dir" && mkdir "$nc_dir"
113 nc_dir_suffix="/`echo $nc_dir|sed 's%^\./%%'`"
114 # A "../" for each directory in $nc_dir_suffix.
115 nc_dots=`echo $nc_dir_suffix|sed 's%/[^/]*%../%g'`
117 nc_dir_suffix= nc_dots=
120 case "$nc_given_srcdir" in
122 if test -z "$nc_dots"; then nc_top_srcdir=.
123 else nc_top_srcdir=`echo $nc_dots|sed 's%/$%%'`; fi ;;
124 /*) nc_srcdir="$nc_given_srcdir$nc_dir_suffix"; nc_top_srcdir="$nc_given_srcdir" ;;
126 nc_srcdir="$nc_dots$nc_given_srcdir$nc_dir_suffix"
127 nc_top_srcdir="$nc_dots$nc_given_srcdir" ;;
130 case "$ac_given_INSTALL" in
131 [/$]*) NC_INSTALL="$ac_given_INSTALL" ;;
132 *) NC_INSTALL="$nc_dots$ac_given_INSTALL" ;;
135 echo creating "$nc_file"
137 configure_input="Generated automatically from `echo $nc_file_in|sed 's%.*/%%'` by configure."
139 *Makefile*) nc_comsub="1i\\
140 # $configure_input" ;;
144 nc_file_inputs=`echo $nc_file_in|sed -e "s%^%$nc_given_srcdir/%" -e "s%:% $nc_given_srcdir/%g"`
146 s%@configure_input@%$configure_input%g
147 s%@nc_srcdir@%$nc_srcdir%g
148 s%@nc_top_srcdir@%$nc_top_srcdir%g
149 s%@INSTALL@%$NC_INSTALL%g
150 " $nc_file_inputs | (eval "$nc_sed_cmds") > $nc_file
154 # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
155 # NAME is the cpp macro being defined and VALUE is the value it is being given.
157 # nc_d sets the value in "#define NAME VALUE" lines.
158 nc_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)'
159 nc_dB='\([ ][ ]*\)[^ ]*%\1#\2'
162 # nc_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
163 nc_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
164 nc_uB='\([ ]\)%\1#\2define\3'
167 # nc_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
168 nc_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
169 nc_eB='$%\1#\2define\3'
173 NC_CONFIG_HEADERS="ncurses/ncurses_cfg.h:include/ncurses_cfg.hin"
174 for nc_file in .. $NC_CONFIG_HEADERS; do if test "x$nc_file" != x..; then
175 # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
177 *:*) nc_file_in=`echo "$nc_file"|sed 's%[^:]*:%%'`
178 nc_file=`echo "$nc_file"|sed 's%:.*%%'` ;;
179 *) nc_file_in="${nc_file}.in" ;;
182 echo creating $nc_file
184 rm -f conftest.frag conftest.in conftest.out
185 nc_file_inputs=`echo $nc_file_in|sed -e "s%^%$nc_given_srcdir/%" -e "s%:% $nc_given_srcdir/%g"`
186 cat $nc_file_inputs > conftest.in
189 cat >> conftest.frag <<CEOF
191 #define CC_HAS_INLINE_FUNCS 1
192 #define GCC_NORETURN __attribute__((noreturn))
195 #define GCC_UNUSED __attribute__((unused))
196 #define GOOD_SELECT 1
197 #define HAVE_BUILTIN_H 1
198 #define HAVE_DIRENT_H 1
200 #define HAVE_FCNTL_H 1
201 #define HAVE_FORM_H 1
202 #define HAVE_GETOPT_H 1
204 cat >> conftest.frag <<CEOF
205 #define HAVE_GETTIMEOFDAY 1
206 #define HAVE_GETTTYNAM 1
207 #define HAVE_ISASCII 1
208 #define HAVE_LIBFORM 1
209 #define HAVE_LIBMENU 1
210 #define HAVE_LIBPANEL 1
211 #define HAVE_LIMITS_H 1
213 #define HAVE_LOCALE_H 1
214 #define HAVE_LONG_FILE_NAMES 1
215 #define HAVE_MEMCCPY 1
216 #define HAVE_MENU_H 1
217 #define HAVE_NANOSLEEP 1
218 #define HAVE_NC_ALLOC_H 1
220 cat >> conftest.frag <<CEOF
221 #define HAVE_PANEL_H 1
223 #define HAVE_POLL_H 1
224 #define HAVE_REGEX_H_FUNCS 1
225 #define HAVE_REMOVE 1
226 #define HAVE_SELECT 1
227 #define HAVE_SETBUF 1
228 #define HAVE_SETBUFFER 1
229 #define HAVE_SETVBUF 1
230 #define HAVE_SIGACTION 1
231 #define HAVE_SIGVEC 1
232 #define HAVE_SIZECHANGE 1
234 cat >> conftest.frag <<CEOF
235 #define HAVE_STRDUP 1
236 #define HAVE_SYMLINK 1
237 #define HAVE_SYS_IOCTL_H 1
238 #define HAVE_SYS_PARAM_H 1
239 #define HAVE_SYS_SELECT_H 1
240 #define HAVE_SYS_TIMES_H 1
241 #define HAVE_SYS_TIME_H 1
242 #define HAVE_SYS_TIME_SELECT 1
243 #define HAVE_TCGETATTR 1
244 #define HAVE_TERMIOS_H 1
245 #define HAVE_TERMIO_H 1
247 #define HAVE_TTYENT_H 1
249 cat >> conftest.frag <<CEOF
250 #define HAVE_TYPEINFO 1
251 #define HAVE_UNISTD_H 1
252 #define HAVE_VALUES_H 1
253 #define HAVE_VFSCANF 1
254 #define HAVE_VSNPRINTF 1
255 #define HAVE_VSSCANF 1
256 #define NCURSES_EXT_FUNCS 1
258 #define PURE_TERMINFO 1
259 #define RETSIGTYPE void
260 #define STDC_HEADERS 1
262 cat >> conftest.frag <<CEOF
263 #define SYSTEM_NAME "linux-gnu"
264 #define TYPEOF_CHTYPE long
265 #define USE_DATABASE 1
266 #define USE_HASHMAP 1
268 #define NCURSES_NO_PADDING 1
269 #define USE_SIGWINCH 1
271 cat >> conftest.edit <<CEOF
272 /@DEFS@/r conftest.frag
275 sed -f conftest.edit conftest.in > conftest.out
277 mv conftest.out conftest.in
278 rm -f conftest.edit conftest.frag
280 rm -f conftest.frag conftest.h
281 echo "/* $nc_file. Generated automatically by configure. */" > conftest.h
282 cat conftest.in >> conftest.h
284 if cmp -s $nc_file conftest.h 2>/dev/null; then
285 echo "$nc_file is unchanged"
288 # Remove last slash and all that follows it. Not all systems have dirname.
289 nc_dir=`echo $nc_file|sed 's%/[^/][^/]*$%%'`
290 if test "$nc_dir" != "$nc_file" && test "$nc_dir" != .; then
291 # The file is in a subdirectory.
292 test ! -d "$nc_dir" && mkdir "$nc_dir"
295 mv conftest.h $nc_file
301 if test -z "$SYS_NAME"; then SYS_NAME=unknown;fi
304 BUILD_CC=${BUILD_CC-gcc}
305 NC_CC="${BUILD_CC} -I${nc_given_srcdir}/ncurses -Incurses -I${nc_given_srcdir}/include"
307 CF_LIST_MODELS="normal"
309 #WITH_OVERWRITE="yes"
311 cf_cv_systype="Linux"
312 cf_cv_rel_version="4.2"
313 cf_cv_abi_version="4"
314 cf_cv_do_symlinks="yes"
315 cf_cv_rm_so_locs="no"
318 rm -f headers.sed headers.sh
320 echo creating headers.sh
321 cat >headers.sh <<NC_EOF
323 # This shell script is generated by the 'configure' script. It is invoked in a
324 # subdirectory of the build tree. It generates a sed-script in the parent
325 # directory that is used to adjust includes for header files that reside in a
326 # subdirectory of /usr/include, etc.
330 PRG="\$PRG \$1"; shift
335 echo installing \$SRC in \$DST
338 TMP=\${TMPDIR-/tmp}/\`basename \$SRC\`
339 if test ! -f ../headers.sed ; then
340 END=\`basename \$DST\`
341 for i in \`cat \$REF/../*/headers |fgrep -v "#"\`
343 NAME=\`basename \$i\`
344 echo "s/<\$NAME>/<\$END\/\$NAME>/" >> ../headers.sed
348 sed -f ../headers.sed \$SRC > \$TMP
349 eval \$PRG \$TMP \$DST
353 eval \$PRG \$SRC \$DST
358 chmod 0755 headers.sh
360 echo creating ncurses/term.h
361 ${NC_AWK} -f ncurses/MKterm.h.awk ${nc_given_srcdir}/include/Caps > ncurses/term.h
362 sh ${nc_given_srcdir}/include/edit_cfg.sh ncurses/ncurses_cfg.h ncurses/term.h
364 echo creating ncurses/hashsize.h
365 sh ${nc_given_srcdir}/include/MKhashsize.sh ${nc_given_srcdir}/include/Caps > ncurses/hashsize.h
367 echo creating ncurses/parametrized.h
368 sh ${nc_given_srcdir}/include/MKparametrized.sh ${nc_given_srcdir}/include/Caps > ncurses/parametrized.h
370 echo creating ncurses/termsort.c
371 sh ${nc_given_srcdir}/progs/MKtermsort.sh "${NC_AWK}" ${nc_given_srcdir}/include/Caps > ncurses/termsort.c
373 echo creating ncurses/fallback.c
374 sh ${nc_given_srcdir}/ncurses/tinfo/MKfallback.sh > ncurses/fallback.c
376 echo creating ncurses/lib_gen.c
377 sh ${nc_given_srcdir}/ncurses/base/MKlib_gen.sh "${NC_CPP}" "${NC_AWK}" < ncurses/curses.h > ncurses/lib_gen.c
379 echo creating ncurses/nomacros.h
380 sh ${nc_given_srcdir}/ncurses/base/MKlib_gen.sh "${NC_CPP}" "${NC_AWK}" < ncurses/curses.h | fgrep undef > ncurses/nomacros.h
382 echo creating ncurses/expanded.c
383 sh ${nc_given_srcdir}/ncurses/tty/MKexpanded.sh "${NC_CPP}" >ncurses/expanded.c
385 echo creating ncurses/comp_captab.c
386 ${NC_CC} -o make_hash -DMAIN_PROGRAM ${nc_given_srcdir}/ncurses/tinfo/comp_hash.c
387 sh ${nc_given_srcdir}/ncurses/tinfo/MKcaptab.awk "${NC_AWK}" ${nc_given_srcdir}/include/Caps > ncurses/comp_captab.c
390 echo creating ncurses/lib_keyname.c
391 ${NC_AWK} -f ${nc_given_srcdir}/ncurses/base/MKkeyname.awk ${nc_given_srcdir}/ncurses/tinfo/keys.list > ncurses/lib_keyname.c
393 echo creating ncurses/names.c and ncurses/codes.c
394 ${NC_AWK} -f ${nc_given_srcdir}/ncurses/tinfo/MKnames.awk ${nc_given_srcdir}/include/Caps
395 cat namehdr boolnames boolfnames numnames numfnames strnames strfnames nameftr >ncurses/names.c
396 cat namehdr boolcodes numcodes strcodes codeftr > ncurses/codes.c
397 rm -f namehdr nameftr codeftr boolnames boolfnames boolcodes numnames numfnames numcodes strnames strfnames strcodes
399 echo creating ncurses/init_keytry.h
400 ${NC_CC} -o make_key ${nc_given_srcdir}/ncurses/tinfo/make_keys.c
401 ./make_key ${nc_given_srcdir}/ncurses/keys.list > ncurses/init_keytry.h
404 echo creating ncurses/unctrl.c
405 echo | ${NC_AWK} -f ${nc_given_srcdir}/ncurses/base/MKunctrl.awk > ncurses/unctrl.c
406 echo creating ncurses/terminfo.5
407 sh ${nc_given_srcdir}/man/MKterminfo.sh ${nc_given_srcdir}/man/terminfo.head ${nc_given_srcdir}/include/Caps ${nc_given_srcdir}/man/terminfo.tail > ncurses/terminfo.5