File: acinclude.m4

package info (click to toggle)
gambas3 3.20.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 76,984 kB
  • sloc: ansic: 197,178; cpp: 124,076; sh: 18,999; javascript: 7,761; sql: 5,399; makefile: 2,354; perl: 1,397; xml: 490; python: 335
file content (1831 lines) | stat: -rw-r--r-- 47,813 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
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
#######################################################################################
##
##   The following macros are specific to Gambas.
##   Some of them are made by me (Benoît Minisini)
##   Feel free to use these macros as you need !
##
##   IMPORTANT: This file is shared by all Gambas
##   source packages
##
#######################################################################################

## ---------------------------------------------------------------------------
## GB_MESSAGE
## Prints a message, and stores it in a summay file to print it later
## ---------------------------------------------------------------------------

AC_DEFUN([GB_MESSAGE],
[
  echo "|| $1" >> $srcdir/warnings.log
])

## ---------------------------------------------------------------------------
## GB_MESSAGE
## Prints a warning message, and stores it in a summay file to print it later
## ---------------------------------------------------------------------------

AC_DEFUN([GB_WARNING],
[
  AC_MSG_WARN($1)
  GB_MESSAGE([$1])
])

## ---------------------------------------------------------------------------
## GB_CLEAR_MESSAGES
## Clear summary
## ---------------------------------------------------------------------------

AC_DEFUN([GB_CLEAR_MESSAGES],
[
  rm -f $srcdir/warnings.log
  touch $srcdir/warnings.log
])

## ---------------------------------------------------------------------------
## GB_PRINT_MESSAGES
## Print summary
## ---------------------------------------------------------------------------

AC_DEFUN([GB_PRINT_MESSAGES],
[
  if test -s $srcdir/warnings.log; then
    echo
    echo "||"
    cat $srcdir/warnings.log
    echo "||"
    echo
  fi
  
  rm -f $srcdir/warnings.log.before;
  
  if test -e FAILED && test "x${GAMBAS_CONFIG_FAILURE}" != "x"; then
     AC_MSG_ERROR([Failed to configure $3])
  fi
])

## ---------------------------------------------------------------------------
## GB_INIT_AUTOMAKE
## automake initialization with common version number
## ---------------------------------------------------------------------------

AC_DEFUN([GB_INIT_AUTOMAKE],
[
  AM_INIT_AUTOMAKE([subdir-objects])
  m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)])
  AC_CONFIG_HEADERS([config.h])
  AC_PREFIX_DEFAULT(/usr)
  MAKEFLAGS=--silent
  AC_SUBST(MAKEFLAGS)

  GAMBAS_VERSION=GB_VERSION_MAJOR
  GAMBAS_MINOR_VERSION=GB_VERSION_MINOR

  AC_SUBST(GAMBAS_VERSION)
  AC_SUBST(GAMBAS_MINOR_VERSION)

  AC_DEFINE(GAMBAS_VERSION, GB_VERSION_MAJOR, Gambas version)
  AC_DEFINE(GAMBAS_MINOR_VERSION, GB_VERSION_MINOR, Gambas minor version)

  AC_DEFINE(GAMBAS_VERSION_STRING, "GB_VERSION_MAJOR", Gambas version string)
  AC_DEFINE(GAMBAS_FULL_VERSION_STRING, "GB_VERSION_MAJOR.GB_VERSION_MINOR", Gambas full version string)

  AC_DEFINE(GAMBAS_FULL_VERSION, GB_VERSION_FULL, [Full Gambas version])
  AC_DEFINE(GAMBAS_PCODE_VERSION, GB_PCODE_VERSION, [Gambas bytecode version])
  AC_DEFINE(GAMBAS_PCODE_VERSION_MIN, GB_PCODE_VERSION_MIN, [Minimum Gambas bytecode version])

  GB_CLEAR_MESSAGES
])

## ---------------------------------------------------------------------------
## GB_TRUNK_VERSION
## detect version and branch (svn and git supported)
## ---------------------------------------------------------------------------

AC_DEFUN([GB_TRUNK_VERSION],
[
  gb_detect_git=`which git 2> /dev/null`
  gb_vcs_hash=""
  gb_vcs_branch=""
  gb_vcs_version=""

  AC_MSG_CHECKING(for vcs revision)

  if test "x${gb_detect_git}" != "x"; then
    gb_vcs_branch=`git rev-parse --abbrev-ref HEAD 2> /dev/null`
    gb_vcs_hash=`git rev-parse --short HEAD 2> /dev/null`
  else
    gb_detect_svn=`which svn 2> /dev/null`
      if test "x${gb_detect_svn}" != "x"; then
        gb_vcs_hash=`svn info --show-item last-changed-revision 2> /dev/null`
      fi
  fi

  if test "x${gb_vcs_branch}" != "x"; then
    gb_vcs_version="${gb_vcs_hash} (${gb_vcs_branch})"
  else
    if test "x${gb_vcs_hash}" != "x"; then
      gb_vcs_version="r${gb_vcs_hash}"
    fi
  fi

  if test "x${gb_vcs_version}" != "x"; then
    AC_DEFINE_UNQUOTED(TRUNK_VERSION, "${gb_vcs_version}", [vcs revision])
    AC_MSG_RESULT([$gb_vcs_version])
  else
    AC_MSG_RESULT(not found)
  fi
])

## ---------------------------------------------------------------------------
## GB_CONFIG_SUBDIRS
## configuration of a component sub-directory, with a flag for disabling it
## ---------------------------------------------------------------------------

AC_DEFUN([GB_CONFIG_SUBDIRS],
[
  AC_ARG_ENABLE(
    $1,
    [  --enable-$1                enable $1 component (default: yes)],
    gb_enable_$1=$enableval,
    gb_enable_$1=yes
  )

  if test "$gb_enable_$1" = "yes"; then
    if test -d $srcdir/$2; then
      AC_CONFIG_SUBDIRS($2)
      $1_dir=$2
    fi
  else
    GB_WARNING([$1 component is disabled by configure option])
    $1_dir=""
  fi

  AC_SUBST($1_dir)
])

## ---------------------------------------------------------------------------
## GB_INIT_SHORT GB_INIT GB_LIBTOOL
## configure.ac initialization
## ---------------------------------------------------------------------------

AC_DEFUN([GB_INIT_SHORT],
[
  AC_CONFIG_SRCDIR([configure.ac])
  AM_MAINTAINER_MODE

  COMPONENT=$1

  GB_INIT_AUTOMAKE

  AC_CANONICAL_HOST

  gbbindir=$bindir/gambas$GAMBAS_VERSION
  AC_SUBST(gbbindir)
  gblibdir=$libdir/gambas$GAMBAS_VERSION
  AC_SUBST(gblibdir)
  gbdatadir=$datadir/gambas$GAMBAS_VERSION
  AC_SUBST(gbdatadir)

  AC_PROG_INSTALL
  AC_PROG_LN_S
])

AC_DEFUN([GB_LIBTOOL],
[
  dnl AC_LIBTOOL_DLOPEN
  dnl AC_LIBTOOL_WIN32_DLL
  AC_DISABLE_STATIC

  AC_SUBST(INCLTDL)
  AC_SUBST(LIBLTDL)

  dnl LD_FLAGS="-Wl,-O1"
  if test $SYSTEM == "CYGWIN"; then
    LD_FLAGS="$LD_FLAGS -no-undefined"
  fi
  AC_SUBST(LD_FLAGS)

  AM_LIBTOOLFLAGS="--silent"
  AC_SUBST(AM_LIBTOOLFLAGS)
])

