1############################################################################### 2# CONFIGURE.AC: Process this file with AutoConf to produce a configure script. 3############################################################################### 4 5# $Id$ 6 7# AC is AutoConfigure, AM is AutoMake, and AH is AutoHeader. The 8# 'HC_XXXX..' macros are custom Hercules autoconf macros defined 9# in the 'hercules.m4' file in the 'autoconf' subdirectory. 10 11AC_INIT(hercules.h) # (package, version, bugreport email, etc) 12AC_REVISION($Revision$) # (the version of this configure.ac) 13AC_CONFIG_AUX_DIR(autoconf) # (directory containing auxillary build tools) 14AM_INIT_AUTOMAKE(hercules,3.13) # (the version of our software package) 15AM_CONFIG_HEADER(config.h) # (the file the resulting configure script will produce) 16AM_MAINTAINER_MODE() 17AC_CANONICAL_HOST() # (sets $host_cpu, $host_vendor, and $host_os) 18m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 19 20############################################################################### 21# Programs section... 22############################################################################### 23 24# Set CFLAGS first to override the AC_PROG_CC default setting 25 26CFLAGS="$CFLAGS -W -Wall" 27 28AC_PROG_CC() # (set CC to the name of the compiler) 29 30# ----------------------------------------------------------------------------- 31# PROGRAMMING NOTE: The below 'AC_SUBST' macro causes AC_OUTPUT to replace 32# all instances of "@xxxxxx@" in input files with the value that the shell 33# variable "xxxxxx" has when AC_OUTPUT is called. However, we setup a define 34# for source files (MODULESDIR) and a variable for make ($(modexecdir)). Any 35# other usage should be avoided. 36# ----------------------------------------------------------------------------- 37 38modexecdir='$(libdir)/$(PACKAGE)' 39AC_SUBST(modexecdir) 40 41 42# ----------------------------------------------------------------------------- 43# 44# AC_LIBTOOL_DLOPEN 45# 46# Enable checking for dlopen support. This macro should be used if the 47# package makes use of the '-dlopen' and '-dlpreopen' flags, otherwise 48# libtool will assume that the system does not support dlopening. The 49# macro must be called before AC_PROG_LIBTOOL. 50# 51# ----------------------------------------------------------------------------- 52 53AC_LIBTOOL_DLOPEN() # (we need libtool's dlopen support) 54 55 56# ----------------------------------------------------------------------------- 57# 58# AC_LIBTOOL_WIN32_DLL 59# 60# This macro should be used if the package has been ported to build 61# clean dlls on win32 platforms. Usually this means that any library 62# data items are exported with __declspec(dllexport) and imported with 63# __declspec(dllimport). If this macro is not used, libtool will assume 64# that the package libraries are not dll clean and will build only static 65# libraries on win32 hosts. 66# 67# This macro must be called before AC_PROG_LIBTOOL, and provision must 68# be made to pass '-no-undefined' to libtool in link mode from the package 69# Makefile. Naturally, if you pass '-no-undefined', you must ensure that 70# all the library symbols really are defined at link time! 71# 72# ----------------------------------------------------------------------------- 73 74AC_LIBTOOL_WIN32_DLL() # (we need Win32 support in libtool) 75 76 77# ----------------------------------------------------------------------------- 78# See: 'AC_PROG_LIBTOOL' below. 79# ----------------------------------------------------------------------------- 80 81AC_DISABLE_STATIC() # (forces libtool to build shared 82 83 # libraries instead of static ones) 84# ----------------------------------------------------------------------------- 85# AC_PROG_LIBTOOL 86# 87# Add support for the '--enable-shared' and '--disable-shared' 88# configure flags. By default, this macro turns on shared libraries 89# if they are available, and also enables static libraries if they 90# don't conflict with the shared libraries. You can modify these 91# defaults by calling either the AC_DISABLE_SHARED or AC_DISABLE_STATIC 92# macros. 93# 94# Hercules REQUIRES shared libraries (i.e. DLLs), so we do indeed use 95# the AC_DISABLE_STATIC macro above. 96# 97# ----------------------------------------------------------------------------- 98 99AC_PROG_LIBTOOL() # (we build libtool for ourselves) 100 101 102# ----------------------------------------------------------------------------- 103# 104# AC_LIB_LTDL 105# 106# Even though libltdl is installed together with libtool, you may wish 107# to include libltdl in the distribution of your package, for the convenience 108# of users of your package that don't have libtool or libltdl installed. 109# 110# The most simplistic way to add libltdl to your package is to copy the 111# source files, 'ltdl.c' and 'ltdl.h', to a source directory withing your 112# package and to build and link them along with the rest of your sources. 113# 114# To do this, you must add a call to the 'AC_LIB_LTDL' macro to your package's 115# 'configure.in' to perform the required configure time checks in order that 116# 'ltdl.o' is built correctly. 117# 118# This method does have its problems though: if you try to link the package 119# binaries with an installed libltdl, or a library which depends on libltdl, 120# you may have problems with duplicate symbol definitions. 121# 122# In order to enable this flavor of libltdl, you should add the line 123# 'AC_LIBLTDL_CONVENIENCE' to your `configure.in', before 'AC_PROG_LIBTOOL'. 124# 125# In order to select the installable version of libltdl, you should add a 126# call of the macro 'AC_LIBLTDL_INSTALLABLE' to your 'configure.in' before 127# 'AC_PROG_LIBTOOL'. This macro will check whether libltdl is already 128# installed and, if not, request the libltdl embedded in your package to be 129# built and installed. 130# 131# Whatever macro you use, it is up to you to ensure that your 'configure.in' 132# will configure libltdl, using 'AC_CONFIG_SUBDIRS', and that your 'Makefile's 133# will start sub-makes within libltdl's directory, using automake's SUBDIRS, 134# for example. Both macros define the shell variables LIBLTDL, to the link flag 135# that you should use to link with libltdl, and LTDLINCL, to the preprocessor 136# flag that you should use to compile with programs that include 'ltdl.h'. It 137# is up to you to use 'AC_SUBST' to ensure that this variable will be available 138# in 'Makefile's, or add them to variables that are 'AC_SUBST'ed by default, 139# such as LIBS and CPPFLAGS. 140# 141# So, when you want to link a program with libltdl, be it a convenience, 142# installed or installable library, just compile with '$(LTDLINCL)' and link 143# it with '$(LIBLTDL)', using libtool. 144# 145# You should probably also add 'AC_LIBTOOL_DLOPEN' to your 'configure.in' before 146# 'AC_PROG_LIBTOOL', otherwise libtool will assume no dlopening mechanism is 147# supported, and revert to dlpreopening, which is probably not what you want. 148# 149# The following example shows you how to embed the convenience libltdl 150# in your package. In order to use the installable variant just replace 151# 'AC_LIBLTDL_CONVENIENCE' with 'AC_LIBLTDL_INSTALLABLE'. We assume that libltdl 152# was embedded using 'libtoolize --ltdl': 153# 154# configure.in: 155# 156# ... 157# dnl Enable building of the convenience library 158# dnl and set LIBLTDL accordingly 159# AC_LIBLTDL_CONVENIENCE 160# dnl Substitute LTDLINCL and LIBLTDL in the Makefiles 161# AC_SUBST(LTDLINCL) 162# AC_SUBST(LIBLTDL) 163# dnl Check for dlopen support 164# AC_LIBTOOL_DLOPEN 165# dnl Configure libtool 166# AC_PROG_LIBTOOL 167# dnl Configure libltdl 168# AC_CONFIG_SUBDIRS(libltdl) 169# ... 170# 171# Makefile.am: 172# 173# ... 174# SUBDIRS = libltdl 175# 176# INCLUDES = $(LTDLINCL) 177# 178# myprog_LDFLAGS = -export-dynamic 179# # The quotes around -dlopen below fool automake <= 1.4 into accepting it 180# myprog_LDADD = $(LIBLTDL) "-dlopen" self "-dlopen" foo1.la 181# myprog_DEPENDENCIES = $(LIBLTDL) foo1.la 182# ... 183# 184# ----------------------------------------------------------------------------- 185 186AC_LIB_LTDL() # (we need the ltdl libtool library) 187AC_SUBST([LIBTOOL_DEPS]) # (see PROGRAMMING NOTE above) 188 189 190# ----------------------------------------------------------------------------- 191# (See comments in the 'AC_CHECK_LIB' Libraries section further below) 192# ----------------------------------------------------------------------------- 193AC_MSG_NOTICE( [(use of lt_dlopen forced by Hercules Dynamic Loader requirement)] ) 194AS_IF([test "x${with_included_ltdl}" = "xno"], 195 [hc_cv_have_lt_dlopen=no], 196 [hc_cv_have_lt_dlopen=yes]) 197AS_IF([test "x${ac_cv_func_dlopen}" = "xyes" -o "x${ac_cv_lib_dl_dlopen}" = "xyes"], 198 [hc_cv_have_dlopen=yes], 199 [hc_cv_have_dlopen=no]) 200 201 202 203HC_LD_DISALLOWDUPS() # (add duplicate symbols option to LDFLAGS) 204 205# ----------------------------------------------------------------------------- 206# The following is a "global error" flag used to defer aborting configure 207# until after ALL errors have been detected/reported. 208# ----------------------------------------------------------------------------- 209 210hc_error=no 211 212############################################################################### 213# Autoheader templates 214############################################################################### 215 216# All AC_DEFINE() macros used within autoconf (to define pre-processor vars 217# used during the actual build process) must have corresponding AH_TEMPLATE 218# statements coded somewhere. We place them all here simply for convenience. 219 220AH_TEMPLATE( [CUSTOM_BUILD_STRING], [Define to provide additional information about this build] ) 221AH_TEMPLATE( [MAX_CPU_ENGINES], [Defines the maximum number of emulated CPU engines] ) 222AH_TEMPLATE( [DEBUG], [Define to enable extra debugging code (TRACE/VERIFY/ASSERT macros)] ) 223 224AH_TEMPLATE( [C99_FLEXIBLE_ARRAYS], [Define if your gcc properly supports C99 flexible arrays] ) 225 226AH_TEMPLATE( [HAVE_ATTR_REGPARM], [Define if your gcc properly supports __attribute__((regparm(n)))] ) 227AH_TEMPLATE( [NO_ASM_BYTESWAP], [Define to disable assembler routines for byte swapping] ) 228AH_TEMPLATE( [NO_SETUID], [Define to disable setuid operation] ) 229AH_TEMPLATE( [NO_SIGABEND_HANDLER], [Define to disable sigabend_handler (please describe this better)] ) 230AH_TEMPLATE( [NON_UNIQUE_GETTIMEOFDAY], [Define if 'gettimeofday' returns non-unique values] ) 231 232AH_TEMPLATE( [NEED_GETOPT_WRAPPER], [Define to indicate a wrapper for getopt is needed] ) 233AH_TEMPLATE( [NEED_GETOPT_OPTRESET], [Define to indicate optreset exists] ) 234 235AH_TEMPLATE( [HAVE_INTTYPES_H], [Define if inttypes.h header file is present on your system] ) 236AH_TEMPLATE( [HAVE_U_INT], [Define if your system uses u_int8_t, etc, instead of uint8_t] ) 237 238AH_TEMPLATE( [OPTION_CONFIG_SYMBOLS], [Define to enable symbolic substitutions in configuration file] ) 239AH_TEMPLATE( [OPTION_ENHANCED_CONFIG_SYMBOLS], [Define to enable enhanced-mode symbolic substitutions in configuration file] ) 240AH_TEMPLATE( [OPTION_ENHANCED_CONFIG_INCLUDE], [Define to enable enhanced-mode 'include' file support in configuration file] ) 241AH_TEMPLATE( [OPTION_HAO], [Define to enable Hercules Automatic Operator feature] ) 242AH_TEMPLATE( [OPTION_DYNAMIC_LOAD], [Define to enable Hercules Dynamic Loader feature] ) 243AH_TEMPLATE( [HDL_BUILD_SHARED], [Define to indicate shared libraries are being used] ) 244AH_TEMPLATE( [HDL_USE_LIBTOOL], [Define to cause dynamic loader to use libtool instead of dlopen] ) 245 246AH_TEMPLATE( [BUILD_HERCIFC], [Define if hercifc program is to be built] ) 247 248AH_TEMPLATE( [WIN32], [Define when building under Win32 (MinGW or Cygwin)] ) 249AH_TEMPLATE( [EXTERNALGUI], [Define to build interface to external Windows GUI] ) 250AH_TEMPLATE( [OPTION_FTHREADS], [Define to use included threads implementation (fthreads)] ) 251 252AH_TEMPLATE( [TIMESPEC_IN_TIME_H], [Define if 'struct timespec' defined in <time.h>] ) 253AH_TEMPLATE( [TIMESPEC_IN_SYS_TYPES_H], [Define if 'struct timespec' defined in <sys/types.h>] ) 254 255AH_TEMPLATE( [_BSD_SOCKLEN_T_], [Define missing macro on apple darwin (osx) platform] ) 256 257AH_TEMPLATE( [CCKD_BZIP2], [Define to enable bzip2 compression in emulated DASDs] ) 258AH_TEMPLATE( [HET_BZIP2], [Define to enable bzip2 compression in emulated tapes] ) 259AH_TEMPLATE( [OPTION_CAPABILITIES], [Define to enable posix draft 1003.1e capabilities] ) 260 261############################################################################### 262# OS-specific settings that we can't figure out any other way (yet) 263############################################################################### 264 265# 266# Determine what type of host we're building on... 267# 268 269case "$host_os" in 270 271 linux*) 272 273 hc_cv_is_nix=yes 274 hc_cv_is_windows=no 275 hc_cv_is_mingw32=no 276 hc_cv_is_apple=no 277 ;; 278 279 mingw*) 280 281 hc_cv_is_nix=no 282 hc_cv_is_windows=yes 283 hc_cv_is_mingw32=yes 284 hc_cv_is_apple=no 285 ;; 286 287 cygwin*) 288 289 hc_cv_is_nix=no 290 hc_cv_is_windows=yes 291 hc_cv_is_mingw32=no 292 hc_cv_is_apple=no 293 ;; 294 295 darwin*) 296 297 if test $host_vendor = apple; then 298 299 hc_cv_is_nix=no 300 hc_cv_is_windows=no 301 hc_cv_is_mingw32=no 302 hc_cv_is_apple=yes 303 304 else 305 306 hc_cv_is_nix=no 307 hc_cv_is_windows=no 308 hc_cv_is_mingw32=no 309 hc_cv_is_apple=no 310 311 fi 312 ;; 313 314 *bsd*) 315 hc_cv_is_nix=yes 316 hc_cv_is_windows=no 317 hc_cv_is_mingw32=no 318 hc_cv_is_apple=no 319 ;; 320 321 *) 322 hc_cv_is_nix=no 323 hc_cv_is_windows=no 324 hc_cv_is_mingw32=no 325 hc_cv_is_apple=no 326 ;; 327esac 328 329#------------------------------------------------------# 330# Hard-coded host-operating-system-specific settings # 331# that we have no other/easy way to figure out... # 332#------------------------------------------------------# 333 334if test "$hc_cv_is_nix" = "yes"; then 335 336 hc_cv_build_hercifc=yes 337 hc_cv_non_unique_gettimeofday=no 338 339elif test "$hc_cv_is_windows" = "yes"; then 340 341 hc_cv_build_hercifc=no 342 hc_cv_non_unique_gettimeofday=yes 343 344elif test "$hc_cv_is_apple" = "yes"; then 345 346 hc_cv_build_hercifc=yes 347 hc_cv_non_unique_gettimeofday=no 348 349else 350 hc_cv_build_hercifc=no 351 hc_cv_non_unique_gettimeofday=no 352fi 353 354############################################################################### 355# Checks for REQUIRED (non-optional) header files... 356############################################################################### 357 358# PROGRAMMING NOTE: We use 'AC_CHECK_HEADER' here (singular) since we don't 359# care whether 'HAVE_XXX' gets #defined or not since, because these are re- 360# quired headers, if any of them are not found, we abort and thus we don't 361# need to have any 'HAVE_XXX' pre-processor #defined entered into config.h 362# (because we can't build Herc at all if any of them don't happen to exist) 363 364AC_CHECK_HEADER( ctype.h, [], [ AC_MSG_RESULT( [ERROR: Required header 'ctype.h' not found] ); hc_error=yes ] ) 365AC_CHECK_HEADER( errno.h, [], [ AC_MSG_RESULT( [ERROR: Required header 'errno.h' not found] ); hc_error=yes ] ) 366AC_CHECK_HEADER( fcntl.h, [], [ AC_MSG_RESULT( [ERROR: Required header 'fcntl.h' not found] ); hc_error=yes ] ) 367AC_CHECK_HEADER( limits.h, [], [ AC_MSG_RESULT( [ERROR: Required header 'limits.h' not found] ); hc_error=yes ] ) 368AC_CHECK_HEADER( setjmp.h, [], [ AC_MSG_RESULT( [ERROR: Required header 'setjmp.h' not found] ); hc_error=yes ] ) 369AC_CHECK_HEADER( stdarg.h, [], [ AC_MSG_RESULT( [ERROR: Required header 'stdarg.h' not found] ); hc_error=yes ] ) 370AC_CHECK_HEADER( stdio.h, [], [ AC_MSG_RESULT( [ERROR: Required header 'stdio.h' not found] ); hc_error=yes ] ) 371AC_CHECK_HEADER( stdlib.h, [], [ AC_MSG_RESULT( [ERROR: Required header 'stdlib.h' not found] ); hc_error=yes ] ) 372AC_CHECK_HEADER( string.h, [], [ AC_MSG_RESULT( [ERROR: Required header 'string.h' not found] ); hc_error=yes ] ) 373AC_CHECK_HEADER( time.h, [], [ AC_MSG_RESULT( [ERROR: Required header 'time.h' not found] ); hc_error=yes ] ) 374AC_CHECK_HEADER( unistd.h, [], [ AC_MSG_RESULT( [ERROR: Required header 'unistd.h' not found] ); hc_error=yes ] ) 375AC_CHECK_HEADER( sys/stat.h, [], [ AC_MSG_RESULT( [ERROR: Required header 'sys/stat.h' not found] ); hc_error=yes ] ) 376AC_CHECK_HEADER( sys/time.h, [], [ AC_MSG_RESULT( [ERROR: Required header 'sys/time.h' not found] ); hc_error=yes ] ) 377AC_CHECK_HEADER( sys/types.h, [], [ AC_MSG_RESULT( [ERROR: Required header 'sys/types.h' not found] ); hc_error=yes ] ) 378 379# PROGRAMMING NOTE: the pthread.h header only required if this is not 380# an fthreads build. Thus we delay aborting until later once we know 381# (if this is a windows build; otherwise we abort right away) 382 383AC_CHECK_HEADER( pthread.h, [hc_cv_have_pthread_h=yes], 384 [ 385 if test "$hc_cv_is_windows" = "yes"; then 386 387 hc_cv_alt_pthread_location=/usr/Pthreads 388 389 AC_MSG_NOTICE( [looking for pthread.h in ${hc_cv_alt_pthread_location}] ) 390 391 hc_temp=$CFLAGS 392 CFLAGS="$CFLAGS -I${hc_cv_alt_pthread_location}" 393 394 AC_CHECK_HEADER( pthread.h, 395 [hc_cv_have_pthread_h=yes], 396 [hc_cv_have_pthread_h=no] 397 ) 398 399 CFLAGS=$hc_temp 400 401 else 402 AC_MSG_RESULT( [ERROR: Required header 'pthread.h' not found] ) 403 hc_error=yes 404 fi 405 ] 406) 407 408AC_CACHE_SAVE() 409 410############################################################################### 411# Checks for optional (non-required) header files... 412############################################################################### 413 414# PROGRAMMING NOTE: We use 'AC_CHECK_HEADERS' here (plural) to cause autoconf 415# to automatically add a #define/#undef 'HAVE_XXX' statement into config.h to 416# let us know whether the header exists on this system or not (since, because 417# these are optional headers, we are still able to successfully build Herc if 418# they don't happen to exist). The 'hc_cv_have_xxx' variables are only defined 419# in case other parts of configure.ac need to know whether the header exists 420# or not without having to do their own AC_CHECK_HEADERS (since we've already 421# done it). 422 423#------------------------------------------------------------------------------ 424# PROGRAMMING NOTE: on Darwin sys/socket.h must be included before 425# net/if.h, net/route.h, or netinet/in.h can be #included, and on OS X 10.3 426# (but not 10.4) sys/types.h must be #included before sys/socket.h. Thus 427# the below four header checks are treated specially. If we ever drop support 428# for OS X 10.3, a lot of this cruft can be removed, not just here but 429# anywhere we find ourselves manually including sys/types.h. 430 431# PROGRAMMING NOTE: on *BSD sys/socket.h must be included before net/if.h, 432# net/route.h, or netinet/in.h can be #included. 433 434AC_CHECK_HEADERS( sys/socket.h, [hc_cv_have_sys_socket_h=yes], [hc_cv_have_sys_socket_h=no], 435[ 436 #include <sys/types.h> 437] ) 438AC_CHECK_HEADERS( net/if.h, [hc_cv_have_net_if_h=yes], [hc_cv_have_net_if_h=no], 439[ 440 #include <sys/types.h> 441 #if HAVE_SYS_SOCKET_H 442 #include <sys/socket.h> 443 #endif 444] ) 445AC_CHECK_HEADERS( netinet/in.h, [hc_cv_have_netinet_in_h=yes], [hc_cv_have_netinet_in_h=no], 446[ 447 #include <sys/types.h> 448 #if HAVE_SYS_SOCKET_H 449 #include <sys/socket.h> 450 #endif 451] ) 452AC_CHECK_HEADERS( netinet/tcp.h, [hc_cv_have_netinet_tcp_h=yes], [hc_cv_have_netinet_tcp_h=no], 453[ 454 #include <sys/types.h> 455 #if HAVE_SYS_SOCKET_H 456 #include <sys/socket.h> 457 #endif 458] ) 459AC_CHECK_HEADERS( net/route.h, [hc_cv_have_net_route_h=yes], [hc_cv_have_net_route_h=no], 460[ 461 #include <sys/types.h> 462 #if HAVE_SYS_SOCKET_H 463 #include <sys/socket.h> 464 #endif 465] ) 466#------------------------------------------------------------------------------ 467 468AC_CHECK_HEADERS( arpa/inet.h, [hc_cv_have_arpa_inet_h=yes], [hc_cv_have_arpa_inet_h=no] ) 469AC_CHECK_HEADERS( linux/if_tun.h, [hc_cv_have_linux_if_tun_h=yes], [hc_cv_have_linux_if_tun_h=no] ) 470AC_CHECK_HEADERS( sys/ioctl.h, [hc_cv_have_sys_ioctl_h=yes], [hc_cv_have_sys_ioctl_h=no] ) 471AC_CHECK_HEADERS( sys/mman.h, [hc_cv_have_sys_mman_h=yes], [hc_cv_have_sys_mman_h=no] ) 472 473#------------------------------------------------------------------------------ 474# PROGRAMMING NOTE: on *BSD systems sys/param.h must be #included before 475# sys/mount.h as it contains the #define of NGROUPS. 476 477AC_CHECK_HEADERS( sys/param.h, [hc_cv_have_sys_param_h=yes], [hc_cv_have_sys_param_h=no] ) 478AC_CHECK_HEADERS( sys/mount.h, [hc_cv_have_sys_mount_h=yes], [hc_cv_have_sys_mount_h=no], 479[ 480 #if HAVE_SYS_PARAM_H 481 #include <sys/param.h> 482 #endif 483] ) 484#------------------------------------------------------------------------------ 485 486AC_CHECK_HEADERS( sys/mtio.h, [hc_cv_have_sys_mtio_h=yes], [hc_cv_have_sys_mtio_h=no] ) 487AC_CHECK_HEADERS( sys/resource.h, [hc_cv_have_sys_resource_h=yes], [hc_cv_have_sys_resource_h=no] ) 488AC_CHECK_HEADERS( sys/uio.h, [hc_cv_have_sys_uio_h=yes], [hc_cv_have_sys_uio_h=no] ) 489AC_CHECK_HEADERS( sys/utsname.h, [hc_cv_have_sys_utsname_h=yes], [hc_cv_have_sys_utsname_h=no] ) 490AC_CHECK_HEADERS( sys/wait.h, [hc_cv_have_sys_wait_h=yes], [hc_cv_have_sys_wait_h=no] ) 491AC_CHECK_HEADERS( sys/un.h, [hc_cv_have_sys_un_h=yes], [hc_cv_have_sys_un_h=no] ) 492AC_CHECK_HEADERS( byteswap.h, [hc_cv_have_byteswap_h=yes], [hc_cv_have_byteswap_h=no] ) 493AC_CHECK_HEADERS( bzlib.h, [hc_cv_have_bzlib_h=yes], [hc_cv_have_bzlib_h=no] ) 494AC_CHECK_HEADERS( dlfcn.h, [hc_cv_have_dlfcn_h=yes], [hc_cv_have_dlfcn_h=no] ) 495AC_CHECK_HEADERS( inttypes.h, [hc_cv_have_inttypes_h=yes], [hc_cv_have_inttypes_h=no] ) 496AC_CHECK_HEADERS( iconv.h, [hc_cv_have_iconv_h=yes], [hc_cv_have_iconv_h=no] ) 497AC_CHECK_HEADERS( ltdl.h, [hc_cv_have_ltdl_h=yes], [hc_cv_have_ltdl_h=no] ) 498AC_CHECK_HEADERS( malloc.h, [hc_cv_have_malloc_h=yes], [hc_cv_have_malloc_h=no] ) 499AC_CHECK_HEADERS( math.h, [hc_cv_have_math_h=yes], [hc_cv_have_math_h=no] ) 500AC_CHECK_HEADERS( netdb.h, [hc_cv_have_netdb_h=yes], [hc_cv_have_netdb_h=no] ) 501AC_CHECK_HEADERS( pwd.h, [hc_cv_have_pwd_h=yes], [hc_cv_have_pwd_h=no] ) 502AC_CHECK_HEADERS( regex.h, [hc_cv_have_regex_h=yes], [hc_cv_have_regex_h=no] ) 503AC_CHECK_HEADERS( sched.h, [hc_cv_have_sched_h=yes], [hc_cv_have_sched_h=no] ) 504AC_CHECK_HEADERS( signal.h, [hc_cv_have_signal_h=yes], [hc_cv_have_signal_h=no] ) 505AC_CHECK_HEADERS( termios.h, [hc_cv_have_termios_h=yes], [hc_cv_have_termios_h=no] ) 506AC_CHECK_HEADERS( time.h, [hc_cv_have_time_h=yes], [hc_cv_have_time_h=no] ) 507AC_CHECK_HEADERS( zlib.h, [hc_cv_have_zlib_h=yes], [hc_cv_have_zlib_h=no] ) 508AC_CHECK_HEADERS( sys/capability.h, [hc_cv_have_sys_capa_h=yes], [hc_cv_have_sys_capa_h=no] ) 509AC_CHECK_HEADERS( sys/prctl.h, [hc_cv_have_sys_prctl_h=yes], [hc_cv_have_sys_prctl_h=no] ) 510 511AC_CACHE_SAVE() 512 513############################################################################### 514# Checks for declarations... 515############################################################################### 516 517# PROGRAMMING NOTE: For declaration checks, you need to be careful to use the 518# following test in your program: 519# 520# #if defined(HAVE_DECL_XXXX) && !HAVE_DECL_XXXXX 521# ...code to handle not declared case... 522# #endif 523# 524# This is because UNLIKE other 'AC_CHECK' macros, when a SYMBOL isn't DECLared, 525# "HAVE_DECL_XXXX" is #defined to '0' instead of leaving "HAVE_DECL_XXXX" #undefined. 526# (e.g. #defined to 1 if you have the declaration and #defined to 0 if you don't) 527 528AC_CHECK_DECLS( SIGUSR1, [hc_cv_have_sigusr1=yes], [hc_cv_have_sigusr1=no], [#include <signal.h>] ) 529AC_CHECK_DECLS( SIGUSR2, [hc_cv_have_sigusr2=yes], [hc_cv_have_sigusr2=no], [#include <signal.h>] ) 530AC_CHECK_DECLS( SIGPIPE, [hc_cv_have_sigpipe=yes], [hc_cv_have_sigpipe=no], [#include <signal.h>] ) 531AC_CHECK_DECLS( SIGBUS, [hc_cv_have_sigbus=yes], [hc_cv_have_sigbus=no], [#include <signal.h>] ) 532AC_CHECK_DECLS( IFNAMSIZ, [hc_cv_have_ifnamsiz=yes], [hc_cv_have_ifnamsiz=no], 533[ 534 #include <sys/types.h> 535 #if HAVE_SYS_SOCKET_H 536 #include <sys/socket.h> 537 #endif 538] ) 539AC_CHECK_DECLS( LOGIN_NAME_MAX, [hc_cv_have_login_name_max=yes], [hc_cv_have_login_name_max=no], [#include <limits.h>] ) 540AC_CHECK_DECLS( _SC_NPROCESSORS_CONF, [hc_cv_have_sc_nprocessors_conf=yes], [hc_cv_have_sc_nprocessors_conf=no], [#include <unistd.h>] ) 541AC_CHECK_DECLS( _SC_NPROCESSORS_ONLN, [hc_cv_have_sc_nprocessors_onln=yes], [hc_cv_have_sc_nprocessors_onln=no], [#include <unistd.h>] ) 542 543AC_CHECK_DECLS( SIOCSIFNETMASK, [hc_cv_have_siocsifnetmask=yes], [hc_cv_have_siocsifnetmask=no], [#include <linux/sockios.h>] ) 544AC_CHECK_DECLS( SIOCSIFHWADDR, [hc_cv_have_siocsifhwaddr=yes], [hc_cv_have_siocsifhwaddr=no], [#include <linux/sockios.h>] ) 545AC_CHECK_DECLS( SIOCADDRT, [hc_cv_have_siocaddrt=yes], [hc_cv_have_siocaddrt=no], [#include <linux/sockios.h>] ) 546AC_CHECK_DECLS( SIOCDELRT, [hc_cv_have_siocdelrt=yes], [hc_cv_have_siocdelrt=no], [#include <linux/sockios.h>] ) 547AC_CHECK_DECLS( SIOCDIFADDR, [hc_cv_have_siocdifaddr=yes], [hc_cv_have_siocdifaddr=no], [#include <linux/sockios.h>] ) 548 549if test "$hc_cv_have_sys_mtio_h" == "yes"; then 550 AC_CHECK_DECLS( MTEWARN, [hc_cv_have_mtewarn=yes], [hc_cv_have_mtewarn=no], [#include <sys/mtio.h>] ) 551else 552 hc_cv_have_mtewarn=no 553fi 554 555AC_CACHE_SAVE() 556 557############################################################################### 558# Checks for types... 559############################################################################### 560 561AC_CHECK_TYPES( u_int8_t, [hc_cv_have_u_int8_t=yes], [hc_cv_have_u_int8_t=no] ) 562AC_CHECK_TYPES( useconds_t, [hc_cv_have_useconds_t=yes], [hc_cv_have_useconds_t=no] ) 563AC_CHECK_TYPES( id_t, [hc_cv_have_id_t=yes], [hc_cv_have_id_t=no] ) 564AC_CHECK_TYPES( u_char, [hc_cv_have_u_char=yes], [hc_cv_have_u_char=no], 565[ 566 #include <sys/types.h> 567 #if HAVE_SYS_SOCKET_H 568 #include <sys/socket.h> 569 #endif 570] ) 571AC_CHECK_TYPES( u_short, [hc_cv_have_u_short=yes], [hc_cv_have_u_short=no], 572[ 573 #include <sys/types.h> 574 #if HAVE_SYS_SOCKET_H 575 #include <sys/socket.h> 576 #endif 577] ) 578AC_CHECK_TYPES( u_int, [hc_cv_have_u_int=yes], [hc_cv_have_u_int=no], 579[ 580 #include <sys/types.h> 581 #if HAVE_SYS_SOCKET_H 582 #include <sys/socket.h> 583 #endif 584] ) 585AC_CHECK_TYPES( u_long, [hc_cv_have_u_long=yes], [hc_cv_have_u_long=no], 586[ 587 #include <sys/types.h> 588 #if HAVE_SYS_SOCKET_H 589 #include <sys/socket.h> 590 #endif 591] ) 592AC_CHECK_TYPES( in_addr_t, [hc_cv_have_in_addr_t=yes], [hc_cv_have_in_addr_t=no], 593[ 594 #include <sys/types.h> 595 #if HAVE_SYS_SOCKET_H 596 #include <sys/socket.h> 597 #endif 598 #if HAVE_NETINET_IN_H 599 #include <netinet/in.h> 600 #endif 601] ) 602AC_CHECK_TYPES( socklen_t, [hc_cv_have_socklen_t=yes], [hc_cv_have_socklen_t=no], 603[ 604 #include <sys/types.h> 605 #if HAVE_SYS_SOCKET_H 606 #include <sys/socket.h> 607 #endif 608] ) 609 610AC_CACHE_SAVE() 611 612############################################################################### 613# Checks for libraries... 614############################################################################### 615 616# PROGRAMMING NOTE: we require libtool (or, optionally, dlltool (a less power- 617# ful (flexible) libtool-like tool for Windows platforms) in order to support 618# OPTION_DYNAMIC_LOAD. This is a relatively safe requirement since we provide 619# a version of libtool with Hercules (and build it as part of the preliminary 620# autoconf processing; see the 'Programs' section above). However, we need to 621# keep the below check for 'dlopen' anyway since we prefer that libtool use it 622# instead of its own equivalent (lt_dlopen) if it's available. 623 624AC_CHECK_LIB( msvcrt, _pipe ) 625AC_CHECK_LIB( dl, dlopen ) 626AC_CHECK_LIB( m, sqrt ) 627AC_CHECK_LIB( socket, connect ) 628AC_CHECK_LIB( nsl, gethostbyname ) 629AC_CHECK_LIB( resolv, inet_aton ) 630AC_CHECK_LIB( z, uncompress ) 631AC_CHECK_LIB( bz2, BZ2_bzBuffToBuffDecompress, 632 [ hc_cv_have_libbz2=yes ], 633 [ hc_cv_have_libbz2=no ] ) 634AC_CHECK_LIB( iconv, iconv ) 635# jbs 10/15/2003 Solaris requires -lrt for sched_yield() and fdatasync() 636AC_CHECK_LIB( rt, sched_yield ) 637# rbowler 2008/03/10 rev 1.196 Solaris 2.9 requires -lpthread 638AC_CHECK_LIB( pthread,pthread_create ) 639 640AC_CACHE_SAVE() 641 642############################################################################### 643# Checks for library functions... 644############################################################################### 645# PROGRAMMING NOTE: AC_CHECK_LIB should be called first for the below 646# library function checks to ensure the library where the function is 647# defined gets added to the LIBS library search variable... 648############################################################################### 649 650AC_CHECK_FUNCS( iconv ) 651AC_CHECK_FUNCS( memrchr ) 652AC_CHECK_FUNCS( getopt_long ) 653AC_CHECK_FUNCS( sqrtl ldexpl fabsl fmodl frexpl ) 654AC_CHECK_FUNCS( ldexpf frexpf fabsf rint ) 655AC_CHECK_FUNCS( strlcpy strlcat ) 656AC_CHECK_FUNCS( strerror_r ) 657AC_CHECK_FUNCS( strsignal, [hc_cv_have_strsignal=yes], [hc_cv_have_strsignal=no] ) 658AC_CHECK_FUNCS( sys_siglist ) 659AC_CHECK_FUNCS( InitializeCriticalSectionAndSpinCount ) 660AC_CHECK_FUNCS( sleep usleep nanosleep ) 661AC_CHECK_FUNCS( sched_yield ) 662AC_CHECK_FUNCS( strtok_r ) 663AC_CHECK_FUNCS( pipe ) 664AC_CHECK_FUNCS( gettimeofday ) 665AC_CHECK_FUNCS( getpgrp ) 666AC_CHECK_FUNCS( scandir alphasort ) 667AC_CHECK_FUNCS( getlogin getlogin_r ) 668AC_CHECK_FUNCS( realpath ) 669AC_CHECK_FUNCS( fdatasync fsync ftruncate ) 670AC_CHECK_FUNCS( inet_aton ) 671AC_CHECK_FUNCS( fork socketpair ) 672AC_CHECK_FUNCS( sysconf ) 673 674AC_CHECK_FUNCS( vsscanf, 675 [hc_cv_have_vsscanf=yes], 676 [hc_cv_have_vsscanf=no] 677) 678 679AC_CHECK_FUNCS( setresuid getresuid, 680 [hc_cv_have_getset_uid=yes], 681 [hc_cv_have_getset_uid=no; break] 682) 683 684if test "$hc_cv_have_getset_uid" != "yes"; then 685 AC_CHECK_FUNCS( setreuid geteuid getuid, 686 [hc_cv_have_getset_uid=yes], 687 [hc_cv_have_getset_uid=no; break] 688 ) 689fi 690 691 692# FIXME: Disabled because some builtin ffs seem to be causing a problem. 693# (gcc 3.4 barfs on certain 'march=' settings?) 694#AC_CHECK_FUNCS( ffs ) 695 696 697# For OS X 10.6 autoconf defines HAVE_FDATASYNC even though there is 698# no function prototype declared for fdatasync() and unistd.h contains 699# define _POSIX_SYNCHRONIZED_IO (-1) which indicates that fdatasync is 700# not supported. So to decide whether fdatasync really can be used, we 701# create a new symbol HAVE_FDATASYNC_SUPPORTED which is defined only if 702# HAVE_FDATASYNC is defined and _POSIX_SYNCHRONIZED_IO is not negative. 703 704AC_CACHE_CHECK([whether fdatasync is supported],[ac_cv_func_fdatasync_supported],[ 705 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 706#include <unistd.h> 707 ]],[[ 708#if !defined(HAVE_FDATASYNC) 709#error fdatasync is not defined on this platform 710#endif 711#if defined(_POSIX_SYNCHRONIZED_IO) && (_POSIX_SYNCHRONIZED_IO+0 < 0) 712#error fdatasync is not supported on this platform 713#endif 714 ]])], 715 [ac_cv_func_fdatasync_supported=yes], 716 [ac_cv_func_fdatasync_supported=no]) 717]) 718AS_IF([test "x${ac_cv_func_fdatasync_supported}" = "xyes"], 719 [AC_DEFINE([HAVE_FDATASYNC_SUPPORTED],[1],[Define to 1 if the fdatasync function is supported.])]) 720 721 722AC_CACHE_SAVE() 723 724############################################################################### 725# Checks for structures and structure members... 726############################################################################### 727 728AC_CHECK_MEMBERS( [struct sockaddr_in.sin_len], 729 [hc_cv_have_sockaddr_in_sin_len=yes ], 730 [hc_cv_have_sockaddr_in_sin_len=no ], 731[ 732#include <sys/types.h> 733#if HAVE_SYS_SOCKET_H 734#include <sys/socket.h> 735#endif 736#if HAVE_NETINET_IN_H 737#include <netinet/in.h> 738#endif 739] ) 740 741AC_CHECK_MEMBERS( [struct in_addr.s_addr], 742 [hc_cv_have_in_addr_s_addr=yes ], 743 [hc_cv_have_in_addr_s_addr=no ], 744[ 745#include <sys/types.h> 746#if HAVE_SYS_SOCKET_H 747#include <sys/socket.h> 748#endif 749#if HAVE_NETINET_IN_H 750#include <netinet/in.h> 751#endif 752] ) 753 754AC_CHECK_MEMBERS( [struct sigaction.sa_sigaction], 755 [hc_cv_have_sa_sigaction=yes ], 756 [hc_cv_have_sa_sigaction=no ], 757 [#include <signal.h> ] ) 758 759AC_CHECK_MEMBERS( [struct timespec.tv_nsec], 760 [ 761 hc_cv_timespec_in_sys_types_h=yes 762 hc_cv_timespec_in_time_h=no 763 ], 764 [ 765 AC_CHECK_MEMBERS( [struct timespec.tv_nsec], 766 [ 767 hc_cv_timespec_in_sys_types_h=no 768 hc_cv_timespec_in_time_h=yes 769 ], 770 [ 771 hc_cv_timespec_in_sys_types_h=no 772 hc_cv_timespec_in_time_h=no 773 ], 774 [#include <time.h>] 775 ) 776 ], 777 [#include <sys/types.h>] 778) 779 780AC_CACHE_SAVE() 781 782############################################################################### 783# Checks for compiler characteristics... 784############################################################################### 785 786AC_C_BIGENDIAN() 787 788# PROGRAMMING NOTE: Okay, this is stupid. If there are any trailing spaces 789# following the type we're checking the size of, then they're converted to 790# underscores in the 'SIZEOF_XXXX' that gets #defined! For example, doing a 791# AC_CHECK_SIZEOF( int ) yields: #define SIZEOF_INT____ 4 !!!!!!!!!!!!! 792# So... the below AC_CHECK_SIZEOF macros must NOT have any spaces in them!! 793 794AC_CHECK_SIZEOF(int) 795AC_CHECK_SIZEOF(long) 796AC_CHECK_SIZEOF(size_t) 797AC_CHECK_SIZEOF(int *) 798AC_CHECK_SIZEOF(off_t) 799 800#----------------------------------# 801# Structure alignment/size test # 802#----------------------------------# 803 804AC_MSG_NOTICE( [begin check: whether byte structs are aligned/rounded by default...] ) 805 806cat > conftest.h << __EOF 807#include <stdio.h> 808struct bytestruct 809{ 810 unsigned char a; 811}; 812__EOF 813 814AC_CHECK_SIZEOF( struct bytestruct, [], [#include "conftest.h"] ) 815 816if test "$ac_cv_sizeof_struct_bytestruct" = "1"; then 817 818 hc_cv_byte_structs_aligned_and_rounded_by_default=no 819 hc_cv_byte_structs_always_aligned_and_rounded=no 820 821else 822 823 # The sizeof our test structure is not '1'. 824 # The compiler is rounding the size of the 825 # structure upward to some predefined value. 826 827 hc_cv_byte_structs_aligned_and_rounded_by_default=yes 828 829 # If there's no way to request the compiler 830 # to not do that, then we can't build Herc. 831 832 case "$host_cpu-$GCC" in 833 834 arm*-yes|xscale*-yes|sh*-yes|pxa*-yes) 835 836 hc_cv_byte_structs_always_aligned_and_rounded=no 837 ;; 838 839 *) 840 hc_cv_byte_structs_always_aligned_and_rounded=yes 841 ;; 842 esac 843fi 844 845AC_MSG_NOTICE( [results: byte structs are aligned/rounded by default... ${hc_cv_byte_structs_aligned_and_rounded_by_default}] ) 846 847if test "$hc_cv_byte_structs_always_aligned_and_rounded" = "yes"; then 848 849 AC_MSG_RESULT( [ERROR: Size of structures are aligned/rounded and we don't know how to tell the compiler otherwise] ) 850 hc_error=yes 851fi 852 853#------------------------------# 854# Check if this is GCC 2.96 # 855#------------------------------# 856 857AC_CACHE_CHECK( [if this is the broken 2.96 version of GCC], 858 859 [hc_cv_is_gcc_2_96], 860 [ 861 if test "$GCC" = "yes"; then 862 863 AC_COMPILE_IFELSE( 864 [ 865 #if __GNUC__ == 2 && __GNUC_MINOR__ == 96 866 yes; 867 #else 868 int no; 869 #endif 870 ], 871 [hc_cv_is_gcc_2_96=no], 872 [hc_cv_is_gcc_2_96=yes] 873 ) 874 875 else 876 hc_cv_is_gcc_2_96=no 877 fi 878 ] 879) 880 881#----------------------------------------------# 882# Check C99 if flexible arrays are supported # 883#----------------------------------------------# 884# The logic to test whether C99 flexible # 885# arrays are supported is defined in the # 886# 'HC_C99_FLEXIBLE_ARRAYS' macro in the # 887# 'hercules.m4' file in the 'autoconf' sub- # 888# directory, and issues the AC_DEFINE for # 889# 'C99_FLEXIBLE_ARRAYS' if it's supported # 890# and also sets '$hc_cv_c99_flexible_array'. # 891#----------------------------------------------# 892 893HC_C99_FLEXIBLE_ARRAYS() 894 895#--------------------------------------------------------# 896# Check if GCC supports '__attribute__ ((regparm(n)))' # 897#--------------------------------------------------------# 898 899# Note: even though at the moment GCC only supports regparm 900# on i386 or greater machines, that could change at any time 901# in the future so we don't bother checking for it. 902 903if test "$GCC" = "yes"; then 904 905 AC_CACHE_CHECK( [whether '__attribute__ ((regparm(n)))' is supported], 906 907 [hc_cv_regparm_attr_supported], 908 [ 909 hc_temp="$CFLAGS" 910 CFLAGS="-Wall -Werror" 911 912 AC_COMPILE_IFELSE( 913 [ 914 void conftest() __attribute__ ((regparm(1))); 915 ], 916 [hc_cv_regparm_attr_supported=yes], 917 [hc_cv_regparm_attr_supported=no] 918 ) 919 920 CFLAGS="$hc_temp" 921 ] 922 ) 923else 924 hc_cv_regparm_attr_supported=no 925fi 926 927#---------------------------------------------------# 928# Test for GCC '__attribute__ ((regparm(3)))' bug # 929#---------------------------------------------------# 930 931if test "$GCC" = "yes" && 932 test "$hc_cv_regparm_attr_supported" = "yes"; then 933 934 AC_CACHE_CHECK( [whether '__attribute__ ((regparm(3)))' is broken], 935 936 [hc_cv_regparm_attr_broke], 937 [ 938 hc_temp="$CFLAGS" 939 CFLAGS="-O3 -fomit-frame-pointer" 940 941 AC_TRY_RUN( 942 [ 943 /* 944 Fish: Test for reparms bug caused by alloca bug# 8750 945 Ref: <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8750> 946 */ 947 struct REGS 948 { 949 int a, b, c, d; 950 char e[50000]; 951 }; 952 typedef struct REGS REGS; 953 954 #define ATTR_REGPARM __attribute__ (( regparm(3) )) 955 956 int func1 ( int a, int b, int c, REGS *regs ) ATTR_REGPARM; 957 int func2 ( int a, int b, int c, REGS *regs ) ATTR_REGPARM; 958 959 REGS global_regs; 960 961 int main() 962 { 963 return func1( 1, 2, 3, &global_regs ); 964 } 965 966 int ATTR_REGPARM func1 ( int a, int b, int c, REGS *regs ) 967 { 968 REGS stack_regs; 969 regs=regs; /* (quiet compiler warning) */ 970 if ( func2( a, b, c, &stack_regs ) == 0 ) return 0; /* pass */ 971 return 1; /* fail */ 972 } 973 974 int ATTR_REGPARM func2 ( int a, int b, int c, REGS *regs ) 975 { 976 regs=regs; /* (quiet compiler warning) */ 977 if ( 1==a && 2==b && 3==c ) return 0; /* pass */ 978 return 1; /* fail */ 979 } 980 ], 981 [hc_cv_regparm_attr_broke=no], 982 [hc_cv_regparm_attr_broke=yes], 983 [hc_cv_regparm_attr_broke=yes] 984 ) 985 986 CFLAGS="$hc_temp" 987 ] 988 ) 989else 990 hc_cv_regparm_attr_broke=no 991fi 992 993#------------------------------------------------------# 994# Test for GCC builtin alloca bug# 8750 # 995# <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8750> # 996#------------------------------------------------------# 997 998if test "$GCC" = "yes"; then 999 1000 AC_CACHE_CHECK( [whether '__builtin_alloca' is broken], 1001 1002 [hc_cv_builtin_alloca_broke], 1003 [ 1004 hc_temp=$CFLAGS 1005 CFLAGS="-g -O2 -fomit-frame-pointer" 1006 1007 AC_TRY_RUN( 1008 [ 1009 /* 1010 Fish: Test for gcc builtin alloca bug# 8750 1011 <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8750> 1012 1013 Required(?!) (not sure) compiler options: 1014 1015 -g -O2 -fomit-frame-pointer 1016 */ 1017 1018 int foo () 1019 { 1020 char a[50000+16]; 1021 memset(a,0xCD,50000); 1022 a[50000]=0; 1023 return strlen(a); 1024 } 1025 1026 int main() 1027 { 1028 return ( foo() != 50000 ); 1029 } 1030 ], 1031 [hc_cv_builtin_alloca_broke=no], 1032 [hc_cv_builtin_alloca_broke=yes], 1033 [hc_cv_builtin_alloca_broke=yes] 1034 ) 1035 1036 CFLAGS=$hc_temp 1037 ] 1038 ) 1039else 1040 hc_cv_builtin_alloca_broke=no 1041fi 1042 1043#------------------------------------------------------------# 1044# Check for OS X gcc preprocessor macro argument count bug # 1045#------------------------------------------------------------# 1046 1047if test "$GCC" = "yes"; then 1048 1049 AC_CACHE_CHECK( [whether preprocessor macro argument counting broken], 1050 1051 [hc_cv_pp_macro_arg_counting_broke], 1052 [ 1053 hc_temp="$CFLAGS" 1054 CFLAGS="-Wall -Werror" 1055 1056 AC_COMPILE_IFELSE( 1057 [ 1058 #include <stdio.h> 1059 #define MACRO(_x,_args...) printf(_x, ## _args) 1060 int main( int argc, char **argv, char **arge ) 1061 { 1062 MACRO( "bare printf\n" ); 1063 return 0; 1064 } 1065 ], 1066 [hc_cv_pp_macro_arg_counting_broke=no], 1067 [hc_cv_pp_macro_arg_counting_broke=yes] 1068 ) 1069 1070 CFLAGS="$hc_temp" 1071 ] 1072 ) 1073else 1074 hc_cv_pp_macro_arg_counting_broke=no 1075fi 1076 1077#------------------------------------------------------------# 1078# Check if traditional preprocessor is the K&R C type... # 1079#------------------------------------------------------------# 1080# 1081# Apple's latest GCC documentation reveals: 1082# 1083# ... the -traditional-cpp option has changed. 1084# In Apple GCC 3.1 and earlier Apple GCC compilers, 1085# -traditional-cpp was used to toggle between the 1086# standard GNU GCC preprocessor and Apple's own 1087# preprocessor, "cpp-precomp". The GNU GCC compiler 1088# interpreted -traditional-cpp differently on all 1089# other platforms. Since cpp-precomp has been removed 1090# for Apple's GCC 3.3 compiler, the standard GNU 1091# meaning of -traditional-cpp has been restored. By 1092# default, the GCC 3.3 preprocessor conforms to the 1093# ISO C standard. Using the -tradtional-cpp option 1094# means the C preprocessor should instead try to 1095# emulate the old "K&R C". 1096# 1097#------------------------------------------------------------# 1098 1099if test "$GCC" = "yes"; then 1100 1101 AC_CACHE_CHECK( [whether '-traditional-cpp' is K&R C preprocessor], 1102 1103 [hc_cv_traditional_cpp_is_K_AND_R_C_type], 1104 [ 1105 hc_temp="$CFLAGS" 1106 CFLAGS="-Wall -Werror -traditional-cpp" 1107 1108# Note: The test program MUST start in column 1! Otherwise, the compilation 1109# will fail when it's not supposed to. 1110 AC_COMPILE_IFELSE( 1111 [ 1112/* If the following gets an error, then the 1113 "traditional" preprocessor is K&R C type. 1114 Otherwise if it compiles WITHOUT error 1115 the the "traditional" preprocessor is NOT 1116 the K&R C type. 1117*/ 1118#if 1 1119 #include <stdio.h> // comment/etc... 1120#endif 1121int main( int, char**, char** ) 1122{ 1123 return 0; 1124} 1125 ], 1126 [hc_cv_traditional_cpp_is_K_AND_R_C_type=no], 1127 [hc_cv_traditional_cpp_is_K_AND_R_C_type=yes] 1128 ) 1129 1130 CFLAGS="$hc_temp" 1131 ] 1132 ) 1133else 1134 hc_cv_traditional_cpp_is_K_AND_R_C_type=no 1135fi 1136 1137#-----------------------------------------------------------# 1138# Check whether byte-swapping can be done using assembler # 1139#-----------------------------------------------------------# 1140 1141AC_MSG_CHECKING( [whether byte-swapping can be done using assembler] ) 1142 1143# (use our own byteswap assembler routines are i486+ only) 1144# use system's byteswap routines if present... 1145 1146case "$host_cpu" in 1147 1148 i486|i586|i686|i786|x86_64) 1149 1150 hc_cv_asm_byteswap=yes 1151 ;; 1152 *) 1153 hc_cv_asm_byteswap=$hc_cv_have_byteswap_h 1154 ;; 1155esac 1156 1157AC_MSG_RESULT( [$hc_cv_asm_byteswap] ) 1158 1159#----------------------------------------------# 1160# Check whether -pthread needed for pthreads # 1161#----------------------------------------------# 1162 1163AC_MSG_CHECKING( [whether ${CC-cc} accepts -pthread] ) 1164 1165echo 'void f(){}' >conftest.c 1166if test -z "`${CC-cc} -pthread -c conftest.c 2>&1`"; then 1167 hc_cv_dash_pthread_needed=yes 1168else 1169 hc_cv_dash_pthread_needed=no 1170fi 1171 1172AC_MSG_RESULT( [$hc_cv_dash_pthread_needed] ) 1173 1174#------------------------------------------------------------------ 1175# The logic to test whether optreset is needed for getopt use is 1176# defined in the 'HC_CHECK_NEED_GETOPT_OPTRESET' macro in the 1177# 'hercules.m4' file in the autoconf directory, and issues the 1178# AC_DEFINE for 'NEED_GETOPT_OPTRESET' if it's needed (and also 1179# sets the '$hc_cv_need_getopt_optreset' variable appropriately). 1180#------------------------------------------------------------------ 1181 1182HC_CHECK_NEED_GETOPT_OPTRESET() 1183 1184AC_CACHE_SAVE() 1185 1186############################################################################### 1187# Checks for system services... 1188############################################################################### 1189 1190AC_SYS_LARGEFILE() 1191AC_TYPE_OFF_T() 1192AC_FUNC_FSEEKO() 1193 1194AC_CACHE_SAVE() 1195 1196############################################################################### 1197# AC_CONFIG_FILES( [file...] )... 1198############################################################################### 1199 1200AC_CACHE_SAVE() 1201 1202############################################################################### 1203# Set flags according to user-specified --enable-xxxxx build options 1204############################################################################### 1205 1206# PROGRAMMING NOTE: some of these values default to previously determined 1207# values (e.g. cckd-bzip2 for example defaults to whether libbz2 exists), 1208# so this section MUST [unfortunately] come AFTER the above sections. This 1209# does have the unfortunate side effect of not detecting invalid options 1210# right away like one would normally expect/want. The only way around that 1211# would be to perform two checks (one at the beginning and then one again 1212# later on), but that approach was rejected since it would tend to make our 1213# configure.ac script less clean (simple and straightforward). 1214 1215AC_ARG_ENABLE( dynamic-load, 1216 1217 AC_HELP_STRING([--disable-dynamic-load], 1218 1219 [disable dynamic loader option] 1220 ), 1221 [ 1222 case "${enableval}" in 1223 yes) hc_cv_opt_dynamic_load=yes ;; 1224 no) hc_cv_opt_dynamic_load=no ;; 1225 *) AC_MSG_RESULT( [ERROR: invalid 'dynamic-load' option] ) 1226 hc_error=yes 1227 ;; 1228 esac 1229 ], 1230 [hc_cv_opt_dynamic_load=yes] 1231) 1232 1233AC_ARG_ENABLE( cckd-bzip2, 1234 1235 AC_HELP_STRING( [--enable-cckd-bzip2], 1236 1237 [enable bzip2 compression for emulated dasd] 1238 ), 1239 [ 1240 case "${enableval}" in 1241 yes) hc_cv_opt_cckd_bzip2=yes ;; 1242 no) hc_cv_opt_cckd_bzip2=no ;; 1243 *) AC_MSG_RESULT( [ERROR: invalid 'cckd-bzip2' option] ) 1244 hc_error=yes 1245 ;; 1246 esac 1247 ], 1248 [hc_cv_opt_cckd_bzip2=$hc_cv_have_libbz2] 1249) 1250 1251AC_ARG_ENABLE( het-bzip2, 1252 1253 AC_HELP_STRING( [--enable-het-bzip2], 1254 1255 [enable bzip2 compression for emulated tapes] 1256 ), 1257 [ 1258 case "${enableval}" in 1259 yes) hc_cv_opt_het_bzip2=yes ;; 1260 no) hc_cv_opt_het_bzip2=no ;; 1261 *) AC_MSG_RESULT( [ERROR: invalid 'het-bzip2' option] ) 1262 hc_error=yes 1263 ;; 1264 esac 1265 ], 1266 [hc_cv_opt_het_bzip2=$hc_cv_have_libbz2] 1267) 1268 1269AC_ARG_ENABLE( debug, 1270 1271 AC_HELP_STRING( [--enable-debug], 1272 1273 [enable debugging (TRACE/VERIFY/ASSERT macros)] 1274 ), 1275 [ 1276 case "${enableval}" in 1277 yes) hc_cv_opt_debug=yes ;; 1278 no) hc_cv_opt_debug=no ;; 1279 *) AC_MSG_RESULT( [ERROR: invalid 'debug' option] ) 1280 hc_error=yes 1281 ;; 1282 esac 1283 ], 1284 [hc_cv_opt_debug=no] 1285) 1286 1287AC_ARG_ENABLE( optimization, 1288 1289 AC_HELP_STRING( [--enable-optimization=yes|no|FLAGS], 1290 1291 [enable automatic optimization, or specify flags] 1292 ), 1293 [ 1294 hc_cv_opt_optimization=${enableval} 1295 ], 1296 [hc_cv_opt_optimization=yes] 1297) 1298 1299AC_ARG_ENABLE( configsymbols, 1300 1301 AC_HELP_STRING( [--disable-configsymbols], 1302 1303 [disable symbolic substitutions in configuration file] 1304 ), 1305 [ 1306 case "${enableval}" in 1307 yes) hc_cv_opt_configsymbols=yes ;; 1308 no) hc_cv_opt_configsymbols=no ;; 1309 *) AC_MSG_RESULT( [ERROR: invalid 'configsymbols' option] ) 1310 hc_error=yes 1311 ;; 1312 esac 1313 ], 1314 [hc_cv_opt_configsymbols=yes] 1315) 1316 1317AC_ARG_ENABLE( enhanced-configsymbols, 1318 1319 AC_HELP_STRING( [--disable-enhanced-configsymbols], 1320 1321 [disable enhanced-mode symbolic substitutions in configuration file] 1322 ), 1323 [ 1324 case "${enableval}" in 1325 yes) hc_cv_opt_enhanced_configsymbols=yes ;; 1326 no) hc_cv_opt_enhanced_configsymbols=no ;; 1327 *) AC_MSG_RESULT( [ERROR: invalid 'enhanced-configsymbols' option] ) 1328 hc_error=yes 1329 ;; 1330 esac 1331 ], 1332 [hc_cv_opt_enhanced_configsymbols=yes] 1333) 1334 1335AC_ARG_ENABLE( enhanced-configincludes, 1336 1337 AC_HELP_STRING( [--disable-enhanced-configincludes], 1338 1339 [disable enhanced-mode 'include' file support in configuration file] 1340 ), 1341 [ 1342 case "${enableval}" in 1343 yes) hc_cv_opt_enhanced_configincludes=yes ;; 1344 no) hc_cv_opt_enhanced_configincludes=no ;; 1345 *) AC_MSG_RESULT( [ERROR: invalid 'enhanced-configincludes' option] ) 1346 hc_error=yes 1347 ;; 1348 esac 1349 ], 1350 [hc_cv_opt_enhanced_configincludes=yes] 1351) 1352 1353AC_ARG_ENABLE( automatic-operator, 1354 1355 AC_HELP_STRING( [--disable-automatic-operator], 1356 1357 [disable Hercules Automatic Operator feature] 1358 ), 1359 [ 1360 case "${enableval}" in 1361 yes) hc_cv_opt_auto_oper=yes ;; 1362 no) hc_cv_opt_auto_oper=no ;; 1363 *) AC_MSG_RESULT( [ERROR: invalid 'automatic-operator' option] ) 1364 hc_error=yes 1365 ;; 1366 esac 1367 ], 1368 [hc_cv_opt_auto_oper=$hc_cv_have_regex_h] 1369) 1370 1371AC_ARG_ENABLE( external-gui, 1372 1373 AC_HELP_STRING( [--disable-external-gui], 1374 1375 [disable external GUI interface] 1376 ), 1377 [ 1378 case "${enableval}" in 1379 yes) hc_cv_opt_external_gui=yes ;; 1380 no) hc_cv_opt_external_gui=no ;; 1381 *) AC_MSG_RESULT( [ERROR: invalid 'external-gui' option] ) 1382 hc_error=yes 1383 ;; 1384 esac 1385 ], 1386 [hc_cv_opt_external_gui=yes] 1387) 1388 1389AC_ARG_ENABLE( fthreads, 1390 1391 AC_HELP_STRING( [--disable-fthreads], 1392 1393 [disable use of fish threads instead of posix threads] 1394 ), 1395 [ 1396 case "${enableval}" in 1397 yes) hc_cv_opt_fthreads=yes ;; 1398 no) hc_cv_opt_fthreads=no ;; 1399 *) AC_MSG_RESULT( [ERROR: invalid 'fthreads' option] ) 1400 hc_error=yes 1401 ;; 1402 esac 1403 ], 1404 [hc_cv_opt_fthreads=$hc_cv_is_windows] 1405) 1406 1407AC_ARG_ENABLE( multi-cpu, 1408 1409 AC_HELP_STRING( [--enable-multi-cpu=yes|no|NUMBER], 1410 1411 [enable/disable multi-cpu support (1-128, default 8)] 1412 ), 1413 [ 1414 case "${enableval}" in 1415 yes) hc_cv_opt_num_cpu_engines=8 ;; 1416 no) hc_cv_opt_num_cpu_engines=1 ;; 1417 *) 1418 if test 0 -lt "${enableval}" -a 128 -ge "${enableval}" 1419 then 1420 hc_cv_opt_num_cpu_engines=${enableval} 1421 else 1422 AC_MSG_RESULT( [ERROR: invalid 'multi-cpu' option] ) 1423 hc_error=yes 1424 fi 1425 ;; 1426 esac 1427 ], 1428 [hc_cv_opt_num_cpu_engines=8] 1429) 1430 1431AC_ARG_ENABLE( capabilities, 1432 1433 AC_HELP_STRING([--disable-capabilities], 1434 1435 [disable fine grained privileges] 1436 ), 1437 [ 1438 case "${enableval}" in 1439 yes) hc_cv_opt_capabilities=yes ;; 1440 no) hc_cv_opt_capabilities=no ;; 1441 *) AC_MSG_RESULT( [ERROR: invalid 'capabilities' option] ) 1442 hc_error=yes 1443 ;; 1444 esac 1445 ], 1446 [hc_cv_opt_capabilities=hc_cv_have_sys_capability] 1447) 1448 1449# only include libcap if needed 1450if test "$hc_cv_opt_capabilities" = "yes"; then 1451 AC_CHECK_LIB(cap,cap_set_proc) 1452fi 1453# Force disable capabilities support if library is missing 1454if test "$ac_cv_lib_cap_cap_set_proc" = "no"; then 1455 hc_cv_opt_capabilities="no" 1456fi 1457# Force disable capabilities support if sys/capability.h header is missing 1458if test "$hc_cv_have_sys_capa_h" = "no"; then 1459 hc_cv_opt_capabilities="no" 1460fi 1461# Force disable capabilities support if sys/prctl.h header is missing 1462if test "$hc_cv_have_sys_prctl_h" = "no"; then 1463 hc_cv_opt_capabilities="no" 1464fi 1465 1466AC_ARG_ENABLE( custom, 1467 1468 AC_HELP_STRING( [--enable-custom=STRING], 1469 1470 [provide a custom description for this build] 1471 ), 1472 [ 1473 hc_cv_opt_custom_build_str=${enableval} 1474 ] 1475) 1476 1477if test "$hc_cv_build_hercifc" = "yes"; then 1478 1479 AC_ARG_ENABLE( setuid-hercifc, 1480 1481 AC_HELP_STRING( [--enable-setuid-hercifc=yes|no|GROUPNAME], 1482 1483 [install hercifc as setuid root, and allow execution by users in group GROUPNAME] 1484 ), 1485 [ 1486 case "${enableval}" in 1487 yes) hc_cv_opt_setuid_hercifc=yes ;; 1488 no) hc_cv_opt_setuid_hercifc=no ;; 1489 *) hc_cv_opt_setuid_hercifc=yes 1490 hc_cv_hercifc_groupname=${enableval} 1491 ;; 1492 esac 1493 ], 1494 [hc_cv_opt_setuid_hercifc=no] 1495 ) 1496 1497 hc_cv_setuid_hercifc=$hc_cv_opt_setuid_hercifc 1498 1499else 1500 hc_cv_setuid_hercifc=no 1501fi 1502 1503#----------------------------------------------------------------- 1504# The handling of AC_ARG_ENABLE for "--enable-getoptwrapper" 1505# is defined within the 'HC_ARG_ENABLE_GETOPTWRAPPER' macro 1506# coded in the 'hercules.m4' file in the autoconf directory 1507# and issues the AC_DEFINE for NEED_GETOPT_WRAPPER if needed 1508# (and sets the '$hc_cv_need_getopt_wrapper' variable too). 1509#----------------------------------------------------------------- 1510 1511HC_ARG_ENABLE_GETOPTWRAPPER() 1512 1513#---------------------------------------------------------------- 1514# Note: '$enable_shared' is automatically set by LIBTOOL, 1515# unless the user overrides it via --disable-shared. 1516#---------------------------------------------------------------- 1517hc_cv_hdl_build_shared=$enable_shared 1518 1519AC_CACHE_SAVE() 1520 1521############################################################################### 1522# Final default settings, final sanity / error checks... 1523############################################################################### 1524 1525if test "$hc_cv_build_hercifc" = "yes"; then 1526 1527 if test "$hc_cv_have_linux_if_tun_h" != "yes"; then 1528 1529 if test "$hc_cv_have_net_if_h" != "yes"; then 1530 1531 AC_MSG_RESULT( [ERROR: Required headers 'linux/if_tun.h' or 'net/if.h' not found] ) 1532 hc_error=yes 1533 fi 1534 fi 1535 1536 if test "$hc_cv_have_net_route_h" != "yes"; then 1537 1538 AC_MSG_RESULT( [ERROR: Required header 'net/route_h' not found] ) 1539 hc_error=yes 1540 fi 1541fi 1542 1543#------------------------------------------------------------------------------ 1544# signal.h is only required if strsignal function isn't available since if 1545# the strsignal function isn't available, we use our builtin which needs it. 1546# The presumption that if the strsignal function is found, then the signal.h 1547# header will also be found seems to be a fairly safe assumption to make IMO. 1548 1549if test "$hc_cv_have_strsignal" != "yes" && 1550 test "$hc_cv_have_signal_h" != "yes"; then 1551 1552 AC_MSG_RESULT( [ERROR: Required header 'signal.h' not found] ) 1553 hc_error=yes 1554fi 1555 1556#------------------------------------------------------------------------------ 1557 1558if test "$hc_cv_have_vsscanf" != "yes"; then 1559 1560 AC_MSG_RESULT( [ERROR: Required function 'vsscanf' not found] ) 1561 hc_error=yes 1562fi 1563 1564#------------------------------------------------------------------------------ 1565 1566if test "$hc_cv_have_inttypes_h" != "yes" && 1567 test "$hc_cv_have_u_int8_t" != "yes"; then 1568 1569 AC_MSG_RESULT( [ERROR: unable to find fixed-size data types] ) 1570 hc_error=yes 1571fi 1572 1573#------------------------------------------------------------------------------ 1574 1575if test "$hc_cv_opt_cckd_bzip2" = "yes" || 1576 test "$hc_cv_opt_het_bzip2" = "yes"; then 1577 1578 if test "$hc_cv_have_libbz2" != "yes"; then 1579 1580 AC_MSG_RESULT( [ERROR: bzip2 compression requested but libbz2 library not found] ) 1581 hc_error=yes 1582 fi 1583 1584 if test "$hc_cv_have_bzlib_h" != "yes"; then 1585 1586 AC_MSG_RESULT( [ERROR: bzip2 compression requested but 'bzlib.h' header not found] ) 1587 hc_error=yes 1588 fi 1589fi 1590 1591#------------------------------------------------------------------------------ 1592 1593if test "$hc_cv_opt_dynamic_load" = "yes"; then 1594 1595 if test "$hc_cv_have_lt_dlopen" != "yes" && 1596 test "$hc_cv_have_dlopen" != "yes"; then 1597 1598 AC_MSG_RESULT( [ERROR: dynamic-load requires libtool or dlltool] ) 1599 hc_error=yes 1600 fi 1601fi 1602 1603#------------------------------------------------------------------------------ 1604 1605if test "$hc_cv_opt_auto_oper" = "yes" && 1606 test "$hc_cv_have_regex_h" != "yes"; then 1607 1608 AC_MSG_RESULT( [ERROR: automatic-operator requested but 'regex.h' header not found] ) 1609 hc_error=yes 1610fi 1611 1612#------------------------------------------------------------------------------ 1613 1614if test "$hc_cv_opt_external_gui" = "yes" && 1615 test "$hc_cv_opt_dynamic_load" != "yes"; then 1616 1617 AC_MSG_RESULT( [ERROR: external-gui requires dynamic-load] ) 1618 hc_error=yes 1619fi 1620 1621#------------------------------------------------------------------------------ 1622 1623if test "$hc_cv_opt_fthreads" = "yes" && 1624 test "$hc_cv_is_windows" != "yes"; then 1625 1626 AC_MSG_RESULT( [ERROR: fthreads is only for Windows platforms] ) 1627 hc_error=yes 1628fi 1629 1630if test "$hc_cv_have_pthread_h" != "yes" && 1631 test "$hc_cv_opt_fthreads" != "yes"; then 1632 1633 AC_MSG_RESULT( [ERROR: unable to find pthread.h] ) 1634 hc_error=yes 1635fi 1636 1637#------------------------------------------------------------------------------ 1638 1639if test "$hc_cv_is_apple" = "yes" && 1640 test "$hc_cv_pp_macro_arg_counting_broke" = "yes" && 1641 test "$hc_cv_traditional_cpp_is_K_AND_R_C_type" = "yes"; then 1642 1643 AC_MSG_RESULT( [ERROR: macro argument counting broken and cannot use -traditional-cpp option to work around it] ) 1644 hc_error=yes 1645fi 1646 1647#------------------------------------------------------------------------------ 1648# If any errors have been detected, then abort the configure at this time 1649#------------------------------------------------------------------------------ 1650 1651if test "$hc_error" != "no"; then 1652 AC_MSG_ERROR( [Please correct the above error(s) and try again] ) 1653fi 1654 1655AC_CACHE_SAVE() 1656 1657############################################################################### 1658# Act on the results of all of the above... 1659############################################################################### 1660 1661# AUTOMATIC DETERMINATION OF OPTIMIZATION FLAGS 1662# 1663# If they specified 'no' then don't optimize. 1664# If they specified 'yes' then determine what flags we should use. 1665# If they didn't specify, then optimize only if this is NOT a debug build. 1666# Otherwise use whatever flags they specified as-is. 1667 1668AC_MSG_CHECKING( [for what optimization flags to use] ) 1669 1670case "$hc_cv_opt_optimization" in 1671 1672 no) 1673 1674 hc_cv_auto_optimize=no 1675 ;; 1676 1677 yes) 1678 1679 hc_cv_auto_optimize=yes 1680 ;; 1681 1682 *) 1683 if test "x$hc_cv_opt_optimization" = "x"; then 1684 1685 if test "$hc_cv_opt_debug" = "yes"; then 1686 1687 hc_cv_auto_optimize=no 1688 else 1689 hc_cv_auto_optimize=yes 1690 fi 1691 1692 else 1693 1694 hc_cv_auto_optimize=no 1695 hc_cv_optimization_flags="$hc_cv_opt_optimization" 1696 fi 1697 ;; 1698esac 1699 1700if test "$hc_cv_auto_optimize" = "yes"; then 1701 1702 if test "$hc_cv_builtin_alloca_broke" != "yes" && 1703 test "$hc_cv_opt_debug" != "yes"; then 1704 1705 hc_cv_optimization_flags="-O3" 1706 fi 1707 1708 hc_cv_is_intel_x86_arch=no 1709 1710 case "$host_cpu-$GCC" in 1711 1712 x86_64-yes) 1713 1714 hc_cv_is_intel_x86_arch=yes 1715 hc_cv_intel_cpu_type=k8 1716 ;; 1717 1718 i386-yes|i486-yes|i586-yes|i686-yes|i786-yes) 1719 1720 hc_cv_is_intel_x86_arch=yes 1721 1722 if test $host_cpu = i786; then 1723 1724 hc_cv_intel_cpu_type=pentium4 1725 else 1726 if test $host_cpu = i686 && 1727 test "hc_cv_is_gcc_2_96" = "yes"; then 1728 1729 hc_cv_intel_cpu_type=i586 1730 else 1731 hc_cv_intel_cpu_type=$host_cpu 1732 fi 1733 fi 1734 ;; 1735 1736 arm-yes) 1737 1738 hc_cv_is_intel_x86_arch=no 1739 hc_cv_optimization_flags="$hc_cv_optimization_flags -frename-registers" 1740 ;; 1741 1742 xscale-yes|arm*-yes) 1743 1744 hc_cv_is_intel_x86_arch=no 1745 hc_cv_optimization_flags="$hc_cv_optimization_flags -mcpu=$host_cpu -mtune=$host_cpu -frename-registers" 1746 ;; 1747 esac 1748 if test "$hc_cv_is_intel_x86_arch" = "yes"; then 1749 1750 hc_cv_optimization_flags="$hc_cv_optimization_flags -march=$hc_cv_intel_cpu_type" 1751 1752 if test "$hc_cv_builtin_alloca_broke" != "yes" && 1753 test "$hc_cv_opt_debug" != "yes"; then 1754 1755 hc_cv_optimization_flags="$hc_cv_optimization_flags -fomit-frame-pointer" 1756 else 1757 hc_cv_optimization_flags="$hc_cv_optimization_flags -fno-omit-frame-pointer" 1758 fi 1759 fi 1760 hc_cv_optimization_flags="$hc_cv_optimization_flags -fno-strict-aliasing" 1761fi 1762 1763if test "x$hc_cv_optimization_flags" = "x"; then 1764 AC_MSG_RESULT( [(none)] ) 1765else 1766 AC_MSG_RESULT( [$hc_cv_optimization_flags] ) 1767fi 1768 1769 1770AC_CACHE_SAVE() 1771 1772############################################################################### 1773# Set additional Warning options for the compiler 1774############################################################################### 1775 1776# Avoid warnings when the instruction decoders load unused register numbers 1777# from the instruction, and also to avoid modifying decNumber and softfloat 1778HC_ADD_TO_CFLAGS_IF_SUPPORTED([-Wno-unused-but-set-variable], 1779 hc_have_unused_set_variable) 1780 1781# MSVC requires all declarations to be at the start of a block, whereas gcc 1782# only issues a warning. This makes gcc flag mixed declarations as an error 1783HC_ADD_TO_CFLAGS_IF_SUPPORTED([-Werror=declaration-after-statement], 1784 hc_have_decl_after_stmt) 1785 1786AC_CACHE_SAVE() 1787 1788############################################################################### 1789# DONE! -- Define our OUTPUT values and then exit... 1790############################################################################### 1791 1792#--------------------------------------------------------------# 1793# (place only AC_DEFINE_UNQUOTED here; place AC_DEFINE below) # 1794#--------------------------------------------------------------# 1795 1796if test "x$hc_cv_opt_custom_build_str" != "x"; then 1797 AC_DEFINE_UNQUOTED( [CUSTOM_BUILD_STRING], "${hc_cv_opt_custom_build_str}" ) 1798fi 1799 1800AC_DEFINE_UNQUOTED( [MAX_CPU_ENGINES], ${hc_cv_opt_num_cpu_engines} ) 1801 1802AC_CACHE_SAVE() 1803 1804AC_MSG_NOTICE( [ ] ) 1805AC_MSG_NOTICE( [ Package destination directory prefixes: ] ) 1806AC_MSG_NOTICE( [ ] ) 1807AC_MSG_NOTICE( [ Libraries: ${modexecdir} ] ) 1808AC_MSG_NOTICE( [ Data: \$(datadir)/hercules ] ) 1809AC_MSG_NOTICE( [ ] ) 1810 1811CPPFLAGS="$CPPFLAGS"' -DPKGDATADIR=\"$(pkgdatadir)\" -DMODULESDIR=\"$(modexecdir)\"' 1812 1813#---------------------------------------------------------------# 1814# (place only AC_DEFINE here; place AC_DEFINE_UNQUOTED above) # 1815#---------------------------------------------------------------# 1816 1817test "$hc_cv_opt_debug" = "yes" && AC_DEFINE(DEBUG) 1818test "$hc_cv_have_inttypes_h" = "yes" && AC_DEFINE(HAVE_INTTYPES_H) 1819test "$hc_cv_have_u_int8_t" = "yes" && AC_DEFINE(HAVE_U_INT) 1820test "$hc_cv_opt_configsymbols" = "yes" && AC_DEFINE(OPTION_CONFIG_SYMBOLS) 1821test "$hc_cv_opt_enhanced_configsymbols" = "yes" && AC_DEFINE(OPTION_ENHANCED_CONFIG_SYMBOLS) 1822test "$hc_cv_opt_enhanced_configincludes" = "yes" && AC_DEFINE(OPTION_ENHANCED_CONFIG_INCLUDE) 1823test "$hc_cv_opt_auto_oper" = "yes" && AC_DEFINE(OPTION_HAO) 1824test "$hc_cv_opt_dynamic_load" = "yes" && AC_DEFINE(OPTION_DYNAMIC_LOAD) 1825test "$hc_cv_opt_fthreads" = "yes" && AC_DEFINE(OPTION_FTHREADS) 1826test "$hc_cv_hdl_build_shared" = "yes" && AC_DEFINE(HDL_BUILD_SHARED) 1827test "$hc_cv_have_lt_dlopen" = "yes" && AC_DEFINE(HDL_USE_LIBTOOL) 1828test "$hc_cv_is_windows" = "yes" && AC_DEFINE(WIN32) 1829test "$hc_cv_opt_external_gui" = "yes" && AC_DEFINE(EXTERNALGUI) 1830test "$hc_cv_opt_cckd_bzip2" = "yes" && AC_DEFINE(CCKD_BZIP2) 1831test "$hc_cv_opt_het_bzip2" = "yes" && AC_DEFINE(HET_BZIP2) 1832test "$hc_cv_timespec_in_sys_types_h" = "yes" && AC_DEFINE(TIMESPEC_IN_SYS_TYPES_H) 1833test "$hc_cv_timespec_in_time_h" = "yes" && AC_DEFINE(TIMESPEC_IN_TIME_H) 1834test "$hc_cv_have_getset_uid" != "yes" && AC_DEFINE(NO_SETUID) 1835test "$hc_cv_asm_byteswap" != "yes" && AC_DEFINE(NO_ASM_BYTESWAP) 1836test "$hc_cv_non_unique_gettimeofday" = "yes" && AC_DEFINE(NON_UNIQUE_GETTIMEOFDAY) 1837test "$hc_cv_build_hercifc" = "yes" && AC_DEFINE(BUILD_HERCIFC) 1838test "$hc_cv_opt_capabilities" = "yes" && AC_DEFINE(OPTION_CAPABILITIES) 1839 1840if test $hc_cv_have_sa_sigaction != yes || 1841 test $hc_cv_have_sigusr1 != yes || 1842 test $hc_cv_have_sigusr2 != yes || 1843 test $hc_cv_have_sigpipe != yes || 1844 test $hc_cv_have_sigbus != yes; then 1845 1846 AC_DEFINE(NO_SIGABEND_HANDLER) 1847 1848fi 1849 1850if test "$hc_cv_regparm_attr_supported" = "yes" && 1851 test "$hc_cv_regparm_attr_broke" != "yes"; then 1852 1853 AC_DEFINE(HAVE_ATTR_REGPARM) 1854fi 1855 1856if test "$hc_cv_is_apple" = "yes"; then 1857 1858 : 1859 1860 # 1861 # TODO?? 1862 # 1863 # Do whatever is necessary to get the following symbol defined 1864 # so the included libltdl will be built and used... 1865 # 1866 1867## AC_PROVIDE_AC_LIBTOOL_DLOPEN() 1868 1869fi 1870 1871#--------------------------------------------------# 1872# CPPFLAGS (pre-processor flags) # 1873#--------------------------------------------------# 1874 1875if test "$hc_cv_is_apple" = "yes" && 1876 test "$hc_cv_pp_macro_arg_counting_broke" = "yes"; then 1877 1878 CPPFLAGS="${CPPFLAGS} -traditional-cpp -Wno-endif-labels" 1879fi 1880 1881#--------------------------------------------------# 1882# CFLAGS (compiler flags) # 1883#--------------------------------------------------# 1884 1885 1886if test "$hc_cv_is_windows" = "yes"; then 1887 1888 if test "$hc_cv_have_pthread_h" = "yes" && 1889 test "x$hc_cv_alt_pthread_location" != "x"; then 1890 1891 CFLAGS="$CFLAGS -I${hc_cv_alt_pthread_location}" 1892 fi 1893 1894 CFLAGS="$CFLAGS -Wno-format" 1895fi 1896 1897if test "$hc_cv_byte_structs_aligned_and_rounded_by_default" = "yes"; then 1898 1899 #=============================================================== 1900 # the following requests 8-bit (byte) struct boundary alignment 1901 #=============================================================== 1902 1903 CFLAGS="$CFLAGS -mstructure-size-boundary=8" 1904fi 1905 1906test "x$hc_cv_optimization_flags" != "x" && CFLAGS="$CFLAGS $hc_cv_optimization_flags" 1907 1908#--------------------------------------------------# 1909# LIBS (linker flags) # 1910#--------------------------------------------------# 1911 1912test "$hc_cv_dash_pthread_needed" = "yes" && LIBS="$LIBS -pthread" 1913test "$hc_cv_have_libbz2" = "yes" && LIBS="$LIBS -lbz2" 1914 1915# ---------------------- MINGW32 ---------------------- 1916 1917test "$hc_cv_is_mingw32" = "yes" && LIBS="$LIBS -lmsvcrt" 1918test "$hc_cv_is_mingw32" = "yes" && LIBS="$LIBS -lws2_32" 1919 1920AC_CACHE_SAVE() 1921 1922#--------------------------------------------------------------------------------# 1923# Pass certain values/settings as makefile variables to automake (makefile.am) # 1924#--------------------------------------------------------------------------------# 1925 1926AM_CONDITIONAL( OPTION_DYNAMIC_LOAD, [ test "$hc_cv_opt_dynamic_load" = "yes" ] ) 1927AM_CONDITIONAL( BUILD_FTHREADS, [ test "$hc_cv_opt_fthreads" = "yes" ] ) 1928AM_CONDITIONAL( BUILD_HERCIFC, [ test "$hc_cv_build_hercifc" = "yes" ] ) 1929AM_CONDITIONAL( SETUID_HERCIFC, [ test "$hc_cv_setuid_hercifc" = "yes" ] ) 1930AM_CONDITIONAL( HERCIFC_GROUPSET, [ test "x$hc_cv_hercifc_groupname" != "x"] ) 1931 1932if test "x$hc_cv_hercifc_groupname" != "x"; then 1933 HERCIFC_GROUPNAME=${hc_cv_hercifc_groupname} 1934 AC_SUBST(HERCIFC_GROUPNAME) 1935fi 1936 1937# Building of shared libraries is forced, and we force use of libtool too. 1938 1939AM_CONDITIONAL( BUILD_SHARED, [ test "$hc_cv_hdl_build_shared" = "yes" ] ) 1940AM_CONDITIONAL( USE_DLLTOOL, [ test "$hc_cv_is_windows" = "yes" ] ) 1941 1942AC_CACHE_SAVE() 1943 1944AC_OUTPUT( [ Makefile util/Makefile html/Makefile crypto/Makefile man/Makefile m4/Makefile decNumber/Makefile softfloat/Makefile] ) 1945 1946############################################################################### 1947# (end-of-file) 1948############################################################################### 1949