configure.ac 30.2 KB
Newer Older
Niels Möller's avatar
Niels Möller committed
1
dnl Process this file with autoconf to produce a configure script.
Niels Möller's avatar
Niels Möller committed
2 3 4

dnl Note that version string is included in the handshake message, and
dnl must therefore not contain any space.
5
AC_INIT([lsh], [2.9.1-exp], [bug-lsh@gnu.org]) 
Niels Möller's avatar
Niels Möller committed
6
AC_PREREQ(2.52)
7
AC_CONFIG_SRCDIR([src/lsh.c])
8 9 10
# Needed to stop autoconf from looking for files in parent directories.
AC_CONFIG_AUX_DIR([.])
	
11
AC_CONFIG_HEADER(src/config.h)
12

13 14 15 16
# GNU libc defaults to supplying the ISO C library functions only. 
# initgroups() and strsignal() are extensions; the _GNU_SOURCE define
# enables these extensions.
# Enable it on all systems; no problems have been reported with it so far.
Niels Möller's avatar
Niels Möller committed
17

18
AC_GNU_SOURCE
Niels Möller's avatar
Niels Möller committed
19

20
# Check options
21
AC_ARG_ENABLE(debug_alloc,
22
  AC_HELP_STRING([--enable-debug-alloc], [Enable memory allocation sanity checks]),,
23
  [enable_debug_alloc=no])
24 25 26

AH_TEMPLATE([DEBUG_ALLOC],
	    [Define to enable sanity checking on memory allocation and casting])
27
if test x$enable_debug_alloc = xyes ; then
28 29 30
  AC_DEFINE(DEBUG_ALLOC)
fi

31
AC_ARG_ENABLE(debug_trace,
32
  AC_HELP_STRING([--enable-debug-trace], [Enable tracing support]),,
33
  [enable_debug_trace=no])
34

35
AH_TEMPLATE([DEBUG_TRACE], [Define to enable tracing])
36
if test x$enable_debug_trace = xyes ; then
37 38 39
  AC_DEFINE(DEBUG_TRACE)
fi

Niels Möller's avatar
Niels Möller committed
40
AC_ARG_ENABLE(gcov,
41
  AC_HELP_STRING([--enable-gcov], [Instrument for gcov (requires a modern gcc)]),,
Niels Möller's avatar
Niels Möller committed
42 43
  [enable_gcov=no])

Niels Möller's avatar
Niels Möller committed
44 45 46 47
AC_ARG_ENABLE(profiling,
  AC_HELP_STRING([--enable-profiling], [Instrument for gprof profiling]),,
  [enable_profiling=no])

48
# FIXME: Not supported at the moment.
49 50 51 52
with_zlib=no
# AC_ARG_WITH(zlib,
#   AC_HELP_STRING([--without-zlib], [Don't use zlib compression]),,
#   [with_zlib=yes])
53

54 55 56 57 58 59 60 61 62 63
AC_ARG_WITH(tcpwrappers,
  AC_HELP_STRING([--with-tcpwrappers], 
                [Use tcp-wrappers for filtering connections]),
  [if test -z "$withval"; then 
    with_tcpwrappers=yes; 
  else 
    with_tcpwrappers="$withval";
  fi],
  [with_tcpwrappers=no])

64 65
# Checking this variable is delayed until we have checked if zlib is
# actually available.
66

67
AC_ARG_ENABLE(pty,
68
  AC_HELP_STRING([--without-pty], [Disable pty support]),,
69
  [enable_pty=yes])
70

71
AH_TEMPLATE([WITH_PTY_SUPPORT], [Define to enable pty support])
72
if test x$enable_pty = xyes ; then
73 74 75
  AC_DEFINE(WITH_PTY_SUPPORT)
fi

76
AC_ARG_ENABLE(srp,
77
  AC_HELP_STRING([--disable-srp], [Disable the (experimental) support for SRP]),,
78 79
  [enable_srp=yes])

80 81 82 83
AC_ARG_ENABLE(gss,
  AC_HELP_STRING([--disable-gss], [Disable the (experimental) support for GSS]),,
  [enable_gss=yes])

