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