File: configure.in

package info (click to toggle)
tf5 5.0beta8-10
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 3,736 kB
  • sloc: ansic: 25,484; perl: 103; makefile: 82; sh: 79
file content (744 lines) | stat: -rw-r--r-- 21,440 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
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
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
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
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
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
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
dnl
dnl  TinyFugue - programmable mud client
dnl  Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2002, 2003, 2004, 2005, 2006-2007 Ken Keys
dnl
dnl  TinyFugue (aka "tf") is protected under the terms of the GNU
dnl  General Public License.  See the file "COPYING" for details.
dnl
dnl  DO NOT EDIT THIS FILE.
dnl  Any configuration changes should be made to the unix/Config file.
dnl

AC_REVISION($Id: configure.in,v 35000.61 2007/01/13 23:12:35 kkeys Exp $)

dnl Note: autoconf uses <<EOF, so we use <<END instead.

dnl ### Initialization variables.

AC_INIT(src/tf.h)

SOCKS=''
OTHER_OBJS=""
TFVER=`sed -ne 's/^TFVER=\(.*\)/\1/p' src/vars.mak`
TFVERSION=`sed -n -e '/Fugue version/s/^.*"\(.*\)".*$/\1/p' src/main.c`

AC_CONFIG_HEADER(src/tfconfig.h)

AC_PREFIX_DEFAULT(`
    if test -w /usr/local/bin && test -w /usr/local/share; then
	echo "/usr/local"
    elif uname -s | egrep BeOS >/dev/null 2>&1; then
	# prefix according to Steven Black <steven@be.com>
	echo "$HOME/config"
    else
	echo "$HOME"
    fi
`)

AC_SUBST(TFVERSION)
AC_MSG_NOTICE([Configuring $TFVERSION])

