summaryrefslogtreecommitdiff
path: root/acsite.m4
blob: 8c25e7b83bcda797736cfbfa2fd05abb84baad3b (plain)
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
dnl ============================================================
dnl We define the macro GLIBC_PROVIDES to do an AC_PROVIDE for
dnl each macro which appears in configure.ac before the sysdep
dnl configure scripts are run. Each sysdep configure.ac does
dnl LIBMPU_PROVIDES first, to avoid any AC_REQUIREs or
dnl AC_BEFOREs duplicating their code.
dnl ============================================================
define([LIBMPU_PROVIDES], [dnl
AC_PROVIDE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
AC_PROVIDE([AC_CONFIG_SUBDIRS])dnl
AC_PROVIDE([_AS_ECHO_N_PREPARE])dnl
AC_PROVIDE([_AS_ECHO_PREPARE])dnl
AC_PROVIDE([_AS_CR_PREPARE])dnl
AC_PROVIDE([_AS_TR_SH_PREPARE])dnl
AC_PROVIDE([_AS_VAR_ARITH_PREPARE])dnl
AC_PROVIDE([AC_PROG_INSTALL])dnl
AC_PROVIDE([AC_PROG_CC])dnl
AC_PROVIDE([AC_PROG_CPP])dnl
AC_PROVIDE([_AS_PATH_SEPARATOR_PREPARE])dnl
AC_PROVIDE([_AS_TEST_PREPARE])dnl
AC_PROVIDE([_AS_BASENAME_PREPARE])dnl
AC_PROVIDE([_AS_ME_PREPARE])dnl
AC_PROVIDE([_AS_LINENO_PREPARE])dnl
AC_PROVIDE([AS_SHELL_FN_as_fn_set_status])dnl
AC_PROVIDE([AS_SHELL_FN_as_fn_exit])dnl
AC_PROVIDE([AS_SHELL_FN_as_fn_arith])dnl
AC_PROVIDE([AS_SHELL_FN_ac_fn_c_try_compile])dnl
define([AS_MESSAGE_LOG_FD],5)dnl
define([AS_MESSAGE_FD],6)dnl
dnl Ripped out of AS_INIT, which does more cruft we do not want.
m4_wrap([m4_divert_pop([BODY])[]])
m4_divert_push([BODY])[]dnl
dnl End of ripped out of AS_INIT.
# This file is generated from configure.ac by Autoconf.  DO NOT EDIT!
define([_AC_LANG], [C])dnl
])dnl

dnl ============================================================
dnl Support for Configuration Headers
dnl
dnl    configure.ac:
dnl       AC_LIBMPU_HEADLINE(<short-name>, <long-name>,
dnl                          <vers-var>, <vers-file>,
dnl                          <copyright>)
dnl
dnl NOTE:
dnl ====
dnl   See the paragraph 8.3.3 of Autoconf Documentation at:
dnl
dnl     https://www.gnu.org/software/autoconf/manual/autoconf.html#Diversion-support
dnl
dnl ============================================================
m4_define([AC_LIBMPU_HEADLINE], [dnl
m4_divert_push([M4SH-SANITIZE])dnl
{
  if test ".`echo dummy [$]@ | grep help`" = .; then
    ####### bootstrapping version-tool
    ac_prog=[$]0
changequote(, )dnl
    ac_srcdir=`echo $ac_prog | sed -e 's%/[^/][^/]*$%%' -e 's%\([^/]\)/*$%\1%'`
changequote([, ])dnl
    test ".$ac_srcdir" = ".$ac_prog" && ac_srcdir=.
    ac_version_tool="${CONFIG_SHELL-/bin/sh} $ac_srcdir/version-tool"

    ####### нахождение escape последовательностей для
    ####### обозначения начала и конца выделяемого текста
    ####### Use a `Quadrigaph'. '@<:@' gives you [ and '@:>@' gives you ] :
    TB=`echo -n -e '\033@<:@1m'`
    TN=`echo -n -e '\033@<:@0m'`

    ####### чтение короткого номера версии продукта (например, "1.0.0")
    $3="`$ac_version_tool $ac_srcdir/$4`"
    AC_SUBST($3)

    ####### печать заголовка
    echo "Configuring:"
    echo ""
    echo "${TB}$1${TN} ($2), Version ${TB}${$3}${TN}"
    echo "$5"
    echo ""

    ####### чтение шестнадцатеричного номера версии продукта (например, 0x100200)
#    $3_HEX="`$ac_version_tool version -lc -dhex $ac_srcdir/$4`"
#    AC_SUBST($3_HEX)
  fi
}
m4_divert_pop([M4SH-SANITIZE])dnl
])dnl


dnl ============================================================
dnl Display Configuration Headers
dnl
dnl    configure.ac:
dnl       AC_MSG_CFG_PART(<text>)
dnl ============================================================
AC_DEFUN([AC_MSG_CFG_PART],[dnl
   AC_MSG_RESULT()
   AC_MSG_RESULT([${TB}$1:${TN}])
])dnl


dnl ============================================================
dnl  Check for weak symbols too:
dnl ============================================================
AC_DEFUN([LIBMPU_ALIAS_ATTRIBUTE],
[AC_CACHE_CHECK(for broken __attribute__((alias())),
  libmpu_cv_broken_alias_attribute,
  [cat > conftest.c <<EOF
   extern int foo (int x) __asm ("xyzzy");
   int bar (int x) { return x; }
   extern __typeof (bar) foo __attribute ((weak, alias ("bar")));
   extern int dfoo;
   extern __typeof (dfoo) dfoo __asm ("abccb");
   int dfoo = 1;
EOF
  libmpu_cv_broken_alias_attribute=yes
  if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
    if grep 'xyzzy' conftest.s >/dev/null &&
       grep 'abccb' conftest.s >/dev/null; then
       libmpu_cv_broken_alias_attribute=no
    fi
  fi
  rm -f conftest.c conftest.s
  ])
if test $libmpu_cv_broken_alias_attribute = yes; then
  AC_MSG_ERROR([
********   ${TB}Working alias attribute support required.${TN}])
else
  AC_DEFINE(HAVE_WEAK_SYMBOLS, 1, [Defined if supports weak symbols.])
fi
])


dnl ============================================================
dnl  Check for hidden visibility attribute:
dnl ============================================================
AC_DEFUN([LIBMPU_HIDDEN_VISIBILITY_ATTRIBUTE],
[AC_CACHE_CHECK(for __attribute__((visibility("hidden"))),
  libmpu_cv_hidden_visibility_attribute,
  [cat > conftest.c <<EOF
   int __attribute__ ((visibility ("hidden"))) foo (void) { return 1; }
EOF
  libmpu_cv_hidden_visibility_attribute=no
  if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
    if grep '\.hidden.*foo' conftest.s >/dev/null; then
       libmpu_cv_hidden_visibility_attribute=yes
    fi
  fi
  rm -f conftest.c conftest.s
  ])
if test $libmpu_cv_hidden_visibility_attribute = yes; then
  AC_DEFINE([HAVE_HIDDEN_VISIBILITY_ATTRIBUTE], [1],
    [Defined if __attribute__((visibility("hidden"))) supported.])
fi
])


