]> ncurses.scripts.mit.edu Git - ncurses.git/blob - sysdeps/unix/sysv/linux/configure
6f4b789abb41db75812450d7240296f239c7be4d
[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/keys.tries \
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%@cf_cv_rel_version@%$cf_cv_rel_version%g
50 s%@cf_cv_abi_version@%$cf_cv_abi_version%g
51 s%@cf_cv_builtin_bool@%1%g
52 s%@cf_cv_type_of_bool@%$cf_cv_type_of_bool%g
53 s%@cf_cv_shift_limit@%32%g
54 s%@cf_cv_widec_shift@%8%g
55 s%@cf_cv_typeof_chtype@%long%g
56 s%@cf_cv_1UL@%1UL%g
57
58 EOF
59
60 # Split the substitutions into bite-sized pieces for seds with
61 # small command number limits, like on Digital OSF/1 and HP-UX.
62 nc_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
63 nc_file=1 # Number of current file.
64 nc_beg=1 # First line for current file.
65 nc_end=$nc_max_sed_cmds # Line after last line for current file.
66 nc_more_lines=:
67 nc_sed_cmds=""
68 while $nc_more_lines; do
69   if test $nc_beg -gt 1; then
70     sed "1,${nc_beg}d; ${nc_end}q" conftest.subs > conftest.s$nc_file
71   else
72     sed "${nc_end}q" conftest.subs > conftest.s$nc_file
73   fi
74   if test ! -s conftest.s$nc_file; then
75     nc_more_lines=false
76     rm -f conftest.s$nc_file
77   else
78     if test -z "$nc_sed_cmds"; then
79       nc_sed_cmds="sed -f conftest.s$nc_file"
80     else
81       nc_sed_cmds="$nc_sed_cmds | sed -f conftest.s$nc_file"
82     fi
83     nc_file=`expr $nc_file + 1`
84     nc_beg=$nc_end
85     nc_end=`expr $nc_end + $nc_max_sed_cmds`
86   fi
87 done
88 if test -z "$nc_sed_cmds"; then
89   nc_sed_cmds=cat
90 fi
91
92 NC_CONFIG_FILES=${NC_CONFIG_FILES-"ncurses/MKterm.h.awk         ncurses/curses.h        ncurses/termcap.h       ncurses/unctrl.h"}
93 for nc_file in .. $NC_CONFIG_FILES; do if test "x$nc_file" != x..; then
94   # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
95   case "$nc_file" in
96   *:*) nc_file_in=`echo "$nc_file"|sed 's%[^:]*:%%'`
97        nc_file=`echo "$nc_file"|sed 's%:.*%%'` ;;
98   *) nc_file_in=`echo "${nc_file}" | sed 's%ncurses%include%'`.in ;;
99   esac
100
101   # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
102
103   # Remove last slash and all that follows it.  Not all systems have dirname.
104   nc_dir=`echo $nc_file|sed 's%/[^/][^/]*$%%'`
105   if test "$nc_dir" != "$nc_file" && test "$nc_dir" != .; then
106     # The file is in a subdirectory.
107     test ! -d "$nc_dir" && mkdir "$nc_dir"
108     nc_dir_suffix="/`echo $nc_dir|sed 's%^\./%%'`"
109     # A "../" for each directory in $nc_dir_suffix.
110     nc_dots=`echo $nc_dir_suffix|sed 's%/[^/]*%../%g'`
111   else
112     nc_dir_suffix= nc_dots=
113   fi
114
115   case "$nc_given_srcdir" in
116   .)  nc_srcdir=.
117       if test -z "$nc_dots"; then nc_top_srcdir=.
118       else nc_top_srcdir=`echo $nc_dots|sed 's%/$%%'`; fi ;;
119   /*) nc_srcdir="$nc_given_srcdir$nc_dir_suffix"; nc_top_srcdir="$nc_given_srcdir" ;;
120   *) # Relative path.
121     nc_srcdir="$nc_dots$nc_given_srcdir$nc_dir_suffix"
122     nc_top_srcdir="$nc_dots$nc_given_srcdir" ;;
123   esac
124
125   case "$ac_given_INSTALL" in
126   [/$]*) NC_INSTALL="$ac_given_INSTALL" ;;
127   *) NC_INSTALL="$nc_dots$ac_given_INSTALL" ;;
128   esac
129
130   echo creating "$nc_file"
131   rm -f "$nc_file"
132   configure_input="Generated automatically from `echo $nc_file_in|sed 's%.*/%%'` by configure."
133   case "$nc_file" in
134   *Makefile*) nc_comsub="1i\\
135 # $configure_input" ;;
136   *) nc_comsub= ;;
137   esac
138
139   nc_file_inputs=`echo $nc_file_in|sed -e "s%^%$nc_given_srcdir/%" -e "s%:% $nc_given_srcdir/%g"`
140   sed -e "$nc_comsub
141 s%@configure_input@%$configure_input%g
142 s%@nc_srcdir@%$nc_srcdir%g
143 s%@nc_top_srcdir@%$nc_top_srcdir%g
144 s%@INSTALL@%$NC_INSTALL%g
145 " $nc_file_inputs | (eval "$nc_sed_cmds") > $nc_file
146 fi; done
147 rm -f conftest.s*
148
149 # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
150 # NAME is the cpp macro being defined and VALUE is the value it is being given.
151 #
152 # nc_d sets the value in "#define NAME VALUE" lines.
153 nc_dA='s%^\([   ]*\)#\([        ]*define[       ][      ]*\)'
154 nc_dB='\([      ][      ]*\)[^  ]*%\1#\2'
155 nc_dC='\3'
156 nc_dD='%g'
157 # nc_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
158 nc_uA='s%^\([   ]*\)#\([        ]*\)undef\([    ][      ]*\)'
159 nc_uB='\([      ]\)%\1#\2define\3'
160 nc_uC=' '
161 nc_uD='\4%g'
162 # nc_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
163 nc_eA='s%^\([   ]*\)#\([        ]*\)undef\([    ][      ]*\)'
164 nc_eB='$%\1#\2define\3'
165 nc_eC=' '
166 nc_eD='%g'
167
168 NC_CONFIG_HEADERS="ncurses/ncurses_cfg.h:include/ncurses_cfg.hin"
169 for nc_file in .. $NC_CONFIG_HEADERS; do if test "x$nc_file" != x..; then
170   # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
171   case "$nc_file" in
172   *:*) nc_file_in=`echo "$nc_file"|sed 's%[^:]*:%%'`
173        nc_file=`echo "$nc_file"|sed 's%:.*%%'` ;;
174   *) nc_file_in="${nc_file}.in" ;;
175   esac
176
177   echo creating $nc_file
178
179   rm -f conftest.frag conftest.in conftest.out
180   nc_file_inputs=`echo $nc_file_in|sed -e "s%^%$nc_given_srcdir/%" -e "s%:% $nc_given_srcdir/%g"`
181   cat $nc_file_inputs > conftest.in
182
183   rm -f conftest.frag
184   cat >> conftest.frag <<CEOF
185
186 #define CC_HAS_INLINE_FUNCS 1
187 #define GCC_NORETURN __attribute__((noreturn))
188 #define GCC_PRINTF 1
189 #define GCC_SCANF 1
190 #define GCC_UNUSED __attribute__((unused))
191 #define GOOD_SELECT 1
192 #define HAVE_ISASCII 1
193 #define HAVE_BUILTIN_H 1
194 #define HAVE_DIRENT_H 1
195 #define HAVE_FCNTL_H 1
196 #define HAVE_FORM_H 1
197 #define HAVE_GETOPT_H 1
198 CEOF
199   cat >> conftest.frag <<CEOF
200 #define HAVE_GETTIMEOFDAY 1
201 #define HAVE_GETTTYNAM 1
202 #define HAVE_LIBFORM 1
203 #define HAVE_LIBMENU 1
204 #define HAVE_LIBPANEL 1
205 #define HAVE_LIMITS_H 1
206 #define HAVE_LINK 1
207 #define HAVE_LOCALE_H 1
208 #define HAVE_LONG_FILE_NAMES 1
209 #define HAVE_MEMCCPY 1
210 #define HAVE_MENU_H 1
211 #define HAVE_NC_ALLOC_H 1
212 CEOF
213   cat >> conftest.frag <<CEOF
214 #define HAVE_PANEL_H 1
215 #define HAVE_POLL 1
216 #define HAVE_POLL_H 1
217 #define HAVE_REGEX_H_FUNCS 1
218 #define HAVE_REMOVE 1
219 #define HAVE_SELECT 1
220 #define HAVE_SETBUF 1
221 #define HAVE_SETBUFFER 1
222 #define HAVE_SETVBUF 1
223 #define HAVE_SIGACTION 1
224 #define HAVE_SIGVEC 1
225 #define HAVE_SIZECHANGE 1
226 CEOF
227   cat >> conftest.frag <<CEOF
228 #define HAVE_STRDUP 1
229 #define HAVE_SYS_IOCTL_H 1
230 #define HAVE_SYS_PARAM_H 1
231 #define HAVE_SYS_SELECT_H 1
232 #define HAVE_SYS_TIMES_H 1
233 #define HAVE_SYS_TIME_H 1
234 #define HAVE_SYS_TIME_SELECT 1
235 #define HAVE_TCGETATTR 1
236 #define HAVE_TERMIOS_H 1
237 #define HAVE_TERMIO_H 1
238 #define HAVE_TIMES 1
239 #define HAVE_TTYENT_H 1
240 CEOF
241   cat >> conftest.frag <<CEOF
242 #define HAVE_TYPEINFO 1
243 #define HAVE_UNISTD_H 1
244 #define HAVE_USLEEP 1
245 #define HAVE_VALUES_H 1
246 #define HAVE_VFSCANF 1
247 #define HAVE_VSNPRINTF 1
248 #define HAVE_VSSCANF 1
249 #define NCURSES_EXT_FUNCS 1
250 #define NDEBUG 1
251 #define PURE_TERMINFO 1
252 #define RETSIGTYPE void
253 #define STDC_HEADERS 1
254 CEOF
255   cat >> conftest.frag <<CEOF
256 #define SYSTEM_NAME "linux-gnu"
257 #define TYPEOF_CHTYPE long
258 #define USE_DATABASE 1
259 #define USE_SCROLL_HINTS 1
260 CEOF
261   cat >> conftest.edit <<CEOF
262 /@DEFS@/r conftest.frag
263 /@DEFS@/d
264 CEOF
265 sed -f conftest.edit conftest.in > conftest.out
266 rm -f conftest.in
267 mv conftest.out conftest.in
268 rm -f conftest.edit conftest.frag
269
270   rm -f conftest.frag conftest.h
271   echo "/* $nc_file.  Generated automatically by configure.  */" > conftest.h
272   cat conftest.in >> conftest.h
273   rm -f conftest.in
274   if cmp -s $nc_file conftest.h 2>/dev/null; then
275     echo "$nc_file is unchanged"
276     rm -f conftest.h
277   else
278     # Remove last slash and all that follows it.  Not all systems have dirname.
279       nc_dir=`echo $nc_file|sed 's%/[^/][^/]*$%%'`
280       if test "$nc_dir" != "$nc_file" && test "$nc_dir" != .; then
281       # The file is in a subdirectory.
282       test ! -d "$nc_dir" && mkdir "$nc_dir"
283     fi
284     rm -f $nc_file
285     mv conftest.h $nc_file
286   fi
287 fi; done
288
289
290 SYS_NAME=`uname -a`
291 if test -z "$SYS_NAME"; then SYS_NAME=unknown;fi
292
293 NC_AWK=awk
294 BUILD_CC=${BUILD_CC-gcc}
295 NC_CC="${BUILD_CC} -I${nc_given_srcdir}/ncurses -Incurses -I${nc_given_srcdir}/include"
296 NC_CPP="${NC_CC} -E"
297 CF_LIST_MODELS="normal"
298 #WITH_ECHO="yes"
299 #WITH_OVERWRITE="yes"
300 nc_cxx_library="yes"
301 cf_cv_systype="Linux"
302 cf_cv_rel_version="4.2"
303 cf_cv_abi_version="4"
304 cf_cv_do_symlinks="yes"
305 cf_cv_rm_so_locs="no"
306
307
308 rm -f headers.sed headers.sh
309
310 echo creating headers.sh
311 cat >headers.sh <<NC_EOF
312 #!/bin/sh
313 # This shell script is generated by the 'configure' script.  It is invoked in a
314 # subdirectory of the build tree.  It generates a sed-script in the parent
315 # directory that is used to adjust includes for header files that reside in a
316 # subdirectory of /usr/include, etc.
317 PRG=""
318 while test \$# != 3
319 do
320 PRG="\$PRG \$1"; shift
321 done
322 DST=\$1
323 REF=\$2
324 SRC=\$3
325 echo installing \$SRC in \$DST
326 case \$DST in
327 /*/include/*)
328         TMP=\${TMPDIR-/tmp}/\`basename \$SRC\`
329         if test ! -f ../headers.sed ; then
330                 END=\`basename \$DST\`
331                 for i in \`cat \$REF/../*/headers |fgrep -v "#"\`
332                 do
333                         NAME=\`basename \$i\`
334                         echo "s/<\$NAME>/<\$END\/\$NAME>/" >> ../headers.sed
335                 done
336         fi
337         rm -f \$TMP
338         sed -f ../headers.sed \$SRC > \$TMP
339         eval \$PRG \$TMP \$DST
340         rm -f \$TMP
341         ;;
342 *)
343         eval \$PRG \$SRC \$DST
344         ;;
345 esac
346 NC_EOF
347
348 chmod 0755 headers.sh
349
350 echo creating ncurses/term.h
351 ${NC_AWK} -f ncurses/MKterm.h.awk ${nc_given_srcdir}/include/Caps > ncurses/term.h
352 sh ${nc_given_srcdir}/include/edit_cfg.sh ncurses/ncurses_cfg.h ncurses/term.h
353
354 echo creating ncurses/hashsize.h
355 sh ${nc_given_srcdir}/include/MKhashsize.sh ${nc_given_srcdir}/include/Caps > ncurses/hashsize.h
356
357 echo creating ncurses/parametrized.h
358 sh ${nc_given_srcdir}/include/MKparametrized.sh ${nc_given_srcdir}/include/Caps > ncurses/parametrized.h
359
360 echo creating ncurses/termsort.c
361 sh ${nc_given_srcdir}/progs/MKtermsort.sh "${NC_AWK}" ${nc_given_srcdir}/include/Caps > ncurses/termsort.c
362
363 echo creating ncurses/fallback.c
364 sh ${nc_given_srcdir}/ncurses/MKfallback.sh > ncurses/fallback.c
365
366 echo creating ncurses/lib_gen.c
367 sh ${nc_given_srcdir}/ncurses/MKlib_gen.sh "${NC_CPP}" "${NC_AWK}" < ncurses/curses.h > ncurses/lib_gen.c
368
369 echo creating ncurses/nomacros.h
370 sh ${nc_given_srcdir}/ncurses/MKlib_gen.sh "${NC_CPP}" "${NC_AWK}" < ncurses/curses.h | fgrep undef > ncurses/nomacros.h
371
372 echo creating ncurses/expanded.c
373 sh ${nc_given_srcdir}/ncurses/MKexpanded.sh "${NC_CPP}"
374 mv expanded.c ncurses/expanded.c
375
376 echo creating ncurses/comp_captab.c
377 ${NC_CC} -o make_hash -DMAIN_PROGRAM ${nc_given_srcdir}/ncurses/comp_hash.c
378 sh ${nc_given_srcdir}/ncurses/MKcaptab.awk "${NC_AWK}" ${nc_given_srcdir}/include/Caps > ncurses/comp_captab.c
379 rm -f make_hash
380
381 echo creating ncurses/lib_keyname.c
382 ${NC_AWK} -f ${nc_given_srcdir}/ncurses/MKkeyname.awk ${nc_given_srcdir}/ncurses/keys.list > ncurses/lib_keyname.c
383
384 echo creating ncurses/names.c and ncurses/codes.c
385 ${NC_AWK} -f ${nc_given_srcdir}/ncurses/MKnames.awk ${nc_given_srcdir}/include/Caps
386 cat namehdr boolnames boolfnames numnames numfnames strnames strfnames nameftr >ncurses/names.c
387 cat namehdr boolcodes numcodes strcodes codeftr > ncurses/codes.c
388 rm -f namehdr nameftr codeftr boolnames boolfnames boolcodes numnames numfnames numcodes strnames strfnames strcodes
389
390 echo creating ncurses/keys.tries
391 ${NC_CC} -o make_key ${nc_given_srcdir}/ncurses/make_keys.c
392 ./make_key ${nc_given_srcdir}/ncurses/keys.list > ncurses/keys.tries
393 rm -f make_key
394
395 echo creating ncurses/unctrl.c
396 echo | ${NC_AWK} -f ${nc_given_srcdir}/ncurses/MKunctrl.awk > ncurses/unctrl.c
397 echo creating ncurses/terminfo.5
398 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