configure.in 15.5 KB
Newer Older
1
dnl -*- mode: shell-script; sh-indentation: 2; -*-
2
dnl $Id$
3

Niels Möller's avatar
Niels Möller committed
4
dnl Process this file with autoconf to produce a configure script.
Niels Möller's avatar
Niels Möller committed
5
AC_INIT(src/lsh_types.h)
Niels Möller's avatar
Niels Möller committed
6

7
AM_INIT_AUTOMAKE(lsh, 0.2.6)
Niels Möller's avatar
Niels Möller committed
8
dnl No real versioning yet, use dated snapshots instead.
Niels Möller's avatar
Niels Möller committed
9
dnl AM_INIT_AUTOMAKE(lsh, esyscmd([date +snapshot-%Y-%m-%d]))
Niels Möller's avatar
Niels Möller committed
10

Niels Möller's avatar
Niels Möller committed
11
AM_CONFIG_HEADER(config.h)
Niels Möller's avatar
Niels Möller committed
12

Niels Möller's avatar
Niels Möller committed
13
14
15
16
dnl This macro turns of a the Makefile.in: Makefile.am dependencies, unless
dnl --enable-maintainer-mode is passed to ./configure. But I want
dnl maintainermode to be *on* by default.
dnl AM_MAINTAINER_MODE
17