dnl ============================================================
dnl Check GNU Binutils
dnl
dnl    configure.ac:
dnl       LIBMPU_PROG_BINUTILS
dnl ============================================================
AC_DEFUN([LIBMPU_PROG_FOO_GNU],
[# Most GNU programs take a -v and spit out some text including
# the word 'GNU'.  Some try to read stdin, so give them /dev/null.
if $1 -o conftest -v </dev/null 2>&1 | grep GNU > /dev/null 2>&1; then
  $2
else
  $3
fi
rm -fr contest*])

AC_DEFUN([LIBMPU_PROG_BINUTILS],
[dnl
AS=`$CC -print-prog-name=as`
LD=`$CC -print-prog-name=ld`
AR=`$CC -print-prog-name=ar`
AC_SUBST(AR)
AC_SUBST(AS)
OBJDUMP=`$CC -print-prog-name=objdump`
AC_SUBST(OBJDUMP)
OBJCOPY=`$CC -print-prog-name=objcopy`
AC_SUBST(OBJCOPY)

# ranlib has to be treated a bit differently since it might not exist at all.
RANLIB=`$CC -print-prog-name=ranlib`
if test $RANLIB = ranlib; then
# This extra check has to happen since gcc simply echos the parameter in
# case it cannot find the value in its own directories.
AC_CHECK_TOOL(RANLIB, ranlib, :)
fi
AC_SUBST(RANLIB)

# readelf has to be treated a bit differently since it might not exist at all.
READELF=`$CC -print-prog-name=readelf`
if test $READELF = readelf; then
# This extra check has to happen since gcc simply echos the parameter in
# case it cannot find the value in its own directories.
AC_CHECK_TOOL(READELF, readelf, :)
fi
AC_SUBST(READELF)

# nm has to be treated a bit differently since it might not exist at all.
NM=`$CC -print-prog-name=nm`
if test $NM = nm; then
# This extra check has to happen since gcc simply echos the parameter in
# case it cannot find the value in its own directories.
AC_CHECK_TOOL(NM, nm, :)
fi
AC_SUBST(NM)

# strip has to be treated a bit differently since it might not exist at all.
STRIP=`$CC -print-prog-name=strip`
if test $STRIP = strip; then
# This extra check has to happen since gcc simply echos the parameter in
# case it cannot find the value in its own directories.
AC_CHECK_TOOL(STRIP, strip, :)
fi
AC_SUBST(STRIP)

# Determine whether we are using GNU binutils.
AC_CACHE_CHECK(whether $AS is GNU as, libmpu_cv_prog_as_gnu,
[LIBMPU_PROG_FOO_GNU($AS, libmpu_cv_prog_as_gnu=yes, libmpu_cv_prog_as_gnu=no)])
rm -f a.out
gnu_as=$libmpu_cv_prog_as_gnu

AC_CACHE_CHECK(whether $LD is GNU ld, libmpu_cv_prog_ld_gnu,
[LIBMPU_PROG_FOO_GNU($LD, libmpu_cv_prog_ld_gnu=yes, libmpu_cv_prog_ld_gnu=no)])
gnu_ld=$libmpu_cv_prog_ld_gnu
])


dnl ============================================================
dnl  Test for build_cc:
dnl  =================
dnl
dnl    configure.ac:
dnl       if test $host != $build; then
dnl         AC_PROG_BUILD_CC
dnl       fi
dnl
dnl ============================================================
AC_DEFUN([AC_PROG_BUILD_CC],
[ac_test_BUILD_CFLAGS=${BUILD_CFLAGS+set}
ac_save_BUILD_CFLAGS=$BUILD_CFLAGS
AC_CHECK_PROGS(BUILD_CC, gcc cc)
AC_MSG_CHECKING(whether $BUILD_CC works on build machine)
AC_CACHE_VAL(ac_cv_prog_build_cc,
[rm -f conftest
cat > conftest.c <<EOF

int main()
{
   char *s = "strip";

   return( 0 );
}

EOF
$BUILD_CC -o conftest conftest.c
if test -f conftest
then
   rm -f conftest conftest.c
   ac_cv_prog_build_cc="$BUILD_CC"
else
   rm -f conftest conftest.c
   ac_cv_prog_build_cc=
fi])dnl

if test "$ac_test_BUILD_CFLAGS" = set; then
  BUILD_CFLAGS=$ac_save_BUILD_CFLAGS
fi

BUILD_CC="$ac_cv_prog_build_cc"
if test "$ac_cv_prog_build_cc" = "$BUILD_CC"; then
   AC_MSG_RESULT(yes)
else
   AC_MSG_RESULT(no)
fi
AC_SUBST(BUILD_CC)dnl
])


dnl ============================================================
dnl  Test for build_host `strip -s':
dnl  ==============================
dnl
dnl    configure.ac:
dnl       if test $host != $build; then
dnl         AC_PATH_PROG_BUILD_STRIP_S
dnl       fi
dnl
dnl ============================================================
AC_DEFUN([AC_PATH_PROG_BUILD_STRIP_S],
[AC_REQUIRE([AC_PROG_BUILD_CC])dnl
AC_PATH_PROG(BUILD_STRIP, strip, no, /usr/local/bin:/usr/bin:/bin:$PATH)
AC_MSG_CHECKING(whether strip -s works on build machine)
AC_CACHE_VAL(ac_cv_path_prog_STRIP_S,
[rm -f conftest
cat > conftest.c <<EOF

int main()
{
   char *s = "strip";

   return( 0 );
}

EOF
$BUILD_CC -o conftest conftest.c
if $BUILD_STRIP -s conftest 2>/dev/null
then
   rm -f conftest conftest.c
   ac_cv_path_prog_STRIP_S="$BUILD_STRIP -s"
else
   rm -f conftest conftest.c
   ac_cv_path_prog_STRIP_S="$BUILD_STRIP"
fi])dnl
BUILD_STRIP_S="$ac_cv_path_prog_STRIP_S"
if test "$ac_cv_path_prog_STRIP_S" = "$BUILD_STRIP -s"; then
   AC_MSG_RESULT(yes)
else
   AC_MSG_RESULT(no)
fi
AC_SUBST(BUILD_STRIP)dnl
AC_SUBST(BUILD_STRIP_S)dnl
])


dnl ============================================================
dnl  Test for WIDTH of MACHINE REGISTER using GCC predefines:
dnl  ==================
dnl
dnl    configure.ac:
dnl       AC_GCC_REGISTER_WIDTH
dnl
dnl ============================================================
AC_DEFUN([AC_GCC_REGISTER_WIDTH],
[dnl
AC_MSG_CHECKING(for CPP predefined macro __INT_FAST32_WIDTH__ )
AC_CACHE_VAL(ac_cv_int_fast32_width,
[ac_cv_int_fast32_width=`$CC -dM -E - < /dev/null | grep __INT_FAST32_WIDTH__ | cut -f3- -d' ' | tr '\n' ' ' | tr -s ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
if test "$ac_cv_int_fast32_width" != ""; then
  AC_MSG_RESULT($ac_cv_int_fast32_width)
else
  AC_MSG_RESULT(not defined)
fi

