-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.ac
1948 lines (1557 loc) · 70 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.AC: Process this file with AutoConf to produce a configure script.
###############################################################################
# $Id$
# AC is AutoConfigure, AM is AutoMake, and AH is AutoHeader. The
# 'HC_XXXX..' macros are custom Hercules autoconf macros defined
# in the 'hercules.m4' file in the 'autoconf' subdirectory.
AC_INIT(hercules.h) # (package, version, bugreport email, etc)
AC_REVISION($Revision$) # (the version of this configure.ac)
AC_CONFIG_AUX_DIR(autoconf) # (directory containing auxillary build tools)
AM_INIT_AUTOMAKE(hercules,3.13) # (the version of our software package)
AM_CONFIG_HEADER(config.h) # (the file the resulting configure script will produce)
AM_MAINTAINER_MODE()
AC_CANONICAL_HOST() # (sets $host_cpu, $host_vendor, and $host_os)
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
###############################################################################
# Programs section...
###############################################################################
# Set CFLAGS first to override the AC_PROG_CC default setting
CFLAGS="$CFLAGS -W -Wall"
AC_PROG_CC() # (set CC to the name of the compiler)
# -----------------------------------------------------------------------------
# PROGRAMMING NOTE: The below 'AC_SUBST' macro causes AC_OUTPUT to replace
# all instances of "@xxxxxx@" in input files with the value that the shell
# variable "xxxxxx" has when AC_OUTPUT is called. However, we setup a define
# for source files (MODULESDIR) and a variable for make ($(modexecdir)). Any
# other usage should be avoided.
# -----------------------------------------------------------------------------
modexecdir='$(libdir)/$(PACKAGE)'
AC_SUBST(modexecdir)
# -----------------------------------------------------------------------------
#
# AC_LIBTOOL_DLOPEN
#
# Enable checking for dlopen support. This macro should be used if the
# package makes use of the '-dlopen' and '-dlpreopen' flags, otherwise
# libtool will assume that the system does not support dlopening. The
# macro must be called before AC_PROG_LIBTOOL.
#
# -----------------------------------------------------------------------------
AC_LIBTOOL_DLOPEN() # (we need libtool's dlopen support)
# -----------------------------------------------------------------------------
#
# AC_LIBTOOL_WIN32_DLL
#
# This macro should be used if the package has been ported to build
# clean dlls on win32 platforms. Usually this means that any library
# data items are exported with __declspec(dllexport) and imported with
# __declspec(dllimport). If this macro is not used, libtool will assume
# that the package libraries are not dll clean and will build only static
# libraries on win32 hosts.
#
# This macro must be called before AC_PROG_LIBTOOL, and provision must
# be made to pass '-no-undefined' to libtool in link mode from the package
# Makefile. Naturally, if you pass '-no-undefined', you must ensure that
# all the library symbols really are defined at link time!
#
# -----------------------------------------------------------------------------
AC_LIBTOOL_WIN32_DLL() # (we need Win32 support in libtool)
# -----------------------------------------------------------------------------
# See: 'AC_PROG_LIBTOOL' below.
# -----------------------------------------------------------------------------
AC_DISABLE_STATIC() # (forces libtool to build shared
# libraries instead of static ones)
# -----------------------------------------------------------------------------
# AC_PROG_LIBTOOL
#
# Add support for the '--enable-shared' and '--disable-shared'
# configure flags. By default, this macro turns on shared libraries
# if they are available, and also enables static libraries if they
# don't conflict with the shared libraries. You can modify these
# defaults by calling either the AC_DISABLE_SHARED or AC_DISABLE_STATIC
# macros.
#
# Hercules REQUIRES shared libraries (i.e. DLLs), so we do indeed use
# the AC_DISABLE_STATIC macro above.
#
# -----------------------------------------------------------------------------
AC_PROG_LIBTOOL() # (we build libtool for ourselves)
# -----------------------------------------------------------------------------
#
# AC_LIB_LTDL
#
# Even though libltdl is installed together with libtool, you may wish
# to include libltdl in the distribution of your package, for the convenience
# of users of your package that don't have libtool or libltdl installed.
#
# The most simplistic way to add libltdl to your package is to copy the
# source files, 'ltdl.c' and 'ltdl.h', to a source directory withing your
# package and to build and link them along with the rest of your sources.
#
# To do this, you must add a call to the 'AC_LIB_LTDL' macro to your package's
# 'configure.in' to perform the required configure time checks in order that
# 'ltdl.o' is built correctly.
#
# This method does have its problems though: if you try to link the package
# binaries with an installed libltdl, or a library which depends on libltdl,
# you may have problems with duplicate symbol definitions.
#
# In order to enable this flavor of libltdl, you should add the line
# 'AC_LIBLTDL_CONVENIENCE' to your `configure.in', before 'AC_PROG_LIBTOOL'.
#
# In order to select the installable version of libltdl, you should add a
# call of the macro 'AC_LIBLTDL_INSTALLABLE' to your 'configure.in' before
# 'AC_PROG_LIBTOOL'. This macro will check whether libltdl is already
# installed and, if not, request the libltdl embedded in your package to be
# built and installed.
#
# Whatever macro you use, it is up to you to ensure that your 'configure.in'
# will configure libltdl, using 'AC_CONFIG_SUBDIRS', and that your 'Makefile's
# will start sub-makes within libltdl's directory, using automake's SUBDIRS,
# for example. Both macros define the shell variables LIBLTDL, to the link flag
# that you should use to link with libltdl, and LTDLINCL, to the preprocessor
# flag that you should use to compile with programs that include 'ltdl.h'. It
# is up to you to use 'AC_SUBST' to ensure that this variable will be available
# in 'Makefile's, or add them to variables that are 'AC_SUBST'ed by default,
# such as LIBS and CPPFLAGS.
#
# So, when you want to link a program with libltdl, be it a convenience,
# installed or installable library, just compile with '$(LTDLINCL)' and link
# it with '$(LIBLTDL)', using libtool.
#
# You should probably also add 'AC_LIBTOOL_DLOPEN' to your 'configure.in' before
# 'AC_PROG_LIBTOOL', otherwise libtool will assume no dlopening mechanism is
# supported, and revert to dlpreopening, which is probably not what you want.
#
# The following example shows you how to embed the convenience libltdl
# in your package. In order to use the installable variant just replace
# 'AC_LIBLTDL_CONVENIENCE' with 'AC_LIBLTDL_INSTALLABLE'. We assume that libltdl
# was embedded using 'libtoolize --ltdl':
#
# configure.in:
#
# ...
# dnl Enable building of the convenience library
# dnl and set LIBLTDL accordingly
# AC_LIBLTDL_CONVENIENCE
# dnl Substitute LTDLINCL and LIBLTDL in the Makefiles
# AC_SUBST(LTDLINCL)
# AC_SUBST(LIBLTDL)
# dnl Check for dlopen support
# AC_LIBTOOL_DLOPEN
# dnl Configure libtool
# AC_PROG_LIBTOOL
# dnl Configure libltdl
# AC_CONFIG_SUBDIRS(libltdl)
# ...
#
# Makefile.am:
#
# ...
# SUBDIRS = libltdl
#
# INCLUDES = $(LTDLINCL)
#
# myprog_LDFLAGS = -export-dynamic
# # The quotes around -dlopen below fool automake <= 1.4 into accepting it
# myprog_LDADD = $(LIBLTDL) "-dlopen" self "-dlopen" foo1.la
# myprog_DEPENDENCIES = $(LIBLTDL) foo1.la
# ...
#
# -----------------------------------------------------------------------------
AC_LIB_LTDL() # (we need the ltdl libtool library)
AC_SUBST([LIBTOOL_DEPS]) # (see PROGRAMMING NOTE above)
# -----------------------------------------------------------------------------
# (See comments in the 'AC_CHECK_LIB' Libraries section further below)
# -----------------------------------------------------------------------------
AC_MSG_NOTICE( [(use of lt_dlopen forced by Hercules Dynamic Loader requirement)] )
AS_IF([test "x${with_included_ltdl}" = "xno"],
[hc_cv_have_lt_dlopen=no],
[hc_cv_have_lt_dlopen=yes])
AS_IF([test "x${ac_cv_func_dlopen}" = "xyes" -o "x${ac_cv_lib_dl_dlopen}" = "xyes"],
[hc_cv_have_dlopen=yes],
[hc_cv_have_dlopen=no])
HC_LD_DISALLOWDUPS() # (add duplicate symbols option to LDFLAGS)
# -----------------------------------------------------------------------------
# The following is a "global error" flag used to defer aborting configure
# until after ALL errors have been detected/reported.
# -----------------------------------------------------------------------------
hc_error=no
###############################################################################
# Autoheader templates
###############################################################################
# All AC_DEFINE() macros used within autoconf (to define pre-processor vars
# used during the actual build process) must have corresponding AH_TEMPLATE
# statements coded somewhere. We place them all here simply for convenience.
AH_TEMPLATE( [CUSTOM_BUILD_STRING], [Define to provide additional information about this build] )
AH_TEMPLATE( [MAX_CPU_ENGINES], [Defines the maximum number of emulated CPU engines] )
AH_TEMPLATE( [DEBUG], [Define to enable extra debugging code (TRACE/VERIFY/ASSERT macros)] )
AH_TEMPLATE( [C99_FLEXIBLE_ARRAYS], [Define if your gcc properly supports C99 flexible arrays] )
AH_TEMPLATE( [HAVE_ATTR_REGPARM], [Define if your gcc properly supports __attribute__((regparm(n)))] )
AH_TEMPLATE( [NO_ASM_BYTESWAP], [Define to disable assembler routines for byte swapping] )
AH_TEMPLATE( [NO_SETUID], [Define to disable setuid operation] )
AH_TEMPLATE( [NO_SIGABEND_HANDLER], [Define to disable sigabend_handler (please describe this better)] )
AH_TEMPLATE( [NON_UNIQUE_GETTIMEOFDAY], [Define if 'gettimeofday' returns non-unique values] )
AH_TEMPLATE( [NEED_GETOPT_WRAPPER], [Define to indicate a wrapper for getopt is needed] )
AH_TEMPLATE( [NEED_GETOPT_OPTRESET], [Define to indicate optreset exists] )
AH_TEMPLATE( [HAVE_INTTYPES_H], [Define if inttypes.h header file is present on your system] )
AH_TEMPLATE( [HAVE_U_INT], [Define if your system uses u_int8_t, etc, instead of uint8_t] )
AH_TEMPLATE( [OPTION_CONFIG_SYMBOLS], [Define to enable symbolic substitutions in configuration file] )
AH_TEMPLATE( [OPTION_ENHANCED_CONFIG_SYMBOLS], [Define to enable enhanced-mode symbolic substitutions in configuration file] )
AH_TEMPLATE( [OPTION_ENHANCED_CONFIG_INCLUDE], [Define to enable enhanced-mode 'include' file support in configuration file] )
AH_TEMPLATE( [OPTION_HAO], [Define to enable Hercules Automatic Operator feature] )
AH_TEMPLATE( [OPTION_DYNAMIC_LOAD], [Define to enable Hercules Dynamic Loader feature] )
AH_TEMPLATE( [HDL_BUILD_SHARED], [Define to indicate shared libraries are being used] )
AH_TEMPLATE( [HDL_USE_LIBTOOL], [Define to cause dynamic loader to use libtool instead of dlopen] )
AH_TEMPLATE( [BUILD_HERCIFC], [Define if hercifc program is to be built] )
AH_TEMPLATE( [WIN32], [Define when building under Win32 (MinGW or Cygwin)] )
AH_TEMPLATE( [EXTERNALGUI], [Define to build interface to external Windows GUI] )
AH_TEMPLATE( [OPTION_FTHREADS], [Define to use included threads implementation (fthreads)] )
AH_TEMPLATE( [TIMESPEC_IN_TIME_H], [Define if 'struct timespec' defined in <time.h>] )
AH_TEMPLATE( [TIMESPEC_IN_SYS_TYPES_H], [Define if 'struct timespec' defined in <sys/types.h>] )
AH_TEMPLATE( [_BSD_SOCKLEN_T_], [Define missing macro on apple darwin (osx) platform] )
AH_TEMPLATE( [CCKD_BZIP2], [Define to enable bzip2 compression in emulated DASDs] )
AH_TEMPLATE( [HET_BZIP2], [Define to enable bzip2 compression in emulated tapes] )
AH_TEMPLATE( [OPTION_CAPABILITIES], [Define to enable posix draft 1003.1e capabilities] )
###############################################################################
# OS-specific settings that we can't figure out any other way (yet)
###############################################################################
#
# Determine what type of host we're building on...
#
case "$host_os" in
linux*)
hc_cv_is_nix=yes
hc_cv_is_windows=no
hc_cv_is_mingw32=no
hc_cv_is_apple=no
;;
mingw*)
hc_cv_is_nix=no
hc_cv_is_windows=yes
hc_cv_is_mingw32=yes
hc_cv_is_apple=no
;;
cygwin*)
hc_cv_is_nix=no
hc_cv_is_windows=yes
hc_cv_is_mingw32=no
hc_cv_is_apple=no
;;
darwin*)
if test $host_vendor = apple; then
hc_cv_is_nix=no
hc_cv_is_windows=no
hc_cv_is_mingw32=no
hc_cv_is_apple=yes
else
hc_cv_is_nix=no
hc_cv_is_windows=no
hc_cv_is_mingw32=no
hc_cv_is_apple=no
fi
;;
*bsd*)
hc_cv_is_nix=yes
hc_cv_is_windows=no
hc_cv_is_mingw32=no
hc_cv_is_apple=no
;;
*)
hc_cv_is_nix=no
hc_cv_is_windows=no
hc_cv_is_mingw32=no
hc_cv_is_apple=no
;;
esac
#------------------------------------------------------#
# Hard-coded host-operating-system-specific settings #
# that we have no other/easy way to figure out... #
#------------------------------------------------------#
if test "$hc_cv_is_nix" = "yes"; then
hc_cv_build_hercifc=yes
hc_cv_non_unique_gettimeofday=no
elif test "$hc_cv_is_windows" = "yes"; then
hc_cv_build_hercifc=no
hc_cv_non_unique_gettimeofday=yes
elif test "$hc_cv_is_apple" = "yes"; then
hc_cv_build_hercifc=yes
hc_cv_non_unique_gettimeofday=no
else
hc_cv_build_hercifc=no
hc_cv_non_unique_gettimeofday=no
fi
###############################################################################
# Checks for REQUIRED (non-optional) header files...
###############################################################################
# PROGRAMMING NOTE: We use 'AC_CHECK_HEADER' here (singular) since we don't
# care whether 'HAVE_XXX' gets #defined or not since, because these are re-
# quired headers, if any of them are not found, we abort and thus we don't
# need to have any 'HAVE_XXX' pre-processor #defined entered into config.h
# (because we can't build Herc at all if any of them don't happen to exist)
AC_CHECK_HEADER( ctype.h, [], [ AC_MSG_RESULT( [ERROR: Required header 'ctype.h' not found] ); hc_error=yes ] )
AC_CHECK_HEADER( errno.h, [], [ AC_MSG_RESULT( [ERROR: Required header 'errno.h' not found] ); hc_error=yes ] )
AC_CHECK_HEADER( fcntl.h, [], [ AC_MSG_RESULT( [ERROR: Required header 'fcntl.h' not found] ); hc_error=yes ] )
AC_CHECK_HEADER( limits.h, [], [ AC_MSG_RESULT( [ERROR: Required header 'limits.h' not found] ); hc_error=yes ] )
AC_CHECK_HEADER( setjmp.h, [], [ AC_MSG_RESULT( [ERROR: Required header 'setjmp.h' not found] ); hc_error=yes ] )
AC_CHECK_HEADER( stdarg.h, [], [ AC_MSG_RESULT( [ERROR: Required header 'stdarg.h' not found] ); hc_error=yes ] )
AC_CHECK_HEADER( stdio.h, [], [ AC_MSG_RESULT( [ERROR: Required header 'stdio.h' not found] ); hc_error=yes ] )
AC_CHECK_HEADER( stdlib.h, [], [ AC_MSG_RESULT( [ERROR: Required header 'stdlib.h' not found] ); hc_error=yes ] )
AC_CHECK_HEADER( string.h, [], [ AC_MSG_RESULT( [ERROR: Required header 'string.h' not found] ); hc_error=yes ] )
AC_CHECK_HEADER( time.h, [], [ AC_MSG_RESULT( [ERROR: Required header 'time.h' not found] ); hc_error=yes ] )
AC_CHECK_HEADER( unistd.h, [], [ AC_MSG_RESULT( [ERROR: Required header 'unistd.h' not found] ); hc_error=yes ] )
AC_CHECK_HEADER( sys/stat.h, [], [ AC_MSG_RESULT( [ERROR: Required header 'sys/stat.h' not found] ); hc_error=yes ] )
AC_CHECK_HEADER( sys/time.h, [], [ AC_MSG_RESULT( [ERROR: Required header 'sys/time.h' not found] ); hc_error=yes ] )
AC_CHECK_HEADER( sys/types.h, [], [ AC_MSG_RESULT( [ERROR: Required header 'sys/types.h' not found] ); hc_error=yes ] )
# PROGRAMMING NOTE: the pthread.h header only required if this is not
# an fthreads build. Thus we delay aborting until later once we know
# (if this is a windows build; otherwise we abort right away)
AC_CHECK_HEADER( pthread.h, [hc_cv_have_pthread_h=yes],
[
if test "$hc_cv_is_windows" = "yes"; then
hc_cv_alt_pthread_location=/usr/Pthreads
AC_MSG_NOTICE( [looking for pthread.h in ${hc_cv_alt_pthread_location}] )
hc_temp=$CFLAGS
CFLAGS="$CFLAGS -I${hc_cv_alt_pthread_location}"
AC_CHECK_HEADER( pthread.h,
[hc_cv_have_pthread_h=yes],
[hc_cv_have_pthread_h=no]
)
CFLAGS=$hc_temp
else
AC_MSG_RESULT( [ERROR: Required header 'pthread.h' not found] )
hc_error=yes
fi
]
)
AC_CACHE_SAVE()
###############################################################################
# Checks for optional (non-required) header files...
###############################################################################
# PROGRAMMING NOTE: We use 'AC_CHECK_HEADERS' here (plural) to cause autoconf
# to automatically add a #define/#undef 'HAVE_XXX' statement into config.h to
# let us know whether the header exists on this system or not (since, because
# these are optional headers, we are still able to successfully build Herc if
# they don't happen to exist). The 'hc_cv_have_xxx' variables are only defined
# in case other parts of configure.ac need to know whether the header exists
# or not without having to do their own AC_CHECK_HEADERS (since we've already
# done it).
#------------------------------------------------------------------------------
# PROGRAMMING NOTE: on Darwin sys/socket.h must be included before
# net/if.h, net/route.h, or netinet/in.h can be #included, and on OS X 10.3
# (but not 10.4) sys/types.h must be #included before sys/socket.h. Thus
# the below four header checks are treated specially. If we ever drop support
# for OS X 10.3, a lot of this cruft can be removed, not just here but
# anywhere we find ourselves manually including sys/types.h.
# PROGRAMMING NOTE: on *BSD sys/socket.h must be included before net/if.h,
# net/route.h, or netinet/in.h can be #included.
AC_CHECK_HEADERS( sys/socket.h, [hc_cv_have_sys_socket_h=yes], [hc_cv_have_sys_socket_h=no],
[
#include <sys/types.h>
] )
AC_CHECK_HEADERS( net/if.h, [hc_cv_have_net_if_h=yes], [hc_cv_have_net_if_h=no],
[
#include <sys/types.h>
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
] )
AC_CHECK_HEADERS( netinet/in.h, [hc_cv_have_netinet_in_h=yes], [hc_cv_have_netinet_in_h=no],
[
#include <sys/types.h>
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
] )
AC_CHECK_HEADERS( netinet/tcp.h, [hc_cv_have_netinet_tcp_h=yes], [hc_cv_have_netinet_tcp_h=no],
[
#include <sys/types.h>
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
] )
AC_CHECK_HEADERS( net/route.h, [hc_cv_have_net_route_h=yes], [hc_cv_have_net_route_h=no],
[
#include <sys/types.h>
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
] )
#------------------------------------------------------------------------------
AC_CHECK_HEADERS( arpa/inet.h, [hc_cv_have_arpa_inet_h=yes], [hc_cv_have_arpa_inet_h=no] )
AC_CHECK_HEADERS( linux/if_tun.h, [hc_cv_have_linux_if_tun_h=yes], [hc_cv_have_linux_if_tun_h=no] )
AC_CHECK_HEADERS( sys/ioctl.h, [hc_cv_have_sys_ioctl_h=yes], [hc_cv_have_sys_ioctl_h=no] )
AC_CHECK_HEADERS( sys/mman.h, [hc_cv_have_sys_mman_h=yes], [hc_cv_have_sys_mman_h=no] )
#------------------------------------------------------------------------------
# PROGRAMMING NOTE: on *BSD systems sys/param.h must be #included before
# sys/mount.h as it contains the #define of NGROUPS.
AC_CHECK_HEADERS( sys/param.h, [hc_cv_have_sys_param_h=yes], [hc_cv_have_sys_param_h=no] )
AC_CHECK_HEADERS( sys/mount.h, [hc_cv_have_sys_mount_h=yes], [hc_cv_have_sys_mount_h=no],
[
#if HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
] )
#------------------------------------------------------------------------------
AC_CHECK_HEADERS( sys/mtio.h, [hc_cv_have_sys_mtio_h=yes], [hc_cv_have_sys_mtio_h=no] )
AC_CHECK_HEADERS( sys/resource.h, [hc_cv_have_sys_resource_h=yes], [hc_cv_have_sys_resource_h=no] )
AC_CHECK_HEADERS( sys/uio.h, [hc_cv_have_sys_uio_h=yes], [hc_cv_have_sys_uio_h=no] )
AC_CHECK_HEADERS( sys/utsname.h, [hc_cv_have_sys_utsname_h=yes], [hc_cv_have_sys_utsname_h=no] )
AC_CHECK_HEADERS( sys/wait.h, [hc_cv_have_sys_wait_h=yes], [hc_cv_have_sys_wait_h=no] )
AC_CHECK_HEADERS( sys/un.h, [hc_cv_have_sys_un_h=yes], [hc_cv_have_sys_un_h=no] )
AC_CHECK_HEADERS( byteswap.h, [hc_cv_have_byteswap_h=yes], [hc_cv_have_byteswap_h=no] )
AC_CHECK_HEADERS( bzlib.h, [hc_cv_have_bzlib_h=yes], [hc_cv_have_bzlib_h=no] )
AC_CHECK_HEADERS( dlfcn.h, [hc_cv_have_dlfcn_h=yes], [hc_cv_have_dlfcn_h=no] )
AC_CHECK_HEADERS( inttypes.h, [hc_cv_have_inttypes_h=yes], [hc_cv_have_inttypes_h=no] )
AC_CHECK_HEADERS( iconv.h, [hc_cv_have_iconv_h=yes], [hc_cv_have_iconv_h=no] )
AC_CHECK_HEADERS( ltdl.h, [hc_cv_have_ltdl_h=yes], [hc_cv_have_ltdl_h=no] )
AC_CHECK_HEADERS( malloc.h, [hc_cv_have_malloc_h=yes], [hc_cv_have_malloc_h=no] )
AC_CHECK_HEADERS( math.h, [hc_cv_have_math_h=yes], [hc_cv_have_math_h=no] )
AC_CHECK_HEADERS( netdb.h, [hc_cv_have_netdb_h=yes], [hc_cv_have_netdb_h=no] )
AC_CHECK_HEADERS( pwd.h, [hc_cv_have_pwd_h=yes], [hc_cv_have_pwd_h=no] )
AC_CHECK_HEADERS( regex.h, [hc_cv_have_regex_h=yes], [hc_cv_have_regex_h=no] )
AC_CHECK_HEADERS( sched.h, [hc_cv_have_sched_h=yes], [hc_cv_have_sched_h=no] )
AC_CHECK_HEADERS( signal.h, [hc_cv_have_signal_h=yes], [hc_cv_have_signal_h=no] )
AC_CHECK_HEADERS( termios.h, [hc_cv_have_termios_h=yes], [hc_cv_have_termios_h=no] )
AC_CHECK_HEADERS( time.h, [hc_cv_have_time_h=yes], [hc_cv_have_time_h=no] )
AC_CHECK_HEADERS( zlib.h, [hc_cv_have_zlib_h=yes], [hc_cv_have_zlib_h=no] )
AC_CHECK_HEADERS( sys/capability.h, [hc_cv_have_sys_capa_h=yes], [hc_cv_have_sys_capa_h=no] )
AC_CHECK_HEADERS( sys/prctl.h, [hc_cv_have_sys_prctl_h=yes], [hc_cv_have_sys_prctl_h=no] )
AC_CACHE_SAVE()
###############################################################################
# Checks for declarations...
###############################################################################
# PROGRAMMING NOTE: For declaration checks, you need to be careful to use the
# following test in your program:
#
# #if defined(HAVE_DECL_XXXX) && !HAVE_DECL_XXXXX
# ...code to handle not declared case...
# #endif
#
# This is because UNLIKE other 'AC_CHECK' macros, when a SYMBOL isn't DECLared,
# "HAVE_DECL_XXXX" is #defined to '0' instead of leaving "HAVE_DECL_XXXX" #undefined.
# (e.g. #defined to 1 if you have the declaration and #defined to 0 if you don't)
AC_CHECK_DECLS( SIGUSR1, [hc_cv_have_sigusr1=yes], [hc_cv_have_sigusr1=no], [#include <signal.h>] )
AC_CHECK_DECLS( SIGUSR2, [hc_cv_have_sigusr2=yes], [hc_cv_have_sigusr2=no], [#include <signal.h>] )
AC_CHECK_DECLS( SIGPIPE, [hc_cv_have_sigpipe=yes], [hc_cv_have_sigpipe=no], [#include <signal.h>] )
AC_CHECK_DECLS( SIGBUS, [hc_cv_have_sigbus=yes], [hc_cv_have_sigbus=no], [#include <signal.h>] )
AC_CHECK_DECLS( IFNAMSIZ, [hc_cv_have_ifnamsiz=yes], [hc_cv_have_ifnamsiz=no],
[
#include <sys/types.h>
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
] )
AC_CHECK_DECLS( LOGIN_NAME_MAX, [hc_cv_have_login_name_max=yes], [hc_cv_have_login_name_max=no], [#include <limits.h>] )
AC_CHECK_DECLS( _SC_NPROCESSORS_CONF, [hc_cv_have_sc_nprocessors_conf=yes], [hc_cv_have_sc_nprocessors_conf=no], [#include <unistd.h>] )
AC_CHECK_DECLS( _SC_NPROCESSORS_ONLN, [hc_cv_have_sc_nprocessors_onln=yes], [hc_cv_have_sc_nprocessors_onln=no], [#include <unistd.h>] )
AC_CHECK_DECLS( SIOCSIFNETMASK, [hc_cv_have_siocsifnetmask=yes], [hc_cv_have_siocsifnetmask=no], [#include <linux/sockios.h>] )
AC_CHECK_DECLS( SIOCSIFHWADDR, [hc_cv_have_siocsifhwaddr=yes], [hc_cv_have_siocsifhwaddr=no], [#include <linux/sockios.h>] )
AC_CHECK_DECLS( SIOCADDRT, [hc_cv_have_siocaddrt=yes], [hc_cv_have_siocaddrt=no], [#include <linux/sockios.h>] )
AC_CHECK_DECLS( SIOCDELRT, [hc_cv_have_siocdelrt=yes], [hc_cv_have_siocdelrt=no], [#include <linux/sockios.h>] )
AC_CHECK_DECLS( SIOCDIFADDR, [hc_cv_have_siocdifaddr=yes], [hc_cv_have_siocdifaddr=no], [#include <linux/sockios.h>] )
if test "$hc_cv_have_sys_mtio_h" == "yes"; then
AC_CHECK_DECLS( MTEWARN, [hc_cv_have_mtewarn=yes], [hc_cv_have_mtewarn=no], [#include <sys/mtio.h>] )
else
hc_cv_have_mtewarn=no
fi
AC_CACHE_SAVE()
###############################################################################
# Checks for types...
###############################################################################
AC_CHECK_TYPES( u_int8_t, [hc_cv_have_u_int8_t=yes], [hc_cv_have_u_int8_t=no] )
AC_CHECK_TYPES( useconds_t, [hc_cv_have_useconds_t=yes], [hc_cv_have_useconds_t=no] )
AC_CHECK_TYPES( id_t, [hc_cv_have_id_t=yes], [hc_cv_have_id_t=no] )
AC_CHECK_TYPES( u_char, [hc_cv_have_u_char=yes], [hc_cv_have_u_char=no],
[
#include <sys/types.h>
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
] )
AC_CHECK_TYPES( u_short, [hc_cv_have_u_short=yes], [hc_cv_have_u_short=no],
[
#include <sys/types.h>
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
] )
AC_CHECK_TYPES( u_int, [hc_cv_have_u_int=yes], [hc_cv_have_u_int=no],
[
#include <sys/types.h>
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
] )
AC_CHECK_TYPES( u_long, [hc_cv_have_u_long=yes], [hc_cv_have_u_long=no],
[
#include <sys/types.h>
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
] )
AC_CHECK_TYPES( in_addr_t, [hc_cv_have_in_addr_t=yes], [hc_cv_have_in_addr_t=no],
[
#include <sys/types.h>
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
] )
AC_CHECK_TYPES( socklen_t, [hc_cv_have_socklen_t=yes], [hc_cv_have_socklen_t=no],
[
#include <sys/types.h>
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
] )
AC_CACHE_SAVE()
###############################################################################
# Checks for libraries...
###############################################################################
# PROGRAMMING NOTE: we require libtool (or, optionally, dlltool (a less power-
# ful (flexible) libtool-like tool for Windows platforms) in order to support
# OPTION_DYNAMIC_LOAD. This is a relatively safe requirement since we provide
# a version of libtool with Hercules (and build it as part of the preliminary
# autoconf processing; see the 'Programs' section above). However, we need to
# keep the below check for 'dlopen' anyway since we prefer that libtool use it
# instead of its own equivalent (lt_dlopen) if it's available.
AC_CHECK_LIB( msvcrt, _pipe )
AC_CHECK_LIB( dl, dlopen )
AC_CHECK_LIB( m, sqrt )
AC_CHECK_LIB( socket, connect )
AC_CHECK_LIB( nsl, gethostbyname )
AC_CHECK_LIB( resolv, inet_aton )
AC_CHECK_LIB( z, uncompress )
AC_CHECK_LIB( bz2, BZ2_bzBuffToBuffDecompress,
[ hc_cv_have_libbz2=yes ],
[ hc_cv_have_libbz2=no ] )
AC_CHECK_LIB( iconv, iconv )
# jbs 10/15/2003 Solaris requires -lrt for sched_yield() and fdatasync()
AC_CHECK_LIB( rt, sched_yield )
# rbowler 2008/03/10 rev 1.196 Solaris 2.9 requires -lpthread
AC_CHECK_LIB( pthread,pthread_create )
AC_CACHE_SAVE()
###############################################################################
# Checks for library functions...
###############################################################################
# PROGRAMMING NOTE: AC_CHECK_LIB should be called first for the below
# library function checks to ensure the library where the function is
# defined gets added to the LIBS library search variable...
###############################################################################
AC_CHECK_FUNCS( iconv )
AC_CHECK_FUNCS( memrchr )
AC_CHECK_FUNCS( getopt_long )
AC_CHECK_FUNCS( sqrtl ldexpl fabsl fmodl frexpl )
AC_CHECK_FUNCS( ldexpf frexpf fabsf rint )
AC_CHECK_FUNCS( strlcpy strlcat )
AC_CHECK_FUNCS( strerror_r )
AC_CHECK_FUNCS( strsignal, [hc_cv_have_strsignal=yes], [hc_cv_have_strsignal=no] )
AC_CHECK_FUNCS( sys_siglist )
AC_CHECK_FUNCS( InitializeCriticalSectionAndSpinCount )
AC_CHECK_FUNCS( sleep usleep nanosleep )
AC_CHECK_FUNCS( sched_yield )
AC_CHECK_FUNCS( strtok_r )
AC_CHECK_FUNCS( pipe )
AC_CHECK_FUNCS( gettimeofday )
AC_CHECK_FUNCS( getpgrp )
AC_CHECK_FUNCS( scandir alphasort )
AC_CHECK_FUNCS( getlogin getlogin_r )
AC_CHECK_FUNCS( realpath )
AC_CHECK_FUNCS( fdatasync fsync ftruncate )
AC_CHECK_FUNCS( inet_aton )
AC_CHECK_FUNCS( fork socketpair )
AC_CHECK_FUNCS( sysconf )
AC_CHECK_FUNCS( vsscanf,
[hc_cv_have_vsscanf=yes],
[hc_cv_have_vsscanf=no]
)
AC_CHECK_FUNCS( setresuid getresuid,
[hc_cv_have_getset_uid=yes],
[hc_cv_have_getset_uid=no; break]
)
if test "$hc_cv_have_getset_uid" != "yes"; then
AC_CHECK_FUNCS( setreuid geteuid getuid,
[hc_cv_have_getset_uid=yes],
[hc_cv_have_getset_uid=no; break]
)
fi
# FIXME: Disabled because some builtin ffs seem to be causing a problem.
# (gcc 3.4 barfs on certain 'march=' settings?)
#AC_CHECK_FUNCS( ffs )
# For OS X 10.6 autoconf defines HAVE_FDATASYNC even though there is
# no function prototype declared for fdatasync() and unistd.h contains
# define _POSIX_SYNCHRONIZED_IO (-1) which indicates that fdatasync is
# not supported. So to decide whether fdatasync really can be used, we
# create a new symbol HAVE_FDATASYNC_SUPPORTED which is defined only if
# HAVE_FDATASYNC is defined and _POSIX_SYNCHRONIZED_IO is not negative.
AC_CACHE_CHECK([whether fdatasync is supported],[ac_cv_func_fdatasync_supported],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <unistd.h>
]],[[
#if !defined(HAVE_FDATASYNC)
#error fdatasync is not defined on this platform
#endif
#if defined(_POSIX_SYNCHRONIZED_IO) && (_POSIX_SYNCHRONIZED_IO+0 < 0)
#error fdatasync is not supported on this platform
#endif
]])],
[ac_cv_func_fdatasync_supported=yes],
[ac_cv_func_fdatasync_supported=no])
])
AS_IF([test "x${ac_cv_func_fdatasync_supported}" = "xyes"],
[AC_DEFINE([HAVE_FDATASYNC_SUPPORTED],[1],[Define to 1 if the fdatasync function is supported.])])
AC_CACHE_SAVE()
###############################################################################
# Checks for structures and structure members...
###############################################################################
AC_CHECK_MEMBERS( [struct sockaddr_in.sin_len],
[hc_cv_have_sockaddr_in_sin_len=yes ],
[hc_cv_have_sockaddr_in_sin_len=no ],
[
#include <sys/types.h>
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
] )
AC_CHECK_MEMBERS( [struct in_addr.s_addr],
[hc_cv_have_in_addr_s_addr=yes ],
[hc_cv_have_in_addr_s_addr=no ],
[
#include <sys/types.h>
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
] )
AC_CHECK_MEMBERS( [struct sigaction.sa_sigaction],
[hc_cv_have_sa_sigaction=yes ],
[hc_cv_have_sa_sigaction=no ],
[#include <signal.h> ] )
AC_CHECK_MEMBERS( [struct timespec.tv_nsec],
[
hc_cv_timespec_in_sys_types_h=yes
hc_cv_timespec_in_time_h=no
],
[
AC_CHECK_MEMBERS( [struct timespec.tv_nsec],
[
hc_cv_timespec_in_sys_types_h=no
hc_cv_timespec_in_time_h=yes
],
[
hc_cv_timespec_in_sys_types_h=no
hc_cv_timespec_in_time_h=no
],
[#include <time.h>]
)
],
[#include <sys/types.h>]
)
AC_CACHE_SAVE()
###############################################################################
# Checks for compiler characteristics...
###############################################################################
AC_C_BIGENDIAN()
# PROGRAMMING NOTE: Okay, this is stupid. If there are any trailing spaces
# following the type we're checking the size of, then they're converted to
# underscores in the 'SIZEOF_XXXX' that gets #defined! For example, doing a
# AC_CHECK_SIZEOF( int ) yields: #define SIZEOF_INT____ 4 !!!!!!!!!!!!!
# So... the below AC_CHECK_SIZEOF macros must NOT have any spaces in them!!
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(size_t)
AC_CHECK_SIZEOF(int *)
AC_CHECK_SIZEOF(off_t)
#----------------------------------#
# Structure alignment/size test #
#----------------------------------#
AC_MSG_NOTICE( [begin check: whether byte structs are aligned/rounded by default...] )
cat > conftest.h << __EOF
#include <stdio.h>
struct bytestruct
{
unsigned char a;
};
__EOF
AC_CHECK_SIZEOF( struct bytestruct, [], [#include "conftest.h"] )
if test "$ac_cv_sizeof_struct_bytestruct" = "1"; then
hc_cv_byte_structs_aligned_and_rounded_by_default=no
hc_cv_byte_structs_always_aligned_and_rounded=no
else
# The sizeof our test structure is not '1'.
# The compiler is rounding the size of the
# structure upward to some predefined value.
hc_cv_byte_structs_aligned_and_rounded_by_default=yes
# If there's no way to request the compiler
# to not do that, then we can't build Herc.
case "$host_cpu-$GCC" in
arm*-yes|xscale*-yes|sh*-yes|pxa*-yes)
hc_cv_byte_structs_always_aligned_and_rounded=no
;;
*)
hc_cv_byte_structs_always_aligned_and_rounded=yes
;;
esac
fi
AC_MSG_NOTICE( [results: byte structs are aligned/rounded by default... ${hc_cv_byte_structs_aligned_and_rounded_by_default}] )
if test "$hc_cv_byte_structs_always_aligned_and_rounded" = "yes"; then
AC_MSG_RESULT( [ERROR: Size of structures are aligned/rounded and we don't know how to tell the compiler otherwise] )
hc_error=yes
fi
#------------------------------#
# Check if this is GCC 2.96 #
#------------------------------#
AC_CACHE_CHECK( [if this is the broken 2.96 version of GCC],
[hc_cv_is_gcc_2_96],
[
if test "$GCC" = "yes"; then
AC_COMPILE_IFELSE(
[
#if __GNUC__ == 2 && __GNUC_MINOR__ == 96
yes;
#else
int no;
#endif
],
[hc_cv_is_gcc_2_96=no],
[hc_cv_is_gcc_2_96=yes]
)
else
hc_cv_is_gcc_2_96=no
fi
]
)
#----------------------------------------------#
# Check C99 if flexible arrays are supported #
#----------------------------------------------#
# The logic to test whether C99 flexible #
# arrays are supported is defined in the #
# 'HC_C99_FLEXIBLE_ARRAYS' macro in the #
# 'hercules.m4' file in the 'autoconf' sub- #
# directory, and issues the AC_DEFINE for #
# 'C99_FLEXIBLE_ARRAYS' if it's supported #
# and also sets '$hc_cv_c99_flexible_array'. #
#----------------------------------------------#
HC_C99_FLEXIBLE_ARRAYS()
#--------------------------------------------------------#
# Check if GCC supports '__attribute__ ((regparm(n)))' #
#--------------------------------------------------------#
# Note: even though at the moment GCC only supports regparm
# on i386 or greater machines, that could change at any time
# in the future so we don't bother checking for it.
if test "$GCC" = "yes"; then
AC_CACHE_CHECK( [whether '__attribute__ ((regparm(n)))' is supported],
[hc_cv_regparm_attr_supported],
[
hc_temp="$CFLAGS"
CFLAGS="-Wall -Werror"
AC_COMPILE_IFELSE(
[
void conftest() __attribute__ ((regparm(1)));
],
[hc_cv_regparm_attr_supported=yes],
[hc_cv_regparm_attr_supported=no]
)
CFLAGS="$hc_temp"
]
)
else
hc_cv_regparm_attr_supported=no
fi
#---------------------------------------------------#
# Test for GCC '__attribute__ ((regparm(3)))' bug #
#---------------------------------------------------#
if test "$GCC" = "yes" &&
test "$hc_cv_regparm_attr_supported" = "yes"; then
AC_CACHE_CHECK( [whether '__attribute__ ((regparm(3)))' is broken],
[hc_cv_regparm_attr_broke],
[
hc_temp="$CFLAGS"
CFLAGS="-O3 -fomit-frame-pointer"
AC_TRY_RUN(
[
/*
Fish: Test for reparms bug caused by alloca bug# 8750
Ref: <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8750>
*/
struct REGS
{
int a, b, c, d;
char e[50000];
};
typedef struct REGS REGS;
#define ATTR_REGPARM __attribute__ (( regparm(3) ))
int func1 ( int a, int b, int c, REGS *regs ) ATTR_REGPARM;
int func2 ( int a, int b, int c, REGS *regs ) ATTR_REGPARM;
REGS global_regs;
int main()
{
return func1( 1, 2, 3, &global_regs );
}
int ATTR_REGPARM func1 ( int a, int b, int c, REGS *regs )
{
REGS stack_regs;
regs=regs; /* (quiet compiler warning) */
if ( func2( a, b, c, &stack_regs ) == 0 ) return 0; /* pass */
return 1; /* fail */
}
int ATTR_REGPARM func2 ( int a, int b, int c, REGS *regs )
{
regs=regs; /* (quiet compiler warning) */
if ( 1==a && 2==b && 3==c ) return 0; /* pass */
return 1; /* fail */
}
],
[hc_cv_regparm_attr_broke=no],
[hc_cv_regparm_attr_broke=yes],
[hc_cv_regparm_attr_broke=yes]
)
CFLAGS="$hc_temp"
]
)
else
hc_cv_regparm_attr_broke=no
fi
#------------------------------------------------------#
# Test for GCC builtin alloca bug# 8750 #
# <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8750> #
#------------------------------------------------------#
if test "$GCC" = "yes"; then
AC_CACHE_CHECK( [whether '__builtin_alloca' is broken],