AC_DEFUN([GB_INIT],
[
  GB_INIT_SHORT($1)
  GB_SYSTEM
  GB_LIBTOOL

  dnl ---- Checks for headers needed by the following tests

  AC_CHECK_HEADERS(unistd.h)
  
  dnl ---- Checks for header files.

  dnl AC_HEADER_DIRENT
  dnl AC_HEADER_SYS_WAIT

  dnl ---- Checks for typedefs, structures, and compiler characteristics.

  dnl AC_C_CONST
  dnl AC_TYPE_PID_T
  dnl AC_TYPE_SIZE_T
  dnl AC_CHECK_HEADERS_ONCE([sys/time.h])

  dnl AC_STRUCT_TM

  AC_TYPE_LONG_DOUBLE_WIDER
  ac_cv_c_long_double=$ac_cv_type_long_double_wider
  if test $ac_cv_c_long_double = yes; then
    AC_DEFINE([HAVE_LONG_DOUBLE],[1],[Define to 1 if the type `long double' works and has more range or
    precision than `double'.])
  fi

  dnl ---- Checks for library functions.

  dnl AC_FUNC_ALLOCA
  dnl AC_PROG_GCC_TRADITIONAL
  dnl AC_FUNC_STRCOLL
  dnl AC_FUNC_STRFTIME
  dnl AC_FUNC_VPRINTF
  dnl AC_FUNC_WAIT3
  dnl AC_CHECK_FUNCS(getcwd gettimeofday mkdir rmdir select socket strdup strerror strtod strtol sysinfo)

  AC_CHECK_FUNCS(setenv unsetenv getdomainname getpt cfmakeraw fstatat)

  dnl ---- Checks for libraries

  dnl AC_CHECK_LIB(m, main, echo)
  dnl AC_CHECK_LIB(z, main, echo)

  GB_LIBC

  dnl ---- Check for C++ libraries
  
  AC_CHECK_LIB(gcc_s, main, CXX_LIB="$CXX_LIB -lgcc_s")
  AC_CHECK_LIB(stdc++, main, CXX_LIB="$CXX_LIB -lstdc++")

  AC_SUBST(CXX_LIB)

  dnl ---- Check for shared library extension

  GB_SHARED_LIBRARY_EXT()

  dnl ---- Check for threading

  GB_THREAD()

  dnl ---- Check for mathematic libraries

  GB_MATH()

  dnl ---- Check for gettext library

  GB_GETTEXT()
  
  dnl ---- Check for inotify library

  GB_INOTIFY()

  dnl ---- Check for internationalization library

  GB_INTL()

  dnl ---- Check for charset conversion library

  GB_ICONV()

  dnl ---- Check for monotonic clock
  
  GB_MONOTONIC()
  
  dnl ---- Support for colorgcc
  dnl ---- WARNING: libtool does not support colorgcc!

  dnl AC_PATH_PROG(COLORGCC, colorgcc)

  if test x"$COLORGCC" != x; then
    if test "$gambas_colorgcc" = "yes"; then
      CC="colorgcc"
      CXX="g++"
    fi
  fi

  dnl ---- Support for ccache

  AC_ARG_ENABLE(
    ccache,
    [  --enable-ccache                use ccache if present (default: yes)],
    gambas_ccache=$enableval,
    gambas_ccache=yes
  )

  AC_PATH_PROG(CCACHE, ccache)

  if test "$gambas_colorgcc" = "yes"; then
    if test x"$CCACHE" != x; then

      CC="ccache $CC"
      CXX="ccache $CXX"

      if test x"$COLORGCC" != x; then
        if test "$gambas_colorgcc" = "yes"; then
          CC="colorgcc"
          CXX="colorgcc"
        fi
      fi

    fi
  fi

  dnl ---- debug option

  AC_ARG_ENABLE(
    debug,
    [  --enable-debug                 compile for debugging (default: yes)],
    gambas_debug=$enableval,
    gambas_debug=yes
  )

  AM_CONDITIONAL(DEBUG, test "$gambas_debug" = yes)

  dnl ---- optimization option

  AC_ARG_ENABLE(
    optimization,
    [  --enable-optimization          compile with optimizations (default: yes)],
    gambas_optimization=$enableval,
    gambas_optimization=yes
  )

  AM_CONDITIONAL(OPTIMIZE, test "$gambas_optimization" = yes)

  AM_CFLAGS="$AM_CFLAGS -pipe -Wall -Wno-unused-value -fsigned-char"
  if test $SYSTEM = "MACOSX"; then
    AM_CFLAGS="$AM_CFLAGS -fnested-functions"
  fi

  AM_CXXFLAGS="$AM_CXXFLAGS -pipe -Wall -fno-exceptions -Wno-unused-value -fsigned-char"

  dnl ---- Check for gcc visibility flag

  have_gcc_visibility=no

  if test $SYSTEM != "CYGWIN"; then
    GB_CFLAGS_GCC_OPTION([-fvisibility=hidden],,
      [
      AM_CFLAGS="$AM_CFLAGS -fvisibility=hidden"
      AM_CXXFLAGS="$AM_CXXFLAGS -fvisibility=hidden"
      have_gcc_visibility=yes])
  fi

  if test "$have_gcc_visibility" = "yes"; then
    AC_DEFINE(HAVE_GCC_VISIBILITY, 1, [Whether gcc supports -fvisibility=hidden])
  fi

  dnl ---- check for -fcf-protection=return compiler flag

  have_gcc_nocte=no

  GB_CFLAGS_GCC_OPTION([-fcf-protection=return],,
    [
      GB_CFLAGS_NOCTE=" -fcf-protection=return"
      have_gcc_nocte=yes
    ])

  dnl ---- check for -flto compiler flag
  
  GB_CFLAGS_GCC_OPTION([-flto],,
    [
      GB_CFLAGS_LTO=" -flto"
      have_gcc_lto=yes
    ])
  
  AC_ARG_ENABLE(
    lto,
    [  --enable-lto                   enable link time optimization (default: no)],
    gambas_lto=$enableval,
    gambas_lto=no
  )
  
  if test "$gambas_lto" = "no"; then
    have_gcc_lto=no;
    GB_CFLAGS_LTO="";
  fi
  
  if test "$have_gcc_lto" = "yes"; then
    AC_DEFINE(HAVE_GCC_LTO, 1, [Whether gcc supports -flto])
  fi
  
  dnl ---- check for -std=c++11 compiler flag
  
  GB_CXXFLAGS_GCC_OPTION([-std=c++11],,
    [
      GB_CXXFLAGS_STD_CPP11=" -std=c++11"
      have_gcc_std_cpp11x=yes
    ])
  
  if test "$have_gcc_std_cpp11" = "yes"; then
    AC_DEFINE(HAVE_GCC_STD_CPP11, 1, [Whether g++ supports -std=c++11])
  fi
  
  dnl ---- check for -std=c++17 compiler flag
  
  GB_CXXFLAGS_GCC_OPTION([-std=c++17],,
    [
      GB_CXXFLAGS_STD_CPP17=" -std=c++17"
      have_gcc_std_cpp17x=yes
    ])
  
  if test "$have_gcc_std_cpp17" = "yes"; then
    AC_DEFINE(HAVE_GCC_STD_CPP17, 1, [Whether g++ supports -std=c++17])
  fi
  
  dnl ---- check for -std=c++20 compiler flag

  GB_CXXFLAGS_GCC_OPTION([-std=c++20],,
    [
      GB_CXXFLAGS_STD_CPP20=" -std=c++20"
      have_gcc_std_cpp20x=yes
    ])

  if test "$have_gcc_std_cpp20" = "yes"; then
    AC_DEFINE(HAVE_GCC_STD_CPP20, 1, [Whether g++ supports -std=c++20])
  fi

  dnl ---- Debug flags

  if test "$gambas_debug" = "yes"; then
    AM_CFLAGS="$AM_CFLAGS -g -ggdb"
    AM_CXXFLAGS="$AM_CXXFLAGS -g -ggdb"
  fi

  dnl ---- Optimization flags

  if test "x$gambas_optimization" = "xyes"; then
    AM_CFLAGS_OPT="$AM_CFLAGS -O3"
    AM_CFLAGS="$AM_CFLAGS -O2"
    AM_CXXFLAGS_OPT="$AM_CXXFLAGS -O3 -fno-omit-frame-pointer"
    AM_CXXFLAGS="$AM_CXXFLAGS -O2 -fno-omit-frame-pointer"
  else
    AM_CFLAGS_OPT="$AM_CFLAGS -O0"
    AM_CFLAGS="$AM_CFLAGS -O0"
    AM_CXXFLAGS_OPT="$AM_CXXFLAGS -O0"
    AM_CXXFLAGS="$AM_CXXFLAGS -O0"
  fi

  dnl ---- Checks for programs

  save_CFLAGS=$CFLAGS
  AC_PROG_CPP
  AC_PROG_CXX
  AC_PROG_CC
  AC_PROG_MAKE_SET
  CFLAGS=$save_CFLAGS

  AC_SUBST(AM_CFLAGS)
  AC_SUBST(AM_CFLAGS_OPT)
  AC_SUBST(AM_CXXFLAGS)
  AC_SUBST(AM_CXXFLAGS_OPT)
  AC_SUBST(GB_CFLAGS_LTO)
  AC_SUBST(GB_CFLAGS_NOCTE)
  AC_SUBST(GB_CXXFLAGS_STD_CPP11)
  AC_SUBST(GB_CXXFLAGS_STD_CPP17)
  AC_SUBST(GB_CXXFLAGS_STD_CPP20)

  rm -f DISABLED DISABLED.* FAILED
])


## ---------------------------------------------------------------------------
## GB_THREAD
## Detect threading compiler options
## ---------------------------------------------------------------------------

AC_DEFUN([GB_THREAD],
[
  case "${host}" in
    *-*-freebsd* | *-*-netbsd* | *-*-darwin* )
      THREAD_LIB=""
      THREAD_INC="-pthread -D_REENTRANT"
      GBX_THREAD_LIB=""
      GBX_THREAD_INC="-pthread -D_REENTRANT"
      GBX_THREAD_LDFLAGS=""
      ;;
    *-*-haiku* )
      THREAD_LIB=""
      THREAD_INC=""
      GBX_THREAD_LIB=""
      GBX_THREAD_INC=""
      GBX_THREAD_LDFLAGS=""
      ;;
    *)
      THREAD_LIB="-lpthread"
      THREAD_INC="-D_REENTRANT"
      GBX_THREAD_LIB="-lpthread"
      GBX_THREAD_INC="-D_REENTRANT"
      GBX_THREAD_LDFLAGS="-Wl,--no-as-needed"
      ;;
  esac

  AC_MSG_CHECKING(for threading compiler options)
  AC_MSG_RESULT($THREAD_INC)
  AC_MSG_CHECKING(for threading linker options)
  AC_MSG_RESULT($THREAD_LIB)

  AC_SUBST(THREAD_LIB)
  AC_SUBST(THREAD_INC)
  AC_SUBST(GBX_THREAD_LIB)
  AC_SUBST(GBX_THREAD_INC)
  AC_SUBST(GBX_THREAD_LDFLAGS)
])


