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