File: configure.in

package info (click to toggle)
gnomehack 1.0.5-1.1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 10,256 kB
  • ctags: 12,966
  • sloc: ansic: 119,783; yacc: 2,002; sh: 610; lex: 417; makefile: 397
file content (1058 lines) | stat: -rw-r--r-- 27,245 bytes parent folder | download
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
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
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
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
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
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
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
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
dnl			 GnomeHack - configure.in

dnl $Id: configure.in,v 1.85 1999/12/15 08:00:27 andersee Exp $

dnl Process this file with autoconf to produce a configure script.

dnl ignore the warnings;  cross-compiling will work successfully --
dnl cross-compiles will never get to that point, and dummy code
dnl placed there somehow confuses sh.

dnl We use some nice new stuff from autoconf 2.13 (like AC_DEFINE_DIR)
AC_PREREQ(2.13)

AC_INIT(src/hack.c)
AM_INIT_AUTOMAKE(gnomehack, 1.0.5)
AM_ACLOCAL_INCLUDE(macros)

dnl FIXME - enable this _after_ primary GnomeHack development ends
dnl AM_MAINTAINER_MODE

dnl bleck, there is no AC macro to change the default bindir
bindir='${exec_prefix}/games'

AM_CONFIG_HEADER(include/config.h)

dnl Keep these near the top to ensure that following
dnl macros have the basics needed
AC_PROG_MAKE_SET
AC_PROG_CC
AC_ISC_POSIX

dnl Set default configure language to C
AC_LANG_C

dnl Checks for programs, with the more specific checks first
dnl (for no particular reason other than organization)
AC_PROG_GCC_TRADITIONAL
AC_PROG_LN_S
AM_PROG_LEX
AC_PROG_YACC
YACC="$YACC -d" # make sure to generate y.tab.h file too
AC_PATH_PROG(SH, sh)
AC_PATH_PROG(SED, sed)
AC_PATH_PROG(MV, mv)
AC_PATH_PROG(TOUCH, touch)
AC_PATH_PROG(RANLIB, ranlib)
AC_PATH_PROG(RM, rm)
AC_PATH_PROG(NROFF, nroff)
AC_PATH_PROG(CP, cp)
AC_PATH_PROG(TBL, tbl)
AC_PATH_PROG(COL, col)
AC_PATH_PROG(LINT, lint)
AC_PATH_PROG(CAT, cat)
AC_PATH_PROG(CTAGS, ctags)
AC_PATH_PROG(GREP, grep)
AC_PATH_PROG(EGREP, egrep)
AC_PATH_PROG(ECHO, echo)
AC_PATH_PROG(ED, ed)
AC_PATH_PROG(DIFF, diff)
AC_PATH_PROG(MKDIR, mkdir)
AC_PATH_PROG(CHOWN, chown)
AC_PATH_PROG(CHGRP, chgrp)
AC_PATH_PROG(CHMOD, chmod)
AC_PATH_PROG(DITROFF, ditroff)
AC_PATH_PROG(PSDIT, psdit)
AC_PATH_PROG(LATEX, latex)

COMPRESS_SPEC=""
AC_PATH_PROGS(COMPRESS, bzip2 gzip compress, internal)
case $COMPRESS in
	*bzip2) AC_DEFINE_UNQUOTED(COMPRESS, "$COMPRESS") 
		AC_DEFINE(COMPRESS_EXTENSION, ".bz2")
		COMPRESS_SPEC="Requires: bzip2"
		;;
	*gzip) 	AC_DEFINE_UNQUOTED(COMPRESS, "$COMPRESS") 
		AC_DEFINE(COMPRESS_EXTENSION, ".gz")
		COMPRESS_SPEC="Requires: gzip" 
		;;
	*compress) AC_DEFINE_UNQUOTED(COMPRESS, "$COMPRESS") 
		AC_DEFINE(COMPRESS_EXTENSION, ".Z")
		COMPRESS_SPEC="Requires: compress" 
		;;
	internal) AC_DEFINE(INTERNAL_COMP)
		;;
esac


dnl checkpoint config.cache
AC_CACHE_SAVE

dnl
dnl --- TO DO ---
dnl

dnl *PERM
dnl GAMEUID/GAMEGRP
dnl posix/bsd job control
dnl DOAGAIN
dnl TEXTCOLOR
dnl OPENWINBUG
dnl PYRAMID_BUG
dnl BSD_43_BUG
dnl MICROPORT_[286_]BUG
dnl AIXPS_2BUG
dnl UNIX386MUSIC
dnl VPIX_MUSIC
dnl NO_FILE_LINKS dnl write proper config!
dnl LOCKDIR
dnl DEF_PAGER
dnl NO_MAILREADER
dnl DEF_MAILREADER
dnl COMPRESS_OPTIONS
dnl FCMASK
dnl SHELL


