configure.in 96.1 KB
Newer Older
1
dnl  Autoconf script for GNU Emacs
David J. MacKenzie's avatar
David J. MacKenzie committed
2 3 4
dnl To rebuild the `configure' script from this, execute the command
dnl 	autoconf
dnl in the directory containing this script.
5
dnl
6
dnl  Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2003,
Glenn Morris's avatar
Glenn Morris committed
7
dnl    2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
8
dnl
9
dnl  This file is part of GNU Emacs.
10
dnl
11
dnl  GNU Emacs is free software: you can redistribute it and/or modify
12
dnl  it under the terms of the GNU General Public License as published by
13 14 15
dnl  the Free Software Foundation, either version 3 of the License, or
dnl  (at your option) any later version.
dnl  
16 17 18 19
dnl  GNU Emacs is distributed in the hope that it will be useful,
dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
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.61)
Glenn Morris's avatar
Glenn Morris committed
25
AC_INIT(emacs, 23.0.60)
26
AC_CONFIG_HEADER(src/config.h:src/config.in)
27
AC_CONFIG_SRCDIR(src/lisp.h)
David J. MacKenzie's avatar
David J. MacKenzie committed
28

29 30 31 32
dnl Support for --program-prefix, --program-suffix and
dnl --program-transform-name options
AC_ARG_PROGRAM

David J. MacKenzie's avatar
David J. MacKenzie committed
33
lispdir='${datadir}/emacs/${version}/lisp'
34
locallisppath='${datadir}/emacs/${version}/site-lisp:'\
35 36
'${datadir}/emacs/site-lisp'
lisppath='${locallisppath}:${lispdir}:${datadir}/emacs/${version}/leim'
David J. MacKenzie's avatar
David J. MacKenzie committed
37
etcdir='${datadir}/emacs/${version}/etc'
38
archlibdir='${libexecdir}/emacs/${version}/${configuration}'
David J. MacKenzie's avatar
David J. MacKenzie committed
39
docdir='${datadir}/emacs/${version}/etc'
40
gamedir='${localstatedir}/games/emacs'
41 42

gameuser=games
David J. MacKenzie's avatar
David J. MacKenzie committed
43

44 45 46 47 48 49 50 51 52 53 54 55
dnl OPTION_DEFAULT_OFF(NAME, HELP-STRING)
dnl Create a new --with option that defaults to being disabled.
dnl NAME is the base name of the option.  The shell variable with_NAME
dnl   will be set to either the user's value (if the option is
dnl   specified; 'yes' for a plain --with-NAME) or to 'no' (if the
dnl   option is not specified).  Note that the shell variable name is
dnl   constructed as autoconf does, by replacing non-alphanumeric
dnl   characters with "_".
dnl HELP-STRING is the help text for the option.
AC_DEFUN([OPTION_DEFAULT_OFF], [dnl
  AC_ARG_WITH([$1],[AS_HELP_STRING([--with-$1],[$2])],[],[dnl
    m4_bpatsubst([with_$1], [[^0-9a-z]], [_])=no])dnl
56
])dnl
57 58 59 60 61 62 63 64 65 66 67 68

dnl OPTION_DEFAULT_ON(NAME, HELP-STRING)
dnl Create a new --with option that defaults to being enabled.  NAME
dnl   is the base name of the option.  The shell variable with_NAME
dnl   will be set either to 'no' (for a plain --without-NAME) or to
dnl   'yes' (if the option is not specified).  Note that the shell
dnl   variable name is constructed as autoconf does, by replacing
dnl   non-alphanumeric characters with "_".
dnl HELP-STRING is the help text for the option.
AC_DEFUN([OPTION_DEFAULT_ON], [dnl
  AC_ARG_WITH([$1],[AS_HELP_STRING([--without-$1],[$2])],[],[dnl
   m4_bpatsubst([with_$1], [[^0-9a-z]], [_])=yes])dnl
69 70
])dnl

71 72
OPTION_DEFAULT_ON([pop],[don't support POP mail retrieval with movemail])
if test "$with_pop" = yes; then
Dave Love's avatar
Dave Love committed
73
   AC_DEFINE(MAIL_USE_POP)
74
fi
75
AH_TEMPLATE(MAIL_USE_POP, [Define to support POP mail retrieval.])dnl
76

77
OPTION_DEFAULT_OFF([kerberos],[support Kerberos-authenticated POP])
78
if test "$with_kerberos" != no; then
79
   AC_DEFINE(KERBEROS)
80
fi
81 82
AH_TEMPLATE(KERBEROS,
	    [Define to support Kerberos-authenticated POP mail retrieval.])dnl
83

84
OPTION_DEFAULT_OFF([kerberos5],[support Kerberos version 5 authenticated POP])
85 86
if test "${with_kerberos5}" != no; then
  if test "${with_kerberos}" = no; then
87 88 89
    with_kerberos=yes
    AC_DEFINE(KERBEROS)
  fi
90
  AC_DEFINE(KERBEROS5, 1, [Define to use Kerberos 5 instead of Kerberos 4.])
91
fi
92

93
OPTION_DEFAULT_OFF([hesiod],[support Hesiod to get the POP server host])
94
if test "$with_hesiod" != no; then
95
  AC_DEFINE(HESIOD, 1, [Define to support using a Hesiod database to find the POP server.])
96
fi
Pavel Janík's avatar
Pavel Janík committed
97

98
OPTION_DEFAULT_ON([sound],[don't compile with sound support])
Pavel Janík's avatar
Pavel Janík committed
99

100 101 102 103 104
OPTION_DEFAULT_ON([sync-input],[Process async input synchronously])
if test "$with_sync_input" = yes; then
   AC_DEFINE(SYNC_INPUT, 1, [Process async input synchronously.])
fi

105
dnl FIXME currently it is not the last.
David J. MacKenzie's avatar
David J. MacKenzie committed
106 107 108
dnl This should be the last --with option, because --with-x is
dnl added later on when we find the path of X, and it's best to
dnl keep them together visually.
109 110
AC_ARG_WITH([x-toolkit],[AS_HELP_STRING([--with-x-toolkit=KIT],
 [use an X toolkit (KIT one of: yes, lucid, athena, motif, gtk, no)])],
David J. MacKenzie's avatar
David J. MacKenzie committed
111
[	  case "${withval}" in
Glenn Morris's avatar
Glenn Morris committed
112
	    y | ye | yes )	val=gtk ;;
David J. MacKenzie's avatar
David J. MacKenzie committed
113 114
	    n | no )		val=no  ;;
	    l | lu | luc | luci | lucid )	val=lucid ;;
115
	    a | at | ath | athe | athen | athena )	val=athena ;;
David J. MacKenzie's avatar
David J. MacKenzie committed
116
	    m | mo | mot | moti | motif )	val=motif ;;
Jan Djärv's avatar
Jan Djärv committed
117
	    g | gt | gtk  )	val=gtk ;;
David J. MacKenzie's avatar
David J. MacKenzie committed
118
	    * )
119
AC_MSG_ERROR([`--with-x-toolkit=$withval' is invalid;
Jan Djärv's avatar
Jan Djärv committed
120
this option's value should be `yes', `no', `lucid', `athena', `motif' or `gtk'.
121
`yes' and `gtk' are synonyms. `athena' and `lucid' are synonyms.])
David J. MacKenzie's avatar
David J. MacKenzie committed
122 123 124 125
	    ;;
	  esac
	  with_x_toolkit=$val
])
126

127 128 129 130 131 132 133 134 135
dnl _ON results in a '--without' option in the --help output, so
dnl the help text should refer to "don't compile", etc.
OPTION_DEFAULT_ON([xpm],[don't compile with XPM image support])
OPTION_DEFAULT_ON([jpeg],[don't compile with JPEG image support])
OPTION_DEFAULT_ON([tiff],[don't compile with TIFF image support])
OPTION_DEFAULT_ON([gif],[don't compile with GIF image support])
OPTION_DEFAULT_ON([png],[don't compile with PNG image support])
OPTION_DEFAULT_ON([rsvg],[don't compile with SVG image support])

136 137
OPTION_DEFAULT_ON([freetype],[don't use Freetype for local font support])
OPTION_DEFAULT_ON([xft],[don't use XFT for anti aliased fonts])
Miles Bader's avatar
Miles Bader committed
138 139 140
OPTION_DEFAULT_ON([libotf],[don't use libotf for OpenType font support])
OPTION_DEFAULT_ON([m17n-flt],[don't use m17n-flt for text shaping])

141 142 143
OPTION_DEFAULT_ON([toolkit-scroll-bars],[don't use Motif or Xaw3d scroll bars])
OPTION_DEFAULT_ON([xaw3d],[don't use Xaw3d])
OPTION_DEFAULT_ON([xim],[don't use X11 XIM])
144
OPTION_DEFAULT_OFF([carbon],[use Carbon GUI on Mac OS X.  This is unsupported!])
145
OPTION_DEFAULT_OFF([ns],[use nextstep (Cocoa or GNUstep) windowing system])
146 147

OPTION_DEFAULT_ON([gpm],[don't use -lgpm for mouse support on a GNU/Linux console])
148
OPTION_DEFAULT_ON([dbus],[don't compile with D-Bus support])
149

150 151 152 153 154
## For the times when you want to build Emacs but don't have
## a suitable makeinfo, and can live without the manuals.
dnl http://lists.gnu.org/archive/html/emacs-devel/2008-04/msg01844.html
OPTION_DEFAULT_ON([makeinfo],[don't require makeinfo for building manuals])

155 156 157 158 159 160 161 162 163
dnl Can remove these in Emacs 24.
AC_ARG_WITH([gtk],,
  AC_MSG_ERROR([--with-gtk has been removed.  Use --with-x-toolkit to
specify a toolkit.]),,)

AC_ARG_WITH([gcc],,
  AC_MSG_ERROR([--with-gcc has been removed.  Set the `CC' environment
  variable to specify a compiler.]),,)

