File: configure.in

package info (click to toggle)
vice 1.19-1etch1
  • links: PTS
  • area: contrib
  • in suites: etch
  • size: 27,132 kB
  • ctags: 33,406
  • sloc: ansic: 257,145; cpp: 13,395; sh: 3,674; makefile: 3,380; perl: 1,801; yacc: 622; lex: 258; asm: 4
file content (1636 lines) | stat: -rw-r--r-- 55,502 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
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
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
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
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
dnl
dnl This file is part of VICE, the Versatile Commodore Emulator.
dnl See README for copyright notice.
dnl
dnl Process this file with GNU autoconf to produce a configure script.
dnl

AC_INIT(src/maincpu.c)

VICE_VERSION_MAJOR=1
VICE_VERSION_MINOR=19
VICE_VERSION_BUILD=0

AC_SUBST(VICE_VERSION_MAJOR)
AC_SUBST(VICE_VERSION_MINOR)
AC_SUBST(VICE_VERSION_BUILD)

dnl AC_DEFINE(UNSTABLE,,[Define if this version is unstable.])

if test x"$VICE_VERSION_BUILD" == "x" -o x"$VICE_VERSION_BUILD" == "x0" ; then
  VICE_VERSION=$VICE_VERSION_MAJOR"."$VICE_VERSION_MINOR
else
  VICE_VERSION=$VICE_VERSION_MAJOR"."$VICE_VERSION_MINOR"."$VICE_VERSION_BUILD
fi
AC_SUBST(VICE_VERSION)

AM_INIT_AUTOMAKE(vice, $VICE_VERSION)
AM_CONFIG_HEADER(src/config.h)

if test x"$VICE_VERSION_BUILD" == "x" -o x"$VICE_VERSION_BUILD" == "x0" ; then
  VERSION_RC=$VICE_VERSION_MAJOR","$VICE_VERSION_MINOR",0,0"
else
  VERSION_RC=$VICE_VERSION_MAJOR","$VICE_VERSION_MINOR","$VICE_VERSION_BUILD",0"
fi
AC_SUBST(VERSION_RC)

AC_DEFINE(VERSION_RC,"$VERSION_RC",[Win32 Version string.])

is_dos=no
is_win32=no
is_riscos=no
is_os2=no
is_beos=no

dnl Try to find out which system we are on...
AC_CANONICAL_HOST

dnl Command-line options