AC_MSG_CHECKING(for CPP predefined macro __INT_FAST64_WIDTH__ )
AC_CACHE_VAL(ac_cv_int_fast64_width,
[ac_cv_int_fast64_width=`$CC -dM -E - < /dev/null | grep __INT_FAST64_WIDTH__ | cut -f3- -d' ' | tr '\n' ' ' | tr -s ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
if test "$ac_cv_int_fast64_width" != ""; then
  AC_MSG_RESULT($ac_cv_int_fast64_width)
else
  AC_MSG_RESULT(not defined)
fi

AC_MSG_CHECKING(for MACHINE REGISTER WIDTH )
AC_CACHE_VAL(ac_cv_machine_register_width,
[dnl
if test "$ac_cv_int_fast64_width" != "" -a "$ac_cv_int_fast32_width" != "" ; then
  if test "$ac_cv_int_fast64_width" -gt "$ac_cv_int_fast32_width" ; then
    ac_cv_machine_register_width=$ac_cv_int_fast32_width
  else
    ac_cv_machine_register_width=$ac_cv_int_fast64_width
  fi
elif test "$ac_cv_int_fast64_width" != "" ; then
  ac_cv_machine_register_width=$ac_cv_int_fast64_width
elif test "$ac_cv_int_fast32_width" != "" ; then
  ac_cv_machine_register_width=$ac_cv_int_fast32_width
else
  ac_cv_machine_register_width=32
fi
])dnl
if test "$ac_cv_machine_register_width" != ""; then
  MACHINE_REGISTER_WIDTH=$ac_cv_machine_register_width
  AC_MSG_RESULT($ac_cv_machine_register_width)
else
  MACHINE_REGISTER_WIDTH=
  AC_MSG_RESULT(not defined)
fi
AC_SUBST(MACHINE_REGISTER_WIDTH)dnl
AC_DEFINE_UNQUOTED([MACHINE_REGISTER_WIDTH], [$ac_cv_machine_register_width], [The size of Machine Register in bits.])dnl
])


dnl ============================================================
dnl  Test for GCC Types:
dnl  ==================
dnl
dnl    configure.ac:
dnl       AC_GCC_TYPES
dnl
dnl ============================================================
AC_DEFUN([AC_GCC_TYPES],
[dnl
AC_MSG_CHECKING(for CPP predefined macro __CHAR16_TYPE__ )
AC_CACHE_VAL(ac_cv_char16_type,
[ac_cv_char16_type=`$CC -dM -E - < /dev/null | grep __CHAR16_TYPE__ | cut -f3- -d' ' | tr '\n' ' ' | tr -s ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
if test "$ac_cv_char16_type" != ""; then
  GCC_CHAR16_TYPE=$ac_cv_char16_type
  AC_MSG_RESULT($ac_cv_char16_type)
else
  GCC_CHAR16_TYPE=
  AC_MSG_RESULT(not defined)
fi
AC_SUBST(GCC_CHAR16_TYPE)dnl

AC_MSG_CHECKING(for CPP predefined macro __CHAR32_TYPE__ )
AC_CACHE_VAL(ac_cv_char32_type,
[ac_cv_char32_type=`$CC -dM -E - < /dev/null | grep __CHAR32_TYPE__ | cut -f3- -d' ' | tr '\n' ' ' | tr -s ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
if test "$ac_cv_char32_type" != ""; then
  GCC_CHAR32_TYPE=$ac_cv_char32_type
  AC_MSG_RESULT($ac_cv_char32_type)
else
  GCC_CHAR32_TYPE=
  AC_MSG_RESULT(not defined)
fi
AC_SUBST(GCC_CHAR32_TYPE)dnl

AC_MSG_CHECKING(for CPP predefined macro __WCHAR_TYPE__ )
AC_CACHE_VAL(ac_cv_wchar_type,
[ac_cv_wchar_type=`$CC -dM -E - < /dev/null | grep __WCHAR_TYPE__ | cut -f3- -d' ' | tr '\n' ' ' | tr -s ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
if test "$ac_cv_wchar_type" != ""; then
  GCC_WCHAR_TYPE=$ac_cv_wchar_type
  AC_MSG_RESULT($ac_cv_wchar_type)
else
  GCC_WCHAR_TYPE=
  AC_MSG_RESULT(not defined)
fi
AC_SUBST(GCC_WCHAR_TYPE)dnl

AC_MSG_CHECKING(for CPP predefined macro __INT8_TYPE__ )
AC_CACHE_VAL(ac_cv_int8_type,
[ac_cv_int8_type=`$CC -dM -E - < /dev/null | grep __INT8_TYPE__ | cut -f3- -d' ' | tr '\n' ' ' | tr -s ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
if test "$ac_cv_int8_type" != ""; then
  GCC_INT8_TYPE=$ac_cv_int8_type
  AC_MSG_RESULT($ac_cv_int8_type)
else
  GCC_INT8_TYPE=
  AC_MSG_RESULT(not defined)
fi
AC_SUBST(GCC_INT8_TYPE)dnl

AC_MSG_CHECKING(for CPP predefined macro __UINT8_TYPE__ )
AC_CACHE_VAL(ac_cv_uint8_type,
[ac_cv_uint8_type=`$CC -dM -E - < /dev/null | grep __UINT8_TYPE__ | cut -f3- -d' ' | tr '\n' ' ' | tr -s ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
if test "$ac_cv_uint8_type" != ""; then
  GCC_UINT8_TYPE=$ac_cv_uint8_type
  AC_MSG_RESULT($ac_cv_uint8_type)
else
  GCC_UINT8_TYPE=
  AC_MSG_RESULT(not defined)
fi
AC_SUBST(GCC_UINT8_TYPE)dnl

AC_MSG_CHECKING(for CPP predefined macro __INT16_TYPE__ )
AC_CACHE_VAL(ac_cv_int16_type,
[ac_cv_int16_type=`$CC -dM -E - < /dev/null | grep __INT16_TYPE__ | cut -f3- -d' ' | tr '\n' ' ' | tr -s ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
if test "$ac_cv_int16_type" != ""; then
  GCC_INT16_TYPE=$ac_cv_int16_type
  AC_MSG_RESULT($ac_cv_int16_type)
else
  GCC_INT16_TYPE=
  AC_MSG_RESULT(not defined)
fi
AC_SUBST(GCC_INT16_TYPE)dnl

AC_MSG_CHECKING(for CPP predefined macro __UINT16_TYPE__ )
AC_CACHE_VAL(ac_cv_uint16_type,
[ac_cv_uint16_type=`$CC -dM -E - < /dev/null | grep __UINT16_TYPE__ | cut -f3- -d' ' | tr '\n' ' ' | tr -s ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
if test "$ac_cv_uint16_type" != ""; then
  GCC_UINT16_TYPE=$ac_cv_uint16_type
  AC_MSG_RESULT($ac_cv_uint16_type)
else
  GCC_UINT16_TYPE=
  AC_MSG_RESULT(not defined)
fi
AC_SUBST(GCC_UINT16_TYPE)dnl

AC_MSG_CHECKING(for CPP predefined macro __INT32_TYPE__ )
AC_CACHE_VAL(ac_cv_int32_type,
[ac_cv_int32_type=`$CC -dM -E - < /dev/null | grep __INT32_TYPE__ | cut -f3- -d' ' | tr '\n' ' ' | tr -s ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
if test "$ac_cv_int32_type" != ""; then
  GCC_INT32_TYPE=$ac_cv_int32_type
  AC_MSG_RESULT($ac_cv_int32_type)
else
  GCC_INT32_TYPE=
  AC_MSG_RESULT(not defined)
fi
AC_SUBST(GCC_INT32_TYPE)dnl

AC_MSG_CHECKING(for CPP predefined macro __UINT32_TYPE__ )
AC_CACHE_VAL(ac_cv_uint32_type,
[ac_cv_uint32_type=`$CC -dM -E - < /dev/null | grep __UINT32_TYPE__ | cut -f3- -d' ' | tr '\n' ' ' | tr -s ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
AC_CACHE_VAL(ac_cv_uint32_const_suffix,
[ac_cv_uint32_const_suffix=`$CC -dM -E - < /dev/null | grep __UINT32_C | cut -f5- -d' ' | tr '\n' ' ' | tr -s ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
if test "$ac_cv_uint32_type" != ""; then
  GCC_UINT32_TYPE=$ac_cv_uint32_type
  AC_MSG_RESULT($ac_cv_uint32_type)
else
  GCC_UINT32_TYPE=
  AC_MSG_RESULT(not defined)
fi
AC_SUBST(GCC_UINT32_TYPE)dnl

AC_MSG_CHECKING(for CPP predefined macro __INT64_TYPE__ )
AC_CACHE_VAL(ac_cv_int64_type,
[ac_cv_int64_type=`$CC -dM -E - < /dev/null | grep __INT64_TYPE__ | cut -f3- -d' ' | tr '\n' ' ' | tr -s ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
if test "$ac_cv_int64_type" != ""; then
  GCC_INT64_TYPE=$ac_cv_int64_type
  AC_MSG_RESULT($ac_cv_int64_type)
else
  GCC_INT64_TYPE=
  AC_MSG_RESULT(not defined)
fi
AC_SUBST(GCC_INT64_TYPE)dnl

AC_MSG_CHECKING(for CPP predefined macro __UINT64_TYPE__ )
AC_CACHE_VAL(ac_cv_uint64_type,
[ac_cv_uint64_type=`$CC -dM -E - < /dev/null | grep __UINT64_TYPE__ | cut -f3- -d' ' | tr '\n' ' ' | tr -s ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
AC_CACHE_VAL(ac_cv_uint64_const_suffix,
[ac_cv_uint64_const_suffix=`$CC -dM -E - < /dev/null | grep __UINT64_C | cut -f5- -d' ' | tr '\n' ' ' | tr -s ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
if test "$ac_cv_uint64_type" != ""; then
  GCC_UINT64_TYPE=$ac_cv_uint64_type
  AC_MSG_RESULT($ac_cv_uint64_type)
else
  GCC_UINT64_TYPE=
  AC_MSG_RESULT(not defined)
fi
AC_SUBST(GCC_UINT64_TYPE)dnl

AC_MSG_CHECKING(for CPP predefined macro __WINT_TYPE__ )
AC_CACHE_VAL(ac_cv_wint_type,
[ac_cv_wint_type=`$CC -dM -E - < /dev/null | grep __WINT_TYPE__ | cut -f3- -d' ' | tr '\n' ' ' | tr -s ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
if test "$ac_cv_wint_type" != ""; then
  GCC_WINT_TYPE=$ac_cv_wint_type
  AC_MSG_RESULT($ac_cv_wint_type)
else
  GCC_WINT_TYPE=
  AC_MSG_RESULT(not defined)
fi
AC_SUBST(GCC_WINT_TYPE)dnl

AC_MSG_CHECKING(for CPP predefined macro __INTMAX_TYPE__ )
AC_CACHE_VAL(ac_cv_intmax_type,
[ac_cv_intmax_type=`$CC -dM -E - < /dev/null | grep __INTMAX_TYPE__ | cut -f3- -d' ' | tr '\n' ' ' | tr -s ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
if test "$ac_cv_intmax_type" != ""; then
  GCC_INTMAX_TYPE=$ac_cv_intmax_type
  AC_MSG_RESULT($ac_cv_intmax_type)
else
  GCC_INTMAX_TYPE=
  AC_MSG_RESULT(not defined)
fi
AC_SUBST(GCC_INTMAX_TYPE)dnl

AC_MSG_CHECKING(for CPP predefined macro __UINTMAX_TYPE__ )
AC_CACHE_VAL(ac_cv_uintmax_type,
[ac_cv_uintmax_type=`$CC -dM -E - < /dev/null | grep __UINTMAX_TYPE__ | cut -f3- -d' ' | tr '\n' ' ' | tr -s ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
if test "$ac_cv_uintmax_type" != ""; then
  GCC_UINTMAX_TYPE=$ac_cv_uintmax_type
  AC_MSG_RESULT($ac_cv_uintmax_type)
else
  GCC_UINTMAX_TYPE=
  AC_MSG_RESULT(not defined)
fi
AC_SUBST(GCC_UINTMAX_TYPE)dnl

AC_MSG_CHECKING(for CPP predefined macro __SIZE_TYPE__ )
AC_CACHE_VAL(ac_cv_size_type,
[ac_cv_size_type=`$CC -dM -E - < /dev/null | grep __SIZE_TYPE__ | cut -f3- -d' ' | tr '\n' ' ' | tr -s ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
if test "$ac_cv_size_type" != ""; then
  GCC_SIZE_TYPE=$ac_cv_size_type
  AC_MSG_RESULT($ac_cv_size_type)
else
  GCC_SIZE_TYPE=
  AC_MSG_RESULT(not defined)
fi
AC_SUBST(GCC_SIZE_TYPE)dnl

AC_MSG_CHECKING(for CPP predefined macro __INTPTR_TYPE__ )
AC_CACHE_VAL(ac_cv_intptr_type,
[ac_cv_intptr_type=`$CC -dM -E - < /dev/null | grep __INTPTR_TYPE__ | cut -f3- -d' ' | tr '\n' ' ' | tr -s ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
if test "$ac_cv_intptr_type" != ""; then
  GCC_INTPTR_TYPE=$ac_cv_intptr_type
  AC_MSG_RESULT($ac_cv_intptr_type)
else
  GCC_INTPTR_TYPE=
  AC_MSG_RESULT(not defined)
fi
AC_SUBST(GCC_INTPTR_TYPE)dnl

AC_MSG_CHECKING(for CPP predefined macro __UINTPTR_TYPE__ )
AC_CACHE_VAL(ac_cv_uintptr_type,
[ac_cv_uintptr_type=`$CC -dM -E - < /dev/null | grep __UINTPTR_TYPE__ | cut -f3- -d' ' | tr '\n' ' ' | tr -s ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
if test "$ac_cv_uintptr_type" != ""; then
  GCC_UINTPTR_TYPE=$ac_cv_uintptr_type
  AC_MSG_RESULT($ac_cv_uintptr_type)
else
  GCC_UINTPTR_TYPE=
  AC_MSG_RESULT(not defined)
fi
AC_SUBST(GCC_UINTPTR_TYPE)dnl

AC_MSG_CHECKING(for CPP predefined macro __PTRDIFF_TYPE__ )
AC_CACHE_VAL(ac_cv_ptrdiff_type,
[ac_cv_ptrdiff_type=`$CC -dM -E - < /dev/null | grep __PTRDIFF_TYPE__ | cut -f3- -d' ' | tr '\n' ' ' | tr -s ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
if test "$ac_cv_ptrdiff_type" != ""; then
  GCC_PTRDIFF_TYPE=$ac_cv_ptrdiff_type
  AC_MSG_RESULT($ac_cv_ptrdiff_type)
else
  GCC_PTRDIFF_TYPE=
  AC_MSG_RESULT(not defined)
fi
AC_SUBST(GCC_PTRDIFF_TYPE)dnl

AC_MSG_CHECKING(for CPP predefined macro __SIG_ATOMIC_TYPE__ )
AC_CACHE_VAL(ac_cv_sig_atomic_type,
[ac_cv_sig_atomic_type=`$CC -dM -E - < /dev/null | grep __SIG_ATOMIC_TYPE__ | cut -f3- -d' ' | tr '\n' ' ' | tr -s ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
if test "$ac_cv_sig_atomic_type" != ""; then
  GCC_SIG_ATOMIC_TYPE=$ac_cv_sig_atomic_type
  AC_MSG_RESULT($ac_cv_sig_atomic_type)
else
  GCC_SIG_ATOMIC_TYPE=
  AC_MSG_RESULT(not defined)
fi
AC_SUBST(GCC_SIG_ATOMIC_TYPE)dnl
])


dnl ============================================================
dnl  Test for GCC Sizeof Types:
dnl  =========================
dnl
dnl    configure.ac:
dnl       AC_GCC_SIZEOF_TYPES
dnl
dnl ============================================================
AC_DEFUN([AC_GCC_SIZEOF_TYPES],
[dnl
AC_MSG_CHECKING(for CPP predefined macro __SIZEOF_WCHAR_T__ )
AC_CACHE_VAL(ac_cv_sizeof_wchar_t,
[ac_cv_sizeof_wchar_t=`$CC -dM -E - < /dev/null | grep __SIZEOF_WCHAR_T__ | cut -f3 -d' ' | tr '\n' ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
if test "$ac_cv_sizeof_wchar_t" != ""; then
  GCC_SIZEOF_WCHAR_T=$ac_cv_sizeof_wchar_t
  AC_MSG_RESULT($ac_cv_sizeof_wchar_t)
else
  GCC_SIZEOF_WCHAR_T=
  AC_MSG_RESULT(not defined)
fi
AC_SUBST(GCC_SIZEOF_WCHAR_T)dnl

AC_MSG_CHECKING(for CPP predefined macro __SIZEOF_SHORT__ )
AC_CACHE_VAL(ac_cv_sizeof_short,
[ac_cv_sizeof_short=`$CC -dM -E - < /dev/null | grep __SIZEOF_SHORT__ | cut -f3 -d' ' | tr '\n' ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
if test "$ac_cv_sizeof_short" != ""; then
  GCC_SIZEOF_SHORT=$ac_cv_sizeof_short
  AC_MSG_RESULT($ac_cv_sizeof_short)
else
  GCC_SIZEOF_SHORT=
  AC_MSG_RESULT(not defined)
fi
AC_SUBST(GCC_SIZEOF_SHORT)dnl

AC_MSG_CHECKING(for CPP predefined macro __SIZEOF_INT__ )
AC_CACHE_VAL(ac_cv_sizeof_int,
[ac_cv_sizeof_int=`$CC -dM -E - < /dev/null | grep __SIZEOF_INT__ | cut -f3 -d' ' | tr '\n' ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
if test "$ac_cv_sizeof_int" != ""; then
  GCC_SIZEOF_INT=$ac_cv_sizeof_int
  AC_MSG_RESULT($ac_cv_sizeof_int)
else
  GCC_SIZEOF_INT=
  AC_MSG_RESULT(not defined)
fi
AC_SUBST(GCC_SIZEOF_INT)dnl

AC_MSG_CHECKING(for CPP predefined macro __SIZEOF_WINT_T__ )
AC_CACHE_VAL(ac_cv_sizeof_wint_t,
[ac_cv_sizeof_wint_t=`$CC -dM -E - < /dev/null | grep __SIZEOF_WINT_T__ | cut -f3 -d' ' | tr '\n' ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
if test "$ac_cv_sizeof_wint_t" != ""; then
  GCC_SIZEOF_WINT_T=$ac_cv_sizeof_wint_t
  AC_MSG_RESULT($ac_cv_sizeof_wint_t)
else
  GCC_SIZEOF_WINT_T=
  AC_MSG_RESULT(not defined)
fi
AC_SUBST(GCC_SIZEOF_WINT_T)dnl

AC_MSG_CHECKING(for CPP predefined macro __SIZEOF_LONG__ )
AC_CACHE_VAL(ac_cv_sizeof_long,
[ac_cv_sizeof_long=`$CC -dM -E - < /dev/null | grep __SIZEOF_LONG__ | cut -f3 -d' ' | tr '\n' ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
if test "$ac_cv_sizeof_long" != ""; then
  GCC_SIZEOF_LONG=$ac_cv_sizeof_long
  AC_MSG_RESULT($ac_cv_sizeof_long)
else
  GCC_SIZEOF_LONG=
  AC_MSG_RESULT(not defined)
fi
AC_SUBST(GCC_SIZEOF_LONG)dnl

AC_MSG_CHECKING(for CPP predefined macro __SIZEOF_LONG_LONG__ )
AC_CACHE_VAL(ac_cv_sizeof_long_long,
[ac_cv_sizeof_long_long=`$CC -dM -E - < /dev/null | grep __SIZEOF_LONG_LONG__ | cut -f3 -d' ' | tr '\n' ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
if test "$ac_cv_sizeof_long_long" != ""; then
  GCC_SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
  AC_MSG_RESULT($ac_cv_sizeof_long_long)
else
  GCC_SIZEOF_LONG_LONG=
  AC_MSG_RESULT(not defined)
fi
AC_SUBST(GCC_SIZEOF_LONG_LONG)dnl

AC_MSG_CHECKING(for CPP predefined macro __SIZEOF_FLOAT__ )
AC_CACHE_VAL(ac_cv_sizeof_float,
[ac_cv_sizeof_float=`$CC -dM -E - < /dev/null | grep __SIZEOF_FLOAT__ | cut -f3 -d' ' | tr '\n' ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
if test "$ac_cv_sizeof_float" != ""; then
  GCC_SIZEOF_FLOAT=$ac_cv_sizeof_float
  AC_MSG_RESULT($ac_cv_sizeof_float)
else
  GCC_SIZEOF_FLOAT=
  AC_MSG_RESULT(not defined)
fi
AC_SUBST(GCC_SIZEOF_FLOAT)dnl

AC_MSG_CHECKING(for CPP predefined macro __SIZEOF_DOUBLE__ )
AC_CACHE_VAL(ac_cv_sizeof_double,
[ac_cv_sizeof_double=`$CC -dM -E - < /dev/null | grep __SIZEOF_DOUBLE__ | cut -f3 -d' ' | tr '\n' ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
if test "$ac_cv_sizeof_double" != ""; then
  GCC_SIZEOF_DOUBLE=$ac_cv_sizeof_double
  AC_MSG_RESULT($ac_cv_sizeof_double)
else
  GCC_SIZEOF_DOUBLE=
  AC_MSG_RESULT(not defined)
fi
AC_SUBST(GCC_SIZEOF_DOUBLE)dnl

AC_MSG_CHECKING(for CPP predefined macro __SIZEOF_LONG_DOUBLE__ )
AC_CACHE_VAL(ac_cv_sizeof_long_double,
[ac_cv_sizeof_long_double=`$CC -dM -E - < /dev/null | grep __SIZEOF_LONG_DOUBLE__ | cut -f3 -d' ' | tr '\n' ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
if test "$ac_cv_sizeof_long_double" != ""; then
  GCC_SIZEOF_LONG_DOUBLE=$ac_cv_sizeof_long_double
  AC_MSG_RESULT($ac_cv_sizeof_long_double)
else
  GCC_SIZEOF_LONG_DOUBLE=
  AC_MSG_RESULT(not defined)
fi
AC_SUBST(GCC_SIZEOF_LONG_DOUBLE)dnl

AC_MSG_CHECKING(for CPP predefined macro __SIZEOF_SIZE_T__ )
AC_CACHE_VAL(ac_cv_sizeof_size_t,
[ac_cv_sizeof_size_t=`$CC -dM -E - < /dev/null | grep __SIZEOF_SIZE_T__ | cut -f3 -d' ' | tr '\n' ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
if test "$ac_cv_sizeof_size_t" != ""; then
  GCC_SIZEOF_SIZE_T=$ac_cv_sizeof_size_t
  AC_MSG_RESULT($ac_cv_sizeof_size_t)
else
  GCC_SIZEOF_SIZE_T=
  AC_MSG_RESULT(not defined)
fi
AC_SUBST(GCC_SIZEOF_SIZE_T)dnl

AC_MSG_CHECKING(for CPP predefined macro __SIZEOF_POINTER__ )
AC_CACHE_VAL(ac_cv_sizeof_pointer,
[ac_cv_sizeof_pointer=`$CC -dM -E - < /dev/null | grep __SIZEOF_POINTER__ | cut -f3 -d' ' | tr '\n' ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
if test "$ac_cv_sizeof_pointer" != ""; then
  GCC_SIZEOF_POINTER=$ac_cv_sizeof_pointer
  AC_MSG_RESULT($ac_cv_sizeof_pointer)
else
  GCC_SIZEOF_POINTER=
  AC_MSG_RESULT(not defined)
fi
AC_SUBST(GCC_SIZEOF_POINTER)dnl

AC_MSG_CHECKING(for CPP predefined macro __SIZEOF_PTRDIFF_T__ )
AC_CACHE_VAL(ac_cv_sizeof_ptrdiff_t,
[ac_cv_sizeof_ptrdiff_t=`$CC -dM -E - < /dev/null | grep __SIZEOF_PTRDIFF_T__ | cut -f3 -d' ' | tr '\n' ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
if test "$ac_cv_sizeof_ptrdiff_t" != ""; then
  GCC_SIZEOF_PTRDIFF_T=$ac_cv_sizeof_ptrdiff_t
  AC_MSG_RESULT($ac_cv_sizeof_ptrdiff_t)
else
  GCC_SIZEOF_PTRDIFF_T=
  AC_MSG_RESULT(not defined)
fi
AC_SUBST(GCC_SIZEOF_PTRDIFF_T)dnl
])


dnl ============================================================
dnl  Test for GCC Width of Types:
dnl  ===========================
dnl
dnl    configure.ac:
dnl       AC_GCC_WIDTH_OF_TYPES
dnl
dnl ============================================================
AC_DEFUN([AC_GCC_WIDTH_OF_TYPES],
[dnl
AC_MSG_CHECKING(for CPP predefined macro __CHAR_BIT__ )
AC_CACHE_VAL(ac_cv_char_width,
[ac_cv_char_width=`$CC -dM -E - < /dev/null | grep __CHAR_BIT__ | cut -f3 -d' ' | tr '\n' ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
if test "$ac_cv_char_width" != ""; then
  GCC_CHAR_WIDTH=$ac_cv_char_width
  AC_MSG_RESULT($ac_cv_char_width)
else
  GCC_CHAR_WIDTH=
  AC_MSG_RESULT(not defined)
fi
AC_SUBST(GCC_CHAR_WIDTH)dnl
])


dnl ============================================================
dnl  Test for GCC Byte Order:
dnl  =======================
dnl
dnl    configure.ac:
dnl       AC_GCC_BYTE_ORDER
dnl
dnl ============================================================
AC_DEFUN([AC_GCC_BYTE_ORDER],
[dnl
AC_MSG_CHECKING(for CPP predefined macro __BYTE_ORDER__ )
AC_CACHE_VAL(ac_cv_order_little_endian,
[ac_cv_order_little_endian=`$CC -dM -E - < /dev/null | grep __ORDER_LITTLE_ENDIAN__ | cut -f3 -d' ' | tr '\n' ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
AC_CACHE_VAL(ac_cv_order_big_endian,
[ac_cv_order_big_endian=`$CC -dM -E - < /dev/null | grep __ORDER_BIG_ENDIAN__ | cut -f3 -d' ' | tr '\n' ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
AC_CACHE_VAL(ac_cv_byte_order,
[ac_cv_byte_order=`$CC -dM -E - < /dev/null | grep __BYTE_ORDER__ | cut -f3 -d' ' | tr '\n' ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
if test "$ac_cv_byte_order" = "__ORDER_LITTLE_ENDIAN__"; then
  GCC_BYTE_ORDER=1234
  GCC_BYTE_ORDER_LITTLE_ENDIAN=1
  GCC_BYTE_ORDER_BIG_ENDIAN=0
  AC_MSG_RESULT(Little-endian)
else
  GCC_BYTE_ORDER=4321
  GCC_BYTE_ORDER_LITTLE_ENDIAN=0
  GCC_BYTE_ORDER_BIG_ENDIAN=1
  AC_MSG_RESULT(Big-endian)
fi
AC_SUBST(GCC_BYTE_ORDER)dnl
AC_SUBST(GCC_BYTE_ORDER_LITTLE_ENDIAN)dnl
AC_SUBST(GCC_BYTE_ORDER_BIG_ENDIAN)dnl
])


dnl ============================================================
dnl  Test for GCC Float Word Order:
dnl  =============================
dnl
dnl    configure.ac:
dnl       AC_GCC_FLOAT_WORD_ORDER
dnl
dnl ============================================================
AC_DEFUN([AC_GCC_FLOAT_WORD_ORDER],
[dnl
AC_MSG_CHECKING(for CPP predefined macro __FLOAT_WORD_ORDER__ )
AC_CACHE_VAL(ac_cv_order_little_endian,
[ac_cv_order_little_endian=`$CC -dM -E - < /dev/null | grep __ORDER_LITTLE_ENDIAN__ | cut -f3 -d' ' | tr '\n' ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
AC_CACHE_VAL(ac_cv_order_big_endian,
[ac_cv_order_big_endian=`$CC -dM -E - < /dev/null | grep __ORDER_BIG_ENDIAN__ | cut -f3 -d' ' | tr '\n' ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
AC_CACHE_VAL(ac_cv_float_word_order,
[ac_cv_float_word_order=`$CC -dM -E - < /dev/null | grep __FLOAT_WORD_ORDER__ | cut -f3 -d' ' | tr '\n' ' ' | sed 's,^[ \t]*,,;s,[ \t]*$,,'`])dnl
if test "$ac_cv_float_word_order" = "__ORDER_LITTLE_ENDIAN__"; then
  GCC_FLOAT_WORD_ORDER=1234
  GCC_FLOAT_WORD_ORDER_LITTLE_ENDIAN=1
  GCC_FLOAT_WORD_ORDER_BIG_ENDIAN=0
  AC_MSG_RESULT(Little-endian)
else
  GCC_FLOAT_WORD_ORDER=4321
  GCC_FLOAT_WORD_ORDER_LITTLE_ENDIAN=0
  GCC_FLOAT_WORD_ORDER_BIG_ENDIAN=1
  AC_MSG_RESULT(Big-endian)
fi
AC_SUBST(GCC_FLOAT_WORD_ORDER)dnl
AC_SUBST(GCC_FLOAT_WORD_ORDER_LITTLE_ENDIAN)dnl
AC_SUBST(GCC_FLOAT_WORD_ORDER_BIG_ENDIAN)dnl
])


dnl =======================================================================
dnl  AC_GCC_PROGRAMMING_MODEL
dnl
dnl  Determine programming model corresponding to following list:
dnl
dnl    PROGRAMMING MODELS:
dnl    ------------------
dnl
dnl           PM: |     1 |     2 |        3  |     4 |        5  |      6
dnl    -----------+-------+-------+-----------+-------+-----------+--------
dnl               |  LP32 | ILP32 |     LP64  | ILP64 |    LLP64  | SILP64
dnl     Data type |       |       | (I32LP64) |       | (IL32P64) |
dnl    ===========|=======|=======|===========|=======|===========|========
dnl          char |     8 |     8 |         8 |     8 |         8 |      8
dnl    -----------+-------+-------+-----------+-------+-----------+--------
dnl         short |    16 |    16 |        16 |    16 |        16 |     64
dnl    -----------+-------+-------+-----------+-------+-----------+--------
dnl           int |    16 |    32 |        32 |    64 |        32 |     64
dnl    -----------+-------+-------+-----------+-------+-----------+--------
dnl          long |    32 |    32 |        64 |    64 |        32 |     64
dnl    -----------+-------+-------+-----------+-------+-----------+--------
dnl     long long |                     64
dnl    -----------+-------+-------+-----------+-------+-----------+--------
dnl       pointer |    32 |    32 |        64 |    64 |        64 |     64
dnl    -----------+-------+-------+-----------+-------+-----------+--------
dnl     ptrdiff_t |    32 |    32 |        64 |    64 |        64 |     64
dnl    ===========+=======+=======+===========+=======+===========+========
dnl          CPU: |       |  i686 |    x86_64 |       |           |
dnl
dnl    Many 64-bit platforms today use an LP64 model (including Solaris,
dnl    AIX, HP-UX, Linux, macOS, BSD, and IBM z/OS).  Microsoft Windows
dnl    uses an LLP64 model.  The disadvantage of the LP64 model is that
dnl    storing a long into an int may overflow.  On the other hand,
dnl    converting a pointer to a long will “work” in LP64. In the LLP64
dnl    model, the reverse is true.  These are not problems which affect
dnl    fully standard-compliant code, but code is often written with
dnl    implicit assumptions about the widths of data types. C code
dnl    should prefer (u)intptr_t instead of long when casting pointers
dnl    into integer objects.
dnl
dnl =======================================================================
AC_DEFUN([AC_GCC_PROGRAMMING_MODEL],
[AC_REQUIRE([AC_GCC_TYPES])dnl
AC_REQUIRE([AC_GCC_SIZEOF_TYPES])dnl
AC_CACHE_CHECK(for Target Machine Programming Model, ac_cv_gcc_programming_model,
ac_cv_gcc_programming_model=unknown  dnl Initialize to unknown
[
silp=${ac_cv_sizeof_short}${ac_cv_sizeof_int}${ac_cv_sizeof_long}${ac_cv_sizeof_pointer}
changequote(,)dnl
case "$silp" in
   2244)
      ac_cv_gcc_programming_model=LP32
      ac_cv_gcc_programming_model_silp=2244
      ac_cv_gcc_programming_model_id=1
      ;;
   2444)
      ac_cv_gcc_programming_model=ILP32
      ac_cv_gcc_programming_model_silp=2444
      ac_cv_gcc_programming_model_id=2
      ;;
   2488)
      ac_cv_gcc_programming_model=LP64
      ac_cv_gcc_programming_model_silp=2488
      ac_cv_gcc_programming_model_id=3
      ;;
   2888)
      ac_cv_gcc_programming_model=ILP64
      ac_cv_gcc_programming_model_silp=2888
      ac_cv_gcc_programming_model_id=4
      ;;
   2448)
      ac_cv_gcc_programming_model=LLP64
      ac_cv_gcc_programming_model_silp=2448
      ac_cv_gcc_programming_model_id=5
      ;;
   8888)
      ac_cv_gcc_programming_model=SILP64
      ac_cv_gcc_programming_model_silp=8888
      ac_cv_gcc_programming_model_id=6
      ;;
   *)
changequote([,])dnl
      ac_cv_c_programming_model=unknown
      ;;
esac
]
if test $ac_cv_gcc_programming_model = unknown ; then
  AC_MSG_ERROR([
********   ${TB}Not able to determine programming model.${TN}])
elif test $ac_cv_gcc_programming_model = LP32 ; then
  AC_MSG_ERROR([
********   ${TB}MPU Library does not support LP32 programming model.${TN}])
elif test $ac_cv_gcc_programming_model = IPL64 ; then
  AC_MSG_ERROR([
********   ${TB}MPU Library does not support IPL64 programming model.${TN}])
elif test $ac_cv_gcc_programming_model = SIPL64 ; then
  AC_MSG_ERROR([
********   ${TB}MPU Library does not support SIPL64 programming model.${TN}])
fi
)

dnl =======================================================================
dnl Programming model IDs:
dnl =======================================================================
AC_SUBST(PM_LP32, 1)
AC_SUBST(PM_ILP32, 2)
AC_SUBST(PM_LP64, 3)
AC_SUBST(PM_ILP64, 4)
AC_SUBST(PM_LLP64, 5)
AC_SUBST(PM_SILP64, 6)

AC_DEFINE([__PM_LP32], [1], [The ID of LP32 programming model.])dnl
AC_DEFINE([__PM_ILP32], [2], [The ID of ILP32 programming model.])dnl
AC_DEFINE([__PM_LP64], [3], [The ID of LP64 programming model.])dnl
AC_DEFINE([__PM_ILP64], [4], [The ID of ILP64 programming model.])dnl
AC_DEFINE([__PM_LLP64], [5], [The ID of LLP64 programming model.])dnl
AC_DEFINE([__PM_SILP64], [6], [The ID of SILP64 programming model.])dnl

dnl =======================================================================
dnl EMUSHORT, EMULONG Types:
dnl =======================================================================
AC_SUBST(LIBMPU_EMUSHORT_TYPE, $ac_cv_int32_type)
AC_SUBST(LIBMPU_UINT32_CONST_SUFFIX, $ac_cv_uint32_const_suffix)
AC_SUBST(LIBMPU_SIZEOF_EMUSHORT, 4)
AC_SUBST(LIBMPU_EMUSHORT_WIDTH, 32)

AC_DEFINE_UNQUOTED([EMUSHORT], [$ac_cv_uint32_type], [The type of unsigned 32-bit integer variables.])dnl
AC_DEFINE_UNQUOTED([EMUSHORT_C(c)], [c ## $ac_cv_uint32_const_suffix], [The macro for expand the EMUSHORT value to constant expression.])dnl
AC_DEFINE([SIZE_OF_EMUSHORT], [4], [The size of EMUSHORT type in bytes.])dnl
AC_DEFINE([BITS_PER_EMUSHORT], [32], [The size of EMUSHORT type in bits.])dnl

AC_SUBST(LIBMPU_EMUPART_TYPE, $ac_cv_int32_type)
AC_SUBST(LIBMPU_SIZEOF_EMUPART, 4)
AC_SUBST(LIBMPU_EMUPART_WIDTH, 32)

AC_DEFINE_UNQUOTED([EMUPART], [$ac_cv_uint32_type], [The type of unsigned 32-bit integer variables.])dnl
AC_DEFINE_UNQUOTED([EMUPART_C(c)], [c ## $ac_cv_uint32_const_suffix], [The macro for expand the EMUPART value to constant expression.])dnl
AC_DEFINE([SIZE_OF_EMUPART], [4], [The size of EMUPART type in bytes.])dnl
AC_DEFINE([BITS_PER_EMUPART], [32], [The size of EMUPART type in bits.])dnl

AC_SUBST(LIBMPU_EMULONG_TYPE, $ac_cv_int64_type)
AC_SUBST(LIBMPU_UINT64_CONST_SUFFIX, $ac_cv_uint64_const_suffix)
AC_SUBST(LIBMPU_SIZEOF_EMULONG, 8)
AC_SUBST(LIBMPU_EMULONG_WIDTH, 64)

AC_DEFINE_UNQUOTED([EMULONG], [$ac_cv_uint64_type], [The type of unsigned 64-bit integer variables.])dnl
AC_DEFINE_UNQUOTED([EMULONG_C(c)], [c ## $ac_cv_uint64_const_suffix], [The macro for expand the EMULONG value to constant expression.])dnl
AC_DEFINE([SIZE_OF_EMULONG], [8], [The size of EMULONG type in bytes.])dnl
AC_DEFINE([BITS_PER_EMULONG], [64], [The size of EMULONG type in bits.])dnl

AC_DEFINE_UNQUOTED([BITS_PER_BYTE], [$ac_cv_char_width], [The size of BYTE or UNIT type in bits.])dnl

AC_SUBST(GCC_PROGRAMMING_MODEL, $ac_cv_gcc_programming_model)
AC_SUBST(GCC_PROGRAMMING_MODEL_SILP, $ac_cv_gcc_programming_model_silp)
AC_SUBST(GCC_PROGRAMMING_MODEL_ID, $ac_cv_gcc_programming_model_id)

AC_DEFINE_UNQUOTED([__PROGRAMMING_MODEL], [$ac_cv_gcc_programming_model], [The programming model name.])dnl
AC_DEFINE_UNQUOTED([__PROGRAMMING_MODEL_SILP], [$ac_cv_gcc_programming_model_silp], [The programming model sizes of short, int, long, pointer types.])dnl
AC_DEFINE_UNQUOTED([__PROGRAMMING_MODEL_ID], [$ac_cv_gcc_programming_model_id], [The programming model identificator.])dnl
])


AC_DEFUN([AC_LIBMPU_LT_VERSION_INFO],
[AC_MSG_CHECKING(for MPU Library Version Information)
#
# Made LT_VERSION_INFO so that library version matches PACKAGE_VERSION:
#
major=`echo ${PACKAGE_VERSION} | cut -f1 -d'.'`
minor=`echo ${PACKAGE_VERSION} | cut -f2 -d'.'`
patch=`echo ${PACKAGE_VERSION} | cut -f3 -d'.'`

current=$( expr ${major} + ${patch} )
revision=${minor}
age=${patch}

ac_cv_libmpu_lt_release="${major}.${minor}"
ac_cv_libmpu_lt_current="${current}"
ac_cv_libmpu_lt_revision="${revision}"
ac_cv_libmpu_lt_age="${age}"

ac_cv_libmpu_lt_version_info="${major}:${age}:${revision}"

AC_SUBST(LIBMPU_LT_RELEASE, $ac_cv_libmpu_lt_release)
AC_SUBST(LIBMPU_LT_VERSION_INFO, $ac_cv_libmpu_lt_version_info)
AC_SUBST(LIBMPU_LT_CURRENT, $ac_cv_libmpu_lt_current)
AC_SUBST(LIBMPU_LT_REVISION, $ac_cv_libmpu_lt_revision)
AC_SUBST(LIBMPU_LT_AGE, $ac_cv_libmpu_lt_age)

AC_MSG_RESULT($ac_cv_libmpu_lt_version_info)
if test "$ac_cv_libmpu_lt_version_info" = ""; then
AC_MSG_ERROR([
********   ${TB}The MPU Library Version Information does not declared.${TN}])
fi
])


dnl ============================================================
dnl  Test if LD_LIBRARY_PATH contains the notation for the
dnl  current directory since this would lead to problems
dnl  installing/building kxlibc .
dnl
dnl  LD_LIBRARY_PATH contains the current directory if one
dnl  of the following is true:
dnl     - one of the terminals (":" and ";") is the first or
dnl       last sign;
dnl     - two terminals occur directly after each other;
dnl     - the path contains an element with a dot in it .
dnl ============================================================
AC_DEFUN([AC_LD_LIBRARY_PATH],
[AC_MSG_CHECKING(for LD_LIBRARY_PATH does not contain current directory)
changequote(,)dnl
case ${LD_LIBRARY_PATH} in
   [:\;]* | *[:\;] | *[:\;][:\;]* |  *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
      ld_library_path_setting="contains current directory"
      ;;
   *)
      ld_library_path_setting="ok"
      ;;
esac
changequote([,])dnl
AC_MSG_RESULT($ld_library_path_setting)
if test "$ld_library_path_setting" != "ok"; then
AC_MSG_ERROR([
********   ${TB}LD_LIBRARY_PATH shouldn't contain the current directory when${TN}
********   ${TB}building MPU Library. Please change the environment variable${TN}
********   ${TB}and run configure again.${TN}])
fi
])