-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
1187 lines (1071 loc) · 34.6 KB
/
configure.ac
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
#
# Configure template for GnuCOBOL
# Process this file with autoconf to produce a configure script.
#
# Copyright (C) 2001-2012, 2014-2016 Free Software Foundation, Inc.
# Written by Keisuke Nishida, Roger While, Ron Norman, Simon Sobisch
#
# This file is part of GnuCOBOL.
#
# The GnuCOBOL compiler is free software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# GnuCOBOL is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GnuCOBOL. If not, see <http://www.gnu.org/licenses/>.
AC_PREREQ([2.64])
AC_INIT([GnuCOBOL],
[2.0],
[gnu-cobol],
[http://www.opencobol.org])
AC_CONFIG_SRCDIR([libcob.h])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_TESTDIR([tests])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([build_aux])
# Note for SUN Solaris (gcc)
# export/setenv CFLAGS "-m64 -mptr64"
# export/setenv LDFLAGS "-m64 -mptr64 -L/usr/local/lib/sparcv9"
# ./configure --libdir=/usr/local/lib/sparcv9
#
# Hack for AIX 64 bit (gcc)
# Required -
# export/setenv CFLAGS=-maix64
# export/setenv LDFLAGS=-maix64
if echo $CFLAGS | grep 'aix64' 1>/dev/null 2>&1; then
if test -f /usr/ccs/bin/ar; then
AR="/usr/ccs/bin/ar -X64"
else
AR="ar -X64"
fi
NM="/usr/ccs/bin/nm -X64 -B"
fi
AM_INIT_AUTOMAKE([gnu no-texinfo.tex])
AM_MAINTAINER_MODE
# Autoheader templates
AH_TEMPLATE([COB_EXPERIMENTAL], [Enable experimental code (Developers only!)])
AH_TEMPLATE([COB_PARAM_CHECK], [Enable CALL parameter checking])
AH_TEMPLATE([PATCH_LEVEL], [Define a patch level])
AH_TEMPLATE([WITH_INDEX_EXTFH], [Compile with an external ISAM handler])
AH_TEMPLATE([WITH_SEQRA_EXTFH], [Compile with an external SEQ/RAN handler])
AH_TEMPLATE([WITH_DB], [Use Berkeley DB library as emulation of ISAM handler])
AH_TEMPLATE([WITH_CISAM], [Use CISAM as ISAM handler])
AH_TEMPLATE([WITH_DISAM], [Use DISAM as ISAM handler])
AH_TEMPLATE([WITH_VBISAM], [Use VBISAM as ISAM handler])
AH_TEMPLATE([COB_EXPORT_DYN], [Compile/link option for exporting symbols])
AH_TEMPLATE([COB_PIC_FLAGS], [Compile/link option for PIC code])
AH_TEMPLATE([COB_SHARED_OPT], [Compile/link option for shared code])
AH_TEMPLATE([COB_STRIP_CMD], [Strip command])
AH_TEMPLATE([USE_LIBDL], [Use system dynamic loader])
AH_TEMPLATE([HAVE_DLADDR], [Has dladdr function])
AH_TEMPLATE([WITH_VARSEQ], [Define variable sequential file format])
AH_TEMPLATE([HAVE_PSIGN_OPT], [Has -Wno-pointer-sign])
AH_TEMPLATE([HAVE_ATTRIBUTE_ALIGNED], [Has __attribute__((aligned))])
AH_TEMPLATE([HAVE_TIMEZONE], [Has timezone variable])
AH_TEMPLATE([COB_EXEEXT], [Executable extension])
AH_TEMPLATE([COB_OBJEXT], [Object extension])
AH_TEMPLATE([COB_KEYWORD_INLINE], [Keyword for inline])
AH_TEMPLATE([COB_NO_SELFOPEN], [Can not dlopen self])
AH_TEMPLATE([COB_STRFTIME], [Can use strftime for timezone])
AH_TEMPLATE([COB_LI_IS_LL], [long int is long long])
AH_TEMPLATE([WITH_CURSES], [curses library for extended SCREEN I/O])
AH_TEMPLATE([HAVE_COLOR_SET], [curses has color_set function])
AH_TEMPLATE([HAVE_CURSES_FREEALL], [ncurses has _nc_freeall function])
AH_TEMPLATE([HAVE_USE_LEGACY_CODING], [ncurses has use_legacy_coding function])
AH_TEMPLATE([HAVE_DESIGNATED_INITS], [Has designated initializers])
AH_TEMPLATE([HAVE_NANO_SLEEP], [Has nanosleep function])
AH_TEMPLATE([HAVE_CLOCK_GETTIME], [Has clock_gettime function and CLOCK_REALTIME])
AH_TEMPLATE([HAVE_MP_GET_MEMORY_FUNCTIONS], [Do we have mp_get_memory_functions in gmp])
#AH_TEMPLATE([HAVE_RAISE], [Has raise function])
AH_TEMPLATE([HAVE_FINITE_IEEEFP_H],
[Declaration of finite function in ieeefp.h instead of math.h])
save_libs="$LIBS"
enable_cflags_setting=no
if test "$enable_debug" = "yes"; then
AC_MSG_CHECKING([whether CFLAGS can be modified])
# Enable setting if the user has not specified the optimisation in CFLAGS.
echo "$CFLAGS" | grep "\-O.*\( \|$\)" 1>/dev/null 2>/dev/null
if test $? != 0; then
enable_cflags_setting=yes
fi
AC_MSG_RESULT([$enable_cflags_setting])
fi
# Basic capability tests
AC_PROG_CC([gcc xlc cc])
AC_PROG_CC_STDC
AC_PROG_CPP
AC_USE_SYSTEM_EXTENSIONS
LT_INIT([dlopen win32-dll])
AC_PROG_EGREP
AM_PROG_CC_C_O
# Stop tests for C++ and Fortran
AC_DEFUN([AC_PROG_F77], [])
AC_DEFUN([AC_PROG_CXX], [])
AC_PROG_LN_S
AC_PROG_INSTALL
# AC_LIBTOOL_DLOPEN
# AC_LIBTOOL_WIN32_DLL
# AC_PROG_LIBTOOL
AC_PROG_MAKE_SET
AC_LIB_RPATH
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([stdint.h sys/types.h signal.h fcntl.h malloc.h locale.h \
stddef.h wchar.h dlfcn.h sys/time.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_BIGENDIAN
AC_TYPE_SIZE_T
AC_STRUCT_TM
AC_CHECK_TYPES([sig_atomic_t], [], [], [[#include <signal.h>]])
# Don't use AC_C_INLINE here. We need the value
AC_MSG_CHECKING([for inline keyword])
for cob_keyw in __inline __inline__ inline
do
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifndef __cplusplus
typedef int foo_t;
static $cob_keyw foo_t foo () { return 0; }
#endif]], [[
#ifndef __cplusplus
return foo ();
#else
choke me
#endif]])],
[AC_DEFINE_UNQUOTED([COB_KEYWORD_INLINE], [$cob_keyw]) break],
[],
[])
done
AC_MSG_RESULT([$cob_keyw])
unset cob_keyw
# Checks for library functions.
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([memmove memset setlocale fcntl strerror strcasecmp \
strchr strrchr strdup strstr strtol gettimeofday localeconv \
readlink getexecname canonicalize_file_name realpath \
strcoll strxfrm setenv raise])
# Check for timezone
AC_MSG_CHECKING([for timezone variable access])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]],
[[timezone = 3600;]])],
[AC_DEFINE([HAVE_TIMEZONE], [1]) AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
# Check for designated initializers
AC_MSG_CHECKING([for designated initializers])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]],
[[static const unsigned char valid_char[256] = {
@<:@'0'@:>@ = 1,
@<:@'1'@:>@ = 1 };
]])],
[AC_DEFINE([HAVE_DESIGNATED_INITS], [1]) AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
# Check gcc/icc
COB_USES_GCC_ICC=no
COB_USES_GCC_ONLY=no
COB_USES_ICC_ONLY=no
AC_RUN_IFELSE([AC_LANG_PROGRAM([[]], [[
#ifdef __GNUC__
return 0;
#else
return 1;
#endif]])],
[COB_USES_GCC_ICC=yes],
[],
[])
AC_RUN_IFELSE([AC_LANG_PROGRAM([[]], [[
#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
return 0;
#else
return 1;
#endif]])],
[COB_USES_GCC_ONLY=yes],
[],
[])
AC_RUN_IFELSE([AC_LANG_PROGRAM([[]], [[
#ifdef __INTEL_COMPILER
return 0;
#else
return 1;
#endif]])],
[COB_USES_ICC_ONLY=yes],
[],
[])
COB_CC="$CC"
if test "$COB_USES_ICC_ONLY" = "yes"; then
LIBCOB_LIBS="-limf -lm"
else
LIBCOB_LIBS="-lm"
fi
# Configure options.
AC_ARG_ENABLE([debug],
[ --enable-debug (GnuCOBOL) Enable -g C compiler debug option],
[],
[enable_debug=no])
AC_ARG_ENABLE([experimental],
[ --enable-experimental (GnuCOBOL) Enable experimental code (Developers only!)],
[if test "$enable_experimental" = "yes"; then
AC_DEFINE([COB_EXPERIMENTAL], [1])
fi],
[])
AC_ARG_ENABLE([param-check],
[ --enable-param-check (GnuCOBOL) Enable CALL parameter checking (default no)],
[if test "$enable_param_check" = "yes"; then
AC_DEFINE([COB_PARAM_CHECK], [1])
fi],
[])
AC_ARG_WITH([patch-level],
[ --with-patch-level (GnuCOBOL) Define a patch level (default 0)],
[case $with_patch_level in
yes) AC_MSG_ERROR([[You must give --with-patch-level an argument.]])
;;
no) AC_MSG_ERROR([[--without-patch-level not supported.]])
;;
[[0-9]]*)
;;
*) AC_MSG_ERROR([[You must use a numeric patch level]])
;;
esac],
[with_patch_level=0])
AC_DEFINE_UNQUOTED([PATCH_LEVEL], [$with_patch_level])
AC_ARG_WITH([curses],
[ --with-curses (GnuCOBOL) Used curses library for extended SCREEN I/O (default=check)],
[case "$with_curses" in
ncursesw | ncurses | pdcurses | curses | check | no)
USE_NCURSES="$with_curses"
;;
*)
AC_MSG_ERROR([Wrong value for --with-curses, must be one of the following
ncursesw, ncurses, pdcurses, curses (use only the specified library)
check (use whatever curses library is usable, disable if no one usable)
no (disable curses usage)])
;;
esac],
[USE_NCURSES="check"])
AC_ARG_WITH([seqra-extfh],
[ --with-seqra-extfh (GnuCOBOL) Use external SEQ/RAN file handler],
[ if test "$with_seqra_extfh" = "yes"; then
AC_DEFINE([WITH_SEQRA_EXTFH], [1])
fi ],
[])
AC_ARG_WITH([cisam],
[ --with-cisam (GnuCOBOL) Use CISAM for ISAM I/O],
[ if test "$with_cisam" = "yes"; then
AC_CHECK_HEADERS([isam.h], [],
AC_MSG_ERROR([isam.h is required for CISAM]))
AC_CHECK_LIB([ifisam], [isopen],
[AC_DEFINE([WITH_CISAM], [1])
LIBCOB_LIBS="$LIBCOB_LIBS -lifisam -lifisamx"],
AC_MSG_ERROR([libifisam is required for CISAM]), [-lifisamx])
fi ],
[])
if test "$with_cisam" != "yes"; then
AC_ARG_WITH([disam],
[ --with-disam (GnuCOBOL) Use DISAM for ISAM I/O],
[ if test "$with_disam" = "yes"; then
AC_CHECK_HEADERS([disam.h], [],
AC_MSG_ERROR([disam.h is required for DISAM]))
AC_CHECK_LIB([disam], [isopen],
[AC_DEFINE([WITH_DISAM], [1])
LIBCOB_LIBS="$LIBCOB_LIBS -ldisam"],
AC_MSG_ERROR([libdisam is required for DISAM]), [])
fi ],
[])
fi
if test "$with_cisam" != "yes" -a "$with_disam" != "yes"; then
AC_ARG_WITH([vbisam],
[ --with-vbisam (GnuCOBOL) Use VBISAM for ISAM I/O],
[ if test "$with_vbisam" = "yes"; then
AC_CHECK_HEADERS([vbisam.h], [],
AC_MSG_ERROR([vbisam.h is required for VBISAM]))
AC_CHECK_LIB([vbisam], [isopen],
[AC_DEFINE([WITH_VBISAM], [1])
LIBCOB_LIBS="$LIBCOB_LIBS -lvbisam"],
AC_MSG_ERROR([libvbisam is required for VBISAM]), [])
fi ],
[])
fi
if test "$with_cisam" != "yes" -a "$with_disam" != "yes" -a "$with_vbisam" != "yes"; then
AC_ARG_WITH([index-extfh],
[ --with-index-extfh (GnuCOBOL) Use external ISAM file handler],
[ if test "$with_index_extfh" = "yes"; then
AC_DEFINE([WITH_INDEX_EXTFH], [1])
fi ],
[])
fi
if test "$with_cisam" != "yes" -a "$with_disam" != "yes" -a "$with_vbisam" != "yes" -a "$with_index_extfh" != "yes"; then
AC_ARG_WITH([db],
[ --with-db (GnuCOBOL) Use Berkeley DB >= 4.1 for ISAM I/O (default)],
[],
[with_db=yes])
fi
AC_ARG_WITH([dl],
[ --with-dl (GnuCOBOL) Use system dynamic loader (default)],
[case $with_dl in
yes)
;;
no)
;;
*) AC_MSG_ERROR([[--with/without-dl can not have a value]])
;;
esac],
[with_dl=yes])
AC_ARG_WITH([varseq],
[ --with-varseq (GnuCOBOL) Define variable sequential format (default 0)],
[case $with_varseq in
yes) AC_MSG_ERROR([[You must give --with-varseq an argument.]])
;;
no) AC_MSG_ERROR([[--without-varseq not supported.]])
;;
[[0-3]])
;;
*) AC_MSG_ERROR([[Invalid --with-varseq argument]])
;;
esac],
[with_varseq=0])
AC_DEFINE_UNQUOTED([WITH_VARSEQ], [$with_varseq])
# Checks for gmp.
AC_MSG_NOTICE([Checks for GMP ...])
AC_CHECK_HEADERS([gmp.h], [], AC_MSG_ERROR([gmp.h (GMP) is required]), [])
AC_CHECK_LIB([gmp], [__gmpz_init],
[LIBCOB_LIBS="$LIBCOB_LIBS -lgmp"],
AC_MSG_ERROR([GMP is required]), [])
# Check just major/minor levels between header and library
MYOLDLIBS=$LIBS
LIBS="$MYOLDLIBS -lgmp"
# get GMP version from header
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdio.h>
#include <gmp.h>
int main (int argc, char **argv)
{
(void)argv;
if (argc > 1)
printf ("%d.%d\n", __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR);
return 0;
}
]])],
[COB_GMP_HEADER=`./conftest$ac_exeext x`],
[AC_MSG_ERROR([Unable to extract GMP version information from gmp.h])],
[])
if test "x$COB_GMP_HEADER" = "x"; then
AC_MSG_ERROR([Unable to extract GMP version information])
fi
# get GMP version from lib
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdio.h>
#include <gmp.h>
int main (int argc, char **argv)
{
(void)argv;
if (argc > 1)
puts (gmp_version);
return 0;
}
]])],
[COB_GMP_LIB=`./conftest$ac_exeext x`],
[AC_MSG_ERROR([Unable to extract GMP version information from gmp_version])],
[])
if test "x$COB_GMP_LIB" = "x"; then
AC_MSG_ERROR([Unable to extract GMP version information])
fi
AC_MSG_CHECKING([matching GMP version])
COB_GMP_LIB_MAJOR=$(echo "$COB_GMP_LIB" | cut -d. -f1)
COB_GMP_LIB_MINOR=$(echo "$COB_GMP_LIB" | cut -d. -f2)
if test "$COB_GMP_HEADER" == "$COB_GMP_LIB_MAJOR.$COB_GMP_LIB_MINOR"; then
AC_MSG_RESULT([yes ($COB_GMP_HEADER)])
else
AC_MSG_RESULT([no ($COB_GMP_HEADER / $COB_GMP_LIB)])
AC_MSG_ERROR([Unable to use GMP - Please check config.log])
fi
LIBS=$MYOLDLIBS
# Works fine as an alternative if necessary
# AC_SEARCH_LIBS([__gmp_get_memory_functions], [gmp], [AC_DEFINE([HAVE_MP_GET_MEMORY_FUNCTIONS], [1])], [], [])
AC_CHECK_LIB([gmp], [__gmp_get_memory_functions], [AC_DEFINE([HAVE_MP_GET_MEMORY_FUNCTIONS], [1])], [], [])
# Solaris has nanosleep in other libraries
AC_MSG_CHECKING([for nanosleep])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]],
[[nanosleep (NULL, NULL);]])],
[AC_DEFINE([HAVE_NANO_SLEEP], [1]) AC_MSG_RESULT([yes])],
[AC_CHECK_LIB([rt], [nanosleep], [], [], [])
if test "x$ac_cv_lib_rt_nanosleep" = "xyes"; then
AC_DEFINE([HAVE_NANO_SLEEP], [1])
AC_MSG_RESULT([yes])
LIBCOB_LIBS="$LIBCOB_LIBS -lrt"
else
AC_CHECK_LIB([posix4], [nanosleep], [], [], [])
if test "x$ac_cv_lib_posix4_nanosleep" = "xyes"; then
AC_DEFINE([HAVE_NANO_SLEEP], [1])
AC_MSG_RESULT([yes])
LIBCOB_LIBS="$LIBCOB_LIBS -lposix4"
else
AC_MSG_RESULT([no])
fi
fi])
AC_MSG_CHECKING([for clock_gettime and CLOCK_REALTIME])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]],
[[clock_gettime (CLOCK_REALTIME, NULL);]])],
[AC_DEFINE([HAVE_CLOCK_GETTIME], [1]) AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
# Check for raise (optional) --> done via AC_CHECK_FUNCS
#AC_MSG_CHECKING([for raise])
#AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>]],
# [[raise (SIGINT);]])],
# [AC_DEFINE([HAVE_RAISE], [1]) AC_MSG_RESULT([yes])],
# [AC_MSG_RESULT([no])],
# [])
# Check prototype for finite in math.h (alternative ieeefp.h)
AC_MSG_CHECKING([prototype for finite in <math.h>])
AC_EGREP_HEADER(finite, math.h, AC_MSG_RESULT([yes]),
[AC_MSG_RESULT([no])
AC_MSG_CHECKING([prototype for finite in <ieeefp.h>])
AC_EGREP_HEADER(finite, ieeefp.h,
[AC_DEFINE([HAVE_FINITE_IEEEFP_H], [1]) AC_MSG_RESULT([yes])],
AC_MSG_ERROR([
Declaration for finite function neither in math.h nor in ieeefp.h]))
])
AC_CHECK_FUNCS([fdatasync sigaction])
# Checks for gettext.
case $host_os in
darwin* | rhapsody*)
;;
*)
gt_cv_func_CFPreferencesCopyAppValue=no
gt_cv_func_CFLocaleCopyCurrent=no
;;
esac
# Disable for Cygwin
AC_RUN_IFELSE([AC_LANG_PROGRAM([[]], [[
#ifdef __CYGWIN__
return 0;
#else
return 1;
#endif]])],
[enable_nls=no],
[],
[])
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.19.4])
if test "x$LTLIBINTL" != "x"; then
COBC_LIBS="$COBC_LIBS $LTLIBINTL"
LIBCOB_LIBS="$LIBCOB_LIBS $LTLIBINTL"
fi
# Checks for internationalization stuff
# AM_ICONV
AM_LANGINFO_CODESET
# Checks for ncurses/pdcurses/curses.
AC_MSG_NOTICE([Checks for curses ...])
if test "$USE_NCURSES" = "ncursesw" -o "$USE_NCURSES" = "check"; then
AC_CHECK_LIB([ncursesw], [initscr], [], [], [])
if test "x$ac_cv_lib_ncursesw_initscr" = "xyes"; then
AC_CHECK_HEADERS([ncursesw/ncurses.h], [USE_NCURSES="ncursesw"],
[AC_CHECK_HEADERS([ncursesw/curses.h], [USE_NCURSES="ncursesw"],
[if test "$USE_NCURSES" = "ncursesw"; then
USE_NCURSES="missing_header"
fi], [])], [])
if test "$USE_NCURSES" = "ncursesw"; then
LIBCOB_LIBS="$LIBCOB_LIBS -lncursesw"
fi
else
if test "$USE_NCURSES" = "ncursesw"; then
USE_NCURSES="missing_lib"
fi
fi
fi
if test "$USE_NCURSES" = "ncurses" -o "$USE_NCURSES" = "check"; then
AC_CHECK_LIB([ncurses], [initscr], [], [], [])
if test "x$ac_cv_lib_ncurses_initscr" = "xyes"; then
AC_CHECK_HEADERS([ncurses.h], [USE_NCURSES="ncurses"],
[AC_CHECK_HEADERS([ncurses/ncurses.h], [USE_NCURSES="ncurses"],
[AC_CHECK_HEADERS([curses.h], [USE_NCURSES="ncurses"],
[if test "$USE_NCURSES" = "ncurses"; then
USE_NCURSES="missing_header"
fi], [])], [])], [])
if test "$USE_NCURSES" = "ncurses"; then
LIBCOB_LIBS="$LIBCOB_LIBS -lncurses"
fi
else
if test "$USE_NCURSES" = "ncurses"; then
USE_NCURSES="missing_lib"
fi
fi
fi
if test "$USE_NCURSES" = "pdcurses" -o "$USE_NCURSES" = "check"; then
AC_CHECK_LIB([pdcurses], [initscr], [], [], [])
if test "x$ac_cv_lib_pdcurses_initscr" = "xyes"; then
AC_CHECK_HEADERS([pdcurses.h], [USE_NCURSES="pdcurses"],
[AC_CHECK_HEADERS([curses.h], [USE_NCURSES="pdcurses"],
[if test "$USE_NCURSES" = "pdcurses"; then
USE_NCURSES="missing_header"
fi], [])], [])
if test "$USE_NCURSES" = "pdcurses"; then
LIBCOB_LIBS="$LIBCOB_LIBS -lpdcurses"
fi
else
if test "$USE_NCURSES" = "pdcurses"; then
USE_NCURSES="missing_lib"
fi
fi
fi
if test "$USE_NCURSES" = "curses" -o "$USE_NCURSES" = "check"; then
AC_CHECK_LIB([curses], [initscr], [], [], [])
if test "x$ac_cv_lib_curses_initscr" = "xyes"; then
AC_CHECK_HEADERS([curses.h], [USE_NCURSES="curses"],
[if test "$USE_NCURSES" = "curses"; then
USE_NCURSES="missing_header"
fi], [])
if test "$USE_NCURSES" != "no"; then
LIBCOB_LIBS="$LIBCOB_LIBS -lcurses"
fi
fi
else
if test "$USE_NCURSES" = "curses"; then
USE_NCURSES="missing_lib"
fi
fi
case "$USE_NCURSES" in
check)
USE_NCURSES="not_found"
AC_DEFINE([WITH_CURSES], ["no curses found"])
;;
no)
AC_DEFINE([WITH_CURSES], ["disabled"])
;;
missing_lib)
AC_MSG_ERROR([[Not able to link configured library $with_curses]])
;;
missing_header)
AC_MSG_ERROR([[No header found for configured library $with_curses]])
;;
ncursesw)
AC_DEFINE([WITH_CURSES], ["ncursesw"])
;;
ncurses)
AC_DEFINE([WITH_CURSES], ["ncurses"])
;;
pdcurses)
AC_DEFINE([WITH_CURSES], ["pdcurses"])
;;
curses)
AC_DEFINE([WITH_CURSES], ["curses"])
;;
esac
if test "$USE_NCURSES" = "ncurses" -o "$USE_NCURSES" = "ncursesw"; then
AC_MSG_CHECKING([for ncurses _nc_freeall function])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
extern void _nc_freeall (void);]],
[[_nc_freeall ();]])],
[AC_DEFINE([HAVE_CURSES_FREEALL], [1]) AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])],
[])
AC_MSG_CHECKING([for ncurses use_legacy_coding function])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
extern void use_legacy_coding (void);]],
[[use_legacy_coding ();]])],
[AC_DEFINE([HAVE_USE_LEGACY_CODING], [1]) AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])],
[])
fi
if test "$USE_NCURSES" != "no" -a "$USE_NCURSES" != "not_found"; then
AC_MSG_CHECKING([for curses color_set function])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#ifdef HAVE_NCURSESW_NCURSES_H
#include <ncursesw/ncurses.h>
#elif defined (HAVE_NCURSESW_CURSES_H)
#include <ncursesw/curses.h>
#elif defined (HAVE_NCURSES_H)
#include <ncurses.h>
#elif defined (HAVE_NCURSES_NCURSES_H)
#include <ncurses/ncurses.h>
#elif defined (HAVE_PDCURSES_H)
#include <pdcurses.h>
#elif defined (HAVE_CURSES_H)
#include <curses.h>
#endif]], [[
color_set (0, NULL);]])],
[AC_DEFINE([HAVE_COLOR_SET], [1]) AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])],
[])
fi
# Checks for db.
if test "$with_db" = "yes"; then
AC_MSG_NOTICE([Checks for Berkeley DB ...])
AC_CHECK_HEADERS([db.h], [], AC_MSG_ERROR([Berkeley DB db.h is missing]), [])
# BDB header exists. Extract major/minor number pair
COB_BDB_HEADER=''
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdio.h>
#include <db.h>
int main (int argc, char **argv)
{
(void)argv;
if (argc > 1)
printf ("%d.%d\n", DB_VERSION_MAJOR, DB_VERSION_MINOR);
return 0;
}
]])],
[COB_BDB_HEADER=`./conftest$ac_exeext x`],
[AC_MSG_ERROR([Unable to extract Berkeley DB version information from db.h])],
[])
if test "x$COB_BDB_HEADER" = "x"; then
AC_MSG_ERROR([Unable to extract Berkeley DB version information])
fi
AC_MSG_CHECKING([for Berkeley DB db.h version >= 4.1])
COB_BDB_HEADER_MAJOR=$(echo "$COB_BDB_HEADER" | cut -d. -f1)
if test $COB_BDB_HEADER_MAJOR -gt 4; then
AC_MSG_RESULT([yes ($COB_BDB_HEADER)])
else
COB_BDB_HEADER_MINOR=$(echo "$COB_BDB_HEADER" | cut -d. -f2)
if test $COB_BDB_HEADER_MAJOR -eq 4 -a $COB_BDB_HEADER_MINOR -ge 1; then
AC_MSG_RESULT([yes ($COB_BDB_HEADER)])
else
AC_MSG_RESULT([no ($COB_BDB_HEADER)])
AC_MSG_ERROR([Berkeley DB db.h has incompatible version])
fi
fi
MYOLDLIBS="$LIBS"
cob_got_db=no
AC_MSG_CHECKING([for Berkeley DB library with version $COB_BDB_HEADER])
for cobdb in db db-$COB_BDB_HEADER
do
LIBS="$MYOLDLIBS -l$cobdb"
AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>
#include <db.h>]], [[
int major, minor, patch;
db_version (&major, &minor, &patch);
if (major == DB_VERSION_MAJOR && minor == DB_VERSION_MINOR) {
return 0;
}
return 1;]])],
[AC_DEFINE([WITH_DB], [1])
cob_got_db=yes
LIBCOB_LIBS="$LIBCOB_LIBS -l$cobdb"
break],
[],
[])
done
LIBS="$MYOLDLIBS"
if test "$cob_got_db" = "yes"; then
AC_MSG_RESULT([yes])
AC_MSG_NOTICE([BDB library version $COB_BDB_HEADER found as -l$cobdb])
else
AC_MSG_RESULT([no])
AC_MSG_ERROR([BDB library version $COB_BDB_HEADER not found])
fi
unset cobdb
unset cob_got_db
unset COB_BDB_HEADER
fi
# Checks for dl/ltdl.
DEFINE_DL="no"
AC_RUN_IFELSE([AC_LANG_PROGRAM([[]], [[
#ifdef _WIN32
return 0;
#else
return 1;
#endif]])],
[DEFINE_DL="yes"],
[],
[])
if test "$DEFINE_DL" = "no" -a "$with_dl" = "yes"; then
if test "x$ac_cv_header_dlfcn_h" = "xyes"; then
AC_CHECK_LIB([c], [dlopen], [DEFINE_DL="yes"], [], [])
if test "$DEFINE_DL" = "no"; then
AC_CHECK_LIB([dl], [dlopen], [DEFINE_DL="yes"], [], [])
if test "$DEFINE_DL" = "yes"; then
AC_DEFINE([USE_LIBDL], [1])
LIBCOB_LIBS="$LIBCOB_LIBS -ldl"
AC_CHECK_LIB([dl], [dladdr], [AC_DEFINE([HAVE_DLADDR], [1])], [], [])
else
AC_CHECK_LIB([dld], [dlopen], [DEFINE_DL="yes"], [], [])
if test "$DEFINE_DL" = "yes"; then
AC_DEFINE([USE_LIBDL], [1])
LIBCOB_LIBS="$LIBCOB_LIBS -ldld"
AC_CHECK_LIB([dld], [dladdr], [AC_DEFINE([HAVE_DLADDR], [1])], [], [])
fi
fi
else
AC_DEFINE([USE_LIBDL], [1])
AC_CHECK_LIB([c], [dladdr], [AC_DEFINE([HAVE_DLADDR], [1])], [], [])
fi
fi
fi
if test "$DEFINE_DL" = "no"; then
AC_CHECK_HEADERS([ltdl.h], [], AC_MSG_ERROR([ltdl.h is required]), [])
AC_CHECK_LIB([ltdl], [lt_dlopen],
[LIBCOB_LIBS="$LIBCOB_LIBS -lltdl"],
AC_MSG_ERROR([libltdl is required]), [])
fi
# Checks for workable strftime
AC_MSG_CHECKING([for working strftime])
AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>
#include <time.h>]], [[
time_t ticks;
int ret;
char buff[16];
ticks = time(NULL);
ret = strftime(buff, 15, "%z", localtime(&ticks));
if (ret != 5) {
return 1;
}
if (buff[0] != '+' && buff[0] != '-') {
return 1;
}
return 0;]])],
[AC_DEFINE([COB_STRFTIME], [1]) AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])],
[])
# Checks for size of long
AC_MSG_CHECKING([if size of long int = size of long long])
AC_RUN_IFELSE([AC_LANG_PROGRAM([[]], [[
if (sizeof(long int) == sizeof(long long))
return 0;
return 1;
]])],
[AC_DEFINE([COB_LI_IS_LL], [1]) AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])],
[])
# Check gcc 4 pointer sign option
if test "$COB_USES_GCC_ONLY" = "yes"; then
MYOLDCFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wno-pointer-sign"
AC_MSG_CHECKING([for gcc pointer sign option])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[int testint;]])],
[AC_DEFINE([HAVE_PSIGN_OPT], [1]) AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
CFLAGS="$MYOLDCFLAGS"
fi
#if test "$enable_debug" != "yes" -a "$COB_USES_GCC_ONLY" = "yes"; then
# MYOLDCFLAGS="$CFLAGS"
# CFLAGS="$CFLAGS -fno-asynchronous-unwind-tables"
# AC_MSG_CHECKING([for gcc unwind tables option])
# AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[int testint;]])],
# [AC_DEFINE([HAVE_UNWIND_OPT], [1]) AC_MSG_RESULT([yes])],
# [AC_MSG_RESULT([no])])
# CFLAGS="$MYOLDCFLAGS"
#fi
# Check gcc wrapv option
# We MAY need this eventually for >= 4.4. 4.3 appears to be OK.
#if test "$COB_USES_GCC_ONLY" = "yes"; then
# MYOLDCFLAGS="$CFLAGS"
# CFLAGS="$CFLAGS -fwrapv"
# AC_MSG_CHECKING([for gcc -fwrapv option])
# AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[int testint;]])],
# [AC_DEFINE([HAVE_FWRAPV_OPT], [1]) AC_MSG_RESULT([yes])],
# [AC_MSG_RESULT([no])])
# [],
# [CFLAGS="$MYOLDCFLAGS"])
# CFLAGS="$MYOLDCFLAGS"
#fi
# Check if aligned attribute works
AC_MSG_CHECKING([for aligned attribute])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],
[[char testchar[4] __attribute__((aligned));]])],
[AC_DEFINE([HAVE_ATTRIBUTE_ALIGNED], [1]) AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
# GnuCOBOL Configuration
if test "x$prefix" = "xNONE"; then
if test "x$includedir" = "x\${prefix}/include"; then
COB_CFLAGS="-I${ac_default_prefix}/include"
else
COB_CFLAGS="-I${includedir}"
fi
else
if test "x$includedir" = "x\${prefix}/include"; then
if test "x$prefix" = "x/usr"; then
COB_CFLAGS=""
else
COB_CFLAGS="-I${prefix}/include"
fi
else
COB_CFLAGS="-I${includedir}"
fi
fi
if test "x$CPPFLAGS" != "x"; then
COB_CFLAGS="$COB_CFLAGS $CPPFLAGS"
fi
COB_LIBS="-L$libdir -lcob ${LIBCOB_LIBS}"
COB_LDFLAGS=""
if test "x$LDFLAGS" != "x"; then
COB_LIBS="$LDFLAGS $COB_LIBS"
COB_LDFLAGS="$LDFLAGS"
fi
COB_CONFIG_DIR="$datadir/$PACKAGE_TARNAME/config"
COB_COPY_DIR="$datadir/$PACKAGE_TARNAME/copy"
COB_LIBRARY_PATH="$libdir/$PACKAGE_TARNAME"
COB_MODULE_EXT=`echo "$acl_cv_shlibext" | sed -e 's/dll\.a/dll/'`
COB_OBJECT_EXT="$OBJEXT"
LIBS="$save_libs"
COB_EXPORT_DYN="`eval echo $export_dynamic_flag_spec`"
COB_PIC_FLAGS=`echo "$lt_prog_compiler_pic" | sed -e 's/^ //'`
COB_SHARED_OPT="-shared"
COB_EXEEXT="$EXEEXT"
if test "$enable_cflags_setting" = yes; then
# Remove -O2 option added by AC_PROG_CC and add -O0
CFLAGS=`echo "$CFLAGS" | sed -e 's/ *-O@<:@0-9a-zA-Z@:>@* */ /g' -e 's/ $//' -e 's/^ //'`
if test "$COB_USES_GCC_ICC" = "yes"; then
CFLAGS="$CFLAGS -O0"
fi
fi
unset enable_cflags_setting
if test "$enable_debug" != "yes" -a "x$CFLAGS" != "x"; then
CFLAGS=`echo "$CFLAGS" | sed -e 's/-g//' -e 's/^ //' -e 's/ $//'`
fi
# Include CFLAGS in COB_CFLAGS without optimization/debug options
cob_temp_flags=""
if test "x$CFLAGS" != "x"; then
cob_temp_flags=`echo "$CFLAGS" | sed -e 's/-g//' -e 's/ $//' -e 's/^ //'`
cob_temp_flags=`echo "$cob_temp_flags" | sed -e 's/@<:@+-@:>@O@<:@0-9s@:>@//' -e 's/ $//' -e 's/^ //'`
cob_temp_flags=`echo "$cob_temp_flags" | sed -e 's/-O//' -e 's/ $//' -e 's/^ //'`
cob_temp_flags=`echo "$cob_temp_flags" | sed -e 's/-fmessage-length=0//'`
cob_temp_flags=`echo "$cob_temp_flags" | sed -e 's/-D_FORTIFY_SOURCE=.//'`
cob_temp_flags=`echo "$cob_temp_flags" | sed -e 's/-fstack-protector//'`
cob_temp_flags=`echo "$cob_temp_flags" | sed -e 's/-funwind-tables//'`
cob_temp_flags=`echo "$cob_temp_flags" | sed -e 's/-fasynchronous-unwind-tables//'`
cob_temp_flags=`echo "$cob_temp_flags" | sed -e 's/ */ /g' -e 's/ $//' -e 's/^ //'`
fi
if test "x$cob_temp_flags" != "x"; then
COB_CFLAGS="$COB_CFLAGS $cob_temp_flags"
fi
unset cob_temp_flags
if test "$COB_USES_GCC_ICC" = "yes"; then
if test "x$CFLAGS" != "x"; then
CFLAGS="$CFLAGS -pipe"
else
CFLAGS="-pipe"
fi
if test "x$COB_CFLAGS" != "x"; then
COB_CFLAGS="$COB_CFLAGS -pipe"
else
COB_CFLAGS="-pipe"
fi
fi
# Special stuff
AH_VERBATIM([_XOPEN_SOURCE_EXTENDED],
[/* Define to 1 if on HPUX. */
#ifndef _XOPEN_SOURCE_EXTENDED
# undef _XOPEN_SOURCE_EXTENDED
#endif])dnl
COB_FIX_LIB="$COB_EXPORT_DYN"
COB_FIX_LIBTOOL=""
case $host_os in
mingw*)
if test "$prefix" = "NONE"; then
COB_CONFIG_DIR="`cd /usr && pwd -W`/local/share/$PACKAGE_TARNAME/config"
COB_COPY_DIR="`cd /usr && pwd -W`/local/share/$PACKAGE_TARNAME/copy"
fi
COB_EXPORT_DYN="-Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-auto-image-base"
COB_FIX_LIB=""
COB_FIX_LIBTOOL="-Wl,--enable-auto-import"
;;
cygwin*)
COB_EXPORT_DYN="-Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-auto-image-base"
COB_FIX_LIB=""
COB_FIX_LIBTOOL="-Wl,--enable-auto-import"
;;
darwin* | rhapsody*)
COB_SHARED_OPT="-bundle -flat_namespace -undefined suppress"
;;
hpux*)
if test "$COB_USES_GCC_ICC" != "yes"; then
COB_SHARED_OPT="-b"
AC_DEFINE([_XOPEN_SOURCE_EXTENDED], [1])
rm -f hptest*
echo 'int main() { return 0; }' > hptest.c
${CC} ${CFLAGS} +Olit=all -o hptest hptest.c > hptest.out 2>&1
if test $? -ne 0 -o -s hptest.out; then
CFLAGS="$CFLAGS +ESlit"
COB_CFLAGS="$COB_CFLAGS +ESlit -w"
else
CFLAGS="$CFLAGS +Olit=all"
COB_CFLAGS="$COB_CFLAGS +Olit=all -w"
fi
if test "$enable_debug" = "yes"; then
CFLAGS="$CFLAGS +O0"
else
CFLAGS="$CFLAGS +O2"
fi
rm -f hptest*
fi
;;
aix*)