## ---------------------------------------------------------------------------
## GB_LIBC
## Detect C library
## ---------------------------------------------------------------------------

AC_DEFUN([GB_LIBC],
[
  case "${host}" in
    *-*-haiku* )
      dnl Haiku has implicit C library in libroot.
      C_LIB=""
      ;;
    *)
      C_LIB="-lc"
      ;;
  esac

  AC_MSG_CHECKING(for C library)
  AC_MSG_RESULT($C_LIB)

  AC_SUBST(C_LIB)
])


## ---------------------------------------------------------------------------
## GB_MATH
## Detect mathematic libraries
## ---------------------------------------------------------------------------

AC_DEFUN([GB_MATH],
[
  case "${host}" in
    *-*-haiku* )
      MATH_LIB=""
      ;;
    *)
      MATH_LIB="-lm"
      ;;
  esac

  AC_MSG_CHECKING(for mathematic libraries)
  AC_MSG_RESULT($MATH_LIB)

  AC_SUBST(MATH_LIB)
])


## ---------------------------------------------------------------------------
## GB_CHECK_MATH_FUNC
## Check a specific mathematical function
##
##   $1 = name of the function
##   $2 = macro to define
## ---------------------------------------------------------------------------

AC_DEFUN([GB_CHECK_MATH_FUNC],
[AC_CACHE_CHECK(for $1,
  gb_cv_math_$1,
  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
      #define _ISOC9X_SOURCE	1
      #define _ISOC99_SOURCE	1
      #define _GNU_SOURCE	1
      #define __USE_ISOC99	1
      #define __USE_ISOC9X	1
      #include <math.h>
    ]], [[
      int value = $1 (1.0);
    ]])],[gb_cv_math_$1=yes],[gb_cv_math_$1=no
    ])])
  
  if test $gb_cv_math_$1 = yes; then
    AC_DEFINE(HAVE_$2, 1, [Define if you have $1 function.])
  fi
])

## ---------------------------------------------------------------------------
## GB_MATH_FUNC
## Detect which mathematical functions are available
## ---------------------------------------------------------------------------

AC_DEFUN([GB_MATH_FUNC],
[
  ac_save_LDFLAGS="$LDFLAGS"
  LDFLAGS="$LDFLAGS -$MATH_LIB"

  GB_CHECK_MATH_FUNC(exp10, EXP10)
  GB_CHECK_MATH_FUNC(exp2, EXP2)
  GB_CHECK_MATH_FUNC(log2, LOG2)

  LDFLAGS=$ac_save_LDFLAGS
])


## ---------------------------------------------------------------------------
## GB_SYSTEM
## Detects the target system and its architecture
## ---------------------------------------------------------------------------