# User installation options
AC_ARG_ENABLE(version,
[  --enable-version        insert version number into names of installed files
                          (equivalent to --program-suffix=\"-${TFVER}\")],
    , enable_version=default)
AC_ARG_ENABLE(symlink,
[  --enable-symlink[=NAME] make a symlink NAME to the executable
                          [NAME=BINDIR/tf]],
    , enable_symlink=default)
AC_ARG_ENABLE(core,
[  --enable-core           enable debugging core files],
    , enable_core=default)

AC_ARG_ENABLE(ssl,
[  --disable-ssl           disable SSL support],
    , enable_ssl=yes)
AC_ARG_ENABLE(getaddrinfo,
[  --enable-getaddrinfo    enable getaddrinfo() (if configure complains)
  --disable-getaddrinfo   disable getaddrinfo() (implies --disable-inet6)],
    , enable_getaddrinfo=default)
AC_ARG_ENABLE(inet6,
[  --disable-inet6         disable IPv6 support],
    , enable_inet6=yes)
AC_ARG_ENABLE(termcap,
[  --disable-termcap       use hardcoded vt100 codes instead of termcap
  --enable-termcap=LIB    enable termcap with library LIB (e.g., "ncurses")
                          (needed only if configure guesses incorrectly)],
    , enable_termcap=default)
AC_ARG_ENABLE(256colors,
[  --disable-256colors     disable 256 color support (may reduce memory use)],
    , enable_256colors=yes)
AC_ARG_ENABLE(mailcheck,
[  --disable-mailcheck     disable mail checking
  --enable-mailcheck=DIR  enable checking for mail in directory DIR
                          (needed only if configure guesses incorrectly)],
    , enable_mailcheck=yes)

# User feature options
AC_ARG_ENABLE(history,
[  --disable-history       disable /recall and other history features],
    , enable_history=yes)
AC_ARG_ENABLE(process,
[  --disable-process       disable /quote and /repeat],
    , enable_process=yes)
AC_ARG_ENABLE(float,
[  --disable-float         disable floating point arithmetic and functions],
    , enable_float=yes)

AC_ARG_WITH(incdirs,
[  --with-incdirs=DIRS     search for include files in DIRS])
AC_ARG_WITH(libdirs,
[  --with-libdirs=DIRS     search for libraries in DIRS])
AC_ARG_WITH(inclibdirs,
[  --with-inclibdirs=DIRS  same as --with-incdirs=DIRS --with-libdirs=DIRS])
AC_ARG_WITH(inclibpfx,
[  --with-inclibpfx=DIRS   same, but appends '/include' and '/lib'])
AC_ARG_WITH(incdir) dnl because I never remember if it's singular or plural
AC_ARG_WITH(libdir) dnl because I never remember if it's singular or plural
AC_ARG_WITH(inclibdir) dnl because I never remember if it's singular or plural


# Developer options
# --enable-development implies --enable-core --disable-symlink
AC_ARG_ENABLE(development, , , enable_development=default)
AC_ARG_ENABLE(dmalloc, , , enable_dmalloc=no)

AC_MSG_NOTICE([])

if test "$enable_development" = "default"; then
    if test -d CVS; then
	enable_development=yes
    else
	enable_development=no
    fi
fi

if test "$enable_development" = "yes"; then
    AC_MSG_NOTICE([Development version.])
elif echo $TFVERSION | egrep "alpha" >/dev/null 2>&1; then
cat <<END
This is an alpha version, and so may not be fully tested on some platforms.
With the new features comes the possibility of new bugs.  If you don't want
to deal with this, get the latest stable or gamma version.

END
fi

if test "$enable_core" = "default"; then
    enable_core=$enable_development
fi

if test "$enable_version" = "default"; then
    enable_version=$enable_development
fi

if test "$enable_development" = "yes"; then
    if test "$enable_symlink" = "default"; then
	enable_symlink=no
    fi
    if test -z "${CC}"; then
	AC_CHECK_PROGS(CC, tfcc gcc-anal)
    fi
else
    AC_DEFINE(NDEBUG)
fi

if test "$enable_core" = "yes"; then
    AC_MSG_NOTICE([Core dumps enabled.])
    CFLAGS="${CFLAGS} -g"
    STRIP=":"
else
    AC_MSG_NOTICE([Core dumps disabled.])
    AC_DEFINE(DISABLE_CORE)
fi


dnl XXX option: TTYDRIVER


UNAME=`{ uname -s && uname -v && uname -r || uname -a; } 2>/dev/null`
UNAME=`echo $UNAME`  # remove newlines
AC_SUBST(UNAME)
#AC_CYGWIN

dnl ########### programs ############

AC_PROG_CC
AC_PROG_GCC_TRADITIONAL
dnl XXX STD_C=1, if compiler is standard

dnl XXX
dnl ${CC} ${CCFLAGS} -c symtest.c >symtest.out 2>&1 || {
dnl     echo
dnl     cat symtest.out
dnl     echo
dnl     echo "## The messages above indicate one of these configuration problems:"
dnl     echo "##   1. the compiler is not installed correctly;"
dnl     echo "##   2. you do not have permission to execute the compiler; or"
dnl     echo "##   3. CCFLAGS='${CCFLAGS}' in unix/Config is invalid."
dnl     echo "## In any case, this is a local problem that can only be"
dnl     echo "## solved by you or a system administrator, so don't ask me."
dnl     echo
dnl     exit 1
dnl }

dnl XXX AC_AIX

AC_PROG_MAKE_SET

##if test "$enable_core" = "no"; then
##    AC_CHECK_PROG(STRIP, strip, strip, :)
##fi
AC_SUBST(STRIP)

AC_CHECK_PROG(RANLIB, ranlib, ranlib, :)


dnl ########### compiler characteristics ############

AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)

if test "$GCC" = "yes"; then
    # gcc may generate a warning for "inline", so use "__inline__" instead.
    AC_MSG_CHECKING([for inline])
    AC_MSG_RESULT([yes])
    AC_DEFINE(inline, __inline__)
else
    AC_C_INLINE
fi


dnl ########### libraries ############

dnl ### Library testing.
dnl # If libfoo.a make references to libbar.a, the order must be "-lfoo -lbar".
dnl # So we test incrementally, building the list from right to left.
dnl # Dynix/ptx needs: -lsocket -linet -lnsl
dnl # SysV needs: -lsocket -lnsl


dnl TF_DIRS(src, dst[, prefix[, suffix]])
AC_DEFUN(TF_DIRS, [
    if test "${$1}" != "no" && test "${$1}" != ""; then
        for dir in ${$1}; do
            $2="${$2} $3${dir}$4"
        done
    fi
])

TF_DIRS(with_incdirs, CPPFLAGS, -I)
TF_DIRS(with_incdir, CPPFLAGS, -I)
TF_DIRS(with_inclibdirs, CPPFLAGS, -I)
TF_DIRS(with_inclibdir, CPPFLAGS, -I)
TF_DIRS(with_inclibpfx, CPPFLAGS, -I, /include)

LIBDIRS=""
TF_DIRS(with_libdirs, LIBDIRS, -L)
TF_DIRS(with_libdir, LIBDIRS, -L)
TF_DIRS(with_inclibdirs, LIBDIRS, -L)
TF_DIRS(with_inclibdir, LIBDIRS, -L)
TF_DIRS(with_inclibpfx, LIBDIRS, -L, /lib)

dnl Must append LIBDIRS to LDFLAGS now so it's present for AC_CHECK_LIB.
dnl (LIBDIRS will not work in the OTHER-LIBRARIES argument of AC_CHECK_LIB
dnl on all platforms since it will _follow_ the -l option for the library
dnl being tested.)
LDFLAGS="$LDFLAGS $LIBDIRS"


AC_SEARCH_LIBS(select, bsd, ,
    AC_MSG_ERROR([TF can not work without select().]))

dnl # gethostbyname may not be in default libraries.
dnl # QNX keeps gethostbyname in lsocket.
AC_SEARCH_LIBS(gethostbyname, bsd nsl_s nsl resolv socket, ,
    AC_MSG_WARN([Host name resolution will not be available.]))

dnl ### If -linet exists, assume we need it.
AC_CHECK_LIB(inet, main)

dnl ### If -lnet exists, assume we need it.
AC_CHECK_LIB(net, main)

dnl ## If we haven't found connect(), look for -lsocket.
dnl ## Note: on IRIX 5, -lsocket exists, but we mustn't use its gethostbyname().
AC_SEARCH_LIBS(connect, socket)


dnl XXX --enable-socks
dnl if test "$enable_socks" != "no" ; then
dnl     # SOCKS uses res_init(), so we need -lresolv if there is one.
dnl     AC_SEARCH_LIBS(res_init, resolv)
dnl     AC_SEARCH_LIBS(XXX, socks5 "-lsocks5 -L/usr/local/lib" \
dnl 	socks "-lsocks -L/usr/local/lib")
dnl     AC_CHECK_HEADERS(socks.h) dnl -I/usr/local/include
dnl     echo "#define SOCKS ${SOCKS}" >&4
dnl     if test -n "$SOCKS_NONBLOCK" ; then
dnl         echo "#define SOCKS_NONBLOCK" >&4
dnl     fi
dnl fi


dnl ### I'm guessing setlocale() is in libintl on some systems, if not in libc.
AC_SEARCH_LIBS(setlocale, intl, ,
    AC_MSG_WARN([Locales will not be supported.]))

dnl ### OpenSSL
if test "$enable_ssl" = "yes"; then
    ok=0
    old_LIBS="$LIBS"
    old_CFLAGS="$CFLAGS"
    old_CPPFLAGS="$CPPFLAGS"
    while true; do
	dnl -lssl needs -lcrypto
	dnl Try in default locations first, then /usr/local/ssl
	LIBS="$LIBS -lssl -lcrypto"
	AC_MSG_CHECKING([for libcrypto and libssl])
	AC_TRY_LINK_FUNC(SSL_new, AC_MSG_RESULT([yes]),
	    CFLAGS="$CFLAGS -L/usr/local/ssl/lib";
	    CPPFLAGS="-I/usr/local/ssl/include $CPPFLAGS";
	    AC_TRY_LINK_FUNC(SSL_new, AC_MSG_RESULT([/usr/local/ssl]),
		AC_MSG_RESULT([no]); break))
	dnl Red Hat 9 and Yellow Dog Linux have ssl.h in a standard place,
	dnl but it depends on krb5.h which isn't in a standard place.
	AC_MSG_CHECKING(for ssl kerberos dependency)
	if test -r /usr/kerberos/include/krb5.h; then
	    AC_MSG_RESULT([yes])
	    CPPFLAGS="-I/usr/kerberos/include $CPPFLAGS"
	else
	    AC_MSG_RESULT([no])
	fi
	AC_CHECK_HEADER(openssl/ssl.h, , break)
	AC_DEFINE(HAVE_SSL)
	ok=1
	break
    done
    if test "$ok" = "0"; then
	AC_MSG_RESULT([ssl support will not be enabled.])
	LIBS="$old_LIBS"
	CFLAGS="$old_CFLAGS"
	CPPFLAGS="$old_CPPFLAGS"
    fi
fi

dnl ### test termcap.
dnl # At least one system (Red Hat Linux) has a broken ncurses and a working
dnl # termcap, so we try termcap before ncurses.

terminal_hardcode="TERM_vt100";

dnl # Cygwin may not have termcap at all, but it only supports ANSI emulation
dnl # anyway, so we hardcode that (unless it was overridden).
if test "$CYGWIN" = "yes"; then
    terminal_hardcode="TERM_ansi";
    if test "$enable_termcap" = "default"; then
	enable_termcap="no";
    fi
fi

if test "$enable_termcap" = "default"; then
    enable_termcap="yes";
fi

if test "$enable_termcap" = "no"; then
    AC_DEFINE_UNQUOTED(HARDCODE, $terminal_hardcode)
else
    if test "$enable_termcap" = "yes"; then enable_termcap=""; fi
    AC_SEARCH_LIBS(tgetent, $enable_termcap termcap ncurses curses,
	AC_DEFINE(TERMCAP)
    ,
	AC_DEFINE_UNQUOTED(HARDCODE, $terminal_hardcode)
	AC_MSG_WARN([Hardcoding terminal codes.]))
fi
dnl XXX check for debian linux's broken termcap


if test "$enable_256colors" = "yes"; then
    AC_DEFINE(NCOLORS, 256)
fi


if test "$enable_float" = "yes"; then
    AC_SEARCH_LIBS(sqrt, m)
fi

AC_CHECK_LIB(z, inflate)

AC_CHECK_LIB(pcre, pcre_compile, :, [
    AC_MSG_NOTICE([Note: will use old copy of pcre distributed with tf]);
    PCRE=pcre; LDFLAGS="${LDFLAGS} -Lpcre-2.08"; ])
AC_SUBST(PCRE)


dnl ########### headers ############

AC_HEADER_STDC
AC_CHECK_HEADERS(unistd.h memory.h sys/select.h)
AC_HEADER_SYS_WAIT

dnl ### For optional language support.
AC_CHECK_HEADERS(locale.h, ,
    AC_MSG_WARN([Locales will not be supported.]))

dnl ### Find pwd.h
AC_CHECK_HEADERS(pwd.h, ,
AC_MSG_WARN([Filename '~user' expansion will not be supported.]))

dnl ### Find zlib.h
AC_CHECK_HEADERS(zlib.h)


dnl TF_SEARCH_HEADERS(SYMBOL, HEADERS... [, DO-IF-FOUND [, DO-IF-NOT-FOUND]])
dnl Searches for each header in HEADERS, and defines SYMBOL to the first one
dnl found.
AC_DEFUN(TF_SEARCH_HEADERS, [
    found=0;
    for f in $2; do
	AC_CHECK_HEADERS($f,
	    AC_DEFINE_UNQUOTED($1, <$f>)
	    found=1
	    break)
	if test $found -eq 1; then break; fi
    done
    if test $found -eq 1; then
	:; $3
    else
	:; $4
    fi
    unset found
])


dnl ### Find internet structure header
TF_SEARCH_HEADERS(NETINET_IN_H, netinet/in.h sys/in.h sys/netinet/in.h, ,
AC_MSG_WARN([I will use my own internet structures.  Good luck.]))

dnl ### Find internet address header
TF_SEARCH_HEADERS(ARPA_INET_H, arpa/inet.h sys/inet.h)

dnl ### Find nameser header
dnl TF_SEARCH_HEADERS(NAMESER_H, arpa/nameser.h nameser.h)

dnl ### Find netdb header
TF_SEARCH_HEADERS(NETDB_H, netdb.h sys/netdb.h, ,
    AC_MSG_ERROR([can't find netdb.h]))

AC_CACHE_CHECK([whether struct sockaddr has sa_len], tf_cv_sa_len,
    AC_TRY_COMPILE([
#include<sys/types.h>
#include <sys/socket.h>],
        [struct sockaddr sa; return sa.sa_len;],
        tf_cv_sa_len=yes,
	tf_cv_sa_len=no))

if test "${tf_cv_sa_len}" = "yes"; then
    AC_DEFINE(HAVE_SOCKADDR_SA_LEN)
fi


dnl ### Figure out which terminal driver to use.

AC_CHECK_HEADERS(termios.h termio.h sgtty.h, break)

dnl # Some brain damaged systems (Xenix) need <sys/ptem.h> for struct winsize.
AC_EGREP_HEADER([struct winsize], sys/ptem.h, AC_DEFINE(NEED_PTEM_H))


dnl ########### typedefs ############

dnl TF_CHECK_TYPE(TYPE, DEFAULT [, OTHER_HEADERS])
dnl ...because AC_CHECK_TYPE doesn't have OTHER_HEADERS
AC_DEFUN(TF_CHECK_TYPE,
[AC_REQUIRE([AC_HEADER_STDC])dnl
AC_MSG_CHECKING(for $1)
AC_CACHE_VAL(ac_cv_type_$1,
[AC_EGREP_CPP(dnl
changequote(<<,>>)dnl
<<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl
changequote([,]), [
#if STDC_HEADERS
#include <stdlib.h>
#include <stddef.h>
#endif
$3
], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl
AC_MSG_RESULT($ac_cv_type_$1)
if test $ac_cv_type_$1 = no; then
  AC_DEFINE($1, $2)
fi
])


AC_TYPE_SIGNAL
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_CHECK_TYPE(time_t, long)
TF_CHECK_TYPE(socklen_t, int, [
#include <sys/types.h>
#include <sys/socket.h>
])


dnl ########### structures ############


dnl ########### functions ############

dnl # SCO keeps strftime() in -lintl
AC_FUNC_STRFTIME

dnl # h_errno is a variable, not a function.  But AC_CHECK_FUNCS only checks
dnl # that the symbol is defined, so this works.
AC_CHECK_FUNCS(h_errno)

dnl # required standard functions
AC_CHECK_FUNCS(strstr strtol, ,
    AC_MSG_ERROR([Missing required standard function.]))
dnl # optional functions
AC_CHECK_FUNCS(bcopy bzero connect fileno getcwd \
    gethostname gethostbyname getipnodebyname \
    getpwnam gettimeofday getwd hstrerror index inet_aton)

if test "$enable_getaddrinfo" = "default"; then
    if test `uname -s` = 'Darwin'; then
	AC_MSG_WARN([getaddrinfo() may be broken, so IPv6 support is disabled.  Use --enable-getaddrinfo to override.])
	enable_getaddrinfo=no
    else
	enable_getaddrinfo=yes
    fi
fi
if test "$enable_getaddrinfo" = "no"; then
    enable_inet6=no
else
    AC_CHECK_FUNCS(getaddrinfo gai_strerror)
fi

AC_CHECK_FUNCS(kill memcpy memset raise setlocale setrlimit sigaction \
    srand srandom \
    strcasecmp strchr strcmpi strcspn strerror stricmp strtod tzset waitpid)

dnl # override a few values
if test "$CYGWIN" = "yes"; then
    AC_DEFINE(HAVE_H_ERRNO, [0  /* h_errno is broken in cygwin32 b18. */])
fi

if test "$enable_inet6" = "yes"; then
    AC_MSG_CHECKING([for IPv6 address structure])
    for type in in6_addr in_addr6; do
	AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>
#include NETINET_IN_H
],
	    [
#ifndef AF_INET6
# error AF_INET6 not defined
#endif
	    struct ${type} foo;
	    ],
	    AC_DEFINE_UNQUOTED(IN6_ADDR, $type)
	    AC_MSG_RESULT([$type])
	    break)
    done
fi


dnl ########### system services ############

dnl # These should come after AC_PROG_CC.
AC_EXEEXT
AC_OBJEXT

dnl ### Find mail directory by looking at $MAIL, then in the usual places.
if test "$enable_mailcheck" = "no"; then
    MAILDIR=""
elif test "$enable_mailcheck" = "yes"; then
    AC_MSG_CHECKING([location of mail directory])
    if test -n "$MAIL" ; then
        # Not every system has dirname.  sigh.
        changequote(, )dnl We need brackets for the regexp.
        MAILDIR=`echo $MAIL | sed 's;/[^/]*$;;'`
        changequote([, ])dnl Restore bracket quotes.
    elif test -d /usr/spool/mail ; then
        MAILDIR="/usr/spool/mail"
    elif test -d /var/spool/mail ; then
        MAILDIR="/var/spool/mail"
    elif test -d /usr/mail ; then
        MAILDIR="/usr/mail"
    elif test -d /var/mail ; then
        MAILDIR="/var/mail"
    else
	MAILDIR=""
    fi
    AC_MSG_RESULT([${MAILDIR-(none)}])
else
    MAILDIR="$enable_mailcheck"
fi
if test -n "$MAILDIR"; then
    AC_DEFINE_UNQUOTED(MAILDIR, "$MAILDIR")
fi


dnl ### Figure out names of executable, library directory, and symlink.

if test "$enable_version" != "no" && test "$program_suffix" = "NONE"; then
    program_suffix="-${TFVER}"
fi

dnl The "right" way of using program_transform_name, program_prefix, and
dnl program_suffix expects you to use AC_ARG_PROGRAM here and do transformation
dnl in the Makefile, but we want the values now, so we do it ourselves.
EXENAME="tf" PROGNAME="tf"
test "${program_prefix}" != "NONE" && EXENAME="${program_prefix}${EXENAME}"
test "${program_suffix}" != "NONE" && EXENAME="${EXENAME}${program_suffix}"
if test "${program_transform_name}" != "NONE"; then
    EXENAME=`echo "${EXENAME}" | sed "${program_transform_name}"`
fi
LIBNAME="${PROGNAME}-lib"

if test "$enable_symlink" = "no"; then
    SYMLINK=""
elif test "$enable_symlink" = "yes"; then
    SYMLINK='${bindir}/tf'
else
    SYMLINK="$enable_symlink"
fi

AC_SUBST(EXENAME)
AC_SUBST(PROGNAME)
AC_SUBST(LIBNAME)
AC_SUBST(SYMLINK)


dnl ### man page

dnl if test "$enable_manpage" = "yes"; then
dnl     MANPAGE='${mandir}/man1/${EXENAME}.1'
dnl     MANTYPE='nroff'
dnl else
dnl     MANPAGE=''
dnl     MANTYPE=''
dnl fi
dnl AC_SUBST(MANPAGE)
dnl AC_SUBST(MANTYPE) dnl XXX


dnl ########### output ############


dnl ########### end ############


dnl # XXX
dnl ### Sanity check for filenames (some people do pretty stupid things)
dnl # The "${SYMLINK}/" is just to make the grep return false if SYMLINK is empty.
dnl #
dnl #if echo "$TF"          | egrep "^[^/]" >/dev/null 2>&1 ||
dnl #   echo "$LIBDIR"      | egrep "^[^/]" >/dev/null 2>&1 ||
dnl #   echo "${SYMLINK}/"  | egrep "^[^/]" >/dev/null 2>&1
dnl #then
dnl #   echo "Don't install files with relative paths or '~'."
dnl #   echo "Edit unix/Config and try again."
dnl #   exit 2
dnl #fi
dnl #
dnl ## Don't allow installation in the build tree (people have actually tried this).
dnl ## The cd;pwd is needed to normalize the directory name in case of links, etc.
dnl #
dnl #DIR1=`echo $TF      | sed 's;/[^/]*$;;'`
dnl #DIR1=`cd $DIR1 && pwd`
dnl #DIR2=`echo $LIBDIR  | sed 's;/[^/]*$;;'`
dnl #DIR2=`cd $DIR2 && pwd`
dnl #DIR3=`echo $SYMLINK | sed 's;/[^/]*$;;'`
dnl #DIR3=`cd $DIR3 && pwd`
dnl #
dnl #if test -z "$DIR1"  || test -z "$DIR2"  || test -z "$DIR3" ; then
dnl #    echo "Error in directory."
dnl #    exit 1;
dnl #fi
dnl #
dnl #DIR1=`cd $DIR1 && pwd || { echo "Error in directory $DIR1."; false; }`
dnl #
dnl #BUILDTREE=`cd .. && pwd`
dnl #if echo "${DIR1}/" | egrep "^${BUILDTREE}/" >/dev/null 2>&1 ||
dnl #   echo "${DIR2}/" | egrep "^${BUILDTREE}/" >/dev/null 2>&1 ||
dnl #   echo "${DIR3}/" | egrep "^${BUILDTREE}/" >/dev/null 2>&1
dnl #then
dnl #    echo
dnl #    echo 'You can not install files in the build tree,'
dnl #    echo "${BUILDTREE}."
dnl #    echo 'Edit unix/Config and try again.'
dnl #    exit 2
dnl #fi
dnl #
dnl # Too many people have renamed the distribution directory to "$HOME/tf", and
dnl # then wondered why they couldn't install the executable as "$HOME/tf".
dnl #if test -d "${TF}" ; then
dnl #    echo "\"${TF}\" is a directory; you can not install the executable"
dnl #    echo 'with the same name.  Either rename the directory, or choose a'
dnl #    echo 'different name for the executable.'
dnl #    exit 1
dnl #fi


MODE=755
AC_SUBST(MODE)




dnl ### Make sure the PATH is sane.
dnl # Ideally, this should be done before the compiler check.  But a compiler
dnl # found now in the extended PATH won't be found in src/Makefile, because it
dnl # won't inherit this PATH.
PATH="$PATH:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc:/usr/new:/usr/new/bin:/usr/nbin:/usr/ccs/bin"


if test "$enable_dmalloc" = "yes"; then
    CPPFLAGS="$CPPFLAGS -DUSE_DMALLOC"
    OTHER_OBJS="$OTHER_OBJS dmalloc.o"
fi

dnl ### write variables

if test "$enable_inet6"   = "yes"; then AC_DEFINE(ENABLE_INET6)  fi
if test "$enable_history" = "no"; then AC_DEFINE(NO_HISTORY)  fi
if test "$enable_process" = "no"; then AC_DEFINE(NO_PROCESS)  fi
if test "$enable_float"   = "no"; then AC_DEFINE(NO_FLOAT)    fi

CPPFLAGS="${CPPFLAGS} -DDATADIR=\${datadir}"
AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(LIBS)
AC_SUBST(OTHER_OBJS)

AC_OUTPUT(Makefile unix/vars.mak src/tfdefs.h, [

### Create src/Makefile from pieces.

cat >src/Makefile <<END
#### DO NOT EDIT THIS FILE.
#### This src/Makefile was automatically generated by configure.  The correct
#### installation precedure is to run ./configure in the top directory.  You
#### should not edit this file; all configuration changes should be made
#### via arguments to configure.

END
cat unix/vars.mak src/vars.mak unix/unix.mak src/rules.mak >> src/Makefile
])

AC_MSG_NOTICE([
#####################################################
## prefix: $prefix
## exec_prefix: $exec_prefix
## bindir: $bindir
## datadir: $datadir
## executable: \${bindir}/$EXENAME
## library: \${datadir}/$LIBNAME
##
## TinyFugue configuration successful.
## Use "make" to build.
])