AC_ARG_ENABLE(textfield,[  --disable-textfield     disable enhanced text field widget])
AC_ARG_ENABLE(zlibtest,[  --disable-zlibtest      disable zlib test])
AC_ARG_WITH(xaw3d, [  --with-xaw3d            use Xaw3d library instead of plain Xaw])
AC_ARG_WITH(readline, [  --without-readline      do not try to use the system's readline library])
AC_ARG_WITH(midas, [  --with-midas            use MIDAS sound system instead of Allegro for audio])
AC_ARG_WITH(arts, [  --with-arts             use aRts sound system])
AC_ARG_WITH(esd, [  --without-esd           do not use the Enlightened Sound Daemon system])
AC_ARG_WITH(alsa, [  --without-alsa          do not use the ALSA sound system])
AC_ARG_WITH(oss, [  --without-oss           do not use the OSS sound system])
AC_ARG_ENABLE(sdl, [  --with-sdl              use sdl sound system])
AC_ARG_WITH(resid, [  --without-resid         do not use the reSID engine])
AC_ARG_ENABLE(fullscreen, [  --enable-fullscreen     enable XFree86 fullscreen detection], [ echo checking for XFree86 fullscreen requested...], [enable_fullscreen="no"; echo no explicit checking for XFree86 fullscreen requested, disabling fullscreen...])
AC_ARG_ENABLE(gnomeui,[  --enable-gnomeui        enables gnome ui support])
AC_ARG_ENABLE(nls,[  --disable-nls           disables national language support])
AC_ARG_ENABLE(realdevice,[  --disable-realdevice    disables access to real peripheral devices (CBM4Linux/OpenCBM)])
AC_ARG_ENABLE(ffmpeg,[  --enable-ffmpeg         enables ffmpeg library support])
AC_ARG_ENABLE(ethernet,[  --enable-ethernet       enables Tfe Final Ethernet emulation])
AC_ARG_ENABLE(ipv6,[  --disable-ipv6          disables the checking for ipv6 compatibility])

if test x"$enable_gnomeui" = "xyes" ; then
  AC_DEFINE(USE_GNOMEUI,,[Use GNOME UI.])
fi

AM_CONDITIONAL(GNOMEUI, test x"$enable_gnomeui" = "xyes")

if test x"$enable_textfield" != "xno"; then
  AC_DEFINE(ENABLE_TEXTFIELD,,[Enable support for the TextField widget.])
  echo "using TextField widget."
else
  echo "using ugly Athena text widget."
fi

user_cflags=$CFLAGS
AC_PROG_CC

if test x"$host_os" = "xminixvmd"; then
  AR="\$(top_srcdir)/src/arch/unix/minix/minix-ar.sh"
  AC_DEFINE(MINIXVMD,,[are we compiling under Minix-Vmd])
  CFLAGS="$CFLAGS -I/usr/include/bsdcompat"
fi

dnl Setup DJGPP crosscompiling.

if test x"$host_vendor" = "xgo32" -o x"$host_vendor" = "xmsdos" -o x"$host_os" = "xmsdosdjgpp"; then

  dnl Some GCC cross-compilers are installed with a different name
  dnl instead of using the GCC architecture targeting features.
  dnl Check for the most common ones.

  if test "x$CC" = "xgcc" -a "x$host_vendor" != "xmsdos" -a "x`uname -s`" != "xMS-DOS"; then
    CFLAGS="$CFLAGS -b i386-go32"
    LDFLAGS="$CFLAGS -b i386-go32"
  fi

  dnl This is used by subsequent tests.
  ac_cv_prog_gcc=yes
  GCC=yes

  is_dos=yes

  if test x"$with_midas" = "xyes" ; then
      AC_DEFINE(USE_MIDAS_SOUND,,
                [Use MIDAS Sound System instead of the Allegro library.])
      LIBMIDAS="-lmidas"
      echo "configuring support for MIDAS Sound System"
  else
      LIBMIDAS=""
      echo "using Allegro sound driver"
  fi

  AM_CONDITIONAL(HAVE_RS232, false)
  AM_CONDITIONAL(HAVE_RAWDRIVE, false)

  dnl We always have a joystick and mouse on MSDOS.
  AC_DEFINE(HAS_JOYSTICK,,[Enable joystick emulation.])
  AC_DEFINE(HAVE_MOUSE,,[Enable 1351 mouse support])
  AC_DEFINE(HAS_SINGLE_CANVAS,,[Is only one canvas supported?])

elif test x"$host_os" = "xcygwin32" -o x"$host_os" = "xcygwin" -o x"$host_os" = "xmingw32"; then

  dnl This is used by subsequent tests.
  ac_cv_prog_gcc=yes
  GCC=yes

  is_win32=yes

  dnl AC_CHECK_HEADERS(commctrl.h shlobj.h winioctl.h)

  AC_DEFINE(HAS_JOYSTICK,,[Enable joystick emulation.])
  AC_DEFINE(HAVE_MOUSE,,[Enable 1351 mouse support])
  AC_DEFINE(HAVE_RS232,,[Enable RS232 emulation.])
  AM_CONDITIONAL(HAVE_RS232, true)
  AM_CONDITIONAL(HAVE_RAWDRIVE, false)
  AC_DEFINE(HAVE_CATWEASELMKIII,,[Support for Catweasel MKIII.])
  AC_DEFINE(HAVE_HARDSID,,[Support for HardSID.])
  AC_DEFINE(HAVE_TFE,,[Support for The final Ethernet.])
  AC_DEFINE(HAVE_NETWORK,,[Enable netplay support])

  AC_TRY_LINK([#include <windows.h>],
              [LARGE_INTEGER li; return (int) li.QuadPart],
              AC_DEFINE(HAS_LONGLONG_INTEGER,,
                [Support 64bit integer for Win32 performance counter]),)
  AC_TRY_LINK([#include <windows.h>],
              [HGLOBAL hGlobal; UnlockResource(hGlobal); return 0],
              AC_DEFINE(HAS_UNLOCKRESOURCE,,[Do we have UnlockResource()?]),)

elif test x"$host_os" = "xbeos"; then

  dnl This is used by subsequent tests.
  ac_cv_prog_gcc=yes
  GCC=yes

  is_beos=yes

  AC_DEFINE(HAS_JOYSTICK,,[Enable joystick emulation.])
  AC_DEFINE(HAVE_MOUSE,,[Enable 1351 mouse support])
  AM_CONDITIONAL(HAVE_RS232, false)
  AM_CONDITIONAL(HAVE_RAWDRIVE, false)

elif test x"$host_os" = "xriscos"; then

  dnl This is used by subsequent tests.
  ac_cv_prog_gcc=yes
  GCC=yes
  READLINE=""
    
  is_riscos=yes

  AC_DEFINE(HAS_JOYSTICK,,[Enable joystick emulation.])
  AM_CONDITIONAL(HAVE_RS232, false)
  AM_CONDITIONAL(HAVE_RAWDRIVE, false)

else

  if test -z "$user_cflags" ; then

    dnl Check for the type of compiler first.
    if test x"$GCC" = "xyes" ; then

      if test x"$enable_gnomeui" != "xyes" ; then
          warnings="-Wall -Wstrict-prototypes -Winline"
      else
	  dnl "-Wstrict-prototypes" gives zillions of warnings in gtk headers
	  warnings="-Wall -Winline"
      fi

      dnl Set appropriate optimization options (better than the default -g -O)
      dnl if using GCC.
      dnl `-pipe' is broken on some Alpha systems, and also `-funroll-loops'
      dnl gives troubles on both Alpha and SPARC.  That's why we use the fancy
      dnl options on x86 only.
      dnl If the user has specified her own `CFLAGS', we do not override them.

      if test "x$host_cpu" = "xi586" -o x"$host_cpu" = "xi486" -o x"$host_cpu" = "xi686" -o x"$host_cpu" = "xi386"; then

        echo using x86-specific optimizing options

        dnl `-DNO_REGPARM' should theoretically make it slower, but
        dnl regparms are so broken on the current GCC/EGCS that it's
        dnl better not to rely on them by default.
        CFLAGS="-g -O2 -DNO_REGPARM $warnings"

      else

        dnl Use -g if available.
        if test x"$ac_cv_prog_cc_g" = "xyes" ; then
           CFLAGS="-g -O2 -finline-functions $warnings"
        else
           CFLAGS="-O2 -finline-functions $warnings"
        fi

      fi

      dnl Check whether the options are OK.
      AC_PROG_CC

    fi

    dnl (If not on GCC, just keep the defaults, which are very conservative).

  fi

  is_dos=no
  is_win32=no
  is_riscos=no
  is_os2=no
  is_beos=no

  dnl This is only possible on Unix (for now).
  AC_DEFINE(HAVE_RS232,,[Enable RS232 emulation.])
  AM_CONDITIONAL(HAVE_RS232, true)
  AC_DEFINE(HAVE_RAWDRIVE,,[Support for block device disk image access.])
  AM_CONDITIONAL(HAVE_RAWDRIVE, true)

  AC_CHECK_HEADER(linux/hardsid.h,
      [ AC_DEFINE(HAVE_HARDSID,,[Support for HardSID.]) ],)

  AC_DEFINE(USE_COLOR_MANAGEMENT,,[Enable new color management code.])
fi

AM_CONDITIONAL(USE_MIDAS_SOUND, test x"$with_midas" = "xyes")
AM_CONDITIONAL(DOS_OR_WIN, test x"$is_dos" = "xyes" -o x"$is_win32" = "xyes")

dnl Check for needed external programs.

AC_PROG_CPP
AC_CHECK_PROG(AR, ar, ar, ar)
AC_PROG_RANLIB
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_YACC
AM_PROG_LEX

dnl Extension for executable files in this system
AC_EXEEXT

dnl NLS stuff
dnl Its has been rejected to use the full GNU gettext package 
dnl delivered within the source. This is a minimum replacement implementing
dnl a simple check to find `libintl.h' and `gettext'.
dnl

dnl Add new languages here
ALL_LINGUAS="de fr it sv pl nl"

dnl These rules are solely for the distribution goal.  While doing this
dnl we only have to keep exactly one list of the available catalogs
dnl in configure.in.
for lang in $ALL_LINGUAS; do
  GMOFILES="$GMOFILES $lang.gmo"
  POFILES="$POFILES $lang.po"
done
AC_SUBST(GMOFILES)
AC_SUBST(POFILES)

if test x"$enable_nls" != x"no" ; then
  AC_CHECK_HEADER(libintl.h,
    [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
      [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
  	 gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])

     AC_CACHE_CHECK([for gettext in libintl], gt_cv_func_gettext_libintl,
      [save_libs="$LIBS"
       LIBS="-lintl $LIBS"
       AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
  	 INTLLIBS=-lintl gt_cv_func_gettext_libintl=yes, gt_cv_func_gettext_libintl=no)
       LIBS="$save_libs"])

     if test "$gt_cv_func_gettext_libc" = "yes" \
  	|| test "$gt_cv_func_gettext_libintl" = "yes"; then
  	AC_DEFINE(HAVE_GETTEXT,,[Define if gettext if available.])
  	AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
  	  [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
  	if test "$MSGFMT" != "no"; then
  	  AC_CHECK_FUNCS(dcgettext)
  	  AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
  	  AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
  	    [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
  	  AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
  			 return _nl_msg_cat_cntr],
  	    [CATOBJEXT=.gmo
  	     DATADIRNAME=share],
  	    [CATOBJEXT=.mo
  	     DATADIRNAME=lib])
  	  INSTOBJEXT=.mo
  	fi
        USE_NLS=yes
	AC_DEFINE(ENABLE_NLS,,[Define if NLS support is enabled.])
	AC_DEFINE(HAVE_LIBINTL_H,,[use libintl for NLS.])
	AC_DEFINE_UNQUOTED(DATADIRNAME, "$DATADIRNAME",[NLS datadirname.])
	dnl this is prefixed with PREFIX
	AC_DEFINE(NLS_LOCALEDIR, PREFIX"/"DATADIRNAME"/locale",[NLS local directory.])
      else
        AC_MSG_WARN([libintl.h not found, disabling NLS])
        USE_NLS=no
      fi
  ])
  dnl Test whether we really found GNU xgettext.
  if test "$XGETTEXT" != ":"; then
    dnl If it is no GNU xgettext we define it as : so that the
    dnl Makefiles still can work.
    if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
      : ;
    else
      AC_MSG_RESULT(
    	[found xgettext program is not GNU xgettext; ignore it])
      XGETTEXT=":"
    fi
  fi

  dnl Test wether GMSGFMT is there. Should fix `make dist'.
  if test "$GMSGFMT" = "" ; then
    GMSGFMT=":"
  fi

  # We need to process the po/ directory.
  POSUB=po
  
  AC_OUTPUT_COMMANDS(
    [case "$CONFIG_FILES" in *po/Makefile.in*)
      sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
    esac])
  
  dnl Make all variables we use known to autoconf.
  AC_SUBST(USE_INCLUDED_LIBINTL)
  AC_SUBST(CATALOGS)
  AC_SUBST(DATADIRNAME)
  AC_SUBST(INSTOBJEXT)
  AC_SUBST(INTLDEPS)
  AC_SUBST(INTLLIBS)
  AC_SUBST(INTLOBJS)
  AC_SUBST(POSUB)
  AC_SUBST(GENCAT)

  dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
  dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
  dnl Try to locate is.
  MKINSTALLDIRS=
  if test -n "$ac_aux_dir"; then
    MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
  fi
  if test -z "$MKINSTALLDIRS"; then
    MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
  fi
  AC_SUBST(MKINSTALLDIRS)

  dnl currently no catgets support, can't check it.
  GENCAT=
  AC_SUBST(GENCAT)
else
  AC_MSG_WARN([disabling NLS on user request])
  USE_NLS=no
fi

if test x"$USE_NLS" = x"" ; then
  USE_NLS=no
fi
if test "$MSGFMT" = "no" ; then
  dnl Fallback to shipped .gmo 
  dnl Those should work on x86 linux systems.
  AC_MSG_WARN([msgfmt not found, falling back to default catalogs (x86/Linux)])
  CATOBJEXT=".gmo"
fi
AC_SUBST(CATOBJEXT)
AC_SUBST(USE_NLS)
AC_SUBST(NLS_LOCALEDIR)

dnl Check for a perl interpreter.
AC_PATH_PROG(PERL, perl)
AC_SUBST(PERL)
 
dnl Check and setup aRts compilation.
if test x"$with_arts" = "xyes"; then
	AC_CHECK_PROGS(artsc_config, artsc-config, no)
	if test x"$artsc_config" = "xno"; then
		AC_MSG_WARN([artsc-config not found. aRts will not be configured])
                with_arts=no
        fi
else
	with_arts=no
fi

dnl Check and setup SDL compilation.
if test x"$with_sdl" = "xyes"; then
	AC_CHECK_PROGS(sdl_config, sdl-config, no)
	if test x"$sdl_config" = "xno"; then
		AC_MSG_WARN([sdl-config not found. SDL will not be configured])
                with_sdl=no
        fi
else
	with_sdl=no
fi

dnl Setup reSID compilation.  We need a C++ compiler for this.

if test x"$with_resid" != "xno" -a -z "$CXX"; then
  AC_CHECK_PROGS(cxx, $CCC c++ g++ gcc CC cxx cc++, no)
  if test x"$cxx" = "xno"; then
    AC_MSG_WARN([C++ compiler missing, reSID will not be configured])
    with_resid=no
  fi
fi

RESID_DIR=
RESID_LIBS=
RESID_INCLUDES=
RESID_DEP=


LINKCC='$(CC)'

if test x"$with_resid" = "xno"; then
  dnl Do not attempt to configure reSID.
  dnl NOTE: no_recursion is set because directories specified with
  dnl AC_CONFIG_SUBDIRS are always recursed into regardless of where the
  dnl macro is used.
  dnl Another workaround must be found if other self-contained packages go
  dnl into VICE.
  no_recursion=yes
  dnl A workaround for an autoconf bug when not using/checking the C++
  dnl compiler, we'll define am__fastdepCXX_TRUE as #
  am__fastdepCXX_TRUE=#
  am__fastdepCXX_FALSE=
else
  AC_LANG_SAVE
  AC_LANG_CPLUSPLUS
  AC_PROG_CXX

  dnl Set CXXFLAGS. Use -fno-exceptions for G++ if supported.
  if test "$ac_test_CXXFLAGS" != set; then
    if test "$GXX" = yes; then
      CXXFLAGS="$CFLAGS -fno-exceptions"
      AC_MSG_CHECKING([whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works])
      AC_TRY_COMPILE([],
                     [ int test; ],
                     [ AC_MSG_RESULT(yes) ],
                     [ AC_MSG_RESULT(no)
                       CXXFLAGS="$CFLAGS"
                       ])
    else
      CXXFLAGS="$CFLAGS"
    fi
  fi

  AC_PROG_CXXCPP
  if test x"$CXX" != "x" ; then
    LINKCC='$(CXX)'
  fi
  if test x"$with_resid" = "xyes" -o x"$with_resid" = "x"; then
    AC_DEFINE(HAVE_RESID,,[This version provides ReSID support.])
    AC_CONFIG_SUBDIRS(src/resid)
    RESID_DIR=resid
    RESID_LIBS="\$(top_builddir)/src/resid/libresid.a"
    RESID_INCLUDES="-I\$(top_builddir)/src/resid"
    RESID_DEP=libresid
  else
    dnl reSID is installed elsewhere, no need to configure.
    no_recursion=yes

    LDFLAGS="$LDFLAGS -L$with_resid/lib"
    CPPFLAGS="$CPPFLAGS -I$with_resid/include"

    dnl Test for libresid.a and resid/sid.h
    AC_CHECK_LIB(resid, resid_version_string,
                 [],
                 AC_MSG_ERROR([reSID library not found]))
    AC_CHECK_HEADER(resid/sid.h,
                    [],
                    AC_MSG_ERROR([reSID header file not found]))

    AC_DEFINE(HAVE_RESID,,[This version provides ReSID support.])
    RESID_DIR=
    RESID_LIBS="$with_resid/lib/libresid.a"
    RESID_INCLUDES="-I$with_resid/include"
  fi

  AC_LANG_RESTORE
fi

AC_SUBST(LINKCC)

AM_CONDITIONAL(HAVE_RESID, test x"$with_resid" != "xno")

AC_SUBST(RESID_DIR)
AC_SUBST(RESID_LIBS)
AC_SUBST(RESID_INCLUDES)
AC_SUBST(RESID_DEP)


dnl Check for typedefs, structures, and compiler characteristics.

AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T

dnl Check whether inline functions are available.

AC_C_INLINE
if test x"$ac_cv_c_inline" = "xno" ; then
  CFLAGS="$CFLAGS -DNO_INLINE"
fi

dnl Define the type sizes.

if [[ x"$ac_cv_prog_cc_cross" != "xyes" ]]; then
  AC_C_BIGENDIAN
else
  dnl if cross-compiling, we have to do this by hand
  echo "warning: assuming sizeof(unsigned short) == 2,"
  echo "                  sizeof(unsigned int) == 4,"
  echo "                  sizeof(unsigned long) == 4"
fi

AM_CONDITIONAL(CROSS, test x"$cross_compiling" = "xyes")
AC_SUBST(CROSS)

AC_CHECK_SIZEOF(unsigned short, 2)
AC_CHECK_SIZEOF(unsigned int, 4)
AC_CHECK_SIZEOF(unsigned long, 4)

dnl Check whether gcc needs -traditional.

AC_PROG_GCC_TRADITIONAL

dnl Check for header files.

AC_HEADER_DIRENT
AC_CHECK_HEADERS(direct.h errno.h fcntl.h limits.h regex.h unistd.h \
sys/dirent.h sys/ioctl.h sys/stat.h sys/types.h \
dir.h io.h process.h signal.h ffmpeg/avformat.h commctrl.h shlobj.h winioctl.h)

AC_CHECK_HEADER(regexp.h,,,[#define	INIT		register char *sp = instring;
#define	GETC()		(*sp++)
#define	PEEKC()		(*sp)
#define	UNGETC(c)	-- sp
#define	RETURN(ptr)	return NULL;
#define	ERROR(val)	_RegExpError(val)
])
AC_DECL_SYS_SIGLIST

dnl Check for system-specific header files.

if test x"$host_vendor" != "xgo32" -a x"$host_vendor" != "xmsdos" -a x"$host_os" != "xcygwin32" -a x"$host_vendor" != "xmingw32"; then
  AC_CHECK_HEADER(linux/joystick.h,
                  [ AC_DEFINE(HAS_JOYSTICK,,[Enable joystick emulation.])
                    AC_DEFINE(LINUX_JOYSTICK,,
                              [Enable support for Linux style joysticks.])
                    JOY_OBJS='$(ARCHDIR)/joystick.o' ], )
  if test x"$ac_cv_header_linux_joystick_h" = "xyes" ; then
    AC_MSG_CHECKING(whether linux/joystick.h supports digital joysticks)
    AC_TRY_COMPILE([ #include <linux/joystick.h> ],
                   [ struct DJS_DATA_TYPE djs; ],
                   [ AC_DEFINE(HAS_DIGITAL_JOYSTICK,,
                               [Enable emulation for digital joysticks.])
                     AC_MSG_RESULT(yes) ], AC_MSG_RESULT(no))
  fi
  AC_CHECK_HEADER(machine/joystick.h,
                  [ AC_DEFINE(HAS_JOYSTICK,,[Enable joystick emulation.])
                    AC_DEFINE(BSD_JOYSTICK,,
                              [Enable support for BSD style joysticks.])
                    JOY_OBJS='$(ARCHDIR)/joystick.o' ], )

  dnl NetBSD/FreeBSD USB joystick support
  usbhid_header=no
  AC_CHECK_LIB(usbhid, hid_get_report_desc,
  	[AC_CHECK_HEADER(usbhid.h,
	    [AC_DEFINE(HAVE_USBHID_H,1,
		[Define to 1 if you have the <usbhid.h> header file.])
	     usb_header=yes],
 	     [AC_CHECK_HEADER(libusbhid.h,
	    	[AC_DEFINE(HAVE_LIBUSBHID_H,1,
		 [Define to 1 if you have the <libusbhid.h> header file.])],
	        usbhid_header=no)])
	if test x"$usb_header" = "xyes" ; then
	    AC_DEFINE(HAS_USB_JOYSTICK,,[Enable emulation for USB joysticks.])
	    LIBS="$LIBS -lusbhid"
	fi])

  AC_SUBST(JOY_OBJS)
fi

dnl Check for math library

AC_CHECK_LIB(m, sinf,,,$LIBS)

dnl Check for zlib


VICE_ZLIB=
VICE_ZLIB_DIR=
VICE_ZLIB_DEP=
VICE_ZLIB_INCLUDES=

if test x"$with_zlib" != "xno" ; then
  AC_CHECK_HEADER(zlib.h,,)
  if test x"$ac_cv_header_zlib_h" = "xyes" ; then
    ac_cv_lib_z_zlibVersion=yes
    if test x"$enable_zlibtest" != "xno" ; then
      AC_CHECK_LIB(z, zlibVersion,
                 [ LIBS="-lz $LIBS";
                   AC_DEFINE(HAVE_ZLIB,,
                             [Can we use the ZLIB compression library?]) ],,)
    fi
  fi
  if test x"$ac_cv_lib_z_zlibVersion" != "xyes"; then
    AC_DEFINE(HAVE_ZLIB,, [Can we use the ZLIB compression library?])
    VICE_ZLIB="\$(top_builddir)/src/lib/zlib/libz.a"
    VICE_ZLIB_DEP=libz
    VICE_ZLIB_INCLUDES="-I\$(top_srcdir)/src/lib/zlib"
    VICE_ZLIB_DIR=lib/zlib
  fi
fi

AC_SUBST(VICE_ZLIB)
AC_SUBST(VICE_ZLIB_DIR)
AC_SUBST(VICE_ZLIB_DEP)
AC_SUBST(VICE_ZLIB_INCLUDES)


dnl Configure unix and msdos netplay support

if test x"$is_win32" != "xyes" -a x"$is_beos" != "xyes" -a x"$is_riscos" != "xyes"; then

  dnl Check for needed network headers

  UNIX_NETWORK_HEADERS_PRESENT=yes
  AC_CHECK_HEADERS(sys/types.h unistd.h sys/socket.h sys/time.h sys/select.h netinet/in.h arpa/inet.h netdb.h,,
                   [UNIX_NETWORK_HEADERS_PRESENT=no],)

  if test x"$UNIX_NETWORK_HEADERS_PRESENT" = "xyes"; then

    dnl Check for possible extra needed network libraries

    AC_CHECK_LIB(nsl, gethostbyname,[ LIBS="-lnsl $LIBS"],,)
    AC_CHECK_LIB(socket, gethostbyname,[ LIBS="-lsocket $LIBS"],,)
    AC_CHECK_LIB(bsd, gethostbyname,[ LIBS="-lbsd $LIBS"],,)
    AC_CHECK_LIB(inet, gethostbyname,[ LIBS="-linet $LIBS"],,)
    AC_CHECK_LIB(watt, gethostbyname,[ LIBS="-lwatt $LIBS"],,)

    dnl Check for needed functions

    UNIX_NETWORK_FUNCS_PRESENT=yes

    AC_CHECK_FUNCS(socket send htons htonl bind listen gethostbyname connect recv accept,,
                   [UNIX_NETWORK_FUNCS_PRESENT=no],)

    if test x"$UNIX_NETWORK_FUNCS_PRESENT" = "xyes"; then
      AC_DEFINE(HAVE_NETWORK,,[Enable netplay support])
      AC_CHECK_FUNCS(getdtablesize getrlimit)
    fi
  fi
fi

if test x"$is_beos" == "xyes"; then

  dnl Check for needed network headers

  BEOS_NETWORK_HEADERS_PRESENT=yes
  AC_CHECK_HEADERS(socket.h netdb.h byteorder.h,,
                   [BEOS_NETWORK_HEADERS_PRESENT=no],)

  if test x"$BEOS_NETWORK_HEADERS_PRESENT" = "xyes"; then

    dnl Check for possible extra needed network libraries

    AC_CHECK_LIB(net, gethostbyname,[ LIBS="-lnet -lnetapi $LIBS"],,)

    dnl Check for needed functions

    BEOS_NETWORK_FUNCS_PRESENT=yes

    AC_CHECK_FUNCS(socket send bind listen gethostbyname connect recv accept,,
                   [BEOS_NETWORK_FUNCS_PRESENT=no],)

    if test x"$BEOS_NETWORK_FUNCS_PRESENT" = "xyes"; then
      AC_DEFINE(HAVE_NETWORK,,[Enable netplay support])
      AC_CHECK_FUNCS(getdtablesize getrlimit)
    fi
  fi
fi


dnl Check for availability of IPV6
if test x"$is_win32" != "xyes" -a x"$is_beos" != "xyes" -a x"$is_riscos" != "xyes"; then
  if test x"$UNIX_NETWORK_FUNCS_PRESENT" = "xyes"; then
    AC_MSG_CHECKING([if IPV6 should be enabled])
    if test x"$enable_ipv6" != "xno"; then
      have_ipv6=no
      AC_TRY_COMPILE([
        #include <sys/socket.h>
        #include <sys/types.h>], [
        struct sockaddr_storage ss;
        socket(AF_INET6, SOCK_STREAM, 0)
        ],
        have_ipv6=yes,
        have_ipv6=no
      )
      AC_MSG_RESULT($have_ipv6)

      if test $have_ipv6 = yes; then
        have_broken_ss_family=no

        dnl on some platforms, the structure sockaddr doesn't have a
        dnl ss_family, but __ss_family. If we find no ss_family then we
        dnl check for __ss_family, and if found define NEED_PREFIXED_SS_FAMILY.
        AC_MSG_CHECKING([struct sockaddr::ss_family])
        AC_TRY_COMPILE([
          #include <sys/socket.h>
          #include <sys/types.h>], [
          struct sockaddr_storage ss ;
          ss.ss_family = 0 ;
          ],
          have_ss_family=yes,
          have_ss_family=no
        )
        AC_MSG_RESULT($have_ss_family)
        if test x$have_ss_family = xno ; then
          AC_MSG_CHECKING([broken struct sockaddr::ss_family])
          AC_TRY_COMPILE([
            #include <sys/socket.h>
            #include <sys/types.h>], [
            struct sockaddr_storage ss ;
            ss.__ss_family = 0 ;
            ],
            have_broken_ss_family=yes,
            have_broken_ss_family=no
          )
          AC_MSG_RESULT($have_broken_ss_family)
          if test x$have_broken_ss_family = xyes ; then
            AC_DEFINE(NEED_PREFIXED_SS_FAMILY, [],
            [Whether struct sockaddr::__ss_family exists]) 
            AC_DEFINE(ss_family, __ss_family,
            [ss_family is not defined here, use __ss_family instead])
          else
            AC_MSG_WARN(ss_family and __ss_family not found)
          fi
        fi

        have_gethostbyname2=no
        AC_CHECK_FUNC(gethostbyname2, have_gethostbyname2=yes)
        if test $have_gethostbyname2 = yes; then
          AC_DEFINE([HAVE_GETHOSTBYNAME2], [], [Define if gethostbyname2 can be used])
          AC_DEFINE([HAVE_IPV6], [], [Define if ipv6 can be used])
        else
          have_getipnodebyname=no
          AC_CHECK_FUNC(getipnodebyname, have_getipnodebyname=yes)
          if test $have_getipnodebyname = yes; then
            AC_DEFINE([HAVE_GETIPNODEBYNAME], [], [Define if getipnodebyname can be used])
            AC_DEFINE([HAVE_IPV6], [], [Define if ipv6 can be used])
          fi
        fi
      fi
    else
      AC_MSG_RESULT("no")
    fi
  fi
fi

dnl Configure sound drivers

SOUND_DRIVERS=""
GFXOUTPUT_DRIVERS=""

if test x"$enable_ffmpeg" = "xyes" -o x"$is_win32" = "xyes"; then
  AC_DEFINE(HAVE_FFMPEG,,[Enable FFMPEG library support])
  SOUND_DRIVERS="$SOUND_DRIVERS soundffmpegaudio.o"
  GFXOUTPUT_DRIVERS="$GFXOUTPUT_DRIVERS ffmpegdrv.o"
fi

if test x"$is_dos" = "xyes" ; then
  if test x"$enable_ethernet" = "xyes"; then
    AC_CHECK_LIB(watt, gethostbyname,
                 [ AC_DEFINE(DOS_TCP,,
                             [Can we use the dos WATTCP library?]) ],,)
    AC_CHECK_LIB(pcap, pcap_open_live,
                 [ AC_DEFINE(DOS_TFE,,
                             [Can we use the dos PCAP library?])
                   AC_DEFINE(HAVE_TFE,,
                             [Support for The Final Ethernet]) ],,)
    AC_CHECK_LIB(net, libnet_write_link_layer,
                 [ LIBS="-lnet $LIBS";
                   AC_DEFINE(HAVE_DOS_LIBNET,,
                             [Can we use the dos NET library?]) ],,)
    DOS_TFE_PCAP_LIB="libpcap_nodma.a"
  fi
else
  if test x"$enable_ethernet" = "xyes"; then
  dnl /usr/lib/libpcap.a
  dnl /usr/lib/libnet.a
    AC_CHECK_LIB(pcap, pcap_open_live,[AC_CHECK_LIB(net, libnet_write_link_layer,[
      AC_DEFINE(HAVE_TFE,,[Support for The Final Ethernet])
      LIBS="$LIBS -lpcap `libnet-config --libs`"
      CFLAGS="$CFLAGS `libnet-config --defines`"
    ],,$LIBS)],,$LIBS)
  fi
fi

AC_SUBST(DOS_TFE_PCAP_LIB)

if test x"$is_dos" != "xyes" -a x"$is_win32" != "xyes" -a x"$is_beos" != "xyes" -a x"$is_riscos" != "xyes"; then

  if test x"$enable_ffmpeg" = "xyes" ; then
    AC_CHECK_LIB(avcodec, avcodec_init,,,$LIBS)
    AC_CHECK_LIB(mp3lame, MP3lame_encode_frame,,,$LIBS)
    AC_CHECK_LIB(avformat, av_register_all,,,$LIBS)
  fi

  AC_CHECK_HEADERS(cwsid.h, AC_DEFINE(HAVE_CATWEASELMKIII,,
                   [Support for Catweasel MKIII.]), )

  if test x"$with_arts" = "xyes"; then
    old_cflags=$CFLAGS
    old_libs=$LIBS
    CFLAGS="$CFLAGS `artsc-config --cflags`"
    LIBS="$LIBS `artsc-config --libs`"
    AC_CHECK_HEADERS(artsc.h,[AC_CHECK_LIB(artsc, arts_init,
                     [SOUND_DRIVERS="$SOUND_DRIVERS soundarts.o"; break],
                     [CFLAGS=$old_cflags; LIBS=$old_libs; with_arts=no; break],$SOUND_LIBS)],
                     [CFLAGS=$old_cflags; LIBS=$old_libs; with_arts=no; break])
  fi

  if test x"$with_arts" = "xyes"; then
    AC_DEFINE(USE_ARTS,,[Enable aRts support.])
  fi

  if test x"$with_alsa" != "xno"; then
    AC_CHECK_HEADERS(alsa/asoundlib.h,[AC_CHECK_LIB(asound, snd_pcm_open,
                     [SOUND_DRIVERS="$SOUND_DRIVERS soundalsa.o";
                      SOUND_LIBS="$SOUND_LIBS -lasound"; break],,$SOUND_LIBS)])
  fi

  if test x"$with_oss" != "xno"; then
    AC_CHECK_HEADERS(linux/soundcard.h machine/soundcard.h sys/soundcard.h soundcard.h,
                     [SOUND_DRIVERS="$SOUND_DRIVERS sounduss.o"; break])
    AC_CHECK_LIB(ossaudio, _oss_ioctl,,,$SOUND_LIBS)
  fi

  AC_CHECK_HEADERS(dmedia/audio.h, [AC_CHECK_LIB(audio, ALseterrorhandler,
                   [SOUND_DRIVERS="$SOUND_DRIVERS soundsgi.o";
                    SOUND_LIBS="$SOUND_LIBS -laudio"; break;],,$SOUND_LIBS)])

  AC_CHECK_HEADERS(sys/audioio.h,
                   [SOUND_DRIVERS="$SOUND_DRIVERS soundsun.o"; break])

  if test x"$with_esd" != "xno"; then
    AC_CHECK_HEADERS(esd.h,[AC_CHECK_LIB(esd, esd_open_sound,
                     [SOUND_DRIVERS="$SOUND_DRIVERS soundesd.o";
                      SOUND_LIBS="$SOUND_LIBS -lesd"; break],,$SOUND_LIBS)])
  fi

  if test x"$with_sdl" = "xyes"; then
    old_cflags=$CFLAGS
    old_libs=$LIBS
    CFLAGS="$CFLAGS `sdl-config --cflags`"
    LIBS="$LIBS `sdl-config --libs`"
    AC_CHECK_HEADERS(SDL/SDL_audio.h,[AC_CHECK_LIB(SDL, SDL_OpenAudio,
                     [SOUND_DRIVERS="$SOUND_DRIVERS soundsdl.o"; break],
                     [CFLAGS=$old_cflags; LIBS=$old_libs; break],$SOUND_LIBS)],
                     [CFLAGS=$old_cflags; LIBS=$old_libs; break])
  fi

  if test x"$host_os" = "xhpux"; then
    AC_CHECK_HEADERS(sys/audio.h,
                     [SOUND_DRIVERS="$SOUND_DRIVERS soundhpux.o"; break])
  fi

  AC_CHECK_HEADERS(UMS/UMSAudioDevice.h,[AC_CHECK_HEADERS(UMS/UMSBAUDDevice.h,
                   [AC_CHECK_LIB(UMSobj, UMSAudioDevice_initialize,
                    [SOUND_DRIVERS="$SOUND_DRIVERS soundaix.o";
                     SOUND_LIBS="$SOUND_LIBS -lUMSobj"; break],,$SOUND_LIBS)])])
fi

if [[ x"$is_dos" = "xyes" ]] ; then
    if test x"$with_midas" = "xyes"; then
        AC_CHECK_HEADERS(midasdll.h,
                         [SOUND_DRIVERS="$SOUND_DRIVERS soundmidas.o"; break])
    else
        AC_CHECK_HEADERS(allegro.h,
                         [SOUND_DRIVERS="$SOUND_DRIVERS soundallegro.o"; break])
    fi
fi

if [[ x"$is_win32" = "xyes" ]] ; then
    SOUND_DRIVERS="$SOUND_DRIVERS sounddx.o soundwmm.o"
    AC_PATH_PROGS(WINDRES, windres, windres)
    AC_PATH_PROGS(WRC, wrc , windres)
    if test x"$WRC" = "xwindres"; then
        AC_MSG_WARN([WRC not found, WRC is required for propper internationalization support])
        if test x"$WINDRES" = "xwindres"; then
          WRC="windres"
        else
          WRC="$WINDRES"
        fi
    fi
fi

if [[ x"$is_beos" = "xyes" ]] ; then
    SOUND_DRIVERS="$SOUND_DRIVERS soundbeos.o"
fi

if [[ x"$is_riscos" = "xyes" ]]; then
    SOUND_DRIVERS="$SOUND_DRIVERS soundacorn.o"
fi

AC_CHECK_HEADER(CoreAudio/CoreAudio.h,,)
if test x"$ac_cv_header_CoreAudio_CoreAudio_h" = "xyes" ; then
  AC_CHECK_HEADER(AudioToolbox/AudioToolbox.h,,)
  if test x"$ac_cv_header_AudioToolbox_AudioToolbox_h" = "xyes" ; then
    AC_MSG_CHECKING(whether we can link the CoreAudio framework)
    old_LIBS="${LIBS}"
    LIBS="${LIBS} -framework CoreAudio -framework AudioToolbox"
    AC_TRY_LINK([#include <CoreAudio/CoreAudio.h>],
                [AudioDeviceStart(0,0);],
                [AC_MSG_RESULT(yes);
                 SOUND_DRIVERS="$SOUND_DRIVERS soundcoreaudio.o";
                 AC_DEFINE(USE_COREAUDIO,,[Enable CoreAudio support.])],
                [AC_MSG_RESULT(no);
                 LIBS=${old_LIBS}])
  fi
fi

AC_SUBST(SOUND_DRIVERS)

AC_SUBST(SOUND_LIBS)

dnl Check for library functions

if test x"$is_dos" = "xno" -a x"$is_win32" = "xno" -a -x"$is_riscos" = "xno"; then
  AC_FUNC_MEMCMP
fi
AC_TYPE_SIGNAL
AC_FUNC_VFORK
AC_CHECK_TYPES(u_short)
dnl some platforms have some of the functions in libbsd,
dnl so we check it out first.
AC_CHECK_LIB(bsd,gettimeofday,,,$LIBS)
AC_CHECK_FUNCS(gettimeofday memmove atexit strerror strcasecmp strncasecmp telldir seekdir)

AC_SUBST(LIBS)

dnl if usleep is not defined, compile our own version for it (usleep.o)
if test x"$is_win32" = "xno" -a x"$is_riscos" = "xno"; then
  AC_REPLACE_FUNCS(usleep)
fi

dnl Check time.h.

dnl AC_HEADER_TIME
dnl AC_STRUCT_TM

dnl Check whether we have GNU readline.  If not, use our replacement.
dnl The user can force us to use the replacement with `--without-readline'.

if test x"$is_dos" != "xyes" -a x"$is_win32" != "xyes" -a x"$is_beos" != "xyes" -a x"$is_riscos" != "xyes"; then
  if test x"$with_readline" != "xno" ; then
    READLINE=""
    unset ac_cv_lib_readline_readline
    AC_CHECK_LIB(readline, readline,
               [ READLINE="" LIBS="-lreadline $LIBS"],
               [],,)
    if test "$ac_cv_lib_readline_readline" = "no"; then
      unset ac_cv_lib_readline_readline
      AC_CHECK_LIB(readline, readline,
               [ READLINE="" LIBS="-lreadline -lncurses $LIBS"],
               [], "-lncurses",)
      if test "$ac_cv_lib_readline_readline" = "no"; then
        unset ac_cv_lib_readline_readline
        AC_CHECK_LIB(readline, readline,
               [ READLINE="" LIBS="-lreadline -lcurses $LIBS"],
               [ READLINE="\$(top_builddir)/src/arch/unix/readline/libreadline.a" ],
                "-lcurses",)
      else
        AC_CHECK_LIB(readline, rl_readline_name,
          [ AC_DEFINE(HAVE_RLNAME,,
            [Does the `readline' library support `rl_readline_name'?]) ],,)
      fi
    else
      AC_CHECK_LIB(readline, rl_readline_name,
        [ AC_DEFINE(HAVE_RLNAME,,
          [Does the `readline' library support `rl_readline_name'?]) ],,)
    fi
  else
    READLINE="\$(top_builddir)/src/arch/unix/readline/libreadline.a"
  fi
else
  READLINE=""
fi
AM_CONDITIONAL(NEED_READLINE, test x"$READLINE" != "x")
AC_SUBST(READLINE)


dnl Configure graphics output drivers

VICE_LIBPNG=
VICE_LIBPNG_DIR=
VICE_LIBPNG_DEP=
VICE_LIBPNG_INCLUDES=

if test x"$is_beos" != "xyes"; then
  if test x"$with_png" != "xno" ; then
    dnl Check for the PNG library.
    AC_CHECK_HEADER(png.h,,)
    if test x"$ac_cv_header_png_h" = "xyes" ; then
      unset ac_cv_lib_png_png_check_sig
      AC_CHECK_LIB(png, png_check_sig,
                   [ LIBS="-lpng $LIBS";
                     GFXOUTPUT_DRIVERS="$GFXOUTPUT_DRIVERS pngdrv.o";
                     AC_DEFINE(HAVE_PNG,,[Can we use the PNG library?]) ],,)
      if test "$ac_cv_lib_png_png_check_sig" = "no"; then
        unset ac_cv_lib_png_png_check_sig
        AC_CHECK_LIB(png, png_check_sig,
                     [ LIBS="-lpng -lz $LIBS";
                       GFXOUTPUT_DRIVERS="$GFXOUTPUT_DRIVERS pngdrv.o";
                       AC_DEFINE(HAVE_PNG,,
                                 [Can we use the PNG library?]) ],,"-lz")
      fi
    fi
    if test x"$ac_cv_lib_png_png_check_sig" != "xyes"; then
      if test x"$with_zlib" != "xno" ; then
        AC_DEFINE(HAVE_PNG,,[Can we use the PNG library?])
        VICE_LIBPNG="\$(top_builddir)/src/lib/lpng/libpng.a"
        VICE_LIBPNG_DEP=libpng
        GFXOUTPUT_DRIVERS="$GFXOUTPUT_DRIVERS pngdrv.o"
        VICE_LIBPNG_INCLUDES="-I\$(top_srcdir)/src/lib/lpng"
        VICE_LIBPNG_DIR=lib/lpng
      fi
    fi
  fi
fi

dnl Check for the GIF or UNGIF library.
AC_CHECK_HEADER(gif_lib.h,,)
if test x"$ac_cv_header_gif_lib_h" = "xyes" ; then
  AC_CHECK_LIB(ungif, EGifPutLine, [ LIBS="-lungif $LIBS";
               GFXOUTPUT_DRIVERS="$GFXOUTPUT_DRIVERS gifdrv.o";
               AC_DEFINE(HAVE_GIF,,[Can we use the GIF or UNGIF library?]) ],,)
  if test "$ac_cv_lib_ungif_EGifPutLine" = "no"; then
    AC_CHECK_LIB(gif, EGifPutLine, [ LIBS="-lgif $LIBS";
                 GFXOUTPUT_DRIVERS="$GFXOUTPUT_DRIVERS gifdrv.o";
                 AC_DEFINE(HAVE_GIF,,[Can we use the GIF or UNGIF library?]) ],,)
  fi
fi

dnl Check for the JPEG library.
AC_CHECK_HEADER(jpeglib.h,,)
if test x"$ac_cv_header_jpeglib_h" = "xyes" ; then
  AC_CHECK_LIB(jpeg, jpeg_CreateCompress, [ LIBS="-ljpeg $LIBS";
               GFXOUTPUT_DRIVERS="$GFXOUTPUT_DRIVERS jpegdrv.o";
               AC_DEFINE(HAVE_JPEG,,[Can we use the JPEG library?]) ],,)
fi

AC_SUBST(VICE_LIBPNG)
AC_SUBST(VICE_LIBPNG_DIR)
AC_SUBST(VICE_LIBPNG_DEP)
AC_SUBST(GFXOUTPUT_DRIVERS)
AC_SUBST(VICE_LIBPNG_INCLUDES)

dnl Check for X11 libraries and header files

if test x"$is_dos" != "xyes" -a x"$is_win32" != "xyes" -a x"$is_beos" != "xyes" -a x"$enable_gnomeui" != "xyes" ; then

  X_LIBS=""
  AC_PATH_XTRA

  PATH_X_LIBS=$X_LIBS
  LINK_X_LIBS=""

  dnl instead of assuming that libsocket needs libnsl, we
  dnl will check the existance of libnsl first.

  AC_CHECK_LIB(nsl, gethostbyname,[ X_LIBS="-lnsl $X_LIBS";
                                    LINK_X_LIBS="-lnsl $LINK_X_LIBS"],,$X_LIBS)
  AC_CHECK_LIB(socket, gethostbyname,[ X_LIBS="-lsocket $X_LIBS";
                                    LINK_X_LIBS="-lsocket $LINK_X_LIBS"],,$X_LIBS)
  AC_CHECK_LIB(bsd, gethostbyname,[ X_LIBS="-lbsd $X_LIBS";
                                    LINK_X_LIBS="-lbsd $LINK_X_LIBS"],,$X_LIBS)
  AC_CHECK_LIB(ICE, IceConnectionNumber,[ X_LIBS="-lICE $X_LIBS";
                                    LINK_X_LIBS="-lICE $LINK_X_LIBS"],,$X_LIBS)
  AC_CHECK_LIB(SM, SmFreeProperty,[ X_LIBS="-lSM $X_LIBS";
                                    LINK_X_LIBS="-lSM $LINK_X_LIBS"],,$X_LIBS)

  dnl This is necessary because CPP tests use `CPPFLAGS' instead.
  dnl FIXME: Are we sure `AC_PATH_XTRA' will always put only X11
  dnl include paths in?  Let's hope so.
  CPPFLAGS="$CPPFLAGS $X_CFLAGS"

  MISSING_X_LIBS=""

  AC_CHECK_LIB(X11, XCreateWindow,
               [ X_LIBS="-lX11 $X_LIBS";
                 LINK_X_LIBS="-lX11 $LINK_X_LIBS"],
               [ MISSING_X_LIBS="$MISSING_X_LIBS X11" ],$X_LIBS)

  AC_CHECK_LIB(Xext, XQueryExtension,
               [ X_LIBS="-lXext $X_LIBS";
                 LINK_X_LIBS="-lXext $LINK_X_LIBS"],,$X_LIBS)

  AC_CHECK_LIB(Xv, XvQueryExtension,
               [ X_LIBS="-lXv $X_LIBS";
                 LINK_X_LIBS="-lXv $LINK_X_LIBS";
                 AC_DEFINE(HAVE_XVIDEO,,[Enable XVideo support.]) ],,$X_LIBS)

  AC_CHECK_LIB(Xt, XtToolkitInitialize,
               [ X_LIBS="-lXt $X_LIBS";
                 LINK_X_LIBS="-lXt $LINK_X_LIBS"],
               [ MISSING_X_LIBS="$MISSING_X_LIBS Xt" ],$X_LIBS)

  AC_CHECK_LIB(Xmu, XInternAtom,
               [ X_LIBS="-lXmu $X_LIBS";
                 LINK_X_LIBS="-lXmu $LINK_X_LIBS"],
               [ MISSING_X_LIBS="$MISSING_X_LIBS Xmu" ],$X_LIBS)

  dnl check for Xpm, on some systems Xpm is required for correct Xaw usage.
  AC_CHECK_LIB(Xpm, XpmCreatePixmapFromData,
               [ X_LIBS="-lXpm $X_LIBS";
                 LINK_X_LIBS="-lXpm $LINK_X_LIBS";
                 AC_DEFINE(HAVE_LIBXPM,,[Is libXpm available?]) ],,$X_LIBS)

  dnl Check for Xaw.  Use Xaw3d if requested.
  if test x"$with_xaw3d" != "xyes" ; then
    AC_CHECK_LIB(Xaw, XawFormDoLayout,
                 [ X_LIBS="-lXaw $X_LIBS";
                   LINK_X_LIBS="-lXaw $LINK_X_LIBS"],
                 [ MISSING_X_LIBS="$MISSING_X_LIBS Xaw" ],
                 $X_LIBS $X_PRE_LIBS)
  else
    AC_CHECK_LIB(Xaw3d, XawFormDoLayout,
                 [ X_LIBS="-lXaw3d $X_LIBS";
                   LINK_X_LIBS="-lXaw3d $LINK_X_LIBS"],
                 [ MISSING_X_LIBS="$MISSING_X_LIBS Xaw3d" ],
                 $X_LIBS $X_PRE_LIBS)
  fi

  AC_CHECK_HEADER(X11/extensions/XShm.h,,,[#include <X11/Xlib.h>])
  if test x"$ac_cv_header_X11_extensions_XShm_h" = "xyes" ; then
    AC_CHECK_LIB(Xext, XShmAttach,
                 [ AC_DEFINE(USE_MITSHM,,
                             [Enable MITSHM extensions.]) ],,$X_LIBS)
  fi

  if test x"$MISSING_X_LIBS" != "x"; then
    echo
    echo "+++ Warning: the following important X11 libraries were not found: $MISSING_X_LIBS"
    echo "+++ You might have to edit the Makefile by hand to compile properly"
    echo
  fi

  AC_CHECK_HEADERS(X11/Sunkeysym.h X11/xpm.h)

  dnl Check for XFree86 header and library extensions.
  FULLSCREEN_DRIVERS=""
  if test x"$enable_fullscreen" != "xno"; then
    AC_CHECK_HEADER(X11/extensions/xf86vmode.h,,,[#include <X11/Xlib.h>])
    if test x"$ac_cv_header_X11_extensions_xf86vmode_h" = "xyes" ; then
      AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryVersion,
                   [ X_LIBS="-lXxf86vm $X_LIBS";
                     LINK_X_LIBS="-lXxf86vm $LINK_X_LIBS";
                     FULLSCREEN_DRIVERS="$FULLSCREEN_DRIVERS vidmode.o";
                     AC_DEFINE(USE_XF86_VIDMODE_EXT,,
                               [Enable XF86 VidMode extensions.])
		     AC_DEFINE(USE_XF86_EXTENSIONS,,
                               [Enable XF86 extensions.])],,$X_LIBS)
      if test x"$ac_cv_lib_Xxf86vm_XF86VidModeQueryVersion" = "xyes" ; then
        AC_CHECK_HEADER(X11/extensions/xf86dga.h,,,[#include <X11/Xlib.h>])
        if test x"$ac_cv_header_X11_extensions_xf86dga_h" = "xyes" ; then
          AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension,
                       [ X_LIBS="-lXxf86dga $X_LIBS";
                         LINK_X_LIBS="-lXxf86dga $LINK_X_LIBS";
                         FULLSCREEN_DRIVERS="$FULLSCREEN_DRIVERS dga1.o";
                         AC_DEFINE(USE_XF86_EXTENSIONS,,
                                   [Enable XF86 extensions.])
                         AC_DEFINE(USE_XF86_DGA1_EXTENSIONS,,
                                   [Enable XF86 DGA1 extensions.])],,$X_LIBS)
        fi
      fi
    fi
    AC_CHECK_HEADER(X11/extensions/xf86dga.h,,,[#include <X11/Xlib.h>])
    if test x"$ac_cv_header_X11_extensions_xf86dga_h" = "xyes" ; then
      AC_CHECK_LIB(Xxf86dga, XDGAQueryExtension,
                   [ X_LIBS="-lXxf86dga $X_LIBS";
                     LINK_X_LIBS="-lXxf86dga $LINK_X_LIBS";
		     FULLSCREEN_DRIVERS="$FULLSCREEN_DRIVERS dga2.o";
		     AC_DEFINE(USE_XF86_EXTENSIONS,,[Enable XF86 extensions.])
		     AC_DEFINE(USE_XF86_DGA2_EXTENSIONS,,
                               [Enable XF86 DGA2 extensions.])],,$X_LIBS)
    fi
  fi
  AC_SUBST(FULLSCREEN_DRIVERS)

  X_LIBS="$PATH_X_LIBS $LINK_X_LIBS"

  dnl We always have a mouse on UNIX.
  AC_DEFINE(HAVE_MOUSE,,[Enable 1351 mouse support])

elif [[ x"$is_dos" != "xno" ]]; then

  dnl On MS-DOS, we already know what we want.

  LIBS="$LIBS -lalleg $LIBMIDAS"
  AC_SUBST(LDFLAGS)

elif [[ x"$is_beos" != "xno" ]]; then

  dnl On BEOS, we already know what we want.

  LIBS="$LIBS -lbe -ltracker -ldevice -lgame"
  AC_SUBST(LDFLAGS)

elif [[ x"$is_win32" != "xno" ]]; then

  dnl On Windows, we already know what we want.

  LIBS="$LIBS -lkernel32 -luser32 -lgdi32 -lwinmm -lcomdlg32 -lcomctl32 -lddraw -ldsound -ldinput -lth32 -lwsock32 -lversion"

  AC_CHECK_LIB(dxguid, GUID_SysMouse,[LIBS="$LIBS -ldxguid";
               AC_DEFINE(HAVE_GUIDLIB,,
                         [Is the GUID lib of DX SDK present?])],,$LIBS)

  AC_MSG_CHECKING([whether DWORD is defined as unsigned long or unsigned int in the Mingw32 headers])
  AC_TRY_COMPILE([#include <windows.h>
extern DWORD test;
unsigned long test; ],
                 ,
                 [ AC_DEFINE(DWORD_IS_LONG,,
                   [Is DWORD defined as long or int in the Windows header files?])
                   AC_MSG_RESULT(unsigned long) ], AC_MSG_RESULT(unsigned int))

  x64_LDFLAGS="-mwindows"
  x128_LDFLAGS="-mwindows"
  xvic_LDFLAGS="-mwindows"
  xpet_LDFLAGS="-mwindows"
  xplus4_LDFLAGS="-mwindows"
  xcbm2_LDFLAGS="-mwindows"

  X64_WINRES="\$(top_builddir)/src/arch/win32/resc64.o"
  X128_WINRES="\$(top_builddir)/src/arch/win32/resc128.o"
  XVIC_WINRES="\$(top_builddir)/src/arch/win32/resvic20.o"
  XPET_WINRES="\$(top_builddir)/src/arch/win32/respet.o"
  XPLUS4_WINRES="\$(top_builddir)/src/arch/win32/resplus4.o"
  XCBM2_WINRES="\$(top_builddir)/src/arch/win32/rescbm2.o"

  AC_SUBST(LDFLAGS)

  if test -z "$WINDRES" ; then
    WINDRES="windres"
  fi

  AC_SUBST(WINDRES)

  AC_DEFINE(HAS_TRANSLATION,,[Enable internationalization support])

elif [[ x"${enable_gnomeui}" = x"yes" ]] ; then

  LIBS="${LIBS} `gnome-config --libs gnomeui`"

  dnl We always have a mouse on UNIX/Gnome.
  AC_DEFINE(HAVE_MOUSE,,[Enable 1351 mouse support])

  dnl Check for XFree86 header and library extensions.

  AC_CHECK_LIB(Xv, XvQueryExtension,
               [ X_LIBS="-lXv $X_LIBS";
                 LINK_X_LIBS="-lXv $LINK_X_LIBS";
                 AC_DEFINE(HAVE_XVIDEO,,[Enable XVideo support.]) ],,$X_LIBS)

  AC_CHECK_LIB(Xext, XShmQueryExtension,
               [ AC_DEFINE(USE_MITSHM,,[Enable MITSHM extensions.]) ],,$X_LIBS)

  dnl Check for XFree86 header and library extensions.
  FULLSCREEN_DRIVERS=""
  if test x"$enable_fullscreen" != "xno"; then
    AC_CHECK_HEADER(X11/extensions/xf86vmode.h,,,[#include <X11/Xlib.h>])
    if test x"$ac_cv_header_X11_extensions_xf86vmode_h" = "xyes" ; then
      AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryVersion,
                   [ X_LIBS="-lXxf86vm $X_LIBS";
                     LINK_X_LIBS="-lXxf86vm $LINK_X_LIBS";
                     FULLSCREEN_DRIVERS="$FULLSCREEN_DRIVERS vidmode.o";
                     AC_DEFINE(USE_XF86_VIDMODE_EXT,,
                               [Enable XF86 VidMode extensions.])
                     AC_DEFINE(USE_XF86_EXTENSIONS,,
                               [Enable XF86 extensions.])],,$X_LIBS)
      if test x"$ac_cv_lib_Xxf86vm_XF86VidModeQueryVersion" = "xyes" ; then
        AC_CHECK_HEADER(X11/extensions/xf86dga.h,,,[#include <X11/Xlib.h>])
        if test x"$ac_cv_header_X11_extensions_xf86dga_h" = "xyes" ; then
          AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension,
                       [ X_LIBS="-lXxf86dga $X_LIBS";
                         LINK_X_LIBS="-lXxf86dga $LINK_X_LIBS";
                         FULLSCREEN_DRIVERS="$FULLSCREEN_DRIVERS dga1.o";
                         AC_DEFINE(USE_XF86_EXTENSIONS,,
                                   [Enable XF86 extensions.])
                         AC_DEFINE(USE_XF86_DGA1_EXTENSIONS,,
                                   [Enable XF86 DGA1 extensions.])],,$X_LIBS)
        fi
      fi
    fi
    AC_CHECK_HEADER(X11/extensions/xf86dga.h,,,[#include <X11/Xlib.h>])
    if test x"$ac_cv_header_X11_extensions_xf86dga_h" = "xyes" ; then
      AC_CHECK_LIB(Xxf86dga, XDGAQueryExtension,
                   [ X_LIBS="-lXxf86dga $X_LIBS";
                     LINK_X_LIBS="-lXxf86dga $LINK_X_LIBS";
                     FULLSCREEN_DRIVERS="$FULLSCREEN_DRIVERS dga2.o";
                     AC_DEFINE(USE_XF86_EXTENSIONS,,[Enable XF86 extensions.])
                     AC_DEFINE(USE_XF86_DGA2_EXTENSIONS,,
                               [Enable XF86 DGA2 extensions.])],,$X_LIBS)
    fi
  fi
  AC_SUBST(FULLSCREEN_DRIVERS)

fi

dnl CBM4Linux/OpenCBM
if test x"$enable_realdevice" != x"no"; then
  if test x"$host_os" = "xcygwin32" -o x"$host_os" = "xcygwin" -o x"$host_os" = "xmingw32"; then
    AC_DEFINE(HAVE_OPENCBM,,[Support for OpenCBM (former CBM4Linux).])
    AM_CONDITIONAL(HAVE_REALDEVICE, true)
  else
    AC_CHECK_HEADER(opencbm.h,,)
    if test x"$ac_cv_header_opencbm_h" = "xyes" ; then
      AC_DEFINE(HAVE_OPENCBM_H,,[OpenCBM header file is available.])
      AC_CHECK_LIB(opencbm, cbm_get_eoi,
                   [ LIBS="$LIBS -lopencbm";
                     AC_DEFINE(HAVE_OPENCBM,,
                               [Support for OpenCBM (former CBM4Linux).]) ],,)  
      AM_CONDITIONAL(HAVE_REALDEVICE,
                     test x"$ac_cv_lib_opencbm_cbm_get_eoi" = "xyes")
    else
      AM_CONDITIONAL(HAVE_REALDEVICE, false)
    fi
  fi
else
  AM_CONDITIONAL(HAVE_REALDEVICE, false)
fi

AC_SUBST(x64_LDFLAGS)
AC_SUBST(x128_LDFLAGS)
AC_SUBST(xvic_LDFLAGS)
AC_SUBST(xpet_LDFLAGS)
AC_SUBST(xplus4_LDFLAGS)
AC_SUBST(xcbm2_LDFLAGS)

AC_SUBST(X64_WINRES)
AC_SUBST(X128_WINRES)
AC_SUBST(XVIC_WINRES)
AC_SUBST(XPET_WINRES)
AC_SUBST(XPLUS4_WINRES)
AC_SUBST(XCBM2_WINRES)

dnl Setup the system-specific object files.

if test x"$is_dos" != "xyes" -a x"$is_win32" != "xyes" -a x"$is_riscos" != "xyes" -a x"$is_os2" != "xyes" -a x"$is_beos" != "xyes"; then
  ARCH_DIR="\$(top_builddir)/src/arch/unix"
  if test x"$enable_gnomeui" != "xyes" ; then
    ARCH_LIBS="$ARCH_DIR/libarch.a $ARCH_DIR/x11/libx11ui.a $ARCH_DIR/x11/xaw/libxawui.a $ARCH_DIR/x11/xaw/widgets/libwidgets.a $ARCH_DIR/libarch.a $ARCH_DIR/x11/libx11ui.a"
    ARCH_INCLUDES="-I\$(top_srcdir)/src/arch/unix"
  else
    ARCH_LIBS="$ARCH_DIR/x11/gnome/libgnomeui.a $ARCH_DIR/libarch.a $ARCH_DIR/x11/libx11ui.a $ARCH_DIR/x11/gnome/libgnomeui.a $ARCH_DIR/x11/libx11ui.a $ARCH_DIR/libarch.a"
    ARCH_INCLUDES="-I\$(top_srcdir)/src/arch/unix `gnome-config --cflags gnomeui`"
  fi
  AM_CONDITIONAL(UNIX_COMPILE, true)
  AM_CONDITIONAL(WIN32_COMPILE, false)
  AM_CONDITIONAL(MSDOS_COMPILE, false)
  AM_CONDITIONAL(RISCOS_COMPILE, false)
  AM_CONDITIONAL(OS2_COMPILE, false)
  AM_CONDITIONAL(BEOS_COMPILE, false)
  AC_DEFINE(HAVE_READLINE,,[Are we using the readline library replacement?])
elif [[ x"$is_win32" != "xno" ]]; then
  ARCH_DIR="\$(top_builddir)/src/arch/win32"
  ARCH_LIBS="$ARCH_DIR/libarch.a"
  ARCH_INCLUDES="-I\$(top_srcdir)/src/arch/win32"
  AM_CONDITIONAL(UNIX_COMPILE, false)
  AM_CONDITIONAL(WIN32_COMPILE, true)
  AM_CONDITIONAL(MSDOS_COMPILE, false)
  AM_CONDITIONAL(RISCOS_COMPILE, false)
  AM_CONDITIONAL(OS2_COMPILE, false)
  AM_CONDITIONAL(BEOS_COMPILE, false)
elif [[ x"$is_dos" != "xno" ]]; then
  ARCH_INCLUDES="-I\$(top_srcdir)/src/arch/msdos"
  ARCH_DIR="\$(top_builddir)/src/arch/msdos"
  if test $ac_cv_lib_pcap_pcap_open_live = yes; then
  ARCH_LIBS="$ARCH_DIR/libarch.a $ARCH_DIR/libpcap_nodma.a"
  else
  ARCH_LIBS="$ARCH_DIR/libarch.a"
  fi
  AM_CONDITIONAL(UNIX_COMPILE, false)
  AM_CONDITIONAL(WIN32_COMPILE, false)
  AM_CONDITIONAL(MSDOS_COMPILE, true)
  AM_CONDITIONAL(RISCOS_COMPILE, false)
  AM_CONDITIONAL(OS2_COMPILE, false)
  AM_CONDITIONAL(BEOS_COMPILE, false)
elif [[ x"$is_os2" != "xno" ]]; then
  ARCH_INCLUDES="-I\$(top_srcdir)/src/arch/os2"
  ARCH_DIR="\$(top_builddir)/src/arch/os2"
  ARCH_LIBS="$ARCH_DIR/libarch.a"
  AM_CONDITIONAL(UNIX_COMPILE, false)
  AM_CONDITIONAL(WIN32_COMPILE, false)
  AM_CONDITIONAL(MSDOS_COMPILE, false)
  AM_CONDITIONAL(RISCOS_COMPILE, false)
  AM_CONDITIONAL(OS2_COMPILE, true)
  AM_CONDITIONAL(BEOS_COMPILE, false)
elif [[ x"$is_beos" != "xno" ]]; then
  ARCH_INCLUDES="-I\$(top_srcdir)/src/arch/beos"
  ARCH_DIR="\$(top_builddir)/src/arch/beos"
  ARCH_LIBS="$ARCH_DIR/libarch.a"
  AM_CONDITIONAL(UNIX_COMPILE, false)
  AM_CONDITIONAL(WIN32_COMPILE, false)
  AM_CONDITIONAL(MSDOS_COMPILE, false)
  AM_CONDITIONAL(RISCOS_COMPILE, false)
  AM_CONDITIONAL(OS2_COMPILE, false)
  AM_CONDITIONAL(BEOS_COMPILE, true)
else
  ARCH_INCLUDES="-I\$(top_srcdir)/src/arch/riscos"
  ARCH_DIR="\$(top_builddir)/src/arch/riscos"
  ARCH_LIBS="$ARCH_DIR/libarch.a"
  AM_CONDITIONAL(UNIX_COMPILE, false)
  AM_CONDITIONAL(WIN32_COMPILE, false)
  AM_CONDITIONAL(MSDOS_COMPILE, false)
  AM_CONDITIONAL(RISCOS_COMPILE, true)
  AM_CONDITIONAL(OS2_COMPILE, false)
  AM_CONDITIONAL(BEOS_COMPILE, false)
fi

dnl Check wether we have gcc and solaris /usr/openwin stuff.
dnl The headers there give zillions of warnings because of implicit int 
dnl declarations. gcc's >= 2.6.3 know the `-Wno-implicit-int' option so I 
dnl don't care about checking it out. MP

if test x"$GCC" = "xyes" ; then
  case "$host_os" in
    solaris*)
      if echo ${CFLAGS} ${ARCH_INCLUDES} | grep "I/usr/openwin/include" > /dev/null 2>&1 ; then
  	CFLAGS="${CFLAGS} -Wno-implicit-int"
      fi
      ;;
    *)
      ;;  
  esac
fi

AC_SUBST(HAVE_READLINE)
AC_SUBST(ARCH_INCLUDES)
AC_SUBST(ARCH_LIBS)
AC_SUBST(ARCH_DIR)
AC_SUBST(SOUND_USS_OBJ)
AC_SUBST(SOUND_SGI_OBJ)
AC_SUBST(SOUND_HPUX_OBJ)
AC_SUBST(SOUND_AIX_OBJ)
AC_SUBST(SOUND_MIDAS_OBJ)
AC_SUBST(SOUND_SDL_OBJ)

if test "$prefix" = NONE && test "$exec_prefix" = NONE; then
  AC_DEFINE_UNQUOTED(PREFIX, "$ac_default_prefix",
                     [Where do we want to install the executable?])
elif test "$prefix" = NONE; then
  AC_DEFINE_UNQUOTED(PREFIX, "$exec_prefix",
                     [Where do we want to install the executable?])
else
  AC_DEFINE_UNQUOTED(PREFIX, "$prefix",
                     [Where do we want to install the executable?])
fi

if false ; then
    dnl Now produce the directories & Makefiles.

    mkdir -p arch/beos
    mkdir -p arch/msdos
    mkdir -p arch/os2
    mkdir -p arch/os2/dialogs
    mkdir -p arch/os2/icons
    mkdir -p arch/os2/kbd
    mkdir -p arch/os2/snippets
    mkdir -p arch/os2/vac++
    mkdir -p arch/riscos
    mkdir -p arch/unix
    mkdir -p arch/unix/readline
    mkdir -p arch/unix/x11
    mkdir -p arch/unix/x11/gnome
    mkdir -p arch/unix/x11/xaw
    mkdir -p arch/unix/x11/xaw/widgets
    mkdir -p arch/win32
    mkdir -p arch/win32/utils
    mkdir -p c128
    mkdir -p c64
    mkdir -p c64/cart
    mkdir -p cbm2
    mkdir -p core
    mkdir -p crtc
    mkdir -p diskimage
    mkdir -p drive
    mkdir -p drive/iec
    mkdir -p drive/iec128dcr
    mkdir -p drive/iecieee
    mkdir -p drive/ieee
    mkdir -p drive/tcbm
    mkdir -p fileio
    mkdir -p fsdevice
    mkdir -p gfxoutputdrv
    mkdir -p iecbus
    mkdir -p imagecontents
    mkdir -p monitor
    mkdir -p parallel
    mkdir -p pet
    mkdir -p plus4
    mkdir -p printerdrv
    mkdir -p raster
    mkdir -p resid
    mkdir -p rs232drv
    mkdir -p serial
    mkdir -p sid
    mkdir -p sounddrv
    mkdir -p tape
    mkdir -p vdc
    mkdir -p vdrive
    mkdir -p vic20
    mkdir -p vicii
    mkdir -p video 

    if test x"$srcdir" != "x." ; then
        BINDIR="./bin"
        mkdir -p "$BINDIR"
        rm -f "$BINDIR/C64" "$BINDIR/PET" "$BINDIR/VIC20"
        $LN_S "../$srcdir/../bin/C64" "$BINDIR/C64"
        $LN_S "../$srcdir/../bin/PET" "$BINDIR/PET"
        $LN_S "../$srcdir/../bin/VIC20" "$BINDIR/VIC20"
    else
        BINDIR="../bin"
    fi

    AC_SUBST(BINDIR)
fi

AC_OUTPUT([Makefile
           data/Makefile
           data/C128/Makefile
           data/C64/Makefile
           data/CBM-II/Makefile
           data/DRIVES/Makefile
           data/PET/Makefile
           data/PLUS4/Makefile
           data/PRINTER/Makefile
           data/VIC20/Makefile
           data/fonts/Makefile
           doc/Makefile
           doc/html/Makefile
           man/Makefile
           src/Makefile
           src/arch/Makefile
           src/arch/beos/Makefile
           src/arch/msdos/Makefile
           src/arch/os2/Makefile
           src/arch/os2/dialogs/Makefile
           src/arch/os2/kbd/Makefile
           src/arch/os2/snippets/Makefile
           src/arch/os2/vac++/Makefile
           src/arch/riscos/Makefile
           src/arch/unix/Makefile
           src/arch/unix/readline/Makefile
           src/arch/unix/x11/Makefile
           src/arch/unix/x11/gnome/Makefile
           src/arch/unix/x11/xaw/Makefile
           src/arch/unix/x11/xaw/widgets/Makefile
           src/arch/win32/Makefile
           src/arch/win32/utils/Makefile
           src/c128/Makefile
           src/c64/Makefile
           src/c64/cart/Makefile
           src/cbm2/Makefile
           src/core/Makefile
           src/crtc/Makefile
           src/diskimage/Makefile
           src/drive/Makefile
           src/drive/iec/Makefile
           src/drive/iec128dcr/Makefile
           src/drive/iecieee/Makefile
           src/drive/ieee/Makefile
           src/drive/tcbm/Makefile
           src/fileio/Makefile
           src/fsdevice/Makefile
           src/gfxoutputdrv/Makefile
           src/iecbus/Makefile
           src/imagecontents/Makefile
           src/lib/Makefile
           src/lib/lpng/Makefile
           src/lib/zlib/Makefile
           src/monitor/Makefile
           src/parallel/Makefile
           src/pet/Makefile
           src/plus4/Makefile
           src/printerdrv/Makefile
           src/raster/Makefile
           src/rs232drv/Makefile
           src/serial/Makefile
           src/sid/Makefile
           src/sounddrv/Makefile
           src/tape/Makefile
           src/vdc/Makefile
           src/vdrive/Makefile
           src/vic20/Makefile
           src/vicii/Makefile
           src/video/Makefile
           src/version.h
	   po/Makefile.in
           ])

dnl Local Variables:
dnl mode: autoconf
dnl compile-command: "autoconf"
dnl End: