Correct usage of OPTION_DEFAULT_ON, OPTION_DEFAULT_OFF so that the
[bpt/emacs.git] / 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
6 dnl Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2003,
7 dnl 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
8 dnl
9 dnl This file is part of GNU Emacs.
10 dnl
11 dnl GNU Emacs is free software; you can redistribute it and/or modify
12 dnl it under the terms of the GNU General Public License as published by
13 dnl the Free Software Foundation; either version 3, or (at your option)
14 dnl any later version.
15 dnl
16 dnl GNU Emacs is distributed in the hope that it will be useful,
17 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
18 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 dnl GNU General Public License for more details.
20 dnl
21 dnl You should have received a copy of the GNU General Public License
22 dnl along with GNU Emacs; see the file COPYING. If not, write to the
23 dnl Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 dnl Boston, MA 02110-1301, USA.
25
26 AC_PREREQ(2.61)dnl
27 AC_INIT(emacs, 23.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 lispdir='${datadir}/emacs/${version}/lisp'
36 locallisppath='${datadir}/emacs/${version}/site-lisp:'\
37 '${datadir}/emacs/site-lisp'
38 lisppath='${locallisppath}:${lispdir}:${datadir}/emacs/${version}/leim'
39 etcdir='${datadir}/emacs/${version}/etc'
40 archlibdir='${libexecdir}/emacs/${version}/${configuration}'
41 docdir='${datadir}/emacs/${version}/etc'
42 gamedir='${localstatedir}/games/emacs'
43
44 gameuser=games
45
46 dnl OPTION_DEFAULT_OFF(NAME, HELP-STRING)
47 dnl Create a new --with option that defaults to being disabled.
48 dnl NAME is the base name of the option. The shell variable with_NAME
49 dnl will be set to either the user's value (if the option is
50 dnl specified; 'yes' for a plain --with-NAME) or to 'no' (if the
51 dnl option is not specified). Note that the shell variable name is
52 dnl constructed as autoconf does, by replacing non-alphanumeric
53 dnl characters with "_".
54 dnl HELP-STRING is the help text for the option.
55 AC_DEFUN([OPTION_DEFAULT_OFF], [dnl
56 AC_ARG_WITH([$1],[AS_HELP_STRING([--with-$1],[$2])],[],[dnl
57 m4_bpatsubst([with_$1], [[^0-9a-z]], [_])=no])dnl
58 ])dnl
59
60 dnl OPTION_DEFAULT_ON(NAME, HELP-STRING)
61 dnl Create a new --with option that defaults to being enabled. NAME
62 dnl is the base name of the option. The shell variable with_NAME
63 dnl will be set either to 'no' (for a plain --without-NAME) or to
64 dnl 'yes' (if the option is not specified). Note that the shell
65 dnl variable name is constructed as autoconf does, by replacing
66 dnl non-alphanumeric characters with "_".
67 dnl HELP-STRING is the help text for the option.
68 AC_DEFUN([OPTION_DEFAULT_ON], [dnl
69 AC_ARG_WITH([$1],[AS_HELP_STRING([--without-$1],[$2])],[],[dnl
70 m4_bpatsubst([with_$1], [[^0-9a-z]], [_])=yes])dnl
71 ])dnl
72
73 OPTION_DEFAULT_ON([gcc],[don't use GCC to compile Emacs if GCC is found])
74
75 OPTION_DEFAULT_ON([pop],[don't support POP mail retrieval with movemail])
76 if test "$with_pop" = yes; then
77 AC_DEFINE(MAIL_USE_POP)
78 fi
79 AH_TEMPLATE(MAIL_USE_POP, [Define to support POP mail retrieval.])dnl
80
81 OPTION_DEFAULT_OFF([kerberos],[support Kerberos-authenticated POP])
82 if test "$with_kerberos" = yes; then
83 AC_DEFINE(KERBEROS)
84 fi
85 AH_TEMPLATE(KERBEROS,
86 [Define to support Kerberos-authenticated POP mail retrieval.])dnl
87
88 OPTION_DEFAULT_OFF([kerberos5],[support Kerberos version 5 authenticated POP])
89 if test "${with_kerberos5}" = yes; then
90 if test "${with_kerberos}" != yes; then
91 with_kerberos=yes
92 AC_DEFINE(KERBEROS)
93 fi
94 AC_DEFINE(KERBEROS5, 1, [Define to use Kerberos 5 instead of Kerberos 4.])
95 fi
96
97 OPTION_DEFAULT_OFF([hesiod],[support Hesiod to get the POP server host])
98 if test "$with_hesiod" = yes; then
99 AC_DEFINE(HESIOD, 1, [Define to support using a Hesiod database to find the POP server.])
100 fi
101
102 OPTION_DEFAULT_ON([sound],[don't compile with sound support])
103
104 dnl FIXME currently it is not the last.
105 dnl This should be the last --with option, because --with-x is
106 dnl added later on when we find the path of X, and it's best to
107 dnl keep them together visually.
108 AC_ARG_WITH([x-toolkit],[AS_HELP_STRING([--with-x-toolkit=KIT],
109 [use an X toolkit (KIT one of: yes, lucid, athena, motif, gtk, no)])],
110 [ case "${withval}" in
111 y | ye | yes ) val=gtk ;;
112 n | no ) val=no ;;
113 l | lu | luc | luci | lucid ) val=lucid ;;
114 a | at | ath | athe | athen | athena ) val=athena ;;
115 m | mo | mot | moti | motif ) val=motif ;;
116 g | gt | gtk ) val=gtk ;;
117 * )
118 AC_MSG_ERROR([`--with-x-toolkit=$withval' is invalid;
119 this option's value should be `yes', `no', `lucid', `athena', `motif' or `gtk'.
120 `yes' and `gtk' are synonyms. `athena' and `lucid' are synonyms.])
121 ;;
122 esac
123 with_x_toolkit=$val
124 ])
125
126 dnl _ON results in a '--without' option in the --help output, so
127 dnl the help text should refer to "don't compile", etc.
128 OPTION_DEFAULT_ON([xpm],[don't compile with XPM image support])
129 OPTION_DEFAULT_ON([jpeg],[don't compile with JPEG image support])
130 OPTION_DEFAULT_ON([tiff],[don't compile with TIFF image support])
131 OPTION_DEFAULT_ON([gif],[don't compile with GIF image support])
132 OPTION_DEFAULT_ON([png],[don't compile with PNG image support])
133 OPTION_DEFAULT_ON([rsvg],[don't compile with SVG image support])
134
135 OPTION_DEFAULT_OFF([gtk],[use GTK toolkit])
136 OPTION_DEFAULT_ON([toolkit-scroll-bars],[don't use Motif or Xaw3d scroll bars])
137 OPTION_DEFAULT_ON([xaw3d],[don't use Xaw3d])
138 OPTION_DEFAULT_ON([xim],[don't use X11 XIM])
139 OPTION_DEFAULT_OFF([carbon],[use Carbon GUI on Mac OS X. **UNSUPPORTED!**])
140
141 OPTION_DEFAULT_ON([gpm],[don't use -lgpm for mouse support on a GNU/Linux console])
142 OPTION_DEFAULT_OFF([dbus],[compile with D-Bus support])
143
144
145 AC_ARG_WITH([pkg-config-prog],dnl
146 [AS_HELP_STRING([--with-pkg-config-prog=PATH],
147 [Path to pkg-config for finding GTK and librsvg])])
148 if test "X${with_pkg_config_prog}" != X; then
149 if test "${with_pkg_config_prog}" != yes; then
150 PKG_CONFIG="${with_pkg_config_prog}"
151 fi
152 fi
153
154 AC_ARG_ENABLE(carbon-app,
155 [AS_HELP_STRING([--enable-carbon-app@<:@=DIR@:>@],
156 [specify install directory for Emacs.app on Mac OS X
157 [DIR=/Application]])],
158 [ carbon_appdir_x=${enableval}])
159
160 AC_ARG_ENABLE(asserts,
161 [AS_HELP_STRING([--enable-asserts], [compile code with asserts enabled])],
162 USE_XASSERTS=$enableval,
163 USE_XASSERTS=no)
164
165 AC_ARG_ENABLE(maintainer-mode,
166 [AS_HELP_STRING([--enable-maintainer-mode],
167 [enable make rules and dependencies not useful (and sometimes
168 confusing) to the casual installer])],
169 USE_MAINTAINER_MODE=$enableval,
170 USE_MAINTAINER_MODE=no)
171 if test $USE_MAINTAINER_MODE = yes; then
172 MAINT=
173 else
174 MAINT=#
175 fi
176 AC_SUBST(MAINT)
177
178 AC_ARG_ENABLE(locallisppath,
179 [AS_HELP_STRING([--enable-locallisppath=PATH],
180 [directories Emacs should search for lisp files specific
181 to this site])],
182 if test "${enableval}" = "no"; then
183 locallisppath=
184 elif test "${enableval}" != "yes"; then
185 locallisppath=${enableval}
186 fi)
187
188 #### Make srcdir absolute, if it isn't already. It's important to
189 #### avoid running the path through pwd unnecessarily, since pwd can
190 #### give you automounter prefixes, which can go away. We do all this
191 #### so Emacs can find its files when run uninstalled.
192 ## Make sure CDPATH doesn't affect cd (in case PWD is relative).
193 unset CDPATH
194 case "${srcdir}" in
195 /* ) ;;
196 . )
197 ## We may be able to use the $PWD environment variable to make this
198 ## absolute. But sometimes PWD is inaccurate.
199 ## Note: we used to use ${PWD} at the end instead of `pwd`,
200 ## but that tested only for a well-formed and valid PWD,
201 ## it did not object when PWD was well-formed and valid but just wrong.
202 if test ".${PWD}" != "." && test ".`(cd ${PWD} ; sh -c pwd)`" = ".`pwd`" ;
203 then
204 srcdir="$PWD"
205 else
206 srcdir="`(cd ${srcdir}; pwd)`"
207 fi
208 ;;
209 * ) srcdir="`(cd ${srcdir}; pwd)`" ;;
210 esac
211
212 #### Check if the source directory already has a configured system in it.
213 if test `pwd` != `(cd ${srcdir} && pwd)` \
214 && test -f "${srcdir}/src/config.h" ; then
215 AC_MSG_WARN([[The directory tree `${srcdir}' is being used
216 as a build directory right now; it has been configured in its own
217 right. To configure in another directory as well, you MUST
218 use GNU make. If you do not have GNU make, then you must
219 now do `make distclean' in ${srcdir},
220 and then run $0 again.]])
221 fi
222
223 #### Given the configuration name, set machfile and opsysfile to the
224 #### names of the m/*.h and s/*.h files we should use.
225
226 ### Canonicalize the configuration name.
227
228 AC_CANONICAL_HOST
229 canonical=$host
230 configuration=${host_alias-${build_alias-$host}}
231
232 dnl This used to use changequote, but, apart from `changequote is evil'
233 dnl per the autoconf manual, we can speed up autoconf somewhat by quoting
234 dnl the great gob of text. Thus it's not processed for possible expansion.
235 dnl Just make sure the brackets remain balanced.
236 dnl
237 dnl Since Emacs can't find matching pairs of quotes, boundaries are
238 dnl indicated by comments.
239 dnl quotation begins
240 [
241
242 ### If you add support for a new configuration, add code to this
243 ### switch statement to recognize your configuration name and select
244 ### the appropriate operating system and machine description files.
245
246 ### You would hope that you could choose an m/*.h file pretty much
247 ### based on the machine portion of the configuration name, and an s-
248 ### file based on the operating system portion. However, it turns out
249 ### that each m/*.h file is pretty manufacturer-specific - for
250 ### example hp9000s300.h is a 68000 machine;
251 ### mips.h, pmax.h are all MIPS
252 ### machines. So we basically have to have a special case for each
253 ### configuration name.
254 ###
255 ### As far as handling version numbers on operating systems is
256 ### concerned, make sure things will fail in a fixable way. If
257 ### /etc/MACHINES doesn't say anything about version numbers, be
258 ### prepared to handle anything reasonably. If version numbers
259 ### matter, be sure /etc/MACHINES says something about it.
260 ###
261 ### Eric Raymond says we should accept strings like "sysvr4" to mean
262 ### "System V Release 4"; he writes, "The old convention encouraged
263 ### confusion between `system' and `release' levels'."
264
265 machine='' opsys='' unported=no
266 case "${canonical}" in
267
268 ## FreeBSD ports
269 *-*-freebsd* )
270 opsys=freebsd
271 case "${canonical}" in
272 alpha*-*-freebsd*) machine=alpha ;;
273 ia64-*-freebsd*) machine=ia64 ;;
274 sparc64-*-freebsd*) machine=sparc ;;
275 powerpc-*-freebsd*) machine=macppc ;;
276 i[3456]86-*-freebsd*) machine=intel386 ;;
277 amd64-*-freebsd*|x86_64-*-freebsd*) machine=amdx86-64 ;;
278 esac
279 ;;
280
281 ## FreeBSD kernel + glibc based userland
282 *-*-kfreebsd*gnu* )
283 opsys=gnu-kfreebsd
284 case "${canonical}" in
285 alpha*-*-kfreebsd*) machine=alpha ;;
286 ia64-*-kfreebsd*) machine=ia64 ;;
287 sparc64-*-kfreebsd*) machine=sparc ;;
288 powerpc-*-kfreebsd*) machine=macppc ;;
289 i[3456]86-*-kfreebsd*) machine=intel386 ;;
290 amd64-*-kfreebsd*|x86_64-*-kfreebsd*) machine=amdx86-64 ;;
291 esac
292 ;;
293
294 ## NetBSD ports
295 *-*-netbsd* )
296 opsys=netbsd
297 if test -f /usr/lib/crti.o; then]
298 dnl The close and open brackets here are because this section is quoted --
299 dnl see the `changequote' comment above.
300 AC_DEFINE(HAVE_CRTIN, [], [Define to 1 if you have /usr/lib/crti.o.])
301 [ fi
302
303 case "${canonical}" in
304 alpha*-*-netbsd*) machine=alpha ;;
305 i[3456]86-*-netbsd*) machine=intel386 ;;
306 m68k-*-netbsd*)
307 # This is somewhat bogus.
308 machine=hp9000s300 ;;
309 mips-*-netbsd*) machine=pmax ;;
310 mipsel-*-netbsd*) machine=pmax ;;
311 mipseb-*-netbsd*) machine=pmax ;;
312 powerpc-*-netbsd*) machine=macppc ;;
313 sparc*-*-netbsd*) machine=sparc ;;
314 vax-*-netbsd*) machine=vax ;;
315 arm-*-netbsd*) machine=arm ;;
316 x86_64-*-netbsd*) machine=amdx86-64 ;;
317 hppa-*-netbsd*) machine=hp800 ;;
318 esac
319 ;;
320
321 ## OpenBSD ports
322 *-*-openbsd* )
323 opsys=openbsd
324 case "${canonical}" in
325 alpha*-*-openbsd*) machine=alpha ;;
326 arm-*-openbsd*) machine=arm ;;
327 hppa-*-openbsd*) machine=hp9000s300 ;;
328 i386-*-openbsd*) machine=intel386 ;;
329 m68k-*-openbsd*) machine=hp9000s300 ;;
330 mips64-*-openbsd*) machine=mips64 ;;
331 powerpc-*-openbsd*) machine=macppc ;;
332 sparc*-*-openbsd*) machine=sparc ;;
333 vax-*-openbsd*) machine=vax ;;
334 x86_64-*-openbsd*) machine=amdx86-64 ;;
335 esac
336 ;;
337
338 ## LynxOS ports
339 *-*-lynxos* )
340 opsys=lynxos
341 case "${canonical}" in
342 i[3456]86-*-lynxos*) machine=intel386 ;;
343 powerpc-*-lynxos*) machine=powerpc ;;
344 esac
345 ;;
346
347 ## BSDI ports
348 *-*-bsdi* )
349 opsys=bsdi
350 case "${canonical}" in
351 i[345]86-*-bsdi*) machine=intel386 ;;
352 sparc-*-bsdi*) machine=sparc ;;
353 powerpc-*-bsdi*) machine=macppc ;;
354 esac
355 case "${canonical}" in
356 *-*-bsd386* | *-*-bsdi1* ) opsys=bsd386 ;;
357 *-*-bsdi2.0* ) opsys=bsdos2 ;;
358 *-*-bsdi2* ) opsys=bsdos2-1 ;;
359 *-*-bsdi3* ) opsys=bsdos3 ;;
360 *-*-bsdi[45]* ) opsys=bsdos4 ;;
361 esac
362 ;;
363
364 ## Alpha (DEC) machines.
365 alpha*-dec-osf* )
366 machine=alpha opsys=osf1
367 # This is needed to find X11R6.1 libraries for certain tests.
368 NON_GCC_LINK_TEST_OPTIONS=-Wl,-rpath,/usr/X11R6/lib
369 GCC_LINK_TEST_OPTIONS=-Wl,-rpath,/usr/X11R6/lib
370 # NON_GNU_CPP is necessary on 5.0 to avoid mangling src/Makefile
371 # due to non-traditional preprocessing with the current compiler
372 # defaults. OSF 4 can also have that compiler version, and there
373 # seems always to have been a usable /usr/bin/cpp.
374 NON_GNU_CPP=/usr/bin/cpp
375 case "${canonical}" in
376 alpha*-dec-osf[5-9]*)
377 opsys=osf5-0 ;;
378 esac
379 ;;
380
381 alpha*-*-linux-gnu* )
382 machine=alpha opsys=gnu-linux
383 ;;
384
385 arm*-*-linux-gnu* )
386 machine=arm opsys=gnu-linux
387 ;;
388
389 ## Apple Darwin / Mac OS X
390 *-apple-darwin* )
391 case "${canonical}" in
392 i[3456]86-* ) machine=intel386 ;;
393 powerpc-* ) machine=powermac ;;
394 * ) unported=yes ;;
395 esac
396 opsys=darwin
397 # Define CPP as follows to make autoconf work correctly.
398 CPP="${CC-cc} -E -no-cpp-precomp"
399 # Use fink packages if available.
400 if test -d /sw/include && test -d /sw/lib; then
401 GCC_TEST_OPTIONS="-I/sw/include -L/sw/lib"
402 CPP="${CPP} ${GCC_TEST_OPTIONS}"
403 NON_GCC_TEST_OPTIONS=${GCC_TEST_OPTIONS}
404 fi
405 ;;
406
407 ## Compaq Nonstop
408 mips-compaq-nonstopux* )
409 machine=nonstopux opsys=nonstopux
410 ;;
411
412 ## Cubix QBx/386
413 i[3456]86-cubix-sysv* )
414 machine=intel386 opsys=usg5-3
415 ;;
416
417 mips-dec-ultrix[0-3].* | mips-dec-ultrix4.0* | mips-dec-bsd4.2* )
418 machine=pmax opsys=bsd4-2
419 ;;
420 mips-dec-ultrix4.[12]* | mips-dec-bsd* )
421 machine=pmax opsys=bsd4-3
422 ;;
423 mips-dec-ultrix* )
424 machine=pmax opsys=ultrix4-3
425 ;;
426 mips-dec-osf* )
427 machine=pmax opsys=osf1
428 ;;
429 mips-dec-mach_bsd4.3* )
430 machine=pmax opsys=mach-bsd4-3
431 ;;
432
433 ## HP 9000 series 200 or 300
434 m68*-hp-bsd* )
435 machine=hp9000s300 opsys=bsd4-3
436 ;;
437 ## HP/UX 7, 8, 9, and 10 are supported on these machines.
438 m68*-hp-hpux* )
439 case "`uname -r`" in
440 ## Someone's system reports A.B8.05 for this.
441 ## I wonder what other possibilities there are.
442 *.B8.* ) machine=hp9000s300 opsys=hpux8 ;;
443 *.08.* ) machine=hp9000s300 opsys=hpux8 ;;
444 *.09.* ) machine=hp9000s300 opsys=hpux9 ;;
445 *.1[0-9].* ) machine=hp9000s300 opsys=hpux9shr ;;
446 *) machine=hp9000s300 opsys=hpux ;;
447 esac
448 ;;
449
450 ## HP 9000 series 700 and 800, running HP/UX
451 hppa*-hp-hpux7* )
452 machine=hp800 opsys=hpux
453 ;;
454 hppa*-hp-hpux8* )
455 machine=hp800 opsys=hpux8
456 ;;
457 hppa*-hp-hpux9shr* )
458 machine=hp800 opsys=hpux9shr
459 ;;
460 hppa*-hp-hpux9* )
461 machine=hp800 opsys=hpux9
462 ;;
463 hppa*-hp-hpux10.2* )
464 machine=hp800 opsys=hpux10-20
465 ;;
466 hppa*-hp-hpux10* )
467 machine=hp800 opsys=hpux10
468 ;;
469 hppa*-hp-hpux1[1-9]* )
470 machine=hp800 opsys=hpux11
471 CFLAGS="-D_INCLUDE__STDC_A1_SOURCE $CFLAGS"
472 ;;
473
474 hppa*-*-linux-gnu* )
475 machine=hp800 opsys=gnu-linux
476 ;;
477
478 ## HP 9000 series 700 and 800, running HP/UX
479 hppa*-hp-hpux* )
480 ## Cross-compilation? Nah!
481 case "`uname -r`" in
482 ## Someone's system reports A.B8.05 for this.
483 ## I wonder what other possibilities there are.
484 *.B8.* ) machine=hp800 opsys=hpux8 ;;
485 *.08.* ) machine=hp800 opsys=hpux8 ;;
486 *.09.* ) machine=hp800 opsys=hpux9 ;;
487 *) machine=hp800 opsys=hpux10 ;;
488 esac
489 ;;
490 hppa*-*-nextstep* )
491 machine=hp800 opsys=nextstep
492 ;;
493
494 ## IBM machines
495 i370-ibm-aix*)
496 machine=ibm370aix opsys=usg5-3
497 ;;
498 s390-*-linux-gnu* )
499 machine=ibms390 opsys=gnu-linux
500 ;;
501 s390x-*-linux-gnu* )
502 machine=ibms390x opsys=gnu-linux
503 ;;
504 rs6000-ibm-aix3.1* | powerpc-ibm-aix3.1* )
505 machine=ibmrs6000 opsys=aix3-1
506 ;;
507 rs6000-ibm-aix3.2.5 | powerpc-ibm-aix3.2.5 )
508 machine=ibmrs6000 opsys=aix3-2-5
509 ;;
510 rs6000-ibm-aix4.1* | powerpc-ibm-aix4.1* )
511 machine=ibmrs6000 opsys=aix4-1
512 ;;
513 rs6000-ibm-aix4.2* | powerpc-ibm-aix4.2* )
514 machine=ibmrs6000 opsys=aix4-2
515 ;;
516 rs6000-ibm-aix4.3* | powerpc-ibm-aix4.3* )
517 machine=ibmrs6000 opsys=aix4-2
518 ;;
519 rs6000-ibm-aix5* | powerpc-ibm-aix5* )
520 machine=ibmrs6000 opsys=aix4-2
521 ;;
522 rs6000-ibm-aix4.0* | powerpc-ibm-aix4.0* )
523 machine=ibmrs6000 opsys=aix4
524 ;;
525 rs6000-ibm-aix4* | powerpc-ibm-aix4* )
526 machine=ibmrs6000 opsys=aix4-1
527 ;;
528 rs6000-ibm-aix* | powerpc-ibm-aix* )
529 machine=ibmrs6000 opsys=aix3-2
530 ;;
531
532 ## Prime EXL
533 i[3456]86-prime-sysv* )
534 machine=i386 opsys=usg5-3
535 ;;
536
537 ## ncr machine running svr4.3.
538 i[3456]86-ncr-sysv4.3 )
539 machine=ncr386 opsys=usg5-4-3
540 ;;
541
542 ## Unspecified sysv on an ncr machine defaults to svr4.2.
543 ## (Plain usg5-4 doesn't turn on POSIX signals, which we need.)
544 i[3456]86-ncr-sysv* )
545 machine=ncr386 opsys=usg5-4-2
546 ;;
547
548 ## Macintosh PowerPC
549 powerpc*-*-linux-gnu* )
550 machine=macppc opsys=gnu-linux
551 ;;
552
553 ## Workstations sold by MIPS
554 ## This is not necessarily all workstations using the MIPS processor -
555 ## Irises are produced by SGI, and DECstations by DEC.
556
557 ## etc/MACHINES lists mips.h and mips4.h as possible machine files,
558 ## and usg5-2-2 and bsd4-3 as possible OS files. The only guidance
559 ## it gives for choosing between the alternatives seems to be "Use
560 ## -machine=mips4 for RISCOS version 4; use -opsystem=bsd4-3 with
561 ## the BSD world." I'll assume that these are instructions for
562 ## handling two odd situations, and that every other situation
563 ## should use mips.h and usg5-2-2, they being listed first.
564 mips-mips-usg* )
565 machine=mips4
566 ## Fall through to the general code at the bottom to decide on the OS.
567 ;;
568 mips-mips-riscos4* )
569 machine=mips4 opsys=bsd4-3
570 NON_GNU_CC="cc -systype bsd43"
571 NON_GNU_CPP="cc -systype bsd43 -E"
572 ;;
573 mips-mips-riscos5* )
574 machine=mips4 opsys=riscos5
575 NON_GNU_CC="cc -systype bsd43"
576 NON_GNU_CPP="cc -systype bsd43 -E"
577 ;;
578 mips-mips-bsd* )
579 machine=mips opsys=bsd4-3
580 ;;
581 mips-mips-* )
582 machine=mips opsys=usg5-2-2
583 ;;
584
585 ## NeXT
586 m68*-next-* | m68k-*-nextstep* )
587 machine=m68k opsys=nextstep
588 ;;
589
590 ## NEC EWS4800
591 mips-nec-sysv4*)
592 machine=ews4800 opsys=ux4800
593 ;;
594
595 ## Siemens Nixdorf
596 mips-siemens-sysv* | mips-sni-sysv*)
597 machine=mips-siemens opsys=usg5-4
598 NON_GNU_CC=/usr/ccs/bin/cc
599 NON_GNU_CPP=/usr/ccs/lib/cpp
600 ;;
601
602 ## Silicon Graphics machines
603 ## Iris 4D
604 mips-sgi-irix6.5 )
605 machine=iris4d opsys=irix6-5
606 # Without defining _LANGUAGE_C, things get masked out in the headers
607 # so that, for instance, grepping for `free' in stdlib.h fails and
608 # AC_HEADER_STD_C fails. (MIPSPro 7.2.1.2m compilers, Irix 6.5.3m).
609 NON_GNU_CPP="/lib/cpp -D_LANGUAGE_C"
610 NON_GCC_TEST_OPTIONS="-D_LANGUAGE_C"
611 ;;
612 mips-sgi-irix6* )
613 machine=iris4d opsys=irix6-0
614 # It's not clear whether -D_LANGUAGE_C is necessary as it is for 6.5,
615 # but presumably it does no harm.
616 NON_GNU_CPP="/lib/cpp -D_LANGUAGE_C"
617 # -32 probably isn't necessary in later v.6s -- anyone know which?
618 NON_GCC_TEST_OPTIONS=-32
619 ;;
620 mips-sgi-irix5.[01]* )
621 machine=iris4d opsys=irix5-0
622 ;;
623 mips-sgi-irix5* | mips-sgi-irix* )
624 machine=iris4d opsys=irix5-2
625 ;;
626
627 ## Suns
628 sparc-*-linux-gnu* | sparc64-*-linux-gnu* )
629 machine=sparc opsys=gnu-linux
630 ;;
631
632 *-auspex-sunos* | *-sun-sunos* | *-sun-bsd* | *-sun-solaris* \
633 | i[3456]86-*-solaris2* | i[3456]86-*-sunos5* | powerpc*-*-solaris2* \
634 | rs6000-*-solaris2*)
635 case "${canonical}" in
636 i[3456]86-*-* ) machine=intel386 ;;
637 amd64-*-*|x86_64-*-*) machine=amdx86-64 ;;
638 powerpcle* ) machine=powerpcle ;;
639 powerpc* | rs6000* ) machine=ibmrs6000 ;;
640 sparc* ) machine=sparc ;;
641 * ) unported=yes ;;
642 esac
643 case "${canonical}" in
644 *-sunos5.3* | *-solaris2.3* )
645 opsys=sol2-3
646 NON_GNU_CPP=/usr/ccs/lib/cpp
647 ;;
648 *-sunos5.4* | *-solaris2.4* )
649 opsys=sol2-4
650 NON_GNU_CPP=/usr/ccs/lib/cpp
651 RANLIB="ar -ts"
652 ;;
653 *-sunos5.5* | *-solaris2.5* )
654 opsys=sol2-5
655 NON_GNU_CPP=/usr/ccs/lib/cpp
656 RANLIB="ar -ts"
657 ;;
658 *-sunos5.6* | *-solaris2.6* )
659 opsys=sol2-6
660 NON_GNU_CPP=/usr/ccs/lib/cpp
661 RANLIB="ar -ts"
662 ;;
663 *-sunos5* | *-solaris* )
664 opsys=sol2-6
665 emacs_check_sunpro_c=yes
666 NON_GNU_CPP=/usr/ccs/lib/cpp
667 ;;
668 * ) opsys=bsd4-2 ;;
669 esac
670 ## Watch out for a compiler that we know will not work.
671 case "${canonical}" in
672 *-solaris* | *-sunos5* )
673 if [ "x$CC" = x/usr/ucb/cc ]; then
674 ## /usr/ucb/cc doesn't work;
675 ## we should find some other compiler that does work.
676 unset CC
677 fi
678 ;;
679 *) ;;
680 esac
681 ;;
682 sparc-*-nextstep* )
683 machine=sparc opsys=nextstep
684 ;;
685
686 ## Tandem Integrity S2
687 mips-tandem-sysv* )
688 machine=tandem-s2 opsys=usg5-3
689 ;;
690
691 ## Vaxen.
692 vax-dec-* )
693 machine=vax
694 case "${canonical}" in
695 *-bsd4.1* ) opsys=bsd4-1 ;;
696 *-bsd4.2* | *-ultrix[0-3].* | *-ultrix4.0* ) opsys=bsd4-2 ;;
697 *-bsd4.3* | *-ultrix* ) opsys=bsd4-3 ;;
698 *-sysv[01]* | *-sysvr[01]* ) opsys=usg5-0 ;;
699 *-sysv2* | *-sysvr2* ) opsys=usg5-2 ;;
700 *-vms* ) opsys=vms ;;
701 * ) unported=yes
702 esac
703 ;;
704
705 ## IA-64
706 ia64*-*-linux* )
707 machine=ia64 opsys=gnu-linux
708 ;;
709
710 ## Intel 386 machines where we don't care about the manufacturer
711 i[3456]86-*-* )
712 machine=intel386
713 case "${canonical}" in
714 *-cygwin ) opsys=cygwin ;;
715 *-darwin* ) opsys=darwin
716 CPP="${CC-cc} -E -no-cpp-precomp"
717 ;;
718 *-xenix* ) opsys=xenix ;;
719 *-linux-gnu* ) opsys=gnu-linux ;;
720 *-sysv4.2uw* ) opsys=unixware; NON_GNU_CPP=/lib/cpp ;;
721 *-sysv5uw* ) opsys=unixware; NON_GNU_CPP=/lib/cpp ;;
722 *-sysv5OpenUNIX* ) opsys=unixware; NON_GNU_CPP=/lib/cpp ;;
723 *-386bsd* ) opsys=386bsd ;;
724 *-nextstep* ) opsys=nextstep ;;
725 ## Otherwise, we'll fall through to the generic opsys code at the bottom.
726 esac
727 ;;
728
729 ## m68k Linux-based GNU system
730 m68k-*-linux-gnu* )
731 machine=m68k opsys=gnu-linux
732 ;;
733
734 ## Mips Linux-based GNU system
735 mips-*-linux-gnu* | mipsel-*-linux-gnu* )
736 machine=mips opsys=gnu-linux
737 ;;
738
739 ## UXP/DS
740 sparc-fujitsu-sysv4* )
741 machine=sparc opsys=uxpds
742 NON_GNU_CPP=/usr/ccs/lib/cpp
743 RANLIB="ar -ts"
744 ;;
745
746 ## AMD x86-64 Linux-based GNU system
747 x86_64-*-linux-gnu* )
748 machine=amdx86-64 opsys=gnu-linux
749 ;;
750
751 ## Tensilica Xtensa Linux-based GNU system
752 xtensa-*-linux-gnu* )
753 machine=xtensa opsys=gnu-linux
754 ;;
755
756 * )
757 unported=yes
758 ;;
759 esac
760
761 ### If the code above didn't choose an operating system, just choose
762 ### an operating system based on the configuration name. You really
763 ### only want to use this when you have no idea what the right
764 ### operating system is; if you know what operating systems a machine
765 ### runs, it's cleaner to make it explicit in the case statement
766 ### above.
767 if test x"${opsys}" = x; then
768 case "${canonical}" in
769 *-gnu* ) opsys=gnu ;;
770 *-bsd4.[01] ) opsys=bsd4-1 ;;
771 *-bsd4.2 ) opsys=bsd4-2 ;;
772 *-bsd4.3 ) opsys=bsd4-3 ;;
773 *-sysv0 | *-sysvr0 ) opsys=usg5-0 ;;
774 *-sysv2 | *-sysvr2 ) opsys=usg5-2 ;;
775 *-sysv2.2 | *-sysvr2.2 ) opsys=usg5-2-2 ;;
776 *-sysv3* | *-sysvr3* ) opsys=usg5-3 ;;
777 *-sysv4.2uw* ) opsys=unixware ;;
778 *-sysv5uw* ) opsys=unixware ;;
779 *-sysv5OpenUNIX* ) opsys=unixware ;;
780 *-sysv4.1* | *-sysvr4.1* )
781 NON_GNU_CPP=/usr/lib/cpp
782 opsys=usg5-4 ;;
783 *-sysv4.[2-9]* | *-sysvr4.[2-9]* )
784 if [ x$NON_GNU_CPP = x ]; then
785 if [ -f /usr/ccs/lib/cpp ]; then
786 NON_GNU_CPP=/usr/ccs/lib/cpp
787 else
788 NON_GNU_CPP=/lib/cpp
789 fi
790 fi
791 opsys=usg5-4-2 ;;
792 *-sysv4* | *-sysvr4* ) opsys=usg5-4 ;;
793 * )
794 unported=yes
795 ;;
796 esac
797 fi
798
799 ]
800 dnl quotation ends
801
802 if test $unported = yes; then
803 AC_MSG_ERROR([Emacs hasn't been ported to `${canonical}' systems.
804 Check `etc/MACHINES' for recognized configuration names.])
805 fi
806
807 machfile="m/${machine}.h"
808 opsysfile="s/${opsys}.h"
809
810
811 #### Choose a compiler.
812 test -n "$CC" && cc_specified=yes
813
814 # Save the value of CFLAGS that the user specified.
815 SPECIFIED_CFLAGS="$CFLAGS"
816
817 case ${with_gcc} in
818 "yes" ) CC="gcc" GCC=yes ;;
819 "no" ) : ${CC=cc} ;;
820 * )
821 esac
822 AC_PROG_CC
823
824 # On Suns, sometimes $CPP names a directory.
825 if test -n "$CPP" && test -d "$CPP"; then
826 CPP=
827 fi
828
829 ## If not using gcc, and on Solaris, and no CPP specified, see if
830 ## using a Sun compiler, which needs -Xs to prevent whitespace.
831 if test x"$GCC" != xyes && test x"$emacs_check_sunpro_c" = xyes && \
832 test x"$CPP" = x; then
833 AC_MSG_CHECKING([whether we are using a Sun C compiler])
834 AC_CACHE_VAL(emacs_cv_sunpro_c,
835 [AC_TRY_LINK([],
836 [#ifndef __SUNPRO_C
837 fail;
838 #endif
839 ], emacs_cv_sunpro_c=yes, emacs_cv_sunpro_c=no)])
840 AC_MSG_RESULT($emacs_cv_sunpro_c)
841
842 if test x"$emacs_cv_sunpro_c" = xyes; then
843 NON_GNU_CPP="$CC -E -Xs"
844 fi
845 fi
846
847 #### Some systems specify a CPP to use unless we are using GCC.
848 #### Now that we know whether we are using GCC, we can decide whether
849 #### to use that one.
850 if test "x$NON_GNU_CPP" != x && test x$GCC != xyes && test "x$CPP" = x
851 then
852 CPP="$NON_GNU_CPP"
853 fi
854
855 #### Some systems specify a CC to use unless we are using GCC.
856 #### Now that we know whether we are using GCC, we can decide whether
857 #### to use that one.
858 if test "x$NON_GNU_CC" != x && test x$GCC != xyes &&
859 test x$cc_specified != xyes
860 then
861 CC="$NON_GNU_CC"
862 fi
863
864 if test x$GCC = xyes && test "x$GCC_TEST_OPTIONS" != x
865 then
866 CC="$CC $GCC_TEST_OPTIONS"
867 fi
868
869 if test x$GCC = x && test "x$NON_GCC_TEST_OPTIONS" != x
870 then
871 CC="$CC $NON_GCC_TEST_OPTIONS"
872 fi
873
874 dnl checks for Unix variants
875 AC_AIX
876 AC_GNU_SOURCE
877
878 ### Use -Wno-pointer-sign if the compiler supports it
879 AC_MSG_CHECKING([whether gcc understands -Wno-pointer-sign])
880 SAVE_CFLAGS="$CFLAGS"
881 CFLAGS="$CFLAGS -Wno-pointer-sign"
882 AC_TRY_COMPILE([], [], has_option=yes, has_option=no,)
883 if test $has_option = yes; then
884 C_WARNINGS_SWITCH="-Wno-pointer-sign $C_WARNINGS_SWITCH"
885 fi
886 AC_MSG_RESULT($has_option)
887 CFLAGS="$SAVE_CFLAGS"
888 unset has_option
889 unset SAVE_CFLAGS
890
891 #### Some other nice autoconf tests.
892
893 dnl checks for programs
894 AC_PROG_LN_S
895 AC_PROG_CPP
896 AC_PROG_INSTALL
897 if test "x$RANLIB" = x; then
898 AC_PROG_RANLIB
899 fi
900 AC_PATH_PROG(INSTALL_INFO, install-info)
901 AC_PATH_PROG(INSTALL_INFO, install-info,, /usr/sbin)
902 AC_PATH_PROG(INSTALL_INFO, install-info,:, /sbin)
903 dnl Don't use GZIP, which is used by gzip for additional parameters.
904 AC_PATH_PROG(GZIP_PROG, gzip)
905
906
907 ## Need makeinfo >= 4.6 (?) to build the manuals.
908 AC_PATH_PROG(MAKEINFO, makeinfo, no)
909 dnl By this stage, configure has already checked for egrep and set EGREP,
910 dnl or exited with an error if no egrep was found.
911 if test "$MAKEINFO" != "no" && \
912 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
913 MAKEINFO=no
914 fi
915
916 if test "$MAKEINFO" = "no"; then
917 AC_MSG_ERROR( [makeinfo >= 4.6 is required] )
918 fi
919
920
921 dnl Add our options to ac_link now, after it is set up.
922
923 if test x$GCC = xyes && test "x$GCC_LINK_TEST_OPTIONS" != x
924 then
925 ac_link="$ac_link $GCC_LINK_TEST_OPTIONS"
926 fi
927
928 if test x$GCC = x && test "x$NON_GCC_LINK_TEST_OPTIONS" != x
929 then
930 ac_link="$ac_link $NON_GCC_LINK_TEST_OPTIONS"
931 fi
932
933 dnl We need -znocombreloc if we're using a relatively recent GNU ld.
934 dnl If we can link with the flag, it shouldn't do any harm anyhow.
935 dnl (Don't use `-z nocombreloc' as -z takes no arg on Irix.)
936 dnl Treat GCC specially since it just gives a non-fatal `unrecognized option'
937 dnl if not built to support GNU ld.
938
939 late_LDFLAGS=$LDFLAGS
940 if test "$GCC" = yes; then
941 LDFLAGS="$LDFLAGS -Wl,-znocombreloc"
942 else
943 LDFLAGS="$LDFLAGS -znocombreloc"
944 fi
945
946 AC_MSG_CHECKING([for -znocombreloc])
947 AC_LINK_IFELSE([main(){return 0;}],
948 [AC_MSG_RESULT(yes)],
949 LDFLAGS=$late_LDFLAGS
950 [AC_MSG_RESULT(no)])
951
952 #### Extract some information from the operating system and machine files.
953
954 AC_CHECKING([the machine- and system-dependent files to find out
955 - which libraries the lib-src programs will want, and
956 - whether the GNU malloc routines are usable])
957
958 ### First figure out CFLAGS (which we use for running the compiler here)
959 ### and REAL_CFLAGS (which we use for real compilation).
960 ### The two are the same except on a few systems, where they are made
961 ### different to work around various lossages. For example,
962 ### GCC 2.5 on GNU/Linux needs them to be different because it treats -g
963 ### as implying static linking.
964
965 ### If the CFLAGS env var is specified, we use that value
966 ### instead of the default.
967
968 ### It's not important that this name contain the PID; you can't run
969 ### two configures in the same directory and have anything work
970 ### anyway.
971 tempcname="conftest.c"
972
973 echo '
974 #include "'${srcdir}'/src/'${opsysfile}'"
975 #include "'${srcdir}'/src/'${machfile}'"
976 #ifndef LIBS_MACHINE
977 #define LIBS_MACHINE
978 #endif
979 #ifndef LIBS_SYSTEM
980 #define LIBS_SYSTEM
981 #endif
982 #ifndef C_SWITCH_SYSTEM
983 #define C_SWITCH_SYSTEM
984 #endif
985 #ifndef C_SWITCH_MACHINE
986 #define C_SWITCH_MACHINE
987 #endif
988 configure___ libsrc_libs=LIBS_MACHINE LIBS_SYSTEM
989 configure___ c_switch_system=C_SWITCH_SYSTEM
990 configure___ c_switch_machine=C_SWITCH_MACHINE
991
992 #ifndef LIB_X11_LIB
993 #define LIB_X11_LIB -lX11
994 #endif
995
996 #ifndef LIBX11_MACHINE
997 #define LIBX11_MACHINE
998 #endif
999
1000 #ifndef LIBX11_SYSTEM
1001 #define LIBX11_SYSTEM
1002 #endif
1003 configure___ LIBX=LIB_X11_LIB LIBX11_MACHINE LIBX11_SYSTEM
1004
1005 #ifdef UNEXEC
1006 configure___ unexec=UNEXEC
1007 #else
1008 configure___ unexec=unexec.o
1009 #endif
1010
1011 #ifdef SYSTEM_MALLOC
1012 configure___ system_malloc=yes
1013 #else
1014 configure___ system_malloc=no
1015 #endif
1016
1017 #ifdef USE_MMAP_FOR_BUFFERS
1018 configure___ use_mmap_for_buffers=yes
1019 #else
1020 configure___ use_mmap_for_buffers=no
1021 #endif
1022
1023 #ifndef C_DEBUG_SWITCH
1024 #define C_DEBUG_SWITCH -g
1025 #endif
1026
1027 #ifndef C_OPTIMIZE_SWITCH
1028 #ifdef __GNUC__
1029 #define C_OPTIMIZE_SWITCH -O2
1030 #else
1031 #define C_OPTIMIZE_SWITCH -O
1032 #endif
1033 #endif
1034
1035 #ifndef C_WARNINGS_SWITCH
1036 #define C_WARNINGS_SWITCH ${C_WARNINGS_SWITCH}
1037 #endif
1038
1039 #ifndef LD_SWITCH_MACHINE
1040 #define LD_SWITCH_MACHINE
1041 #endif
1042
1043 #ifndef LD_SWITCH_SYSTEM
1044 #define LD_SWITCH_SYSTEM
1045 #endif
1046
1047 #ifndef LD_SWITCH_X_SITE_AUX
1048 #define LD_SWITCH_X_SITE_AUX
1049 #endif
1050
1051 configure___ ld_switch_system=LD_SWITCH_SYSTEM
1052 configure___ ld_switch_machine=LD_SWITCH_MACHINE
1053
1054 #ifdef THIS_IS_CONFIGURE
1055
1056 /* Get the CFLAGS for tests in configure. */
1057 #ifdef __GNUC__
1058 configure___ CFLAGS=C_DEBUG_SWITCH C_OPTIMIZE_SWITCH '${SPECIFIED_CFLAGS}'
1059 #else
1060 configure___ CFLAGS=C_DEBUG_SWITCH '${SPECIFIED_CFLAGS}'
1061 #endif
1062
1063 #else /* not THIS_IS_CONFIGURE */
1064
1065 /* Get the CFLAGS for real compilation. */
1066 #ifdef __GNUC__
1067 configure___ REAL_CFLAGS=C_DEBUG_SWITCH C_OPTIMIZE_SWITCH C_WARNINGS_SWITCH '${SPECIFIED_CFLAGS}'
1068 #else
1069 configure___ REAL_CFLAGS=C_DEBUG_SWITCH '${SPECIFIED_CFLAGS}'
1070 #endif
1071
1072 #endif /* not THIS_IS_CONFIGURE */
1073 ' > ${tempcname}
1074
1075 # The value of CPP is a quoted variable reference, so we need to do this
1076 # to get its actual value...
1077 CPP=`eval "echo $CPP"`
1078 [eval `${CPP} -Isrc ${tempcname} \
1079 | sed -n -e 's/^configure___ \([^=]*=\)\(.*\)$/\1"\2"/p'`
1080 if test "x$SPECIFIED_CFLAGS" = x; then
1081 eval `${CPP} -Isrc -DTHIS_IS_CONFIGURE ${tempcname} \
1082 | sed -n -e 's/^configure___ \([^=]*=\)\(.*\)$/\1"\2"/p'`
1083 else
1084 REAL_CFLAGS="$CFLAGS"
1085 fi]
1086 rm ${tempcname}
1087
1088 ac_link="$ac_link $ld_switch_machine $ld_switch_system"
1089
1090 ### Make sure subsequent tests use flags consistent with the build flags.
1091
1092 if test x"${OVERRIDE_CPPFLAGS}" != x; then
1093 CPPFLAGS="${OVERRIDE_CPPFLAGS}"
1094 else
1095 CPPFLAGS="$c_switch_system $c_switch_machine $CPPFLAGS"
1096 fi
1097
1098 dnl For AC_FUNC_GETLOADAVG, at least:
1099 AC_CONFIG_LIBOBJ_DIR(src)
1100
1101 dnl Do this early because it can frob feature test macros for Unix-98 &c.
1102 AC_SYS_LARGEFILE
1103
1104
1105 ### The standard library on x86-64 and s390x GNU/Linux distributions can
1106 ### be located in either /usr/lib64 or /usr/lib.
1107 case "${canonical}" in
1108 x86_64-*-linux-gnu* | s390x-*-linux-gnu* )
1109 if test -d /usr/lib64; then
1110 AC_DEFINE(HAVE_LIB64_DIR, 1,
1111 [Define to 1 if the directory /usr/lib64 exists.])
1112 fi
1113 esac
1114
1115 dnl This function defintion taken from Gnome 2.0
1116 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
1117 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
1118 dnl also defines GSTUFF_PKG_ERRORS on error
1119 AC_DEFUN([PKG_CHECK_MODULES], [
1120 succeeded=no
1121
1122 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1123
1124 if test "$PKG_CONFIG" = "no" ; then
1125 ifelse([$4], , [AC_MSG_ERROR([
1126 *** 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])
1127 else
1128 PKG_CONFIG_MIN_VERSION=0.9.0
1129 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
1130 AC_MSG_CHECKING(for $2)
1131
1132 if $PKG_CONFIG --exists "$2" 2>&AS_MESSAGE_LOG_FD; then
1133 AC_MSG_RESULT(yes)
1134 succeeded=yes
1135
1136 AC_MSG_CHECKING($1_CFLAGS)
1137 $1_CFLAGS=`$PKG_CONFIG --cflags "$2"|sed -e 's,///*,/,g'`
1138 AC_MSG_RESULT($$1_CFLAGS)
1139
1140 AC_MSG_CHECKING($1_LIBS)
1141 $1_LIBS=`$PKG_CONFIG --libs "$2"|sed -e 's,///*,/,g'`
1142 AC_MSG_RESULT($$1_LIBS)
1143 else
1144 AC_MSG_RESULT(no)
1145 $1_CFLAGS=""
1146 $1_LIBS=""
1147 ## If we have a custom action on failure, don't print errors, but
1148 ## do set a variable so people can do so.
1149 $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
1150 ifelse([$4], ,echo $$1_PKG_ERRORS,)
1151 fi
1152
1153 AC_SUBST($1_CFLAGS)
1154 AC_SUBST($1_LIBS)
1155 else
1156 echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
1157 echo "*** See http://www.freedesktop.org/software/pkgconfig"
1158 fi
1159 fi
1160
1161 if test $succeeded = yes; then
1162 ifelse([$3], , :, [$3])
1163 else
1164 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])
1165 fi
1166 ])
1167
1168
1169 if test "${with_sound}" != "no"; then
1170 # Sound support for GNU/Linux and the free BSDs.
1171 AC_CHECK_HEADERS(machine/soundcard.h sys/soundcard.h soundcard.h)
1172 # Emulation library used on NetBSD.
1173 AC_CHECK_LIB(ossaudio, _oss_ioctl, LIBSOUND=-lossaudio, LIBSOUND=)
1174 AC_SUBST(LIBSOUND)
1175
1176 ALSA_REQUIRED=1.0.0
1177 ALSA_MODULES="alsa >= $ALSA_REQUIRED"
1178 PKG_CHECK_MODULES(ALSA, $ALSA_MODULES, HAVE_ALSA=yes, HAVE_ALSA=no)
1179 if test $HAVE_ALSA = yes; then
1180 SAVE_CFLAGS="$CFLAGS"
1181 SAVE_LDFLAGS="$LDFLAGS"
1182 CFLAGS="$ALSA_CFLAGS $CFLAGS"
1183 LDFLAGS="$ALSA_LIBS $LDFLAGS"
1184 AC_TRY_COMPILE([#include <asoundlib.h>], [snd_lib_error_set_handler (0);],
1185 emacs_alsa_normal=yes,
1186 emacs_alsa_normal=no)
1187 if test "$emacs_alsa_normal" != yes; then
1188 AC_TRY_COMPILE([#include <alsa/asoundlib.h>],
1189 [snd_lib_error_set_handler (0);],
1190 emacs_alsa_subdir=yes,
1191 emacs_alsa_subdir=no)
1192 if test "$emacs_alsa_subdir" != yes; then
1193 AC_MSG_ERROR([pkg-config found alsa, but it does not compile. See config.log for error messages.])
1194 fi
1195 ALSA_CFLAGS="$ALSA_CFLAGS -DALSA_SUBDIR_INCLUDE"
1196 fi
1197
1198 CFLAGS="$SAVE_CFLAGS"
1199 LDFLAGS="$SAVE_LDFLAGS"
1200 LIBSOUND="$LIBSOUND $ALSA_LIBS"
1201 CFLAGS_SOUND="$CFLAGS_SOUND $ALSA_CFLAGS"
1202 AC_DEFINE(HAVE_ALSA, 1, [Define to 1 if ALSA is available.])
1203 fi
1204 AC_SUBST(CFLAGS_SOUND)
1205 fi
1206
1207 dnl checks for header files
1208 AC_CHECK_HEADERS(sys/select.h sys/timeb.h sys/time.h unistd.h utime.h \
1209 linux/version.h sys/systeminfo.h termios.h limits.h string.h stdlib.h \
1210 termcap.h stdio_ext.h fcntl.h strings.h coff.h pty.h sys/mman.h \
1211 sys/param.h sys/vlimit.h sys/resource.h locale.h sys/_mbstate_t.h \
1212 sys/utsname.h pwd.h)
1213
1214 AC_MSG_CHECKING(if personality LINUX32 can be set)
1215 AC_TRY_COMPILE([#include <sys/personality.h>], [personality (PER_LINUX32)],
1216 emacs_cv_personality_linux32=yes,
1217 emacs_cv_personality_linux32=no)
1218 AC_MSG_RESULT($emacs_cv_personality_linux32)
1219
1220 if test $emacs_cv_personality_linux32 = yes; then
1221 AC_DEFINE(HAVE_PERSONALITY_LINUX32, 1,
1222 [Define to 1 if personality LINUX32 can be set.])
1223 fi
1224
1225 dnl On Solaris 8 there's a compilation warning for term.h because
1226 dnl it doesn't define `bool'.
1227 AC_CHECK_HEADERS(term.h, , , -)
1228 AC_HEADER_STDC
1229 AC_HEADER_TIME
1230 AC_CHECK_DECLS([sys_siglist])
1231 if test $ac_cv_have_decl_sys_siglist != yes; then
1232 # For Tru64, at least:
1233 AC_CHECK_DECLS([__sys_siglist])
1234 if test $ac_cv_have_decl___sys_siglist = yes; then
1235 AC_DEFINE(sys_siglist, __sys_siglist,
1236 [Define to any substitute for sys_siglist.])
1237 fi
1238 fi
1239 AC_HEADER_SYS_WAIT
1240
1241 dnl Some systems have utime.h but don't declare the struct anyplace.
1242 AC_CACHE_CHECK(for struct utimbuf, emacs_cv_struct_utimbuf,
1243 AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME
1244 #include <sys/time.h>
1245 #include <time.h>
1246 #else
1247 #ifdef HAVE_SYS_TIME_H
1248 #include <sys/time.h>
1249 #else
1250 #include <time.h>
1251 #endif
1252 #endif
1253 #ifdef HAVE_UTIME_H
1254 #include <utime.h>
1255 #endif], [static struct utimbuf x; x.actime = x.modtime;],
1256 emacs_cv_struct_utimbuf=yes, emacs_cv_struct_utimbuf=no))
1257 if test $emacs_cv_struct_utimbuf = yes; then
1258 AC_DEFINE(HAVE_STRUCT_UTIMBUF, 1, [Define to 1 if `struct utimbuf' is declared by <utime.h>.])
1259 fi
1260
1261 dnl checks for typedefs
1262 AC_TYPE_SIGNAL
1263
1264 dnl Check for speed_t typedef.
1265 AC_CACHE_CHECK(for speed_t, emacs_cv_speed_t,
1266 [AC_TRY_COMPILE([#include <termios.h>], [speed_t x = 1;],
1267 emacs_cv_speed_t=yes, emacs_cv_speed_t=no)])
1268 if test $emacs_cv_speed_t = yes; then
1269 AC_DEFINE(HAVE_SPEED_T, 1,
1270 [Define to 1 if `speed_t' is declared by <termios.h>.])
1271 fi
1272
1273 AC_CACHE_CHECK(for struct timeval, emacs_cv_struct_timeval,
1274 AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME
1275 #include <sys/time.h>
1276 #include <time.h>
1277 #else
1278 #ifdef HAVE_SYS_TIME_H
1279 #include <sys/time.h>
1280 #else
1281 #include <time.h>
1282 #endif
1283 #endif], [static struct timeval x; x.tv_sec = x.tv_usec;],
1284 emacs_cv_struct_timeval=yes, emacs_cv_struct_timeval=no))
1285 HAVE_TIMEVAL=$emacs_cv_struct_timeval
1286 if test $emacs_cv_struct_timeval = yes; then
1287 AC_DEFINE(HAVE_TIMEVAL, 1, [Define to 1 if `struct timeval' is declared by <sys/time.h>.])
1288 fi
1289
1290 AC_CACHE_CHECK(for struct exception, emacs_cv_struct_exception,
1291 AC_TRY_COMPILE([#include <math.h>],
1292 [static struct exception x; x.arg1 = x.arg2 = x.retval; x.name = ""; x.type = 1;],
1293 emacs_cv_struct_exception=yes, emacs_cv_struct_exception=no))
1294 HAVE_EXCEPTION=$emacs_cv_struct_exception
1295 if test $emacs_cv_struct_exception != yes; then
1296 AC_DEFINE(NO_MATHERR, 1, [Define to 1 if you don't have struct exception in math.h.])
1297 fi
1298
1299 AC_CHECK_HEADERS(sys/socket.h)
1300 AC_CHECK_HEADERS(net/if.h, , , [AC_INCLUDES_DEFAULT
1301 #if HAVE_SYS_SOCKET_H
1302 #include <sys/socket.h>
1303 #endif])
1304
1305 dnl checks for structure members
1306 AC_STRUCT_TM
1307 AC_STRUCT_TIMEZONE
1308 AC_CHECK_MEMBER(struct tm.tm_gmtoff,
1309 [AC_DEFINE(HAVE_TM_GMTOFF, 1,
1310 [Define to 1 if `tm_gmtoff' is member of `struct tm'.])],,
1311 [#include <time.h>])
1312 AC_CHECK_MEMBERS([struct ifreq.ifr_flags, struct ifreq.ifr_hwaddr,
1313 struct ifreq.ifr_netmask, struct ifreq.ifr_broadaddr,
1314 struct ifreq.ifr_addr], , ,
1315 [AC_INCLUDES_DEFAULT
1316 #if HAVE_SYS_SOCKET_H
1317 #include <sys/socket.h>
1318 #endif
1319 #if HAVE_NET_IF_H
1320 #include <net/if.h>
1321 #endif])
1322
1323 dnl checks for compiler characteristics
1324
1325 dnl Testing __STDC__ to determine prototype support isn't good enough.
1326 dnl DEC C, for instance, doesn't define it with default options, and
1327 dnl is used on 64-bit systems (OSF Alphas). Similarly for volatile
1328 dnl and void *.
1329 AC_C_PROTOTYPES
1330 AC_C_VOLATILE
1331 AC_C_CONST
1332 dnl This isn't useful because we can't turn on use of `inline' unless
1333 dnl the compiler groks `extern inline'.
1334 dnl AC_C_INLINE
1335 AC_CACHE_CHECK([for void * support], emacs_cv_void_star,
1336 [AC_TRY_COMPILE(, [void * foo;],
1337 emacs_cv_void_star=yes, emacs_cv_void_star=no)])
1338 if test $emacs_cv_void_star = yes; then
1339 AC_DEFINE(POINTER_TYPE, void)
1340 else
1341 AC_DEFINE(POINTER_TYPE, char)
1342 fi
1343 AH_TEMPLATE(POINTER_TYPE,
1344 [Define as `void' if your compiler accepts `void *'; otherwise
1345 define as `char'.])dnl
1346
1347
1348
1349 dnl This could be used for targets which can have both byte sexes.
1350 dnl We could presumably replace the hardwired WORDS_BIG_ENDIAN generally.
1351 dnl AC_C_BIGENDIAN
1352
1353 dnl check for Make feature
1354 AC_PROG_MAKE_SET
1355
1356 dnl checks for operating system services
1357 AC_SYS_LONG_FILE_NAMES
1358
1359 #### Choose a window system.
1360
1361 AC_PATH_X
1362 if test "$no_x" = yes; then
1363 window_system=none
1364 else
1365 window_system=x11
1366 fi
1367
1368 if test "${x_libraries}" != NONE; then
1369 if test -n "${x_libraries}"; then
1370 LD_SWITCH_X_SITE=-L`echo ${x_libraries} | sed -e "s/:/ -L/g"`
1371 LD_SWITCH_X_SITE_AUX=-R`echo ${x_libraries} | sed -e "s/:/ -R/g"`
1372 fi
1373 x_default_search_path=""
1374 x_search_path=${x_libraries}
1375 if test -z "${x_search_path}"; then
1376 x_search_path=/usr/lib
1377 fi
1378 for x_library in `echo ${x_search_path}: | \
1379 sed -e "s/:/ /g" -e p -e "s:/lib[[^ /]]* :/share :g"`; do
1380 x_search_path="\
1381 ${x_library}/X11/%L/%T/%N%C%S:\
1382 ${x_library}/X11/%l/%T/%N%C%S:\
1383 ${x_library}/X11/%T/%N%C%S:\
1384 ${x_library}/X11/%L/%T/%N%S:\
1385 ${x_library}/X11/%l/%T/%N%S:\
1386 ${x_library}/X11/%T/%N%S"
1387 if test x"${x_default_search_path}" = x; then
1388 x_default_search_path=${x_search_path}
1389 else
1390 x_default_search_path="${x_search_path}:${x_default_search_path}"
1391 fi
1392 done
1393 fi
1394 if test "${x_includes}" != NONE && test -n "${x_includes}"; then
1395 C_SWITCH_X_SITE=-I`echo ${x_includes} | sed -e "s/:/ -I/g"`
1396 fi
1397
1398 if test x"${x_includes}" = x; then
1399 bitmapdir=/usr/include/X11/bitmaps
1400 else
1401 # accumulate include directories that have X11 bitmap subdirectories
1402 bmd_acc="dummyval"
1403 for bmd in `echo ${x_includes} | sed -e "s/:/ /g"`; do
1404 if test -d "${bmd}/X11/bitmaps"; then
1405 bmd_acc="${bmd_acc}:${bmd}/X11/bitmaps"
1406 fi
1407 if test -d "${bmd}/bitmaps"; then
1408 bmd_acc="${bmd_acc}:${bmd}/bitmaps"
1409 fi
1410 done
1411 if test ${bmd_acc} != "dummyval"; then
1412 bitmapdir=`echo ${bmd_acc} | sed -e "s/^dummyval://"`
1413 fi
1414 fi
1415
1416 HAVE_CARBON=no
1417 if test "${with_carbon}" != no; then
1418 AC_CHECK_HEADER(Carbon/Carbon.h, HAVE_CARBON=yes)
1419 fi
1420 if test "${window_system}" = x11 && test "${HAVE_CARBON}" = yes; then
1421 if test "${with_carbon+set}" != set \
1422 && test "${carbon_appdir_x+set}" != set; then
1423 for var in with_x with_x_toolkit with_gtk with_xim \
1424 with_xpm with_jpeg with_tiff with_gif with_png; do
1425 if eval test \"\${$var+set}\" = set; then
1426 HAVE_CARBON=no
1427 break
1428 fi
1429 done
1430 fi
1431 fi
1432 if test "${HAVE_CARBON}" = yes; then
1433 window_system=mac
1434 fi
1435
1436 case "${window_system}" in
1437 x11 )
1438 HAVE_X_WINDOWS=yes
1439 HAVE_X11=yes
1440 case "${with_x_toolkit}" in
1441 athena | lucid ) USE_X_TOOLKIT=LUCID ;;
1442 motif ) USE_X_TOOLKIT=MOTIF ;;
1443 gtk ) with_gtk=yes
1444 dnl Dont set this for GTK. A lot of tests below assumes Xt when
1445 dnl USE_X_TOOLKIT is set.
1446 USE_X_TOOLKIT=none ;;
1447 no ) USE_X_TOOLKIT=none ;;
1448 dnl If user did not say whether to use a toolkit, make this decision later:
1449 dnl use the toolkit if we have gtk, or X11R5 or newer.
1450 * )
1451 if test x"$with_gtk" = xyes; then
1452 USE_X_TOOLKIT=none
1453 else
1454 USE_X_TOOLKIT=maybe
1455 fi
1456 ;;
1457 esac
1458 ;;
1459 mac | none )
1460 HAVE_X_WINDOWS=no
1461 HAVE_X11=no
1462 USE_X_TOOLKIT=none
1463 ;;
1464 esac
1465
1466 if test "$window_system" = none && test "X$with_x" != "Xno"; then
1467 AC_CHECK_PROG(HAVE_XSERVER, X, true, false)
1468 if test "$HAVE_XSERVER" = true ||
1469 test -n "$DISPLAY" ||
1470 test "`echo /usr/lib/libX11.*`" != "/usr/lib/libX11.*"; then
1471 AC_MSG_ERROR([You seem to be running X, but no X development libraries
1472 were found. You should install the relevant development files for X
1473 and for the toolkit you want, such as Gtk+, Lesstif or Motif. Also make
1474 sure you have development files for image handling, i.e.
1475 tiff, gif, jpeg, png and xpm.
1476 If you are sure you want Emacs compiled without X window support, pass
1477 --without-x
1478 to configure.])
1479 fi
1480 fi
1481
1482 ### If we're using X11, we should use the X menu package.
1483 HAVE_MENUS=no
1484 case ${HAVE_X11} in
1485 yes ) HAVE_MENUS=yes ;;
1486 esac
1487
1488 ### Compute the unexec source name from the object name.
1489 UNEXEC_SRC="`echo ${unexec} | sed 's/\.o/.c/'`"
1490
1491 # Do the opsystem or machine files prohibit the use of the GNU malloc?
1492 # Assume not, until told otherwise.
1493 GNU_MALLOC=yes
1494 doug_lea_malloc=yes
1495 AC_CHECK_FUNC(malloc_get_state, ,doug_lea_malloc=no)
1496 AC_CHECK_FUNC(malloc_set_state, ,doug_lea_malloc=no)
1497 AC_CACHE_CHECK(whether __after_morecore_hook exists,
1498 emacs_cv_var___after_morecore_hook,
1499 [AC_TRY_LINK([extern void (* __after_morecore_hook)();],[__after_morecore_hook = 0],
1500 emacs_cv_var___after_morecore_hook=yes,
1501 emacs_cv_var___after_morecore_hook=no)])
1502 if test $emacs_cv_var___after_morecore_hook = no; then
1503 doug_lea_malloc=no
1504 fi
1505 if test "${system_malloc}" = "yes"; then
1506 GNU_MALLOC=no
1507 GNU_MALLOC_reason="
1508 (The GNU allocators don't work with this system configuration.)"
1509 fi
1510 if test "$doug_lea_malloc" = "yes" ; then
1511 if test "$GNU_MALLOC" = yes ; then
1512 GNU_MALLOC_reason="
1513 (Using Doug Lea's new malloc from the GNU C Library.)"
1514 fi
1515 AC_DEFINE(DOUG_LEA_MALLOC, 1,
1516 [Define to 1 if you are using the GNU C Library.])
1517 fi
1518
1519 if test x"${REL_ALLOC}" = x; then
1520 REL_ALLOC=${GNU_MALLOC}
1521 fi
1522
1523 dnl For now, need to use an explicit `#define USE_MMAP_FOR_BUFFERS 1'
1524 dnl the system configuration file (s/*.h) to turn the use of mmap
1525 dnl in the relocating allocator on.
1526
1527 AC_FUNC_MMAP
1528 if test $use_mmap_for_buffers = yes; then
1529 REL_ALLOC=no
1530 fi
1531
1532 LIBS="$libsrc_libs $LIBS"
1533
1534 dnl If found, this defines HAVE_LIBDNET, which m/pmax.h checks,
1535 dnl and also adds -ldnet to LIBS, which Autoconf uses for checks.
1536 AC_CHECK_LIB(dnet, dnet_ntoa)
1537 dnl This causes -lresolv to get used in subsequent tests,
1538 dnl which causes failures on some systems such as HPUX 9.
1539 dnl AC_CHECK_LIB(resolv, gethostbyname)
1540
1541 dnl FIXME replace main with a function we actually want from this library.
1542 AC_CHECK_LIB(Xbsd, main, LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -lXbsd")
1543
1544 AC_CHECK_LIB(pthreads, cma_open)
1545
1546 AC_MSG_CHECKING(for XFree86 in /usr/X386)
1547 if test -d /usr/X386/include; then
1548 HAVE_XFREE386=yes
1549 : ${C_SWITCH_X_SITE="-I/usr/X386/include"}
1550 else
1551 HAVE_XFREE386=no
1552 fi
1553 AC_MSG_RESULT($HAVE_XFREE386)
1554
1555 dnl Check for need for bigtoc support on IBM AIX
1556
1557 case ${host_os} in
1558 aix*)
1559 AC_CACHE_CHECK([for -bbigtoc option], [gdb_cv_bigtoc], [
1560 case $GCC in
1561 yes) gdb_cv_bigtoc=-Wl,-bbigtoc ;;
1562 *) gdb_cv_bigtoc=-bbigtoc ;;
1563 esac
1564
1565 LDFLAGS=$LDFLAGS\ $gdb_cv_bigtoc
1566 AC_TRY_LINK([], [int i;], [], [gdb_cv_bigtoc=])
1567 ])
1568 ;;
1569 esac
1570
1571 # Change CFLAGS and CPPFLAGS temporarily so that C_SWITCH_X_SITE gets
1572 # used for the tests that follow. We set them back to REAL_CFLAGS and
1573 # REAL_CPPFLAGS later on.
1574
1575 REAL_CPPFLAGS="$CPPFLAGS"
1576
1577 if test "${HAVE_X11}" = "yes"; then
1578 DEFS="$C_SWITCH_X_SITE $DEFS"
1579 LDFLAGS="$LDFLAGS $LD_SWITCH_X_SITE"
1580 LIBS="$LIBX $LIBS"
1581 CFLAGS="$C_SWITCH_X_SITE $CFLAGS"
1582 CPPFLAGS="$C_SWITCH_X_SITE $CPPFLAGS"
1583
1584 # On Solaris, arrange for LD_RUN_PATH to point to the X libraries for tests.
1585 # This is handled by LD_SWITCH_X_SITE_AUX during the real build,
1586 # but it's more convenient here to set LD_RUN_PATH
1587 # since this also works on hosts that don't understand LD_SWITCH_X_SITE_AUX.
1588 if test "${x_libraries}" != NONE && test -n "${x_libraries}"; then
1589 LD_RUN_PATH=$x_libraries${LD_RUN_PATH+:}$LD_RUN_PATH
1590 export LD_RUN_PATH
1591 fi
1592
1593 if test "${opsys}" = "gnu-linux"; then
1594 AC_MSG_CHECKING(whether X on GNU/Linux needs -b to link)
1595 AC_TRY_LINK([],
1596 [XOpenDisplay ("foo");],
1597 [xlinux_first_failure=no],
1598 [xlinux_first_failure=yes])
1599 if test "${xlinux_first_failure}" = "yes"; then
1600 OLD_LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE"
1601 OLD_C_SWITCH_X_SITE="$C_SWITCH_X_SITE"
1602 OLD_CPPFLAGS="$CPPFLAGS"
1603 OLD_LIBS="$LIBS"
1604 LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -b i486-linuxaout"
1605 C_SWITCH_X_SITE="$C_SWITCH_X_SITE -b i486-linuxaout"
1606 CPPFLAGS="$CPPFLAGS -b i486-linuxaout"
1607 LIBS="$LIBS -b i486-linuxaout"
1608 AC_TRY_LINK([],
1609 [XOpenDisplay ("foo");],
1610 [xlinux_second_failure=no],
1611 [xlinux_second_failure=yes])
1612 if test "${xlinux_second_failure}" = "yes"; then
1613 # If we get the same failure with -b, there is no use adding -b.
1614 # So take it out. This plays safe.
1615 LD_SWITCH_X_SITE="$OLD_LD_SWITCH_X_SITE"
1616 C_SWITCH_X_SITE="$OLD_C_SWITCH_X_SITE"
1617 CPPFLAGS="$OLD_CPPFLAGS"
1618 LIBS="$OLD_LIBS"
1619 AC_MSG_RESULT(no)
1620 else
1621 AC_MSG_RESULT(yes)
1622 fi
1623 else
1624 AC_MSG_RESULT(no)
1625 fi
1626 fi
1627
1628 # Reportedly, some broken Solaris systems have XKBlib.h but are missing
1629 # header files included from there.
1630 AC_MSG_CHECKING(for Xkb)
1631 AC_TRY_LINK([#include <X11/Xlib.h>
1632 #include <X11/XKBlib.h>],
1633 [XkbDescPtr kb = XkbGetKeyboard (0, XkbAllComponentsMask, XkbUseCoreKbd);],
1634 emacs_xkb=yes, emacs_xkb=no)
1635 AC_MSG_RESULT($emacs_xkb)
1636 if test $emacs_xkb = yes; then
1637 AC_DEFINE(HAVE_XKBGETKEYBOARD, 1, [Define to 1 if you have the XkbGetKeyboard function.])
1638 fi
1639
1640 AC_CHECK_FUNCS(XrmSetDatabase XScreenResourceString \
1641 XScreenNumberOfScreen XSetWMProtocols)
1642 fi
1643
1644 if test "${window_system}" = "x11"; then
1645 AC_MSG_CHECKING(X11 version 6)
1646 AC_CACHE_VAL(emacs_cv_x11_version_6,
1647 [AC_TRY_LINK([#include <X11/Xlib.h>],
1648 [#if XlibSpecificationRelease < 6
1649 fail;
1650 #endif
1651 ], emacs_cv_x11_version_6=yes, emacs_cv_x11_version_6=no)])
1652 if test $emacs_cv_x11_version_6 = yes; then
1653 AC_MSG_RESULT(6 or newer)
1654 AC_DEFINE(HAVE_X11R6, 1,
1655 [Define to 1 if you have the X11R6 or newer version of Xlib.])
1656 else
1657 AC_MSG_RESULT(before 6)
1658 fi
1659 fi
1660
1661
1662 ### Use -lrsvg-2 if available, unless `--with-rsvg=no' is specified.
1663 HAVE_RSVG=no
1664 if test "${HAVE_X11}" = "yes" || test "${HAVE_CARBON}" = "yes"; then
1665 if test "${with_rsvg}" != "no"; then
1666 RSVG_REQUIRED=2.0.0
1667 RSVG_MODULE="librsvg-2.0 >= $RSVG_REQUIRED"
1668
1669 PKG_CHECK_MODULES(RSVG, $RSVG_MODULE, :, :)
1670 AC_SUBST(RSVG_CFLAGS)
1671 AC_SUBST(RSVG_LIBS)
1672
1673 if test ".${RSVG_CFLAGS}" != "."; then
1674 HAVE_RSVG=yes
1675 AC_DEFINE(HAVE_RSVG, 1, [Define to 1 if using librsvg.])
1676 CFLAGS="$CFLAGS $RSVG_CFLAGS"
1677 LIBS="$RSVG_LIBS $LIBS"
1678 fi
1679 fi
1680 fi
1681
1682
1683 HAVE_GTK=no
1684 if test "${with_gtk}" = "yes" && test "$USE_X_TOOLKIT" = "gtk"; then
1685 USE_X_TOOLKIT=none
1686 fi
1687 if test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "gtk" || \
1688 test "$USE_X_TOOLKIT" = "maybe"; then
1689 if test "$USE_X_TOOLKIT" != "none" && test "$USE_X_TOOLKIT" != "maybe"; then
1690 AC_MSG_ERROR([Conflicting options, --with-gtk is incompatible with --with-x-toolkit=${with_x_toolkit}]);
1691 fi
1692 GLIB_REQUIRED=2.6
1693 GTK_REQUIRED=2.6
1694 GTK_MODULES="gtk+-2.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
1695
1696 dnl Checks for libraries.
1697 PKG_CHECK_MODULES(GTK, $GTK_MODULES, pkg_check_gtk=yes, pkg_check_gtk=no)
1698 if test "$pkg_check_gtk" = "no" && test "$USE_X_TOOLKIT" != "maybe"; then
1699 AC_MSG_ERROR($GTK_PKG_ERRORS)
1700 fi
1701 fi
1702
1703
1704 if test x"$pkg_check_gtk" = xyes; then
1705
1706 AC_SUBST(GTK_CFLAGS)
1707 AC_SUBST(GTK_LIBS)
1708 C_SWITCH_X_SITE="$C_SWITCH_X_SITE $GTK_CFLAGS"
1709 CFLAGS="$CFLAGS $GTK_CFLAGS"
1710 LIBS="$GTK_LIBS $LIBS"
1711 dnl Try to compile a simple GTK program.
1712 GTK_COMPILES=no
1713 AC_CHECK_FUNCS(gtk_main, GTK_COMPILES=yes)
1714 if test "${GTK_COMPILES}" != "yes"; then
1715 if test "$USE_X_TOOLKIT" != "maybe"; then
1716 AC_MSG_ERROR([Gtk+ wanted, but it does not compile, see config.log. Maybe some x11-devel files missing?]);
1717 fi
1718 else
1719 HAVE_GTK=yes
1720 AC_DEFINE(HAVE_GTK, 1, [Define to 1 if using GTK.])
1721 USE_X_TOOLKIT=none
1722 fi
1723
1724 fi
1725
1726
1727 if test "${HAVE_GTK}" = "yes"; then
1728
1729 dnl GTK scrollbars resemble toolkit scrollbars a lot, so to avoid
1730 dnl a lot if #ifdef:s, say we have toolkit scrollbars.
1731 if test "$with_toolkit_scroll_bars" != no; then
1732 with_toolkit_scroll_bars=yes
1733 fi
1734
1735 dnl Check if we can use multiple displays with this GTK version.
1736 dnl If gdk_display_open exists, assume all others are there also.
1737 HAVE_GTK_MULTIDISPLAY=no
1738 AC_CHECK_FUNCS(gdk_display_open, HAVE_GTK_MULTIDISPLAY=yes)
1739 if test "${HAVE_GTK_MULTIDISPLAY}" = "yes"; then
1740 AC_DEFINE(HAVE_GTK_MULTIDISPLAY, 1,
1741 [Define to 1 if GTK can handle more than one display.])
1742 fi
1743
1744 dnl Check if we have the old file selection dialog.
1745 dnl If gdk_display_open exists, assume all others are there also.
1746 HAVE_GTK_FILE_SELECTION=no
1747 AC_CHECK_FUNCS(gtk_file_selection_new, HAVE_GTK_FILE_SELECTION=yes)
1748
1749 dnl Check if we have the new file chooser dialog
1750 dnl If gdk_display_open exists, assume all others are there also.
1751 HAVE_GTK_FILE_CHOOSER=no
1752 AC_CHECK_FUNCS(gtk_file_chooser_dialog_new, HAVE_GTK_FILE_CHOOSER=yes)
1753
1754 if test "$HAVE_GTK_FILE_SELECTION" = yes \
1755 && test "$HAVE_GTK_FILE_CHOOSER" = yes; then
1756 AC_DEFINE(HAVE_GTK_FILE_BOTH, 1,
1757 [Define to 1 if GTK has both file selection and chooser dialog.])
1758 fi
1759
1760 dnl Check if pthreads are available. Emacs only needs this when using
1761 dnl gtk_file_chooser under Gnome.
1762 if test "$HAVE_GTK_FILE_CHOOSER" = yes; then
1763 HAVE_GTK_AND_PTHREAD=no
1764 AC_CHECK_HEADERS(pthread.h)
1765 if test "$ac_cv_header_pthread_h"; then
1766 AC_CHECK_LIB(pthread, pthread_self, HAVE_GTK_AND_PTHREAD=yes)
1767 fi
1768 if test "$HAVE_GTK_AND_PTHREAD" = yes; then
1769 case "${canonical}" in
1770 *-hpux*) ;;
1771 *) GTK_LIBS="$GTK_LIBS -lpthread" ;;
1772 esac
1773 AC_DEFINE(HAVE_GTK_AND_PTHREAD, 1,
1774 [Define to 1 if you have GTK and pthread (-lpthread).])
1775 fi
1776 fi
1777 fi
1778
1779 dnl D-Bus has been tested under GNU/Linux only. Must be adapted for
1780 dnl other platforms. Support for higher D-Bus versions than 1.0 is
1781 dnl also not configured.
1782 HAVE_DBUS=no
1783 if test "${with_dbus}" = "yes"; then
1784 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0, HAVE_DBUS=yes, HAVE_DBUS=no)
1785 if test "$HAVE_DBUS" = yes; then
1786 AC_DEFINE(HAVE_DBUS, 1, [Define to 1 if using D-Bus.])
1787 fi
1788 fi
1789
1790 ### Link with -lXft if available to work around a bug.
1791 HAVE_XFT=maybe
1792 if test "${HAVE_GTK}" = "yes"; then
1793 PKG_CHECK_MODULES(XFT, xft >= 0.13.0, , HAVE_XFT=no)
1794 if test "$HAVE_XFT" != no; then
1795 OLD_CFLAGS="$CPPFLAGS"
1796 OLD_CPPFLAGS="$CFLAGS"
1797 OLD_LIBS="$LIBS"
1798 CPPFLAGS="$CPPFLAGS $XFT_CFLAGS"
1799 CFLAGS="$CFLAGS $XFT_CFLAGS"
1800 LIBS="$XFT_LIBS $LIBS"
1801 AC_CHECK_HEADER(X11/Xft/Xft.h,
1802 [AC_CHECK_LIB(Xft, XftFontOpen, HAVE_XFT=yes, , $XFT_LIBS)])
1803
1804 if test "${HAVE_XFT}" = "yes"; then
1805 AC_DEFINE(HAVE_XFT, 1, [Define to 1 if you have the Xft library.])
1806 AC_SUBST(XFT_LIBS)
1807 C_SWITCH_X_SITE="$C_SWITCH_X_SITE $XFT_CFLAGS"
1808 else
1809 CFLAGS="$OLD_CPPFLAGS"
1810 CFLAGS="$OLD_CFLAGS"
1811 LIBS="$OLD_LIBS"
1812 fi
1813 fi
1814 fi
1815
1816 dnl Do not put whitespace before the #include statements below.
1817 dnl Older compilers (eg sunos4 cc) choke on it.
1818 HAVE_XAW3D=no
1819 if test x"${USE_X_TOOLKIT}" = xmaybe || test x"${USE_X_TOOLKIT}" = xLUCID; then
1820 if test "$with_xaw3d" != no; then
1821 AC_MSG_CHECKING(for xaw3d)
1822 AC_CACHE_VAL(emacs_cv_xaw3d,
1823 [AC_TRY_LINK([
1824 #include <X11/Intrinsic.h>
1825 #include <X11/Xaw3d/Simple.h>],
1826 [],
1827 emacs_cv_xaw3d=yes,
1828 emacs_cv_xaw3d=no)])
1829 else
1830 emacs_cv_xaw3d=no
1831 fi
1832 if test $emacs_cv_xaw3d = yes; then
1833 AC_MSG_RESULT([yes; using Lucid toolkit])
1834 USE_X_TOOLKIT=LUCID
1835 HAVE_XAW3D=yes
1836 AC_DEFINE(HAVE_XAW3D, 1,
1837 [Define to 1 if you have the Xaw3d library (-lXaw3d).])
1838 else
1839 AC_MSG_RESULT(no)
1840 AC_MSG_CHECKING(for libXaw)
1841 AC_CACHE_VAL(emacs_cv_xaw,
1842 [AC_TRY_LINK([
1843 #include <X11/Intrinsic.h>
1844 #include <X11/Xaw/Simple.h>],
1845 [],
1846 emacs_cv_xaw=yes,
1847 emacs_cv_xaw=no)])
1848 if test $emacs_cv_xaw = yes; then
1849 AC_MSG_RESULT([yes; using Lucid toolkit])
1850 USE_X_TOOLKIT=LUCID
1851 elif test x"${USE_X_TOOLKIT}" = xLUCID; then
1852 AC_MSG_ERROR([Lucid toolkit requires X11/Xaw include files])
1853 else
1854 AC_MSG_RESULT([no; do not use toolkit by default])
1855 USE_X_TOOLKIT=none
1856 fi
1857 fi
1858 fi
1859
1860 X_TOOLKIT_TYPE=$USE_X_TOOLKIT
1861
1862 if test "${USE_X_TOOLKIT}" != "none"; then
1863 AC_MSG_CHECKING(X11 toolkit version)
1864 AC_CACHE_VAL(emacs_cv_x11_toolkit_version_6,
1865 [AC_TRY_LINK([#include <X11/Intrinsic.h>],
1866 [#if XtSpecificationRelease < 6
1867 fail;
1868 #endif
1869 ], emacs_cv_x11_toolkit_version_6=yes, emacs_cv_x11_toolkit_version_6=no)])
1870 HAVE_X11XTR6=$emacs_cv_x11_toolkit_version_6
1871 if test $emacs_cv_x11_toolkit_version_6 = yes; then
1872 AC_MSG_RESULT(6 or newer)
1873 AC_DEFINE(HAVE_X11XTR6, 1,
1874 [Define to 1 if you have the X11R6 or newer version of Xt.])
1875 else
1876 AC_MSG_RESULT(before 6)
1877 fi
1878
1879 dnl If using toolkit, check whether libXmu.a exists.
1880 dnl tranle@intellicorp.com says libXmu.a can need XtMalloc in libXt.a to link.
1881 OLDLIBS="$LIBS"
1882 if test x$HAVE_X11XTR6 = xyes; then
1883 LIBS="-lXt -lSM -lICE $LIBS"
1884 else
1885 LIBS="-lXt $LIBS"
1886 fi
1887 AC_CHECK_LIB(Xmu, XmuConvertStandardSelection)
1888 test $ac_cv_lib_Xmu_XmuConvertStandardSelection = no && LIBS="$OLDLIBS"
1889 fi
1890
1891 # On Irix 6.5, at least, we need XShapeQueryExtension from -lXext for Xaw3D.
1892 if test "${HAVE_X11}" = "yes"; then
1893 if test "${USE_X_TOOLKIT}" != "none"; then
1894 AC_CHECK_LIB(Xext, XShapeQueryExtension)
1895 fi
1896 fi
1897
1898 if test "${USE_X_TOOLKIT}" = "MOTIF"; then
1899 AC_CACHE_CHECK(for Motif version 2.1, emacs_cv_motif_version_2_1,
1900 [AC_TRY_COMPILE([#include <Xm/Xm.h>],
1901 [#if XmVERSION > 2 || (XmVERSION == 2 && XmREVISION >= 1)
1902 int x = 5;
1903 #else
1904 Motif version prior to 2.1.
1905 #endif],
1906 emacs_cv_motif_version_2_1=yes, emacs_cv_motif_version_2_1=no)])
1907 HAVE_MOTIF_2_1=$emacs_cv_motif_version_2_1
1908 if test $emacs_cv_motif_version_2_1 = yes; then
1909 HAVE_LIBXP=no
1910 AC_DEFINE(HAVE_MOTIF_2_1, 1,
1911 [Define to 1 if you have Motif 2.1 or newer.])
1912 AC_CHECK_LIB(Xp, XpCreateContext, HAVE_LIBXP=yes)
1913 if test ${HAVE_LIBXP} = yes; then
1914 AC_DEFINE(HAVE_LIBXP, 1,
1915 [Define to 1 if you have the Xp library (-lXp).])
1916 fi
1917 else
1918 AC_CACHE_CHECK(for LessTif where some systems put it, emacs_cv_lesstif,
1919 # We put this in CFLAGS temporarily to precede other -I options
1920 # that might be in CFLAGS temporarily.
1921 # We put this in CPPFLAGS where it precedes the other -I options.
1922 OLD_CPPFLAGS=$CPPFLAGS
1923 OLD_CFLAGS=$CFLAGS
1924 CPPFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $CPPFLAGS"
1925 CFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $CFLAGS"
1926 [AC_TRY_COMPILE([#include </usr/X11R6/LessTif/Motif1.2/include/Xm/Xm.h>],
1927 [int x = 5;],
1928 emacs_cv_lesstif=yes, emacs_cv_lesstif=no)])
1929 if test $emacs_cv_lesstif = yes; then
1930 # Make sure this -I option remains in CPPFLAGS after it is set
1931 # back to REAL_CPPFLAGS.
1932 # There is no need to change REAL_CFLAGS, because REAL_CFLAGS does not
1933 # have those other -I options anyway. Ultimately, having this
1934 # directory ultimately in CPPFLAGS will be enough.
1935 REAL_CPPFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $REAL_CPPFLAGS"
1936 LDFLAGS="-L/usr/X11R6/LessTif/Motif1.2/lib $LDFLAGS"
1937 else
1938 CFLAGS=$OLD_CFLAGS
1939 CPPFLAGS=$OLD_CPPFLAGS
1940 fi
1941 fi
1942 fi
1943
1944 dnl Use toolkit scroll bars if configured for GTK or X toolkit and either
1945 dnl using Motif or Xaw3d is available, and unless
1946 dnl --with-toolkit-scroll-bars=no was specified.
1947
1948 AH_TEMPLATE(USE_TOOLKIT_SCROLL_BARS,
1949 [Define to 1 if we should use toolkit scroll bars.])dnl
1950 USE_TOOLKIT_SCROLL_BARS=no
1951 if test "${with_toolkit_scroll_bars}" != "no"; then
1952 if test "${USE_X_TOOLKIT}" != "none"; then
1953 if test "${USE_X_TOOLKIT}" = "MOTIF"; then
1954 AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
1955 HAVE_XAW3D=no
1956 USE_TOOLKIT_SCROLL_BARS=yes
1957 elif test "${HAVE_XAW3D}" = "yes"; then
1958 AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
1959 USE_TOOLKIT_SCROLL_BARS=yes
1960 fi
1961 elif test "${HAVE_GTK}" = "yes"; then
1962 AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
1963 USE_TOOLKIT_SCROLL_BARS=yes
1964 elif test "${HAVE_CARBON}" = "yes"; then
1965 AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
1966 USE_TOOLKIT_SCROLL_BARS=yes
1967 fi
1968 fi
1969
1970 dnl See if XIM is available.
1971 AC_TRY_COMPILE([
1972 #include <X11/Xlib.h>
1973 #include <X11/Xresource.h>],
1974 [XIMProc callback;],
1975 [HAVE_XIM=yes
1976 AC_DEFINE(HAVE_XIM, 1, [Define to 1 if XIM is available])],
1977 HAVE_XIM=no)
1978
1979 dnl `--with-xim' now controls only the initial value of use_xim at run time.
1980
1981 if test "${with_xim}" != "no"; then
1982 AC_DEFINE(USE_XIM, 1,
1983 [Define to 1 if we should use XIM, if it is available.])
1984 fi
1985
1986
1987 if test "${HAVE_XIM}" != "no"; then
1988 late_CFLAGS=$CFLAGS
1989 if test "$GCC" = yes; then
1990 CFLAGS="$CFLAGS --pedantic-errors"
1991 fi
1992 AC_TRY_COMPILE([
1993 #include <X11/Xlib.h>
1994 #include <X11/Xresource.h>],
1995 [Display *display;
1996 XrmDatabase db;
1997 char *res_name;
1998 char *res_class;
1999 XIMProc callback;
2000 XPointer *client_data;
2001 #ifndef __GNUC__
2002 /* If we're not using GCC, it's probably not XFree86, and this is
2003 probably right, but we can't use something like --pedantic-errors. */
2004 extern Bool XRegisterIMInstantiateCallback(Display*, XrmDatabase, char*,
2005 char*, XIMProc, XPointer*);
2006 #endif
2007 (void)XRegisterIMInstantiateCallback(display, db, res_name, res_class, callback,
2008 client_data);],
2009 [emacs_cv_arg6_star=yes])
2010 AH_TEMPLATE(XRegisterIMInstantiateCallback_arg6,
2011 [Define to the type of the 6th arg of XRegisterIMInstantiateCallback,
2012 either XPointer or XPointer*.])dnl
2013 if test "$emacs_cv_arg6_star" = yes; then
2014 AC_DEFINE(XRegisterIMInstantiateCallback_arg6, [XPointer*])
2015 else
2016 AC_DEFINE(XRegisterIMInstantiateCallback_arg6, [XPointer])
2017 fi
2018 CFLAGS=$late_CFLAGS
2019 fi
2020
2021 ### Use -lXpm if available, unless `--with-xpm=no'.
2022 HAVE_XPM=no
2023 if test "${HAVE_X11}" = "yes"; then
2024 if test "${with_xpm}" != "no"; then
2025 AC_CHECK_HEADER(X11/xpm.h,
2026 [AC_CHECK_LIB(Xpm, XpmReadFileToPixmap, HAVE_XPM=yes, , -lX11)])
2027 if test "${HAVE_XPM}" = "yes"; then
2028 AC_MSG_CHECKING(for XpmReturnAllocPixels preprocessor define)
2029 AC_EGREP_CPP(no_return_alloc_pixels,
2030 [#include "X11/xpm.h"
2031 #ifndef XpmReturnAllocPixels
2032 no_return_alloc_pixels
2033 #endif
2034 ], HAVE_XPM=no, HAVE_XPM=yes)
2035
2036 if test "${HAVE_XPM}" = "yes"; then
2037 AC_MSG_RESULT(yes)
2038 else
2039 AC_MSG_RESULT(no)
2040 fi
2041 fi
2042 fi
2043
2044 if test "${HAVE_XPM}" = "yes"; then
2045 AC_DEFINE(HAVE_XPM, 1, [Define to 1 if you have the Xpm libary (-lXpm).])
2046 fi
2047 fi
2048
2049 ### Use -ljpeg if available, unless `--with-jpeg=no'.
2050 HAVE_JPEG=no
2051 if test "${HAVE_X11}" = "yes"; then
2052 if test "${with_jpeg}" != "no"; then
2053 dnl Checking for jpeglib.h can lose because of a redefinition of
2054 dnl HAVE_STDLIB_H.
2055 AC_CHECK_HEADER(jerror.h,
2056 [AC_CHECK_LIB(jpeg, jpeg_destroy_compress, HAVE_JPEG=yes)])
2057 fi
2058
2059 AH_TEMPLATE(HAVE_JPEG, [Define to 1 if you have the jpeg library (-ljpeg).])dnl
2060 if test "${HAVE_JPEG}" = "yes"; then
2061 AC_DEFINE(HAVE_JPEG)
2062 AC_EGREP_CPP([version= *(6[2-9]|[7-9][0-9])],
2063 [#include <jpeglib.h>
2064 version=JPEG_LIB_VERSION
2065 ],
2066 [AC_DEFINE(HAVE_JPEG)],
2067 [AC_MSG_WARN([libjpeg found, but not version 6b or later])
2068 HAVE_JPEG=no])
2069 fi
2070 fi
2071
2072 ### Use -lpng if available, unless `--with-png=no'.
2073 HAVE_PNG=no
2074 if test "${HAVE_X11}" = "yes"; then
2075 if test "${with_png}" != "no"; then
2076 # Debian unstable as of July 2003 has multiple libpngs, and puts png.h
2077 # in /usr/include/libpng.
2078 AC_CHECK_HEADERS(png.h libpng/png.h)
2079 if test "$ac_cv_header_png_h" = yes || test "$ac_cv_header_libpng_png_h" = yes ; then
2080 AC_CHECK_LIB(png, png_get_channels, HAVE_PNG=yes, , -lz -lm)
2081 fi
2082 fi
2083
2084 if test "${HAVE_PNG}" = "yes"; then
2085 AC_DEFINE(HAVE_PNG, 1, [Define to 1 if you have the png library (-lpng).])
2086 fi
2087 fi
2088
2089 ### Use -ltiff if available, unless `--with-tiff=no'.
2090 HAVE_TIFF=no
2091 if test "${HAVE_X11}" = "yes"; then
2092 if test "${with_tiff}" != "no"; then
2093 AC_CHECK_HEADER(tiffio.h,
2094 [tifflibs="-lz -lm"
2095 # At least one tiff package requires the jpeg library.
2096 if test "${HAVE_JPEG}" = yes; then tifflibs="-ljpeg $tifflibs"; fi
2097 AC_CHECK_LIB(tiff, TIFFGetVersion, HAVE_TIFF=yes, , $tifflibs)])
2098 fi
2099
2100 if test "${HAVE_TIFF}" = "yes"; then
2101 AC_DEFINE(HAVE_TIFF, 1, [Define to 1 if you have the tiff library (-ltiff).])
2102 fi
2103 fi
2104
2105 ### Use -lgif or -lungif if available, unless `--with-gif=no'.
2106 HAVE_GIF=no
2107 if test "${HAVE_X11}" = "yes" && test "${with_gif}" != "no"; then
2108 AC_CHECK_HEADER(gif_lib.h,
2109 # EGifPutExtensionLast only exists from version libungif-4.1.0b1.
2110 # Earlier versions can crash Emacs.
2111 [AC_CHECK_LIB(gif, EGifPutExtensionLast, HAVE_GIF=yes, try_libungif=yes)])
2112
2113 if test "$HAVE_GIF" = yes; then
2114 ac_gif_lib_name="-lgif"
2115 fi
2116
2117 # If gif_lib.h but no libgif, try libungif.
2118 if test x"$try_libungif" = xyes; then
2119 AC_CHECK_LIB(ungif, EGifPutExtensionLast, HAVE_GIF=yes)
2120
2121 if test "$HAVE_GIF" = yes; then
2122 AC_DEFINE(LIBGIF, -lungif, [Compiler option to link with the gif library (if not -lgif).])
2123 ac_gif_lib_name="-lungif"
2124 fi
2125 fi
2126
2127 if test "${HAVE_GIF}" = "yes"; then
2128 AC_DEFINE(HAVE_GIF, 1, [Define to 1 if you have a gif library (default -lgif; otherwise specify with LIBGIF).])
2129 fi
2130 fi
2131
2132 dnl Check for required libraries.
2133 if test "${HAVE_X11}" = "yes"; then
2134 MISSING=""
2135 WITH_NO=""
2136 test "${with_xpm}" != "no" && test "${HAVE_XPM}" != "yes" &&
2137 MISSING="libXpm" && WITH_NO="--with-xpm=no"
2138 test "${with_jpeg}" != "no" && test "${HAVE_JPEG}" != "yes" &&
2139 MISSING="$MISSING libjpeg" && WITH_NO="$WITH_NO --with-jpeg=no"
2140 test "${with_png}" != "no" && test "${HAVE_PNG}" != "yes" &&
2141 MISSING="$MISSING libpng" && WITH_NO="$WITH_NO --with-png=no"
2142 test "${with_gif}" != "no" && test "${HAVE_GIF}" != "yes" &&
2143 MISSING="$MISSING libgif/libungif" && WITH_NO="$WITH_NO --with-gif=no"
2144 test "${with_tiff}" != "no" && test "${HAVE_TIFF}" != "yes" &&
2145 MISSING="$MISSING libtiff" && WITH_NO="$WITH_NO --with-tiff=no"
2146
2147 if test "X${MISSING}" != X; then
2148 AC_MSG_ERROR([The following required libraries were not found:
2149 $MISSING
2150 Maybe some development libraries/packages are missing?
2151 If you don't want to link with them give
2152 $WITH_NO
2153 as options to configure])
2154 fi
2155 fi
2156
2157 ### Use -lgpm if available, unless `--with-gpm=no'.
2158 HAVE_GPM=no
2159 if test "${with_gpm}" != "no"; then
2160 AC_CHECK_HEADER(gpm.h,
2161 [AC_CHECK_LIB(gpm, Gpm_Open, HAVE_GPM=yes)])
2162 fi
2163
2164 if test "${HAVE_GPM}" = "yes"; then
2165 AC_DEFINE(HAVE_GPM, 1, [Define to 1 if you have the gpm library (-lgpm).])
2166 fi
2167
2168 dnl Check for malloc/malloc.h on darwin
2169 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.])])
2170
2171 ### Use Mac OS X Carbon API to implement GUI.
2172 if test "${HAVE_CARBON}" = "yes"; then
2173 AC_DEFINE(HAVE_CARBON, 1, [Define to 1 if you are using the Carbon API on Mac OS X.])
2174 ## Specify the install directory
2175 carbon_appdir=
2176 if test "${carbon_appdir_x}" != ""; then
2177 case ${carbon_appdir_x} in
2178 y | ye | yes) carbon_appdir=/Applications ;;
2179 * ) carbon_appdir=${carbon_appdir_x} ;;
2180 esac
2181 fi
2182 # We also have mouse menus.
2183 HAVE_MENUS=yes
2184 fi
2185
2186 ### Use session management (-lSM -lICE) if available
2187 HAVE_X_SM=no
2188 if test "${HAVE_X11}" = "yes"; then
2189 AC_CHECK_HEADER(X11/SM/SMlib.h,
2190 [AC_CHECK_LIB(SM, SmcOpenConnection, HAVE_X_SM=yes, , -lICE)])
2191
2192 if test "${HAVE_X_SM}" = "yes"; then
2193 AC_DEFINE(HAVE_X_SM, 1, [Define to 1 if you have the SM library (-lSM).])
2194 case "$LIBS" in
2195 *-lSM*) ;;
2196 *) LIBS="-lSM -lICE $LIBS" ;;
2197 esac
2198 fi
2199 fi
2200
2201 # If netdb.h doesn't declare h_errno, we must declare it by hand.
2202 AC_CACHE_CHECK(whether netdb declares h_errno,
2203 emacs_cv_netdb_declares_h_errno,
2204 [AC_TRY_LINK([#include <netdb.h>],
2205 [return h_errno;],
2206 emacs_cv_netdb_declares_h_errno=yes, emacs_cv_netdb_declares_h_errno=no)])
2207 if test $emacs_cv_netdb_declares_h_errno = yes; then
2208 AC_DEFINE(HAVE_H_ERRNO, 1, [Define to 1 if netdb.h declares h_errno.])
2209 fi
2210
2211 AC_FUNC_ALLOCA
2212
2213 dnl src/alloca.c has been removed. Could also check if $ALLOCA is set?
2214 dnl FIXME is there an autoconf test that does the right thing, without
2215 dnl needing to call A_M_E afterwards?
2216 if test x"$ac_cv_func_alloca_works" != xyes; then
2217 AC_MSG_ERROR( [a system implementation of alloca is required] )
2218 fi
2219
2220 # fmod, logb, and frexp are found in -lm on most systems.
2221 # On HPUX 9.01, -lm does not contain logb, so check for sqrt.
2222 AC_CHECK_LIB(m, sqrt)
2223
2224 # Check for mail-locking functions in a "mail" library. Probably this should
2225 # have the same check as for liblockfile below.
2226 AC_CHECK_LIB(mail, maillock)
2227 dnl Debian, at least:
2228 AC_CHECK_LIB(lockfile, maillock)
2229 # If we have the shared liblockfile, assume we must use it for mail
2230 # locking (e.g. Debian). If we couldn't link against liblockfile
2231 # (no liblockfile.a installed), ensure that we don't need to.
2232 if test "$ac_cv_lib_lockfile_maillock" = no; then
2233 dnl This works for files generally, not just executables.
2234 dnl Should we look elsewhere for it? Maybe examine /etc/ld.so.conf?
2235 AC_CHECK_PROG(liblockfile, liblockfile.so, yes, no,
2236 /usr/lib:/lib:/usr/local/lib:$LD_LIBRARY_PATH)
2237 if test $ac_cv_prog_liblockfile = yes; then
2238 AC_MSG_ERROR([Shared liblockfile found but can't link against it.
2239 This probably means that movemail could lose mail.
2240 There may be a `development' package to install containing liblockfile.])
2241 else :
2242 fi
2243 fi
2244 AC_CHECK_FUNCS(touchlock)
2245 AC_CHECK_HEADERS(maillock.h)
2246
2247 AC_CHECK_FUNCS(gethostname getdomainname dup2 \
2248 rename closedir mkdir rmdir sysinfo getrusage get_current_dir_name \
2249 random lrand48 bcopy bcmp logb frexp fmod rint cbrt ftime setsid \
2250 strerror fpathconf select mktime euidaccess getpagesize tzset setlocale \
2251 utimes setrlimit setpgid getcwd getwd shutdown getaddrinfo \
2252 __fpending mblen mbrlen mbsinit strsignal setitimer ualarm index rindex \
2253 sendto recvfrom getsockopt setsockopt getsockname getpeername \
2254 gai_strerror mkstemp getline getdelim mremap memmove fsync sync bzero \
2255 memset memcmp difftime memcpy mempcpy mblen mbrlen posix_memalign)
2256
2257 AC_CHECK_HEADERS(sys/un.h)
2258
2259 AC_FUNC_MKTIME
2260 if test "$ac_cv_func_working_mktime" = no; then
2261 AC_DEFINE(BROKEN_MKTIME, 1, [Define to 1 if the mktime function is broken.])
2262 fi
2263
2264 AC_FUNC_GETLOADAVG
2265
2266 AC_FUNC_FSEEKO
2267
2268 # Configure getopt.
2269 m4_include([m4/getopt.m4])
2270 gl_GETOPT_IFELSE([
2271 gl_GETOPT_SUBSTITUTE_HEADER
2272 gl_PREREQ_GETOPT
2273 GETOPTOBJS='getopt.o getopt1.o'
2274 ])
2275 AC_SUBST(GETOPTOBJS)
2276
2277 AC_FUNC_GETPGRP
2278
2279 AC_FUNC_STRFTIME
2280
2281 # UNIX98 PTYs.
2282 AC_CHECK_FUNCS(grantpt)
2283
2284 # PTY-related GNU extensions.
2285 AC_CHECK_FUNCS(getpt)
2286
2287 # Check this now, so that we will NOT find the above functions in ncurses.
2288 # That is because we have not set up to link ncurses in lib-src.
2289 # It's better to believe a function is not available
2290 # than to expect to find it in ncurses.
2291 AC_CHECK_LIB(ncurses, tparm)
2292
2293 # Do we have res_init, for detecting changes in /etc/resolv.conf?
2294
2295 resolv=no
2296 AC_TRY_LINK([#include <netinet/in.h>
2297 #include <arpa/nameser.h>
2298 #include <resolv.h>],
2299 [return res_init();],
2300 have_res_init=yes, have_res_init=no)
2301 if test "$have_res_init" = no; then
2302 OLIBS="$LIBS"
2303 LIBS="$LIBS -lresolv"
2304 AC_MSG_CHECKING(for res_init with -lresolv)
2305 AC_TRY_LINK([#include <netinet/in.h>
2306 #include <arpa/nameser.h>
2307 #include <resolv.h>],
2308 [return res_init();],
2309 have_res_init=yes, have_res_init=no)
2310 AC_MSG_RESULT($have_res_init)
2311 if test "$have_res_init" = yes ; then
2312 resolv=yes
2313 fi
2314 LIBS="$OLIBS"
2315 fi
2316
2317 if test "$have_res_init" = yes; then
2318 AC_DEFINE(HAVE_RES_INIT, 1, [Define to 1 if res_init is available.])
2319 fi
2320
2321 # Do we need the Hesiod library to provide the support routines?
2322 if test "$with_hesiod" = yes ; then
2323 # Don't set $LIBS here -- see comments above.
2324 AC_CHECK_FUNC(res_send, , [AC_CHECK_FUNC(__res_send, ,
2325 [AC_CHECK_LIB(resolv, res_send, resolv=yes,
2326 [AC_CHECK_LIB(resolv, __res_send, resolv=yes)])])])
2327 if test "$resolv" = yes ; then
2328 RESOLVLIB=-lresolv
2329 else
2330 RESOLVLIB=
2331 fi
2332 AC_CHECK_FUNC(hes_getmailhost, , [AC_CHECK_LIB(hesiod, hes_getmailhost,
2333 [AC_DEFINE(HAVE_LIBHESIOD, 1,
2334 [Define to 1 if you have the hesiod library (-lhesiod).])],
2335 :, $RESOLVLIB)])
2336 fi
2337
2338 # Do we need libresolv (due to res_init or Hesiod)?
2339 if test "$resolv" = yes ; then
2340 AC_DEFINE(HAVE_LIBRESOLV, 1,
2341 [Define to 1 if you have the resolv library (-lresolv).])
2342 fi
2343
2344 # These tell us which Kerberos-related libraries to use.
2345 if test "${with_kerberos+set}" = set; then
2346 AC_CHECK_LIB(com_err, com_err)
2347 AC_CHECK_LIB(k5crypto, mit_des_cbc_encrypt)
2348 AC_CHECK_LIB(crypto, mit_des_cbc_encrypt)
2349 AC_CHECK_LIB(krb5, krb5_init_context)
2350 if test "${with_kerberos5+set}" != set; then
2351 AC_CHECK_LIB(des425, des_cbc_encrypt,,
2352 [AC_CHECK_LIB(des, des_cbc_encrypt)])
2353 AC_CHECK_LIB(krb4, krb_get_cred,,
2354 [AC_CHECK_LIB(krb, krb_get_cred)])
2355 fi
2356
2357 if test "${with_kerberos5+set}" = set; then
2358 AC_CHECK_HEADERS(krb5.h)
2359 else
2360 AC_CHECK_HEADERS(des.h,,
2361 [AC_CHECK_HEADERS(kerberosIV/des.h,,
2362 [AC_CHECK_HEADERS(kerberos/des.h)])])
2363 AC_CHECK_HEADERS(krb.h,,
2364 [AC_CHECK_HEADERS(kerberosIV/krb.h,,
2365 [AC_CHECK_HEADERS(kerberos/krb.h)])])
2366 fi
2367 AC_CHECK_HEADERS(com_err.h)
2368 fi
2369
2370 # Solaris requires -lintl if you want strerror (which calls dgettext)
2371 # to return localized messages.
2372 AC_CHECK_LIB(intl, dgettext)
2373
2374 AC_MSG_CHECKING(whether localtime caches TZ)
2375 AC_CACHE_VAL(emacs_cv_localtime_cache,
2376 [if test x$ac_cv_func_tzset = xyes; then
2377 AC_TRY_RUN([#include <time.h>
2378 extern char **environ;
2379 unset_TZ ()
2380 {
2381 char **from, **to;
2382 for (to = from = environ; (*to = *from); from++)
2383 if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '='))
2384 to++;
2385 }
2386 char TZ_GMT0[] = "TZ=GMT0";
2387 char TZ_PST8[] = "TZ=PST8";
2388 main()
2389 {
2390 time_t now = time ((time_t *) 0);
2391 int hour_GMT0, hour_unset;
2392 if (putenv (TZ_GMT0) != 0)
2393 exit (1);
2394 hour_GMT0 = localtime (&now)->tm_hour;
2395 unset_TZ ();
2396 hour_unset = localtime (&now)->tm_hour;
2397 if (putenv (TZ_PST8) != 0)
2398 exit (1);
2399 if (localtime (&now)->tm_hour == hour_GMT0)
2400 exit (1);
2401 unset_TZ ();
2402 if (localtime (&now)->tm_hour != hour_unset)
2403 exit (1);
2404 exit (0);
2405 }], emacs_cv_localtime_cache=no, emacs_cv_localtime_cache=yes,
2406 [# If we have tzset, assume the worst when cross-compiling.
2407 emacs_cv_localtime_cache=yes])
2408 else
2409 # If we lack tzset, report that localtime does not cache TZ,
2410 # since we can't invalidate the cache if we don't have tzset.
2411 emacs_cv_localtime_cache=no
2412 fi])dnl
2413 AC_MSG_RESULT($emacs_cv_localtime_cache)
2414 if test $emacs_cv_localtime_cache = yes; then
2415 AC_DEFINE(LOCALTIME_CACHE, 1,
2416 [Define to 1 if localtime caches TZ.])
2417 fi
2418
2419 if test "x$HAVE_TIMEVAL" = xyes; then
2420 AC_CHECK_FUNCS(gettimeofday)
2421 if test $ac_cv_func_gettimeofday = yes; then
2422 AC_CACHE_CHECK(whether gettimeofday can accept two arguments,
2423 emacs_cv_gettimeofday_two_arguments,
2424 [AC_TRY_COMPILE([
2425 #ifdef TIME_WITH_SYS_TIME
2426 #include <sys/time.h>
2427 #include <time.h>
2428 #else
2429 #ifdef HAVE_SYS_TIME_H
2430 #include <sys/time.h>
2431 #else
2432 #include <time.h>
2433 #endif
2434 #endif],
2435 [struct timeval time;
2436 gettimeofday (&time, 0);],
2437 emacs_cv_gettimeofday_two_arguments=yes,
2438 emacs_cv_gettimeofday_two_arguments=no)])
2439 if test $emacs_cv_gettimeofday_two_arguments = no; then
2440 AC_DEFINE(GETTIMEOFDAY_ONE_ARGUMENT, 1,
2441 [Define to 1 if gettimeofday accepts only one argument.])
2442 fi
2443 fi
2444 fi
2445
2446 ok_so_far=yes
2447 AC_CHECK_FUNC(socket, , ok_so_far=no)
2448 if test $ok_so_far = yes; then
2449 AC_CHECK_HEADER(netinet/in.h, , ok_so_far=no)
2450 fi
2451 if test $ok_so_far = yes; then
2452 AC_CHECK_HEADER(arpa/inet.h, , ok_so_far=no)
2453 fi
2454 if test $ok_so_far = yes; then
2455 dnl Fixme: Not used. Should this be HAVE_SOCKETS?
2456 AC_DEFINE(HAVE_INET_SOCKETS, 1,
2457 [Define to 1 if you have inet sockets.])
2458 fi
2459
2460 AC_CHECK_HEADERS(sys/ioctl.h)
2461
2462 if test -f /usr/lpp/X11/bin/smt.exp; then
2463 AC_DEFINE(HAVE_AIX_SMT_EXP, 1,
2464 [Define to 1 if the file /usr/lpp/X11/bin/smt.exp exists.])
2465 fi
2466
2467 AC_MSG_CHECKING(whether system supports dynamic ptys)
2468 if test -d /dev/pts && ls -d /dev/ptmx > /dev/null 2>&1 ; then
2469 AC_MSG_RESULT(yes)
2470 AC_DEFINE(HAVE_DEV_PTMX, 1, [Define to 1 if dynamic ptys are supported.])
2471 else
2472 AC_MSG_RESULT(no)
2473 fi
2474
2475 AC_FUNC_FORK
2476
2477 dnl Adapted from Haible's version.
2478 AC_CACHE_CHECK([for nl_langinfo and CODESET], emacs_cv_langinfo_codeset,
2479 [AC_TRY_LINK([#include <langinfo.h>],
2480 [char* cs = nl_langinfo(CODESET);],
2481 emacs_cv_langinfo_codeset=yes,
2482 emacs_cv_langinfo_codeset=no)
2483 ])
2484 if test $emacs_cv_langinfo_codeset = yes; then
2485 AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
2486 [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
2487 fi
2488
2489 AC_CHECK_TYPES(size_t)
2490
2491 AC_TYPE_MBSTATE_T
2492
2493 dnl Restrict could probably be used effectively other than in regex.c.
2494 AC_CACHE_CHECK([for C restrict keyword], emacs_cv_c_restrict,
2495 [AC_TRY_COMPILE([void fred (int *restrict x);], [],
2496 emacs_cv_c_restrict=yes,
2497 [AC_TRY_COMPILE([void fred (int *__restrict x);], [],
2498 emacs_cv_c_restrict=__restrict,
2499 emacs_cv_c_restrict=no)])])
2500 case "$emacs_cv_c_restrict" in
2501 yes) emacs_restrict=restrict;;
2502 no) emacs_restrict="";;
2503 *) emacs_restrict="$emacs_cv_c_restrict";;
2504 esac
2505 if test "$emacs_restrict" != __restrict; then
2506 AC_DEFINE_UNQUOTED(__restrict, $emacs_restrict,
2507 [Define to compiler's equivalent of C99 restrict keyword.
2508 Don't define if equivalent is `__restrict'.])
2509 fi
2510
2511 AC_CACHE_CHECK([for C restricted array declarations], emacs_cv_c_restrict_arr,
2512 [AC_TRY_COMPILE([void fred (int x[__restrict]);], [],
2513 emacs_cv_c_restrict_arr=yes, emacs_cv_c_restrict_arr=no)])
2514 if test "$emacs_cv_c_restrict_arr" = yes; then
2515 AC_DEFINE(__restrict_arr, __restrict,
2516 [Define to compiler's equivalent of C99 restrict keyword in array
2517 declarations. Define as empty for no equivalent.])
2518 fi
2519
2520 dnl Fixme: AC_SYS_POSIX_TERMIOS should probably be used, but it's not clear
2521 dnl how the tty code is related to POSIX and/or other versions of termios.
2522 dnl The following looks like a useful start.
2523 dnl
2524 dnl AC_SYS_POSIX_TERMIOS
2525 dnl if test $ac_cv_sys_posix_termios = yes; then
2526 dnl AC_DEFINE(HAVE_TERMIOS, 1, [Define to 1 if you have POSIX-style functions
2527 dnl and macros for terminal control.])
2528 dnl AC_DEFINE(HAVE_TCATTR, 1, [Define to 1 if you have tcgetattr and tcsetattr.])
2529 dnl fi
2530
2531 dnl Fixme: Use AC_FUNC_MEMCMP since memcmp is used. (Needs libobj replacement.)
2532
2533 # Set up the CFLAGS for real compilation, so we can substitute it.
2534 CFLAGS="$REAL_CFLAGS"
2535 CPPFLAGS="$REAL_CPPFLAGS"
2536
2537 #### Find out which version of Emacs this is.
2538 [version=`grep 'defconst[ ]*emacs-version' ${srcdir}/lisp/version.el \
2539 | sed -e 's/^[^"]*"\([^"]*\)".*$/\1/'`]
2540 if test x"${version}" = x; then
2541 AC_MSG_ERROR([can't find current emacs version in `${srcdir}/lisp/version.el'.])
2542 fi
2543
2544 ### Specify what sort of things we'll be editing into Makefile and config.h.
2545 ### Use configuration here uncanonicalized to avoid exceeding size limits.
2546 AC_SUBST(version)
2547 AC_SUBST(configuration)
2548 AC_SUBST(canonical)
2549 AC_SUBST(srcdir)
2550 AC_SUBST(prefix)
2551 AC_SUBST(exec_prefix)
2552 AC_SUBST(bindir)
2553 AC_SUBST(datadir)
2554 AC_SUBST(sharedstatedir)
2555 AC_SUBST(libexecdir)
2556 AC_SUBST(mandir)
2557 AC_SUBST(infodir)
2558 AC_SUBST(lispdir)
2559 AC_SUBST(locallisppath)
2560 AC_SUBST(lisppath)
2561 AC_SUBST(x_default_search_path)
2562 AC_SUBST(etcdir)
2563 AC_SUBST(archlibdir)
2564 AC_SUBST(docdir)
2565 AC_SUBST(bitmapdir)
2566 AC_SUBST(gamedir)
2567 AC_SUBST(gameuser)
2568 AC_SUBST(c_switch_system)
2569 AC_SUBST(c_switch_machine)
2570 AC_SUBST(LD_SWITCH_X_SITE)
2571 AC_SUBST(LD_SWITCH_X_SITE_AUX)
2572 AC_SUBST(C_SWITCH_X_SITE)
2573 AC_SUBST(CFLAGS)
2574 AC_SUBST(X_TOOLKIT_TYPE)
2575 AC_SUBST(machfile)
2576 AC_SUBST(opsysfile)
2577 AC_SUBST(GETLOADAVG_LIBS)
2578 AC_SUBST(carbon_appdir)
2579
2580 AC_DEFINE_UNQUOTED(EMACS_CONFIGURATION, "${canonical}",
2581 [Define to the canonical Emacs configuration name.])
2582 AC_DEFINE_UNQUOTED(EMACS_CONFIG_OPTIONS, "${ac_configure_args}",
2583 [Define to the options passed to configure.])
2584 AC_DEFINE_UNQUOTED(config_machfile, "${machfile}",
2585 [Define to the used machine dependent file.])
2586 AC_DEFINE_UNQUOTED(config_opsysfile, "${opsysfile}",
2587 [Define to the used os dependent file.])
2588 AC_DEFINE_UNQUOTED(LD_SWITCH_X_SITE, ${LD_SWITCH_X_SITE},
2589 [Define LD_SWITCH_X_SITE to contain any special flags your loader
2590 may need to deal with X Windows. For instance, if you've defined
2591 HAVE_X_WINDOWS above and your X libraries aren't in a place that
2592 your loader can find on its own, you might want to add "-L/..." or
2593 something similar.])
2594 AC_DEFINE_UNQUOTED(LD_SWITCH_X_SITE_AUX, ${LD_SWITCH_X_SITE_AUX},
2595 [Define LD_SWITCH_X_SITE_AUX with an -R option
2596 in case it's needed (for Solaris, for example).])
2597 AC_DEFINE_UNQUOTED(C_SWITCH_X_SITE, ${C_SWITCH_X_SITE},
2598 [Define C_SWITCH_X_SITE to contain any special flags your compiler
2599 may need to deal with X Windows. For instance, if you've defined
2600 HAVE_X_WINDOWS above and your X include files aren't in a place
2601 that your compiler can find on its own, you might want to add
2602 "-I/..." or something similar.])
2603 AC_DEFINE_UNQUOTED(UNEXEC_SRC, ${UNEXEC_SRC},
2604 [Define to the unexec source file name.])
2605
2606 if test "${HAVE_X_WINDOWS}" = "yes" ; then
2607 AC_DEFINE(HAVE_X_WINDOWS, 1,
2608 [Define to 1 if you want to use the X window system.])
2609 fi
2610 if test "${USE_X_TOOLKIT}" != "none" ; then
2611 AC_DEFINE(USE_X_TOOLKIT, 1, [Define to 1 if using an X toolkit.])
2612 fi
2613 if test "${HAVE_X11}" = "yes" ; then
2614 AC_DEFINE(HAVE_X11, 1,
2615 [Define to 1 if you want to use version 11 of X windows.
2616 Otherwise, Emacs expects to use version 10.])
2617 fi
2618 if test "${HAVE_XFREE386}" = "yes" ; then
2619 AC_DEFINE(HAVE_XFREE386, 1, [Define to 1 if you're using XFree386.])
2620 fi
2621 if test "${HAVE_MENUS}" = "yes" ; then
2622 AC_DEFINE(HAVE_MENUS, 1,
2623 [Define to 1 if you have mouse menus.
2624 (This is automatic if you use X, but the option to specify it remains.)
2625 It is also defined with other window systems that support xmenu.c.])
2626 fi
2627 if test "${GNU_MALLOC}" = "yes" ; then
2628 AC_DEFINE(GNU_MALLOC, 1,
2629 [Define to 1 if you want to use the GNU memory allocator.])
2630 fi
2631 if test "${REL_ALLOC}" = "yes" ; then
2632 AC_DEFINE(REL_ALLOC, 1,
2633 [Define REL_ALLOC if you want to use the relocating allocator for
2634 buffer space.])
2635 fi
2636
2637
2638 AH_TOP([/* GNU Emacs site configuration template file.
2639 Copyright (C) 1988, 1993, 1994, 1999, 2000, 2001, 2002, 2004, 2005,
2640 2006, 2007, 2008 Free Software Foundation, Inc.
2641
2642 This file is part of GNU Emacs.
2643
2644 GNU Emacs is free software; you can redistribute it and/or modify
2645 it under the terms of the GNU General Public License as published by
2646 the Free Software Foundation; either version 3, or (at your option)
2647 any later version.
2648
2649 GNU Emacs is distributed in the hope that it will be useful,
2650 but WITHOUT ANY WARRANTY; without even the implied warranty of
2651 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2652 GNU General Public License for more details.
2653
2654 You should have received a copy of the GNU General Public License
2655 along with GNU Emacs; see the file COPYING. If not, write to the
2656 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
2657 Boston, MA 02110-1301, USA. */
2658
2659
2660 /* No code in Emacs #includes config.h twice, but some bits of code
2661 intended to work with other packages as well (like gmalloc.c)
2662 think they can include it as many times as they like. */
2663 #ifndef EMACS_CONFIG_H
2664 #define EMACS_CONFIG_H
2665 ])dnl
2666
2667 AH_BOTTOM([
2668 /* If we're using any sort of window system, define some consequences. */
2669 #ifdef HAVE_X_WINDOWS
2670 #define HAVE_WINDOW_SYSTEM
2671 #define MULTI_KBOARD
2672 #define HAVE_MOUSE
2673 #endif
2674
2675 /* Multi-tty support relies on MULTI_KBOARD. It seems safe to turn it
2676 on unconditionally. Note that src/s/darwin.h disables this at
2677 present. */
2678 #ifndef MULTI_KBOARD
2679 #define MULTI_KBOARD
2680 #endif
2681
2682 /* If we're using the Carbon API on Mac OS X, define a few more
2683 variables as well. */
2684 #ifdef HAVE_CARBON
2685 #define HAVE_WINDOW_SYSTEM
2686 #define HAVE_MOUSE
2687 #endif
2688
2689 /* Define USER_FULL_NAME to return a string
2690 that is the user's full name.
2691 It can assume that the variable `pw'
2692 points to the password file entry for this user.
2693
2694 At some sites, the pw_gecos field contains
2695 the user's full name. If neither this nor any other
2696 field contains the right thing, use pw_name,
2697 giving the user's login name, since that is better than nothing. */
2698 #define USER_FULL_NAME pw->pw_gecos
2699
2700 /* Define AMPERSAND_FULL_NAME if you use the convention
2701 that & in the full name stands for the login id. */
2702 /* Turned on June 1996 supposing nobody will mind it. */
2703 #define AMPERSAND_FULL_NAME
2704
2705 /* We have blockinput.h. */
2706 #define DO_BLOCK_INPUT
2707
2708 /* Define HAVE_SOUND if we have sound support. We know it works
2709 and compiles only on the specified platforms. For others,
2710 it probably doesn't make sense to try. */
2711
2712 #if defined __FreeBSD__ || defined __NetBSD__ || defined __linux__
2713 #ifdef HAVE_MACHINE_SOUNDCARD_H
2714 #define HAVE_SOUND 1
2715 #endif
2716 #ifdef HAVE_SYS_SOUNDCARD_H
2717 #define HAVE_SOUND 1
2718 #endif
2719 #ifdef HAVE_SOUNDCARD_H
2720 #define HAVE_SOUND 1
2721 #endif
2722 #ifdef HAVE_ALSA
2723 #define HAVE_SOUND 1
2724 #endif
2725 #endif /* __FreeBSD__ || __NetBSD__ || __linux__ */
2726
2727 /* If using GNU, then support inline function declarations. */
2728 /* Don't try to switch on inline handling as detected by AC_C_INLINE
2729 generally, because even if non-gcc compilers accept `inline', they
2730 may reject `extern inline'. */
2731 #if defined (__GNUC__) && defined (OPTIMIZE)
2732 #define INLINE __inline__
2733 #else
2734 #define INLINE
2735 #endif
2736
2737 /* Include the os and machine dependent files. */
2738 #include config_opsysfile
2739 #include config_machfile
2740
2741 /* Load in the conversion definitions if this system
2742 needs them and the source file being compiled has not
2743 said to inhibit this. There should be no need for you
2744 to alter these lines. */
2745
2746 #ifdef SHORTNAMES
2747 #ifndef NO_SHORTNAMES
2748 #include "../shortnames/remap.h"
2749 #endif /* not NO_SHORTNAMES */
2750 #endif /* SHORTNAMES */
2751
2752 /* If no remapping takes place, static variables cannot be dumped as
2753 pure, so don't worry about the `static' keyword. */
2754 #ifdef NO_REMAP
2755 #undef static
2756 #endif
2757
2758 /* Define `subprocesses' should be defined if you want to
2759 have code for asynchronous subprocesses
2760 (as used in M-x compile and M-x shell).
2761 These do not work for some USG systems yet;
2762 for the ones where they work, the s/SYSTEM.h file defines this flag. */
2763
2764 #ifndef VMS
2765 #ifndef USG
2766 /* #define subprocesses */
2767 #endif
2768 #endif
2769
2770 /* SIGTYPE is the macro we actually use. */
2771 #ifndef SIGTYPE
2772 #define SIGTYPE RETSIGTYPE
2773 #endif
2774
2775 #ifdef emacs /* Don't do this for lib-src. */
2776 /* Tell regex.c to use a type compatible with Emacs. */
2777 #define RE_TRANSLATE_TYPE Lisp_Object
2778 #define RE_TRANSLATE(TBL, C) CHAR_TABLE_TRANSLATE (TBL, C)
2779 #ifdef make_number
2780 /* If make_number is a macro, use it. */
2781 #define RE_TRANSLATE_P(TBL) (!EQ (TBL, make_number (0)))
2782 #else
2783 /* If make_number is a function, avoid it. */
2784 #define RE_TRANSLATE_P(TBL) (!(INTEGERP (TBL) && XINT (TBL) == 0))
2785 #endif
2786 #endif
2787
2788 /* Avoid link-time collision with system mktime if we will use our own. */
2789 #if ! HAVE_MKTIME || BROKEN_MKTIME
2790 #define mktime emacs_mktime
2791 #endif
2792
2793 #define my_strftime nstrftime /* for strftime.c */
2794
2795 /* The rest of the code currently tests the CPP symbol BSTRING.
2796 Override any claims made by the system-description files.
2797 Note that on some SCO version it is possible to have bcopy and not bcmp. */
2798 #undef BSTRING
2799 #if defined (HAVE_BCOPY) && defined (HAVE_BCMP)
2800 #define BSTRING
2801 #endif
2802
2803 /* Some of the files of Emacs which are intended for use with other
2804 programs assume that if you have a config.h file, you must declare
2805 the type of getenv.
2806
2807 This declaration shouldn't appear when alloca.s or Makefile.in
2808 includes config.h. */
2809 #ifndef NOT_C_CODE
2810 extern char *getenv ();
2811 #endif
2812
2813 /* These default definitions are good for almost all machines.
2814 The exceptions override them in m/MACHINE.h. */
2815
2816 #ifndef BITS_PER_CHAR
2817 #define BITS_PER_CHAR 8
2818 #endif
2819
2820 #ifndef BITS_PER_SHORT
2821 #define BITS_PER_SHORT 16
2822 #endif
2823
2824 /* Note that lisp.h uses this in a preprocessor conditional, so it
2825 would not work to use sizeof. That being so, we do all of them
2826 without sizeof, for uniformity's sake. */
2827 #ifndef BITS_PER_INT
2828 #define BITS_PER_INT 32
2829 #endif
2830
2831 #ifndef BITS_PER_LONG
2832 #ifdef _LP64
2833 #define BITS_PER_LONG 64
2834 #else
2835 #define BITS_PER_LONG 32
2836 #endif
2837 #endif
2838
2839 /* Define if the compiler supports function prototypes. It may do so
2840 but not define __STDC__ (e.g. DEC C by default) or may define it as
2841 zero. */
2842 #undef PROTOTYPES
2843 /* For mktime.c: */
2844 #ifndef __P
2845 # if defined PROTOTYPES
2846 # define __P(args) args
2847 # else
2848 # define __P(args) ()
2849 # endif /* GCC. */
2850 #endif /* __P */
2851
2852 /* Don't include "string.h" or <stdlib.h> in non-C code. */
2853 #ifndef NOT_C_CODE
2854 #ifdef HAVE_STRING_H
2855 #include "string.h"
2856 #endif
2857 #ifdef HAVE_STRINGS_H
2858 #include "strings.h" /* May be needed for bcopy & al. */
2859 #endif
2860 #ifdef HAVE_STDLIB_H
2861 #include <stdlib.h>
2862 #endif
2863 #ifndef __GNUC__
2864 # ifdef HAVE_ALLOCA_H
2865 # include <alloca.h>
2866 # else /* AIX files deal with #pragma. */
2867 # ifndef alloca /* predefined by HP cc +Olibcalls */
2868 char *alloca ();
2869 # endif
2870 # endif /* HAVE_ALLOCA_H */
2871 #endif /* __GNUC__ */
2872 #ifndef HAVE_SIZE_T
2873 typedef unsigned size_t;
2874 #endif
2875 #endif /* NOT_C_CODE */
2876
2877 /* Define HAVE_X_I18N if we have usable i18n support. */
2878
2879 #ifdef HAVE_X11R6
2880 #define HAVE_X_I18N
2881 #elif !defined X11R5_INHIBIT_I18N
2882 #define HAVE_X_I18N
2883 #endif
2884
2885 /* Define HAVE_X11R6_XIM if we have usable X11R6-style XIM support. */
2886
2887 #if defined HAVE_X11R6 && !defined INHIBIT_X11R6_XIM
2888 #define HAVE_X11R6_XIM
2889 #endif
2890
2891 /* Should we enable expensive run-time checking of data types? */
2892 #undef ENABLE_CHECKING
2893
2894 #if defined __GNUC__ && (__GNUC__ > 2 \
2895 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
2896 #define NO_RETURN __attribute__ ((__noreturn__))
2897 #else
2898 #define NO_RETURN /* nothing */
2899 #endif
2900
2901 /* These won't be used automatically yet. We also need to know, at least,
2902 that the stack is continuous. */
2903 #ifdef __GNUC__
2904 # ifndef GC_SETJMP_WORKS
2905 /* GC_SETJMP_WORKS is nearly always appropriate for GCC --
2906 see NON_SAVING_SETJMP in the target descriptions. */
2907 /* Exceptions (see NON_SAVING_SETJMP in target description) are
2908 SCO5 non-ELF (but Emacs specifies ELF) and SVR3 on x86.
2909 Fixme: Deal with SVR3. */
2910 # define GC_SETJMP_WORKS 1
2911 # endif
2912 # ifndef GC_LISP_OBJECT_ALIGNMENT
2913 # define GC_LISP_OBJECT_ALIGNMENT (__alignof__ (Lisp_Object))
2914 # endif
2915 #endif
2916
2917 #ifndef HAVE_BCOPY
2918 #define bcopy(a,b,s) memcpy (b,a,s)
2919 #endif
2920 #ifndef HAVE_BZERO
2921 #define bzero(a,s) memset (a,0,s)
2922 #endif
2923 #ifndef HAVE_BCMP
2924 #define BCMP memcmp
2925 #endif
2926
2927 #endif /* EMACS_CONFIG_H */
2928
2929 /*
2930 Local Variables:
2931 mode: c
2932 End:
2933 */
2934 ])dnl
2935
2936 #### Report on what we decided to do.
2937 #### Report GTK as a toolkit, even if it doesn't use Xt.
2938 #### It makes printing result more understandable as using GTK sets
2939 #### toolkit_scroll_bars to yes by default.
2940 if test "${HAVE_GTK}" = "yes"; then
2941 USE_X_TOOLKIT=GTK
2942 fi
2943
2944 echo "
2945 Configured for \`${canonical}'.
2946
2947 Where should the build process find the source code? ${srcdir}
2948 What operating system and machine description files should Emacs use?
2949 \`${opsysfile}' and \`${machfile}'
2950 What compiler should emacs be built with? ${CC} ${CFLAGS}
2951 Should Emacs use the GNU version of malloc? ${GNU_MALLOC}${GNU_MALLOC_reason}
2952 Should Emacs use a relocating allocator for buffers? ${REL_ALLOC}
2953 Should Emacs use mmap(2) for buffer allocation? $use_mmap_for_buffers
2954 What window system should Emacs use? ${window_system}
2955 What toolkit should Emacs use? ${USE_X_TOOLKIT}"
2956
2957 if test -n "${x_includes}"; then
2958 echo " Where do we find X Windows header files? ${x_includes}"
2959 else
2960 echo " Where do we find X Windows header files? Standard dirs"
2961 fi
2962 if test -n "${x_libraries}"; then
2963 echo " Where do we find X Windows libraries? ${x_libraries}"
2964 else
2965 echo " Where do we find X Windows libraries? Standard dirs"
2966 fi
2967
2968 echo " Does Emacs use -lXaw3d? ${HAVE_XAW3D}"
2969 echo " Does Emacs use -lXpm? ${HAVE_XPM}"
2970 echo " Does Emacs use -ljpeg? ${HAVE_JPEG}"
2971 echo " Does Emacs use -ltiff? ${HAVE_TIFF}"
2972 echo " Does Emacs use a gif library? ${HAVE_GIF} $ac_gif_lib_name"
2973 echo " Does Emacs use -lpng? ${HAVE_PNG}"
2974 echo " Does Emacs use -lrsvg-2? ${HAVE_RSVG}"
2975 echo " Does Emacs use -lgpm? ${HAVE_GPM}"
2976 echo " Does Emacs use -ldbus? ${HAVE_DBUS}"
2977 echo " Does Emacs use X toolkit scroll bars? ${USE_TOOLKIT_SCROLL_BARS}"
2978 echo
2979
2980 if test $USE_XASSERTS = yes; then
2981 echo " Compiling with asserts turned on."
2982 CPPFLAGS="$CPPFLAGS -DXASSERTS=1"
2983 echo
2984 fi
2985
2986 if test "$USE_X_TOOLKIT" = GTK; then
2987 case "$canonical" in
2988 *cygwin*)
2989 echo "There are known problems with Emacs and Gtk+ on cygwin, so you
2990 will probably get a crash on startup. If this happens, please use another
2991 toolkit for Emacs. See etc/PROBLEMS for more information."
2992 ;;
2993 esac
2994 fi
2995
2996
2997 if test "$HAVE_CARBON" = "yes"; then
2998 echo
2999 echo "Warning: The Mac Carbon port is currently unsupported and has
3000 known problems. It is not recommended for use by non-developers.
3001 Read the emacs-devel archives for more information."
3002 echo
3003 fi
3004
3005 if test "$HAVE_DBUS" = yes && test "${opsys}" != "gnu-linux"; then
3006 echo "D-Bus integration has been tested for GNU/Linux only."
3007 echo
3008 fi
3009
3010
3011 # Remove any trailing slashes in these variables.
3012 [test "${prefix}" != NONE &&
3013 prefix=`echo "${prefix}" | sed 's,\([^/]\)/*$,\1,'`
3014 test "${exec_prefix}" != NONE &&
3015 exec_prefix=`echo "${exec_prefix}" | sed 's,\([^/]\)/*$,\1,'`]
3016
3017 ## Check if the C preprocessor will convert `..' to `. .'. If so, set
3018 ## CPP_NEED_TRADITIONAL to `yes' so that the code to generate Makefile
3019 ## from Makefile.c can correctly provide the arg `-traditional' to the
3020 ## C preprocessor.
3021
3022 AC_EGREP_CPP(yes..yes,
3023 [yes..yes],
3024 CPP_NEED_TRADITIONAL=no,
3025 CPP_NEED_TRADITIONAL=yes)
3026
3027 AC_OUTPUT(Makefile lib-src/Makefile.c:lib-src/Makefile.in oldXMenu/Makefile \
3028 doc/emacs/Makefile doc/misc/Makefile doc/lispintro/Makefile \
3029 doc/lispref/Makefile src/Makefile.c:src/Makefile.in \
3030 lwlib/Makefile lisp/Makefile leim/Makefile, [
3031
3032 ### Make the necessary directories, if they don't exist.
3033 for dir in etc lisp ; do
3034 test -d ${dir} || mkdir ${dir}
3035 done
3036
3037 # Build src/Makefile from ${srcdir}/src/Makefile.c
3038 # and lib-src/Makefile from ${srcdir}/lib-src/Makefile.c
3039 # This must be done after src/config.h is built, since we rely on that file.
3040
3041 # Now get this: Some word that is part of the ${srcdir} directory name
3042 # or the ${configuration} value might, just might, happen to be an
3043 # identifier like `sun4' or `i386' or something, and be predefined by
3044 # the C preprocessor to some helpful value like 1, or maybe the empty
3045 # string. Needless to say consequent macro substitutions are less
3046 # than conducive to the makefile finding the correct directory.
3047 [undefs="`echo $top_srcdir $configuration $canonical |
3048 sed -e 's/[^a-zA-Z0-9_]/ /g' -e 's/^/ /' -e 's/ *$//' \
3049 -e 's/ */ -U/g' -e 's/-U[0-9][^ ]*//g' \
3050 `"]
3051
3052 echo creating src/epaths.h
3053 ${MAKE-make} epaths-force
3054
3055 # As of 2000-11-19, newest development versions of GNU cpp preprocess
3056 # `..' to `. .' unless invoked with -traditional
3057
3058 if test "x$GCC" = xyes && test "x$CPP_NEED_TRADITIONAL" = xyes; then
3059 CPPFLAGS="$CPPFLAGS -traditional"
3060 fi
3061
3062 echo creating lib-src/Makefile
3063 ( cd lib-src
3064 rm -f junk.c junk1.c junk2.c
3065 sed -e '/start of cpp stuff/q' \
3066 < Makefile.c > junk1.c
3067 sed -e '1,/start of cpp stuff/d'\
3068 -e 's,/\*\*/#\(.*\)$,/* \1 */,' \
3069 < Makefile.c > junk.c
3070 $CPP $undefs -I. -I$srcdir/src $CPPFLAGS junk.c | \
3071 sed -e 's/^ / /' -e '/^#/d' -e '/^[ \f]*$/d' > junk2.c
3072 cat junk1.c junk2.c > Makefile.new
3073 rm -f junk.c junk1.c junk2.c
3074 chmod 444 Makefile.new
3075 mv -f Makefile.new Makefile
3076 )
3077
3078 echo creating src/Makefile
3079 ( cd src
3080 rm -f junk.c junk1.c junk2.c
3081 sed -e '/start of cpp stuff/q' \
3082 < Makefile.c > junk1.c
3083 sed -e '1,/start of cpp stuff/d'\
3084 -e 's,/\*\*/#\(.*\)$,/* \1 */,' \
3085 < Makefile.c > junk.c
3086 $CPP $undefs -I. -I$srcdir/src $CPPFLAGS junk.c | \
3087 sed -e 's/^ / /' -e '/^#/d' -e '/^[ \f]*$/d' > junk2.c
3088 cat junk1.c junk2.c > Makefile.new
3089 rm -f junk.c junk1.c junk2.c
3090 chmod 444 Makefile.new
3091 mv -f Makefile.new Makefile
3092 )
3093
3094 if test ! -f src/.gdbinit && test -f $srcdir/src/.gdbinit; then
3095 echo creating src/.gdbinit
3096 echo source $srcdir/src/.gdbinit > src/.gdbinit
3097 fi
3098
3099 # This is how we know whether to re-run configure in certain cases.
3100 touch src/config.stamp
3101
3102 ], [GCC="$GCC" NON_GNU_CPP="$NON_GNU_CPP" CPP="$CPP" CPP_NEED_TRADITIONAL="$CPP_NEED_TRADITIONAL" CPPFLAGS="$CPPFLAGS"])
3103
3104 m4_if(dnl Do not change this comment
3105 arch-tag: 156a4dd5-bddc-4d18-96ac-f37742cf6a5e
3106 )dnl