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