AC_DEFUN([GB_SYSTEM],
[
  AC_MSG_CHECKING(target system)

  case "${host}" in
    *-*-linux*-gnu* )
      SYSTEM=LINUX
      AC_DEFINE(OS_GNU, 1, [Target system is of GNU family])
      AC_DEFINE(OS_LINUX, 1, [Target system is Linux])
      AC_DEFINE(SYSTEM, "Linux", [Operating system])
      ;;
    *-*-linux* )
      SYSTEM=LINUX
      AC_DEFINE(OS_LINUX, 1, [Target system is Linux])
      AC_DEFINE(SYSTEM, "Linux", [Operating system])
      ;;
    *-*-freebsd* )
      SYSTEM=FREEBSD
      AC_DEFINE(OS_BSD, 1, [Target system is of BSD family])
      AC_DEFINE(OS_FREEBSD, 1, [Target system is FreeBSD])
      AC_DEFINE(SYSTEM, "FreeBSD", [Operating system])
      ;;
    *-*-netbsd* )
      SYSTEM=NETBSD
      AC_DEFINE(OS_BSD, 1, [Target system is of BSD family])
      AC_DEFINE(OS_NETBSD, 1, [Target system is NetBSD])
      AC_DEFINE(SYSTEM, "NetBSD", [Operating system])
      ;;
    *-*-openbsd* )
      SYSTEM=OPENBSD
      AC_DEFINE(OS_BSD, 1, [Target system is of BSD family])
      AC_DEFINE(OS_OPENBSD, 1, [Target system is OpenBSD])
      AC_DEFINE(SYSTEM, "OpenBSD", [Operating system])
      ;;
    *-*-cygwin* )
      SYSTEM=CYGWIN
      AC_DEFINE(OS_CYGWIN, 1, [Target system is Cygwin/Windows])
      AC_DEFINE(SYSTEM, "Cygwin", [Operating system])
      ;;
    *-*-darwin* | *-*-rhapsody* )
      SYSTEM=MACOSX
      AC_DEFINE(OS_BSD, 1, [Target system is of BSD family])
      AC_DEFINE(OS_FREEBSD, 1, [Target system is FreeBSD])
      AC_DEFINE(OS_MACOSX, 1, [Target system is MacOS X])
      AC_DEFINE(SYSTEM, "MacOSX", [Operating system])
      ;;
    *-*-solaris* )
      SYSTEM=SOLARIS
      AC_DEFINE(OS_SOLARIS, 1, [Target system is Solaris])
      AC_DEFINE(SYSTEM, "Solaris", [Operating system])
      ;;
    *-*-k*bsd*-gnu* )
      SYSTEM=KFREEBSD
      AC_DEFINE(OS_BSD, 1, [Target system is of BSD family])
      AC_DEFINE(OS_GNU, 1, [Target system is of GNU family])
      AC_DEFINE(OS_KFREEBSD, 1, [Target system is kFREEBSD])
      AC_DEFINE(SYSTEM, "kFreeBSD", [Operating system])
      ;;
    *-gnu* )
      SYSTEM=HURD
      AC_DEFINE(OS_GNU, 1, [Target system is of GNU family])
      AC_DEFINE(OS_HURD, 1, [Target system is Hurd])
      AC_DEFINE(SYSTEM, "Hurd", [Operating system])
      ;;
    *-*-haiku* )
      SYSTEM=HAIKU
      dnl AC_DEFINE(OS_GNU, 1, [Target system is of GNU family])
      AC_DEFINE(OS_HAIKU, 1, [Target system is Haiku])
      AC_DEFINE(SYSTEM, "Haiku", [Operating system])
      ;;      
    * )
      SYSTEM=UNKNOWN
      AC_DEFINE(SYSTEM, "unknown", [Operating system])
      GB_MESSAGE([System is unknown])
      ;;
  esac

  AC_MSG_RESULT($SYSTEM)

  AC_MSG_CHECKING(target architecture)

  case "${host}" in
    i*86-*-* )
      ARCH=X86
      AC_DEFINE(ARCH_X86, 1, [Target architecture is x86])
      AC_DEFINE(ARCHITECTURE, "x86", [Architecture])
      ;;
    x86_64-*-* | amd64-* | ia64-* )
      ARCH=X86_64
      AC_DEFINE(ARCH_X86_64, 1, [Target architecture is x86_64])
      AC_DEFINE(ARCHITECTURE, "x86_64", [Architecture])
      ;;
    arm*-*-* )
      ARCH=ARM
      AC_DEFINE(ARCH_ARM, 1, [Target architecture is ARM])
      AC_DEFINE(ARCHITECTURE, "arm", [Architecture])
      ;;
    aarch64*-*-* )
      ARCH=AARCH64
      AC_DEFINE(ARCH_AARCH64, 1, [Target architecture is AARCH64])
      AC_DEFINE(ARCHITECTURE, "aarch64", [Architecture])
      ;;
    powerpc*-*-* )
      ARCH=PPC
      AC_DEFINE(ARCH_PPC, 1, [Target architecture is PowerPC])
      AC_DEFINE(ARCHITECTURE, "powerpc", [Architecture])
      ;;
    e2k-*-* )
      ARCH=E2K
      AC_DEFINE(ARCH_E2K, 1, [Target architecture is e2k])
      AC_DEFINE(ARCHITECTURE, "e2k", [Architecture])
      ;;
    *)
      ARCH=UNKNOWN
      AC_DEFINE(ARCHITECTURE, "unknown", [Architecture])
      GB_MESSAGE([Architecture is unknown])
      ;;
  esac

  AC_MSG_RESULT($ARCH)
])


## ---------------------------------------------------------------------------
## GB_SHARED_LIBRARY_EXT
## Detects shared library extension
## ---------------------------------------------------------------------------

AC_DEFUN([GB_SHARED_LIBRARY_EXT],
[
  AC_MSG_CHECKING(which extension is used for shared libraries)

  case "${host}" in
    *-*-cygwin* )
      SHLIBEXT="dll.a"
      AC_DEFINE(SHARED_LIBRARY_EXT, "dll", [Shared library extension is '.dll.a'])
      ;;
    *-*-darwin* )
      SHLIBEXT="dylib"
      AC_DEFINE(SHARED_LIBRARY_EXT, "dylib", [Shared library extension is '.dylib'])
      ;;
    *)
      SHLIBEXT="so"
      AC_DEFINE(SHARED_LIBRARY_EXT, "so", [Shared library extension is '.so'])
      ;;
  esac

  AC_SUBST(SHLIBEXT)

  AC_MSG_RESULT([.$SHLIBEXT])
])


## ---------------------------------------------------------------------------
## GB_GETTEXT
## Detects if we must link to an external gettext library
## ---------------------------------------------------------------------------

AC_DEFUN([GB_GETTEXT],
[
  AC_MSG_CHECKING(for external gettext library)

  case "${host}" in
    *-*-openbsd* )
      GETTEXT_LIB=-llibgettext
      ;;
    *)
      GETTEXT_LIB=
      ;;
  esac

  AC_SUBST(GETTEXT_LIB)
  AC_SUBST(GETTEXT_LDFLAGS)

  AC_MSG_RESULT($GETTEXT_LIB)
])


## ---------------------------------------------------------------------------
## GB_INOTIFY
## Detects if we must link to an external inotify library
## ---------------------------------------------------------------------------

AC_DEFUN([GB_INOTIFY],
[
  AC_MSG_CHECKING(for external inotify library)

  case "${host}" in
    *-*-linux* )
      GB_INOTIFY_LIB=
      ;;
    *)
      GB_INOTIFY_LIB=-linotify
      ;;
  esac

  AC_SUBST(GB_INOTIFY_LIB)
  AC_MSG_RESULT($GB_INOTIFY_LIB)
])


## ---------------------------------------------------------------------------
## GB_INTL
## Detects if we must link to an external internationalization library
## ---------------------------------------------------------------------------

AC_DEFUN([GB_INTL],
[
  AC_MSG_CHECKING(for external internationalization library)

  case "${host}" in
    *-musl)
      GB_INTL_LIB=-lintl
      ;;
    *)
      GB_INTL_LIB=
      ;;
  esac

  AC_SUBST(GB_INTL_LIB)
  AC_MSG_RESULT($GB_INTL_LIB)
])


## ---------------------------------------------------------------------------
## GB_ICONV
## Detects if we must link to an external charset conversion library
## ---------------------------------------------------------------------------

AC_DEFUN([GB_ICONV],
[
  AC_MSG_CHECKING(for external charset conversion library)

  case "${host}" in
    *)
      GB_ICONV_LIB=
      ;;
  esac

  AC_SUBST(GB_ICONV_LIB)
  AC_MSG_RESULT($GB_ICONV_LIB)
])


## ---------------------------------------------------------------------------
## GB_MONOTONIC
## Detect monotonic clock
## ---------------------------------------------------------------------------