164
AC_ARG_WITH([pkg-config-prog],dnl
165
[AS_HELP_STRING([--with-pkg-config-prog=PATH],
166 167 168 169 170 171
                  [Path to pkg-config for finding GTK and librsvg])])
if test "X${with_pkg_config_prog}" != X; then
   if test "${with_pkg_config_prog}" != yes; then
      PKG_CONFIG="${with_pkg_config_prog}"
   fi
fi
172

173
AC_ARG_ENABLE(carbon-app,
174 175 176
[AS_HELP_STRING([--enable-carbon-app@<:@=DIR@:>@],
                [specify install directory for Emacs.app on Mac OS X
		 [DIR=/Application]])],
177
[ carbon_appdir_x=${enableval}])
David J. MacKenzie's avatar
David J. MacKenzie committed
178

179 180 181 182 183
AC_ARG_ENABLE(cocoa-experimental-ctrl-g,
[  --enable-cocoa-experimental-ctrl-g        enable experimental improved ctrl-g recognition],
   EN_COCOA_EXPERIMENTAL_CTRL_G=yes,
   EN_COCOA_EXPERIMENTAL_CTRL_G=no)

184 185 186 187 188
AC_ARG_ENABLE(ns-self-contained,
[  --disable-ns-self-contained        disable self contained build under NS],
   EN_NS_SELF_CONTAINED=no,
   EN_NS_SELF_CONTAINED=yes)

189
AC_ARG_ENABLE(asserts,
190
[AS_HELP_STRING([--enable-asserts], [compile code with asserts enabled])],
191 192 193
      USE_XASSERTS=$enableval,
      USE_XASSERTS=no)

194
AC_ARG_ENABLE(maintainer-mode,
195 196 197
[AS_HELP_STRING([--enable-maintainer-mode],
                [enable make rules and dependencies not useful (and sometimes
		 confusing) to the casual installer])],
198 199 200 201 202 203 204 205 206
      USE_MAINTAINER_MODE=$enableval,
      USE_MAINTAINER_MODE=no)
if test $USE_MAINTAINER_MODE = yes; then
  MAINT=
else
  MAINT=#
fi
AC_SUBST(MAINT)

Lute Kamstra's avatar
Lute Kamstra committed
207
AC_ARG_ENABLE(locallisppath,
208 209 210
[AS_HELP_STRING([--enable-locallisppath=PATH],
                [directories Emacs should search for lisp files specific
		 to this site])],
Lute Kamstra's avatar
Lute Kamstra committed
211 212 213 214 215 216
if test "${enableval}" = "no"; then
  locallisppath=
elif test "${enableval}" != "yes"; then
  locallisppath=${enableval}
fi)