84
AC_ARG_ENABLE(kerberos,
85
  AC_HELP_STRING([--disable-kerberos], [Don't support kerberos]),,
86
  [enable_kerberos=yes])
87

88 89 90 91
AC_ARG_ENABLE(pam,
  AC_HELP_STRING([--disable-pam], [Don't support PAM]),,
  [enable_pam=yes])

92
AH_TEMPLATE([WITH_SRP], [Define if SRP should be supported])
93 94
if test x$enable_srp = xyes ; then
  AC_DEFINE(WITH_SRP)
95
  SRP_PROGRAM=srp-gen
96 97
fi

98 99
AC_SUBST(SRP_PROGRAM)

100 101 102 103 104 105 106 107 108 109 110 111
AC_ARG_ENABLE(initgroups_workaround,
  AC_HELP_STRING([--enable-initgroups-workaround],
		 [Use a special initgroups for supporting more groups]),,
  [enable_initgroups_workaround=no])

AH_TEMPLATE([INITGROUPS_WORKAROUND],
	    [Define to enable the initgroups workaround])
if test x$enable_initgroups_workaround = xyes ; then
  AC_DEFINE(INITGROUPS_WORKAROUND)
fi


112
AC_ARG_ENABLE(tcp_forward,
113
  AC_HELP_STRING([--disable-tcp-forward], [Disable tcp forwarding]),,
114
  [enable_tcp_forward=yes])
115

116
AH_TEMPLATE([WITH_TCP_FORWARD], [Define to enable tcp forwarding])
117
if test x$enable_tcp_forward = xyes ; then
118 119
  AC_DEFINE(WITH_TCP_FORWARD)
fi
120

121
AC_ARG_ENABLE(x11_forward,
122
  AC_HELP_STRING([--disable-x11-forward], [Disable x11 forwarding (proxy only)]),,
123
  [enable_x11_forward=yes])
124

125
AH_TEMPLATE([WITH_X11_FORWARD], [Define to enable x11 forwarding])
126
if test x$enable_x11_forward = xyes ; then
127 128 129
  AC_DEFINE(WITH_X11_FORWARD)
fi

130
AC_ARG_ENABLE(agent_forward,
131
  AC_HELP_STRING([--disable-agent-forward], [Disable auth-agent forwarding (proxy only)]),,
132 133
  [with_agent_forward=yes])

134 135
AH_TEMPLATE([WITH_AGENT_FORWARD],
	    [Define to enable authentication agent forwarding])
136
if test x$disable_agent_forward = xyes ; then
137 138 139
  AC_DEFINE(WITH_AGENT_FORWARD)
fi

140
AC_ARG_WITH(scheme,
141
  AC_HELP_STRING([[--with-scheme[=PROGRAM]]], [Use a particular scheme implementation]),,
142
  [with_scheme=])
143 144

AC_ARG_WITH(system-argp,
145 146
  AC_HELP_STRING([--with-system-argp], [Use the argp parser in libc]),,
  [with_system_argp=no])
147

148 149 150 151 152 153 154 155
AC_ARG_WITH(system-nettle,
  AC_HELP_STRING([--with-system-nettle], [Use the installed nettle library]),,
  [with_system_nettle=no])

AC_ARG_WITH(system-libspki,
  AC_HELP_STRING([--with-system-libspki], [Use the installed spki library]),,
  [with_system_libspki=no])

156
# IPv6 support
157
AC_ARG_ENABLE(ipv6,
158
  AC_HELP_STRING([--disable-ipv6], [Disable IPv6 support]),,
159 160
  [enable_ipv6=yes])

161
# utmp/wtmp logging 
162
AC_ARG_ENABLE(utmp,
163
  AC_HELP_STRING([--disable-utmp], [Disable utmp and wtmp support]),,
164 165
  [enable_utmp=yes])

166
AC_ARG_WITH(include-path,
167
  AC_HELP_STRING([--with-include-path], [A colon-separated list of directories to search for include files]),,
168 169 170
  [with_include_path=''])

if test x$with_include_path != x ; then
171
  CPPFLAGS="$CPPFLAGS -I`echo $with_include_path | sed 's/:/ -I/g'`"
172 173
fi

174
AC_ARG_WITH(lib-path,
175
  AC_HELP_STRING([--with-lib-path], [A colon-separated list of directories to search for libraries]),,
176 177 178
  [with_lib_path=''])

if test x$with_lib_path != x ; then
179
  LDFLAGS="$LDFLAGS -L`echo $with_lib_path | sed 's/:/ -L/g'`"
180 181 182 183 184 185 186 187 188
fi

LSH_RPATH_INIT([`echo $with_lib_path | sed 's/:/ /g'` \
    `echo $exec_prefix | sed "s@^NONE@$prefix/lib@g" | sed "s@^NONE@$ac_default_prefix/lib@g"` \
    /usr/local/lib /sw/local/lib /sw/lib \
    /usr/gnu/lib /opt/gnu/lib /sw/gnu/lib /usr/freeware/lib /usr/pkg/lib])

dnl echo RPATH_CANDIDATE_DIRS = $RPATH_CANDIDATE_DIRS

189
# Checks for programs.
Niels Möller's avatar
Niels Möller committed
190 191
AC_PROG_CC
AC_PROG_MAKE_SET
Niels Möller's avatar
Niels Möller committed
192
AC_PROG_RANLIB
Niels Möller's avatar
Niels Möller committed
193

194
if test "x$am_cv_prog_cc_stdc" = xno ; then
195
  AC_MSG_ERROR([the C compiler doesn't handle ANSI-C])
196 197
fi

Niels Möller's avatar
Niels Möller committed
198 199
LSH_CCPIC

200 201 202 203 204 205
AC_PROG_INSTALL

# According to the autoconf manual, needs install-sh from
# autoconf-2.60 or automake-1.10 to avoid races.
AC_PROG_MKDIR_P

206 207 208 209 210 211 212
LSH_DEPENDENCY_TRACKING

if test x$enable_dependency_tracking = xyes ; then
  # Since the makefiles use include to get the dependency files, we must
  # make sure that the files exist.

  AC_CONFIG_COMMANDS([dummy-dep-files],
213 214
  [(cd "$srcdir/src" && echo *.c testsuite/*.c) \
 | tr ' ' '\n' |sed 's/\.c$//' \
215 216 217 218 219
 | (cd src && while read f; do echo > "$f.o.d"; done \
           && for f in format lsh_string parse werror; do echo > "$f.mo.d"; done)
])
fi

220 221
# Use a particular scheme implementation?
if test x$with_scheme != x ; then
222 223 224 225 226 227 228 229 230
  # If an absolute path is given, don't AC_PATH_PROG but just use it
  if grep "^/" > /dev/null <<EOF
$with_scheme 
EOF  
  then
    SCHEME_PROGRAM="$with_scheme" 
  else
    AC_PATH_PROG(SCHEME_PROGRAM, $with_scheme,, $PATH)
  fi
231
else  
232
  AC_PATH_PROGS(SCHEME_PROGRAM, guile scsh,, $PATH)
233
fi
234

235
if test "x$SCHEME_PROGRAM" = x ; then
236 237
  AC_MSG_WARN([No scheme implementation found.
This is fine as long as you don't modify the source files.])
238 239 240
  SCHEME_PROGRAM=false
fi

241 242 243
SCHEME_NAME=`basename $SCHEME_PROGRAM`
AC_SUBST(SCHEME_NAME)

244 245 246 247 248 249 250 251 252 253
if test "x$GROFF" = x; then
  AC_PATH_PROG(GROFF, groff,, $PATH)
fi
AC_ARG_VAR(GROFF, groff)

if test "x$M4" = x; then
  AC_PATH_PROG(M4, m4, m4)
fi
AC_ARG_VAR(M4, M4 macro processor)

Niels Möller's avatar
Niels Möller committed
254 255 256 257 258 259 260 261
# Check if we're using dynamic linking. For the getpwnam-wrapper.so
# hack used by the testsuite, we need LD_PRELOAD and $(CC) -shared.
# Might need a more sophisticated test.

IF_LD_PRELOAD='#'

if test "x$GCC" = xyes ; then
  for d in /lib /lib64 /lib/64 ; do
262
    for f in $d/libc.so $d/libc.so.* ; do
Niels Möller's avatar
Niels Möller committed
263 264 265 266 267 268 269 270 271
      if test -x $f ; then
        IF_LD_PRELOAD=''
        break
      fi
    done
  done
fi

AC_SUBST(IF_LD_PRELOAD)
272

273
# Checks for header files.
Niels Möller's avatar
Niels Möller committed
274
AC_HEADER_STDC
275

276 277 278
# We don't look in gmp2 anymore, as we need gmp-3.1 or better.
AC_CHECK_HEADERS(gmp.h,,
  AC_MSG_ERROR([gmp.h not found]))
279
  
280
AC_CHECK_HEADERS(fcntl.h strings.h sys/time.h unistd.h)
281
AC_CHECK_HEADERS(shadow.h)
282

283 284 285
if test x$with_zlib = xyes; then
  AC_CHECK_HEADERS(zlib.h,, [with_zlib=no])
fi
286
AC_CHECK_HEADERS(libutil.h)
287
AC_CHECK_HEADERS(crypt.h)
288 289
AC_CHECK_HEADERS(pty.h)
AC_CHECK_HEADERS(stropts.h)
290
AC_CHECK_HEADERS(syslog.h)
291
AC_CHECK_HEADERS(argp.h)
292
AC_CHECK_HEADERS(sys/resource.h)
Niels Möller's avatar
Niels Möller committed
293
AC_CHECK_HEADERS(sys/filio.h)
Niels Möller's avatar
Niels Möller committed
294
AC_CHECK_HEADERS(ucred.h)
295

296
AC_CHECK_HEADERS(utmp.h, [have_utmp_h=yes], [have_utmp_h=no])
297
AC_CHECK_HEADERS(utmpx.h, [have_utmpx_h=yes], [have_utmpx_h=no])
298

299 300 301 302
dnl With current autoconfs we can't check for struct ut_tv with
dnl AC_CHECK_MEMBERS, but we can check for sub members. Leave the
dnl ut_tv check for clarity.

303
if test x$have_utmp_h = xyes; then
304 305 306 307 308
  # Currently, no support for pure bsd systems where login(3) and
  # friends are the only library functions for updating the utmp and
  # wtmp data. FIXME: Don't do this if we're going to use the the utmpx
  # functions instead.
  AC_CHECK_FUNC([pututline],,[enable_utmp=no])
309 310 311
  AC_CHECK_MEMBERS([struct utmp.ut_host,
		    struct utmp.ut_name,
		    struct utmp.ut_user,
312 313
		    struct utmp.ut_time,
		    struct utmp.ut_tv,
314
		    struct utmp.ut_tv.tv_sec,
315 316 317
		    struct utmp.ut_id,
		    struct utmp.ut_syslen,
		    struct utmp.ut_session,
318 319
		    struct utmp.ut_pid,
		    struct utmp.ut_exit,
320
		    struct utmp.ut_exit.e_termination,
321 322
		    struct utmp.ut_exit.__e_termination,
		    struct utmp.ut_exit.ut_termination,
323 324
		    struct utmp.ut_addr,
		    struct utmp.ut_addr_v6],,,
325 326
[# if HAVE_SYS_TYPES_H
#  include <sys/types.h>
327
# endif
328
# if HAVE_UTMP_H
329 330
#  include <utmp.h>
# endif
331 332
])
fi
333

334 335 336 337 338 339 340
if test x$have_utmpx_h = xyes; then
  AC_CHECK_MEMBERS([struct utmpx.ut_host,
		    struct utmpx.ut_name,
		    struct utmpx.ut_user,
		    struct utmpx.ut_time,
		    struct utmpx.ut_id,
		    struct utmpx.ut_tv,
341
		    struct utmpx.ut_tv.tv_sec,
342 343 344 345
		    struct utmpx.ut_syslen,
		    struct utmpx.ut_session,
		    struct utmpx.ut_pid,
		    struct utmpx.ut_exit,
346
		    struct utmpx.ut_exit.e_termination,
347 348
		    struct utmpx.ut_exit.__e_termination,
		    struct utmpx.ut_exit.ut_termination,
349 350 351
		    struct utmpx.ut_addr,
		    struct utmpx.ut_addr_v6],,,
[# if HAVE_UTMPX_H
352 353 354
#  include <utmpx.h>
# endif
])
355
fi
356

357 358 359 360 361
AH_TEMPLATE([WITH_UTMP], [For utmp support])
if test x$enable_utmp = xyes ; then
  AC_DEFINE(WITH_UTMP)
fi

362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390
AH_TEMPLATE([WITH_GSS_K5], [Whether to use gss K5 authorization (Heimdal/MIT)])
if test x$enable_gss != xno; then
  if test x$enable_gss = xk5; then
    AC_CHECK_PROG(KRB5CONFIG, krb5-config, krb5-config, no)
    if test x$KRB5CONFIG != xno; then
      CPPFLAGS="$CPPFLAGS `$KRB5CONFIG --cflags gssapi`"
      LIBS="$LIBS `$KRB5CONFIG --libs gssapi`"
      AC_CHECK_HEADERS([gssapi.h gssapi/gssapi.h gssapi/gssapi_generic.h])
      AC_DEFINE(WITH_GSS_K5)
      AC_CHECK_DECL(GSS_C_NT_HOSTBASED_SERVICE,, [
	AC_DEFINE(GSS_C_NT_HOSTBASED_SERVICE,
		gss_nt_service_name,
		[Work around buggy MIT library])], [
#ifdef HAVE_GSSAPI_H
#include <gssapi.h>
#endif
#ifdef HAVE_GSSAPI_GSSAPI_H
#include <gssapi/gssapi.h>
#endif
#ifdef HAVE_GSSAPI_GSSAPI_GENERIC_H
#include <gssapi/gssapi_generic.h>
#endif
])
    fi
  else
    AC_CHECK_HEADERS(gss.h,, [enable_gss=no])
    AC_CHECK_LIB(gss, gss_check_version,, [enable_gss=no])
  fi
fi
391

392 393 394 395
if test x$enable_kerberos = xyes; then
  AC_CHECK_HEADERS(krb5.h,, [enable_kerberos=no])
fi

396 397 398 399
if test x$enable_pam = xyes; then
  AC_CHECK_HEADERS(security/pam_appl.h,, [enable_pam=no])
fi

400 401
# Some systems (in particular, Unixware) doesn't have socklen_t, but
# uses size_t. Falling back to int will cause some warnings.
402

403 404
# AC_CHECK_TYPE doesn't work, probably because the type in
# question is not defined in sys/types.h.
405

406
LSH_TYPE_SOCKLEN_T
407

408 409
# Checks for libraries

410 411 412 413 414 415 416 417 418
# System libraries first. E.g., X11 libraries depend on gethostbyname,
# which on Solaris is in nsl.

# glibc has a nis-library "libnsl", which we don't need. So use
# AC_SEARCH_LIBS rather than AC_CHECK_LIB.
AC_SEARCH_LIBS(gethostbyname, nsl)
AC_SEARCH_LIBS(inet_ntop, nsl)
AC_CHECK_LIB(socket, setsockopt)

419 420
AC_CHECK_LIB(gmp, __gmpz_getlimbn,,
    [AC_MSG_ERROR(
421
    [GNU MP not found, or not 3.1 or up, see http://gmplib.org/.])])
422

423 424
LSH_RPATH_FIX

Niels Möller's avatar
Niels Möller committed
425
AC_CHECK_LIB([oop], [oop_sys_new],,
426
  [AC_MSG_ERROR([liboop is missing. Get liboop from http://liboop.ofb.net])])
Niels Möller's avatar
Niels Möller committed
427 428 429

LSH_RPATH_FIX

430 431 432 433
if test x$with_zlib = xyes; then
  AC_CHECK_LIB(z, inflate,, [with_zlib=no])
fi

434 435 436 437
if test x$with_zlib = xyes; then
  LSH_RPATH_FIX
fi

438 439 440 441 442
# FIXME: Should we let people use --with-tcpwrappers=/here/they/are?

if test x$with_tcpwrappers = xyes; then
  AC_CHECK_LIB(wrap, request_init,, 
  [
443
      AC_MSG_WARN([Failed to link libwrap, you might try adding -lsocket to LDFLAGS])
444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461
      with_tcpwrappers=no
  ])

  AC_CHECK_HEADER(tcpd.h,, [with_tcpwrappers=no])

  if test x$with_tcpwrappers = xno; then
    AC_MSG_WARN([Failed to find a working tcpwrappers setup, disabling wrappers])
  fi
fi

if test x$with_tcpwrappers = xyes; then
  LSH_RPATH_FIX
  AC_DEFINE(WITH_TCPWRAPPERS,1,[Whatever to use tcpwrappers])
else
  AC_DEFINE(WITH_TCPWRAPPERS,0,[Whatever to use tcpwrappers])
fi


462
# X11 stuff. We only need Xauth, usually located in libXau.
463 464
# FIXME: Use AC_PATH_XTRA instead?

465 466 467
AC_PATH_X

if test -z "$no_x" ; then
468
  if test -n "$x_includes" ; then
469
    CPPFLAGS="$CPPFLAGS -I$x_includes"
470
  fi
471
  if test -n "$x_libraries" ; then    
472 473
    LDFLAGS="$LDFLAGS -L$x_libraries"
    LSH_RPATH_ADD($x_libraries)
474
  fi
475 476 477
fi

AC_CHECK_HEADERS(X11/Xauth.h)
478
AC_CHECK_LIB([Xau], [XauGetAuthByAddr])
479

480 481
LSH_RPATH_FIX

482 483 484 485
AC_CHECK_LIB(crypt, crypt)
AC_CHECK_LIB(xnet, inet_addr)
# logwtmp is also in libutil
AC_CHECK_LIB(util, openpty)
486

487
# This macro is new in autoconf-2.13
488
AC_SEARCH_LIBS(syslog, bsd socket inet, [AC_DEFINE(HAVE_SYSLOG)])
489

490
AH_TEMPLATE([WITH_ZLIB], [Define if zlib should be used])
491
# Should we use zlib?
492 493 494 495
if test x$with_zlib = xyes ; then
  AC_DEFINE(WITH_ZLIB)
fi

496 497 498 499 500 501
AH_TEMPLATE([WITH_GSS], [Define if gss should be used])
# Should we use gss?
if test x$enable_gss != xno ; then
  AC_DEFINE(WITH_GSS)
fi

502 503 504 505 506
# The kerberos libraries are needed only to support the
# krb-check-passwd program, so we put them $KRB_LIBS, not in the
# ordinary $LIBS.

if test x$enable_kerberos = xyes; then
507 508 509 510
  LSH_CHECK_KRB_LIB(roken, strlcpy)
  LSH_CHECK_KRB_LIB(resolv, dn_expand)
  LSH_CHECK_KRB_LIB(des, des_cbc_encrypt)
  LSH_CHECK_KRB_LIB(asn1, der_get_octet_string)
511 512 513
  # Check for krb5_cc_gen_new too?
  # krb5_verify_user_lrealm seems to be unique to heimdal
  LSH_CHECK_KRB_LIB(krb5, krb5_verify_user_lrealm,, [enable_kerberos=no])
514 515
fi

516
AH_TEMPLATE([WITH_KERBEROS], [For kerberos])
517 518 519 520 521 522
if test x$enable_kerberos = xyes; then
  AC_DEFINE(WITH_KERBEROS)
fi

AC_SUBST(KRB_LIBS)

523 524
AH_TEMPLATE([WITH_PAM], [For PAM])
if test x$enable_pam = xyes; then
525 526 527 528 529 530 531
  AC_CHECK_LIB(pam,pam_start,, enable_pam=no )

  if test x$enable_pam = xyes; then
    AC_DEFINE(WITH_PAM)
  else
    AC_MSG_WARN([pam_start not found in libpam, disabling PAM])
  fi
532 533
fi

534
AH_TEMPLATE([WITH_GCOV], [Use gcov])
Niels Möller's avatar
Niels Möller committed
535 536
if test "x$enable_gcov" = "xyes"; then
  CFLAGS="$CFLAGS -ftest-coverage -fprofile-arcs"
537
  AC_DEFINE(WITH_GCOV)
Niels Möller's avatar
Niels Möller committed
538 539
fi

Niels Möller's avatar
Niels Möller committed
540 541 542 543
if test "x$enable_profiling" = "xyes"; then
  CFLAGS="$CFLAGS -pg"
fi

544
# Checks for typedefs, structures, and compiler characteristics.
545
AC_C_CONST
546
AC_C_INLINE
547
AC_TYPE_UID_T
Niels Möller's avatar
Niels Möller committed
548
AC_TYPE_SIZE_T
549 550
AC_HEADER_TIME

551
# Needed by the supplied memcmp.c
Niels Möller's avatar
Niels Möller committed
552 553
AC_C_BIGENDIAN

554
# FIXME: We should check that a pid_t fits in an int
Niels Möller's avatar
Niels Möller committed
555
	
556
# Checks for library functions.
557

558 559 560
LSH_FUNC_ALLOCA
LSH_FUNC_STRERROR
LSH_FUNC_STRSIGNAL
561 562
AC_FUNC_MEMCMP
AC_FUNC_VPRINTF
563
AC_CHECK_FUNCS(select socket strtol alarm)
564
AC_CHECK_FUNCS(getrusage gettimeofday)
565
AC_CHECK_FUNCS(getspnam)
Niels Möller's avatar
Niels Möller committed
566
AC_CHECK_FUNCS(vsnprintf inet_aton inet_ntop)
567
AC_CHECK_FUNCS(openpty)
568
AC_CHECK_FUNCS(logwtmp login logout pututline pututxline updwtmp updwtmpx)
569
AC_CHECK_FUNCS(getaddrinfo getnameinfo gai_strerror)
570
AC_CHECK_FUNCS(setrlimit getdtablesize)
571 572
AC_FUNC_GETPGRP
AC_CHECK_FUNCS(syslog)
573

574 575 576 577 578 579 580 581 582 583
# HP-UX doesn't have seteuid
AC_CHECK_FUNCS(seteuid setresuid)

AH_BOTTOM(
[#if !HAVE_SETEUID
# if HAVE_SETRESUID
#  define seteuid(uid) setresuid(-1, (uid), -1)
# endif
#endif])

584
# FIXME: Is there a better way in autoconf 2.50?
585 586 587 588 589 590 591 592 593
AC_CACHE_CHECK([if netdb.h defines AI_NUMERICHOST],
  lsh_cv_sys_ai_numerichost,
  [AC_EGREP_CPP(yes,
    [#include <netdb.h>
     #ifdef AI_NUMERICHOST
     yes
     #endif
    ], lsh_cv_sys_ai_numerichost=yes,
       lsh_cv_sys_ai_numerichost=no)])
594 595

AH_TEMPLATE([HAVE_AI_NUMERICHOST], [Define if AI_NUMERICHOST exists])
596 597 598 599
if test x$lsh_cv_sys_ai_numerichost = xyes ; then
  AC_DEFINE(HAVE_AI_NUMERICHOST)
fi

600
# Test if the libc includes a good enough argp.
601
# FIXME: Doesn't check for the argp-help bug.
602
if test x$with_system_argp != xno ; then
603
  LSH_LIB_ARGP(,with_system_argp=no)
604 605
fi

606 607 608 609 610
AH_TEMPLATE([HAVE_ARGP_PARSE], [Define to use the argp parser in libc])
if test x$with_system_argp != xno ; then
  AC_DEFINE(HAVE_ARGP_PARSE)
fi

611
BUILD_SUBDIRS=''
612
LIB_ARGP=''
613
if test x$with_system_argp = xno ; then
614 615 616 617 618
  AC_CONFIG_COMMANDS([argp-symlinks],
  [argp_srcdir="`cd "$srcdir/argp" && pwd`"
  (cd src && rm -f argp argp_builddir && ln -s ../argp argp_builddir && ln -s $argp_srcdir argp)
  ])
  BUILD_SUBDIRS="$BUILD_SUBDIRS argp"
619
  LIB_ARGP="-largp"
620
fi
621

622 623
LOCAL_NETTLE_DEP=''

624 625 626 627 628 629 630
if test x$with_system_nettle = xno ; then
  AC_CONFIG_COMMANDS([nettle-symlinks],
  [nettle_srcdir="`cd "$srcdir/nettle" && pwd`"
  for d in spki src ; do
    (mkdir $d 2>/dev/null; cd $d && rm -f nettle nettle_builddir && ln -s ../nettle nettle_builddir && ln -s $nettle_srcdir nettle)
  done])
  BUILD_SUBDIRS="$BUILD_SUBDIRS nettle"
631
  LOCAL_NETTLE_DEP="nettle_builddir/libnettle.a nettle_builddir/libhogweed.a"
632
fi
633

634 635
AC_SUBST(LOCAL_NETTLE_DEP)

636 637 638 639 640 641 642 643 644
if test x$with_system_libspki = xno ; then
  AC_CONFIG_COMMANDS([libspki-symlinks],
  [spki_srcdir="`cd "$srcdir/spki" && pwd`"
  (cd src && rm -f spki spki_builddir && ln -s ../spki spki_builddir && ln -s $spki_srcdir spki)
  ])
  BUILD_SUBDIRS="$BUILD_SUBDIRS spki"
fi

AC_SUBST(BUILD_SUBDIRS)
645
AC_SUBST(LIB_ARGP)
646

647
# Check for broken shutdown
648 649
AC_CACHE_CHECK(for working shutdown on AF_UNIX sockets,
	       lsh_cv_func_shutdown_works_on_unix_sockets,
650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676
[
AC_TRY_RUN([
#include <stdio.h>

#include <errno.h>

#include <sys/types.h>
#include <sys/socket.h>

#include <signal.h>

#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif

/* Creates a one-way socket connection. Returns 1 on success, 0 on
 * failure. fds[0] is for reading, fds[1] for writing (like for the
 * pipe() system call). */
static int make_pipe(int *fds)
{

#ifndef SHUT_RD
#define SHUT_RD 0
#define SHUT_WR 1
#define SHUT_RDWR 2
#endif

677
  if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds) < 0)
678 679 680 681 682 683 684 685
    {
      fprintf(stderr, "socketpair() failed: %s\n", strerror(errno));
      return 0;
    }
  fprintf(stderr, "Created socket pair. Using fd:s %d <-- %d\n", fds[0], fds[1]);

  if(shutdown(fds[0], SHUT_WR) < 0)
    {
686 687
      fprintf(stderr, "shutdown(%d, SHUT_WR) failed: %s\n",
	      fds[0], strerror(errno));
688 689 690 691
      return 0;
    }
  if (shutdown(fds[1], SHUT_RD) < 0)
    {
692 693
      fprintf(stderr, "shutdown(%d, SHUT_RD) failed: %s\n",
	      fds[1], strerror(errno));
694 695 696 697 698 699 700 701 702 703 704 705 706 707 708
      return 0;
    }

  return 1;
}

int main(int argc, char **argv)
{
  int fds[2];
  
  if (!make_pipe(fds))
    exit(1);

  if (signal(SIGPIPE, SIG_IGN) == SIG_ERR)
    {
709
      fprintf(stderr, "signal failed.\n");
710 711 712 713 714 715 716 717 718
      exit(1);
    }

  if ( (write(fds[1], "foo", 3) < 0)
       && (errno == EPIPE))
    exit(1);

  exit(0);
}
719 720 721
], lsh_cv_func_shutdown_works_on_unix_sockets=yes,
   lsh_cv_func_shutdown_works_on_unix_sockets=no,
   lsh_cv_func_shutdown_works_on_unix_sockets=yes)])
722

723 724
AH_TEMPLATE([SHUTDOWN_WORKS_WITH_UNIX_SOCKETS],
	    [Define to indicate that shutdown seems to work properly])
725
if test x$lsh_cv_func_shutdown_works_on_unix_sockets = xyes ; then
726 727 728
    AC_DEFINE(SHUTDOWN_WORKS_WITH_UNIX_SOCKETS)
fi

729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 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
AC_CACHE_CHECK(
  [for working UNIX98 ptys],
  lsh_cv_sys_unix98_ptys,
  AC_TRY_RUN([
  /* Try to obtain a working UNIX98-style pty master and slave */
  /* Based on example code from the GNU C library documentation */
  #include <stdlib.h>	/* EXIT_FAILURE, EXIT_SUCCESS, ptsname */
  #include <unistd.h>	/* close(2) */
  
  #include <sys/types.h>	/* open(2) */
  #include <sys/stat.h>	/* - " -   */
  #ifdef HAVE_FCNTL_H
  #  include <fcntl.h>	/* - " -   */
  #endif
  #ifdef HAVE_STROPTS_H
  #  include <stropts.h>	/* isastream() */
  #endif
  
  int main(int argc, char* argv[]) {
    int master, slave;
    char *name;
  
    master = open("/dev/ptmx", O_RDWR); /* PTY master multiplex */
    if (master < 0) {
  	  exit(EXIT_FAILURE);
    }
  
    if (grantpt(master) < 0 || unlockpt(master) < 0)
      goto close_master;
    name = ptsname(master);
    if (name == NULL)
      goto close_master;
  
    slave = open(name, O_RDWR);
    if (slave == -1)
      goto close_master;
  
  #ifdef HAVE_STROPTS_H
    if (isastream(slave))
      {
  	if (ioctl(slave, I_PUSH, "ptem") < 0
  	    || ioctl(slave, I_PUSH, "ldterm") < 0)
  	  goto close_slave;
      }
  #endif
  
    exit(0);
  
  close_slave:
    close (slave);
  
  close_master:
    close (master);
    exit(1);
  }
  ],
  [lsh_cv_sys_unix98_ptys=yes],
  [lsh_cv_sys_unix98_ptys=no],
787
  # Pessimistic default for cross compilation.
788 789
  [lsh_cv_sys_unix98_ptys=no]))

790 791
AH_TEMPLATE([HAVE_UNIX98_PTYS],
	    [Define if a we have working UNIX98 pty handling])
792 793
if test x$lsh_cv_sys_unix98_ptys = xyes; then
  AC_DEFINE(HAVE_UNIX98_PTYS)
794 795
else
  AC_MSG_WARN([No support for UNIX98 PTYs. PTY support disabled.])
796
fi
797

Niels Möller's avatar
Niels Möller committed
798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820
# Check that FIONREAD exists, works, and uses an argument of type int, not long.  
AC_CACHE_CHECK(
  [for FIONREAD with int argument],
  lsh_cv_sys_ioctl_fionread_int,
[AC_TRY_RUN([
#include <errno.h>
#include <fcntl.h>

#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#if HAVE_SYS_FILIO_H
#include <sys/filio.h>
#endif
int main(int argc, char **argv)
{
#ifdef FIONREAD
  union {
    int i[2];
    long l;
  } val;

  int fds[2];
821
  int res;
Niels Möller's avatar
Niels Möller committed
822 823 824 825 826 827 828 829 830 831

  if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds) < 0)
    {
      printf("socketpair failed: errno = %d.\n", errno);
      return 1;
    }
    
  val.i[0] = 0xdeadbeaf;
  val.i[1] = 0xdeadbeaf;

832 833 834 835 836 837 838 839 840 841
  do 
    res = write(fds[1], "xxx", 3);
  while (res < 0 && errno == EINTR);

  if (res != 3)
    {
      printf("write failed: errno = %d.\n", errno);
      return 1;
    }
  
Niels Möller's avatar
Niels Möller committed
842 843 844 845 846
  if (ioctl(fds[0], FIONREAD, val.i) < 0)
    {
      printf("ioctl FIONREAD failed: errno = %d.\n", errno);
      return 1;
    }
847
  if (val.i[0] == 3 && val.i[1] == 0xdeadbeaf)
Niels Möller's avatar
Niels Möller committed
848 849 850 851 852 853 854 855 856 857 858 859 860 861
    return 0;
#endif
  return 1;
}
], lsh_cv_sys_ioctl_fionread_int=yes,
   lsh_cv_sys_ioctl_fionread_int=no,
   lsh_cv_sys_ioctl_fionread_int=no)])

AH_TEMPLATE([HAVE_IOCTL_FIONREAD],
	    [Define if the FIONREAD ioctl works, and uses an argument of type int])
if test x$lsh_cv_sys_ioctl_fionread_int = xyes; then
  AC_DEFINE([HAVE_IOCTL_FIONREAD])
fi

862 863 864 865 866 867 868 869 870 871
# Check that credentials passing work
AC_CACHE_CHECK(
  [for credentials passing],
  lsh_cv_sys_ucred_passing,
[AC_TRY_RUN([
/* For CMSG_SPACE and friends on Solaris */
#define _XPG4_2

#include <errno.h>
#include <stdio.h>
872
#include <stdlib.h>
873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912
#include <string.h>

/* Linux: For struct ucred */
#include <sys/types.h>
#include <sys/socket.h>

/* Solaris ucred support */
#if HAVE_UCRED_H
#include <ucred.h>
#endif

int main (int argc, char **argv)
{
  int pipe[2];
  int type;
  struct msghdr hdr;
  struct cmsghdr *cmsg;
  struct iovec io;
  void *creds_buf;
  size_t creds_size;
  size_t creds_space;
  char buf[3];
  int res;
  int yes = 1;

#ifdef SO_RECVUCRED
  /* Solaris' ucred passing works with SOCK_DGRAM sockets only */
  type = SOCK_DGRAM;
#else
  type = SOCK_STREAM;
#endif
  if (socketpair(AF_UNIX, type, 0, pipe) < 0)
    {
      printf("socketpair failed: errno = %d.\n", errno);
      return 1;
    }

#if defined (SO_PASSCRED)
  /* For Linux */
  if (setsockopt(pipe[1], SOL_SOCKET, SO_PASSCRED,
913
		 &yes, sizeof(yes)) < 0)
914 915 916 917 918 919 920 921 922 923 924 925 926 927
    {
      printf("setsockopt SO_PASSCRED failed: %d.\n", errno);
      return 1;
    }
#elif defined (SO_RECVUCRED)
  /* Solaris */
  if (setsockopt(pipe[1], SOL_SOCKET, SO_RECVUCRED,
  		   &yes, sizeof(yes)) < 0)
    {
      printf("setsockopt SO_RECVUCRED failed: %d.\n", errno);
      return 1;
    }
#endif

928
#if defined (SCM_CREDENTIALS)
929
  creds_size = sizeof(struct ucred);
930 931
#elif defined (SCM_CREDS)
  creds_size = sizeof(struct cmsgcred);
932 933 934 935
#else
  creds_size = 0;
#endif

936 937 938 939
  /* Appearantly, on FreeBSD-6.3, sendmsg requires that if
     msg_controllen == 0, then one *must* also have msg_control == NULL. */
  
  if (creds_size)
940
    {
941 942 943 944 945 946 947 948 949 950 951 952
      creds_space = CMSG_SPACE(creds_size);
      creds_buf = malloc(creds_space);
      if (!creds_buf)
	{
	  printf("malloc failed\n");
	  return 1;
	}
    }
  else
    {
      creds_space = 0;
      creds_buf = NULL;
953 954 955 956 957 958 959 960 961 962 963 964
    }

  io.iov_base = (void *) "foo";
  io.iov_len = 3;
  
  hdr.msg_name = NULL;
  hdr.msg_namelen = 0;
  hdr.msg_iov = &io;
  hdr.msg_iovlen = 1;
  hdr.msg_controllen = creds_space;
  hdr.msg_control = creds_buf;

965
#if defined (SCM_CREDENTIALS)
966 967 968 969 970
  /* Linux style credentials */
  
  {
    struct ucred *creds;

971
    cmsg = CMSG_FIRSTHDR(&hdr);
972 973 974 975 976 977 978 979 980 981 982
    cmsg->cmsg_level = SOL_SOCKET;
    cmsg->cmsg_type = SCM_CREDENTIALS;
    cmsg->cmsg_len = CMSG_LEN(sizeof(*creds));

    creds = (struct ucred *) CMSG_DATA(cmsg);
    creds->pid = getpid();
    creds->uid = getuid();
    creds->gid = getgid();

    hdr.msg_controllen = CMSG_SPACE(sizeof(*creds));
  }
983 984 985 986 987 988 989 990 991 992 993
#elif defined (SCM_CREDS)
  {
    cmsg = CMSG_FIRSTHDR(&hdr);

    cmsg->cmsg_level = SOL_SOCKET;
    cmsg->cmsg_type = SCM_CREDS;
    cmsg->cmsg_len = CMSG_LEN(sizeof(struct cmsgcred));

    /* Data filled in by the kernel */
    hdr.msg_controllen = CMSG_SPACE(sizeof(struct cmsgcred));      
  }
994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072
#else
  hdr.msg_controllen = 0;
#endif 

  do
    res = sendmsg(pipe[0], &hdr, 0);
  while (res < 0 && errno == EINTR);

  if (res < 0)
    {
      printf("sendmsg failed: errno = %d.\n", errno);
      return 1;
    }
  
  memset(buf, 0, sizeof(buf));
  if (creds_space)
    memset(creds_buf, 0, creds_space);

  io.iov_base = (void *) buf;
  io.iov_len = sizeof(buf);

  hdr.msg_name = NULL;
  hdr.msg_namelen = 0;
  hdr.msg_iov = &io;
  hdr.msg_iovlen = 1;
  hdr.msg_controllen = creds_space;
  hdr.msg_control = creds_buf;
  
  do
    res = recvmsg(pipe[1], &hdr, 0);
  while (res < 0 && errno == EINTR);

  if (res < 0)
    {
      printf("recvmsg failed: errno = %d.\n", errno);
      return 1;
    }

  if (res != 3)
    {
      printf("recvmsg returned unexpected count\n");
      return 1;
    }

  if (memcmp (buf, "foo", 3) != 0)
    {
      printf("recvmsg returned unexpected data\n");
      return 1;
    }

  /* Process ancillary data */
  for (cmsg = CMSG_FIRSTHDR(&hdr); cmsg; cmsg = CMSG_NXTHDR(&hdr, cmsg))
    {
      pid_t pid;
      uid_t uid;
      gid_t gid;

      if (cmsg->cmsg_level != SOL_SOCKET)
	continue;
      switch (cmsg->cmsg_type)
	{
	  got_creds:
	    if (pid != getpid())
	      {
	        printf("Received unexpected pid %d\n", (int) pid);
		return 1;
	      }
	    if (uid != getuid())
	      {
	        printf("Received unexpected uid %d\n", (int) uid);
		return 1;
	      }
	    if (gid != getgid())
	      {
	        printf("Received unexpected gid %d\n", (int) gid);
		return 1;
	      }
	    /* Success! */
	    return 0;
1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086

#if defined (SCM_CREDENTIALS)
	case SCM_CREDENTIALS:
	  {
	    struct ucred *creds;
	    if (cmsg->cmsg_len != CMSG_LEN(sizeof(*creds)))
	      continue;

	    creds = (struct ucred *) CMSG_DATA(cmsg);
	    pid = creds->pid;
	    uid = creds->uid;
	    gid = creds->gid;

	    goto got_creds;
1087
	  }
1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101
#elif defined (SCM_CREDS)
	case SCM_CREDS:
	  {
	    struct cmsgcred *creds;
	    if (cmsg->cmsg_len != CMSG_LEN(sizeof(*creds)))
	      continue;

	    creds = (struct cmsgcred *) CMSG_DATA(cmsg);
	    pid = creds->cmcred_pid;
	    uid = creds->cmcred_uid;
	    gid = creds->cmcred_gid;

	    goto got_creds;
	  }	  
1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129
#elif defined (SCM_UCRED)
	case SCM_UCRED:
	  {
	    ucred_t *creds;

	    creds = (ucred_t *) CMSG_DATA(cmsg);
	    pid = ucred_getpid(creds);
	    uid = ucred_geteuid(creds);
	    gid = ucred_getegid(creds);

	    goto got_creds;
	  }	    
#endif
	}
    }
  printf("No creds received.\n");
  return 1;
} 
], lsh_cv_sys_ucred_passing=yes,
   lsh_cv_sys_ucred_passing=no,
   lsh_cv_sys_ucred_passing=no)])

AH_TEMPLATE([HAVE_SOCKET_CREDENTIALS_PASSING],
	    [Define if credentials passing over unix sockets work])
if test x$lsh_cv_sys_ucred_passing = xyes; then
  AC_DEFINE([HAVE_SOCKET_CREDENTIALS_PASSING])
fi

1130
LSH_GCC_ATTRIBUTES
1131

1132
AC_MSG_CHECKING(for BSD pty names)
Niels Möller's avatar
Niels Möller committed
1133

1134 1135 1136 1137 1138
AH_TEMPLATE([PTY_BSD_SCHEME_FIRST_CHARS],
	    [Possible first characters in a /dev/ptyXX name])
AH_TEMPLATE([PTY_BSD_SCHEME_SECOND_CHARS],
	    [Possible second characters in a /dev/ptyXX name])

1139
# FIXME: What is most portable, tr -d '\n' or tr -d '\012' ?
1140 1141
AC_DEFINE_UNQUOTED(PTY_BSD_SCHEME_FIRST_CHARS, "`ls /dev/pty* | cut -c 9-9 | uniq | tr -d '\n'`")
AC_DEFINE_UNQUOTED(PTY_BSD_SCHEME_SECOND_CHARS, "`ls /dev/pty* | cut -c 10-10 | sort | uniq | tr -d '\n'`")
1142

1143
# FIXME: How can we test if the bsd scheme is likely to work?
1144
AH_TEMPLATE([PTY_BSD_SCHEME], [Traditional BSD pty handling])
1145 1146 1147
AC_DEFINE(PTY_BSD_SCHEME)
AC_MSG_RESULT([done])

1148
# IPv6 support
1149 1150

if test x$enable_ipv6 = xyes ; then
1151
  if test x$ac_cv_func_getaddrinfo != xyes ; then
1152 1153
    AC_MSG_WARN([getaddrinfo not found. Disabling IPv6 support])
    enable_ipv6=no
1154
  elif test x$ac_cv_func_gai_strerror != xyes ; then
1155 1156
    AC_MSG_WARN([gai_strerror not found. Disabling IPv6 support])
    enable_ipv6=no
1157
  elif test x$lsh_cv_sys_ai_numerichost != xyes ; then
1158 1159
    AC_MSG_WARN([AI_NUMERICHOST not defined. Disabling IPv6 support])
    enable_ipv6=no
1160 1161 1162
  fi
fi

1163
AH_TEMPLATE([WITH_IPV6], [For Ipv6 support])
1164
if test x$enable_ipv6 = xyes ; then
1165 1166 1167
  AC_DEFINE(WITH_IPV6)
fi

1168
# Unconditionally configure nettle; otherwise make dist won't work
Niels Möller's avatar
Niels Möller committed
1169
AC_CONFIG_SUBDIRS(argp nettle spki sftp)
1170

1171 1172
# Set these flags *last*, or else the test programs won't compile
if test x$GCC = xyes ; then
1173 1174 1175 1176 1177 1178
  # Using -ggdb3 makes (some versions of) Redhat's gcc-2.96 dump core
  if "$CC" --version | grep '^2\.96$' 1>/dev/null 2>&1; then
    true
  else
    CFLAGS="$CFLAGS -ggdb3"
  fi
1179
  # FIXME: It would be better to actually test if this option works and/or is needed.
Niels Möller's avatar
Niels Möller committed
1180
  # Or perhaps use -funsigned-char.
1181 1182 1183
  if "$CC" --version | grep 'gcc.* 4\.' 1>/dev/null 2>&1; then
    CFLAGS="$CFLAGS -Wno-pointer-sign"
  fi
1184 1185 1186
  CFLAGS="$CFLAGS -Wall -W \
  -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes \
  -Wpointer-arith -Wbad-function-cast -Wnested-externs"
1187

1188 1189
# Don't enable -Wcast-align as it results in tons of warnings in the
# DES code. And when using stdio.
1190 1191
# Don't enable -Waggregate-return, as that causes warnings for glibc
# inttypes.h.
1192

1193
fi
Niels Möller's avatar
Niels Möller committed
1194

Niels Möller's avatar
Niels Möller committed
1195
# Used by contrib/solpkg.sh.in.
1196 1197 1198 1199
AC_SUBST(BUILD_ARCH, `uname -p`)
AC_SUBST(BUILD_OSSYS,`uname -s`)
AC_SUBST(BUILD_OSREV,`uname -r`)

1200 1201 1202
AC_CONFIG_FILES([Makefile src/config.make src/Makefile src/testsuite/Makefile
		 doc/Makefile misc/Makefile
		 contrib/Makefile contrib/lsh.spec contrib/solpkg.sh])
1203

1204
AC_OUTPUT