1 dnl Autoconf script for GNU Emacs
2 dnl To rebuild the `configure' script from this, execute the command
4 dnl in the directory containing this script.
6 dnl Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2003,
7 dnl 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
9 dnl This file is part of GNU Emacs.
11 dnl GNU Emacs is free software; you can redistribute it and/or modify
12 dnl it under the terms of the GNU General Public License as published by
13 dnl the Free Software Foundation; either version 3, or (at your option)
14 dnl any later version.
16 dnl GNU Emacs is distributed in the hope that it will be useful,
17 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
18 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 dnl GNU General Public License for more details.
21 dnl You should have received a copy of the GNU General Public License
22 dnl along with GNU Emacs; see the file COPYING. If not, write to the
23 dnl Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 dnl Boston, MA 02110-1301, USA.
27 AC_INIT(emacs, 23.0.50)
28 AC_CONFIG_HEADER(src/config.h:src/config.in)
29 AC_CONFIG_SRCDIR(src/lisp.h)
31 dnl Support for --program-prefix, --program-suffix and
32 dnl --program-transform-name options
35 lispdir='${datadir}/emacs/${version}/lisp'
36 locallisppath='${datadir}/emacs/${version}/site-lisp:'\
37 '${datadir}/emacs/site-lisp'
38 lisppath='${locallisppath}:${lispdir}:${datadir}/emacs/${version}/leim'
39 etcdir='${datadir}/emacs/${version}/etc'
40 archlibdir='${libexecdir}/emacs/${version}/${configuration}'
41 docdir='${datadir}/emacs/${version}/etc'
42 gamedir='${localstatedir}/games/emacs'
46 dnl OPTION_DEFAULT_OFF(NAME, HELP-STRING)
47 dnl Create a new --with option that defaults to being disabled.
48 dnl NAME is the base name of the option. The shell variable with_NAME
49 dnl will be set to either the user's value (if the option is
50 dnl specified; 'yes' for a plain --with-NAME) or to 'no' (if the
51 dnl option is not specified). Note that the shell variable name is
52 dnl constructed as autoconf does, by replacing non-alphanumeric
53 dnl characters with "_".
54 dnl HELP-STRING is the help text for the option.
55 AC_DEFUN([OPTION_DEFAULT_OFF], [dnl
56 AC_ARG_WITH([$1],[AS_HELP_STRING([--with-$1],[$2])],[],[dnl
57 m4_bpatsubst([with_$1], [[^0-9a-z]], [_])=no])dnl
60 dnl OPTION_DEFAULT_ON(NAME, HELP-STRING)
61 dnl Create a new --with option that defaults to being enabled. NAME
62 dnl is the base name of the option. The shell variable with_NAME
63 dnl will be set either to 'no' (for a plain --without-NAME) or to
64 dnl 'yes' (if the option is not specified). Note that the shell
65 dnl variable name is constructed as autoconf does, by replacing
66 dnl non-alphanumeric characters with "_".
67 dnl HELP-STRING is the help text for the option.
68 AC_DEFUN([OPTION_DEFAULT_ON], [dnl
69 AC_ARG_WITH([$1],[AS_HELP_STRING([--without-$1],[$2])],[],[dnl
70 m4_bpatsubst([with_$1], [[^0-9a-z]], [_])=yes])dnl
73 OPTION_DEFAULT_ON([gcc],[don't use GCC to compile Emacs if GCC is found])
75 OPTION_DEFAULT_ON([pop],[don't support POP mail retrieval with movemail])
76 if test "$with_pop" = yes; then
77 AC_DEFINE(MAIL_USE_POP)
79 AH_TEMPLATE(MAIL_USE_POP, [Define to support POP mail retrieval.])dnl
81 OPTION_DEFAULT_OFF([kerberos],[support Kerberos-authenticated POP])
82 if test "$with_kerberos" = yes; then
86 [Define to support Kerberos-authenticated POP mail retrieval.])dnl
88 OPTION_DEFAULT_OFF([kerberos5],[support Kerberos version 5 authenticated POP])
89 if test "${with_kerberos5}" = yes; then
90 if test "${with_kerberos}" != yes; then
94 AC_DEFINE(KERBEROS5, 1, [Define to use Kerberos 5 instead of Kerberos 4.])
97 OPTION_DEFAULT_OFF([hesiod],[support Hesiod to get the POP server host])
98 if test "$with_hesiod" = yes; then
99 AC_DEFINE(HESIOD, 1, [Define to support using a Hesiod database to find the POP server.])
102 OPTION_DEFAULT_ON([sound],[don't compile with sound support])
104 dnl FIXME currently it is not the last.
105 dnl This should be the last --with option, because --with-x is
106 dnl added later on when we find the path of X, and it's best to
107 dnl keep them together visually.
108 AC_ARG_WITH([x-toolkit],[AS_HELP_STRING([--with-x-toolkit=KIT],
109 [use an X toolkit (KIT one of: yes, lucid, athena, motif, gtk, no)])],
110 [ case "${withval}" in
111 y | ye | yes ) val=gtk ;;
113 l | lu | luc | luci | lucid ) val=lucid ;;
114 a | at | ath | athe | athen | athena ) val=athena ;;
115 m | mo | mot | moti | motif ) val=motif ;;
116 g | gt | gtk ) val=gtk ;;
118 AC_MSG_ERROR([`--with-x-toolkit=$withval' is invalid;
119 this option's value should be `yes', `no', `lucid', `athena', `motif' or `gtk'.
120 `yes' and `gtk' are synonyms. `athena' and `lucid' are synonyms.])
126 dnl _ON results in a '--without' option in the --help output, so
127 dnl the help text should refer to "don't compile", etc.
128 OPTION_DEFAULT_ON([xpm],[don't compile with XPM image support])
129 OPTION_DEFAULT_ON([jpeg],[don't compile with JPEG image support])
130 OPTION_DEFAULT_ON([tiff],[don't compile with TIFF image support])
131 OPTION_DEFAULT_ON([gif],[don't compile with GIF image support])
132 OPTION_DEFAULT_ON([png],[don't compile with PNG image support])
133 OPTION_DEFAULT_ON([rsvg],[don't compile with SVG image support])
135 OPTION_DEFAULT_OFF([gtk],[use GTK toolkit])
136 OPTION_DEFAULT_ON([toolkit-scroll-bars],[don't use Motif or Xaw3d scroll bars])
137 OPTION_DEFAULT_ON([xaw3d],[don't use Xaw3d])
138 OPTION_DEFAULT_ON([xim],[don't use X11 XIM])
139 OPTION_DEFAULT_OFF([carbon],[use Carbon GUI on Mac OS X. **UNSUPPORTED!**])
141 OPTION_DEFAULT_ON([gpm],[don't use -lgpm for mouse support on a GNU/Linux console])
142 OPTION_DEFAULT_OFF([dbus],[compile with D-Bus support])
145 AC_ARG_WITH([pkg-config-prog],dnl
146 [AS_HELP_STRING([--with-pkg-config-prog=PATH],
147 [Path to pkg-config for finding GTK and librsvg])])
148 if test "X${with_pkg_config_prog}" != X; then
149 if test "${with_pkg_config_prog}" != yes; then
150 PKG_CONFIG="${with_pkg_config_prog}"
154 AC_ARG_ENABLE(carbon-app,
155 [AS_HELP_STRING([--enable-carbon-app@<:@=DIR@:>@],
156 [specify install directory for Emacs.app on Mac OS X
157 [DIR=/Application]])],
158 [ carbon_appdir_x=${enableval}])
160 AC_ARG_ENABLE(asserts,
161 [AS_HELP_STRING([--enable-asserts], [compile code with asserts enabled])],
162 USE_XASSERTS=$enableval,
165 AC_ARG_ENABLE(maintainer-mode,
166 [AS_HELP_STRING([--enable-maintainer-mode],
167 [enable make rules and dependencies not useful (and sometimes
168 confusing) to the casual installer])],
169 USE_MAINTAINER_MODE=$enableval,
170 USE_MAINTAINER_MODE=no)
171 if test $USE_MAINTAINER_MODE = yes; then
178 AC_ARG_ENABLE(locallisppath,
179 [AS_HELP_STRING([--enable-locallisppath=PATH],
180 [directories Emacs should search for lisp files specific
182 if test "${enableval}" = "no"; then
184 elif test "${enableval}" != "yes"; then
185 locallisppath=${enableval}
188 #### Make srcdir absolute, if it isn't already. It's important to
189 #### avoid running the path through pwd unnecessarily, since pwd can
190 #### give you automounter prefixes, which can go away. We do all this
191 #### so Emacs can find its files when run uninstalled.
192 ## Make sure CDPATH doesn't affect cd (in case PWD is relative).
197 ## We may be able to use the $PWD environment variable to make this
198 ## absolute. But sometimes PWD is inaccurate.
199 ## Note: we used to use ${PWD} at the end instead of `pwd`,
200 ## but that tested only for a well-formed and valid PWD,
201 ## it did not object when PWD was well-formed and valid but just wrong.
202 if test ".${PWD}" != "." && test ".`(cd ${PWD} ; sh -c pwd)`" = ".`pwd`" ;
206 srcdir="`(cd ${srcdir}; pwd)`"
209 * ) srcdir="`(cd ${srcdir}; pwd)`" ;;
212 #### Check if the source directory already has a configured system in it.
213 if test `pwd` != `(cd ${srcdir} && pwd)` \
214 && test -f "${srcdir}/src/config.h" ; then
215 AC_MSG_WARN([[The directory tree `${srcdir}' is being used
216 as a build directory right now; it has been configured in its own
217 right. To configure in another directory as well, you MUST
218 use GNU make. If you do not have GNU make, then you must
219 now do `make distclean' in ${srcdir},
220 and then run $0 again.]])
223 #### Given the configuration name, set machfile and opsysfile to the
224 #### names of the m/*.h and s/*.h files we should use.
226 ### Canonicalize the configuration name.
230 configuration=${host_alias-${build_alias-$host}}
232 dnl This used to use changequote, but, apart from `changequote is evil'
233 dnl per the autoconf manual, we can speed up autoconf somewhat by quoting
234 dnl the great gob of text. Thus it's not processed for possible expansion.
235 dnl Just make sure the brackets remain balanced.
237 dnl Since Emacs can't find matching pairs of quotes, boundaries are
238 dnl indicated by comments.
242 ### If you add support for a new configuration, add code to this
243 ### switch statement to recognize your configuration name and select
244 ### the appropriate operating system and machine description files.
246 ### You would hope that you could choose an m/*.h file pretty much
247 ### based on the machine portion of the configuration name, and an s-
248 ### file based on the operating system portion. However, it turns out
249 ### that each m/*.h file is pretty manufacturer-specific - for
250 ### example hp9000s300.h is a 68000 machine;
251 ### mips.h, pmax.h are all MIPS
252 ### machines. So we basically have to have a special case for each
253 ### configuration name.
255 ### As far as handling version numbers on operating systems is
256 ### concerned, make sure things will fail in a fixable way. If
257 ### /etc/MACHINES doesn't say anything about version numbers, be
258 ### prepared to handle anything reasonably. If version numbers
259 ### matter, be sure /etc/MACHINES says something about it.
261 ### Eric Raymond says we should accept strings like "sysvr4" to mean
262 ### "System V Release 4"; he writes, "The old convention encouraged
263 ### confusion between `system' and `release' levels'."
265 machine='' opsys='' unported=no
266 case "${canonical}" in
271 case "${canonical}" in
272 alpha*-*-freebsd*) machine=alpha ;;
273 ia64-*-freebsd*) machine=ia64 ;;
274 sparc64-*-freebsd*) machine=sparc ;;
275 powerpc-*-freebsd*) machine=macppc ;;
276 i[3456]86-*-freebsd*) machine=intel386 ;;
277 amd64-*-freebsd*|x86_64-*-freebsd*) machine=amdx86-64 ;;
281 ## FreeBSD kernel + glibc based userland
284 case "${canonical}" in
285 alpha*-*-kfreebsd*) machine=alpha ;;
286 ia64-*-kfreebsd*) machine=ia64 ;;
287 sparc64-*-kfreebsd*) machine=sparc ;;
288 powerpc-*-kfreebsd*) machine=macppc ;;
289 i[3456]86-*-kfreebsd*) machine=intel386 ;;
290 amd64-*-kfreebsd*|x86_64-*-kfreebsd*) machine=amdx86-64 ;;
297 if test -f /usr/lib/crti.o; then]
298 dnl The close and open brackets here are because this section is quoted --
299 dnl see the `changequote' comment above.
300 AC_DEFINE(HAVE_CRTIN, [], [Define to 1 if you have /usr/lib/crti.o.])
303 case "${canonical}" in
304 alpha*-*-netbsd*) machine=alpha ;;
305 i[3456]86-*-netbsd*) machine=intel386 ;;
307 # This is somewhat bogus.
308 machine=hp9000s300 ;;
309 mips-*-netbsd*) machine=pmax ;;
310 mipsel-*-netbsd*) machine=pmax ;;
311 mipseb-*-netbsd*) machine=pmax ;;
312 powerpc-*-netbsd*) machine=macppc ;;
313 sparc*-*-netbsd*) machine=sparc ;;
314 vax-*-netbsd*) machine=vax ;;
315 arm-*-netbsd*) machine=arm ;;
316 x86_64-*-netbsd*) machine=amdx86-64 ;;
317 hppa-*-netbsd*) machine=hp800 ;;
324 case "${canonical}" in
325 alpha*-*-openbsd*) machine=alpha ;;
326 arm-*-openbsd*) machine=arm ;;
327 hppa-*-openbsd*) machine=hp9000s300 ;;
328 i386-*-openbsd*) machine=intel386 ;;
329 m68k-*-openbsd*) machine=hp9000s300 ;;
330 mips64-*-openbsd*) machine=mips64 ;;
331 powerpc-*-openbsd*) machine=macppc ;;
332 sparc*-*-openbsd*) machine=sparc ;;
333 vax-*-openbsd*) machine=vax ;;
334 x86_64-*-openbsd*) machine=amdx86-64 ;;
341 case "${canonical}" in
342 i[3456]86-*-lynxos*) machine=intel386 ;;
343 powerpc-*-lynxos*) machine=powerpc ;;
350 case "${canonical}" in
351 i[345]86-*-bsdi*) machine=intel386 ;;
352 sparc-*-bsdi*) machine=sparc ;;
353 powerpc-*-bsdi*) machine=macppc ;;
355 case "${canonical}" in
356 *-*-bsd386* | *-*-bsdi1* ) opsys=bsd386 ;;
357 *-*-bsdi2.0* ) opsys=bsdos2 ;;
358 *-*-bsdi2* ) opsys=bsdos2-1 ;;
359 *-*-bsdi3* ) opsys=bsdos3 ;;
360 *-*-bsdi[45]* ) opsys=bsdos4 ;;
364 ## Alpha (DEC) machines.
366 machine=alpha opsys=osf1
367 # This is needed to find X11R6.1 libraries for certain tests.
368 NON_GCC_LINK_TEST_OPTIONS=-Wl,-rpath,/usr/X11R6/lib
369 GCC_LINK_TEST_OPTIONS=-Wl,-rpath,/usr/X11R6/lib
370 # NON_GNU_CPP is necessary on 5.0 to avoid mangling src/Makefile
371 # due to non-traditional preprocessing with the current compiler
372 # defaults. OSF 4 can also have that compiler version, and there
373 # seems always to have been a usable /usr/bin/cpp.
374 NON_GNU_CPP=/usr/bin/cpp
375 case "${canonical}" in
376 alpha*-dec-osf[5-9]*)
381 alpha*-*-linux-gnu* )
382 machine=alpha opsys=gnu-linux
386 machine=arm opsys=gnu-linux
389 ## Apple Darwin / Mac OS X
391 case "${canonical}" in
392 i[3456]86-* ) machine=intel386 ;;
393 powerpc-* ) machine=powermac ;;
397 # Define CPP as follows to make autoconf work correctly.
398 CPP="${CC-cc} -E -no-cpp-precomp"
399 # Use fink packages if available.
400 if test -d /sw/include && test -d /sw/lib; then
401 GCC_TEST_OPTIONS="-I/sw/include -L/sw/lib"
402 CPP="${CPP} ${GCC_TEST_OPTIONS}"
403 NON_GCC_TEST_OPTIONS=${GCC_TEST_OPTIONS}
408 mips-compaq-nonstopux* )
409 machine=nonstopux opsys=nonstopux
413 i[3456]86-cubix-sysv* )
414 machine=intel386 opsys=usg5-3
417 mips-dec-ultrix[0-3].* | mips-dec-ultrix4.0* | mips-dec-bsd4.2* )
418 machine=pmax opsys=bsd4-2
420 mips-dec-ultrix4.[12]* | mips-dec-bsd* )
421 machine=pmax opsys=bsd4-3
424 machine=pmax opsys=ultrix4-3
427 machine=pmax opsys=osf1
429 mips-dec-mach_bsd4.3* )
430 machine=pmax opsys=mach-bsd4-3
433 ## HP 9000 series 200 or 300
435 machine=hp9000s300 opsys=bsd4-3
437 ## HP/UX 7, 8, 9, and 10 are supported on these machines.
440 ## Someone's system reports A.B8.05 for this.
441 ## I wonder what other possibilities there are.
442 *.B8.* ) machine=hp9000s300 opsys=hpux8 ;;
443 *.08.* ) machine=hp9000s300 opsys=hpux8 ;;
444 *.09.* ) machine=hp9000s300 opsys=hpux9 ;;
445 *.1[0-9].* ) machine=hp9000s300 opsys=hpux9shr ;;
446 *) machine=hp9000s300 opsys=hpux ;;
450 ## HP 9000 series 700 and 800, running HP/UX
452 machine=hp800 opsys=hpux
455 machine=hp800 opsys=hpux8
458 machine=hp800 opsys=hpux9shr
461 machine=hp800 opsys=hpux9
464 machine=hp800 opsys=hpux10-20
467 machine=hp800 opsys=hpux10
469 hppa*-hp-hpux1[1-9]* )
470 machine=hp800 opsys=hpux11
471 CFLAGS="-D_INCLUDE__STDC_A1_SOURCE $CFLAGS"
475 machine=hp800 opsys=gnu-linux
478 ## HP 9000 series 700 and 800, running HP/UX
480 ## Cross-compilation? Nah!
482 ## Someone's system reports A.B8.05 for this.
483 ## I wonder what other possibilities there are.
484 *.B8.* ) machine=hp800 opsys=hpux8 ;;
485 *.08.* ) machine=hp800 opsys=hpux8 ;;
486 *.09.* ) machine=hp800 opsys=hpux9 ;;
487 *) machine=hp800 opsys=hpux10 ;;
491 machine=hp800 opsys=nextstep
496 machine=ibm370aix opsys=usg5-3
499 machine=ibms390 opsys=gnu-linux
502 machine=ibms390x opsys=gnu-linux
504 rs6000-ibm-aix3.1* | powerpc-ibm-aix3.1* )
505 machine=ibmrs6000 opsys=aix3-1
507 rs6000-ibm-aix3.2.5 | powerpc-ibm-aix3.2.5 )
508 machine=ibmrs6000 opsys=aix3-2-5
510 rs6000-ibm-aix4.1* | powerpc-ibm-aix4.1* )
511 machine=ibmrs6000 opsys=aix4-1
513 rs6000-ibm-aix4.2* | powerpc-ibm-aix4.2* )
514 machine=ibmrs6000 opsys=aix4-2
516 rs6000-ibm-aix4.3* | powerpc-ibm-aix4.3* )
517 machine=ibmrs6000 opsys=aix4-2
519 rs6000-ibm-aix5* | powerpc-ibm-aix5* )
520 machine=ibmrs6000 opsys=aix4-2
522 rs6000-ibm-aix4.0* | powerpc-ibm-aix4.0* )
523 machine=ibmrs6000 opsys=aix4
525 rs6000-ibm-aix4* | powerpc-ibm-aix4* )
526 machine=ibmrs6000 opsys=aix4-1
528 rs6000-ibm-aix* | powerpc-ibm-aix* )
529 machine=ibmrs6000 opsys=aix3-2
533 i[3456]86-prime-sysv* )
534 machine=i386 opsys=usg5-3
537 ## ncr machine running svr4.3.
538 i[3456]86-ncr-sysv4.3 )
539 machine=ncr386 opsys=usg5-4-3
542 ## Unspecified sysv on an ncr machine defaults to svr4.2.
543 ## (Plain usg5-4 doesn't turn on POSIX signals, which we need.)
544 i[3456]86-ncr-sysv* )
545 machine=ncr386 opsys=usg5-4-2
549 powerpc*-*-linux-gnu* )
550 machine=macppc opsys=gnu-linux
553 ## Workstations sold by MIPS
554 ## This is not necessarily all workstations using the MIPS processor -
555 ## Irises are produced by SGI, and DECstations by DEC.
557 ## etc/MACHINES lists mips.h and mips4.h as possible machine files,
558 ## and usg5-2-2 and bsd4-3 as possible OS files. The only guidance
559 ## it gives for choosing between the alternatives seems to be "Use
560 ## -machine=mips4 for RISCOS version 4; use -opsystem=bsd4-3 with
561 ## the BSD world." I'll assume that these are instructions for
562 ## handling two odd situations, and that every other situation
563 ## should use mips.h and usg5-2-2, they being listed first.
566 ## Fall through to the general code at the bottom to decide on the OS.
569 machine=mips4 opsys=bsd4-3
570 NON_GNU_CC="cc -systype bsd43"
571 NON_GNU_CPP="cc -systype bsd43 -E"
574 machine=mips4 opsys=riscos5
575 NON_GNU_CC="cc -systype bsd43"
576 NON_GNU_CPP="cc -systype bsd43 -E"
579 machine=mips opsys=bsd4-3
582 machine=mips opsys=usg5-2-2
586 m68*-next-* | m68k-*-nextstep* )
587 machine=m68k opsys=nextstep
592 machine=ews4800 opsys=ux4800
596 mips-siemens-sysv* | mips-sni-sysv*)
597 machine=mips-siemens opsys=usg5-4
598 NON_GNU_CC=/usr/ccs/bin/cc
599 NON_GNU_CPP=/usr/ccs/lib/cpp
602 ## Silicon Graphics machines
605 machine=iris4d opsys=irix6-5
606 # Without defining _LANGUAGE_C, things get masked out in the headers
607 # so that, for instance, grepping for `free' in stdlib.h fails and
608 # AC_HEADER_STD_C fails. (MIPSPro 7.2.1.2m compilers, Irix 6.5.3m).
609 NON_GNU_CPP="/lib/cpp -D_LANGUAGE_C"
610 NON_GCC_TEST_OPTIONS="-D_LANGUAGE_C"
613 machine=iris4d opsys=irix6-0
614 # It's not clear whether -D_LANGUAGE_C is necessary as it is for 6.5,
615 # but presumably it does no harm.
616 NON_GNU_CPP="/lib/cpp -D_LANGUAGE_C"
617 # -32 probably isn't necessary in later v.6s -- anyone know which?
618 NON_GCC_TEST_OPTIONS=-32
620 mips-sgi-irix5.[01]* )
621 machine=iris4d opsys=irix5-0
623 mips-sgi-irix5* | mips-sgi-irix* )
624 machine=iris4d opsys=irix5-2
628 sparc-*-linux-gnu* | sparc64-*-linux-gnu* )
629 machine=sparc opsys=gnu-linux
632 *-auspex-sunos* | *-sun-sunos* | *-sun-bsd* | *-sun-solaris* \
633 | i[3456]86-*-solaris2* | i[3456]86-*-sunos5* | powerpc*-*-solaris2* \
634 | rs6000-*-solaris2*)
635 case "${canonical}" in
636 i[3456]86-*-* ) machine=intel386 ;;
637 amd64-*-*|x86_64-*-*) machine=amdx86-64 ;;
638 powerpcle* ) machine=powerpcle ;;
639 powerpc* | rs6000* ) machine=ibmrs6000 ;;
640 sparc* ) machine=sparc ;;
643 case "${canonical}" in
644 *-sunos5.3* | *-solaris2.3* )
646 NON_GNU_CPP=/usr/ccs/lib/cpp
648 *-sunos5.4* | *-solaris2.4* )
650 NON_GNU_CPP=/usr/ccs/lib/cpp
653 *-sunos5.5* | *-solaris2.5* )
655 NON_GNU_CPP=/usr/ccs/lib/cpp
658 *-sunos5.6* | *-solaris2.6* )
660 NON_GNU_CPP=/usr/ccs/lib/cpp
663 *-sunos5* | *-solaris* )
665 emacs_check_sunpro_c=yes
666 NON_GNU_CPP=/usr/ccs/lib/cpp
670 ## Watch out for a compiler that we know will not work.
671 case "${canonical}" in
672 *-solaris* | *-sunos5* )
673 if [ "x$CC" = x/usr/ucb/cc ]; then
674 ## /usr/ucb/cc doesn't work;
675 ## we should find some other compiler that does work.
683 machine=sparc opsys=nextstep
686 ## Tandem Integrity S2
688 machine=tandem-s2 opsys=usg5-3
694 case "${canonical}" in
695 *-bsd4.1* ) opsys=bsd4-1 ;;
696 *-bsd4.2* | *-ultrix[0-3].* | *-ultrix4.0* ) opsys=bsd4-2 ;;
697 *-bsd4.3* | *-ultrix* ) opsys=bsd4-3 ;;
698 *-sysv[01]* | *-sysvr[01]* ) opsys=usg5-0 ;;
699 *-sysv2* | *-sysvr2* ) opsys=usg5-2 ;;
700 *-vms* ) opsys=vms ;;
707 machine=ia64 opsys=gnu-linux
710 ## Intel 386 machines where we don't care about the manufacturer
713 case "${canonical}" in
714 *-cygwin ) opsys=cygwin ;;
715 *-darwin* ) opsys=darwin
716 CPP="${CC-cc} -E -no-cpp-precomp"
718 *-xenix* ) opsys=xenix ;;
719 *-linux-gnu* ) opsys=gnu-linux ;;
720 *-sysv4.2uw* ) opsys=unixware; NON_GNU_CPP=/lib/cpp ;;
721 *-sysv5uw* ) opsys=unixware; NON_GNU_CPP=/lib/cpp ;;
722 *-sysv5OpenUNIX* ) opsys=unixware; NON_GNU_CPP=/lib/cpp ;;
723 *-386bsd* ) opsys=386bsd ;;
724 *-nextstep* ) opsys=nextstep ;;
725 ## Otherwise, we'll fall through to the generic opsys code at the bottom.
729 ## m68k Linux-based GNU system
731 machine=m68k opsys=gnu-linux
734 ## Mips Linux-based GNU system
735 mips-*-linux-gnu* | mipsel-*-linux-gnu* )
736 machine=mips opsys=gnu-linux
740 sparc-fujitsu-sysv4* )
741 machine=sparc opsys=uxpds
742 NON_GNU_CPP=/usr/ccs/lib/cpp
746 ## AMD x86-64 Linux-based GNU system
747 x86_64-*-linux-gnu* )
748 machine=amdx86-64 opsys=gnu-linux
751 ## Tensilica Xtensa Linux-based GNU system
752 xtensa-*-linux-gnu* )
753 machine=xtensa opsys=gnu-linux
761 ### If the code above didn't choose an operating system, just choose
762 ### an operating system based on the configuration name. You really
763 ### only want to use this when you have no idea what the right
764 ### operating system is; if you know what operating systems a machine
765 ### runs, it's cleaner to make it explicit in the case statement
767 if test x"${opsys}" = x; then
768 case "${canonical}" in
769 *-gnu* ) opsys=gnu ;;
770 *-bsd4.[01] ) opsys=bsd4-1 ;;
771 *-bsd4.2 ) opsys=bsd4-2 ;;
772 *-bsd4.3 ) opsys=bsd4-3 ;;
773 *-sysv0 | *-sysvr0 ) opsys=usg5-0 ;;
774 *-sysv2 | *-sysvr2 ) opsys=usg5-2 ;;
775 *-sysv2.2 | *-sysvr2.2 ) opsys=usg5-2-2 ;;
776 *-sysv3* | *-sysvr3* ) opsys=usg5-3 ;;
777 *-sysv4.2uw* ) opsys=unixware ;;
778 *-sysv5uw* ) opsys=unixware ;;
779 *-sysv5OpenUNIX* ) opsys=unixware ;;
780 *-sysv4.1* | *-sysvr4.1* )
781 NON_GNU_CPP=/usr/lib/cpp
783 *-sysv4.[2-9]* | *-sysvr4.[2-9]* )
784 if [ x$NON_GNU_CPP = x ]; then
785 if [ -f /usr/ccs/lib/cpp ]; then
786 NON_GNU_CPP=/usr/ccs/lib/cpp
792 *-sysv4* | *-sysvr4* ) opsys=usg5-4 ;;
802 if test $unported = yes; then
803 AC_MSG_ERROR([Emacs hasn't been ported to `${canonical}' systems.
804 Check `etc/MACHINES' for recognized configuration names.])
807 machfile="m/${machine}.h"
808 opsysfile="s/${opsys}.h"
811 #### Choose a compiler.
812 test -n "$CC" && cc_specified=yes
814 # Save the value of CFLAGS that the user specified.
815 SPECIFIED_CFLAGS="$CFLAGS"
818 "yes" ) CC="gcc" GCC=yes ;;
824 # On Suns, sometimes $CPP names a directory.
825 if test -n "$CPP" && test -d "$CPP"; then
829 ## If not using gcc, and on Solaris, and no CPP specified, see if
830 ## using a Sun compiler, which needs -Xs to prevent whitespace.
831 if test x"$GCC" != xyes && test x"$emacs_check_sunpro_c" = xyes && \
832 test x"$CPP" = x; then
833 AC_MSG_CHECKING([whether we are using a Sun C compiler])
834 AC_CACHE_VAL(emacs_cv_sunpro_c,
839 ], emacs_cv_sunpro_c=yes, emacs_cv_sunpro_c=no)])
840 AC_MSG_RESULT($emacs_cv_sunpro_c)
842 if test x"$emacs_cv_sunpro_c" = xyes; then
843 NON_GNU_CPP="$CC -E -Xs"
847 #### Some systems specify a CPP to use unless we are using GCC.
848 #### Now that we know whether we are using GCC, we can decide whether
849 #### to use that one.
850 if test "x$NON_GNU_CPP" != x && test x$GCC != xyes && test "x$CPP" = x
855 #### Some systems specify a CC to use unless we are using GCC.
856 #### Now that we know whether we are using GCC, we can decide whether
857 #### to use that one.
858 if test "x$NON_GNU_CC" != x && test x$GCC != xyes &&
859 test x$cc_specified != xyes
864 if test x$GCC = xyes && test "x$GCC_TEST_OPTIONS" != x
866 CC="$CC $GCC_TEST_OPTIONS"
869 if test x$GCC = x && test "x$NON_GCC_TEST_OPTIONS" != x
871 CC="$CC $NON_GCC_TEST_OPTIONS"
874 dnl checks for Unix variants
878 ### Use -Wno-pointer-sign if the compiler supports it
879 AC_MSG_CHECKING([whether gcc understands -Wno-pointer-sign])
880 SAVE_CFLAGS="$CFLAGS"
881 CFLAGS="$CFLAGS -Wno-pointer-sign"
882 AC_TRY_COMPILE([], [], has_option=yes, has_option=no,)
883 if test $has_option = yes; then
884 C_WARNINGS_SWITCH="-Wno-pointer-sign $C_WARNINGS_SWITCH"
886 AC_MSG_RESULT($has_option)
887 CFLAGS="$SAVE_CFLAGS"
891 #### Some other nice autoconf tests.
893 dnl checks for programs
897 if test "x$RANLIB" = x; then
900 AC_PATH_PROG(INSTALL_INFO, install-info)
901 AC_PATH_PROG(INSTALL_INFO, install-info,, /usr/sbin)
902 AC_PATH_PROG(INSTALL_INFO, install-info,:, /sbin)
903 dnl Don't use GZIP, which is used by gzip for additional parameters.
904 AC_PATH_PROG(GZIP_PROG, gzip)
907 ## Need makeinfo >= 4.6 (?) to build the manuals.
908 AC_PATH_PROG(MAKEINFO, makeinfo, no)
909 dnl By this stage, configure has already checked for egrep and set EGREP,
910 dnl or exited with an error if no egrep was found.
911 if test "$MAKEINFO" != "no" && \
912 test x"`$MAKEINFO --version 2> /dev/null | $EGREP 'texinfo[[^0-9]]*([[1-4]][[0-9]]+|[[5-9]]|4\.[[6-9]]|4\.[[1-5]][[0-9]]+)'`" = x; then
916 if test "$MAKEINFO" = "no"; then
917 AC_MSG_ERROR( [makeinfo >= 4.6 is required] )
921 dnl Add our options to ac_link now, after it is set up.
923 if test x$GCC = xyes && test "x$GCC_LINK_TEST_OPTIONS" != x
925 ac_link="$ac_link $GCC_LINK_TEST_OPTIONS"
928 if test x$GCC = x && test "x$NON_GCC_LINK_TEST_OPTIONS" != x
930 ac_link="$ac_link $NON_GCC_LINK_TEST_OPTIONS"
933 dnl We need -znocombreloc if we're using a relatively recent GNU ld.
934 dnl If we can link with the flag, it shouldn't do any harm anyhow.
935 dnl (Don't use `-z nocombreloc' as -z takes no arg on Irix.)
936 dnl Treat GCC specially since it just gives a non-fatal `unrecognized option'
937 dnl if not built to support GNU ld.
939 late_LDFLAGS=$LDFLAGS
940 if test "$GCC" = yes; then
941 LDFLAGS="$LDFLAGS -Wl,-znocombreloc"
943 LDFLAGS="$LDFLAGS -znocombreloc"
946 AC_MSG_CHECKING([for -znocombreloc])
947 AC_LINK_IFELSE([main(){return 0;}],
948 [AC_MSG_RESULT(yes)],
949 LDFLAGS=$late_LDFLAGS
952 #### Extract some information from the operating system and machine files.
954 AC_CHECKING([the machine- and system-dependent files to find out
955 - which libraries the lib-src programs will want, and
956 - whether the GNU malloc routines are usable])
958 ### First figure out CFLAGS (which we use for running the compiler here)
959 ### and REAL_CFLAGS (which we use for real compilation).
960 ### The two are the same except on a few systems, where they are made
961 ### different to work around various lossages. For example,
962 ### GCC 2.5 on GNU/Linux needs them to be different because it treats -g
963 ### as implying static linking.
965 ### If the CFLAGS env var is specified, we use that value
966 ### instead of the default.
968 ### It's not important that this name contain the PID; you can't run
969 ### two configures in the same directory and have anything work
971 tempcname="conftest.c"
974 #include "'${srcdir}'/src/'${opsysfile}'"
975 #include "'${srcdir}'/src/'${machfile}'"
982 #ifndef C_SWITCH_SYSTEM
983 #define C_SWITCH_SYSTEM
985 #ifndef C_SWITCH_MACHINE
986 #define C_SWITCH_MACHINE
988 configure___ libsrc_libs=LIBS_MACHINE LIBS_SYSTEM
989 configure___ c_switch_system=C_SWITCH_SYSTEM
990 configure___ c_switch_machine=C_SWITCH_MACHINE
993 #define LIB_X11_LIB -lX11
996 #ifndef LIBX11_MACHINE
997 #define LIBX11_MACHINE
1000 #ifndef LIBX11_SYSTEM
1001 #define LIBX11_SYSTEM
1003 configure___ LIBX=LIB_X11_LIB LIBX11_MACHINE LIBX11_SYSTEM
1006 configure___ unexec=UNEXEC
1008 configure___ unexec=unexec.o
1011 #ifdef SYSTEM_MALLOC
1012 configure___ system_malloc=yes
1014 configure___ system_malloc=no
1017 #ifdef USE_MMAP_FOR_BUFFERS
1018 configure___ use_mmap_for_buffers=yes
1020 configure___ use_mmap_for_buffers=no
1023 #ifndef C_DEBUG_SWITCH
1024 #define C_DEBUG_SWITCH -g
1027 #ifndef C_OPTIMIZE_SWITCH
1029 #define C_OPTIMIZE_SWITCH -O2
1031 #define C_OPTIMIZE_SWITCH -O
1035 #ifndef C_WARNINGS_SWITCH
1036 #define C_WARNINGS_SWITCH ${C_WARNINGS_SWITCH}
1039 #ifndef LD_SWITCH_MACHINE
1040 #define LD_SWITCH_MACHINE
1043 #ifndef LD_SWITCH_SYSTEM
1044 #define LD_SWITCH_SYSTEM
1047 #ifndef LD_SWITCH_X_SITE_AUX
1048 #define LD_SWITCH_X_SITE_AUX
1051 configure___ ld_switch_system=LD_SWITCH_SYSTEM
1052 configure___ ld_switch_machine=LD_SWITCH_MACHINE
1054 #ifdef THIS_IS_CONFIGURE
1056 /* Get the CFLAGS for tests in configure. */
1058 configure___ CFLAGS=C_DEBUG_SWITCH C_OPTIMIZE_SWITCH '${SPECIFIED_CFLAGS}'
1060 configure___ CFLAGS=C_DEBUG_SWITCH '${SPECIFIED_CFLAGS}'
1063 #else /* not THIS_IS_CONFIGURE */
1065 /* Get the CFLAGS for real compilation. */
1067 configure___ REAL_CFLAGS=C_DEBUG_SWITCH C_OPTIMIZE_SWITCH C_WARNINGS_SWITCH '${SPECIFIED_CFLAGS}'
1069 configure___ REAL_CFLAGS=C_DEBUG_SWITCH '${SPECIFIED_CFLAGS}'
1072 #endif /* not THIS_IS_CONFIGURE */
1075 # The value of CPP is a quoted variable reference, so we need to do this
1076 # to get its actual value...
1077 CPP=`eval "echo $CPP"`
1078 [eval `${CPP} -Isrc ${tempcname} \
1079 | sed -n -e 's/^configure___ \([^=]*=\)\(.*\)$/\1"\2"/p'`
1080 if test "x$SPECIFIED_CFLAGS" = x; then
1081 eval `${CPP} -Isrc -DTHIS_IS_CONFIGURE ${tempcname} \
1082 | sed -n -e 's/^configure___ \([^=]*=\)\(.*\)$/\1"\2"/p'`
1084 REAL_CFLAGS="$CFLAGS"
1088 ac_link="$ac_link $ld_switch_machine $ld_switch_system"
1090 ### Make sure subsequent tests use flags consistent with the build flags.
1092 if test x"${OVERRIDE_CPPFLAGS}" != x; then
1093 CPPFLAGS="${OVERRIDE_CPPFLAGS}"
1095 CPPFLAGS="$c_switch_system $c_switch_machine $CPPFLAGS"
1098 dnl For AC_FUNC_GETLOADAVG, at least:
1099 AC_CONFIG_LIBOBJ_DIR(src)
1101 dnl Do this early because it can frob feature test macros for Unix-98 &c.
1105 ### The standard library on x86-64 and s390x GNU/Linux distributions can
1106 ### be located in either /usr/lib64 or /usr/lib.
1107 case "${canonical}" in
1108 x86_64-*-linux-gnu* | s390x-*-linux-gnu* )
1109 if test -d /usr/lib64; then
1110 AC_DEFINE(HAVE_LIB64_DIR, 1,
1111 [Define to 1 if the directory /usr/lib64 exists.])
1115 dnl This function defintion taken from Gnome 2.0
1116 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
1117 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
1118 dnl also defines GSTUFF_PKG_ERRORS on error
1119 AC_DEFUN([PKG_CHECK_MODULES], [
1122 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1124 if test "$PKG_CONFIG" = "no" ; then
1125 ifelse([$4], , [AC_MSG_ERROR([
1126 *** The pkg-config script could not be found. Make sure it is in your path, or give the full path to pkg-config with the PKG_CONFIG environment variable or --with-pkg-config-prog. Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config.])], [$4])
1128 PKG_CONFIG_MIN_VERSION=0.9.0
1129 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
1130 AC_MSG_CHECKING(for $2)
1132 if $PKG_CONFIG --exists "$2" 2>&AS_MESSAGE_LOG_FD; then
1136 AC_MSG_CHECKING($1_CFLAGS)
1137 $1_CFLAGS=`$PKG_CONFIG --cflags "$2"|sed -e 's,///*,/,g'`
1138 AC_MSG_RESULT($$1_CFLAGS)
1140 AC_MSG_CHECKING($1_LIBS)
1141 $1_LIBS=`$PKG_CONFIG --libs "$2"|sed -e 's,///*,/,g'`
1142 AC_MSG_RESULT($$1_LIBS)
1147 ## If we have a custom action on failure, don't print errors, but
1148 ## do set a variable so people can do so.
1149 $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
1150 ifelse([$4], ,echo $$1_PKG_ERRORS,)
1156 echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
1157 echo "*** See http://www.freedesktop.org/software/pkgconfig"
1161 if test $succeeded = yes; then
1162 ifelse([$3], , :, [$3])
1164 ifelse([$4], , [AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.])], [$4])
1169 if test "${with_sound}" != "no"; then
1170 # Sound support for GNU/Linux and the free BSDs.
1171 AC_CHECK_HEADERS(machine/soundcard.h sys/soundcard.h soundcard.h)
1172 # Emulation library used on NetBSD.
1173 AC_CHECK_LIB(ossaudio, _oss_ioctl, LIBSOUND=-lossaudio, LIBSOUND=)
1177 ALSA_MODULES="alsa >= $ALSA_REQUIRED"
1178 PKG_CHECK_MODULES(ALSA, $ALSA_MODULES, HAVE_ALSA=yes, HAVE_ALSA=no)
1179 if test $HAVE_ALSA = yes; then
1180 SAVE_CFLAGS="$CFLAGS"
1181 SAVE_LDFLAGS="$LDFLAGS"
1182 CFLAGS="$ALSA_CFLAGS $CFLAGS"
1183 LDFLAGS="$ALSA_LIBS $LDFLAGS"
1184 AC_TRY_COMPILE([#include <asoundlib.h>], [snd_lib_error_set_handler (0);],
1185 emacs_alsa_normal=yes,
1186 emacs_alsa_normal=no)
1187 if test "$emacs_alsa_normal" != yes; then
1188 AC_TRY_COMPILE([#include <alsa/asoundlib.h>],
1189 [snd_lib_error_set_handler (0);],
1190 emacs_alsa_subdir=yes,
1191 emacs_alsa_subdir=no)
1192 if test "$emacs_alsa_subdir" != yes; then
1193 AC_MSG_ERROR([pkg-config found alsa, but it does not compile. See config.log for error messages.])
1195 ALSA_CFLAGS="$ALSA_CFLAGS -DALSA_SUBDIR_INCLUDE"
1198 CFLAGS="$SAVE_CFLAGS"
1199 LDFLAGS="$SAVE_LDFLAGS"
1200 LIBSOUND="$LIBSOUND $ALSA_LIBS"
1201 CFLAGS_SOUND="$CFLAGS_SOUND $ALSA_CFLAGS"
1202 AC_DEFINE(HAVE_ALSA, 1, [Define to 1 if ALSA is available.])
1204 AC_SUBST(CFLAGS_SOUND)
1207 dnl checks for header files
1208 AC_CHECK_HEADERS(sys/select.h sys/timeb.h sys/time.h unistd.h utime.h \
1209 linux/version.h sys/systeminfo.h termios.h limits.h string.h stdlib.h \
1210 termcap.h stdio_ext.h fcntl.h strings.h coff.h pty.h sys/mman.h \
1211 sys/param.h sys/vlimit.h sys/resource.h locale.h sys/_mbstate_t.h \
1212 sys/utsname.h pwd.h)
1214 AC_MSG_CHECKING(if personality LINUX32 can be set)
1215 AC_TRY_COMPILE([#include <sys/personality.h>], [personality (PER_LINUX32)],
1216 emacs_cv_personality_linux32=yes,
1217 emacs_cv_personality_linux32=no)
1218 AC_MSG_RESULT($emacs_cv_personality_linux32)
1220 if test $emacs_cv_personality_linux32 = yes; then
1221 AC_DEFINE(HAVE_PERSONALITY_LINUX32, 1,
1222 [Define to 1 if personality LINUX32 can be set.])
1225 dnl On Solaris 8 there's a compilation warning for term.h because
1226 dnl it doesn't define `bool'.
1227 AC_CHECK_HEADERS(term.h, , , -)
1230 AC_CHECK_DECLS([sys_siglist])
1231 if test $ac_cv_have_decl_sys_siglist != yes; then
1232 # For Tru64, at least:
1233 AC_CHECK_DECLS([__sys_siglist])
1234 if test $ac_cv_have_decl___sys_siglist = yes; then
1235 AC_DEFINE(sys_siglist, __sys_siglist,
1236 [Define to any substitute for sys_siglist.])
1241 dnl Some systems have utime.h but don't declare the struct anyplace.
1242 AC_CACHE_CHECK(for struct utimbuf, emacs_cv_struct_utimbuf,
1243 AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME
1244 #include <sys/time.h>
1247 #ifdef HAVE_SYS_TIME_H
1248 #include <sys/time.h>
1255 #endif], [static struct utimbuf x; x.actime = x.modtime;],
1256 emacs_cv_struct_utimbuf=yes, emacs_cv_struct_utimbuf=no))
1257 if test $emacs_cv_struct_utimbuf = yes; then
1258 AC_DEFINE(HAVE_STRUCT_UTIMBUF, 1, [Define to 1 if `struct utimbuf' is declared by <utime.h>.])
1261 dnl checks for typedefs
1264 dnl Check for speed_t typedef.
1265 AC_CACHE_CHECK(for speed_t, emacs_cv_speed_t,
1266 [AC_TRY_COMPILE([#include <termios.h>], [speed_t x = 1;],
1267 emacs_cv_speed_t=yes, emacs_cv_speed_t=no)])
1268 if test $emacs_cv_speed_t = yes; then
1269 AC_DEFINE(HAVE_SPEED_T, 1,
1270 [Define to 1 if `speed_t' is declared by <termios.h>.])
1273 AC_CACHE_CHECK(for struct timeval, emacs_cv_struct_timeval,
1274 AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME
1275 #include <sys/time.h>
1278 #ifdef HAVE_SYS_TIME_H
1279 #include <sys/time.h>
1283 #endif], [static struct timeval x; x.tv_sec = x.tv_usec;],
1284 emacs_cv_struct_timeval=yes, emacs_cv_struct_timeval=no))
1285 HAVE_TIMEVAL=$emacs_cv_struct_timeval
1286 if test $emacs_cv_struct_timeval = yes; then
1287 AC_DEFINE(HAVE_TIMEVAL, 1, [Define to 1 if `struct timeval' is declared by <sys/time.h>.])
1290 AC_CACHE_CHECK(for struct exception, emacs_cv_struct_exception,
1291 AC_TRY_COMPILE([#include <math.h>],
1292 [static struct exception x; x.arg1 = x.arg2 = x.retval; x.name = ""; x.type = 1;],
1293 emacs_cv_struct_exception=yes, emacs_cv_struct_exception=no))
1294 HAVE_EXCEPTION=$emacs_cv_struct_exception
1295 if test $emacs_cv_struct_exception != yes; then
1296 AC_DEFINE(NO_MATHERR, 1, [Define to 1 if you don't have struct exception in math.h.])
1299 AC_CHECK_HEADERS(sys/socket.h)
1300 AC_CHECK_HEADERS(net/if.h, , , [AC_INCLUDES_DEFAULT
1301 #if HAVE_SYS_SOCKET_H
1302 #include <sys/socket.h>
1305 dnl checks for structure members
1308 AC_CHECK_MEMBER(struct tm.tm_gmtoff,
1309 [AC_DEFINE(HAVE_TM_GMTOFF, 1,
1310 [Define to 1 if `tm_gmtoff' is member of `struct tm'.])],,
1311 [#include <time.h>])
1312 AC_CHECK_MEMBERS([struct ifreq.ifr_flags, struct ifreq.ifr_hwaddr,
1313 struct ifreq.ifr_netmask, struct ifreq.ifr_broadaddr,
1314 struct ifreq.ifr_addr], , ,
1315 [AC_INCLUDES_DEFAULT
1316 #if HAVE_SYS_SOCKET_H
1317 #include <sys/socket.h>
1323 dnl checks for compiler characteristics
1325 dnl Testing __STDC__ to determine prototype support isn't good enough.
1326 dnl DEC C, for instance, doesn't define it with default options, and
1327 dnl is used on 64-bit systems (OSF Alphas). Similarly for volatile
1332 dnl This isn't useful because we can't turn on use of `inline' unless
1333 dnl the compiler groks `extern inline'.
1335 AC_CACHE_CHECK([for void * support], emacs_cv_void_star,
1336 [AC_TRY_COMPILE(, [void * foo;],
1337 emacs_cv_void_star=yes, emacs_cv_void_star=no)])
1338 if test $emacs_cv_void_star = yes; then
1339 AC_DEFINE(POINTER_TYPE, void)
1341 AC_DEFINE(POINTER_TYPE, char)
1343 AH_TEMPLATE(POINTER_TYPE,
1344 [Define as `void' if your compiler accepts `void *'; otherwise
1345 define as `char'.])dnl
1349 dnl This could be used for targets which can have both byte sexes.
1350 dnl We could presumably replace the hardwired WORDS_BIG_ENDIAN generally.
1353 dnl check for Make feature
1356 dnl checks for operating system services
1357 AC_SYS_LONG_FILE_NAMES
1359 #### Choose a window system.
1362 if test "$no_x" = yes; then
1368 if test "${x_libraries}" != NONE; then
1369 if test -n "${x_libraries}"; then
1370 LD_SWITCH_X_SITE=-L`echo ${x_libraries} | sed -e "s/:/ -L/g"`
1371 LD_SWITCH_X_SITE_AUX=-R`echo ${x_libraries} | sed -e "s/:/ -R/g"`
1373 x_default_search_path=""
1374 x_search_path=${x_libraries}
1375 if test -z "${x_search_path}"; then
1376 x_search_path=/usr/lib
1378 for x_library in `echo ${x_search_path}: | \
1379 sed -e "s/:/ /g" -e p -e "s:/lib[[^ /]]* :/share :g"`; do
1381 ${x_library}/X11/%L/%T/%N%C%S:\
1382 ${x_library}/X11/%l/%T/%N%C%S:\
1383 ${x_library}/X11/%T/%N%C%S:\
1384 ${x_library}/X11/%L/%T/%N%S:\
1385 ${x_library}/X11/%l/%T/%N%S:\
1386 ${x_library}/X11/%T/%N%S"
1387 if test x"${x_default_search_path}" = x; then
1388 x_default_search_path=${x_search_path}
1390 x_default_search_path="${x_search_path}:${x_default_search_path}"
1394 if test "${x_includes}" != NONE && test -n "${x_includes}"; then
1395 C_SWITCH_X_SITE=-I`echo ${x_includes} | sed -e "s/:/ -I/g"`
1398 if test x"${x_includes}" = x; then
1399 bitmapdir=/usr/include/X11/bitmaps
1401 # accumulate include directories that have X11 bitmap subdirectories
1403 for bmd in `echo ${x_includes} | sed -e "s/:/ /g"`; do
1404 if test -d "${bmd}/X11/bitmaps"; then
1405 bmd_acc="${bmd_acc}:${bmd}/X11/bitmaps"
1407 if test -d "${bmd}/bitmaps"; then
1408 bmd_acc="${bmd_acc}:${bmd}/bitmaps"
1411 if test ${bmd_acc} != "dummyval"; then
1412 bitmapdir=`echo ${bmd_acc} | sed -e "s/^dummyval://"`
1417 if test "${with_carbon}" != no; then
1418 AC_CHECK_HEADER(Carbon/Carbon.h, HAVE_CARBON=yes)
1420 if test "${window_system}" = x11 && test "${HAVE_CARBON}" = yes; then
1421 if test "${with_carbon+set}" != set \
1422 && test "${carbon_appdir_x+set}" != set; then
1423 for var in with_x with_x_toolkit with_gtk with_xim \
1424 with_xpm with_jpeg with_tiff with_gif with_png; do
1425 if eval test \"\${$var+set}\" = set; then
1432 if test "${HAVE_CARBON}" = yes; then
1436 case "${window_system}" in
1440 case "${with_x_toolkit}" in
1441 athena | lucid ) USE_X_TOOLKIT=LUCID ;;
1442 motif ) USE_X_TOOLKIT=MOTIF ;;
1444 dnl Dont set this for GTK. A lot of tests below assumes Xt when
1445 dnl USE_X_TOOLKIT is set.
1446 USE_X_TOOLKIT=none ;;
1447 no ) USE_X_TOOLKIT=none ;;
1448 dnl If user did not say whether to use a toolkit, make this decision later:
1449 dnl use the toolkit if we have gtk, or X11R5 or newer.
1451 if test x"$with_gtk" = xyes; then
1466 if test "$window_system" = none && test "X$with_x" != "Xno"; then
1467 AC_CHECK_PROG(HAVE_XSERVER, X, true, false)
1468 if test "$HAVE_XSERVER" = true ||
1469 test -n "$DISPLAY" ||
1470 test "`echo /usr/lib/libX11.*`" != "/usr/lib/libX11.*"; then
1471 AC_MSG_ERROR([You seem to be running X, but no X development libraries
1472 were found. You should install the relevant development files for X
1473 and for the toolkit you want, such as Gtk+, Lesstif or Motif. Also make
1474 sure you have development files for image handling, i.e.
1475 tiff, gif, jpeg, png and xpm.
1476 If you are sure you want Emacs compiled without X window support, pass
1482 ### If we're using X11, we should use the X menu package.
1485 yes ) HAVE_MENUS=yes ;;
1488 ### Compute the unexec source name from the object name.
1489 UNEXEC_SRC="`echo ${unexec} | sed 's/\.o/.c/'`"
1491 # Do the opsystem or machine files prohibit the use of the GNU malloc?
1492 # Assume not, until told otherwise.
1495 AC_CHECK_FUNC(malloc_get_state, ,doug_lea_malloc=no)
1496 AC_CHECK_FUNC(malloc_set_state, ,doug_lea_malloc=no)
1497 AC_CACHE_CHECK(whether __after_morecore_hook exists,
1498 emacs_cv_var___after_morecore_hook,
1499 [AC_TRY_LINK([extern void (* __after_morecore_hook)();],[__after_morecore_hook = 0],
1500 emacs_cv_var___after_morecore_hook=yes,
1501 emacs_cv_var___after_morecore_hook=no)])
1502 if test $emacs_cv_var___after_morecore_hook = no; then
1505 if test "${system_malloc}" = "yes"; then
1508 (The GNU allocators don't work with this system configuration.)"
1510 if test "$doug_lea_malloc" = "yes" ; then
1511 if test "$GNU_MALLOC" = yes ; then
1513 (Using Doug Lea's new malloc from the GNU C Library.)"
1515 AC_DEFINE(DOUG_LEA_MALLOC, 1,
1516 [Define to 1 if you are using the GNU C Library.])
1519 if test x"${REL_ALLOC}" = x; then
1520 REL_ALLOC=${GNU_MALLOC}
1523 dnl For now, need to use an explicit `#define USE_MMAP_FOR_BUFFERS 1'
1524 dnl the system configuration file (s/*.h) to turn the use of mmap
1525 dnl in the relocating allocator on.
1528 if test $use_mmap_for_buffers = yes; then
1532 LIBS="$libsrc_libs $LIBS"
1534 dnl If found, this defines HAVE_LIBDNET, which m/pmax.h checks,
1535 dnl and also adds -ldnet to LIBS, which Autoconf uses for checks.
1536 AC_CHECK_LIB(dnet, dnet_ntoa)
1537 dnl This causes -lresolv to get used in subsequent tests,
1538 dnl which causes failures on some systems such as HPUX 9.
1539 dnl AC_CHECK_LIB(resolv, gethostbyname)
1541 dnl FIXME replace main with a function we actually want from this library.
1542 AC_CHECK_LIB(Xbsd, main, LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -lXbsd")
1544 AC_CHECK_LIB(pthreads, cma_open)
1546 AC_MSG_CHECKING(for XFree86 in /usr/X386)
1547 if test -d /usr/X386/include; then
1549 : ${C_SWITCH_X_SITE="-I/usr/X386/include"}
1553 AC_MSG_RESULT($HAVE_XFREE386)
1555 dnl Check for need for bigtoc support on IBM AIX
1559 AC_CACHE_CHECK([for -bbigtoc option], [gdb_cv_bigtoc], [
1561 yes) gdb_cv_bigtoc=-Wl,-bbigtoc ;;
1562 *) gdb_cv_bigtoc=-bbigtoc ;;
1565 LDFLAGS=$LDFLAGS\ $gdb_cv_bigtoc
1566 AC_TRY_LINK([], [int i;], [], [gdb_cv_bigtoc=])
1571 # Change CFLAGS and CPPFLAGS temporarily so that C_SWITCH_X_SITE gets
1572 # used for the tests that follow. We set them back to REAL_CFLAGS and
1573 # REAL_CPPFLAGS later on.
1575 REAL_CPPFLAGS="$CPPFLAGS"
1577 if test "${HAVE_X11}" = "yes"; then
1578 DEFS="$C_SWITCH_X_SITE $DEFS"
1579 LDFLAGS="$LDFLAGS $LD_SWITCH_X_SITE"
1581 CFLAGS="$C_SWITCH_X_SITE $CFLAGS"
1582 CPPFLAGS="$C_SWITCH_X_SITE $CPPFLAGS"
1584 # On Solaris, arrange for LD_RUN_PATH to point to the X libraries for tests.
1585 # This is handled by LD_SWITCH_X_SITE_AUX during the real build,
1586 # but it's more convenient here to set LD_RUN_PATH
1587 # since this also works on hosts that don't understand LD_SWITCH_X_SITE_AUX.
1588 if test "${x_libraries}" != NONE && test -n "${x_libraries}"; then
1589 LD_RUN_PATH=$x_libraries${LD_RUN_PATH+:}$LD_RUN_PATH
1593 if test "${opsys}" = "gnu-linux"; then
1594 AC_MSG_CHECKING(whether X on GNU/Linux needs -b to link)
1596 [XOpenDisplay ("foo");],
1597 [xlinux_first_failure=no],
1598 [xlinux_first_failure=yes])
1599 if test "${xlinux_first_failure}" = "yes"; then
1600 OLD_LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE"
1601 OLD_C_SWITCH_X_SITE="$C_SWITCH_X_SITE"
1602 OLD_CPPFLAGS="$CPPFLAGS"
1604 LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -b i486-linuxaout"
1605 C_SWITCH_X_SITE="$C_SWITCH_X_SITE -b i486-linuxaout"
1606 CPPFLAGS="$CPPFLAGS -b i486-linuxaout"
1607 LIBS="$LIBS -b i486-linuxaout"
1609 [XOpenDisplay ("foo");],
1610 [xlinux_second_failure=no],
1611 [xlinux_second_failure=yes])
1612 if test "${xlinux_second_failure}" = "yes"; then
1613 # If we get the same failure with -b, there is no use adding -b.
1614 # So take it out. This plays safe.
1615 LD_SWITCH_X_SITE="$OLD_LD_SWITCH_X_SITE"
1616 C_SWITCH_X_SITE="$OLD_C_SWITCH_X_SITE"
1617 CPPFLAGS="$OLD_CPPFLAGS"
1628 # Reportedly, some broken Solaris systems have XKBlib.h but are missing
1629 # header files included from there.
1630 AC_MSG_CHECKING(for Xkb)
1631 AC_TRY_LINK([#include <X11/Xlib.h>
1632 #include <X11/XKBlib.h>],
1633 [XkbDescPtr kb = XkbGetKeyboard (0, XkbAllComponentsMask, XkbUseCoreKbd);],
1634 emacs_xkb=yes, emacs_xkb=no)
1635 AC_MSG_RESULT($emacs_xkb)
1636 if test $emacs_xkb = yes; then
1637 AC_DEFINE(HAVE_XKBGETKEYBOARD, 1, [Define to 1 if you have the XkbGetKeyboard function.])
1640 AC_CHECK_FUNCS(XrmSetDatabase XScreenResourceString \
1641 XScreenNumberOfScreen XSetWMProtocols)
1644 if test "${window_system}" = "x11"; then
1645 AC_MSG_CHECKING(X11 version 6)
1646 AC_CACHE_VAL(emacs_cv_x11_version_6,
1647 [AC_TRY_LINK([#include <X11/Xlib.h>],
1648 [#if XlibSpecificationRelease < 6
1651 ], emacs_cv_x11_version_6=yes, emacs_cv_x11_version_6=no)])
1652 if test $emacs_cv_x11_version_6 = yes; then
1653 AC_MSG_RESULT(6 or newer)
1654 AC_DEFINE(HAVE_X11R6, 1,
1655 [Define to 1 if you have the X11R6 or newer version of Xlib.])
1657 AC_MSG_RESULT(before 6)
1662 ### Use -lrsvg-2 if available, unless `--with-rsvg=no' is specified.
1664 if test "${HAVE_X11}" = "yes" || test "${HAVE_CARBON}" = "yes"; then
1665 if test "${with_rsvg}" != "no"; then
1667 RSVG_MODULE="librsvg-2.0 >= $RSVG_REQUIRED"
1669 PKG_CHECK_MODULES(RSVG, $RSVG_MODULE, :, :)
1670 AC_SUBST(RSVG_CFLAGS)
1673 if test ".${RSVG_CFLAGS}" != "."; then
1675 AC_DEFINE(HAVE_RSVG, 1, [Define to 1 if using librsvg.])
1676 CFLAGS="$CFLAGS $RSVG_CFLAGS"
1677 LIBS="$RSVG_LIBS $LIBS"
1684 if test "${with_gtk}" = "yes" && test "$USE_X_TOOLKIT" = "gtk"; then
1687 if test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "gtk" || \
1688 test "$USE_X_TOOLKIT" = "maybe"; then
1689 if test "$USE_X_TOOLKIT" != "none" && test "$USE_X_TOOLKIT" != "maybe"; then
1690 AC_MSG_ERROR([Conflicting options, --with-gtk is incompatible with --with-x-toolkit=${with_x_toolkit}]);
1694 GTK_MODULES="gtk+-2.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
1696 dnl Checks for libraries.
1697 PKG_CHECK_MODULES(GTK, $GTK_MODULES, pkg_check_gtk=yes, pkg_check_gtk=no)
1698 if test "$pkg_check_gtk" = "no" && test "$USE_X_TOOLKIT" != "maybe"; then
1699 AC_MSG_ERROR($GTK_PKG_ERRORS)
1704 if test x"$pkg_check_gtk" = xyes; then
1706 AC_SUBST(GTK_CFLAGS)
1708 C_SWITCH_X_SITE="$C_SWITCH_X_SITE $GTK_CFLAGS"
1709 CFLAGS="$CFLAGS $GTK_CFLAGS"
1710 LIBS="$GTK_LIBS $LIBS"
1711 dnl Try to compile a simple GTK program.
1713 AC_CHECK_FUNCS(gtk_main, GTK_COMPILES=yes)
1714 if test "${GTK_COMPILES}" != "yes"; then
1715 if test "$USE_X_TOOLKIT" != "maybe"; then
1716 AC_MSG_ERROR([Gtk+ wanted, but it does not compile, see config.log. Maybe some x11-devel files missing?]);
1720 AC_DEFINE(HAVE_GTK, 1, [Define to 1 if using GTK.])
1727 if test "${HAVE_GTK}" = "yes"; then
1729 dnl GTK scrollbars resemble toolkit scrollbars a lot, so to avoid
1730 dnl a lot if #ifdef:s, say we have toolkit scrollbars.
1731 if test "$with_toolkit_scroll_bars" != no; then
1732 with_toolkit_scroll_bars=yes
1735 dnl Check if we can use multiple displays with this GTK version.
1736 dnl If gdk_display_open exists, assume all others are there also.
1737 HAVE_GTK_MULTIDISPLAY=no
1738 AC_CHECK_FUNCS(gdk_display_open, HAVE_GTK_MULTIDISPLAY=yes)
1739 if test "${HAVE_GTK_MULTIDISPLAY}" = "yes"; then
1740 AC_DEFINE(HAVE_GTK_MULTIDISPLAY, 1,
1741 [Define to 1 if GTK can handle more than one display.])
1744 dnl Check if we have the old file selection dialog.
1745 dnl If gdk_display_open exists, assume all others are there also.
1746 HAVE_GTK_FILE_SELECTION=no
1747 AC_CHECK_FUNCS(gtk_file_selection_new, HAVE_GTK_FILE_SELECTION=yes)
1749 dnl Check if we have the new file chooser dialog
1750 dnl If gdk_display_open exists, assume all others are there also.
1751 HAVE_GTK_FILE_CHOOSER=no
1752 AC_CHECK_FUNCS(gtk_file_chooser_dialog_new, HAVE_GTK_FILE_CHOOSER=yes)
1754 if test "$HAVE_GTK_FILE_SELECTION" = yes \
1755 && test "$HAVE_GTK_FILE_CHOOSER" = yes; then
1756 AC_DEFINE(HAVE_GTK_FILE_BOTH, 1,
1757 [Define to 1 if GTK has both file selection and chooser dialog.])
1760 dnl Check if pthreads are available. Emacs only needs this when using
1761 dnl gtk_file_chooser under Gnome.
1762 if test "$HAVE_GTK_FILE_CHOOSER" = yes; then
1763 HAVE_GTK_AND_PTHREAD=no
1764 AC_CHECK_HEADERS(pthread.h)
1765 if test "$ac_cv_header_pthread_h"; then
1766 AC_CHECK_LIB(pthread, pthread_self, HAVE_GTK_AND_PTHREAD=yes)
1768 if test "$HAVE_GTK_AND_PTHREAD" = yes; then
1769 case "${canonical}" in
1771 *) GTK_LIBS="$GTK_LIBS -lpthread" ;;
1773 AC_DEFINE(HAVE_GTK_AND_PTHREAD, 1,
1774 [Define to 1 if you have GTK and pthread (-lpthread).])
1779 dnl D-Bus has been tested under GNU/Linux only. Must be adapted for
1780 dnl other platforms. Support for higher D-Bus versions than 1.0 is
1781 dnl also not configured.
1783 if test "${with_dbus}" = "yes"; then
1784 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0, HAVE_DBUS=yes, HAVE_DBUS=no)
1785 if test "$HAVE_DBUS" = yes; then
1786 AC_DEFINE(HAVE_DBUS, 1, [Define to 1 if using D-Bus.])
1790 ### Link with -lXft if available to work around a bug.
1792 if test "${HAVE_GTK}" = "yes"; then
1793 PKG_CHECK_MODULES(XFT, xft >= 0.13.0, , HAVE_XFT=no)
1794 if test "$HAVE_XFT" != no; then
1795 OLD_CFLAGS="$CPPFLAGS"
1796 OLD_CPPFLAGS="$CFLAGS"
1798 CPPFLAGS="$CPPFLAGS $XFT_CFLAGS"
1799 CFLAGS="$CFLAGS $XFT_CFLAGS"
1800 LIBS="$XFT_LIBS $LIBS"
1801 AC_CHECK_HEADER(X11/Xft/Xft.h,
1802 [AC_CHECK_LIB(Xft, XftFontOpen, HAVE_XFT=yes, , $XFT_LIBS)])
1804 if test "${HAVE_XFT}" = "yes"; then
1805 AC_DEFINE(HAVE_XFT, 1, [Define to 1 if you have the Xft library.])
1807 C_SWITCH_X_SITE="$C_SWITCH_X_SITE $XFT_CFLAGS"
1809 CFLAGS="$OLD_CPPFLAGS"
1810 CFLAGS="$OLD_CFLAGS"
1816 dnl Do not put whitespace before the #include statements below.
1817 dnl Older compilers (eg sunos4 cc) choke on it.
1819 if test x"${USE_X_TOOLKIT}" = xmaybe || test x"${USE_X_TOOLKIT}" = xLUCID; then
1820 if test "$with_xaw3d" != no; then
1821 AC_MSG_CHECKING(for xaw3d)
1822 AC_CACHE_VAL(emacs_cv_xaw3d,
1824 #include <X11/Intrinsic.h>
1825 #include <X11/Xaw3d/Simple.h>],
1828 emacs_cv_xaw3d=no)])
1832 if test $emacs_cv_xaw3d = yes; then
1833 AC_MSG_RESULT([yes; using Lucid toolkit])
1836 AC_DEFINE(HAVE_XAW3D, 1,
1837 [Define to 1 if you have the Xaw3d library (-lXaw3d).])
1840 AC_MSG_CHECKING(for libXaw)
1841 AC_CACHE_VAL(emacs_cv_xaw,
1843 #include <X11/Intrinsic.h>
1844 #include <X11/Xaw/Simple.h>],
1848 if test $emacs_cv_xaw = yes; then
1849 AC_MSG_RESULT([yes; using Lucid toolkit])
1851 elif test x"${USE_X_TOOLKIT}" = xLUCID; then
1852 AC_MSG_ERROR([Lucid toolkit requires X11/Xaw include files])
1854 AC_MSG_RESULT([no; do not use toolkit by default])
1860 X_TOOLKIT_TYPE=$USE_X_TOOLKIT
1862 if test "${USE_X_TOOLKIT}" != "none"; then
1863 AC_MSG_CHECKING(X11 toolkit version)
1864 AC_CACHE_VAL(emacs_cv_x11_toolkit_version_6,
1865 [AC_TRY_LINK([#include <X11/Intrinsic.h>],
1866 [#if XtSpecificationRelease < 6
1869 ], emacs_cv_x11_toolkit_version_6=yes, emacs_cv_x11_toolkit_version_6=no)])
1870 HAVE_X11XTR6=$emacs_cv_x11_toolkit_version_6
1871 if test $emacs_cv_x11_toolkit_version_6 = yes; then
1872 AC_MSG_RESULT(6 or newer)
1873 AC_DEFINE(HAVE_X11XTR6, 1,
1874 [Define to 1 if you have the X11R6 or newer version of Xt.])
1876 AC_MSG_RESULT(before 6)
1879 dnl If using toolkit, check whether libXmu.a exists.
1880 dnl tranle@intellicorp.com says libXmu.a can need XtMalloc in libXt.a to link.
1882 if test x$HAVE_X11XTR6 = xyes; then
1883 LIBS="-lXt -lSM -lICE $LIBS"
1887 AC_CHECK_LIB(Xmu, XmuConvertStandardSelection)
1888 test $ac_cv_lib_Xmu_XmuConvertStandardSelection = no && LIBS="$OLDLIBS"
1891 # On Irix 6.5, at least, we need XShapeQueryExtension from -lXext for Xaw3D.
1892 if test "${HAVE_X11}" = "yes"; then
1893 if test "${USE_X_TOOLKIT}" != "none"; then
1894 AC_CHECK_LIB(Xext, XShapeQueryExtension)
1898 if test "${USE_X_TOOLKIT}" = "MOTIF"; then
1899 AC_CACHE_CHECK(for Motif version 2.1, emacs_cv_motif_version_2_1,
1900 [AC_TRY_COMPILE([#include <Xm/Xm.h>],
1901 [#if XmVERSION > 2 || (XmVERSION == 2 && XmREVISION >= 1)
1904 Motif version prior to 2.1.
1906 emacs_cv_motif_version_2_1=yes, emacs_cv_motif_version_2_1=no)])
1907 HAVE_MOTIF_2_1=$emacs_cv_motif_version_2_1
1908 if test $emacs_cv_motif_version_2_1 = yes; then
1910 AC_DEFINE(HAVE_MOTIF_2_1, 1,
1911 [Define to 1 if you have Motif 2.1 or newer.])
1912 AC_CHECK_LIB(Xp, XpCreateContext, HAVE_LIBXP=yes)
1913 if test ${HAVE_LIBXP} = yes; then
1914 AC_DEFINE(HAVE_LIBXP, 1,
1915 [Define to 1 if you have the Xp library (-lXp).])
1918 AC_CACHE_CHECK(for LessTif where some systems put it, emacs_cv_lesstif,
1919 # We put this in CFLAGS temporarily to precede other -I options
1920 # that might be in CFLAGS temporarily.
1921 # We put this in CPPFLAGS where it precedes the other -I options.
1922 OLD_CPPFLAGS=$CPPFLAGS
1924 CPPFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $CPPFLAGS"
1925 CFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $CFLAGS"
1926 [AC_TRY_COMPILE([#include </usr/X11R6/LessTif/Motif1.2/include/Xm/Xm.h>],
1928 emacs_cv_lesstif=yes, emacs_cv_lesstif=no)])
1929 if test $emacs_cv_lesstif = yes; then
1930 # Make sure this -I option remains in CPPFLAGS after it is set
1931 # back to REAL_CPPFLAGS.
1932 # There is no need to change REAL_CFLAGS, because REAL_CFLAGS does not
1933 # have those other -I options anyway. Ultimately, having this
1934 # directory ultimately in CPPFLAGS will be enough.
1935 REAL_CPPFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $REAL_CPPFLAGS"
1936 LDFLAGS="-L/usr/X11R6/LessTif/Motif1.2/lib $LDFLAGS"
1939 CPPFLAGS=$OLD_CPPFLAGS
1944 dnl Use toolkit scroll bars if configured for GTK or X toolkit and either
1945 dnl using Motif or Xaw3d is available, and unless
1946 dnl --with-toolkit-scroll-bars=no was specified.
1948 AH_TEMPLATE(USE_TOOLKIT_SCROLL_BARS,
1949 [Define to 1 if we should use toolkit scroll bars.])dnl
1950 USE_TOOLKIT_SCROLL_BARS=no
1951 if test "${with_toolkit_scroll_bars}" != "no"; then
1952 if test "${USE_X_TOOLKIT}" != "none"; then
1953 if test "${USE_X_TOOLKIT}" = "MOTIF"; then
1954 AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
1956 USE_TOOLKIT_SCROLL_BARS=yes
1957 elif test "${HAVE_XAW3D}" = "yes"; then
1958 AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
1959 USE_TOOLKIT_SCROLL_BARS=yes
1961 elif test "${HAVE_GTK}" = "yes"; then
1962 AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
1963 USE_TOOLKIT_SCROLL_BARS=yes
1964 elif test "${HAVE_CARBON}" = "yes"; then
1965 AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
1966 USE_TOOLKIT_SCROLL_BARS=yes
1970 dnl See if XIM is available.
1972 #include <X11/Xlib.h>
1973 #include <X11/Xresource.h>],
1974 [XIMProc callback;],
1976 AC_DEFINE(HAVE_XIM, 1, [Define to 1 if XIM is available])],
1979 dnl `--with-xim' now controls only the initial value of use_xim at run time.
1981 if test "${with_xim}" != "no"; then
1982 AC_DEFINE(USE_XIM, 1,
1983 [Define to 1 if we should use XIM, if it is available.])
1987 if test "${HAVE_XIM}" != "no"; then
1989 if test "$GCC" = yes; then
1990 CFLAGS="$CFLAGS --pedantic-errors"
1993 #include <X11/Xlib.h>
1994 #include <X11/Xresource.h>],
2000 XPointer *client_data;
2002 /* If we're not using GCC, it's probably not XFree86, and this is
2003 probably right, but we can't use something like --pedantic-errors. */
2004 extern Bool XRegisterIMInstantiateCallback(Display*, XrmDatabase, char*,
2005 char*, XIMProc, XPointer*);
2007 (void)XRegisterIMInstantiateCallback(display, db, res_name, res_class, callback,
2009 [emacs_cv_arg6_star=yes])
2010 AH_TEMPLATE(XRegisterIMInstantiateCallback_arg6,
2011 [Define to the type of the 6th arg of XRegisterIMInstantiateCallback,
2012 either XPointer or XPointer*.])dnl
2013 if test "$emacs_cv_arg6_star" = yes; then
2014 AC_DEFINE(XRegisterIMInstantiateCallback_arg6, [XPointer*])
2016 AC_DEFINE(XRegisterIMInstantiateCallback_arg6, [XPointer])
2021 ### Use -lXpm if available, unless `--with-xpm=no'.
2023 if test "${HAVE_X11}" = "yes"; then
2024 if test "${with_xpm}" != "no"; then
2025 AC_CHECK_HEADER(X11/xpm.h,
2026 [AC_CHECK_LIB(Xpm, XpmReadFileToPixmap, HAVE_XPM=yes, , -lX11)])
2027 if test "${HAVE_XPM}" = "yes"; then
2028 AC_MSG_CHECKING(for XpmReturnAllocPixels preprocessor define)
2029 AC_EGREP_CPP(no_return_alloc_pixels,
2030 [#include "X11/xpm.h"
2031 #ifndef XpmReturnAllocPixels
2032 no_return_alloc_pixels
2034 ], HAVE_XPM=no, HAVE_XPM=yes)
2036 if test "${HAVE_XPM}" = "yes"; then
2044 if test "${HAVE_XPM}" = "yes"; then
2045 AC_DEFINE(HAVE_XPM, 1, [Define to 1 if you have the Xpm libary (-lXpm).])
2049 ### Use -ljpeg if available, unless `--with-jpeg=no'.
2051 if test "${HAVE_X11}" = "yes"; then
2052 if test "${with_jpeg}" != "no"; then
2053 dnl Checking for jpeglib.h can lose because of a redefinition of
2055 AC_CHECK_HEADER(jerror.h,
2056 [AC_CHECK_LIB(jpeg, jpeg_destroy_compress, HAVE_JPEG=yes)])
2059 AH_TEMPLATE(HAVE_JPEG, [Define to 1 if you have the jpeg library (-ljpeg).])dnl
2060 if test "${HAVE_JPEG}" = "yes"; then
2061 AC_DEFINE(HAVE_JPEG)
2062 AC_EGREP_CPP([version= *(6[2-9]|[7-9][0-9])],
2063 [#include <jpeglib.h>
2064 version=JPEG_LIB_VERSION
2066 [AC_DEFINE(HAVE_JPEG)],
2067 [AC_MSG_WARN([libjpeg found, but not version 6b or later])
2072 ### Use -lpng if available, unless `--with-png=no'.
2074 if test "${HAVE_X11}" = "yes"; then
2075 if test "${with_png}" != "no"; then
2076 # Debian unstable as of July 2003 has multiple libpngs, and puts png.h
2077 # in /usr/include/libpng.
2078 AC_CHECK_HEADERS(png.h libpng/png.h)
2079 if test "$ac_cv_header_png_h" = yes || test "$ac_cv_header_libpng_png_h" = yes ; then
2080 AC_CHECK_LIB(png, png_get_channels, HAVE_PNG=yes, , -lz -lm)
2084 if test "${HAVE_PNG}" = "yes"; then
2085 AC_DEFINE(HAVE_PNG, 1, [Define to 1 if you have the png library (-lpng).])
2089 ### Use -ltiff if available, unless `--with-tiff=no'.
2091 if test "${HAVE_X11}" = "yes"; then
2092 if test "${with_tiff}" != "no"; then
2093 AC_CHECK_HEADER(tiffio.h,
2095 # At least one tiff package requires the jpeg library.
2096 if test "${HAVE_JPEG}" = yes; then tifflibs="-ljpeg $tifflibs"; fi
2097 AC_CHECK_LIB(tiff, TIFFGetVersion, HAVE_TIFF=yes, , $tifflibs)])
2100 if test "${HAVE_TIFF}" = "yes"; then
2101 AC_DEFINE(HAVE_TIFF, 1, [Define to 1 if you have the tiff library (-ltiff).])
2105 ### Use -lgif or -lungif if available, unless `--with-gif=no'.
2107 if test "${HAVE_X11}" = "yes" && test "${with_gif}" != "no"; then
2108 AC_CHECK_HEADER(gif_lib.h,
2109 # EGifPutExtensionLast only exists from version libungif-4.1.0b1.
2110 # Earlier versions can crash Emacs.
2111 [AC_CHECK_LIB(gif, EGifPutExtensionLast, HAVE_GIF=yes, try_libungif=yes)])
2113 if test "$HAVE_GIF" = yes; then
2114 ac_gif_lib_name="-lgif"
2117 # If gif_lib.h but no libgif, try libungif.
2118 if test x"$try_libungif" = xyes; then
2119 AC_CHECK_LIB(ungif, EGifPutExtensionLast, HAVE_GIF=yes)
2121 if test "$HAVE_GIF" = yes; then
2122 AC_DEFINE(LIBGIF, -lungif, [Compiler option to link with the gif library (if not -lgif).])
2123 ac_gif_lib_name="-lungif"
2127 if test "${HAVE_GIF}" = "yes"; then
2128 AC_DEFINE(HAVE_GIF, 1, [Define to 1 if you have a gif library (default -lgif; otherwise specify with LIBGIF).])
2132 dnl Check for required libraries.
2133 if test "${HAVE_X11}" = "yes"; then
2136 test "${with_xpm}" != "no" && test "${HAVE_XPM}" != "yes" &&
2137 MISSING="libXpm" && WITH_NO="--with-xpm=no"
2138 test "${with_jpeg}" != "no" && test "${HAVE_JPEG}" != "yes" &&
2139 MISSING="$MISSING libjpeg" && WITH_NO="$WITH_NO --with-jpeg=no"
2140 test "${with_png}" != "no" && test "${HAVE_PNG}" != "yes" &&
2141 MISSING="$MISSING libpng" && WITH_NO="$WITH_NO --with-png=no"
2142 test "${with_gif}" != "no" && test "${HAVE_GIF}" != "yes" &&
2143 MISSING="$MISSING libgif/libungif" && WITH_NO="$WITH_NO --with-gif=no"
2144 test "${with_tiff}" != "no" && test "${HAVE_TIFF}" != "yes" &&
2145 MISSING="$MISSING libtiff" && WITH_NO="$WITH_NO --with-tiff=no"
2147 if test "X${MISSING}" != X; then
2148 AC_MSG_ERROR([The following required libraries were not found:
2150 Maybe some development libraries/packages are missing?
2151 If you don't want to link with them give
2153 as options to configure])
2157 ### Use -lgpm if available, unless `--with-gpm=no'.
2159 if test "${with_gpm}" != "no"; then
2160 AC_CHECK_HEADER(gpm.h,
2161 [AC_CHECK_LIB(gpm, Gpm_Open, HAVE_GPM=yes)])
2164 if test "${HAVE_GPM}" = "yes"; then
2165 AC_DEFINE(HAVE_GPM, 1, [Define to 1 if you have the gpm library (-lgpm).])
2168 dnl Check for malloc/malloc.h on darwin
2169 AC_CHECK_HEADER(malloc/malloc.h, [AC_DEFINE(HAVE_MALLOC_MALLOC_H, 1, [Define to 1 if you have the <malloc/malloc.h> header file.])])
2171 ### Use Mac OS X Carbon API to implement GUI.
2172 if test "${HAVE_CARBON}" = "yes"; then
2173 AC_DEFINE(HAVE_CARBON, 1, [Define to 1 if you are using the Carbon API on Mac OS X.])
2174 ## Specify the install directory
2176 if test "${carbon_appdir_x}" != ""; then
2177 case ${carbon_appdir_x} in
2178 y | ye | yes) carbon_appdir=/Applications ;;
2179 * ) carbon_appdir=${carbon_appdir_x} ;;
2182 # We also have mouse menus.
2186 ### Use session management (-lSM -lICE) if available
2188 if test "${HAVE_X11}" = "yes"; then
2189 AC_CHECK_HEADER(X11/SM/SMlib.h,
2190 [AC_CHECK_LIB(SM, SmcOpenConnection, HAVE_X_SM=yes, , -lICE)])
2192 if test "${HAVE_X_SM}" = "yes"; then
2193 AC_DEFINE(HAVE_X_SM, 1, [Define to 1 if you have the SM library (-lSM).])
2196 *) LIBS="-lSM -lICE $LIBS" ;;
2201 # If netdb.h doesn't declare h_errno, we must declare it by hand.
2202 AC_CACHE_CHECK(whether netdb declares h_errno,
2203 emacs_cv_netdb_declares_h_errno,
2204 [AC_TRY_LINK([#include <netdb.h>],
2206 emacs_cv_netdb_declares_h_errno=yes, emacs_cv_netdb_declares_h_errno=no)])
2207 if test $emacs_cv_netdb_declares_h_errno = yes; then
2208 AC_DEFINE(HAVE_H_ERRNO, 1, [Define to 1 if netdb.h declares h_errno.])
2213 dnl src/alloca.c has been removed. Could also check if $ALLOCA is set?
2214 dnl FIXME is there an autoconf test that does the right thing, without
2215 dnl needing to call A_M_E afterwards?
2216 if test x"$ac_cv_func_alloca_works" != xyes; then
2217 AC_MSG_ERROR( [a system implementation of alloca is required] )
2220 # fmod, logb, and frexp are found in -lm on most systems.
2221 # On HPUX 9.01, -lm does not contain logb, so check for sqrt.
2222 AC_CHECK_LIB(m, sqrt)
2224 # Check for mail-locking functions in a "mail" library. Probably this should
2225 # have the same check as for liblockfile below.
2226 AC_CHECK_LIB(mail, maillock)
2227 dnl Debian, at least:
2228 AC_CHECK_LIB(lockfile, maillock)
2229 # If we have the shared liblockfile, assume we must use it for mail
2230 # locking (e.g. Debian). If we couldn't link against liblockfile
2231 # (no liblockfile.a installed), ensure that we don't need to.
2232 if test "$ac_cv_lib_lockfile_maillock" = no; then
2233 dnl This works for files generally, not just executables.
2234 dnl Should we look elsewhere for it? Maybe examine /etc/ld.so.conf?
2235 AC_CHECK_PROG(liblockfile, liblockfile.so, yes, no,
2236 /usr/lib:/lib:/usr/local/lib:$LD_LIBRARY_PATH)
2237 if test $ac_cv_prog_liblockfile = yes; then
2238 AC_MSG_ERROR([Shared liblockfile found but can't link against it.
2239 This probably means that movemail could lose mail.
2240 There may be a `development' package to install containing liblockfile.])
2244 AC_CHECK_FUNCS(touchlock)
2245 AC_CHECK_HEADERS(maillock.h)
2247 AC_CHECK_FUNCS(gethostname getdomainname dup2 \
2248 rename closedir mkdir rmdir sysinfo getrusage get_current_dir_name \
2249 random lrand48 bcopy bcmp logb frexp fmod rint cbrt ftime setsid \
2250 strerror fpathconf select mktime euidaccess getpagesize tzset setlocale \
2251 utimes setrlimit setpgid getcwd getwd shutdown getaddrinfo \
2252 __fpending mblen mbrlen mbsinit strsignal setitimer ualarm index rindex \
2253 sendto recvfrom getsockopt setsockopt getsockname getpeername \
2254 gai_strerror mkstemp getline getdelim mremap memmove fsync sync bzero \
2255 memset memcmp difftime memcpy mempcpy mblen mbrlen posix_memalign)
2257 AC_CHECK_HEADERS(sys/un.h)
2260 if test "$ac_cv_func_working_mktime" = no; then
2261 AC_DEFINE(BROKEN_MKTIME, 1, [Define to 1 if the mktime function is broken.])
2269 m4_include([m4/getopt.m4])
2271 gl_GETOPT_SUBSTITUTE_HEADER
2273 GETOPTOBJS='getopt.o getopt1.o'
2275 AC_SUBST(GETOPTOBJS)
2282 AC_CHECK_FUNCS(grantpt)
2284 # PTY-related GNU extensions.
2285 AC_CHECK_FUNCS(getpt)
2287 # Check this now, so that we will NOT find the above functions in ncurses.
2288 # That is because we have not set up to link ncurses in lib-src.
2289 # It's better to believe a function is not available
2290 # than to expect to find it in ncurses.
2291 AC_CHECK_LIB(ncurses, tparm)
2293 # Do we have res_init, for detecting changes in /etc/resolv.conf?
2296 AC_TRY_LINK([#include <netinet/in.h>
2297 #include <arpa/nameser.h>
2298 #include <resolv.h>],
2299 [return res_init();],
2300 have_res_init=yes, have_res_init=no)
2301 if test "$have_res_init" = no; then
2303 LIBS="$LIBS -lresolv"
2304 AC_MSG_CHECKING(for res_init with -lresolv)
2305 AC_TRY_LINK([#include <netinet/in.h>
2306 #include <arpa/nameser.h>
2307 #include <resolv.h>],
2308 [return res_init();],
2309 have_res_init=yes, have_res_init=no)
2310 AC_MSG_RESULT($have_res_init)
2311 if test "$have_res_init" = yes ; then
2317 if test "$have_res_init" = yes; then
2318 AC_DEFINE(HAVE_RES_INIT, 1, [Define to 1 if res_init is available.])
2321 # Do we need the Hesiod library to provide the support routines?
2322 if test "$with_hesiod" = yes ; then
2323 # Don't set $LIBS here -- see comments above.
2324 AC_CHECK_FUNC(res_send, , [AC_CHECK_FUNC(__res_send, ,
2325 [AC_CHECK_LIB(resolv, res_send, resolv=yes,
2326 [AC_CHECK_LIB(resolv, __res_send, resolv=yes)])])])
2327 if test "$resolv" = yes ; then
2332 AC_CHECK_FUNC(hes_getmailhost, , [AC_CHECK_LIB(hesiod, hes_getmailhost,
2333 [AC_DEFINE(HAVE_LIBHESIOD, 1,
2334 [Define to 1 if you have the hesiod library (-lhesiod).])],
2338 # Do we need libresolv (due to res_init or Hesiod)?
2339 if test "$resolv" = yes ; then
2340 AC_DEFINE(HAVE_LIBRESOLV, 1,
2341 [Define to 1 if you have the resolv library (-lresolv).])
2344 # These tell us which Kerberos-related libraries to use.
2345 if test "${with_kerberos+set}" = set; then
2346 AC_CHECK_LIB(com_err, com_err)
2347 AC_CHECK_LIB(k5crypto, mit_des_cbc_encrypt)
2348 AC_CHECK_LIB(crypto, mit_des_cbc_encrypt)
2349 AC_CHECK_LIB(krb5, krb5_init_context)
2350 if test "${with_kerberos5+set}" != set; then
2351 AC_CHECK_LIB(des425, des_cbc_encrypt,,
2352 [AC_CHECK_LIB(des, des_cbc_encrypt)])
2353 AC_CHECK_LIB(krb4, krb_get_cred,,
2354 [AC_CHECK_LIB(krb, krb_get_cred)])
2357 if test "${with_kerberos5+set}" = set; then
2358 AC_CHECK_HEADERS(krb5.h)
2360 AC_CHECK_HEADERS(des.h,,
2361 [AC_CHECK_HEADERS(kerberosIV/des.h,,
2362 [AC_CHECK_HEADERS(kerberos/des.h)])])
2363 AC_CHECK_HEADERS(krb.h,,
2364 [AC_CHECK_HEADERS(kerberosIV/krb.h,,
2365 [AC_CHECK_HEADERS(kerberos/krb.h)])])
2367 AC_CHECK_HEADERS(com_err.h)
2370 # Solaris requires -lintl if you want strerror (which calls dgettext)
2371 # to return localized messages.
2372 AC_CHECK_LIB(intl, dgettext)
2374 AC_MSG_CHECKING(whether localtime caches TZ)
2375 AC_CACHE_VAL(emacs_cv_localtime_cache,
2376 [if test x$ac_cv_func_tzset = xyes; then
2377 AC_TRY_RUN([#include <time.h>
2378 extern char **environ;
2382 for (to = from = environ; (*to = *from); from++)
2383 if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '='))
2386 char TZ_GMT0[] = "TZ=GMT0";
2387 char TZ_PST8[] = "TZ=PST8";
2390 time_t now = time ((time_t *) 0);
2391 int hour_GMT0, hour_unset;
2392 if (putenv (TZ_GMT0) != 0)
2394 hour_GMT0 = localtime (&now)->tm_hour;
2396 hour_unset = localtime (&now)->tm_hour;
2397 if (putenv (TZ_PST8) != 0)
2399 if (localtime (&now)->tm_hour == hour_GMT0)
2402 if (localtime (&now)->tm_hour != hour_unset)
2405 }], emacs_cv_localtime_cache=no, emacs_cv_localtime_cache=yes,
2406 [# If we have tzset, assume the worst when cross-compiling.
2407 emacs_cv_localtime_cache=yes])
2409 # If we lack tzset, report that localtime does not cache TZ,
2410 # since we can't invalidate the cache if we don't have tzset.
2411 emacs_cv_localtime_cache=no
2413 AC_MSG_RESULT($emacs_cv_localtime_cache)
2414 if test $emacs_cv_localtime_cache = yes; then
2415 AC_DEFINE(LOCALTIME_CACHE, 1,
2416 [Define to 1 if localtime caches TZ.])
2419 if test "x$HAVE_TIMEVAL" = xyes; then
2420 AC_CHECK_FUNCS(gettimeofday)
2421 if test $ac_cv_func_gettimeofday = yes; then
2422 AC_CACHE_CHECK(whether gettimeofday can accept two arguments,
2423 emacs_cv_gettimeofday_two_arguments,
2425 #ifdef TIME_WITH_SYS_TIME
2426 #include <sys/time.h>
2429 #ifdef HAVE_SYS_TIME_H
2430 #include <sys/time.h>
2435 [struct timeval time;
2436 gettimeofday (&time, 0);],
2437 emacs_cv_gettimeofday_two_arguments=yes,
2438 emacs_cv_gettimeofday_two_arguments=no)])
2439 if test $emacs_cv_gettimeofday_two_arguments = no; then
2440 AC_DEFINE(GETTIMEOFDAY_ONE_ARGUMENT, 1,
2441 [Define to 1 if gettimeofday accepts only one argument.])
2447 AC_CHECK_FUNC(socket, , ok_so_far=no)
2448 if test $ok_so_far = yes; then
2449 AC_CHECK_HEADER(netinet/in.h, , ok_so_far=no)
2451 if test $ok_so_far = yes; then
2452 AC_CHECK_HEADER(arpa/inet.h, , ok_so_far=no)
2454 if test $ok_so_far = yes; then
2455 dnl Fixme: Not used. Should this be HAVE_SOCKETS?
2456 AC_DEFINE(HAVE_INET_SOCKETS, 1,
2457 [Define to 1 if you have inet sockets.])
2460 AC_CHECK_HEADERS(sys/ioctl.h)
2462 if test -f /usr/lpp/X11/bin/smt.exp; then
2463 AC_DEFINE(HAVE_AIX_SMT_EXP, 1,
2464 [Define to 1 if the file /usr/lpp/X11/bin/smt.exp exists.])
2467 AC_MSG_CHECKING(whether system supports dynamic ptys)
2468 if test -d /dev/pts && ls -d /dev/ptmx > /dev/null 2>&1 ; then
2470 AC_DEFINE(HAVE_DEV_PTMX, 1, [Define to 1 if dynamic ptys are supported.])
2477 dnl Adapted from Haible's version.
2478 AC_CACHE_CHECK([for nl_langinfo and CODESET], emacs_cv_langinfo_codeset,
2479 [AC_TRY_LINK([#include <langinfo.h>],
2480 [char* cs = nl_langinfo(CODESET);],
2481 emacs_cv_langinfo_codeset=yes,
2482 emacs_cv_langinfo_codeset=no)
2484 if test $emacs_cv_langinfo_codeset = yes; then
2485 AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
2486 [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
2489 AC_CHECK_TYPES(size_t)
2493 dnl Restrict could probably be used effectively other than in regex.c.
2494 AC_CACHE_CHECK([for C restrict keyword], emacs_cv_c_restrict,
2495 [AC_TRY_COMPILE([void fred (int *restrict x);], [],
2496 emacs_cv_c_restrict=yes,
2497 [AC_TRY_COMPILE([void fred (int *__restrict x);], [],
2498 emacs_cv_c_restrict=__restrict,
2499 emacs_cv_c_restrict=no)])])
2500 case "$emacs_cv_c_restrict" in
2501 yes) emacs_restrict=restrict;;
2502 no) emacs_restrict="";;
2503 *) emacs_restrict="$emacs_cv_c_restrict";;
2505 if test "$emacs_restrict" != __restrict; then
2506 AC_DEFINE_UNQUOTED(__restrict, $emacs_restrict,
2507 [Define to compiler's equivalent of C99 restrict keyword.
2508 Don't define if equivalent is `__restrict'.])
2511 AC_CACHE_CHECK([for C restricted array declarations], emacs_cv_c_restrict_arr,
2512 [AC_TRY_COMPILE([void fred (int x[__restrict]);], [],
2513 emacs_cv_c_restrict_arr=yes, emacs_cv_c_restrict_arr=no)])
2514 if test "$emacs_cv_c_restrict_arr" = yes; then
2515 AC_DEFINE(__restrict_arr, __restrict,
2516 [Define to compiler's equivalent of C99 restrict keyword in array
2517 declarations. Define as empty for no equivalent.])
2520 dnl Fixme: AC_SYS_POSIX_TERMIOS should probably be used, but it's not clear
2521 dnl how the tty code is related to POSIX and/or other versions of termios.
2522 dnl The following looks like a useful start.
2524 dnl AC_SYS_POSIX_TERMIOS
2525 dnl if test $ac_cv_sys_posix_termios = yes; then
2526 dnl AC_DEFINE(HAVE_TERMIOS, 1, [Define to 1 if you have POSIX-style functions
2527 dnl and macros for terminal control.])
2528 dnl AC_DEFINE(HAVE_TCATTR, 1, [Define to 1 if you have tcgetattr and tcsetattr.])
2531 dnl Fixme: Use AC_FUNC_MEMCMP since memcmp is used. (Needs libobj replacement.)
2533 # Set up the CFLAGS for real compilation, so we can substitute it.
2534 CFLAGS="$REAL_CFLAGS"
2535 CPPFLAGS="$REAL_CPPFLAGS"
2537 #### Find out which version of Emacs this is.
2538 [version=`grep 'defconst[ ]*emacs-version' ${srcdir}/lisp/version.el \
2539 | sed -e 's/^[^"]*"\([^"]*\)".*$/\1/'`]
2540 if test x"${version}" = x; then
2541 AC_MSG_ERROR([can't find current emacs version in `${srcdir}/lisp/version.el'.])
2544 ### Specify what sort of things we'll be editing into Makefile and config.h.
2545 ### Use configuration here uncanonicalized to avoid exceeding size limits.
2547 AC_SUBST(configuration)
2551 AC_SUBST(exec_prefix)
2554 AC_SUBST(sharedstatedir)
2555 AC_SUBST(libexecdir)
2559 AC_SUBST(locallisppath)
2561 AC_SUBST(x_default_search_path)
2563 AC_SUBST(archlibdir)
2568 AC_SUBST(c_switch_system)
2569 AC_SUBST(c_switch_machine)
2570 AC_SUBST(LD_SWITCH_X_SITE)
2571 AC_SUBST(LD_SWITCH_X_SITE_AUX)
2572 AC_SUBST(C_SWITCH_X_SITE)
2574 AC_SUBST(X_TOOLKIT_TYPE)
2577 AC_SUBST(GETLOADAVG_LIBS)
2578 AC_SUBST(carbon_appdir)
2580 AC_DEFINE_UNQUOTED(EMACS_CONFIGURATION, "${canonical}",
2581 [Define to the canonical Emacs configuration name.])
2582 AC_DEFINE_UNQUOTED(EMACS_CONFIG_OPTIONS, "${ac_configure_args}",
2583 [Define to the options passed to configure.])
2584 AC_DEFINE_UNQUOTED(config_machfile, "${machfile}",
2585 [Define to the used machine dependent file.])
2586 AC_DEFINE_UNQUOTED(config_opsysfile, "${opsysfile}",
2587 [Define to the used os dependent file.])
2588 AC_DEFINE_UNQUOTED(LD_SWITCH_X_SITE, ${LD_SWITCH_X_SITE},
2589 [Define LD_SWITCH_X_SITE to contain any special flags your loader
2590 may need to deal with X Windows. For instance, if you've defined
2591 HAVE_X_WINDOWS above and your X libraries aren't in a place that
2592 your loader can find on its own, you might want to add "-L/..." or
2593 something similar.])
2594 AC_DEFINE_UNQUOTED(LD_SWITCH_X_SITE_AUX, ${LD_SWITCH_X_SITE_AUX},
2595 [Define LD_SWITCH_X_SITE_AUX with an -R option
2596 in case it's needed (for Solaris, for example).])
2597 AC_DEFINE_UNQUOTED(C_SWITCH_X_SITE, ${C_SWITCH_X_SITE},
2598 [Define C_SWITCH_X_SITE to contain any special flags your compiler
2599 may need to deal with X Windows. For instance, if you've defined
2600 HAVE_X_WINDOWS above and your X include files aren't in a place
2601 that your compiler can find on its own, you might want to add
2602 "-I/..." or something similar.])
2603 AC_DEFINE_UNQUOTED(UNEXEC_SRC, ${UNEXEC_SRC},
2604 [Define to the unexec source file name.])
2606 if test "${HAVE_X_WINDOWS}" = "yes" ; then
2607 AC_DEFINE(HAVE_X_WINDOWS, 1,
2608 [Define to 1 if you want to use the X window system.])
2610 if test "${USE_X_TOOLKIT}" != "none" ; then
2611 AC_DEFINE(USE_X_TOOLKIT, 1, [Define to 1 if using an X toolkit.])
2613 if test "${HAVE_X11}" = "yes" ; then
2614 AC_DEFINE(HAVE_X11, 1,
2615 [Define to 1 if you want to use version 11 of X windows.
2616 Otherwise, Emacs expects to use version 10.])
2618 if test "${HAVE_XFREE386}" = "yes" ; then
2619 AC_DEFINE(HAVE_XFREE386, 1, [Define to 1 if you're using XFree386.])
2621 if test "${HAVE_MENUS}" = "yes" ; then
2622 AC_DEFINE(HAVE_MENUS, 1,
2623 [Define to 1 if you have mouse menus.
2624 (This is automatic if you use X, but the option to specify it remains.)
2625 It is also defined with other window systems that support xmenu.c.])
2627 if test "${GNU_MALLOC}" = "yes" ; then
2628 AC_DEFINE(GNU_MALLOC, 1,
2629 [Define to 1 if you want to use the GNU memory allocator.])
2631 if test "${REL_ALLOC}" = "yes" ; then
2632 AC_DEFINE(REL_ALLOC, 1,
2633 [Define REL_ALLOC if you want to use the relocating allocator for
2638 AH_TOP([/* GNU Emacs site configuration template file.
2639 Copyright (C) 1988, 1993, 1994, 1999, 2000, 2001, 2002, 2004, 2005,
2640 2006, 2007, 2008 Free Software Foundation, Inc.
2642 This file is part of GNU Emacs.
2644 GNU Emacs is free software; you can redistribute it and/or modify
2645 it under the terms of the GNU General Public License as published by
2646 the Free Software Foundation; either version 3, or (at your option)
2649 GNU Emacs is distributed in the hope that it will be useful,
2650 but WITHOUT ANY WARRANTY; without even the implied warranty of
2651 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2652 GNU General Public License for more details.
2654 You should have received a copy of the GNU General Public License
2655 along with GNU Emacs; see the file COPYING. If not, write to the
2656 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
2657 Boston, MA 02110-1301, USA. */
2660 /* No code in Emacs #includes config.h twice, but some bits of code
2661 intended to work with other packages as well (like gmalloc.c)
2662 think they can include it as many times as they like. */
2663 #ifndef EMACS_CONFIG_H
2664 #define EMACS_CONFIG_H
2668 /* If we're using any sort of window system, define some consequences. */
2669 #ifdef HAVE_X_WINDOWS
2670 #define HAVE_WINDOW_SYSTEM
2671 #define MULTI_KBOARD
2675 /* Multi-tty support relies on MULTI_KBOARD. It seems safe to turn it
2676 on unconditionally. Note that src/s/darwin.h disables this at
2678 #ifndef MULTI_KBOARD
2679 #define MULTI_KBOARD
2682 /* If we're using the Carbon API on Mac OS X, define a few more
2683 variables as well. */
2685 #define HAVE_WINDOW_SYSTEM
2689 /* Define USER_FULL_NAME to return a string
2690 that is the user's full name.
2691 It can assume that the variable `pw'
2692 points to the password file entry for this user.
2694 At some sites, the pw_gecos field contains
2695 the user's full name. If neither this nor any other
2696 field contains the right thing, use pw_name,
2697 giving the user's login name, since that is better than nothing. */
2698 #define USER_FULL_NAME pw->pw_gecos
2700 /* Define AMPERSAND_FULL_NAME if you use the convention
2701 that & in the full name stands for the login id. */
2702 /* Turned on June 1996 supposing nobody will mind it. */
2703 #define AMPERSAND_FULL_NAME
2705 /* We have blockinput.h. */
2706 #define DO_BLOCK_INPUT
2708 /* Define HAVE_SOUND if we have sound support. We know it works
2709 and compiles only on the specified platforms. For others,
2710 it probably doesn't make sense to try. */
2712 #if defined __FreeBSD__ || defined __NetBSD__ || defined __linux__
2713 #ifdef HAVE_MACHINE_SOUNDCARD_H
2714 #define HAVE_SOUND 1
2716 #ifdef HAVE_SYS_SOUNDCARD_H
2717 #define HAVE_SOUND 1
2719 #ifdef HAVE_SOUNDCARD_H
2720 #define HAVE_SOUND 1
2723 #define HAVE_SOUND 1
2725 #endif /* __FreeBSD__ || __NetBSD__ || __linux__ */
2727 /* If using GNU, then support inline function declarations. */
2728 /* Don't try to switch on inline handling as detected by AC_C_INLINE
2729 generally, because even if non-gcc compilers accept `inline', they
2730 may reject `extern inline'. */
2731 #if defined (__GNUC__) && defined (OPTIMIZE)
2732 #define INLINE __inline__
2737 /* Include the os and machine dependent files. */
2738 #include config_opsysfile
2739 #include config_machfile
2741 /* Load in the conversion definitions if this system
2742 needs them and the source file being compiled has not
2743 said to inhibit this. There should be no need for you
2744 to alter these lines. */
2747 #ifndef NO_SHORTNAMES
2748 #include "../shortnames/remap.h"
2749 #endif /* not NO_SHORTNAMES */
2750 #endif /* SHORTNAMES */
2752 /* If no remapping takes place, static variables cannot be dumped as
2753 pure, so don't worry about the `static' keyword. */
2758 /* Define `subprocesses' should be defined if you want to
2759 have code for asynchronous subprocesses
2760 (as used in M-x compile and M-x shell).
2761 These do not work for some USG systems yet;
2762 for the ones where they work, the s/SYSTEM.h file defines this flag. */
2766 /* #define subprocesses */
2770 /* SIGTYPE is the macro we actually use. */
2772 #define SIGTYPE RETSIGTYPE
2775 #ifdef emacs /* Don't do this for lib-src. */
2776 /* Tell regex.c to use a type compatible with Emacs. */
2777 #define RE_TRANSLATE_TYPE Lisp_Object
2778 #define RE_TRANSLATE(TBL, C) CHAR_TABLE_TRANSLATE (TBL, C)
2780 /* If make_number is a macro, use it. */
2781 #define RE_TRANSLATE_P(TBL) (!EQ (TBL, make_number (0)))
2783 /* If make_number is a function, avoid it. */
2784 #define RE_TRANSLATE_P(TBL) (!(INTEGERP (TBL) && XINT (TBL) == 0))
2788 /* Avoid link-time collision with system mktime if we will use our own. */
2789 #if ! HAVE_MKTIME || BROKEN_MKTIME
2790 #define mktime emacs_mktime
2793 #define my_strftime nstrftime /* for strftime.c */
2795 /* The rest of the code currently tests the CPP symbol BSTRING.
2796 Override any claims made by the system-description files.
2797 Note that on some SCO version it is possible to have bcopy and not bcmp. */
2799 #if defined (HAVE_BCOPY) && defined (HAVE_BCMP)
2803 /* Some of the files of Emacs which are intended for use with other
2804 programs assume that if you have a config.h file, you must declare
2807 This declaration shouldn't appear when alloca.s or Makefile.in
2808 includes config.h. */
2810 extern char *getenv ();
2813 /* These default definitions are good for almost all machines.
2814 The exceptions override them in m/MACHINE.h. */
2816 #ifndef BITS_PER_CHAR
2817 #define BITS_PER_CHAR 8
2820 #ifndef BITS_PER_SHORT
2821 #define BITS_PER_SHORT 16
2824 /* Note that lisp.h uses this in a preprocessor conditional, so it
2825 would not work to use sizeof. That being so, we do all of them
2826 without sizeof, for uniformity's sake. */
2827 #ifndef BITS_PER_INT
2828 #define BITS_PER_INT 32
2831 #ifndef BITS_PER_LONG
2833 #define BITS_PER_LONG 64
2835 #define BITS_PER_LONG 32
2839 /* Define if the compiler supports function prototypes. It may do so
2840 but not define __STDC__ (e.g. DEC C by default) or may define it as
2845 # if defined PROTOTYPES
2846 # define __P(args) args
2848 # define __P(args) ()
2852 /* Don't include "string.h" or <stdlib.h> in non-C code. */
2854 #ifdef HAVE_STRING_H
2857 #ifdef HAVE_STRINGS_H
2858 #include "strings.h" /* May be needed for bcopy & al. */
2860 #ifdef HAVE_STDLIB_H
2864 # ifdef HAVE_ALLOCA_H
2865 # include <alloca.h>
2866 # else /* AIX files deal with #pragma. */
2867 # ifndef alloca /* predefined by HP cc +Olibcalls */
2870 # endif /* HAVE_ALLOCA_H */
2871 #endif /* __GNUC__ */
2873 typedef unsigned size_t;
2875 #endif /* NOT_C_CODE */
2877 /* Define HAVE_X_I18N if we have usable i18n support. */
2881 #elif !defined X11R5_INHIBIT_I18N
2885 /* Define HAVE_X11R6_XIM if we have usable X11R6-style XIM support. */
2887 #if defined HAVE_X11R6 && !defined INHIBIT_X11R6_XIM
2888 #define HAVE_X11R6_XIM
2891 /* Should we enable expensive run-time checking of data types? */
2892 #undef ENABLE_CHECKING
2894 #if defined __GNUC__ && (__GNUC__ > 2 \
2895 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
2896 #define NO_RETURN __attribute__ ((__noreturn__))
2898 #define NO_RETURN /* nothing */
2901 /* These won't be used automatically yet. We also need to know, at least,
2902 that the stack is continuous. */
2904 # ifndef GC_SETJMP_WORKS
2905 /* GC_SETJMP_WORKS is nearly always appropriate for GCC --
2906 see NON_SAVING_SETJMP in the target descriptions. */
2907 /* Exceptions (see NON_SAVING_SETJMP in target description) are
2908 SCO5 non-ELF (but Emacs specifies ELF) and SVR3 on x86.
2909 Fixme: Deal with SVR3. */
2910 # define GC_SETJMP_WORKS 1
2912 # ifndef GC_LISP_OBJECT_ALIGNMENT
2913 # define GC_LISP_OBJECT_ALIGNMENT (__alignof__ (Lisp_Object))
2918 #define bcopy(a,b,s) memcpy (b,a,s)
2921 #define bzero(a,s) memset (a,0,s)
2927 #endif /* EMACS_CONFIG_H */
2936 #### Report on what we decided to do.
2937 #### Report GTK as a toolkit, even if it doesn't use Xt.
2938 #### It makes printing result more understandable as using GTK sets
2939 #### toolkit_scroll_bars to yes by default.
2940 if test "${HAVE_GTK}" = "yes"; then
2945 Configured for \`${canonical}'.
2947 Where should the build process find the source code? ${srcdir}
2948 What operating system and machine description files should Emacs use?
2949 \`${opsysfile}' and \`${machfile}'
2950 What compiler should emacs be built with? ${CC} ${CFLAGS}
2951 Should Emacs use the GNU version of malloc? ${GNU_MALLOC}${GNU_MALLOC_reason}
2952 Should Emacs use a relocating allocator for buffers? ${REL_ALLOC}
2953 Should Emacs use mmap(2) for buffer allocation? $use_mmap_for_buffers
2954 What window system should Emacs use? ${window_system}
2955 What toolkit should Emacs use? ${USE_X_TOOLKIT}"
2957 if test -n "${x_includes}"; then
2958 echo " Where do we find X Windows header files? ${x_includes}"
2960 echo " Where do we find X Windows header files? Standard dirs"
2962 if test -n "${x_libraries}"; then
2963 echo " Where do we find X Windows libraries? ${x_libraries}"
2965 echo " Where do we find X Windows libraries? Standard dirs"
2968 echo " Does Emacs use -lXaw3d? ${HAVE_XAW3D}"
2969 echo " Does Emacs use -lXpm? ${HAVE_XPM}"
2970 echo " Does Emacs use -ljpeg? ${HAVE_JPEG}"
2971 echo " Does Emacs use -ltiff? ${HAVE_TIFF}"
2972 echo " Does Emacs use a gif library? ${HAVE_GIF} $ac_gif_lib_name"
2973 echo " Does Emacs use -lpng? ${HAVE_PNG}"
2974 echo " Does Emacs use -lrsvg-2? ${HAVE_RSVG}"
2975 echo " Does Emacs use -lgpm? ${HAVE_GPM}"
2976 echo " Does Emacs use -ldbus? ${HAVE_DBUS}"
2977 echo " Does Emacs use X toolkit scroll bars? ${USE_TOOLKIT_SCROLL_BARS}"
2980 if test $USE_XASSERTS = yes; then
2981 echo " Compiling with asserts turned on."
2982 CPPFLAGS="$CPPFLAGS -DXASSERTS=1"
2986 if test "$USE_X_TOOLKIT" = GTK; then
2987 case "$canonical" in
2989 echo "There are known problems with Emacs and Gtk+ on cygwin, so you
2990 will probably get a crash on startup. If this happens, please use another
2991 toolkit for Emacs. See etc/PROBLEMS for more information."
2997 if test "$HAVE_CARBON" = "yes"; then
2999 echo "Warning: The Mac Carbon port is currently unsupported and has
3000 known problems. It is not recommended for use by non-developers.
3001 Read the emacs-devel archives for more information."
3005 if test "$HAVE_DBUS" = yes && test "${opsys}" != "gnu-linux"; then
3006 echo "D-Bus integration has been tested for GNU/Linux only."
3011 # Remove any trailing slashes in these variables.
3012 [test "${prefix}" != NONE &&
3013 prefix=`echo "${prefix}" | sed 's,\([^/]\)/*$,\1,'`
3014 test "${exec_prefix}" != NONE &&
3015 exec_prefix=`echo "${exec_prefix}" | sed 's,\([^/]\)/*$,\1,'`]
3017 ## Check if the C preprocessor will convert `..' to `. .'. If so, set
3018 ## CPP_NEED_TRADITIONAL to `yes' so that the code to generate Makefile
3019 ## from Makefile.c can correctly provide the arg `-traditional' to the
3022 AC_EGREP_CPP(yes..yes,
3024 CPP_NEED_TRADITIONAL=no,
3025 CPP_NEED_TRADITIONAL=yes)
3027 AC_OUTPUT(Makefile lib-src/Makefile.c:lib-src/Makefile.in oldXMenu/Makefile \
3028 doc/emacs/Makefile doc/misc/Makefile doc/lispintro/Makefile \
3029 doc/lispref/Makefile src/Makefile.c:src/Makefile.in \
3030 lwlib/Makefile lisp/Makefile leim/Makefile, [
3032 ### Make the necessary directories, if they don't exist.
3033 for dir in etc lisp ; do
3034 test -d ${dir} || mkdir ${dir}
3037 # Build src/Makefile from ${srcdir}/src/Makefile.c
3038 # and lib-src/Makefile from ${srcdir}/lib-src/Makefile.c
3039 # This must be done after src/config.h is built, since we rely on that file.
3041 # Now get this: Some word that is part of the ${srcdir} directory name
3042 # or the ${configuration} value might, just might, happen to be an
3043 # identifier like `sun4' or `i386' or something, and be predefined by
3044 # the C preprocessor to some helpful value like 1, or maybe the empty
3045 # string. Needless to say consequent macro substitutions are less
3046 # than conducive to the makefile finding the correct directory.
3047 [undefs="`echo $top_srcdir $configuration $canonical |
3048 sed -e 's/[^a-zA-Z0-9_]/ /g' -e 's/^/ /' -e 's/ *$//' \
3049 -e 's/ */ -U/g' -e 's/-U[0-9][^ ]*//g' \
3052 echo creating src/epaths.h
3053 ${MAKE-make} epaths-force
3055 # As of 2000-11-19, newest development versions of GNU cpp preprocess
3056 # `..' to `. .' unless invoked with -traditional
3058 if test "x$GCC" = xyes && test "x$CPP_NEED_TRADITIONAL" = xyes; then
3059 CPPFLAGS="$CPPFLAGS -traditional"
3062 echo creating lib-src/Makefile
3064 rm -f junk.c junk1.c junk2.c
3065 sed -e '/start of cpp stuff/q' \
3066 < Makefile.c > junk1.c
3067 sed -e '1,/start of cpp stuff/d'\
3068 -e 's,/\*\*/#\(.*\)$,/* \1 */,' \
3069 < Makefile.c > junk.c
3070 $CPP $undefs -I. -I$srcdir/src $CPPFLAGS junk.c | \
3071 sed -e 's/^ / /' -e '/^#/d' -e '/^[
\f]*$/d' > junk2.c
3072 cat junk1.c junk2.c > Makefile.new
3073 rm -f junk.c junk1.c junk2.c
3074 chmod 444 Makefile.new
3075 mv -f Makefile.new Makefile
3078 echo creating src/Makefile
3080 rm -f junk.c junk1.c junk2.c
3081 sed -e '/start of cpp stuff/q' \
3082 < Makefile.c > junk1.c
3083 sed -e '1,/start of cpp stuff/d'\
3084 -e 's,/\*\*/#\(.*\)$,/* \1 */,' \
3085 < Makefile.c > junk.c
3086 $CPP $undefs -I. -I$srcdir/src $CPPFLAGS junk.c | \
3087 sed -e 's/^ / /' -e '/^#/d' -e '/^[
\f]*$/d' > junk2.c
3088 cat junk1.c junk2.c > Makefile.new
3089 rm -f junk.c junk1.c junk2.c
3090 chmod 444 Makefile.new
3091 mv -f Makefile.new Makefile
3094 if test ! -f src/.gdbinit && test -f $srcdir/src/.gdbinit; then
3095 echo creating src/.gdbinit
3096 echo source $srcdir/src/.gdbinit > src/.gdbinit
3099 # This is how we know whether to re-run configure in certain cases.
3100 touch src/config.stamp
3102 ], [GCC="$GCC" NON_GNU_CPP="$NON_GNU_CPP" CPP="$CPP" CPP_NEED_TRADITIONAL="$CPP_NEED_TRADITIONAL" CPPFLAGS="$CPPFLAGS"])
3104 m4_if(dnl Do not change this comment
3105 arch-tag: 156a4dd5-bddc-4d18-96ac-f37742cf6a5e