David J. MacKenzie's avatar
David J. MacKenzie committed
217
#### Make srcdir absolute, if it isn't already.  It's important to
218
#### avoid running the path through pwd unnecessarily, since pwd can
David J. MacKenzie's avatar
David J. MacKenzie committed
219 220
#### give you automounter prefixes, which can go away.  We do all this
#### so Emacs can find its files when run uninstalled.
221 222
## Make sure CDPATH doesn't affect cd (in case PWD is relative).
unset CDPATH
David J. MacKenzie's avatar
David J. MacKenzie committed
223 224 225 226 227
case "${srcdir}" in
  /* ) ;;
  . )
    ## We may be able to use the $PWD environment variable to make this
    ## absolute.  But sometimes PWD is inaccurate.
228 229 230 231
    ## Note: we used to use ${PWD} at the end instead of `pwd`,
    ## but that tested only for a well-formed and valid PWD,
    ## it did not object when PWD was well-formed and valid but just wrong.
    if test ".${PWD}" != "." && test ".`(cd ${PWD} ; sh -c pwd)`" = ".`pwd`"  ;
David J. MacKenzie's avatar
David J. MacKenzie committed
232 233 234 235 236 237 238 239 240 241 242 243
    then
      srcdir="$PWD"
    else
      srcdir="`(cd ${srcdir}; pwd)`"
    fi
  ;;
  *  ) srcdir="`(cd ${srcdir}; pwd)`" ;;
esac

#### Check if the source directory already has a configured system in it.
if test `pwd` != `(cd ${srcdir} && pwd)` \
   && test -f "${srcdir}/src/config.h" ; then
Dave Love's avatar
Dave Love committed
244
  AC_MSG_WARN([[The directory tree `${srcdir}' is being used
David J. MacKenzie's avatar
David J. MacKenzie committed
245 246 247
   as a build directory right now; it has been configured in its own
   right.  To configure in another directory as well, you MUST
   use GNU make.  If you do not have GNU make, then you must
Dave Love's avatar
Dave Love committed
248 249
   now do `make distclean' in ${srcdir},
   and then run $0 again.]])
David J. MacKenzie's avatar
David J. MacKenzie committed
250 251 252 253 254 255 256 257 258
fi

#### Given the configuration name, set machfile and opsysfile to the
#### names of the m/*.h and s/*.h files we should use.

### Canonicalize the configuration name.

AC_CANONICAL_HOST
canonical=$host
259
configuration=${host_alias-${build_alias-$host}}
David J. MacKenzie's avatar
David J. MacKenzie committed
260

Dave Love's avatar
Dave Love committed
261 262 263 264
dnl This used to use changequote, but, apart from `changequote is evil'
dnl per the autoconf manual, we can speed up autoconf somewhat by quoting
dnl the great gob of text.  Thus it's not processed for possible expansion.
dnl Just make sure the brackets remain balanced.
265 266 267 268
dnl
dnl Since Emacs can't find matching pairs of quotes, boundaries are
dnl indicated by comments.
dnl quotation begins
Dave Love's avatar
Dave Love committed
269
[
David J. MacKenzie's avatar
David J. MacKenzie committed
270 271 272 273 274 275 276 277 278

### If you add support for a new configuration, add code to this
### switch statement to recognize your configuration name and select
### the appropriate operating system and machine description files.

### You would hope that you could choose an m/*.h file pretty much
### based on the machine portion of the configuration name, and an s-
### file based on the operating system portion.  However, it turns out
### that each m/*.h file is pretty manufacturer-specific - for
Dan Nicolaescu's avatar
Dan Nicolaescu committed
279 280
### example mips.h is MIPS
### So we basically have to have a special case for each
David J. MacKenzie's avatar
David J. MacKenzie committed
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295
### configuration name.
###
### As far as handling version numbers on operating systems is
### concerned, make sure things will fail in a fixable way.  If
### /etc/MACHINES doesn't say anything about version numbers, be
### prepared to handle anything reasonably.  If version numbers
### matter, be sure /etc/MACHINES says something about it.
###
### Eric Raymond says we should accept strings like "sysvr4" to mean
### "System V Release 4"; he writes, "The old convention encouraged
### confusion between `system' and `release' levels'."

machine='' opsys='' unported=no
case "${canonical}" in

296
  ## FreeBSD ports
297
  *-*-freebsd* )
298 299 300
    opsys=freebsd
    case "${canonical}" in
      alpha*-*-freebsd*)	machine=alpha ;;
301
      arm*-*-freebsd*)          machine=arm ;;
302
      ia64-*-freebsd*)		machine=ia64 ;;
303
      sparc-*-freebsd*)         machine=sparc ;;
304 305
      sparc64-*-freebsd*)	machine=sparc ;;
      powerpc-*-freebsd*)	machine=macppc ;;
306
      i[3456]86-*-freebsd*)	machine=intel386 ;;
307
      amd64-*-freebsd*|x86_64-*-freebsd*) machine=amdx86-64 ;;
308 309 310
    esac
  ;;

311 312 313 314 315 316
  ## FreeBSD kernel + glibc based userland
  *-*-kfreebsd*gnu* )
    opsys=gnu-kfreebsd
    case "${canonical}" in
      alpha*-*-kfreebsd*)	machine=alpha ;;
      ia64-*-kfreebsd*)		machine=ia64 ;;
317
      sparc-*-kfreebsd*)	machine=sparc ;;
318 319 320 321 322 323 324
      sparc64-*-kfreebsd*)	machine=sparc ;;
      powerpc-*-kfreebsd*)	machine=macppc ;;
      i[3456]86-*-kfreebsd*)	machine=intel386 ;;
      amd64-*-kfreebsd*|x86_64-*-kfreebsd*) machine=amdx86-64 ;;
    esac
  ;;

David J. MacKenzie's avatar
David J. MacKenzie committed
325 326 327
  ## NetBSD ports
  *-*-netbsd* )
    opsys=netbsd
328
    if test -f /usr/lib/crti.o; then]
329 330 331
dnl The close and open brackets here are because this section is quoted --
dnl see the `changequote' comment above.
      AC_DEFINE(HAVE_CRTIN, [], [Define to 1 if you have /usr/lib/crti.o.])
332
[   fi
333

David J. MacKenzie's avatar
David J. MacKenzie committed
334
    case "${canonical}" in
335
      alpha*-*-netbsd*)	machine=alpha ;;
336
      i[3456]86-*-netbsd*) machine=intel386 ;;
337
      powerpc-*-netbsd*) machine=macppc ;;
Gerd Moellmann's avatar
Gerd Moellmann committed
338
      sparc*-*-netbsd*)	machine=sparc ;;
Richard M. Stallman's avatar
Richard M. Stallman committed
339
      vax-*-netbsd*)	machine=vax ;;
340
      arm-*-netbsd*)	machine=arm ;;
341 342
      x86_64-*-netbsd*)	machine=amdx86-64 ;;
      hppa-*-netbsd*)	machine=hp800 ;;
David J. MacKenzie's avatar
David J. MacKenzie committed
343 344 345
    esac
  ;;

346 347 348 349
  ## OpenBSD ports
  *-*-openbsd* )
    opsys=openbsd
    case "${canonical}" in
350
      alpha*-*-openbsd*)	machine=alpha ;;
351 352 353 354 355 356
      arm-*-openbsd*)          machine=arm ;;
      i386-*-openbsd*)         machine=intel386 ;;
      powerpc-*-openbsd*)      machine=macppc ;;
      sparc*-*-openbsd*)       machine=sparc ;;
      vax-*-openbsd*)          machine=vax ;;
      x86_64-*-openbsd*)       machine=amdx86-64 ;;
357 358 359
    esac
  ;;

360 361 362 363 364 365 366 367 368
  ## LynxOS ports
  *-*-lynxos* )
    opsys=lynxos
    case "${canonical}" in
      i[3456]86-*-lynxos*) machine=intel386 ;;
      powerpc-*-lynxos*) machine=powerpc ;;
    esac
  ;;

369
  alpha*-*-linux-gnu* )
370
    machine=alpha opsys=gnu-linux
371 372
  ;;

373 374 375 376
  arm*-*-linux-gnu* )
    machine=arm opsys=gnu-linux
  ;;

377 378 379 380
  ## Apple Darwin / Mac OS X
  *-apple-darwin* )
    case "${canonical}" in
      i[3456]86-* )  machine=intel386 ;;
381
      powerpc-* )    machine=macppc ;;
382 383 384 385 386 387 388 389 390 391 392 393 394
      * )            unported=yes ;;
    esac
    opsys=darwin
    # Define CPP as follows to make autoconf work correctly.
    CPP="${CC-cc} -E -no-cpp-precomp"
    # Use fink packages if available.
    if test -d /sw/include && test -d /sw/lib; then
      GCC_TEST_OPTIONS="-I/sw/include -L/sw/lib"
      CPP="${CPP} ${GCC_TEST_OPTIONS}"
      NON_GCC_TEST_OPTIONS=${GCC_TEST_OPTIONS}
    fi
  ;;

395 396 397 398 399 400 401 402 403
  ## HP 9000 series 700 and 800, running HP/UX
  hppa*-hp-hpux10.2* )
    machine=hp800 opsys=hpux10-20
  ;;
  hppa*-hp-hpux1[1-9]* )
    machine=hp800 opsys=hpux11
    CFLAGS="-D_INCLUDE__STDC_A1_SOURCE $CFLAGS"
  ;;

404 405 406 407
  hppa*-*-linux-gnu* )
    machine=hp800 opsys=gnu-linux
  ;;

David J. MacKenzie's avatar
David J. MacKenzie committed
408
  ## IBM machines
Dave Love's avatar
Dave Love committed
409
  s390-*-linux-gnu* )
410 411
    machine=ibms390 opsys=gnu-linux
  ;;
412 413
  s390x-*-linux-gnu* )
    machine=ibms390x opsys=gnu-linux
414
  ;;
415 416 417
  rs6000-ibm-aix4.2* | powerpc-ibm-aix4.2*  )
    machine=ibmrs6000 opsys=aix4-2
  ;;
418 419 420
  rs6000-ibm-aix4.3* | powerpc-ibm-aix4.3*  )
    machine=ibmrs6000 opsys=aix4-2
  ;;
421
  rs6000-ibm-aix5* | powerpc-ibm-aix5*  )
Eli Zaretskii's avatar
Eli Zaretskii committed
422 423
    machine=ibmrs6000 opsys=aix4-2
  ;;
424 425 426
  rs6000-ibm-aix5* | powerpc-ibm-aix6*  )
    machine=ibmrs6000 opsys=aix4-2
  ;;
David J. MacKenzie's avatar
David J. MacKenzie committed
427

428 429 430 431 432
  ## Macintosh PowerPC
  powerpc*-*-linux-gnu* )
    machine=macppc opsys=gnu-linux
  ;;

David J. MacKenzie's avatar
David J. MacKenzie committed
433 434
  ## Silicon Graphics machines
  ## Iris 4D
Karl Heuer's avatar
Karl Heuer committed
435 436
  mips-sgi-irix6.5 )
    machine=iris4d opsys=irix6-5
437 438 439 440
    # Without defining _LANGUAGE_C, things get masked out in the headers
    # so that, for instance, grepping for `free' in stdlib.h fails and
    # AC_HEADER_STD_C fails.   (MIPSPro 7.2.1.2m compilers, Irix 6.5.3m).
    NON_GNU_CPP="/lib/cpp -D_LANGUAGE_C"
441
    NON_GCC_TEST_OPTIONS="-D_LANGUAGE_C"
Karl Heuer's avatar
Karl Heuer committed
442
  ;;
David J. MacKenzie's avatar
David J. MacKenzie committed
443 444

  ## Suns
Dave Love's avatar
Dave Love committed
445
  sparc-*-linux-gnu* | sparc64-*-linux-gnu* )
446
    machine=sparc opsys=gnu-linux
Karl Heuer's avatar
Karl Heuer committed
447 448
  ;;

449
  *-sun-solaris* \
450
    | i[3456]86-*-solaris2* | i[3456]86-*-sunos5* | powerpc*-*-solaris2* \
451
    | rs6000-*-solaris2*)
David J. MacKenzie's avatar
David J. MacKenzie committed
452
    case "${canonical}" in
453
      i[3456]86-*-* )     machine=intel386 ;;
454
      amd64-*-*|x86_64-*-*)	machine=amdx86-64 ;;
455
      powerpc* | rs6000* )  machine=ibmrs6000 ;;
David J. MacKenzie's avatar
David J. MacKenzie committed
456 457 458 459 460 461 462 463 464 465 466
      sparc* )		machine=sparc ;;
      * )		unported=yes ;;
    esac
    case "${canonical}" in
      *-sunos5.3* | *-solaris2.3* )
		opsys=sol2-3
		NON_GNU_CPP=/usr/ccs/lib/cpp
		;;
      *-sunos5.4* | *-solaris2.4* )
		opsys=sol2-4
		NON_GNU_CPP=/usr/ccs/lib/cpp
467
		RANLIB="ar -ts"
David J. MacKenzie's avatar
David J. MacKenzie committed
468
		;;
469 470 471
      *-sunos5.5* | *-solaris2.5* )
		opsys=sol2-5
		NON_GNU_CPP=/usr/ccs/lib/cpp
472
		RANLIB="ar -ts"
473
		;;
474 475 476 477 478
      *-sunos5.6* | *-solaris2.6* )
		opsys=sol2-6
		NON_GNU_CPP=/usr/ccs/lib/cpp
		RANLIB="ar -ts"
		;;
David J. MacKenzie's avatar
David J. MacKenzie committed
479
      *-sunos5* | *-solaris* )
480
		opsys=sol2-6
481 482
		emacs_check_sunpro_c=yes
		NON_GNU_CPP=/usr/ccs/lib/cpp
David J. MacKenzie's avatar
David J. MacKenzie committed
483 484
		;;
    esac
485 486 487 488 489 490 491 492 493 494 495
    ## Watch out for a compiler that we know will not work.
    case "${canonical}" in
     *-solaris* | *-sunos5* )
		if [ "x$CC" = x/usr/ucb/cc ]; then
		  ## /usr/ucb/cc doesn't work;
		  ## we should find some other compiler that does work.
		  unset CC
		fi
		;;
      *) ;;
    esac
David J. MacKenzie's avatar
David J. MacKenzie committed
496 497 498 499 500 501 502 503 504 505 506
  ;;

  ## Vaxen.
  vax-dec-* )
    machine=vax
    case "${canonical}" in
      *-vms* ) 						opsys=vms ;;
      * ) 						unported=yes
    esac
  ;;

507 508 509 510 511
  ## IA-64
  ia64*-*-linux* )
    machine=ia64 opsys=gnu-linux
  ;;

David J. MacKenzie's avatar
David J. MacKenzie committed
512
  ## Intel 386 machines where we don't care about the manufacturer
513
  i[3456]86-*-* )
David J. MacKenzie's avatar
David J. MacKenzie committed
514 515
    machine=intel386
    case "${canonical}" in
Juanma Barranquero's avatar
Juanma Barranquero committed
516
      *-cygwin )                opsys=cygwin ;;
517
      *-darwin* )               opsys=darwin
518 519
                                CPP="${CC-cc} -E -no-cpp-precomp"
 				;;
520
      *-linux-gnu* )		opsys=gnu-linux ;;
521
      *-sysv4.2uw* )	  	opsys=unixware; NON_GNU_CPP=/lib/cpp ;;
522 523
      *-sysv5uw* )	  	opsys=unixware; NON_GNU_CPP=/lib/cpp ;;
      *-sysv5OpenUNIX* )  	opsys=unixware; NON_GNU_CPP=/lib/cpp ;;
David J. MacKenzie's avatar
David J. MacKenzie committed
524 525 526 527
      ## Otherwise, we'll fall through to the generic opsys code at the bottom.
    esac
  ;;

528
  ## m68k Linux-based GNU system
529 530
  m68k-*-linux-gnu* )
    machine=m68k opsys=gnu-linux
531 532
  ;;

533
  ## Mips Linux-based GNU system
534
  mips-*-linux-gnu* | mipsel-*-linux-gnu* )
535 536 537
    machine=mips opsys=gnu-linux
  ;;

Andreas Schwab's avatar
Andreas Schwab committed
538 539
  ## AMD x86-64 Linux-based GNU system
  x86_64-*-linux-gnu* )
540
    machine=amdx86-64 opsys=gnu-linux
Andreas Schwab's avatar
Andreas Schwab committed
541 542
  ;;

543
  ## Tensilica Xtensa Linux-based GNU system
Miles Bader's avatar
Miles Bader committed
544
  xtensa*-*-linux-gnu* )
545 546 547
    machine=xtensa opsys=gnu-linux
    ;;

David J. MacKenzie's avatar
David J. MacKenzie committed
548 549 550 551 552 553 554 555 556 557 558 559 560 561
  * )
    unported=yes
  ;;
esac

### If the code above didn't choose an operating system, just choose
### an operating system based on the configuration name.  You really
### only want to use this when you have no idea what the right
### operating system is; if you know what operating systems a machine
### runs, it's cleaner to make it explicit in the case statement
### above.
if test x"${opsys}" = x; then
  case "${canonical}" in
    *-gnu* )				opsys=gnu ;;
562
    *-sysv4.2uw* )			opsys=unixware ;;
563 564
    *-sysv5uw* )			opsys=unixware ;;
    *-sysv5OpenUNIX* )			opsys=unixware ;;
565
    *-sysv4.1* | *-sysvr4.1* )
David J. MacKenzie's avatar
David J. MacKenzie committed
566 567
	NON_GNU_CPP=/usr/lib/cpp
	opsys=usg5-4 ;;
568
    *-sysv4.[2-9]* | *-sysvr4.[2-9]* )
569
	if [ x$NON_GNU_CPP = x ]; then
570 571 572 573 574
	  if [ -f /usr/ccs/lib/cpp ]; then
	    NON_GNU_CPP=/usr/ccs/lib/cpp
	  else
	    NON_GNU_CPP=/lib/cpp
	  fi
575 576
	fi
	opsys=usg5-4-2 ;;
577
    *-sysv4* | *-sysvr4* )		opsys=usg5-4 ;;
David J. MacKenzie's avatar
David J. MacKenzie committed
578 579 580 581 582 583
    * )
      unported=yes
    ;;
  esac
fi

Dave Love's avatar
Dave Love committed
584
]
585
dnl quotation ends
David J. MacKenzie's avatar
David J. MacKenzie committed
586 587

if test $unported = yes; then
Dave Love's avatar
Dave Love committed
588 589
  AC_MSG_ERROR([Emacs hasn't been ported to `${canonical}' systems.
Check `etc/MACHINES' for recognized configuration names.])
David J. MacKenzie's avatar
David J. MacKenzie committed
590 591 592 593 594 595 596 597 598
fi

machfile="m/${machine}.h"
opsysfile="s/${opsys}.h"


#### Choose a compiler.
test -n "$CC" && cc_specified=yes

599 600 601
# Save the value of CFLAGS that the user specified.
SPECIFIED_CFLAGS="$CFLAGS"

602
dnl Sets GCC=yes if using gcc.
Andreas Schwab's avatar
Andreas Schwab committed
603
AC_PROG_CC
David J. MacKenzie's avatar
David J. MacKenzie committed
604 605 606 607 608 609

# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
  CPP=
fi

610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627
## If not using gcc, and on Solaris, and no CPP specified, see if
## using a Sun compiler, which needs -Xs to prevent whitespace.
if test x"$GCC" != xyes && test x"$emacs_check_sunpro_c" = xyes && \
 test x"$CPP" = x; then
  AC_MSG_CHECKING([whether we are using a Sun C compiler])
  AC_CACHE_VAL(emacs_cv_sunpro_c,
  [AC_TRY_LINK([],
[#ifndef __SUNPRO_C
fail;
#endif
], emacs_cv_sunpro_c=yes, emacs_cv_sunpro_c=no)])
  AC_MSG_RESULT($emacs_cv_sunpro_c)

  if test x"$emacs_cv_sunpro_c" = xyes; then
    NON_GNU_CPP="$CC -E -Xs"
  fi
fi

David J. MacKenzie's avatar
David J. MacKenzie committed
628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647
#### Some systems specify a CPP to use unless we are using GCC.
#### Now that we know whether we are using GCC, we can decide whether
#### to use that one.
if test "x$NON_GNU_CPP" != x && test x$GCC != xyes && test "x$CPP" = x
then
  CPP="$NON_GNU_CPP"
fi

#### Some systems specify a CC to use unless we are using GCC.
#### Now that we know whether we are using GCC, we can decide whether
#### to use that one.
if test "x$NON_GNU_CC" != x && test x$GCC != xyes &&
  test x$cc_specified != xyes
then
  CC="$NON_GNU_CC"
fi

if test x$GCC = xyes && test "x$GCC_TEST_OPTIONS" != x
then
  CC="$CC $GCC_TEST_OPTIONS"
648
fi
David J. MacKenzie's avatar
David J. MacKenzie committed
649 650 651 652

if test x$GCC = x && test "x$NON_GCC_TEST_OPTIONS" != x
then
  CC="$CC $NON_GCC_TEST_OPTIONS"
653
fi
David J. MacKenzie's avatar
David J. MacKenzie committed
654

655
dnl checks for Unix variants
656
AC_USE_SYSTEM_EXTENSIONS
657

658 659 660 661 662 663 664 665 666 667 668 669 670
### Use -Wno-pointer-sign if the compiler supports it
AC_MSG_CHECKING([whether gcc understands -Wno-pointer-sign])
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wno-pointer-sign"
AC_TRY_COMPILE([], [], has_option=yes, has_option=no,)
if test $has_option = yes; then
   C_WARNINGS_SWITCH="-Wno-pointer-sign $C_WARNINGS_SWITCH"
fi
AC_MSG_RESULT($has_option)
CFLAGS="$SAVE_CFLAGS"
unset has_option
unset SAVE_CFLAGS

Dave Love's avatar
Dave Love committed
671
#### Some other nice autoconf tests.
David J. MacKenzie's avatar
David J. MacKenzie committed
672 673

dnl checks for programs
David J. MacKenzie's avatar
David J. MacKenzie committed
674
AC_PROG_LN_S
David J. MacKenzie's avatar
David J. MacKenzie committed
675 676
AC_PROG_CPP
AC_PROG_INSTALL
677 678 679
if test "x$RANLIB" = x; then
  AC_PROG_RANLIB
fi
David Kastrup's avatar
David Kastrup committed
680 681 682
AC_PATH_PROG(INSTALL_INFO, install-info)
AC_PATH_PROG(INSTALL_INFO, install-info,, /usr/sbin)
AC_PATH_PROG(INSTALL_INFO, install-info,:, /sbin)
683 684
dnl Don't use GZIP, which is used by gzip for additional parameters.
AC_PATH_PROG(GZIP_PROG, gzip)
David J. MacKenzie's avatar
David J. MacKenzie committed
685

686

687
## Need makeinfo >= 4.6 (?) to build the manuals.
688
AC_PATH_PROG(MAKEINFO, makeinfo, no)
689
dnl By this stage, configure has already checked for egrep and set EGREP,
690 691
dnl or exited with an error if no egrep was found.
if test "$MAKEINFO" != "no" && \
Glenn Morris's avatar
Glenn Morris committed
692
  test x"`$MAKEINFO --version 2> /dev/null | $EGREP 'texinfo[[^0-9]]*([[1-4]][[0-9]]+|[[5-9]]|4\.[[6-9]]|4\.[[1-5]][[0-9]]+)'`" = x; then
693
   MAKEINFO=no
694 695
fi

696 697 698 699 700 701 702 703 704 705 706 707 708 709 710
## Makeinfo is unusual.  For a released Emacs, the manuals are
## pre-built, and not deleted by the normal clean rules.  makeinfo is
## therefore in the category of "special tools" not normally required, which
## configure does not have to check for (eg autoconf itself).
## In a CVS checkout on the other hand, the manuals are not included.
## So makeinfo is a requirement to build from CVS, and configure
## should test for it as it does for any other build requirement.
## We use the presence of $srcdir/info/emacs to distinguish a release,
## with pre-built manuals, from a CVS checkout.
if test "$MAKEINFO" = "no"; then
  if test "x${with_makeinfo}" = "xno"; then
    MAKEINFO=off
  elif ! test -e $srcdir/info/emacs; then
    AC_MSG_ERROR( [You do not seem to have makeinfo >= 4.6, and your
source tree does not seem to have pre-built manuals in the `info' directory.
711
Either install a suitable version of makeinfo, or re-run configure
712 713
with the `--without-makeinfo' option to build without the manuals.] )
  fi
714
fi
715

716 717 718 719 720 721 722 723 724 725 726 727
dnl Add our options to ac_link now, after it is set up.

if test x$GCC = xyes && test "x$GCC_LINK_TEST_OPTIONS" != x
then
  ac_link="$ac_link $GCC_LINK_TEST_OPTIONS"
fi

if test x$GCC = x && test "x$NON_GCC_LINK_TEST_OPTIONS" != x
then
  ac_link="$ac_link $NON_GCC_LINK_TEST_OPTIONS"
fi

728 729 730
dnl We need -znocombreloc if we're using a relatively recent GNU ld.
dnl If we can link with the flag, it shouldn't do any harm anyhow.
dnl (Don't use `-z nocombreloc' as -z takes no arg on Irix.)
Richard M. Stallman's avatar
Richard M. Stallman committed
731 732 733
dnl Treat GCC specially since it just gives a non-fatal `unrecognized option'
dnl if not built to support GNU ld.

734
late_LDFLAGS=$LDFLAGS
735
if test "$GCC" = yes; then
Richard M. Stallman's avatar
Richard M. Stallman committed
736 737 738 739
  LDFLAGS="$LDFLAGS -Wl,-znocombreloc"
else
  LDFLAGS="$LDFLAGS -znocombreloc"
fi
740

Lute Kamstra's avatar
Lute Kamstra committed
741
AC_MSG_CHECKING([for -znocombreloc])
742 743 744 745 746
AC_LINK_IFELSE([main(){return 0;}],
  [AC_MSG_RESULT(yes)],
  LDFLAGS=$late_LDFLAGS
  [AC_MSG_RESULT(no)])

747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793
#### Extract some information from the operating system and machine files.

AC_CHECKING([the machine- and system-dependent files to find out
 - which libraries the lib-src programs will want, and
 - whether the GNU malloc routines are usable])

### First figure out CFLAGS (which we use for running the compiler here)
### and REAL_CFLAGS (which we use for real compilation).
### The two are the same except on a few systems, where they are made
### different to work around various lossages.  For example,
### GCC 2.5 on GNU/Linux needs them to be different because it treats -g
### as implying static linking.

### If the CFLAGS env var is specified, we use that value
### instead of the default.

### It's not important that this name contain the PID; you can't run
### two configures in the same directory and have anything work
### anyway.
tempcname="conftest.c"

echo '
#include "'${srcdir}'/src/'${opsysfile}'"
#include "'${srcdir}'/src/'${machfile}'"
#ifndef LIBS_MACHINE
#define LIBS_MACHINE
#endif
#ifndef LIBS_SYSTEM
#define LIBS_SYSTEM
#endif
#ifndef C_SWITCH_SYSTEM
#define C_SWITCH_SYSTEM
#endif
#ifndef C_SWITCH_MACHINE
#define C_SWITCH_MACHINE
#endif
configure___ libsrc_libs=LIBS_MACHINE LIBS_SYSTEM
configure___ c_switch_system=C_SWITCH_SYSTEM
configure___ c_switch_machine=C_SWITCH_MACHINE

#ifndef LIB_X11_LIB
#define LIB_X11_LIB -lX11
#endif

#ifndef LIBX11_SYSTEM
#define LIBX11_SYSTEM
#endif
794
configure___ LIBX=LIB_X11_LIB LIBX11_SYSTEM
795 796 797 798 799 800 801 802 803 804 805 806 807

#ifdef UNEXEC
configure___ unexec=UNEXEC
#else
configure___ unexec=unexec.o
#endif

#ifdef SYSTEM_MALLOC
configure___ system_malloc=yes
#else
configure___ system_malloc=no
#endif

808 809
#ifdef USE_MMAP_FOR_BUFFERS
configure___ use_mmap_for_buffers=yes
810
#else
811
configure___ use_mmap_for_buffers=no
812 813
#endif

814 815 816 817 818 819 820 821 822 823 824 825
#ifndef C_DEBUG_SWITCH
#define C_DEBUG_SWITCH -g
#endif

#ifndef C_OPTIMIZE_SWITCH
#ifdef __GNUC__
#define C_OPTIMIZE_SWITCH -O2
#else
#define C_OPTIMIZE_SWITCH -O
#endif
#endif

826 827 828 829
#ifndef C_WARNINGS_SWITCH
#define C_WARNINGS_SWITCH ${C_WARNINGS_SWITCH}
#endif

830 831 832 833 834 835 836 837 838 839
#ifndef LD_SWITCH_MACHINE
#define LD_SWITCH_MACHINE
#endif

#ifndef LD_SWITCH_SYSTEM
#define LD_SWITCH_SYSTEM
#endif

#ifndef LD_SWITCH_X_SITE_AUX
#define LD_SWITCH_X_SITE_AUX
840
#endif
841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857

configure___ ld_switch_system=LD_SWITCH_SYSTEM
configure___ ld_switch_machine=LD_SWITCH_MACHINE

#ifdef THIS_IS_CONFIGURE

/* Get the CFLAGS for tests in configure.  */
#ifdef __GNUC__
configure___ CFLAGS=C_DEBUG_SWITCH C_OPTIMIZE_SWITCH '${SPECIFIED_CFLAGS}'
#else
configure___ CFLAGS=C_DEBUG_SWITCH '${SPECIFIED_CFLAGS}'
#endif

