configure.in 98.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 12
dnl  GNU Emacs is free software; you can redistribute it and/or modify
dnl  it under the terms of the GNU General Public License as published by
13
dnl  the Free Software Foundation; either version 3, or (at your option)
14
dnl  any later version.
15
dnl
16 17 18 19 20 21
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.
dnl
dnl  You should have received a copy of the GNU General Public License
Karl Heuer's avatar
Karl Heuer committed
22
dnl  along with GNU Emacs; see the file COPYING.  If not, write to the
Lute Kamstra's avatar
Lute Kamstra committed
23 24
dnl  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
dnl  Boston, MA 02110-1301, USA.
25

Richard M. Stallman's avatar
Richard M. Stallman committed
26
AC_PREREQ(2.61)dnl
Glenn Morris's avatar
Glenn Morris committed
27
AC_INIT(emacs, 23.0.60)
28
AC_CONFIG_HEADER(src/config.h:src/config.in)
29
AC_CONFIG_SRCDIR(src/lisp.h)
David J. MacKenzie's avatar
David J. MacKenzie committed
30

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

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

46 47 48 49 50 51 52 53 54 55 56 57
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
58
])dnl
59 60 61 62 63 64 65 66 67 68 69 70

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
71 72
])dnl

73 74
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
75
   AC_DEFINE(MAIL_USE_POP)
76
fi
77
AH_TEMPLATE(MAIL_USE_POP, [Define to support POP mail retrieval.])dnl
78

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

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

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

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

102
dnl FIXME currently it is not the last.
David J. MacKenzie's avatar
David J. MacKenzie committed
103 104 105
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.
106 107
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
108
[	  case "${withval}" in
Glenn Morris's avatar
Glenn Morris committed
109
	    y | ye | yes )	val=gtk ;;
David J. MacKenzie's avatar
David J. MacKenzie committed
110 111
	    n | no )		val=no  ;;
	    l | lu | luc | luci | lucid )	val=lucid ;;
112
	    a | at | ath | athe | athen | athena )	val=athena ;;
David J. MacKenzie's avatar
David J. MacKenzie committed
113
	    m | mo | mot | moti | motif )	val=motif ;;
Jan Djärv's avatar
Jan Djärv committed
114
	    g | gt | gtk  )	val=gtk ;;
David J. MacKenzie's avatar
David J. MacKenzie committed
115
	    * )
116
AC_MSG_ERROR([`--with-x-toolkit=$withval' is invalid;
Jan Djärv's avatar
Jan Djärv committed
117
this option's value should be `yes', `no', `lucid', `athena', `motif' or `gtk'.
118
`yes' and `gtk' are synonyms. `athena' and `lucid' are synonyms.])
David J. MacKenzie's avatar
David J. MacKenzie committed
119 120 121 122
	    ;;
	  esac
	  with_x_toolkit=$val
])
123

124 125 126 127 128 129 130 131 132
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])

133 134
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
135 136 137
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])

138 139 140
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])
141
OPTION_DEFAULT_OFF([carbon],[use Carbon GUI on Mac OS X.  This is unsupported!])
142 143

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

146 147 148 149 150 151 152 153 154
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.]),,)