dnl For now, we're always running on Unix, so define this
AC_DEFINE(UNIX)

dnl NETWORK is always defined for Unix (and since the only
dnl reference is in sys/unix, the code can probably be thrown away)
AC_DEFINE(NETWORK)

dnl Non-Mac platforms always enable clipping
AC_DEFINE(CLIPPING)



dnl ==================================================================
AC_ARG_ENABLE(efence, [  --enable-efence         Enable Electric Fence malloc debugging (def disabled)],
	if eval "test x$enable_internal_tiles = xyes"
	then
		use_efence=yes
	else
		use_efence=no
	fi,
	use_efence=no)

dnl ==================================================================
AC_ARG_ENABLE(internal-tiles, [  --enable-internal-tiles Compile tiles into X11 gnomehack binary (def enabled)
  --disable-internal-tiles  ONLY external tiles will be used],
	if eval "test x$enable_internal_tiles = xyes"
	then
		AC_DEFINE(INTERNAL_TILES)
	else
		AC_MSG_WARN(No picture tiles compiled into NetHack)
	fi,
	AC_DEFINE(INTERNAL_TILES))

dnl ==================================================================
AC_ARG_ENABLE(mailcheck, [  --enable-mailcheck      Check for new mail during the game (def enabled)
  --disable-mailcheck     Do NOT check for new mail during game],
	if eval "test x$enable_mailcheck = xyes"
	then
		AC_DEFINE(MAIL)
		mail_checking="yes"
	else
		if eval "test x$enable_mailcheck != xno"
		then
			AC_DEFINE(MAIL)
			mail_checking="yes"
		fi
	fi,
	AC_DEFINE(MAIL)
	mail_checking="yes")

dnl ==================================================================
AC_ARG_ENABLE(alt-hackdir, [  --enable-alt-hackdir=directory
			  Set NetHack data dir to something
			  other than PREFIX/gnomehackdir (def disabled)],
	if eval "test x$enable_alt_hackdir != xyes" && eval "test x$enable_alt_hackdir != xno"
	then
		alt_hackdir="$enable_alt_hackdir"
	else
		alt_hackdir="no"
	fi,
	alt_hackdir="no")
	
dnl ==================================================================
AC_ARG_ENABLE(alt-docdir, [  --enable-alt-docdir=directory
			  Set the location for the gnomehack documentation to
			  be installed.  Default = PREFIX/doc/gnomehack (def disabled)],
	if eval "test x$enable_alt_docdir != xyes" && eval "test x$enable_alt_docdir != xno"
	then
		alt_docdir="$enable_alt_docdir"
	else
		alt_docdir="no"
	fi,
	alt_docdir="no")
	
dnl ==================================================================
AC_ARG_ENABLE(alt-desktopdir, [  --enable-alt-desktopdir=directory
			  Set the location for the Gnome desktop directory.
			  Default = PREFIX/apps/Games (def disabled)],
	if eval "test x$enable_alt_desktopdir != xyes" && eval "test x$enable_alt_desktopdir != xno"
	then
		alt_desktopdir="$enable_alt_desktopdir"
	else
		alt_desktopdir="no"
	fi,
	alt_desktopdir="no")
	
dnl ==================================================================
AC_ARG_ENABLE(alt-savedir, [  --enable-alt-savedir=directory
			  Set the location for the save game directory.
			  Default = /var/lib/games/gnomehack (def disabled)],
	if eval "test x$enable_alt_savedir != xyes" && eval "test x$enable_alt_savedir != xno"
	then
		alt_savedir="$enable_alt_savedir"
	else
		alt_savedir="no"
	fi,
	alt_savedir="no")
	
dnl ==================================================================
AC_ARG_ENABLE(ams-mail, [  --enable-ams-mail       use Andrew Messaging System for mail (def disabled)],
	use_ams_mail="$enable_ams_mail")

dnl ==================================================================
AC_ARG_ENABLE(default, [  --enable-default=opt    set default windowing system to opt.
                          opt can be one of (tty, X11, gnome)
			  (default is to have autoconf set this option)],
	if eval "test x$enable_default != xyes" && eval "test x$enable_default != xno"
	then
		ws_enable_default="$enable_default"
	else
		ws_enable_default="default"
	fi,

	ws_enable_default="default")
	
	
dnl ==================================================================
AC_ARG_ENABLE(xpm,
[  --enable-xpm
                          use XPM graphics (if available) (def enabled)],
	if eval "test x$enable-with-xpm != xno"
	then
		want_xpm="yes"
	else
		want_xpm="no"
	fi,
	want_xpm="yes")

dnl ==================================================================