#else /* not THIS_IS_CONFIGURE */

/* Get the CFLAGS for real compilation.  */
#ifdef __GNUC__
858
configure___ REAL_CFLAGS=C_DEBUG_SWITCH C_OPTIMIZE_SWITCH C_WARNINGS_SWITCH '${SPECIFIED_CFLAGS}'
859 860 861 862 863 864 865 866 867 868
#else
configure___ REAL_CFLAGS=C_DEBUG_SWITCH '${SPECIFIED_CFLAGS}'
#endif

#endif /* not THIS_IS_CONFIGURE */
' > ${tempcname}

# The value of CPP is a quoted variable reference, so we need to do this
# to get its actual value...
CPP=`eval "echo $CPP"`
Dave Love's avatar
Dave Love committed
869
[eval `${CPP} -Isrc ${tempcname} \
870 871 872 873 874 875
       | sed -n -e 's/^configure___ \([^=]*=\)\(.*\)$/\1"\2"/p'`
if test "x$SPECIFIED_CFLAGS" = x; then
  eval `${CPP} -Isrc -DTHIS_IS_CONFIGURE ${tempcname} \
	 | sed -n -e 's/^configure___ \([^=]*=\)\(.*\)$/\1"\2"/p'`
else
  REAL_CFLAGS="$CFLAGS"
Dave Love's avatar
Dave Love committed
876
fi]
877 878 879 880 881 882 883 884 885 886 887 888
rm ${tempcname}

