5243fb010dca31859f7f76e0e48d247b8ed66bac
[chise/xemacs-chise.git.1] / configure.in
1 dnl Define our own header notice with own copyright
2 define([AC_INIT_NOTICE],
3 [#### Configuration script for XEmacs.  Largely divergent from FSF.
4 #### Guess values for system-dependent variables and create Makefiles.
5 #### Generated automatically using autoconf version] AC_ACVERSION [
6 #### Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
7 #### Copyright (C) 1993-1995 Board of Trustees, University of Illinois.
8 #### Copyright (C) 1996, 1997 Sun Microsystems, Inc.
9 #### Copyright (C) 1995, 1996 Ben Wing.
10 #### Copyright (C) 1998, 1999 J. Kean Johnston.
11
12 ### Don't edit this script!
13 ### This script was automatically generated by the `autoconf' program
14 ### from the file `./configure.in'.
15 ### To rebuild it, execute the command
16 ###     autoconf
17 ### in the this directory.  You must have autoconf version 2.12 or later.
18
19 ### This file is part of XEmacs.
20
21 ### XEmacs is free software; you can redistribute it and/or modify it
22 ### under the terms of the GNU General Public License as published by
23 ### the Free Software Foundation; either version 2, or (at your
24 ### option) any later version.
25
26 ### XEmacs is distributed in the hope that it will be useful, but
27 ### WITHOUT ANY WARRANTY; without even the implied warranty of
28 ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
29 ### General Public License for more details.
30
31 ### You should have received a copy of the GNU General Public License
32 ### along with XEmacs; see the file COPYING.  If not, write to the Free
33 ### Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
34 ### 02111-1307, USA.
35
36 ### For usage, run `./configure --help'
37 ### For more detailed information on building and installing XEmacs,
38 ### read the file `INSTALL'.
39 ###
40 ### If configure succeeds, it leaves its status in config.status.
41 ### A log of configuration tests can be found in config.log.
42 ### If configure fails after disturbing the status quo,
43 ###     config.status is removed.
44 ])
45
46 dnl Since XEmacs has configuration requirements that autoconf cannot
47 dnl meet, this file is an unholy marriage of custom-baked
48 dnl configuration code and autoconf macros.
49
50 dnl We use the m4 quoting characters [ ] (as established by the
51 dnl autoconf system), so quote them like this: [[foo]]
52
53 AC_PREREQ(2.12)dnl
54 dnl Redefine some standard autoconf macros
55 dnl here is how XEmacs is different:
56 dnl - no cache file
57 dnl - non-standard options
58 dnl - suport for extra-verbosity
59 dnl - ordinary libs are handled separately from X libs (might be a mistake)
60 dnl - various random kludges (e.g. -with-dnet=no
61
62 dnl PRINT_VAR(var var ...)  prints values of shell variables
63 define([PRINT_VAR],[for var in patsubst([$1],[[
64 ]+],[ ]); do eval "echo \"$var = '\$$var'\""; done])
65
66 dnl Disable cache files:
67 dnl This is controversial, but I am convinced this is the right way to go,
68 dnl at least by default.  Otherwise there are too many surprises.
69 define([AC_CACHE_LOAD], )dnl
70 define([AC_CACHE_SAVE], )dnl
71 define([AC_CACHE_VAL], [
72 $2
73 ])dnl
74
75 dnl Redefine AC_TRY_RUN_NATIVE to not throw away stderr while running
76 dnl AC_TRY_RUN_NATIVE(PROGRAM, [ACTION-IF-TRUE [, ACTION-IF-FALSE]])
77 define([AC_TRY_RUN_NATIVE],
78 [cat > conftest.$ac_ext <<EOF
79 [#]line __oline__ "configure"
80 #include "confdefs.h"
81 [$1]
82 EOF
83 if AC_TRY_EVAL(ac_link) && test -s conftest && (./conftest; exit $?) 2>&AC_FD_CC
84 then
85 dnl Do not remove the temporary files here, so they can be examined.
86   ifelse([$2], , :, [$2])
87 else
88   conftest_rc="$?"
89   echo "configure: failed program was:" >&AC_FD_CC
90   cat conftest.$ac_ext >&AC_FD_CC
91 ifelse([$3], , , [  rm -fr conftest*
92   $3
93 ])dnl
94 fi
95 rm -fr conftest*])dnl AC_TRY_RUN_NATIVE
96
97
98 dnl Avoid spurious cross-compiling warnings from AC_TRY_RUN
99 dnl XEmacs is unlikely to ever cross-compile
100 define([AC_TRY_RUN],[AC_TRY_RUN_NATIVE([$1], [$2], [$3])])dnl
101
102 dnl Redefine AC_DEFINE* to provide more output if extra_verbose
103 dnl Set VARIABLE to VALUE, verbatim, or 1.
104 dnl AC_DEFINE(VARIABLE [, VALUE])
105 define([AC_DEFINE],
106 [{ test "$extra_verbose" = "yes" && cat << \EOF
107     Defining $1[]ifelse($#, 2, [ = $2],)
108 EOF
109 cat >> confdefs.h <<\EOF
110 [#define] $1 ifelse($#, 2, [$2], 1)
111 EOF
112 }
113 ])dnl AC_DEFINE
114
115 define([AC_DEFINE_UNQUOTED],
116 [{ test "$extra_verbose" = "yes" && cat << EOF
117     Defining $1[]ifelse($#, 2, [ = $2],)
118 EOF
119 cat >> confdefs.h <<EOF
120 [#define] $1 ifelse($#, 2, [$2], 1)
121 EOF
122 }
123 ])dnl AC_DEFINE_UNQUOTED
124
125 dnl redefine AC_CHECK_LIB in accordance with our own value of ac_link
126 dnl Add in extra kludgy check to support with_dnet=no
127 dnl Add in extra LDFLAGS arg, which PRECEDE libs
128 dnl Support --with-dnet=no
129
130 dnl AC_CHECK_LIB(LIBRARY, FUNCTION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
131 dnl             [, OTHER-LIBRARIES] [, LDFLAGS]]]])
132 define([AC_CHECK_LIB],
133 [ifelse([$1],dnet, [if test "$with_dnet" = "no" ; then
134 ac_cv_lib_dnet_dnet_ntoa=no
135 ifelse([$4], , , [$4]
136 )dnl
137 else
138 ])]
139 AC_CHECK_LIB_ORIG_HACKED([$1],[$2],[$3],[$4],[$5], [$6])
140 [ifelse([$1],dnet,[fi
141 ])]dnl
142 )dnl AC_CHECK_LIB
143
144 define([AC_CHECK_LIB_ORIG_HACKED],
145 [ifelse([$5],,AC_MSG_CHECKING([for $2 in -l$1]),
146 xe_msg_checking="for [$2] in -l[$1]"
147 test -n "[$5]" && xe_msg_checking="$xe_msg_checking using extra libs [$5]"
148 AC_MSG_CHECKING("$xe_msg_checking"))
149 dnl Use a cache variable name containing both the library and function name,
150 dnl because the test really is for library $1 defining function $2, not
151 dnl just for library $1.  Separate tests with the same $1 and different $2s
152 dnl may have different results.
153 ac_lib_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'`
154 AC_CACHE_VAL(ac_cv_lib_$ac_lib_var,
155 [xe_check_libs="$6 -l$1 $5"
156 AC_TRY_LINK(dnl
157 ifelse([$2], [main], , dnl Avoid conflicting decl of main.
158 [/* Override any gcc2 internal prototype to avoid an error.  */
159 ]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus
160 extern "C"
161 #endif
162 ])dnl
163 [/* We use char because int might match the return type of a gcc2
164     builtin and then its argument prototype would still apply.  */
165 char $2();
166 ]),
167             [$2()],
168             eval "ac_cv_lib_$ac_lib_var=yes",
169             eval "ac_cv_lib_$ac_lib_var=no")
170 xe_check_libs=""
171 ])dnl
172 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes" ; then
173   AC_MSG_RESULT(yes)
174   ifelse([$3], ,
175 [changequote(, )dnl
176   ac_tr_lib=HAVE_LIB`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \
177     -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
178 changequote([, ])dnl
179   AC_DEFINE_UNQUOTED($ac_tr_lib)
180   XE_PREPEND([-l$1], LIBS)
181 ], [$3])
182 else
183   AC_MSG_RESULT(no)
184 ifelse([$4], , , [$4
185 ])dnl
186 fi
187 ])dnl AC_CHECK_LIB_ORIG_HACKED
188
189
190 dnl AC_LANG_C()
191 define([AC_LANG_C],
192 [define([AC_LANG], [C])dnl
193 ac_ext=c
194 dnl CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
195 dnl ac_cpp='$CPP $CPPFLAGS'
196 dnl ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&AC_FD_CC'
197 dnl ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC'
198 xe_cppflags='$CPPFLAGS $c_switch_site $c_switch_machine $c_switch_system $c_switch_x_site $X_CFLAGS'
199 xe_ldflags='$LDFLAGS $ld_switch_site $ld_switch_machine $ld_switch_system $ld_switch_x_site $ld_switch_run'
200 xe_libs='$ld_call_shared $xe_check_libs $X_EXTRA_LIBS $libs_x $X_PRE_LIBS $LIBS $libs_machine $libs_system $libs_standard'
201 ac_cpp='$CPP '"$xe_cppflags"
202 ac_compile='${CC-cc} -c $CFLAGS '"$xe_cppflags"' conftest.$ac_ext 1>&AC_FD_CC'
203 ac_link='${CC-cc} -o conftest $CFLAGS '"$xe_cppflags $xe_ldflags"' conftest.$ac_ext '"$xe_libs"' 1>&AC_FD_CC'
204 cross_compiling=no
205 ]) dnl AC_LANG_C
206
207 dnl The construct foo=`echo $w1 $w2 $w3` fails on some systems if $w1 = -e or -n
208 dnl So we use the following instead.
209 dnl XE_SPACE(var, words)
210 define([XE_SPACE],[
211 T=""
212 for W in $2; do if test -z "$T"; then T="$W"; else T="$T $W"; fi; done
213 $1="$T"
214 ])dnl XE_SPACE
215
216 dnl XE_ADD_OBJS(foo.o ...)
217 define([XE_ADD_OBJS],
218 [extra_objs="$extra_objs [$1]" && dnl
219  if test "$extra_verbose" = "yes"; then
220    echo "    xemacs will be linked with \"[$1]\""
221  fi])dnl XE_ADD_OBJS
222
223 dnl XE_APPEND(value, varname)
224 define([XE_APPEND],
225 [[$2]="$[$2] [$1]" && dnl
226  if test "$extra_verbose" = "yes"; then echo "    Appending \"[$1]\" to \$[$2]"; fi])
227
228 dnl XE_PREPEND(value, varname)
229 define([XE_PREPEND],
230 [[$2]="[$1] $[$2]" && dnl
231  if test "$extra_verbose" = "yes"; then echo "    Prepending \"[$1]\" to \$[$2]"; fi])
232
233 dnl XE_DIE(message)
234 define([XE_DIE], [{ echo "Error:" $1 >&2; exit 1; }])
235
236 dnl XE_STRIP_4TH_COMPONENT(var)
237 dnl Changes i986-pc-linux-gnu to i986-pc-linux, as God (not RMS) intended.
238 define([XE_STRIP_4TH_COMPONENT],
239 [$1=`echo "$$1" | sed '[s/^\([^-][^-]*-[^-][^-]*-[^-][^-]*\)-.*$/\1/]'`])
240
241 dnl Initialize some variables set by options.
242 dnl The variables have the same names as the options, with
243 dnl dashes changed to underlines.
244
245 define([AC_INIT_PARSE_ARGS],[
246
247 dnl Get sane consistent behavior from various shells
248 dnl Avoid losing with weird user CDPATHs
249
250 if test -n "$ZSH_VERSION"; then
251   dnl zsh's Bourne shell emulation options
252   setopt NO_BAD_PATTERN NO_BANG_HIST NO_BG_NICE NO_EQUALS NO_FUNCTION_ARGZERO
253   setopt GLOB_SUBST NO_HUP INTERACTIVE_COMMENTS KSH_ARRAYS NO_MULTIOS NO_NOMATCH
254   setopt RM_STAR_SILENT POSIX_BUILTINS SH_FILE_EXPANSION SH_GLOB SH_OPTION_LETTERS
255   setopt SH_WORD_SPLIT BSD_ECHO IGNORE_BRACES
256   dnl zsh-3.1-beta drops core on the following
257   dnl unset CDPATH
258   if test -n "$CDPATH"; then CDPATH="."; export CDPATH; fi
259 elif test -n "$BASH_VERSION"; then
260   dnl Use Posix mode with bash
261   set -o posix
262   unset CDPATH
263 else
264   if test -n "$CDPATH"; then CDPATH="."; export CDPATH; fi
265 fi
266
267 dnl Initialize some variables set by options.
268 dnl The variables have the same names as the options, with
269 dnl dashes changed to underlines.
270 exec_prefix=NONE
271 host=NONE
272 no_create=
273 nonopt=NONE
274 no_recursion=
275 prefix=NONE
276 program_prefix=NONE
277 program_suffix=NONE
278 program_transform_name=s,x,x,
279 silent=
280 site=
281 srcdir=
282 target=NONE
283 verbose=
284 x_includes=NONE
285 x_libraries=NONE
286
287 dnl Installation directory options.
288 dnl These are left unexpanded so users can "make install exec_prefix=/foo"
289 dnl and all the variables that are supposed to be based on exec_prefix
290 dnl by default will actually change.
291 dnl Use braces instead of parens because sh, perl, etc. also accept them.
292 dnl If you change these, you need to synchronize with the settings of the
293 dnl various ..._USER_DEFINED variables further down.
294 bindir='${exec_prefix}/bin'
295 sbindir='${exec_prefix}/sbin'
296 libexecdir='${exec_prefix}/libexec'
297 datadir='${prefix}/share'
298 sysconfdir='${prefix}/etc'
299 sharedstatedir='${prefix}/com'
300 localstatedir='${prefix}/var'
301 libdir='${{exec_prefix}}/lib'
302 includedir='${prefix}/include'
303 oldincludedir='/usr/include'
304 infodir='${prefix}/info'
305 mandir='${prefix}/man'
306
307 dnl Initialize some other variables.
308 subdirs=
309 MFLAGS= MAKEFLAGS=
310 dnl Maximum number of lines to put in a shell here document.
311 ac_max_here_lines=12
312 ])dnl AC_INIT_PARSE_ARGS
313
314 AC_INIT(src/lisp.h)dnl
315 AC_CONFIG_HEADER(src/config.h lwlib/config.h)
316 dnl Remove any more than one leading "." element from the path name.
317 dnl If we do not remove them, then another "./" will be prepended to
318 dnl the file name each time we use config.status, and the program name
319 dnl will get larger and larger.  This would not be a problem, except
320 dnl that since progname gets recorded in all the Makefiles this script
321 dnl produces, move-if-change thinks they're different when they're
322 dnl not.
323 dnl
324 dnl It would be nice if we could put the ./ in a \( \) group and then
325 dnl apply the * operator to that, so we remove as many leading './././'s
326 dnl as are present, but some seds (like Ultrix's sed) don't allow you to
327 dnl apply * to a \( \) group.  Bleah.
328 progname="`echo $0 | sed 's:^\./\./:\./:'`"
329
330 dnl -----------------------------
331 dnl Establish some default values
332 dnl -----------------------------
333
334 XE_APPEND(lib-src, MAKE_SUBDIR)
335 XE_APPEND(lib-src, INSTALL_ARCH_DEP_SUBDIR)
336
337 prefix='/usr/local'
338 exec_prefix='${prefix}'
339 bindir='${exec_prefix}/bin'
340 dnl FSF 19.29 changes to:
341 dnl datadir='${prefix}/share'
342 dnl sharedstatedir='${prefix}/com'
343 dnl libexecdir='${exec_prefix}/libexec'
344 datadir='${prefix}/lib'
345 statedir='${prefix}/lib'
346 libdir='${exec_prefix}/lib'
347 mandir='${prefix}/man/man1'
348 infodir='${datadir}/${PROGNAME}-${version}/info'
349 infopath=''
350 install_pp=''
351 lispdir='${datadir}/${PROGNAME}-${version}/lisp'
352 moduledir='${datadir}/${PROGNAME}-${version}/${configuration}/modules'
353 sitelispdir='${datadir}/xemacs/site-lisp'
354 sitemoduledir='${datadir}/xemacs/site-modules'
355 pkgdir='${datadir}/${PROGNAME}-${version}/lisp'
356 package_path=''
357 etcdir='${datadir}/${PROGNAME}-${version}/etc'
358 lockdir='${statedir}/${PROGNAME}/lock'
359 archlibdir='${datadir}/${PROGNAME}-${version}/${configuration}'
360 with_site_lisp='no'
361 with_site_modules='yes'
362 with_menubars=''
363 with_scrollbars=''
364 with_dialogs=''
365 with_file_coding=''
366 dnl const_is_losing is removed - we rely on AC_C_CONST instead.
367 dnl We accept (and ignore) the --const-is-losing option for compatibility.
368 dnl const_is_losing='yes'
369 puresize=''
370 cpp='' cppflags='' libs='' ldflags=''
371 dynamic=''
372 with_x11=''
373 with_msw=''
374 rel_alloc='default'
375 with_system_malloc='default'
376 with_dlmalloc='default'
377 native_sound_lib=''
378 dnl use_assertions should be 'yes' by default.  Too many people in this
379 dnl world have core dumps turned off by default or \"cannot find where the
380 dnl core file went\".  At least we should get some useful output ...
381 use_assertions="yes"
382 dnl the following is set to yes or no later.
383 with_toolbars=""
384 with_tty=""
385 use_union_type="no"
386 with_dnet=""
387
388 dnl ------------------
389 dnl Options Processing
390 dnl ------------------
391
392 define([USAGE_ERROR],
393 [(echo "$progname: Usage error:"
394 echo " " $1
395 echo "  Use \`$progname --help' to show usage.") >&2 && exit 1])
396
397 dnl Record all the arguments, so we can save them in config.status.
398 arguments="$@"
399
400 dnl Shell Magic: Quote the quoted arguments in ARGUMENTS.  At a later date,
401 dnl in order to get the arguments back in $@, we have to do an
402 dnl 'eval set x "$quoted_arguments"; shift'
403 dnl # We use sed to turn embedded ' into '"'"'.  I truly hate sh quoting.
404 quoted_sed_magic=s/"'"/"'"'"'"'"'"'"'"/g
405 quoted_arguments=
406 for i in "$@"; do
407    case "$i" in
408    -no-create | --no-create | --no-creat | --no-crea | --no-cre \
409    | --no-cr | --no-c) ;;
410    -no-recursion | --no-recursion | --no-recursio | --no-recursi \
411    | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
412    *)
413    quoted_i="`echo '' $i | sed -e 's:^ ::' -e $quoted_sed_magic`"
414    quoted_arguments="$quoted_arguments '$quoted_i'" ;;
415    esac
416 done
417
418 dnl Do not use shift -- that destroys the argument list, which autoconf needs
419 dnl to produce config.status.  It turns out that "set - $arguments" does not
420 dnl work portably.
421 dnl However, it also turns out that many shells cannot expand ${10} at all.
422 dnl So using an index variable does not work either.  It is possible to use
423 dnl some shell magic to make 'set x "$arguments"; shift' work portably.
424 while test $# != 0; do
425   arg="$1"; shift
426   case "$arg" in
427     --no-create|--no-recursion) ;;
428     dnl Anything starting with a hyphen we assume is an option.
429     -* )
430       dnl Separate the switch name from the value it is being given.
431       case "$arg" in
432         -*=*)
433           opt=`echo '' $arg | sed -e 's:^ ::' -e 's:^-*\([[^=]]*\)=.*$:\1:'`
434           val=`echo '' $arg | sed -e 's:^ ::' -e 's:^-*[[^=]]*=\(.*\)$:\1:'`
435           valomitted=no
436         ;;
437            dnl special case these strings since echo may silently eat them:
438            dnl --help ) opt=help val=yes valomitted=yes ;;
439            dnl --version ) opt=version val=yes valomitted=yes ;;
440            dnl -e ) opt=e val=yes valomitted=yes ;;
441            dnl -E ) opt=E val=yes valomitted=yes ;;
442            dnl -n ) opt=n val=yes valomitted=yes ;;
443         -*)
444            dnl If FOO is a boolean argument, --FOO is equivalent to
445            dnl --FOO=yes.  Otherwise, the value comes from the next
446            dnl argument - see below.
447           opt=`echo '' $arg | sed -e 's:^ ::' -e 's:^-*\(.*\)$:\1:'`
448           val="yes" valomitted=yes
449         ;;
450       esac
451
452       dnl translate "-" in option string to "_"
453       optname="$opt"
454       opt="`echo '' $opt | sed -e 's:^ ::' | tr - _`"
455
456       dnl Support --without-FOO as a synonym for --with-FOO=no
457       case "${valomitted}-${opt}" in yes-without_* )
458         opt=`echo $opt | sed 's/without/with/'`
459         valomitted="no" val="no" ;;
460       esac
461
462       dnl Process the option.
463       case "$opt" in
464
465       dnl Process (many) boolean options
466         with_site_lisp  | \
467     with_site_modules | \
468         with_x          | \
469         with_x11        | \
470         with_msw        | \
471         with_gcc        | \
472         dynamic         | \
473         with_ncurses    | \
474         with_dnet       | \
475         with_socks      | \
476         with_dragndrop  | \
477         with_cde        | \
478         with_offix      | \
479         with_gpm        | \
480         with_xpm        | \
481         with_xface      | \
482         with_gif        | \
483         with_jpeg       | \
484         with_png        | \
485         with_tiff       | \
486         with_session    | \
487         with_xmu        | \
488         with_purify     | \
489         with_quantify   | \
490         with_toolbars   | \
491         with_tty        | \
492         with_xfs        | \
493         with_i18n3      | \
494         with_mule       | \
495         with_file_coding| \
496         with_canna      | \
497         with_wnn        | \
498         with_wnn6       | \
499         with_workshop   | \
500         with_sparcworks | \
501         with_tooltalk   | \
502         with_ldap       | \
503         with_pop        | \
504         with_kerberos   | \
505         with_hesiod     | \
506         with_dnet       | \
507         with_infodock   | \
508         external_widget | \
509         verbose         | \
510         extra_verbose   | \
511         const_is_losing | \
512         usage_tracking  | \
513         use_union_type  | \
514         debug           | \
515         use_assertions  | \
516         gung_ho         | \
517         use_minimal_tagbits                     | \
518         use_indexed_lrecord_implementation      | \
519         memory_usage_stats | \
520         with_clash_detection | \
521         with_shlib | \
522         no_doc_file )
523           dnl Make sure the value given was either "yes" or "no".
524           case "$val" in
525             y | ye | yes )      val=yes ;;
526             n | no )            val=no  ;;
527             * ) USAGE_ERROR("The \`--$optname' option requires a boolean value: \`yes' or \`no'.") ;;
528           esac
529           eval "$opt=\"$val\"" ;;
530
531
532         dnl Options that take a user-supplied value, as in --puresize=8000000
533         dnl The cache-file option is ignored (for compatibility with other configures)
534         srcdir          | \
535         compiler        | \
536         cflags          | \
537         cpp             | \
538         cppflags        | \
539         libs            | \
540         ldflags         | \
541         puresize        | \
542         cache_file      | \
543         native_sound_lib| \
544         site_lisp       | \
545         x_includes      | \
546         x_libraries     | \
547         site_includes   | \
548         site_libraries  | \
549         site_prefixes   | \
550         site_runtime_libraries )
551           dnl If the value was omitted, get it from the next argument.
552           if test "$valomitted" = "yes" ; then
553             dnl Get the next argument from the argument list, if there is one.
554             if test "$#" = 0 ; then
555               USAGE_ERROR("The \`--$optname' option requires a value.");
556             fi
557             val="$1"; shift
558           fi
559           eval "$opt=\"$val\""
560         ;;
561
562         dnl Options that take "yes", "no", or "default" values
563         rel_alloc | \
564         with_dlmalloc | \
565         with_debug_malloc  | use_debug_malloc | \
566         with_system_malloc | use_system_malloc )
567           case "$val" in
568             y | ye | yes )      val=yes ;;
569             n | no )            val=no  ;;
570             d | de | def | defa | defau | defaul | default ) val=default ;;
571             * ) USAGE_ERROR(["The \`--$optname' option requires one of these values:
572   \`yes', \`no', or \`default'."]) ;;
573           esac
574           case "$opt" in use_* ) opt="`echo $opt | sed s/use/with/`" ;; esac
575           eval "$opt=\"$val\""
576         ;;
577
578         dnl Has the user requested database support?
579         "with_database" )
580           with_database_berkdb=no
581           with_database_dbm=no
582           with_database_gnudbm=no
583           for x in `echo "$val" | sed -e 's/,/ /g'` ; do
584             case "$x" in
585                 no ) ;;
586                 b | be | ber | berk | berkd | berkdb )  with_database_berkdb=yes ;;
587                 d | db | dbm )                          with_database_dbm=yes    ;;
588                 g | gn | gnu | gnud | gnudb | gnudbm )  with_database_gnudbm=yes ;;
589                 * ) USAGE_ERROR(["The \`--$optname' option value
590   must be either \`no' or a comma-separated list
591   of one or more of \`berkdb' and either \`dbm' or \`gnudbm'."]) ;;
592             esac
593           done
594           if test "$with_database_dbm"    = "yes" -a \
595                   "$with_database_gnudbm" = "yes"; then
596           USAGE_ERROR("Only one of \`dbm' and \`gnudbm' may be specified
597   with the \`--$optname' option.")
598           fi
599         ;;
600
601         dnl Has the user requested sound support?
602         "with_sound" )
603           dnl value can be native, nas or both. yes is allowed
604           dnl as a backwards compatible synonym for native
605           case "$val" in
606             y | ye | yes )                      val=native ;;
607             n | no | non | none )               val=no;;
608             na | nat | nati | nativ | native )  val=native  ;;
609             ne | net | neta | netau | netaud | netaudi | netaudio | nas ) val=nas  ;;
610             b | bo | bot | both )               val=both;;
611             * ) USAGE_ERROR(["The \`--$optname' option must have one of these values:
612   \`native', \`nas', \`both', or \`none'."]) ;;
613           esac
614           eval "$opt=\"$val\""
615         ;;
616
617         dnl Has the user requested XIM support?
618         "with_xim" )
619           case "$val" in
620             y | ye | yes )                val=yes   ;;
621             n | no | non | none )         val=no    ;;
622             x | xl | xli | xlib )         val=xlib  ;;
623             m | mo | mot | moti | motif ) val=motif ;;
624             * ) USAGE_ERROR(["The \`--$optname' option must have one of these values:
625   \`motif', \`xlib', \`yes', or \`no'."]) ;;
626           esac
627           eval "$opt=\"$val\""
628         ;;
629
630         dnl Mail locking specification
631         "mail_locking" )
632           case "$val" in
633             lockf )     val=lockf ;;
634             flock )     val=flock ;;
635             file )      val=file  ;;
636             * ) USAGE_ERROR(["The \`--$optname' option must have one of these values:
637   \`lockf', \`flock', or \`file'."]) ;;
638           esac
639           eval "$opt=\"$val\""
640         ;;
641
642         dnl Has the user requested error-checking?
643         "error_checking" )
644           dnl value can be all, none, and/or a list of categories to check.
645           dnl Example: --error-checking=all,noextents,nobufpos
646           dnl Example: --error-checking=none,malloc,gc
647
648           for x in `echo "$val" | sed -e 's/,/ /g'` ; do
649             case "$x" in
650               dnl all and none are only permitted as the first in the list.
651               n | no | non | none ) new_default=no ;;
652               a | al | all )        new_default=yes ;;
653
654               extents )       error_check_extents=yes ;;
655               noextents )     error_check_extents=no ;;
656
657               typecheck )     error_check_typecheck=yes ;;
658               notypecheck )   error_check_typecheck=no ;;
659
660               bufpos )        error_check_bufpos=yes ;;
661               nobufpos )      error_check_bufpos=no ;;
662
663               gc )            error_check_gc=yes ;;
664               nogc )          error_check_gc=no ;;
665
666               malloc )        error_check_malloc=yes ;;
667               nomalloc )      error_check_malloc=no ;;
668
669               * ) bogus_error_check=yes ;;
670             esac
671             if test "$bogus_error_check" -o \
672                  \( -n "$new_default" -a -n "$echeck_notfirst" \) ; then
673                 if test "$error_check_default" = yes ; then
674                   types="\`all' (default), \`none', \`noextents', \`notypecheck', \`nobufpos', \`nogc', and \`nomalloc'."
675                 else
676                   types="\`all', \`none' (default), \`extents', \`typecheck', \`bufpos', \`gc', and \`malloc'."
677                 fi
678                 USAGE_ERROR(["Valid types for the \`--$optname' option are:
679   $types."])
680             elif test -n "$new_default" ; then
681                 error_check_extents=$new_default
682                 error_check_typecheck=$new_default
683                 error_check_bufpos=$new_default
684                 error_check_gc=$new_default
685                 error_check_malloc=$new_default
686                 new_default=    # reset this
687             fi
688             echeck_notfirst=true
689           done
690         ;;
691
692         dnl Has the user tried to tell us where the X files are?
693         dnl I think these are dopey, but no less than three alpha
694         dnl testers, at large sites, have said they have their X files
695         dnl installed in odd places.
696
697         dnl Has the user specified one of the path options?
698         prefix | exec_prefix | bindir | datadir | statedir | libdir | \
699         mandir | infodir | infopath | lispdir | etcdir | lockdir | pkgdir | \
700         archlibdir | docdir | package_path )
701            dnl If the value was omitted, get it from the next argument.
702            if test "$valomitted" = "yes"; then
703              if test "$#" = 0; then
704                  USAGE_ERROR("The \`--$optname' option requires a value.");
705              fi
706              val="$1"; shift
707            fi
708            eval "$opt=\"$val\""
709
710            dnl You need to synchronize this with the way the
711            dnl default values are built.
712            case "$opt" in
713              lispdir ) AC_DEFINE(LISPDIR_USER_DEFINED) ;;
714              sitelispdir ) AC_DEFINE(SITELISPDIR_USER_DEFINED) ;;
715              moduledir ) AC_DEFINE(MODULEDIR_USER_DEFINED) ;;
716              etcdir  )  AC_DEFINE(ETCDIR_USER_DEFINED) ;;
717              infodir ) AC_DEFINE(INFODIR_USER_DEFINED) ;;
718              infopath ) AC_DEFINE(INFOPATH_USER_DEFINED) ;;
719              package_path ) AC_DEFINE(PACKAGE_PATH_USER_DEFINED) ;;
720              datadir )
721                 AC_DEFINE(INFODIR_USER_DEFINED)
722                 AC_DEFINE(LISPDIR_USER_DEFINED)
723             AC_DEFINE(MODULEDIR_USER_DEFINED)
724                 AC_DEFINE(ETCDIR_USER_DEFINED) ;;
725              statedir | lockdir ) AC_DEFINE(LOCKDIR_USER_DEFINED) ;;
726              exec_prefix | libdir | archlibdir ) AC_DEFINE(ARCHLIBDIR_USER_DEFINED) ;;
727            esac
728         ;;
729
730         dnl --no-create added by autoconf for use by config.status
731         "no_create" ) ;;
732
733         dnl Has the user asked for some help?
734         "usage" | "help" ) ${PAGER-more} ${srcdir}/configure.usage; exit 0 ;;
735
736         dnl Has the user specified the toolkit(s) to use for GUI elements?
737         "with_menubars"   | \
738         "with_scrollbars" | \
739         "with_dialogs" )
740           case "$val" in
741             l | lu | luc | luci | lucid )               val=lucid  ;;
742             m | mo | mot | moti | motif )               val=motif  ;;
743             athena3d | athena-3d )                      val=athena3d ;;
744             a | at | ath | athe | athen | athena )      val=athena ;;
745             n | no | non | none )                       val=no ;;
746             * ) USAGE_ERROR(["The \`--$optname' option must have one of these values:
747   \`lucid', \`motif', \`athena', \`athena3d', or \`no'."]) ;;
748           esac
749           eval "$opt=\"$val\""
750         ;;
751
752         dnl Obsolete legacy argument?  Warn, but otherwise ignore.
753         "run_in_place"  | \
754         "with_gnu_make" )
755           AC_MSG_WARN([Obsolete option \`--$optname' ignored.])
756         ;;
757
758         dnl Unrecognized option?  No mercy for user errors.
759         * ) USAGE_ERROR("Unrecognized option: $arg") ;;
760
761       esac
762     ;;
763
764     dnl Assume anything with multiple hyphens is a configuration name.
765     *-*-*) configuration="$arg" ;;
766
767     dnl Unrecognized argument?  No mercy for user errors.
768     *) USAGE_ERROR("Unrecognized argument: $arg") ;;
769
770   esac
771 done
772
773 dnl -------------------------
774 dnl Finish options processing
775 dnl -------------------------
776
777 dnl Several options are equivalent to, and override, environment variables.
778 test -n "$cpp"      && CPP="$cpp"
779 test -n "$cppflags" && CPPFLAGS="$cppflags"
780 test -n "$libs"     && LIBS="$libs"
781 test -n "$ldflags"  && LDFLAGS="$ldflags"
782
783 dnl Get the arguments back.  See the diatribe on Shell Magic above.
784 eval set x "$quoted_arguments"; shift
785
786 dnl --extra-verbose implies --verbose
787 test "$extra_verbose" = "yes" && verbose=yes
788
789 dnl with_x is an obsolete synonym for with_x11
790 test -n "$with_x" && with_x11="$with_x"
791
792 dnl --with-quantify or --with-purify imply --use-system-malloc
793 if test "$with_purify" = "yes" -o "$with_quantify" = "yes"; then
794   test "$with_system_malloc" = "default" && with_system_malloc=yes
795 fi
796
797 dnl --gung-ho=val is a synonym for
798 dnl --use-minimal-tagbits=val --use-indexed-lrecord-implementation=val
799 if test -n "$gung_ho"; then
800   test -z "$use_minimal_tagbits" && use_minimal_tagbits="$gung_ho"
801   test -z "$use_indexed_lrecord_implementation" && \
802     use_indexed_lrecord_implementation="$gung_ho"
803 fi
804 if test "$use_minimal_tagbits" = "no"; then
805   test "$with_dlmalloc" = "yes" && \
806     USAGE_ERROR("--with-dlmalloc requires --use-minimal-tagbits")
807   with_dlmalloc=no
808 fi
809
810 dnl XE_CHECK_FEATURE_DEPENDENCY(feature1, feature2)
811 define([XE_CHECK_FEATURE_DEPENDENCY],
812 [if test "$with_$1 $with_$2" = "yes no"; then
813   USAGE_ERROR("--with-$1 requires --with-$2")
814 elif test "$with_$2" = "no" ; then with_$1=no
815 elif test "$with_$1" = "yes"; then with_$2=yes
816 fi
817 ])
818
819 dnl CDE requires tooltalk
820 XE_CHECK_FEATURE_DEPENDENCY(cde, tooltalk)
821
822 dnl Find the source directory.
823 case "$srcdir" in
824
825   dnl If srcdir is not specified, see if  "." or ".." might work.
826   "" )
827     for dir in "`echo $0 | sed 's|//|/|' | sed 's|/[[^/]]*$||'`" "." ".." ; do
828       if test -f "$dir/src/lisp.h" -a \
829               -f "$dir/lisp/version.el" ; then
830         srcdir="$dir"
831         break
832       fi
833     done
834     if test -z "$srcdir" ; then
835       USAGE_ERROR(["Neither the current directory nor its parent seem to
836   contain the XEmacs sources.  If you do not want to build XEmacs in its
837   source tree, you should run \`$progname' in the directory in which
838   you wish to build XEmacs, using the \`--srcdir' option to say where the
839   sources may be found."])
840     fi
841   ;;
842
843   dnl Otherwise, check if the directory they specified is okay.
844   * )
845     if test ! -f "$srcdir/src/lisp.h" -o \
846             ! -f "$srcdir/lisp/version.el" ; then
847       USAGE_ERROR(["The directory specified with the \`--srcdir' option,
848   \`$srcdir', doesn't seem to contain the XEmacs sources.  You should
849   either run the \`$progname' script at the top of the XEmacs source
850   tree, or use the \`--srcdir' option to specify the XEmacs source directory."])
851     fi
852   ;;
853 esac
854
855 dnl ###########################################################################
856 if test -z "$configuration"; then
857   dnl Guess the configuration
858   configuration=`${CONFIG_SHELL-/bin/sh} $srcdir/config.guess`
859   if test -z "$configuration"; then
860     USAGE_ERROR(["XEmacs has not been ported to this host type.
861 Try explicitly specifying the CONFIGURATION when rerunning configure."])
862   fi
863 fi
864
865 AC_PROG_LN_S
866
867 dnl Make symlinks for etc, lisp, and info directories while the path
868 dnl is still relative.  We do not symlink lock because someone may
869 dnl have stuck the source on a read-only partition.  Instead we
870 dnl create it as an actual directory later on if it does not already
871 dnl exist.
872 for dir in lisp etc man info; do
873   if test ! -d "$dir" ; then
874     echo Making symbolic link to "$srcdir/$dir"
875     ${LN_S} "$srcdir/$dir" "$dir"
876   fi
877 done
878
879 dnl Calculate canonical name for blddir (i.e. current directory).
880 dnl PWD may already be the preferable absolute name for ".",
881 dnl but we can't trust it - it is sometimes inaccurate.
882 absolute_pwd="`pwd`";
883 if test -n "$PWD" -a "`cd $PWD && pwd`" = "$absolute_pwd"
884 then blddir="$PWD"
885 else blddir="$absolute_pwd"
886 fi
887 AC_SUBST(blddir)
888
889 dnl Make srcdir absolute, if not already.  It is important to
890 dnl avoid running the path through pwd unnecessary, since pwd can
891 dnl give you automounter prefixes, which can go away.
892 case "$srcdir" in
893   /* ) ;;
894   .  ) srcdir="$blddir" ;;
895   *  ) srcdir="`cd $srcdir && pwd`" ;;
896 esac
897
898 dnl Check if the source directory already has a configured system in it.
899 if test `pwd` != `sh -c cd $srcdir && pwd`  \
900    && test -f "$srcdir/src/config.h"; then
901   (echo "$progname: WARNING: The directory tree \`$srcdir' is being used"
902    echo "   as a build directory right now; it has been configured in its own"
903    echo "   right.  To configure in another directory as well, you MUST"
904    echo "   use GNU make.  If you do not have GNU make, then you must"
905    echo "   now do \`make distclean' in $srcdir,"
906    echo "   and then run $progname again.") >&2
907   extrasub='/^VPATH[[    ]]*=/c\
908 vpath %.c $(srcdir)\
909 vpath %.h $(srcdir)\
910 vpath %.y $(srcdir)\
911 vpath %.l $(srcdir)\
912 vpath %.s $(srcdir)\
913 vpath %.in $(srcdir)'
914 fi
915
916 dnl ----------------------------------------
917 dnl Find out which version of XEmacs this is
918 dnl ----------------------------------------
919 . "$srcdir/version.sh" || exit 1;
920 dnl Must do the following first to determine verbosity for AC_DEFINE
921 if test -n "$emacs_beta_version"; then beta=yes; else beta=no; fi
922 : "${extra_verbose=$beta}"
923 version="${emacs_major_version}.${emacs_minor_version}"
924 AC_DEFINE_UNQUOTED(EMACS_MAJOR_VERSION, $emacs_major_version)
925 AC_DEFINE_UNQUOTED(EMACS_MINOR_VERSION, $emacs_minor_version)
926 if test -n "$emacs_beta_version"; then
927   version="${version}-b${emacs_beta_version}"
928   AC_DEFINE_UNQUOTED(EMACS_BETA_VERSION, $emacs_beta_version)
929 fi
930 AC_DEFINE_UNQUOTED(XEMACS_CODENAME, "$xemacs_codename")
931 AC_DEFINE_UNQUOTED(EMACS_VERSION, "$version")
932
933 if test "$with_infodock" = "yes"; then
934   if test ! -f ../ID-INSTALL; then
935     echo "Cannot build InfoDock without InfoDock sources"
936     with_infodock=no
937   fi
938 fi
939
940 if test "$with_infodock" = "yes"; then
941   dnl InfoDock version numbers.  XEmacs will use the same style of numbering
942   dnl after the release of XEmacs 21.0.
943   AC_DEFINE_UNQUOTED(INFODOCK_MAJOR_VERSION, $infodock_major_version)
944   AC_DEFINE_UNQUOTED(INFODOCK_MINOR_VERSION, $infodock_minor_version)
945   AC_DEFINE_UNQUOTED(INFODOCK_BUILD_VERSION, $infodock_build_version)
946   version=${infodock_major_version}.${infodock_minor_version}.${infodock_build_version}
947   PROGNAME=infodock
948   CPPFLAGS="$CPPFLAGS -DINFODOCK"
949 else
950   PROGNAME=xemacs
951 fi
952
953 dnl ----------------------------------
954 dnl Error checking and debugging flags
955 dnl ----------------------------------
956 dnl Error checking default to "yes" in beta versions, to "no" in releases.
957 dnl Same goes for --debug and --extra-verbosity.
958 if test -n "$emacs_beta_version"; then beta=yes; else beta=no; fi
959 test "${error_check_extents=$beta}"   = yes && AC_DEFINE(ERROR_CHECK_EXTENTS)
960 test "${error_check_typecheck=$beta}" = yes && AC_DEFINE(ERROR_CHECK_TYPECHECK)
961 test "${error_check_bufpos=$beta}"    = yes && AC_DEFINE(ERROR_CHECK_BUFPOS)
962 test "${error_check_gc=$beta}"        = yes && AC_DEFINE(ERROR_CHECK_GC)
963 test "${error_check_malloc=$beta}"    = yes && AC_DEFINE(ERROR_CHECK_MALLOC)
964 dnl debug=yes must be set when error checking is present.  This should be
965 dnl fixed up.
966 dnl debug implies other options
967 if test "${debug:=$beta}" = "yes"; then
968   use_assertions=yes memory_usage_stats=yes
969   XE_ADD_OBJS(debug.o)
970   AC_DEFINE(DEBUG_XEMACS)
971 fi
972 test "$use_assertions"     = "yes" && AC_DEFINE(USE_ASSERTIONS)
973 test "$memory_usage_stats" = "yes" && AC_DEFINE(MEMORY_USAGE_STATS)
974
975 dnl ------------------------------
976 dnl Determine the s&m files to use
977 dnl ------------------------------
978 dnl Given the configuration name, set machfile and opsysfile to the
979 dnl names of the m/*.h and s/*.h files we should use.
980
981 dnl Canonicalize the configuration name.
982 AC_MSG_CHECKING("host system type")
983 dnl allow -workshop suffix on configuration name
984 internal_configuration=`echo $configuration | sed 's/-\(workshop\)//'`
985 canonical=`${CONFIG_SHELL-/bin/sh} $srcdir/config.sub "$internal_configuration"`
986 XE_STRIP_4TH_COMPONENT(configuration)
987 XE_STRIP_4TH_COMPONENT(canonical)
988 AC_MSG_RESULT($configuration)
989
990 dnl If you add support for a new configuration, add code to this
991 dnl switch statement to recognize your configuration name and select
992 dnl the appropriate operating system and machine description files.
993
994 dnl You would hope that you could choose an m/*.h file pretty much
995 dnl based on the machine portion of the configuration name, and an s-
996 dnl file based on the operating system portion.  However, it turns out
997 dnl that each m/*.h file is pretty manufacturer-specific - for
998 dnl example, apollo.h, hp9000s300.h, mega68k, news.h, and tad68k are
999 dnl all 68000 machines; mips.h, pmax.h, and news-risc are all MIPS
1000 dnl machines.  So we basically have to have a special case for each
1001 dnl configuration name.
1002
1003 dnl As far as handling version numbers on operating systems is
1004 dnl concerned, make sure things will fail in a fixable way.  If
1005 dnl /etc/MACHINES says nothing about version numbers, be
1006 dnl prepared to handle anything reasonably.  If version numbers
1007 dnl matter, be sure /etc/MACHINES says something about it.
1008
1009 dnl Eric Raymond says we should accept strings like "sysvr4" to mean
1010 dnl "System V Release 4"; he writes, "The old convention encouraged"
1011 dnl "confusion between `system' and `release' levels'."
1012
1013 machine='' opsys=''
1014
1015 dnl Straightforward machine determination
1016 case "$canonical" in
1017   sparc-*-*        ) machine=sparc ;;
1018   alpha*-*-*       ) machine=alpha ;;
1019   vax-*-*          ) machine=vax ;;
1020   mips-dec-*       ) machine=pmax ;;
1021   mips-sgi-*       ) machine=iris4d ;;
1022   romp-ibm-*       ) machine=ibmrt ;;
1023   rs6000-ibm-aix*  ) machine=ibmrs6000 ;;
1024   powerpc-ibm-aix* ) machine=ibmrs6000 ;;
1025   powerpc*-*       ) machine=powerpc ;;
1026   hppa-*-*         ) machine=hp800 ;;
1027   m88k-dg-*        ) machine=aviion ;;
1028   m68*-sony-*      ) machine=news ;;
1029   mips-sony-*      ) machine=news-risc ;;
1030   clipper-*        ) machine=clipper ;;
1031   arm-*            ) machine=arm ;;
1032   ns32k-*          ) machine=ns32000 ;;
1033 esac
1034
1035 dnl Straightforward OS determination
1036 case "$canonical" in
1037   *-*-linux*    ) opsys=linux ;;
1038   *-*-netbsd*   ) opsys=netbsd ;;
1039   *-*-openbsd*  ) opsys=openbsd ;;
1040   *-*-nextstep* ) opsys=nextstep ;;
1041   *-*-vms       ) opsys=vms ;;
1042
1043   dnl DEC OSF
1044   *-dec-osf1.3 | *-dec-osf2* ) opsys=decosf1-3 ;;
1045   *-dec-osf1.2 | *-dec-osf1* ) opsys=decosf1-2 ;;
1046   *-dec-osf3.[[2-9]]         ) opsys=decosf3-2 ;;
1047   *-dec-osf3*                ) opsys=decosf3-1 ;;
1048   *-dec-osf4*                ) opsys=decosf4-0 ;;
1049
1050   dnl DEC Ultrix
1051   *-*-ultrix[[0-3]].* | *-*-ultrix4.0* ) opsys=bsd4-2 ;;
1052   *-*-ultrix4.[[12]]* ) opsys=bsd4-3 ;;
1053   *-*-ultrix* )         opsys=ultrix4-3 ;;
1054
1055   dnl AIX
1056   *-*-aix3.1*  ) opsys=aix3-1   ;;
1057   *-*-aix3.2.5 ) opsys=aix3-2-5 ;;
1058   *-*-aix3*    ) opsys=aix3-2   ;;
1059   *-*-aix4.0*  ) opsys=aix4     ;;
1060   *-*-aix4.1*  ) opsys=aix4-1   ;;
1061   *-*-aix4*    ) opsys=aix4-2   ;;
1062
1063   dnl Other generic OSes
1064   *-gnu* )                      opsys=gnu    ;;
1065   *-*-bsd4.[[01]] )             opsys=bsd4-1 ;;
1066   *-*-bsd4.2 )                  opsys=bsd4-2 ;;
1067   *-*-bsd4.3 )                  opsys=bsd4-3 ;;
1068   *-*-aos4.2 )                  opsys=bsd4-2 ;;
1069   *-*-aos*   )                  opsys=bsd4-3 ;;
1070   *-*-sysv0    | *-*-sysvr0 )   opsys=usg5-0 ;;
1071   *-*-sysv2    | *-*-sysvr2 )   opsys=usg5-2 ;;
1072   *-*-sysv2.2  | *-*-sysvr2.2 ) opsys=usg5-2-2 ;;
1073   *-*-sysv3*   | *-*-sysvr3* )  opsys=usg5-3 ;;
1074   *-*-sysv4.1* | *-*-sysvr4.1* )opsys=usg5-4 NON_GNU_CPP=/usr/lib/cpp ;;
1075   *-*-sysv4.[[2-9]]* | *-sysvr4.[[2-9]]* )
1076         if test -z "$NON_GNU_CPP" ; then
1077           for prog in "/usr/ccs/lib/cpp" "/lib/cpp"; do
1078             if test -f "$prog"; then NON_GNU_CPP="$prog"; break; fi
1079           done
1080         fi
1081         opsys=usg5-4-2 ;;
1082     *-sysv4* | *-sysvr4* )      opsys=usg5-4 ;;
1083     *-*-mach_bsd4.3* )          opsys=mach-bsd4-3 ;;
1084 esac
1085
1086 case "$canonical" in
1087
1088   dnl NetBSD ports
1089   *-*-netbsd* )
1090     case "$canonical" in
1091       i[[3-9]]86-*-netbsd*) machine=intel386 ;;
1092       hp300-*-netbsd* | amiga-*-netbsd* | sun3-*-netbsd* | mac68k-*-netbsd* | da30-*-netbsd* | m68k-*-netbsd* )
1093                       dnl Yes, this is somewhat bogus.
1094                       machine=hp9000s300 ;;
1095       pc532-*-netbsd* | ns32k-*-netbsd* )  machine=ns32000 ;;
1096       pmax-*-netbsd*  | mips-*-netbsd*  )  machine=pmax ;;
1097     esac
1098   ;;
1099
1100   dnl OpenBSD ports
1101   *-*-openbsd* )
1102     case "${canonical}" in
1103       i386-*-openbsd*)          machine=intel386 ;;
1104       m68k-*-openbsd*)          machine=hp9000s300 ;;
1105       mipsel-*-openbsd*)        machine=pmax ;;
1106      esac
1107    ;;
1108
1109   dnl Acorn RISCiX:
1110   arm-acorn-riscix1.1* ) machine=acorn opsys=riscix1-1 ;;
1111   arm-acorn-riscix1.2* | arm-acorn-riscix ) machine=acorn opsys=riscix1-2 ;;
1112
1113   dnl Alliant machines
1114   fx80-alliant-* ) machine=alliant4     opsys=bsd4-2 ;;
1115   i860-alliant-* ) machine=alliant-2800 opsys=bsd4-3 ;;
1116
1117   dnl Altos 3068
1118   m68*-altos-sysv* ) machine=altos opsys=usg5-2 ;;
1119
1120   dnl Amdahl UTS
1121   580-amdahl-sysv* ) machine=amdahl opsys=usg5-2-2 ;;
1122
1123   dnl Apollo, Domain/OS
1124   m68*-apollo-* ) machine=apollo opsys=bsd4-3 ;;
1125
1126   dnl AT&T 3b2, 3b5, 3b15, 3b20
1127   we32k-att-sysv* ) machine=att3b opsys=usg5-2-2 ;;
1128
1129   dnl AT&T 3b1 - The Mighty Unix PC!
1130   m68*-att-sysv* ) machine=7300 opsys=usg5-2-2 ;;
1131
1132   dnl Bull machines
1133   rs6000-bull-bosx* ) machine=ibmrs6000 opsys=aix3-2 ;; # dpx20
1134   m68*-bull-sysv3*  ) machine=dpx2      opsys=usg5-3 ;; # dpx2
1135   m68*-bull-sysv2*  ) machine=sps7      opsys=usg5-2 ;; # sps7
1136
1137   dnl CCI 5/32, 6/32 -- see "Tahoe".
1138
1139   dnl Celerity
1140   celerity-celerity-bsd* ) machine=celerity opsys=bsd4-2 ;;
1141
1142   dnl Convex
1143   *-convex-bsd* | *-convex-convexos* )
1144     machine=convex opsys=bsd4-3
1145     NON_GNU_CPP="cc -E -P"
1146   ;;
1147
1148   dnl Cubix QBx/386
1149   i[[3-9]]86-cubix-sysv* ) machine=intel386 opsys=usg5-3 ;;
1150
1151   dnl Data General AViiON Machines
1152   i586-dg-dgux*R4*   | i586-dg-dgux5.4.4* ) machine=aviion opsys=dgux5-4r4 ;;
1153   m88k-dg-dgux5.4R3* | m88k-dg-dgux5.4.3* ) opsys=dgux5-4r3 ;;
1154   m88k-dg-dgux5.4R2* | m88k-dg-dgux5.4.2* ) opsys=dgux5-4r2 ;;
1155   m88k-dg-dgux*                           ) opsys=dgux     ;;
1156
1157   dnl Motorola Delta machines
1158   m68k-motorola-sysv* | m68000-motorola-sysv* ) machine=delta opsys=usg5-3 ;;
1159   m88k-motorola-sysv4* )
1160     dnl jbotte@bnr.ca says that UNIX_System_V <hostName> 4.0 R40V4.3 m88k mc88110
1161     dnl needs POSIX_SIGNALS and therefore needs usg5-4-2.
1162     dnl I hope there are not other 4.0 versions for this machine
1163     dnl which really need usg5-4 instead.
1164     machine=delta88k opsys=usg5-4-2
1165   ;;
1166   m88k-motorola-sysv* | m88k-motorola-m88kbcs* ) machine=delta88k opsys=usg5-3 ;;
1167
1168   dnl Dual machines
1169   m68*-dual-sysv*    ) machine=dual opsys=usg5-2   ;;
1170   m68*-dual-uniplus* ) machine=dual opsys=unipl5-2 ;;
1171
1172   dnl Encore machines
1173   ns16k-encore-bsd* ) machine=ns16000 opsys=umax ;;
1174
1175   dnl Gould Power Node and NP1
1176   pn-gould-bsd4.2* ) machine=gould     opsys=bsd4-2 ;;
1177   pn-gould-bsd4.3* ) machine=gould     opsys=bsd4-3 ;;
1178   np1-gould-bsd* )   machine=gould-np1 opsys=bsd4-3 ;;
1179
1180   dnl Harris Night Hawk machines running CX/UX (a 5000 looks just like a 4000
1181   dnl as far as XEmacs is concerned).
1182   m88k-harris-cxux* )
1183     dnl Build needs to be different on 7.0 and later releases
1184     case "`uname -r`" in
1185        [[56]].[[0-9]] ) machine=nh4000 opsys=cxux  ;;
1186        [[7]].[[0-9]]  ) machine=nh4000 opsys=cxux7 ;;
1187     esac
1188     NON_GNU_CPP="/lib/cpp"
1189   ;;
1190   dnl Harris ecx or gcx running CX/UX (Series 1200, Series 3000)
1191   m68k-harris-cxux* ) machine=nh3000 opsys=cxux ;;
1192   dnl Harris power pc NightHawk running Power UNIX (Series 6000)
1193   powerpc-harris-powerunix ) machine=nh6000 opsys=powerunix NON_GNU_CPP="cc -Xo -E -P" ;;
1194
1195   dnl Honeywell XPS100
1196   xps*-honeywell-sysv* ) machine=xps100 opsys=usg5-2 ;;
1197
1198   dnl HP 9000 series 200 or 300
1199   m68*-hp-bsd* ) machine=hp9000s300 opsys=bsd4-3 ;;
1200
1201   dnl HP-UX
1202   *-hp-hpux* )
1203     dnl Figure out machine and opsys orthogonally
1204     case "$canonical" in
1205       m68*  ) machine=hp9000s300 ;;
1206       hppa* ) machine=hp800      ;;
1207     esac
1208
1209     case "$canonical" in
1210       *-hp-hpux7*  )  opsys=hpux   ;;
1211       *-hp-hpux8*  )  opsys=hpux8  ;;
1212       *-hp-hpux9*  )  opsys=hpux9  ;;
1213       *-hp-hpux10* )  opsys=hpux10 ;;
1214       *-hp-hpux11* )  opsys=hpux11 ;;
1215       *            )  opsys=hpux   ;;
1216     esac
1217
1218     dnl HP has a broken "strcat"
1219     case "$opsys" in hpux9 | hpux10 ) XE_ADD_OBJS(strcat.o) ;; esac
1220
1221     if test "$opsys" = "hpux10" -o "$opsys" = "hpux11"; then \
1222         ansi_flag="-Ae"; else ansi_flag="-Aa"; fi
1223     NON_GNU_CC="cc $ansi_flag" NON_GNU_CPP="cc $ansi_flag -E"
1224
1225     case "$canonical" in *-hp-hpux*shr* ) opsys="${opsys}-shr" ;; esac
1226   ;;
1227
1228   dnl Orion machines
1229   orion-orion-bsd*   ) machine=orion    opsys=bsd4-2 ;;
1230   clipper-orion-bsd* ) machine=orion105 opsys=bsd4-2 ;;
1231
1232   dnl IBM machines
1233   i[[3-9]]86-ibm-aix1.1* ) machine=ibmps2-aix opsys=usg5-2-2 ;;
1234   i[[3-9]]86-ibm-aix1.[[23]]* | i[[3-9]]86-ibm-aix* ) machine=ibmps2-aix opsys=usg5-3 ;;
1235   i370-ibm-aix*) machine=ibm370aix opsys=usg5-3 ;;
1236   romp-ibm-aos*    ) opsys=bsd4-3 ;;
1237   romp-ibm-bsd*    ) opsys=bsd4-3 ;;
1238   romp-ibm-mach*   ) opsys=mach-bsd4-3 ;;
1239
1240   dnl Integrated Solutions "Optimum V"
1241   m68*-isi-bsd4.2* ) machine=isi-ov opsys=bsd4-2 ;;
1242   m68*-isi-bsd4.3* ) machine=isi-ov opsys=bsd4-3 ;;
1243
1244   dnl Intel 386 machines where we do care about the manufacturer
1245   i[[3-9]]86-intsys-sysv* ) machine=is386 opsys=usg5-2-2 ;;
1246
1247   dnl Prime EXL
1248   i[[3-9]]86-prime-sysv* ) machine=i386 opsys=usg5-3 ;;
1249
1250   dnl Sequent Symmetry running Dynix
1251   i[[3-9]]86-sequent-bsd* ) machine=symmetry opsys=bsd4-3 ;;
1252
1253   dnl Sequent Symmetry running DYNIX/ptx
1254   i[[3-9]]86-sequent-ptx* ) machine=sequent-ptx opsys=ptx NON_GNU_CPP="/lib/cpp" ;;
1255
1256   dnl Unspecified sysv on an ncr machine defaults to svr4.2.
1257   dnl (Plain usg5-4 does not turn on POSIX signals, which we need.)
1258   i[[3-9]]86-ncr-sysv* ) machine=ncr386 opsys=usg5-4-2 ;;
1259
1260   dnl Intel Paragon OSF/1
1261   i860-intel-osf1* ) machine=paragon opsys=osf1 NON_GNU_CPP=/usr/mach/lib/cpp ;;
1262
1263   dnl Intel 860
1264   i860-*-sysv4* ) machine=i860 opsys=usg5-4 NON_GNU_CC="/bin/cc" NON_GNU_CPP="/usr/ccs/lib/cpp" ;;
1265
1266   dnl Masscomp machines
1267   m68*-masscomp-rtu* ) machine=masscomp opsys=rtu ;;
1268
1269   dnl Megatest machines
1270   m68*-megatest-bsd* ) machine=mega68 opsys=bsd4-2 ;;
1271
1272   dnl Workstations sold by MIPS
1273   dnl This is not necessarily all workstations using the MIPS processor -
1274   dnl Irises are produced by SGI, and DECstations by DEC.
1275   mips-mips-usg* ) machine=mips4 ;;
1276   mips-mips-riscos4 )
1277     machine=mips4
1278     NON_GNU_CC="cc -systype bsd43"
1279     NON_GNU_CPP="cc -systype bsd43 -E"
1280     case "$canonical" in
1281       mips-mips-riscos4* ) opsys=bsd4-3  ;;
1282       mips-mips-riscos5* ) opsys=riscos5 ;;
1283     esac
1284   ;;
1285   mips-mips-bsd* ) machine=mips opsys=bsd4-3 ;;
1286   mips-mips-*    ) machine=mips opsys=usg5-2-2 ;;
1287
1288   dnl NeXT
1289   m68*-next-* | m68k-*-nextstep* ) machine=m68k opsys=nextstep ;;
1290
1291   dnl The complete machine from National Semiconductor
1292   ns32k-ns-genix* ) machine=ns32000 opsys=usg5-2 ;;
1293
1294   dnl NCR machines
1295   m68*-ncr-sysv2* | m68*-ncr-sysvr2* ) machine=tower32   opsys=usg5-2-2 ;;
1296   m68*-ncr-sysv3* | m68*-ncr-sysvr3* ) machine=tower32v3 opsys=usg5-3 ;;
1297
1298   dnl Nixdorf Targon 31
1299   m68*-nixdorf-sysv* ) machine=targon31 opsys=usg5-2-2 ;;
1300
1301   dnl Nu (TI or LMI)
1302   m68*-nu-sysv* ) machine=nu opsys=usg5-2 ;;
1303
1304   dnl Plexus
1305   m68*-plexus-sysv* ) machine=plexus opsys=usg5-2 ;;
1306
1307   dnl Pyramid machines
1308   pyramid-pyramid-bsd* ) machine=pyramid opsys=bsd4-2 ;;
1309
1310   dnl Sequent Balance
1311   ns32k-sequent-bsd4.2* ) machine=sequent opsys=bsd4-2 ;;
1312   ns32k-sequent-bsd4.3* ) machine=sequent opsys=bsd4-3 ;;
1313
1314   dnl Siemens Nixdorf
1315   mips-siemens-sysv* | mips-sni-sysv*)
1316     machine=mips-siemens opsys=usg5-4
1317     NON_GNU_CC=/usr/ccs/bin/cc
1318     NON_GNU_CPP=/usr/ccs/lib/cpp
1319   ;;
1320
1321   dnl NEC
1322   mips-nec-sysv*)
1323     machine=mips-nec
1324     NON_GNU_CC=/usr/ccs/bin/cc
1325     NON_GNU_CPP=/usr/ccs/lib/cpp
1326   ;;
1327
1328   dnl Silicon Graphics machines
1329   dnl Iris 2500 and Iris 2500 Turbo (aka the Iris 3030)
1330   m68*-sgi-iris3.5* ) machine=irist opsys=iris3-5 ;;
1331   m68*-sgi-iris3.6* | m68*-sgi-iris*) machine=irist opsys=iris3-6 ;;
1332   dnl Iris 4D
1333   mips-sgi-irix3.*    ) opsys=irix3-3 ;;
1334   mips-sgi-irix4.*    ) opsys=irix4-0 ;;
1335   mips-sgi-irix6*     ) opsys=irix6-0 ;;
1336   mips-sgi-irix5.1*   ) opsys=irix5-1 ;;
1337   mips-sgi-irix5.2*   ) opsys=irix5-2 ;;
1338   mips-sgi-irix5.*    ) opsys=irix5-3 ;;
1339   mips-sgi-irix*      ) opsys=irix5-0 ;;
1340
1341   dnl SONY machines
1342   *-sony-newsos[[34]]* | *-sony-news[[34]]* ) opsys=bsd4-3 ;;
1343   *-sony-news* ) opsys=newsos5 ;;
1344
1345   dnl Stride
1346   m68*-stride-sysv* ) machine=stride opsys=usg5-2 ;;
1347
1348   dnl Suns
1349   *-*-solaris* | *-*-sunos* | *-sun-mach* | *-sun-bsd* )
1350     dnl Hardware type
1351     case "$canonical" in
1352       m68*-sunos1* )             machine=sun1     ;;
1353       m68*-sunos2* )             machine=sun2     ;;
1354       m68* )                     machine=sun3     ;;
1355       i*86*-sun-sunos[[34]]* )   machine=sun386   ;;
1356       i*86-*-* )                 machine=intel386 ;;
1357       rs6000* )                  machine=rs6000   ;;
1358     esac
1359
1360     dnl Make $canonical even more so.
1361     case "$canonical" in *-sunos5*)
1362       canonical=`echo $canonical | sed -e s/sunos5/solaris2/`;;
1363     esac
1364
1365     dnl On SunOS 4, use /usr/lib/cpp, sans dynodump, /bin/ranlib
1366     dnl On SunOS 5, use cc -E,        need dynodump, RANLIB not needed
1367     dnl But, SunOS 5.6 no longer needs dynodump because it has a similar
1368     dnl function integrated.
1369     case "$canonical" in
1370       *-sunos4* )
1371         #test -f /usr/lib/cpp     && NON_GNU_CPP=/usr/lib/cpp ;;
1372         : ;;
1373       *-solaris2* )
1374         #test -f /usr/ccs/lib/cpp && NON_GNU_CPP=/usr/ccs/lib/cpp
1375         RANLIB=':' ;;
1376     esac
1377
1378     case "$canonical" in
1379       *-solaris*          )
1380         opsys=sol2
1381         os_release=`uname -r | sed -e 's/^\([[0-9]]\)\.\([[0-9]]\).*/\1\2/'`
1382         AC_DEFINE_UNQUOTED(OS_RELEASE, $os_release) ;;
1383
1384       dnl The last Sun386 ran 4.0.
1385       i*86-*-sunos4*      ) opsys=sunos4-0      ;;
1386       *-sunos4.0*         ) opsys=sunos4-0      ;;
1387       *-sunos4.1.2*       ) opsys=sunos4-1-2    ;;
1388       *-sunos4.1.3*       ) opsys=sunos4-1-3    ;;
1389       *-sunos4.1.[[4-9]]* ) opsys=sunos4-1-4    ;;
1390       *-sunos4* | *-sunos ) opsys=sunos4-1      ;;
1391       *-mach*             ) opsys=mach-bsd4-3   ;;
1392       *                   ) opsys=bsd4-2        ;;
1393     esac
1394
1395     case "$canonical" in *-sunos4*shr* ) opsys="${opsys}-shr" ;; esac
1396
1397     dnl Watch out for a compiler guaranteed not to work.
1398     test "$opsys $CC" = "sol2 /usr/ucb/cc" && CC=""
1399   ;;
1400
1401   dnl Tadpole 68k
1402   m68*-tadpole-sysv* ) machine=tad68k opsys=usg5-3 ;;
1403
1404   dnl Tahoe machines
1405   tahoe-tahoe-bsd4.2* ) machine=tahoe opsys=bsd4-2 ;;
1406   tahoe-tahoe-bsd4.3* ) machine=tahoe opsys=bsd4-3 ;;
1407
1408   dnl Tandem Integrity S2
1409   mips-tandem-sysv* ) machine=tandem-s2 opsys=usg5-3 ;;
1410
1411   dnl Tektronix XD88
1412   m88k-tektronix-sysv3* ) machine=tekxd88 opsys=usg5-3 ;;
1413
1414   dnl Tektronix 16000 box (6130?)
1415   ns16k-tektronix-bsd* ) machine=ns16000 opsys=bsd4-2 ;;
1416   dnl Tektronix 4300
1417   dnl src/m/tek4300.h hints that this is a m68k machine.
1418   m68*-tektronix-bsd* ) machine=tek4300 opsys=bsd4-3 ;;
1419
1420   dnl Titan P2 or P3
1421   titan-titan-sysv* ) machine=titan opsys=usg5-3 ;;
1422
1423   dnl Ustation E30 (SS5E)
1424   m68*-unisys-uniplus* ) machine=ustation opsystem=unipl5-2 ;;
1425
1426   dnl Vaxen.
1427   vax-dec-* )
1428     case "$canonical" in
1429       *-sysv[[01]]* | *-sysvr[[01]]* )  opsys=usg5-0 ;;
1430       *-sysv2* | *-sysvr2* )            opsys=usg5-2 ;;
1431       *-mach* )                         opsys=mach-bsd4-3 ;;
1432     esac
1433   ;;
1434
1435   dnl Whitechapel MG1
1436   ns16k-whitechapel-* ) machine=mg1 ;;
1437
1438   dnl Wicat
1439   m68*-wicat-sysv* ) machine=wicat opsys=usg5-2 ;;
1440
1441   dnl Intel 386 machines where we do not care about the manufacturer
1442   i[[3-9]]86-*-* )
1443     machine=intel386
1444     case "$canonical" in
1445       *-isc1.* | *-isc2.[[01]]* ) opsys=386-ix ;;
1446       *-isc2.2* )               opsys=isc2-2 ;;
1447       *-isc4.0* )               opsys=isc4-0 ;;
1448       *-isc4.* )                opsys=isc4-1
1449                                 GCC_TEST_OPTIONS=-posix
1450                                 NON_GCC_TEST_OPTIONS=-Xp
1451                                 ;;
1452       *-isc* )                  opsys=isc3-0 ;;
1453       *-esix5* )                opsys=esix5r4 NON_GNU_CPP=/usr/lib/cpp ;;
1454       *-esix* )                 opsys=esix ;;
1455       *-mach* )                 opsys=mach-bsd4-3 ;;
1456       *-xenix* )                opsys=xenix ;;
1457       *-sco3.2v4* )             opsys=sco4 NON_GNU_CPP=/lib/cpp  ;;
1458       *-bsd386* | *-bsdi1* )    opsys=bsd386 ;;
1459       *-bsdi3* )                opsys=bsdos3 ;;
1460       *-bsdi2.1* )              opsys=bsdos2-1 ;;
1461       *-bsdi2* )                opsys=bsdos2 ;;
1462       *-sco3.2v5* )             opsys=sco5 ;
1463         dnl This is a pain.  Like the current USL cc, SCO cc -E
1464         dnl tokenizes as it preprocesses, making configure very
1465         dnl unhappy.  Unfortunately, /lib/cpp does not understand
1466         dnl flags like "-b elf", so we have to cheat in order to
1467         dnl pick up the right defines for UNEXEC from the s-file.
1468         dnl 01/05/95 robertl@dgii.com
1469         if test "$dynamic" = "yes" ; then
1470                 NON_GNU_CPP="/lib/cpp -D_XOPEN_SOURCE -D_SCO_ELF"  ;
1471         else
1472                 NON_GNU_CPP="/lib/cpp -D_XOPEN_SOURCE"  ;
1473         fi ;;
1474       *-386bsd* )               opsys=386bsd ;;
1475       *-freebsd* )              opsys=freebsd ;;
1476       *-nextstep* )             opsys=nextstep ;;
1477       *-pc-cygwin32 )           opsys=cygwin32 ;;
1478       dnl Otherwise, we fall through to the generic opsys code at the bottom.
1479     esac
1480   ;;
1481
1482   dnl Linux/68k
1483   m68k-*-linux* ) machine=m68k opsys=linux ;;
1484
1485 esac
1486
1487 if test -z "$machine" -o -z "$opsys"; then
1488   (echo "$progname: XEmacs hasn't been ported to \`$canonical' systems."
1489    echo "$progname: Check \`etc/MACHINES' for recognized configuration names."
1490   ) >&2
1491   exit 1
1492 fi
1493
1494 if test -z "$dynamic"; then
1495   case "$opsys" in
1496     hpux* | sunos4* ) dynamic=no ;;
1497     *) dynamic=yes ;;
1498   esac
1499 fi
1500 if test "$dynamic" = "yes"; then
1501   case "$opsys" in
1502     hpux* | sunos4* | sco5 ) opsys="${opsys}-shr" ;;
1503     decosf* ) ld_call_shared="-call_shared" ;;
1504   esac
1505 else dnl "$dynamic" = "no"
1506   case "$opsys" in
1507     sol2 )
1508       echo "Static linking is not supported on Solaris 2."
1509       echo "Rerun configure without specifying --dynamic=no."
1510       exit 1 ;;
1511     linux   ) ld_call_shared="-Bstatic" ;;
1512     decosf* ) ld_call_shared="-non_shared" ;;
1513   esac
1514 fi
1515
1516 dnl Use xlc by default on AIX
1517 case "$opsys" in aix*) NON_GNU_CC=xlc ;; esac
1518
1519 stack_trace_eye_catcher=`echo ${PROGNAME}_${version}_${canonical} | sed 'y/.-/__/'`
1520 AC_DEFINE_UNQUOTED(STACK_TRACE_EYE_CATCHER, $stack_trace_eye_catcher)
1521
1522 machfile="m/${machine}.h"
1523 opsysfile="s/${opsys}.h"
1524
1525 dnl --------------------------------------------------
1526 dnl Determine the compiler, set up for feature testing
1527 dnl --------------------------------------------------
1528
1529 dnl Sun Development environment support
1530 test "$with_sparcworks" = "yes" && with_workshop=yes # compatibility alias
1531 XE_CHECK_FEATURE_DEPENDENCY(workshop, tooltalk)
1532 if test "$with_workshop" = "yes"; then
1533   AC_DEFINE(SUNPRO)
1534   XE_ADD_OBJS(sunpro.o)
1535 fi
1536
1537 if test "$with_clash_detection" = "yes"; then
1538   AC_DEFINE(CLASH_DETECTION)
1539   XE_ADD_OBJS(filelock.o)
1540 fi
1541
1542 dnl Choose a compiler from (in order)
1543 dnl --compiler, env var CC, with_gcc=no && ${NON_GNU_CC:-cc}, AC_PROG_CC
1544 test -n "$compiler" && CC="$compiler"
1545 if test "$with_gcc" = "no"; then dnl Try to find a non-gcc compiler
1546   case "$CC" in "" | *gcc* ) CC="${NON_GNU_CC-cc}" ;; esac
1547 fi
1548
1549 dnl If we don't set CFLAGS here, AC_PROG_CC will set it.
1550 dnl But we know better what's good for us, so we do our own
1551 dnl computation of real CFLAGS later.
1552 dnl --cflags overrides environment variable CFLAGS
1553 test "${cflags-unset}" != unset && CFLAGS="$cflags"
1554 if test "${CFLAGS-unset}" != unset
1555   then cflags_specified=yes;
1556   else cflags_specified=no;
1557 fi
1558
1559 xe_save_CFLAGS="$CFLAGS"
1560
1561 AC_PROG_CC dnl Autoconf has its own magic for compiler autodetection
1562
1563 dnl Retry using random guesswork if AC_PROG_CC got it wrong...
1564 if   test "$with_gcc" = "no"  -a "$GCC" = "yes"; then
1565   CC=${NON_GNU_CC-cc}
1566   AC_PROG_CC
1567 elif test "$with_gcc" = "yes" -a "$GCC" != "yes" ; then
1568   CC=gcc
1569   AC_PROG_CC
1570 fi
1571 CFLAGS="$xe_save_CFLAGS"
1572
1573 dnl Figure out what C preprocessor to use.
1574
1575 dnl On Sun systems, people sometimes set up the variable CPP
1576 dnl with a value that is a directory, not an executable at all.
1577 dnl Detect that case, and ignore that value.
1578 test -n "$CPP" -a -d "$CPP" && CPP=
1579
1580 test -n "$NON_GNU_CPP" -a "$GCC" != "yes" -a -z "$CPP" && CPP="$NON_GNU_CPP"
1581
1582 AC_PROG_CPP
1583
1584 AC_AIX
1585
1586 AC_MSG_CHECKING(for GNU libc)
1587 AC_TRY_COMPILE([#include <features.h>],[
1588 #if ! (defined __GLIBC__ || defined __GNU_LIBRARY__)
1589 #error Not a GNU libc system :-(
1590 ******* ======= ******** &&&&&&&&
1591 #endif
1592 ], have_glibc=yes, have_glibc=no)
1593 AC_MSG_RESULT($have_glibc)
1594 dnl I'm tired of pop being broken with GLIBC -slb
1595 dnl Well. then why not fix fucking pop?
1596 test "$have_glibc" = "yes" && AC_DEFINE(_GNU_SOURCE)
1597
1598
1599 dnl Identify compilers to enable compiler-specific hacks.
1600 dnl Add support for other compilers HERE!
1601 dnl GCC is already identified elsewhere.
1602 AC_TRY_RUN([int main () {
1603 #if defined __SUNPRO_C
1604 return 11;
1605 #elif defined __DECC
1606 return 12;
1607 #else
1608 return 0;
1609 #endif
1610 }], [],
1611 [case "$conftest_rc" in
1612   11) echo "You appear to be using the SunPro C compiler."; __SUNPRO_C=yes ;;
1613   12) echo "You appear to be using the DEC C compiler."   ; __DECC=yes ;;
1614 esac])
1615
1616
1617 dnl case "$canonical" in
1618 dnl   *-sun-sunos* ) test "$CPP" = "acc -E" && CPP="acc -E -Xs" ;;
1619 dnl esac
1620
1621 dnl --------------------------------------------------------------------
1622 dnl Extract some information from the operating system and machine files
1623 dnl --------------------------------------------------------------------
1624
1625 echo "Extracting information from the machine- and system-dependent headers..."
1626
1627 dnl It is not important that this name contain the PID; you cannot run
1628 dnl two configures in the same directory and have anything work
1629 dnl anyway.
1630 tempcname="conftest.c"
1631
1632 dnl CPP_to_sh(CPP_SYMBOL, SH_VAR, DEFAULT_VALUE)
1633 define([CPP_to_sh],
1634 [[#]ifndef [$1]
1635 [#]define [$1]ifelse([$3],,, [ "$3"])
1636 [#]endif
1637 configure___ [$2]=[$1]
1638 ])dnl CPP_to_sh
1639
1640 dnl CPP_boolean_to_sh(CPP_SYMBOL, SH_VAR)
1641 define([CPP_boolean_to_sh],
1642 [[#]ifdef [$1]
1643 configure___ [$2]=yes
1644 [#]else
1645 configure___ [$2]=no
1646 [#]endif
1647 ])dnl CPP_boolean_to_sh
1648
1649 cat > $tempcname <<EOF
1650 #define NOT_C_CODE
1651 #define C_SWITCH_SITE
1652 #define C_SWITCH_X_SITE
1653 #define LD_SWITCH_SITE
1654 #define LD_SWITCH_X_SITE
1655 #define LD_SWITCH_X_SITE_AUX
1656 #define OS_RELEASE $os_release
1657 #include "$srcdir/src/$opsysfile"
1658 #include "$srcdir/src/$machfile"
1659
1660 CPP_to_sh(LIBS_MACHINE, libs_machine)
1661 CPP_to_sh(LIBS_SYSTEM,  libs_system)
1662 CPP_to_sh(LIBS_TERMCAP, libs_termcap)
1663 CPP_to_sh(LIB_STANDARD, libs_standard)
1664
1665 CPP_to_sh(OBJECTS_MACHINE, objects_machine)
1666 CPP_to_sh(OBJECTS_SYSTEM,  objects_system)
1667
1668 CPP_to_sh(C_SWITCH_MACHINE,   c_switch_machine)
1669 CPP_to_sh(C_SWITCH_SYSTEM,    c_switch_system)
1670
1671 CPP_to_sh(LD_SWITCH_MACHINE,  ld_switch_machine)
1672 CPP_to_sh(LD_SWITCH_SYSTEM,   ld_switch_system)
1673
1674 CPP_to_sh(UNEXEC, unexec, unexec.o)
1675
1676 CPP_to_sh(LD_SWITCH_SHARED, ld_switch_shared, -c)
1677
1678 #ifdef ORDINARY_LINK
1679 #define LD "\$(CC) \$(CFLAGS)"
1680 #else /* no ORDINARY LINK */
1681 #ifdef COFF_ENCAPSULATE
1682 #define LD "\$(CC) -nostdlib"
1683 #else /* not COFF_ENCAPSULATE */
1684 #ifdef LINKER
1685 #define LD LINKER
1686 #else /* ! defined (LINKER) */
1687 #define LD "ld"
1688 #endif /* ! defined (LINKER) */
1689 #endif /* ! defined (COFF_ENCAPSULATE) */
1690 #endif /* not ORDINARY_LINK */
1691 configure___ ld=LD
1692
1693 CPP_to_sh(LIB_GCC, lib_gcc)
1694 CPP_to_sh(LD_TEXT_START_ADDR, ld_text_start_addr)
1695
1696 #if ! defined (ORDINARY_LINK) && !defined (START_FILES)
1697 #ifdef NO_REMAP
1698 #ifdef COFF_ENCAPSULATE
1699 #define START_FILES "pre-crt0.o /usr/local/lib/gcc-crt0.o"
1700 #else /* ! defined (COFF_ENCAPSULATE) */
1701 #define START_FILES "pre-crt0.o /lib/crt0.o"
1702 #endif /* ! defined (COFF_ENCAPSULATE) */
1703 #else /* ! defined (NO_REMAP) */
1704 #define START_FILES "ecrt0.o"
1705 #endif /* ! defined (NO_REMAP) */
1706 #endif /* no ORDINARY_LINK */
1707 #ifndef START_FILES
1708 #define START_FILES
1709 #endif
1710 configure___ start_files=START_FILES
1711
1712 CPP_boolean_to_sh(ORDINARY_LINK, ordinary_link)
1713 CPP_boolean_to_sh(SYSTEM_MALLOC, system_malloc)
1714 CPP_boolean_to_sh(TERMINFO, have_terminfo)
1715 CPP_boolean_to_sh(MAIL_USE_FLOCK, mail_use_flock)
1716 CPP_boolean_to_sh(MAIL_USE_LOCKF, mail_use_lockf)
1717 EOF
1718
1719 dnl The value of CPP is a quoted variable reference, so we need to do this
1720 dnl to get its actual value...
1721 CPP=`eval "echo $CPP $CPPFLAGS"`
1722 define(TAB, [   ])dnl
1723 changequote(, )dnl
1724 eval `$CPP -Isrc $tempcname \
1725         | sed -n -e "s/[ TAB]*=[ TAB\"]*/='/" -e "s/[ TAB\"]*\$/'/" -e "s/^configure___//p"`
1726 changequote([, ])dnl
1727
1728 rm $tempcname
1729
1730 dnl For debugging...
1731 test "$extra_verbose" = "yes" && \
1732   PRINT_VAR(libs_machine libs_system libs_termcap libs_standard
1733   objects_machine objects_system c_switch_machine c_switch_system
1734   ld_switch_machine ld_switch_system unexec ld_switch_shared
1735   ld lib_gcc ld_text_start_addr start_files ordinary_link
1736   have_terminfo mail_use_flock mail_use_lockf) && echo ""
1737
1738 dnl Non-ordinary link usually requires -lc
1739 test "$ordinary_link" = "no" -a -z "$libs_standard" && libs_standard="-lc"
1740
1741 dnl Compiler-specific hacks
1742 dnl DEC C requires -std
1743 test "$__DECC" = "yes" && XE_APPEND(-std, c_switch_site)
1744
1745 dnl Calculalate value of CFLAGS:
1746 dnl Use either command line flag, environment var, or autodetection
1747 if test "$cflags_specified" = "no"; then
1748   dnl Following values of CFLAGS are known to work well.
1749   dnl Should we take debugging options into consideration?
1750   if   test "$GCC" = "yes"; then
1751     CFLAGS="-g -O3 -Wall -Wno-switch"
1752     dnl I'm not convinced this is a good idea any more. -sb
1753     dnl test "$opsys $machine" = "linux intel386" && \
1754     dnl CFLAGS="$CFLAGS -fno-strength-reduce -malign-loops=2 -malign-jumps=2 -malign-functions=2"
1755     dnl cygwin b19 can't cope with -O3, but most people use 20.1 or egcs now.
1756     dnl    test "$opsys $machine" = "cygwin32 intel386" && \
1757     dnl      CFLAGS="-g -O2 -Wall -Wno-switch"
1758   elif test "$__SUNPRO_C" = "yes"; then
1759     case "$opsys" in
1760       sol2    ) CFLAGS="-v -xO4" ;;
1761       sunos4* ) CFLAGS="-xO2";;
1762     esac
1763   elif test "$__DECC" = "yes"; then
1764     CFLAGS="-O3"
1765   elif test "$CC" = "xlc"; then
1766     CFLAGS="-g -O3 -qstrict -qnoansialias -qlibansi -qinfo -qro -qmaxmem=20000"
1767   dnl ### Add optimal CFLAGS support for other compilers HERE!
1768   else
1769     CFLAGS="-O" ;dnl The only POSIX-approved flag
1770   fi
1771 fi
1772
1773 dnl Inform compiler that certain flags are meant for the linker
1774 dnl XE_PROTECT_LINKER_FLAGS(shell_var)
1775 define([XE_PROTECT_LINKER_FLAGS], [
1776 if test "$GCC" = "yes"; then
1777   set x $[$1]; shift; [$1]=""
1778   while test -n "[$]1"; do
1779     case [$]1 in
1780       -L  | -l  | -u               ) [$1]="$[$1] [$]1 [$]2"; shift ;;
1781       -L* | -l* | -u* | -Wl* | -pg ) [$1]="$[$1] [$]1" ;;
1782       -Xlinker* ) ;;
1783       * ) [$1]="$[$1] -Xlinker [$]1" ;;
1784     esac
1785     shift
1786   done
1787 fi])dnl
1788 XE_PROTECT_LINKER_FLAGS(ld_switch_system)
1789 XE_PROTECT_LINKER_FLAGS(ld_switch_machine)
1790 XE_PROTECT_LINKER_FLAGS(LDFLAGS)
1791 XE_PROTECT_LINKER_FLAGS(ld_call_shared)
1792
1793 dnl Add s&m-determined objects (including unexec) to link line
1794 test -n "$objects_machine" && XE_ADD_OBJS($objects_machine)
1795 test -n "$objects_system"  && XE_ADD_OBJS($objects_system)
1796 test -n "$unexec"          && XE_ADD_OBJS($unexec)
1797
1798 dnl Dynodump (Solaris 2.x, x<6)
1799 AC_MSG_CHECKING(for dynodump)
1800 if test "$unexec" != "unexsol2.o"; then
1801   AC_MSG_RESULT(no)
1802 else
1803   AC_MSG_RESULT(yes)
1804   AC_DEFINE(DYNODUMP)
1805   XE_APPEND(dynodump, MAKE_SUBDIR)
1806   XE_APPEND(dynodump, SRC_SUBDIR_DEPS)
1807   case "$machine" in
1808     sparc   ) dynodump_arch=sparc ;;
1809     *86*    ) dynodump_arch=i386  ;;
1810     powerpc ) dynodump_arch=ppc   ;;
1811   esac
1812   dnl Dynodump requires the system linker
1813   test "$GCC" = "yes" && XE_APPEND(-fno-gnu-linker, ld_switch_site)
1814 fi
1815
1816 dnl Feed s&m crud to src/Makefile
1817
1818 dnl Linux/powerpc needs the following magic for some reason
1819 test "$machine$opsys" = "powerpclinux" && start_flags="-T $srcdir/src/ppc.ldscript"
1820
1821 if test "$unexec" = "unexaix.o"; then
1822 dnl AIX needs various hacks to make static linking work.
1823   if   test "$dynamic" = "no"; then
1824   start_flags="-Wl,-bnso,-bnodelcsect"
1825   test "$GCC" = "yes" && start_flags="-B/bin/ ${start_flags}"
1826   for f in "/lib/syscalls.exp" "/lib/threads.exp"; do
1827     if test -r "$f"; then start_flags="${start_flags},-bI:${f}"; fi
1828   done
1829   for f in "/usr/lpp/X11/bin/smt.exp" "/usr/bin/X11/smt.exp"; do
1830     if test -r "$f"; then start_flags="${start_flags},-bI:${f}"; break; fi
1831   done
1832   AC_CHECK_LIB(C, terminateAndUnload, XE_APPEND(-lC, libs_system))
1833   fi
1834 elif test -n "$ld_text_start_addr"; then
1835   start_flags="-T $ld_text_start_addr -e __start"
1836 fi
1837 AC_SUBST(start_flags)
1838
1839 AC_SUBST(ld_switch_shared)
1840 AC_SUBST(start_files)
1841 if test "$ordinary_link" = "no" -a "$GCC" = "yes"; then
1842  test -z "$linker" &&  linker='$(CC) -nostdlib'
1843  test -z "$lib_gcc" && lib_gcc='`$(CC) -print-libgcc-file-name`'
1844 fi
1845 test "$GCC" != "yes" && lib_gcc=
1846 AC_SUBST(ld)
1847 AC_SUBST(lib_gcc)
1848
1849 dnl ---------------------------------------------------------------
1850 dnl Add site and system specific flags to compile and link commands
1851 dnl ---------------------------------------------------------------
1852
1853 dnl Allow use of either ":" or spaces for lists of directories
1854 define(COLON_TO_SPACE,
1855   [case "$[$1]" in *:* [)] [$1]="`echo '' $[$1] | sed -e 's/^ //' -e 's/:/ /g'`";; esac])dnl
1856
1857 dnl --site-libraries (multiple dirs)
1858 COLON_TO_SPACE(site_libraries)
1859 if test -n "$site_libraries"; then
1860   for arg in $site_libraries; do
1861     case "$arg" in
1862      -* ) ;;
1863      * ) test -d "$arg" || \
1864            XE_DIE("Invalid site library \`$arg': no such directory")
1865        arg="-L${arg}" ;;
1866     esac
1867     XE_APPEND($arg, ld_switch_site)
1868   done
1869 fi
1870
1871 dnl --site-includes (multiple dirs)
1872 COLON_TO_SPACE(site_includes)
1873 if test -n "$site_includes"; then
1874   for arg in $site_includes; do
1875     case "$arg" in
1876       -* ) ;;
1877       * ) test -d "$arg" || \
1878            XE_DIE("Invalid site include \`$arg': no such directory")
1879       arg="-I${arg}" ;;
1880     esac
1881     XE_APPEND($arg, c_switch_site)
1882   done
1883 fi
1884
1885 dnl --site-prefixes (multiple dirs)
1886 dnl --site-prefixes=dir1:dir2 is a convenient shorthand for
1887 dnl --site-libraries=dir1/lib:dir2/lib --site-includes=dir1/include:dir2/include
1888 dnl Site prefixes take precedence over the standard places, but not over
1889 dnl site-includes and site-libraries.
1890 COLON_TO_SPACE(site_prefixes)
1891 if test -n "$site_prefixes"; then
1892   for dir in $site_prefixes; do
1893     inc_dir="${dir}/include"
1894     lib_dir="${dir}/lib"
1895     if test ! -d "$dir"; then
1896       XE_DIE("Invalid site prefix \`$dir': no such directory")
1897     elif test ! -d "$inc_dir"; then
1898       XE_DIE("Invalid site prefix \`$dir': no such directory \`$inc_dir'")
1899     elif test ! -d "$lib_dir"; then
1900       XE_DIE("Invalid site prefix \`$dir': no such directory \`$lib_dir'")
1901     else
1902       XE_APPEND("-I$inc_dir", c_switch_site)
1903       XE_APPEND("-L$lib_dir", ld_switch_site)
1904     fi
1905   done
1906 fi
1907
1908 dnl GNU software installs by default into /usr/local/{include,lib}
1909 dnl if test -d "/usr/local/include" -a -d "/usr/local/lib"; then
1910 dnl   XE_APPEND("-L/usr/local/lib",    ld_switch_site)
1911 dnl   XE_APPEND("-I/usr/local/include", c_switch_site)
1912 dnl fi
1913
1914 dnl Extra system-specific library directories - please add to list
1915 for dir in "/usr/ccs/lib"; do
1916   test -d "$dir" && XE_APPEND(-L${dir}, ld_switch_site)
1917 done
1918
1919 dnl --site-runtime-libraries (multiple dirs)
1920 COLON_TO_SPACE(site_runtime_libraries)
1921 if test -n "$site_runtime_libraries"; then
1922   LD_RUN_PATH="`echo $site_runtime_libraries | sed -e 's/  */:/g'`"
1923   export LD_RUN_PATH
1924 fi
1925
1926 dnl -------------------------------------
1927 dnl Compute runtime library path
1928 dnl -------------------------------------
1929
1930 if   test "$dynamic" = "no"; then add_runtime_path=no
1931 elif test -n "$LD_RUN_PATH"; then add_runtime_path=yes
1932 else case "$opsys" in
1933        sol2 | irix* | *bsd* | decosf* ) add_runtime_path=yes ;;
1934        * ) add_runtime_path=no ;;
1935      esac
1936 fi
1937
1938 if test "$add_runtime_path" = "yes"; then
1939   dnl Try to autodetect runtime library flag (usually -R),
1940   dnl and whether it works (or at least does no harm)
1941   AC_MSG_CHECKING("for runtime libraries flag")
1942   case "$opsys" in
1943     sol2 ) dash_r="-R" ;;
1944     decosf* | linux* ) dash_r="-rpath " ;;
1945     *)
1946       dash_r=""
1947       for try_dash_r in "-R" "-R " "-rpath "; do
1948         xe_check_libs="${try_dash_r}/no/such/file-or-directory"
1949         XE_PROTECT_LINKER_FLAGS(xe_check_libs)
1950         AC_TRY_LINK(, , dash_r="$try_dash_r")
1951         xe_check_libs=""
1952         test -n "$dash_r" && break
1953       done ;;
1954   esac
1955   if test -n "$dash_r";
1956     then AC_MSG_RESULT("\"${dash_r}\"")
1957     else AC_MSG_RESULT(NONE)
1958   fi
1959 fi
1960
1961 xe_add_unique_runpath_dir='
1962   xe_add_p=yes
1963   for xe_dir in $runpath_dirs; do   dnl Uniquify
1964     test "$xe_dir" = "$xe_runpath_dir" && xe_add_p=no
1965   done
1966   if test "$xe_add_p" = "yes"; then
1967     test -n "$runpath" && runpath="${runpath}:"
1968     runpath="${runpath}${xe_runpath_dir}"
1969     runpath_dirs="$runpath_dirs $xe_runpath_dir"
1970   fi'
1971
1972
1973 dnl XE_ADD_RUNPATH_DIR(directory)
1974 define([XE_ADD_RUNPATH_DIR],[{
1975 xe_runpath_dir=$1
1976 dnl PRINT_VAR(ld_switch_site ld_switch_x_site runpath xe_runpath_dir LD_RUN_PATH xe_ldflags)
1977   test "$xe_runpath_dir" != "/lib"     -a \
1978         "$xe_runpath_dir" != "/usr/lib" -a \
1979         -n "`ls ${xe_runpath_dir}/*.s[[ol]] 2>/dev/null`" && \
1980   eval "$xe_add_unique_runpath_dir"
1981 }])dnl
1982
1983 dnl XE_COMPUTE_RUNPATH()
1984 define([XE_COMPUTE_RUNPATH],[
1985 if test "$add_runtime_path" = "yes" -a -n "$dash_r"; then
1986   dnl Remove runtime paths from current ld switches
1987   ld_switch_site=`echo   '' $ld_switch_site   | sed -e 's:^ ::' -e "s/$dash_r[[^ ]]*//g"`
1988   ld_switch_x_site=`echo '' $ld_switch_x_site | sed -e 's:^ ::' -e "s/$dash_r[[^ ]]*//g"`
1989   dnl PRINT_VAR(ld_switch_site ld_switch_x_site)
1990
1991   dnl Fix up Runtime path
1992   dnl If LD_RUN_PATH is set in environment, use that.
1993   dnl In this case, assume user has set the right value.
1994   runpath="" runpath_dirs=""
1995   if test -n "$LD_RUN_PATH"; then
1996     runpath="$LD_RUN_PATH"
1997   elif test "$GCC" = "yes"; then
1998     dnl Compute runpath from gcc's -v output
1999     ld_switch_run_save="$ld_switch_run"; ld_switch_run=""
2000     echo "int main(int argc, char *argv[[]]) {return 0;}" > conftest.c
2001     xe_runpath_link='${CC-cc} -o conftest -v $CFLAGS '"$xe_ldflags"' conftest.$ac_ext 2>&1 1>/dev/null'
2002     for arg in `eval "$xe_runpath_link" | grep ' -L'`; do
2003       case "$arg" in P,* | -L* | -R* )
2004         for dir in `echo '' "$arg" | sed -e 's:^ ::' -e 's/^..//' -e 'y/:/ /'`; do
2005           XE_ADD_RUNPATH_DIR("$dir")
2006         done ;;
2007       esac
2008     done
2009     ld_switch_run="$ld_switch_run_save"
2010     rm -f conftest*
2011   else
2012     dnl Add all directories with .so files to runpath
2013     for arg in $ld_switch_site $ld_switch_x_site; do
2014       case "$arg" in -L*) XE_ADD_RUNPATH_DIR(`echo '' "$arg" | sed -e 's:^ ::' -e 's/^-L//'`);; esac
2015     done
2016     dnl Sometimes /opt/SUNWdt/lib is the only installed Motif available
2017     if test "$opsys $need_motif" = "sol2 yes"; then
2018       xe_runpath_dir="/opt/SUNWdt/lib";
2019       eval "$xe_add_unique_runpath_dir";
2020     fi
2021   fi dnl Compute $runpath
2022
2023   if test -n "$runpath"; then
2024     ld_switch_run="${dash_r}${runpath}"
2025     XE_PROTECT_LINKER_FLAGS(ld_switch_run)
2026     test "$extra_verbose" = "yes" && echo "Setting runpath to $runpath"
2027   fi
2028 fi
2029 ])dnl
2030 XE_COMPUTE_RUNPATH()
2031
2032 dnl JKJ REMOVEME
2033 dnl XE_SHLIB_STUFF
2034
2035 dnl -----------------------------------
2036 dnl Do some misc autoconf-special tests
2037 dnl -----------------------------------
2038
2039 dnl Do the opsystem or machine files prohibit the use of the GNU malloc?
2040 dnl Assume not, until told otherwise.
2041 GNU_MALLOC=yes
2042 if test "$with_dlmalloc" != "no"; then
2043         doug_lea_malloc=yes
2044 else
2045         doug_lea_malloc=no
2046 fi
2047 after_morecore_hook_exists=yes
2048 AC_CHECK_FUNC(malloc_get_state, ,doug_lea_malloc=no)
2049 AC_CHECK_FUNC(malloc_set_state, ,doug_lea_malloc=no)
2050 AC_MSG_CHECKING(whether __after_morecore_hook exists)
2051 AC_TRY_LINK([extern void (* __after_morecore_hook)();],[__after_morecore_hook = 0],
2052   [AC_MSG_RESULT(yes)],
2053   [AC_MSG_RESULT(no)
2054    after_morecore_hook_exists=no])
2055 if test "$system_malloc" = "yes" ; then
2056   GNU_MALLOC=no
2057   GNU_MALLOC_reason="
2058   (The GNU allocators don't work with this system configuration)."
2059 elif test "$with_system_malloc" = "yes" ; then
2060   GNU_MALLOC=no
2061   GNU_MALLOC_reason="
2062   (User chose not to use GNU allocators)."
2063 elif test "$with_debug_malloc" = "yes" ; then
2064   GNU_MALLOC=no
2065   GNU_MALLOC_reason="
2066   (User chose to use Debugging Malloc)."
2067 fi
2068
2069 if test "$doug_lea_malloc" = "yes" ; then
2070   if test "$GNU_MALLOC" = yes ; then
2071     GNU_MALLOC_reason="
2072   (Using Doug Lea's new malloc from the GNU C Library.)"
2073   fi
2074   AC_DEFINE(DOUG_LEA_MALLOC)
2075   if test "$after_morecore_hook_exists" = "no" ; then
2076     GNU_MALLOC_reason="
2077   (Using Doug Lea's new malloc from the Linux C Library.)"
2078     AC_DEFINE(_NO_MALLOC_WARNING_)
2079   fi
2080   use_minimal_tagbits=yes
2081 fi
2082
2083 dnl #### mcheck is broken in all versions of Linux libc and glibc.
2084 dnl Try this again when 2.1 hits the streets.
2085 dnl Avoid using free-hook.c if support exists for malloc debugging in libc
2086 dnl have_libmcheck=no
2087 dnl if test "$error_check_malloc" = "yes" -a \
2088 dnl    "$have_glibc" = "yes" -a \
2089 dnl    "$doug_lea_malloc" = "yes"; then
2090 dnl   AC_CHECK_HEADERS(mcheck.h)
2091 dnl   AC_CHECK_LIB(mcheck, mcheck, have_libmcheck=yes, have_libmcheck=no)
2092 dnl fi
2093
2094 dnl if test "$have_libmcheck" = "yes"; then
2095 dnl   AC_DEFINE(HAVE_LIBMCHECK)
2096 dnl   libmcheck=-lmcheck
2097 dnl   AC_SUBST(libmcheck)
2098 dnl fi
2099
2100 dnl Some other nice autoconf tests.  If you add a test here which
2101 dnl should make an entry in src/config.h, do not forget to add an
2102 dnl #undef clause to src/config.h.in for autoconf to modify.
2103
2104 AC_PROG_RANLIB
2105 AC_PROG_INSTALL
2106 AC_PROG_YACC
2107
2108 dnl checks for header files
2109 AC_CHECK_HEADERS(mach/mach.h sys/stropts.h sys/timeb.h sys/time.h unistd.h)
2110 AC_CHECK_HEADERS(utime.h locale.h libgen.h fcntl.h ulimit.h cygwin/version.h)
2111 AC_CHECK_HEADERS(kstat.h sys/pstat.h inttypes.h sys/un.h a.out.h)
2112 AC_HEADER_SYS_WAIT
2113 AC_HEADER_STDC
2114 AC_HEADER_TIME
2115 AC_DECL_SYS_SIGLIST
2116
2117 dnl Some systems have utime.h but do not declare the struct anyplace.
2118 AC_MSG_CHECKING(for struct utimbuf)
2119 AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME
2120 #include <sys/time.h>
2121 #include <time.h>
2122 #else
2123 #ifdef HAVE_SYS_TIME_H
2124 #include <sys/time.h>
2125 #else
2126 #include <time.h>
2127 #endif
2128 #endif
2129 #ifdef HAVE_UTIME_H
2130 #include <utime.h>
2131 #endif], [static struct utimbuf x; x.actime = x.modtime;],
2132   [AC_MSG_RESULT(yes)
2133    AC_DEFINE(HAVE_STRUCT_UTIMBUF)],
2134   AC_MSG_RESULT(no))
2135
2136 dnl checks for typedefs
2137 AC_TYPE_SIGNAL
2138 AC_TYPE_SIZE_T
2139 AC_TYPE_PID_T
2140 AC_TYPE_UID_T
2141 AC_TYPE_MODE_T
2142 AC_TYPE_OFF_T
2143
2144 AC_MSG_CHECKING(for struct timeval)
2145 AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME
2146 #include <sys/time.h>
2147 #include <time.h>
2148 #else
2149 #ifdef HAVE_SYS_TIME_H
2150 #include <sys/time.h>
2151 #else
2152 #include <time.h>
2153 #endif
2154 #endif], [static struct timeval x; x.tv_sec = x.tv_usec;],
2155   [AC_MSG_RESULT(yes)
2156   HAVE_TIMEVAL=yes
2157   AC_DEFINE(HAVE_TIMEVAL)],
2158   [AC_MSG_RESULT(no)
2159    HAVE_TIMEVAL=no])
2160
2161 dnl checks for structure members
2162 AC_STRUCT_TM
2163 AC_STRUCT_TIMEZONE
2164
2165 dnl checks for compiler characteristics
2166 AC_C_CONST
2167
2168 dnl check for Make feature
2169 AC_PROG_MAKE_SET
2170
2171 dnl check byte order
2172 AC_C_BIGENDIAN
2173
2174 dnl define SIZEOF_TYPE
2175 AC_CHECK_SIZEOF(short)
2176 if test "$ac_cv_sizeof_short" = 0; then
2177   echo ""
2178   echo "*** PANIC *** Configure tests are not working - compiler is broken."
2179   echo "*** PANIC *** Please examine config.log for compilation errors."
2180   exit 1
2181 fi
2182 AC_CHECK_SIZEOF(int)
2183 AC_CHECK_SIZEOF(long)
2184 AC_CHECK_SIZEOF(long long)
2185 AC_CHECK_SIZEOF(void *)
2186
2187 dnl check for long file names
2188 AC_SYS_LONG_FILE_NAMES
2189
2190 dnl -lm is required by LISP_FLOAT_TYPE, among other things
2191 AC_CHECK_LIB(m, sin)
2192
2193 dnl Floating operation support is now unconditional
2194 AC_DEFINE(LISP_FLOAT_TYPE)
2195
2196 AC_TRY_LINK([#include <math.h>],
2197   [return atanh(1.0) + asinh(1.0) + acosh(1.0); ],
2198   AC_DEFINE(HAVE_INVERSE_HYPERBOLIC))
2199
2200 dnl Determine type of mail locking from configure args and s&m headers
2201 AC_CHECKING(type of mail spool file locking)
2202 test -z "$mail_locking" -a "$mail_use_flock" = "yes" && mail_locking=flock
2203 test -z "$mail_locking" -a "$mail_use_lockf" = "yes" && mail_locking=lockf
2204 if   test "$mail_locking" = "lockf"; then AC_DEFINE(REAL_MAIL_USE_LOCKF)
2205 elif test "$mail_locking" = "flock"; then AC_DEFINE(REAL_MAIL_USE_FLOCK)
2206 else mail_locking="dot-locking"
2207 fi
2208
2209 dnl Used by getloadavg() - does not require root priveleges
2210 AC_CHECK_LIB(kstat, kstat_open)
2211
2212 dnl Another way to get the load average
2213 AC_CHECK_LIB(kvm, kvm_read)
2214
2215 case "$opsys" in decosf*)
2216   AC_CHECK_LIB(pthreads, cma_open)
2217   test "$ac_cv_lib_pthreads_cma_open" = "yes" && \
2218     c_switch_site="$c_switch_site -threads" ;;
2219 esac
2220
2221 AC_MSG_CHECKING(whether the -xildoff compiler flag is required)
2222 if   ${CC-cc} '-###' -xildon  no_such_file.c 2>&1 | grep '^[^ ]*/ild ' > /dev/null ; then
2223   if ${CC-cc} '-###' -xildoff no_such_file.c 2>&1 | grep '^[^ ]*/ild ' > /dev/null ;
2224     then AC_MSG_RESULT(no);
2225     else AC_MSG_RESULT(yes); XE_APPEND(-xildoff, ld_switch_site)
2226   fi
2227   else AC_MSG_RESULT(no)
2228 fi
2229
2230 dnl Link with "-z ignore" on Solaris if supported
2231 if test "$opsys" = "sol2" && test "$OS_RELEASE" -ge 56; then
2232   AC_MSG_CHECKING(for \"-z ignore\" linker flag)
2233   case "`ld -h 2>&1`" in
2234     *-z\ ignore\|record* ) AC_MSG_RESULT(yes)
2235       XE_PREPEND(-z ignore, ld_switch_site) ;;
2236     *) AC_MSG_RESULT(no) ;;
2237   esac
2238 fi
2239
2240 dnl ----------------------
2241 dnl Choose a window system
2242 dnl ----------------------
2243
2244 AC_CHECKING("for specified window system")
2245
2246 if test "$with_x11" != "no"; then
2247   dnl User-specified --x-includes or --x-libraries implies --with-x11.
2248   test "$x_includes $x_libraries" != "NONE NONE" && \
2249    window_system=x11 with_x11=yes
2250
2251   dnl Autodetection of X11 libraries and includes
2252   dnl -------------------------------------------
2253   dnl AC_PATH_XTRA thinks it can find our X headers and includes, but
2254   dnl it often gets it wrong, so we only use it as a last resort.
2255
2256   dnl $OPENWINHOME implies --x-includes and --x-libraries
2257   dnl Not (yet) handled by autoconf2
2258   if test "$x_includes $x_libraries" = "NONE NONE" \
2259     -a -n "$OPENWINHOME" \
2260     -a "$OPENWINHOME" != "/usr/openwin" \
2261     -a -d "$OPENWINHOME"; then
2262       test -d "$OPENWINHOME/lib"           && x_libraries="$OPENWINHOME/lib"
2263       test -d "$OPENWINHOME/include"       && x_includes="$OPENWINHOME/include"
2264       test -d "$OPENWINHOME/share/include" && x_includes="$OPENWINHOME/share/include"
2265   fi
2266
2267   if test "$x_includes" = "NONE"; then
2268     dnl AC_PATH_XTRA often guesses /usr/include, when some other
2269     dnl include directory is a MUCH better guess (Linux, HP-UX 10.20).
2270     dnl This is a workaround for idiot (esp. HP) system vendors, who
2271     dnl provide a /usr/include/X11, but DON'T FULLY POPULATE IT.
2272     for dir in "/usr/X11" "/usr/X11R6"; do
2273       if test -d "$dir/include/X11"; then x_includes="$dir/include"; break; fi
2274     done
2275   fi
2276
2277   if test "$x_libraries" = "NONE"; then
2278     for dir in "/usr/X11/lib" "/usr/X11R6/lib" "/usr/lib/X11R6"; do
2279       if test -r "$dir/libX11.a"; then x_libraries="$dir"; break; fi
2280     done
2281   fi
2282
2283   AC_PATH_XTRA # Autoconf claims to find X library and include dirs for us.
2284   if test "$no_x" = "yes"
2285   then with_x11=no  window_system=none HAVE_X_WINDOWS=no
2286   else with_x11=yes window_system=x11  HAVE_X_WINDOWS=yes
2287   fi
2288 fi
2289
2290 case "$with_x11" in
2291   yes ) window_system=x11  HAVE_X_WINDOWS=yes ;;
2292   no  ) window_system=none HAVE_X_WINDOWS=no  ;;
2293 esac
2294
2295 if test "$with_x11" = "yes"; then
2296   AC_DEFINE(HAVE_X_WINDOWS)
2297   XE_APPEND(lwlib, MAKE_SUBDIR)
2298   XE_APPEND(lwlib, SRC_SUBDIR_DEPS)
2299
2300   dnl Try to find Motif/CDE/Tooltalk dirs
2301   dnl These take precedence over other X libs/includes, so PRE-pend
2302   for lib_dir in "/usr/dt/lib" "/usr/lib/Motif2.1" "/usr/lib/Motif1.2" "/usr/lib/Motif1.1"; do
2303     inc_dir=`echo $lib_dir | sed -e 's/lib/include/'`
2304     if test -d "$lib_dir" -a -d "$inc_dir"; then
2305       case "$x_libraries" in *"$lib_dir"* ) ;; *)
2306         x_libraries="$lib_dir $x_libraries"
2307         XE_PREPEND(-L${lib_dir}, X_LIBS) ;;
2308       esac
2309       case "$x_includes" in "$inc_dir"* ) ;; *)
2310         x_includes="$inc_dir $x_includes"
2311         XE_PREPEND(-I${inc_dir}, X_CFLAGS) ;;
2312       esac
2313       break; dnl only need ONE Motif implementation!
2314       fi
2315   done
2316
2317   dnl Contrib X libs/includes do NOT take precedence, so AP-pend
2318   for rel in "X11R6" "X11R5" "X11R4"; do
2319     lib_dir="/usr/contrib/$rel/lib" inc_dir="/usr/contrib/$rel/include"
2320     if test -d "$lib_dir" -a -d "$inc_dir"; then
2321       case "$x_libraries" in *"$lib_dir"* ) ;; *)
2322         x_libraries="$x_libraries $lib_dir"
2323         XE_APPEND(-L${lib_dir}, X_LIBS)
2324       esac
2325       case "$x_includes" in "$inc_dir"* ) ;; *)
2326         x_includes="$x_includes $inc_dir"
2327         XE_APPEND(-I${inc_dir}, X_CFLAGS)
2328       esac
2329       break; dnl Only need ONE X11 implementation !
2330     fi
2331   done
2332
2333   dnl Avoid version mismatch for shared library libXm.so on osf4
2334   if test "$GCC" = yes -a -d /usr/shlib; then XE_APPEND(-L/usr/shlib, X_LIBS); fi
2335
2336   ld_switch_x_site="$X_LIBS"
2337
2338   XE_COMPUTE_RUNPATH()
2339
2340   if test "$extra_verbose" = "yes"; then
2341     echo; echo "X11 compilation variables:"
2342     PRINT_VAR(x_libraries x_includes X_CFLAGS X_LIBS X_PRE_LIBS X_EXTRA_LIBS)
2343     echo
2344   fi
2345
2346   dnl Set up bitmaps search path.
2347   dnl The original suggestion was to unconditionally to append X11/bitmaps
2348   dnl to each element of $x_includes, I'm pretty sure this is the wrong
2349   dnl thing to do.  We test for bitmaps and X11/bitmaps directories on each
2350   dnl element and add them to BITMAPDIR if they exist.
2351   bitmapdirs=
2352   if test "$x_includes" != NONE; then
2353     for i in $x_includes; do
2354       if test -d "$i/bitmaps"; then
2355         bitmapdirs="$i/bitmaps:$bitmapdirs"
2356       fi
2357       if test -d "$i/X11/bitmaps"; then
2358         bitmapdirs="$i/X11/bitmaps:$bitmapdirs"
2359       fi
2360     done
2361     bitmapdirs=`echo "$bitmapdirs" | sed s/.$//`
2362   fi
2363   test ! -z "$bitmapdirs" && AC_DEFINE_UNQUOTED(BITMAPDIR, "$bitmapdirs")
2364
2365   dnl Autodetect defines extracted from X config by xmkmf, e.g. NARROWPROTO
2366   AC_CHECKING(for X defines extracted by xmkmf)
2367   rm -fr conftestdir
2368   if mkdir conftestdir; then
2369     cd conftestdir
2370     cat > Imakefile <<'EOF'
2371 xetest:
2372         @echo ${PROTO_DEFINES} ${STD_DEFINES}
2373 EOF
2374     if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
2375       # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
2376       xmkmf_defines=`${MAKE-make} xetest 2>/dev/null | grep -v make`
2377     fi
2378     cd ..
2379     rm -fr conftestdir
2380     for word in $xmkmf_defines; do
2381       case "$word" in
2382         -D*=* ) ;;
2383         -D* ) word=`echo '' $word | sed -e 's:^ *-D::'`
2384               AC_DEFINE_UNQUOTED($word) ;;
2385       esac
2386     done
2387   fi
2388
2389   dnl make sure we can find Intrinsic.h
2390   AC_CHECK_HEADER(X11/Intrinsic.h, ,
2391    [AC_MSG_ERROR("Unable to find X11 header files.")])
2392
2393   dnl -lXt and -lX11 are required
2394   dnl Some broken systems require the magic "-b i486-linuxaout" flag
2395   AC_CHECK_LIB(X11, XOpenDisplay, have_lib_x11=yes)
2396   if test "$have_lib_x11" != "yes"; then
2397     AC_CHECK_LIB(X11, XGetFontProperty,
2398       ld_switch_x_site="-b i486-linuxaout $ld_switch_x_site",
2399       [AC_MSG_ERROR("Unable to find X11 libraries.")],
2400       -b i486-linuxaout)
2401   fi
2402   libs_x="-lX11"
2403   test "$extra_verbose" = "yes" && echo "    Setting libs_x to \"-lX11\""
2404
2405   dnl Autodetect -lXext
2406   AC_CHECK_LIB(Xext, XShapeSelectInput, XE_PREPEND(-lXext, libs_x))
2407
2408   dnl Require -lXt
2409   AC_CHECK_LIB(Xt, XtOpenDisplay, XE_PREPEND(-lXt, libs_x),
2410     AC_MSG_ERROR("Unable to find X11 libraries."))
2411
2412   AC_MSG_CHECKING(the version of X11 being used)
2413   AC_TRY_RUN([#include <X11/Intrinsic.h>
2414     int main(int c, char *v[]) { return c>1 ? XlibSpecificationRelease : 0; }],
2415     [./conftest foobar; x11_release=$?],[x11_release=4],[x11_release=4])
2416   AC_MSG_RESULT(R${x11_release})
2417   AC_DEFINE_UNQUOTED(THIS_IS_X11R${x11_release})
2418
2419   AC_CHECK_HEADERS(X11/Xlocale.h)
2420
2421   dnl remove this - we should avoid checking for specific OS
2422   AC_MSG_CHECKING(for XFree86)
2423   if test -d "/usr/X386/include" -o \
2424           -f "/etc/XF86Config"    -o \
2425           -f "/etc/X11/XF86Config" -o \
2426           -f "/usr/X11R6/lib/X11/XF86Config"; then
2427     AC_MSG_RESULT(yes)
2428     AC_DEFINE(HAVE_XFREE386)
2429   else
2430     AC_MSG_RESULT(no)
2431   fi
2432
2433   dnl autodetect -lXmu
2434   test -z "$with_xmu" && { AC_CHECK_LIB(Xmu, XmuReadBitmapDataFromFile,
2435                            with_xmu=yes, with_xmu=no) }
2436   if test "$with_xmu" = "no"; then
2437     XE_ADD_OBJS(xmu.o)
2438   else
2439     XE_PREPEND(-lXmu, libs_x)
2440     AC_DEFINE(HAVE_XMU)
2441   fi
2442
2443   dnl Autodetect -lXbsd
2444   dnl #### Someone, please add a better function than main
2445   AC_CHECK_LIB(Xbsd, main, XE_PREPEND(-lXbsd, libs_x))
2446
2447   dnl Problem with the MIT distribution of X on AIX
2448   if test "$unexec" = "unexaix.o" -a "$x11_release" = "6"; then
2449     dnl X11R6 requires thread-safe code on AIX for some reason
2450     if test "$GCC" = "yes"; then
2451       XE_PREPEND(-mthreads, X_CFLAGS)
2452       XE_PREPEND(-mthreads, libs_x)
2453     else
2454       case "$CC" in
2455         "xlc" ) CC="xlc_r" ;;
2456         "xlC" ) CC="xlC_r" ;;
2457         "cc"  ) CC="cc_r" ;;
2458       esac
2459     fi
2460   fi
2461
2462 fi dnl $with_x11 = yes
2463
2464 if test "$with_msw" != "no"; then
2465   AC_CHECKING(for MS-Windows)
2466   AC_CHECK_LIB(gdi32,main,with_msw=yes)
2467   if test "$with_msw" = "yes"; then
2468     AC_DEFINE(HAVE_MS_WINDOWS)
2469     install_pp="$blddir/lib-src/installexe.sh"
2470     XE_APPEND(-lshell32 -lgdi32 -luser32 -lcomctl32, libs_system)
2471     test "$with_dragndrop" != no && XE_APPEND(msw, dragndrop_proto)
2472     if test "$window_system" != x11; then
2473         window_system=msw
2474         test "$with_scrollbars" != "no" && with_scrollbars=msw \
2475             && XE_ADD_OBJS(scrollbar-msw.o)
2476         test "$with_menubars"   != "no" && with_menubars=msw \
2477             && XE_ADD_OBJS(menubar-msw.o)
2478         test "$with_toolbars"   != "no" && with_toolbars=msw \
2479             && XE_ADD_OBJS(toolbar-msw.o)
2480         test "$with_dialogs"   != "no" && with_dialogs=msw \
2481             && XE_ADD_OBJS(dialog-msw.o)
2482     else
2483         test "$with_scrollbars" != "no" && XE_ADD_OBJS(scrollbar-msw.o)
2484         test "$with_menubars"   != "no" && XE_ADD_OBJS(menubar-msw.o)
2485         test "$with_toolbars"   != "no" && XE_ADD_OBJS(toolbar-msw.o)
2486         test "$with_dialogs"    != "no" && XE_ADD_OBJS(dialog-msw.o)
2487     fi
2488     dnl check for our special version of select
2489     AC_TRY_RUN([#include <fcntl.h>
2490     int main() { return (open("/dev/windows", O_RDONLY, 0) > 0)? 0 : 1; }],
2491     [AC_DEFINE(HAVE_MSG_SELECT)])
2492     const_is_losing=no
2493     with_file_coding=yes
2494     use_minimal_tagbits=yes
2495     use_indexed_lrecord_implementation=yes
2496     XE_ADD_OBJS(console-msw.o device-msw.o event-msw.o frame-msw.o objects-msw.o select-msw.o redisplay-msw.o glyphs-msw.o gui-msw.o)
2497   fi
2498 fi
2499
2500 AC_SUBST(install_pp)
2501
2502 test -z "$window_system" && window_system="none"
2503
2504 dnl Test for features that require a window system - ANY window system
2505 if test "$window_system" = "none"; then
2506   for feature in menubars scrollbars toolbars dialogs dragndrop xface
2507   do
2508     if eval "test -n \"\$with_${feature}\" -a \"\$with_${feature}\" != no" ; then
2509        AC_MSG_WARN([--with-$feature ignored:  Not valid without window system support])
2510     fi
2511     eval "with_${feature}=no"
2512   done
2513 else
2514   test -z "$with_toolbars" && with_toolbars=yes
2515 fi
2516
2517 dnl ### Test for features that require mswindows support - currently none
2518 dnl ### MS-Windows folks: add code here..... (martin)
2519 if test "$with_msw" != "yes"; then
2520   for feature in   MARTIN_IS_CLUELESS_ABOUT_MSW_FEATURES
2521   do
2522     if eval "test -n \"\$with_${feature}\" -a \"\$with_${feature}\" != no" ; then
2523        AC_MSG_WARN([--with-$feature ignored:  Not valid without MS-Windows support])
2524     fi
2525     eval "with_${feature}=no"
2526   done
2527 else
2528   :
2529 fi
2530
2531 dnl Test for features that require X11 support
2532 if test "$with_x11" != "yes"; then
2533   dnl It ought to be reasonable to have no output device at all, and only use
2534   dnl XEmacs in --batch mode.
2535   dnl if test "$with_tty" = "no" ; then
2536   dnl   AC_MSG_ERROR([No window system support and no TTY support - Unable to proceed.])
2537   dnl fi
2538   for feature in tooltalk cde offix session xim xmu 
2539   do
2540     if eval "test -n \"\$with_${feature}\" -a \"\$with_${feature}\" != no" ; then
2541        AC_MSG_WARN([--with-$feature ignored:  Not valid without X support])
2542     fi
2543     eval "with_${feature}=no"
2544   done
2545 fi
2546
2547 dnl FSF 19.29 has some bitmapdir stuff here.
2548 bitmapdir=
2549
2550 case "$window_system" in
2551   x11  ) HAVE_X_WINDOWS=yes; echo "  Using X11." ;;
2552   msw  ) HAVE_X_WINDOWS=no ; echo "  Using MS-Windows." ;;
2553   none ) HAVE_X_WINDOWS=no ; echo "  Using no window system." ;;
2554 esac
2555
2556 case "$x_libraries" in *X11R4* )
2557   test "$opsys" = "hpux9"     && opsysfile="s/hpux9-x11r4.h"
2558   test "$opsys" = "hpux9-shr" && opsysfile="s/hpux9shxr4.h"
2559 esac
2560
2561 dnl Enable or disable proper session-management
2562 AC_CHECKING(for session-management option);
2563 dnl if test "$with_session" = "yes"; then
2564 if test "$with_session" != "no"; then
2565   AC_DEFINE(HAVE_SESSION)
2566 fi
2567
2568 dnl Autodetect Xauth
2569 dnl -lXau is only used by gnuclient, so use a special variable for Xauth X libs
2570 test -z "$with_xauth" && test "$window_system" = "none" && with_xauth=no
2571 test -z "$with_xauth" && { AC_CHECK_HEADER(X11/Xauth.h,          ,with_xauth=no) }
2572 test -z "$with_xauth" && { AC_CHECK_LIB(Xau, XauGetAuthByAddr,[:],with_xauth=no) }
2573 test -z "$with_xauth" && with_xauth=yes
2574 if test "$with_xauth" = "yes"; then
2575   AC_DEFINE(HAVE_XAUTH)
2576   XE_SPACE(libs_xauth, $X_EXTRA_LIBS -lXau $libs_x $X_PRE_LIBS)
2577 fi
2578 AC_SUBST(libs_xauth)
2579
2580 dnl This one is for the static initializeds variables in
2581 dnl offix.c, so that the thing is dumped after lastfile.o
2582 AC_SUBST(dnd_objs)
2583
2584 dnl Autodetect tooltalk
2585 if test "$with_tooltalk" != "no" ; then
2586   dnl autodetect the location of tt_c.h
2587   dnl tt_c.h might be in Tt or desktop include directories
2588   for dir in "" "Tt/" "desktop/" ; do
2589     AC_CHECK_HEADER(${dir}tt_c.h, tt_c_h_path="${dir}tt_c.h"; break)
2590   done
2591   if test -z "$tt_c_h_path"; then
2592     if test "$with_tooltalk" = "yes"; then
2593       USAGE_ERROR("Unable to find required tooltalk header files.")
2594     fi
2595     with_tooltalk=no
2596   fi
2597 fi
2598 if test "$with_tooltalk" != "no" ; then
2599   for extra_libs in "" "-lI18N -lce" "-lcxx"; do
2600     AC_CHECK_LIB(tt, tt_message_create,
2601       tt_libs="-ltt $extra_libs"; break, [:],$extra_libs)
2602   done
2603   if test -z "$tt_libs"; then
2604     if test "$with_tooltalk" = "yes"; then
2605       USAGE_ERROR("Unable to find required tooltalk libraries.")
2606     fi
2607     with_tooltalk=no
2608   fi
2609 fi
2610 test -z "$with_tooltalk" && with_tooltalk=yes
2611 if test "$with_tooltalk" = "yes"; then
2612   AC_DEFINE(TOOLTALK)
2613   AC_DEFINE_UNQUOTED(TT_C_H_PATH, "$tt_c_h_path")
2614   XE_PREPEND($tt_libs, libs_x)
2615   XE_ADD_OBJS(tooltalk.o)
2616 fi
2617
2618 dnl Autodetect CDE
2619 test -z "$with_cde" && { AC_CHECK_HEADER(Dt/Dt.h,               , with_cde=no) }
2620 test -z "$with_cde" && { AC_CHECK_LIB(DtSvc, DtDndDragStart, [:], with_cde=no) }
2621 test -z "$with_cde" && with_cde=yes
2622 if test "$with_dragndrop" = no; then
2623   AC_MSG_WARN([No CDE without generic Drag'n'Drop support])
2624   with_cde=no
2625 fi
2626 if test "$with_cde" = "yes" ; then
2627   AC_DEFINE(HAVE_CDE)
2628   XE_PREPEND(-lDtSvc, libs_x)
2629   XE_APPEND(CDE, dragndrop_proto)
2630   with_tooltalk=yes # CDE requires Tooltalk
2631   need_motif=yes    # CDE requires Motif
2632 fi
2633
2634 dnl Always compile OffiX unless --without-offix is given, no
2635 dnl X11 support is compiled in, no standard Xmu is available,
2636 dnl or dragndrop support is disabled
2637 dnl Because OffiX support currently loses when more than one display
2638 dnl is in use, we now disable it by default -slb 07/10/1998.
2639 test "$window_system" != "x11" && with_offix=no
2640 if test "$with_xmu" != yes -a "$with_x11" = yes; then
2641   AC_MSG_WARN([No OffiX without real Xmu support])
2642   with_offix=no
2643 fi
2644 if test "$with_dragndrop" = no; then
2645   AC_MSG_WARN([No OffiX without generic Drag'n'Drop support])
2646   with_offix=no
2647 fi
2648 if test "$with_cde" = yes; then
2649   AC_MSG_WARN([CDE already found, disabling OffiX support])
2650   with_offix=no
2651 fi
2652 test -z "$with_offix" && with_offix=no
2653 if test "$with_offix" = "yes"; then
2654   AC_DEFINE(HAVE_OFFIX_DND)
2655   XE_APPEND(offix.o, dnd_objs)
2656   XE_APPEND(OffiX, dragndrop_proto)
2657 fi
2658
2659 dnl Autodetect Drag'n'Drop support
2660 dnl always included if CDE, Offix, or MSWindows are defined
2661 AC_MSG_CHECKING(if drag and drop API is needed)
2662 if test "$with_dragndrop" != "no" ; then
2663   if test -n "$dragndrop_proto" ; then
2664     with_dragndrop=yes
2665     AC_MSG_RESULT([yes (${dragndrop_proto} )])
2666     AC_DEFINE(HAVE_DRAGNDROP)
2667     XE_APPEND(dragdrop.o, extra_objs)
2668   else
2669     with_dragndrop=no
2670     AC_MSG_RESULT(no)
2671   fi
2672 fi
2673
2674 dnl Autodetect LDAP
2675 AC_CHECKING(for LDAP)
2676 test -z "$with_ldap" && { AC_CHECK_HEADER(ldap.h, ,with_ldap=no) }
2677 test -z "$with_ldap" && { AC_CHECK_HEADER(lber.h, ,with_ldap=no) }
2678 if test "$with_ldap" != "no"; then
2679   test -z "$with_umich_ldap" && { AC_CHECK_LIB(ldap, ldap_open, with_umich_ldap=yes, with_umich_ldap=no, -llber) }
2680   test "$with_umich_ldap" = "no" && { AC_CHECK_LIB(ldap10, ldap_set_option, with_ns_ldap=yes, with_ns_ldap=no) }
2681   test -z "$with_ldap" -a \( "$with_umich_ldap" = "yes" -o "$with_ns_ldap" = "yes" \) && with_ldap=yes
2682 fi
2683 if test "$with_ldap" = "yes"; then
2684   AC_DEFINE(HAVE_LDAP)
2685   XE_ADD_OBJS(eldap.o)
2686   if test "$with_umich_ldap" = "yes" ; then
2687     AC_DEFINE(HAVE_UMICH_LDAP)
2688     XE_PREPEND(-llber, LIBS)
2689     XE_PREPEND(-lldap, LIBS)
2690   elif test "$with_ldap" = "yes" -a "$with_ns_ldap" = "yes" ; then
2691     AC_DEFINE(HAVE_NS_LDAP)
2692     XE_PREPEND(-lldap10, LIBS)
2693   elif test "$with_ldap" = "yes" ; then
2694     XE_PREPEND(-lldap, LIBS)
2695   fi
2696 fi
2697
2698 dnl ----------------------
2699 dnl Graphics libraries
2700 dnl ----------------------
2701
2702 if test "$window_system" != "none"; then
2703   AC_CHECKING(for graphics libraries)
2704
2705   dnl Autodetect Xpm
2706   xpm_problem=""
2707   if test -z "$with_xpm"; then
2708     AC_MSG_CHECKING(for Xpm - no older than 3.4f)
2709     xe_check_libs=-lXpm
2710     AC_TRY_RUN([#include <X11/xpm.h>
2711     int main(int c, char **v) {
2712     return c == 1 ? 0 :
2713       XpmIncludeVersion != XpmLibraryVersion() ? 1 :
2714       XpmIncludeVersion < 30406 ? 2 : 0 ;}],
2715     [./conftest dummy_arg; xpm_status=$?;
2716       if test "$xpm_status" = "0"; then
2717         with_xpm=yes;
2718       else
2719         with_xpm=no;
2720         if test "$xpm_status" = "1"; then
2721           xpm_problem="Xpm library version and header file version don't match!"
2722         elif test "$xpm_status" = "2"; then
2723           xpm_problem="Xpm library version is too old!"
2724         else
2725           xpm_problem="Internal xpm detection logic error!"
2726         fi
2727         echo "
2728 *** WARNING *** $xpm_problem
2729   I'm not touching that with a 10-foot pole!
2730   If you really want to use the installed version of Xpm, rerun
2731   configure and add '--with-xpm=yes', but don't blame me if XEmacs crashes!"
2732     fi],
2733     [with_xpm=no])
2734     xe_check_libs=
2735     AC_MSG_RESULT($with_xpm)
2736   fi
2737   if test "$with_xpm" = "yes"; then
2738     AC_DEFINE(HAVE_XPM)
2739     XE_PREPEND(-lXpm, libs_x)
2740     AC_MSG_CHECKING(for \"FOR_MSW\" xpm)
2741     xe_check_libs=-lXpm
2742     AC_TRY_LINK(, [XpmCreatePixmapFromData()],
2743     [xpm_for_msw=no],
2744     [xpm_for_msw=yes])
2745     xe_check_libs=
2746     AC_MSG_RESULT($xpm_for_msw)
2747     if test "$xpm_for_msw" = "yes"; then
2748       AC_DEFINE(FOR_MSW)
2749     fi
2750   fi
2751
2752   dnl Autodetect XFACE
2753   test -z "$with_xface" && { AC_CHECK_HEADER(compface.h,          ,with_xface=no) }
2754   test -z "$with_xface" && { AC_CHECK_LIB(compface, UnGenFace,[:] ,with_xface=no) }
2755   test -z "$with_xface" && with_xface=yes
2756   if test "$with_xface" = "yes"; then
2757     AC_DEFINE(HAVE_XFACE)
2758     XE_PREPEND(-lcompface, libs_x)
2759   fi
2760
2761   dnl For a brief period we had the GIF code split out into a separate library,
2762   dnl but patent problems, etc. sort of squashed that idea.
2763   dnl We default to building with builtin GIF decoding
2764   if test "$with_gif" != "no"; then
2765     with_gif="yes"
2766     AC_DEFINE(HAVE_GIF)
2767     XE_ADD_OBJS(dgif_lib.o gif_io.o)
2768   fi
2769
2770   dnl Too many stupid linkers can't detect cascaded lib dependencies until runtime
2771   dnl So we always search for libz compression support.
2772   if test "$with_png $with_tiff" != "no no"; then
2773     AC_CHECK_LIB(c,  inflate, [:], [
2774     AC_CHECK_LIB(z,  inflate, [XE_PREPEND(-lz,  libs_x)],[
2775     AC_CHECK_LIB(gz, inflate, [XE_PREPEND(-lgz, libs_x)])])])
2776   fi
2777
2778   dnl autodetect JPEG
2779   test -z "$with_jpeg" && { AC_CHECK_HEADER(jpeglib.h,                    ,with_jpeg=no) }
2780   test -z "$with_jpeg" && { AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,[:],with_jpeg=no) }
2781   test -z "$with_jpeg" && with_jpeg=yes
2782   if test "$with_jpeg" = "yes"; then
2783     AC_DEFINE(HAVE_JPEG)
2784     XE_PREPEND(-ljpeg, libs_x)
2785   fi
2786
2787   dnl autodetect PNG
2788   png_problem=""
2789   test -z "$with_png" && { AC_CHECK_FUNC(pow,                  ,with_png=no) }
2790   test -z "$with_png" && { AC_CHECK_HEADER(png.h,              ,with_png=no) }
2791   test -z "$with_png" && { AC_CHECK_LIB(png, png_read_image,[:],with_png=no) }
2792   if test -z "$with_png"; then
2793     AC_MSG_CHECKING(for workable png version information)
2794     xe_check_libs="-lpng -lz"
2795     AC_TRY_RUN([#include <png.h>
2796     int main(int c, char **v) {
2797     if (c == 1) return 0;
2798     if (strcmp(png_libpng_ver, PNG_LIBPNG_VER_STRING) != 0) return 1;
2799     return (PNG_LIBPNG_VER < 10002) ? 2 : 0 ;}],
2800     [./conftest dummy_arg; png_status=$?;
2801       if test "$png_status" = "0"; then
2802         with_png=yes;
2803       else
2804         with_png=no;
2805         if test "$png_status" = "1"; then
2806           png_problem="PNG library version and header file don't match!"
2807         elif test "$png_status" = "2"; then
2808           png_problem="PNG library version too old (pre 1.0.2)!"
2809         fi
2810         echo "
2811 *** WARNING *** $png_problem
2812   I'm not touching that with a 10-foot pole!
2813   If you really want to use the installed version of libPNG, rerun
2814   configure and add '--with-png=yes', but don't blame me if XEmacs crashes!"
2815     fi],
2816     [with_png=no])
2817     xe_check_libs=
2818     AC_MSG_RESULT($with_png)
2819   fi
2820   if test "$with_png" = "yes"; then
2821     AC_DEFINE(HAVE_PNG)
2822     XE_PREPEND(-lpng, libs_x)
2823   fi
2824
2825   dnl autodetect TIFF
2826   test -z "$with_tiff" && { AC_CHECK_HEADER(tiffio.h,            ,with_tiff=no) }
2827   test -z "$with_tiff" && { AC_CHECK_LIB(tiff, TIFFClientOpen,[:],with_tiff=no) }
2828   test -z "$with_tiff" && with_tiff=yes
2829   if test "$with_tiff" = "yes"; then
2830     AC_DEFINE(HAVE_TIFF)
2831     XE_PREPEND(-ltiff, libs_x)
2832   fi
2833 fi
2834
2835 dnl ----------------------
2836 dnl X-Specific Graphics libraries
2837 dnl ----------------------
2838
2839 if test "$with_x11" = "yes"; then
2840
2841   AC_CHECKING(for X11 graphics libraries)
2842
2843   dnl Autodetect -lXaw
2844   AC_CHECK_LIB(Xaw, XawScrollbarSetThumb, have_xaw=yes, have_xaw=no)
2845   dnl if test "$have_xaw" = "yes"; then
2846     dnl AC_CHECK_HEADER(X11/Xaw/Reports.h, [
2847       dnl XE_APPEND(pkg-src/tree-x, MAKE_SUBDIR)
2848       dnl XE_APPEND(pkg-src/tree-x, INSTALL_ARCH_DEP_SUBDIR)])
2849   dnl fi
2850
2851   dnl autodetect Motif - but only add to libs_x later (if necessary)
2852   AC_CHECK_HEADER(Xm/Xm.h,
2853    [AC_CHECK_LIB(Xm, XmStringFree, have_motif=yes, have_motif=no)],
2854    have_motif=no)
2855
2856   if test "$have_motif" = "yes"; then
2857     dnl autodetect lesstif
2858     AC_MSG_CHECKING(for Lesstif)
2859     AC_EGREP_CPP(yes,
2860 [#include <Xm/Xm.h>
2861 #ifdef LESSTIF_VERSION
2862 yes
2863 #endif
2864 ], have_lesstif=yes, have_lesstif=no)
2865   AC_MSG_RESULT($have_lesstif)
2866   fi
2867
2868 fi dnl "$with_x11" = "yes"
2869
2870 dnl Finish ensuring that we have values for the various toolkit items.
2871 dnl Not all toolkits support all widgets
2872 dnl if Motif is available we use it for the dialog boxes.
2873
2874 case "$with_menubars" in "" | "yes" | "athena" | "athena3d" )
2875   with_menubars="lucid" ;;
2876 esac
2877 case "$with_dialogs" in "" | "yes" | "lucid" )
2878   if   test "$have_motif" = "yes"; then with_dialogs="motif"
2879   elif test "$have_xaw"   = "yes"; then with_dialogs="athena"
2880   else with_dialogs=no
2881   fi ;;
2882 esac
2883 case "$with_scrollbars" in "" | "yes" )
2884   with_scrollbars="lucid" ;;
2885 esac
2886
2887 all_widgets="$with_menubars $with_scrollbars $with_dialogs $with_toolbars"
2888
2889 case "$all_widgets" in *athena* )
2890   AC_DEFINE(LWLIB_USES_ATHENA)
2891   AC_DEFINE(NEED_ATHENA)
2892   XE_APPEND(lwlib-Xaw.o, lwlib_objs)
2893   XE_PREPEND(-lXaw, libs_x) ;;
2894 esac
2895
2896 case "$all_widgets" in *motif* )
2897   AC_DEFINE(LWLIB_USES_MOTIF)
2898   AC_DEFINE(NEED_MOTIF)
2899   XE_APPEND(lwlib-Xm.o, lwlib_objs)
2900   need_motif=yes ;;
2901 esac
2902
2903 test "$with_menubars"   = "lucid" && XE_APPEND(xlwmenu.o, lwlib_objs)
2904 test "$with_menubars"   = "motif" && XE_APPEND(xlwmenu.o, lwlib_objs)
2905 test "$with_scrollbars" = "lucid" && XE_APPEND(xlwscrollbar.o, lwlib_objs)
2906 case "$all_widgets" in *lucid* )
2907   AC_DEFINE(NEED_LUCID)
2908   XE_APPEND(lwlib-Xlw.o, lwlib_objs) ;;
2909 esac
2910
2911 AC_SUBST(lwlib_objs)
2912
2913 case "$with_scrollbars" in athena* ) AC_DEFINE(LWLIB_SCROLLBARS_ATHENA);; esac
2914 case "$with_dialogs"    in athena* ) AC_DEFINE(LWLIB_DIALOGS_ATHENA)   ;; esac
2915 test "$with_scrollbars" = "athena3d" && AC_DEFINE(LWLIB_SCROLLBARS_ATHENA3D)
2916 test "$with_dialogs"    = "athena3d" && AC_DEFINE(LWLIB_DIALOGS_ATHENA3D)
2917
2918 test "$with_menubars"   != "no"    && AC_DEFINE(HAVE_MENUBARS)
2919 test "$with_scrollbars" != "no"    && AC_DEFINE(HAVE_SCROLLBARS)
2920 test "$with_dialogs"    != "no"    && AC_DEFINE(HAVE_DIALOGS)
2921 test "$with_toolbars"   != "no"    && AC_DEFINE(HAVE_TOOLBARS)
2922
2923 test "$with_menubars"   = "lucid"  && AC_DEFINE(LWLIB_MENUBARS_LUCID)
2924 test "$with_scrollbars" = "lucid"  && AC_DEFINE(LWLIB_SCROLLBARS_LUCID)
2925
2926 test "$with_menubars"   = "motif"  && AC_DEFINE(LWLIB_MENUBARS_MOTIF)
2927 test "$with_scrollbars" = "motif"  && AC_DEFINE(LWLIB_SCROLLBARS_MOTIF)
2928 test "$with_dialogs"    = "motif"  && AC_DEFINE(LWLIB_DIALOGS_MOTIF)
2929
2930 test "$with_menubars"   != "no"      && XE_ADD_OBJS(menubar.o)
2931 test "$with_scrollbars" != "no"      && XE_ADD_OBJS(scrollbar.o)
2932 test "$with_dialogs"    != "no"      && XE_ADD_OBJS(dialog.o)
2933 test "$with_toolbars"   != "no"      && XE_ADD_OBJS(toolbar.o)
2934
2935 if test "$with_x11" = "yes"; then
2936   test "$with_menubars"   != "no"      && XE_ADD_OBJS(menubar-x.o)
2937   test "$with_scrollbars" != "no"      && XE_ADD_OBJS(scrollbar-x.o)
2938   test "$with_dialogs"    != "no"      && XE_ADD_OBJS(dialog-x.o)
2939   test "$with_toolbars"   != "no"      && XE_ADD_OBJS(toolbar-x.o)
2940   test "$all_widgets" != "no no no no" && XE_ADD_OBJS(gui-x.o)
2941 else
2942   if test \( "$with_sound" = "nas" \) -o \( "$with_sound" = "both" \); then
2943     echo "Attempt to Build NAS sound without X"
2944     echo "Please remove NAS configuration or build with X"
2945     exit 1
2946   fi
2947 fi
2948
2949 test "$use_minimal_tagbits" = "yes" && AC_DEFINE(USE_MINIMAL_TAGBITS)
2950 test "$use_indexed_lrecord_implementation" = "yes" && \
2951   AC_DEFINE(USE_INDEXED_LRECORD_IMPLEMENTATION)
2952
2953 dnl ----------------------
2954 dnl Mule-dependent options
2955 dnl ----------------------
2956
2957 test -z "$with_mule" && with_mule=no
2958 test -z "$with_file_coding" && with_file_coding=no
2959
2960 dnl if test "$with_mule" = "yes" && test ! -d "$srcdir/lisp/mule"; then
2961 dnl     echo "Attempt to Build with Mule without Mule/Lisp"
2962 dnl     echo "Please install the XEmacs/Mule tarball or"
2963 dnl     echo "rerun configure with --with-mule=no"
2964 dnl     exit 1
2965 dnl fi
2966
2967 if test "$with_file_coding" = "yes" && test "$with_mule" = "no"; then
2968   AC_DEFINE(FILE_CODING)
2969   XE_ADD_OBJS(file-coding.o)
2970 fi
2971
2972 if test "$with_mule" = "yes" ; then
2973   AC_CHECKING(for Mule-related features)
2974   AC_DEFINE(MULE)
2975   AC_DEFINE(FILE_CODING)
2976   XE_ADD_OBJS(mule.o mule-ccl.o mule-charset.o mule-coding.o file-coding.o)
2977
2978   dnl Use -lintl to get internationalized strerror for Mule
2979   AC_CHECK_HEADERS(libintl.h)
2980   AC_CHECK_LIB(intl, strerror)
2981
2982   AC_CHECKING(for Mule input methods)
2983   dnl Do we have the XmIm* routines?  And if so, do we want to use them?
2984   dnl XIM seems to be flaky except on Solaris...
2985   dnl test -z "$with_xim" -a "$opsys" != "sol2" && with_xim=no
2986   case "$with_xim" in "" | "yes" )
2987     AC_CHECKING(for XIM)
2988     dnl XIM + Lesstif is not (yet?) usable
2989     if test "$have_lesstif" = "yes"; then with_xim=xlib
2990     else AC_CHECK_LIB(Xm, XmImMbLookupString, with_xim=motif, with_xim=xlib)
2991     fi
2992   esac
2993   if test "$with_xim" != "no"; then
2994     AC_DEFINE(HAVE_XIM)
2995     if test "$with_xim" = "xlib"; then
2996       AC_DEFINE(XIM_XLIB)
2997       XE_ADD_OBJS(input-method-xlib.o)
2998     fi
2999     if test "$with_xim" = "motif"; then
3000       AC_DEFINE(XIM_MOTIF)
3001       need_motif=yes
3002       XE_ADD_OBJS(input-method-motif.o)
3003     fi
3004     if test "$with_xim" = "motif"; then
3005       with_xfs=no
3006     fi
3007   fi
3008
3009   dnl "with_xim" = "yes"
3010   if test "$with_xfs" = "yes" ; then
3011     AC_CHECKING(for XFontSet)
3012     AC_CHECK_LIB(X11, XmbDrawString, [:], with_xfs=no)
3013     if test "$with_xfs" = "yes" && test "$with_menubars" = "lucid"; then
3014       AC_DEFINE(USE_XFONTSET)
3015       if test "$with_xim" = "no" ; then
3016         XE_ADD_OBJS(input-method-xfs.o)
3017       fi
3018     fi
3019   fi dnl with_xim
3020
3021   dnl Autodetect WNN
3022   test "$with_wnn6" = "yes" && with_wnn=yes # wnn6 implies wnn support
3023   test -z "$with_wnn" && { AC_CHECK_HEADER(wnn/jllib.h, ,with_wnn=no) }
3024   dnl Detour to find crypt
3025   if test "$with_wnn" != "no"; then
3026     AC_CHECK_FUNCS(crypt)
3027     test "$ac_cv_func_crypt" != "yes" && { AC_CHECK_LIB(crypt, crypt) }
3028   fi
3029   dnl Back to our regularly scheduled wnn hunting
3030   if test -z "$with_wnn" -o "$with_wnn" = "yes"; then
3031     AC_CHECK_LIB(wnn,jl_dic_list_e,libwnn=wnn,
3032       AC_CHECK_LIB(wnn4,jl_dic_list_e,libwnn=wnn4,
3033         AC_CHECK_LIB(wnn6,jl_dic_list_e,libwnn=wnn6,
3034           AC_CHECK_LIB(wnn6_fromsrc,dic_list_e,libwnn=wnn6_fromsrc,with_wnn=no))))
3035   fi
3036   test -z "$with_wnn" && with_wnn=yes
3037   if test "$with_wnn" = "yes"; then
3038     AC_DEFINE(HAVE_WNN)
3039     XE_PREPEND(-l$libwnn, libs_x)
3040     XE_ADD_OBJS(mule-wnnfns.o)
3041     if test "$with_wnn6" != "no"; then
3042       AC_CHECK_LIB($libwnn, jl_fi_dic_list, with_wnn6=yes)
3043       test "$with_wnn6" = "yes" && AC_DEFINE(WNN6)
3044     fi
3045   fi
3046
3047   dnl Autodetect canna
3048   canna_includes_found=no
3049   if test "$with_canna" != "no"; then
3050     AC_CHECK_HEADER(canna/jrkanji.h,canna_includes_found=yes)
3051   fi
3052   if test "$canna_includes_found" = "no" -a "$with_canna" != "no" -a \
3053       -d "/usr/local/canna/include"; then
3054     save_c_switch_site="$c_switch_site"
3055     c_switch_site="$c_switch_site -I/usr/local/canna/include"
3056     AC_CHECK_HEADER(canna/jrkanji.h,canna_includes_found=yes)
3057     if test "$canna_includes_found" != "yes"; then
3058       c_switch_site="$save_c_switch_site"
3059       with_canna="no"
3060     fi
3061   fi
3062
3063   test -z "$with_canna" && { AC_CHECK_HEADER(canna/RK.h,         , with_canna=no) }
3064   test -z "$with_canna" && { AC_CHECK_LIB(RKC, RkBgnBun,       [:],with_canna=no) }
3065   test -z "$with_canna" && { AC_CHECK_LIB(canna,jrKanjiControl,[:],with_canna=no) }
3066   test -z "$with_canna" && with_canna=yes
3067   if test "$with_canna" = "yes"; then
3068     AC_DEFINE(HAVE_CANNA)
3069     XE_PREPEND(-lcanna -lRKC, libs_x)
3070     XE_ADD_OBJS(mule-canna.o)
3071   fi
3072
3073 else dnl "$with_mule" = "no"
3074   for feature in xim canna wnn; do
3075     if eval "test -n \"\$with_${feature}\" -a \"\$with_${feature}\" != no" ; then
3076       AC_MSG_WARN("--with-${feature} ignored:  Not valid without Mule support")
3077     fi
3078     eval "with_${feature}=no"
3079   done
3080 fi dnl with_mule
3081
3082
3083 dnl At this point, we know whether we need the motif lib or not.
3084 if test "$need_motif" = "yes" ; then
3085   XE_PREPEND(-lXm, libs_x)
3086   dnl AIX needs the following library for use with Motif
3087   AC_CHECK_LIB(i18n, layout_object_getvalue, [XE_PREPEND(-li18n, libs_x)])
3088   XE_COMPUTE_RUNPATH()
3089 fi
3090
3091 AC_CHECK_FUNCS(cbrt closedir dup2 eaccess fmod fpathconf frexp ftime gethostname getpagesize gettimeofday getcwd getwd logb lrand48 matherr mkdir mktime perror poll random rename res_init rint rmdir select setitimer setpgid setlocale setsid sigblock sighold sigprocmask snprintf strcasecmp strerror tzset ulimit usleep utimes waitpid vsnprintf)
3092
3093 dnl realpath is buggy on linux, decosf and aix4
3094
3095 dnl The realpath() in linux libc (4.6.27) sometimes fails with ELOOP.
3096 dnl The realpath in ELF linux libc's is O.K.
3097 dnl For example, call realpath on a file thirty-five or so directories deep
3098 dnl and you get ELOOP even if no symlinks at all are involved.
3099 dnl Reports as of 11/1997 indicate BSDi has problems too.
3100 dnl The realpath() in UnixWare2.1.3 could not get any pathname fragment in error condition.
3101 case "$opsys" in
3102   linuxaout* | bsdos3* | freebsd* | decosf4-0* | aix4* ) XE_ADD_OBJS(realpath.o) ;;
3103   * )
3104     case "$canonical" in
3105       *-*-sysv4.2uw2* ) XE_ADD_OBJS(realpath.o) ;;
3106       * ) AC_CHECK_FUNCS(realpath)
3107           test "$ac_cv_func_realpath" != "yes" && XE_ADD_OBJS(realpath.o) ;;
3108     esac ;;
3109 esac
3110
3111 dnl If netdb.h does not declare h_errno, we must declare it by hand.
3112 AC_MSG_CHECKING(whether netdb declares h_errno)
3113 AC_TRY_LINK([#include <netdb.h>],
3114   [return h_errno;],
3115   [AC_MSG_RESULT(yes)
3116    AC_DEFINE(HAVE_H_ERRNO)],
3117   [AC_MSG_RESULT(no)])
3118
3119 AC_MSG_CHECKING(for sigsetjmp)
3120 AC_TRY_COMPILE([#include <setjmp.h>],
3121         [sigjmp_buf bar; sigsetjmp (bar, 0);],
3122   [AC_MSG_RESULT(yes)
3123    AC_DEFINE(HAVE_SIGSETJMP)],
3124   [AC_MSG_RESULT(no)])
3125
3126 AC_MSG_CHECKING(whether localtime caches TZ)
3127 AC_CACHE_VAL(emacs_cv_localtime_cache,
3128 [if test "$ac_cv_func_tzset" = "yes"; then
3129 AC_TRY_RUN([#include <time.h>
3130 #if STDC_HEADERS
3131 # include <stdlib.h>
3132 #endif
3133 extern char **environ;
3134 unset_TZ ()
3135 {
3136   char **from, **to;
3137   for (to = from = environ; (*to = *from); from++)
3138     if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '='))
3139       to++;
3140 }
3141 char TZ_GMT0[] = "TZ=GMT0";
3142 char TZ_PST8[] = "TZ=PST8";
3143 main()
3144 {
3145   time_t now = time ((time_t *) 0);
3146   int hour_GMT0, hour_unset;
3147   if (putenv (TZ_GMT0) != 0)
3148     exit (1);
3149   hour_GMT0 = localtime (&now)->tm_hour;
3150   unset_TZ ();
3151   hour_unset = localtime (&now)->tm_hour;
3152   if (putenv (TZ_PST8) != 0)
3153     exit (1);
3154   if (localtime (&now)->tm_hour == hour_GMT0)
3155     exit (1);
3156   unset_TZ ();
3157   if (localtime (&now)->tm_hour != hour_unset)
3158     exit (1);
3159   exit (0);
3160 }], emacs_cv_localtime_cache=no, emacs_cv_localtime_cache=yes,
3161 [# If we have tzset, assume the worst when cross-compiling.
3162 emacs_cv_localtime_cache=yes])
3163 else
3164         # If we lack tzset, report that localtime does not cache TZ,
3165         # since we can't invalidate the cache if we don't have tzset.
3166         emacs_cv_localtime_cache=no
3167 fi],[:])dnl
3168 AC_MSG_RESULT($emacs_cv_localtime_cache)
3169 if test $emacs_cv_localtime_cache = yes; then
3170   AC_DEFINE(LOCALTIME_CACHE)
3171 fi
3172
3173 if test "$HAVE_TIMEVAL" = "yes"; then
3174 AC_MSG_CHECKING(whether gettimeofday accepts one or two arguments)
3175 AC_TRY_LINK([
3176 #ifdef TIME_WITH_SYS_TIME
3177 #include <sys/time.h>
3178 #include <time.h>
3179 #else
3180 #ifdef HAVE_SYS_TIME_H
3181 #include <sys/time.h>
3182 #else
3183 #include <time.h>
3184 #endif
3185 #endif
3186   ],
3187   [
3188   struct timeval time;
3189   struct timezone dummy;
3190   gettimeofday (&time, &dummy);
3191 ],
3192   [AC_MSG_RESULT(two)],
3193   [AC_MSG_RESULT(one)
3194    AC_DEFINE(GETTIMEOFDAY_ONE_ARGUMENT)])
3195 fi
3196
3197
3198 AC_C_INLINE
3199 if test "$ac_cv_c_inline" != "no"; then
3200   AC_DEFINE(HAVE_INLINE)
3201   test "$GCC" = "yes" && XE_ADD_OBJS(inline.o)
3202 fi
3203
3204 dnl HP-UX has a working alloca in libPW.
3205 dnl case "${GCC}${opsys}" in hpux* )
3206 dnl  AC_CHECK_FUNC(alloca, [:], [AC_CHECK_LIB(PW, alloca)])
3207 dnl esac
3208
3209 AC_FUNC_ALLOCA
3210 test -n "$ALLOCA" && XE_ADD_OBJS($ALLOCA)
3211
3212 dnl Check whether vfork exists and works correctly. (This does more
3213 dnl than just check for its existence.) If so, it defines HAVE_VFORK_H.
3214 dnl If not, it defines vfork to be fork.
3215 AC_FUNC_VFORK
3216
3217 dnl Check whether strcoll exists and works correctly. (This does more
3218 dnl than just check for its existence.) If so, it defines HAVE_STRCOLL.
3219 AC_FUNC_STRCOLL
3220
3221 dnl If `getpgrp' takes no argument (the POSIX.1 version), define
3222 dnl `GETPGRP_VOID'.  Otherwise, it is the BSD version, which takes a
3223 dnl process ID as an argument.
3224 AC_CHECK_FUNCS(getpgrp)
3225 AC_FUNC_GETPGRP
3226
3227 dnl We used to call AC_FUNC_MMAP here
3228 dnl Instead we now use following, suggested by Neal Becker
3229 AC_MSG_CHECKING(for working mmap)
3230 case "$opsys" in ultrix* ) have_mmap=no ;; *)
3231 AC_TRY_RUN([#include <stdio.h>
3232 #include <unistd.h>
3233 #include <fcntl.h>
3234 #include <sys/mman.h>
3235
3236 #ifndef MAP_VARIABLE
3237 #define MAP_VARIABLE 0
3238 #endif
3239
3240 #ifndef MAP_FAILED
3241 #define MAP_FAILED -1
3242 #endif
3243
3244 int main (int argc, char *argv[])
3245 {
3246   int fd = -1;
3247   caddr_t p;
3248 #ifndef MAP_ANONYMOUS
3249   fd = open ("/dev/zero", O_RDWR);
3250   if (fd < 0)
3251     return 1;
3252 #define MAP_ANONYMOUS 0
3253 #endif
3254   if (mmap(0, 1024, PROT_READ | PROT_WRITE,
3255            MAP_PRIVATE | MAP_VARIABLE | MAP_ANONYMOUS,
3256            fd, 0) != (void *) MAP_FAILED)
3257     return 0;
3258   perror ("conftest: mmap failed");
3259   return 1;
3260 }], have_mmap=yes, have_mmap=no) ;;
3261 esac
3262 AC_MSG_RESULT($have_mmap)
3263 test "$have_mmap" = "yes" && AC_DEFINE(HAVE_MMAP)
3264 AC_FUNC_MMAP
3265
3266 dnl rel_alloc requires either GNU malloc or system malloc with mmap
3267 dnl We only turn rel_alloc on by default if mmap is available.
3268 test "$GNU_MALLOC" != "yes"   -a "$have_mmap" != "yes" && rel_alloc=no
3269 test "$rel_alloc" = "default" -a "$have_mmap"  = "yes" && rel_alloc=yes
3270 test "$rel_alloc" = "yes" && AC_DEFINE(REL_ALLOC)
3271
3272 dnl Check for terminal I/O variants
3273 dnl TERMIOS systems may have termio.h, but not vice-versa, I think.
3274 AC_CHECK_HEADER(termios.h,
3275   AC_DEFINE(HAVE_TERMIOS)
3276   AC_DEFINE(SIGNALS_VIA_CHARACTERS)
3277   AC_DEFINE(NO_TERMIO),
3278   [AC_CHECK_HEADER(termio.h, [AC_DEFINE(HAVE_TERMIO)])])
3279
3280
3281 dnl Check for Internet sockets.
3282 AC_CHECK_FUNC(socket,
3283  [AC_CHECK_HEADER(netinet/in.h,
3284    [AC_CHECK_HEADER(arpa/inet.h, [
3285   AC_DEFINE(HAVE_SOCKETS)
3286       AC_MSG_CHECKING("for sun_len member in struct sockaddr_un")
3287       AC_TRY_LINK([
3288 #include <sys/types.h>
3289 #include <sys/socket.h>
3290 #include <sys/un.h>
3291       ],
3292       [static struct sockaddr_un x; x.sun_len = 1;],
3293       [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SOCKADDR_SUN_LEN)],
3294       [AC_MSG_RESULT(no)])
3295       AC_MSG_CHECKING("for ip_mreq struct in netinet/in.h")
3296       AC_TRY_LINK([
3297 #include <sys/types.h>
3298 #include <netinet/in.h>
3299       ],
3300       [static struct ip_mreq x;],
3301       [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_MULTICAST)],
3302       [AC_MSG_RESULT(no)])])])])
3303
3304 dnl Check for SYS V IPC. (Inferior to sockets.)
3305 AC_CHECK_FUNC(msgget,
3306   [AC_CHECK_HEADER(sys/ipc.h,
3307     [AC_CHECK_HEADER(sys/msg.h,
3308       [AC_DEFINE(HAVE_SYSVIPC)])])])
3309
3310 dnl Check for directory variants
3311 AC_CHECK_HEADER(dirent.h, [AC_DEFINE(SYSV_SYSTEM_DIR)],
3312   [AC_CHECK_HEADER(sys/dir.h, , [AC_DEFINE(NONSYSTEM_DIR_LIBRARY)])])
3313
3314 dnl Check for nlist.h
3315 AC_CHECK_HEADER(nlist.h, AC_DEFINE(NLIST_STRUCT), )
3316
3317 dnl Check for sound of various sorts.
3318
3319 dnl Autodetect native sound
3320 AC_CHECKING("for sound support")
3321 case "$with_sound" in
3322   native | both ) with_native_sound=yes;;
3323   nas    | no   ) with_native_sound=no;;
3324 esac
3325 test -z "$with_native_sound" -a -n "$native_sound_lib" && with_native_sound=yes
3326
3327 if test "$with_native_sound" != "no"; then
3328   dnl Maybe sound is already on include path...
3329   if test -n "$native_sound_lib"; then
3330     AC_CHECK_HEADER(multimedia/audio_device.h,
3331       [sound_found=yes sound_cflags=""
3332       XE_ADD_OBJS(sunplay.o)])
3333   fi
3334
3335   dnl Autodetect Sun native sound from SUNWaudmo package
3336   if test -z "$sound_found" -a -d "/usr/demo/SOUND"; then
3337     sound_found=yes
3338     XE_ADD_OBJS(sunplay.o)
3339     if test -d "/usr/demo/SOUND/include"
3340       then sound_cflags="-I/usr/demo/SOUND/include"
3341       else sound_cflags="-I/usr/demo/SOUND"
3342     fi
3343     if test -z "$native_sound_lib" ; then
3344       if test -r "/usr/demo/SOUND/lib/libaudio.a"
3345         then native_sound_lib="/usr/demo/SOUND/lib/libaudio.a"
3346         else native_sound_lib="/usr/demo/SOUND/libaudio.a"
3347       fi
3348     fi
3349   fi
3350
3351   dnl Check for SGI and HP native sound libs
3352   if test -z "$sound_found"; then
3353     case "$canonical" in
3354     *-sgi-* )
3355       if test -z "$native_sound_lib"; then
3356         AC_CHECK_LIB(audio, ALopenport, native_sound_lib="-laudio")
3357       fi
3358       if test -n "$native_sound_lib"; then
3359         sound_found=yes sound_cflags=""
3360         XE_ADD_OBJS(sgiplay.o)
3361       fi ;;
3362     hppa*-hp-hpux* )
3363       if test -z "$native_sound_lib"; then
3364         AC_CHECK_LIB(Alib, AOpenAudio, native_sound_lib="-lAlib")
3365       fi
3366       if test -n "$native_sound_lib"; then
3367         sound_found=yes
3368         XE_ADD_OBJS(hpplay.o)
3369         if test "$GCC" = "yes" # Kludge city
3370           then sound_cflags="-Dconst= -Dvolatile= -I/usr/audio/examples"
3371           else sound_cflags="+e -I/usr/audio/examples"
3372         fi
3373       fi ;;
3374     esac
3375   fi
3376
3377   dnl Check for Linux/BSD native sound
3378   if test -z "$sound_found"; then
3379     for dir in "machine" "sys" "linux"; do
3380       AC_CHECK_HEADER(${dir}/soundcard.h,
3381         sound_found=yes
3382         XE_ADD_OBJS(linuxplay.o)
3383         [AC_DEFINE_UNQUOTED(SOUNDCARD_H_PATH, "${dir}/soundcard.h")]
3384         break)
3385     done
3386   fi
3387
3388   test "$sound_found" = "yes" && with_native_sound=yes
3389 fi
3390
3391 if test -z "$with_sound"; then
3392   if test "$with_native_sound" = "yes" -o -n "$native_sound_lib"; then
3393     with_sound=native
3394   fi
3395 fi
3396
3397 if test "$with_native_sound" = "yes"; then
3398   AC_DEFINE(HAVE_NATIVE_SOUND)
3399   test -n "$native_sound_lib" && XE_PREPEND($native_sound_lib, LIBS)
3400 fi
3401
3402 case "$with_sound" in both | nas )
3403   AC_DEFINE(HAVE_NAS_SOUND)
3404   XE_ADD_OBJS(nas.o)
3405   XE_PREPEND(-laudio, libs_x)
3406   dnl If the nas library does not contain the error jump point,
3407   dnl then we force safer behavior.
3408   AC_EGREP_HEADER(AuXtErrorJump,audio/Xtutil.h,,[AC_DEFINE(NAS_NO_ERROR_JUMP)])
3409 esac
3410
3411 dnl ---------------------
3412 dnl TTY-dependent options
3413 dnl ---------------------
3414
3415 test -z "$with_tty" && with_tty=yes
3416
3417 if test "$with_tty" = "yes"  ; then
3418   AC_CHECKING(for TTY-related features)
3419   AC_DEFINE(HAVE_TTY)
3420   XE_ADD_OBJS(console-tty.o device-tty.o event-tty.o frame-tty.o objects-tty.o redisplay-tty.o cm.o)
3421
3422   dnl Autodetect ncurses.
3423   if test -z "$with_ncurses"; then
3424     AC_CHECK_LIB(ncurses, tgetent, with_ncurses=yes, with_ncurses=no)
3425   fi
3426   if test "$with_ncurses" = "yes"; then
3427     AC_DEFINE(HAVE_NCURSES)
3428     AC_CHECK_HEADER(ncurses/curses.h, curses_h_path=ncurses/curses.h)
3429     AC_CHECK_HEADER(ncurses/term.h, term_h_path=ncurses/term.h)
3430     XE_ADD_OBJS(terminfo.o)
3431     XE_PREPEND(-lncurses, LIBS)
3432
3433     if test "$ac_cv_header_ncurses_curses_h" != "yes" ; then
3434       dnl Try again, and check for the bogus ncurses/ include bug.
3435       dnl (i.e. ncurses/curses.h bogusly includes <unctrl.h> instead of
3436       dnl <ncurses/unctrl.h>)
3437       save_c_switch_site="$c_switch_site"
3438       c_switch_site="$c_switch_site -I/usr/include/ncurses"
3439       AC_CHECK_HEADER(ncurses/curses.h, curses_h_path=ncurses/curses.h)
3440       if test "$ac_cv_header_ncurses_curses_h" = "yes"
3441         then AC_MSG_WARN("Your system has the bogus ncurses include bug.")
3442         else c_switch_site="$save_c_switch_site"
3443       fi
3444     fi
3445   else dnl "$with_ncurses" = "no"
3446     dnl Autodetect terminfo/-lcurses/-ltermlib/-ltermcap
3447     if test "$have_terminfo" = "yes"; then
3448       XE_ADD_OBJS(terminfo.o)
3449       if test -n "$libs_termcap"; then
3450         XE_PREPEND($libs_termcap, LIBS)
3451       else
3452         for lib in curses termlib termcap; do
3453           AC_CHECK_LIB($lib, tgetent, XE_PREPEND(-l${lib}, LIBS); break)
3454         done
3455       fi
3456     else dnl "$have_terminfo" = "no" && "with_ncurses" = "no"
3457       XE_ADD_OBJS(tparam.o)
3458       dnl The HP-UX curses library seems to have a badly broken version of select(2)
3459       dnl that makes "poll: interrupted system call" messages to appear and
3460       dnl Emacs suprocesses to hang (e.g. TeX compilation w/ AUCTeX) */
3461       case "$opsys" in *-hp-hpux* ) libs_termcap="-ltermcap" ;; esac
3462       if test -n "$libs_termcap"; then
3463         XE_PREPEND($libs_termcap, LIBS)
3464       else
3465         AC_CHECK_LIB(curses, tgetent, XE_PREPEND(-lcurses, LIBS),
3466           AC_CHECK_LIB(termcap, tgetent, XE_PREPEND(-ltermcap, LIBS),
3467             XE_ADD_OBJS(termcap.o)))
3468       fi
3469     fi
3470   fi
3471   AC_DEFINE_UNQUOTED(CURSES_H_PATH, "${curses_h_path-curses.h}")
3472   AC_DEFINE_UNQUOTED(TERM_H_PATH, "${term_h_path-term.h}")
3473
3474   dnl Autodetect gpm
3475   test -z "$with_gpm" && { AC_CHECK_HEADER(gpm.h, , with_gpm=no) }
3476   test -z "$with_gpm" && { AC_CHECK_LIB(gpm, Gpm_Open, with_gpm=yes, with_gpm=no) }
3477   if test "$with_gpm" = "yes"; then
3478     AC_DEFINE(HAVE_GPM)
3479     XE_ADD_OBJS(gpmevent.o)
3480     XE_PREPEND(-lgpm, LIBS)
3481   fi
3482
3483 else dnl "$with_tty" = "no"
3484   for feature in ncurses gpm; do
3485     if eval "test -n \"\$with_${feature}\" -a \"\$with_${feature}\" != no" ; then
3486       AC_MSG_WARN("--with-${feature} ignored:  Not valid without TTY support")
3487     fi
3488     eval "with_${feature}=no"
3489   done
3490 fi dnl with_tty
3491
3492 dnl Do we need event-unixoid.o ?
3493 test "$with_x11" = "yes" -o "$with_tty" = "yes" && XE_ADD_OBJS(event-unixoid.o)
3494
3495 dnl Database support
3496 dnl We do not necessarily have to have libdb/lib(g)dbm for DB/(G)DBM support.
3497 dnl On FreeBSD, both DB and DBM are part of libc.
3498 dnl By default, we check for DBM support in libgdbm, then libc, then libdbm.
3499
3500 test "$with_database_gnudbm $with_database_dbm $with_database_berkdb" \
3501   != "no no no" && AC_CHECKING(for database support)
3502
3503 dnl Check for ndbm.h, required for either kind of DBM support.
3504 if test "$with_database_gnudbm $with_database_dbm" != "no no"; then
3505   AC_CHECK_HEADER(ndbm.h, [:], [
3506     test "$with_database_gnudbm" = "yes" -o \
3507          "$with_database_dbm"    = "yes" && \
3508       XE_DIE("Required DBM support cannot be provided.")
3509     with_database_gnudbm=no with_database_dbm=no])
3510 fi
3511
3512 dnl Check for DBM support in libgdbm.
3513 if test "$with_database_gnudbm" != "no"; then
3514   AC_CHECK_LIB(gdbm, dbm_open, [
3515    with_database_gnudbm=yes with_database_dbm=no libdbm=-lgdbm], [
3516    if test "$with_database_gnudbm" = "yes"; then
3517      XE_DIE("Required GNU DBM support cannot be provided.")
3518    fi
3519    with_database_gnudbm=no])
3520 fi
3521
3522 dnl Check for DBM support in libc and libdbm.
3523 if test "$with_database_dbm" != "no"; then
3524   AC_CHECK_FUNC(dbm_open, [with_database_dbm=yes libdbm=], [
3525     AC_CHECK_LIB(dbm, dbm_open, [with_database_dbm=yes libdbm=-ldbm], [
3526       test "$with_database_dbm" = "yes" && \
3527         XE_DIE("Required DBM support cannot be provided.")
3528       with_database_dbm=no])])
3529 fi
3530
3531 dnl Tell make about the DBM support we detected.
3532 test -n "$libdbm" && XE_PREPEND("$libdbm", LIBS)
3533 test "$with_database_gnudbm" = "yes" -o \
3534      "$with_database_dbm"    = "yes" && \
3535   AC_DEFINE(HAVE_DBM)
3536
3537 dnl Check for Berkeley DB.
3538 if test "$with_database_berkdb" != "no"; then
3539   AC_MSG_CHECKING(for Berkeley db.h)
3540   for path in "db/db.h" "db.h"; do
3541     AC_TRY_COMPILE([#ifdef HAVE_INTTYPES_H
3542 #define __BIT_TYPES_DEFINED__
3543 #include <inttypes.h>
3544 typedef uint8_t  u_int8_t;
3545 typedef uint16_t u_int16_t;
3546 typedef uint32_t u_int32_t;
3547 #ifdef WE_DONT_NEED_QUADS
3548 typedef uint64_t u_int64_t;
3549 #endif
3550 #endif
3551 #include <$path>
3552 ],[], db_h_path="$path"; break)
3553   done
3554   if test -z "$db_h_path"
3555   then AC_MSG_RESULT(no); with_database_berkdb=no
3556   else AC_MSG_RESULT($db_h_path)
3557   fi
3558
3559   if test "$with_database_berkdb" != "no"; then
3560     AC_MSG_CHECKING(for Berkeley DB version)
3561     AC_EGREP_CPP(yes,
3562 [#include <$db_h_path>
3563 #if DB_VERSION_MAJOR > 1
3564 yes
3565 #endif
3566 ], [AC_MSG_RESULT(2); dbfunc=db_open], [AC_MSG_RESULT(1); dbfunc=dbopen])
3567     AC_CHECK_FUNC($dbfunc,     with_database_berkdb=yes need_libdb=no, [
3568     AC_CHECK_LIB(db, $dbfunc,  with_database_berkdb=yes need_libdb=yes)])
3569   fi
3570
3571   if test "$with_database_berkdb" = "yes"; then
3572     AC_DEFINE_UNQUOTED(DB_H_PATH, "$db_h_path")
3573     AC_DEFINE(HAVE_BERKELEY_DB)
3574     test "$need_libdb" = "yes" && XE_PREPEND(-ldb, LIBS)
3575   else with_database_berkdb=no
3576   fi
3577 fi
3578
3579 if test "$with_database_gnudbm $with_database_dbm $with_database_berkdb" \
3580      != "no no no"; then
3581   AC_DEFINE(HAVE_DATABASE)
3582   XE_ADD_OBJS(database.o)
3583 fi
3584
3585 dnl Socks support
3586 if test "$with_socks" = "yes"; then
3587   AC_CHECK_LIB(socks, SOCKSinit)
3588   test -n "$ac_cv_lib_socks_SOCKSinit" && AC_DEFINE(HAVE_SOCKS)
3589 fi
3590
3591 dnl Usage tracking (undocumented and likely unused option)
3592 if test "$usage_tracking" = "yes"; then
3593   AC_DEFINE(USAGE_TRACKING)
3594   XE_PREPEND(-Bstatic -lut -Bdynamic, LIBS)
3595 fi
3596
3597 dnl autodetect dll support
3598 AC_CHECK_HEADERS(dlfcn.h, [have_dlfcn=yes
3599   AC_DEFINE(HAVE_DLFCN_H)])
3600 test -z "$with_shlib" && test ! -z "$have_dlfcn" && { AC_CHECK_LIB(dl,  dlopen,   [ AC_DEFINE(HAVE_DLOPEN) DLL_LIB=dl;  with_shlib=yes]) }
3601 test -z "$with_shlib" && test ! -z "$have_dlfcn" && { AC_CHECK_LIB(c,   _dlopen,  [ AC_DEFINE(HAVE_DLOPEN) DLL_LIB=;   with_shlib=yes]) }
3602 test -z "$with_shlib" && test ! -z "$have_dlfcn" && { AC_CHECK_LIB(c,   dlopen,   [ AC_DEFINE(HAVE_DLOPEN) DLL_LIB=;   with_shlib=yes]) }
3603 test -z "$with_shlib" && { AC_CHECK_LIB(dld, shl_load, [ AC_DEFINE(HAVE_SHL_LOAD) DLL_LIB=dld; with_shlib=yes]) }
3604 test -z "$with_shlib" && { AC_CHECK_LIB(dld, dld_init, [ AC_DEFINE(HAVE_DLD_INIT) DLL_LIB=dld; with_shlib=yes]) }
3605 if test "$with_shlib" = "yes"; then
3606   XE_SHLIB_STUFF
3607   if test "$can_build_shared" = "yes"; then
3608     AC_DEFINE(HAVE_SHLIB)
3609     XE_ADD_OBJS(sysdll.o)
3610     XE_ADD_OBJS(emodules.o)
3611     XE_APPEND(src, INSTALL_ARCH_DEP_SUBDIR)
3612     test ! -z "$DLL_LIB" && XE_PREPEND(-l${DLL_LIB}, LIBS)
3613     AC_CHECK_FUNCS(dlerror _dlerror)
3614   else
3615     AC_MSG_WARN(disabling shared library support)
3616     with_shlib=no
3617   fi
3618 fi
3619
3620 dnl Unfortunately, just because we can link doesn't mean we can run.
3621 dnl One of the above link tests may have succeeded but caused resulting
3622 dnl executables to fail to run.  Also any tests using AC_TRY_RUN will
3623 dnl have reported incorrect results.
3624 AC_TRY_RUN([int main(int c,char *v[]){return 0;}],[:],[
3625   echo ""
3626   echo "*** PANIC *** The C compiler can no longer build working executables."
3627   echo "*** PANIC *** Please examine the tail of config.log for runtime errors."
3628   echo "*** PANIC *** The most likely reason for this problem is that configure"
3629   echo "*** PANIC *** links with shared libraries, but those libraries cannot be"
3630   echo "*** PANIC *** found at run time."
3631   echo "*** PANIC ***"
3632   echo "*** PANIC *** On a Linux system, edit /etc/ld.so.conf and re-run ldconfig."
3633   echo "*** PANIC *** On other systems, try telling configure where to find the"
3634   echo "*** PANIC *** shared libraries using the --site-runtime-libraries option"
3635   echo "*** PANIC ***"
3636   echo "*** PANIC *** Another way to shoot yourself in the foot is to specify"
3637   echo "*** PANIC *** --with-FEATURE when FEATURE is not actually installed"
3638   echo "*** PANIC *** on your system.  Don't do that."
3639   exit 1])
3640
3641 dnl Process support (hardcoded)
3642 dnl every system that supports this runs configure, the others don't
3643
3644 dnl We're not ready for this yet.
3645 AC_DEFINE(HAVE_UNIX_PROCESSES)
3646 XE_ADD_OBJS(process-unix.o)
3647
3648 dnl --------------------------------
3649 dnl Compute SUBST-itutable variables
3650 dnl --------------------------------
3651
3652 dnl We ignore (C|LD)_SWITCH_X_(MACHINE|SYSTEM)
3653 dnl Use XE_SPACE instead of plain assignment statements to remove extraneous blanks
3654 XE_SPACE(CFLAGS, $CFLAGS)
3655 XE_SPACE(extra_objs, $extra_objs)
3656 XE_SPACE(c_switch_general, -DHAVE_CONFIG_H $c_switch_site $c_switch_machine $c_switch_system)
3657 XE_SPACE(c_switch_window_system, $c_switch_x_site $X_CFLAGS)
3658 XE_SPACE(c_switch_all, $c_switch_general $c_switch_window_system)
3659 XE_SPACE(ld_switch_general, $ld_switch_site $ld_switch_machine $ld_switch_system $ld_switch_run)
3660 XE_SPACE(ld_switch_window_system, $ld_switch_x_site)
3661 XE_SPACE(ld_switch_all, $ld_switch_general $ld_switch_window_system)
3662 XE_SPACE(ld_libs_general, $LIBS $libs_machine $libs_system $libs_standard)
3663 XE_SPACE(ld_libs_window_system, $X_EXTRA_LIBS $libs_x $X_PRE_LIBS)
3664 XE_SPACE(ld_libs_all, $ld_libs_window_system $ld_libs_general)
3665
3666 dnl Compute lists of Makefiles and subdirs
3667 AC_SUBST(SRC_SUBDIR_DEPS)
3668 XE_APPEND(src, MAKE_SUBDIR)
3669 internal_makefile_list="Makefile.in"
3670 SUBDIR_MAKEFILES=''
3671 test -d lock || mkdir lock
3672 for dir in $MAKE_SUBDIR; do
3673   case "$dir" in */* ) dnl Implement mkdir -p
3674     ( for d in `echo $dir | sed 's:/: :g'` ; do
3675         test -d "$d" || mkdir "$d"; cd "$d"
3676       done ) ;;
3677    * ) test -d "$dir" || mkdir "$dir" ;;
3678   esac
3679   XE_SPACE(SUBDIR_MAKEFILES, $SUBDIR_MAKEFILES $dir/Makefile $dir/GNUmakefile)
3680   XE_SPACE(internal_makefile_list, $internal_makefile_list $dir/Makefile.in)
3681 done
3682 AC_SUBST(INSTALL_ARCH_DEP_SUBDIR)
3683 AC_SUBST(MAKE_SUBDIR)
3684 AC_SUBST(SUBDIR_MAKEFILES)
3685
3686 dnl Make s&m symlinks in the src directory, for config.h
3687 for dir in src/s src/m; do
3688   if test ! -d "$dir" ; then
3689     echo Making symbolic link to "$srcdir/$dir"
3690     ${LN_S} "$srcdir/$dir" "$dir"
3691   fi
3692 done
3693
3694 if test "$extra_verbose" = "yes"; then
3695   echo ""
3696   PRINT_VAR(extra_objs
3697    c_switch_general  c_switch_window_system  c_switch_all
3698   ld_switch_general ld_switch_window_system ld_switch_all
3699     ld_libs_general   ld_libs_window_system   ld_libs_all)
3700   echo ""
3701 fi
3702
3703 dnl Create some auxiliary files
3704 if test -f $srcdir/src/gdbinit -a ! -f src/gdbinit ; then
3705   echo "creating src/gdbinit"; echo ""
3706   echo "source $srcdir/src/gdbinit" > src/gdbinit
3707 fi
3708
3709 dnl Create top level .sbinit for Sun compilers
3710 if test "$__SUNPRO_C" = "yes"; then
3711   echo "creating .sbinit"; echo ""
3712   ( echo "# For use with Sun WorkShop's Source browser."
3713     echo "# See sbquery(1) and sbinit(4) for more information"
3714     for dir in $MAKE_SUBDIR; do echo "import $dir"; done
3715   ) > .sbinit
3716 fi
3717
3718 dnl There are no more compile tests; remove the core they created.
3719 rm -f core
3720
3721 dnl ----------------------------------------------
3722 dnl Substitute into Makefile, config.h and paths.h
3723 dnl ----------------------------------------------
3724
3725 dnl what sort of things to edit into Makefile, config.h and paths.h
3726 dnl configuration here uncanonicalized to avoid exceeding size limits.
3727
3728 AC_SUBST(PROGNAME)
3729 AC_SUBST(version)
3730 AC_SUBST(configuration)
3731 AC_SUBST(canonical)
3732 AC_SUBST(srcdir)
3733 AC_SUBST(bindir)
3734 AC_SUBST(datadir)
3735 AC_SUBST(pkgdir)
3736 AC_SUBST(statedir)
3737 AC_SUBST(libdir)
3738 AC_SUBST(mandir)
3739
3740 AC_SUBST(prefix)
3741 dnl Yo, Stephen Bourne!  I want to marry you!
3742 PREFIX=$prefix
3743 while true; do
3744   case "$PREFIX" in
3745     *\$* ) eval "PREFIX=$PREFIX" ;;
3746     *) break ;;
3747   esac
3748 done
3749 AC_SUBST(PREFIX)
3750
3751 AC_SUBST(exec_prefix)
3752 EXEC_PREFIX=$exec_prefix
3753 while true; do
3754   case "$EXEC_PREFIX" in
3755     *\$* ) eval "EXEC_PREFIX=$EXEC_PREFIX" ;;
3756     *) break ;;
3757   esac
3758 done
3759 AC_SUBST(EXEC_PREFIX)
3760
3761 AC_SUBST(infodir)
3762 AC_SUBST(INFODIR_USER_DEFINED)
3763 INFODIR=$infodir
3764 while true; do
3765   case "$INFODIR" in
3766     *\$* ) eval "INFODIR=$INFODIR" ;;
3767     *) break ;;
3768   esac
3769 done
3770 AC_SUBST(INFODIR)
3771
3772 AC_SUBST(infopath)
3773 AC_SUBST(INFOPATH_USER_DEFINED)
3774 INFOPATH=$infopath
3775 while true; do
3776   case "$INFOPATH" in
3777     *\$* ) eval "INFOPATH=$INFOPATH" ;;
3778     *) break ;;
3779   esac
3780 done
3781 AC_SUBST(INFOPATH)
3782
3783 AC_SUBST(package_path)
3784 AC_SUBST(PACKAGE_PATH_USER_DEFINED)
3785 PACKAGE_PATH=$package_path
3786 while true; do
3787   case "$PACKAGE_PATH" in
3788     *\$* ) eval "PACKAGE_PATH=$PACKAGE_PATH" ;;
3789     *) break ;;
3790   esac
3791 done
3792 AC_SUBST(PACKAGE_PATH)
3793
3794 AC_SUBST(lispdir)
3795 AC_SUBST(LISPDIR_USER_DEFINED)
3796 LISPDIR=$lispdir
3797 while true; do
3798   case "$LISPDIR" in
3799     *\$* ) eval "LISPDIR=$LISPDIR" ;;
3800     *) break ;;
3801   esac
3802 done
3803 AC_SUBST(LISPDIR)
3804
3805 AC_SUBST(moduledir)
3806 AC_SUBST(MODULEDIR_USER_DEFINED)
3807 MODULEDIR=$moduledir
3808 while true; do
3809   case "$MODULEDIR" in
3810     *\$* ) eval "MODULEDIR=$MODULEDIR" ;;
3811     *) break ;;
3812   esac
3813 done
3814 AC_SUBST(MODULEDIR)
3815
3816 AC_SUBST(sitelispdir)
3817 AC_SUBST(SITELISPDIR_USER_DEFINED)
3818 SITELISPDIR=$sitelispdir
3819 while true; do
3820   case "$SITELISPDIR" in
3821     *\$* ) eval "SITELISPDIR=$SITELISPDIR" ;;
3822     *) break ;;
3823   esac
3824 done
3825 AC_SUBST(SITELISPDIR)
3826
3827 AC_SUBST(sitemoduledir)
3828 AC_SUBST(SITEMODULEDIR_USER_DEFINED)
3829 SITEMODULEDIR=$sitemoduledir
3830 while true; do
3831   case "$SITEMODULEDIR" in
3832     *\$* ) eval "SITEMODULEDIR=$SITEMODULEDIR" ;;
3833     *) break ;;
3834   esac
3835 done
3836 AC_SUBST(SITEMODULEDIR)
3837
3838 AC_SUBST(etcdir)
3839 AC_SUBST(ETCDIR_USER_DEFINED)
3840 ETCDIR=$etcdir
3841 while true; do
3842   case "$ETCDIR" in
3843     *\$* ) eval "ETCDIR=$ETCDIR" ;;
3844     *) break ;;
3845   esac
3846 done
3847 AC_SUBST(ETCDIR)
3848
3849 AC_SUBST(lockdir)
3850 AC_SUBST(LOCKDIR_USER_DEFINED)
3851 LOCKDIR=$lockdir
3852 while true; do
3853   case "$LOCKDIR" in
3854     *\$* ) eval "LOCKDIR=$LOCKDIR" ;;
3855     *) break ;;
3856   esac
3857 done
3858 AC_SUBST(LOCKDIR)
3859
3860 AC_SUBST(archlibdir)
3861 AC_SUBST(ARCHLIBDIR_USER_DEFINED)
3862 ARCHLIBDIR=$archlibdir
3863 while true; do
3864   case "$ARCHLIBDIR" in
3865     *\$* ) eval "ARCHLIBDIR=$ARCHLIBDIR" ;;
3866     *) break ;;
3867   esac
3868 done
3869 AC_SUBST(ARCHLIBDIR)
3870
3871 AC_SUBST(docdir)
3872 AC_SUBST(bitmapdir)
3873 AC_SUBST(extra_objs)
3874
3875 dnl The following flags combine all the information from:
3876 dnl - command line options (user always gets priority)
3877 dnl - user environment variables
3878 dnl - determined by configure
3879 dnl - the s&m header files (required for ellcc)
3880 AC_SUBST(machfile)
3881 AC_SUBST(opsysfile)
3882 AC_SUBST(c_switch_general)
3883 AC_SUBST(c_switch_window_system)
3884 AC_SUBST(c_switch_all)
3885 AC_SUBST(ld_switch_general)
3886 AC_SUBST(ld_switch_window_system)
3887 AC_SUBST(ld_switch_all)
3888 AC_SUBST(ld_libs_general)
3889 AC_SUBST(ld_libs_window_system)
3890 AC_SUBST(ld_libs_all)
3891 AC_SUBST(CFLAGS)
3892 AC_SUBST(CPPFLAGS)
3893 AC_SUBST(LDFLAGS)
3894 RECURSIVE_MAKE="\$(MAKE) \$(MFLAGS) CC='\$(CC)' CFLAGS='\$(CFLAGS)' LDFLAGS='\$(LDFLAGS)' CPPFLAGS='\$(CPPFLAGS)'"
3895 AC_SUBST(RECURSIVE_MAKE)
3896
3897 AC_SUBST(native_sound_lib)
3898 AC_SUBST(sound_cflags)
3899 AC_SUBST(RANLIB)
3900 AC_SUBST(dynodump_arch)
3901
3902 dnl Preliminary support for using a different compiler for xemacs itself.
3903 dnl Useful for building XEmacs with a C++ or 64-bit compiler.
3904 : ${XEMACS_CC:=$CC}
3905 AC_SUBST(XEMACS_CC)
3906
3907
3908 dnl The default is no
3909 if test "$with_site_lisp" = "no"; then
3910   AC_DEFINE(INHIBIT_SITE_LISP)
3911 fi
3912 dnl The default is yes
3913 if test "$with_site_modules" = "no"; then
3914   AC_DEFINE(INHIBIT_SITE_MODULES)
3915 fi
3916
3917 XE_SPACE(ac_configure_args, $ac_configure_args)
3918 AC_DEFINE_UNQUOTED(EMACS_CONFIGURATION, "$canonical")
3919 AC_DEFINE_UNQUOTED(EMACS_CONFIG_OPTIONS, "$ac_configure_args")
3920 AC_DEFINE_UNQUOTED(config_machfile,  "$machfile")
3921 AC_DEFINE_UNQUOTED(config_opsysfile, "$opsysfile")
3922
3923 dnl Following are deprecated
3924
3925 null_string=""
3926 AC_DEFINE_UNQUOTED(LD_SWITCH_X_SITE,     $null_string)
3927 AC_DEFINE_UNQUOTED(LD_SWITCH_X_SITE_AUX, $null_string)
3928 AC_DEFINE_UNQUOTED(C_SWITCH_X_SITE,      $null_string)
3929 AC_DEFINE_UNQUOTED(LD_SWITCH_SITE,       $null_string)
3930 AC_DEFINE_UNQUOTED(C_SWITCH_SITE,        $null_string)
3931
3932 dnl Note: as a general rule, *only* define things here that are not
3933 dnl autodetected.  For things that are autodetected, define them
3934 dnl at the point where the autodetection occurs or would occur,
3935 dnl so that the user gets immediate feedback on the results of the
3936 dnl autodetection.
3937
3938 test -n "$puresize" && AC_DEFINE_UNQUOTED(RAW_PURESIZE, $puresize)
3939
3940 if   test "$GNU_MALLOC"         = "yes"; then AC_DEFINE(GNU_MALLOC)
3941 elif test "$with_system_malloc" = "yes"; then AC_DEFINE(USE_SYSTEM_MALLOC)
3942 elif test "$with_debug_malloc"  = "yes"; then AC_DEFINE(USE_DEBUG_MALLOC)
3943                                               AC_DEFINE(USE_SYSTEM_MALLOC)
3944 fi
3945 test "$with_i18n3"         = "yes" && AC_DEFINE(I18N3)
3946 test "$GCC"                = "yes" && AC_DEFINE(USE_GCC)
3947 test "$external_widget"    = "yes" && AC_DEFINE(EXTERNAL_WIDGET)
3948 test "$no_doc_file"        = "yes" && AC_DEFINE(NO_DOC_FILE)
3949 dnl test "$const_is_losing"    = "yes" && AC_DEFINE(CONST_IS_LOSING)
3950 test "$with_purify"        = "yes" && AC_DEFINE(PURIFY)
3951 test "$with_quantify"      = "yes" && AC_DEFINE(QUANTIFY)
3952 test "$with_pop"           = "yes" && AC_DEFINE(MAIL_USE_POP)
3953 test "$with_kerberos"      = "yes" && AC_DEFINE(KERBEROS)
3954 test "$with_hesiod"        = "yes" && AC_DEFINE(HESIOD)
3955 test "$use_union_type"     = "yes" && AC_DEFINE(USE_UNION_TYPE)
3956
3957 dnl -------------------------------
3958 dnl Report on what we decided to do
3959 dnl -------------------------------
3960
3961 (
3962 dnl /etc/osversion is on SONY NEWS-OS
3963 if test -f /etc/osversion; then dnl SONY NEWS-OS
3964   echo "osversion: `cat /etc/osversion`"
3965 else
3966   echo "uname -a: `uname -a`"
3967 fi
3968 echo ""
3969 echo "$0 $quoted_arguments"
3970 ) > Installation
3971
3972 xemacs_betaname=""
3973 test ! -z "${emacs_beta_version}" && xemacs_betaname="-b${emacs_beta_version}"
3974
3975 dnl Start stdout redirection to '| tee -a Installation'
3976 (
3977 echo "
3978
3979 XEmacs ${emacs_major_version}.${emacs_minor_version}${xemacs_betaname} \"$xemacs_codename\" configured for \`$canonical'.
3980
3981   Where should the build process find the source code?    $srcdir
3982   What installation prefix should install use?            $prefix
3983   What operating system and machine description files should XEmacs use?
3984         \`$opsysfile' and \`$machfile'
3985   What compiler should XEmacs be built with?              $CC $CFLAGS
3986   Should XEmacs use the GNU version of malloc?            ${GNU_MALLOC}${GNU_MALLOC_reason}
3987   Should XEmacs use the relocating allocator for buffers? $rel_alloc
3988   What window system should XEmacs use?                   ${window_system}"
3989 if test "$with_x11" = "yes"; then
3990   echo "  Where do we find X Windows header files?                $x_includes"
3991   echo "  Where do we find X Windows libraries?                   $x_libraries"
3992 fi
3993 if test -n "$site_includes"; then
3994   echo "  Additional header files:                                $site_includes"
3995 fi
3996 if test -n "$site_libraries"; then
3997   echo "  Additional libraries:                                   $site_libraries"
3998 fi
3999 if test -n "$site_prefixes"; then
4000   echo "  Additional prefixes:                                    $site_prefixes"
4001 fi
4002 if test -n "$runpath"; then
4003   echo "  Runtime library search path:                            $runpath"
4004 fi
4005 test "$with_dnet"  = yes && echo "  Compiling in support for DNET."
4006 test "$with_socks" = yes && echo "  Compiling in support for SOCKS."
4007 test "$with_xauth" = yes && echo "  Compiling in support for XAUTH."
4008 if test "$with_xmu" != yes -a "$with_x11" = yes; then
4009   echo "  No Xmu; substituting equivalent routines."
4010 fi
4011
4012 if test "$with_xpm" = yes; then
4013   echo "  Compiling in support for XPM images."
4014 elif test "$with_x11" = yes; then
4015   echo "  --------------------------------------------------------------------"
4016   echo "  WARNING: Compiling without XPM support."
4017   if test "$xpm_problem" != ""; then
4018     echo "  Reason: $xpm_problem"
4019   fi
4020   echo "  WARNING: You should strongly consider installing XPM."
4021   echo "  WARNING: Otherwise toolbars and other graphics will look suboptimal."
4022   echo "  WARNING: (a copy may be found in ftp://ftp.xemacs.org/pub/xemacs/aux)"
4023   echo "  --------------------------------------------------------------------"
4024 fi
4025 if test "$with_png" = yes; then
4026   echo "  Compiling in support for PNG image handling."
4027 elif test "$window_system" != "none"; then
4028   echo "  --------------------------------------------------------------------"
4029   echo "  WARNING: Compiling without PNG image support."
4030   if test "$png_problem" != ""; then
4031     echo "  Reason: $png_problem"
4032   fi
4033   echo "  WARNING: You should strongly consider installing the PNG libraries."
4034   echo "  WARNING: Otherwise certain images and glyphs may not display."
4035   echo "  WARNING: (a copy may be found in ftp://ftp.xemacs.org/pub/xemacs/aux)"
4036   echo "  --------------------------------------------------------------------"
4037 fi
4038 test "$with_gif"   = yes && echo "  Compiling in support for (builtin) GIF image handling."
4039 test "$with_jpeg"  = yes && echo "  Compiling in support for JPEG image handling."
4040 test "$with_tiff"  = yes && echo "  Compiling in support for TIFF image handling."
4041 test "$with_xface" = yes && echo "  Compiling in support for X-Face message headers."
4042 case "$with_sound" in
4043   nas    ) echo "  Compiling in network sound (NAS) support." ;;
4044   native ) echo "  Compiling in native sound support." ;;
4045   both   ) echo "  Compiling in both network and native sound support." ;;
4046 esac
4047 test "$old_nas" = yes && echo "        nas library lacks error trapping, will play synchronously."
4048
4049 test "$with_database_berkdb" = yes && echo "  Compiling in support for Berkeley DB."
4050 test "$with_database_dbm"    = yes && echo "  Compiling in support for DBM."
4051 test "$with_database_gnudbm" = yes && echo "  Compiling in support for GNU DBM."
4052
4053 test "$with_umich_ldap"      = yes && echo "  Compiling in support for LDAP (UMich libs)."
4054 test "$with_ns_ldap"         = yes && echo "  Compiling in support for LDAP (Netscape SDK)."
4055 test "$with_ldap" = yes -a "$with_umich_ldap" = no -a "$with_ns_ldap" = no && echo "  Compiling in support for LDAP (Generic)."
4056
4057 test "$with_ncurses"  = yes && echo "  Compiling in support for ncurses."
4058 test "$with_gpm"      = yes && echo "  Compiling in support for GPM (General Purpose Mouse)."
4059
4060 test "$with_mule"     = yes && echo "  Compiling in Mule (multi-lingual) support."
4061 test "$with_file_coding"     = yes && echo "  Compiling in File coding support."
4062 test "$with_xim"      != no && echo "  Compiling in XIM (X11R5+ I18N input method) support."
4063 test "$with_xim" = motif    && echo "    Using Motif to provide XIM support."
4064 test "$with_xim" = xlib     && echo "    Using raw Xlib to provide XIM support."
4065 test "$with_xfs" = yes      && echo "    Using XFontSet to provide bilingual menubar."
4066 test "$with_canna"    = yes && echo "  Compiling in support for Canna on Mule."
4067 if test "$with_wnn" = yes; then
4068   echo "  Compiling in support for the WNN input method on Mule."
4069   test "$with_wnn6" = yes && echo "    Using WNN version 6."
4070 fi
4071 test "$with_i18n3"    = yes && echo "  Compiling in I18N support, level 3 (doesn't currently work)."
4072
4073 test "$with_cde"      = yes && echo "  Compiling in support for CDE."
4074 test "$with_tooltalk" = yes && echo "  Compiling in support for ToolTalk."
4075 test "$with_offix"    = yes && echo "  Compiling in support for OffiX."
4076 test "$with_dragndrop" = yes && echo "  Compiling in EXPERIMENTAL support for Drag'n'Drop ($dragndrop_proto )."
4077 test "$with_workshop" = yes && echo "  Compiling in support for Sun WorkShop."
4078 test "$with_session"  != no && echo "  Compiling in support for proper session-management."
4079 case "$with_menubars" in
4080   lucid ) echo "  Using Lucid menubars." ;;
4081   motif ) echo "  Using Motif menubars."
4082           echo "  *WARNING*  The Motif menubar implementation is currently buggy."
4083           echo "             We recommend using the Lucid menubar instead."
4084           echo "             Re-run configure with --with-menubars='lucid'." ;;
4085 esac
4086 case "$with_scrollbars" in
4087   lucid    ) echo "  Using Lucid scrollbars."     ;;
4088   motif    ) echo "  Using Motif scrollbars."     ;;
4089   athena   ) echo "  Using Athena scrollbars."    ;;
4090   athena3d ) echo "  Using Athena-3d scrollbars." ;;
4091 esac
4092 case "$with_dialogs" in
4093   motif    ) echo "  Using Motif dialog boxes."     ;;
4094   athena   ) echo "  Using Athena dialog boxes."    ;;
4095   athena3d ) echo "  Using Athena-3d dialog boxes." ;;
4096 esac
4097 test "$with_shlib" = "yes" && echo "  Compiling in DLL support."
4098 test "$with_clash_detection" = yes && \
4099   echo "  Clash detection will use \"$lockdir\" for locking files."
4100 echo "  movemail will use \"$mail_locking\" for locking mail spool files."
4101 test "$with_pop"        = yes && echo "  Using POP for mail access."
4102 test "$with_kerberos"   = yes && echo "  Using Kerberos for POP authentication."
4103 test "$with_hesiod"     = yes && echo "  Using Hesiod to get POP server host."
4104 test "$use_union_type"  = yes && echo "  Using the union type for Lisp_Objects."
4105 test "$use_minimal_tagbits" = yes && echo "  Using Lisp_Objects with minimal tagbits."
4106 test "$use_indexed_lrecord_implementation" = yes && echo "  Using indexed lrecord implementation."
4107 test "$debug"              = yes && echo "  Compiling in extra code for debugging."
4108 test "$memory_usage_stats" = yes && echo "  Compiling in code for checking XEmacs memory usage."
4109 test "$usage_tracking"     = yes && echo "  Compiling with usage tracking active (Sun internal)."
4110 if test "$error_check_extents $error_check_typecheck $error_check_bufpos $error_check_gc $error_check_malloc" \
4111   != "no no no no no"; then
4112   echo "  WARNING: ---------------------------------------------------------"
4113   echo "  WARNING: Compiling in support for runtime error checking."
4114   echo "  WARNING: XEmacs will run noticeably more slowly as a result."
4115   echo "  WARNING: Error checking is on by default for XEmacs beta releases."
4116   echo "  WARNING: ---------------------------------------------------------"
4117 fi
4118 echo ""
4119 ) | tee -a Installation
4120 dnl echo "The above configure report is appended to \"Installation\" file."
4121 echo ""
4122
4123 dnl Generate Installation.el
4124 echo '(setq Installation-string "' > Installation.el
4125 sed 's/"/\\"/g' Installation >> Installation.el
4126 echo '")' >> Installation.el
4127
4128 dnl -----------------------------------
4129 dnl Now generate config.h and Makefiles
4130 dnl -----------------------------------
4131 dnl This has to be called in order for this variable to get into config.status
4132 AC_SUBST(internal_makefile_list)
4133 # Remove any trailing slashes in these variables.
4134 test -n "$prefix" &&
4135   prefix=`echo '' "$prefix" | sed -e 's:^ ::' -e 's,\([[^/]]\)/*$,\1,'`
4136 test -n "$exec_prefix" &&
4137   exec_prefix=`echo '' "$exec_prefix" | sed -e 's:^ ::' -e 's,\([[^/]]\)/*$,\1,'`
4138
4139 dnl Build Makefile.in's from Makefile.in.in's
4140 dnl except ./Makefile from $srcdir/Makefile.in
4141
4142 for file in $internal_makefile_list; do
4143   test "$file" = src/Makefile.in && \
4144     file="src/Makefile.in:src/Makefile.in.in:src/depend"
4145   ac_output_files="${ac_output_files+$ac_output_files }$file"
4146 done
4147 ac_output_files="$ac_output_files src/paths.h lib-src/config.values"
4148 if test "$with_shlib" = "yes"; then
4149   ac_output_files="$ac_output_files lib-src/ellcc.h"
4150 fi
4151
4152 AC_OUTPUT($ac_output_files,
4153 [for dir in . $MAKE_SUBDIR; do
4154   (
4155     cd $dir
4156     rm -f junk.c
4157     < Makefile.in \
4158       sed -e '/^# Generated/d' \
4159           -e 's%/\*\*/#.*%%' \
4160           -e 's/^ *# */#/' \
4161 dnl Delete Makefile.in.in comment lines
4162           -e '/^##/d' \
4163 dnl Pass through CPP directives unchanged
4164           -e '/^#/ {
4165 p
4166 d
4167 }'        \
4168 dnl Quote other lines to protect from CPP substitution
4169           -e '/./ {
4170 s/\([[\"]]\)/\\\1/g
4171 s/^/"/
4172 s/$/"/
4173 }'  > junk.c;
4174
4175 dnl Create a GNUmakefile and Makefile from Makefile.in.
4176
4177 changequote(<<,>>)dnl
4178 dnl CPP_MAKEFILE(CPPFLAGS,filename)
4179 define(<<CPP_MAKEFILE>>,
4180 echo creating $dir/<<$2>>
4181 $CPP -I. -I${top_srcdir}/src <<$1>> junk.c \
4182 dnl Delete line directives inserted by $CPP
4183   | sed -e 's/^\#.*//'          \
4184 dnl Delete spurious blanks inserted by $CPP
4185         -e 's/^[ TAB][ TAB]*$//'\
4186         -e 's/^ /TAB/'          \
4187 dnl Delete blank lines
4188   | sed -n -e '/^..*$/p'        \
4189 dnl Restore lines quoted above to original contents.
4190   | sed '/^\"/ {
4191         s/\\\([\"]\)/\1/g
4192         s/^[ TAB]*\"//
4193         s/\"[ TAB]*$//
4194 }' > Makefile.new
4195     chmod 444 Makefile.new
4196     mv -f Makefile.new <<$2>>
4197 )dnl CPP_MAKEFILE
4198
4199     CPP_MAKEFILE(,Makefile)
4200     CPP_MAKEFILE(-DUSE_GNU_MAKE,GNUmakefile)
4201 changequote([,])dnl
4202     rm -f junk.c
4203   )
4204 done
4205
4206 dnl Append AC_DEFINE information to lib-src/config.values
4207 dnl (AC_SUBST information is already there (see config.values.sh).
4208 sed < config.status >> lib-src/config.values \
4209   -e '/{ac_dA}.*{ac_dB}.*{ac_dC}.*{ac_dD}$/!d' \
4210   -e 's/\${ac_dA}\(.*\)\${ac_dB}.*\${ac_dC}\(.*\)\${ac_dD}/\1 \2/' \
4211   -e 's/^\([[^ ]]*\) $/\1 ""/' \
4212   -e 's/ 1$/ t/'
4213
4214 ],
4215 [CPP="$CPP"
4216  top_srcdir="$srcdir"
4217  MAKE_SUBDIR="$MAKE_SUBDIR"
4218 ])dnl