]> code.delx.au - gnu-emacs/blob - configure.in
upstream
[gnu-emacs] / configure.in
1 dnl Autoconf script for GNU Emacs
2 dnl To rebuild the `configure' script from this, execute the command
3 dnl autoconf
4 dnl in the directory containing this script.
5 dnl If you changed any AC_DEFINES, also run autoheader.
6 dnl
7 dnl Copyright (C) 1994-1996, 1999-2012 Free Software Foundation, Inc.
8 dnl
9 dnl This file is part of GNU Emacs.
10 dnl
11 dnl GNU Emacs is free software: you can redistribute it and/or modify
12 dnl it under the terms of the GNU General Public License as published by
13 dnl the Free Software Foundation, either version 3 of the License, or
14 dnl (at your option) any later version.
15 dnl
16 dnl GNU Emacs is distributed in the hope that it will be useful,
17 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
18 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 dnl GNU General Public License for more details.
20 dnl
21 dnl You should have received a copy of the GNU General Public License
22 dnl along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
23
24 AC_PREREQ(2.65)
25 AC_INIT(emacs, 24.1.50)
26 AC_CONFIG_HEADER(src/config.h:src/config.in)
27 AC_CONFIG_SRCDIR(src/lisp.h)
28 AC_CONFIG_AUX_DIR(build-aux)
29 AM_INIT_AUTOMAKE
30
31 dnl Support for --program-prefix, --program-suffix and
32 dnl --program-transform-name options
33 AC_ARG_PROGRAM
34
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 leimdir='${datadir}/emacs/${version}/leim'
41 locallisppath='${datadir}/emacs/${version}/site-lisp:'\
42 '${datadir}/emacs/site-lisp'
43 lisppath='${locallisppath}:${lispdir}:${datadir}/emacs/${version}/leim'
44 etcdir='${datadir}/emacs/${version}/etc'
45 archlibdir='${libexecdir}/emacs/${version}/${configuration}'
46 docdir='${datadir}/emacs/${version}/etc'
47 gamedir='${localstatedir}/games/emacs'
48
49 dnl OPTION_DEFAULT_OFF(NAME, HELP-STRING)
50 dnl Create a new --with option that defaults to being disabled.
51 dnl NAME is the base name of the option. The shell variable with_NAME
52 dnl will be set to either the user's value (if the option is
53 dnl specified; 'yes' for a plain --with-NAME) or to 'no' (if the
54 dnl option is not specified). Note that the shell variable name is
55 dnl constructed as autoconf does, by replacing non-alphanumeric
56 dnl characters with "_".
57 dnl HELP-STRING is the help text for the option.
58 AC_DEFUN([OPTION_DEFAULT_OFF], [dnl
59 AC_ARG_WITH([$1],[AS_HELP_STRING([--with-$1],[$2])],[],[dnl
60 m4_bpatsubst([with_$1], [[^0-9a-z]], [_])=no])dnl
61 ])dnl
62
63 dnl OPTION_DEFAULT_ON(NAME, HELP-STRING)
64 dnl Create a new --with option that defaults to being enabled. NAME
65 dnl is the base name of the option. The shell variable with_NAME
66 dnl will be set either to 'no' (for a plain --without-NAME) or to
67 dnl 'yes' (if the option is not specified). Note that the shell
68 dnl variable name is constructed as autoconf does, by replacing
69 dnl non-alphanumeric characters with "_".
70 dnl HELP-STRING is the help text for the option.
71 AC_DEFUN([OPTION_DEFAULT_ON], [dnl
72 AC_ARG_WITH([$1],[AS_HELP_STRING([--without-$1],[$2])],[],[dnl
73 m4_bpatsubst([with_$1], [[^0-9a-z]], [_])=yes])dnl
74 ])dnl
75
76 OPTION_DEFAULT_ON([pop],[don't support POP mail retrieval with movemail])
77 if test "$with_pop" = yes; then
78 AC_DEFINE(MAIL_USE_POP)
79 fi
80 AH_TEMPLATE(MAIL_USE_POP, [Define to support POP mail retrieval.])dnl
81
82 OPTION_DEFAULT_OFF([kerberos],[support Kerberos-authenticated POP])
83 if test "$with_kerberos" != no; then
84 AC_DEFINE(KERBEROS)
85 fi
86 AH_TEMPLATE(KERBEROS,
87 [Define to support Kerberos-authenticated POP mail retrieval.])dnl
88
89 OPTION_DEFAULT_OFF([kerberos5],[support Kerberos version 5 authenticated POP])
90 if test "${with_kerberos5}" != no; then
91 if test "${with_kerberos}" = no; then
92 with_kerberos=yes
93 AC_DEFINE(KERBEROS)
94 fi
95 AC_DEFINE(KERBEROS5, 1, [Define to use Kerberos 5 instead of Kerberos 4.])
96 fi
97
98 OPTION_DEFAULT_OFF([hesiod],[support Hesiod to get the POP server host])
99 dnl FIXME hesiod support may not be present, so it seems like an error
100 dnl to define, or at least use, this unconditionally.
101 if test "$with_hesiod" != no; then
102 AC_DEFINE(HESIOD, 1, [Define to support using a Hesiod database to find the POP server.])
103 fi
104
105 OPTION_DEFAULT_OFF([mmdf],[support MMDF mailboxes])
106 if test "$with_mmdf" != no; then
107 AC_DEFINE(MAIL_USE_MMDF, 1, [Define to support MMDF mailboxes in movemail.])
108 fi
109
110 OPTION_DEFAULT_OFF([mail-unlink],[unlink, rather than empty, mail spool after reading])
111 if test "$with_mail_unlink" != no; then
112 AC_DEFINE(MAIL_UNLINK_SPOOL, 1, [Define to unlink, rather than empty, mail spool after reading.])
113 fi
114
115 AC_ARG_WITH([mailhost],[AS_HELP_STRING([--with-mailhost=HOSTNAME],
116 [string giving default POP mail host])],
117 AC_DEFINE_UNQUOTED(MAILHOST, ["$withval"], [String giving fallback POP mail host.]))
118
119 OPTION_DEFAULT_ON([sound],[don't compile with sound support])
120
121 OPTION_DEFAULT_ON([sync-input],[process async input synchronously])
122 if test "$with_sync_input" = yes; then
123 AC_DEFINE(SYNC_INPUT, 1, [Process async input synchronously.])
124 fi
125
126 dnl FIXME currently it is not the last.
127 dnl This should be the last --with option, because --with-x is
128 dnl added later on when we find the path of X, and it's best to
129 dnl keep them together visually.
130 AC_ARG_WITH([x-toolkit],[AS_HELP_STRING([--with-x-toolkit=KIT],
131 [use an X toolkit (KIT one of: yes or gtk, gtk3, lucid or athena, motif, no)])],
132 [ case "${withval}" in
133 y | ye | yes ) val=gtk ;;
134 n | no ) val=no ;;
135 l | lu | luc | luci | lucid ) val=lucid ;;
136 a | at | ath | athe | athen | athena ) val=athena ;;
137 m | mo | mot | moti | motif ) val=motif ;;
138 g | gt | gtk ) val=gtk ;;
139 gtk3 ) val=gtk3 ;;
140 * )
141 AC_MSG_ERROR([`--with-x-toolkit=$withval' is invalid;
142 this option's value should be `yes', `no', `lucid', `athena', `motif', `gtk' or
143 `gtk3'. `yes' and `gtk' are synonyms. `athena' and `lucid' are synonyms.])
144 ;;
145 esac
146 with_x_toolkit=$val
147 ])
148
149 OPTION_DEFAULT_OFF([wide-int], [prefer wide Emacs integers (typically 62-bit)])
150 if test "$with_wide_int" = yes; then
151 AC_DEFINE([WIDE_EMACS_INT], 1, [Use long long for EMACS_INT if available.])
152 fi
153
154 dnl _ON results in a '--without' option in the --help output, so
155 dnl the help text should refer to "don't compile", etc.
156 OPTION_DEFAULT_ON([xpm],[don't compile with XPM image support])
157 OPTION_DEFAULT_ON([jpeg],[don't compile with JPEG image support])
158 OPTION_DEFAULT_ON([tiff],[don't compile with TIFF image support])
159 OPTION_DEFAULT_ON([gif],[don't compile with GIF image support])
160 OPTION_DEFAULT_ON([png],[don't compile with PNG image support])
161 OPTION_DEFAULT_ON([rsvg],[don't compile with SVG image support])
162 OPTION_DEFAULT_ON([xml2],[don't compile with XML parsing support])
163 OPTION_DEFAULT_ON([imagemagick],[don't compile with ImageMagick image support])
164
165 OPTION_DEFAULT_ON([xft],[don't use XFT for anti aliased fonts])
166 OPTION_DEFAULT_ON([libotf],[don't use libotf for OpenType font support])
167 OPTION_DEFAULT_ON([m17n-flt],[don't use m17n-flt for text shaping])
168
169 OPTION_DEFAULT_ON([toolkit-scroll-bars],[don't use Motif or Xaw3d scroll bars])
170 OPTION_DEFAULT_ON([xaw3d],[don't use Xaw3d])
171 OPTION_DEFAULT_ON([xim],[don't use X11 XIM])
172 OPTION_DEFAULT_OFF([ns],[use NeXTstep (Cocoa or GNUstep) windowing system])
173
174 OPTION_DEFAULT_ON([gpm],[don't use -lgpm for mouse support on a GNU/Linux console])
175 OPTION_DEFAULT_ON([dbus],[don't compile with D-Bus support])
176 OPTION_DEFAULT_ON([gconf],[don't compile with GConf support])
177 OPTION_DEFAULT_ON([gsettings],[don't compile with GSettings support])
178 OPTION_DEFAULT_ON([selinux],[don't compile with SELinux support])
179 OPTION_DEFAULT_ON([gnutls],[don't use -lgnutls for SSL/TLS support])
180
181 OPTION_DEFAULT_OFF([xwidgets],[enable use of some gtk widgets it Emacs buffers])
182
183 ## For the times when you want to build Emacs but don't have
184 ## a suitable makeinfo, and can live without the manuals.
185 dnl http://lists.gnu.org/archive/html/emacs-devel/2008-04/msg01844.html
186 OPTION_DEFAULT_ON([makeinfo],[don't require makeinfo for building manuals])
187
188 ## Makefile.in needs the cache file name.
189 AC_SUBST(cache_file)
190
191 ## This is an option because I do not know if all info/man support
192 ## compressed files, nor how to test if they do so.
193 OPTION_DEFAULT_ON([compress-info],[don't compress the installed Info pages])
194 if test $with_compress_info = yes; then
195 GZIP_INFO=yes
196 else
197 GZIP_INFO=
198 fi
199 AC_SUBST(GZIP_INFO)
200
201 AC_ARG_WITH([pkg-config-prog],dnl
202 [AS_HELP_STRING([--with-pkg-config-prog=PATH],
203 [path to pkg-config for finding GTK and librsvg])])
204 if test "X${with_pkg_config_prog}" != X; then
205 if test "${with_pkg_config_prog}" != yes; then
206 PKG_CONFIG="${with_pkg_config_prog}"
207 fi
208 fi
209
210 CRT_DIR=
211 AC_ARG_WITH([crt-dir],dnl
212 [AS_HELP_STRING([--with-crt-dir=DIR],[directory containing crtn.o etc.
213 The default is /usr/lib, or /usr/lib64 on some platforms.])])
214 CRT_DIR="${with_crt_dir}"
215
216 AC_ARG_WITH(gameuser,dnl
217 [AS_HELP_STRING([--with-gameuser=USER],[user for shared game score files])])
218 test "X${with_gameuser}" != X && test "${with_gameuser}" != yes \
219 && gameuser="${with_gameuser}"
220 test "X$gameuser" = X && gameuser=games
221
222 AC_ARG_WITH([gnustep-conf],dnl
223 [AS_HELP_STRING([--with-gnustep-conf=PATH],[path to GNUstep.conf; default $GNUSTEP_CONFIG_FILE, or /etc/GNUstep/GNUstep.conf])])
224 test "X${with_gnustep_conf}" != X && test "${with_gnustep_conf}" != yes && \
225 GNUSTEP_CONFIG_FILE="${with_gnustep_conf}"
226 test "X$GNUSTEP_CONFIG_FILE" = "X" && \
227 GNUSTEP_CONFIG_FILE=/etc/GNUstep/GNUstep.conf
228
229 AC_ARG_ENABLE(ns-self-contained,
230 [AS_HELP_STRING([--disable-ns-self-contained],
231 [disable self contained build under NeXTstep])],
232 EN_NS_SELF_CONTAINED=$enableval,
233 EN_NS_SELF_CONTAINED=yes)
234
235 AC_ARG_ENABLE(asserts,
236 [AS_HELP_STRING([--enable-asserts], [compile code with asserts enabled])],
237 USE_XASSERTS=$enableval,
238 USE_XASSERTS=no)
239
240 AC_ARG_ENABLE(maintainer-mode,
241 [AS_HELP_STRING([--disable-maintainer-mode],
242 [disable make rules and dependencies not useful (and sometimes
243 confusing) to the casual installer])],
244 USE_MAINTAINER_MODE=$enableval,
245 USE_MAINTAINER_MODE=yes)
246 if test $USE_MAINTAINER_MODE = yes; then
247 MAINT=
248 else
249 MAINT=#
250 fi
251 AC_SUBST(MAINT)
252
253 AC_ARG_ENABLE(locallisppath,
254 [AS_HELP_STRING([--enable-locallisppath=PATH],
255 [directories Emacs should search for lisp files specific
256 to this site])],
257 if test "${enableval}" = "no"; then
258 locallisppath=
259 elif test "${enableval}" != "yes"; then
260 locallisppath=${enableval}
261 fi)
262
263 AC_ARG_ENABLE(checking,
264 [AS_HELP_STRING([--enable-checking@<:@=LIST@:>@],
265 [enable expensive run-time checks. With LIST,
266 enable only specific categories of checks.
267 Categories are: all,yes,no.
268 Flags are: stringbytes, stringoverrun, stringfreelist,
269 xmallocoverrun, conslist])],
270 [ac_checking_flags="${enableval}"],[])
271 IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="$IFS,"
272 for check in $ac_checking_flags
273 do
274 case $check in
275 # these set all the flags to specific states
276 yes) ac_enable_checking=1 ;;
277 no) ac_enable_checking= ;
278 ac_gc_check_stringbytes= ;
279 ac_gc_check_string_overrun= ;
280 ac_gc_check_string_free_list= ;
281 ac_xmalloc_overrun= ;
282 ac_gc_check_cons_list= ;;
283 all) ac_enable_checking=1 ;
284 ac_gc_check_stringbytes=1 ;
285 ac_gc_check_string_overrun=1 ;
286 ac_gc_check_string_free_list=1 ;
287 ac_xmalloc_overrun=1 ;
288 ac_gc_check_cons_list=1 ;;
289 # these enable particular checks
290 stringbytes) ac_gc_check_stringbytes=1 ;;
291 stringoverrun) ac_gc_check_string_overrun=1 ;;
292 stringfreelist) ac_gc_check_string_free_list=1 ;;
293 xmallocoverrun) ac_xmalloc_overrun=1 ;;
294 conslist) ac_gc_check_cons_list=1 ;;
295 *) AC_MSG_ERROR(unknown check category $check) ;;
296 esac
297 done
298 IFS="$ac_save_IFS"
299
300 if test x$ac_enable_checking != x ; then
301 AC_DEFINE(ENABLE_CHECKING, 1,
302 [Enable expensive run-time checking of data types?])
303 fi
304 if test x$ac_gc_check_stringbytes != x ; then
305 AC_DEFINE(GC_CHECK_STRING_BYTES, 1,
306 [Define this temporarily to hunt a bug. If defined, the size of
307 strings is redundantly recorded in sdata structures so that it can
308 be compared to the sizes recorded in Lisp strings.])
309 fi
310 if test x$ac_gc_check_string_overrun != x ; then
311 AC_DEFINE(GC_CHECK_STRING_OVERRUN, 1,
312 [Define this to check for short string overrun.])
313 fi
314 if test x$ac_gc_check_string_free_list != x ; then
315 AC_DEFINE(GC_CHECK_STRING_FREE_LIST, 1,
316 [Define this to check the string free list.])
317 fi
318 if test x$ac_xmalloc_overrun != x ; then
319 AC_DEFINE(XMALLOC_OVERRUN_CHECK, 1,
320 [Define this to check for malloc buffer overrun.])
321 fi
322 if test x$ac_gc_check_cons_list != x ; then
323 AC_DEFINE(GC_CHECK_CONS_LIST, 1,
324 [Define this to check for errors in cons list.])
325 fi
326
327 AC_ARG_ENABLE(use-lisp-union-type,
328 [AS_HELP_STRING([--enable-use-lisp-union-type],
329 [use a union for the Lisp_Object data type.
330 This is only useful for development for catching certain types of bugs.])],
331 if test "${enableval}" != "no"; then
332 AC_DEFINE(USE_LISP_UNION_TYPE, 1,
333 [Define this to use a lisp union for the Lisp_Object data type.])
334 fi)
335
336
337 AC_ARG_ENABLE(profiling,
338 [AS_HELP_STRING([--enable-profiling],
339 [build emacs with profiling support.
340 This might not work on all platforms])],
341 [ac_enable_profiling="${enableval}"],[])
342 if test x$ac_enable_profiling != x ; then
343 PROFILING_CFLAGS="-DPROFILING=1 -pg"
344 else
345 PROFILING_CFLAGS=
346 fi
347 AC_SUBST(PROFILING_CFLAGS)
348
349 AC_ARG_ENABLE(autodepend,
350 [AS_HELP_STRING([--enable-autodepend],
351 [automatically generate dependencies to .h-files.
352 Requires GNU Make and Gcc. Enabled if GNU Make and Gcc is
353 found])],
354 [ac_enable_autodepend="${enableval}"],[ac_enable_autodepend=yes])
355
356 #### Make srcdir absolute, if it isn't already. It's important to
357 #### avoid running the path through pwd unnecessarily, since pwd can
358 #### give you automounter prefixes, which can go away. We do all this
359 #### so Emacs can find its files when run uninstalled.
360 ## Make sure CDPATH doesn't affect cd (in case PWD is relative).
361 unset CDPATH
362 case "${srcdir}" in
363 /* ) ;;
364 . )
365 ## We may be able to use the $PWD environment variable to make this
366 ## absolute. But sometimes PWD is inaccurate.
367 ## Note: we used to use ${PWD} at the end instead of `pwd`,
368 ## but that tested only for a well-formed and valid PWD,
369 ## it did not object when PWD was well-formed and valid but just wrong.
370 if test ".${PWD}" != "." && test ".`(cd ${PWD} ; sh -c pwd)`" = ".`pwd`" ;
371 then
372 srcdir="$PWD"
373 else
374 srcdir="`(cd ${srcdir}; pwd)`"
375 fi
376 ;;
377 * ) srcdir="`(cd ${srcdir}; pwd)`" ;;
378 esac
379
380 #### Given the configuration name, set machfile and opsysfile to the
381 #### names of the m/*.h and s/*.h files we should use.
382
383 ### Canonicalize the configuration name.
384
385 AC_CANONICAL_HOST
386 canonical=$host
387 configuration=${host_alias-${build_alias-$host}}
388
389 dnl This used to use changequote, but, apart from `changequote is evil'
390 dnl per the autoconf manual, we can speed up autoconf somewhat by quoting
391 dnl the great gob of text. Thus it's not processed for possible expansion.
392 dnl Just make sure the brackets remain balanced.
393 dnl
394 dnl Since Emacs can't find matching pairs of quotes, boundaries are
395 dnl indicated by comments.
396 dnl quotation begins
397 [
398
399 ### If you add support for a new configuration, add code to this
400 ### switch statement to recognize your configuration name and select
401 ### the appropriate operating system and machine description files.
402
403 ### You would hope that you could choose an m/*.h file pretty much
404 ### based on the machine portion of the configuration name, and an s/*.h
405 ### file based on the operating system portion. However, it turns out
406 ### that each m/*.h file is pretty manufacturer-specific - for
407 ### example mips.h is MIPS
408 ### So we basically have to have a special case for each
409 ### configuration name.
410 ###
411 ### As far as handling version numbers on operating systems is
412 ### concerned, make sure things will fail in a fixable way. If
413 ### /etc/MACHINES doesn't say anything about version numbers, be
414 ### prepared to handle anything reasonably. If version numbers
415 ### matter, be sure /etc/MACHINES says something about it.
416
417 machine='' opsys='' unported=no
418 case "${canonical}" in
419
420 ## GNU/Linux and similar ports
421 *-*-linux* )
422 opsys=gnu-linux
423 case ${canonical} in
424 alpha*) machine=alpha ;;
425 s390x-*) machine=ibms390x ;;
426 powerpc*) machine=macppc ;;
427 sparc*) machine=sparc ;;
428 ia64*) machine=ia64 ;;
429 m68k*) machine=m68k ;;
430 x86_64*) machine=amdx86-64 ;;
431 esac
432 ;;
433
434 ## FreeBSD ports
435 *-*-freebsd* )
436 opsys=freebsd
437 case "${canonical}" in
438 alpha*) machine=alpha ;;
439 amd64-*|x86_64-*) machine=amdx86-64 ;;
440 ia64-*) machine=ia64 ;;
441 i[3456]86-*) machine=intel386 ;;
442 powerpc-*) machine=macppc ;;
443 sparc-*) machine=sparc ;;
444 sparc64-*) machine=sparc ;;
445 esac
446 ;;
447
448 ## FreeBSD kernel + glibc based userland
449 *-*-kfreebsd*gnu* )
450 opsys=gnu-kfreebsd
451 case "${canonical}" in
452 alpha*) machine=alpha ;;
453 amd64-*|x86_64-*) machine=amdx86-64 ;;
454 ia64-*) machine=ia64 ;;
455 i[3456]86-*) machine=intel386 ;;
456 powerpc-*) machine=macppc ;;
457 sparc-*) machine=sparc ;;
458 sparc64-*) machine=sparc ;;
459 esac
460 ;;
461
462 ## NetBSD ports
463 *-*-netbsd* )
464 opsys=netbsd
465 case "${canonical}" in
466 alpha*) machine=alpha ;;
467 x86_64-*) machine=amdx86-64 ;;
468 i[3456]86-*) machine=intel386 ;;
469 m68k-*) machine=m68k ;;
470 powerpc-*) machine=macppc ;;
471 sparc*-) machine=sparc ;;
472 esac
473 ;;
474
475 ## OpenBSD ports
476 *-*-openbsd* )
477 opsys=openbsd
478 case "${canonical}" in
479 alpha*) machine=alpha ;;
480 x86_64-*) machine=amdx86-64 ;;
481 i386-*) machine=intel386 ;;
482 powerpc-*) machine=macppc ;;
483 sparc*) machine=sparc ;;
484 esac
485 ;;
486
487 ## Apple Darwin / Mac OS X
488 *-apple-darwin* )
489 case "${canonical}" in
490 i[3456]86-* ) machine=intel386 ;;
491 powerpc-* ) machine=macppc ;;
492 x86_64-* ) machine=amdx86-64 ;;
493 * ) unported=yes ;;
494 esac
495 opsys=darwin
496 ## Use fink packages if available.
497 ## FIXME find a better way to do this: http://debbugs.gnu.org/11507
498 ## if test -d /sw/include && test -d /sw/lib; then
499 ## GCC_TEST_OPTIONS="-I/sw/include -L/sw/lib"
500 ## NON_GCC_TEST_OPTIONS=${GCC_TEST_OPTIONS}
501 ## fi
502 ;;
503
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 ;;
512
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 ;;
526
527 ## Silicon Graphics machines
528 ## Iris 4D
529 mips-sgi-irix6.5 )
530 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_GCC_TEST_OPTIONS="-D_LANGUAGE_C"
535 ;;
536
537 ## Suns
538 *-sun-solaris* \
539 | i[3456]86-*-solaris2* | i[3456]86-*-sunos5* \
540 | x86_64-*-solaris2* | x86_64-*-sunos5*)
541 case "${canonical}" in
542 i[3456]86-*-* ) machine=intel386 ;;
543 amd64-*-*|x86_64-*-*) machine=amdx86-64 ;;
544 sparc* ) machine=sparc ;;
545 * ) unported=yes ;;
546 esac
547 case "${canonical}" in
548 *-sunos5.6* | *-solaris2.6* )
549 opsys=sol2-6
550 RANLIB="ar -ts"
551 ;;
552 *-sunos5.[7-9]* | *-solaris2.[7-9]* )
553 opsys=sol2-6
554 emacs_check_sunpro_c=yes
555 ;;
556 *-sunos5* | *-solaris* )
557 opsys=sol2-10
558 emacs_check_sunpro_c=yes
559 ;;
560 esac
561 ## Watch out for a compiler that we know will not work.
562 case "${canonical}" in
563 *-solaris* | *-sunos5* )
564 if [ "x$CC" = x/usr/ucb/cc ]; then
565 ## /usr/ucb/cc doesn't work;
566 ## we should find some other compiler that does work.
567 unset CC
568 fi
569 ;;
570 *) ;;
571 esac
572 ;;
573
574 ## Intel 386 machines where we don't care about the manufacturer.
575 i[3456]86-*-* )
576 machine=intel386
577 case "${canonical}" in
578 *-cygwin ) opsys=cygwin ;;
579 *-darwin* ) opsys=darwin ;;
580 *-sysv4.2uw* ) opsys=unixware ;;
581 *-sysv5uw* ) opsys=unixware ;;
582 *-sysv5OpenUNIX* ) opsys=unixware ;;
583 ## Otherwise, we'll fall through to the generic opsys code at the bottom.
584 esac
585 ;;
586
587 * )
588 unported=yes
589 ;;
590 esac
591
592 ### If the code above didn't choose an operating system, just choose
593 ### an operating system based on the configuration name. You really
594 ### only want to use this when you have no idea what the right
595 ### operating system is; if you know what operating systems a machine
596 ### runs, it's cleaner to make it explicit in the case statement
597 ### above.
598 if test x"${opsys}" = x; then
599 case "${canonical}" in
600 *-gnu* ) opsys=gnu ;;
601 * )
602 unported=yes
603 ;;
604 esac
605 fi
606
607 ]
608 dnl quotation ends
609
610 if test $unported = yes; then
611 AC_MSG_ERROR([Emacs hasn't been ported to `${canonical}' systems.
612 Check `etc/MACHINES' for recognized configuration names.])
613 fi
614
615 if test -n "$machine"; then
616 machfile="m/${machine}.h"
617 else
618 machfile=
619 fi
620 opsysfile="s/${opsys}.h"
621
622
623 #### Choose a compiler.
624
625 dnl Sets GCC=yes if using gcc.
626 AC_PROG_CC
627 AM_PROG_CC_C_O
628
629 if test x$GCC = xyes; then
630 test "x$GCC_TEST_OPTIONS" != x && CC="$CC $GCC_TEST_OPTIONS"
631 else
632 test "x$NON_GCC_TEST_OPTIONS" != x && CC="$CC $NON_GCC_TEST_OPTIONS"
633 fi
634
635 # Initialize gnulib right after choosing the compiler.
636 gl_EARLY
637
638 AC_ARG_ENABLE([gcc-warnings],
639 [AS_HELP_STRING([--enable-gcc-warnings],
640 [turn on lots of GCC warnings (for developers)])],
641 [case $enableval in
642 yes|no) ;;
643 *) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
644 esac
645 gl_gcc_warnings=$enableval],
646 [gl_gcc_warnings=no]
647 )
648
649 # gl_GCC_VERSION_IFELSE([major], [minor], [run-if-found], [run-if-not-found])
650 # ------------------------------------------------
651 # If $CPP is gcc-MAJOR.MINOR or newer, then run RUN-IF-FOUND.
652 # Otherwise, run RUN-IF-NOT-FOUND.
653 AC_DEFUN([gl_GCC_VERSION_IFELSE],
654 [AC_PREPROC_IFELSE(
655 [AC_LANG_PROGRAM(
656 [[
657 #if ($1) < __GNUC__ || (($1) == __GNUC__ && ($2) <= __GNUC_MINOR__)
658 /* ok */
659 #else
660 # error "your version of gcc is older than $1.$2"
661 #endif
662 ]]),
663 ], [$3], [$4])
664 ]
665 )
666
667 # When compiling with GCC, prefer -isystem to -I when including system
668 # include files, to avoid generating useless diagnostics for the files.
669 if test "$gl_gcc_warnings" != yes; then
670 isystem='-I'
671 else
672 isystem='-isystem '
673
674 # This, $nw, is the list of warnings we disable.
675 nw=
676
677 case $with_x_toolkit in
678 lucid | athena | motif)
679 # Old toolkits mishandle 'const'.
680 nw="$nw -Wwrite-strings"
681 ;;
682 *)
683 gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
684 ;;
685 esac
686 AC_SUBST([WERROR_CFLAGS])
687
688 nw="$nw -Waggregate-return" # anachronistic
689 nw="$nw -Wlong-long" # C90 is anachronistic
690 nw="$nw -Wc++-compat" # We don't care about C++ compilers
691 nw="$nw -Wundef" # Warns on '#if GNULIB_FOO' etc in gnulib
692 nw="$nw -Wtraditional" # Warns on #elif which we use often
693 nw="$nw -Wcast-qual" # Too many warnings for now
694 nw="$nw -Wconversion" # Too many warnings for now
695 nw="$nw -Wsystem-headers" # Don't let system headers trigger warnings
696 nw="$nw -Wsign-conversion" # Too many warnings for now
697 nw="$nw -Woverlength-strings" # Not a problem these days
698 nw="$nw -Wtraditional-conversion" # Too many warnings for now
699 nw="$nw -Wpadded" # Our structs are not padded
700 nw="$nw -Wredundant-decls" # We regularly (re)declare getenv etc.
701 nw="$nw -Wlogical-op" # any use of fwrite provokes this
702 nw="$nw -Wformat-nonliteral" # Emacs does this a lot
703 nw="$nw -Wvla" # warnings in gettext.h
704 nw="$nw -Wnested-externs" # use of XARGMATCH/verify_function__
705 nw="$nw -Wswitch-enum" # Too many warnings for now
706 nw="$nw -Wswitch-default" # Too many warnings for now
707 nw="$nw -Wfloat-equal" # e.g., ftoastr.c
708 nw="$nw -Winline" # e.g., dispnew.c's inlining of row_equal_p
709
710 # Emacs doesn't care about shadowing; see
711 # <http://lists.gnu.org/archive/html/emacs-diffs/2011-11/msg00265.html>.
712 nw="$nw -Wshadow"
713
714 # The following lines should be removable at some point.
715 nw="$nw -Wstack-protector"
716 nw="$nw -Wstrict-overflow"
717 nw="$nw -Wsuggest-attribute=const"
718 nw="$nw -Wsuggest-attribute=pure"
719
720 gl_MANYWARN_ALL_GCC([ws])
721 gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
722 for w in $ws; do
723 gl_WARN_ADD([$w])
724 done
725 gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one
726 gl_WARN_ADD([-Wno-sign-compare]) # Too many warnings for now
727 gl_WARN_ADD([-Wno-type-limits]) # Too many warnings for now
728 gl_WARN_ADD([-Wno-switch]) # Too many warnings for now
729 gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
730 gl_WARN_ADD([-Wno-format-nonliteral])
731
732 # In spite of excluding -Wlogical-op above, it is enabled, as of
733 # gcc 4.5.0 20090517.
734 gl_WARN_ADD([-Wno-logical-op])
735
736 gl_WARN_ADD([-fdiagnostics-show-option])
737 gl_WARN_ADD([-funit-at-a-time])
738
739 AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.])
740 AC_DEFINE([_FORTIFY_SOURCE], [2],
741 [enable compile-time and run-time bounds-checking, and some warnings])
742 AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
743
744 # We use a slightly smaller set of warning options for lib/.
745 # Remove the following and save the result in GNULIB_WARN_CFLAGS.
746 nw=
747 nw="$nw -Wunused-macros"
748
749 gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw])
750 AC_SUBST([GNULIB_WARN_CFLAGS])
751 fi
752
753
754
755 dnl Some other nice autoconf tests.
756 dnl These are commented out, since gl_EARLY and/or Autoconf already does them.
757 dnl AC_PROG_INSTALL
758 dnl AC_PROG_MKDIR_P
759 dnl if test "x$RANLIB" = x; then
760 dnl AC_PROG_RANLIB
761 dnl fi
762
763 ## Although we're running on an amd64 kernel, we're actually compiling for
764 ## the x86 architecture. The user should probably have provided an
765 ## explicit --build to `configure', but if everything else than the kernel
766 ## is running in i386 mode, we can help them out.
767 if test "$machine" = "amdx86-64"; then
768 AC_CHECK_DECL([i386])
769 if test "$ac_cv_have_decl_i386" = "yes"; then
770 canonical=`echo "$canonical" | sed -e 's/^amd64/i386/' -e 's/^x86_64/i386/'`
771 machine=intel386
772 machfile="m/${machine}.h"
773 fi
774 fi
775
776 AC_PATH_PROG(INSTALL_INFO, install-info)
777 AC_PATH_PROG(INSTALL_INFO, install-info,, /usr/sbin)
778 AC_PATH_PROG(INSTALL_INFO, install-info,:, /sbin)
779 dnl Don't use GZIP, which is used by gzip for additional parameters.
780 AC_PATH_PROG(GZIP_PROG, gzip)
781
782
783 ## Need makeinfo >= 4.7 (?) to build the manuals.
784 AC_PATH_PROG(MAKEINFO, makeinfo, no)
785 dnl By this stage, configure has already checked for egrep and set EGREP,
786 dnl or exited with an error if no egrep was found.
787 if test "$MAKEINFO" != "no" && \
788 test x"`$MAKEINFO --version 2> /dev/null | $EGREP 'texinfo[[^0-9]]*([[1-4]][[0-9]]+|[[5-9]]|4\.[[7-9]]|4\.[[1-6]][[0-9]]+)'`" = x; then
789 MAKEINFO=no
790 fi
791
792 ## Makeinfo is unusual. For a released Emacs, the manuals are
793 ## pre-built, and not deleted by the normal clean rules. makeinfo is
794 ## therefore in the category of "special tools" not normally required, which
795 ## configure does not have to check for (eg autoconf itself).
796 ## In a Bazaar checkout on the other hand, the manuals are not included.
797 ## So makeinfo is a requirement to build from Bazaar, and configure
798 ## should test for it as it does for any other build requirement.
799 ## We use the presence of $srcdir/info/emacs to distinguish a release,
800 ## with pre-built manuals, from a Bazaar checkout.
801 HAVE_MAKEINFO=yes
802
803 if test "$MAKEINFO" = "no"; then
804 MAKEINFO=makeinfo
805 if test "x${with_makeinfo}" = "xno"; then
806 HAVE_MAKEINFO=no
807 elif test ! -e $srcdir/info/emacs; then
808 AC_MSG_ERROR( [You do not seem to have makeinfo >= 4.7, and your
809 source tree does not seem to have pre-built manuals in the `info' directory.
810 Either install a suitable version of makeinfo, or re-run configure
811 with the `--without-makeinfo' option to build without the manuals.] )
812 fi
813 fi
814 AC_SUBST(HAVE_MAKEINFO)
815
816 dnl Just so that there is only a single place we need to edit.
817 INFO_EXT=.info
818 INFO_OPTS=--no-split
819 AC_SUBST(INFO_EXT)
820 AC_SUBST(INFO_OPTS)
821
822 dnl Add our options to ac_link now, after it is set up.
823
824 if test x$GCC = xyes; then
825 test "x$GCC_LINK_TEST_OPTIONS" != x && \
826 ac_link="$ac_link $GCC_LINK_TEST_OPTIONS"
827 else
828 test "x$NON_GCC_LINK_TEST_OPTIONS" != x && \
829 ac_link="$ac_link $NON_GCC_LINK_TEST_OPTIONS"
830 fi
831
832 dnl We need -znocombreloc if we're using a relatively recent GNU ld.
833 dnl If we can link with the flag, it shouldn't do any harm anyhow.
834 dnl (Don't use `-z nocombreloc' as -z takes no arg on Irix.)
835 dnl Treat GCC specially since it just gives a non-fatal `unrecognized option'
836 dnl if not built to support GNU ld.
837
838 late_LDFLAGS=$LDFLAGS
839 if test x$GCC = xyes; then
840 LDFLAGS="$LDFLAGS -Wl,-znocombreloc"
841 else
842 LDFLAGS="$LDFLAGS -znocombreloc"
843 fi
844
845 AC_MSG_CHECKING([for -znocombreloc])
846 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
847 [AC_MSG_RESULT(yes)],
848 LDFLAGS=$late_LDFLAGS
849 [AC_MSG_RESULT(no)])
850
851
852 dnl The function dump-emacs will not be defined and temacs will do
853 dnl (load "loadup") automatically unless told otherwise.
854 test "x$CANNOT_DUMP" = "x" && CANNOT_DUMP=no
855 case "$opsys" in
856 your-opsys-here) CANNOT_DUMP=yes ;;
857 esac
858
859 test "$CANNOT_DUMP" = "yes" && \
860 AC_DEFINE(CANNOT_DUMP, 1, [Define if Emacs cannot be dumped on your system.])
861
862 AC_SUBST(CANNOT_DUMP)
863
864
865 UNEXEC_OBJ=unexelf.o
866 case "$opsys" in
867 # MSDOS uses unexcoff.o
868 # MSWindows uses unexw32.o
869 aix4-2)
870 UNEXEC_OBJ=unexaix.o
871 ;;
872 cygwin)
873 UNEXEC_OBJ=unexcw.o
874 ;;
875 darwin)
876 UNEXEC_OBJ=unexmacosx.o
877 ;;
878 hpux10-20 | hpux11)
879 UNEXEC_OBJ=unexhp9k800.o
880 ;;
881 sol2-10)
882 # Use the Solaris dldump() function, called from unexsol.c, to dump
883 # emacs, instead of the generic ELF dump code found in unexelf.c.
884 # The resulting binary has a complete symbol table, and is better
885 # for debugging and other observability tools (debuggers, pstack, etc).
886 #
887 # If you encounter a problem using dldump(), please consider sending
888 # a message to the OpenSolaris tools-linking mailing list:
889 # http://mail.opensolaris.org/mailman/listinfo/tools-linking
890 #
891 # It is likely that dldump() works with older Solaris too, but this has
892 # not been tested, so for now this change is for Solaris 10 or newer.
893 UNEXEC_OBJ=unexsol.o
894 ;;
895 esac
896
897 LD_SWITCH_SYSTEM=
898 case "$opsys" in
899 freebsd)
900 ## Let `ld' find image libs and similar things in /usr/local/lib.
901 ## The system compiler, GCC, has apparently been modified to not
902 ## look there, contrary to what a stock GCC would do.
903 ### It's not our place to do this. See bug#10313#17.
904 ### LD_SWITCH_SYSTEM=-L/usr/local/lib
905 :
906 ;;
907
908 gnu-linux)
909 ## cpp test was "ifdef __mips__", but presumably this is equivalent...
910 case $host_cpu in mips*) LD_SWITCH_SYSTEM="-G 0";; esac
911 ;;
912
913 netbsd)
914 ### It's not our place to do this. See bug#10313#17.
915 ### LD_SWITCH_SYSTEM="-Wl,-rpath,/usr/pkg/lib -L/usr/pkg/lib -Wl,-rpath,/usr/local/lib -L/usr/local/lib"
916 :
917 ;;
918
919 openbsd)
920 ## Han Boetes <han@mijncomputer.nl> says this is necessary,
921 ## otherwise Emacs dumps core on elf systems.
922 LD_SWITCH_SYSTEM="-Z"
923 ;;
924 esac
925 AC_SUBST(LD_SWITCH_SYSTEM)
926
927 ac_link="$ac_link $LD_SWITCH_SYSTEM"
928
929 ## This setting of LD_SWITCH_SYSTEM references LD_SWITCH_X_SITE_RPATH,
930 ## which has not been defined yet. When this was handled with cpp,
931 ## it was expanded to null when configure sourced the s/*.h file.
932 ## Thus LD_SWITCH_SYSTEM had different values in configure and the Makefiles.
933 ## FIXME it would be cleaner to put this in LD_SWITCH_SYSTEM_TEMACS
934 ## (or somesuch), but because it is supposed to go at the _front_
935 ## of LD_SWITCH_SYSTEM, we cannot do that in exactly the same way.
936 ## Compare with the gnu-linux case below, which added to the end
937 ## of LD_SWITCH_SYSTEM, and so can instead go at the front of
938 ## LD_SWITCH_SYSTEM_TEMACS.
939 case "$opsys" in
940 netbsd|openbsd)
941 LD_SWITCH_SYSTEM="\$(LD_SWITCH_X_SITE_RPATH) $LD_SWITCH_SYSTEM" ;;
942 esac
943
944
945 C_SWITCH_MACHINE=
946 if test "$machine" = "alpha"; then
947 AC_CHECK_DECL([__ELF__])
948 if test "$ac_cv_have_decl___ELF__" = "yes"; then
949 ## With ELF, make sure that all common symbols get allocated to in the
950 ## data section. Otherwise, the dump of temacs may miss variables in
951 ## the shared library that have been initialized. For example, with
952 ## GNU libc, __malloc_initialized would normally be resolved to the
953 ## shared library's .bss section, which is fatal.
954 if test "x$GCC" = "xyes"; then
955 C_SWITCH_MACHINE="-fno-common"
956 else
957 AC_MSG_ERROR([What gives? Fix me if DEC Unix supports ELF now.])
958 fi
959 else
960 UNEXEC_OBJ=unexalpha.o
961 fi
962 fi
963 AC_SUBST(C_SWITCH_MACHINE)
964
965 AC_SUBST(UNEXEC_OBJ)
966
967 C_SWITCH_SYSTEM=
968 ## Some programs in src produce warnings saying certain subprograms
969 ## are too complex and need a MAXMEM value greater than 2000 for
970 ## additional optimization. --nils@exp-math.uni-essen.de
971 test "$opsys" = "aix4.2" && test "x$GCC" != "xyes" && \
972 C_SWITCH_SYSTEM="-ma -qmaxmem=4000"
973 ## gnu-linux might need -D_BSD_SOURCE on old libc5 systems.
974 ## It is redundant in glibc2, since we define _GNU_SOURCE.
975 AC_SUBST(C_SWITCH_SYSTEM)
976
977
978 LIBS_SYSTEM=
979 case "$opsys" in
980 ## IBM's X11R5 uses -lIM and -liconv in AIX 3.2.2.
981 aix4-2) LIBS_SYSTEM="-lrts -lIM -liconv" ;;
982
983 freebsd) LIBS_SYSTEM="-lutil" ;;
984
985 hpux*) LIBS_SYSTEM="-l:libdld.sl" ;;
986
987 sol2*) LIBS_SYSTEM="-lsocket -lnsl" ;;
988
989 ## Motif needs -lgen.
990 unixware) LIBS_SYSTEM="-lsocket -lnsl -lelf -lgen" ;;
991 esac
992 AC_SUBST(LIBS_SYSTEM)
993
994
995 ### Make sure subsequent tests use flags consistent with the build flags.
996
997 if test x"${OVERRIDE_CPPFLAGS}" != x; then
998 CPPFLAGS="${OVERRIDE_CPPFLAGS}"
999 else
1000 CPPFLAGS="$C_SWITCH_SYSTEM $C_SWITCH_MACHINE $CPPFLAGS"
1001 fi
1002
1003 # Suppress obsolescent Autoconf test for size_t; Emacs assumes C89 or better.
1004 AC_DEFUN([AC_TYPE_SIZE_T])
1005 # Likewise for obsolescent test for uid_t, gid_t; Emacs assumes them.
1006 AC_DEFUN([AC_TYPE_UID_T])
1007
1008 dnl Do this early because it can frob feature test macros for Unix-98 &c.
1009 AC_SYS_LARGEFILE
1010
1011
1012 LIB_MATH=-lm
1013 LIB_STANDARD=
1014 START_FILES=
1015
1016 dnl NB do not use CRT_DIR unquoted here, since it might not be set yet.
1017 case $opsys in
1018 cygwin )
1019 LIB_MATH=
1020 START_FILES='pre-crt0.o'
1021 ;;
1022 darwin )
1023 ## Adding -lm confuses the dynamic linker, so omit it.
1024 LIB_MATH=
1025 START_FILES='pre-crt0.o'
1026 ;;
1027 freebsd )
1028 LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o $(CRT_DIR)/crtn.o'
1029 START_FILES='pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o $(CRT_DIR)/crtbegin.o'
1030 ;;
1031 gnu-linux | gnu-kfreebsd )
1032 LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtn.o'
1033 START_FILES='pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o'
1034 ;;
1035 hpux10-20 | hpux11 )
1036 LIB_STANDARD=-lc
1037 START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o'
1038 ;;
1039 dnl NB this may be adjusted below.
1040 netbsd | openbsd )
1041 LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o'
1042 START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o $(CRT_DIR)/crtbegin.o'
1043 ;;
1044 esac
1045
1046 AC_SUBST(LIB_MATH)
1047 AC_SUBST(START_FILES)
1048
1049 dnl Not all platforms use crtn.o files. Check if the current one does.
1050 crt_files=
1051
1052 for file in x $LIB_STANDARD $START_FILES; do
1053 case "$file" in
1054 *CRT_DIR*) crt_files="$crt_files `echo $file | sed -e 's|.*/||'`" ;;
1055 esac
1056 done
1057
1058 if test "x$crt_files" != x; then
1059
1060 ## If user specified a crt-dir, use that unconditionally.
1061 crt_gcc=no
1062
1063 if test "X$CRT_DIR" = "X"; then
1064
1065 CRT_DIR=/usr/lib # default
1066
1067 case "$canonical" in
1068 x86_64-*-linux-gnu* | s390x-*-linux-gnu*)
1069 ## On x86-64 and s390x GNU/Linux distributions, the standard library
1070 ## can be in a variety of places. We only try /usr/lib64 and /usr/lib.
1071 ## For anything else (eg /usr/lib32), it is up the user to specify
1072 ## the location (bug#5655).
1073 ## Test for crtn.o, not just the directory, because sometimes the
1074 ## directory exists but does not have the relevant files (bug#1287).
1075 ## FIXME better to test for binary compatibility somehow.
1076 test -e /usr/lib64/crtn.o && CRT_DIR=/usr/lib64
1077 ;;
1078
1079 powerpc64-*-linux-gnu* | sparc64-*-linux-gnu*) CRT_DIR=/usr/lib64 ;;
1080 esac
1081
1082 case "$opsys" in
1083 hpux10-20) CRT_DIR=/lib ;;
1084 esac
1085
1086 test "x${GCC}" = xyes && crt_gcc=yes
1087
1088 fi # CRT_DIR = ""
1089
1090 crt_missing=
1091
1092 for file in $crt_files; do
1093
1094 ## If we're using gcc, try to determine it automatically by asking
1095 ## gcc. [If this doesn't work, CRT_DIR will remain at the
1096 ## system-dependent default from above.]
1097 if test $crt_gcc = yes && test ! -e $CRT_DIR/$file; then
1098
1099 crt_file=`$CC --print-file-name=$file 2>/dev/null`
1100 case "$crt_file" in
1101 */*)
1102 CRT_DIR=`AS_DIRNAME(["$crt_file"])`
1103 ;;
1104 esac
1105 fi
1106
1107 dnl We expect all the files to be in a single directory, so after the
1108 dnl first there is no point asking gcc.
1109 crt_gcc=no
1110
1111 test -e $CRT_DIR/$file || crt_missing="$crt_missing $file"
1112 done # $crt_files
1113
1114 test "x$crt_missing" = x || \
1115 AC_MSG_ERROR([Required file(s) not found:$crt_missing
1116 Try using the --with-crt-dir option.])
1117
1118 fi # crt_files != ""
1119
1120 AC_SUBST(CRT_DIR)
1121
1122 case $opsys in
1123 netbsd | openbsd )
1124 if test -f $CRT_DIR/crti.o; then
1125
1126 test -f $CRT_DIR/crtn.o || \
1127 AC_MSG_ERROR([Required file not found: crtn.o])
1128
1129 LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o $(CRT_DIR)/crtn.o'
1130 START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o $(CRT_DIR)/crti.o $(CRT_DIR)/crtbegin.o'
1131 fi
1132 ;;
1133 esac
1134
1135
1136 dnl This function definition taken from Gnome 2.0
1137 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
1138 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
1139 dnl also defines GSTUFF_PKG_ERRORS on error
1140 AC_DEFUN([PKG_CHECK_MODULES], [
1141 succeeded=no
1142
1143 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1144
1145 if test "$PKG_CONFIG" = "no" ; then
1146 ifelse([$4], , [AC_MSG_ERROR([
1147 *** 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])
1148 else
1149 PKG_CONFIG_MIN_VERSION=0.9.0
1150 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
1151 AC_MSG_CHECKING(for $2)
1152
1153 if $PKG_CONFIG --exists "$2" 2>&AS_MESSAGE_LOG_FD &&
1154 $1_CFLAGS=`$PKG_CONFIG --cflags "$2" 2>&AS_MESSAGE_LOG_FD` &&
1155 $1_LIBS=`$PKG_CONFIG --libs "$2" 2>&AS_MESSAGE_LOG_FD`; then
1156 edit_cflags="
1157 s,///*,/,g
1158 s/^/ /
1159 s/ -I/ $isystem/g
1160 s/^ //
1161 "
1162 $1_CFLAGS=`AS_ECHO(["$$1_CFLAGS"]) | sed -e "$edit_cflags"`
1163 $1_LIBS=`AS_ECHO(["$$1_LIBS"]) | sed -e 's,///*,/,g'`
1164 AC_MSG_RESULT([yes CFLAGS='$$1_CFLAGS' LIBS='$$1_LIBS'])
1165 succeeded=yes
1166 else
1167 AC_MSG_RESULT(no)
1168 $1_CFLAGS=""
1169 $1_LIBS=""
1170 ## If we have a custom action on failure, don't print errors, but
1171 ## do set a variable so people can do so.
1172 $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
1173 ifelse([$4], ,echo $$1_PKG_ERRORS,)
1174 fi
1175
1176 AC_SUBST($1_CFLAGS)
1177 AC_SUBST($1_LIBS)
1178 else
1179 echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
1180 echo "*** See http://www.freedesktop.org/software/pkgconfig"
1181 fi
1182 fi
1183
1184 if test $succeeded = yes; then
1185 ifelse([$3], , :, [$3])
1186 else
1187 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])
1188 fi
1189 ])
1190
1191
1192 if test "${with_sound}" != "no"; then
1193 # Sound support for GNU/Linux and the free BSDs.
1194 AC_CHECK_HEADERS(machine/soundcard.h sys/soundcard.h soundcard.h,
1195 have_sound_header=yes)
1196 # Emulation library used on NetBSD.
1197 AC_CHECK_LIB(ossaudio, _oss_ioctl, LIBSOUND=-lossaudio, LIBSOUND=)
1198 AC_SUBST(LIBSOUND)
1199
1200 ALSA_REQUIRED=1.0.0
1201 ALSA_MODULES="alsa >= $ALSA_REQUIRED"
1202 PKG_CHECK_MODULES(ALSA, $ALSA_MODULES, HAVE_ALSA=yes, HAVE_ALSA=no)
1203 if test $HAVE_ALSA = yes; then
1204 SAVE_CFLAGS="$CFLAGS"
1205 SAVE_LIBS="$LIBS"
1206 CFLAGS="$ALSA_CFLAGS $CFLAGS"
1207 LIBS="$ALSA_LIBS $LIBS"
1208 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <asoundlib.h>]], [[snd_lib_error_set_handler (0);]])],
1209 emacs_alsa_normal=yes,
1210 emacs_alsa_normal=no)
1211 if test "$emacs_alsa_normal" != yes; then
1212 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <alsa/asoundlib.h>]],
1213 [[snd_lib_error_set_handler (0);]])],
1214 emacs_alsa_subdir=yes,
1215 emacs_alsa_subdir=no)
1216 if test "$emacs_alsa_subdir" != yes; then
1217 AC_MSG_ERROR([pkg-config found alsa, but it does not compile. See config.log for error messages.])
1218 fi
1219 ALSA_CFLAGS="$ALSA_CFLAGS -DALSA_SUBDIR_INCLUDE"
1220 fi
1221
1222 CFLAGS="$SAVE_CFLAGS"
1223 LIBS="$SAVE_LIBS"
1224 LIBSOUND="$LIBSOUND $ALSA_LIBS"
1225 CFLAGS_SOUND="$CFLAGS_SOUND $ALSA_CFLAGS"
1226 AC_DEFINE(HAVE_ALSA, 1, [Define to 1 if ALSA is available.])
1227 fi
1228
1229 dnl Define HAVE_SOUND if we have sound support. We know it works and
1230 dnl compiles only on the specified platforms. For others, it
1231 dnl probably doesn't make sense to try.
1232 if test x$have_sound_header = xyes || test $HAVE_ALSA = yes; then
1233 case "$opsys" in
1234 dnl defined __FreeBSD__ || defined __NetBSD__ || defined __linux__
1235 gnu-linux|freebsd|netbsd)
1236 AC_DEFINE(HAVE_SOUND, 1, [Define to 1 if you have sound support.])
1237 ;;
1238 esac
1239 fi
1240
1241 AC_SUBST(CFLAGS_SOUND)
1242 fi
1243
1244 dnl checks for header files
1245 AC_CHECK_HEADERS(sys/select.h sys/time.h unistd.h utime.h \
1246 linux/version.h sys/systeminfo.h \
1247 stdio_ext.h fcntl.h coff.h pty.h sys/mman.h \
1248 sys/vlimit.h sys/resource.h locale.h sys/_mbstate_t.h \
1249 sys/utsname.h pwd.h utmp.h dirent.h util.h)
1250
1251 AC_MSG_CHECKING(if personality LINUX32 can be set)
1252 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/personality.h>]], [[personality (PER_LINUX32)]])],
1253 emacs_cv_personality_linux32=yes,
1254 emacs_cv_personality_linux32=no)
1255 AC_MSG_RESULT($emacs_cv_personality_linux32)
1256
1257 if test $emacs_cv_personality_linux32 = yes; then
1258 AC_DEFINE(HAVE_PERSONALITY_LINUX32, 1,
1259 [Define to 1 if personality LINUX32 can be set.])
1260 fi
1261
1262 dnl On Solaris 8 there's a compilation warning for term.h because
1263 dnl it doesn't define `bool'.
1264 AC_CHECK_HEADERS(term.h, , , -)
1265 AC_HEADER_TIME
1266 AC_CHECK_DECLS([sys_siglist])
1267 if test $ac_cv_have_decl_sys_siglist != yes; then
1268 # For Tru64, at least:
1269 AC_CHECK_DECLS([__sys_siglist])
1270 if test $ac_cv_have_decl___sys_siglist = yes; then
1271 AC_DEFINE(sys_siglist, __sys_siglist,
1272 [Define to any substitute for sys_siglist.])
1273 fi
1274 fi
1275 AC_HEADER_SYS_WAIT
1276
1277 dnl Some systems have utime.h but don't declare the struct anyplace.
1278 AC_CACHE_CHECK(for struct utimbuf, emacs_cv_struct_utimbuf,
1279 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifdef TIME_WITH_SYS_TIME
1280 #include <sys/time.h>
1281 #include <time.h>
1282 #else
1283 #ifdef HAVE_SYS_TIME_H
1284 #include <sys/time.h>
1285 #else
1286 #include <time.h>
1287 #endif
1288 #endif
1289 #ifdef HAVE_UTIME_H
1290 #include <utime.h>
1291 #endif]], [[static struct utimbuf x; x.actime = x.modtime;]])],
1292 emacs_cv_struct_utimbuf=yes, emacs_cv_struct_utimbuf=no))
1293 if test $emacs_cv_struct_utimbuf = yes; then
1294 AC_DEFINE(HAVE_STRUCT_UTIMBUF, 1, [Define to 1 if `struct utimbuf' is declared by <utime.h>.])
1295 fi
1296
1297 dnl Check for speed_t typedef.
1298 AC_CACHE_CHECK(for speed_t, emacs_cv_speed_t,
1299 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <termios.h>]], [[speed_t x = 1;]])],
1300 emacs_cv_speed_t=yes, emacs_cv_speed_t=no)])
1301 if test $emacs_cv_speed_t = yes; then
1302 AC_DEFINE(HAVE_SPEED_T, 1,
1303 [Define to 1 if `speed_t' is declared by <termios.h>.])
1304 fi
1305
1306 AC_CACHE_CHECK(for struct timeval, emacs_cv_struct_timeval,
1307 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifdef TIME_WITH_SYS_TIME
1308 #include <sys/time.h>
1309 #include <time.h>
1310 #else
1311 #ifdef HAVE_SYS_TIME_H
1312 #include <sys/time.h>
1313 #else
1314 #include <time.h>
1315 #endif
1316 #endif]], [[static struct timeval x; x.tv_sec = x.tv_usec;]])],
1317 emacs_cv_struct_timeval=yes, emacs_cv_struct_timeval=no))
1318 HAVE_TIMEVAL=$emacs_cv_struct_timeval
1319 if test $emacs_cv_struct_timeval = yes; then
1320 AC_DEFINE(HAVE_TIMEVAL, 1, [Define to 1 if `struct timeval' is declared by <sys/time.h>.])
1321 fi
1322
1323 AC_CACHE_CHECK(for struct exception, emacs_cv_struct_exception,
1324 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]],
1325 [[static struct exception x; x.arg1 = x.arg2 = x.retval; x.name = ""; x.type = 1;]])],
1326 emacs_cv_struct_exception=yes, emacs_cv_struct_exception=no))
1327 HAVE_EXCEPTION=$emacs_cv_struct_exception
1328 if test $emacs_cv_struct_exception != yes; then
1329 AC_DEFINE(NO_MATHERR, 1, [Define to 1 if you don't have struct exception in math.h.])
1330 fi
1331
1332 AC_CHECK_HEADERS(sys/socket.h)
1333 AC_CHECK_HEADERS(net/if.h, , , [AC_INCLUDES_DEFAULT
1334 #if HAVE_SYS_SOCKET_H
1335 #include <sys/socket.h>
1336 #endif])
1337 AC_CHECK_HEADERS(ifaddrs.h, , , [AC_INCLUDES_DEFAULT
1338 #if HAVE_SYS_SOCKET_H
1339 #include <sys/socket.h>
1340 #endif])
1341 AC_CHECK_HEADERS(net/if_dl.h, , , [AC_INCLUDES_DEFAULT
1342 #if HAVE_SYS_SOCKET_H
1343 #include <sys/socket.h>
1344 #endif])
1345 AC_CHECK_FUNCS(getifaddrs freeifaddrs)
1346
1347 dnl checks for structure members
1348 AC_CHECK_MEMBERS([struct ifreq.ifr_flags, struct ifreq.ifr_hwaddr,
1349 struct ifreq.ifr_netmask, struct ifreq.ifr_broadaddr,
1350 struct ifreq.ifr_addr,
1351 struct ifreq.ifr_addr.sa_len], , ,
1352 [AC_INCLUDES_DEFAULT
1353 #if HAVE_SYS_SOCKET_H
1354 #include <sys/socket.h>
1355 #endif
1356 #if HAVE_NET_IF_H
1357 #include <net/if.h>
1358 #endif])
1359
1360 dnl Check for endianness.
1361 AC_C_BIGENDIAN
1362
1363 AC_CACHE_CHECK([for __attribute__ ((__aligned__ (expr)))],
1364 [emacs_cv_attribute_aligned],
1365 [AC_COMPILE_IFELSE(
1366 [AC_LANG_PROGRAM(
1367 [[char __attribute__ ((__aligned__ (1 << 3))) c;]],
1368 [[]])],
1369 [emacs_cv_attribute_aligned=yes],
1370 [emacs_cv_attribute_aligned=no])])
1371 if test $emacs_cv_attribute_aligned = yes; then
1372 AC_DEFINE([HAVE_ATTRIBUTE_ALIGNED], 1,
1373 [Define to 1 if GCC-style __attribute__ ((__aligned__ (expr))) works.])
1374 fi
1375
1376 dnl check for Make feature
1377 AC_PROG_MAKE_SET
1378
1379 DEPFLAGS=
1380 MKDEPDIR=":"
1381 deps_frag=deps.mk
1382 dnl check for GNU Make if we have GCC and autodepend is on.
1383 if test "$GCC" = yes && test "$ac_enable_autodepend" = yes; then
1384 AC_MSG_CHECKING([whether we are using GNU Make])
1385 HAVE_GNU_MAKE=no
1386 testval=`${MAKE-make} --version 2>/dev/null | grep 'GNU Make'`
1387 if test "x$testval" != x; then
1388 HAVE_GNU_MAKE=yes
1389 else
1390 ac_enable_autodepend=no
1391 fi
1392 AC_MSG_RESULT([$HAVE_GNU_MAKE])
1393 if test $HAVE_GNU_MAKE = yes; then
1394 AC_MSG_CHECKING([whether gcc understands -MMD -MF])
1395 SAVE_CFLAGS="$CFLAGS"
1396 CFLAGS="$CFLAGS -MMD -MF deps.d -MP"
1397 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], , ac_enable_autodepend=no)
1398 CFLAGS="$SAVE_CFLAGS"
1399 test -f deps.d || ac_enable_autodepend=no
1400 rm -rf deps.d
1401 AC_MSG_RESULT([$ac_enable_autodepend])
1402 fi
1403 if test $ac_enable_autodepend = yes; then
1404 DEPFLAGS='-MMD -MF ${DEPDIR}/$*.d -MP'
1405 ## MKDIR_P is documented (see AC_PROG_MKDIR_P) to be parallel-safe.
1406 MKDEPDIR='${MKDIR_P} ${DEPDIR}'
1407 deps_frag=autodeps.mk
1408 fi
1409 fi
1410 deps_frag=$srcdir/src/$deps_frag
1411 AC_SUBST(MKDEPDIR)
1412 AC_SUBST(DEPFLAGS)
1413 AC_SUBST_FILE(deps_frag)
1414
1415
1416 lisp_frag=$srcdir/src/lisp.mk
1417 AC_SUBST_FILE(lisp_frag)
1418
1419
1420 dnl checks for operating system services
1421 AC_SYS_LONG_FILE_NAMES
1422
1423 #### Choose a window system.
1424
1425 AC_PATH_X
1426 if test "$no_x" = yes; then
1427 window_system=none
1428 else
1429 window_system=x11
1430 fi
1431
1432 LD_SWITCH_X_SITE_RPATH=
1433 if test "${x_libraries}" != NONE; then
1434 if test -n "${x_libraries}"; then
1435 LD_SWITCH_X_SITE=-L`echo ${x_libraries} | sed -e "s/:/ -L/g"`
1436 LD_SWITCH_X_SITE_RPATH=-Wl,-rpath,`echo ${x_libraries} | sed -e "s/:/ -Wl,-rpath,/g"`
1437 fi
1438 x_default_search_path=""
1439 x_search_path=${x_libraries}
1440 if test -z "${x_search_path}"; then
1441 x_search_path=/usr/lib
1442 fi
1443 for x_library in `echo ${x_search_path}: | \
1444 sed -e "s/:/ /g" -e p -e "s:/lib[[^ /]]* :/share :g"`; do
1445 x_search_path="\
1446 ${x_library}/X11/%L/%T/%N%C%S:\
1447 ${x_library}/X11/%l/%T/%N%C%S:\
1448 ${x_library}/X11/%T/%N%C%S:\
1449 ${x_library}/X11/%L/%T/%N%S:\
1450 ${x_library}/X11/%l/%T/%N%S:\
1451 ${x_library}/X11/%T/%N%S"
1452 if test x"${x_default_search_path}" = x; then
1453 x_default_search_path=${x_search_path}
1454 else
1455 x_default_search_path="${x_search_path}:${x_default_search_path}"
1456 fi
1457 done
1458 fi
1459 AC_SUBST(LD_SWITCH_X_SITE_RPATH)
1460
1461 if test "${x_includes}" != NONE && test -n "${x_includes}"; then
1462 C_SWITCH_X_SITE="$isystem"`echo ${x_includes} | sed -e "s/:/ $isystem/g"`
1463 fi
1464
1465 if test x"${x_includes}" = x; then
1466 bitmapdir=/usr/include/X11/bitmaps
1467 else
1468 # accumulate include directories that have X11 bitmap subdirectories
1469 bmd_acc="dummyval"
1470 for bmd in `echo ${x_includes} | sed -e "s/:/ /g"`; do
1471 if test -d "${bmd}/X11/bitmaps"; then
1472 bmd_acc="${bmd_acc}:${bmd}/X11/bitmaps"
1473 fi
1474 if test -d "${bmd}/bitmaps"; then
1475 bmd_acc="${bmd_acc}:${bmd}/bitmaps"
1476 fi
1477 done
1478 if test ${bmd_acc} != "dummyval"; then
1479 bitmapdir=`echo ${bmd_acc} | sed -e "s/^dummyval://"`
1480 fi
1481 fi
1482
1483 HAVE_NS=no
1484 NS_IMPL_COCOA=no
1485 NS_IMPL_GNUSTEP=no
1486 tmp_CPPFLAGS="$CPPFLAGS"
1487 tmp_CFLAGS="$CFLAGS"
1488 CPPFLAGS="$CPPFLAGS -x objective-c"
1489 CFLAGS="$CFLAGS -x objective-c"
1490 TEMACS_LDFLAGS2="\${LDFLAGS}"
1491 GNU_OBJC_CFLAGS=
1492 if test "${with_ns}" != no; then
1493 if test "${opsys}" = darwin; then
1494 NS_IMPL_COCOA=yes
1495 ns_appdir=`pwd`/nextstep/Emacs.app
1496 ns_appbindir=${ns_appdir}/Contents/MacOS
1497 ns_appresdir=${ns_appdir}/Contents/Resources
1498 ns_appsrc=${srcdir}/nextstep/Cocoa/Emacs.base
1499 elif test -f $GNUSTEP_CONFIG_FILE; then
1500 NS_IMPL_GNUSTEP=yes
1501 ns_appdir=`pwd`/nextstep/Emacs.app
1502 ns_appbindir=${ns_appdir}
1503 ns_appresdir=${ns_appdir}/Resources
1504 ns_appsrc=${srcdir}/nextstep/GNUstep/Emacs.base
1505 dnl FIXME sourcing this several times in subshells seems inefficient.
1506 GNUSTEP_SYSTEM_HEADERS="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_SYSTEM_HEADERS)"
1507 GNUSTEP_SYSTEM_LIBRARIES="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_SYSTEM_LIBRARIES)"
1508 dnl I seemed to need these as well with GNUstep-startup 0.25.
1509 GNUSTEP_LOCAL_HEADERS="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_LOCAL_HEADERS)"
1510 GNUSTEP_LOCAL_LIBRARIES="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_LOCAL_LIBRARIES)"
1511 test "x${GNUSTEP_LOCAL_HEADERS}" != "x" && \
1512 GNUSTEP_LOCAL_HEADERS="-I${GNUSTEP_LOCAL_HEADERS}"
1513 test "x${GNUSTEP_LOCAL_LIBRARIES}" != "x" && \
1514 GNUSTEP_LOCAL_LIBRARIES="-L${GNUSTEP_LOCAL_LIBRARIES}"
1515 CPPFLAGS="$CPPFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
1516 CFLAGS="$CFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
1517 LDFLAGS="$LDFLAGS -L${GNUSTEP_SYSTEM_LIBRARIES} ${GNUSTEP_LOCAL_LIBRARIES}"
1518 LIB_STANDARD=
1519 START_FILES=
1520 TEMACS_LDFLAGS2=
1521 dnl GNUstep defines BASE_NATIVE_OBJC_EXCEPTIONS to 0 or 1.
1522 dnl If they had chosen to either define it or not, we could have
1523 dnl just used AC_CHECK_DECL here.
1524 AC_CACHE_CHECK(if GNUstep defines BASE_NATIVE_OBJC_EXCEPTIONS,
1525 emacs_cv_objc_exceptions,
1526 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <GNUstepBase/GSConfig.h>]],
1527 [[#if defined BASE_NATIVE_OBJC_EXCEPTIONS && BASE_NATIVE_OBJC_EXCEPTIONS > 0
1528 1;
1529 #else
1530 fail;
1531 #endif]])], emacs_cv_objc_exceptions=yes, emacs_cv_objc_exceptions=no ) )
1532 if test $emacs_cv_objc_exceptions = yes; then
1533 dnl _NATIVE_OBJC_EXCEPTIONS is used by the GNUstep headers.
1534 AC_DEFINE(_NATIVE_OBJC_EXCEPTIONS, 1,
1535 [Define if GNUstep uses ObjC exceptions.])
1536 GNU_OBJC_CFLAGS="-fobjc-exceptions"
1537 fi
1538 fi
1539
1540 dnl This is only used while we test the NS headers, it gets reset below.
1541 CFLAGS="$CFLAGS $GNU_OBJC_CFLAGS"
1542
1543 AC_CHECK_HEADER([AppKit/AppKit.h], [HAVE_NS=yes],
1544 [AC_MSG_ERROR([`--with-ns' was specified, but the include
1545 files are missing or cannot be compiled.])])
1546 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <Foundation/NSObjCRuntime.h>],
1547 [NSInteger i;])],
1548 ns_have_nsinteger=yes,
1549 ns_have_nsinteger=no)
1550 if test $ns_have_nsinteger = yes; then
1551 AC_DEFINE(NS_HAVE_NSINTEGER, 1, [Define to 1 if `NSInteger' is defined.])
1552 fi
1553 fi
1554 AC_SUBST(TEMACS_LDFLAGS2)
1555
1556 INSTALL_ARCH_INDEP_EXTRA=install-etc
1557 ns_self_contained=no
1558 ns_frag=/dev/null
1559 NS_OBJ=
1560 NS_OBJC_OBJ=
1561 if test "${HAVE_NS}" = yes; then
1562 if test "$with_toolkit_scroll_bars" = "no"; then
1563 AC_MSG_ERROR([Non-toolkit scroll bars are not implemented for Nextstep.])
1564 fi
1565
1566 window_system=nextstep
1567 with_xft=no
1568 # set up packaging dirs
1569 if test "${EN_NS_SELF_CONTAINED}" = yes; then
1570 ns_self_contained=yes
1571 prefix=${ns_appresdir}
1572 exec_prefix=${ns_appbindir}
1573 dnl This one isn't really used, only archlibdir is.
1574 libexecdir="\${ns_appbindir}/libexec"
1575 archlibdir="\${ns_appbindir}/libexec"
1576 docdir="\${ns_appresdir}/etc"
1577 etcdir="\${ns_appresdir}/etc"
1578 dnl FIXME maybe set datarootdir instead.
1579 dnl That would also get applications, icons, man.
1580 infodir="\${ns_appresdir}/info"
1581 mandir="\${ns_appresdir}/man"
1582 lispdir="\${ns_appresdir}/lisp"
1583 leimdir="\${ns_appresdir}/leim"
1584 INSTALL_ARCH_INDEP_EXTRA=
1585 fi
1586 ns_frag=$srcdir/src/ns.mk
1587 NS_OBJ="fontset.o fringe.o image.o"
1588 NS_OBJC_OBJ="nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o"
1589 fi
1590 CFLAGS="$tmp_CFLAGS"
1591 CPPFLAGS="$tmp_CPPFLAGS"
1592 AC_SUBST(INSTALL_ARCH_INDEP_EXTRA)
1593 AC_SUBST(ns_self_contained)
1594 AC_SUBST(NS_OBJ)
1595 AC_SUBST(NS_OBJC_OBJ)
1596 AC_SUBST(LIB_STANDARD)
1597 AC_SUBST_FILE(ns_frag)
1598
1599 case "${window_system}" in
1600 x11 )
1601 HAVE_X_WINDOWS=yes
1602 HAVE_X11=yes
1603 case "${with_x_toolkit}" in
1604 athena | lucid ) USE_X_TOOLKIT=LUCID ;;
1605 motif ) USE_X_TOOLKIT=MOTIF ;;
1606 gtk ) with_gtk=yes
1607 dnl Don't set this for GTK. A lot of tests below assumes Xt when
1608 dnl USE_X_TOOLKIT is set.
1609 USE_X_TOOLKIT=none ;;
1610 gtk3 ) with_gtk3=yes
1611 USE_X_TOOLKIT=none ;;
1612 no ) USE_X_TOOLKIT=none ;;
1613 dnl If user did not say whether to use a toolkit, make this decision later:
1614 dnl use the toolkit if we have gtk, or X11R5 or newer.
1615 * ) USE_X_TOOLKIT=maybe ;;
1616 esac
1617 ;;
1618 nextstep | none )
1619 HAVE_X_WINDOWS=no
1620 HAVE_X11=no
1621 USE_X_TOOLKIT=none
1622 ;;
1623 esac
1624
1625 if test "$window_system" = none && test "X$with_x" != "Xno"; then
1626 AC_CHECK_PROG(HAVE_XSERVER, X, true, false)
1627 if test "$HAVE_XSERVER" = true ||
1628 test -n "$DISPLAY" ||
1629 test "`echo /usr/lib/libX11.*`" != "/usr/lib/libX11.*"; then
1630 AC_MSG_ERROR([You seem to be running X, but no X development libraries
1631 were found. You should install the relevant development files for X
1632 and for the toolkit you want, such as Gtk+, Lesstif or Motif. Also make
1633 sure you have development files for image handling, i.e.
1634 tiff, gif, jpeg, png and xpm.
1635 If you are sure you want Emacs compiled without X window support, pass
1636 --without-x
1637 to configure.])
1638 fi
1639 fi
1640
1641 ### If we're using X11, we should use the X menu package.
1642 HAVE_MENUS=no
1643 case ${HAVE_X11} in
1644 yes ) HAVE_MENUS=yes ;;
1645 esac
1646
1647 # Do the opsystem or machine files prohibit the use of the GNU malloc?
1648 # Assume not, until told otherwise.
1649 GNU_MALLOC=yes
1650
1651 AC_CACHE_CHECK(
1652 [whether malloc is Doug Lea style],
1653 [emacs_cv_var_doug_lea_malloc],
1654 [AC_LINK_IFELSE(
1655 [AC_LANG_PROGRAM(
1656 [[#include <malloc.h>
1657 static void hook (void) {}]],
1658 [[malloc_set_state (malloc_get_state ());
1659 __after_morecore_hook = hook;
1660 __malloc_initialize_hook = hook;]])],
1661 [emacs_cv_var_doug_lea_malloc=yes],
1662 [emacs_cv_var_doug_lea_malloc=no])])
1663 doug_lea_malloc=$emacs_cv_var_doug_lea_malloc
1664
1665
1666 dnl See comments in aix4-2.h about maybe using system malloc there.
1667 system_malloc=no
1668 case "$opsys" in
1669 ## darwin ld insists on the use of malloc routines in the System framework.
1670 darwin|sol2-10) system_malloc=yes ;;
1671 esac
1672
1673 if test "${system_malloc}" = "yes"; then
1674 AC_DEFINE(SYSTEM_MALLOC, 1, [Define to use system malloc.])
1675 GNU_MALLOC=no
1676 GNU_MALLOC_reason="
1677 (The GNU allocators don't work with this system configuration.)"
1678 GMALLOC_OBJ=
1679 VMLIMIT_OBJ=
1680 else
1681 test "$doug_lea_malloc" != "yes" && GMALLOC_OBJ=gmalloc.o
1682 VMLIMIT_OBJ=vm-limit.o
1683 fi
1684 AC_SUBST(GMALLOC_OBJ)
1685 AC_SUBST(VMLIMIT_OBJ)
1686
1687 if test "$doug_lea_malloc" = "yes" ; then
1688 if test "$GNU_MALLOC" = yes ; then
1689 GNU_MALLOC_reason="
1690 (Using Doug Lea's new malloc from the GNU C Library.)"
1691 fi
1692 AC_DEFINE(DOUG_LEA_MALLOC, 1,
1693 [Define to 1 if you are using the GNU C Library.])
1694
1695 ## Use mmap directly for allocating larger buffers.
1696 ## FIXME this comes from src/s/{gnu,gnu-linux}.h:
1697 ## #ifdef DOUG_LEA_MALLOC; #undef REL_ALLOC; #endif
1698 ## Does the AC_FUNC_MMAP test below make this check unnecessary?
1699 case "$opsys" in
1700 gnu*) REL_ALLOC=no ;;
1701 esac
1702 fi
1703
1704 if test x"${REL_ALLOC}" = x; then
1705 REL_ALLOC=${GNU_MALLOC}
1706 fi
1707
1708 use_mmap_for_buffers=no
1709 case "$opsys" in
1710 cygwin|freebsd|irix6-5) use_mmap_for_buffers=yes ;;
1711 esac
1712
1713 AC_FUNC_MMAP
1714 if test $use_mmap_for_buffers = yes; then
1715 AC_DEFINE(USE_MMAP_FOR_BUFFERS, 1, [Define to use mmap to allocate buffer text.])
1716 REL_ALLOC=no
1717 fi
1718
1719 LIBS="$LIBS_SYSTEM $LIBS"
1720
1721 dnl If found, this defines HAVE_LIBDNET, which m/pmax.h checks,
1722 dnl and also adds -ldnet to LIBS, which Autoconf uses for checks.
1723 AC_CHECK_LIB(dnet, dnet_ntoa)
1724 dnl This causes -lresolv to get used in subsequent tests,
1725 dnl which causes failures on some systems such as HPUX 9.
1726 dnl AC_CHECK_LIB(resolv, gethostbyname)
1727
1728 dnl FIXME replace main with a function we actually want from this library.
1729 AC_CHECK_LIB(Xbsd, main, LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -lXbsd")
1730
1731 dnl Check if pthreads is available.
1732 LIB_PTHREAD=
1733 AC_CHECK_HEADERS(pthread.h)
1734 if test "$ac_cv_header_pthread_h"; then
1735 dnl gmalloc.c uses pthread_atfork, which is not available on older-style
1736 dnl hosts such as MirBSD 10, so test for pthread_atfork instead of merely
1737 dnl testing for pthread_self if Emacs uses gmalloc.c.
1738 if test "$GMALLOC_OBJ" = gmalloc.o; then
1739 emacs_pthread_function=pthread_atfork
1740 else
1741 emacs_pthread_function=pthread_self
1742 fi
1743 AC_CHECK_LIB(pthread, $emacs_pthread_function, HAVE_PTHREAD=yes)
1744 fi
1745 if test "$HAVE_PTHREAD" = yes; then
1746 case "${canonical}" in
1747 *-hpux*) ;;
1748 *) LIB_PTHREAD="-lpthread"
1749 LIBS="$LIB_PTHREAD $LIBS" ;;
1750 esac
1751 AC_DEFINE(HAVE_PTHREAD, 1, [Define to 1 if you have pthread (-lpthread).])
1752 fi
1753 AC_SUBST([LIB_PTHREAD])
1754
1755 AC_CHECK_LIB(pthreads, cma_open)
1756
1757 ## Note: when using cpp in s/aix4.2.h, this definition depended on
1758 ## HAVE_LIBPTHREADS. That was not defined earlier in configure when
1759 ## the system file was sourced. Hence the value of LIBS_SYSTEM
1760 ## added to LIBS in configure would never contain the pthreads part,
1761 ## but the value used in Makefiles might. FIXME?
1762 ##
1763 ## -lpthreads seems to be necessary for Xlib in X11R6, and should
1764 ## be harmless on older versions of X where it happens to exist.
1765 test "$opsys" = "aix4-2" && \
1766 test $ac_cv_lib_pthreads_cma_open = yes && \
1767 LIBS_SYSTEM="$LIBS_SYSTEM -lpthreads"
1768
1769 dnl Check for need for bigtoc support on IBM AIX
1770
1771 case ${host_os} in
1772 aix*)
1773 AC_CACHE_CHECK([for -bbigtoc option], [gdb_cv_bigtoc], [
1774 case $GCC in
1775 yes) gdb_cv_bigtoc=-Wl,-bbigtoc ;;
1776 *) gdb_cv_bigtoc=-bbigtoc ;;
1777 esac
1778
1779 LDFLAGS=$LDFLAGS\ $gdb_cv_bigtoc
1780 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int i;]])], [], [gdb_cv_bigtoc=])
1781 ])
1782 ;;
1783 esac
1784
1785 # Change CFLAGS and CPPFLAGS temporarily so that C_SWITCH_X_SITE gets
1786 # used for the tests that follow. We set them back to REAL_CFLAGS and
1787 # REAL_CPPFLAGS later on.
1788
1789 REAL_CFLAGS="$CFLAGS"
1790 REAL_CPPFLAGS="$CPPFLAGS"
1791
1792 if test "${HAVE_X11}" = "yes"; then
1793 DEFS="$C_SWITCH_X_SITE $DEFS"
1794 LDFLAGS="$LDFLAGS $LD_SWITCH_X_SITE"
1795 LIBS="-lX11 $LIBS"
1796 CFLAGS="$C_SWITCH_X_SITE $CFLAGS"
1797 CPPFLAGS="$C_SWITCH_X_SITE $CPPFLAGS"
1798
1799 # On Solaris, arrange for LD_RUN_PATH to point to the X libraries for tests.
1800 # This is handled by LD_SWITCH_X_SITE_RPATH during the real build,
1801 # but it's more convenient here to set LD_RUN_PATH since this
1802 # also works on hosts that don't understand LD_SWITCH_X_SITE_RPATH.
1803 if test "${x_libraries}" != NONE && test -n "${x_libraries}"; then
1804 LD_RUN_PATH=$x_libraries${LD_RUN_PATH+:}$LD_RUN_PATH
1805 export LD_RUN_PATH
1806 fi
1807
1808 if test "${opsys}" = "gnu-linux"; then
1809 AC_MSG_CHECKING(whether X on GNU/Linux needs -b to link)
1810 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
1811 [[XOpenDisplay ("foo");]])],
1812 [xgnu_linux_first_failure=no],
1813 [xgnu_linux_first_failure=yes])
1814 if test "${xgnu_linux_first_failure}" = "yes"; then
1815 OLD_LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE"
1816 OLD_C_SWITCH_X_SITE="$C_SWITCH_X_SITE"
1817 OLD_CPPFLAGS="$CPPFLAGS"
1818 OLD_LIBS="$LIBS"
1819 LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -b i486-linuxaout"
1820 C_SWITCH_X_SITE="$C_SWITCH_X_SITE -b i486-linuxaout"
1821 CPPFLAGS="$CPPFLAGS -b i486-linuxaout"
1822 LIBS="$LIBS -b i486-linuxaout"
1823 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
1824 [[XOpenDisplay ("foo");]])],
1825 [xgnu_linux_second_failure=no],
1826 [xgnu_linux_second_failure=yes])
1827 if test "${xgnu_linux_second_failure}" = "yes"; then
1828 # If we get the same failure with -b, there is no use adding -b.
1829 # So take it out. This plays safe.
1830 LD_SWITCH_X_SITE="$OLD_LD_SWITCH_X_SITE"
1831 C_SWITCH_X_SITE="$OLD_C_SWITCH_X_SITE"
1832 CPPFLAGS="$OLD_CPPFLAGS"
1833 LIBS="$OLD_LIBS"
1834 AC_MSG_RESULT(no)
1835 else
1836 AC_MSG_RESULT(yes)
1837 fi
1838 else
1839 AC_MSG_RESULT(no)
1840 fi
1841 fi
1842
1843 # Reportedly, some broken Solaris systems have XKBlib.h but are missing
1844 # header files included from there.
1845 AC_MSG_CHECKING(for Xkb)
1846 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>
1847 #include <X11/XKBlib.h>]],
1848 [[XkbDescPtr kb = XkbGetKeyboard (0, XkbAllComponentsMask, XkbUseCoreKbd);]])],
1849 emacs_xkb=yes, emacs_xkb=no)
1850 AC_MSG_RESULT($emacs_xkb)
1851 if test $emacs_xkb = yes; then
1852 AC_DEFINE(HAVE_XKBGETKEYBOARD, 1, [Define to 1 if you have the XkbGetKeyboard function.])
1853 fi
1854
1855 AC_CHECK_FUNCS(XrmSetDatabase XScreenResourceString \
1856 XScreenNumberOfScreen)
1857 fi
1858
1859 if test "${window_system}" = "x11"; then
1860 AC_MSG_CHECKING(X11 version 6)
1861 AC_CACHE_VAL(emacs_cv_x11_version_6,
1862 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>]],
1863 [[#if XlibSpecificationRelease < 6
1864 fail;
1865 #endif
1866 ]])], emacs_cv_x11_version_6=yes, emacs_cv_x11_version_6=no)])
1867 if test $emacs_cv_x11_version_6 = yes; then
1868 AC_MSG_RESULT(6 or newer)
1869 AC_DEFINE(HAVE_X11R6, 1,
1870 [Define to 1 if you have the X11R6 or newer version of Xlib.])
1871 AC_DEFINE(HAVE_X_I18N, 1, [Define if you have usable i18n support.])
1872 ## inoue@ainet.or.jp says Solaris has a bug related to X11R6-style
1873 ## XIM support.
1874 case "$opsys" in
1875 sol2-*) : ;;
1876 *) AC_DEFINE(HAVE_X11R6_XIM, 1,
1877 [Define if you have usable X11R6-style XIM support.])
1878 ;;
1879 esac
1880 else
1881 AC_MSG_RESULT(before 6)
1882 fi
1883 fi
1884
1885
1886 ### Use -lrsvg-2 if available, unless `--with-rsvg=no' is specified.
1887 HAVE_RSVG=no
1888 if test "${HAVE_X11}" = "yes" || test "${HAVE_NS}" = "yes"; then
1889 if test "${with_rsvg}" != "no"; then
1890 RSVG_REQUIRED=2.11.0
1891 RSVG_MODULE="librsvg-2.0 >= $RSVG_REQUIRED"
1892
1893 PKG_CHECK_MODULES(RSVG, $RSVG_MODULE, HAVE_RSVG=yes, :)
1894 AC_SUBST(RSVG_CFLAGS)
1895 AC_SUBST(RSVG_LIBS)
1896
1897 if test $HAVE_RSVG = yes; then
1898 AC_DEFINE(HAVE_RSVG, 1, [Define to 1 if using librsvg.])
1899 CFLAGS="$CFLAGS $RSVG_CFLAGS"
1900 LIBS="$RSVG_LIBS $LIBS"
1901 fi
1902 fi
1903 fi
1904
1905 HAVE_IMAGEMAGICK=no
1906 if test "${HAVE_X11}" = "yes"; then
1907 if test "${with_imagemagick}" != "no"; then
1908 ## 6.2.8 is the earliest version known to work, but earlier versions
1909 ## might work - let us know if you find one.
1910 ## 6.0.7 does not work. See bug#7955.
1911 IMAGEMAGICK_MODULE="Wand >= 6.2.8"
1912 PKG_CHECK_MODULES(IMAGEMAGICK, $IMAGEMAGICK_MODULE, HAVE_IMAGEMAGICK=yes, :)
1913 AC_SUBST(IMAGEMAGICK_CFLAGS)
1914 AC_SUBST(IMAGEMAGICK_LIBS)
1915
1916 if test $HAVE_IMAGEMAGICK = yes; then
1917 AC_DEFINE(HAVE_IMAGEMAGICK, 1, [Define to 1 if using imagemagick.])
1918 CFLAGS="$CFLAGS $IMAGEMAGICK_CFLAGS"
1919 LIBS="$IMAGEMAGICK_LIBS $LIBS"
1920 AC_CHECK_FUNCS(MagickExportImagePixels)
1921 fi
1922 fi
1923 fi
1924
1925
1926 HAVE_GTK=no
1927 GTK_OBJ=
1928 if test "${with_gtk3}" = "yes"; then
1929 GLIB_REQUIRED=2.28
1930 GTK_REQUIRED=3.0
1931 GTK_MODULES="gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
1932
1933 dnl Checks for libraries.
1934 PKG_CHECK_MODULES(GTK, $GTK_MODULES, pkg_check_gtk=yes, pkg_check_gtk=no)
1935 if test "$pkg_check_gtk" = "no" && test "$USE_X_TOOLKIT" != "maybe"; then
1936 AC_MSG_ERROR($GTK_PKG_ERRORS)
1937 fi
1938 AC_DEFINE(HAVE_GTK3, 1, [Define to 1 if using GTK 3 or later.])
1939 GTK_OBJ=emacsgtkfixed.o
1940 fi
1941
1942 if test "$pkg_check_gtk" != "yes"; then
1943 HAVE_GTK=no
1944 if test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then
1945 GLIB_REQUIRED=2.10
1946 GTK_REQUIRED=2.10
1947 GTK_MODULES="gtk+-2.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
1948
1949 dnl Checks for libraries.
1950 PKG_CHECK_MODULES(GTK, $GTK_MODULES, pkg_check_gtk=yes, pkg_check_gtk=no)
1951 if test "$pkg_check_gtk" = "no" && test "$USE_X_TOOLKIT" != "maybe"; then
1952 AC_MSG_ERROR($GTK_PKG_ERRORS)
1953 fi
1954 fi
1955 fi
1956
1957 if test x"$pkg_check_gtk" = xyes; then
1958
1959 AC_SUBST(GTK_CFLAGS)
1960 AC_SUBST(GTK_LIBS)
1961 C_SWITCH_X_SITE="$C_SWITCH_X_SITE $GTK_CFLAGS"
1962 CFLAGS="$CFLAGS $GTK_CFLAGS"
1963 LIBS="$GTK_LIBS $LIBS"
1964 dnl Try to compile a simple GTK program.
1965 GTK_COMPILES=no
1966 AC_CHECK_FUNCS(gtk_main, GTK_COMPILES=yes)
1967 if test "${GTK_COMPILES}" != "yes"; then
1968 if test "$USE_X_TOOLKIT" != "maybe"; then
1969 AC_MSG_ERROR([Gtk+ wanted, but it does not compile, see config.log. Maybe some x11-devel files missing?]);
1970 fi
1971 else
1972 HAVE_GTK=yes
1973 AC_DEFINE(USE_GTK, 1, [Define to 1 if using GTK.])
1974 GTK_OBJ="gtkutil.o $GTK_OBJ"
1975 USE_X_TOOLKIT=none
1976 if $PKG_CONFIG --atleast-version=2.10 gtk+-2.0; then
1977 :
1978 else
1979 AC_MSG_WARN([[Your version of Gtk+ will have problems with
1980 closing open displays. This is no problem if you just use
1981 one display, but if you use more than one and close one of them
1982 Emacs may crash.]])
1983 sleep 3
1984 fi
1985 fi
1986
1987 fi
1988 AC_SUBST(GTK_OBJ)
1989
1990
1991 if test "${HAVE_GTK}" = "yes"; then
1992
1993 dnl GTK scrollbars resemble toolkit scrollbars a lot, so to avoid
1994 dnl a lot if #ifdef:s, say we have toolkit scrollbars.
1995 if test "$with_toolkit_scroll_bars" != no; then
1996 with_toolkit_scroll_bars=yes
1997 fi
1998
1999 dnl Check if we have the old file selection dialog declared and
2000 dnl in the link library. In 2.x it may be in the library,
2001 dnl but not declared if deprecated featured has been selected out.
2002 dnl AC_CHECK_DECL checks for a macro, so check for GTK_TYPE_FILE_SELECTION.
2003 HAVE_GTK_FILE_SELECTION=no
2004 AC_CHECK_DECL(GTK_TYPE_FILE_SELECTION, HAVE_GTK_FILE_SELECTION=yes,
2005 HAVE_GTK_FILE_SELECTION=no, [AC_INCLUDES_DEFAULT
2006 #include <gtk/gtk.h>])
2007 if test "$HAVE_GTK_FILE_SELECTION" = yes; then
2008 AC_CHECK_FUNCS(gtk_file_selection_new)
2009 fi
2010
2011
2012 dnl Check for functions introduced in 2.14 and later.
2013 AC_CHECK_FUNCS(gtk_widget_get_window gtk_widget_set_has_window \
2014 gtk_dialog_get_action_area gtk_widget_get_sensitive \
2015 gtk_widget_get_mapped gtk_adjustment_get_page_size \
2016 gtk_orientable_set_orientation \
2017 gtk_window_set_has_resize_grip)
2018 fi
2019
2020
2021 HAVE_XWIDGETS=no
2022 HAVE_WEBKIT=no
2023 HAVE_GOOCANVAS=no
2024 HAVE_CLUTTER=no
2025 if test "${with_xwidgets}" != "no"; then
2026 echo "xwidgets enabled, checking webkit, and others"
2027 HAVE_XWIDGETS=yes
2028 AC_DEFINE(HAVE_XWIDGETS, 1, [Define to 1 if you have xwidgets support.])
2029 #xwidgets
2030 #TODO
2031 # - enable only if gtk/gtk3 enabled
2032 # - webkit, goocanvas, clutter
2033 # - only webkit_osr is good so remove plain webkit laterish
2034
2035 #webkit version for gtk3.
2036 WEBKIT_REQUIRED=1.4.0
2037 WEBKIT_MODULES="webkitgtk-3.0 >= $WEBKIT_REQUIRED"
2038
2039 if test "${with_gtk3}" = "yes"; then
2040 PKG_CHECK_MODULES(WEBKIT, $WEBKIT_MODULES, HAVE_WEBKIT=yes, HAVE_WEBKIT=no)
2041 if test $HAVE_WEBKIT = yes; then
2042 AC_DEFINE(HAVE_WEBKIT_OSR, 1, [Define to 1 if you have webkit_osr support.])
2043 fi
2044 fi
2045
2046 if test "${with_xwdemo}" = "yes"; then
2047 #clutter and goocanvas are just proof of concept so disable for now
2048 CLUTTER_REQUIRED=1.0.0
2049 CLUTTER_MODULES="clutter-gtk-1.0 >= $CLUTTER_REQUIRED"
2050
2051 PKG_CHECK_MODULES(CLUTTER, $CLUTTER_MODULES, HAVE_CLUTTER=yes, HAVE_CLUTTER=no)
2052 if test $HAVE_CLUTTER = yes; then
2053 AC_DEFINE(HAVE_CLUTTER, 1, [Define to 1 if you have clutter support.])
2054 fi
2055
2056
2057 GOOCANVAS_REQUIRED=1.4.0
2058 GOOCANVAS_MODULES="goocanvasgtk-3.0 >= $GOOCANVAS_REQUIRED"
2059
2060 PKG_CHECK_MODULES(GOOCANVAS, $GOOCANVAS_MODULES, HAVE_GOOCANVAS=yes, HAVE_GOOCANVAS=no)
2061 if test $HAVE_GOOCANVAS = yes; then
2062 AC_DEFINE(HAVE_GOOCANVAS, 1, [Define to 1 if you have goocanvas support.])
2063 fi
2064 fi
2065 fi
2066
2067
2068 dnl D-Bus has been tested under GNU/Linux only. Must be adapted for
2069 dnl other platforms.
2070 HAVE_DBUS=no
2071 DBUS_OBJ=
2072 if test "${with_dbus}" = "yes"; then
2073 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0, HAVE_DBUS=yes, HAVE_DBUS=no)
2074 if test "$HAVE_DBUS" = yes; then
2075 LIBS="$LIBS $DBUS_LIBS"
2076 AC_DEFINE(HAVE_DBUS, 1, [Define to 1 if using D-Bus.])
2077 dnl dbus_watch_get_unix_fd has been introduced in D-Bus 1.1.1.
2078 dnl dbus_validate_* have been introduced in D-Bus 1.5.12.
2079 AC_CHECK_FUNCS(dbus_watch_get_unix_fd \
2080 dbus_validate_bus_name \
2081 dbus_validate_path \
2082 dbus_validate_interface \
2083 dbus_validate_member)
2084 DBUS_OBJ=dbusbind.o
2085 fi
2086 fi
2087 AC_SUBST(DBUS_OBJ)
2088
2089 dnl GSettings has been tested under GNU/Linux only.
2090 HAVE_GSETTINGS=no
2091 if test "${HAVE_X11}" = "yes" && test "${with_gsettings}" = "yes"; then
2092 PKG_CHECK_MODULES(GSETTINGS, gio-2.0 >= 2.26, HAVE_GSETTINGS=yes, HAVE_GSETTINGS=no)
2093 if test "$HAVE_GSETTINGS" = "yes"; then
2094 AC_DEFINE(HAVE_GSETTINGS, 1, [Define to 1 if using GSettings.])
2095 SETTINGS_CFLAGS="$GSETTINGS_CFLAGS"
2096 SETTINGS_LIBS="$GSETTINGS_LIBS"
2097 fi
2098 fi
2099
2100 dnl GConf has been tested under GNU/Linux only.
2101 dnl The version is really arbitrary, it is about the same age as Gtk+ 2.6.
2102 HAVE_GCONF=no
2103 if test "${HAVE_X11}" = "yes" && test "${with_gconf}" = "yes"; then
2104 PKG_CHECK_MODULES(GCONF, gconf-2.0 >= 2.13, HAVE_GCONF=yes, HAVE_GCONF=no)
2105 if test "$HAVE_GCONF" = yes; then
2106 AC_DEFINE(HAVE_GCONF, 1, [Define to 1 if using GConf.])
2107 dnl Newer GConf doesn't link with g_objects, so this is not defined.
2108 SETTINGS_CFLAGS="$SETTINGS_CFLAGS $GCONF_CFLAGS"
2109 SETTINGS_LIBS="$SETTINGS_LIBS $GCONF_LIBS"
2110 fi
2111 fi
2112
2113 if test "$HAVE_GSETTINGS" = "yes" || test "$HAVE_GCONF" = "yes"; then
2114 SAVE_CFLAGS="$CFLAGS"
2115 SAVE_LIBS="$LIBS"
2116 CFLAGS="$SETTINGS_CFLAGS $CFLAGS"
2117 LIBS="$SETTINGS_LIBS $LIBS"
2118 AC_CHECK_FUNCS([g_type_init])
2119 CFLAGS="$SAVE_CFLAGS"
2120 LIBS="$SAVE_LIBS"
2121 fi
2122 AC_SUBST(SETTINGS_CFLAGS)
2123 AC_SUBST(SETTINGS_LIBS)
2124
2125
2126 dnl SELinux is available for GNU/Linux only.
2127 HAVE_LIBSELINUX=no
2128 LIBSELINUX_LIBS=
2129 if test "${with_selinux}" = "yes"; then
2130 AC_CHECK_LIB([selinux], [lgetfilecon], HAVE_LIBSELINUX=yes, HAVE_LIBSELINUX=no)
2131 if test "$HAVE_LIBSELINUX" = yes; then
2132 AC_DEFINE(HAVE_LIBSELINUX, 1, [Define to 1 if using SELinux.])
2133 LIBSELINUX_LIBS=-lselinux
2134 fi
2135 fi
2136 AC_SUBST(LIBSELINUX_LIBS)
2137
2138 HAVE_GNUTLS=no
2139 HAVE_GNUTLS_CALLBACK_CERTIFICATE_VERIFY=no
2140 if test "${with_gnutls}" = "yes" ; then
2141 PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 2.6.6], HAVE_GNUTLS=yes, HAVE_GNUTLS=no)
2142 if test "${HAVE_GNUTLS}" = "yes"; then
2143 AC_DEFINE(HAVE_GNUTLS, 1, [Define if using GnuTLS.])
2144 fi
2145
2146 CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS"
2147 LIBS="$LIBGNUTLS_LIBS $LIBS"
2148 AC_CHECK_FUNCS(gnutls_certificate_set_verify_function, HAVE_GNUTLS_CALLBACK_CERTIFICATE_VERIFY=yes)
2149
2150 if test "${HAVE_GNUTLS_CALLBACK_CERTIFICATE_VERIFY}" = "yes"; then
2151 AC_DEFINE(HAVE_GNUTLS_CALLBACK_CERTIFICATE_VERIFY, 1, [Define if using GnuTLS certificate verification callbacks.])
2152 fi
2153 fi
2154
2155 AC_SUBST(LIBGNUTLS_LIBS)
2156 AC_SUBST(LIBGNUTLS_CFLAGS)
2157
2158 dnl Do not put whitespace before the #include statements below.
2159 dnl Older compilers (eg sunos4 cc) choke on it.
2160 HAVE_XAW3D=no
2161 LUCID_LIBW=
2162 if test x"${USE_X_TOOLKIT}" = xmaybe || test x"${USE_X_TOOLKIT}" = xLUCID; then
2163 if test "$with_xaw3d" != no; then
2164 AC_MSG_CHECKING(for xaw3d)
2165 AC_CACHE_VAL(emacs_cv_xaw3d,
2166 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2167 #include <X11/Intrinsic.h>
2168 #include <X11/Xaw3d/Simple.h>]],
2169 [[]])],
2170 [AC_CHECK_LIB(Xaw3d, XawScrollbarSetThumb,
2171 emacs_cv_xaw3d=yes, emacs_cv_xaw3d=no)],
2172 emacs_cv_xaw3d=no)])
2173 else
2174 emacs_cv_xaw3d=no
2175 fi
2176 if test $emacs_cv_xaw3d = yes; then
2177 AC_MSG_RESULT([yes; using Lucid toolkit])
2178 USE_X_TOOLKIT=LUCID
2179 HAVE_XAW3D=yes
2180 LUCID_LIBW=-lXaw3d
2181 AC_DEFINE(HAVE_XAW3D, 1,
2182 [Define to 1 if you have the Xaw3d library (-lXaw3d).])
2183 else
2184 AC_MSG_RESULT(no)
2185 AC_MSG_CHECKING(for libXaw)
2186 AC_CACHE_VAL(emacs_cv_xaw,
2187 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2188 #include <X11/Intrinsic.h>
2189 #include <X11/Xaw/Simple.h>]],
2190 [[]])],
2191 emacs_cv_xaw=yes,
2192 emacs_cv_xaw=no)])
2193 if test $emacs_cv_xaw = yes; then
2194 AC_MSG_RESULT([yes; using Lucid toolkit])
2195 USE_X_TOOLKIT=LUCID
2196 LUCID_LIBW=-lXaw
2197 elif test x"${USE_X_TOOLKIT}" = xLUCID; then
2198 AC_MSG_ERROR([Lucid toolkit requires X11/Xaw include files])
2199 else
2200 AC_MSG_ERROR([No X toolkit could be found.
2201 If you are sure you want Emacs compiled without an X toolkit, pass
2202 --with-x-toolkit=no
2203 to configure. Otherwise, install the development libraries for the toolkit
2204 that you want to use (e.g. Gtk+) and re-run configure.])
2205 fi
2206 fi
2207 fi
2208
2209 X_TOOLKIT_TYPE=$USE_X_TOOLKIT
2210
2211 LIBXTR6=
2212 if test "${USE_X_TOOLKIT}" != "none"; then
2213 AC_MSG_CHECKING(X11 toolkit version)
2214 AC_CACHE_VAL(emacs_cv_x11_toolkit_version_6,
2215 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Intrinsic.h>]],
2216 [[#if XtSpecificationRelease < 6
2217 fail;
2218 #endif
2219 ]])], emacs_cv_x11_toolkit_version_6=yes, emacs_cv_x11_toolkit_version_6=no)])
2220 HAVE_X11XTR6=$emacs_cv_x11_toolkit_version_6
2221 if test $emacs_cv_x11_toolkit_version_6 = yes; then
2222 AC_MSG_RESULT(6 or newer)
2223 AC_DEFINE(HAVE_X11XTR6, 1,
2224 [Define to 1 if you have the X11R6 or newer version of Xt.])
2225 LIBXTR6="-lSM -lICE"
2226 case "$opsys" in
2227 ## Use libw.a along with X11R6 Xt.
2228 unixware) LIBXTR6="$LIBXTR6 -lw" ;;
2229 esac
2230 else
2231 AC_MSG_RESULT(before 6)
2232 fi
2233
2234 dnl If using toolkit, check whether libXmu.a exists.
2235 dnl tranle@intellicorp.com says libXmu.a can need XtMalloc in libXt.a to link.
2236 OLDLIBS="$LIBS"
2237 if test x$HAVE_X11XTR6 = xyes; then
2238 LIBS="-lXt -lSM -lICE $LIBS"
2239 else
2240 LIBS="-lXt $LIBS"
2241 fi
2242 AC_CHECK_LIB(Xmu, XmuConvertStandardSelection)
2243 test $ac_cv_lib_Xmu_XmuConvertStandardSelection = no && LIBS="$OLDLIBS"
2244 fi
2245 AC_SUBST(LIBXTR6)
2246
2247 dnl FIXME the logic here seems weird, but this is what cpp was doing.
2248 dnl Why not just test for libxmu in the normal way?
2249 LIBXMU=-lXmu
2250 case $opsys in
2251 ## These systems don't supply Xmu.
2252 hpux* | aix4-2 )
2253 test "X$ac_cv_lib_Xmu_XmuConvertStandardSelection" != "Xyes" && LIBXMU=
2254 ;;
2255 esac
2256 AC_SUBST(LIBXMU)
2257
2258 # On Irix 6.5, at least, we need XShapeQueryExtension from -lXext for Xaw3D.
2259 if test "${HAVE_X11}" = "yes"; then
2260 if test "${USE_X_TOOLKIT}" != "none"; then
2261 AC_CHECK_LIB(Xext, XShapeQueryExtension)
2262 fi
2263 fi
2264
2265 LIBXP=
2266 if test "${USE_X_TOOLKIT}" = "MOTIF"; then
2267 AC_CACHE_CHECK(for Motif version 2.1, emacs_cv_motif_version_2_1,
2268 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <Xm/Xm.h>]],
2269 [[#if XmVERSION > 2 || (XmVERSION == 2 && XmREVISION >= 1)
2270 int x = 5;
2271 #else
2272 Motif version prior to 2.1.
2273 #endif]])],
2274 emacs_cv_motif_version_2_1=yes, emacs_cv_motif_version_2_1=no)])
2275 if test $emacs_cv_motif_version_2_1 = yes; then
2276 AC_CHECK_LIB(Xp, XpCreateContext, LIBXP=-lXp)
2277 else
2278 AC_CACHE_CHECK(for LessTif where some systems put it, emacs_cv_lesstif,
2279 # We put this in CFLAGS temporarily to precede other -I options
2280 # that might be in CFLAGS temporarily.
2281 # We put this in CPPFLAGS where it precedes the other -I options.
2282 OLD_CPPFLAGS=$CPPFLAGS
2283 OLD_CFLAGS=$CFLAGS
2284 CPPFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $CPPFLAGS"
2285 CFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $CFLAGS"
2286 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include </usr/X11R6/LessTif/Motif1.2/include/Xm/Xm.h>]],
2287 [[int x = 5;]])],
2288 emacs_cv_lesstif=yes, emacs_cv_lesstif=no)])
2289 if test $emacs_cv_lesstif = yes; then
2290 # Make sure this -I option remains in CPPFLAGS after it is set
2291 # back to REAL_CPPFLAGS.
2292 # There is no need to change REAL_CFLAGS, because REAL_CFLAGS does not
2293 # have those other -I options anyway. Ultimately, having this
2294 # directory ultimately in CPPFLAGS will be enough.
2295 REAL_CPPFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $REAL_CPPFLAGS"
2296 LDFLAGS="-L/usr/X11R6/LessTif/Motif1.2/lib $LDFLAGS"
2297 else
2298 CFLAGS=$OLD_CFLAGS
2299 CPPFLAGS=$OLD_CPPFLAGS
2300 fi
2301 fi
2302 AC_CHECK_HEADER([Xm/BulletinB.h], [],
2303 [AC_MSG_ERROR([Motif toolkit requested but requirements not found.])])
2304 fi
2305
2306 dnl Use toolkit scroll bars if configured for GTK or X toolkit and either
2307 dnl using Motif or Xaw3d is available, and unless
2308 dnl --with-toolkit-scroll-bars=no was specified.
2309
2310 AH_TEMPLATE(USE_TOOLKIT_SCROLL_BARS,
2311 [Define to 1 if we should use toolkit scroll bars.])dnl
2312 USE_TOOLKIT_SCROLL_BARS=no
2313 if test "${with_toolkit_scroll_bars}" != "no"; then
2314 if test "${USE_X_TOOLKIT}" != "none"; then
2315 if test "${USE_X_TOOLKIT}" = "MOTIF"; then
2316 AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
2317 HAVE_XAW3D=no
2318 USE_TOOLKIT_SCROLL_BARS=yes
2319 elif test "${HAVE_XAW3D}" = "yes" || test "${USE_X_TOOLKIT}" = "LUCID"; then
2320 AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
2321 USE_TOOLKIT_SCROLL_BARS=yes
2322 fi
2323 elif test "${HAVE_GTK}" = "yes"; then
2324 AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
2325 USE_TOOLKIT_SCROLL_BARS=yes
2326 elif test "${HAVE_NS}" = "yes"; then
2327 AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
2328 USE_TOOLKIT_SCROLL_BARS=yes
2329 fi
2330 fi
2331
2332 dnl See if XIM is available.
2333 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2334 #include <X11/Xlib.h>
2335 #include <X11/Xresource.h>]],
2336 [[XIMProc callback;]])],
2337 [HAVE_XIM=yes
2338 AC_DEFINE(HAVE_XIM, 1, [Define to 1 if XIM is available])],
2339 HAVE_XIM=no)
2340
2341 dnl `--with-xim' now controls only the initial value of use_xim at run time.
2342
2343 if test "${with_xim}" != "no"; then
2344 AC_DEFINE(USE_XIM, 1,
2345 [Define to 1 if we should use XIM, if it is available.])
2346 fi
2347
2348
2349 if test "${HAVE_XIM}" != "no"; then
2350 late_CFLAGS=$CFLAGS
2351 if test "$GCC" = yes; then
2352 CFLAGS="$CFLAGS --pedantic-errors"
2353 fi
2354 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2355 #include <X11/Xlib.h>
2356 #include <X11/Xresource.h>]],
2357 [[Display *display;
2358 XrmDatabase db;
2359 char *res_name;
2360 char *res_class;
2361 XIMProc callback;
2362 XPointer *client_data;
2363 #ifndef __GNUC__
2364 /* If we're not using GCC, it's probably not XFree86, and this is
2365 probably right, but we can't use something like --pedantic-errors. */
2366 extern Bool XRegisterIMInstantiateCallback(Display*, XrmDatabase, char*,
2367 char*, XIMProc, XPointer*);
2368 #endif
2369 (void)XRegisterIMInstantiateCallback(display, db, res_name, res_class, callback,
2370 client_data);]])],
2371 [emacs_cv_arg6_star=yes])
2372 AH_TEMPLATE(XRegisterIMInstantiateCallback_arg6,
2373 [Define to the type of the 6th arg of XRegisterIMInstantiateCallback,
2374 either XPointer or XPointer*.])dnl
2375 if test "$emacs_cv_arg6_star" = yes; then
2376 AC_DEFINE(XRegisterIMInstantiateCallback_arg6, [XPointer*])
2377 else
2378 AC_DEFINE(XRegisterIMInstantiateCallback_arg6, [XPointer])
2379 fi
2380 CFLAGS=$late_CFLAGS
2381 fi
2382
2383 ### Start of font-backend (under any platform) section.
2384 # (nothing here yet -- this is a placeholder)
2385 ### End of font-backend (under any platform) section.
2386
2387 ### Start of font-backend (under X11) section.
2388 if test "${HAVE_X11}" = "yes"; then
2389 PKG_CHECK_MODULES(FONTCONFIG, fontconfig >= 2.2.0, HAVE_FC=yes, HAVE_FC=no)
2390
2391 ## Use -lXft if available, unless `--with-xft=no'.
2392 HAVE_XFT=maybe
2393 if test "${HAVE_FC}" = "no" || test "x${with_x}" = "xno"; then
2394 with_xft="no";
2395 fi
2396 if test "x${with_xft}" != "xno"; then
2397
2398 PKG_CHECK_MODULES(XFT, xft >= 0.13.0, , HAVE_XFT=no)
2399 ## Because xftfont.c uses XRenderQueryExtension, we also
2400 ## need to link to -lXrender.
2401 HAVE_XRENDER=no
2402 AC_CHECK_LIB(Xrender, XRenderQueryExtension, HAVE_XRENDER=yes)
2403 if test "$HAVE_XFT" != no && test "$HAVE_XRENDER" != no; then
2404 OLD_CPPFLAGS="$CPPFLAGS"
2405 OLD_CFLAGS="$CFLAGS"
2406 OLD_LIBS="$LIBS"
2407 CPPFLAGS="$CPPFLAGS $XFT_CFLAGS"
2408 CFLAGS="$CFLAGS $XFT_CFLAGS"
2409 XFT_LIBS="-lXrender $XFT_LIBS"
2410 LIBS="$XFT_LIBS $LIBS"
2411 AC_CHECK_HEADER(X11/Xft/Xft.h,
2412 AC_CHECK_LIB(Xft, XftFontOpen, HAVE_XFT=yes, , $XFT_LIBS))
2413
2414 if test "${HAVE_XFT}" = "yes"; then
2415 AC_DEFINE(HAVE_XFT, 1, [Define to 1 if you have the Xft library.])
2416 AC_SUBST(XFT_LIBS)
2417 C_SWITCH_X_SITE="$C_SWITCH_X_SITE $XFT_CFLAGS"
2418 else
2419 CPPFLAGS="$OLD_CPPFLAGS"
2420 CFLAGS="$OLD_CFLAGS"
2421 LIBS="$OLD_LIBS"
2422 fi # "${HAVE_XFT}" = "yes"
2423 fi # "$HAVE_XFT" != no
2424 fi # "x${with_xft}" != "xno"
2425
2426 ## We used to allow building with FreeType and without Xft.
2427 ## However, the ftx font backend driver is not in good shape.
2428 if test "$HAVE_XFT" != "yes"; then
2429 dnl For the "Does Emacs use" message at the end.
2430 HAVE_XFT=no
2431 HAVE_FREETYPE=no
2432 else
2433 dnl Strict linkers fail with
2434 dnl ftfont.o: undefined reference to symbol 'FT_New_Face'
2435 dnl if -lfreetype is not specified.
2436 dnl The following is needed to set FREETYPE_LIBS.
2437 PKG_CHECK_MODULES(FREETYPE, freetype2, HAVE_FREETYPE=yes,
2438 HAVE_FREETYPE=no)
2439
2440 test "$HAVE_FREETYPE" = "no" && AC_MSG_ERROR(libxft requires libfreetype)
2441 fi
2442
2443 HAVE_LIBOTF=no
2444 if test "${HAVE_FREETYPE}" = "yes"; then
2445 AC_DEFINE(HAVE_FREETYPE, 1,
2446 [Define to 1 if using the freetype and fontconfig libraries.])
2447 if test "${with_libotf}" != "no"; then
2448 PKG_CHECK_MODULES(LIBOTF, libotf, HAVE_LIBOTF=yes,
2449 HAVE_LIBOTF=no)
2450 if test "$HAVE_LIBOTF" = "yes"; then
2451 AC_DEFINE(HAVE_LIBOTF, 1, [Define to 1 if using libotf.])
2452 AC_CHECK_LIB(otf, OTF_get_variation_glyphs,
2453 HAVE_OTF_GET_VARIATION_GLYPHS=yes,
2454 HAVE_OTF_GET_VARIATION_GLYPHS=no)
2455 if test "${HAVE_OTF_GET_VARIATION_GLYPHS}" = "yes"; then
2456 AC_DEFINE(HAVE_OTF_GET_VARIATION_GLYPHS, 1,
2457 [Define to 1 if libotf has OTF_get_variation_glyphs.])
2458 fi
2459 fi
2460 fi
2461 dnl FIXME should there be an error if HAVE_FREETYPE != yes?
2462 dnl Does the new font backend require it, or can it work without it?
2463 fi
2464
2465 HAVE_M17N_FLT=no
2466 if test "${HAVE_LIBOTF}" = yes; then
2467 if test "${with_m17n_flt}" != "no"; then
2468 PKG_CHECK_MODULES(M17N_FLT, m17n-flt, HAVE_M17N_FLT=yes, HAVE_M17N_FLT=no)
2469 if test "$HAVE_M17N_FLT" = "yes"; then
2470 AC_DEFINE(HAVE_M17N_FLT, 1, [Define to 1 if using libm17n-flt.])
2471 fi
2472 fi
2473 fi
2474 else
2475 HAVE_XFT=no
2476 HAVE_FREETYPE=no
2477 HAVE_LIBOTF=no
2478 HAVE_M17N_FLT=no
2479 fi
2480
2481 ### End of font-backend (under X11) section.
2482
2483 AC_SUBST(FREETYPE_CFLAGS)
2484 AC_SUBST(FREETYPE_LIBS)
2485 AC_SUBST(FONTCONFIG_CFLAGS)
2486 AC_SUBST(FONTCONFIG_LIBS)
2487 AC_SUBST(LIBOTF_CFLAGS)
2488 AC_SUBST(LIBOTF_LIBS)
2489 AC_SUBST(M17N_FLT_CFLAGS)
2490 AC_SUBST(M17N_FLT_LIBS)
2491
2492 ### Use -lXpm if available, unless `--with-xpm=no'.
2493 HAVE_XPM=no
2494 LIBXPM=
2495 if test "${HAVE_X11}" = "yes"; then
2496 if test "${with_xpm}" != "no"; then
2497 AC_CHECK_HEADER(X11/xpm.h,
2498 [AC_CHECK_LIB(Xpm, XpmReadFileToPixmap, HAVE_XPM=yes, , -lX11)])
2499 if test "${HAVE_XPM}" = "yes"; then
2500 AC_MSG_CHECKING(for XpmReturnAllocPixels preprocessor define)
2501 AC_EGREP_CPP(no_return_alloc_pixels,
2502 [#include "X11/xpm.h"
2503 #ifndef XpmReturnAllocPixels
2504 no_return_alloc_pixels
2505 #endif
2506 ], HAVE_XPM=no, HAVE_XPM=yes)
2507
2508 if test "${HAVE_XPM}" = "yes"; then
2509 AC_MSG_RESULT(yes)
2510 else
2511 AC_MSG_RESULT(no)
2512 fi
2513 fi
2514 fi
2515
2516 if test "${HAVE_XPM}" = "yes"; then
2517 AC_DEFINE(HAVE_XPM, 1, [Define to 1 if you have the Xpm library (-lXpm).])
2518 LIBXPM=-lXpm
2519 fi
2520 fi
2521 AC_SUBST(LIBXPM)
2522
2523 ### Use -ljpeg if available, unless `--with-jpeg=no'.
2524 HAVE_JPEG=no
2525 LIBJPEG=
2526 if test "${HAVE_X11}" = "yes"; then
2527 if test "${with_jpeg}" != "no"; then
2528 dnl Checking for jpeglib.h can lose because of a redefinition of
2529 dnl HAVE_STDLIB_H.
2530 AC_CHECK_HEADER(jerror.h,
2531 [AC_CHECK_LIB(jpeg, jpeg_destroy_compress, HAVE_JPEG=yes)])
2532 fi
2533
2534 AH_TEMPLATE(HAVE_JPEG, [Define to 1 if you have the jpeg library (-ljpeg).])dnl
2535 if test "${HAVE_JPEG}" = "yes"; then
2536 AC_DEFINE(HAVE_JPEG)
2537 AC_EGREP_CPP([version= *(6[2-9]|[7-9][0-9])],
2538 [#include <jpeglib.h>
2539 version=JPEG_LIB_VERSION
2540 ],
2541 [AC_DEFINE(HAVE_JPEG)],
2542 [AC_MSG_WARN([libjpeg found, but not version 6b or later])
2543 HAVE_JPEG=no])
2544 fi
2545 if test "${HAVE_JPEG}" = "yes"; then
2546 LIBJPEG=-ljpeg
2547 fi
2548 fi
2549 AC_SUBST(LIBJPEG)
2550
2551 ### Use -lpng if available, unless `--with-png=no'.
2552 HAVE_PNG=no
2553 LIBPNG=
2554 if test "${HAVE_X11}" = "yes"; then
2555 if test "${with_png}" != "no"; then
2556 # Debian unstable as of July 2003 has multiple libpngs, and puts png.h
2557 # in /usr/include/libpng.
2558 AC_CHECK_HEADERS(png.h libpng/png.h)
2559 if test "$ac_cv_header_png_h" = yes || test "$ac_cv_header_libpng_png_h" = yes ; then
2560 AC_CHECK_LIB(png, png_get_channels, HAVE_PNG=yes, , -lz -lm)
2561 fi
2562 fi
2563
2564 if test "${HAVE_PNG}" = "yes"; then
2565 AC_DEFINE(HAVE_PNG, 1, [Define to 1 if you have the png library (-lpng).])
2566 LIBPNG="-lpng -lz -lm"
2567 fi
2568 fi
2569 AC_SUBST(LIBPNG)
2570
2571 ### Use -ltiff if available, unless `--with-tiff=no'.
2572 HAVE_TIFF=no
2573 LIBTIFF=
2574 if test "${HAVE_X11}" = "yes"; then
2575 if test "${with_tiff}" != "no"; then
2576 AC_CHECK_HEADER(tiffio.h,
2577 [tifflibs="-lz -lm"
2578 # At least one tiff package requires the jpeg library.
2579 if test "${HAVE_JPEG}" = yes; then tifflibs="-ljpeg $tifflibs"; fi
2580 AC_CHECK_LIB(tiff, TIFFGetVersion, HAVE_TIFF=yes, , $tifflibs)])
2581 fi
2582
2583 if test "${HAVE_TIFF}" = "yes"; then
2584 AC_DEFINE(HAVE_TIFF, 1, [Define to 1 if you have the tiff library (-ltiff).])
2585 dnl FIXME -lz -lm, as per libpng?
2586 LIBTIFF=-ltiff
2587 fi
2588 fi
2589 AC_SUBST(LIBTIFF)
2590
2591 ### Use -lgif or -lungif if available, unless `--with-gif=no'.
2592 HAVE_GIF=no
2593 LIBGIF=
2594 if test "${HAVE_X11}" = "yes" && test "${with_gif}" != "no"; then
2595 AC_CHECK_HEADER(gif_lib.h,
2596 # EGifPutExtensionLast only exists from version libungif-4.1.0b1.
2597 # Earlier versions can crash Emacs.
2598 [AC_CHECK_LIB(gif, EGifPutExtensionLast, HAVE_GIF=yes, HAVE_GIF=maybe)])
2599
2600 if test "$HAVE_GIF" = yes; then
2601 LIBGIF=-lgif
2602 elif test "$HAVE_GIF" = maybe; then
2603 # If gif_lib.h but no libgif, try libungif.
2604 AC_CHECK_LIB(ungif, EGifPutExtensionLast, HAVE_GIF=yes, HAVE_GIF=no)
2605 test "$HAVE_GIF" = yes && LIBGIF=-lungif
2606 fi
2607
2608 if test "${HAVE_GIF}" = "yes"; then
2609 AC_DEFINE(HAVE_GIF, 1, [Define to 1 if you have a gif (or ungif) library.])
2610 fi
2611 fi
2612 AC_SUBST(LIBGIF)
2613
2614 dnl Check for required libraries.
2615 if test "${HAVE_X11}" = "yes"; then
2616 MISSING=""
2617 WITH_NO=""
2618 test "${with_xpm}" != "no" && test "${HAVE_XPM}" != "yes" &&
2619 MISSING="libXpm" && WITH_NO="--with-xpm=no"
2620 test "${with_jpeg}" != "no" && test "${HAVE_JPEG}" != "yes" &&
2621 MISSING="$MISSING libjpeg" && WITH_NO="$WITH_NO --with-jpeg=no"
2622 test "${with_png}" != "no" && test "${HAVE_PNG}" != "yes" &&
2623 MISSING="$MISSING libpng" && WITH_NO="$WITH_NO --with-png=no"
2624 test "${with_gif}" != "no" && test "${HAVE_GIF}" != "yes" &&
2625 MISSING="$MISSING libgif/libungif" && WITH_NO="$WITH_NO --with-gif=no"
2626 test "${with_tiff}" != "no" && test "${HAVE_TIFF}" != "yes" &&
2627 MISSING="$MISSING libtiff" && WITH_NO="$WITH_NO --with-tiff=no"
2628
2629 if test "X${MISSING}" != X; then
2630 AC_MSG_ERROR([The following required libraries were not found:
2631 $MISSING
2632 Maybe some development libraries/packages are missing?
2633 If you don't want to link with them give
2634 $WITH_NO
2635 as options to configure])
2636 fi
2637 fi
2638
2639 ### Use -lgpm if available, unless `--with-gpm=no'.
2640 HAVE_GPM=no
2641 LIBGPM=
2642 if test "${with_gpm}" != "no"; then
2643 AC_CHECK_HEADER(gpm.h,
2644 [AC_CHECK_LIB(gpm, Gpm_Open, HAVE_GPM=yes)])
2645
2646 if test "${HAVE_GPM}" = "yes"; then
2647 AC_DEFINE(HAVE_GPM, 1, [Define to 1 if you have the gpm library (-lgpm).])
2648 LIBGPM=-lgpm
2649 fi
2650 fi
2651 AC_SUBST(LIBGPM)
2652
2653 dnl Check for malloc/malloc.h on darwin
2654 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.])])
2655
2656 GNUSTEP_CFLAGS=
2657 ### Use NeXTstep API to implement GUI.
2658 if test "${HAVE_NS}" = "yes"; then
2659 AC_DEFINE(HAVE_NS, 1, [Define to 1 if you are using the NeXTstep API, either GNUstep or Cocoa on Mac OS X.])
2660 if test "${NS_IMPL_COCOA}" = "yes"; then
2661 AC_DEFINE(NS_IMPL_COCOA, 1, [Define to 1 if you are using NS windowing under MacOS X.])
2662 fi
2663 if test "${NS_IMPL_GNUSTEP}" = "yes"; then
2664 AC_DEFINE(NS_IMPL_GNUSTEP, 1, [Define to 1 if you are using NS windowing under GNUstep.])
2665 # See also .m.o rule in Makefile.in */
2666 # FIXME: are all these flags really needed? Document here why. */
2667 GNUSTEP_CFLAGS="-D_REENTRANT -fPIC -fno-strict-aliasing -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
2668 ## Extra CFLAGS applied to src/*.m files.
2669 GNU_OBJC_CFLAGS="$GNU_OBJC_CFLAGS -fgnu-runtime -Wno-import -fconstant-string-class=NSConstantString -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 -DGSWARN -DGSDIAGNOSE"
2670 fi
2671 # We also have mouse menus.
2672 HAVE_MENUS=yes
2673 OTHER_FILES=ns-app
2674 fi
2675
2676
2677 ### Use session management (-lSM -lICE) if available
2678 HAVE_X_SM=no
2679 LIBXSM=
2680 if test "${HAVE_X11}" = "yes"; then
2681 AC_CHECK_HEADER(X11/SM/SMlib.h,
2682 [AC_CHECK_LIB(SM, SmcOpenConnection, HAVE_X_SM=yes, , -lICE)])
2683
2684 if test "${HAVE_X_SM}" = "yes"; then
2685 AC_DEFINE(HAVE_X_SM, 1, [Define to 1 if you have the SM library (-lSM).])
2686 LIBXSM="-lSM -lICE"
2687 case "$LIBS" in
2688 *-lSM*) ;;
2689 *) LIBS="$LIBXSM $LIBS" ;;
2690 esac
2691 fi
2692 fi
2693 AC_SUBST(LIBXSM)
2694
2695 ### Use libxml (-lxml2) if available
2696 HAVE_LIBXML2=no
2697 if test "${with_xml2}" != "no"; then
2698 ### I'm not sure what the version number should be, so I just guessed.
2699 PKG_CHECK_MODULES(LIBXML2, libxml-2.0 > 2.6.17, HAVE_LIBXML2=yes, HAVE_LIBXML2=no)
2700 if test "${HAVE_LIBXML2}" = "yes"; then
2701 LIBS="$LIBXML2_LIBS $LIBS"
2702 AC_CHECK_LIB(xml2, htmlReadMemory, HAVE_LIBXML2=yes, HAVE_LIBXML2=no)
2703 if test "${HAVE_LIBXML2}" = "yes"; then
2704 AC_DEFINE(HAVE_LIBXML2, 1, [Define to 1 if you have the libxml library (-lxml2).])
2705 else
2706 LIBXML2_LIBS=""
2707 LIBXML2_CFLAGS=""
2708 fi
2709 fi
2710 fi
2711 AC_SUBST(LIBXML2_LIBS)
2712 AC_SUBST(LIBXML2_CFLAGS)
2713
2714 # If netdb.h doesn't declare h_errno, we must declare it by hand.
2715 AC_CACHE_CHECK(whether netdb declares h_errno,
2716 emacs_cv_netdb_declares_h_errno,
2717 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]],
2718 [[return h_errno;]])],
2719 emacs_cv_netdb_declares_h_errno=yes, emacs_cv_netdb_declares_h_errno=no)])
2720 if test $emacs_cv_netdb_declares_h_errno = yes; then
2721 AC_DEFINE(HAVE_H_ERRNO, 1, [Define to 1 if netdb.h declares h_errno.])
2722 fi
2723
2724 # fmod, logb, and frexp are found in -lm on most systems.
2725 # On HPUX 9.01, -lm does not contain logb, so check for sqrt.
2726 AC_CHECK_LIB(m, sqrt)
2727
2728 # Check for mail-locking functions in a "mail" library. Probably this should
2729 # have the same check as for liblockfile below.
2730 AC_CHECK_LIB(mail, maillock, have_mail=yes, have_mail=no)
2731 if test $have_mail = yes; then
2732 LIBS_MAIL=-lmail
2733 LIBS="$LIBS_MAIL $LIBS"
2734 AC_DEFINE(HAVE_LIBMAIL, 1, [Define to 1 if you have the `mail' library (-lmail).])
2735 else
2736 LIBS_MAIL=
2737 fi
2738 dnl Debian, at least:
2739 AC_CHECK_LIB(lockfile, maillock, have_lockfile=yes, have_lockfile=no)
2740 if test $have_lockfile = yes; then
2741 LIBS_MAIL=-llockfile
2742 LIBS="$LIBS_MAIL $LIBS"
2743 AC_DEFINE(HAVE_LIBLOCKFILE, 1, [Define to 1 if you have the `lockfile' library (-llockfile).])
2744 else
2745 # If we have the shared liblockfile, assume we must use it for mail
2746 # locking (e.g. Debian). If we couldn't link against liblockfile
2747 # (no liblockfile.a installed), ensure that we don't need to.
2748 dnl This works for files generally, not just executables.
2749 dnl Should we look elsewhere for it? Maybe examine /etc/ld.so.conf?
2750 AC_CHECK_PROG(liblockfile, liblockfile.so, yes, no,
2751 /usr/lib:/lib:/usr/local/lib:$LD_LIBRARY_PATH)
2752 if test $ac_cv_prog_liblockfile = yes; then
2753 AC_MSG_ERROR([Shared liblockfile found but can't link against it.
2754 This probably means that movemail could lose mail.
2755 There may be a `development' package to install containing liblockfile.])
2756 fi
2757 fi
2758 AC_CHECK_FUNCS(touchlock)
2759 AC_CHECK_HEADERS(maillock.h)
2760 AC_SUBST(LIBS_MAIL)
2761
2762 ## Define MAIL_USE_FLOCK (or LOCKF) if the mailer uses flock (or lockf) to
2763 ## interlock access to the mail spool. The alternative is a lock file named
2764 ## /usr/spool/mail/$USER.lock.
2765 mail_lock=no
2766 case "$opsys" in
2767 aix4-2) mail_lock="lockf" ;;
2768
2769 gnu|freebsd|netbsd|openbsd|darwin|irix6-5) mail_lock="flock" ;;
2770
2771 ## On GNU/Linux systems, both methods are used by various mail programs.
2772 ## I assume most people are using newer mailers that have heard of flock.
2773 ## Change this if you need to.
2774 ## Debian contains a patch which says: ``On Debian/GNU/Linux systems,
2775 ## configure gets the right answers, and that means *NOT* using flock.
2776 ## Using flock is guaranteed to be the wrong thing. See Debian Policy
2777 ## for details.'' and then uses `#ifdef DEBIAN'. Unfortunately the
2778 ## Debian maintainer hasn't provided a clean fix for Emacs.
2779 ## movemail.c will use `maillock' when MAILDIR, HAVE_LIBMAIL and
2780 ## HAVE_MAILLOCK_H are defined, so the following appears to be the
2781 ## correct logic. -- fx
2782 ## We must check for HAVE_LIBLOCKFILE too, as movemail does.
2783 ## liblockfile is a Free Software replacement for libmail, used on
2784 ## Debian systems and elsewhere. -rfr.
2785 gnu-*)
2786 mail_lock="flock"
2787 if test $have_mail = yes || test $have_lockfile = yes; then
2788 test $ac_cv_header_maillock_h = yes && mail_lock=no
2789 fi
2790 ;;
2791 esac
2792
2793 BLESSMAIL_TARGET=
2794 case "$mail_lock" in
2795 flock) AC_DEFINE(MAIL_USE_FLOCK, 1, [Define if the mailer uses flock to interlock the mail spool.]) ;;
2796
2797 lockf) AC_DEFINE(MAIL_USE_LOCKF, 1, [Define if the mailer uses lockf to interlock the mail spool.]) ;;
2798
2799 *) BLESSMAIL_TARGET="need-blessmail" ;;
2800 esac
2801 AC_SUBST(BLESSMAIL_TARGET)
2802
2803
2804 AC_CHECK_FUNCS(gethostname \
2805 rename closedir mkdir rmdir sysinfo getrusage get_current_dir_name \
2806 random lrand48 logb frexp fmod rint cbrt setsid \
2807 strerror fpathconf select euidaccess getpagesize tzset setlocale \
2808 utimes getrlimit setrlimit setpgid getcwd getwd shutdown getaddrinfo \
2809 __fpending strsignal setitimer \
2810 sendto recvfrom getsockname getpeername \
2811 gai_strerror mkstemp getline getdelim fsync sync \
2812 difftime posix_memalign \
2813 getpwent endpwent getgrent endgrent \
2814 cfmakeraw cfsetspeed copysign __executable_start)
2815
2816 dnl Cannot use AC_CHECK_FUNCS
2817 AC_CACHE_CHECK([for __builtin_unwind_init],
2818 emacs_cv_func___builtin_unwind_init,
2819 [AC_LINK_IFELSE([AC_LANG_PROGRAM([], [__builtin_unwind_init ();])],
2820 emacs_cv_func___builtin_unwind_init=yes,
2821 emacs_cv_func___builtin_unwind_init=no)])
2822 if test $emacs_cv_func___builtin_unwind_init = yes; then
2823 AC_DEFINE(HAVE___BUILTIN_UNWIND_INIT, 1,
2824 [Define to 1 if you have the `__builtin_unwind_init' function.])
2825 fi
2826
2827 AC_CHECK_HEADERS(sys/un.h)
2828
2829 AC_FUNC_FSEEKO
2830
2831 AC_FUNC_GETPGRP
2832
2833 # UNIX98 PTYs.
2834 AC_CHECK_FUNCS(grantpt)
2835
2836 # PTY-related GNU extensions.
2837 AC_CHECK_FUNCS(getpt)
2838
2839 # Check this now, so that we will NOT find the above functions in ncurses.
2840 # That is because we have not set up to link ncurses in lib-src.
2841 # It's better to believe a function is not available
2842 # than to expect to find it in ncurses.
2843 # Also we need tputs and friends to be able to build at all.
2844 AC_MSG_CHECKING([for library containing tputs])
2845 # Run a test program that contains a call to tputs, a call that is
2846 # never executed. This tests whether a pre-'main' dynamic linker
2847 # works with the library. It's too much trouble to actually call
2848 # tputs in the test program, due to portability hassles. When
2849 # cross-compiling, assume the test program will run if it links.
2850 AC_DEFUN([tputs_link_source], [
2851 AC_LANG_SOURCE(
2852 [[extern void tputs (const char *, int, int (*)(int));
2853 int main (int argc, char **argv)
2854 {
2855 if (argc == 10000)
2856 tputs (argv[0], 0, 0);
2857 return 0;
2858 }]])
2859 ])
2860 # Maybe curses should be tried earlier?
2861 # See http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9736#35
2862 for tputs_library in '' tinfo ncurses terminfo termcap curses; do
2863 OLIBS=$LIBS
2864 if test -z "$tputs_library"; then
2865 LIBS_TERMCAP=
2866 msg='none required'
2867 else
2868 LIBS_TERMCAP=-l$tputs_library
2869 msg=$LIBS_TERMCAP
2870 LIBS="$LIBS_TERMCAP $LIBS"
2871 fi
2872 AC_RUN_IFELSE([tputs_link_source], [], [msg=no],
2873 [AC_LINK_IFELSE([tputs_link_source], [], [msg=no])])
2874 LIBS=$OLIBS
2875 if test "X$msg" != Xno; then
2876 break
2877 fi
2878 done
2879 AC_MSG_RESULT([$msg])
2880 if test "X$msg" = Xno; then
2881 AC_MSG_ERROR([The required function `tputs' was not found in any library.
2882 The following libraries were tried (in order):
2883 libtinfo, libncurses, libterminfo, libtermcap, libcurses
2884 Please try installing whichever of these libraries is most appropriate
2885 for your system, together with its header files.
2886 For example, a libncurses-dev(el) or similar package.])
2887 fi
2888
2889 ## Use termcap instead of terminfo?
2890 ## Only true for: freebsd < 40000, ms-w32, msdos, netbsd < 599002500.
2891 TERMINFO=yes
2892 ## FIXME? In the cases below where we unconditionally set
2893 ## LIBS_TERMCAP="-lncurses", this overrides LIBS_TERMCAP = -ltinfo,
2894 ## if that was found above to have tputs.
2895 ## Should we use the gnu* logic everywhere?
2896 case "$opsys" in
2897 ## darwin: Prevents crashes when running Emacs in Terminal.app under 10.2.
2898 ## The ncurses library has been moved out of the System framework in
2899 ## Mac OS X 10.2. So if configure detects it, set the command-line
2900 ## option to use it.
2901 darwin) LIBS_TERMCAP="-lncurses" ;;
2902
2903 gnu*) test -z "$LIBS_TERMCAP" && LIBS_TERMCAP="-lncurses" ;;
2904
2905 freebsd)
2906 AC_MSG_CHECKING([whether FreeBSD is new enough to use terminfo])
2907 AC_CACHE_VAL(emacs_cv_freebsd_terminfo,
2908 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <osreldate.h>]],
2909 [[#if __FreeBSD_version < 400000
2910 fail;
2911 #endif
2912 ]])], emacs_cv_freebsd_terminfo=yes, emacs_cv_freebsd_terminfo=no)])
2913
2914 AC_MSG_RESULT($emacs_cv_freebsd_terminfo)
2915
2916 if test $emacs_cv_freebsd_terminfo = yes; then
2917 LIBS_TERMCAP="-lncurses"
2918 else
2919 TERMINFO=no
2920 LIBS_TERMCAP="-ltermcap"
2921 fi
2922 ;;
2923
2924 netbsd)
2925 if test "x$LIBS_TERMCAP" != "x-lterminfo"; then
2926 TERMINFO=no
2927 LIBS_TERMCAP="-ltermcap"
2928 fi
2929 ;;
2930
2931 openbsd) LIBS_TERMCAP="-lncurses" ;;
2932
2933 ## hpux: Make sure we get select from libc rather than from libcurses
2934 ## because libcurses on HPUX 10.10 has a broken version of select.
2935 ## We used to use -lc -lcurses, but this may be cleaner.
2936 ## FIXME? But TERMINFO = yes on hpux (it used to be explicitly
2937 # set that way, now it uses the default). Isn't this a contradiction?
2938 hpux*) LIBS_TERMCAP="-ltermcap" ;;
2939
2940 esac
2941
2942 TERMCAP_OBJ=tparam.o
2943 if test $TERMINFO = yes; then
2944 AC_DEFINE(TERMINFO, 1, [Define to 1 if you use terminfo instead of termcap.])
2945 TERMCAP_OBJ=terminfo.o
2946 fi
2947 AC_SUBST(LIBS_TERMCAP)
2948 AC_SUBST(TERMCAP_OBJ)
2949
2950
2951 # Do we have res_init, for detecting changes in /etc/resolv.conf?
2952 resolv=no
2953 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netinet/in.h>
2954 #include <arpa/nameser.h>
2955 #include <resolv.h>]],
2956 [[return res_init();]])],
2957 have_res_init=yes, have_res_init=no)
2958 if test "$have_res_init" = no; then
2959 OLIBS="$LIBS"
2960 LIBS="$LIBS -lresolv"
2961 AC_MSG_CHECKING(for res_init with -lresolv)
2962 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netinet/in.h>
2963 #include <arpa/nameser.h>
2964 #include <resolv.h>]],
2965 [[return res_init();]])],
2966 have_res_init=yes, have_res_init=no)
2967 AC_MSG_RESULT($have_res_init)
2968 if test "$have_res_init" = yes ; then
2969 resolv=yes
2970 fi
2971 LIBS="$OLIBS"
2972 fi
2973
2974 if test "$have_res_init" = yes; then
2975 AC_DEFINE(HAVE_RES_INIT, 1, [Define to 1 if res_init is available.])
2976 fi
2977
2978 # Do we need the Hesiod library to provide the support routines?
2979 LIBHESIOD=
2980 if test "$with_hesiod" != no ; then
2981 # Don't set $LIBS here -- see comments above. FIXME which comments?
2982 AC_CHECK_FUNC(res_send, , [AC_CHECK_FUNC(__res_send, ,
2983 [AC_CHECK_LIB(resolv, res_send, resolv=yes,
2984 [AC_CHECK_LIB(resolv, __res_send, resolv=yes)])])])
2985 if test "$resolv" = yes ; then
2986 RESOLVLIB=-lresolv
2987 else
2988 RESOLVLIB=
2989 fi
2990 AC_CHECK_FUNC(hes_getmailhost, , [AC_CHECK_LIB(hesiod, hes_getmailhost,
2991 hesiod=yes, :, $RESOLVLIB)])
2992
2993 if test x"$hesiod" = xyes; then
2994 AC_DEFINE(HAVE_LIBHESIOD, 1,
2995 [Define to 1 if you have the hesiod library (-lhesiod).])
2996 LIBHESIOD=-lhesiod
2997 fi
2998 fi
2999 AC_SUBST(LIBHESIOD)
3000
3001 # Do we need libresolv (due to res_init or Hesiod)?
3002 if test "$resolv" = yes ; then
3003 AC_DEFINE(HAVE_LIBRESOLV, 1,
3004 [Define to 1 if you have the resolv library (-lresolv).])
3005 LIBRESOLV=-lresolv
3006 else
3007 LIBRESOLV=
3008 fi
3009 AC_SUBST(LIBRESOLV)
3010
3011 # These tell us which Kerberos-related libraries to use.
3012 COM_ERRLIB=
3013 CRYPTOLIB=
3014 KRB5LIB=
3015 DESLIB=
3016 KRB4LIB=
3017
3018 if test "${with_kerberos}" != no; then
3019 AC_CHECK_LIB(com_err, com_err, have_com_err=yes, have_com_err=no)
3020 if test $have_com_err = yes; then
3021 COM_ERRLIB=-lcom_err
3022 LIBS="$COM_ERRLIB $LIBS"
3023 AC_DEFINE(HAVE_LIBCOM_ERR, 1, [Define to 1 if you have the `com_err' library (-lcom_err).])
3024 fi
3025 AC_CHECK_LIB(crypto, mit_des_cbc_encrypt, have_crypto=yes, have_crypto=no)
3026 if test $have_crypto = yes; then
3027 CRYPTOLIB=-lcrypto
3028 LIBS="$CRYPTOLIB $LIBS"
3029 AC_DEFINE(HAVE_LIBCRYPTO, 1, [Define to 1 if you have the `crypto' library (-lcrypto).])
3030 fi
3031 AC_CHECK_LIB(k5crypto, mit_des_cbc_encrypt, have_k5crypto=yes, have_k5crypto=no)
3032 if test $have_k5crypto = yes; then
3033 CRYPTOLIB=-lk5crypto
3034 LIBS="$CRYPTOLIB $LIBS"
3035 AC_DEFINE(HAVE_LIBK5CRYPTO, 1, [Define to 1 if you have the `k5crypto' library (-lk5crypto).])
3036 fi
3037 AC_CHECK_LIB(krb5, krb5_init_context, have_krb5=yes, have_krb5=no)
3038 if test $have_krb5=yes; then
3039 KRB5LIB=-lkrb5
3040 LIBS="$KRB5LIB $LIBS"
3041 AC_DEFINE(HAVE_LIBKRB5, 1, [Define to 1 if you have the `krb5' library (-lkrb5).])
3042 fi
3043 dnl FIXME Simplify. Does not match 22 logic, thanks to default_off?
3044 if test "${with_kerberos5}" = no; then
3045 AC_CHECK_LIB(des425, des_cbc_encrypt, have_des425=yes, have_des425=no )
3046 if test $have_des425 = yes; then
3047 DESLIB=-ldes425
3048 LIBS="$DESLIB $LIBS"
3049 AC_DEFINE(HAVE_LIBDES425, 1, [Define to 1 if you have the `des425' library (-ldes425).])
3050 else
3051 AC_CHECK_LIB(des, des_cbc_encrypt, have_des=yes, have_des=no)
3052 if test $have_des = yes; then
3053 DESLIB=-ldes
3054 LIBS="$DESLIB $LIBS"
3055 AC_DEFINE(HAVE_LIBDES, 1, [Define to 1 if you have the `des' library (-ldes).])
3056 fi
3057 fi
3058 AC_CHECK_LIB(krb4, krb_get_cred, have_krb4=yes, have_krb4=no)
3059 if test $have_krb4 = yes; then
3060 KRB4LIB=-lkrb4
3061 LIBS="$KRB4LIB $LIBS"
3062 AC_DEFINE(HAVE_LIBKRB4, 1, [Define to 1 if you have the `krb4' library (-lkrb4).])
3063 else
3064 AC_CHECK_LIB(krb, krb_get_cred, have_krb=yes, have_krb=no)
3065 if test $have_krb = yes; then
3066 KRB4LIB=-lkrb
3067 LIBS="$KRB4LIB $LIBS"
3068 AC_DEFINE(HAVE_LIBKRB, 1, [Define to 1 if you have the `krb' library (-lkrb).])
3069 fi
3070 fi
3071 fi
3072
3073 if test "${with_kerberos5}" != no; then
3074 AC_CHECK_HEADERS(krb5.h,
3075 [AC_CHECK_MEMBERS([krb5_error.text, krb5_error.e_text],,,
3076 [#include <krb5.h>])])
3077 else
3078 AC_CHECK_HEADERS(des.h,,
3079 [AC_CHECK_HEADERS(kerberosIV/des.h,,
3080 [AC_CHECK_HEADERS(kerberos/des.h)])])
3081 AC_CHECK_HEADERS(krb.h,,
3082 [AC_CHECK_HEADERS(kerberosIV/krb.h,,
3083 [AC_CHECK_HEADERS(kerberos/krb.h)])])
3084 fi
3085 AC_CHECK_HEADERS(com_err.h)
3086 fi
3087
3088 AC_SUBST(COM_ERRLIB)
3089 AC_SUBST(CRYPTOLIB)
3090 AC_SUBST(KRB5LIB)
3091 AC_SUBST(DESLIB)
3092 AC_SUBST(KRB4LIB)
3093
3094 AC_MSG_CHECKING(whether localtime caches TZ)
3095 AC_CACHE_VAL(emacs_cv_localtime_cache,
3096 [if test x$ac_cv_func_tzset = xyes; then
3097 AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <time.h>
3098 char TZ_GMT0[] = "TZ=GMT0";
3099 char TZ_PST8[] = "TZ=PST8";
3100 main()
3101 {
3102 time_t now = time ((time_t *) 0);
3103 int hour_GMT0, hour_unset;
3104 if (putenv (TZ_GMT0) != 0)
3105 exit (1);
3106 hour_GMT0 = localtime (&now)->tm_hour;
3107 unsetenv("TZ");
3108 hour_unset = localtime (&now)->tm_hour;
3109 if (putenv (TZ_PST8) != 0)
3110 exit (1);
3111 if (localtime (&now)->tm_hour == hour_GMT0)
3112 exit (1);
3113 unsetenv("TZ");
3114 if (localtime (&now)->tm_hour != hour_unset)
3115 exit (1);
3116 exit (0);
3117 }]])], emacs_cv_localtime_cache=no, emacs_cv_localtime_cache=yes,
3118 [# If we have tzset, assume the worst when cross-compiling.
3119 emacs_cv_localtime_cache=yes])
3120 else
3121 # If we lack tzset, report that localtime does not cache TZ,
3122 # since we can't invalidate the cache if we don't have tzset.
3123 emacs_cv_localtime_cache=no
3124 fi])dnl
3125 AC_MSG_RESULT($emacs_cv_localtime_cache)
3126 if test $emacs_cv_localtime_cache = yes; then
3127 AC_DEFINE(LOCALTIME_CACHE, 1,
3128 [Define to 1 if localtime caches TZ.])
3129 fi
3130
3131 if test "x$HAVE_TIMEVAL" = xyes; then
3132 AC_CHECK_FUNCS(gettimeofday)
3133 if test $ac_cv_func_gettimeofday = yes; then
3134 AC_CACHE_CHECK(whether gettimeofday can accept two arguments,
3135 emacs_cv_gettimeofday_two_arguments,
3136 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3137 #ifdef TIME_WITH_SYS_TIME
3138 #include <sys/time.h>
3139 #include <time.h>
3140 #else
3141 #ifdef HAVE_SYS_TIME_H
3142 #include <sys/time.h>
3143 #else
3144 #include <time.h>
3145 #endif
3146 #endif]],
3147 [[struct timeval time;
3148 gettimeofday (&time, 0);]])],
3149 emacs_cv_gettimeofday_two_arguments=yes,
3150 emacs_cv_gettimeofday_two_arguments=no)])
3151 if test $emacs_cv_gettimeofday_two_arguments = no; then
3152 AC_DEFINE(GETTIMEOFDAY_ONE_ARGUMENT, 1,
3153 [Define to 1 if gettimeofday accepts only one argument.])
3154 fi
3155 fi
3156 fi
3157
3158 ok_so_far=yes
3159 AC_CHECK_FUNC(socket, , ok_so_far=no)
3160 if test $ok_so_far = yes; then
3161 AC_CHECK_HEADER(netinet/in.h, , ok_so_far=no)
3162 fi
3163 if test $ok_so_far = yes; then
3164 AC_CHECK_HEADER(arpa/inet.h, , ok_so_far=no)
3165 fi
3166 if test $ok_so_far = yes; then
3167 dnl Fixme: Not used. Should this be HAVE_SOCKETS?
3168 AC_DEFINE(HAVE_INET_SOCKETS, 1,
3169 [Define to 1 if you have inet sockets.])
3170 fi
3171
3172 if test -f /usr/lpp/X11/bin/smt.exp; then
3173 AC_DEFINE(HAVE_AIX_SMT_EXP, 1,
3174 [Define to 1 if the file /usr/lpp/X11/bin/smt.exp exists.])
3175 fi
3176
3177 AC_MSG_CHECKING(whether system supports dynamic ptys)
3178 if test -d /dev/pts && ls -d /dev/ptmx > /dev/null 2>&1 ; then
3179 AC_MSG_RESULT(yes)
3180 AC_DEFINE(HAVE_DEV_PTMX, 1, [Define to 1 if dynamic ptys are supported.])
3181 else
3182 AC_MSG_RESULT(no)
3183 fi
3184
3185 AC_FUNC_FORK
3186
3187 AC_CHECK_FUNCS(snprintf)
3188
3189 dnl Adapted from Haible's version.
3190 AC_CACHE_CHECK([for nl_langinfo and CODESET], emacs_cv_langinfo_codeset,
3191 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]],
3192 [[char* cs = nl_langinfo(CODESET);]])],
3193 emacs_cv_langinfo_codeset=yes,
3194 emacs_cv_langinfo_codeset=no)
3195 ])
3196 if test $emacs_cv_langinfo_codeset = yes; then
3197 AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
3198 [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
3199 fi
3200
3201 AC_TYPE_MBSTATE_T
3202
3203 AC_CACHE_CHECK([for C restricted array declarations], emacs_cv_c_restrict_arr,
3204 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[void fred (int x[__restrict]);]], [[]])],
3205 emacs_cv_c_restrict_arr=yes, emacs_cv_c_restrict_arr=no)])
3206 if test "$emacs_cv_c_restrict_arr" = yes; then
3207 AC_DEFINE(__restrict_arr, __restrict,
3208 [Define to compiler's equivalent of C99 restrict keyword in array
3209 declarations. Define as empty for no equivalent.])
3210 fi
3211
3212 dnl Fixme: AC_SYS_POSIX_TERMIOS should probably be used, but it's not clear
3213 dnl how the tty code is related to POSIX and/or other versions of termios.
3214 dnl The following looks like a useful start.
3215 dnl
3216 dnl AC_SYS_POSIX_TERMIOS
3217 dnl if test $ac_cv_sys_posix_termios = yes; then
3218 dnl AC_DEFINE(HAVE_TERMIOS, 1, [Define to 1 if you have POSIX-style functions
3219 dnl and macros for terminal control.])
3220 dnl AC_DEFINE(HAVE_TCATTR, 1, [Define to 1 if you have tcgetattr and tcsetattr.])
3221 dnl fi
3222
3223 # Set up the CFLAGS for real compilation, so we can substitute it.
3224 CFLAGS="$REAL_CFLAGS"
3225 CPPFLAGS="$REAL_CPPFLAGS"
3226
3227 ## Hack to detect a buggy GCC version.
3228 if test "x$GCC" = xyes \
3229 && test x"`$CC --version 2> /dev/null | grep 'gcc.* 4.5.0'`" != x \
3230 && test x"`echo $CFLAGS | grep '\-O@<:@23@:>@'`" != x \
3231 && test x"`echo $CFLAGS | grep '\-fno-optimize-sibling-calls'`" = x; then
3232 AC_MSG_ERROR([GCC 4.5.0 has problems compiling Emacs; see etc/PROBLEMS'.])
3233 fi
3234
3235 version=$PACKAGE_VERSION
3236
3237 ### Specify what sort of things we'll be editing into Makefile and config.h.
3238 ### Use configuration here uncanonicalized to avoid exceeding size limits.
3239 AC_SUBST(version)
3240 AC_SUBST(configuration)
3241 ## Unused?
3242 AC_SUBST(canonical)
3243 AC_SUBST(srcdir)
3244 AC_SUBST(prefix)
3245 AC_SUBST(exec_prefix)
3246 AC_SUBST(bindir)
3247 AC_SUBST(datadir)
3248 AC_SUBST(sharedstatedir)
3249 AC_SUBST(libexecdir)
3250 AC_SUBST(mandir)
3251 AC_SUBST(infodir)
3252 AC_SUBST(lispdir)
3253 AC_SUBST(leimdir)
3254 AC_SUBST(locallisppath)
3255 AC_SUBST(lisppath)
3256 AC_SUBST(x_default_search_path)
3257 AC_SUBST(etcdir)
3258 AC_SUBST(archlibdir)
3259 AC_SUBST(docdir)
3260 AC_SUBST(bitmapdir)
3261 AC_SUBST(gamedir)
3262 AC_SUBST(gameuser)
3263 ## FIXME? Nothing uses @LD_SWITCH_X_SITE@.
3264 ## src/Makefile.in did add LD_SWITCH_X_SITE (as a cpp define) to the
3265 ## end of LIBX_BASE, but nothing ever set it.
3266 AC_SUBST(LD_SWITCH_X_SITE)
3267 AC_SUBST(C_SWITCH_X_SITE)
3268 AC_SUBST(GNUSTEP_CFLAGS)
3269 AC_SUBST(CFLAGS)
3270 ## Used in lwlib/Makefile.in.
3271 AC_SUBST(X_TOOLKIT_TYPE)
3272 if test -n "${machfile}"; then
3273 M_FILE="\$(srcdir)/${machfile}"
3274 else
3275 M_FILE=
3276 fi
3277 S_FILE="\$(srcdir)/${opsysfile}"
3278 AC_SUBST(M_FILE)
3279 AC_SUBST(S_FILE)
3280 AC_SUBST(ns_appdir)
3281 AC_SUBST(ns_appbindir)
3282 AC_SUBST(ns_appresdir)
3283 AC_SUBST(ns_appsrc)
3284 AC_SUBST(GNU_OBJC_CFLAGS)
3285 AC_SUBST(OTHER_FILES)
3286
3287 AC_DEFINE_UNQUOTED(EMACS_CONFIGURATION, "${canonical}",
3288 [Define to the canonical Emacs configuration name.])
3289 AC_DEFINE_UNQUOTED(EMACS_CONFIG_OPTIONS, "${ac_configure_args}",
3290 [Define to the options passed to configure.])
3291 if test -n "$machfile"; then
3292 AC_DEFINE_UNQUOTED(config_machfile, "${machfile}",
3293 [Define to the used machine dependent file.])
3294 fi
3295 AC_DEFINE_UNQUOTED(config_opsysfile, "${opsysfile}",
3296 [Define to the used os dependent file.])
3297
3298 XMENU_OBJ=
3299 XOBJ=
3300 FONT_OBJ=
3301 if test "${HAVE_X_WINDOWS}" = "yes" ; then
3302 AC_DEFINE(HAVE_X_WINDOWS, 1,
3303 [Define to 1 if you want to use the X window system.])
3304 XMENU_OBJ=xmenu.o
3305 XOBJ="xterm.o xfns.o xselect.o xrdb.o fontset.o xsmfns.o fringe.o image.o xsettings.o xgselect.o"
3306 FONT_OBJ=xfont.o
3307 if test "$HAVE_XFT" = "yes"; then
3308 FONT_OBJ="$FONT_OBJ ftfont.o xftfont.o ftxfont.o"
3309 elif test "$HAVE_FREETYPE" = "yes"; then
3310 FONT_OBJ="$FONT_OBJ ftfont.o ftxfont.o"
3311 fi
3312 AC_SUBST(FONT_OBJ)
3313 fi
3314 AC_SUBST(XMENU_OBJ)
3315 AC_SUBST(XOBJ)
3316 AC_SUBST(FONT_OBJ)
3317
3318 WIDGET_OBJ=
3319 MOTIF_LIBW=
3320 if test "${USE_X_TOOLKIT}" != "none" ; then
3321 WIDGET_OBJ=widget.o
3322 AC_DEFINE(USE_X_TOOLKIT, 1, [Define to 1 if using an X toolkit.])
3323 if test "${USE_X_TOOLKIT}" = "LUCID"; then
3324 AC_DEFINE(USE_LUCID, 1, [Define to 1 if using the Lucid X toolkit.])
3325 elif test "${USE_X_TOOLKIT}" = "MOTIF"; then
3326 AC_DEFINE(USE_MOTIF, 1, [Define to 1 if using the Motif X toolkit.])
3327 MOTIF_LIBW=-lXm
3328 case "$opsys" in
3329 gnu-linux)
3330 ## Paul Abrahams <abrahams at equinox.shaysnet.com> says this is needed.
3331 MOTIF_LIBW="$MOTIF_LIBW -lXpm"
3332 ;;
3333
3334 unixware)
3335 ## Richard Anthony Ryan <ryanr at ellingtn.ftc.nrcs.usda.gov>
3336 ## says -lXimp is needed in UNIX_SV ... 4.2 1.1.2.
3337 MOTIF_LIBW="MOTIF_LIBW -lXimp"
3338 ;;
3339
3340 aix4-2)
3341 ## olson@mcs.anl.gov says -li18n is needed by -lXm.
3342 MOTIF_LIBW="$MOTIF_LIBW -li18n"
3343 ;;
3344 esac
3345 MOTIF_LIBW="$MOTIF_LIBW $LIBXP"
3346 fi
3347 fi
3348 AC_SUBST(WIDGET_OBJ)
3349
3350 TOOLKIT_LIBW=
3351 case "$USE_X_TOOLKIT" in
3352 MOTIF) TOOLKIT_LIBW="$MOTIF_LIBW" ;;
3353 LUCID) TOOLKIT_LIBW="$LUCID_LIBW" ;;
3354 none) test "x$HAVE_GTK" = "xyes" && TOOLKIT_LIBW="$GTK_LIBS -lXcomposite" ;;
3355 esac
3356 AC_SUBST(TOOLKIT_LIBW)
3357
3358 if test "$USE_X_TOOLKIT" = "none"; then
3359 LIBXT_OTHER="\$(LIBXSM)"
3360 OLDXMENU_TARGET="really-oldXMenu"
3361 else
3362 LIBXT_OTHER="\$(LIBXMU) -lXt \$(LIBXTR6) -lXext"
3363 OLDXMENU_TARGET="really-lwlib"
3364 fi
3365 AC_SUBST(LIBXT_OTHER)
3366
3367 ## The X Menu stuff is present in the X10 distribution, but missing
3368 ## from X11. If we have X10, just use the installed library;
3369 ## otherwise, use our own copy.
3370 if test "${HAVE_X11}" = "yes" ; then
3371 AC_DEFINE(HAVE_X11, 1,
3372 [Define to 1 if you want to use version 11 of X windows.
3373 Otherwise, Emacs expects to use version 10.])
3374
3375 if test "$USE_X_TOOLKIT" = "none"; then
3376 OLDXMENU="\${oldXMenudir}/libXMenu11.a"
3377 else
3378 OLDXMENU="\${lwlibdir}/liblw.a"
3379 fi
3380 LIBXMENU="\$(OLDXMENU)"
3381 LIBX_OTHER="\$(LIBXT) \$(LIBX_EXTRA)"
3382 OLDXMENU_DEPS="\${OLDXMENU} ../src/\${OLDXMENU}"
3383 else
3384 ## For a syntactically valid Makefile; not actually used for anything.
3385 ## See comments in src/Makefile.in.
3386 OLDXMENU=nothing
3387 ## FIXME This case (!HAVE_X11 && HAVE_X_WINDOWS) is no longer possible(?).
3388 if test "${HAVE_X_WINDOWS}" = "yes"; then
3389 LIBXMENU="-lXMenu"
3390 else
3391 LIBXMENU=
3392 fi
3393 LIBX_OTHER=
3394 OLDXMENU_DEPS=
3395 fi
3396
3397 if test "$HAVE_GTK" = "yes" || test "$HAVE_MENUS" != "yes"; then
3398 OLDXMENU_TARGET=
3399 OLDXMENU=nothing
3400 LIBXMENU=
3401 OLDXMENU_DEPS=
3402 fi
3403
3404 AC_SUBST(OLDXMENU_TARGET)
3405 AC_SUBST(OLDXMENU)
3406 AC_SUBST(LIBXMENU)
3407 AC_SUBST(LIBX_OTHER)
3408 AC_SUBST(OLDXMENU_DEPS)
3409
3410 if test "${HAVE_MENUS}" = "yes" ; then
3411 AC_DEFINE(HAVE_MENUS, 1,
3412 [Define to 1 if you have mouse menus.
3413 (This is automatic if you use X, but the option to specify it remains.)
3414 It is also defined with other window systems that support xmenu.c.])
3415 fi
3416
3417 if test "${GNU_MALLOC}" = "yes" ; then
3418 AC_DEFINE(GNU_MALLOC, 1,
3419 [Define to 1 if you want to use the GNU memory allocator.])
3420 fi
3421
3422 RALLOC_OBJ=
3423 if test "${REL_ALLOC}" = "yes" ; then
3424 AC_DEFINE(REL_ALLOC, 1,
3425 [Define REL_ALLOC if you want to use the relocating allocator for
3426 buffer space.])
3427
3428 test "$system_malloc" != "yes" && RALLOC_OBJ=ralloc.o
3429 fi
3430 AC_SUBST(RALLOC_OBJ)
3431
3432 if test "$opsys" = "cygwin"; then
3433 CYGWIN_OBJ="sheap.o"
3434 ## Cygwin differs because of its unexec().
3435 PRE_ALLOC_OBJ=
3436 POST_ALLOC_OBJ=lastfile.o
3437 else
3438 CYGWIN_OBJ=
3439 PRE_ALLOC_OBJ=lastfile.o
3440 POST_ALLOC_OBJ=
3441 fi
3442 AC_SUBST(CYGWIN_OBJ)
3443 AC_SUBST(PRE_ALLOC_OBJ)
3444 AC_SUBST(POST_ALLOC_OBJ)
3445
3446 # Configure gnulib here, now that we know LIBS.
3447 gl_ASSERT_NO_GNULIB_POSIXCHECK
3448 gl_ASSERT_NO_GNULIB_TESTS
3449 gl_INIT
3450
3451 case "$opsys" in
3452 aix4-2) LD_SWITCH_SYSTEM_TEMACS="-Wl,-bnodelcsect" ;;
3453
3454 darwin)
3455 ## The -headerpad option tells ld (see man page) to leave room at the
3456 ## end of the header for adding load commands. Needed for dumping.
3457 ## 0x690 is the total size of 30 segment load commands (at 56
3458 ## each); under Cocoa 31 commands are required.
3459 if test "$HAVE_NS" = "yes"; then
3460 libs_nsgui="-framework AppKit"
3461 headerpad_extra=6C8
3462 else
3463 libs_nsgui=
3464 headerpad_extra=690
3465 fi
3466 LD_SWITCH_SYSTEM_TEMACS="-fno-pie -prebind $libs_nsgui -Xlinker -headerpad -Xlinker $headerpad_extra"
3467
3468 ## This is here because src/Makefile.in did some extra fiddling around
3469 ## with LD_SWITCH_SYSTEM. The cpp logic was:
3470 ## #ifndef LD_SWITCH_SYSTEM
3471 ## #if !defined (__GNUC__) && ((defined (BSD_SYSTEM) && !defined (COFF)))
3472 ## Since all the *bsds define LD_SWITCH_SYSTEM, this simplifies to:
3473 ## not using gcc, darwin system not on an alpha (ie darwin, since
3474 ## darwin + alpha does not occur).
3475 ## Because this was done in src/Makefile.in, the resulting part of
3476 ## LD_SWITCH_SYSTEM was not used in configure (ie, in ac_link).
3477 ## It therefore seems cleaner to put this in LD_SWITCH_SYSTEM_TEMACS,
3478 ## rather than LD_SWITCH_SYSTEM.
3479 test "x$LD_SWITCH_SYSTEM" = "x" && test "x$GCC" != "xyes" && \
3480 LD_SWITCH_SYSTEM_TEMACS="-X $LD_SWITCH_SYSTEM_TEMACS"
3481 ;;
3482
3483 ## LD_SWITCH_X_SITE_RPATH is a -rpath option saying where to
3484 ## find X at run-time.
3485 ## When handled by cpp, this was in LD_SWITCH_SYSTEM. However, at the
3486 ## point where configure sourced the s/*.h file, LD_SWITCH_X_SITE_RPATH
3487 ## had not yet been defined and was expanded to null. Hence LD_SWITCH_SYSTEM
3488 ## had different values in configure (in ac_link) and src/Makefile.in.
3489 ## It seems clearer therefore to put this piece in LD_SWITCH_SYSTEM_TEMACS.
3490 gnu*) LD_SWITCH_SYSTEM_TEMACS="\$(LD_SWITCH_X_SITE_RPATH)" ;;
3491
3492 *) LD_SWITCH_SYSTEM_TEMACS= ;;
3493 esac
3494
3495 if test "$NS_IMPL_GNUSTEP" = "yes"; then
3496 LD_SWITCH_SYSTEM_TEMACS="${LD_SWITCH_SYSTEM_TEMACS} -L${GNUSTEP_SYSTEM_LIBRARIES} ${GNUSTEP_LOCAL_LIBRARIES} -lgnustep-gui -lgnustep-base -lobjc -lpthread"
3497 fi
3498
3499 AC_SUBST(LD_SWITCH_SYSTEM_TEMACS)
3500
3501
3502 LD_FIRSTFLAG=
3503 ORDINARY_LINK=
3504 case "$opsys" in
3505 ## gnu: GNU needs its own crt0.
3506 aix4-2|cygwin|darwin|gnu|hpux*|irix6-5|sol2*|unixware) ORDINARY_LINK=yes ;;
3507
3508 ## On post 1.3 releases of NetBSD, gcc -nostdlib also clears the
3509 ## library search parth, i.e. it won't search /usr/lib for libc and
3510 ## friends. Using -nostartfiles instead avoids this problem, and
3511 ## will also work on earlier NetBSD releases.
3512 netbsd|openbsd) LD_FIRSTFLAG="-nostartfiles" ;;
3513
3514 ## macpcc: NAKAJI Hiroyuki <nakaji@tutrp.tut.ac.jp> says
3515 ## MkLinux/LinuxPPC needs this.
3516 ## ibms390x only supports opsys = gnu-linux so it can be added here.
3517 gnu-*)
3518 case "$machine" in
3519 macppc|ibms390x) LD_FIRSTFLAG="-nostdlib" ;;
3520 esac
3521 ;;
3522 esac
3523
3524
3525 if test "x$ORDINARY_LINK" = "xyes"; then
3526
3527 LD_FIRSTFLAG=""
3528 AC_DEFINE(ORDINARY_LINK, 1, [Define if the C compiler is the linker.])
3529
3530 ## The system files defining neither ORDINARY_LINK nor LD_FIRSTFLAG are:
3531 ## freebsd, gnu-* not on macppc|ibms390x.
3532 elif test "x$GCC" = "xyes" && test "x$LD_FIRSTFLAG" = "x"; then
3533
3534 ## Versions of GCC >= 2.0 put their library, libgcc.a, in obscure
3535 ## places that are difficult to figure out at make time. Fortunately,
3536 ## these same versions allow you to pass arbitrary flags on to the
3537 ## linker, so there is no reason not to use it as a linker.
3538 ##
3539 ## Well, it is not quite perfect. The "-nostdlib" keeps GCC from
3540 ## searching for libraries in its internal directories, so we have to
3541 ## ask GCC explicitly where to find libgcc.a (LIB_GCC below).
3542 LD_FIRSTFLAG="-nostdlib"
3543 fi
3544
3545 ## FIXME? What setting of EDIT_LDFLAGS should this have?
3546 test "$NS_IMPL_GNUSTEP" = "yes" && LD_FIRSTFLAG="-rdynamic"
3547
3548 AC_SUBST(LD_FIRSTFLAG)
3549
3550
3551 ## FIXME? The logic here is not precisely the same as that above.
3552 ## There is no check here for a pre-defined LD_FIRSTFLAG.
3553 ## Should we only be setting LIB_GCC if LD ~ -nostdlib?
3554 LIB_GCC=
3555 if test "x$GCC" = "xyes" && test "x$ORDINARY_LINK" != "xyes"; then
3556
3557 case "$opsys" in
3558 freebsd|netbsd|openbsd) LIB_GCC= ;;
3559
3560 gnu-*)
3561 ## armin76@gentoo.org reported that the lgcc_s flag is necessary to
3562 ## build on ARM EABI under GNU/Linux. (Bug#5518)
3563 case $host_cpu in
3564 arm*)
3565 LIB_GCC="-lgcc_s"
3566 ;;
3567 *)
3568 ## FIXME? s/gnu-linux.h used to define LIB_GCC as below, then
3569 ## immediately undefine it again and redefine it to empty.
3570 ## Was the C_SWITCH_X_SITE part really necessary?
3571 ## LIB_GCC=`$CC $C_SWITCH_X_SITE -print-libgcc-file-name`
3572 LIB_GCC=
3573 ;;
3574 esac
3575 ;;
3576
3577 ## Ask GCC where to find libgcc.a.
3578 *) LIB_GCC=`$CC -print-libgcc-file-name 2> /dev/null` ;;
3579 esac
3580 fi dnl if $GCC
3581 AC_SUBST(LIB_GCC)
3582
3583
3584 ## If we're using X11/GNUstep, define some consequences.
3585 if test "$HAVE_X_WINDOWS" = "yes" || test "$HAVE_NS" = "yes"; then
3586 AC_DEFINE(HAVE_WINDOW_SYSTEM, 1, [Define if you have a window system.])
3587 AC_DEFINE(HAVE_MOUSE, 1, [Define if you have mouse support.])
3588 fi
3589
3590
3591 AH_TOP([/* GNU Emacs site configuration template file.
3592
3593 Copyright (C) 1988, 1993-1994, 1999-2002, 2004-2012
3594 Free Software Foundation, Inc.
3595
3596 This file is part of GNU Emacs.
3597
3598 GNU Emacs is free software: you can redistribute it and/or modify
3599 it under the terms of the GNU General Public License as published by
3600 the Free Software Foundation, either version 3 of the License, or
3601 (at your option) any later version.
3602
3603 GNU Emacs is distributed in the hope that it will be useful,
3604 but WITHOUT ANY WARRANTY; without even the implied warranty of
3605 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3606 GNU General Public License for more details.
3607
3608 You should have received a copy of the GNU General Public License
3609 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
3610
3611
3612 /* No code in Emacs #includes config.h twice, but some bits of code
3613 intended to work with other packages as well (like gmalloc.c)
3614 think they can include it as many times as they like. */
3615 #ifndef EMACS_CONFIG_H
3616 #define EMACS_CONFIG_H
3617 ])dnl
3618
3619 AH_BOTTOM([
3620 /* On AIX 3 this must be included before any other include file. */
3621 #include <alloca.h>
3622 #if ! HAVE_ALLOCA
3623 # error "alloca not available on this machine"
3624 #endif
3625
3626 /* Define AMPERSAND_FULL_NAME if you use the convention
3627 that & in the full name stands for the login id. */
3628 /* Turned on June 1996 supposing nobody will mind it. */
3629 #define AMPERSAND_FULL_NAME
3630
3631 /* `subprocesses' should be defined if you want to
3632 have code for asynchronous subprocesses
3633 (as used in M-x compile and M-x shell).
3634 Only MSDOS does not support this (it overrides
3635 this in its config_opsysfile below). */
3636
3637 #define subprocesses
3638
3639 /* Include the os and machine dependent files. */
3640 #include config_opsysfile
3641 #ifdef config_machfile
3642 # include config_machfile
3643 #endif
3644
3645 /* GNUstep needs a bit more pure memory. Of the existing knobs,
3646 SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems.
3647 (There is probably a better place to do this, but right now the
3648 Cocoa side does this in s/darwin.h and we cannot parallel this
3649 exactly since GNUstep is multi-OS. */
3650 #if defined HAVE_NS && defined NS_IMPL_GNUSTEP
3651 # define SYSTEM_PURESIZE_EXTRA 30000
3652 #endif
3653
3654 #ifdef emacs /* Don't do this for lib-src. */
3655 /* Tell regex.c to use a type compatible with Emacs. */
3656 #define RE_TRANSLATE_TYPE Lisp_Object
3657 #define RE_TRANSLATE(TBL, C) CHAR_TABLE_TRANSLATE (TBL, C)
3658 #ifdef make_number
3659 /* If make_number is a macro, use it. */
3660 #define RE_TRANSLATE_P(TBL) (!EQ (TBL, make_number (0)))
3661 #else
3662 /* If make_number is a function, avoid it. */
3663 #define RE_TRANSLATE_P(TBL) (!(INTEGERP (TBL) && XINT (TBL) == 0))
3664 #endif
3665 #endif
3666
3667 /* These default definitions are good for almost all machines.
3668 Any exceptions should override them in m/MACHINE.h.
3669 They must be usable in preprocessor conditionals. */
3670
3671 #ifndef BITS_PER_CHAR
3672 #define BITS_PER_CHAR 8
3673 #endif
3674
3675 #ifndef BITS_PER_SHORT
3676 #define BITS_PER_SHORT 16
3677 #endif
3678
3679 #ifndef BITS_PER_INT
3680 #define BITS_PER_INT 32
3681 #endif
3682
3683 #ifndef BITS_PER_LONG
3684 #ifdef _LP64
3685 #define BITS_PER_LONG 64
3686 #else
3687 #define BITS_PER_LONG 32
3688 #endif
3689 #endif
3690
3691 #if !defined BITS_PER_LONG_LONG && HAVE_LONG_LONG_INT
3692 #define BITS_PER_LONG_LONG 64
3693 #endif
3694
3695 #include <string.h>
3696 #include <stdlib.h>
3697
3698 #if defined __GNUC__ && (__GNUC__ > 2 \
3699 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
3700 #define NO_RETURN __attribute__ ((__noreturn__))
3701 #else
3702 #define NO_RETURN /* nothing */
3703 #endif
3704
3705 #if __GNUC__ >= 3 /* On GCC 3.0 we might get a warning. */
3706 #define NO_INLINE __attribute__((noinline))
3707 #else
3708 #define NO_INLINE
3709 #endif
3710
3711 #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1))
3712 #define EXTERNALLY_VISIBLE __attribute__((externally_visible))
3713 #else
3714 #define EXTERNALLY_VISIBLE
3715 #endif
3716
3717 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
3718 # define ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
3719 #else
3720 # define ATTRIBUTE_FORMAT(spec) /* empty */
3721 #endif
3722
3723 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
3724 # define ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \
3725 ATTRIBUTE_FORMAT ((__gnu_printf__, formatstring_parameter, first_argument))
3726 #else
3727 # define ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \
3728 ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument))
3729 #endif
3730
3731 /* Some versions of GNU/Linux define noinline in their headers. */
3732 #ifdef noinline
3733 #undef noinline
3734 #endif
3735
3736 /* These won't be used automatically yet. We also need to know, at least,
3737 that the stack is continuous. */
3738 #ifdef __GNUC__
3739 # ifndef GC_SETJMP_WORKS
3740 /* GC_SETJMP_WORKS is nearly always appropriate for GCC. */
3741 # define GC_SETJMP_WORKS 1
3742 # endif
3743 #endif
3744
3745 #endif /* EMACS_CONFIG_H */
3746
3747 /*
3748 Local Variables:
3749 mode: c
3750 End:
3751 */
3752 ])dnl
3753
3754 #### Report on what we decided to do.
3755 #### Report GTK as a toolkit, even if it doesn't use Xt.
3756 #### It makes printing result more understandable as using GTK sets
3757 #### toolkit_scroll_bars to yes by default.
3758 if test "${HAVE_GTK}" = "yes"; then
3759 USE_X_TOOLKIT=GTK
3760 fi
3761
3762 and_machfile=
3763 if test -n "$machfile"; then
3764 and_machfile=" and \`${machfile}'"
3765 fi
3766
3767 echo "
3768 Configured for \`${canonical}'.
3769
3770 Where should the build process find the source code? ${srcdir}
3771 What operating system and machine description files should Emacs use?
3772 \`${opsysfile}'${and_machfile}
3773 What compiler should emacs be built with? ${CC} ${CFLAGS}
3774 Should Emacs use the GNU version of malloc? ${GNU_MALLOC}${GNU_MALLOC_reason}
3775 Should Emacs use a relocating allocator for buffers? ${REL_ALLOC}
3776 Should Emacs use mmap(2) for buffer allocation? $use_mmap_for_buffers
3777 What window system should Emacs use? ${window_system}
3778 What toolkit should Emacs use? ${USE_X_TOOLKIT}"
3779
3780 if test -n "${x_includes}"; then
3781 echo " Where do we find X Windows header files? ${x_includes}"
3782 else
3783 echo " Where do we find X Windows header files? Standard dirs"
3784 fi
3785 if test -n "${x_libraries}"; then
3786 echo " Where do we find X Windows libraries? ${x_libraries}"
3787 else
3788 echo " Where do we find X Windows libraries? Standard dirs"
3789 fi
3790
3791 echo " Does Emacs use -lXaw3d? ${HAVE_XAW3D}"
3792 echo " Does Emacs use -lXpm? ${HAVE_XPM}"
3793 echo " Does Emacs use -ljpeg? ${HAVE_JPEG}"
3794 echo " Does Emacs use -ltiff? ${HAVE_TIFF}"
3795 echo " Does Emacs use a gif library? ${HAVE_GIF} $LIBGIF"
3796 echo " Does Emacs use -lpng? ${HAVE_PNG}"
3797 echo " Does Emacs use -lrsvg-2? ${HAVE_RSVG}"
3798 echo " Does Emacs use imagemagick? ${HAVE_IMAGEMAGICK}"
3799
3800 echo " Does Emacs use -lgpm? ${HAVE_GPM}"
3801 echo " Does Emacs use -ldbus? ${HAVE_DBUS}"
3802 echo " Does Emacs use -lgconf? ${HAVE_GCONF}"
3803 echo " Does Emacs use GSettings? ${HAVE_GSETTINGS}"
3804 echo " Does Emacs use -lselinux? ${HAVE_LIBSELINUX}"
3805 echo " Does Emacs use -lgnutls? ${HAVE_GNUTLS}"
3806 echo " Does Emacs use -lxml2? ${HAVE_LIBXML2}"
3807
3808 echo " Does Emacs use -lfreetype? ${HAVE_FREETYPE}"
3809 echo " Does Emacs use -lm17n-flt? ${HAVE_M17N_FLT}"
3810 echo " Does Emacs use -lotf? ${HAVE_LIBOTF}"
3811 echo " Does Emacs use -lxft? ${HAVE_XFT}"
3812
3813 echo " Does Emacs use toolkit scroll bars? ${USE_TOOLKIT_SCROLL_BARS}"
3814
3815 echo " Does Emacs support Xwidgets? ${HAVE_XWIDGETS}"
3816 echo " Does xwidgets support webkit(requires gtk3)? ${HAVE_WEBKIT}"
3817 echo " Does xwidgets support clutter(demo code)? ${HAVE_CLUTTER}"
3818 echo " Does xwidgets support goocanvas(demo code)? ${HAVE_GOOCANVAS}"
3819 echo
3820
3821 if test -n "${EMACSDATA}"; then
3822 echo " Environment variable EMACSDATA set to: $EMACSDATA"
3823 fi
3824 if test -n "${EMACSDOC}"; then
3825 echo " Environment variable EMACSDOC set to: $EMACSDOC"
3826 fi
3827
3828 if test $USE_XASSERTS = yes; then
3829 echo " Compiling with asserts turned on."
3830 CPPFLAGS="$CPPFLAGS -DXASSERTS=1"
3831 fi
3832
3833 echo
3834
3835 if test "$HAVE_NS" = "yes"; then
3836 echo
3837 echo "You must run \"${MAKE-make} install\" in order to test the built application.
3838 The installed application will go to nextstep/Emacs.app and can be
3839 run or moved from there."
3840 if test "$EN_NS_SELF_CONTAINED" = "yes"; then
3841 echo "The application will be fully self-contained."
3842 else
3843 echo "The lisp resources for the application will be installed under ${prefix}.
3844 You may need to run \"${MAKE-make} install\" with sudo. The application will fail
3845 to run if these resources are not installed."
3846 fi
3847 echo
3848 fi
3849
3850 if test "${opsys}" = "cygwin"; then
3851 case `uname -r` in
3852 1.5.*) AC_MSG_WARN([[building Emacs on Cygwin 1.5 is not supported.]])
3853 echo
3854 ;;
3855 esac
3856 fi
3857
3858 # Remove any trailing slashes in these variables.
3859 [test "${prefix}" != NONE &&
3860 prefix=`echo "${prefix}" | sed 's,\([^/]\)/*$,\1,'`
3861 test "${exec_prefix}" != NONE &&
3862 exec_prefix=`echo "${exec_prefix}" | sed 's,\([^/]\)/*$,\1,'`]
3863
3864 dnl Obviously there is duplication here wrt $SUBDIR_MAKEFILES.
3865 dnl You _can_ use that variable in AC_CONFIG_FILES, so long as any directory
3866 dnl using automake (ie lib/) is explicitly listed and not "hidden" in a variable
3867 dnl (else you get "no `Makefile.am' found for any configure output").
3868 dnl This will work, but you get a config.status that is not quite right
3869 dnl (see http://lists.gnu.org/archive/html/bug-autoconf/2008-08/msg00028.html).
3870 dnl That doesn't have any obvious consequences for Emacs, but on the whole
3871 dnl it seems better to just live with the duplication.
3872 SUBDIR_MAKEFILES="lib/Makefile lib-src/Makefile oldXMenu/Makefile doc/emacs/Makefile doc/misc/Makefile doc/lispintro/Makefile doc/lispref/Makefile src/Makefile lwlib/Makefile lisp/Makefile leim/Makefile"
3873
3874 AC_CONFIG_FILES([Makefile lib/Makefile lib-src/Makefile oldXMenu/Makefile \
3875 doc/emacs/Makefile doc/misc/Makefile doc/lispintro/Makefile \
3876 doc/lispref/Makefile src/Makefile lwlib/Makefile lisp/Makefile \
3877 leim/Makefile])
3878
3879 dnl test/ is not present in release tarfiles.
3880 opt_makefile=test/automated/Makefile
3881
3882 if test -f $srcdir/${opt_makefile}.in; then
3883 SUBDIR_MAKEFILES="$SUBDIR_MAKEFILES $opt_makefile"
3884 dnl Again, it's best not to use a variable. Though you can add
3885 dnl ", [], [opt_makefile='$opt_makefile']" and it should work.
3886 AC_CONFIG_FILES([test/automated/Makefile])
3887 fi
3888
3889
3890 dnl admin/ may or may not be present.
3891 opt_makefile=admin/unidata/Makefile
3892
3893 if test -f $srcdir/${opt_makefile}.in; then
3894 SUBDIR_MAKEFILES="$SUBDIR_MAKEFILES $opt_makefile"
3895 AC_CONFIG_FILES([admin/unidata/Makefile])
3896 fi
3897
3898
3899 SUBDIR_MAKEFILES_IN=`echo " ${SUBDIR_MAKEFILES}" | sed -e 's| | $(srcdir)/|g' -e 's|Makefile|Makefile.in|g'`
3900
3901 AC_SUBST(SUBDIR_MAKEFILES_IN)
3902
3903 dnl Make the necessary directories, if they don't exist.
3904 AC_CONFIG_COMMANDS([mkdirs], [
3905 for dir in etc lisp ; do
3906 test -d ${dir} || mkdir ${dir}
3907 done
3908 ])
3909
3910 dnl You might wonder (I did) why epaths.h is generated by running make,
3911 dnl rather than just letting configure generate it from epaths.in.
3912 dnl One reason is that the various paths are not fully expanded (see above);
3913 dnl eg gamedir=${prefix}/var/games/emacs.
3914 dnl Secondly, the GNU Coding standards require that one should be able
3915 dnl to run `make prefix=/some/where/else' and override the values set
3916 dnl by configure. This also explains the `move-if-change' test and
3917 dnl the use of force in the `epaths-force' rule in Makefile.in.
3918 AC_CONFIG_COMMANDS([epaths], [
3919 echo creating src/epaths.h
3920 ${MAKE-make} epaths-force
3921 ], [GCC="$GCC" CPPFLAGS="$CPPFLAGS"])
3922
3923 AC_CONFIG_COMMANDS([gdbinit], [
3924 if test ! -f src/.gdbinit && test -f $srcdir/src/.gdbinit; then
3925 echo creating src/.gdbinit
3926 echo source $srcdir/src/.gdbinit > src/.gdbinit
3927 fi
3928 ])
3929
3930 AC_OUTPUT
3931
3932 dnl configure.in ends here