File: aclocal.m4

package info (click to toggle)
regina 3.3-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 4,928 kB
  • ctags: 7,233
  • sloc: ansic: 50,555; sh: 2,727; lex: 2,298; yacc: 1,498; makefile: 1,010; cpp: 117
file content (1588 lines) | stat: -rw-r--r-- 53,258 bytes parent folder | download | duplicates (3)
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
dnl MH_HAVE_PROTO
dnl MH_PROG_CC
dnl MH_CHECK_CC_O
dnl MH_CHECK__SIGHANDLER_T
dnl MH_STRUCT_RANDOM_DATA
dnl MH_GETGRGID_R_INT_RETURN_5_PARAMS
dnl MH_GETGRGID_R_INT_RETURN_4_PARAMS
dnl MH_GETGRGID_R_STRUCT_RETURN
dnl MH_GETPWUID_R_INT_RETURN
dnl MH_GETPWUID_R_STRUCT_RETURN
dnl MH_GETHOSTBYNAME_R_INT_RETURN_6_PARAMS
dnl MH_GETHOSTBYNAME_R_STRUCT_RETURN_5_PARAMS
dnl MH_CHECK_POSIX_THREADS
dnl MH_CHECK_LEADING_USCORE
dnl MH_HOWTO_DYN_LINK
dnl MH_HOWTO_SHARED_LIBRARY
dnl MH_CHECK_LIB
dnl MH_CHECK_CRYPT
dnl MH_GET_SHLPST
dnl MH_SET_SHLPST
dnl MH_SHARED_LIBRARY
dnl MH_STATIC_LOADING
dnl MH_CHECK_UNSIGNED_CHAR_COMPILER_SWITCH
dnl
dnl ---------------------------------------------------------------------------
dnl Determine if C compiler handles ANSI prototypes
dnl ---------------------------------------------------------------------------
AC_DEFUN([MH_HAVE_PROTO],
[
AC_MSG_CHECKING(if compiler supports ANSI prototypes)
dnl
dnl override existing value of $ac_compile so we use the correct compiler
dnl SHOULD NOT NEED THIS
dnl
ac_compile='$ac_cv_prog_CC conftest.$ac_ext $CFLAGS $CPPFLAGS -c 1>&5 2>&5'
AC_TRY_COMPILE([#include <stdio.h>],
[extern int xxx(int, char *);],
  mh_have_proto=yes; AC_DEFINE(HAVE_PROTO), mh_have_proto=no )
AC_MSG_RESULT($mh_have_proto)
])dnl
dnl ---------------------------------------------------------------------------
dnl Determine the best C compiler to use given a list
dnl ---------------------------------------------------------------------------
AC_DEFUN([MH_PROG_CC],
[
mh_sysv_incdir=""
mh_sysv_libdir=""
all_words="$CC_LIST"
ac_dir=""
AC_MSG_CHECKING(for one of the following C compilers: $all_words)
AC_CACHE_VAL(ac_cv_prog_CC,[
if test -n "$CC"; then
  ac_cv_prog_CC="$CC" # Let the user override the test.
else
  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
  for mh_cc in $all_words; do
    for ac_dir in $PATH; do
      test -z "$ac_dir" && ac_dir=.
      if test -f $ac_dir/$mh_cc; then
        ac_cv_prog_CC="$mh_cc"
        if test "$ac_dir" = "/usr/5bin"; then
          mh_sysv_incdir="/usr/5include"
          mh_sysv_libdir="/usr/5lib"
        fi
        break 2
      fi
    done
  done
  IFS="$ac_save_ifs"
  test -z "$ac_cv_prog_CC" && ac_cv_prog_CC="cc"
fi
CC="$ac_cv_prog_CC"
])
AC_SUBST(CC)
if test "$ac_dir" = ""; then
   AC_MSG_RESULT(using $ac_cv_prog_CC specified in CC env variable)
else
   AC_MSG_RESULT(using $ac_dir/$ac_cv_prog_CC)
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl Check if C compiler supports -c -o file.ooo
dnl ---------------------------------------------------------------------------
AC_DEFUN([MH_CHECK_CC_O],
[
AC_MSG_CHECKING(whether $CC understands -c and -o together)
set dummy $CC; ac_cc="`echo [$]2 |
changequote(, )dnl
                       sed -e 's/[^a-zA-Z0-9_]/_/g' -e 's/^[0-9]/_/'`"
changequote([, ])dnl
AC_CACHE_VAL(ac_cv_prog_cc_${ac_cc}_c_o,
[echo 'foo(){}' > conftest.c
# We do the test twice because some compilers refuse to overwrite an
# existing .o file with -o, though they will create one.
eval ac_cv_prog_cc_${ac_cc}_c_o=no
ac_try='${CC-cc} -c conftest.c -o conftest.ooo 1>&AC_FD_CC'
if AC_TRY_EVAL(ac_try) && test -f conftest.ooo && AC_TRY_EVAL(ac_try);
then
  ac_try='${CC-cc} -c conftest.c -o conftest.ooo 1>&AC_FD_CC'
  if AC_TRY_EVAL(ac_try) && test -f conftest.ooo && AC_TRY_EVAL(ac_try);
  then
    eval ac_cv_prog_cc_${ac_cc}_c_o=yes
  fi
fi
rm -f conftest*
])dnl
if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = yes"; then
        O2SHO=""
        O2SAVE=""
        SAVE2O=""
        O2TSO=""
        O2TSAVE=""
        TSAVE2O=""
        CC2O="-o $"'@'
        AC_MSG_RESULT(yes)
else
        O2SHO="-mv \`basename "$'@'" .sho\`.o "$'@'
        O2SAVE="-mv \`basename "$'@'" .sho\`.o \`basename "$'@'" .sho\`.o.save"
        SAVE2O="-mv \`basename "$'@'" .sho\`.o.save \`basename "$'@'" .sho\`.o"
        O2TSO="-mv \`basename "$'@'" .tso\`.o "$'@'
        O2TSAVE="-mv \`basename "$'@'" .tso\`.o \`basename "$'@'" .tso\`.tso.save"
        TSAVE2O="-mv \`basename "$'@'" .tso\`.tso.save \`basename "$'@'" .tso\`.o"
        CC2O=""
        AC_MSG_RESULT(no)
fi
])
dnl ---------------------------------------------------------------------------
dnl Check if gcc compiler supports -fno-strict-aliasing
dnl ---------------------------------------------------------------------------
AC_DEFUN([MH_CHECK_GCC_STRICT_ALIASING],
[
AC_MSG_CHECKING(whether gcc understands -fno-strict-aliasing)
AC_CACHE_VAL(
[mh_strict_aliasing],
[
mh_save_libs="$LIBS"
LIBS="-fno-strict-aliasing"
AC_TRY_LINK(
[#include <stdio.h>],
[exit(0)],
[mh_strict_aliasing=yes],
[mh_strict_aliasing=no]
)
LIBS="$mh_save_libs"
if test "$mh_strict_aliasing" = yes; then
	MH_STRICT_ALIASING="-fno-strict-aliasing"
else
	MH_STRICT_ALIASING=""
fi
AC_SUBST(MH_STRICT_ALIASING)
])
AC_MSG_RESULT($mh_strict_aliasing)
])

dnl ---------------------------------------------------------------------------
dnl Determine compiler's "unsigned char" is default switch
dnl ---------------------------------------------------------------------------
AC_DEFUN([MH_CHECK_UNSIGNED_CHAR_COMPILER_SWITCH],
[
AC_C_CHAR_UNSIGNED()
AC_MSG_CHECKING(compiler switch for unsigned char)
AC_CACHE_VAL(
[MH_UNSIGNED_CHAR_SWITCH],
[
#
# QNX4 Watcom compiler is unsigned char by default
#
if test "$on_qnx4" = yes -a "$ac_cv_prog_CC" = "cc" ; then
	qnx4_char_unsigned="yes"
fi

if test "$ac_cv_c_char_unsigned" = yes -o "$qnx4_char_unsigned" = yes; then
	MH_UNSIGNED_CHAR_SWITCH=""
	msg="not needed - char is unsigned by default"
else
	case "$ac_cv_prog_CC" in
		gcc)
			MH_UNSIGNED_CHAR_SWITCH="-funsigned-char"
			msg="$MH_UNSIGNED_CHAR_SWITCH"
			;;
		xlC)
			MH_UNSIGNED_CHAR_SWITCH="-qchars=unsigned"
			msg="$MH_UNSIGNED_CHAR_SWITCH"
			;;
		*)
			save_cflags="$CFLAGS"
			mh_have_unsigned_char_switch=no
			for mh_flag in "-xchar=unsigned"; do
				CFLAGS="$CFLAGS $mh_flag"
AC_TRY_COMPILE([#include <stdio.h>],
[char x;],
  MH_UNSIGNED_CHAR_SWITCH="$mh_flag"; msg="$MH_UNSIGNED_CHAR_SWITCH"; mh_have_unsigned_char_switch=yes )
				CFLAGS="$save_cflags"
			done
			if test "$mh_have_unsigned_char_switch" = no; then
				msg="unknown - assuming unsigned by default but running execiser will confirm"
			fi
			;;
	esac
fi
])
AC_MSG_RESULT("$msg")
AC_SUBST(MH_UNSIGNED_CHAR_SWITCH)
])
dnl ---------------------------------------------------------------------------
dnl Check if gcc compiler supports --version-script
dnl ---------------------------------------------------------------------------
AC_DEFUN([MH_CHECK_GCC_VERSION_SCRIPT],
[
AC_MSG_CHECKING(whether gcc understands --version-script)
AC_CACHE_VAL(
[mh_version_script],
[
echo "TEST {" > conftest.def
echo "global:" >> conftest.def
echo "Test;" >> conftest.def
echo "};" >> conftest.def
mh_save_libs="$LIBS"
LIBS="-Wl,--version-script=conftest.def"
AC_TRY_LINK(
[#include <stdio.h>],
[exit(0)],
[mh_version_script=yes],
[mh_version_script=no]
)
LIBS="$mh_save_libs"
rm -f conftest.def
])
if test "$mh_version_script" = yes; then
	SHL_SCRIPT="-Wl,--version-script=${srcdir}/regina_elf.def"
else
	SHL_SCRIPT=""
fi
AC_SUBST(SHL_SCRIPT)
AC_MSG_RESULT($mh_version_script)
])

dnl ---------------------------------------------------------------------------
dnl Check if __sighandler_t is defined
dnl ---------------------------------------------------------------------------
AC_DEFUN([MH_CHECK__SIGHANDLER_T],
[
AC_MSG_CHECKING(whether __sighandler_t is defined)

AC_CACHE_VAL(
[mh_cv__sighandler_t],
[
AC_TRY_COMPILE(
[#include <sys/types.h>]
[#include <signal.h>],
[__sighandler_t fred],
[mh_cv__sighandler_t=yes],
[mh_cv__sighandler_t=no]
)
])dnl
AC_MSG_RESULT($mh_cv__sighandler_t)
if test "$mh_cv__sighandler_t" = yes ; then
        AC_DEFINE(HAVE__SIGHANDLER_T)
fi
])


dnl ---------------------------------------------------------------------------
dnl Work out if struct random_data is defined
dnl ---------------------------------------------------------------------------
AC_DEFUN(MH_STRUCT_RANDOM_DATA,
[AC_CACHE_CHECK([for struct random_data], mh_cv_struct_random_data,
[AC_TRY_COMPILE([#include <stdlib.h>
#include <stdio.h>],
[struct random_data s;],
mh_cv_struct_random_data=yes, mh_cv_struct_random_data=no)])
if test $mh_cv_struct_random_data = yes; then
  AC_DEFINE(HAVE_RANDOM_DATA)
fi
])

dnl ---------------------------------------------------------------------------
dnl Work out if getgrgid_r returns an int and has 5 parameters
dnl ---------------------------------------------------------------------------
AC_DEFUN(MH_GETGRGID_R_INT_RETURN_5_PARAMS,
[AC_CACHE_CHECK([if getgrgid_r has 5 args and returns an int], mh_cv_getgrgid_r_int5,
[AC_TRY_COMPILE([#include <sys/types.h>
#include <grp.h>
#include <pwd.h>],
[
struct group *ptr,result;
int rc;
gid_t gid;
char buf[100];
rc = getgrgid_r(gid,&result,buf,sizeof(buf),&ptr);
],
mh_cv_getgrgid_r_int5=yes, mh_cv_getgrgid_r_int5=no)])
if test $mh_cv_getgrgid_r_int5 = yes; then
  AC_DEFINE(HAVE_GETGRGID_R_RETURNS_INT_5_PARAMS)
fi
])

dnl ---------------------------------------------------------------------------
dnl Work out if getgrgid_r returns an int and has 4 parameters
dnl ---------------------------------------------------------------------------
AC_DEFUN(MH_GETGRGID_R_INT_RETURN_4_PARAMS,
[AC_CACHE_CHECK([if getgrgid_r has 4 args and returns an int], mh_cv_getgrgid_r_int4,
[AC_TRY_COMPILE([#include <sys/types.h>
#include <grp.h>
#include <pwd.h>],
[
struct group *ptr,result;
int rc;
gid_t gid;
char buf[100];
rc = getgrgid_r(gid,&result,buf,sizeof(buf));
],
mh_cv_getgrgid_r_int4=yes, mh_cv_getgrgid_r_int4=no)])
if test $mh_cv_getgrgid_r_int4 = yes; then
  AC_DEFINE(HAVE_GETGRGID_R_RETURNS_INT_4_PARAMS)
fi
])

dnl ---------------------------------------------------------------------------
dnl Work out if getgrgid_r returns a struct group *
dnl ---------------------------------------------------------------------------
AC_DEFUN(MH_GETGRGID_R_STRUCT_RETURN,
[AC_CACHE_CHECK([if getgrgid_r returns a struct group *], mh_cv_getgrgid_r_struct,
[AC_TRY_COMPILE([#include <sys/types.h>
#include <grp.h>
#include <pwd.h>],
[
struct group *ptr,result;
int rc;
gid_t gid;
char buf[100];
ptr = getgrgid_r(gid,&result,buf,sizeof(buf));
],
mh_cv_getgrgid_r_struct=yes, mh_cv_getgrgid_r_struct=no)])
if test $mh_cv_getgrgid_r_struct = yes; then
  AC_DEFINE(HAVE_GETGRGID_R_RETURNS_STRUCT)
fi
])

dnl ---------------------------------------------------------------------------
dnl Work out if getpwuid_r returns an int
dnl ---------------------------------------------------------------------------
AC_DEFUN(MH_GETPWUID_R_INT_RETURN,
[AC_CACHE_CHECK([if getpwuid_r returns an int], mh_cv_getpwuid_r_int,
[AC_TRY_COMPILE([#include <sys/types.h>
#include <grp.h>
#include <pwd.h>],
[
struct passwd *ptr,*result;
int rc;
uid_t uid;
char buf[100];
rc = getpwuid_r(uid,&result,buf,sizeof(buf),&ptr);
],
mh_cv_getpwuid_r_int=yes, mh_cv_getpwuid_r_int=no)])
if test $mh_cv_getpwuid_r_int = yes; then
  AC_DEFINE(HAVE_GETPWUID_R_RETURNS_INT)
fi
])

dnl ---------------------------------------------------------------------------
dnl Work out if getpwuid_r returns a struct group *
dnl ---------------------------------------------------------------------------
AC_DEFUN(MH_GETPWUID_R_STRUCT_RETURN,
[AC_CACHE_CHECK([if getpwuid_r returns a struct passwd *], mh_cv_getpwuid_r_struct,
[AC_TRY_COMPILE([#include <sys/types.h>
#include <grp.h>
#include <pwd.h>],
[
struct group *ptr,*result;
int rc;
uid_t uid;
char buf[100];
ptr = getpwuid_r(uid,&result,buf,sizeof(buf));
],
mh_cv_getpwuid_r_struct=yes, mh_cv_getpwuid_r_struct=no)])
if test $mh_cv_getpwuid_r_struct = yes; then
  AC_DEFINE(HAVE_GETPWUID_R_RETURNS_STRUCT)
fi
])

dnl ---------------------------------------------------------------------------
dnl Work out if gethostbyname_r returns a struct and has 6 parameters
dnl ---------------------------------------------------------------------------
AC_DEFUN(MH_GETHOSTBYNAME_R_INT_RETURN_6_PARAMS,
[AC_CACHE_CHECK([if gethostbyname_r has 6 args and returns an int], mh_cv_gethostbyname_r_int6,
[AC_TRY_COMPILE([#include <sys/types.h>
#include <netdb.h>],
[
int herr;
struct hostent *he,*rc;
char buf[8192];
struct hostent retval;
rc = gethostbyname_r("fred",&retval,buf,sizeof(buf),&he,&herr);
],
mh_cv_gethostbyname_r_int6=yes, mh_cv_gethostbyname_r_int6=no)])
if test $mh_cv_gethostbyname_r_int6 = yes; then
  AC_DEFINE(HAVE_GETHOSTBYNAME_R_RETURNS_INT_6_PARAMS)
fi
])

dnl ---------------------------------------------------------------------------
dnl Work out if gethostbyname_r returns a struct and has 5 parameters
dnl ---------------------------------------------------------------------------
AC_DEFUN(MH_GETHOSTBYNAME_R_STRUCT_RETURN_5_PARAMS,
[AC_CACHE_CHECK([if gethostbyname_r has 5 args and returns a struct], mh_cv_gethostbyname_r_struct5,
[AC_TRY_COMPILE([#include <sys/types.h>
#include <netdb.h>],
[
int herr;
struct hostent *he,*rc;
char buf[8192];
struct hostent retval;
rc = gethostbyname_r("fred",&retval,buf,sizeof(buf),&herr);
],
mh_cv_gethostbyname_r_struct5=yes, mh_cv_gethostbyname_r_struct5=no)])
if test $mh_cv_gethostbyname_r_struct5 = yes; then
  AC_DEFINE(HAVE_GETHOSTBYNAME_R_RETURNS_STRUCT_5_PARAMS)
fi
])

dnl ---------------------------------------------------------------------------
dnl Work out if POSIX Threads are supported
dnl ---------------------------------------------------------------------------
AC_DEFUN([MH_CHECK_POSIX_THREADS],
[
MH_MT_LIBS=""
THREADING_COMPILE=""
THREADING_LINK=""
THREADSAFE_TARGET=""
MT_FILE="mt_notmt"
if test "$enable_posix_threads" = yes; then
   dnl
   dnl -lrt is needed by posix threads on Solaris
   dnl
   AC_CHECK_LIB("rt",main,mh_rt_lib_found=yes,mh_rt_lib_found=no)
   AC_MSG_CHECKING(whether Posix Threads are supported)
   tmpLIBS=$LIBS
   save_cflags="$CFLAGS"
   pthread_libs="pthreads pthread c_r"
   case "$target" in
      *freebsd*)
         CFLAGS="$CFLAGS -pthread"
         ;;
   esac
   for mh_lib in $pthread_libs; do
      LIBS="$tmpLIBS -l${mh_lib}"
      AC_TRY_LINK(
      [#include <pthread.h>],
      [pthread_create(NULL,NULL,NULL,NULL)],
      [mh_has_pthreads=yes],
      [mh_has_pthreads=no]
      )
      if test "$mh_has_pthreads" = yes; then
         MH_MT_LIBS="-l${mh_lib}"
         AC_REQUIRE([AC_CANONICAL_SYSTEM])
         THREADING_COMPILE="-D_REENTRANT -DPOSIX"
         THREADING_LINK=""
         THREADSAFE_TARGET="threader"
         MT_FILE="mt_posix"
         case "$target" in
            *solaris*)
               if test "$ac_cv_prog_CC" = "gcc"; then
                  THREADING_COMPILE="-D_REENTRANT -DPOSIX"
                  if test "$mh_rt_lib_found" = "yes"; then 
                     THREADING_LINK="-lrt"
                  fi
               else
                  THREADING_COMPILE="-mt -D_REENTRANT -DREENTRANT -D_PTHREAD_SEMANTICS"
                  THREADING_LINK="-mt"
               fi
               ;;
            *hp-hpux1*)
               if test "$ac_cv_prog_CC" = "gcc"; then
                  THREADING_COMPILE="-D_REENTRANT -DPOSIX"
               fi
               if test "$mh_rt_lib_found" = "yes"; then 
                  THREADING_LINK="-lrt"
               fi
               ;;
            *linux*)
               ;;
            *freebsd*)
               THREADING_COMPILE="-pthread -D_REENTRANT -DPOSIX"
               THREADING_LINK="-pthread"
               ;;
            *cygwin*)
               THREADING_COMPILE="-D_REENTRANT -DPOSIX"
               THREADING_LINK=""
               THREADSAFE_TARGET="threader.exe"
               ;;
            *)
               if test "$ac_cv_prog_CC" = "gcc"; then
                  THREADING_COMPILE="-D_REENTRANT -DPOSIX"
               fi
               ;;
         esac
         break
      fi
   done
   LIBS="$tmpLIBS"
   CFLAGS="$save_cflags"
   AC_MSG_RESULT($mh_has_pthreads)
fi
AC_SUBST(THREADING_COMPILE)
AC_SUBST(THREADING_LINK)
AC_SUBST(THREADSAFE_TARGET)
AC_SUBST(MH_MT_LIBS)
AC_SUBST(MT_FILE)
])

dnl ---------------------------------------------------------------------------
dnl Work out if functions in dynamically loadable libraries need leading _
dnl Tests based on glib code and only valid for dlopen() mechanism
dnl ---------------------------------------------------------------------------
AC_DEFUN([MH_CHECK_LEADING_USCORE],
[
if test "$ac_cv_header_dlfcn_h" = "yes" -o "$HAVE_DLFCN_H" = "1"; then
   AC_MSG_CHECKING(if symbols need underscore prepended in loadable modules)
   tmpLIBS="$LIBS"
   save_cflags="$CFLAGS"
   LIBS="$LIBS $DLFCNLIBDIR"
   CFLAGS="$CFLAGS $DLFCNINCDIR"
   AC_CACHE_VAL(mh_cv_uscore,[
   AC_TRY_RUN_NATIVE([
   #include <dlfcn.h>
   int mh_underscore_test (void) { return 42; }
   int main() {
     void *f1 = (void*)0, *f2 = (void*)0, *handle;
     handle = dlopen ((void*)0, 0);
     if (handle) {
       f1 = dlsym (handle, "mh_underscore_test");
       f2 = dlsym (handle, "_mh_underscore_test");
     } return (!f2 || f1);
   }],
   mh_cv_uscore=yes,
   mh_cv_uscore=no
   )
   ])
   AC_MSG_RESULT($mh_cv_uscore)
   if test "x$mh_cv_uscore" = "xyes"; then
     AC_DEFINE(MODULES_NEED_USCORE)
   fi
   LIBS="$tmpLIBS"
   CFLAGS="$save_cflags"
fi
])

dnl ---------------------------------------------------------------------------
dnl Work out how to create a dynamically loaded module
dnl ---------------------------------------------------------------------------
AC_DEFUN([MH_HOWTO_DYN_LINK],
[
mh_compile='${CC-cc} -c $DYN_COMP conftest.$ac_ext 1>&AC_FD_CC'
cat > conftest.$ac_ext <<EOF
dnl [#]line __oline__ "[$]0"
[#]line __oline__ "configure"
int foo()
{
return(0);
}
EOF
if AC_TRY_EVAL(mh_compile) && test -s conftest.o; then
        mh_dyn_link='ld -shared -o conftest.rxlib conftest.o -lc 1>&AC_FD_CC'
#       mh_dyn_link='${CC} -Wl,-shared -o conftest.rxlib conftest.o -lc 1>&AC_FD_CC'
        if AC_TRY_EVAL(mh_dyn_link) && test -s conftest.rxlib; then
                LD_RXLIB_A1="ld -shared -o \$(@)"
                LD_RXLIB_A2="ld -shared -o \$(@)"
#               LD_RXLIB1="${CC} -Wl,-shared"
                LD_RXLIB_B1="-L. -l${SHLFILE}"
                LD_RXLIB_B2="-L. -l${SHLFILE}"
                SHLPRE="lib"
                SHLPST=".so"
        else
                mh_dyn_link='ld -G -o conftest.rxlib conftest.o 1>&AC_FD_CC'
#               mh_dyn_link='${CC} -Wl,-G -o conftest.rxlib conftest.o 1>&AC_FD_CC'
                if AC_TRY_EVAL(mh_dyn_link) && test -s conftest.rxlib; then
                        LD_RXLIB_A1="ld -G -o \$(@)"
                        LD_RXLIB_A2="ld -G -o \$(@)"
#                       LD_RXLIB1="${CC} -Wl,-G"
                        LD_RXLIB_B1="-L. -l${SHLFILE}"
                        LD_RXLIB_B2="-L. -l${SHLFILE}"
                        SHLPRE="lib"
                        SHLPST=".so"
                else
                        LD_RXLIB_A1=""
                        LD_RXLIB_A2=""
                        LD_RXLIB_B1=""
                        LD_RXLIB_B2=""
                        SHLPRE=""
                        SHLPST=""
                fi
        fi
fi
rm -f conftest*
])dnl

dnl ---------------------------------------------------------------------------
dnl Work out how to create a shared library
dnl ---------------------------------------------------------------------------
AC_DEFUN(MH_HOWTO_SHARED_LIBRARY,
[
AC_MSG_CHECKING(how to create a shared library)
mh_compile='${CC-cc} -c $DYN_COMP conftest.$ac_ext 1>&AC_FD_CC'
cat > conftest.$ac_ext <<EOF
dnl [#]line __oline__ "[$]0"
[#]line __oline__ "configure"
int foo()
{
return(0);
}
EOF
if AC_TRY_EVAL(mh_compile) && test -s conftest.o; then
        mh_dyn_link='ld -shared -o conftest.so.1.0 conftest.o -lc 1>&AC_FD_CC'
#       mh_dyn_link='${CC} -Wl,-shared -o conftest.so.1.0 conftest.o -lc 1>&AC_FD_CC'
        if AC_TRY_EVAL(mh_dyn_link) && test -s conftest.so.1.0; then
                SHL_LD="ld -shared -o ${SHLPRE}${SHLFILE}${SHLPST} "'$('SHOFILES')'" -lc"
#               SHL_LD="${CC} -Wl,-shared -o ${SHLPRE}${SHLFILE}${SHLPST} "'$('SHOFILES')'" -lc"
        else
                mh_dyn_link='ld -G -o conftest.so.1.0 conftest.o 1>&AC_FD_CC'
#               mh_dyn_link='${CC} -Wl,-G -o conftest.so.1.0 conftest.o 1>&AC_FD_CC'
                if AC_TRY_EVAL(mh_dyn_link) && test -s conftest.so.1.0; then
                        SHL_LD="ld -G -o ${SHLPRE}${SHLFILE}${SHLPST} "'$('SHOFILES')'
#                       SHL_LD="${CC} -Wl,-G -o ${SHLPRE}${SHLFILE}${SHLPST} "'$('SHOFILES')'
                else
                        mh_dyn_link='ld -o conftest.so.1.0 -shared -no_archive conftest.o  -lc 1>&AC_FD_CC'
#                       mh_dyn_link='${CC} -o conftest.so.1.0 -Wl,-shared,-no_archive conftest.o  -lc 1>&AC_FD_CC'
                        if AC_TRY_EVAL(mh_dyn_link) && test -s conftest.so.1.0; then
                                SHL_LD="ld -o ${SHLPRE}${SHLFILE}${SHLPST} -shared -no_archive "'$('SHOFILES')'" -lc"
#                               SHL_LD="${CC} -o ${SHLPRE}${SHLFILE}${SHLPST} -Wl,-shared,-no_archive "'$('SHOFILES')'" -lc"
                        else
                                mh_dyn_link='ld -b -o conftest.so.1.0 conftest.o 1>&AC_FD_CC'
#                               mh_dyn_link='${CC} -Wl,-b -o conftest.so.1.0 conftest.o 1>&AC_FD_CC'
                                if AC_TRY_EVAL(mh_dyn_link) && test -s conftest.so.1.0; then
                                        SHL_LD="ld -b -o ${SHLPRE}${SHLFILE}${SHLPST} "'$('SHOFILES')'
#                                       SHL_LD="${CC} -Wl,-b -o ${SHLPRE}${SHLFILE}.${SHLPST} "'$('SHOFILES')'
                                else
                                        mh_dyn_link='ld -Bshareable -o conftest.so.1.0 conftest.o 1>&AC_FD_CC'
#                                       mh_dyn_link='${CC} -Wl,-Bshareable -o conftest.so.1.0 conftest.o 1>&AC_FD_CC'
                                        if AC_TRY_EVAL(mh_dyn_link) && test -s conftest.so.1.0; then
                                                SHL_LD="ld -Bshareable -o ${SHLPRE}${SHLFILE}${SHLPST} "'$('SHOFILES')'
#                                               SHL_LD="${CC} -Wl,-Bshareable -o ${SHLPRE}${SHLFILE}${SHLPST} "'$('SHOFILES')'
                                        else
                                                mh_dyn_link='ld -assert pure-text -o conftest.so.1.0 conftest.o 1>&AC_FD_CC'
#                                               mh_dyn_link='${CC} -Wl,-assert pure-text -o conftest.so.1.0 conftest.o 1>&AC_FD_CC'
                                                if AC_TRY_EVAL(mh_dyn_link) && test -s conftest.so.1.0; then
                                                        SHL_LD="ld -assert pure-text -o ${SHLPRE}${SHLFILE}${SHLPST} "'$('SHOFILES')'
#                                                       SHL_LD="${CC} -Wl,-assert pure-text -o ${SHLPRE}${SHLFILE}${SHLPST} "'$('SHOFILES')'
                                                else
                                                        SHL_LD=""
                                                fi
                                        fi
                                fi
                        fi
                fi
        fi
fi
if test "$SHL_LD" = ""; then
        AC_MSG_RESULT(unknown)
else
        AC_MSG_RESULT(found)
fi
rm -f conftest*
])

dnl ---------------------------------------------------------------------------
dnl Check for presence of various libraries
dnl ---------------------------------------------------------------------------
AC_DEFUN([MH_CHECK_LIB],
[
MH_EXTRA_LIBS=''
for mh_lib in $1; do
   if test "$on_qnx4" = yes -a "$ac_cv_prog_CC" != "gcc"; then
      AC_MSG_CHECKING(for library -l${mh_lib})
      if test -r /usr/lib/${mh_lib}3r.lib; then
         AC_MSG_RESULT(found)
         MH_EXTRA_LIBS="${MH_EXTRA_LIBS} -l${mh_lib}"
      else
         AC_MSG_RESULT(not found)
      fi
   else
      AC_CHECK_LIB($mh_lib,main,mh_lib_found=yes,mh_lib_found=no)
      if test "$mh_lib_found" = yes; then
         MH_EXTRA_LIBS="${MH_EXTRA_LIBS} -l${mh_lib}"
      fi
   fi
done
])dnl

dnl ---------------------------------------------------------------------------
dnl Check for presence of various libraries
dnl ---------------------------------------------------------------------------
AC_DEFUN([MH_CHECK_CRYPT],
[
mh_save_libs="$LIBS"

if test "$on_qnx4" = no; then
   AC_CHECK_LIB(crypt,main,mh_crypt_found=yes,mh_crypt_found=no)
   if test "$mh_crypt_found" = yes; then
      LIBS="${LIBS} -lcrypt"
   fi
fi

AC_MSG_CHECKING(for crypt function)

AC_CACHE_VAL(
[mh_cv_func_crypt],
[
        AC_TRY_LINK(
[#include <unistd.h>],
[crypt("fred","aa")],
        [mh_cv_func_crypt=yes],
        [mh_cv_func_crypt=no]
        )
])dnl
AC_MSG_RESULT($mh_cv_func_crypt)
if test "$mh_cv_func_crypt" = yes ; then
        AC_DEFINE(HAVE_CRYPT)
        if test "$mh_crypt_found" = yes; then
                MH_EXTRA_LIBS="${MH_EXTRA_LIBS} -lcrypt"
        fi
fi

LIBS="$mh_save_libs"

])dnl

dnl ---------------------------------------------------------------------------
dnl Determines the file extension for shared libraries
dnl ---------------------------------------------------------------------------
AC_DEFUN([MH_GET_SHLPST],
[
AC_MSG_CHECKING(shared library/external function extensions)
SHLPST=".so"
MODPST=".so"
AC_REQUIRE([AC_CANONICAL_SYSTEM])
case "$target" in
        *hp-hpux*)
                SHLPST=".sl"
                MODPST=".sl"
                ;;
        *ibm-aix*)
                SHLPST=".a"
                MODPST=".a"
                ;;
        *nto-qnx*)
                ;;
        *qnx*)
                SHLPST=""
                MODPST=""
                ;;
        *cygwin*)
                SHLPST=".dll"
                MODPST=".dll"
                ;;
        *darwin*)
                SHLPST=".dylib"
                MODPST=".dylib"
# MH                MODPST=".so"
                ;;
esac
AC_MSG_RESULT($SHLPST/$MODPST)
])

dnl ---------------------------------------------------------------------------
dnl Sets SHLPST and MODPST
dnl ---------------------------------------------------------------------------
AC_DEFUN([MH_SET_SHLPST],
[
AC_SUBST(SHLPST)
AC_SUBST(MODPST)
])

dnl ---------------------------------------------------------------------------
dnl Determine how to build shared libraries etc..
dnl ---------------------------------------------------------------------------
AC_DEFUN([MH_SHARED_LIBRARY],
[
AC_REQUIRE([MH_SET_SHLPST])
dnl
dnl If compiler is gcc, then flags should be the same for all platforms
dnl (just guessing on this)
dnl
SHLPRE="lib"
LIBFILE="regina"
SHLFILE="regina"
OSAVE=".o.save"
OBJ="o"
EXE=""
LIBPST=".a"
LIBPRE="lib"
LIBEXE="ar"
GETOPT=""
OBJECTS='$('OFILES')'
STATIC_LDFLAGS=""
AIX_DYN="no"
BEOS_DYN="no"

AC_REQUIRE([AC_CANONICAL_SYSTEM])
case "$target" in
        *hp-hpux9*)
                SYS_DEFS="-D_HPUX_SOURCE +e" # Extended ANSI mode for c89
                AC_DEFINE(SELECT_IN_TIME_H)
                ;;
        *hp-hpux*)
                if test "$ac_cv_prog_CC" = "gcc"; then
                  SYS_DEFS="-D_HPUX_SOURCE"
                else
                  SYS_DEFS="-D_HPUX_SOURCE +e" # Extended ANSI mode for c89
                fi
                ;;
        *ibm-aix3*|*ibm-aix4.1*)
                SYS_DEFS="-D_ALL_SOURCE -DAIX"
                ;;
        *ibm-aix*)
                SYS_DEFS="-D_ALL_SOURCE -DAIX"
                DYN_COMP="-DDYNAMIC"
                ;;
        *dec-osf*)
                if test "$ac_cv_prog_CC" = "gcc"; then
                        SYS_DEFS="-D_POSIX_SOURCE -D_XOPEN_SOURCE"
                else
                        SYS_DEFS="-D_POSIX_SOURCE -D_XOPEN_SOURCE -Olimit 800"
                fi
                ;;
        sparc*sunos*)
                SYS_DEFS="-DSUNOS -DSUNOS_STRTOD_BUG"
                ;;
        *nto-qnx*)
                ;;
        *qnx*)
                LIBPRE=""
                LIBPST=".lib"
                SHLPRE=""
                SHLPST=".lib"
                SHLFILE="rexx"
                ;;
        *cygwin*)
                LIBPRE="lib"
                SHLPRE=""
                DYN_COMP="-DDYNAMIC"
                LIBPST=".a"
                EXE=".exe"
                ;;
        *darwin*)
                DYN_COMP="-fno-common"
                ;;
esac

dnl
dnl set variables for compiling if we don't already have it
dnl
if test "$DYN_COMP" = ""; then
AC_MSG_CHECKING(compiler flags for a dynamic object)

cat > conftest.$ac_ext <<EOF
dnl [#]line __oline__ "[$]0"
[#]line __oline__ "configure"
int a=0
EOF

        DYN_COMP=""
        mh_cv_stop=no
        save_cflags="$CFLAGS"
        mh_cv_flags="-fPIC -KPIC +Z"
        for a in $mh_cv_flags; do
                CFLAGS="-c $a"

                mh_compile='${CC-cc} -c $CFLAGS conftest.$ac_ext > conftest.tmp 2>&1'
                if AC_TRY_EVAL(mh_compile); then
                        DYN_COMP=""
                else
                        slash="\\"
                        mh_dyncomp="`egrep -c $slash$a conftest.tmp`"
                        if test "$mh_dyncomp" = "0"; then
                                DYN_COMP="$a -DDYNAMIC"
                                AC_MSG_RESULT($a)
                                break
                        else
                                DYN_COMP=""
                        fi
                fi
        done
        if test "$DYN_COMP" = ""; then
                AC_MSG_RESULT(none of $mh_cv_flags supported)
        fi
        CFLAGS="$save_cflags"
        rm -f conftest.*
fi

dnl
dnl set variables for linking
dnl
SHL_LD=""
TEST1EXPORTS=""
TEST2EXPORTS=""
TEST1EXP=""
TEST2EXP=""
REGINAEXP=""

# If the build OS can handle version numbers in the shared library name,
# then set SHL_BASE="${SHLPRE}${SHLFILE}${SHLPST}.\$(ABI)"
SHL_BASE="${SHLPRE}${SHLFILE}${SHLPST}"

# OTHER_INSTALLS is set to install a non-version numbered shared library
# by default; ie. no .\$(ABI) suffix. If the regina executable is not built, 
# then there is no shared library. Set OTHER_INSTALLS="installabilib" if you
# are building a version numbered shared library.
OTHER_INSTALLS="installlib"
BASE_INSTALL="installbase"
BASE_BINARY="binarybase"
USE_ABI="no"
BUNDLE=""
EXTRATARGET=""
case "$target" in
        *hp-hpux*)
                EEXTRA="-Wl,-E"
                LD_RXLIB_A1="ld -b -q -n -o \$(@)"
                LD_RXLIB_A2="ld -b -q -n -o \$(@)"
                LD_RXLIB_B1=""
                LD_RXLIB_B2=""
                DYNAMIC_LDFLAGS="-Wl,+s"
                SHLPRE="lib"
                SHL_LD="ld -b -o ${SHLPRE}${SHLFILE}${SHLPST} "'$('SHOFILES')'
                ;;
        *ibm-aix3*)
                STATIC_LDFLAGS="-bnso -bI:/lib/syscalls.exp"
                LD_RXLIB_A1="ld -bnoentry -bM:SRE -bT:512 -bH:512 -bI:regina.exp -o \$(@)"
                LD_RXLIB_A2="ld -bnoentry -bM:SRE -bT:512 -bH:512 -bI:regina.exp -o \$(@)"
                LD_RXLIB_B1="${SHLPRE}${SHLFILE}${SHLPST} -lc"
                LD_RXLIB_B2="${SHLPRE}${SHLFILE}${SHLPST} -lc"
                SHLPRE="lib"
                TEST1EXPORTS="-bE:test1.exp"
                TEST2EXPORTS="-bE:test2.exp"
                TEST1EXP="test1.exp"
                TEST2EXP="test2.exp"
                REGINAEXP="regina.exp"
                if test "$ac_cv_header_dlfcn_h" = "yes" -o "$HAVE_DLFCN_H" = "1"; then
                        AIX_DYN="yes"
                        DYN_COMP="-DDYNAMIC"
                        SHL_LD="ld -o ${SHLPRE}${SHLFILE}${SHLPST} -bnoentry -bE:regina.exp -bM:SRE -bT:512 -bH:512 "'$('SHOFILES')'" -lc"
                else
                        SHL_LD=" "'$('LIBEXE')'" "'$('LIBFLAGS')'" "'$('SHOFILES')'
                        DYN_COMP=""
                fi
                ;;
        *ibm-aix*)
#                STATIC_LDFLAGS="-bnso -bI:/lib/syscalls.exp"
                LD_RXLIB_A1="ld -bnoentry -bM:SRE -o \$(@)"
                LD_RXLIB_A2="ld -bnoentry -bM:SRE -o \$(@)"
                LD_RXLIB_B1="${SHLPRE}${SHLFILE}${SHLPST} -lc"
                LD_RXLIB_B2="${SHLPRE}${SHLFILE}${SHLPST} -lc"
                SHLPRE="lib"
                TEST1EXPORTS="-bE:test1.exp"
                TEST2EXPORTS="-bE:test2.exp"
                TEST1EXP="test1.exp"
                TEST2EXP="test2.exp"
                REGINAEXP="regina.exp"
                if test "$ac_cv_header_dlfcn_h" = "yes" -o "$HAVE_DLFCN_H" = "1"; then
                        AIX_DYN="yes"
                        DYN_COMP="-DDYNAMIC"
                        SHL_LD="ld -o ${SHLPRE}${SHLFILE}${SHLPST} -bnoentry -bE:regina.exp -bM:SRE \$(SHOFILES) -lc \$(SHLIBS) \$(MH_MT_LIBS)"
                else
                        SHL_LD=" "'$('LIBEXE')'" "'$('LIBFLAGS')'" "'$('SHOFILES')'
                        DYN_COMP=""
                fi
                ;;
        *dec-osf*)
                LD_RXLIB_A1="ld -shared -o \$(@)"
                LD_RXLIB_A2="ld -shared -o \$(@)"
                LD_RXLIB_B1="-lc -L. -l${SHLFILE}"
                LD_RXLIB_B2="-lc -L. -l${SHLFILE}"
                SHLPRE="lib"
                SHL_LD="ld -o ${SHLPRE}${SHLFILE}${SHLPST} -shared -no_archive "'$('SHOFILES')'" -lc"
                ;;
        *esix*)
                LD_RXLIB_A1="ld -G -o \$(@)"
                LD_RXLIB_A2="ld -G -o \$(@)"
                LD_RXLIB_B1=""
                LD_RXLIB_B2=""
                DYNAMIC_LDFLAGS=""
                SHLPRE="lib"
                SHL_LD="ld -G -o ${SHLPRE}${SHLFILE}${SHLPST} "'$('SHOFILES')'
                ;;
        *dgux*)
                LD_RXLIB_A1="ld -G -o \$(@)"
                LD_RXLIB_A2="ld -G -o \$(@)"
                LD_RXLIB_B1=""
                LD_RXLIB_B2=""
                DYNAMIC_LDFLAGS=""
                SHLPRE="lib"
                SHL_LD="ld -G -o ${SHLPRE}${SHLFILE}${SHLPST} "'$('SHOFILES')'
                ;;
        *pc-sco*)
                LD_RXLIB_A1="ld -dy -G -o \$(@)"
                LD_RXLIB_A2="ld -dy -G -o \$(@)"
                LD_RXLIB_B1=""
                LD_RXLIB_B2=""
                DYNAMIC_LDFLAGS=""
                SHLPRE="lib"
                SHL_LD="ld -dy -G -o ${SHLPRE}${SHLFILE}${SHLPST} "'$('SHOFILES')'
                ;;
        *solaris*)
                if test "$ac_cv_prog_CC" = "gcc"; then
                   LD_RXLIB_A1="gcc -shared -o \$(@)"
                   LD_RXLIB_A2="gcc -shared -o \$(@)"
                   SHL_LD="gcc -shared -o ${SHLPRE}${SHLFILE}${SHLPST} "'$('SHOFILES')'
                else
                   LD_RXLIB_A1="ld -G -o \$(@)"
                   LD_RXLIB_A2="ld -G -o \$(@)"
                   SHL_LD="ld -G -o ${SHLPRE}${SHLFILE}${SHLPST} "'$('SHOFILES')'
                fi
                LD_RXLIB_B1=""
                LD_RXLIB_B2=""
                DYNAMIC_LDFLAGS=""
                SHLPRE="lib"
                ;;
        sparc*sunos*)
                LD_RXLIB_A1="ld -o \$(@)"
                LD_RXLIB_A2="ld -o \$(@)"
                LD_RXLIB_B1=""
                LD_RXLIB_B2=""
                SHLPRE="lib"
                SHL_LD="ld -assert pure-text -o ${SHLPRE}${SHLFILE}${SHLPST} "'$('SHOFILES')'
                ;;
        *freebsd*)
                LD_RXLIB_A1="ld -Bdynamic -Bshareable -o \$(@)"
                LD_RXLIB_A2="ld -Bdynamic -Bshareable -o \$(@)"
                LD_RXLIB_B1="-lc -L. -l${SHLFILE}"
                LD_RXLIB_B2="-lc -L. -l${SHLFILE}"
                SHLPRE="lib"
                SHL_LD="ld -Bdynamic -Bshareable -o ${SHLPRE}${SHLFILE}${SHLPST} "'$('SHOFILES')'
                ;;
        *linux*)
                LD_RXLIB_A1="${CC} -shared -o \$(@)"
                LD_RXLIB_A2="${CC} -shared -o \$(@)"
                LD_RXLIB_B1="-L. -l${SHLFILE}"
                LD_RXLIB_B2="-L. -l${SHLFILE}"
                SHLPRE="lib"
                SHL_LD="${CC} -o ${SHLPRE}${SHLFILE}${SHLPST}.\$(ABI) -shared ${SHL_SCRIPT} \$(SHOFILES) -lc"
                SHL_BASE="${SHLPRE}${SHLFILE}${SHLPST}.\$(ABI)"
                OTHER_INSTALLS="installabilib"
                USE_ABI="yes"
                ;;
        *atheos*)
                LD_RXLIB_A1="${CC} -shared -o \$(@)"
                LD_RXLIB_A2="${CC} -shared -o \$(@)"
                LD_RXLIB_B1="-L. -l${SHLFILE} "'$('BOTHLIBS')'
                LD_RXLIB_B2="-L. -l${SHLFILE} "'$('BOTHLIBS')'
                SHLPRE="lib"
                SHL_LD="${CC} -o ${SHLPRE}${SHLFILE}${SHLPST} -shared \$(SHOFILES) "'$('BOTHLIBS')'
                SHL_BASE="${LIBPRE}${SHLFILE}${SHLPST}"
                BASE_BINARY="atheosbinary"
                ;;
        *beos*)
                LD_RXLIB_A1="${CC} -Wl,-shared -nostart -Xlinker -o\$(@)"
                LD_RXLIB_A2="${CC} -Wl,-shared -nostart -Xlinker -o\$(@)"
                LD_RXLIB_B1="-L. -l${SHLFILE}"
                LD_RXLIB_B2="-L. -l${SHLFILE}"
                SHLPRE="lib"
                SHL_LD="${CC} -o ${SHLPRE}${SHLFILE}${SHLPST} -Wl,-shared -nostart -Xlinker \$(SHOFILES)"
                SHL_BASE="${SHLPRE}${SHLFILE}${SHLPST}"
                BEOS_DYN="yes"
                BASE_INSTALL="installbase"
                BASE_BINARY="installbase"
                OTHER_INSTALLS="installlib"
                ;;
        *nto-qnx*)
                LD_RXLIB_A1="${CC} -shared -o \$(@)"
                LD_RXLIB_A2="${CC} -shared -o \$(@)"
                LD_RXLIB_B1="-L. -l${SHLFILE}"
                LD_RXLIB_B2="-L. -l${SHLFILE}"
                SHLPRE="lib"
                SHL_LD="${CC} -o ${SHLPRE}${SHLFILE}${SHLPST} -shared \$(SHOFILES)"
                SHL_BASE="${SHLPRE}${SHLFILE}${SHLPST}"
                ;;
        *qnx*)
                LD_RXLIB_A1=""
                LD_RXLIB_A2=""
                LD_RXLIB_B1=""
                LD_RXLIB_B2=""
                SHLPRE=""
                # set BUNDLE to unique junk names to stop the Makefile
                # getting duplicate targets
                BUNDLE=".junk2"
                SHLPST=".junk"
                SHL_LD=""
                EEXTRA="-mf -N0x20000 -Q"
                LIBPRE=""
                LIBPST=".lib"
                LIBFILE="rexx"
                ;;
        *cygwin*)
                LD_RXLIB_A1="dllwrap --target i386-cygwin32 --def ${srcdir}/test1_w32_dll.def --dllname test1.dll -o \$(@)"
                LD_RXLIB_A2="dllwrap --target i386-cygwin32 --def ${srcdir}/test2_w32_dll.def --dllname test2.dll -o \$(@)"
                LD_RXLIB_B1="-L. -lregina"
                LD_RXLIB_B2="-L. -lregina"
                SHLPRE=""
                SHL_LD="dllwrap --def ${srcdir}/regina_w32_dll.def --output-lib libregina.a --target i386-cygwin32 --dllname regina.dll -o regina.dll \$(SHOFILES)"
                EEXTRA=""
                LIBPRE="lib"
                LIBPST=".a"
                LIBFILE="rexx"
                SHL_BASE="${SHLPRE}${SHLFILE}${SHLPST}"
                TEST1EXPORTS=""
                TEST2EXPORTS=""
                TEST1EXP="${srcdir}/test1_w32_dll.def"
                TEST2EXP="${srcdir}/test2_w32_dll.def"
                REGINAEXP="${srcdir}/regina_w32_dll.def"
                BASE_INSTALL="cygwininstall"
                BASE_BINARY="cygwinbinary"
                OTHER_INSTALLS=""
                ;;
        *apple-darwin*)
                # to test on platform other than real Mac OSX use: --build=ppc-apple-darwin10.1 --target=ppc-apple-darwin10.1
                #
                # Link switches for building "bundles"
                #
# MH                LD_RXLIB_A1="${CC} -bundle -flat_namespace -undefined suppress -o \$(@)"
# MH                LD_RXLIB_A2="${CC} -bundle -flat_namespace -undefined suppress -o \$(@)"
                LD_RXLIB_A1="${CC} -dynamiclib -o \$(@)"
                LD_RXLIB_A2="${CC} -dynamiclib -o \$(@)"
                LD_RXLIB_B1="-L. -l${SHLFILE} -lc \$(SHLIBS)"
                LD_RXLIB_B2="-L. -l${SHLFILE} -lc \$(SHLIBS)"
                DYN_COMP="-DDYNAMIC -fno-common"
                SHLPRE="lib"
# MH                BUNDLE=".so"
                BUNDLE=".junk"
                SHL_LD="${CC} -dynamiclib -install_name ${SHLPRE}${SHLFILE}${SHLPST} -o ${SHLPRE}${SHLFILE}${SHLPST} "'$('SHOFILES')'
                SHL_BASE="${LIBPRE}${SHLFILE}${SHLPST}"
# MH                EXTRATARGET="libregina$BUNDLE"
                OTHER_INSTALLS="installlib"
                ;;
        *)
                MH_HOWTO_SHARED_LIBRARY()
                MH_HOWTO_DYN_LINK()
                ;;
esac

LIBFLAGS="cr ${LIBPRE}${LIBFILE}${LIBPST}"
LIBLINK="-L. -l${LIBFILE}"
LINKSHL="-L. -l${SHLFILE}"

case "$target" in
        *hp-hpux*)
                #
                # For HPUX, we must link the "regina" executable with -lregina
                # otherwise you can't move the shared library anywhere other
                # than where it was built. Fix by PJM
                #
                LINKREG="${LINKSHL}"
                ;;
        *cygwin*)
                #
                # For CygWin, we must link with the import library
                # not the actual DLL
                #
                LINKREG="${LINKSHL}"
                ;;
        *)
                LINKREG="${SHLPRE}${SHLFILE}${SHLPST}"
                ;;
esac

if test "$SHL_LD" != ""; then
   SHL_LD="$SHL_LD \$(BOTHLIBS) \$(MH_MT_LIBS)"
fi

AC_MSG_CHECKING(if dynamic loading of external functions is supported)
if test "$HAVE_DLFCN_H" = "1" -o "$ac_cv_header_dl_h" = "yes" -o "$ac_cv_header_dlfcn_h" = "yes" -o "$AIX_DYN" = "yes" -o "$BEOS_DYN" = "yes"; then
   SHL_TARGETS="${SHL_BASE} regina${EXE} ${SHLPRE}test1${MODPST} ${SHLPRE}test2${MODPST} $EXTRATARGET"
   EXECISER_DEP="${SHL_BASE}"
   OTHER_INSTALLS="regina${EXE} $OTHER_INSTALLS"
   AC_MSG_RESULT("yes")
else
   SHL_TARGETS=""
   EXECISER_DEP="${STATICLIB}"
   OTHER_INSTALLS=""
   AC_MSG_RESULT("no")
fi

if test "$AIX_DYN" = "yes"; then
   STATICLIB=""
   LIBPST=".junk"
else
   STATICLIB="${LIBPRE}${LIBFILE}${LIBPST}"
fi

RANLIB_DYNAMIC=""
AC_SUBST(BASE_BINARY)
AC_SUBST(BASE_INSTALL)
AC_SUBST(BOTHLIBS)
AC_SUBST(CC2O)
AC_SUBST(CEXTRA)
AC_SUBST(DYNAMIC_LDFLAGS)
AC_SUBST(DYN_COMP)
AC_SUBST(EEXTRA)
AC_SUBST(EXE)
AC_SUBST(EXECISER_DEP)
AC_SUBST(GETOPT)
AC_SUBST(LD_RXLIB_A1)
AC_SUBST(LD_RXLIB_A2)
AC_SUBST(LD_RXLIB_B1)
AC_SUBST(LD_RXLIB_B2)
AC_SUBST(LIBEXE)
AC_SUBST(LIBFILE)
AC_SUBST(LIBFLAGS)
AC_SUBST(LIBLINK)
AC_SUBST(LIBPRE)
AC_SUBST(LIBPST)
AC_SUBST(LINKSHL)
AC_SUBST(LINKREG)
AC_SUBST(O2SAVE)
AC_SUBST(O2TSAVE)
AC_SUBST(O2SHO)
AC_SUBST(O2TSO)
AC_SUBST(OBJ)
AC_SUBST(OBJECTS)
AC_SUBST(OSAVE)
AC_SUBST(OTHER_INSTALLS)
AC_SUBST(REGINAEXP)
AC_SUBST(SAVE2O)
AC_SUBST(SHLFILE)
AC_SUBST(SHLIBS)
AC_SUBST(SHLPRE)
AC_SUBST(BUNDLE)
AC_SUBST(SHL_LD)
AC_SUBST(SHL_TARGETS)
AC_SUBST(STATICLIB)
AC_SUBST(STATIC_LDFLAGS)
AC_SUBST(TEST1EXP)
AC_SUBST(TEST1EXPORTS)
AC_SUBST(TEST2EXP)
AC_SUBST(TEST2EXPORTS)
AC_SUBST(USE_ABI)
AC_SUBST(RANLIB_DYNAMIC)
])dnl

dnl ---------------------------------------------------------------------------
dnl Determine how to build shared libraries etc..
dnl ---------------------------------------------------------------------------
AC_DEFUN([MH_STATIC_LOADING],
[
SHLPRE="lib"
SHLPST=".a"
MODPST=".a"
LIBFILE="rexx"
SHLFILE="regina"
OSAVE=".o.save"
OBJ="o"
EXE=""
LIBPST=".a"
LIBPRE="lib"
LIBEXE="ar"
GETOPT=""
OBJECTS='$('OFILES')'
STATIC_LDFLAGS=""
AIX_DYN="no"
BEOS_DYN="no"
DYN_COMP="-DDYNAMIC"

dnl
dnl set variables for linking
dnl
SHL_LD=""
TEST1EXPORTS=""
TEST2EXPORTS=""
TEST1EXP=""
TEST2EXP=""
REGINAEXP=""


# OTHER_INSTALLS is set to install a non-version numbered shared library
# by default; ie. no .\$(ABI) suffix. If the regina executable is not built, 
# then there is no shared library. Set OTHER_INSTALLS="installabilib" if you
# are building a version numbered shared library.
OTHER_INSTALLS="installlib"
BASE_INSTALL="installbase"
BASE_BINARY="binarybase"
USE_ABI="no"
BUNDLE=""
EXTRATARGET=""
AC_REQUIRE([AC_CANONICAL_SYSTEM])
case "$target" in
        *hp-hpux9*)
                SYS_DEFS="-D_HPUX_SOURCE"
                AC_DEFINE(SELECT_IN_TIME_H)
                ;;
        *hp-hpux*)
                SYS_DEFS="-D_HPUX_SOURCE"
                ;;
        *ibm-aix*)
                SYS_DEFS="-D_ALL_SOURCE -DAIX"
#                STATIC_LDFLAGS="-bnso -bI:/lib/syscalls.exp"
                ;;
        *dec-osf*)
                if test "$ac_cv_prog_CC" = "gcc"; then
                        SYS_DEFS="-D_POSIX_SOURCE -D_XOPEN_SOURCE"
                else
                        SYS_DEFS="-D_POSIX_SOURCE -D_XOPEN_SOURCE -Olimit 800"
                fi
                ;;
        sparc*sunos*)
                SYS_DEFS="-DSUNOS -DSUNOS_STRTOD_BUG"
                ;;
        *atheos*)
                BASE_BINARY="atheosbinary"
                ;;
        *beos*)
                BASE_INSTALL="beosinstall"
                BASE_BINARY="beosbinary"
                OTHER_INSTALLS=""
                ;;
        *nto-qnx*)
                ;;
        *qnx*)
                SHLPRE=""
                SHLPST=".lib"
                MODPST=".lib"
                # getting duplicate targets
                BUNDLE=".junk2"
                EEXTRA="-mf -N0x20000 -Q"
                LIBPRE=""
                LIBPST=".lib"
                ;;
        *cygwin*)
                LIBPRE="lib"
                SHLPRE=""
                LIBPST=".a"
                EXE=".exe"
                BASE_INSTALL="cygwininstall"
                BASE_BINARY="cygwinbinary"
                OTHER_INSTALLS=""
                ;;
        *apple-darwin*)
                # to test use: --build=ppc-apple-darwin10.1 --target=ppc-apple-darwin10.1
                #
                # Link switches for building "bundles"
                #
                OTHER_INSTALLS="installlib installmacosx"
                ;;
        *)
                ;;
esac
LD_RXLIB_A1="${LIBEXE} cr \$(@)"
LD_RXLIB_A2="${LIBEXE} cr \$(@)"
LD_RXLIB_B1=""
LD_RXLIB_B2=""
SHL_LD="${LIBEXE} cr ${SHLPRE}${SHLFILE}${SHLPST} \$(SHOFILES)"

STATICLIB="${LIBPRE}${LIBFILE}${LIBPST}"

LIBFLAGS="cr ${LIBPRE}${LIBFILE}${LIBPST}"
LIBLINK="-L. -l${LIBFILE}"
LINKSHL="-L. -l${LIBFILE}" # ensure we link to static library for execiser
DYN_COMP="$DYN_COMP -DDYNAMIC_STATIC"

SHL_BASE="${SHLPRE}${SHLFILE}${SHLPST}"
SHL_TARGETS="${SHL_BASE} ${SHLPRE}test1${MODPST} ${SHLPRE}test2${MODPST} regina${EXE} $EXTRATARGET"
EXECISER_DEP="${STATICLIB}"
OTHER_INSTALLS="regina${EXE} $OTHER_INSTALLS"
RANLIB_DYNAMIC="-\$(RANLIB) \$(@)"
dnl
dnl Settings for Regina test package
dnl
AC_ARG_WITH(testpackage,
    [     --with-testpackage   enable static linking with Regina test external function packages],
    [with_test=$withval],
    [with_testpackage=no],
)
MH_FUNC_LIBS=""
if test "$with_testpackage" = "yes"; then
   MH_FUNC_LIBS="$MH_FUNC_LIBS ${SHLPRE}test1${MODPST} ${SHLPRE}test2${MODPST}"
   AC_DEFINE(HAVE_TEST_PACKAGE)
   EXECISER_DEP="${EXECISER_DEP} ${SHLPRE}test1${MODPST} ${SHLPRE}test2${MODPST}"
fi
dnl
dnl Settings for Patrick McPhee's Regutil
dnl
AC_ARG_WITH(regutil,
    [     --with-regutil       enable static linking with RegUtil external function package],
    [with_regutil=$withval],
    [with_regutil=no],
)
if test "$with_regutil" = "yes"; then
        AC_CHECK_PROG(regutil_config, [regutil-config], yes, no)
        if test "$ac_cv_prog_regutil_config" = yes; then
           EXTRA_LIB=`regutil-config --libs`
           MH_FUNC_LIBS="$MH_FUNC_LIBS $EXTRA_LIB"
           AC_DEFINE(HAVE_REXXUTIL_PACKAGE)
        else
           AC_MSG_ERROR(regutil-config not found. Cannot use --with-regutil switch)
        fi
fi
dnl
dnl Settings for Rexx/Curses
dnl
AC_ARG_WITH(rexxcurses,
    [     --with-rexxcurses    enable static linking with Rexx/Curses external function package],
    [with_rexxcurses=$withval],
    [with_rexxcurses=no],
)
if test "$with_rexxcurses" = "yes"; then
        AC_CHECK_PROG(rxcurses_config, [rxcurses-config], yes, no)
        if test "$ac_cv_prog_rxcurses_config" = yes; then
           EXTRA_LIB=`rxcurses-config --libs`
           MH_FUNC_LIBS="$MH_FUNC_LIBS $EXTRA_LIB"
           AC_DEFINE(HAVE_REXXCURSES_PACKAGE)
        else
           AC_MSG_ERROR(rxcurses-config not found. Cannot use --with-rexxcurses switch)
        fi
fi
dnl
dnl Settings for Rexx/Tk
dnl
AC_ARG_WITH(rexxtk,
    [     --with-rexxtk        enable static linking with Rexx/Tk external function package],
    [with_rexxtk=$withval],
    [with_rexxtk=no],
)
if test "$with_rexxtk" = "yes"; then
        AC_CHECK_PROG(rexxtk_config, [rexxtk-config], yes, no)
        if test "$ac_cv_prog_rexxtk_config" = yes; then
           EXTRA_LIB=`rexxtk-config --libs`
           MH_FUNC_LIBS="$MH_FUNC_LIBS $EXTRA_LIB"
           AC_DEFINE(HAVE_REXXTK_PACKAGE)
        else
           AC_MSG_ERROR(rexxtk-config not found. Cannot use --with-rexxtk switch)
        fi
fi
dnl
dnl Settings for Rexx/Gd
dnl
AC_ARG_WITH(rexxgd,
    [     --with-rexxgd        enable static linking with Rexx/Gd external function package],
    [with_rexxgd=$withval],
    [with_rexxgd=no],
)
if test "$with_rexxgd" = "yes"; then
        AC_CHECK_PROG(rexxgd_config, [rexxgd-config], yes, no)
        if test "$ac_cv_prog_rexxgd_config" = yes; then
           EXTRA_LIB=`rexxgd-config --libs`
           MH_FUNC_LIBS="$MH_FUNC_LIBS $EXTRA_LIB"
           AC_DEFINE(HAVE_REXXGD_PACKAGE)
        else
           AC_MSG_ERROR(rexxgd-config not found. Cannot use --with-rexxgd switch)
        fi
fi
dnl
dnl Settings for Rexx/CURL
dnl
AC_ARG_WITH(rexxcurl,
    [     --with-rexxcurl      enable static linking with Rexx/CURL external function package],
    [with_rexxcurl=$withval],
    [with_rexxcurl=no],
)
if test "$with_rexxcurl" = "yes"; then
        AC_CHECK_PROG(rexxcurl_config, [rexxcurl-config], yes, no)
        if test "$ac_cv_prog_rexxcurl_config" = yes; then
           EXTRA_LIB=`rexxcurl-config --libs`
           MH_FUNC_LIBS="$MH_FUNC_LIBS $EXTRA_LIB"
           AC_DEFINE(HAVE_REXXCURL_PACKAGE)
        else
           AC_MSG_ERROR(rexxcurl-config not found. Cannot use --with-rexxcurl switch)
        fi
fi
dnl
dnl Settings for Rexx/SQL
dnl
AC_ARG_WITH(rexxsql,
    [     --with-rexxsql       enable static linking with Rexx/SQL external function package],
    [with_rexxsql=$withval],
    [with_rexxsql=no],
)
if test "$with_rexxsql" = "yes"; then
        AC_CHECK_PROG(rexxsql_config, [rexxsql-config], yes, no)
        if test "$ac_cv_prog_rexxsql_config" = yes; then
           EXTRA_LIB=`rexxsql-config --libs`
           MH_FUNC_LIBS="$MH_FUNC_LIBS $EXTRA_LIB"
           AC_DEFINE(HAVE_REXXSQL_PACKAGE)
        else
           AC_MSG_ERROR(rexxsql-config not found. Cannot use --with-rexxsql switch)
        fi
fi
dnl
dnl Settings for Rexx/ISAM
dnl
AC_ARG_WITH(rexxisam,
    [     --with-rexxisam      enable static linking with Rexx/ISAM external function package],
    [with_rexxisam=$withval],
    [with_rexxisam=no],
)
if test "$with_rexxisam" = "yes"; then
        AC_CHECK_PROG(rexxisam_config, [rexxisam-config], yes, no)
        if test "$ac_cv_prog_rexxisam_config" = yes; then
           EXTRA_LIB=`rexxisam-config --libs`
           MH_FUNC_LIBS="$MH_FUNC_LIBS $EXTRA_LIB"
           AC_DEFINE(HAVE_REXXISAM_PACKAGE)
        else
           AC_MSG_ERROR(rexxisam-config not found. Cannot use --with-rexxisam switch)
        fi
fi
dnl
dnl Settings for RxSock
dnl
AC_ARG_WITH(rxsock,
    [     --with-rxsock        enable static linking with RxSock external function package],
    [with_rxsock=$withval],
    [with_rxsock=no],
)
if test "$with_rxsock" = "yes"; then
        AC_CHECK_PROG(rxsock_config, [rxsock-config], yes, no)
        if test "$ac_cv_prog_rxsock_config" = yes; then
           EXTRA_LIB=`rxsock-config --libs`
           MH_FUNC_LIBS="$MH_FUNC_LIBS $EXTRA_LIB"
           AC_DEFINE(HAVE_REXXISAM_PACKAGE)
        else
           AC_MSG_ERROR(rxsock-config not found. Cannot use --with-rxsock switch)
        fi
fi
dnl
dnl Settings for Rexx/DW
dnl
AC_ARG_WITH(rexxdw,
    [     --with-rexxdw        enable static linking with Rexx/DW external function package],
    [with_rexxdw=$withval],
    [with_rexxdw=no],
)
if test "$with_rexxdw" = "yes"; then
        AC_CHECK_PROG(rexxdw_config, [rexxdw-config], yes, no)
        if test "$ac_cv_prog_rexxdw_config" = yes; then
           EXTRA_LIB=`rexxdw-config --libs`
           MH_FUNC_LIBS="$MH_FUNC_LIBS $EXTRA_LIB"
           AC_DEFINE(HAVE_REXXDW_PACKAGE)
        else
           AC_MSG_ERROR(rexxdw-config not found. Cannot use --with-rexxdw switch)
        fi
fi

LINKREG="${SHLPRE}${SHLFILE}${SHLPST} ${MH_FUNC_LIBS} ${SHLPRE}${SHLFILE}${SHLPST}"

AC_SUBST(BASE_BINARY)
AC_SUBST(BASE_INSTALL)
AC_SUBST(BOTHLIBS)
AC_SUBST(CC2O)
AC_SUBST(CEXTRA)
AC_SUBST(DYNAMIC_LDFLAGS)
AC_SUBST(DYN_COMP)
AC_SUBST(EEXTRA)
AC_SUBST(EXE)
AC_SUBST(EXECISER_DEP)
AC_SUBST(GETOPT)
AC_SUBST(LD_RXLIB_A1)
AC_SUBST(LD_RXLIB_A2)
AC_SUBST(LD_RXLIB_B1)
AC_SUBST(LD_RXLIB_B2)
AC_SUBST(LIBEXE)
AC_SUBST(LIBFILE)
AC_SUBST(LIBFLAGS)
AC_SUBST(LIBLINK)
AC_SUBST(LINKSHL)
AC_SUBST(LIBPRE)
AC_SUBST(LIBPST)
AC_SUBST(LINKREG)
AC_SUBST(O2SAVE)
AC_SUBST(O2SHO)
AC_SUBST(OBJ)
AC_SUBST(OBJECTS)
AC_SUBST(OSAVE)
AC_SUBST(OTHER_INSTALLS)
AC_SUBST(REGINAEXP)
AC_SUBST(SAVE2O)
AC_SUBST(SHLFILE)
AC_SUBST(SHLIBS)
AC_SUBST(SHLPRE)
AC_SUBST(BUNDLE)
AC_SUBST(SHL_LD)
AC_SUBST(SHL_TARGETS)
AC_SUBST(STATICLIB)
AC_SUBST(STATIC_LDFLAGS)
AC_SUBST(TEST1EXP)
AC_SUBST(TEST1EXPORTS)
AC_SUBST(TEST2EXP)
AC_SUBST(TEST2EXPORTS)
AC_SUBST(USE_ABI)
AC_SUBST(RANLIB_DYNAMIC)

])