18
19
20
21
22
23
24
25
26
27
28
29
# We want an absolute path to the source-dir.
case "$srcdir" in
    /*)
    ;;
    *)
	oldsrcdir="$srcdir"
	srcdir="`cd \"$srcdir\";pwd`"
	AC_MSG_WARN([ Converted $oldsrcdir to $srcdir,
If this does not work, please use an absolute path to the configure script. ])
    ;;
esac

Niels Möller's avatar
Niels Möller committed
30
# We want to compile the crypto lib for use with lsh
Niels Möller's avatar
Niels Möller committed
31
CPPFLAGS="$CPPFLAGS -I$srcdir -I$srcdir/src -I$srcdir/src/symmetric/include -DLSH"
Niels Möller's avatar
Niels Möller committed
32

33
34
35
36
# 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
37
38
39

CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"

40
41
dnl Check options
AC_ARG_WITH(debug_alloc,
42
43
  [--with-debug-alloc    sanity check memory allocation and casts],,
  [with_debug_alloc=yes])
44

45
46
47
48
if test x$with_debug_alloc = xyes ; then
  AC_DEFINE(DEBUG_ALLOC)
fi

49
50
51
52
53
54
55
56
AC_ARG_WITH(debug_trace,
  [--with-debug-trace    support for tracing],,
  [with_debug_trace=yes])

if test x$with_debug_trace = xyes ; then
  AC_DEFINE(DEBUG_TRACE)
fi

57
AC_ARG_WITH(zlib,
58
59
  [--with-zlib    use zlib compression],,
  [with_zlib=yes])
60
61
62
63

dnl Checking this variable is delayed until we have checked if zlib is
dnl actually available.

64
65
66
67
68
69
70
71
AC_ARG_WITH(pty,
  [--without-pty   disable pty support],,
  [with_pty=yes])

if test x$with_pty = xyes ; then
  AC_DEFINE(WITH_PTY_SUPPORT)
fi

72
AC_ARG_WITH(sshd1,
73
  [--with-sshd1[=PROGRAM]    support fallback to SSH1 daemon],,
74
  [with_sshd1=yes])
75

76
77
78
79
80
81
82
83
84
# Default sshd1 path
if test x$with_sshd1 = xyes ; then
  with_sshd1=/usr/local/sbin/sshd1
fi

if test x$with_sshd1 != xno ; then
  AC_DEFINE(WITH_SSH1_FALLBACK)
  AC_DEFINE_UNQUOTED(SSHD1,"$with_sshd1")
fi
85

86
AC_ARG_WITH(idea,
87
88
  [--with-idea    support the patent-encumbered IDEA algorithm],,
  [with_idea=no])
89
90
91
92

if test x$with_idea = xyes ; then
  AC_DEFINE(WITH_IDEA)
fi
93

94
95
96
AC_ARG_WITH(datafellows_workarounds,
  [--with-datafellows-workarounds    Bug-compatibility with DataFellows ssh2 clients and servers],,
  [with_datafellows_workarounds=yes])
97

98
99
if test x$with_datafellows_workarounds = xyes ; then
  AC_DEFINE(DATAFELLOWS_WORKAROUNDS)
100
101
fi

102
103
104
105
106
107
108
AC_ARG_WITH(tcp_forward,
  [--with-tcp-forward        Support tcp forwarding],,
  [with_tcp_forward=yes])

if test x$with_tcp_forward = xyes ; then
  AC_DEFINE(WITH_TCP_FORWARD)
fi
109
110
111
112

AC_ARG_WITH(scheme,
  [--with-scheme[=PROGRAM]    Use a particular scheme implementation],,
  [with_scheme=])
113
114
115
116
117

AC_ARG_WITH(system-argp,
  [--without-system-argp    Don't use the system's argp.],,
  [with_system_argp=yes])
        
Niels Möller's avatar
Niels Möller committed
118
119
120
dnl Checks for programs.
AC_PROG_CC
AC_PROG_MAKE_SET
Niels Möller's avatar
Niels Möller committed
121
AC_PROG_RANLIB
122
AM_PROG_CC_STDC
Niels Möller's avatar
Niels Möller committed
123

124
125
126
127
if test x$am_cv_prog_cc_stdc = xno ; then
  AC_ERROR([the C compiler doesn't handle ANSI-C])
fi

128
129
130
131
# Use a particular scheme implementation?
if test x$with_scheme != x ; then
  AC_PATH_PROG(SCHEME_PROGRAM, $with_scheme,, $PATH)
else  
132
  AC_PATH_PROGS(SCHEME_PROGRAM, guile scsh,, $PATH)
133
fi
134
135
136
137
138
139

if test x$SCHEME_PROGRAM = x ; then
  AC_MSG_WARN([No scheme implementation found.])
  SCHEME_PROGRAM=false
fi

140
141
142
SCHEME_NAME=`basename $SCHEME_PROGRAM`
AC_SUBST(SCHEME_NAME)

143
144
AC_PATH_PROG(BASH, bash,, $PATH)
AC_PATH_PROG(GROFF, groff,, $PATH)
145
146
147
148
149
150
151
152
153
154
155
156
157
AC_PATH_PROG(M4, m4, m4)

AC_CACHE_CHECK([if m4 can handle eight-bit quote characters],
  lsh_cv_prog_m4_quote_8bit,
  [ if test xfoo = x`echo 'change''quote(,)foo' | $M4`; then
      lsh_cv_prog_m4_quote_8bit=yes
    else   
      lsh_cv_prog_m4_quote_8bit=no
    fi])

if test x$lsh_cv_prog_m4_quote_8bit = xno; then
  AC_MSG_WARN(  
[Upgrade to a better version than GNU m4 1.4,
158
159
or recompile it with CFLAGS=-funsigned-char.
Latest version is available at <URL: http://www.seindal.dk/rene/gnu/>])
160
  M4="false --"
161
fi
Niels Möller's avatar
Niels Möller committed
162
163

dnl Checks for libraries.
164
AC_CHECK_LIB(gmp, mpz_set_d,,
165
dnl Some debian systems have both gmp1 and gmp2.
166
    [AC_CHECK_LIB(gmp2, mpz_set_d,,
Niels Möller's avatar
Niels Möller committed
167
	AC_ERROR([GMP is missing (ftp://ftp.gnu.org/pub/gnu/gmp/gmp-2.0.2.tar.gz)]))])
168

169
170
171
if test x$with_zlib = xyes; then
  AC_CHECK_LIB(z, inflate,, [with_zlib=no])
fi
172
173
AC_CHECK_LIB(crypt, crypt)
AC_CHECK_LIB(xnet, inet_addr)
174
AC_CHECK_LIB(nsl, gethostbyname)
175
AC_CHECK_LIB(socket, setsockopt)
176
177
178
AC_CHECK_LIB(util, openpty)
dnl This macro is new in autoconf-2.13
AC_SEARCH_LIBS(syslog, bsd socket inet, AC_DEFINE(HAVE_SYSLOG))
Niels Möller's avatar
Niels Möller committed
179
180
181

dnl Checks for header files.
AC_HEADER_STDC
182

183
dnl Some debian systems have both gmp and gmp2.
184
dnl This will probably not work right if both gmp.h and gmp2/gmp.h exists,
185
dnl and gmp.h is too old (i.e GMP-1.x).
186
187
188
189
190
gmp_header_found=no
AC_CHECK_HEADERS(gmp.h gmp2/gmp.h, [gmp_header_found=yes; break])
if test "$gmp_header_found" = no; then
  AC_ERROR([Neither gmp.h nor gmp2/gmp.h found])
fi
191
  
192
AC_CHECK_HEADERS(fcntl.h strings.h sys/time.h unistd.h)
193
AC_CHECK_HEADERS(shadow.h)
194
195
196
if test x$with_zlib = xyes; then
  AC_CHECK_HEADERS(zlib.h,, [with_zlib=no])
fi
197
198
AC_CHECK_HEADERS(poll.h sys/poll.h)
AC_CHECK_HEADERS(crypt.h)
199
200
AC_CHECK_HEADERS(pty.h)
AC_CHECK_HEADERS(stropts.h)
201
AC_CHECK_HEADERS(syslog.h)
202
AC_CHECK_HEADERS(argp.h)
203

204

205
206
207
208
209
210
211
dnl AC_CHECK_MEMBER(includes, struct, field)
AC_DEFUN(AC_CHECK_MEMBER,
[ AC_CACHE_CHECK([if $2 has member $3],
    lsh_cv_decl_struct_$2_$3,
    [AC_TRY_COMPILE([$1],
changequote(<{, }>)dnl
      <{ struct $2 x; (void) &x.$3; }>,
212
changequote([, ])dnl
213
214
215
216
      [lsh_cv_decl_struct_$2_$3=yes],
      [lsh_cv_decl_struct_$2_$3=no])])
  if eval "test \"`echo '$lsh_cv_decl_struct_'$2`_'$3'\" = yes"; then
    AC_DEFINE_UNQUOTED(`echo HAVE_$3 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`)
217
  fi
218
])
219

220

221
222
223
224
225
226
AC_CHECK_HEADERS(utmp.h, [have_utmp_h=yes], [have_utmp_h=no])

if test x$have_utmp_h = xyes; then
  AC_CHECK_MEMBER([#include <utmp.h>], [utmp], [ut_host])
  AC_CHECK_MEMBER([#include <utmp.h>], [utmp], [ut_addr])
  AC_CHECK_MEMBER([#include <utmp.h>], [utmp], [ut_addr_v6])
227
fi
228

229
230
AC_CHECK_HEADERS(utmpx.h)

231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
dnl Some systems (in particular, Unixware) doesn't have socklen_t, but
dnl uses size_t. Falling back to int will cause some warnings.

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

AC_CACHE_CHECK([for socklen_t in sys/socket.h],
  lsh_cv_type_socklen_t,
  [ AC_EGREP_HEADER(socklen_t, sys/socket.h,
		    lsh_cv_type_socklen_t=yes,
		    lsh_cv_type_socklen_t=no]))

if test x$lsh_cv_type_socklen_t = xno ; then
  AC_DEFINE(socklen_t, int)
fi

  
248
249
250
251
252
dnl Should we use zlib?

if test x$with_zlib = xyes ; then
  AC_DEFINE(WITH_ZLIB)
fi
Niels Möller's avatar
Niels Möller committed
253

254
dnl Find the SSH1 daemon; try 'sshd1' first; if it fails, look for 'sshd'
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
dnl ## if test x$with_sshd1 = xyes ; then
dnl ## 	 AC_DEFINE(SSH1_FALLBACK)
dnl ## 	 dnl We have to provide an additional path: regular users seldomly have
dnl ## 	 dnl the sbin directories in their $PATH.
dnl ## 	 AC_PATH_PROG(SSHD1BIN, sshd1, [],
dnl ## 	   $PATH:/usr/local/sbin:/usr/local/etc:/usr/sbin:/usr/etc:/sbin:/etc)
dnl ## 	 if test x$SSHD1BIN = x ; then
dnl ## 	   AC_PATH_PROG(SSHD1BIN, sshd, [],
dnl ## 	     $PATH:/usr/local/sbin:/usr/local/etc:/usr/sbin:/usr/etc:/sbin:/etc)
dnl ## 	 fi
dnl ## 	 if test x$SSHD1BIN = x ; then
dnl ## 	   AC_MSG_ERROR([
dnl ## You requested SSH1 fallback support (--with-sshd1), but no sshd1 could be found.
dnl ## You can
dnl ## - supply the location of sshd1, i.e. --with-sshd1=/home/foo/sbin/sshd ,
dnl ## - install sshd1 (ftp://ftp.cs.hut.fi/pub/ssh/); note that it is not free
dnl ## 	 software, or
dnl ## - configure --without-sshd1 .
dnl ## ])
dnl ## 	 fi
dnl ## 
dnl ## 	 dnl OK. We've found an SSH1 daemon. Now we need to make sure it is
dnl ## 	 dnl recent enough to be used as a fallback daemon. This means it has to
dnl ## 	 dnl support the -V option, which tells it not to read the client version 
dnl ## 	 dnl string as lshd has already done that, and which supplies that version
dnl ## 	 dnl string.
dnl ## 	 AC_MSG_CHECKING(if $SSHD1BIN has the -V compatibility flag)
dnl ## changequote(<<, >>)dnl
dnl ## 	 if ($SSHD1BIN -h 2>&1 ; true) | grep '^[ \t]*-V' > /dev/null ; then
dnl ## changequote([, ])dnl
dnl ## 	   AC_MSG_RESULT(yes)
dnl ## 	 else
dnl ## 	   AC_MSG_ERROR([
dnl ## Found SSH1 daemon ]$SSHD1BIN[, but it does not support the -V option.
dnl ## This means we cannot use it as a fallback daemon. Please install a more recent 
dnl ## SSH1 daemon (ftp://ftp.cs.hut.fi/pub/ssh/), or configure --without-sshd1 .])
dnl ## 	 fi
dnl ## 	 AC_DEFINE_UNQUOTED(SSHD1,"$SSHD1BIN")
dnl ## fi
294

Niels Möller's avatar
Niels Möller committed
295
dnl Checks for typedefs, structures, and compiler characteristics.
296
297
AC_C_CONST
AC_TYPE_UID_T
Niels Möller's avatar
Niels Möller committed
298
AC_TYPE_SIZE_T
299
300
AC_HEADER_TIME

Niels Möller's avatar
Niels Möller committed
301
302
303
AC_CHECK_SIZEOF(short, 2)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long, 4)
Niels Möller's avatar
Niels Möller committed
304
305
dnl FIXME: We should check that a pid_t fits in an int
	
Niels Möller's avatar
Niels Möller committed
306
dnl Checks for library functions.
307
308
309
AC_FUNC_ALLOCA
AC_FUNC_MEMCMP
AC_FUNC_VPRINTF
310
AC_CHECK_FUNCS(select socket strerror strsignal strtol)
311
AC_CHECK_FUNCS(getspnam)
312
AC_CHECK_FUNCS(vsnprintf inet_aton)
313
AC_CHECK_FUNCS(openpty)
314
AC_CHECK_FUNCS(cfmakeraw)
315
316
317
AC_FUNC_GETPGRP
AC_CHECK_FUNCS(syslog)
AC_REPLACE_FUNCS(memxor)
318

319
dnl Needed by argp
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
AC_CHECK_FUNCS(mempcpy strndup)
AC_CHECK_FUNCS(flockfile putc_unlocked)
AC_CHECK_FUNCS(fputs_unlocked fwrite_unlocked)

dnl AC_CHECK_VAR(VAR, INCLUDES)
AC_DEFUN(AC_CHECK_VAR,
[ AC_CACHE_CHECK(
    [for $1],
    lsh_cv_var_$1,
    AC_TRY_LINK([$2], [void *p = (void *) &$1;],
		[lsh_cv_var_$1=yes],
		[lsh_cv_var_$1=no]))
  if eval "test \"`echo '$lsh_cv_var_'$1`\" = yes"; then
    AC_DEFINE_UNQUOTED(HAVE_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`)
  fi
])

AC_CHECK_VAR(program_invocation_name, [#include <errno.h>])
AC_CHECK_VAR(program_invocation_short_name, [#include <errno.h>])

AC_CHECK_FUNCS(poll,,[LIBOBJS="jpoll.o $LIBOBJS"])
Niels Möller's avatar
Niels Möller committed
341

342
343
344
345
dnl This macro is mentioned in the automake manual, but where is it
dnl supposed to be defined?
dnl AC_REPLACE_GNU_GETOPT

346
dnl AC_CHECK_FUNCS(getopt_long,,[LIBOBJS="getopt.o $LIBOBJS"])
Niels Möller's avatar
Niels Möller committed
347
AC_CHECK_FUNCS(getopt_long,,[LIBOBJS="getopt.o getopt1.o $LIBOBJS"])
348

349
# Use system argp only if we can actually link with it.
350
if test x$with_system_argp = xyes ; then
351
  AC_CHECK_FUNCS(argp_parse,, with_system_argp=no)
352
353
fi

354
355
356
357
358
359
# FIXME: If the system already has argp, it's unnecessary to build our own.
# As we want to load the objects into liblsh.a, we list all the objects
# rather than libargp.a.
##  LIBOBJS="$LIBOBJS argp/libargp.a"

if test x$with_system_argp = xno ; then
360
361
362
  LIBOBJS="$LIBOBJS argp/argp-ba.o argp/argp-fmtstream.o \
		    argp/argp-help.o argp/argp-parse.o argp/argp-pin.o argp/argp-pv.o \
		    argp/argp-pvh.o argp/argp-eexst.o"
363
fi
364

365
dnl Check for broken shutdown
366
367
AC_CACHE_CHECK(for working shutdown on AF_UNIX sockets,
	       lsh_cv_func_shutdown_works_on_unix_sockets,
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
[
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

395
  if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds) < 0)
396
397
398
399
400
401
402
403
    {
      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)
    {
404
405
      fprintf(stderr, "shutdown(%d, SHUT_WR) failed: %s\n",
	      fds[0], strerror(errno));
406
407
408
409
      return 0;
    }
  if (shutdown(fds[1], SHUT_RD) < 0)
    {
410
411
      fprintf(stderr, "shutdown(%d, SHUT_RD) failed: %s\n",
	      fds[1], strerror(errno));
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
      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)
    {
427
      fprintf(stderr, "signal failed.\n");
428
429
430
431
432
433
434
435
436
      exit(1);
    }

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

  exit(0);
}
437
438
439
], 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)])
440

441
if test x$lsh_cv_func_shutdown_works_on_unix_sockets = xyes ; then
442
443
444
    AC_DEFINE(SHUTDOWN_WORKS_WITH_UNIX_SOCKETS)
fi

445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
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],
  dnl FIXME: Pessimistic default for cross compilation.
  [lsh_cv_sys_unix98_ptys=no]))

if test x$lsh_cv_sys_unix98_ptys = xyes; then
  AC_DEFINE(HAVE_UNIX98_PTYS)
fi
  
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
dnl Check for gcc's __attribute__ construction
AC_CACHE_CHECK(for __attribute__,
	       lsh_cv_c_attribute,
[ AC_TRY_COMPILE([
#include <stdlib.h>
],
[
static void foo(void) __attribute__ ((noreturn));

static void __attribute__ ((noreturn))
foo(void)
{
  exit(1);
}
],
lsh_cv_c_attribute=yes,
lsh_cv_c_attribute=no)])

528
529
if test "x$lsh_cv_c_attribute" = "xyes"; then
  AC_DEFINE(HAVE_GCC_ATTRIBUTE)
530
531
fi

532
533
534
535
536
537
538
539
540
541
542
543
544
dnl Check for gcc's __FUNCTION__ variable
AC_CACHE_CHECK(for __FUNCTION__,
	       lsh_cv_c_FUNCTION,
  [ AC_TRY_COMPILE(,
      [ void foo(void) { char c = __FUNCTION__[0]; } ],
      lsh_cv_c_FUNCTION=yes,
      lsh_cv_c_FUNCTION=no)])

if test "x$lsh_cv_c_FUNCTION" = "xyes"; then
  AC_DEFINE(HAVE_GCC_FUNCTION)
fi


545
AC_MSG_CHECKING(for BSD pty names)
Niels Möller's avatar
Niels Möller committed
546
547

dnl FIXME: What is most portable, tr -d '\n' or tr -d '\012' ?
548
549
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'`")
550
551

dnl FIXME: How can we test if the bsd scheme is likely to work?
552
553
554
AC_DEFINE(PTY_BSD_SCHEME)
AC_MSG_RESULT([done])

555
556
# Set these flags *last*, or else the test programs won't compile
if test x$GCC = xyes ; then
557
    CFLAGS="$CFLAGS -ggdb3 -Wall -W \
Niels Möller's avatar
Niels Möller committed
558
559
560
 -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes \
 -Waggregate-return \
 -Wpointer-arith -Wbad-function-cast -Wnested-externs"
561

562
563
# Don't enable -Wcast-align as it results in tons of warnings in the
# DES code. And when using stdio.
564

565
fi
Niels Möller's avatar
Niels Möller committed
566

567
AC_OUTPUT(Makefile doc/Makefile misc/Makefile
568
	  src/Makefile src/argp/Makefile src/scm/Makefile
569
	  src/testsuite/Makefile
570
571
	  src/symmetric/Makefile src/symmetric/include/Makefile
	  contrib/Makefile contrib/lsh.spec)