AC_DEFUN([GB_MONOTONIC],
[
  AC_CACHE_CHECK(for monotonic clock, gb_cv_monotonic_clock,
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
        #include <time.h>
        #ifdef HAVE_UNISTD_H
        #include <unistd.h>
        #endif
      ]], [[
        #if !defined(_POSIX_MONOTONIC_CLOCK) || _POSIX_MONOTONIC_CLOCK < 0 || !defined(CLOCK_MONOTONIC)
        #error Either _POSIX_MONOTONIC_CLOCK or CLOCK_MONOTONIC not defined
        #endif
      ]])],[
         gb_cv_monotonic_clock=yes
       ],[
         gb_cv_monotonic_clock=no
       ])
    )
   
  if test "$gb_cv_monotonic_clock" = "yes"; then
  
    AC_DEFINE(HAVE_MONOTONIC_CLOCK,1,[Have a monotonic clock])
    
    ac_save_LIBS="$LIBS"
    AC_SEARCH_LIBS(clock_gettime, rt)
    RT_LIB=$LIBS
    LIBS=$ac_save_LIBS
    
  fi
  
  AC_SUBST(RT_LIB)
  AC_SUBST(RT_LDFLAGS)
])




## ---------------------------------------------------------------------------
## GB_FIND
## Find files in directories
##
##   $1 = Files to search
##   $2 = Directories
##   $3 = Sub-directories patterns
##
##   Returns a path list in $gb_val
## ---------------------------------------------------------------------------

AC_DEFUN([GB_FIND],
[
dnl echo "Searching $1, $2, $3"
gb_val=""
gb_save=`pwd`
gb_file_list="$1"

gb_main_dir_list="$2"
gb_sub_dir_list="$3"

gb_sub_dir_list_64=`echo "$gb_sub_dir_list" | sed s/"lib"/"lib64"/g`

if test $SYSTEM == "HAIKU"; then
  gb_arch="`getarch`"
  gb_main_dir_list="$gb_main_dir_list `findpaths -c' ' -a "$gb_arch" B_FIND_PATH_DEVELOP_DIRECTORY`"
  gb_arch_inc_subdir=headers
  gb_arch_lib_subdir=lib
  if test "$gb_arch" != "`getarch -p`"; then
    gb_arch_inc_subdir="headers/$gb_arch"
    gb_arch_lib_subdir="lib/$gb_arch"
  fi
  gb_sub_dir_list=`echo "$gb_sub_dir_list" | sed "s:include:$gb_arch_inc_subdir:g;s:lib:$gb_arch_lib_subdir:g"`
fi

## if there is 'lib' inside sub-directories, then we decide to search "lib64" first.

if test "$gb_sub_dir_list_64" != "$gb_sub_dir_list"; then
  gb_sub_dir_list="$gb_sub_dir_list_64 $gb_sub_dir_list";

  gb_main_dir_list_64=`echo "$gb_main_dir_list" | sed s/"lib"/"lib64"/g`

  if test "$gb_main_dir_list_64" != "$gb_main_dir_list"; then
    gb_main_dir_list="$gb_main_dir_list_64 $gb_main_dir_list";
  fi

fi

for gb_main_dir in $gb_main_dir_list; do
  dnl echo "search $gb_main_dir"
  if test -d $gb_main_dir; then
    cd $gb_main_dir
    for gb_search_dir in $gb_sub_dir_list; do
      for gb_dir in $gb_search_dir/ $gb_search_dir/*/ $gb_search_dir/*/*/ $gb_search_dir/*/*/*/; do

        dnl echo "search subdir $gb_dir"
        gb_new_file_list=""
        gb_find_dir=""

        for gb_file in $gb_file_list; do

          dnl echo "search file $gb_file"
          gb_find=no
          if test -r "$gb_main_dir/$gb_dir/$gb_file" || test -d "$gb_main_dir/$gb_dir/$gb_file"; then

            ifelse($4,[],

              gb_find=yes,

              for gb_test in $4; do
                gb_output=`ls -la $gb_main_dir/$gb_dir/$gb_file | grep "$gb_test"`
                if test "x$gb_output" != "x"; then
                  gb_find=yes
                fi
              done
            )

          fi

          if test "$gb_find" = "yes"; then
            dnl echo "FOUND!"
            if test "x$gb_find_dir" = "x"; then
              if test "x$gb_val" = "x"; then
                gb_val="$gb_main_dir/$gb_dir"
              else
                gb_val="$gb_val $gb_main_dir/$gb_dir"
              fi
            fi
            gb_find_dir=yes
          else
            gb_new_file_list="$gb_new_file_list $gb_file"
          fi

        done

        gb_file_list=$gb_new_file_list

        if test "x$gb_file_list" = "x " || test "x$gb_file_list" = "x"; then
          break 3
        fi

      done
    done
  fi
done

if test "x$gb_file_list" != "x " && test "x$gb_file_list" != "x"; then
  gb_val=no
fi

cd $gb_save
])


## ---------------------------------------------------------------------------
## GB_COMPONENT_PKG_CONFIG
## Component detection macro based on pkg-config
##
##   $1 = Component key in lower case (ex: pgsql)
##   $2 = Component key in upper case (ex: PGSQL)
##   $3 = Component name (ex: gb.db.postgresql)
##   $4 = Sub-directory name
##   $5 = pkg-config module(s) name(s) with optional required version(s)
##   $6 = Warning message (optional)
##
##   => defines HAVE_*_COMPONENT (to know if you can compile the component)
##      *_INC (for the compiler) and *_LIB / *_LDFLAGS (for the linker)
## ---------------------------------------------------------------------------

AC_DEFUN([GB_COMPONENT_PKG_CONFIG],
[
  AC_REQUIRE([PKG_PROG_PKG_CONFIG])
  AC_ARG_ENABLE(
    $1,
    [  --enable-$1                enable $3 (default: yes)],
    gb_enable_$1=$enableval,
    gb_enable_$1=yes
  )

  dnl AC_ARG_WITH($1-includes,
  dnl   [  --with-$1-includes      where the $3 headers are located. ],
  dnl   [  gb_inc_$1="$withval" ])

  dnl AC_ARG_WITH($1-libraries,
  dnl   [  --with-$1-libraries     where the $3 libraries are located. ],
  dnl   [  gb_lib_$1="$withval" ])

  cp warnings.log warnings.log.before
  
  have_$1=no
  
  if test "$gb_enable_$1" = "yes" && test ! -e DISABLED && test ! -e DISABLED.$3; then

    AC_MSG_CHECKING(for $3 component with pkg-config)

    gb_inc_$1=""
    gb_lib_$1=""
    gb_ldflags_$1=""
    have_$1=yes
    gb_testval=""

    $PKG_CONFIG --silence-errors --exists $5
    if test $? -eq "0"; then

      ## Checking for headers

      $2_INC="`$PKG_CONFIG --cflags $5`"

      ## Checking for libraries

      $2_LIB="`$PKG_CONFIG --libs-only-l $5`"
      $2_LDFLAGS="`$PKG_CONFIG --libs-only-L $5` `$PKG_CONFIG --libs-only-other $5`"
      $2_DIR=$4

    else

      have_$1=no

    fi

  fi

  if test "$have_$1" = "no"; then

    if test "$gb_in_component_search" != "yes"; then
      touch DISABLED.$3
      if test "$gb_enable_$1" = "yes"; then
        touch FAILED
      fi
    fi

    if test "$gb_enable_$1" = "yes"; then
      AC_MSG_RESULT(failed)
    fi

    for pkgcmp in $5
    do

      $PKG_CONFIG --silence-errors --exists $pkgcmp
      if test $? -eq "1"; then
        GB_WARNING([Unable to met pkg-config requirement: $pkgcmp])
      fi

    done

  else

    AC_DEFINE(HAVE_$2_COMPONENT, 1, [Have $3 component])

    AC_MSG_RESULT(OK)

  fi

  if test "$have_$1" = "no"; then

    $2_INC=""
    $2_LIB=""
    $2_LDFLAGS=""
    $2_DIR=""
    if test "$gb_in_component_search" != "yes"; then
      if test x"$6" = x; then
        GB_MESSAGE([$3 is disabled])
      else
        GB_MESSAGE([$6])
      fi
    fi

  fi

  AC_SUBST($2_INC)
  AC_SUBST($2_LIB)
  AC_SUBST($2_LDFLAGS)
  AC_SUBST($2_DIR)
])