ac_link="$ac_link $ld_switch_machine $ld_switch_system"

### Make sure subsequent tests use flags consistent with the build flags.

if test x"${OVERRIDE_CPPFLAGS}" != x; then
  CPPFLAGS="${OVERRIDE_CPPFLAGS}"
else
  CPPFLAGS="$c_switch_system $c_switch_machine $CPPFLAGS"
fi

889 890 891
dnl For AC_FUNC_GETLOADAVG, at least:
AC_CONFIG_LIBOBJ_DIR(src)

Dave Love's avatar
Dave Love committed
892 893 894
dnl Do this early because it can frob feature test macros for Unix-98 &c.
AC_SYS_LARGEFILE

895

896
### The standard library on x86-64 and s390x GNU/Linux distributions can
897 898
### be located in either /usr/lib64 or /usr/lib.
case "${canonical}" in
899
  x86_64-*-linux-gnu* | s390x-*-linux-gnu* )
900
    if test -d /usr/lib64; then
901 902
      AC_DEFINE(HAVE_LIB64_DIR, 1,
        [Define to 1 if the directory /usr/lib64 exists.])
903 904 905
fi
esac

906 907 908 909 910 911 912
dnl This function defintion taken from Gnome 2.0
dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
dnl also defines GSTUFF_PKG_ERRORS on error
AC_DEFUN([PKG_CHECK_MODULES], [
  succeeded=no

913
  AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
914 915 916 917 918 919 920 921 922

  if test "$PKG_CONFIG" = "no" ; then
     ifelse([$4], , [AC_MSG_ERROR([
      *** 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])
  else
     PKG_CONFIG_MIN_VERSION=0.9.0
     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
        AC_MSG_CHECKING(for $2)

923
        if $PKG_CONFIG --exists "$2" 2>&AS_MESSAGE_LOG_FD; then
924 925 926 927
            AC_MSG_RESULT(yes)
            succeeded=yes

            AC_MSG_CHECKING($1_CFLAGS)
928
            $1_CFLAGS=`$PKG_CONFIG --cflags "$2"|sed -e 's,///*,/,g'`
929 930 931
            AC_MSG_RESULT($$1_CFLAGS)

            AC_MSG_CHECKING($1_LIBS)
932
            $1_LIBS=`$PKG_CONFIG --libs "$2"|sed -e 's,///*,/,g'`
933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959
            AC_MSG_RESULT($$1_LIBS)
        else
            AC_MSG_RESULT(no)
            $1_CFLAGS=""
            $1_LIBS=""
            ## If we have a custom action on failure, don't print errors, but
            ## do set a variable so people can do so.
            $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
            ifelse([$4], ,echo $$1_PKG_ERRORS,)
        fi

        AC_SUBST($1_CFLAGS)
        AC_SUBST($1_LIBS)
     else
        echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
        echo "*** See http://www.freedesktop.org/software/pkgconfig"
     fi
  fi

  if test $succeeded = yes; then
     ifelse([$3], , :, [$3])
  else
     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])
  fi
])