dnl ==================================================================
AC_ARG_ENABLE(graphic-tombstone, 
[  --enable-graphic-tombstone
                          use a graphical tombstone (if supported) (def enabled)],
	if eval "test x$enable_graphic_tombstone != xno"
	then
		want_tombstone="yes"
	else
		want_tombstone="no"
	fi,
	want_tombstone="yes")

dnl ==================================================================
AC_ARG_ENABLE(minimal-term, [  --enable-minimal-term   enable if a terminal handles highlighting 
                          or tabs poorly (def disabled)],
	if eval "test x$enable_minimal_term != xyes"
	then
		AC_DEFINE(MINIMAL_TERM)
	fi)


dnl ==================================================================
AC_MSG_CHECKING(for wizard user)
AC_ARG_ENABLE(wizard, [  --enable-wizard=name    the username that can play in wizard (cheating and 
                          debugging) mode (def is `whoami`)
  --disable-wizard        do not allow anyone to use wizard mode])
  
if eval "test x$enable_wizard = xyes" || eval "test x$enable_wizard = x"
then
	if whoami > /dev/null 2> /dev/null
	then
		enable_wizard=`whoami`
	else
		enable_wizard=root
	fi
fi

if eval "test x$enable_wizard = xno"
then
	AC_MSG_RESULT(disabled)
else
	AC_MSG_RESULT($enable_wizard)
fi
	
dnl ==================================================================
AC_ARG_ENABLE(dlb, [  --enable-dlb            store files in a tar-like file (def enabled)],
	if eval "test x$enable_dlb != xno"
	then
		AC_DEFINE(DLB)
	fi,		
	AC_DEFINE(DLB))

dnl ==================================================================
AC_ARG_ENABLE(insurance, [  --enable-insurance      save game on level changes (def enabled)],
	if eval "test x$enable_insurance != xno"
	then
		AC_DEFINE(INSURANCE)
	fi,		
	AC_DEFINE(INSURANCE))

dnl ==================================================================
AC_ARG_ENABLE(secure, [  --enable-secure         Be extra paranoid about protecting files/savesgames
			    from users that might tamper with them.  Leave off for single player installs.
                          set[gu]id (def disabled)],
	if eval "test x$enable_secure == xyes"
	then
		AC_DEFINE(SECURE)
	fi)

dnl ==================================================================
AC_ARG_ENABLE(player-limit, [  --enable-player-limit=num
                          set maximum number of concurent players to num
  --disable-player-limit  don't limit number of simultainous users (default)],
	if eval "test $enable_player_limit -gt 0" #is this a number?
	then
		AC_DEFINE(MAX_NR_OF_PLAYERS, $enable_player_limit)
	fi)

dnl ==================================================================
AC_ARG_ENABLE(vision-algo,  [  --enable-vision-algo=algo
                          set algorithm to use for vision (in order of speed:
			  tables, macros, funcs) (def tables)],
	[case $enable_vision_algo in
		macros)	AC_DEFINE(MACRO_CPATH)
		;;
		funcs) AC_DEFINE(NO_MACRO_CPATH)
		;;
		*) AC_DEFINE(VISION_TABLES)
		;;
	esac])

dnl ==================================================================
AC_ARG_ENABLE(weapon-skills, [  --enable-weapon-skills  Enable weapon skills and proficiencies (def enabled)],
	if eval "test x$enable_weapon_skills != xno"
	then
		AC_DEFINE(WEAPON_SKILLS)
	fi,
	AC_DEFINE(WEAPON_SKILLS))

dnl ==================================================================
AC_ARG_ENABLE(kitchen-sinks, [  --enable-kitchen-sinks  Enable presence of kitchen sinks (def enabled)],
	if eval "test x$enable_kitchen_sinks != xno"
	then
		AC_DEFINE(SINKS)
	fi,
	AC_DEFINE(SINKS))

dnl ==================================================================
AC_ARG_ENABLE(keystone-kops, [  --enable-keystone-kops  Enable presence of Keystone Kops (def enabled)],
	if eval "test x$enable_keystone_kops != xno"
	then
		AC_DEFINE(KOPS)
	fi,
	AC_DEFINE(KOPS))

dnl ==================================================================
AC_ARG_ENABLE(tourists, [  --enable-tourists       Enable both the Tourist player class and anacronisms (def enabled)],
	if eval "test x$enable_tourists != xno"
	then
		AC_DEFINE(TOURIST)
	fi,
	AC_DEFINE(TOURIST))

dnl ==================================================================
AC_ARG_ENABLE(seduction, [  --enable-seduction      Enable succubi/incubi seduction (def enabled)],
	if eval "test x$enable_seduction != xno"
	then
		AC_DEFINE(SEDUCE)
	fi,
	AC_DEFINE(SEDUCE))