## ---------------------------------------------------------------------------
## GB_COMPONENT_PKG_CONFIG_AGAIN
## Try again a component detection macro based on pkg-config
##
##   $1 = Component key in lower case (ex: pgsql)
##   $2 = Component key in upper case (ex: PGSQL)
##   $3 = Component name (ex: gb.db.postgresql)
##   $4 = Sub-directory name
##   $5 = pkg-config module(s) name(s) with optional required version(s)
##   $6 = Try again message
##   $7 = Warning message (optional)
##
## ---------------------------------------------------------------------------

AC_DEFUN([GB_COMPONENT_PKG_CONFIG_AGAIN],
[
  if test "$have_$1" != "yes"; then

    AC_MSG_WARN([$6...])
    rm DISABLED.$3 FAILED;
    cp warnings.log.before warnings.log;

    GB_COMPONENT_PKG_CONFIG($1, $2, $3, $4, $5, $7)

  fi
])


## ---------------------------------------------------------------------------
## GB_COMPONENT
## Component detection macro that searches for files
##
##   $1 = Component key in lower case (ex: postgresql)
##   $2 = Component key in upper case (ex: POSTGRESQL)
##   $3 = Component name (ex: gb.db.postgresql)
##   $4 = Sub-directory name
##   $5 = How to get include path (must return it in gb_val)
##   $6 = How to get library path (must return it in gb_val)
##   $7 = Libraries
##   $8 = Compiler flags (optional)
##   $9 = Warning message (optional)
##
##   => defines HAVE_*_COMPONENT (to know if you can compile the component)
##      *_INC (for the compiler) and *_LIB (for the linker)
## ---------------------------------------------------------------------------

AC_DEFUN([GB_COMPONENT],
[
  AC_ARG_ENABLE(
    $1,
    [  --enable-$1                enable $3 (default: yes)],
    gb_enable_$1=$enableval,
    gb_enable_$1=yes
  )

  gb_inc_$1=no
  gb_lib_$1=no

  if test "$gb_enable_$1" = "yes" && test ! -e DISABLED && test ! -e DISABLED.$3; then

    ## Checking for headers

    AC_MSG_CHECKING(for $3 headers)

    AC_ARG_WITH($1-includes,
      [  --with-$1-includes      where the $3 headers are located. ],
      [  gb_inc_$1="$withval" ])

    AC_CACHE_VAL(gb_cv_header_$1, [

      if test "$gb_inc_$1" = no; then
        gb_val=""
        $5
        gb_inc_$1=$gb_val
      fi

      gb_cv_header_$1=$gb_inc_$1
    ])

    AC_MSG_RESULT([$gb_cv_header_$1])

    if test "$gb_cv_header_$1" = "no"; then
      for gb_result in $gb_file_list; do
        GB_WARNING([Unable to find file: $gb_result])
      done
    fi

    $2_INC=""

    for gb_dir in $gb_cv_header_$1; do
      if test "$gb_dir" != "/usr/include"; then
        if test "$gb_dir" != "/usr/include/"; then
          $2_INC="$$2_INC -I$gb_dir"
        fi
      fi
    done

    if test "x$8" != "x"; then
      $2_INC="$$2_INC $8"
    fi

    if test "$gb_cv_header_$1" = no; then
      have_inc_$1="no"
      $2_INC=""
    else
      have_inc_$1="yes"
    fi

    ## Checking for libraries

    AC_MSG_CHECKING(for $3 libraries)

    AC_ARG_WITH($1-libraries,
      [  --with-$1-libraries     where the $3 libraries are located. ],
      [  gb_lib_$1="$withval" ])

    AC_CACHE_VAL(gb_cv_lib_$1, [

      if test "$gb_lib_$1" = no; then
        gb_val=""
        $6
        gb_lib_$1=$gb_val
      fi

      gb_cv_lib_$1=$gb_lib_$1
    ])

    if test "$gb_cv_lib_$1" = no; then
      have_lib_$1="no"
    else
      have_lib_$1="yes"
    fi

    AC_MSG_RESULT([$gb_cv_lib_$1])

    if test "$gb_cv_lib_$1" = "no"; then
      for gb_result in $gb_file_list; do
        GB_WARNING([Unable to find file: $gb_result])
      done
    fi

    $2_LIB=""
    $2_LDFLAGS=""
    $2_PATH=""

    for gb_dir in $gb_cv_lib_$1; do
      if test "x$$2_PATH" = "x"; then
        $2_PATH="$gb_dir/.."
      fi
      if test "$gb_dir" != "/lib"  && test "$gb_dir" != "/lib/"&& test "$gb_dir" != "/usr/lib" && test "$gb_dir" != "/usr/lib/"; then
        $2_LDFLAGS="$$2_LDFLAGS -L$gb_dir";
      fi
    done

    $2_LIB="$$2_LIB $7"

  fi

  if test "$have_inc_$1" = "yes" && test "$have_lib_$1" = "yes"; then

    have_$1=yes
    $2_DIR=$4
    AC_DEFINE(HAVE_$2_COMPONENT, 1, Have $3)

  else

    have_$1=no
    touch DISABLED.$3
    if test "$gb_enable_$1" = "yes"; then
      touch FAILED
    fi

  fi

  if test "$have_$1" = "no"; then

    $2_INC=""
    $2_LIB=""
    $2_DIR=""
    $2_LDFLAGS=""
    if test x"$9" = x; then
      GB_WARNING([$3 is disabled])
    else
      GB_WARNING([$9])
    fi

  fi

  AC_SUBST($2_INC)
  AC_SUBST($2_LIB)
  AC_SUBST($2_LDFLAGS)
  AC_SUBST($2_DIR)
  AC_SUBST($2_PATH)

])


## ---------------------------------------------------------------------------
## GB_COMPONENT_SEARCH
## Component detection macro that uses GB_COMPONENT_PKG_CONFIG first, and
## then GB_COMPONENT.
##
##   $1  = Component key in lower case (ex: postgresql)
##   $2  = Component key in upper case (ex: POSTGRESQL)
##   $3  = Component name (ex: PostgreSQL)
##   $4  = Sub-directory name
##   $5  = pkg-config module name (optional)
##   $6  = How to get include path (must return it in gb_val)
##   $7  = How to get library path (must return it in gb_val)
##   $8  = Libraries
##   $9  = Compiler flags (optional)
##   $10 = Warning message (optional)
##
##   => defines HAVE_*_COMPONENT (to know if you can compile the component)
##      *_INC (for the compiler) and *_LIB (for the linker)
## ---------------------------------------------------------------------------

AC_DEFUN([GB_COMPONENT_SEARCH],
[
gb_in_component_search=yes
  GB_COMPONENT_PKG_CONFIG(
    $1,
    $2,
    $3,
    $4,
    $5,
    $10
  )
gb_in_component_search=no
  if test -z "${$2_LIB}"; then
    GB_COMPONENT(
      $1,
      $2,
      $3,
      $4,
      $6,
      $7,
      $8,
      $9,
      $10
    )
  fi
])


