]> ncurses.scripts.mit.edu Git - ncurses.git/blob - sysdeps/unix/sysv/linux/configure
ncurses 4.1
[ncurses.git] / sysdeps / unix / sysv / linux / configure
1 # Local configure fragment for ncurses/sysdeps/unix/sysv/linux.
2
3 glibc_nc_srcdir=${srcdir}/ncurses
4
5 NCURSES_MAJOR="`egrep '^NCURSES_MAJOR[  ]*=' $glibc_nc_srcdir/dist.mk | sed -e 's/^[^0-9]*//'`"
6 NCURSES_MINOR="`egrep '^NCURSES_MINOR[  ]*=' $glibc_nc_srcdir/dist.mk | sed -e 's/^[^0-9]*//'`"
7 NCURSES_PATCH="`egrep '^NCURSES_PATCH[  ]*=' $glibc_nc_srcdir/dist.mk | sed -e 's/^[^0-9]*//'`"
8 nc_cv_abi_version=${NCURSES_MAJOR}
9 nc_cv_rel_version=${NCURSES_MAJOR}.${NCURSES_MINOR}
10
11 rm -f ncurses/codes.c \
12         ncurses/comp_captab.c \
13         ncurses/curses.h \
14         ncurses/edit_man.sed \
15         ncurses/edit_man.sh \
16         ncurses/eti.h \
17         ncurses/expanded.c \
18         ncurses/fallback.c \
19         ncurses/form.h \
20         ncurses/hashsize.h \
21         ncurses/keys.tries \
22         ncurses/lib_gen.c \
23         ncurses/lib_keyname.c \
24         ncurses/menu.h \
25         ncurses/mf_common.h \
26         ncurses/names.c \
27         ncurses/ncurses_cfg.h \
28         ncurses/nomacros.h \
29         ncurses/panel.h \
30         ncurses/parametrized.h \
31         ncurses/run_tic.sh \
32         ncurses/term.h \
33         ncurses/termcap.h \
34         ncurses/terminfo.5 \
35         ncurses/termsort.c \
36         ncurses/unctrl.c \
37         ncurses/unctrl.h \
38         ncurses/config_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@% -DSYSTEM_NAME=\"Linux\ (glibc\ 2)\" -DPURE_TERMINFO=1 -DGCC_SCANF=1 -DGCC_PRINTF=1 -DGCC_UNUSED=__attribute__\(\(unused\)\) -DGCC_NORETURN=__attribute__\(\(noreturn\)\) -DHAVE_NC_ALLOC_H=1 -DHAVE_GETTIMEOFDAY=1 -DSTDC_HEADERS=1 -DHAVE_DIRENT_H=1 -DHAVE_REGEX_H=1 -DHAVE_FCNTL_H=1 -DHAVE_GETOPT_H=1 -DHAVE_LIMITS_H=1 -DHAVE_LOCALE_H=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_SYS_PARAM_H=1 -DHAVE_POLL_H=1 -DHAVE_SYS_SELECT_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_TIMES_H=1 -DHAVE_TERMIO_H=1 -DHAVE_TERMIOS_H=1 -DHAVE_TTYENT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_VALUES_H=1 -DCC_HAS_INLINE_FUNCS=1 -DHAVE_EXTERN_ERRNO=1 -DHAVE_EXTERN_SYS_ERRLIST=1 -DHAVE_GETTTYNAM=1 -DHAVE_MEMCCPY=1 -DHAVE_POLL=1 -DHAVE_SELECT=1 -DHAVE_SETBUF=1 -DHAVE_SETBUFFER=1 -DHAVE_SETVBUF=1 -DHAVE_SIGACTION=1 -DHAVE_SIGVEC=1 -DHAVE_STRDUP=1 -DHAVE_TCGETATTR=1 -DHAVE_TIMES=1 -DHAVE_USLEEP=1 -DHAVE_VFSCANF=1 -DHAVE_VSSCANF=1 -DRETSIGTYPE=void -DGOOD_SELECT=1 -DHAVE_BUILTIN_H=1 -DHAVE_TYPEINFO=1 -DHAVE_PANEL_H=1 -DHAVE_LIBPANEL=1 -DHAVE_MENU_H=1 -DHAVE_LIBMENU=1 -DHAVE_FORM_H=1 -DHAVE_LIBFORM=1 %g
46 s%@NCURSES_MAJOR@%$NCURSES_MAJOR%g
47 s%@NCURSES_MINOR@%$NCURSES_MINOR%g
48 s%@NCURSES_PATCH@%$NCURSES_PATCH%g
49 s%@nc_cv_rel_version@%$nc_cv_rel_version%g
50 s%@nc_cv_abi_version@%$nc_cv_abi_version%g
51 s%@nc_cv_builtin_bool@%1%g
52 s%@nc_cv_type_of_bool@%char%g
53
54 EOF
55
56 # Split the substitutions into bite-sized pieces for seds with
57 # small command number limits, like on Digital OSF/1 and HP-UX.
58 nc_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
59 nc_file=1 # Number of current file.
60 nc_beg=1 # First line for current file.
61 nc_end=$nc_max_sed_cmds # Line after last line for current file.
62 nc_more_lines=:
63 nc_sed_cmds=""
64 while $nc_more_lines; do
65   if test $nc_beg -gt 1; then
66     sed "1,${nc_beg}d; ${nc_end}q" conftest.subs > conftest.s$nc_file
67   else
68     sed "${nc_end}q" conftest.subs > conftest.s$nc_file
69   fi
70   if test ! -s conftest.s$nc_file; then
71     nc_more_lines=false
72     rm -f conftest.s$nc_file
73   else
74     if test -z "$nc_sed_cmds"; then
75       nc_sed_cmds="sed -f conftest.s$nc_file"
76     else
77       nc_sed_cmds="$nc_sed_cmds | sed -f conftest.s$nc_file"
78     fi
79     nc_file=`expr $nc_file + 1`
80     nc_beg=$nc_end
81     nc_end=`expr $nc_end + $nc_max_sed_cmds`
82   fi
83 done
84 if test -z "$nc_sed_cmds"; then
85   nc_sed_cmds=cat
86 fi
87
88 NC_CONFIG_FILES=${NC_CONFIG_FILES-"ncurses/config_h     ncurses/MKterm.h.awk    ncurses/curses.h        ncurses/termcap.h       ncurses/unctrl.h"}
89 for nc_file in .. $NC_CONFIG_FILES; do if test "x$nc_file" != x..; then
90   # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
91   case "$nc_file" in
92   *:*) nc_file_in=`echo "$nc_file"|sed 's%[^:]*:%%'`
93        nc_file=`echo "$nc_file"|sed 's%:.*%%'` ;;
94   *) nc_file_in=`echo "${nc_file}"| sed 's%ncurses%include%'`.in ;;
95   esac
96
97   # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
98
99   # Remove last slash and all that follows it.  Not all systems have dirname.
100   nc_dir=`echo $nc_file|sed 's%/[^/][^/]*$%%'`
101   if test "$nc_dir" != "$nc_file" && test "$nc_dir" != .; then
102     # The file is in a subdirectory.
103     test ! -d "$nc_dir" && mkdir "$nc_dir"
104     nc_dir_suffix="/`echo $nc_dir|sed 's%^\./%%'`"
105     # A "../" for each directory in $nc_dir_suffix.
106     nc_dots=`echo $nc_dir_suffix|sed 's%/[^/]*%../%g'`
107   else
108     nc_dir_suffix= nc_dots=
109   fi
110
111   echo creating "$nc_file"
112   rm -f "$nc_file"
113   configure_input="Generated automatically from `echo $nc_file_in|sed 's%.*/%%'` by configure."
114   case "$nc_file" in
115   *Makefile*) nc_comsub="1i\\
116 # $configure_input" ;;
117   *) nc_comsub= ;;
118   esac
119
120   nc_file_inputs=`echo $nc_file_in|sed -e "s%^%$glibc_nc_srcdir/%" -e "s%:% $glibc_nc_srcdir/%g"`
121   sed -e "$nc_comsub
122 s%@configure_input@%$configure_input%g
123 " $nc_file_inputs | (eval "$nc_sed_cmds") > $nc_file
124 fi; done
125 rm -f conftest.s*
126
127
128 SYS_NAME=`uname -a`
129 if test -z "$SYS_NAME"; then SYS_NAME=unknown;fi
130
131 AWK=awk
132 CC="gcc -I${glibc_nc_srcdir}/ncurses -Incurses -I${glibc_nc_srcdir}/include"
133 CPP="${CC} -E"
134 NC_LIST_MODELS="normal"
135 WITH_ECHO="yes"
136 WITH_OVERWRITE="yes"
137 nc_cxx_library="yes"
138 nc_cv_systype="Linux"
139 nc_cv_rel_version="4.1"
140 nc_cv_abi_version="4"
141 nc_cv_do_symlinks="yes"
142 nc_cv_rm_so_locs="no"
143
144
145
146
147
148
149
150
151 rm -f headers.sed headers.sh
152
153 echo creating headers.sh
154 cat >headers.sh <<NC_EOF
155 #!/bin/sh
156 # This shell script is generated by the 'configure' script.  It is invoked in a
157 # subdirectory of the build tree.  It generates a sed-script in the parent
158 # directory that is used to adjust includes for header files that reside in a
159 # subdirectory of /usr/include, etc.
160 PRG=""
161 while test \$# != 3
162 do
163 PRG="\$PRG \$1"; shift
164 done
165 DST=\$1
166 REF=\$2
167 SRC=\$3
168 echo installing \$SRC in \$DST
169 case \$DST in
170 /*/include/*)
171         TMP=\${TMPDIR-/tmp}/\`basename \$SRC\`
172         if test ! -f ../headers.sed ; then
173                 END=\`basename \$DST\`
174                 for i in \`cat \$REF/../*/headers |fgrep -v "#"\`
175                 do
176                         NAME=\`basename \$i\`
177                         echo "s/<\$NAME>/<\$END\/\$NAME>/" >> ../headers.sed
178                 done
179         fi
180         rm -f \$TMP
181         sed -f ../headers.sed \$SRC > \$TMP
182         eval \$PRG \$TMP \$DST
183         rm -f \$TMP
184         ;;
185 *)
186         eval \$PRG \$SRC \$DST
187         ;;
188 esac
189 NC_EOF
190
191 chmod 0755 headers.sh
192
193 ### Special editing.  We generate ncurses_cfg.h directly to allow all filenames
194 ### to be MSDOS-compatible, as well as to make the list of definitions be
195 ### dynamically determined by the configuration script -- a consideration when
196 ### doing type-clean development testing.
197
198 echo creating ncurses/ncurses_cfg.h
199 rm -f ncurses/ncurses_cfg.h
200 echo "/* generated by configure-script
201  * On host: $SYS_NAME
202  */
203 #ifndef NC_CONFIG_H
204 #define NC_CONFIG_H" >ncurses/ncurses_cfg.h
205 sed     -e '/^ -D/!d' \
206         -e 's/ -D/\
207 #define /g' \
208         -e 's/\(#define [A-Za-z_][A-Za-z0-9_]*\)=/\1    /g' \
209         -e 's/\\//g' \
210         ncurses/config_h | sort >>ncurses/ncurses_cfg.h
211 echo "
212         /* The C compiler may not treat these properly, but C++ has to */
213 #ifdef __cplusplus
214 #undef const
215 #undef inline
216 #else
217 #if defined(lint) || defined(TRACE)
218 #undef inline
219 #define inline /* nothing */
220 #endif
221 #endif
222
223 #endif /* NC_CONFIG_H */" >> ncurses/ncurses_cfg.h
224 echo removing ncurses/config_h
225 rm ncurses/config_h
226
227 echo creating ncurses/term.h
228 ${AWK} -f ncurses/MKterm.h.awk ${glibc_nc_srcdir}/include/Caps > ncurses/term.h
229 sh ${glibc_nc_srcdir}/include/edit_cfg.sh ncurses/ncurses_cfg.h ncurses/term.h
230
231 echo creating ncurses/hashsize.h
232 sh ${glibc_nc_srcdir}/include/MKhashsize.sh ${glibc_nc_srcdir}/include/Caps > ncurses/hashsize.h
233
234 echo creating ncurses/parametrized.h
235 sh ${glibc_nc_srcdir}/include/MKparametrized.sh ${glibc_nc_srcdir}/include/Caps > ncurses/parametrized.h
236
237 echo creating ncurses/termsort.c
238 sh ${glibc_nc_srcdir}/progs/MKtermsort.sh "${AWK}" ${glibc_nc_srcdir}/include/Caps > ncurses/termsort.c
239
240 echo creating ncurses/fallback.c
241 sh ${glibc_nc_srcdir}/ncurses/MKfallback.sh > ncurses/fallback.c
242
243 echo creating ncurses/lib_gen.c
244 sh ${glibc_nc_srcdir}/ncurses/MKlib_gen.sh "${CPP}" "${AWK}" < ncurses/curses.h > ncurses/lib_gen.c
245
246 echo creating ncurses/nomacros.h
247 sh ${glibc_nc_srcdir}/ncurses/MKlib_gen.sh "${CPP}" "${AWK}" < ncurses/curses.h | fgrep undef > ncurses/nomacros.h
248
249 echo creating ncurses/keys.tries
250 ${AWK} -f ${glibc_nc_srcdir}/ncurses/MKkeys.awk ${glibc_nc_srcdir}/ncurses/keys.list > ncurses/keys.tries
251
252 echo creating ncurses/expanded.c
253 sh ${glibc_nc_srcdir}/ncurses/MKexpanded.sh "${CPP}"
254 mv expanded.c ncurses/expanded.c
255
256 echo creating ncurses/comp_captab.c
257 ${CC} -o make_hash -DMAIN_PROGRAM ${glibc_nc_srcdir}/ncurses/comp_hash.c
258 sh ${glibc_nc_srcdir}/ncurses/MKcaptab.awk "${AWK}" ${glibc_nc_srcdir}/include/Caps > ncurses/comp_captab.c
259 rm -f make_hash
260
261 echo creating ncurses/lib_keyname.c
262 ${AWK} -f ${glibc_nc_srcdir}/ncurses/MKkeyname.awk ${glibc_nc_srcdir}/ncurses/keys.list > ncurses/lib_keyname.c
263
264 echo creating ncurses/names.c and ncurses/codes.c
265 ${AWK} -f ${glibc_nc_srcdir}/ncurses/MKnames.awk ${glibc_nc_srcdir}/include/Caps
266 cat namehdr boolnames boolfnames numnames numfnames strnames strfnames nameftr >ncurses/names.c
267 cat namehdr boolcodes numcodes strcodes codeftr > ncurses/codes.c
268 rm -f namehdr nameftr codeftr boolnames boolfnames boolcodes numnames numfnames numcodes strnames strfnames strcodes
269
270 echo creating ncurses/unctrl.c
271 echo | ${AWK} -f ${glibc_nc_srcdir}/ncurses/MKunctrl.awk > ncurses/unctrl.c
272 echo creating ncurses/terminfo.5
273 sh ${glibc_nc_srcdir}/man/MKterminfo.sh ${glibc_nc_srcdir}/man/terminfo.head ${glibc_nc_srcdir}/include/Caps ${glibc_nc_srcdir}/man/terminfo.tail > ncurses/terminfo.5