Pavel Janík's avatar
Pavel Janík committed
960 961 962 963 964 965
if test "${with_sound}" != "no"; then
  # Sound support for GNU/Linux and the free BSDs.
  AC_CHECK_HEADERS(machine/soundcard.h sys/soundcard.h soundcard.h)
  # Emulation library used on NetBSD.
  AC_CHECK_LIB(ossaudio, _oss_ioctl, LIBSOUND=-lossaudio, LIBSOUND=)
  AC_SUBST(LIBSOUND)
966 967 968 969 970

  ALSA_REQUIRED=1.0.0
  ALSA_MODULES="alsa >= $ALSA_REQUIRED"
  PKG_CHECK_MODULES(ALSA, $ALSA_MODULES, HAVE_ALSA=yes, HAVE_ALSA=no)
  if test $HAVE_ALSA = yes; then
971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990
    SAVE_CFLAGS="$CFLAGS"
    SAVE_LDFLAGS="$LDFLAGS"
    CFLAGS="$ALSA_CFLAGS $CFLAGS"
    LDFLAGS="$ALSA_LIBS $LDFLAGS"
    AC_TRY_COMPILE([#include <asoundlib.h>], [snd_lib_error_set_handler (0);],
                    emacs_alsa_normal=yes,
	            emacs_alsa_normal=no)
    if test "$emacs_alsa_normal" != yes; then
      AC_TRY_COMPILE([#include <alsa/asoundlib.h>],
                     [snd_lib_error_set_handler (0);],
                     emacs_alsa_subdir=yes,
	             emacs_alsa_subdir=no)
      if test "$emacs_alsa_subdir" != yes; then
        AC_MSG_ERROR([pkg-config found alsa, but it does not compile.  See config.log for error messages.])
      fi
      ALSA_CFLAGS="$ALSA_CFLAGS -DALSA_SUBDIR_INCLUDE"
    fi

    CFLAGS="$SAVE_CFLAGS"
    LDFLAGS="$SAVE_LDFLAGS"
991 992 993 994 995
    LIBSOUND="$LIBSOUND $ALSA_LIBS"
    CFLAGS_SOUND="$CFLAGS_SOUND $ALSA_CFLAGS"
    AC_DEFINE(HAVE_ALSA, 1, [Define to 1 if ALSA is available.])
  fi
  AC_SUBST(CFLAGS_SOUND)
Pavel Janík's avatar
Pavel Janík committed
996
fi
Gerd Moellmann's avatar
Gerd Moellmann committed
997

David J. MacKenzie's avatar
David J. MacKenzie committed
998
dnl checks for header files
999 1000
AC_CHECK_HEADERS(sys/select.h sys/timeb.h sys/time.h unistd.h utime.h \
  linux/version.h sys/systeminfo.h termios.h limits.h string.h stdlib.h \
1001
  termcap.h stdio_ext.h fcntl.h strings.h coff.h pty.h sys/mman.h \
1002
  sys/param.h sys/vlimit.h sys/resource.h locale.h sys/_mbstate_t.h \
Thien-Thi Nguyen's avatar
Thien-Thi Nguyen committed
1003
  sys/utsname.h pwd.h)
1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015

AC_MSG_CHECKING(if personality LINUX32 can be set)
AC_TRY_COMPILE([#include <sys/personality.h>], [personality (PER_LINUX32)],
               emacs_cv_personality_linux32=yes,
	       emacs_cv_personality_linux32=no)
AC_MSG_RESULT($emacs_cv_personality_linux32)

if test $emacs_cv_personality_linux32 = yes; then
  AC_DEFINE(HAVE_PERSONALITY_LINUX32, 1,
            [Define to 1 if personality LINUX32 can be set.])
fi

Dave Love's avatar
Dave Love committed
1016 1017 1018
dnl On Solaris 8 there's a compilation warning for term.h because
dnl it doesn't define `bool'.
AC_CHECK_HEADERS(term.h, , , -)
David J. MacKenzie's avatar
David J. MacKenzie committed
1019 1020
AC_HEADER_STDC
AC_HEADER_TIME
1021 1022 1023 1024 1025 1026 1027 1028 1029
AC_CHECK_DECLS([sys_siglist])
if test $ac_cv_have_decl_sys_siglist != yes; then
  # For Tru64, at least:
  AC_CHECK_DECLS([__sys_siglist])
  if test $ac_cv_have_decl___sys_siglist = yes; then
    AC_DEFINE(sys_siglist, __sys_siglist,
              [Define to any substitute for sys_siglist.])
  fi
fi
Dave Love's avatar
Dave Love committed
1030
AC_HEADER_SYS_WAIT
David J. MacKenzie's avatar
David J. MacKenzie committed
1031

David J. MacKenzie's avatar
David J. MacKenzie committed
1032
dnl Some systems have utime.h but don't declare the struct anyplace.
1033
AC_CACHE_CHECK(for struct utimbuf, emacs_cv_struct_utimbuf,
David J. MacKenzie's avatar
David J. MacKenzie committed
1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046
AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME
#include <sys/time.h>
#include <time.h>
#else
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#else
#include <time.h>
#endif
#endif
#ifdef HAVE_UTIME_H
#include <utime.h>
#endif], [static struct utimbuf x; x.actime = x.modtime;],
1047 1048
  emacs_cv_struct_utimbuf=yes, emacs_cv_struct_utimbuf=no))
if test $emacs_cv_struct_utimbuf = yes; then
1049
  AC_DEFINE(HAVE_STRUCT_UTIMBUF, 1, [Define to 1 if `struct utimbuf' is declared by <utime.h>.])
1050
fi
David J. MacKenzie's avatar
David J. MacKenzie committed
1051

David J. MacKenzie's avatar
David J. MacKenzie committed
1052
dnl checks for typedefs
David J. MacKenzie's avatar
David J. MacKenzie committed
1053
AC_TYPE_SIGNAL
David J. MacKenzie's avatar
David J. MacKenzie committed
1054

1055 1056
dnl Check for speed_t typedef.
AC_CACHE_CHECK(for speed_t, emacs_cv_speed_t,
1057 1058
  [AC_TRY_COMPILE([#include <termios.h>], [speed_t x = 1;],
    emacs_cv_speed_t=yes, emacs_cv_speed_t=no)])
1059
if test $emacs_cv_speed_t = yes; then
1060
  AC_DEFINE(HAVE_SPEED_T, 1,
1061
  	   [Define to 1 if `speed_t' is declared by <termios.h>.])
1062 1063
fi

1064
AC_CACHE_CHECK(for struct timeval, emacs_cv_struct_timeval,
David J. MacKenzie's avatar
David J. MacKenzie committed
1065 1066 1067 1068 1069 1070 1071 1072 1073 1074
AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME
#include <sys/time.h>
#include <time.h>
#else
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#else
#include <time.h>
#endif
#endif], [static struct timeval x; x.tv_sec = x.tv_usec;],
1075 1076 1077
  emacs_cv_struct_timeval=yes, emacs_cv_struct_timeval=no))
HAVE_TIMEVAL=$emacs_cv_struct_timeval
if test $emacs_cv_struct_timeval = yes; then
1078
  AC_DEFINE(HAVE_TIMEVAL, 1, [Define to 1 if `struct timeval' is declared by <sys/time.h>.])
1079
fi
David J. MacKenzie's avatar
David J. MacKenzie committed
1080

1081
AC_CACHE_CHECK(for struct exception, emacs_cv_struct_exception,
1082
AC_TRY_COMPILE([#include <math.h>],
1083 1084 1085 1086
[static struct exception x; x.arg1 = x.arg2 = x.retval; x.name = ""; x.type = 1;],
  emacs_cv_struct_exception=yes, emacs_cv_struct_exception=no))
HAVE_EXCEPTION=$emacs_cv_struct_exception
if test $emacs_cv_struct_exception != yes; then
1087
  AC_DEFINE(NO_MATHERR, 1, [Define to 1 if you don't have struct exception in math.h.])
1088 1089
fi

1090 1091 1092 1093 1094 1095
AC_CHECK_HEADERS(sys/socket.h)
AC_CHECK_HEADERS(net/if.h, , , [AC_INCLUDES_DEFAULT
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif])

David J. MacKenzie's avatar
David J. MacKenzie committed
1096 1097
dnl checks for structure members
AC_STRUCT_TM
David J. MacKenzie's avatar
David J. MacKenzie committed
1098
AC_STRUCT_TIMEZONE
1099 1100 1101 1102
AC_CHECK_MEMBER(struct tm.tm_gmtoff,
		[AC_DEFINE(HAVE_TM_GMTOFF, 1,
			   [Define to 1 if `tm_gmtoff' is member of `struct tm'.])],,
		[#include <time.h>])
Thien-Thi Nguyen's avatar
Thien-Thi Nguyen committed
1103
AC_CHECK_MEMBERS([struct ifreq.ifr_flags, struct ifreq.ifr_hwaddr,
Dave Love's avatar
Dave Love committed
1104
		  struct ifreq.ifr_netmask, struct ifreq.ifr_broadaddr,
1105 1106 1107 1108 1109 1110 1111 1112
		  struct ifreq.ifr_addr], , ,
		 [AC_INCLUDES_DEFAULT
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#if HAVE_NET_IF_H
#include <net/if.h>
#endif])
David J. MacKenzie's avatar
David J. MacKenzie committed
1113 1114

dnl checks for compiler characteristics
1115 1116 1117 1118 1119 1120 1121

dnl Testing __STDC__ to determine prototype support isn't good enough.
dnl DEC C, for instance, doesn't define it with default options, and
dnl is used on 64-bit systems (OSF Alphas).  Similarly for volatile
dnl and void *.
AC_C_PROTOTYPES
AC_C_VOLATILE
David J. MacKenzie's avatar
David J. MacKenzie committed
1122
AC_C_CONST
1123 1124 1125 1126
dnl This isn't useful because we can't turn on use of `inline' unless
dnl the compiler groks `extern inline'.
dnl AC_C_INLINE
AC_CACHE_CHECK([for void * support], emacs_cv_void_star,
1127
  [AC_TRY_COMPILE(, [void * foo;],
1128 1129 1130 1131 1132 1133
                   emacs_cv_void_star=yes, emacs_cv_void_star=no)])
if test $emacs_cv_void_star = yes; then
  AC_DEFINE(POINTER_TYPE, void)
else
  AC_DEFINE(POINTER_TYPE, char)
fi
1134 1135 1136
AH_TEMP