## ---------------------------------------------------------------------------
## GB_COMPONENT_SEARCH_BOTH
## Component detection macro that uses GB_COMPONENT_PKG_CONFIG and
## GB_COMPONENT. both having to succeed
##
##   $1  = Component key in lower case (ex: postgresql)
##   $2  = Component key in upper case (ex: POSTGRESQL)
##   $3  = Component name (ex: gb.db.postgresql)
##   $4  = Sub-directory name
##   $5  = pkg-config module name (optional)
##   $6  = How to get include path (must return it in gb_val)
##   $7  = How to get library path (must return it in gb_val)
##   $8  = Libraries
##   $9  = Compiler flags (optional)
##   $10 = Warning message (optional)
##
##   => defines HAVE_*_COMPONENT (to know if you can compile the component)
##      *_INC (for the compiler) and *_LIB (for the linker)
## ---------------------------------------------------------------------------

AC_DEFUN([GB_COMPONENT_SEARCH_BOTH],
[
  GB_COMPONENT_PKG_CONFIG(
    $1,
    $2,
    $3,
    $4,
    $5,
    $10
  )
  if test ! -e DISABLED.$3; then
    GB_COMPONENT(
      $1,
      $2,
      $3,
      $4,
      $6,
      $7,
      $8,
      $9,
      $10
    )
  fi
])


## ---------------------------------------------------------------------------
## GB_FIND_QT_MOC
## Find QT moc compiler
##
##   $1 = QT version
##   $2 = components to disable
##
##   Returns a path list in $gb_val
## ---------------------------------------------------------------------------

AC_DEFUN([GB_FIND_QT_MOC],
[
  gb_path_qt_moc=no
  if test x$1 = x; then
    gb_qt_version=3
  else
    gb_qt_version=$1
  fi

  AC_ARG_WITH(moc,
    [  --with-moc      The path to the QT moc compiler. ],
    [  gb_path_qt_moc="$withval" ])

  AC_MSG_CHECKING(for QT meta-object compiler)

  AC_CACHE_VAL(gb_cv_path_qt_moc, [

    gb_val=""
    if test "$gb_path_qt_moc" = no; then

      for gb_dir in $QTDIR /usr/lib/qt$gb_qt_version /usr/lib/qt/$gb_qt_version /usr/local/lib/qt$gb_qt_version /usr/local/lib/qt/$gb_qt_version /usr/local/qt$gb_qt_version /usr/local/qt/$gb_qt_version /usr/share/qt$gb_qt_version /usr/qt/$gb_qt_version /usr/pkg/qt$gb_qt_version /usr/pkg /usr; do

        gb_dir=$gb_dir/bin

        if test -r "$gb_dir/moc"; then
          if test "x`$gb_dir/moc -v 2>&1 | grep " $gb_qt_version\."`" != x; then
            gb_val=$gb_dir/moc
            break
          fi
        fi

      done

      gb_path_qt_moc=$gb_val
    fi

    gb_cv_path_qt_moc=$gb_path_qt_moc
  ])

  AC_MSG_RESULT([$gb_cv_path_qt_moc])

  if test x"$gb_cv_path_qt_moc" = x; then
    GB_WARNING([QT moc compiler not found. Try --with-moc option.])
    MOC=""
    touch DISABLED
  else
    MOC=$gb_cv_path_qt_moc
  fi

  AC_SUBST(MOC)
])

## ---------------------------------------------------------------------------
## GB_CHECK_XWINDOW
## Check the X-Window system installation
##
##   $1 = components to disable
## ---------------------------------------------------------------------------

AC_DEFUN([GB_CHECK_XWINDOW],
[
  AC_PATH_XTRA

  if test x"$have_x" = xyes; then
    if test -z `echo $X_LIBS | grep "\-lX11"`; then
      X_LIBS="$X_LIBS -lX11"
    fi
    if test -z `echo $X_LIBS | grep "\-lXext"`; then
      X_LIBS="$X_LIBS -lXext"
    fi
    X_LIBS="$X_PRE_LIBS $X_LIBS"
  else
    touch DISABLED
  fi

])

## ---------------------------------------------------------------------------
## GB_CHECK_MYSQL_CONSTANT
## Check a MySQL / MariaDB constant
##
##  $1 = option name in upper case
## ---------------------------------------------------------------------------

AC_DEFUN([GB_CHECK_MYSQL_CONSTANT],
[AC_CACHE_CHECK(for $1 option,
  gb_cv_mysql_$1,
  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
      #include <mysql.h>
    ]], [[
      int value = MYSQL_$1;
    ]])],[gb_cv_mysql_$1=yes],[gb_cv_mysql_$1=no
    ])])
  
  if test $gb_cv_mysql_$1 = yes; then
    AC_DEFINE(HAVE_MYSQL_$1, 1, [Define if you have MYSQL_$1 constant.])
  fi
])


## ---------------------------------------------------------------------------
## Some macros
## ---------------------------------------------------------------------------

dnl Like AC_CHECK_HEADER, but it uses the already-computed -I directories.

AC_DEFUN([AC_CHECK_X_HEADER], [
  ac_save_CPPFLAGS="$CPPFLAGS"
  if test \! -z "$includedir" ; then
    CPPFLAGS="$CPPFLAGS -I$includedir"
  fi
  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
  AC_CHECK_HEADER([$1],[$2],[$3])
  CPPFLAGS="$ac_save_CPPFLAGS"
])

dnl Like AC_CHECK_LIB, but it used the -L dirs set up by the X checks.

AC_DEFUN([AC_CHECK_X_LIB], [
  ac_save_CPPFLAGS="$CPPFLAGS"
  ac_save_LDFLAGS="$LDFLAGS"

  if test \! -z "$includedir" ; then
    CPPFLAGS="$CPPFLAGS -I$includedir"
  fi

  dnl note: $X_CFLAGS includes $x_includes
  CPPFLAGS="$CPPFLAGS $X_CFLAGS"

  if test \! -z "$libdir" ; then
    LDFLAGS="$LDFLAGS -L$libdir"
  fi

  dnl note: $X_LIBS includes $x_libraries

  LDFLAGS="$LDFLAGS $X_LIBS"
  AC_CHECK_LIB([$1], [$2], [$3], [$4], [$5])
  CPPFLAGS="$ac_save_CPPFLAGS"
  LDFLAGS="$ac_save_LDFLAGS"]
)

dnl Check if it is possible to turn off run time type information (RTTI)
AC_DEFUN([AC_PROG_CXX_FNO_RTTI],
[AC_CACHE_CHECK(whether ${CXX-g++} accepts -fno-rtti, ac_cv_prog_cxx_fno_rtti,
[echo 'void f(){}' > conftest.cc
if test -z "`${CXX-g++} -fno-rtti -c conftest.cc 2>&1`"; then
  ac_cv_prog_cxx_fno_rtti=yes
  CXXFLAGS="${CXXFLAGS} -fno-rtti"
else
  ac_cv_prog_cxx_fno_rtti=no
fi
rm -f conftest*
])])

dnl Check if the type socklen_t is defined anywhere
AC_DEFUN([AC_C_SOCKLEN_T],
[AC_CACHE_CHECK(for socklen_t, ac_cv_c_socklen_t,
[ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h>
#include <sys/socket.h>
]], [[
socklen_t foo;
]])],[
  ac_cv_c_socklen_t=yes
],[
  ac_cv_c_socklen_t=no
  AC_DEFINE(socklen_t,int)
])])])