155
AC_ARG_WITH([pkg-config-prog],dnl
156
[AS_HELP_STRING([--with-pkg-config-prog=PATH],
157 158 159 160 161 162
                  [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
163

164
AC_ARG_ENABLE(carbon-app,
165 166 167
[AS_HELP_STRING([--enable-carbon-app@<:@=DIR@:>@],
                [specify install directory for Emacs.app on Mac OS X
		 [DIR=/Application]])],
168
[ carbon_appdir_x=${enableval}])
David J. MacKenzie's avatar
David J. MacKenzie committed
169

Glenn Morris's avatar
Glenn Morris committed
170
## Enabled by default.
171
AC_ARG_ENABLE(font-backend,
Glenn Morris's avatar
Glenn Morris committed
172
[AS_HELP_STRING([--disable-font-backend],[don't compile font-backend support])],
173
      USE_FONT_BACKEND=$enableval,
Glenn Morris's avatar
Glenn Morris committed
174
      USE_FONT_BACKEND=yes)
175

Glenn Morris's avatar
Glenn Morris committed
176
## Enabled by default.
177
AC_ARG_ENABLE(sync-input,
Glenn Morris's avatar
Glenn Morris committed
178
[AS_HELP_STRING([--disable-sync-input], [don't compile code with sync-input])],
179 180 181
      USE_SYNC_INPUT=$enableval,
      USE_SYNC_INPUT=yes)

182
AC_ARG_ENABLE(asserts,
183
[AS_HELP_STRING([--enable-asserts], [compile code with asserts enabled])],
184 185 186
      USE_XASSERTS=$enableval,
      USE_XASSERTS=no)

187
AC_ARG_ENABLE(maintainer-mode,
188 189 190
[AS_HELP_STRING([--enable-maintainer-mode],
                [enable make rules and dependencies not useful (and sometimes
		 confusing) to the casual installer])],
191 192 193 194 195 196 197 198 199
      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
200
AC_ARG_ENABLE(locallisppath,
201 202 203
[AS_HELP_STRING([--enable-locallisppath=PATH],
                [directories Emacs should search for lisp files specific
		 to this site])],
Lute Kamstra's avatar
Lute Kamstra committed
204 205 206 207 208 209
if test "${enableval}" = "no"; then
  locallisppath=
elif test "${enableval}" != "yes"; then
  locallisppath=${enableval}
fi)

David J. MacKenzie's avatar
David J. MacKenzie committed
210
#### Make srcdir absolute, if it isn't already.  It's important to
211
#### avoid running the path through pwd unnecessarily, since pwd can
David J. MacKenzie's avatar
David J. MacKenzie committed
212 213
#### give you automounter prefixes, which can go away.  We do all this
#### so Emacs can find its files when run uninstalled.
214 215
## Make sure CDPATH doesn't affect cd (in case PWD is relative).
unset CDPATH
David J. MacKenzie's avatar
David J. MacKenzie committed
216 217 218 219 220
case "${srcdir}" in
  /* ) ;;
  . )
    ## We may be able to use the $PWD environment variable to make this
    ## absolute.  But sometimes PWD is inaccurate.
221 222 223 224
    ## 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
225 226 227 228 229 230 231 232 233 234 235 236
    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
237
  AC_MSG_WARN([[The directory tree `${srcdir}' is being used
David J. MacKenzie's avatar
David J. MacKenzie committed
238 239 240
   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
241 242
   now do `make distclean' in ${srcdir},
   and then run $0 again.]])
David J. MacKenzie's avatar
David J. MacKenzie committed
243 244 245 246 247 248 249 250 251
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
252
configuration=${host_alias-${build_alias-$host}}
David J. MacKenzie's avatar
David J. MacKenzie committed
253

Dave Love's avatar
Dave Love committed
254 255 256 257
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.
258 259 260 261
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
262
[
David J. MacKenzie's avatar
David J. MacKenzie committed
263 264 265 266 267 268 269 270 271

### 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
272 273
### example hp9000s300.h is a 68000 machine;
### mips.h, pmax.h are all MIPS
David J. MacKenzie's avatar
David J. MacKenzie committed
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289
### machines.  So we basically have to have a special case for each
### 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

290 291 292 293 294
  ## FreeBSD ports
  *-*-freebsd* )
    opsys=freebsd
    case "${canonical}" in
      alpha*-*-freebsd*)	machine=alpha ;;
295
      arm*-*-freebsd*)          machine=arm ;;
296 297 298
      ia64-*-freebsd*)		machine=ia64 ;;
      sparc64-*-freebsd*)	machine=sparc ;;
      powerpc-*-freebsd*)	machine=macppc ;;
299
      i[3456]86-*-freebsd*)	machine=intel386 ;;
Karl Berry's avatar
Karl Berry committed
300
      amd64-*-freebsd*|x86_64-*-freebsd*) machine=amdx86-64 ;;
301 302 303
    esac
  ;;

304 305 306 307 308 309 310 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 ;;
      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
317 318 319
  ## NetBSD ports
  *-*-netbsd* )
    opsys=netbsd
320
    if test -f /usr/lib/crti.o; then]
321 322 323
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.])
324
[   fi
325

David J. MacKenzie's avatar
David J. MacKenzie committed
326
    case "${canonical}" in
327
      alpha*-*-netbsd*)	machine=alpha ;;
328
      i[3456]86-*-netbsd*) machine=intel386 ;;
David J. MacKenzie's avatar
David J. MacKenzie committed
329 330 331 332
      m68k-*-netbsd*)
			# This is somewhat bogus.
			machine=hp9000s300 ;;
      mips-*-netbsd*)	machine=pmax ;;
333
      mipsel-*-netbsd*)	machine=pmax ;;
334
      mipseb-*-netbsd*)	machine=pmax ;;
335
      powerpc-*-netbsd*) machine=macppc ;;
Gerd Moellmann's avatar
Gerd Moellmann committed
336
      sparc*-*-netbsd*)	machine=sparc ;;
Richard M. Stallman's avatar
Richard M. Stallman committed
337
      vax-*-netbsd*)	machine=vax ;;
338
      arm-*-netbsd*)	machine=arm ;;
339 340
      x86_64-*-netbsd*)	machine=amdx86-64 ;;
      hppa-*-netbsd*)	machine=hp800 ;;
David J. MacKenzie's avatar
David J. MacKenzie committed
341 342 343
    esac
  ;;

344 345 346 347
  ## OpenBSD ports
  *-*-openbsd* )
    opsys=openbsd
    case "${canonical}" in
348
      alpha*-*-openbsd*)	machine=alpha ;;
349 350 351 352 353 354 355 356
      arm-*-openbsd*)          machine=arm ;;
      hppa-*-openbsd*)         machine=hp9000s300 ;;
      i386-*-openbsd*)         machine=intel386 ;;
      m68k-*-openbsd*)         machine=hp9000s300 ;;
      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 370 371 372 373 374
  ## BSDI ports
  *-*-bsdi* )
    opsys=bsdi
    case "${canonical}" in
      i[345]86-*-bsdi*) machine=intel386 ;;
      sparc-*-bsdi*)  machine=sparc ;;
375
      powerpc-*-bsdi*)  machine=macppc ;;
376 377 378 379 380 381
    esac
    case "${canonical}" in
      *-*-bsd386* | *-*-bsdi1* )	opsys=bsd386 ;;
      *-*-bsdi2.0* )		opsys=bsdos2 ;;
      *-*-bsdi2* )		opsys=bsdos2-1 ;;
      *-*-bsdi3* )		opsys=bsdos3 ;;
Eli Zaretskii's avatar
Eli Zaretskii committed
382
      *-*-bsdi[45]* )		opsys=bsdos4 ;;
383 384 385
    esac
  ;;

386
  alpha*-*-linux-gnu* )
387
    machine=alpha opsys=gnu-linux
388 389
  ;;

390 391 392 393
  arm*-*-linux-gnu* )
    machine=arm opsys=gnu-linux
  ;;

394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411
  ## Apple Darwin / Mac OS X
  *-apple-darwin* )
    case "${canonical}" in
      i[3456]86-* )  machine=intel386 ;;
      powerpc-* )    machine=powermac ;;
      * )            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
  ;;

David J. MacKenzie's avatar
David J. MacKenzie committed
412
  ## Cubix QBx/386
413
  i[3456]86-cubix-sysv* )
David J. MacKenzie's avatar
David J. MacKenzie committed
414 415 416 417 418 419
    machine=intel386 opsys=usg5-3
  ;;

  mips-dec-ultrix[0-3].* | mips-dec-ultrix4.0* | mips-dec-bsd4.2* )
    machine=pmax opsys=bsd4-2
  ;;
420
  mips-dec-ultrix4.[12]* | mips-dec-bsd* )
David J. MacKenzie's avatar
David J. MacKenzie committed
421 422
    machine=pmax opsys=bsd4-3
  ;;
423 424 425
  mips-dec-ultrix* )
    machine=pmax opsys=ultrix4-3
  ;;
David J. MacKenzie's avatar
David J. MacKenzie committed
426 427 428 429
  ## HP 9000 series 200 or 300
  m68*-hp-bsd* )
    machine=hp9000s300 opsys=bsd4-3
  ;;
430
  ## HP/UX 7, 8, 9, and 10 are supported on these machines.
David J. MacKenzie's avatar
David J. MacKenzie committed
431 432 433 434 435 436 437
  m68*-hp-hpux* )
    case "`uname -r`" in
      ## Someone's system reports A.B8.05 for this.
      ## I wonder what other possibilities there are.
      *.B8.* ) machine=hp9000s300 opsys=hpux8 ;;
      *.08.* ) machine=hp9000s300 opsys=hpux8 ;;
      *.09.* ) machine=hp9000s300 opsys=hpux9 ;;
438
      *.1[0-9].* ) machine=hp9000s300 opsys=hpux9shr ;;
David J. MacKenzie's avatar
David J. MacKenzie committed
439 440 441 442
      *) machine=hp9000s300 opsys=hpux ;;
    esac
  ;;

443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466
  ## HP 9000 series 700 and 800, running HP/UX
  hppa*-hp-hpux7* )
    machine=hp800 opsys=hpux
  ;;
  hppa*-hp-hpux8* )
    machine=hp800 opsys=hpux8
  ;;
  hppa*-hp-hpux9shr* )
    machine=hp800 opsys=hpux9shr
  ;;
  hppa*-hp-hpux9* )
    machine=hp800 opsys=hpux9
  ;;
  hppa*-hp-hpux10.2* )
    machine=hp800 opsys=hpux10-20
  ;;
  hppa*-hp-hpux10* )
    machine=hp800 opsys=hpux10
  ;;
  hppa*-hp-hpux1[1-9]* )
    machine=hp800 opsys=hpux11
    CFLAGS="-D_INCLUDE__STDC_A1_SOURCE $CFLAGS"
  ;;

467 468 469 470
  hppa*-*-linux-gnu* )
    machine=hp800 opsys=gnu-linux
  ;;

471 472 473 474 475 476 477 478 479 480 481 482
  ## HP 9000 series 700 and 800, running HP/UX
  hppa*-hp-hpux* )
    ## Cross-compilation?  Nah!
    case "`uname -r`" in
      ## Someone's system reports A.B8.05 for this.
      ## I wonder what other possibilities there are.
      *.B8.* ) machine=hp800 opsys=hpux8 ;;
      *.08.* ) machine=hp800 opsys=hpux8 ;;
      *.09.* ) machine=hp800 opsys=hpux9 ;;
      *) machine=hp800 opsys=hpux10 ;;
    esac
  ;;
483
  hppa*-*-nextstep* )
484 485
    machine=hp800 opsys=nextstep
  ;;
David J. MacKenzie's avatar
David J. MacKenzie committed
486 487 488 489 490

  ## IBM machines
  i370-ibm-aix*)
    machine=ibm370aix opsys=usg5-3
  ;;
Dave Love's avatar
Dave Love committed
491
  s390-*-linux-gnu* )
492 493
    machine=ibms390 opsys=gnu-linux
  ;;
494 495
  s390x-*-linux-gnu* )
    machine=ibms390x opsys=gnu-linux
496
  ;;
497
  rs6000-ibm-aix3.1* | powerpc-ibm-aix3.1*  )
David J. MacKenzie's avatar
David J. MacKenzie committed
498 499
    machine=ibmrs6000 opsys=aix3-1
  ;;
500
  rs6000-ibm-aix3.2.5 | powerpc-ibm-aix3.2.5 )
David J. MacKenzie's avatar
David J. MacKenzie committed
501 502
    machine=ibmrs6000 opsys=aix3-2-5
  ;;
503 504 505
  rs6000-ibm-aix4.1* | powerpc-ibm-aix4.1*  )
    machine=ibmrs6000 opsys=aix4-1
  ;;
506 507 508
  rs6000-ibm-aix4.2* | powerpc-ibm-aix4.2*  )
    machine=ibmrs6000 opsys=aix4-2
  ;;
509 510 511
  rs6000-ibm-aix4.3* | powerpc-ibm-aix4.3*  )
    machine=ibmrs6000 opsys=aix4-2
  ;;
512
  rs6000-ibm-aix5* | powerpc-ibm-aix5*  )
Eli Zaretskii's avatar
Eli Zaretskii committed
513 514
    machine=ibmrs6000 opsys=aix4-2
  ;;
515 516 517
  rs6000-ibm-aix5* | powerpc-ibm-aix6*  )
    machine=ibmrs6000 opsys=aix4-2
  ;;
518
  rs6000-ibm-aix4.0* | powerpc-ibm-aix4.0*  )
519 520
    machine=ibmrs6000 opsys=aix4
  ;;
521 522 523
  rs6000-ibm-aix4* | powerpc-ibm-aix4*  )
    machine=ibmrs6000 opsys=aix4-1
  ;;
524
  rs6000-ibm-aix* | powerpc-ibm-aix* )
David J. MacKenzie's avatar
David J. MacKenzie committed
525 526 527 528
    machine=ibmrs6000 opsys=aix3-2
  ;;

  ## Prime EXL
529
  i[3456]86-prime-sysv* )
David J. MacKenzie's avatar
David J. MacKenzie committed
530 531 532
    machine=i386 opsys=usg5-3
  ;;

533 534 535 536 537
  ## ncr machine running svr4.3.
  i[3456]86-ncr-sysv4.3 )
    machine=ncr386 opsys=usg5-4-3
  ;;

David J. MacKenzie's avatar
David J. MacKenzie committed
538 539
  ## Unspecified sysv on an ncr machine defaults to svr4.2.
  ## (Plain usg5-4 doesn't turn on POSIX signals, which we need.)
540
  i[3456]86-ncr-sysv* )
Richard M. Stallman's avatar
Richard M. Stallman committed
541
    machine=ncr386 opsys=usg5-4-2
David J. MacKenzie's avatar
David J. MacKenzie committed
542 543
  ;;

544 545 546 547 548
  ## Macintosh PowerPC
  powerpc*-*-linux-gnu* )
    machine=macppc opsys=gnu-linux
  ;;

David J. MacKenzie's avatar
David J. MacKenzie committed
549 550 551 552 553 554 555 556 557 558 559 560
  ## Workstations sold by MIPS
  ## This is not necessarily all workstations using the MIPS processor -
  ## Irises are produced by SGI, and DECstations by DEC.

  mips-mips-bsd* )
    machine=mips opsys=bsd4-3
  ;;
  mips-mips-* )
    machine=mips opsys=usg5-2-2
  ;;

  ## NeXT
561 562
  m68*-next-* | m68k-*-nextstep* )
    machine=m68k opsys=nextstep
David J. MacKenzie's avatar
David J. MacKenzie committed
563 564
  ;;

Kenichi Handa's avatar
Kenichi Handa committed
565 566 567 568 569
  ## NEC EWS4800
  mips-nec-sysv4*)
  machine=ews4800 opsys=ux4800
  ;;

David J. MacKenzie's avatar
David J. MacKenzie committed
570
  ## Siemens Nixdorf
571
  mips-siemens-sysv* | mips-sni-sysv*)
David J. MacKenzie's avatar
David J. MacKenzie committed
572 573 574 575 576 577 578
    machine=mips-siemens opsys=usg5-4
    NON_GNU_CC=/usr/ccs/bin/cc
    NON_GNU_CPP=/usr/ccs/lib/cpp
  ;;

  ## Silicon Graphics machines
  ## Iris 4D
Karl Heuer's avatar
Karl Heuer committed
579 580
  mips-sgi-irix6.5 )
    machine=iris4d opsys=irix6-5
581 582 583 584
    # 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"
585
    NON_GCC_TEST_OPTIONS="-D_LANGUAGE_C"
Karl Heuer's avatar
Karl Heuer committed
586
  ;;
David J. MacKenzie's avatar
David J. MacKenzie committed
587 588

  ## Suns
Dave Love's avatar
Dave Love committed
589
  sparc-*-linux-gnu* | sparc64-*-linux-gnu* )
590
    machine=sparc opsys=gnu-linux
Karl Heuer's avatar
Karl Heuer committed
591 592
  ;;

593
  *-auspex-sunos* | *-sun-sunos* | *-sun-bsd* | *-sun-solaris* \
594
    | i[3456]86-*-solaris2* | i[3456]86-*-sunos5* | powerpc*-*-solaris2* \
595
    | rs6000-*-solaris2*)
David J. MacKenzie's avatar
David J. MacKenzie committed
596
    case "${canonical}" in
597
      i[3456]86-*-* )     machine=intel386 ;;
598
      amd64-*-*|x86_64-*-*)	machine=amdx86-64 ;;
599
      powerpcle* )      machine=powerpcle ;;
600
      powerpc* | rs6000* )  machine=ibmrs6000 ;;
David J. MacKenzie's avatar
David J. MacKenzie committed
601 602 603 604 605 606 607 608 609 610 611
      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
612
		RANLIB="ar -ts"
David J. MacKenzie's avatar
David J. MacKenzie committed
613
		;;
614 615 616
      *-sunos5.5* | *-solaris2.5* )
		opsys=sol2-5
		NON_GNU_CPP=/usr/ccs/lib/cpp
617
		RANLIB="ar -ts"
618
		;;
619 620 621 622 623
      *-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
624
      *-sunos5* | *-solaris* )
625
		opsys=sol2-6
626 627
		emacs_check_sunpro_c=yes
		NON_GNU_CPP=/usr/ccs/lib/cpp
David J. MacKenzie's avatar
David J. MacKenzie committed
628 629 630
		;;
      *			  ) opsys=bsd4-2   ;;
    esac
631 632 633 634 635 636 637 638 639 640 641
    ## 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
642
  ;;
643
  sparc-*-nextstep* )
644
    machine=sparc opsys=nextstep
645
  ;;
David J. MacKenzie's avatar
David J. MacKenzie committed
646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665

  ## Tandem Integrity S2
  mips-tandem-sysv* )
    machine=tandem-s2 opsys=usg5-3
  ;;

  ## Vaxen.
  vax-dec-* )
    machine=vax
    case "${canonical}" in
      *-bsd4.1* ) 					opsys=bsd4-1 ;;
      *-bsd4.2* | *-ultrix[0-3].* | *-ultrix4.0* )	opsys=bsd4-2 ;;
      *-bsd4.3* | *-ultrix* ) 				opsys=bsd4-3 ;;
      *-sysv[01]* | *-sysvr[01]* ) 			opsys=usg5-0 ;;
      *-sysv2* | *-sysvr2* )				opsys=usg5-2 ;;
      *-vms* ) 						opsys=vms ;;
      * ) 						unported=yes
    esac
  ;;

666 667 668 669 670
  ## IA-64
  ia64*-*-linux* )
    machine=ia64 opsys=gnu-linux
  ;;

David J. MacKenzie's avatar
David J. MacKenzie committed
671
  ## Intel 386 machines where we don't care about the manufacturer
672
  i[3456]86-*-* )
David J. MacKenzie's avatar
David J. MacKenzie committed
673 674
    machine=intel386
    case "${canonical}" in
Juanma Barranquero's avatar
Juanma Barranquero committed
675
      *-cygwin )                opsys=cygwin ;;
676
      *-darwin* )               opsys=darwin
677 678
                                CPP="${CC-cc} -E -no-cpp-precomp"
 				;;
679
      *-linux-gnu* )		opsys=gnu-linux ;;
680
      *-sysv4.2uw* )	  	opsys=unixware; NON_GNU_CPP=/lib/cpp ;;
681 682
      *-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
683
      *-386bsd* )	        opsys=386bsd ;;
684
      *-nextstep* )             opsys=nextstep ;;
David J. MacKenzie's avatar
David J. MacKenzie committed
685 686 687 688
      ## Otherwise, we'll fall through to the generic opsys code at the bottom.
    esac
  ;;

689
  ## m68k Linux-based GNU system
690 691
  m68k-*-linux-gnu* )
    machine=m68k opsys=gnu-linux
692 693
  ;;

694
  ## Mips Linux-based GNU system
695
  mips-*-linux-gnu* | mipsel-*-linux-gnu* )
696 697 698
    machine=mips opsys=gnu-linux
  ;;

699 700 701 702 703 704 705
  ## UXP/DS
  sparc-fujitsu-sysv4* )
    machine=sparc opsys=uxpds
    NON_GNU_CPP=/usr/ccs/lib/cpp
    RANLIB="ar -ts"
  ;;

Andreas Schwab's avatar
Andreas Schwab committed
706 707
  ## AMD x86-64 Linux-based GNU system
  x86_64-*-linux-gnu* )
708
    machine=amdx86-64 opsys=gnu-linux
Andreas Schwab's avatar
Andreas Schwab committed
709 710
  ;;

711
  ## Tensilica Xtensa Linux-based GNU system
Miles Bader's avatar
Miles Bader committed
712
  xtensa*-*-linux-gnu* )
713 714 715
    machine=xtensa opsys=gnu-linux
    ;;

David J. MacKenzie's avatar
David J. MacKenzie committed
716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735
  * )
    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 ;;
    *-bsd4.[01] )			opsys=bsd4-1 ;;
    *-bsd4.2 )				opsys=bsd4-2 ;;
    *-bsd4.3 )				opsys=bsd4-3 ;;
    *-sysv0 | *-sysvr0 )		opsys=usg5-0 ;;
    *-sysv2 | *-sysvr2 )		opsys=usg5-2 ;;
    *-sysv2.2 | *-sysvr2.2 )		opsys=usg5-2-2 ;;
736
    *-sysv3* | *-sysvr3* )		opsys=usg5-3 ;;
737
    *-sysv4.2uw* )			opsys=unixware ;;
738 739
    *-sysv5uw* )			opsys=unixware ;;
    *-sysv5OpenUNIX* )			opsys=unixware ;;
740
    *-sysv4.1* | *-sysvr4.1* )
David J. MacKenzie's avatar
David J. MacKenzie committed
741 742
	NON_GNU_CPP=/usr/lib/cpp
	opsys=usg5-4 ;;
743
    *-sysv4.[2-9]* | *-sysvr4.[2-9]* )
744
	if [ x$NON_GNU_CPP = x ]; then
745 746 747 748 749
	  if [ -f /usr/ccs/lib/cpp ]; then
	    NON_GNU_CPP=/usr/ccs/lib/cpp
	  else
	    NON_GNU_CPP=/lib/cpp
	  fi
750 751
	fi
	opsys=usg5-4-2 ;;
752
    *-sysv4* | *-sysvr4* )		opsys=usg5-4 ;;
David J. MacKenzie's avatar
David J. MacKenzie committed
753 754 755 756 757 758
    * )
      unported=yes
    ;;
  esac
fi

759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782
### Tests for sytems that we beleive are obsolete and should be desupported.

case "${machine}" in
     pmax | hp9000s300 | ibm370aix | ncr386 | ews4800 | mips-siemens | powerpcle | tandem-s2 )
     	  echo "The system that you are configuring on: ${canonical} is considered to be obsolete"
	  echo "and it is planned to be desupported in the next version of Emacs"
	  echo "Please email emacs-devel@gnu.org as soon as possible if this system is still in use."
	  echo "The code is still functional, but you need to edit the 'configure' script and remove the"
	  echo "exit 33 line.  After that you can run configure again and 'complete' the build."
	  exit 33
	  ;;
esac

case "${opsys}" in
     bsd386 | bsdos2-1 |  bsdos2 | bsdos3 | bsdos4 | bsd4-1 | bsd4-2 | bsd4-3 | usg5-0 | usg5-2-2 | usg5-2 | usg5-3 | ultrix4-3 | 386bsd | hpux | hpux8 | hpux9 | hpux9shr | hpux10 | hpux10-20 | aix3-1 | aix3-2-5 | aix3-2 | aix4-1 | nextstep | ux4800 | uxpds | uxpv )
     	  echo "The system that you are configuring on: ${canonical} is considered to be obsolete"
	  echo "and it is planned to be desupported in the next version of Emacs"
	  echo "Please email emacs-devel@gnu.org as soon as possible if this system is still in use."
	  echo "The code is still functional, but you need to edit the 'configure' script and remove the"
	  echo "'exit 44' line.  After that you can run 'configure' again and complete the build."
	  exit 44
	  ;;
esac

Dave Love's avatar
Dave Love committed
783
]
784
dnl quotation ends
David J. MacKenzie's avatar
David J. MacKenzie committed
785 786

if test $unported = yes; then
Dave Love's avatar
Dave Love committed
787 788
  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
789 790 791 792 793 794 795 796 797
fi

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


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

798 799 800
# Save the value of CFLAGS that the user specified.
SPECIFIED_CFLAGS="$CFLAGS"

801
dnl Sets GCC=yes if using gcc.
Andreas Schwab's avatar
Andreas Schwab committed
802
AC_PROG_CC
David J. MacKenzie's avatar
David J. MacKenzie committed
803 804 805 806 807 808

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

809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826
## 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
827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846
#### 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"
847
fi
David J. MacKenzie's avatar
David J. MacKenzie committed
848 849 850 851

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

854 855 856 857
dnl checks for Unix variants
AC_AIX
AC_GNU_SOURCE

858 859 860 861 862 863 864 865 866 867 868 869 870
### 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
871
#### Some other nice autoconf tests.
David J. MacKenzie's avatar
David J. MacKenzie committed
872 873

dnl checks for programs
David J. MacKenzie's avatar
David J. MacKenzie committed
874
AC_PROG_LN_S
David J. MacKenzie's avatar
David J. MacKenzie committed
875 876
AC_PROG_CPP
AC_PROG_INSTALL
877 878 879
if test "x$RANLIB" = x; then
  AC_PROG_RANLIB
fi
David Kastrup's avatar
David Kastrup committed
880 881 882
AC_PATH_PROG(INSTALL_INFO, install-info)
AC_PATH_PROG(INSTALL_INFO, install-info,, /usr/sbin)
AC_PATH_PROG(INSTALL_INFO, install-info,:, /sbin)
883 884
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
885

886

887
## Need makeinfo >= 4.6 (?) to build the manuals.
888
AC_PATH_PROG(MAKEINFO, makeinfo, no)
889
dnl By this stage, configure has already checked for egrep and set EGREP,
890 891
dnl or exited with an error if no egrep was found.
if test "$MAKEINFO" != "no" && \
Glenn Morris's avatar
Glenn Morris committed
892
  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
893
   MAKEINFO=no
894 895 896
fi

if test "$MAKEINFO" = "no"; then
897
  AC_MSG_ERROR( [makeinfo >= 4.6 is required] )
898 899 900
fi


901 902 903 904 905 906 907 908 909 910 911 912
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

913 914 915
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
916 917 918
dnl Treat GCC specially since it just gives a non-fatal `unrecognized option'
dnl if not built to support GNU ld.

919
late_LDFLAGS=$LDFLAGS
920
if test "$GCC" = yes; then
Richard M. Stallman's avatar
Richard M. Stallman committed
921 922 923 924
  LDFLAGS="$LDFLAGS -Wl,-znocombreloc"
else
  LDFLAGS="$LDFLAGS -znocombreloc"
fi
925

Lute Kamstra's avatar
Lute Kamstra committed
926
AC_MSG_CHECKING([for -znocombreloc])
927 928 929 930 931
AC_LINK_IFELSE([main(){return 0;}],
  [AC_MSG_RESULT(yes)],
  LDFLAGS=$late_LDFLAGS
  [AC_MSG_RESULT(no)])

932 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 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978
#### 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
979
configure___ LIBX=LIB_X11_LIB LIBX11_SYSTEM
980 981 982 983 984 985 986 987 988 989 990 991 992

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

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

993 994
#ifdef USE_MMAP_FOR_BUFFERS
configure___ use_mmap_for_buffers=yes
995
#else
996
configure___ use_mmap_for_buffers=no
997 998
#endif

999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010
#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

1011 1012 1013 1014
#ifndef C_WARNINGS_SWITCH
#define C_WARNINGS_SWITCH ${C_WARNINGS_SWITCH}
#endif

1015 1016 1017 1018 1019 1020 1021 1022 1023 1024
#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
1025
#endif
1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042

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__
1043
configure___ REAL_CFLAGS=C_DEBUG_SWITCH C_OPTIMIZE_SWITCH C_WARNINGS_SWITCH '${SPECIFIED_CFLAGS}'
1044 1045 1046 1047 1048 1049 1050 1051 1052 1053
#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
1054
[eval `${CPP} -Isrc ${tempcname} \
1055 1056 1057 1058 1059 1060
       | 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
1061
fi]
1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073
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

1074 1075 1076
dnl For AC_FUNC_GETLOADAVG, at least:
AC_CONFIG_LIBOBJ_DIR(src)

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

1080

1081
### The standard library on x86-64 and s390x GNU/Linux distributions can
1082 1083
### be located in either /usr/lib64 or /usr/lib.
case "${canonical}" in
1084
  x86_64-*-linux-gnu* | s390x-*-linux-gnu* )
1085
    if test -d /usr/lib64; then
1086 1087
      AC_DEFINE(HAVE_LIB64_DIR, 1,
        [Define to 1 if the directory /usr/lib64 exists.])
1088 1089 1090
fi
esac

1091 1092 1093 1094 1095 1096 1097
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

1098
  AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1099 1100 1101 1102 1103 1104 1105 1106 1107

  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)

1108
        if $PKG_CONFIG --exists "$2" 2>&AS_MESSAGE_LOG_FD; then
1109 1110 1111 1112
            AC_MSG_RESULT(yes)
            succeeded=yes

            AC_MSG_CHECKING($1_CFLAGS)
1113
            $1_CFLAGS=`$PKG_CONFIG --cflags "$2"|sed -e 's,///*,/,g'`
1114 1115 1116
            AC_MSG_RESULT($$1_CFLAGS)

            AC_MSG_CHECKING($1_LIBS)
1117
            $1_LIBS=`$PKG_CONFIG --libs "$2"|sed -e 's,///*,/,g'`
1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144
            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
1145 1146 1147 1148 1149 1150
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)
1151 1152 1153 1154 1155

  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
1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175
    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"
1176 1177 1178 1179 1180
    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