dnl ==================================================================
AC_ARG_ENABLE(maze-levels, [  --enable-maze-levels    Enable special maze-like levels (def enabled)],
	if eval "test x$enable_maze_levels != xno"
	then
		AC_DEFINE(WALLIFIED_MAZE)
	fi,
	AC_DEFINE(WALLIFIED_MAZE))

dnl ==================================================================
AC_ARG_ENABLE(rogue-levels, [  --enable-rogue-levels   Enable special Rogue-like levels (def enabled)],
	if eval "test x$enable_rogue_levels != xno"
	then
		AC_DEFINE(REINCARNATION)
	fi,
	AC_DEFINE(REINCARNATION))

dnl ==================================================================
AC_ARG_ENABLE(elbereth, [  --enable-elbereth       Allow player to engrave the E-word (def enabled)],
	if eval "test x$enable_elbereth != xno"
	then
		AC_DEFINE(ELBERETH)
	fi,
	AC_DEFINE(ELBERETH))

dnl ==================================================================
AC_ARG_ENABLE(redo-last-command, [  --enable-redo-last-command
			  Support to re-doing last command (def enabled)],
	if eval "test x$enable_redo_last_command != xno"
	then
		AC_DEFINE(REDO)
	fi,
	AC_DEFINE(REDO))

dnl ==================================================================
AC_ARG_ENABLE(exp-in-status, [  --enable-exp-in-status  Show experience points on bottom status line
			  (def enabled)],
	if eval "test x$enable_exp_in_status != xno"
	then
		AC_DEFINE(EXP_ON_BOTL)
	fi,
	AC_DEFINE(EXP_ON_BOTL))

dnl ==================================================================
AC_ARG_ENABLE(score-in-status, [  --enable-score-in-status  Show score on bottom status line (def enabled)],
	if eval "test x$enable_score_in_status != xno"
	then
		AC_DEFINE(SCORE_ON_BOTL)
	fi,
	AC_DEFINE(SCORE_ON_BOTL))

dnl ==================================================================
AC_ARG_ENABLE(signals, [  --disable-signals       Turn OFF OS signals (def: signals enabled)],
	if eval "test x$enable_signals = xno"
	then
		AC_DEFINE(NO_SIGNAL)
	fi)

dnl ==================================================================
AC_ARG_ENABLE(debug-output, [  --enable-debug-output   Enable debugging (def disabled)],
	if eval "test x$enable_debug_output = xyes"
	then
		AC_DEFINE(DEBUG)
	fi)

dnl ==================================================================
AC_ARG_ENABLE(enh-wizard, [  --enable-enh-wizard     Enable enhanced wizard classes, skills, and spells
			  (a.k.a. LZA's wizard patch '96) (def DISabled)],
	if eval "test x$enable_enh_wizard = xyes"
	then
		AC_DEFINE(FEATURE_WIZ_PATCH)
	fi)

dnl ==================================================================
AC_MSG_CHECKING(whether to test for tty window port)
AC_ARG_WITH(tty-port, [
  --with-tty-port         TTY window port (def enabled)],
	if eval "test x$with_tty_port = xyes"
	then
		TRY_TTY=yes
		AC_MSG_RESULT(yes)
	else
		TRY_TTY=no
		AC_MSG_RESULT(no)
	fi,
	TRY_TTY=yes
	AC_MSG_RESULT(yes))

dnl ==================================================================
AC_MSG_CHECKING(whether to test for GNOME window port)
AC_ARG_WITH(gnome-port, [
  --with-gnome-port       GNOME window port (def enabled)],
	if eval "test x$with_gnome_port = xyes"
	then
		TRY_GNOME=yes
		AC_MSG_RESULT(yes)
	else
		TRY_GNOME=no
		AC_MSG_RESULT(no)
	fi,
	TRY_GNOME=yes
	AC_MSG_RESULT(yes))

if eval "test x$ac_cv_prog_gcc = xyes"
then
	AC_DEFINE(GCC_WARN)
fi

HACKLIBDIR=""
dnl Check for cmd line arg for alternate hackdir
AC_MSG_CHECKING(for alternate NetHack data directory)
if eval "test x$alt_hackdir != xno"
then
	AC_MSG_RESULT($alt_hackdir)
	HACKLIBDIR="$alt_hackdir"
else
	AC_MSG_RESULT(no)
	HACKLIBDIR='${libdir}/${PACKAGE}'
fi

DESKTOP_DIR=""
dnl Check for cmd line arg for alternate Gnome desktop dir
AC_MSG_CHECKING(for alternate Gnome desktop directory)
if eval "test x$alt_desktopdir != xno"
then
	AC_MSG_RESULT($alt_desktopdir)
	DESKTOP_DIR="$alt_desktopdir"
