]> ncurses.scripts.mit.edu Git - ncurses.git/blob - sysdeps/unix/sysv/linux/configure
ncurses 5.1
[ncurses.git] / sysdeps / unix / sysv / linux / configure
1 # Local configure fragment for ncurses/sysdeps/unix/sysv/linux.
2
3 nc_given_srcdir=${srcdir}/ncurses
4
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}
10
11 # Default to char
12 if [ x${cf_cv_type_of_bool} = x ]
13 then
14   cf_cv_type_of_bool=char
15 fi
16
17 rm -f ncurses/MKterm.h.awk \
18         ncurses/codes.c \
19         ncurses/comp_captab.c \
20         ncurses/confdefs.h \
21         ncurses/config.log \
22         ncurses/curses.h \
23         ncurses/expanded.c \
24         ncurses/fallback.c \
25         ncurses/hashsize.h \
26         ncurses/init_keytry.h \
27         ncurses/lib_gen.c \
28         ncurses/lib_keyname.c \
29         ncurses/names.c \
30         ncurses/ncurses_cfg.h \
31         ncurses/nomacros.h \
32         ncurses/parametrized.h \
33         ncurses/term.h \
34         ncurses/termcap.h \
35         ncurses/terminfo.5 \
36         ncurses/termsort.c \
37         ncurses/unctrl.c \
38         ncurses/unctrl.h
39
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
43
44
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
49 s%@NCURSES_CONST@%%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
60 s%@cf_cv_1UL@%1UL%g
61 s%@cf_cv_cc_bool_type@%0%g
62
63 EOF
64
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.
71 nc_more_lines=:
72 nc_sed_cmds=""
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
76   else
77     sed "${nc_end}q" conftest.subs > conftest.s$nc_file
78   fi
79   if test ! -s conftest.s$nc_file; then
80     nc_more_lines=false
81     rm -f conftest.s$nc_file
82   else
83     if test -z "$nc_sed_cmds"; then
84       nc_sed_cmds="sed -f conftest.s$nc_file"
85     else
86       nc_sed_cmds="$nc_sed_cmds | sed -f conftest.s$nc_file"
87     fi
88     nc_file=`expr $nc_file + 1`
89     nc_beg=$nc_end
90     nc_end=`expr $nc_end + $nc_max_sed_cmds`
91   fi
92 done
93 if test -z "$nc_sed_cmds"; then
94   nc_sed_cmds=cat
95 fi
96
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".
100   case "$nc_file" 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 ;;
104   esac
105
106   # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
107
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'`
116   else
117     nc_dir_suffix= nc_dots=
118   fi
119
120   case "$nc_given_srcdir" in
121   .)  nc_srcdir=.
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" ;;
125   *) # Relative path.
126     nc_srcdir="$nc_dots$nc_given_srcdir$nc_dir_suffix"
127     nc_top_srcdir="$nc_dots$nc_given_srcdir" ;;
128   esac
129
130   case "$ac_given_INSTALL" in
131   [/$]*) NC_INSTALL="$ac_given_INSTALL" ;;
132   *) NC_INSTALL="$nc_dots$ac_given_INSTALL" ;;
133   esac
134
135   echo creating "$nc_file"
136   rm -f "$nc_file"
137   configure_input="Generated automatically from `echo $nc_file_in|sed 's%.*/%%'` by configure."
138   case "$nc_file" in
139   *Makefile*) nc_comsub="1i\\
140 # $configure_input" ;;
141   *) nc_comsub= ;;
142   esac
143
144   nc_file_inputs=`echo $nc_file_in|sed -e "s%^%$nc_given_srcdir/%" -e "s%:% $nc_given_srcdir/%g"`
145   sed -e "$nc_comsub
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
151 fi; done
152 rm -f conftest.s*
153
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.
156 #
157 # nc_d sets the value in "#define NAME VALUE" lines.
158 nc_dA='s%^\([   ]*\)#\([        ]*define[       ][      ]*\)'
159 nc_dB='\([      ][      ]*\)[^  ]*%\1#\2'
160 nc_dC='\3'
161 nc_dD='%g'
162 # nc_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
163 nc_uA='s%^\([   ]*\)#\([        ]*\)undef\([    ][      ]*\)'
164 nc_uB='\([      ]\)%\1#\2define\3'
165 nc_uC=' '
166 nc_uD='\4%g'
167 # nc_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
168 nc_eA='s%^\([   ]*\)#\([        ]*\)undef\([    ][      ]*\)'
169 nc_eB='$%\1#\2define\3'
170 nc_eC=' '
171 nc_eD='%g'
172
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".
176   case "$nc_file" 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" ;;
180   esac
181
182   echo creating $nc_file
183
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
187
188   rm -f conftest.frag
189   cat >> conftest.frag <<CEOF
190
191 #define CC_HAS_INLINE_FUNCS 1
192 #define GCC_NORETURN __attribute__((noreturn))
193 #define GCC_PRINTF 1
194 #define GCC_SCANF 1
195 #define GCC_UNUSED __attribute__((unused))
196 #define GOOD_SELECT 1
197 #define HAVE_BUILTIN_H 1
198 #define HAVE_DIRENT_H 1
199 #define HAVE_ERRNO 1
200 #define HAVE_FCNTL_H 1
201 #define HAVE_FORM_H 1
202 #define HAVE_GETOPT_H 1
203 CEOF
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
212 #define HAVE_LINK 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
219 CEOF
220   cat >> conftest.frag <<CEOF
221 #define HAVE_PANEL_H 1
222 #define HAVE_POLL 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
233 CEOF
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
246 #define HAVE_TIMES 1
247 #define HAVE_TTYENT_H 1
248 CEOF
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
257 #define NDEBUG 1
258 #define PURE_TERMINFO 1
259 #define RETSIGTYPE void
260 #define STDC_HEADERS 1
261 CEOF
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
267 #define USE_LINKS 1
268 #define NCURSES_NO_PADDING 1
269 #define USE_SIGWINCH 1
270 CEOF
271   cat >> conftest.edit <<CEOF
272 /@DEFS@/r conftest.frag
273 /@DEFS@/d
274 CEOF
275 sed -f conftest.edit conftest.in > conftest.out
276 rm -f conftest.in
277 mv conftest.out conftest.in
278 rm -f conftest.edit conftest.frag
279
280   rm -f conftest.frag conftest.h
281   echo "/* $nc_file.  Generated automatically by configure.  */" > conftest.h
282   cat conftest.in >> conftest.h
283   rm -f conftest.in
284   if cmp -s $nc_file conftest.h 2>/dev/null; then
285     echo "$nc_file is unchanged"
286     rm -f conftest.h
287   else
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"
293     fi
294     rm -f $nc_file
295     mv conftest.h $nc_file
296   fi
297 fi; done
298
299
300 SYS_NAME=`uname -a`
301 if test -z "$SYS_NAME"; then SYS_NAME=unknown;fi
302
303 NC_AWK=awk
304 BUILD_CC=${BUILD_CC-gcc}
305 NC_CC="${BUILD_CC} -I${nc_given_srcdir}/ncurses -Incurses -I${nc_given_srcdir}/include"
306 NC_CPP="${NC_CC} -E"
307 CF_LIST_MODELS="normal"
308 #WITH_ECHO="yes"
309 #WITH_OVERWRITE="yes"
310 nc_cxx_library="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"
316
317
318 rm -f headers.sed headers.sh
319
320 echo creating headers.sh
321 cat >headers.sh <<NC_EOF
322 #!/bin/sh
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.
327 PRG=""
328 while test \$# != 3
329 do
330 PRG="\$PRG \$1"; shift
331 done
332 DST=\$1
333 REF=\$2
334 SRC=\$3
335 echo installing \$SRC in \$DST
336 case \$DST in
337 /*/include/*)
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 "#"\`
342                 do
343                         NAME=\`basename \$i\`
344                         echo "s/<\$NAME>/<\$END\/\$NAME>/" >> ../headers.sed
345                 done
346         fi
347         rm -f \$TMP
348         sed -f ../headers.sed \$SRC > \$TMP
349         eval \$PRG \$TMP \$DST
350         rm -f \$TMP
351         ;;
352 *)
353         eval \$PRG \$SRC \$DST
354         ;;
355 esac
356 NC_EOF
357
358 chmod 0755 headers.sh
359
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
363
364 echo creating ncurses/hashsize.h
365 sh ${nc_given_srcdir}/include/MKhashsize.sh ${nc_given_srcdir}/include/Caps > ncurses/hashsize.h
366
367 echo creating ncurses/parametrized.h
368 sh ${nc_given_srcdir}/include/MKparametrized.sh ${nc_given_srcdir}/include/Caps > ncurses/parametrized.h
369
370 echo creating ncurses/termsort.c
371 sh ${nc_given_srcdir}/progs/MKtermsort.sh "${NC_AWK}" ${nc_given_srcdir}/include/Caps > ncurses/termsort.c
372
373 echo creating ncurses/fallback.c
374 sh ${nc_given_srcdir}/ncurses/tinfo/MKfallback.sh > ncurses/fallback.c
375
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
378
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
381
382 echo creating ncurses/expanded.c
383 sh ${nc_given_srcdir}/ncurses/tty/MKexpanded.sh "${NC_CPP}" >ncurses/expanded.c
384
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
388 rm -f make_hash
389
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
392
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
398
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
402 rm -f make_key
403
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