dnl Check for sys_errlist[] and sys_nerr, check for declaration
dnl Check nicked from aclocal.m4 from GNU bash 2.01
AC_DEFUN([AC_SYS_ERRLIST],
[AC_MSG_CHECKING([for sys_errlist and sys_nerr])
AC_CACHE_VAL(ac_cv_sys_errlist,
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <errno.h>]], [[extern char *sys_errlist[];
 extern int sys_nerr;
 char *msg = sys_errlist[sys_nerr - 1];]])],[ac_cv_sys_errlist=yes],[ac_cv_sys_errlist=no])])dnl
AC_MSG_RESULT($ac_cv_sys_errlist)
if test $ac_cv_sys_errlist = yes; then
AC_DEFINE(HAVE_SYS_ERRLIST)
fi
])

dnl @synopsis AX_CFLAGS_GCC_OPTION (optionflag [,[shellvar][,[A][,[NA]]])
dnl
dnl AX_CFLAGS_GCC_OPTION(-fvomit-frame) would show a message as like
dnl "checking CFLAGS for gcc -fvomit-frame ... yes" and adds the
dnl optionflag to CFLAGS if it is understood. You can override the
dnl shellvar-default of CFLAGS of course. The order of arguments stems
dnl from the explicit macros like AX_CFLAGS_WARN_ALL.
dnl
dnl The cousin AX_CXXFLAGS_GCC_OPTION would check for an option to add
dnl to CXXFLAGS - and it uses the autoconf setup for C++ instead of C
dnl (since it is possible to use different compilers for C and C++).
dnl
dnl The macro is a lot simpler than any special AX_CFLAGS_* macro (or
dnl ac_cxx_rtti.m4 macro) but allows to check for arbitrary options.
dnl However, if you use this macro in a few places, it would be great
dnl if you would make up a new function-macro and submit it to the
dnl ac-archive.
dnl
dnl   - $1 option-to-check-for : required ("-option" as non-value)
dnl   - $2 shell-variable-to-add-to : CFLAGS (or CXXFLAGS in the other case)
dnl   - $3 action-if-found : add value to shellvariable
dnl   - $4 action-if-not-found : nothing
dnl
dnl note: in earlier versions, $1-$2 were swapped. We try to detect the
dnl situation and accept a $2=~/-/ as being the old
dnl option-to-check-for.
dnl
dnl also: there are other variants that emerged from the original macro
dnl variant which did just test an option to be possibly added.
dnl However, some compilers accept an option silently, or possibly for
dnl just another option that was not intended. Therefore, we have to do
dnl a generic test for a compiler family. For gcc we check "-pedantic"
dnl being accepted which is also understood by compilers who just want
dnl to be compatible with gcc even when not being made from gcc
dnl sources.
dnl
dnl see also:
dnl
dnl       AX_CFLAGS_SUN_OPTION               AX_CFLAGS_HPUX_OPTION
dnl       AX_CFLAGS_AIX_OPTION               AX_CFLAGS_IRIX_OPTION
dnl
dnl @category C
dnl @author Guido Draheim <guidod@gmx.de>
dnl @version 2003-11-04
dnl @license GPLWithACException

AC_DEFUN([AX_CFLAGS_GCC_OPTION_OLD], [dnl
AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_gcc_option_$2])dnl
AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for gcc m4_ifval($2,$2,-option)],
VAR,[VAR="no, unknown"
 AC_LANG_SAVE
 AC_LANG([C])
 ac_save_[]FLAGS="$[]FLAGS"
for ac_arg dnl
in "-pedantic  % m4_ifval($2,$2,-option)"  dnl   GCC
   #
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[return 0;]])],[VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break],[])
done
 FLAGS="$ac_save_[]FLAGS"
 AC_LANG_RESTORE
])
case ".$VAR" in
     .ok|.ok,*) m4_ifvaln($3,$3) ;;
   .|.no|.no,*) m4_ifvaln($4,$4) ;;
   *) m4_ifvaln($3,$3,[
   if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
   then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
   else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
                      m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
   fi ]) ;;
esac
AS_VAR_POPDEF([VAR])dnl
AS_VAR_POPDEF([FLAGS])dnl
])


dnl the only difference - the LANG selection... and the default FLAGS

AC_DEFUN([AX_CXXFLAGS_GCC_OPTION_OLD], [dnl
AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_gcc_option_$2])dnl
AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for gcc m4_ifval($2,$2,-option)],
VAR,[VAR="no, unknown"
 AC_LANG_SAVE
 AC_LANG_CXX
 ac_save_[]FLAGS="$[]FLAGS"
for ac_arg dnl
in "-pedantic  % m4_ifval($2,$2,-option)"  dnl   GCC
   #
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[return 0;]])],[VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break],[])
done
 FLAGS="$ac_save_[]FLAGS"
 AC_LANG_RESTORE
])
case ".$VAR" in
     .ok|.ok,*) m4_ifvaln($3,$3) ;;
   .|.no|.no,*) m4_ifvaln($4,$4) ;;
   *) m4_ifvaln($3,$3,[
   if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
   then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
   else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
                      m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
   fi ]) ;;
esac
AS_VAR_POPDEF([VAR])dnl
AS_VAR_POPDEF([FLAGS])dnl
])

dnl -------------------------------------------------------------------------

AC_DEFUN([AX_CFLAGS_GCC_OPTION_NEW], [dnl
AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_gcc_option_$1])dnl
AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for gcc m4_ifval($1,$1,-option)],
VAR,[VAR="no, unknown"
 AC_LANG_SAVE
 AC_LANG([C])
 ac_save_[]FLAGS="$[]FLAGS"
for ac_arg dnl
in "-pedantic  % m4_ifval($1,$1,-option)"  dnl   GCC
   #
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[return 0;]])],[VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break],[])
done
 FLAGS="$ac_save_[]FLAGS"
 AC_LANG_RESTORE
])
case ".$VAR" in
     .ok|.ok,*) m4_ifvaln($3,$3) ;;
   .|.no|.no,*) m4_ifvaln($4,$4) ;;
   *) m4_ifvaln($3,$3,[
   if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
   then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR])
   else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"])
                      m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"
   fi ]) ;;
esac
AS_VAR_POPDEF([VAR])dnl
AS_VAR_POPDEF([FLAGS])dnl
])


dnl the only difference - the LANG selection... and the default FLAGS

AC_DEFUN([AX_CXXFLAGS_GCC_OPTION_NEW], [dnl
AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_gcc_option_$1])dnl
AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for gcc m4_ifval($1,$1,-option)],
VAR,[VAR="no, unknown"
 AC_LANG_SAVE
 AC_LANG_CXX
 ac_save_[]FLAGS="$[]FLAGS"
for ac_arg dnl
in "-pedantic  % m4_ifval($1,$1,-option)"  dnl   GCC
   #
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[return 0;]])],[VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break],[])
done
 FLAGS="$ac_save_[]FLAGS"
 AC_LANG_RESTORE
])
case ".$VAR" in
     .ok|.ok,*) m4_ifvaln($3,$3) ;;
   .|.no|.no,*) m4_ifvaln($4,$4) ;;
   *) m4_ifvaln($3,$3,[
   if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
   then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR])
   else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"])
                      m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"
   fi ]) ;;
esac
AS_VAR_POPDEF([VAR])dnl
AS_VAR_POPDEF([FLAGS])dnl
])

AC_DEFUN([AX_CFLAGS_GCC_OPTION],[ifelse(m4_bregexp([$2],[-]),-1,
[AX_CFLAGS_GCC_OPTION_NEW($@)],[AX_CFLAGS_GCC_OPTION_OLD($@)])])

AC_DEFUN([AX_CXXFLAGS_GCC_OPTION],[ifelse(m4_bregexp([$2],[-]),-1,
[AX_CXXFLAGS_GCC_OPTION_NEW($@)],[AX_CXXFLAGS_GCC_OPTION_OLD($@)])])