else
	AC_MSG_RESULT(no)
	DESKTOP_DIR='${datadir}/gnome/apps/Games'
fi

SAVE_DIR=""
dnl Check for cmd line arg for alternate save dir
AC_MSG_CHECKING(for alternate save directory)
if eval "test x$alt_savedir != xno"
then
	AC_MSG_RESULT($alt_savedir)
	SAVE_DIR="$alt_savedir"
	AC_DEFINE_DIR(LOGFILE, "{alt_savedir}/logfile")
	AC_DEFINE_DIR(NEWS, "{alt_savedir}/news")
	AC_DEFINE_DIR(HLOCK, "{alt_savedir}/perm")
	AC_DEFINE_DIR(RECORD, "{alt_savedir}/record")
else
	AC_MSG_RESULT(no)
	SAVE_DIR="${HACKLIBDIR}/save"
	AC_DEFINE(LOGFILE, "save/logfile")
	AC_DEFINE(NEWS, "save/news")
	AC_DEFINE(HLOCK, "save/perm")
	AC_DEFINE(RECORD, "save/record")
fi


DOC_DIR=""
dnl Check for cmd line arg for alternate Documentation dir
AC_MSG_CHECKING(for alternate Documentation directory)
if eval "test x$alt_docdir != xno"
then
	AC_MSG_RESULT($alt_docdir)
	DOC_DIR="$alt_docdir"
else
	AC_MSG_RESULT(no)
	DOC_DIR='${prefix}/doc/${PACKAGE}'
fi


dnl Check for Andrew Messaging System/OS features
AC_MSG_CHECKING(for Andrew Messaging System support)
if eval "test x$mail_checking = xyes" && eval "test x$use_ams_mail = xyes"
then
	AC_DEFINE(AMS)
	AC_MSG_RESULT(yes)
else
	AC_MSG_RESULT(no)
fi


dnl
dnl X-Windows
dnl
dnl Depends on AC_PATH_XTRA, above
dnl

ws_best_default=""

AC_MSG_CHECKING(to see if we want X)
if eval "test x$no_x != xyes"
then
AC_MSG_RESULT(yup)
AC_PATH_XTRA

dnl Add basic X libs to link line
dnl FIXME: I thought AC_PATH_X* did this?
dnl We need this b/c Xaw and Xpm won't be found otherwise???
AC_CHECK_LIB(X11, XOpenDisplay,
	X_LIBS="$X_LIBS -lX11", , "$X_LIBS")

dnl Check for Xpm support
XPM_LIBS=""


AC_CHECK_LIB(Xpm, XpmReadFileToXpmImage,
	HAVE_XPM=yes XPM_LIBS="-lXpm",
	HAVE_XPM=no,
	$X_LIBS)

