]> code.delx.au - gnu-emacs/blob - configure.in
Remove comment that is no longer true.
[gnu-emacs] / configure.in
1 dnl Autoconf script for GNU Emacs
2 dnl To rebuild the `configure' script from this, execute the command
3 dnl autoconf
4 dnl in the directory containing this script.
5 dnl If you changed any AC_DEFINES, also run autoheader.
6 dnl
7 dnl Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2003, 2004,
8 dnl 2005, 2006, 2007, 2008, 2009, 2010
9 dnl Free Software Foundation, Inc.
10 dnl
11 dnl This file is part of GNU Emacs.
12 dnl
13 dnl GNU Emacs is free software: you can redistribute it and/or modify
14 dnl it under the terms of the GNU General Public License as published by
15 dnl the Free Software Foundation, either version 3 of the License, or
16 dnl (at your option) any later version.
17 dnl
18 dnl GNU Emacs is distributed in the hope that it will be useful,
19 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
20 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 dnl GNU General Public License for more details.
22 dnl
23 dnl You should have received a copy of the GNU General Public License
24 dnl along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
25
26 AC_PREREQ(2.65)
27 AC_INIT(emacs, 24.0.50)
28 AC_CONFIG_HEADER(src/config.h:src/config.in)
29 AC_CONFIG_SRCDIR(src/lisp.h)
30
31 dnl Support for --program-prefix, --program-suffix and
32 dnl --program-transform-name options
33 AC_ARG_PROGRAM
34
35 dnl It is important that variables on the RHS not be expanded here,
36 dnl hence the single quotes. This is per the GNU coding standards, see
37 dnl (autoconf) Installation Directory Variables
38 dnl See also epaths.h below.
39 lispdir='${datadir}/emacs/${version}/lisp'
40 locallisppath='${datadir}/emacs/${version}/site-lisp:'\
41 '${datadir}/emacs/site-lisp'
42 lisppath='${locallisppath}:${lispdir}:${datadir}/emacs/${version}/leim'
43 etcdir='${datadir}/emacs/${version}/etc'
44 archlibdir='${libexecdir}/emacs/${version}/${configuration}'
45 docdir='${datadir}/emacs/${version}/etc'
46 gamedir='${localstatedir}/games/emacs'
47
48 gameuser=games
49
50 dnl OPTION_DEFAULT_OFF(NAME, HELP-STRING)
51 dnl Create a new --with option that defaults to being disabled.
52 dnl NAME is the base name of the option. The shell variable with_NAME
53 dnl will be set to either the user's value (if the option is
54 dnl specified; 'yes' for a plain --with-NAME) or to 'no' (if the
55 dnl option is not specified). Note that the shell variable name is
56 dnl constructed as autoconf does, by replacing non-alphanumeric
57 dnl characters with "_".
58 dnl HELP-STRING is the help text for the option.
59 AC_DEFUN([OPTION_DEFAULT_OFF], [dnl
60 AC_ARG_WITH([$1],[AS_HELP_STRING([--with-$1],[$2])],[],[dnl
61 m4_bpatsubst([with_$1], [[^0-9a-z]], [_])=no])dnl
62 ])dnl
63
64 dnl OPTION_DEFAULT_ON(NAME, HELP-STRING)
65 dnl Create a new --with option that defaults to being enabled. NAME
66 dnl is the base name of the option. The shell variable with_NAME
67 dnl will be set either to 'no' (for a plain --without-NAME) or to
68 dnl 'yes' (if the option is not specified). Note that the shell
69 dnl variable name is constructed as autoconf does, by replacing
70 dnl non-alphanumeric characters with "_".
71 dnl HELP-STRING is the help text for the option.
72 AC_DEFUN([OPTION_DEFAULT_ON], [dnl
73 AC_ARG_WITH([$1],[AS_HELP_STRING([--without-$1],[$2])],[],[dnl
74 m4_bpatsubst([with_$1], [[^0-9a-z]], [_])=yes])dnl
75 ])dnl
76
77 OPTION_DEFAULT_ON([pop],[don't support POP mail retrieval with movemail])
78 if test "$with_pop" = yes; then
79 AC_DEFINE(MAIL_USE_POP)
80 fi
81 AH_TEMPLATE(MAIL_USE_POP, [Define to support POP mail retrieval.])dnl
82
83 OPTION_DEFAULT_OFF([kerberos],[support Kerberos-authenticated POP])
84 if test "$with_kerberos" != no; then
85 AC_DEFINE(KERBEROS)
86 fi
87 AH_TEMPLATE(KERBEROS,
88 [Define to support Kerberos-authenticated POP mail retrieval.])dnl
89
90 OPTION_DEFAULT_OFF([kerberos5],[support Kerberos version 5 authenticated POP])
91 if test "${with_kerberos5}" != no; then
92 if test "${with_kerberos}" = no; then
93 with_kerberos=yes
94 AC_DEFINE(KERBEROS)
95 fi
96 AC_DEFINE(KERBEROS5, 1, [Define to use Kerberos 5 instead of Kerberos 4.])
97 fi
98
99 OPTION_DEFAULT_OFF([hesiod],[support Hesiod to get the POP server host])
100 dnl FIXME hesiod support may not be present, so it seems like an error
101 dnl to define, or at least use, this unconditionally.
102 if test "$with_hesiod" != no; then
103 AC_DEFINE(HESIOD, 1, [Define to support using a Hesiod database to find the POP server.])
104 fi
105
106 OPTION_DEFAULT_OFF([mmdf],[support MMDF mailboxes])
107 if test "$with_mmdf" != no; then
108 AC_DEFINE(MAIL_USE_MMDF, 1, [Define to support MMDF mailboxes in movemail.])
109 fi
110
111 OPTION_DEFAULT_OFF([mail-unlink],[unlink, rather than empty, mail spool after reading])
112 if test "$with_mail_unlink" != no; then
113 AC_DEFINE(MAIL_UNLINK_SPOOL, 1, [Define to unlink, rather than empty, mail spool after reading.])
114 fi
115
116 AC_ARG_WITH([mailhost],[AS_HELP_STRING([--with-mailhost=HOSTNAME],
117 [string giving default POP mail host])],
118 AC_DEFINE_UNQUOTED(MAILHOST, ["$withval"], [String giving fallback POP mail host.]))
119
120 OPTION_DEFAULT_ON([sound],[don't compile with sound support])
121
122 OPTION_DEFAULT_ON([sync-input],[process async input synchronously])
123 if test "$with_sync_input" = yes; then
124 AC_DEFINE(SYNC_INPUT, 1, [Process async input synchronously.])
125 fi
126
127 dnl FIXME currently it is not the last.
128 dnl This should be the last --with option, because --with-x is
129 dnl added later on when we find the path of X, and it's best to
130 dnl keep them together visually.
131 AC_ARG_WITH([x-toolkit],[AS_HELP_STRING([--with-x-toolkit=KIT],
132 [use an X toolkit (KIT one of: yes or gtk, gtk3, lucid or athena, motif, no)])],
133 [ case "${withval}" in
134 y | ye | yes ) val=gtk ;;
135 n | no ) val=no ;;
136 l | lu | luc | luci | lucid ) val=lucid ;;
137 a | at | ath | athe | athen | athena ) val=athena ;;
138 m | mo | mot | moti | motif ) val=motif ;;
139 g | gt | gtk ) val=gtk ;;
140 gtk3 ) val=gtk3 ;;
141 * )
142 AC_MSG_ERROR([`--with-x-toolkit=$withval' is invalid;
143 this option's value should be `yes', `no', `lucid', `athena', `motif', `gtk' or
144 `gtk3'. `yes' and `gtk' are synonyms. `athena' and `lucid' are synonyms.])
145 ;;
146 esac
147 with_x_toolkit=$val
148 ])
149
150 dnl _ON results in a '--without' option in the --help output, so
151 dnl the help text should refer to "don't compile", etc.
152 OPTION_DEFAULT_ON([xpm],[don't compile with XPM image support])
153 OPTION_DEFAULT_ON([jpeg],[don't compile with JPEG image support])
154 OPTION_DEFAULT_ON([tiff],[don't compile with TIFF image support])
155 OPTION_DEFAULT_ON([gif],[don't compile with GIF image support])
156 OPTION_DEFAULT_ON([png],[don't compile with PNG image support])
157 OPTION_DEFAULT_ON([rsvg],[don't compile with SVG image support])
158
159 OPTION_DEFAULT_ON([xft],[don't use XFT for anti aliased fonts])
160 OPTION_DEFAULT_ON([libotf],[don't use libotf for OpenType font support])
161 OPTION_DEFAULT_ON([m17n-flt],[don't use m17n-flt for text shaping])
162
163 OPTION_DEFAULT_ON([toolkit-scroll-bars],[don't use Motif or Xaw3d scroll bars])
164 OPTION_DEFAULT_ON([xaw3d],[don't use Xaw3d])
165 OPTION_DEFAULT_ON([xim],[don't use X11 XIM])
166 OPTION_DEFAULT_OFF([ns],[use nextstep (Cocoa or GNUstep) windowing system])
167
168 OPTION_DEFAULT_ON([gpm],[don't use -lgpm for mouse support on a GNU/Linux console])
169 OPTION_DEFAULT_ON([dbus],[don't compile with D-Bus support])
170 OPTION_DEFAULT_ON([gconf],[don't compile with GConf support])
171 OPTION_DEFAULT_ON([selinux],[don't compile with SELinux support])
172
173 ## For the times when you want to build Emacs but don't have
174 ## a suitable makeinfo, and can live without the manuals.
175 dnl http://lists.gnu.org/archive/html/emacs-devel/2008-04/msg01844.html
176 OPTION_DEFAULT_ON([makeinfo],[don't require makeinfo for building manuals])
177
178 ## This is an option because I do not know if all info/man support
179 ## compressed files, nor how to test if they do so.
180 OPTION_DEFAULT_ON([compress-info],[don't compress the installed Info pages])
181 if test $with_compress_info = yes; then
182 GZIP_INFO=yes
183 else
184 GZIP_INFO=
185 fi
186 AC_SUBST(GZIP_INFO)
187
188 AC_ARG_WITH([pkg-config-prog],dnl
189 [AS_HELP_STRING([--with-pkg-config-prog=PATH],
190 [path to pkg-config for finding GTK and librsvg])])
191 if test "X${with_pkg_config_prog}" != X; then
192 if test "${with_pkg_config_prog}" != yes; then
193 PKG_CONFIG="${with_pkg_config_prog}"
194 fi
195 fi
196
197 CRT_DIR=
198 AC_ARG_WITH([crt-dir],dnl
199 [AS_HELP_STRING([--with-crt-dir=DIR],[directory containing crtn.o etc.
200 The default is /usr/lib, or /usr/lib64 on some platforms.])])
201 CRT_DIR="${with_crt_dir}"
202
203 AC_ARG_WITH([gnustep-conf],dnl
204 [AS_HELP_STRING([--with-gnustep-conf=PATH],[path to GNUstep.conf; default $GNUSTEP_CONFIG_FILE, or /etc/GNUstep/GNUstep.conf])])
205 test "X${with_gnustep_conf}" != X && test "${with_gnustep_conf}" != yes && \
206 GNUSTEP_CONFIG_FILE="${with_gnustep_conf}"
207 test "X$GNUSTEP_CONFIG_FILE" = "X" && \
208 GNUSTEP_CONFIG_FILE=/etc/GNUstep/GNUstep.conf
209
210 AC_ARG_ENABLE(ns-self-contained,
211 [AS_HELP_STRING([--disable-ns-self-contained],
212 [disable self contained build under NeXTstep])],
213 EN_NS_SELF_CONTAINED=$enableval,
214 EN_NS_SELF_CONTAINED=yes)
215
216 AC_ARG_ENABLE(asserts,
217 [AS_HELP_STRING([--enable-asserts], [compile code with asserts enabled])],
218 USE_XASSERTS=$enableval,
219 USE_XASSERTS=no)
220
221 AC_ARG_ENABLE(maintainer-mode,
222 [AS_HELP_STRING([--enable-maintainer-mode],
223 [enable make rules and dependencies not useful (and sometimes
224 confusing) to the casual installer])],
225 USE_MAINTAINER_MODE=$enableval,
226 USE_MAINTAINER_MODE=no)
227 if test $USE_MAINTAINER_MODE = yes; then
228 MAINT=
229 else
230 MAINT=#
231 fi
232 AC_SUBST(MAINT)
233
234 AC_ARG_ENABLE(locallisppath,
235 [AS_HELP_STRING([--enable-locallisppath=PATH],
236 [directories Emacs should search for lisp files specific
237 to this site])],
238 if test "${enableval}" = "no"; then
239 locallisppath=
240 elif test "${enableval}" != "yes"; then
241 locallisppath=${enableval}
242 fi)
243
244 AC_ARG_ENABLE(checking,
245 [AS_HELP_STRING([--enable-checking@<:@=LIST@:>@],
246 [enable expensive run-time checks. With LIST,
247 enable only specific categories of checks.
248 Categories are: all,yes,no.
249 Flags are: stringbytes, stringoverrun, stringfreelist,
250 xmallocoverrun, conslist])],
251 [ac_checking_flags="${enableval}"],[])
252 IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="$IFS,"
253 for check in $ac_checking_flags
254 do
255 case $check in
256 # these set all the flags to specific states
257 yes) ac_enable_checking=1 ;;
258 no) ac_enable_checking= ;
259 ac_gc_check_stringbytes= ;
260 ac_gc_check_string_overrun= ;
261 ac_gc_check_string_free_list= ;
262 ac_xmalloc_overrun= ;
263 ac_gc_check_cons_list= ;;
264 all) ac_enable_checking=1 ;
265 ac_gc_check_stringbytes=1 ;
266 ac_gc_check_string_overrun=1 ;
267 ac_gc_check_string_free_list=1 ;
268 ac_xmalloc_overrun=1 ;
269 ac_gc_check_cons_list=1 ;;
270 # these enable particular checks
271 stringbytes) ac_gc_check_stringbytes=1 ;;
272 stringoverrun) ac_gc_check_string_overrun=1 ;;
273 stringfreelist) ac_gc_check_string_free_list=1 ;;
274 xmallocoverrun) ac_xmalloc_overrun=1 ;;
275 conslist) ac_gc_check_cons_list=1 ;;
276 *) AC_MSG_ERROR(unknown check category $check) ;;
277 esac
278 done
279 IFS="$ac_save_IFS"
280
281 if test x$ac_enable_checking != x ; then
282 AC_DEFINE(ENABLE_CHECKING, 1,
283 [Enable expensive run-time checking of data types?])
284 fi
285 if test x$ac_gc_check_stringbytes != x ; then
286 AC_DEFINE(GC_CHECK_STRING_BYTES, 1,
287 [Define this temporarily to hunt a bug. If defined, the size of
288 strings is redundantly recorded in sdata structures so that it can
289 be compared to the sizes recorded in Lisp strings.])
290 fi
291 if test x$ac_gc_check_stringoverrun != x ; then
292 AC_DEFINE(GC_CHECK_STRING_OVERRUN, 1,
293 [Define this to check for short string overrun.])
294 fi
295 if test x$ac_gc_check_string_free_list != x ; then
296 AC_DEFINE(GC_CHECK_STRING_FREE_LIST, 1,
297 [Define this to check the string free list.])
298 fi
299 if test x$ac_xmalloc_overrun != x ; then
300 AC_DEFINE(XMALLOC_OVERRUN_CHECK, 1,
301 [Define this to check for malloc buffer overrun.])
302 fi
303 if test x$ac_gc_check_cons_list != x ; then
304 AC_DEFINE(GC_CHECK_CONS_LIST, 1,
305 [Define this to check for errors in cons list.])
306 fi
307
308 AC_ARG_ENABLE(profiling,
309 [AS_HELP_STRING([--enable-profiling],
310 [build emacs with profiling support.
311 This might not work on all platforms])],
312 [ac_enable_profiling="${enableval}"],[])
313 if test x$ac_enable_profiling != x ; then
314 PROFILING_CFLAGS="-DPROFILING=1 -pg"
315 PROFILING_LDFLAGS="-pg"
316 else
317 PROFILING_CFLAGS=
318 PROFILING_LDFLAGS=
319 fi
320
321 AC_ARG_ENABLE(autodepend,
322 [AS_HELP_STRING([--enable-autodepend],
323 [automatically generate dependencies to .h-files.
324 Requires GNU Make and Gcc. Enabled if GNU Make and Gcc is
325 found])],
326 [ac_enable_autodepend="${enableval}"],[ac_enable_autodepend=yes])
327
328 #### Make srcdir absolute, if it isn't already. It's important to
329 #### avoid running the path through pwd unnecessarily, since pwd can
330 #### give you automounter prefixes, which can go away. We do all this
331 #### so Emacs can find its files when run uninstalled.
332 ## Make sure CDPATH doesn't affect cd (in case PWD is relative).
333 unset CDPATH
334 case "${srcdir}" in
335 /* ) ;;
336 . )
337 ## We may be able to use the $PWD environment variable to make this
338 ## absolute. But sometimes PWD is inaccurate.
339 ## Note: we used to use ${PWD} at the end instead of `pwd`,
340 ## but that tested only for a well-formed and valid PWD,
341 ## it did not object when PWD was well-formed and valid but just wrong.
342 if test ".${PWD}" != "." && test ".`(cd ${PWD} ; sh -c pwd)`" = ".`pwd`" ;
343 then
344 srcdir="$PWD"
345 else
346 srcdir="`(cd ${srcdir}; pwd)`"
347 fi
348 ;;
349 * ) srcdir="`(cd ${srcdir}; pwd)`" ;;
350 esac
351
352 #### Check if the source directory already has a configured system in it.
353 if test `pwd` != `(cd ${srcdir} && pwd)` \
354 && test -f "${srcdir}/src/config.h" ; then
355 AC_MSG_WARN([[The directory tree `${srcdir}' is being used
356 as a build directory right now; it has been configured in its own
357 right. To configure in another directory as well, you MUST
358 use GNU make. If you do not have GNU make, then you must
359 now do `make distclean' in ${srcdir},
360 and then run $0 again.]])
361 fi
362
363 #### Given the configuration name, set machfile and opsysfile to the
364 #### names of the m/*.h and s/*.h files we should use.
365
366 ### Canonicalize the configuration name.
367
368 AC_CANONICAL_HOST
369 canonical=$host
370 configuration=${host_alias-${build_alias-$host}}
371
372 dnl This used to use changequote, but, apart from `changequote is evil'
373 dnl per the autoconf manual, we can speed up autoconf somewhat by quoting
374 dnl the great gob of text. Thus it's not processed for possible expansion.
375 dnl Just make sure the brackets remain balanced.
376 dnl
377 dnl Since Emacs can't find matching pairs of quotes, boundaries are
378 dnl indicated by comments.
379 dnl quotation begins
380 [
381
382 ### If you add support for a new configuration, add code to this
383 ### switch statement to recognize your configuration name and select
384 ### the appropriate operating system and machine description files.
385
386 ### You would hope that you could choose an m/*.h file pretty much
387 ### based on the machine portion of the configuration name, and an s/*.h
388 ### file based on the operating system portion. However, it turns out
389 ### that each m/*.h file is pretty manufacturer-specific - for
390 ### example mips.h is MIPS
391 ### So we basically have to have a special case for each
392 ### configuration name.
393 ###
394 ### As far as handling version numbers on operating systems is
395 ### concerned, make sure things will fail in a fixable way. If
396 ### /etc/MACHINES doesn't say anything about version numbers, be
397 ### prepared to handle anything reasonably. If version numbers
398 ### matter, be sure /etc/MACHINES says something about it.
399
400 machine='' opsys='' unported=no
401 case "${canonical}" in
402
403 ## FreeBSD ports
404 *-*-freebsd* )
405 opsys=freebsd
406 case "${canonical}" in
407 alpha*) machine=alpha ;;
408 amd64-*|x86_64-*) machine=amdx86-64 ;;
409 arm*) machine=arm ;;
410 ia64-*) machine=ia64 ;;
411 i[3456]86-*) machine=intel386 ;;
412 powerpc-*) machine=macppc ;;
413 sparc-*) machine=sparc ;;
414 sparc64-*) machine=sparc ;;
415 esac
416 ;;
417
418 ## FreeBSD kernel + glibc based userland
419 *-*-kfreebsd*gnu* )
420 opsys=gnu-kfreebsd
421 case "${canonical}" in
422 alpha*) machine=alpha ;;
423 amd64-*|x86_64-*) machine=amdx86-64 ;;
424 ia64-*) machine=ia64 ;;
425 i[3456]86-*) machine=intel386 ;;
426 powerpc-*) machine=macppc ;;
427 sparc-*) machine=sparc ;;
428 sparc64-*) machine=sparc ;;
429 esac
430 ;;
431
432 ## NetBSD ports
433 *-*-netbsd* )
434 opsys=netbsd
435 case "${canonical}" in
436 alpha*) machine=alpha ;;
437 x86_64-*) machine=amdx86-64 ;;
438 arm-*) machine=arm ;;
439 hppa-*) machine=hp800 ;;
440 i[3456]86-*) machine=intel386 ;;
441 m68k-*) machine=m68k ;;
442 powerpc-*) machine=macppc ;;
443 mips-*) machine=mips ;;
444 mipse[bl]-*) machine=mips ;;
445 sparc*-) machine=sparc ;;
446 vax-*) machine=vax ;;
447 esac
448 ;;
449
450 ## OpenBSD ports
451 *-*-openbsd* )
452 opsys=openbsd
453 case "${canonical}" in
454 alpha*) machine=alpha ;;
455 x86_64-*) machine=amdx86-64 ;;
456 arm-*) machine=arm ;;
457 hppa-*) machine=hp800 ;;
458 i386-*) machine=intel386 ;;
459 powerpc-*) machine=macppc ;;
460 sparc*) machine=sparc ;;
461 vax-*) machine=vax ;;
462 esac
463 ;;
464
465 alpha*-*-linux-gnu* )
466 machine=alpha opsys=gnu-linux
467 ;;
468
469 arm*-*-linux-gnu* )
470 machine=arm opsys=gnu-linux
471 ;;
472
473 ## Apple Darwin / Mac OS X
474 *-apple-darwin* )
475 case "${canonical}" in
476 i[3456]86-* ) machine=intel386 ;;
477 powerpc-* ) machine=macppc ;;
478 x86_64-* ) machine=amdx86-64 ;;
479 * ) unported=yes ;;
480 esac
481 opsys=darwin
482 # Define CPP as follows to make autoconf work correctly.
483 CPP="${CC-cc} -E -no-cpp-precomp"
484 # Use fink packages if available.
485 if test -d /sw/include && test -d /sw/lib; then
486 GCC_TEST_OPTIONS="-I/sw/include -L/sw/lib"
487 CPP="${CPP} ${GCC_TEST_OPTIONS}"
488 NON_GCC_TEST_OPTIONS=${GCC_TEST_OPTIONS}
489 fi
490 ;;
491
492 ## HP 9000 series 700 and 800, running HP/UX
493 hppa*-hp-hpux10.2* )
494 machine=hp800 opsys=hpux10-20
495 ;;
496 hppa*-hp-hpux1[1-9]* )
497 machine=hp800 opsys=hpux11
498 CFLAGS="-D_INCLUDE__STDC_A1_SOURCE $CFLAGS"
499 ;;
500
501 hppa*-*-linux-gnu* )
502 machine=hp800 opsys=gnu-linux
503 ;;
504
505 ## IBM machines
506 s390-*-linux-gnu* )
507 machine=ibms390 opsys=gnu-linux
508 ;;
509 s390x-*-linux-gnu* )
510 machine=ibms390x opsys=gnu-linux
511 ;;
512 rs6000-ibm-aix4.[23]* )
513 machine=ibmrs6000 opsys=aix4-2
514 ;;
515 powerpc-ibm-aix4.[23]* )
516 machine=ibmrs6000 opsys=aix4-2
517 ;;
518 rs6000-ibm-aix[56]* )
519 machine=ibmrs6000 opsys=aix4-2
520 ;;
521 powerpc-ibm-aix[56]* )
522 machine=ibmrs6000 opsys=aix4-2
523 ;;
524
525 ## Macintosh PowerPC
526 powerpc*-*-linux-gnu* )
527 machine=macppc opsys=gnu-linux
528 ;;
529
530 ## Silicon Graphics machines
531 ## Iris 4D
532 mips-sgi-irix6.5 )
533 machine=iris4d opsys=irix6-5
534 # Without defining _LANGUAGE_C, things get masked out in the headers
535 # so that, for instance, grepping for `free' in stdlib.h fails and
536 # AC_HEADER_STD_C fails. (MIPSPro 7.2.1.2m compilers, Irix 6.5.3m).
537 NON_GNU_CPP="/lib/cpp -D_LANGUAGE_C"
538 NON_GCC_TEST_OPTIONS="-D_LANGUAGE_C"
539 ;;
540
541 ## Suns
542 sparc-*-linux-gnu* | sparc64-*-linux-gnu* )
543 machine=sparc opsys=gnu-linux
544 ;;
545
546 *-sun-solaris* \
547 | i[3456]86-*-solaris2* | i[3456]86-*-sunos5* \
548 | x86_64-*-solaris2* | x86_64-*-sunos5*)
549 case "${canonical}" in
550 i[3456]86-*-* ) machine=intel386 ;;
551 amd64-*-*|x86_64-*-*) machine=amdx86-64 ;;
552 sparc* ) machine=sparc ;;
553 * ) unported=yes ;;
554 esac
555 case "${canonical}" in
556 *-sunos5.6* | *-solaris2.6* )
557 opsys=sol2-6
558 NON_GNU_CPP=/usr/ccs/lib/cpp
559 RANLIB="ar -ts"
560 ;;
561 *-sunos5.[7-9]* | *-solaris2.[7-9]* )
562 opsys=sol2-6
563 emacs_check_sunpro_c=yes
564 NON_GNU_CPP=/usr/ccs/lib/cpp
565 ;;
566 *-sunos5* | *-solaris* )
567 opsys=sol2-10
568 emacs_check_sunpro_c=yes
569 NON_GNU_CPP=/usr/ccs/lib/cpp
570 ;;
571 esac
572 ## Watch out for a compiler that we know will not work.
573 case "${canonical}" in
574 *-solaris* | *-sunos5* )
575 if [ "x$CC" = x/usr/ucb/cc ]; then
576 ## /usr/ucb/cc doesn't work;
577 ## we should find some other compiler that does work.
578 unset CC
579 fi
580 ;;
581 *) ;;
582 esac
583 ;;
584
585 ## IA-64
586 ia64*-*-linux* )
587 machine=ia64 opsys=gnu-linux
588 ;;
589
590 ## Intel 386 machines where we don't care about the manufacturer.
591 i[3456]86-*-* )
592 machine=intel386
593 case "${canonical}" in
594 *-cygwin ) opsys=cygwin ;;
595 *-darwin* ) opsys=darwin
596 CPP="${CC-cc} -E -no-cpp-precomp"
597 ;;
598 *-linux-gnu* ) opsys=gnu-linux ;;
599 *-sysv4.2uw* ) opsys=unixware; NON_GNU_CPP=/lib/cpp ;;
600 *-sysv5uw* ) opsys=unixware; NON_GNU_CPP=/lib/cpp ;;
601 *-sysv5OpenUNIX* ) opsys=unixware; NON_GNU_CPP=/lib/cpp ;;
602 ## Otherwise, we'll fall through to the generic opsys code at the bottom.
603 esac
604 ;;
605
606 ## m68k Linux-based GNU system
607 m68k-*-linux-gnu* )
608 machine=m68k opsys=gnu-linux
609 ;;
610
611 ## Mips Linux-based GNU system
612 mips-*-linux-gnu* | mipsel-*-linux-gnu* \
613 | mips64-*-linux-gnu* | mips64el-*-linux-gnu* )
614 machine=mips opsys=gnu-linux
615 ;;
616
617 ## AMD x86-64 Linux-based GNU system
618 x86_64-*-linux-gnu* )
619 machine=amdx86-64 opsys=gnu-linux
620 ;;
621
622 ## Tensilica Xtensa Linux-based GNU system
623 xtensa*-*-linux-gnu* )
624 machine=xtensa opsys=gnu-linux
625 ;;
626
627 ## SuperH Linux-based GNU system
628 sh[34]*-*-linux-gnu* )
629 machine=sh3 opsys=gnu-linux
630 ;;
631
632 * )
633 unported=yes
634 ;;
635 esac
636
637 ### If the code above didn't choose an operating system, just choose
638 ### an operating system based on the configuration name. You really
639 ### only want to use this when you have no idea what the right
640 ### operating system is; if you know what operating systems a machine
641 ### runs, it's cleaner to make it explicit in the case statement
642 ### above.
643 if test x"${opsys}" = x; then
644 case "${canonical}" in
645 *-gnu* ) opsys=gnu ;;
646 * )
647 unported=yes
648 ;;
649 esac
650 fi
651
652 ]
653 dnl quotation ends
654
655 if test $unported = yes; then
656 AC_MSG_ERROR([Emacs hasn't been ported to `${canonical}' systems.
657 Check `etc/MACHINES' for recognized configuration names.])
658 fi
659
660 machfile="m/${machine}.h"
661 opsysfile="s/${opsys}.h"
662
663
664 #### Choose a compiler.
665 test -n "$CC" && cc_specified=yes
666
667 # Save the value of CFLAGS that the user specified.
668 SPECIFIED_CFLAGS="$CFLAGS"
669
670 dnl Sets GCC=yes if using gcc.
671 AC_PROG_CC
672
673 # On Suns, sometimes $CPP names a directory.
674 if test -n "$CPP" && test -d "$CPP"; then
675 CPP=
676 fi
677
678 ## If not using gcc, and on Solaris, and no CPP specified, see if
679 ## using a Sun compiler, which needs -Xs to prevent whitespace.
680 if test x"$GCC" != xyes && test x"$emacs_check_sunpro_c" = xyes && \
681 test x"$CPP" = x; then
682 AC_MSG_CHECKING([whether we are using a Sun C compiler])
683 AC_CACHE_VAL(emacs_cv_sunpro_c,
684 [AC_TRY_LINK([],
685 [#ifndef __SUNPRO_C
686 fail;
687 #endif
688 ], emacs_cv_sunpro_c=yes, emacs_cv_sunpro_c=no)])
689 AC_MSG_RESULT($emacs_cv_sunpro_c)
690
691 if test x"$emacs_cv_sunpro_c" = xyes; then
692 NON_GNU_CPP="$CC -E -Xs"
693 fi
694 fi
695
696 #### Some systems specify a CPP to use unless we are using GCC.
697 #### Now that we know whether we are using GCC, we can decide whether
698 #### to use that one.
699 if test "x$NON_GNU_CPP" != x && test x$GCC != xyes && test "x$CPP" = x
700 then
701 CPP="$NON_GNU_CPP"
702 fi
703
704 #### Some systems specify a CC to use unless we are using GCC.
705 #### Now that we know whether we are using GCC, we can decide whether
706 #### to use that one.
707 if test "x$NON_GNU_CC" != x && test x$GCC != xyes &&
708 test x$cc_specified != xyes
709 then
710 CC="$NON_GNU_CC"
711 fi
712
713 if test x$GCC = xyes; then
714 C_OPTIMIZE_SWITCH=-O2
715 test "x$GCC_TEST_OPTIONS" != x && CC="$CC $GCC_TEST_OPTIONS"
716 else
717 C_OPTIMIZE_SWITCH=-O
718 test "x$NON_GCC_TEST_OPTIONS" != x && CC="$CC $NON_GCC_TEST_OPTIONS"
719 fi
720
721 dnl checks for Unix variants
722 AC_USE_SYSTEM_EXTENSIONS
723
724 ### Use -Wno-pointer-sign if the compiler supports it
725 AC_MSG_CHECKING([whether gcc understands -Wno-pointer-sign])
726 SAVE_CFLAGS="$CFLAGS"
727 CFLAGS="$CFLAGS -Wno-pointer-sign"
728 AC_TRY_COMPILE([], [], has_option=yes, has_option=no,)
729 if test $has_option = yes; then
730 C_WARNINGS_SWITCH="-Wno-pointer-sign $C_WARNINGS_SWITCH"
731 fi
732 AC_MSG_RESULT($has_option)
733 CFLAGS="$SAVE_CFLAGS"
734 unset has_option
735 unset SAVE_CFLAGS
736
737 ### Use -Wdeclaration-after-statement if the compiler supports it
738 AC_MSG_CHECKING([whether gcc understands -Wdeclaration-after-statement])
739 SAVE_CFLAGS="$CFLAGS"
740 CFLAGS="$CFLAGS -Wdeclaration-after-statement"
741 AC_TRY_COMPILE([], [], has_option=yes, has_option=no,)
742 if test $has_option = yes; then
743 C_WARNINGS_SWITCH="-Wdeclaration-after-statement $C_WARNINGS_SWITCH"
744 fi
745 AC_MSG_RESULT($has_option)
746 CFLAGS="$SAVE_CFLAGS"
747 unset has_option
748 unset SAVE_CFLAGS
749
750 #### Some other nice autoconf tests.
751
752 dnl checks for programs
753 AC_PROG_CPP
754 AC_PROG_INSTALL
755 if test "x$RANLIB" = x; then
756 AC_PROG_RANLIB
757 fi
758
759 ## Although we're running on an amd64 kernel, we're actually compiling for
760 ## the x86 architecture. The user should probably have provided an
761 ## explicit --build to `configure', but if everything else than the kernel
762 ## is running in i386 mode, we can help them out.
763 if test "$machine" = "amdx86-64"; then
764 AC_CHECK_DECL([i386])
765 if test "$ac_cv_have_decl_i386" = "yes"; then
766 canonical=`echo "$canonical" | sed -e 's/^amd64/i386/' -e 's/^x86_64/i386/'`
767 machine=intel386
768 machfile="m/${machine}.h"
769 fi
770 fi
771
772 AC_PATH_PROG(INSTALL_INFO, install-info)
773 AC_PATH_PROG(INSTALL_INFO, install-info,, /usr/sbin)
774 AC_PATH_PROG(INSTALL_INFO, install-info,:, /sbin)
775 dnl Don't use GZIP, which is used by gzip for additional parameters.
776 AC_PATH_PROG(GZIP_PROG, gzip)
777
778
779 ## Need makeinfo >= 4.6 (?) to build the manuals.
780 AC_PATH_PROG(MAKEINFO, makeinfo, no)
781 dnl By this stage, configure has already checked for egrep and set EGREP,
782 dnl or exited with an error if no egrep was found.
783 if test "$MAKEINFO" != "no" && \
784 test x"`$MAKEINFO --version 2> /dev/null | $EGREP 'texinfo[[^0-9]]*([[1-4]][[0-9]]+|[[5-9]]|4\.[[6-9]]|4\.[[1-5]][[0-9]]+)'`" = x; then
785 MAKEINFO=no
786 fi
787
788 ## Makeinfo is unusual. For a released Emacs, the manuals are
789 ## pre-built, and not deleted by the normal clean rules. makeinfo is
790 ## therefore in the category of "special tools" not normally required, which
791 ## configure does not have to check for (eg autoconf itself).
792 ## In a Bazaar checkout on the other hand, the manuals are not included.
793 ## So makeinfo is a requirement to build from Bazaar, and configure
794 ## should test for it as it does for any other build requirement.
795 ## We use the presence of $srcdir/info/emacs to distinguish a release,
796 ## with pre-built manuals, from a Bazaar checkout.
797 if test "$MAKEINFO" = "no"; then
798 if test "x${with_makeinfo}" = "xno"; then
799 MAKEINFO=off
800 elif test ! -e $srcdir/info/emacs; then
801 AC_MSG_ERROR( [You do not seem to have makeinfo >= 4.6, and your
802 source tree does not seem to have pre-built manuals in the `info' directory.
803 Either install a suitable version of makeinfo, or re-run configure
804 with the `--without-makeinfo' option to build without the manuals.] )
805 fi
806 fi
807
808 dnl Add our options to ac_link now, after it is set up.
809
810 if test x$GCC = xyes && test "x$GCC_LINK_TEST_OPTIONS" != x
811 then
812 ac_link="$ac_link $GCC_LINK_TEST_OPTIONS"
813 fi
814
815 if test x$GCC = x && test "x$NON_GCC_LINK_TEST_OPTIONS" != x
816 then
817 ac_link="$ac_link $NON_GCC_LINK_TEST_OPTIONS"
818 fi
819
820 dnl We need -znocombreloc if we're using a relatively recent GNU ld.
821 dnl If we can link with the flag, it shouldn't do any harm anyhow.
822 dnl (Don't use `-z nocombreloc' as -z takes no arg on Irix.)
823 dnl Treat GCC specially since it just gives a non-fatal `unrecognized option'
824 dnl if not built to support GNU ld.
825
826 late_LDFLAGS=$LDFLAGS
827 if test "$GCC" = yes; then
828 LDFLAGS="$LDFLAGS -Wl,-znocombreloc"
829 else
830 LDFLAGS="$LDFLAGS -znocombreloc"
831 fi
832
833 AC_MSG_CHECKING([for -znocombreloc])
834 AC_LINK_IFELSE([main(){return 0;}],
835 [AC_MSG_RESULT(yes)],
836 LDFLAGS=$late_LDFLAGS
837 [AC_MSG_RESULT(no)])
838
839 LDFLAGS="${LDFLAGS} ${PROFILING_LDFLAGS}"
840
841
842 # The value of CPP is a quoted variable reference, so we need to do this
843 # to get its actual value...
844 CPP=`eval "echo $CPP"`
845
846
847 ### First figure out CFLAGS (which we use for running the compiler here)
848 ### and REAL_CFLAGS (which we use for real compilation).
849 ### The two are the same except when using GCC where we might use
850 ### extra warning and profiling flags.
851
852 ### If the CFLAGS env var is specified, we use that value
853 ### instead of the default.
854
855 dnl Note AC_PROG_CC sets CFLAGS to -g -O2 for gcc anyway.
856 if test "x$SPECIFIED_CFLAGS" = x; then
857 CFLAGS="-g $C_OPTIMIZE_SWITCH"
858 if test x$GCC = xyes; then
859 REAL_CFLAGS="$CFLAGS $C_WARNINGS_SWITCH $PROFILING_CFLAGS"
860 else
861 REAL_CFLAGS="$CFLAGS"
862 fi
863 else
864 REAL_CFLAGS="$CFLAGS"
865 fi
866
867
868 dnl Not used by any currently supported platform.
869 dnl The function dump-emacs will not be defined and temacs will do
870 dnl (load "loadup") automatically unless told otherwise.
871 CANNOT_DUMP=no
872 case "$opsys" in
873 your-opsys-here)
874 CANNOT_DUMP=yes
875 AC_DEFINE(CANNOT_DUMP, 1, [Define if Emacs cannot be dumped on your system.])
876 ;;
877 esac
878 AC_SUBST(CANNOT_DUMP)
879
880
881 UNEXEC_OBJ=unexelf.o
882 case "$opsys" in
883 aix4-2)
884 UNEXEC_OBJ=unexaix.o
885 ;;
886 cygwin)
887 UNEXEC_OBJ=unexcw.o
888 ;;
889 darwin)
890 UNEXEC_OBJ=unexmacosx.o
891 ;;
892 hpux10-20 | hpux11)
893 UNEXEC_OBJ=unexhp9k800.o
894 ;;
895 sol2-10)
896 # Use the Solaris dldump() function, called from unexsol.c, to dump
897 # emacs, instead of the generic ELF dump code found in unexelf.c.
898 # The resulting binary has a complete symbol table, and is better
899 # for debugging and other observability tools (debuggers, pstack, etc).
900 #
901 # If you encounter a problem using dldump(), please consider sending
902 # a message to the OpenSolaris tools-linking mailing list:
903 # http://mail.opensolaris.org/mailman/listinfo/tools-linking
904 #
905 # It is likely that dldump() works with older Solaris too, but this has
906 # not been tested, so for now this change is for Solaris 10 or newer.
907 UNEXEC_OBJ=unexsol.o
908 ;;
909 esac
910
911 LD_SWITCH_SYSTEM=
912 case "$opsys" in
913 freebsd)
914 ## Let `ld' find image libs and similar things in /usr/local/lib.
915 ## The system compiler, GCC, has apparently been modified to not
916 ## look there, contrary to what a stock GCC would do.
917 LD_SWITCH_SYSTEM=-L/usr/local/lib
918 ;;
919
920 gnu-linux)
921 ## cpp test was "ifdef __mips__", but presumably this is equivalent...
922 test "$machine" = "mips" && LD_SWITCH_SYSTEM="-G 0"
923 ;;
924
925 netbsd)
926 LD_SWITCH_SYSTEM="-Wl,-rpath,/usr/pkg/lib -L/usr/pkg/lib -Wl,-rpath,/usr/local/lib -L/usr/local/lib"
927 ;;
928
929 openbsd)
930 ## Han Boetes <han@mijncomputer.nl> says this is necessary,
931 ## otherwise Emacs dumps core on elf systems.
932 LD_SWITCH_SYSTEM="-Z"
933 ;;
934 esac
935 AC_SUBST(LD_SWITCH_SYSTEM)
936
937 ac_link="$ac_link $LD_SWITCH_SYSTEM"
938
939 ## This setting of LD_SWITCH_SYSTEM references LD_SWITCH_X_SITE_AUX,
940 ## which has not been defined yet. When this was handled with cpp,
941 ## it was expanded to null when configure sourced the s/*.h file.
942 ## Thus LD_SWITCH_SYSTEM had different values in configure and the Makefiles.
943 ## FIXME it would be cleaner to put this in LD_SWITCH_SYSTEM_TEMACS
944 ## (or somesuch), but because it is supposed to go at the _front_
945 ## of LD_SWITCH_SYSTEM, we cannot do that in exactly the same way.
946 ## Compare with the gnu-linux case below, which added to the end
947 ## of LD_SWITCH_SYSTEM, and so can instead go at the front of
948 ## LD_SWITCH_SYSTEM_TEMACS.
949 case "$opsys" in
950 netbsd|openbsd)
951 ## _AUX_RPATH is like _AUX, but uses -rpath instead of -R.
952 LD_SWITCH_SYSTEM="\$(LD_SWITCH_X_SITE_AUX_RPATH) $LD_SWITCH_SYSTEM" ;;
953 esac
954
955
956 C_SWITCH_MACHINE=
957 if test "$machine" = "alpha"; then
958 AC_CHECK_DECL([__ELF__])
959 if test "$ac_cv_have_decl___ELF__" = "yes"; then
960 ## With ELF, make sure that all common symbols get allocated to in the
961 ## data section. Otherwise, the dump of temacs may miss variables in
962 ## the shared library that have been initialized. For example, with
963 ## GNU libc, __malloc_initialized would normally be resolved to the
964 ## shared library's .bss section, which is fatal.
965 if test "x$GCC" = "xyes"; then
966 C_SWITCH_MACHINE="-fno-common"
967 else
968 AC_MSG_ERROR([What gives? Fix me if DEC Unix supports ELF now.])
969 fi
970 else
971 UNEXEC_OBJ=unexalpha.o
972 fi
973 fi
974 AC_SUBST(C_SWITCH_MACHINE)
975
976 AC_SUBST(UNEXEC_OBJ)
977
978 C_SWITCH_SYSTEM=
979 ## Some programs in src produce warnings saying certain subprograms
980 ## are too complex and need a MAXMEM value greater than 2000 for
981 ## additional optimization. --nils@exp-math.uni-essen.de
982 test "$opsys" = "aix4.2" && test "x$GCC" != "xyes" && \
983 C_SWITCH_SYSTEM="-ma -qmaxmem=4000"
984 ## gnu-linux might need -D_BSD_SOURCE on old libc5 systems.
985 ## It is redundant in glibc2, since we define _GNU_SOURCE.
986 AC_SUBST(C_SWITCH_SYSTEM)
987
988
989 LIBS_SYSTEM=
990 case "$opsys" in
991 ## IBM's X11R5 uses -lIM and -liconv in AIX 3.2.2.
992 aix4-2) LIBS_SYSTEM="-lrts -lIM -liconv" ;;
993
994 freebsd) LIBS_SYSTEM="-lutil" ;;
995
996 hpux*) LIBS_SYSTEM="-l:libdld.sl" ;;
997
998 sol2*) LIBS_SYSTEM="-lsocket -lnsl -lkstat" ;;
999
1000 ## Motif needs -lgen.
1001 unixware) LIBS_SYSTEM="-lsocket -lnsl -lelf -lgen" ;;
1002 esac
1003 AC_SUBST(LIBS_SYSTEM)
1004
1005
1006 ### Make sure subsequent tests use flags consistent with the build flags.
1007
1008 if test x"${OVERRIDE_CPPFLAGS}" != x; then
1009 CPPFLAGS="${OVERRIDE_CPPFLAGS}"
1010 else
1011 CPPFLAGS="$C_SWITCH_SYSTEM $C_SWITCH_MACHINE $CPPFLAGS"
1012 fi
1013
1014 dnl For AC_FUNC_GETLOADAVG, at least:
1015 AC_CONFIG_LIBOBJ_DIR(src)
1016
1017 dnl Do this early because it can frob feature test macros for Unix-98 &c.
1018 AC_SYS_LARGEFILE
1019
1020
1021 ## If user specified a crt-dir, use that unconditionally.
1022 if test "X$CRT_DIR" = "X"; then
1023
1024 case "$canonical" in
1025 x86_64-*-linux-gnu* | s390x-*-linux-gnu*)
1026 ## On x86-64 and s390x GNU/Linux distributions, the standard library
1027 ## can be in a variety of places. We only try /usr/lib64 and /usr/lib.
1028 ## For anything else (eg /usr/lib32), it is up the user to specify
1029 ## the location (bug#5655).
1030 ## Test for crtn.o, not just the directory, because sometimes the
1031 ## directory exists but does not have the relevant files (bug#1287).
1032 ## FIXME better to test for binary compatibility somehow.
1033 test -e /usr/lib64/crtn.o && CRT_DIR=/usr/lib64
1034 ;;
1035
1036 powerpc64-*-linux-gnu* | sparc64-*-linux-gnu*) CRT_DIR=/usr/lib64 ;;
1037 esac
1038
1039 case "$opsys" in
1040 hpux10-20) CRT_DIR=/lib ;;
1041 esac
1042
1043 ## Default is /usr/lib.
1044 test "X$CRT_DIR" = "X" && CRT_DIR=/usr/lib
1045
1046 else
1047
1048 ## Some platforms don't use any of these files, so it is not
1049 ## appropriate to put this test outside the if block.
1050 test -e $CRT_DIR/crtn.o || test -e $CRT_DIR/crt0.o || \
1051 AC_MSG_ERROR([crt*.o not found in specified location.])
1052
1053 fi
1054
1055 AC_SUBST(CRT_DIR)
1056
1057 LIB_MATH=-lm
1058 LIB_STANDARD=
1059 START_FILES=
1060
1061 case $opsys in
1062 cygwin )
1063 LIB_MATH=
1064 START_FILES='ecrt0.o'
1065 ;;
1066 darwin )
1067 ## Adding -lm confuses the dynamic linker, so omit it.
1068 LIB_MATH=
1069 START_FILES='pre-crt0.o'
1070 ;;
1071 freebsd )
1072 LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o $(CRT_DIR)/crtn.o'
1073 START_FILES='pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o $(CRT_DIR)/crtbegin.o'
1074 ;;
1075 gnu-linux | gnu-kfreebsd )
1076 LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtn.o'
1077 START_FILES='pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o'
1078 ;;
1079 hpux10-20 | hpux11 )
1080 LIB_STANDARD=-lc
1081 START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o'
1082 ;;
1083 netbsd | openbsd )
1084 if test -f $CRT_DIR/crti.o; then
1085 LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o $(CRT_DIR)/crtn.o'
1086 START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o $(CRT_DIR)/crti.o $(CRT_DIR)/crtbegin.o'
1087 else
1088 LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o'
1089 START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o $(CRT_DIR)/crtbegin.o'
1090 fi
1091 ;;
1092 esac
1093
1094 AC_SUBST(LIB_MATH)
1095 AC_SUBST(START_FILES)
1096
1097 dnl This function definition taken from Gnome 2.0
1098 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
1099 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
1100 dnl also defines GSTUFF_PKG_ERRORS on error
1101 AC_DEFUN([PKG_CHECK_MODULES], [
1102 succeeded=no
1103
1104 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1105
1106 if test "$PKG_CONFIG" = "no" ; then
1107 ifelse([$4], , [AC_MSG_ERROR([
1108 *** The pkg-config script could not be found. Make sure it is in your path, or give the full path to pkg-config with the PKG_CONFIG environment variable or --with-pkg-config-prog. Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config.])], [$4])
1109 else
1110 PKG_CONFIG_MIN_VERSION=0.9.0
1111 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
1112 AC_MSG_CHECKING(for $2)
1113
1114 if $PKG_CONFIG --exists "$2" 2>&AS_MESSAGE_LOG_FD; then
1115 AC_MSG_RESULT(yes)
1116 succeeded=yes
1117
1118 AC_MSG_CHECKING($1_CFLAGS)
1119 $1_CFLAGS=`$PKG_CONFIG --cflags "$2"|sed -e 's,///*,/,g'`
1120 AC_MSG_RESULT($$1_CFLAGS)
1121
1122 AC_MSG_CHECKING($1_LIBS)
1123 $1_LIBS=`$PKG_CONFIG --libs "$2"|sed -e 's,///*,/,g'`
1124 AC_MSG_RESULT($$1_LIBS)
1125 else
1126 AC_MSG_RESULT(no)
1127 $1_CFLAGS=""
1128 $1_LIBS=""
1129 ## If we have a custom action on failure, don't print errors, but
1130 ## do set a variable so people can do so.
1131 $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
1132 ifelse([$4], ,echo $$1_PKG_ERRORS,)
1133 fi
1134
1135 AC_SUBST($1_CFLAGS)
1136 AC_SUBST($1_LIBS)
1137 else
1138 echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
1139 echo "*** See http://www.freedesktop.org/software/pkgconfig"
1140 fi
1141 fi
1142
1143 if test $succeeded = yes; then
1144 ifelse([$3], , :, [$3])
1145 else
1146 ifelse([$4], , [AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.])], [$4])
1147 fi
1148 ])
1149
1150
1151 if test "${with_sound}" != "no"; then
1152 # Sound support for GNU/Linux and the free BSDs.
1153 AC_CHECK_HEADERS(machine/soundcard.h sys/soundcard.h soundcard.h,
1154 have_sound_header=yes)
1155 # Emulation library used on NetBSD.
1156 AC_CHECK_LIB(ossaudio, _oss_ioctl, LIBSOUND=-lossaudio, LIBSOUND=)
1157 AC_SUBST(LIBSOUND)
1158
1159 ALSA_REQUIRED=1.0.0
1160 ALSA_MODULES="alsa >= $ALSA_REQUIRED"
1161 PKG_CHECK_MODULES(ALSA, $ALSA_MODULES, HAVE_ALSA=yes, HAVE_ALSA=no)
1162 if test $HAVE_ALSA = yes; then
1163 SAVE_CFLAGS="$CFLAGS"
1164 SAVE_LDFLAGS="$LDFLAGS"
1165 CFLAGS="$ALSA_CFLAGS $CFLAGS"
1166 LDFLAGS="$ALSA_LIBS $LDFLAGS"
1167 AC_TRY_COMPILE([#include <asoundlib.h>], [snd_lib_error_set_handler (0);],
1168 emacs_alsa_normal=yes,
1169 emacs_alsa_normal=no)
1170 if test "$emacs_alsa_normal" != yes; then
1171 AC_TRY_COMPILE([#include <alsa/asoundlib.h>],
1172 [snd_lib_error_set_handler (0);],
1173 emacs_alsa_subdir=yes,
1174 emacs_alsa_subdir=no)
1175 if test "$emacs_alsa_subdir" != yes; then
1176 AC_MSG_ERROR([pkg-config found alsa, but it does not compile. See config.log for error messages.])
1177 fi
1178 ALSA_CFLAGS="$ALSA_CFLAGS -DALSA_SUBDIR_INCLUDE"
1179 fi
1180
1181 CFLAGS="$SAVE_CFLAGS"
1182 LDFLAGS="$SAVE_LDFLAGS"
1183 LIBSOUND="$LIBSOUND $ALSA_LIBS"
1184 CFLAGS_SOUND="$CFLAGS_SOUND $ALSA_CFLAGS"
1185 AC_DEFINE(HAVE_ALSA, 1, [Define to 1 if ALSA is available.])
1186 fi
1187
1188 dnl Define HAVE_SOUND if we have sound support. We know it works and
1189 dnl compiles only on the specified platforms. For others, it
1190 dnl probably doesn't make sense to try.
1191 if test x$have_sound_header = xyes || test $HAVE_ALSA = yes; then
1192 case "$opsys" in
1193 dnl defined __FreeBSD__ || defined __NetBSD__ || defined __linux__
1194 gnu-linux|freebsd|netbsd)
1195 AC_DEFINE(HAVE_SOUND, 1, [Define to 1 if you have sound support.])
1196 ;;
1197 esac
1198 fi
1199
1200 AC_SUBST(CFLAGS_SOUND)
1201 fi
1202
1203 dnl checks for header files
1204 AC_CHECK_HEADERS(sys/select.h sys/timeb.h sys/time.h unistd.h utime.h \
1205 linux/version.h sys/systeminfo.h termios.h limits.h string.h stdlib.h \
1206 stdio_ext.h fcntl.h strings.h coff.h pty.h sys/mman.h \
1207 sys/param.h sys/vlimit.h sys/resource.h locale.h sys/_mbstate_t.h \
1208 sys/utsname.h pwd.h utmp.h)
1209
1210 AC_MSG_CHECKING(if personality LINUX32 can be set)
1211 AC_TRY_COMPILE([#include <sys/personality.h>], [personality (PER_LINUX32)],
1212 emacs_cv_personality_linux32=yes,
1213 emacs_cv_personality_linux32=no)
1214 AC_MSG_RESULT($emacs_cv_personality_linux32)
1215
1216 if test $emacs_cv_personality_linux32 = yes; then
1217 AC_DEFINE(HAVE_PERSONALITY_LINUX32, 1,
1218 [Define to 1 if personality LINUX32 can be set.])
1219 fi
1220
1221 dnl On Solaris 8 there's a compilation warning for term.h because
1222 dnl it doesn't define `bool'.
1223 AC_CHECK_HEADERS(term.h, , , -)
1224 AC_HEADER_STDC
1225 AC_HEADER_TIME
1226 AC_CHECK_DECLS([sys_siglist])
1227 if test $ac_cv_have_decl_sys_siglist != yes; then
1228 # For Tru64, at least:
1229 AC_CHECK_DECLS([__sys_siglist])
1230 if test $ac_cv_have_decl___sys_siglist = yes; then
1231 AC_DEFINE(sys_siglist, __sys_siglist,
1232 [Define to any substitute for sys_siglist.])
1233 fi
1234 fi
1235 AC_HEADER_SYS_WAIT
1236
1237 dnl Some systems have utime.h but don't declare the struct anyplace.
1238 AC_CACHE_CHECK(for struct utimbuf, emacs_cv_struct_utimbuf,
1239 AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME
1240 #include <sys/time.h>
1241 #include <time.h>
1242 #else
1243 #ifdef HAVE_SYS_TIME_H
1244 #include <sys/time.h>
1245 #else
1246 #include <time.h>
1247 #endif
1248 #endif
1249 #ifdef HAVE_UTIME_H
1250 #include <utime.h>
1251 #endif], [static struct utimbuf x; x.actime = x.modtime;],
1252 emacs_cv_struct_utimbuf=yes, emacs_cv_struct_utimbuf=no))
1253 if test $emacs_cv_struct_utimbuf = yes; then
1254 AC_DEFINE(HAVE_STRUCT_UTIMBUF, 1, [Define to 1 if `struct utimbuf' is declared by <utime.h>.])
1255 fi
1256
1257 dnl checks for typedefs
1258 AC_TYPE_SIGNAL
1259
1260 dnl Check for speed_t typedef.
1261 AC_CACHE_CHECK(for speed_t, emacs_cv_speed_t,
1262 [AC_TRY_COMPILE([#include <termios.h>], [speed_t x = 1;],
1263 emacs_cv_speed_t=yes, emacs_cv_speed_t=no)])
1264 if test $emacs_cv_speed_t = yes; then
1265 AC_DEFINE(HAVE_SPEED_T, 1,
1266 [Define to 1 if `speed_t' is declared by <termios.h>.])
1267 fi
1268
1269 AC_CACHE_CHECK(for struct timeval, emacs_cv_struct_timeval,
1270 AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME
1271 #include <sys/time.h>
1272 #include <time.h>
1273 #else
1274 #ifdef HAVE_SYS_TIME_H
1275 #include <sys/time.h>
1276 #else
1277 #include <time.h>
1278 #endif
1279 #endif], [static struct timeval x; x.tv_sec = x.tv_usec;],
1280 emacs_cv_struct_timeval=yes, emacs_cv_struct_timeval=no))
1281 HAVE_TIMEVAL=$emacs_cv_struct_timeval
1282 if test $emacs_cv_struct_timeval = yes; then
1283 AC_DEFINE(HAVE_TIMEVAL, 1, [Define to 1 if `struct timeval' is declared by <sys/time.h>.])
1284 fi
1285
1286 AC_CACHE_CHECK(for struct exception, emacs_cv_struct_exception,
1287 AC_TRY_COMPILE([#include <math.h>],
1288 [static struct exception x; x.arg1 = x.arg2 = x.retval; x.name = ""; x.type = 1;],
1289 emacs_cv_struct_exception=yes, emacs_cv_struct_exception=no))
1290 HAVE_EXCEPTION=$emacs_cv_struct_exception
1291 if test $emacs_cv_struct_exception != yes; then
1292 AC_DEFINE(NO_MATHERR, 1, [Define to 1 if you don't have struct exception in math.h.])
1293 fi
1294
1295 AC_CHECK_HEADERS(sys/socket.h)
1296 AC_CHECK_HEADERS(net/if.h, , , [AC_INCLUDES_DEFAULT
1297 #if HAVE_SYS_SOCKET_H
1298 #include <sys/socket.h>
1299 #endif])
1300
1301 dnl checks for structure members
1302 AC_STRUCT_TM
1303 AC_STRUCT_TIMEZONE
1304 AC_CHECK_MEMBER(struct tm.tm_gmtoff,
1305 [AC_DEFINE(HAVE_TM_GMTOFF, 1,
1306 [Define to 1 if `tm_gmtoff' is member of `struct tm'.])],,
1307 [#include <time.h>])
1308 AC_CHECK_MEMBERS([struct ifreq.ifr_flags, struct ifreq.ifr_hwaddr,
1309 struct ifreq.ifr_netmask, struct ifreq.ifr_broadaddr,
1310 struct ifreq.ifr_addr], , ,
1311 [AC_INCLUDES_DEFAULT
1312 #if HAVE_SYS_SOCKET_H
1313 #include <sys/socket.h>
1314 #endif
1315 #if HAVE_NET_IF_H
1316 #include <net/if.h>
1317 #endif])
1318
1319 dnl checks for compiler characteristics
1320
1321 dnl Testing __STDC__ to determine prototype support isn't good enough.
1322 dnl DEC C, for instance, doesn't define it with default options, and
1323 dnl is used on 64-bit systems (OSF Alphas). Similarly for volatile
1324 dnl and void *.
1325 AC_C_PROTOTYPES
1326 AC_C_VOLATILE
1327 AC_C_CONST
1328 dnl This isn't useful because we can't turn on use of `inline' unless
1329 dnl the compiler groks `extern inline'.
1330 dnl AC_C_INLINE
1331 AC_CACHE_CHECK([for void * support], emacs_cv_void_star,
1332 [AC_TRY_COMPILE(, [void * foo;],
1333 emacs_cv_void_star=yes, emacs_cv_void_star=no)])
1334 if test $emacs_cv_void_star = yes; then
1335 AC_DEFINE(POINTER_TYPE, void)
1336 else
1337 AC_DEFINE(POINTER_TYPE, char)
1338 fi
1339 AH_TEMPLATE(POINTER_TYPE,
1340 [Define as `void' if your compiler accepts `void *'; otherwise
1341 define as `char'.])dnl
1342
1343
1344
1345 dnl This could be used for targets which can have both byte sexes.
1346 dnl We could presumably replace the hardwired WORDS_BIG_ENDIAN generally.
1347 dnl AC_C_BIGENDIAN
1348
1349 dnl check for Make feature
1350 AC_PROG_MAKE_SET
1351
1352 DEPFLAGS=
1353 MKDEPDIR=":"
1354 deps_frag=deps.mk
1355 dnl check for GNU Make if we have GCC and autodepend is on.
1356 if test "$GCC" = yes && test "$ac_enable_autodepend" = yes; then
1357 AC_MSG_CHECKING([whether we are using GNU Make])
1358 HAVE_GNU_MAKE=no
1359 testval=`make --version 2>/dev/null | grep 'GNU Make'`
1360 if test "x$testval" != x; then
1361 HAVE_GNU_MAKE=yes
1362 else
1363 ac_enable_autodepend=no
1364 fi
1365 AC_MSG_RESULT([$HAVE_GNU_MAKE])
1366 if test $HAVE_GNU_MAKE = yes; then
1367 AC_MSG_CHECKING([whether gcc understands -MMD -MF])
1368 SAVE_CFLAGS="$CFLAGS"
1369 CFLAGS="$CFLAGS -MMD -MF deps.d"
1370 AC_TRY_COMPILE([], [], , ac_enable_autodepend=no)
1371 CFLAGS="$SAVE_CFLAGS"
1372 test -f deps.d || ac_enable_autodepend=no
1373 rm -rf deps.d
1374 AC_MSG_RESULT([$ac_enable_autodepend])
1375 fi
1376 if test $ac_enable_autodepend = yes; then
1377 DEPFLAGS='-MMD -MF ${DEPDIR}/$*.d'
1378 ## In parallel builds, another make might create depdir between
1379 ## the first test and mkdir, so stick another test on the end.
1380 ## Or use mkinstalldirs? mkdir -p is not portable.
1381 MKDEPDIR='test -d ${DEPDIR} || mkdir ${DEPDIR} || test -d ${DEPDIR}'
1382 deps_frag=autodeps.mk
1383 fi
1384 fi
1385 deps_frag=$srcdir/src/$deps_frag
1386 AC_SUBST(MKDEPDIR)
1387 AC_SUBST(DEPFLAGS)
1388 AC_SUBST_FILE(deps_frag)
1389
1390
1391 dnl checks for operating system services
1392 AC_SYS_LONG_FILE_NAMES
1393
1394 #### Choose a window system.
1395
1396 AC_PATH_X
1397 if test "$no_x" = yes; then
1398 window_system=none
1399 else
1400 window_system=x11
1401 fi
1402
1403 ## Workaround for bug in autoconf <= 2.62.
1404 ## http://lists.gnu.org/archive/html/emacs-devel/2008-04/msg01551.html
1405 ## No need to do anything special for these standard directories.
1406 if test -n "${x_libraries}" && test x"${x_libraries}" != xNONE; then
1407
1408 x_libraries=`echo :${x_libraries}: | sed -e 's|:/usr/lib64:|:|g' -e 's|:/lib64:|:|g' -e 's|^:||' -e 's|:$||'`
1409
1410 fi
1411
1412 LD_SWITCH_X_SITE_AUX=
1413 LD_SWITCH_X_SITE_AUX_RPATH=
1414 if test "${x_libraries}" != NONE; then
1415 if test -n "${x_libraries}"; then
1416 LD_SWITCH_X_SITE=-L`echo ${x_libraries} | sed -e "s/:/ -L/g"`
1417 LD_SWITCH_X_SITE_AUX=-R`echo ${x_libraries} | sed -e "s/:/ -R/g"`
1418 LD_SWITCH_X_SITE_AUX_RPATH=`echo ${LD_SWITCH_X_SITE_AUX} | sed -e 's/-R/-Wl,-rpath,/'`
1419 fi
1420 x_default_search_path=""
1421 x_search_path=${x_libraries}
1422 if test -z "${x_search_path}"; then
1423 x_search_path=/usr/lib
1424 fi
1425 for x_library in `echo ${x_search_path}: | \
1426 sed -e "s/:/ /g" -e p -e "s:/lib[[^ /]]* :/share :g"`; do
1427 x_search_path="\
1428 ${x_library}/X11/%L/%T/%N%C%S:\
1429 ${x_library}/X11/%l/%T/%N%C%S:\
1430 ${x_library}/X11/%T/%N%C%S:\
1431 ${x_library}/X11/%L/%T/%N%S:\
1432 ${x_library}/X11/%l/%T/%N%S:\
1433 ${x_library}/X11/%T/%N%S"
1434 if test x"${x_default_search_path}" = x; then
1435 x_default_search_path=${x_search_path}
1436 else
1437 x_default_search_path="${x_search_path}:${x_default_search_path}"
1438 fi
1439 done
1440 fi
1441 AC_SUBST(LD_SWITCH_X_SITE_AUX)
1442 AC_SUBST(LD_SWITCH_X_SITE_AUX_RPATH)
1443
1444 if test "${x_includes}" != NONE && test -n "${x_includes}"; then
1445 C_SWITCH_X_SITE=-I`echo ${x_includes} | sed -e "s/:/ -I/g"`
1446 fi
1447
1448 if test x"${x_includes}" = x; then
1449 bitmapdir=/usr/include/X11/bitmaps
1450 else
1451 # accumulate include directories that have X11 bitmap subdirectories
1452 bmd_acc="dummyval"
1453 for bmd in `echo ${x_includes} | sed -e "s/:/ /g"`; do
1454 if test -d "${bmd}/X11/bitmaps"; then
1455 bmd_acc="${bmd_acc}:${bmd}/X11/bitmaps"
1456 fi
1457 if test -d "${bmd}/bitmaps"; then
1458 bmd_acc="${bmd_acc}:${bmd}/bitmaps"
1459 fi
1460 done
1461 if test ${bmd_acc} != "dummyval"; then
1462 bitmapdir=`echo ${bmd_acc} | sed -e "s/^dummyval://"`
1463 fi
1464 fi
1465
1466 HAVE_NS=no
1467 NS_IMPL_COCOA=no
1468 NS_IMPL_GNUSTEP=no
1469 tmp_CPPFLAGS="$CPPFLAGS"
1470 tmp_CFLAGS="$CFLAGS"
1471 CPPFLAGS="$CPPFLAGS -x objective-c"
1472 CFLAGS="$CFLAGS -x objective-c"
1473 TEMACS_LDFLAGS2="\${LDFLAGS}"
1474 dnl I don't think it's especially important, but src/Makefile.in
1475 dnl (now the only user of ns_appdir) used to go to the trouble of adding a
1476 dnl trailing "/" to it, so now we do it here.
1477 if test "${with_ns}" != no; then
1478 if test "${opsys}" = darwin; then
1479 NS_IMPL_COCOA=yes
1480 ns_appdir=`pwd`/nextstep/Emacs.app/
1481 ns_appbindir=${ns_appdir}Contents/MacOS/
1482 ns_appresdir=${ns_appdir}Contents/Resources
1483 ns_appsrc=${srcdir}/nextstep/Cocoa/Emacs.base
1484 elif test -f $GNUSTEP_CONFIG_FILE; then
1485 NS_IMPL_GNUSTEP=yes
1486 ns_appdir=`pwd`/nextstep/Emacs.app/
1487 ns_appbindir=${ns_appdir}
1488 ns_appresdir=${ns_appdir}Resources
1489 ns_appsrc=${srcdir}/nextstep/GNUstep/Emacs.base
1490 dnl FIXME sourcing this several times in subshells seems inefficient.
1491 GNUSTEP_SYSTEM_HEADERS="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_SYSTEM_HEADERS)"
1492 GNUSTEP_SYSTEM_LIBRARIES="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_SYSTEM_LIBRARIES)"
1493 dnl I seemed to need these as well with GNUstep-startup 0.25.
1494 GNUSTEP_LOCAL_HEADERS="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_LOCAL_HEADERS)"
1495 GNUSTEP_LOCAL_LIBRARIES="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_LOCAL_LIBRARIES)"
1496 test "x${GNUSTEP_LOCAL_HEADERS}" != "x" && \
1497 GNUSTEP_LOCAL_HEADERS="-I${GNUSTEP_LOCAL_HEADERS}"
1498 test "x${GNUSTEP_LOCAL_LIBRARIES}" != "x" && \
1499 GNUSTEP_LOCAL_LIBRARIES="-L${GNUSTEP_LOCAL_LIBRARIES}"
1500 CPPFLAGS="$CPPFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
1501 CFLAGS="$CFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
1502 REAL_CFLAGS="$REAL_CFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
1503 LDFLAGS="$LDFLAGS -L${GNUSTEP_SYSTEM_LIBRARIES} ${GNUSTEP_LOCAL_LIBRARIES}"
1504 LIB_STANDARD=
1505 START_FILES=
1506 TEMACS_LDFLAGS2=
1507 fi
1508 AC_CHECK_HEADER([AppKit/AppKit.h], [HAVE_NS=yes],
1509 [AC_MSG_ERROR([`--with-ns' was specified, but the include
1510 files are missing or cannot be compiled.])])
1511 NS_HAVE_NSINTEGER=yes
1512 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <Foundation/NSObjCRuntime.h>],
1513 [NSInteger i;])],
1514 ns_have_nsinteger=yes,
1515 ns_have_nsinteger=no)
1516 if test $ns_have_nsinteger = no; then
1517 NS_HAVE_NSINTEGER=no
1518 fi
1519 fi
1520 AC_SUBST(TEMACS_LDFLAGS2)
1521
1522 ns_frag=/dev/null
1523 NS_OBJ=
1524 NS_SUPPORT=
1525 if test "${HAVE_NS}" = yes; then
1526 window_system=nextstep
1527 with_xft=no
1528 # set up packaging dirs
1529 exec_prefix=${ns_appbindir}
1530 libexecdir=${ns_appbindir}/libexec
1531 if test "${EN_NS_SELF_CONTAINED}" = yes; then
1532 prefix=${ns_appresdir}
1533 fi
1534 ns_frag=$srcdir/src/ns.mk
1535 NS_OBJ="nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o fontset.o fringe.o image.o"
1536 NS_SUPPORT="\${lispsource}emacs-lisp/easymenu.elc \${lispsource}term/ns-win.elc"
1537 fi
1538 CFLAGS="$tmp_CFLAGS"
1539 CPPFLAGS="$tmp_CPPFLAGS"
1540 AC_SUBST(NS_OBJ)
1541 AC_SUBST(NS_SUPPORT)
1542 AC_SUBST(LIB_STANDARD)
1543 AC_SUBST_FILE(ns_frag)
1544
1545 case "${window_system}" in
1546 x11 )
1547 HAVE_X_WINDOWS=yes
1548 HAVE_X11=yes
1549 case "${with_x_toolkit}" in
1550 athena | lucid ) USE_X_TOOLKIT=LUCID ;;
1551 motif ) USE_X_TOOLKIT=MOTIF ;;
1552 gtk ) with_gtk=yes
1553 dnl Dont set this for GTK. A lot of tests below assumes Xt when
1554 dnl USE_X_TOOLKIT is set.
1555 USE_X_TOOLKIT=none ;;
1556 gtk3 ) with_gtk3=yes
1557 USE_X_TOOLKIT=none ;;
1558 no ) USE_X_TOOLKIT=none ;;
1559 dnl If user did not say whether to use a toolkit, make this decision later:
1560 dnl use the toolkit if we have gtk, or X11R5 or newer.
1561 * ) USE_X_TOOLKIT=maybe ;;
1562 esac
1563 ;;
1564 nextstep | none )
1565 HAVE_X_WINDOWS=no
1566 HAVE_X11=no
1567 USE_X_TOOLKIT=none
1568 ;;
1569 esac
1570
1571 if test "$window_system" = none && test "X$with_x" != "Xno"; then
1572 AC_CHECK_PROG(HAVE_XSERVER, X, true, false)
1573 if test "$HAVE_XSERVER" = true ||
1574 test -n "$DISPLAY" ||
1575 test "`echo /usr/lib/libX11.*`" != "/usr/lib/libX11.*"; then
1576 AC_MSG_ERROR([You seem to be running X, but no X development libraries
1577 were found. You should install the relevant development files for X
1578 and for the toolkit you want, such as Gtk+, Lesstif or Motif. Also make
1579 sure you have development files for image handling, i.e.
1580 tiff, gif, jpeg, png and xpm.
1581 If you are sure you want Emacs compiled without X window support, pass
1582 --without-x
1583 to configure.])
1584 fi
1585 fi
1586
1587 ### If we're using X11, we should use the X menu package.
1588 HAVE_MENUS=no
1589 case ${HAVE_X11} in
1590 yes ) HAVE_MENUS=yes ;;
1591 esac
1592
1593 # Do the opsystem or machine files prohibit the use of the GNU malloc?
1594 # Assume not, until told otherwise.
1595 GNU_MALLOC=yes
1596 doug_lea_malloc=yes
1597 AC_CHECK_FUNC(malloc_get_state, ,doug_lea_malloc=no)
1598 AC_CHECK_FUNC(malloc_set_state, ,doug_lea_malloc=no)
1599 AC_CACHE_CHECK(whether __after_morecore_hook exists,
1600 emacs_cv_var___after_morecore_hook,
1601 [AC_TRY_LINK([extern void (* __after_morecore_hook)();],[__after_morecore_hook = 0],
1602 emacs_cv_var___after_morecore_hook=yes,
1603 emacs_cv_var___after_morecore_hook=no)])
1604 if test $emacs_cv_var___after_morecore_hook = no; then
1605 doug_lea_malloc=no
1606 fi
1607
1608
1609 dnl See comments in aix4-2.h about maybe using system malloc there.
1610 system_malloc=no
1611 case "$opsys" in
1612 ## darwin ld insists on the use of malloc routines in the System framework.
1613 darwin|sol2-10) system_malloc=yes ;;
1614 esac
1615
1616 if test "${system_malloc}" = "yes"; then
1617 AC_DEFINE(SYSTEM_MALLOC, 1, [Define to use system malloc.])
1618 GNU_MALLOC=no
1619 GNU_MALLOC_reason="
1620 (The GNU allocators don't work with this system configuration.)"
1621 GMALLOC_OBJ=
1622 VMLIMIT_OBJ=
1623 else
1624 test "$doug_lea_malloc" != "yes" && GMALLOC_OBJ=gmalloc.o
1625 VMLIMIT_OBJ=vm-limit.o
1626 fi
1627 AC_SUBST(GMALLOC_OBJ)
1628 AC_SUBST(VMLIMIT_OBJ)
1629
1630 if test "$doug_lea_malloc" = "yes" ; then
1631 if test "$GNU_MALLOC" = yes ; then
1632 GNU_MALLOC_reason="
1633 (Using Doug Lea's new malloc from the GNU C Library.)"
1634 fi
1635 AC_DEFINE(DOUG_LEA_MALLOC, 1,
1636 [Define to 1 if you are using the GNU C Library.])
1637
1638 ## Use mmap directly for allocating larger buffers.
1639 ## FIXME this comes from src/s/{gnu,gnu-linux}.h:
1640 ## #ifdef DOUG_LEA_MALLOC; #undef REL_ALLOC; #endif
1641 ## Does the AC_FUNC_MMAP test below make this check unecessary?
1642 case "$opsys" in
1643 gnu*) REL_ALLOC=no ;;
1644 esac
1645 fi
1646
1647 if test x"${REL_ALLOC}" = x; then
1648 REL_ALLOC=${GNU_MALLOC}
1649 fi
1650
1651 use_mmap_for_buffers=no
1652 case "$opsys" in
1653 freebsd|irix6-5) use_mmap_for_buffers=yes ;;
1654 esac
1655
1656 AC_FUNC_MMAP
1657 if test $use_mmap_for_buffers = yes; then
1658 AC_DEFINE(USE_MMAP_FOR_BUFFERS, 1, [Define to use mmap to allocate buffer text.])
1659 REL_ALLOC=no
1660 fi
1661
1662 LIBS="$LIBS_SYSTEM $LIBS"
1663
1664 dnl If found, this defines HAVE_LIBDNET, which m/pmax.h checks,
1665 dnl and also adds -ldnet to LIBS, which Autoconf uses for checks.
1666 AC_CHECK_LIB(dnet, dnet_ntoa)
1667 dnl This causes -lresolv to get used in subsequent tests,
1668 dnl which causes failures on some systems such as HPUX 9.
1669 dnl AC_CHECK_LIB(resolv, gethostbyname)
1670
1671 dnl FIXME replace main with a function we actually want from this library.
1672 AC_CHECK_LIB(Xbsd, main, LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -lXbsd")
1673
1674 AC_CHECK_LIB(pthreads, cma_open)
1675
1676 ## Note: when using cpp in s/aix4.2.h, this definition depended on
1677 ## HAVE_LIBPTHREADS. That was not defined earlier in configure when
1678 ## the system file was sourced. Hence the value of LIBS_SYSTEM
1679 ## added to LIBS in configure would never contain the pthreads part,
1680 ## but the value used in Makefiles might. FIXME?
1681 ##
1682 ## -lpthreads seems to be necessary for Xlib in X11R6, and should
1683 ## be harmless on older versions of X where it happens to exist.
1684 test "$opsys" = "aix4-2" && \
1685 test $ac_cv_lib_pthreads_cma_open = yes && \
1686 LIBS_SYSTEM="$LIBS_SYSTEM -lpthreads"
1687
1688 dnl Check for need for bigtoc support on IBM AIX
1689
1690 case ${host_os} in
1691 aix*)
1692 AC_CACHE_CHECK([for -bbigtoc option], [gdb_cv_bigtoc], [
1693 case $GCC in
1694 yes) gdb_cv_bigtoc=-Wl,-bbigtoc ;;
1695 *) gdb_cv_bigtoc=-bbigtoc ;;
1696 esac
1697
1698 LDFLAGS=$LDFLAGS\ $gdb_cv_bigtoc
1699 AC_TRY_LINK([], [int i;], [], [gdb_cv_bigtoc=])
1700 ])
1701 ;;
1702 esac
1703
1704 # Change CFLAGS and CPPFLAGS temporarily so that C_SWITCH_X_SITE gets
1705 # used for the tests that follow. We set them back to REAL_CFLAGS and
1706 # REAL_CPPFLAGS later on.
1707
1708 REAL_CPPFLAGS="$CPPFLAGS"
1709
1710 if test "${HAVE_X11}" = "yes"; then
1711 DEFS="$C_SWITCH_X_SITE $DEFS"
1712 LDFLAGS="$LDFLAGS $LD_SWITCH_X_SITE"
1713 LIBS="-lX11 $LIBS"
1714 CFLAGS="$C_SWITCH_X_SITE $CFLAGS"
1715 CPPFLAGS="$C_SWITCH_X_SITE $CPPFLAGS"
1716
1717 # On Solaris, arrange for LD_RUN_PATH to point to the X libraries for tests.
1718 # This is handled by LD_SWITCH_X_SITE_AUX during the real build,
1719 # but it's more convenient here to set LD_RUN_PATH
1720 # since this also works on hosts that don't understand LD_SWITCH_X_SITE_AUX.
1721 if test "${x_libraries}" != NONE && test -n "${x_libraries}"; then
1722 LD_RUN_PATH=$x_libraries${LD_RUN_PATH+:}$LD_RUN_PATH
1723 export LD_RUN_PATH
1724 fi
1725
1726 if test "${opsys}" = "gnu-linux"; then
1727 AC_MSG_CHECKING(whether X on GNU/Linux needs -b to link)
1728 AC_TRY_LINK([],
1729 [XOpenDisplay ("foo");],
1730 [xlinux_first_failure=no],
1731 [xlinux_first_failure=yes])
1732 if test "${xlinux_first_failure}" = "yes"; then
1733 OLD_LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE"
1734 OLD_C_SWITCH_X_SITE="$C_SWITCH_X_SITE"
1735 OLD_CPPFLAGS="$CPPFLAGS"
1736 OLD_LIBS="$LIBS"
1737 LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -b i486-linuxaout"
1738 C_SWITCH_X_SITE="$C_SWITCH_X_SITE -b i486-linuxaout"
1739 CPPFLAGS="$CPPFLAGS -b i486-linuxaout"
1740 LIBS="$LIBS -b i486-linuxaout"
1741 AC_TRY_LINK([],
1742 [XOpenDisplay ("foo");],
1743 [xlinux_second_failure=no],
1744 [xlinux_second_failure=yes])
1745 if test "${xlinux_second_failure}" = "yes"; then
1746 # If we get the same failure with -b, there is no use adding -b.
1747 # So take it out. This plays safe.
1748 LD_SWITCH_X_SITE="$OLD_LD_SWITCH_X_SITE"
1749 C_SWITCH_X_SITE="$OLD_C_SWITCH_X_SITE"
1750 CPPFLAGS="$OLD_CPPFLAGS"
1751 LIBS="$OLD_LIBS"
1752 AC_MSG_RESULT(no)
1753 else
1754 AC_MSG_RESULT(yes)
1755 fi
1756 else
1757 AC_MSG_RESULT(no)
1758 fi
1759 fi
1760
1761 # Reportedly, some broken Solaris systems have XKBlib.h but are missing
1762 # header files included from there.
1763 AC_MSG_CHECKING(for Xkb)
1764 AC_TRY_LINK([#include <X11/Xlib.h>
1765 #include <X11/XKBlib.h>],
1766 [XkbDescPtr kb = XkbGetKeyboard (0, XkbAllComponentsMask, XkbUseCoreKbd);],
1767 emacs_xkb=yes, emacs_xkb=no)
1768 AC_MSG_RESULT($emacs_xkb)
1769 if test $emacs_xkb = yes; then
1770 AC_DEFINE(HAVE_XKBGETKEYBOARD, 1, [Define to 1 if you have the XkbGetKeyboard function.])
1771 fi
1772
1773 AC_CHECK_FUNCS(XrmSetDatabase XScreenResourceString \
1774 XScreenNumberOfScreen XSetWMProtocols)
1775 fi
1776
1777 if test "${window_system}" = "x11"; then
1778 AC_MSG_CHECKING(X11 version 6)
1779 AC_CACHE_VAL(emacs_cv_x11_version_6,
1780 [AC_TRY_LINK([#include <X11/Xlib.h>],
1781 [#if XlibSpecificationRelease < 6
1782 fail;
1783 #endif
1784 ], emacs_cv_x11_version_6=yes, emacs_cv_x11_version_6=no)])
1785 if test $emacs_cv_x11_version_6 = yes; then
1786 AC_MSG_RESULT(6 or newer)
1787 AC_DEFINE(HAVE_X11R6, 1,
1788 [Define to 1 if you have the X11R6 or newer version of Xlib.])
1789 AC_DEFINE(HAVE_X_I18N, 1, [Define if you have usable i18n support.])
1790 ## inoue@ainet.or.jp says Solaris has a bug related to X11R6-style
1791 ## XIM support.
1792 case "$opsys" in
1793 sol2-*) : ;;
1794 *) AC_DEFINE(HAVE_X11R6_XIM, 1,
1795 [Define if you have usable X11R6-style XIM support.])
1796 ;;
1797 esac
1798 else
1799 AC_MSG_RESULT(before 6)
1800 fi
1801 fi
1802
1803
1804 ### Use -lrsvg-2 if available, unless `--with-rsvg=no' is specified.
1805 HAVE_RSVG=no
1806 if test "${HAVE_X11}" = "yes" || test "${NS_IMPL_GNUSTEP}" = "yes"; then
1807 if test "${with_rsvg}" != "no"; then
1808 RSVG_REQUIRED=2.11.0
1809 RSVG_MODULE="librsvg-2.0 >= $RSVG_REQUIRED"
1810
1811 PKG_CHECK_MODULES(RSVG, $RSVG_MODULE, :, :)
1812 AC_SUBST(RSVG_CFLAGS)
1813 AC_SUBST(RSVG_LIBS)
1814
1815 if test ".${RSVG_CFLAGS}" != "."; then
1816 HAVE_RSVG=yes
1817 AC_DEFINE(HAVE_RSVG, 1, [Define to 1 if using librsvg.])
1818 CFLAGS="$CFLAGS $RSVG_CFLAGS"
1819 LIBS="$RSVG_LIBS $LIBS"
1820 fi
1821 fi
1822 fi
1823
1824
1825 HAVE_GTK=no
1826 if test "${with_gtk3}" = "yes"; then
1827 GLIB_REQUIRED=2.6
1828 GTK_REQUIRED=2.90
1829 GTK_MODULES="gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
1830
1831 dnl Checks for libraries.
1832 PKG_CHECK_MODULES(GTK, $GTK_MODULES, pkg_check_gtk=yes, pkg_check_gtk=no)
1833 if test "$pkg_check_gtk" = "no" && test "$USE_X_TOOLKIT" != "maybe"; then
1834 AC_MSG_ERROR($GTK_PKG_ERRORS)
1835 fi
1836 fi
1837
1838 if test "$pkg_check_gtk" != "yes"; then
1839 HAVE_GTK=no
1840 if test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then
1841 GLIB_REQUIRED=2.6
1842 GTK_REQUIRED=2.6
1843 GTK_MODULES="gtk+-2.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
1844
1845 dnl Checks for libraries.
1846 PKG_CHECK_MODULES(GTK, $GTK_MODULES, pkg_check_gtk=yes, pkg_check_gtk=no)
1847 if test "$pkg_check_gtk" = "no" && test "$USE_X_TOOLKIT" != "maybe"; then
1848 AC_MSG_ERROR($GTK_PKG_ERRORS)
1849 fi
1850 fi
1851 fi
1852
1853 GTK_OBJ=
1854 if test x"$pkg_check_gtk" = xyes; then
1855
1856 AC_SUBST(GTK_CFLAGS)
1857 AC_SUBST(GTK_LIBS)
1858 C_SWITCH_X_SITE="$C_SWITCH_X_SITE $GTK_CFLAGS"
1859 CFLAGS="$CFLAGS $GTK_CFLAGS"
1860 LIBS="$GTK_LIBS $LIBS"
1861 dnl Try to compile a simple GTK program.
1862 GTK_COMPILES=no
1863 AC_CHECK_FUNCS(gtk_main, GTK_COMPILES=yes)
1864 if test "${GTK_COMPILES}" != "yes"; then
1865 if test "$USE_X_TOOLKIT" != "maybe"; then
1866 AC_MSG_ERROR([Gtk+ wanted, but it does not compile, see config.log. Maybe some x11-devel files missing?]);
1867 fi
1868 else
1869 HAVE_GTK=yes
1870 AC_DEFINE(USE_GTK, 1, [Define to 1 if using GTK.])
1871 GTK_OBJ=gtkutil.o
1872 USE_X_TOOLKIT=none
1873 if $PKG_CONFIG --atleast-version=2.10 gtk+-2.0; then
1874 :
1875 else
1876 AC_MSG_WARN([[Your version of Gtk+ will have problems with
1877 closing open displays. This is no problem if you just use
1878 one display, but if you use more than one and close one of them
1879 Emacs may crash.]])
1880 sleep 3
1881 fi
1882 fi
1883
1884 fi
1885 AC_SUBST(GTK_OBJ)
1886
1887
1888 if test "${HAVE_GTK}" = "yes"; then
1889
1890 dnl GTK scrollbars resemble toolkit scrollbars a lot, so to avoid
1891 dnl a lot if #ifdef:s, say we have toolkit scrollbars.
1892 if test "$with_toolkit_scroll_bars" != no; then
1893 with_toolkit_scroll_bars=yes
1894 fi
1895
1896 dnl Check if we have the old file selection dialog declared and
1897 dnl in the link library. In 2.x it may be in the library,
1898 dnl but not declared if deprecated featured has been selected out.
1899 dnl AC_CHECK_DECL checks for a macro, so check for GTK_TYPE_FILE_SELECTION.
1900 HAVE_GTK_FILE_SELECTION=no
1901 AC_CHECK_DECL(GTK_TYPE_FILE_SELECTION, HAVE_GTK_FILE_SELECTION=yes,
1902 HAVE_GTK_FILE_SELECTION=no, [AC_INCLUDES_DEFAULT
1903 #include <gtk/gtk.h>])
1904 if test "$HAVE_GTK_FILE_SELECTION" = yes; then
1905 AC_CHECK_FUNCS(gtk_file_selection_new)
1906 fi
1907
1908 dnl Check if pthreads are available. Emacs only needs this when using
1909 dnl gtk_file_chooser under Gnome.
1910 HAVE_GTK_AND_PTHREAD=no
1911 AC_CHECK_HEADERS(pthread.h)
1912 if test "$ac_cv_header_pthread_h"; then
1913 AC_CHECK_LIB(pthread, pthread_self, HAVE_GTK_AND_PTHREAD=yes)
1914 fi
1915 if test "$HAVE_GTK_AND_PTHREAD" = yes; then
1916 case "${canonical}" in
1917 *-hpux*) ;;
1918 *) GTK_LIBS="$GTK_LIBS -lpthread" ;;
1919 esac
1920 AC_DEFINE(HAVE_GTK_AND_PTHREAD, 1,
1921 [Define to 1 if you have GTK and pthread (-lpthread).])
1922 fi
1923
1924 dnl Check for functions introduced in 2.14 and later.
1925 AC_CHECK_FUNCS(gtk_widget_get_window gtk_widget_set_has_window \
1926 gtk_dialog_get_action_area gtk_widget_get_sensitive \
1927 gtk_widget_get_mapped gtk_adjustment_get_page_size \
1928 gtk_orientable_set_orientation)
1929
1930 fi
1931
1932 dnl D-Bus has been tested under GNU/Linux only. Must be adapted for
1933 dnl other platforms. Support for higher D-Bus versions than 1.0 is
1934 dnl also not configured.
1935 HAVE_DBUS=no
1936 DBUS_OBJ=
1937 if test "${with_dbus}" = "yes"; then
1938 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0, HAVE_DBUS=yes, HAVE_DBUS=no)
1939 if test "$HAVE_DBUS" = yes; then
1940 LIBS="$LIBS $DBUS_LIBS"
1941 AC_DEFINE(HAVE_DBUS, 1, [Define to 1 if using D-Bus.])
1942 AC_CHECK_FUNCS([dbus_watch_get_unix_fd])
1943 DBUS_OBJ=dbusbind.o
1944 fi
1945 fi
1946 AC_SUBST(DBUS_OBJ)
1947
1948 dnl GConf has been tested under GNU/Linux only.
1949 dnl The version is really arbitrary, it is about the same age as Gtk+ 2.6.
1950 HAVE_GCONF=no
1951 if test "${HAVE_X11}" = "yes" && test "${with_gconf}" = "yes"; then
1952 PKG_CHECK_MODULES(GCONF, gconf-2.0 >= 2.13, HAVE_GCONF=yes, HAVE_GCONF=no)
1953 if test "$HAVE_GCONF" = yes; then
1954 AC_DEFINE(HAVE_GCONF, 1, [Define to 1 if using GConf.])
1955 fi
1956 fi
1957
1958 dnl SELinux is available for GNU/Linux only.
1959 HAVE_LIBSELINUX=no
1960 LIBSELINUX_LIBS=
1961 if test "${with_selinux}" = "yes"; then
1962 AC_CHECK_LIB([selinux], [lgetfilecon], HAVE_LIBSELINUX=yes, HAVE_LIBSELINUX=no)
1963 if test "$HAVE_LIBSELINUX" = yes; then
1964 AC_DEFINE(HAVE_LIBSELINUX, 1, [Define to 1 if using SELinux.])
1965 LIBSELINUX_LIBS=-lselinux
1966 fi
1967 fi
1968 AC_SUBST(LIBSELINUX_LIBS)
1969
1970 dnl Do not put whitespace before the #include statements below.
1971 dnl Older compilers (eg sunos4 cc) choke on it.
1972 HAVE_XAW3D=no
1973 LUCID_LIBW=
1974 if test x"${USE_X_TOOLKIT}" = xmaybe || test x"${USE_X_TOOLKIT}" = xLUCID; then
1975 if test "$with_xaw3d" != no; then
1976 AC_MSG_CHECKING(for xaw3d)
1977 AC_CACHE_VAL(emacs_cv_xaw3d,
1978 [AC_TRY_LINK([
1979 #include <X11/Intrinsic.h>
1980 #include <X11/Xaw3d/Simple.h>],
1981 [],
1982 emacs_cv_xaw3d=yes,
1983 emacs_cv_xaw3d=no)])
1984 else
1985 emacs_cv_xaw3d=no
1986 fi
1987 if test $emacs_cv_xaw3d = yes; then
1988 AC_MSG_RESULT([yes; using Lucid toolkit])
1989 USE_X_TOOLKIT=LUCID
1990 HAVE_XAW3D=yes
1991 LUCID_LIBW=-lXaw3d
1992 AC_DEFINE(HAVE_XAW3D, 1,
1993 [Define to 1 if you have the Xaw3d library (-lXaw3d).])
1994 else
1995 AC_MSG_RESULT(no)
1996 AC_MSG_CHECKING(for libXaw)
1997 AC_CACHE_VAL(emacs_cv_xaw,
1998 [AC_TRY_LINK([
1999 #include <X11/Intrinsic.h>
2000 #include <X11/Xaw/Simple.h>],
2001 [],
2002 emacs_cv_xaw=yes,
2003 emacs_cv_xaw=no)])
2004 if test $emacs_cv_xaw = yes; then
2005 AC_MSG_RESULT([yes; using Lucid toolkit])
2006 USE_X_TOOLKIT=LUCID
2007 LUCID_LIBW=-lXaw
2008 elif test x"${USE_X_TOOLKIT}" = xLUCID; then
2009 AC_MSG_ERROR([Lucid toolkit requires X11/Xaw include files])
2010 else
2011 AC_MSG_RESULT([no; do not use toolkit by default])
2012 USE_X_TOOLKIT=none
2013 fi
2014 fi
2015 fi
2016
2017 X_TOOLKIT_TYPE=$USE_X_TOOLKIT
2018
2019 LIBXTR6=
2020 if test "${USE_X_TOOLKIT}" != "none"; then
2021 AC_MSG_CHECKING(X11 toolkit version)
2022 AC_CACHE_VAL(emacs_cv_x11_toolkit_version_6,
2023 [AC_TRY_LINK([#include <X11/Intrinsic.h>],
2024 [#if XtSpecificationRelease < 6
2025 fail;
2026 #endif
2027 ], emacs_cv_x11_toolkit_version_6=yes, emacs_cv_x11_toolkit_version_6=no)])
2028 HAVE_X11XTR6=$emacs_cv_x11_toolkit_version_6
2029 if test $emacs_cv_x11_toolkit_version_6 = yes; then
2030 AC_MSG_RESULT(6 or newer)
2031 AC_DEFINE(HAVE_X11XTR6, 1,
2032 [Define to 1 if you have the X11R6 or newer version of Xt.])
2033 LIBXTR6="-lSM -lICE"
2034 case "$opsys" in
2035 ## Use libw.a along with X11R6 Xt.
2036 unixware) LIBXTR6="$LIBXTR6 -lw" ;;
2037 esac
2038 else
2039 AC_MSG_RESULT(before 6)
2040 fi
2041
2042 dnl If using toolkit, check whether libXmu.a exists.
2043 dnl tranle@intellicorp.com says libXmu.a can need XtMalloc in libXt.a to link.
2044 OLDLIBS="$LIBS"
2045 if test x$HAVE_X11XTR6 = xyes; then
2046 LIBS="-lXt -lSM -lICE $LIBS"
2047 else
2048 LIBS="-lXt $LIBS"
2049 fi
2050 AC_CHECK_LIB(Xmu, XmuConvertStandardSelection)
2051 test $ac_cv_lib_Xmu_XmuConvertStandardSelection = no && LIBS="$OLDLIBS"
2052 fi
2053 AC_SUBST(LIBXTR6)
2054
2055 dnl FIXME the logic here seems weird, but this is what cpp was doing.
2056 dnl Why not just test for libxmu in the normal way?
2057 LIBXMU=-lXmu
2058 case "$machine" in
2059 ## These machines don't supply Xmu.
2060 hpux* | aix4-2 )
2061 test "X$ac_cv_lib_Xmu_XmuConvertStandardSelection" != "Xyes" && LIBXMU=
2062 ;;
2063 esac
2064 AC_SUBST(LIBXMU)
2065
2066 # On Irix 6.5, at least, we need XShapeQueryExtension from -lXext for Xaw3D.
2067 if test "${HAVE_X11}" = "yes"; then
2068 if test "${USE_X_TOOLKIT}" != "none"; then
2069 AC_CHECK_LIB(Xext, XShapeQueryExtension)
2070 fi
2071 fi
2072
2073 LIBXP=
2074 if test "${USE_X_TOOLKIT}" = "MOTIF"; then
2075 AC_CACHE_CHECK(for Motif version 2.1, emacs_cv_motif_version_2_1,
2076 [AC_TRY_COMPILE([#include <Xm/Xm.h>],
2077 [#if XmVERSION > 2 || (XmVERSION == 2 && XmREVISION >= 1)
2078 int x = 5;
2079 #else
2080 Motif version prior to 2.1.
2081 #endif],
2082 emacs_cv_motif_version_2_1=yes, emacs_cv_motif_version_2_1=no)])
2083 if test $emacs_cv_motif_version_2_1 = yes; then
2084 AC_CHECK_LIB(Xp, XpCreateContext, LIBXP=-lXp)
2085 else
2086 AC_CACHE_CHECK(for LessTif where some systems put it, emacs_cv_lesstif,
2087 # We put this in CFLAGS temporarily to precede other -I options
2088 # that might be in CFLAGS temporarily.
2089 # We put this in CPPFLAGS where it precedes the other -I options.
2090 OLD_CPPFLAGS=$CPPFLAGS
2091 OLD_CFLAGS=$CFLAGS
2092 CPPFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $CPPFLAGS"
2093 CFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $CFLAGS"
2094 [AC_TRY_COMPILE([#include </usr/X11R6/LessTif/Motif1.2/include/Xm/Xm.h>],
2095 [int x = 5;],
2096 emacs_cv_lesstif=yes, emacs_cv_lesstif=no)])
2097 if test $emacs_cv_lesstif = yes; then
2098 # Make sure this -I option remains in CPPFLAGS after it is set
2099 # back to REAL_CPPFLAGS.
2100 # There is no need to change REAL_CFLAGS, because REAL_CFLAGS does not
2101 # have those other -I options anyway. Ultimately, having this
2102 # directory ultimately in CPPFLAGS will be enough.
2103 REAL_CPPFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $REAL_CPPFLAGS"
2104 LDFLAGS="-L/usr/X11R6/LessTif/Motif1.2/lib $LDFLAGS"
2105 else
2106 CFLAGS=$OLD_CFLAGS
2107 CPPFLAGS=$OLD_CPPFLAGS
2108 fi
2109 fi
2110 fi
2111
2112 dnl Use toolkit scroll bars if configured for GTK or X toolkit and either
2113 dnl using Motif or Xaw3d is available, and unless
2114 dnl --with-toolkit-scroll-bars=no was specified.
2115
2116 AH_TEMPLATE(USE_TOOLKIT_SCROLL_BARS,
2117 [Define to 1 if we should use toolkit scroll bars.])dnl
2118 USE_TOOLKIT_SCROLL_BARS=no
2119 if test "${with_toolkit_scroll_bars}" != "no"; then
2120 if test "${USE_X_TOOLKIT}" != "none"; then
2121 if test "${USE_X_TOOLKIT}" = "MOTIF"; then
2122 AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
2123 HAVE_XAW3D=no
2124 USE_TOOLKIT_SCROLL_BARS=yes
2125 elif test "${HAVE_XAW3D}" = "yes"; then
2126 AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
2127 USE_TOOLKIT_SCROLL_BARS=yes
2128 fi
2129 elif test "${HAVE_GTK}" = "yes"; then
2130 AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
2131 USE_TOOLKIT_SCROLL_BARS=yes
2132 elif test "${HAVE_NS}" = "yes"; then
2133 AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
2134 USE_TOOLKIT_SCROLL_BARS=yes
2135 fi
2136 fi
2137
2138 dnl See if XIM is available.
2139 AC_TRY_COMPILE([
2140 #include <X11/Xlib.h>
2141 #include <X11/Xresource.h>],
2142 [XIMProc callback;],
2143 [HAVE_XIM=yes
2144 AC_DEFINE(HAVE_XIM, 1, [Define to 1 if XIM is available])],
2145 HAVE_XIM=no)
2146
2147 dnl `--with-xim' now controls only the initial value of use_xim at run time.
2148
2149 if test "${with_xim}" != "no"; then
2150 AC_DEFINE(USE_XIM, 1,
2151 [Define to 1 if we should use XIM, if it is available.])
2152 fi
2153
2154
2155 if test "${HAVE_XIM}" != "no"; then
2156 late_CFLAGS=$CFLAGS
2157 if test "$GCC" = yes; then
2158 CFLAGS="$CFLAGS --pedantic-errors"
2159 fi
2160 AC_TRY_COMPILE([
2161 #include <X11/Xlib.h>
2162 #include <X11/Xresource.h>],
2163 [Display *display;
2164 XrmDatabase db;
2165 char *res_name;
2166 char *res_class;
2167 XIMProc callback;
2168 XPointer *client_data;
2169 #ifndef __GNUC__
2170 /* If we're not using GCC, it's probably not XFree86, and this is
2171 probably right, but we can't use something like --pedantic-errors. */
2172 extern Bool XRegisterIMInstantiateCallback(Display*, XrmDatabase, char*,
2173 char*, XIMProc, XPointer*);
2174 #endif
2175 (void)XRegisterIMInstantiateCallback(display, db, res_name, res_class, callback,
2176 client_data);],
2177 [emacs_cv_arg6_star=yes])
2178 AH_TEMPLATE(XRegisterIMInstantiateCallback_arg6,
2179 [Define to the type of the 6th arg of XRegisterIMInstantiateCallback,
2180 either XPointer or XPointer*.])dnl
2181 if test "$emacs_cv_arg6_star" = yes; then
2182 AC_DEFINE(XRegisterIMInstantiateCallback_arg6, [XPointer*])
2183 else
2184 AC_DEFINE(XRegisterIMInstantiateCallback_arg6, [XPointer])
2185 fi
2186 CFLAGS=$late_CFLAGS
2187 fi
2188
2189 ### Start of font-backend (under any platform) section.
2190 # (nothing here yet -- this is a placeholder)
2191 ### End of font-backend (under any platform) section.
2192
2193 ### Start of font-backend (under X11) section.
2194 if test "${HAVE_X11}" = "yes"; then
2195 PKG_CHECK_MODULES(FONTCONFIG, fontconfig >= 2.2.0, HAVE_FC=yes, HAVE_FC=no)
2196
2197 ## Use -lXft if available, unless `--with-xft=no'.
2198 HAVE_XFT=maybe
2199 if test "${HAVE_FC}" = "no" || test "x${with_x}" = "xno"; then
2200 with_xft="no";
2201 fi
2202 if test "x${with_xft}" != "xno"; then
2203
2204 PKG_CHECK_MODULES(XFT, xft >= 0.13.0, , HAVE_XFT=no)
2205 ## Because xftfont.c uses XRenderQueryExtension, we also
2206 ## need to link to -lXrender.
2207 HAVE_XRENDER=no
2208 AC_CHECK_LIB(Xrender, XRenderQueryExtension, HAVE_XRENDER=yes)
2209 if test "$HAVE_XFT" != no && test "$HAVE_XRENDER" != no; then
2210 OLD_CPPFLAGS="$CPPFLAGS"
2211 OLD_CFLAGS="$CFLAGS"
2212 OLD_LIBS="$LIBS"
2213 CPPFLAGS="$CPPFLAGS $XFT_CFLAGS"
2214 CFLAGS="$CFLAGS $XFT_CFLAGS"
2215 XFT_LIBS="-lXrender $XFT_LIBS"
2216 LIBS="$XFT_LIBS $LIBS"
2217 AC_CHECK_HEADER(X11/Xft/Xft.h,
2218 AC_CHECK_LIB(Xft, XftFontOpen, HAVE_XFT=yes, , $XFT_LIBS))
2219
2220 if test "${HAVE_XFT}" = "yes"; then
2221 AC_DEFINE(HAVE_XFT, 1, [Define to 1 if you have the Xft library.])
2222 AC_SUBST(XFT_LIBS)
2223 C_SWITCH_X_SITE="$C_SWITCH_X_SITE $XFT_CFLAGS"
2224 else
2225 CPPFLAGS="$OLD_CPPFLAGS"
2226 CFLAGS="$OLD_CFLAGS"
2227 LIBS="$OLD_LIBS"
2228 fi # "${HAVE_XFT}" = "yes"
2229 fi # "$HAVE_XFT" != no
2230 fi # "x${with_xft}" != "xno"
2231
2232 dnl For the "Does Emacs use" message at the end.
2233 if test "$HAVE_XFT" != "yes"; then
2234 HAVE_XFT=no
2235 fi
2236
2237
2238 HAVE_FREETYPE=no
2239 ## We used to allow building with FreeType and without Xft.
2240 ## However, the ftx font backend driver is not in good shape.
2241 if test "${HAVE_XFT}" = "yes"; then
2242 dnl As we use Xft, we anyway use freetype.
2243 dnl There's no need for additional CFLAGS and LIBS.
2244 HAVE_FREETYPE=yes
2245 FONTCONFIG_CFLAGS=
2246 FONTCONFIG_LIBS=
2247 fi
2248
2249 HAVE_LIBOTF=no
2250 if test "${HAVE_FREETYPE}" = "yes"; then
2251 AC_DEFINE(HAVE_FREETYPE, 1,
2252 [Define to 1 if using the freetype and fontconfig libraries.])
2253 if test "${with_libotf}" != "no"; then
2254 PKG_CHECK_MODULES(LIBOTF, libotf, HAVE_LIBOTF=yes,
2255 HAVE_LIBOTF=no)
2256 if test "$HAVE_LIBOTF" = "yes"; then
2257 AC_DEFINE(HAVE_LIBOTF, 1, [Define to 1 if using libotf.])
2258 AC_CHECK_LIB(otf, OTF_get_variation_glyphs,
2259 HAVE_OTF_GET_VARIATION_GLYPHS=yes,
2260 HAVE_OTF_GET_VARIATION_GLYPHS=no)
2261 if test "${HAVE_OTF_GET_VARIATION_GLYPHS}" = "yes"; then
2262 AC_DEFINE(HAVE_OTF_GET_VARIATION_GLYPHS, 1,
2263 [Define to 1 if libotf has OTF_get_variation_glyphs.])
2264 fi
2265 fi
2266 fi
2267 dnl FIXME should there be an error if HAVE_FREETYPE != yes?
2268 dnl Does the new font backend require it, or can it work without it?
2269 fi
2270
2271 HAVE_M17N_FLT=no
2272 if test "${HAVE_LIBOTF}" = yes; then
2273 if test "${with_m17n_flt}" != "no"; then
2274 PKG_CHECK_MODULES(M17N_FLT, m17n-flt, HAVE_M17N_FLT=yes, HAVE_M17N_FLT=no)
2275 if test "$HAVE_M17N_FLT" = "yes"; then
2276 AC_DEFINE(HAVE_M17N_FLT, 1, [Define to 1 if using libm17n-flt.])
2277 fi
2278 fi
2279 fi
2280 else
2281 HAVE_XFT=no
2282 HAVE_FREETYPE=no
2283 HAVE_LIBOTF=no
2284 HAVE_M17N_FLT=no
2285 fi
2286
2287 ### End of font-backend (under X11) section.
2288
2289 AC_SUBST(FREETYPE_CFLAGS)
2290 AC_SUBST(FREETYPE_LIBS)
2291 AC_SUBST(FONTCONFIG_CFLAGS)
2292 AC_SUBST(FONTCONFIG_LIBS)
2293 AC_SUBST(LIBOTF_CFLAGS)
2294 AC_SUBST(LIBOTF_LIBS)
2295 AC_SUBST(M17N_FLT_CFLAGS)
2296 AC_SUBST(M17N_FLT_LIBS)
2297
2298 ### Use -lXpm if available, unless `--with-xpm=no'.
2299 HAVE_XPM=no
2300 LIBXPM=
2301 if test "${HAVE_X11}" = "yes"; then
2302 if test "${with_xpm}" != "no"; then
2303 AC_CHECK_HEADER(X11/xpm.h,
2304 [AC_CHECK_LIB(Xpm, XpmReadFileToPixmap, HAVE_XPM=yes, , -lX11)])
2305 if test "${HAVE_XPM}" = "yes"; then
2306 AC_MSG_CHECKING(for XpmReturnAllocPixels preprocessor define)
2307 AC_EGREP_CPP(no_return_alloc_pixels,
2308 [#include "X11/xpm.h"
2309 #ifndef XpmReturnAllocPixels
2310 no_return_alloc_pixels
2311 #endif
2312 ], HAVE_XPM=no, HAVE_XPM=yes)
2313
2314 if test "${HAVE_XPM}" = "yes"; then
2315 AC_MSG_RESULT(yes)
2316 else
2317 AC_MSG_RESULT(no)
2318 fi
2319 fi
2320 fi
2321
2322 if test "${HAVE_XPM}" = "yes"; then
2323 AC_DEFINE(HAVE_XPM, 1, [Define to 1 if you have the Xpm libary (-lXpm).])
2324 LIBXPM=-lXpm
2325 fi
2326 fi
2327 AC_SUBST(LIBXPM)
2328
2329 ### Use -ljpeg if available, unless `--with-jpeg=no'.
2330 HAVE_JPEG=no
2331 LIBJPEG=
2332 if test "${HAVE_X11}" = "yes"; then
2333 if test "${with_jpeg}" != "no"; then
2334 dnl Checking for jpeglib.h can lose because of a redefinition of
2335 dnl HAVE_STDLIB_H.
2336 AC_CHECK_HEADER(jerror.h,
2337 [AC_CHECK_LIB(jpeg, jpeg_destroy_compress, HAVE_JPEG=yes)])
2338 fi
2339
2340 AH_TEMPLATE(HAVE_JPEG, [Define to 1 if you have the jpeg library (-ljpeg).])dnl
2341 if test "${HAVE_JPEG}" = "yes"; then
2342 AC_DEFINE(HAVE_JPEG)
2343 AC_EGREP_CPP([version= *(6[2-9]|[7-9][0-9])],
2344 [#include <jpeglib.h>
2345 version=JPEG_LIB_VERSION
2346 ],
2347 [AC_DEFINE(HAVE_JPEG)],
2348 [AC_MSG_WARN([libjpeg found, but not version 6b or later])
2349 HAVE_JPEG=no])
2350 fi
2351 if test "${HAVE_JPEG}" = "yes"; then
2352 LIBJPEG=-ljpeg
2353 fi
2354 fi
2355 AC_SUBST(LIBJPEG)
2356
2357 ### Use -lpng if available, unless `--with-png=no'.
2358 HAVE_PNG=no
2359 LIBPNG=
2360 if test "${HAVE_X11}" = "yes"; then
2361 if test "${with_png}" != "no"; then
2362 # Debian unstable as of July 2003 has multiple libpngs, and puts png.h
2363 # in /usr/include/libpng.
2364 AC_CHECK_HEADERS(png.h libpng/png.h)
2365 if test "$ac_cv_header_png_h" = yes || test "$ac_cv_header_libpng_png_h" = yes ; then
2366 AC_CHECK_LIB(png, png_get_channels, HAVE_PNG=yes, , -lz -lm)
2367 fi
2368 fi
2369
2370 if test "${HAVE_PNG}" = "yes"; then
2371 AC_DEFINE(HAVE_PNG, 1, [Define to 1 if you have the png library (-lpng).])
2372 LIBPNG="-lpng -lz -lm"
2373 fi
2374 fi
2375 AC_SUBST(LIBPNG)
2376
2377 ### Use -ltiff if available, unless `--with-tiff=no'.
2378 HAVE_TIFF=no
2379 LIBTIFF=
2380 if test "${HAVE_X11}" = "yes"; then
2381 if test "${with_tiff}" != "no"; then
2382 AC_CHECK_HEADER(tiffio.h,
2383 [tifflibs="-lz -lm"
2384 # At least one tiff package requires the jpeg library.
2385 if test "${HAVE_JPEG}" = yes; then tifflibs="-ljpeg $tifflibs"; fi
2386 AC_CHECK_LIB(tiff, TIFFGetVersion, HAVE_TIFF=yes, , $tifflibs)])
2387 fi
2388
2389 if test "${HAVE_TIFF}" = "yes"; then
2390 AC_DEFINE(HAVE_TIFF, 1, [Define to 1 if you have the tiff library (-ltiff).])
2391 dnl FIXME -lz -lm, as per libpng?
2392 LIBTIFF=-ltiff
2393 fi
2394 fi
2395 AC_SUBST(LIBTIFF)
2396
2397 ### Use -lgif or -lungif if available, unless `--with-gif=no'.
2398 HAVE_GIF=no
2399 LIBGIF=
2400 if test "${HAVE_X11}" = "yes" && test "${with_gif}" != "no"; then
2401 AC_CHECK_HEADER(gif_lib.h,
2402 # EGifPutExtensionLast only exists from version libungif-4.1.0b1.
2403 # Earlier versions can crash Emacs.
2404 [AC_CHECK_LIB(gif, EGifPutExtensionLast, HAVE_GIF=yes, HAVE_GIF=maybe)])
2405
2406 if test "$HAVE_GIF" = yes; then
2407 LIBGIF=-lgif
2408 elif test "$HAVE_GIF" = maybe; then
2409 # If gif_lib.h but no libgif, try libungif.
2410 AC_CHECK_LIB(ungif, EGifPutExtensionLast, HAVE_GIF=yes, HAVE_GIF=no)
2411 test "$HAVE_GIF" = yes && LIBGIF=-lungif
2412 fi
2413
2414 if test "${HAVE_GIF}" = "yes"; then
2415 AC_DEFINE(HAVE_GIF, 1, [Define to 1 if you have a gif (or ungif) library.])
2416 fi
2417 fi
2418 AC_SUBST(LIBGIF)
2419
2420 dnl Check for required libraries.
2421 if test "${HAVE_X11}" = "yes"; then
2422 MISSING=""
2423 WITH_NO=""
2424 test "${with_xpm}" != "no" && test "${HAVE_XPM}" != "yes" &&
2425 MISSING="libXpm" && WITH_NO="--with-xpm=no"
2426 test "${with_jpeg}" != "no" && test "${HAVE_JPEG}" != "yes" &&
2427 MISSING="$MISSING libjpeg" && WITH_NO="$WITH_NO --with-jpeg=no"
2428 test "${with_png}" != "no" && test "${HAVE_PNG}" != "yes" &&
2429 MISSING="$MISSING libpng" && WITH_NO="$WITH_NO --with-png=no"
2430 test "${with_gif}" != "no" && test "${HAVE_GIF}" != "yes" &&
2431 MISSING="$MISSING libgif/libungif" && WITH_NO="$WITH_NO --with-gif=no"
2432 test "${with_tiff}" != "no" && test "${HAVE_TIFF}" != "yes" &&
2433 MISSING="$MISSING libtiff" && WITH_NO="$WITH_NO --with-tiff=no"
2434
2435 if test "X${MISSING}" != X; then
2436 AC_MSG_ERROR([The following required libraries were not found:
2437 $MISSING
2438 Maybe some development libraries/packages are missing?
2439 If you don't want to link with them give
2440 $WITH_NO
2441 as options to configure])
2442 fi
2443 fi
2444
2445 ### Use -lgpm if available, unless `--with-gpm=no'.
2446 HAVE_GPM=no
2447 LIBGPM=
2448 MOUSE_SUPPORT=
2449 if test "${with_gpm}" != "no"; then
2450 AC_CHECK_HEADER(gpm.h,
2451 [AC_CHECK_LIB(gpm, Gpm_Open, HAVE_GPM=yes)])
2452
2453 if test "${HAVE_GPM}" = "yes"; then
2454 AC_DEFINE(HAVE_GPM, 1, [Define to 1 if you have the gpm library (-lgpm).])
2455 LIBGPM=-lgpm
2456 ## May be reset below.
2457 MOUSE_SUPPORT="\$(GPM_MOUSE_SUPPORT)"
2458 fi
2459 fi
2460 AC_SUBST(LIBGPM)
2461
2462 dnl Check for malloc/malloc.h on darwin
2463 AC_CHECK_HEADER(malloc/malloc.h, [AC_DEFINE(HAVE_MALLOC_MALLOC_H, 1, [Define to 1 if you have the <malloc/malloc.h> header file.])])
2464
2465 C_SWITCH_X_SYSTEM=
2466 ### Use NeXTstep API to implement GUI.
2467 if test "${HAVE_NS}" = "yes"; then
2468 AC_DEFINE(HAVE_NS, 1, [Define to 1 if you are using the NeXTstep API, either GNUstep or Cocoa on Mac OS X.])
2469 if test "${NS_IMPL_COCOA}" = "yes"; then
2470 AC_DEFINE(NS_IMPL_COCOA, 1, [Define to 1 if you are using NS windowing under MacOS X.])
2471 GNU_OBJC_CFLAGS=
2472 fi
2473 if test "${NS_IMPL_GNUSTEP}" = "yes"; then
2474 AC_DEFINE(NS_IMPL_GNUSTEP, 1, [Define to 1 if you are using NS windowing under GNUstep.])
2475 # See also .m.o rule in Makefile.in */
2476 # FIXME: are all these flags really needed? Document here why. */
2477 C_SWITCH_X_SYSTEM="-D_REENTRANT -fPIC -fno-strict-aliasing"
2478 GNU_OBJC_CFLAGS="-fgnu-runtime -Wno-import -fconstant-string-class=NSConstantString -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 -DGSWARN -DGSDIAGNOSE"
2479 fi
2480 if test "${NS_HAVE_NSINTEGER}" = "yes"; then
2481 AC_DEFINE(NS_HAVE_NSINTEGER, 1, [Define to 1 if `NSInteger' is defined.])
2482 fi
2483 # We also have mouse menus.
2484 HAVE_MENUS=yes
2485 OTHER_FILES=ns-app
2486 fi
2487
2488
2489 ### Use session management (-lSM -lICE) if available
2490 HAVE_X_SM=no
2491 LIBXSM=
2492 if test "${HAVE_X11}" = "yes"; then
2493 AC_CHECK_HEADER(X11/SM/SMlib.h,
2494 [AC_CHECK_LIB(SM, SmcOpenConnection, HAVE_X_SM=yes, , -lICE)])
2495
2496 if test "${HAVE_X_SM}" = "yes"; then
2497 AC_DEFINE(HAVE_X_SM, 1, [Define to 1 if you have the SM library (-lSM).])
2498 LIBXSM="-lSM -lICE"
2499 case "$LIBS" in
2500 *-lSM*) ;;
2501 *) LIBS="$LIBXSM $LIBS" ;;
2502 esac
2503 fi
2504 fi
2505 AC_SUBST(LIBXSM)
2506
2507 # If netdb.h doesn't declare h_errno, we must declare it by hand.
2508 AC_CACHE_CHECK(whether netdb declares h_errno,
2509 emacs_cv_netdb_declares_h_errno,
2510 [AC_TRY_LINK([#include <netdb.h>],
2511 [return h_errno;],
2512 emacs_cv_netdb_declares_h_errno=yes, emacs_cv_netdb_declares_h_errno=no)])
2513 if test $emacs_cv_netdb_declares_h_errno = yes; then
2514 AC_DEFINE(HAVE_H_ERRNO, 1, [Define to 1 if netdb.h declares h_errno.])
2515 fi
2516
2517 AC_FUNC_ALLOCA
2518
2519 dnl src/alloca.c has been removed. Could also check if $ALLOCA is set?
2520 dnl FIXME is there an autoconf test that does the right thing, without
2521 dnl needing to call A_M_E afterwards?
2522 if test x"$ac_cv_func_alloca_works" != xyes; then
2523 AC_MSG_ERROR( [a system implementation of alloca is required] )
2524 fi
2525
2526 # fmod, logb, and frexp are found in -lm on most systems.
2527 # On HPUX 9.01, -lm does not contain logb, so check for sqrt.
2528 AC_CHECK_LIB(m, sqrt)
2529
2530 # Check for mail-locking functions in a "mail" library. Probably this should
2531 # have the same check as for liblockfile below.
2532 AC_CHECK_LIB(mail, maillock, have_mail=yes, have_mail=no)
2533 if test $have_mail = yes; then
2534 LIBS_MAIL=-lmail
2535 LIBS="$LIBS_MAIL $LIBS"
2536 AC_DEFINE(HAVE_LIBMAIL, 1, [Define to 1 if you have the `mail' library (-lmail).])
2537 else
2538 LIBS_MAIL=
2539 fi
2540 dnl Debian, at least:
2541 AC_CHECK_LIB(lockfile, maillock, have_lockfile=yes, have_lockfile=no)
2542 if test $have_lockfile = yes; then
2543 LIBS_MAIL=-llockfile
2544 LIBS="$LIBS_MAIL $LIBS"
2545 AC_DEFINE(HAVE_LIBLOCKFILE, 1, [Define to 1 if you have the `lockfile' library (-llockfile).])
2546 else
2547 # If we have the shared liblockfile, assume we must use it for mail
2548 # locking (e.g. Debian). If we couldn't link against liblockfile
2549 # (no liblockfile.a installed), ensure that we don't need to.
2550 dnl This works for files generally, not just executables.
2551 dnl Should we look elsewhere for it? Maybe examine /etc/ld.so.conf?
2552 AC_CHECK_PROG(liblockfile, liblockfile.so, yes, no,
2553 /usr/lib:/lib:/usr/local/lib:$LD_LIBRARY_PATH)
2554 if test $ac_cv_prog_liblockfile = yes; then
2555 AC_MSG_ERROR([Shared liblockfile found but can't link against it.
2556 This probably means that movemail could lose mail.
2557 There may be a `development' package to install containing liblockfile.])
2558 fi
2559 fi
2560 AC_CHECK_FUNCS(touchlock)
2561 AC_CHECK_HEADERS(maillock.h)
2562 AC_SUBST(LIBS_MAIL)
2563
2564 ## Define MAIL_USE_FLOCK (or LOCKF) if the mailer uses flock (or lockf) to
2565 ## interlock access to the mail spool. The alternative is a lock file named
2566 ## /usr/spool/mail/$USER.lock.
2567 mail_lock=no
2568 case "$opsys" in
2569 aix4-2) mail_lock="lockf" ;;
2570
2571 gnu|freebsd|netbsd|openbsd|darwin|irix6-5) mail_lock="flock" ;;
2572
2573 ## On GNU/Linux systems, both methods are used by various mail programs.
2574 ## I assume most people are using newer mailers that have heard of flock.
2575 ## Change this if you need to.
2576 ## Debian contains a patch which says: ``On Debian/GNU/Linux systems,
2577 ## configure gets the right answers, and that means *NOT* using flock.
2578 ## Using flock is guaranteed to be the wrong thing. See Debian Policy
2579 ## for details.'' and then uses `#ifdef DEBIAN'. Unfortunately the
2580 ## Debian maintainer hasn't provided a clean fix for Emacs.
2581 ## movemail.c will use `maillock' when MAILDIR, HAVE_LIBMAIL and
2582 ## HAVE_MAILLOCK_H are defined, so the following appears to be the
2583 ## correct logic. -- fx
2584 ## We must check for HAVE_LIBLOCKFILE too, as movemail does.
2585 ## liblockfile is a Free Software replacement for libmail, used on
2586 ## Debian systems and elsewhere. -rfr.
2587 gnu-*)
2588 mail_lock="flock"
2589 if test $have_mail = yes || test $have_lockfile = yes; then
2590 test $ac_cv_header_maillock_h = yes && mail_lock=no
2591 fi
2592 ;;
2593 esac
2594
2595 BLESSMAIL_TARGET=
2596 case "$mail_lock" in
2597 flock) AC_DEFINE(MAIL_USE_FLOCK, 1, [Define if the mailer uses flock to interlock the mail spool.]) ;;
2598
2599 lockf) AC_DEFINE(MAIL_USE_LOCKF, 1, [Define if the mailer uses lockf to interlock the mail spool.]) ;;
2600
2601 *) BLESSMAIL_TARGET="need-blessmail" ;;
2602 esac
2603 AC_SUBST(BLESSMAIL_TARGET)
2604
2605
2606 AC_CHECK_FUNCS(gethostname getdomainname dup2 \
2607 rename closedir mkdir rmdir sysinfo getrusage get_current_dir_name \
2608 random lrand48 bcopy bcmp logb frexp fmod rint cbrt ftime setsid \
2609 strerror fpathconf select mktime euidaccess getpagesize tzset setlocale \
2610 utimes getrlimit setrlimit setpgid getcwd getwd shutdown getaddrinfo \
2611 __fpending mblen mbrlen mbsinit strsignal setitimer ualarm index rindex \
2612 sendto recvfrom getsockopt setsockopt getsockname getpeername \
2613 gai_strerror mkstemp getline getdelim mremap memmove fsync sync bzero \
2614 memset memcmp difftime memcpy mempcpy mblen mbrlen posix_memalign \
2615 cfmakeraw cfsetspeed isnan copysign)
2616
2617 AC_CHECK_HEADERS(sys/un.h)
2618
2619 AC_FUNC_MKTIME
2620 if test "$ac_cv_func_working_mktime" = no; then
2621 AC_DEFINE(BROKEN_MKTIME, 1, [Define to 1 if the mktime function is broken.])
2622 fi
2623
2624 AC_FUNC_GETLOADAVG
2625
2626 AC_FUNC_FSEEKO
2627
2628 # Configure getopt.
2629 m4_include([m4/getopt.m4])
2630 gl_GETOPT_IFELSE([
2631 gl_GETOPT_SUBSTITUTE_HEADER
2632 gl_PREREQ_GETOPT
2633 GETOPTOBJS='getopt.o getopt1.o'
2634 ])
2635 AC_SUBST(GETOPTOBJS)
2636
2637 AC_FUNC_GETPGRP
2638
2639 AC_FUNC_STRFTIME
2640
2641 # UNIX98 PTYs.
2642 AC_CHECK_FUNCS(grantpt)
2643
2644 # PTY-related GNU extensions.
2645 AC_CHECK_FUNCS(getpt)
2646
2647 # Check this now, so that we will NOT find the above functions in ncurses.
2648 # That is because we have not set up to link ncurses in lib-src.
2649 # It's better to believe a function is not available
2650 # than to expect to find it in ncurses.
2651 # Also we need tputs and friends to be able to build at all.
2652 have_tputs_et_al=true
2653 AC_SEARCH_LIBS(tputs, [ncurses terminfo termcap], , have_tputs_et_al=false)
2654 if test "$have_tputs_et_al" != true; then
2655 AC_MSG_ERROR([I couldn't find termcap functions (tputs and friends).
2656 Maybe some development libraries/packages are missing? Try installing
2657 libncurses-dev(el), libterminfo-dev(el) or similar.])
2658 fi
2659 # Must define this when any termcap library is found.
2660 AC_DEFINE(HAVE_LIBNCURSES, 1,
2661 [Define to 1 if you have the `ncurses' library (-lncurses).])
2662 ## FIXME This was the cpp logic, but I am not sure it is right.
2663 ## The above test has not necessarily found libncurses.
2664 HAVE_LIBNCURSES=yes
2665
2666 ## Use terminfo instead of termcap?
2667 ## Note only system files NOT using terminfo are:
2668 ## freebsd < 40000, ms-w32, msdos, netbsd < 599002500, and
2669 ## darwin|gnu without ncurses.
2670 TERMINFO=no
2671 LIBS_TERMCAP=
2672 case "$opsys" in
2673 ## cygwin: Fewer environment variables to go wrong, more terminal types.
2674 ## hpux10-20: Use the system provided termcap(3) library.
2675 ## openbsd: David Mazieres <dm@reeducation-labor.lcs.mit.edu> says this
2676 ## is necessary. Otherwise Emacs dumps core when run -nw.
2677 aix4-2|cygwin|hpux*|irix6-5|openbsd|sol2*|unixware) TERMINFO=yes ;;
2678
2679 ## darwin: Prevents crashes when running Emacs in Terminal.app under 10.2.
2680 ## The ncurses library has been moved out of the System framework in
2681 ## Mac OS X 10.2. So if configure detects it, set the command-line
2682 ## option to use it.
2683 darwin|gnu*)
2684 ## (HAVE_LIBNCURSES was not always true, but is since 2010-03-18.)
2685 if test "x$HAVE_LIBNCURSES" = "xyes"; then
2686 TERMINFO=yes
2687 LIBS_TERMCAP="-lncurses"
2688 fi
2689 ;;
2690
2691 freebsd)
2692 AC_MSG_CHECKING([whether FreeBSD is new enough to use terminfo])
2693 AC_CACHE_VAL(emacs_cv_freebsd_terminfo,
2694 [AC_TRY_LINK([#include <osreldate.h>],
2695 [#if __FreeBSD_version < 400000
2696 fail;
2697 #endif
2698 ], emacs_cv_freebsd_terminfo=yes, emacs_cv_freebsd_terminfo=no)])
2699
2700 AC_MSG_RESULT($emacs_cv_freebsd_terminfo)
2701
2702 if test $emacs_cv_freebsd_terminfo = yes; then
2703 TERMINFO=yes
2704 LIBS_TERMCAP="-lncurses"
2705 else
2706 LIBS_TERMCAP="-ltermcap"
2707 fi
2708 ;;
2709
2710 netbsd)
2711 if test $ac_cv_search_tputs = -lterminfo; then
2712 TERMINFO=yes
2713 LIBS_TERMCAP="-lterminfo"
2714 else
2715 LIBS_TERMCAP="-ltermcap"
2716 fi
2717 ;;
2718
2719 esac
2720
2721 case "$opsys" in
2722 ## hpux: Make sure we get select from libc rather than from libcurses
2723 ## because libcurses on HPUX 10.10 has a broken version of select.
2724 ## We used to use -lc -lcurses, but this may be cleaner.
2725 hpux*) LIBS_TERMCAP="-ltermcap" ;;
2726
2727 openbsd) LIBS_TERMCAP="-lncurses" ;;
2728
2729 ## Must use system termcap, if we use any termcap. It does special things.
2730 sol2*) test "$TERMINFO" != yes && LIBS_TERMCAP="-ltermcap" ;;
2731 esac
2732
2733 TERMCAP_OBJ=tparam.o
2734 if test $TERMINFO = yes; then
2735 AC_DEFINE(TERMINFO, 1, [Define to 1 if you use terminfo instead of termcap.])
2736
2737 ## Default used to be -ltermcap. Add a case above if need something else.
2738 test "x$LIBS_TERMCAP" = "x" && LIBS_TERMCAP="-lcurses"
2739
2740 TERMCAP_OBJ=terminfo.o
2741 fi
2742 AC_SUBST(LIBS_TERMCAP)
2743 AC_SUBST(TERMCAP_OBJ)
2744
2745
2746 # Do we have res_init, for detecting changes in /etc/resolv.conf?
2747 resolv=no
2748 AC_TRY_LINK([#include <netinet/in.h>
2749 #include <arpa/nameser.h>
2750 #include <resolv.h>],
2751 [return res_init();],
2752 have_res_init=yes, have_res_init=no)
2753 if test "$have_res_init" = no; then
2754 OLIBS="$LIBS"
2755 LIBS="$LIBS -lresolv"
2756 AC_MSG_CHECKING(for res_init with -lresolv)
2757 AC_TRY_LINK([#include <netinet/in.h>
2758 #include <arpa/nameser.h>
2759 #include <resolv.h>],
2760 [return res_init();],
2761 have_res_init=yes, have_res_init=no)
2762 AC_MSG_RESULT($have_res_init)
2763 if test "$have_res_init" = yes ; then
2764 resolv=yes
2765 fi
2766 LIBS="$OLIBS"
2767 fi
2768
2769 if test "$have_res_init" = yes; then
2770 AC_DEFINE(HAVE_RES_INIT, 1, [Define to 1 if res_init is available.])
2771 fi
2772
2773 # Do we need the Hesiod library to provide the support routines?
2774 LIBHESIOD=
2775 if test "$with_hesiod" != no ; then
2776 # Don't set $LIBS here -- see comments above. FIXME which comments?
2777 AC_CHECK_FUNC(res_send, , [AC_CHECK_FUNC(__res_send, ,
2778 [AC_CHECK_LIB(resolv, res_send, resolv=yes,
2779 [AC_CHECK_LIB(resolv, __res_send, resolv=yes)])])])
2780 if test "$resolv" = yes ; then
2781 RESOLVLIB=-lresolv
2782 else
2783 RESOLVLIB=
2784 fi
2785 AC_CHECK_FUNC(hes_getmailhost, , [AC_CHECK_LIB(hesiod, hes_getmailhost,
2786 hesiod=yes, :, $RESOLVLIB)])
2787
2788 if test x"$hesiod" = xyes; then
2789 AC_DEFINE(HAVE_LIBHESIOD, 1,
2790 [Define to 1 if you have the hesiod library (-lhesiod).])
2791 LIBHESIOD=-lhesiod
2792 fi
2793 fi
2794 AC_SUBST(LIBHESIOD)
2795
2796 # Do we need libresolv (due to res_init or Hesiod)?
2797 if test "$resolv" = yes ; then
2798 AC_DEFINE(HAVE_LIBRESOLV, 1,
2799 [Define to 1 if you have the resolv library (-lresolv).])
2800 LIBRESOLV=-lresolv
2801 else
2802 LIBRESOLV=
2803 fi
2804 AC_SUBST(LIBRESOLV)
2805
2806 # These tell us which Kerberos-related libraries to use.
2807 COM_ERRLIB=
2808 CRYPTOLIB=
2809 KRB5LIB=
2810 DESLIB=
2811 KRB4LIB=
2812
2813 if test "${with_kerberos}" != no; then
2814 AC_CHECK_LIB(com_err, com_err, have_com_err=yes, have_com_err=no)
2815 if test $have_com_err = yes; then
2816 COM_ERRLIB=-lcom_err
2817 LIBS="$COM_ERRLIB $LIBS"
2818 AC_DEFINE(HAVE_LIBCOM_ERR, 1, [Define to 1 if you have the `com_err' library (-lcom_err).])
2819 fi
2820 AC_CHECK_LIB(crypto, mit_des_cbc_encrypt, have_crypto=yes, have_crypto=no)
2821 if test $have_crypto = yes; then
2822 CRYPTOLIB=-lcrypto
2823 LIBS="$CRYPTOLIB $LIBS"
2824 AC_DEFINE(HAVE_LIBCRYPTO, 1, [Define to 1 if you have the `crypto' library (-lcrypto).])
2825 fi
2826 AC_CHECK_LIB(k5crypto, mit_des_cbc_encrypt, have_k5crypto=yes, have_k5crypto=no)
2827 if test $have_k5crypto = yes; then
2828 CRYPTOLIB=-lk5crypto
2829 LIBS="$CRYPTOLIB $LIBS"
2830 AC_DEFINE(HAVE_LIBK5CRYPTO, 1, [Define to 1 if you have the `k5crypto' library (-lk5crypto).])
2831 fi
2832 AC_CHECK_LIB(krb5, krb5_init_context, have_krb5=yes, have_krb5=no)
2833 if test $have_krb5=yes; then
2834 KRB5LIB=-lkrb5
2835 LIBS="$KRB5LIB $LIBS"
2836 AC_DEFINE(HAVE_LIBKRB5, 1, [Define to 1 if you have the `krb5' library (-lkrb5).])
2837 fi
2838 dnl FIXME Simplify. Does not match 22 logic, thanks to default_off?
2839 if test "${with_kerberos5}" = no; then
2840 AC_CHECK_LIB(des425, des_cbc_encrypt, have_des425=yes, have_des425=no )
2841 if test $have_des425 = yes; then
2842 DESLIB=-ldes425
2843 LIBS="$DESLIB $LIBS"
2844 AC_DEFINE(HAVE_LIBDES425, 1, [Define to 1 if you have the `des425' library (-ldes425).])
2845 else
2846 AC_CHECK_LIB(des, des_cbc_encrypt, have_des=yes, have_des=no)
2847 if test $have_des = yes; then
2848 DESLIB=-ldes
2849 LIBS="$DESLIB $LIBS"
2850 AC_DEFINE(HAVE_LIBDES, 1, [Define to 1 if you have the `des' library (-ldes).])
2851 fi
2852 fi
2853 AC_CHECK_LIB(krb4, krb_get_cred, have_krb4=yes, have_krb4=no)
2854 if test $have_krb4 = yes; then
2855 KRB4LIB=-lkrb4
2856 LIBS="$KRB4LIB $LIBS"
2857 AC_DEFINE(HAVE_LIBKRB4, 1, [Define to 1 if you have the `krb4' library (-lkrb4).])
2858 else
2859 AC_CHECK_LIB(krb, krb_get_cred, have_krb=yes, have_krb=no)
2860 if test $have_krb = yes; then
2861 KRB4LIB=-lkrb
2862 LIBS="$KRB4LIB $LIBS"
2863 AC_DEFINE(HAVE_LIBKRB, 1, [Define to 1 if you have the `krb' library (-lkrb).])
2864 fi
2865 fi
2866 fi
2867
2868 if test "${with_kerberos5}" != no; then
2869 AC_CHECK_HEADERS(krb5.h,
2870 [AC_CHECK_MEMBERS([krb5_error.text, krb5_error.e_text],,,
2871 [#include <krb5.h>])])
2872 else
2873 AC_CHECK_HEADERS(des.h,,
2874 [AC_CHECK_HEADERS(kerberosIV/des.h,,
2875 [AC_CHECK_HEADERS(kerberos/des.h)])])
2876 AC_CHECK_HEADERS(krb.h,,
2877 [AC_CHECK_HEADERS(kerberosIV/krb.h,,
2878 [AC_CHECK_HEADERS(kerberos/krb.h)])])
2879 fi
2880 AC_CHECK_HEADERS(com_err.h)
2881 fi
2882
2883 AC_SUBST(COM_ERRLIB)
2884 AC_SUBST(CRYPTOLIB)
2885 AC_SUBST(KRB5LIB)
2886 AC_SUBST(DESLIB)
2887 AC_SUBST(KRB4LIB)
2888
2889 # Solaris requires -lintl if you want strerror (which calls dgettext)
2890 # to return localized messages.
2891 AC_CHECK_LIB(intl, dgettext)
2892
2893 AC_MSG_CHECKING(whether localtime caches TZ)
2894 AC_CACHE_VAL(emacs_cv_localtime_cache,
2895 [if test x$ac_cv_func_tzset = xyes; then
2896 AC_TRY_RUN([#include <time.h>
2897 extern char **environ;
2898 unset_TZ ()
2899 {
2900 char **from, **to;
2901 for (to = from = environ; (*to = *from); from++)
2902 if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '='))
2903 to++;
2904 }
2905 char TZ_GMT0[] = "TZ=GMT0";
2906 char TZ_PST8[] = "TZ=PST8";
2907 main()
2908 {
2909 time_t now = time ((time_t *) 0);
2910 int hour_GMT0, hour_unset;
2911 if (putenv (TZ_GMT0) != 0)
2912 exit (1);
2913 hour_GMT0 = localtime (&now)->tm_hour;
2914 unset_TZ ();
2915 hour_unset = localtime (&now)->tm_hour;
2916 if (putenv (TZ_PST8) != 0)
2917 exit (1);
2918 if (localtime (&now)->tm_hour == hour_GMT0)
2919 exit (1);
2920 unset_TZ ();
2921 if (localtime (&now)->tm_hour != hour_unset)
2922 exit (1);
2923 exit (0);
2924 }], emacs_cv_localtime_cache=no, emacs_cv_localtime_cache=yes,
2925 [# If we have tzset, assume the worst when cross-compiling.
2926 emacs_cv_localtime_cache=yes])
2927 else
2928 # If we lack tzset, report that localtime does not cache TZ,
2929 # since we can't invalidate the cache if we don't have tzset.
2930 emacs_cv_localtime_cache=no
2931 fi])dnl
2932 AC_MSG_RESULT($emacs_cv_localtime_cache)
2933 if test $emacs_cv_localtime_cache = yes; then
2934 AC_DEFINE(LOCALTIME_CACHE, 1,
2935 [Define to 1 if localtime caches TZ.])
2936 fi
2937
2938 if test "x$HAVE_TIMEVAL" = xyes; then
2939 AC_CHECK_FUNCS(gettimeofday)
2940 if test $ac_cv_func_gettimeofday = yes; then
2941 AC_CACHE_CHECK(whether gettimeofday can accept two arguments,
2942 emacs_cv_gettimeofday_two_arguments,
2943 [AC_TRY_COMPILE([
2944 #ifdef TIME_WITH_SYS_TIME
2945 #include <sys/time.h>
2946 #include <time.h>
2947 #else
2948 #ifdef HAVE_SYS_TIME_H
2949 #include <sys/time.h>
2950 #else
2951 #include <time.h>
2952 #endif
2953 #endif],
2954 [struct timeval time;
2955 gettimeofday (&time, 0);],
2956 emacs_cv_gettimeofday_two_arguments=yes,
2957 emacs_cv_gettimeofday_two_arguments=no)])
2958 if test $emacs_cv_gettimeofday_two_arguments = no; then
2959 AC_DEFINE(GETTIMEOFDAY_ONE_ARGUMENT, 1,
2960 [Define to 1 if gettimeofday accepts only one argument.])
2961 fi
2962 fi
2963 fi
2964
2965 ok_so_far=yes
2966 AC_CHECK_FUNC(socket, , ok_so_far=no)
2967 if test $ok_so_far = yes; then
2968 AC_CHECK_HEADER(netinet/in.h, , ok_so_far=no)
2969 fi
2970 if test $ok_so_far = yes; then
2971 AC_CHECK_HEADER(arpa/inet.h, , ok_so_far=no)
2972 fi
2973 if test $ok_so_far = yes; then
2974 dnl Fixme: Not used. Should this be HAVE_SOCKETS?
2975 AC_DEFINE(HAVE_INET_SOCKETS, 1,
2976 [Define to 1 if you have inet sockets.])
2977 fi
2978
2979 AC_CHECK_HEADERS(sys/ioctl.h)
2980
2981 if test -f /usr/lpp/X11/bin/smt.exp; then
2982 AC_DEFINE(HAVE_AIX_SMT_EXP, 1,
2983 [Define to 1 if the file /usr/lpp/X11/bin/smt.exp exists.])
2984 fi
2985
2986 AC_MSG_CHECKING(whether system supports dynamic ptys)
2987 if test -d /dev/pts && ls -d /dev/ptmx > /dev/null 2>&1 ; then
2988 AC_MSG_RESULT(yes)
2989 AC_DEFINE(HAVE_DEV_PTMX, 1, [Define to 1 if dynamic ptys are supported.])
2990 else
2991 AC_MSG_RESULT(no)
2992 fi
2993
2994 AC_FUNC_FORK
2995
2996 dnl Adapted from Haible's version.
2997 AC_CACHE_CHECK([for nl_langinfo and CODESET], emacs_cv_langinfo_codeset,
2998 [AC_TRY_LINK([#include <langinfo.h>],
2999 [char* cs = nl_langinfo(CODESET);],
3000 emacs_cv_langinfo_codeset=yes,
3001 emacs_cv_langinfo_codeset=no)
3002 ])
3003 if test $emacs_cv_langinfo_codeset = yes; then
3004 AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
3005 [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
3006 fi
3007
3008 AC_CHECK_TYPES(size_t)
3009
3010 AC_TYPE_MBSTATE_T
3011
3012 dnl Restrict could probably be used effectively other than in regex.c.
3013 AC_CACHE_CHECK([for C restrict keyword], emacs_cv_c_restrict,
3014 [AC_TRY_COMPILE([void fred (int *restrict x);], [],
3015 emacs_cv_c_restrict=yes,
3016 [AC_TRY_COMPILE([void fred (int *__restrict x);], [],
3017 emacs_cv_c_restrict=__restrict,
3018 emacs_cv_c_restrict=no)])])
3019 case "$emacs_cv_c_restrict" in
3020 yes) emacs_restrict=restrict;;
3021 no) emacs_restrict="";;
3022 *) emacs_restrict="$emacs_cv_c_restrict";;
3023 esac
3024 if test "$emacs_restrict" != __restrict; then
3025 AC_DEFINE_UNQUOTED(__restrict, $emacs_restrict,
3026 [Define to compiler's equivalent of C99 restrict keyword.
3027 Don't define if equivalent is `__restrict'.])
3028 fi
3029
3030 AC_CACHE_CHECK([for C restricted array declarations], emacs_cv_c_restrict_arr,
3031 [AC_TRY_COMPILE([void fred (int x[__restrict]);], [],
3032 emacs_cv_c_restrict_arr=yes, emacs_cv_c_restrict_arr=no)])
3033 if test "$emacs_cv_c_restrict_arr" = yes; then
3034 AC_DEFINE(__restrict_arr, __restrict,
3035 [Define to compiler's equivalent of C99 restrict keyword in array
3036 declarations. Define as empty for no equivalent.])
3037 fi
3038
3039 dnl Fixme: AC_SYS_POSIX_TERMIOS should probably be used, but it's not clear
3040 dnl how the tty code is related to POSIX and/or other versions of termios.
3041 dnl The following looks like a useful start.
3042 dnl
3043 dnl AC_SYS_POSIX_TERMIOS
3044 dnl if test $ac_cv_sys_posix_termios = yes; then
3045 dnl AC_DEFINE(HAVE_TERMIOS, 1, [Define to 1 if you have POSIX-style functions
3046 dnl and macros for terminal control.])
3047 dnl AC_DEFINE(HAVE_TCATTR, 1, [Define to 1 if you have tcgetattr and tcsetattr.])
3048 dnl fi
3049
3050 dnl Fixme: Use AC_FUNC_MEMCMP since memcmp is used. (Needs libobj replacement.)
3051
3052 # Set up the CFLAGS for real compilation, so we can substitute it.
3053 CFLAGS="$REAL_CFLAGS"
3054 CPPFLAGS="$REAL_CPPFLAGS"
3055
3056 ## Hack to detect a buggy GCC version.
3057 if test "x$GCC" = xyes \
3058 && test x"`$CC --version 2> /dev/null | grep 'gcc.* 4.5.0'`" != x \
3059 && test x"`echo $CFLAGS | grep '\-O@<:@23@:>@'`" != x \
3060 && test x"`echo $CFLAGS | grep '\-fno-optimize-sibling-calls'`" = x; then
3061 AC_MSG_ERROR([GCC 4.5.0 has problems compiling Emacs; see etc/PROBLEMS'.])
3062 fi
3063
3064 #### Find out which version of Emacs this is.
3065 [version=`grep 'const char emacs_version' ${srcdir}/src/emacs.c \
3066 | sed -e 's/^[^"]*"\([^"]*\)".*$/\1/'`]
3067 if test x"${version}" = x; then
3068 AC_MSG_ERROR([can't find current emacs version in `${srcdir}/src/emacs.c'.])
3069 fi
3070 if test x"${version}" != x"$PACKAGE_VERSION"; then
3071 AC_MSG_WARN([version mismatch between `${srcdir}/configure.in' and `${srcdir}/src/emacs.c'.])
3072 fi
3073
3074 ### Specify what sort of things we'll be editing into Makefile and config.h.
3075 ### Use configuration here uncanonicalized to avoid exceeding size limits.
3076 AC_SUBST(version)
3077 AC_SUBST(configuration)
3078 ## Unused?
3079 AC_SUBST(canonical)
3080 AC_SUBST(srcdir)
3081 AC_SUBST(prefix)
3082 AC_SUBST(exec_prefix)
3083 AC_SUBST(bindir)
3084 AC_SUBST(datadir)
3085 AC_SUBST(sharedstatedir)
3086 AC_SUBST(libexecdir)
3087 AC_SUBST(mandir)
3088 AC_SUBST(infodir)
3089 AC_SUBST(lispdir)
3090 AC_SUBST(locallisppath)
3091 AC_SUBST(lisppath)
3092 AC_SUBST(x_default_search_path)
3093 AC_SUBST(etcdir)
3094 AC_SUBST(archlibdir)
3095 AC_SUBST(docdir)
3096 AC_SUBST(bitmapdir)
3097 AC_SUBST(gamedir)
3098 AC_SUBST(gameuser)
3099 ## FIXME? Nothing uses @LD_SWITCH_X_SITE@.
3100 ## src/Makefile.in did add LD_SWITCH_X_SITE (as a cpp define) to the
3101 ## end of LIBX_BASE, but nothing ever set it.
3102 AC_SUBST(LD_SWITCH_X_SITE)
3103 AC_SUBST(C_SWITCH_X_SITE)
3104 AC_SUBST(C_SWITCH_X_SYSTEM)
3105 AC_SUBST(CFLAGS)
3106 ## Used in lwlib/Makefile.in.
3107 AC_SUBST(X_TOOLKIT_TYPE)
3108 AC_SUBST(machfile)
3109 AC_SUBST(opsysfile)
3110 AC_SUBST(GETLOADAVG_LIBS)
3111 AC_SUBST(ns_appdir)
3112 AC_SUBST(ns_appbindir)
3113 AC_SUBST(ns_appresdir)
3114 AC_SUBST(ns_appsrc)
3115 AC_SUBST(GNU_OBJC_CFLAGS)
3116 AC_SUBST(OTHER_FILES)
3117
3118 AC_DEFINE_UNQUOTED(EMACS_CONFIGURATION, "${canonical}",
3119 [Define to the canonical Emacs configuration name.])
3120 AC_DEFINE_UNQUOTED(EMACS_CONFIG_OPTIONS, "${ac_configure_args}",
3121 [Define to the options passed to configure.])
3122 AC_DEFINE_UNQUOTED(config_machfile, "${machfile}",
3123 [Define to the used machine dependent file.])
3124 AC_DEFINE_UNQUOTED(config_opsysfile, "${opsysfile}",
3125 [Define to the used os dependent file.])
3126
3127 XMENU_OBJ=
3128 XOBJ=
3129 FONT_OBJ=
3130 if test "${HAVE_X_WINDOWS}" = "yes" ; then
3131 AC_DEFINE(HAVE_X_WINDOWS, 1,
3132 [Define to 1 if you want to use the X window system.])
3133 XMENU_OBJ=xmenu.o
3134 XOBJ="xterm.o xfns.o xselect.o xrdb.o fontset.o xsmfns.o fringe.o image.o xsettings.o xgselect.o"
3135 FONT_OBJ=xfont.o
3136 if test "$HAVE_XFT" = "yes"; then
3137 FONT_OBJ="$FONT_OBJ ftfont.o xftfont.o ftxfont.o"
3138 elif test "$HAVE_FREETYPE" = "yes"; then
3139 FONT_OBJ="$FONT_OBJ ftfont.o ftxfont.o"
3140 fi
3141 AC_SUBST(FONT_OBJ)
3142 fi
3143 AC_SUBST(XMENU_OBJ)
3144 AC_SUBST(XOBJ)
3145 AC_SUBST(FONT_OBJ)
3146
3147 WIDGET_OBJ=
3148 MOTIF_LIBW=
3149 if test "${USE_X_TOOLKIT}" != "none" ; then
3150 WIDGET_OBJ=widget.o
3151 AC_DEFINE(USE_X_TOOLKIT, 1, [Define to 1 if using an X toolkit.])
3152 if test "${USE_X_TOOLKIT}" = "LUCID"; then
3153 AC_DEFINE(USE_LUCID, 1, [Define to 1 if using the Lucid X toolkit.])
3154 elif test "${USE_X_TOOLKIT}" = "MOTIF"; then
3155 AC_DEFINE(USE_MOTIF, 1, [Define to 1 if using the Motif X toolkit.])
3156 MOTIF_LIBW=-lXm
3157 case "$opsys" in
3158 gnu-linux)
3159 ## Paul Abrahams <abrahams at equinox.shaysnet.com> says this is needed.
3160 MOTIF_LIBW="$MOTIF_LIBW -lXpm"
3161 ;;
3162
3163 unixware)
3164 ## Richard Anthony Ryan <ryanr at ellingtn.ftc.nrcs.usda.gov>
3165 ## says -lXimp is needed in UNIX_SV ... 4.2 1.1.2.
3166 MOTIF_LIBW="MOTIF_LIBW -lXimp"
3167 ;;
3168
3169 aix4-2)
3170 ## olson@mcs.anl.gov says -li18n is needed by -lXm.
3171 MOTIF_LIBW="$MOTIF_LIBW -li18n"
3172 ;;
3173 esac
3174 MOTIF_LIBW="$MOTIF_LIBW $LIBXP"
3175 fi
3176 fi
3177 AC_SUBST(WIDGET_OBJ)
3178
3179 TOOLKIT_LIBW=
3180 case "$USE_X_TOOLKIT" in
3181 MOTIF) TOOLKIT_LIBW="$MOTIF_LIBW" ;;
3182 LUCID) TOOLKIT_LIBW="$LUCID_LIBW" ;;
3183 none) test "x$HAVE_GTK" = "xyes" && TOOLKIT_LIBW="$GTK_LIBS" ;;
3184 esac
3185 AC_SUBST(TOOLKIT_LIBW)
3186
3187 if test "$USE_X_TOOLKIT" = "none"; then
3188 LIBXT_OTHER="\$(LIBXSM)"
3189 OLDXMENU_TARGET="really-oldXMenu"
3190 else
3191 LIBXT_OTHER="\$(LIBXMU) -lXt \$(LIBXTR6) -lXext"
3192 OLDXMENU_TARGET="really-lwlib"
3193 fi
3194 AC_SUBST(LIBXT_OTHER)
3195
3196 ## The X Menu stuff is present in the X10 distribution, but missing
3197 ## from X11. If we have X10, just use the installed library;
3198 ## otherwise, use our own copy.
3199 if test "${HAVE_X11}" = "yes" ; then
3200 AC_DEFINE(HAVE_X11, 1,
3201 [Define to 1 if you want to use version 11 of X windows.
3202 Otherwise, Emacs expects to use version 10.])
3203
3204 if test "$USE_X_TOOLKIT" = "none"; then
3205 OLDXMENU="\${oldXMenudir}libXMenu11.a"
3206 else
3207 OLDXMENU="\${lwlibdir}liblw.a"
3208 fi
3209 LIBXMENU="\$(OLDXMENU)"
3210 LIBX_OTHER="\$(LIBXT) \$(LIBX_EXTRA)"
3211 OLDXMENU_DEPS="\${OLDXMENU} ../src/\${OLDXMENU}"
3212 else
3213 ## For a syntactically valid Makefile; not actually used for anything.
3214 ## See comments in src/Makefile.in.
3215 OLDXMENU=nothing
3216 ## FIXME This case (!HAVE_X11 && HAVE_X_WINDOWS) is no longer possible(?).
3217 if test "${HAVE_X_WINDOWS}" = "yes"; then
3218 LIBXMENU="-lXMenu"
3219 else
3220 LIBXMENU=
3221 fi
3222 LIBX_OTHER=
3223 OLDXMENU_DEPS=
3224 fi
3225
3226 if test "$HAVE_GTK" = "yes" || test "$HAVE_MENUS" != "yes"; then
3227 OLDXMENU_TARGET=
3228 OLDXMENU=nothing
3229 LIBXMENU=
3230 OLDXMENU_DEPS=
3231 fi
3232
3233 AC_SUBST(OLDXMENU_TARGET)
3234 AC_SUBST(OLDXMENU)
3235 AC_SUBST(LIBXMENU)
3236 AC_SUBST(LIBX_OTHER)
3237 AC_SUBST(OLDXMENU_DEPS)
3238
3239 if test "${HAVE_MENUS}" = "yes" ; then
3240 AC_DEFINE(HAVE_MENUS, 1,
3241 [Define to 1 if you have mouse menus.
3242 (This is automatic if you use X, but the option to specify it remains.)
3243 It is also defined with other window systems that support xmenu.c.])
3244 fi
3245
3246 if test "${GNU_MALLOC}" = "yes" ; then
3247 AC_DEFINE(GNU_MALLOC, 1,
3248 [Define to 1 if you want to use the GNU memory allocator.])
3249 fi
3250
3251 RALLOC_OBJ=
3252 if test "${REL_ALLOC}" = "yes" ; then
3253 AC_DEFINE(REL_ALLOC, 1,
3254 [Define REL_ALLOC if you want to use the relocating allocator for
3255 buffer space.])
3256
3257 test "$system_malloc" != "yes" && RALLOC_OBJ=ralloc.o
3258 fi
3259 AC_SUBST(RALLOC_OBJ)
3260
3261 if test "$opsys" = "cygwin"; then
3262 CYGWIN_OBJ="sheap.o"
3263 ## Cygwin differs because of its unexec().
3264 PRE_ALLOC_OBJ=
3265 POST_ALLOC_OBJ=lastfile.o
3266 else
3267 CYGWIN_OBJ=
3268 PRE_ALLOC_OBJ=lastfile.o
3269 POST_ALLOC_OBJ=
3270 fi
3271 AC_SUBST(CYGWIN_OBJ)
3272 AC_SUBST(PRE_ALLOC_OBJ)
3273 AC_SUBST(POST_ALLOC_OBJ)
3274
3275
3276 case "$opsys" in
3277 aix4-2) LD_SWITCH_SYSTEM_TEMACS="-Wl,-bnodelcsect" ;;
3278
3279 darwin)
3280 ## The -headerpad option tells ld (see man page) to leave room at the
3281 ## end of the header for adding load commands. Needed for dumping.
3282 ## 0x690 is the total size of 30 segment load commands (at 56
3283 ## each); under Cocoa 31 commands are required.
3284 if test "$HAVE_NS" = "yes"; then
3285 libs_nsgui="-framework AppKit"
3286 headerpad_extra=6C8
3287 else
3288 libs_nsgui=
3289 headerpad_extra=690
3290 fi
3291 LD_SWITCH_SYSTEM_TEMACS="-prebind $libs_nsgui -Xlinker -headerpad -Xlinker $headerpad_extra"
3292
3293 ## This is here because src/Makefile.in did some extra fiddling around
3294 ## with LD_SWITCH_SYSTEM. The cpp logic was:
3295 ## #ifndef LD_SWITCH_SYSTEM
3296 ## #if !defined (__GNUC__) && ((defined (BSD_SYSTEM) && !defined (COFF)))
3297 ## Since all the *bsds define LD_SWITCH_SYSTEM, this simplifies to:
3298 ## not using gcc, darwin system not on an alpha (ie darwin, since
3299 ## darwin + alpha does not occur).
3300 ## Because this was done in src/Makefile.in, the resulting part of
3301 ## LD_SWITCH_SYSTEM was not used in configure (ie, in ac_link).
3302 ## It therefore seems cleaner to put this in LD_SWITCH_SYSTEM_TEMACS,
3303 ## rather than LD_SWITCH_SYSTEM.
3304 test "x$LD_SWITCH_SYSTEM" = "x" && test "x$GCC" != "xyes" && \
3305 LD_SWITCH_SYSTEM_TEMACS="-X $LD_SWITCH_SYSTEM_TEMACS"
3306 ;;
3307
3308 ## LD_SWITCH_X_SITE_AUX is a -R option saying where to find X at run-time.
3309 ## When handled by cpp, this was in LD_SWITCH_SYSTEM. However, at
3310 ## the point where configure sourced the s/*.h file, LD_SWITCH_X_SITE_AUX
3311 ## had not yet been defined and was expanded to null. Hence LD_SWITCH_SYSTEM
3312 ## had different values in configure (in ac_link) and src/Makefile.in.
3313 ## It seems clearer therefore to put this piece in LD_SWITCH_SYSTEM_TEMACS.
3314 gnu-linux) LD_SWITCH_SYSTEM_TEMACS="\$(LD_SWITCH_X_SITE_AUX)" ;;
3315
3316 *) LD_SWITCH_SYSTEM_TEMACS= ;;
3317 esac
3318
3319 if test "$NS_IMPL_GNUSTEP" = "yes"; then
3320 LD_SWITCH_SYSTEM_TEMACS="${LD_SWITCH_SYSTEM_TEMACS} -L${GNUSTEP_SYSTEM_LIBRARIES} ${GNUSTEP_LOCAL_LIBRARIES} -lgnustep-gui -lgnustep-base -lobjc -lpthread"
3321 fi
3322
3323 AC_SUBST(LD_SWITCH_SYSTEM_TEMACS)
3324
3325
3326 LINKER=
3327 ORDINARY_LINK=
3328 case "$opsys" in
3329 ## gnu: GNU needs its own crt0.
3330 aix4-2|darwin|gnu|usg5-4|irix6-5|sol2*|unixware) ORDINARY_LINK=yes ;;
3331
3332 cygwin) LINKER="\$(CC)" ;;
3333
3334 ## On post 1.3 releases of NetBSD, gcc -nostdlib also clears the
3335 ## library search parth, i.e. it won't search /usr/lib for libc and
3336 ## friends. Using -nostartfiles instead avoids this problem, and
3337 ## will also work on earlier NetBSD releases.
3338 netbsd|openbsd) LINKER="\$(CC) -nostartfiles" ;;
3339
3340 ## macpcc: NAKAJI Hiroyuki <nakaji@tutrp.tut.ac.jp> says
3341 ## MkLinux/LinuxPPC needs this.
3342 ## ibms390x only supports opsys = gnu-linux so it can be added here.
3343 gnu-*)
3344 case "$machine" in
3345 macppc|ibms390x) LINKER="\$(CC) -nostdlib" ;;
3346 esac
3347 ;;
3348 esac
3349
3350
3351 PRE_EDIT_LDFLAGS=
3352 POST_EDIT_LDFLAGS=
3353 if test "x$ORDINARY_LINK" = "xyes"; then
3354
3355 LINKER="\$(CC)"
3356 AC_DEFINE(ORDINARY_LINK, 1, [Define if the C compiler is the linker.])
3357
3358 ## The system files defining neither ORDINARY_LINK nor LINKER are:
3359 ## (bsd-common), freebsd, gnu-* not on macppc|ibms390x, hpux*.
3360 elif test "x$GCC" = "xyes" && test "x$LINKER" = "x"; then
3361
3362 ## Versions of GCC >= 2.0 put their library, libgcc.a, in obscure
3363 ## places that are difficult to figure out at make time. Fortunately,
3364 ## these same versions allow you to pass arbitrary flags on to the
3365 ## linker, so there is no reason not to use it as a linker.
3366 ##
3367 ## Well, it is not quite perfect. The "-nostdlib" keeps GCC from
3368 ## searching for libraries in its internal directories, so we have to
3369 ## ask GCC explicitly where to find libgcc.a (LIB_GCC below).
3370 LINKER="\$(CC) -nostdlib"
3371 ## GCC passes any argument prefixed with -Xlinker directly to the linker.
3372 ## See prefix-args.c for an explanation of why we do not do this with the
3373 ## shell''s ``for'' construct. Note that sane people do not have '.' in
3374 ## their paths, so we must use ./prefix-args.
3375 ## TODO either make prefix-args check ORDINARY_LINK internally,
3376 ## or remove it altogether (bug#6184), removing the need for this hack.
3377 PRE_EDIT_LDFLAGS='`./prefix-args -Xlinker'
3378 POST_EDIT_LDFLAGS='`'
3379 fi
3380 AC_SUBST(PRE_EDIT_LDFLAGS)
3381 AC_SUBST(POST_EDIT_LDFLAGS)
3382
3383 test "x$LINKER" = "x" && LINKER=ld
3384 ## FIXME? What setting of EDIT_LDFLAGS should this have?
3385 test "$NS_IMPL_GNUSTEP" = "yes" && LINKER="\$(CC) -rdynamic"
3386
3387 AC_SUBST(LINKER)
3388
3389
3390 ## FIXME? The logic here is not precisely the same as that above.
3391 ## There is no check here for a pre-defined LINKER.
3392 ## Should we only be setting LIB_GCC if LD ~ -nostdlib?
3393 LIB_GCC=
3394 if test "x$GCC" = "xyes" && test "x$ORDINARY_LINK" != "xyes"; then
3395
3396 case "$opsys" in
3397 ## cygwin: don't link against static libgcc.
3398 cygwin|freebsd|netbsd|openbsd) LIB_GCC= ;;
3399
3400 gnu-*)
3401 ## armin76@gentoo.org reported that the lgcc_s flag is necessary to
3402 ## build on ARM EABI under GNU/Linux. (Bug#5518)
3403 ## Note that m/arm.h never bothered to undefine LIB_GCC first.
3404 if test "$machine" = "arm"; then
3405 LIB_GCC="-lgcc_s"
3406 else
3407 ## FIXME? s/gnu-linux.h used to define LIB_GCC as below, then
3408 ## immediately undefine it again and redefine it to empty.
3409 ## Was the C_SWITCH_X_SITE part really necessary?
3410 ## LIB_GCC=`$CC $C_SWITCH_X_SITE -print-libgcc-file-name`
3411 LIB_GCC=
3412 fi
3413 ;;
3414
3415 ## Ask GCC where to find libgcc.a.
3416 *) LIB_GCC=`$CC -print-libgcc-file-name 2> /dev/null` ;;
3417 esac
3418 fi dnl if $GCC
3419 AC_SUBST(LIB_GCC)
3420
3421
3422 TOOLTIP_SUPPORT=
3423 WINDOW_SUPPORT=
3424 ## If we're using X11/GNUstep, define some consequences.
3425 if test "$HAVE_X_WINDOWS" = "yes" || test "$HAVE_NS" = "yes"; then
3426 AC_DEFINE(HAVE_WINDOW_SYSTEM, 1, [Define if you have a window system.])
3427 AC_DEFINE(HAVE_MOUSE, 1, [Define if you have mouse support.])
3428 MOUSE_SUPPORT="\$(REAL_MOUSE_SUPPORT)"
3429 TOOLTIP_SUPPORT="\${lispsource}mouse.elc"
3430
3431 WINDOW_SUPPORT="\$(BASE_WINDOW_SUPPORT)"
3432 test "$HAVE_X_WINDOWS" = "yes" && \
3433 WINDOW_SUPPORT="$WINDOW_SUPPORT \$(X_WINDOW_SUPPORT)"
3434
3435 fi
3436 AC_SUBST(MOUSE_SUPPORT)
3437 AC_SUBST(TOOLTIP_SUPPORT)
3438 AC_SUBST(WINDOW_SUPPORT)
3439
3440
3441 AH_TOP([/* GNU Emacs site configuration template file.
3442 Copyright (C) 1988, 1993, 1994, 1999, 2000, 2001, 2002, 2004, 2005,
3443 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
3444
3445 This file is part of GNU Emacs.
3446
3447 GNU Emacs is free software: you can redistribute it and/or modify
3448 it under the terms of the GNU General Public License as published by
3449 the Free Software Foundation, either version 3 of the License, or
3450 (at your option) any later version.
3451
3452 GNU Emacs is distributed in the hope that it will be useful,
3453 but WITHOUT ANY WARRANTY; without even the implied warranty of
3454 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3455 GNU General Public License for more details.
3456
3457 You should have received a copy of the GNU General Public License
3458 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
3459
3460
3461 /* No code in Emacs #includes config.h twice, but some bits of code
3462 intended to work with other packages as well (like gmalloc.c)
3463 think they can include it as many times as they like. */
3464 #ifndef EMACS_CONFIG_H
3465 #define EMACS_CONFIG_H
3466 ])dnl
3467
3468 AH_BOTTOM([
3469 /* Define AMPERSAND_FULL_NAME if you use the convention
3470 that & in the full name stands for the login id. */
3471 /* Turned on June 1996 supposing nobody will mind it. */
3472 #define AMPERSAND_FULL_NAME
3473
3474 /* If using GNU, then support inline function declarations. */
3475 /* Don't try to switch on inline handling as detected by AC_C_INLINE
3476 generally, because even if non-gcc compilers accept `inline', they
3477 may reject `extern inline'. */
3478 #if defined (__GNUC__) && defined (OPTIMIZE)
3479 #define INLINE __inline__
3480 #else
3481 #define INLINE
3482 #endif
3483
3484 /* `subprocesses' should be defined if you want to
3485 have code for asynchronous subprocesses
3486 (as used in M-x compile and M-x shell).
3487 Only MSDOS does not support this (it overrides
3488 this in its config_opsysfile below). */
3489
3490 #define subprocesses
3491
3492 /* Include the os and machine dependent files. */
3493 #include config_opsysfile
3494 #include config_machfile
3495
3496 /* Set up some defines, C and LD flags for NeXTstep interface on GNUstep.
3497 (There is probably a better place to do this, but right now the Cocoa
3498 side does this in s/darwin.h and we cannot
3499 parallel this exactly since GNUstep is multi-OS. */
3500 #ifdef HAVE_NS
3501 # ifdef NS_IMPL_GNUSTEP
3502 /* GNUstep needs a bit more pure memory. Of the existing knobs,
3503 SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems. */
3504 # define SYSTEM_PURESIZE_EXTRA 30000
3505 # endif /* NS_IMPL_GNUSTEP */
3506 #endif /* HAVE_NS */
3507
3508 /* SIGTYPE is the macro we actually use. */
3509 #ifndef SIGTYPE
3510 #define SIGTYPE RETSIGTYPE
3511 #endif
3512
3513 #ifdef emacs /* Don't do this for lib-src. */
3514 /* Tell regex.c to use a type compatible with Emacs. */
3515 #define RE_TRANSLATE_TYPE Lisp_Object
3516 #define RE_TRANSLATE(TBL, C) CHAR_TABLE_TRANSLATE (TBL, C)
3517 #ifdef make_number
3518 /* If make_number is a macro, use it. */
3519 #define RE_TRANSLATE_P(TBL) (!EQ (TBL, make_number (0)))
3520 #else
3521 /* If make_number is a function, avoid it. */
3522 #define RE_TRANSLATE_P(TBL) (!(INTEGERP (TBL) && XINT (TBL) == 0))
3523 #endif
3524 #endif
3525
3526 /* Avoid link-time collision with system mktime if we will use our own. */
3527 #if ! HAVE_MKTIME || BROKEN_MKTIME
3528 #define mktime emacs_mktime
3529 #endif
3530
3531 #define my_strftime nstrftime /* for strftime.c */
3532
3533 /* Some of the files of Emacs which are intended for use with other
3534 programs assume that if you have a config.h file, you must declare
3535 the type of getenv. */
3536 extern char *getenv ();
3537
3538 /* These default definitions are good for almost all machines.
3539 The exceptions override them in m/MACHINE.h. */
3540
3541 #ifndef BITS_PER_CHAR
3542 #define BITS_PER_CHAR 8
3543 #endif
3544
3545 #ifndef BITS_PER_SHORT
3546 #define BITS_PER_SHORT 16
3547 #endif
3548
3549 /* Note that lisp.h uses this in a preprocessor conditional, so it
3550 would not work to use sizeof. That being so, we do all of them
3551 without sizeof, for uniformity's sake. */
3552 #ifndef BITS_PER_INT
3553 #define BITS_PER_INT 32
3554 #endif
3555
3556 #ifndef BITS_PER_LONG
3557 #ifdef _LP64
3558 #define BITS_PER_LONG 64
3559 #else
3560 #define BITS_PER_LONG 32
3561 #endif
3562 #endif
3563
3564 /* Define if the compiler supports function prototypes. It may do so but
3565 not define __STDC__ (e.g. DEC C by default) or may define it as zero. */
3566 #undef PROTOTYPES
3567 /* For mktime.c: */
3568 #ifndef __P
3569 # if defined PROTOTYPES
3570 # define __P(args) args
3571 # else
3572 # define __P(args) ()
3573 # endif /* GCC. */
3574 #endif /* __P */
3575
3576 #ifdef HAVE_STRING_H
3577 #include <string.h>
3578 #endif
3579
3580 #ifdef HAVE_STRINGS_H
3581 #include <strings.h> /* May be needed for bcopy & al. */
3582 #endif
3583
3584 #ifdef HAVE_STDLIB_H
3585 #include <stdlib.h>
3586 #endif
3587
3588 #ifdef HAVE_ALLOCA_H
3589 # include <alloca.h>
3590 #elif defined __GNUC__
3591 # define alloca __builtin_alloca
3592 #elif defined _AIX
3593 # define alloca __alloca
3594 #else
3595 # include <stddef.h>
3596 # ifdef __cplusplus
3597 extern "C"
3598 # endif
3599 void *alloca (size_t);
3600 #endif
3601
3602 #ifndef HAVE_SIZE_T
3603 typedef unsigned size_t;
3604 #endif
3605
3606 #if defined __GNUC__ && (__GNUC__ > 2 \
3607 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
3608 #define NO_RETURN __attribute__ ((__noreturn__))
3609 #else
3610 #define NO_RETURN /* nothing */
3611 #endif
3612
3613 /* These won't be used automatically yet. We also need to know, at least,
3614 that the stack is continuous. */
3615 #ifdef __GNUC__
3616 # ifndef GC_SETJMP_WORKS
3617 /* GC_SETJMP_WORKS is nearly always appropriate for GCC. */
3618 # define GC_SETJMP_WORKS 1
3619 # endif
3620 # ifndef GC_LISP_OBJECT_ALIGNMENT
3621 # define GC_LISP_OBJECT_ALIGNMENT (__alignof__ (Lisp_Object))
3622 # endif
3623 #endif
3624
3625 #ifndef HAVE_BCOPY
3626 #define bcopy(a,b,s) memcpy (b,a,s)
3627 #endif
3628 #ifndef HAVE_BZERO
3629 #define bzero(a,s) memset (a,0,s)
3630 #endif
3631 #ifndef HAVE_BCMP
3632 #define BCMP memcmp
3633 #endif
3634
3635 #endif /* EMACS_CONFIG_H */
3636
3637 /*
3638 Local Variables:
3639 mode: c
3640 End:
3641 */
3642 ])dnl
3643
3644 #### Report on what we decided to do.
3645 #### Report GTK as a toolkit, even if it doesn't use Xt.
3646 #### It makes printing result more understandable as using GTK sets
3647 #### toolkit_scroll_bars to yes by default.
3648 if test "${HAVE_GTK}" = "yes"; then
3649 USE_X_TOOLKIT=GTK
3650 fi
3651
3652 echo "
3653 Configured for \`${canonical}'.
3654
3655 Where should the build process find the source code? ${srcdir}
3656 What operating system and machine description files should Emacs use?
3657 \`${opsysfile}' and \`${machfile}'
3658 What compiler should emacs be built with? ${CC} ${CFLAGS}
3659 Should Emacs use the GNU version of malloc? ${GNU_MALLOC}${GNU_MALLOC_reason}
3660 Should Emacs use a relocating allocator for buffers? ${REL_ALLOC}
3661 Should Emacs use mmap(2) for buffer allocation? $use_mmap_for_buffers
3662 What window system should Emacs use? ${window_system}
3663 What toolkit should Emacs use? ${USE_X_TOOLKIT}"
3664
3665 if test -n "${x_includes}"; then
3666 echo " Where do we find X Windows header files? ${x_includes}"
3667 else
3668 echo " Where do we find X Windows header files? Standard dirs"
3669 fi
3670 if test -n "${x_libraries}"; then
3671 echo " Where do we find X Windows libraries? ${x_libraries}"
3672 else
3673 echo " Where do we find X Windows libraries? Standard dirs"
3674 fi
3675
3676 echo " Does Emacs use -lXaw3d? ${HAVE_XAW3D}"
3677 echo " Does Emacs use -lXpm? ${HAVE_XPM}"
3678 echo " Does Emacs use -ljpeg? ${HAVE_JPEG}"
3679 echo " Does Emacs use -ltiff? ${HAVE_TIFF}"
3680 echo " Does Emacs use a gif library? ${HAVE_GIF} $LIBGIF"
3681 echo " Does Emacs use -lpng? ${HAVE_PNG}"
3682 echo " Does Emacs use -lrsvg-2? ${HAVE_RSVG}"
3683 echo " Does Emacs use -lgpm? ${HAVE_GPM}"
3684 echo " Does Emacs use -ldbus? ${HAVE_DBUS}"
3685 echo " Does Emacs use -lgconf? ${HAVE_GCONF}"
3686 echo " Does Emacs use -lselinux? ${HAVE_LIBSELINUX}"
3687
3688 echo " Does Emacs use -lfreetype? ${HAVE_FREETYPE}"
3689 echo " Does Emacs use -lm17n-flt? ${HAVE_M17N_FLT}"
3690 echo " Does Emacs use -lotf? ${HAVE_LIBOTF}"
3691 echo " Does Emacs use -lxft? ${HAVE_XFT}"
3692
3693 echo " Does Emacs use toolkit scroll bars? ${USE_TOOLKIT_SCROLL_BARS}"
3694 echo
3695
3696 if test $USE_XASSERTS = yes; then
3697 echo " Compiling with asserts turned on."
3698 CPPFLAGS="$CPPFLAGS -DXASSERTS=1"
3699 fi
3700
3701 echo
3702
3703 if test "$HAVE_NS" = "yes"; then
3704 echo
3705 echo "You must run \"make install\" in order to test the built application.
3706 The installed application will go to nextstep/Emacs.app and can be
3707 run or moved from there."
3708 if test "$EN_NS_SELF_CONTAINED" = "yes"; then
3709 echo "The application will be fully self-contained."
3710 else
3711 echo "The lisp resources for the application will be installed under ${prefix}.
3712 You may need to run \"make install\" with sudo. The application will fail
3713 to run if these resources are not installed."
3714 fi
3715 echo
3716 fi
3717
3718 if test "$HAVE_DBUS" = yes && test "${opsys}" != "gnu-linux"; then
3719 echo "D-Bus integration has been tested for GNU/Linux only."
3720 echo
3721 fi
3722
3723
3724 # Remove any trailing slashes in these variables.
3725 [test "${prefix}" != NONE &&
3726 prefix=`echo "${prefix}" | sed 's,\([^/]\)/*$,\1,'`
3727 test "${exec_prefix}" != NONE &&
3728 exec_prefix=`echo "${exec_prefix}" | sed 's,\([^/]\)/*$,\1,'`]
3729
3730 dnl You might wonder (I did) why epaths.h is generated by running make,
3731 dnl rather than just letting configure generate it from epaths.in.
3732 dnl One reason is that the various paths are not fully expanded (see above);
3733 dnl eg gamedir=${prefix}/var/games/emacs.
3734 dnl Secondly, the GNU Coding standards require that one should be able
3735 dnl to run `make prefix=/some/where/else' and override the values set
3736 dnl by configure. This also explains the `move-if-change' test and
3737 dnl the use of force in the `epaths-force' rule in Makefile.in.
3738 AC_OUTPUT(Makefile lib-src/Makefile oldXMenu/Makefile \
3739 doc/emacs/Makefile doc/misc/Makefile doc/lispintro/Makefile \
3740 doc/lispref/Makefile src/Makefile \
3741 lwlib/Makefile lisp/Makefile leim/Makefile, [
3742
3743 ### Make the necessary directories, if they don't exist.
3744 for dir in etc lisp ; do
3745 test -d ${dir} || mkdir ${dir}
3746 done
3747
3748 echo creating src/epaths.h
3749 ${MAKE-make} epaths-force
3750
3751 if test ! -f src/.gdbinit && test -f $srcdir/src/.gdbinit; then
3752 echo creating src/.gdbinit
3753 echo source $srcdir/src/.gdbinit > src/.gdbinit
3754 fi
3755
3756 ], [GCC="$GCC" NON_GNU_CPP="$NON_GNU_CPP" CPP="$CPP" CPPFLAGS="$CPPFLAGS"])
3757
3758 m4_if(dnl Do not change this comment
3759 arch-tag: 156a4dd5-bddc-4d18-96ac-f37742cf6a5e
3760 )dnl