if eval "test x$want_xpm = xyes"
then
    AC_MSG_CHECKING(whether to use XPM's)
    if eval "test x$HAVE_XPM = xyes"
    then 
	AC_MSG_RESULT(yes)
	AC_DEFINE(USE_XPM)
	XPM_LIST="x11tiles pet_mark.xbm"

	if eval "test x$want_tombstone = xyes"
	then
		AC_DEFINE(GRAPHIC_TOMBSTONE)
		XPM_LIST="x11tiles pet_mark.xbm rip.xpm"
	fi
    else
	AC_MSG_RESULT(no)
    fi
fi


dnl Check for GNOME+
if eval "test x$TRY_GNOME = xyes"
then
	GNOME_INIT
	GNOME_X_CHECKS

	if eval "test x$HAVE_XPM = xyes"
	then
	    HAVE_GNOME=yes
	    # AC_DEFINE(HAVE_ORBIT)
	    ws_best_default=GNOME
	else
	    AC_MSG_WARN(*** GnomeHack requires XPM ***)
	    HAVE_GNOME=no
	fi

fi



dnl
dnl If HAVE_GNOME set, update CFLAGS et al., otherwise
dnl check for X11 and libs associated with it, and
dnl set CFLAGS et al. properly.
dnl
if eval "test x$HAVE_GNOME = xno"
then
	AC_CHECK_LIB(Xt, XtAppInitialize,
		X_LIBS="$X_LIBS -lXt", , "$X_LIBS")

	dnl Check for 3D Athena Widgets, use them if available
	AC_CHECK_LIB(Xaw3d, XawListUnhighlight,
		HAVE_XAW=yes XAW_LIBS="-lXaw3d" ws_best_default=X11,
		HAVE_XAW=no XAW_LIBS="",
		"$X_LIBS")
	
	dnl Check for Regular Athena Widgets only if 3D ones are not available
	if eval "test x$HAVE_XAW = xno"
	then
		AC_CHECK_LIB(Xaw, XawListUnhighlight,
			HAVE_XAW=yes XAW_LIBS="-lXaw -lXmu" ws_best_default=X11,
			HAVE_XAW=no,
			"$X_LIBS")
	fi

fi

dnl This 'else+fi' brought to you by the letters X and Q,
dnl and the "if no_x" clause way, way, way above here.
else
AC_MSG_RESULT(nope)
fi

dnl FIXME: should this be here?
AC_DEFINE(XPM_LIST)

dnl Checks for header files.
AC_STDC_HEADERS
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
AC_HEADER_DIRENT
AC_CHECK_HEADERS(fcntl.h sgtty.h strings.h sys/file.h sys/ioctl.h)
AC_CHECK_HEADERS(sys/time.h termio.h unistd.h varargs.h pwd.h string.h)
AC_CHECK_HEADERS(xpm.h X11/xpm.h signal.h)
AC_CHECK_HEADER(curses.h, have_curses_h="yes", have_curses_h="no")

dnl checkpoint config.cache
AC_CACHE_SAVE

dnl Checks for typedefs, structures, and compiler characteristics.
AM_C_PROTOTYPES
AC_C_CONST

AC_MSG_CHECKING(for curses.h conflict)

AC_TRY_COMPILE([
#include "include/termcap.h"
#include <curses.h>
],,
	AC_MSG_RESULT(ok),
	if eval "test x$have_curses_h = xyes"
	then
		AC_DEFINE(HAVE_CURSES_H_CONFLICT)
		AC_MSG_RESULT(conflict found - workaround enabled)
	else
		AC_MSG_RESULT(none found)
	fi)


AC_MSG_CHECKING(for working volatile)
AC_TRY_COMPILE(, volatile int blah;,
	AC_MSG_RESULT(yes),
	AC_MSG_RESULT(no)
	AC_DEFINE(volatile,))

AC_MSG_CHECKING(for working signed)
AC_TRY_COMPILE(, signed int blah;,
	AC_MSG_RESULT(yes),
	AC_MSG_RESULT(no)
	AC_DEFINE(signed,))

AC_TYPE_UID_T
AC_C_INLINE
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_CHECK_TYPE(time_t, long)
AC_STRUCT_TM

AC_MSG_CHECKING(good handling of bitfields)
AC_TRY_COMPILE(struct nothing{unsigned blah:2;};,
	struct nothing compfun = {2};,
	AC_MSG_RESULT(yes),
	AC_MSG_RESULT(no))
	 

AC_MSG_CHECKING(for short unsigned integers)
AC_TRY_RUN(int main(){
	unsigned char x;
	
	x = -1;
	
	if (x<0)
		exit(1);
	else
		exit(0);
	},
	AC_MSG_RESULT(unsigned char)
	AC_DEFINE(UCHAR, unsigned char),
	AC_TRY_RUN(int main(){
		char x;
	
		x = -1;
	
		if (x<0)
			exit(1);
		else
			exit(0);
		},
		AC_MSG_RESULT(char)
		AC_DEFINE(UCHAR, char),
		AC_MSG_RESULT(unsigned short int)
		AC_DEFINE(UCHAR, unsigned short int),
		[echo $ac_n "cross compiling; assumed OK... $ac_c"]
		),
	AC_MSG_RESULT((pessimistic cross-compile default) unsigned short int)
	AC_DEFINE(UCHAR, unsigned short int))

AC_MSG_CHECKING(for short signed integers)
AC_TRY_RUN(int main(){
	signed char x;
	
	x = -1;
	
	if (x<0)
		exit(0);
	else
		exit(1);
	},
	AC_MSG_RESULT(signed char)
	AC_DEFINE(SCHAR, signed char),
	AC_TRY_RUN(int main(){
		char x;
	
		x = -1;
	
		if (x<0)
			exit(0);
		else
			exit(1);
		},
		AC_MSG_RESULT(char)
		AC_DEFINE(SCHAR, char),
		AC_MSG_RESULT(signed short int)
		AC_DEFINE(SCHAR, signed short int),
		[echo $ac_n "cross compiling; assumed OK... $ac_c"]
		),
	AC_MSG_RESULT((pessimistic cross-compile default) signed short int)
	AC_DEFINE(UCHAR, signed short int))

AC_MSG_CHECKING(defined())
AC_TRY_COMPILE([
#define ACDEFTST
#if defined(ACDEFTST)
#else
	choke me
#endif],, 
	AC_MSG_RESULT(yes)
	if eval "test x$enable_wizard != xno"
	then
		AC_DEFINE_UNQUOTED(WIZARD, "$enable_wizard")
	fi,
	AC_MSG_RESULT(no)
	AC_DEFINE(KR1ED)
		if eval "test x$enable_wizard != xno"
	then
		AC_DEFINE(WIZARD)
		AC_DEFINE_UNQUOTED(WIZARD_NAME, "$enable_wizard")
	fi)

AC_MSG_CHECKING(if compiler can handle certain complicated expressions) 
AC_TRY_COMPILE(struct rm {
		int icedpool;
		char typ;
		};	
	,struct rm *lev;

	lev->typ = (lev->icedpool == 8 ? 15 : 16);,
	AC_MSG_RESULT(yes), 
	AC_MSG_RESULT(no)
	AC_DEFINE(STUPID))

AC_MSG_CHECKING(if compiler can handle void functions)
AC_TRY_COMPILE(void nothing(){ return; },,
	AC_MSG_RESULT(yes), 
	AC_MSG_RESULT(no)
	AC_DEFINE(void, int))

AC_MSG_CHECKING(for generic pointers)
AC_TRY_COMPILE(,void *p;,
	AC_MSG_RESULT(void *)
	AC_DEFINE(genericptr, void *),
	AC_MSG_RESULT(char *)
	AC_DEFINE(genericptr, char *))
	
AC_MSG_CHECKING(prototype widening requirements)
AC_TRY_COMPILE(int blah();
	int blah(x)
	char x;{return (int)x;},,
	AC_MSG_RESULT(unwidened)
	AC_DEFINE(UNWIDENED_PROTOTYPES),
	AC_MSG_RESULT(widened)
	AC_DEFINE(WIDENED_PROTOTYPES))

dnl Checks for library functions.
AC_TYPE_SIGNAL
AC_FUNC_VPRINTF

dnl Note memcmp must also be checked-for in the list below
AC_FUNC_MEMCMP

AC_CHECK_FUNCS(getcwd getuid setuid getgid setgid getpid getpwuid \
	getpwnam putenv strdup strerror strcasecmp strncasecmp \
	strcmpi strncmpi index rindex memcpy memcmp usleep napms \
	umask stat fstat kill atexit isatty chmod chdir bcopy bcmp)

dnl decide which srandom to use, default to sys/share/random.c
have_srandom="no"

AC_CHECK_FUNC(srandom,
	have_srandom="yes"
	AC_DEFINE(HAVE_SRANDOM))

if eval "test x$have_srandom != xyes"
then
	AC_CHECK_FUNC(srand48,
		have_srandom="yes"
		AC_DEFINE(HAVE_SRAND48))
fi


if eval "test x$have_srandom != xyes"
then
	AC_DEFINE(RANDOM)
	RANDOBJ="random.o"
	already_random="yes"
	AC_MSG_WARN([No high-quality random-number generator init found -- NH replacement])
else
	already_random="no"
fi

NH_TTY_LIBS=""
if eval "test x$TRY_TTY = xyes"
then
	AC_CHECK_FUNCS(tgetent)

	if eval "test x$HAVE_TGETENT = x"
	then
		TTY_LIB_NAME=""

		AC_CHECK_LIB(ncurses, tgetent,
			NH_TTY_LIBS="-lncurses" 
			TTY_LIB_NAME=ncurses)

		if eval "test x$TTY_LIB_NAME = x"
		then
			AC_CHECK_LIB(curses, tgetent,
				NH_TTY_LIBS="-lcurses" 
				TTY_LIB_NAME=curses)
		fi

		if eval "test x$TTY_LIB_NAME = x"
		then
			AC_CHECK_LIB(termcap, tgetent,
				NH_TTY_LIBS="-ltermcap" 
				TTY_LIB_NAME=termcap)
		fi

		if eval "test x$TTY_LIB_NAME = x"
		then
			AC_MSG_WARN(No termcap lib, things may break)
		fi
	fi
fi

if test "x$enable_efence" = xyes; then
	AC_CHECK_LIB(efence, malloc)
fi

AC_CHECK_FUNC(random, 
	AC_DEFINE(RAND_FUNC, random),
	AC_CHECK_FUNC(lrand48, 
		AC_DEFINE(RAND_FUNC, lrand48),
		AC_MSG_WARN(No high-quality random-number generator found -- using internal replacement)
		if eval "test x$already_random != xyes"
		then
			AC_DEFINE(RANDOM)
			RANDOBJ="random.o"
		fi))

AC_MSG_CHECKING(for /dev/speaker)
if test -c /dev/speaker
then
	AC_MSG_RESULT(yes)
	AC_DEFINE(UNIX386MUSIC)
else
	AC_MSG_RESULT(no)
fi


# am_path_gtk must be before ac_lang_cplusplus

dnl set the initial default windowing system -- adjusted later

dnl Set default window system to the best choice
if eval "test x$ws_enable_default = xdefault"
then
	AC_MSG_CHECKING(for a good default window system)

	dnl Select the best default windowing system
	if eval "test x$ws_best_default != x"
	then
		ws_enable_default=$ws_best_default
		AC_MSG_RESULT($ws_best_default)
	else
		ws_enable_default="tty"
		AC_MSG_RESULT(tty)
	fi
fi

echo "Setting NetHack default window system type to $ws_enable_default"
AC_DEFINE_UNQUOTED(DEFAULT_WINDOW_SYS, "$ws_enable_default")

NH_EXTRALIBS=""
NH_WIN_SUBDIRS=""
NH_TILE_C=""
NH_TILE_O=""
NH_TILE2X11=""
if eval "test x$ws_enable_default = xGNOME"
then
	AC_DEFINE(GNOME_GRAPHICS)
	AC_DEFINE(TTY_GRAPHICS)
	AC_DEFINE(USE_TILES)
	
	NH_EXTRALIBS="-L../win/tty -lwintty -L../win/X11 -lwinX11 -L../win/gnome -lwingnome"
	NH_WIN_SUBDIRS="tty X11 gnome"
	NH_TILE_C="tile.c"
	NH_TILE_O="tile.o"
	NH_TILE2X11="tile2x11"
fi
if eval "test x$ws_enable_default = xX11"
then
	AC_DEFINE(X11_GRAPHICS)
	AC_DEFINE(TTY_GRAPHICS)
	AC_DEFINE(USE_TILES)
	
	NH_EXTRALIBS="-L../win/tty -lwintty -L../win/X11 -lwinX11"
	NH_WIN_SUBDIRS="tty X11"
	NH_TILE_C="tile.c"
	NH_TILE_O="tile.o"
	NH_TILE2X11="tile2x11"
fi
if eval "test x$ws_enable_default = xtty"
then
	AC_DEFINE(TTY_GRAPHICS)
	NH_EXTRALIBS="-L../win/tty -lwintty"
	NH_WIN_SUBDIRS="tty"
	NH_TILE_C=""
	NH_TILE_O=""
	NH_TILE2X11=""
fi

# NH_TTY_LIBS set elsewhere
NH_TTY_DEPS=""
if test "xno" = "xyes"; then
	dnl FIXME: correctly test for TTY support
	NH_TTY_DEPS="../win/tty/libwintty.a"
fi
NH_GNOME_LIBS="$GNOME_LIBDIR $GTK_LIBS $GNOME_LIBS $GNOMEUI_LIBS"
NH_GNOME_DEPS=""
if test "x$HAVE_GNOME" = "xyes"; then
	NH_GNOME_DEPS="../win/gnome/libwingnome.a"
fi
NH_X11_LIBS="$X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS $XAW_LIBS $XPM_LIBS"
NH_X11_DEPS=""
if test "xno" = "xyes"; then
	dnl FIXME: correctly test for X11 support
	NH_X11_DEPS="../win/X11/libwinX11.a"
fi

AC_SUBST(LIBS)
AC_SUBST(RANDOBJ)
AC_SUBST(XPM_LIST)
AC_SUBST(NH_EXTRALIBS)
AC_SUBST(NH_WIN_SUBDIRS)
AC_SUBST(NH_TILE_C)
AC_SUBST(NH_TILE_O)
AC_SUBST(NH_TILE2X11)
AC_SUBST(NH_TTY_LIBS)
AC_SUBST(NH_TTY_DEPS)
AC_SUBST(NH_X11_LIBS)
AC_SUBST(NH_X11_DEPS)
AC_SUBST(NH_GNOME_LIBS)
AC_SUBST(NH_GNOME_DEPS)
AC_SUBST(DESKTOP_DIR)
AC_SUBST(HACKLIBDIR)
AC_SUBST(SAVE_DIR)
AC_SUBST(DOC_DIR)
AC_SUBST(COMPRESS_SPEC)


echo "============= CFLAGS"
echo "$CFLAGS"
#CFLAGS="-Wall -g"
#echo "$CFLAGS"
echo "============= CXXFLAGS"
echo "$CXXFLAGS"
echo "============= LDFLAGS"
echo "$LDFLAGS"
echo "============= LIBS"
echo "$LIBS"
echo "============= NH_TTY_LIBS"
echo "$NH_TTY_LIBS"
echo "============= NH_X11_LIBS"
echo "$NH_X11_LIBS"
echo "============= NH_GNOME_LIBS"
echo "$NH_GNOME_LIBS"
echo "============="

AC_OUTPUT(gnomehack.spec Makefile src/Makefile util/Makefile dat/Makefile \
	doc/Makefile sys/Makefile sys/share/Makefile \
	sys/unix/Makefile include/Makefile lib/Makefile \
	win/Makefile win/X11/Makefile win/gnome/Makefile \
	win/gnome/gnomehack.desktop win/tty/Makefile libnhobj/Makefile)