1# 2# Configure template for GnuCOBOL 3# Process this file with autoconf to produce a configure script. 4# 5# Copyright (C) 2001-2012, 2014-2020 Free Software Foundation, Inc. 6# Written by Keisuke Nishida, Roger While, Ron Norman, Simon Sobisch, 7# Edward Hart 8# 9# This file is part of GnuCOBOL. 10# 11# The GnuCOBOL compiler is free software: you can redistribute it 12# and/or modify it under the terms of the GNU General Public License 13# as published by the Free Software Foundation, either version 3 of the 14# License, or (at your option) any later version. 15# 16# GnuCOBOL is distributed in the hope that it will be useful, 17# but WITHOUT ANY WARRANTY; without even the implied warranty of 18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19# GNU General Public License for more details. 20# 21# You should have received a copy of the GNU General Public License 22# along with GnuCOBOL. If not, see <https://www.gnu.org/licenses/>. 23 24AC_PREREQ([2.64]) 25 26AC_INIT([GnuCOBOL], 27 [3.1.2], 28 [bug-gnucobol@gnu.org], 29 [gnucobol], 30 [https://www.gnu.org/software/gnucobol/]) 31AC_REVISION([GnuCOBOL snapshot $Revision: 4106 $]) 32AC_CONFIG_SRCDIR([libcob.h]) 33AC_CONFIG_HEADERS([config.h]) 34AC_CONFIG_TESTDIR([tests]) 35AC_CONFIG_MACRO_DIR([m4]) 36AC_CONFIG_AUX_DIR([build_aux]) 37 38AC_CONFIG_FILES([Makefile libcob/Makefile lib/Makefile cobc/Makefile 39 bin/Makefile po/Makefile.in doc/Makefile config/Makefile 40 copy/Makefile tests/Makefile tests/cobol85/Makefile 41 extras/Makefile]) 42 43AC_CONFIG_FILES([bin/cob-config], [chmod +x bin/cob-config]) 44AC_CONFIG_FILES([pre-inst-env:build_aux/pre-inst-env.in], 45 [chmod +x pre-inst-env]) 46AC_CONFIG_FILES([tests/atlocal], [chmod +x tests/atlocal]) 47AC_CONFIG_FILES([tests/run_prog_manual.sh], 48 [chmod +x tests/run_prog_manual.sh]) 49 50# Note for SUN Solaris (gcc) 51# export/setenv CFLAGS "-m64 -mptr64" 52# export/setenv LDFLAGS "-m64 -mptr64 -L/usr/local/lib/sparcv9" 53# ./configure --libdir=/usr/local/lib/sparcv9 54# 55# Hack for AIX 64 bit (gcc) 56# Required - 57# export/setenv CFLAGS=-maix64 58# export/setenv LDFLAGS=-maix64 59 60if echo $CFLAGS | grep 'aix64' 1>/dev/null 2>&1; then 61 if test -f /usr/ccs/bin/ar; then 62 AR="/usr/ccs/bin/ar -X64" 63 else 64 AR="ar -X64" 65 fi 66 NM="/usr/ccs/bin/nm -X64 -B" 67fi 68 69AM_INIT_AUTOMAKE([gnu no-texinfo.tex]) 70 71# Autoheader templates 72AH_TEMPLATE([COB_DEBUG_LOG], [Enable internal logging (Developers only!)]) 73AH_TEMPLATE([COB_EXPERIMENTAL], [Enable experimental code (Developers only!)]) 74AH_TEMPLATE([COB_TREE_DEBUG], [Enable extra checks within the compiler (Developers only!)]) 75AH_TEMPLATE([COB_PARAM_CHECK], [Enable minimum parameter check for system libraries]) 76AH_TEMPLATE([PATCH_LEVEL], [Define a patch level (numeric, max. 8 digits)]) 77AH_TEMPLATE([MAX_CALL_FIELD_PARAMS], [Define maximum parameters for CALL]) 78AH_TEMPLATE([WITH_MATH], [Math multiple precision library]) 79AH_TEMPLATE([WITH_INDEX_EXTFH], [Compile with obsolete external INDEXED handler]) 80AH_TEMPLATE([WITH_SEQRA_EXTFH], [Compile with obsolete external SEQ/RAN handler]) 81AH_TEMPLATE([WITH_DB], [Use Berkeley DB library as INDEXED handler]) 82# FIXME: may be specified with different file version 83# AH_TEMPLATE([COB_BDB_BAD_DUPNO], [Retain incorrect duplicate sequence for compatibility on little endian!]) 84AH_TEMPLATE([WITH_CISAM], [Use CISAM as INDEXED handler]) 85AH_TEMPLATE([WITH_DISAM], [Use DISAM as INDEXED handler]) 86AH_TEMPLATE([WITH_VBISAM], [Use VBISAM as INDEXED handler]) 87 88AH_TEMPLATE([WITH_XML2], [Use libxml2 as XML handler]) 89AH_TEMPLATE([WITH_JSON], [JSON handler]) 90AH_TEMPLATE([WITH_CJSON], [Use cJSON library/source as JSON handler]) 91AH_TEMPLATE([WITH_JSON_C], [Use JSON-C library as JSON handler]) 92 93AH_TEMPLATE([COB_EXPORT_DYN], [Compile/link option for exporting symbols]) 94AH_TEMPLATE([COB_PIC_FLAGS], [Compile/link option for PIC code]) 95AH_TEMPLATE([COB_DEBUG_FLAGS], [Compile/link option for debugging]) 96AH_TEMPLATE([COB_SHARED_OPT], [Compile/link option for shared code]) 97AH_TEMPLATE([COB_STRIP_CMD], [Strip command]) 98AH_TEMPLATE([USE_LIBDL], [Use system dynamic loader]) 99AH_TEMPLATE([HAVE_DLADDR], [Has dladdr function]) 100AH_TEMPLATE([WITH_VARSEQ], [Define variable sequential file format]) 101AH_TEMPLATE([HAVE_ATTRIBUTE_ALIGNED], [Has __attribute__((aligned))]) 102AH_TEMPLATE([HAVE_TIMEZONE], [Has timezone variable]) 103AH_TEMPLATE([COB_OBJECT_EXT], [Object extension]) 104AH_TEMPLATE([COB_MODULE_EXT], [Module extension]) 105AH_TEMPLATE([COB_EXE_EXT], [Executable extension]) 106AH_TEMPLATE([COB_KEYWORD_INLINE], [Keyword for inline]) 107AH_TEMPLATE([COB_NO_SELFOPEN], [Can not dlopen self]) 108AH_TEMPLATE([COB_COMPUTED_GOTO], [Compilation of computed gotos works]) 109AH_TEMPLATE([COB_LI_IS_LL], [long int is long long]) 110AH_TEMPLATE([COB_32_BIT_LONG], [long int is 32 bits]) 111AH_TEMPLATE([COB_64_BIT_POINTER], [Pointers are longer than 32 bits]) 112AH_TEMPLATE([WITH_CURSES], [curses library for extended SCREEN I/O]) 113AH_TEMPLATE([HAVE_COLOR_SET], [curses has color_set function]) 114AH_TEMPLATE([HAVE_DEFINE_KEY], [curses has define_key function]) 115AH_TEMPLATE([HAVE_MOUSEINTERVAL], [curses has mouseinterval function]) 116AH_TEMPLATE([HAVE_HAS_MOUSE], [curses has has_mouse function]) 117AH_TEMPLATE([HAVE_CURSES_FREEALL], [ncurses has _nc_freeall function]) 118AH_TEMPLATE([HAVE_USE_LEGACY_CODING], [ncurses has use_legacy_coding function]) 119AH_TEMPLATE([HAVE_DESIGNATED_INITS], [Has designated initializers]) 120AH_TEMPLATE([HAVE_NANO_SLEEP], [Has nanosleep function]) 121AH_TEMPLATE([HAVE_CLOCK_GETTIME], [Has clock_gettime function and CLOCK_REALTIME]) 122AH_TEMPLATE([HAVE_ISFINITE], [Has isfinite function]) 123AH_TEMPLATE([HAVE_MP_GET_MEMORY_FUNCTIONS], [Do we have mp_get_memory_functions in GMP/MPIR]) 124#AH_TEMPLATE([HAVE_RAISE], [Has raise function]) 125AH_TEMPLATE([HAVE_FINITE_IEEEFP_H], 126 [Declaration of finite function in ieeefp.h instead of math.h]) 127 128# preparation for cross-compilation 129AC_ARG_PROGRAM 130 131# Configure options part I (not needing any compilation) 132 133AC_ARG_ENABLE([debug], 134 [AS_HELP_STRING([--enable-debug], 135 [(GnuCOBOL) Enable -g C compiler debug option for cobc + libcob])], 136 [], 137 [enable_debug=no]) 138 139AC_ARG_ENABLE([hardening], 140 [AS_HELP_STRING([--enable-hardening, --disable-hardening], 141 [Enable GNU C "hardening" options: define _FORTIFY_SOURCE and use -fstack-protector. 142 If disabled, these are explicit removed from CFLAGS for building GnuCOBOL. 143 Defaults to "defined by CFLAGS".])],, 144 [enable_hardening="unset"]) 145 146AC_ARG_ENABLE([experimental], 147 [AS_HELP_STRING([--enable-experimental], 148 [(GnuCOBOL) Enable experimental code (Developers only!)])], 149 [if test "$enable_experimental" = "yes"; then 150 AC_DEFINE([COB_EXPERIMENTAL], [1]) 151 fi], 152 []) 153 154AC_ARG_ENABLE([cobc-internal-checks], 155 [AS_HELP_STRING([--enable-cobc-internal-checks], 156 [(GnuCOBOL) Enable extra checks within the compiler (Developers only!)])], 157 [if test "$enable_cobc_internal_checks" = "yes"; then 158 AC_DEFINE([COB_TREE_DEBUG], [1]) 159 fi], 160 []) 161 162AC_ARG_ENABLE([debuglog], 163 [AS_HELP_STRING([--enable-debuglog], 164 [(GnuCOBOL) Enable internal logging code (Developers only!)])], 165 [if test "$enable_debuglog" = "yes"; then 166 AC_DEFINE([COB_DEBUG_LOG], [1]) 167 fi], 168 []) 169 170AC_ARG_ENABLE([param-check], 171 [AS_HELP_STRING([--enable-param-check], 172 [(GnuCOBOL) Enable minimum parameter check for system libraries (default no)])], 173 [if test "$enable_param_check" = "yes"; then 174 AC_DEFINE([COB_PARAM_CHECK], [1]) 175 fi], 176 []) 177 178# FIXME: may be specified with different file version 179# AC_ARG_ENABLE([bdbdupno], 180# [AS_HELP_STRING([--enable-bdbdupno], 181# [(GnuCOBOL) Retain old BDB duplicate sequence (Incorrect on little-endian!)])], 182# [if test "$enable_bdbdupno" = "yes"; then 183# AC_DEFINE([COB_BDB_BAD_DUPNO], [1]) 184# fi], 185# []) 186 187AC_ARG_WITH([patch-level], 188 [AS_HELP_STRING([--with-patch-level], 189 [(GnuCOBOL) Define a patch level (default 0), numeric, max. 8 digits])], 190 [case $with_patch_level in 191 yes) AC_MSG_ERROR([[You must give --with-patch-level an argument.]]) 192 ;; 193 no) AC_MSG_ERROR([[--without-patch-level not supported.]]) 194 ;; 195 [[0-9]]*) 196 if test $with_patch_level -gt 99999999; then 197 AC_MSG_ERROR([[Patch level must not contain more than 8 digits]]) 198 fi 199 ;; 200 *) AC_MSG_ERROR([[You must use a numeric patch level]]) 201 ;; 202 esac], 203 [with_patch_level=0]) 204 205AC_DEFINE_UNQUOTED([PATCH_LEVEL], [$with_patch_level]) 206 207AC_ARG_WITH([max-call-params], 208 [AS_HELP_STRING([--with-max-call-params], 209 [(GnuCOBOL) Define maximum number of parameters for CALL (default 192)])], 210 [case $with_max_call_params in 211 yes) AC_MSG_ERROR([[You must give --with-max-call-params an argument.]]) 212 ;; 213 no) AC_MSG_ERROR([[--without-max-call-params not supported.]]) 214 ;; 215 16 | 36 | 56 | 76 | 96 | 192 | 252) 216 ;; 217 *) AC_MSG_ERROR([[Maximum number of parameters for CALL must be one of 16/36/56/76/96/192/252]]) 218 ;; 219 esac], 220 [with_max_call_params=192]) 221 222AC_DEFINE_UNQUOTED([MAX_CALL_FIELD_PARAMS], [$with_max_call_params]) 223 224 225# Basic capability tests 226 227configured_make="" 228if test -z "$MAKE"; then 229 AC_CHECK_PROGS([configured_make], [make gmake gnumake]) 230 if test -z "$configured_make"; then 231 AC_MSG_ERROR([make not found]) 232 else 233 MAKE=$configured_make 234 AC_SUBST(MAKE) 235 fi 236else 237 AC_CHECK_PROG([configured_make], [$MAKE], [$MAKE]) 238 if test -z "$configured_make"; then 239 AC_MSG_ERROR([make, configured as "$MAKE", was not found]) 240 fi 241fi 242 243AC_MSG_CHECKING([whether ${MAKE} supports order-only prerequisites]) 244rm -f confinc.* confprereq 245cat > confmf.mk << 'END' 246PREREQ := confprereq 247am__doit: am__prereq | $(PREREQ) 248 @echo target am__doit. >>confinc.out 249am__prereq: 250 @echo target am__prereq. >>confinc.out 251$(PREREQ): 252 @touch $(PREREQ) 253 @echo target $(PREREQ). >>confinc.out 254.PHONY: am__doit am__prereq 255END 256_am_result=no 257 AM_RUN_LOG([${MAKE} -f confmf.mk && ${MAKE-make} -f confmf.mk && cat confinc.out]) 258 ## redirecting via echo to remove special chars 259 __am_checkme=$(echo `cat confinc.out 2>/dev/null`) 260 AS_CASE([$?:${__am_checkme}], 261 ['0:target am__prereq. target confprereq. target am__doit. target am__prereq. target am__doit.'], 262 [_am_result="yes"]) 263rm -f confinc.* confmf.mk confprereq 264AC_MSG_RESULT([${_am_result}]) 265AM_CONDITIONAL([MAKE_HAS_PREREQ_ONLY], [test "${_am_result}" = "yes"]) 266 267curr_libs="$LIBS" 268 269enable_cflags_setting=no 270AC_MSG_CHECKING([whether CFLAGS -O can be modified]) 271# Enable setting if the user has not specified the optimisation in CFLAGS. 272# Checked before AC_PROG_CC and default flags are applied. 273echo "$CFLAGS" | grep "\-O.*\( \|$\)" 1>/dev/null 2>/dev/null 274if test $? != 0; then 275 enable_cflags_setting=yes 276fi 277AC_MSG_RESULT([$enable_cflags_setting]) 278 279# Default CFLAGS (removed -g set in AC_INIT for compatibility) 280: ${CFLAGS="-O2"} 281 282AC_PROG_CC([gcc xlc cc]) 283AC_PROG_CC_STDC 284 285AC_PROG_CPP 286 287AC_USE_SYSTEM_EXTENSIONS 288 289# general flags for compiler and linker and tests for those 290AC_ARG_VAR([LIBCOB_CPPFLAGS], [see CPPFLAGS, but only applied during generation of libcob]) 291AS_IF([test "x$LIBCOB_CPPFLAGS" != "x"], [ 292 AC_MSG_CHECKING([if compilation with LIBCOB_CPPFLAGS works]) 293 curr_cppflags="$CPPFLAGS" 294 CPPFLAGS="$CPPFLAGS $LIBCOB_CPPFLAGS" 295 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], 296 [[static int i = 1;]])], 297 [AC_MSG_RESULT([yes])], 298 [AC_MSG_RESULT([no]) 299 AC_MSG_ERROR([not possible to compile with LIBCOB_CPPFLAGS="$LIBCOB_CPPFLAGS"])]) 300 CPPFLAGS="$curr_cppflags" 301]) 302 303curr_libs="$LIBS" 304AC_ARG_VAR([LIBCOB_LIBS], [see LIBS, but only applied during generation of libcob]) 305AS_IF([test "x$LIBCOB_LIBS" != "x"], [ 306 AC_MSG_CHECKING([if linking with LIBCOB_LIBS works]) 307 LIBS="$LIBS $LIBCOB_LIBS" 308 AC_LINK_IFELSE([AC_LANG_PROGRAM([], 309 [[return 0;]])], 310 [AC_MSG_RESULT([yes])], 311 [AC_MSG_RESULT([no]) 312 AC_MSG_ERROR([not possible to link with LIBCOB_LIBS="$LIBCOB_LIBS"])]) 313]) 314 315AC_ARG_VAR([PROGRAMS_LIBS], [see LIBS, but only applied during generation of programs: cobc, cobcrun]) 316AS_IF([test "x$PROGRAMS_LIBS" != "x"], [ 317 AC_MSG_CHECKING([if linking with PROGRAMS_LIBS works]) 318 LIBS="$LIBS $PROGRAMS_LIBS" 319 AC_LINK_IFELSE([AC_LANG_PROGRAM([], 320 [[return 0;]])], 321 [AC_MSG_RESULT([yes])], 322 [AC_MSG_RESULT([no]) 323 AC_MSG_ERROR([not possible to link with PROGRAMS_LIBS="$PROGRAMS_LIBS"])]) 324]) 325LIBS="$curr_libs" 326 327 328LT_INIT([dlopen win32-dll]) 329 330AC_PROG_EGREP 331AM_PROG_CC_C_O 332 333AM_PROG_LEX 334AC_PROG_YACC 335 336LT_PROG_RC 337 338# only GNU Bison is supported, so drop yacc-compatibility warnings if possible 339# note: that breaks old Bison versions which we still support, 340# if that changes the test may be obsolete 341AC_MSG_CHECKING([how to disable yacc compatibility warnings]) 342case "$YACC $YFLAGS $AM_YFLAGS" in 343 *-Wno-yacc*) 344 AC_MSG_RESULT([already specified]) 345 ;; 346 *-Wyacc*) 347 AC_MSG_RESULT([explicit enabled]) 348 ;; 349 *) 350 $YACC $AM_YFLAGS $YFLAGS -Wno-yacc -V 1>/dev/null 2>&1 351 if test $? -eq 0; then 352 AC_MSG_RESULT([-Wno-yacc]) 353 if test -z "$YFLAGS"; then 354 YFLAGS="-Wno-yacc" 355 else 356 YFLAGS="$YFLAGS -Wno-yacc" 357 fi 358 else 359 AC_MSG_RESULT([not supported]) 360 fi 361 ;; 362esac 363 364AC_ARG_VAR(DIFF_FLAGS, arguments passed to diff) 365AC_MSG_CHECKING([for diff arguments]) 366case "$DIFF_FLAGS" in 367 *--strip-trailing-cr*) 368 AC_MSG_RESULT([specified as $DIFF_FLAGS]) 369 ;; 370 *) 371 diff $DIFF_FLAGS --strip-trailing-cr --version 1>/dev/null 2>&1 372 if test $? -eq 0; then 373 if test -z "$DIFF_FLAGS"; then 374 DIFF_FLAGS="--strip-trailing-cr" 375 else 376 DIFF_FLAGS="$DIFF_FLAGS --strip-trailing-cr" 377 fi 378 AC_MSG_RESULT([$DIFF_FLAGS]) 379 else 380 AC_MSG_RESULT([not supported]) 381 fi 382 ;; 383esac 384AC_SUBST(DIFF_FLAGS) 385 386# Stop tests for C++ and Fortran 387AC_DEFUN([AC_PROG_F77], []) 388AC_DEFUN([AC_PROG_CXX], []) 389AC_PROG_LN_S 390AC_PROG_INSTALL 391 392AC_PROG_MAKE_SET 393AC_LIB_RPATH 394 395 396# Checks for header files. 397AC_HEADER_STDC 398AC_CHECK_HEADERS([stdint.h sys/types.h signal.h fcntl.h malloc.h locale.h \ 399 stddef.h wchar.h dlfcn.h sys/time.h sys/wait.h]) 400 401 402# Checks for typedefs, structures, and compiler characteristics. 403AC_C_CONST 404AC_C_BIGENDIAN 405AC_TYPE_SIZE_T 406AC_STRUCT_TM 407AC_CHECK_TYPES([sig_atomic_t], [], [], [[#include <signal.h>]]) 408 409# Don't use AC_C_INLINE here. We need the value 410 411AC_MSG_CHECKING([for inline keyword]) 412for cob_keyw in __inline __inline__ inline 413do 414 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 415 #ifndef __cplusplus 416 typedef int foo_t; 417 static $cob_keyw foo_t foo () { return 0; } 418 #endif]], [[ 419 #ifndef __cplusplus 420 return foo (); 421 #else 422 choke me 423 #endif]])], 424 [AC_DEFINE_UNQUOTED([COB_KEYWORD_INLINE], [$cob_keyw]) break], 425 [], 426 []) 427done 428AC_MSG_RESULT([$cob_keyw]) 429unset cob_keyw 430 431 432# Checks for library functions. 433AC_FUNC_VPRINTF 434AC_CHECK_FUNCS([memmove memset setlocale fcntl strerror strcasecmp \ 435 strchr strrchr strdup strstr strtol gettimeofday localeconv \ 436 getexecname canonicalize_file_name popen raise readlink realpath \ 437 setenv strcoll flockfile]) 438 439# Check for timezone 440AC_MSG_CHECKING([for timezone variable access]) 441AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], 442 [[timezone = 3600;]])], 443 [AC_DEFINE([HAVE_TIMEZONE], [1]) 444 AC_MSG_RESULT([yes])], 445 [AC_MSG_RESULT([no])]) 446 447# Check for designated initializers 448AC_MSG_CHECKING([for designated initializers]) 449AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], 450 [[static const unsigned char valid_char[256] = { 451 @<:@'0'@:>@ = 1, 452 @<:@'1'@:>@ = 1 }; 453 ]])], 454 [AC_DEFINE([HAVE_DESIGNATED_INITS], [1]) AC_MSG_RESULT([yes])], 455 [AC_MSG_RESULT([no])]) 456 457# Check gcc/icc/clang 458COB_USES_GCC="no" 459COB_USES_GCC_NO_ICC="no" 460COB_USES_ICC_ONLY="no" 461COB_USES_CLANG_ONLY="no" 462COB_USES_XLC_ONLY="no" 463COB_USES_WATCOMC_ONLY="no" 464 465AC_MSG_CHECKING([for __GNUC__]) 466AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ 467 #ifndef __GNUC__ 468 # error macro not defined 469 #endif]])], 470 [COB_USES_GCC="yes" 471 AC_MSG_RESULT([yes])], 472 [AC_MSG_RESULT([no])]) 473 474AC_MSG_CHECKING([for __INTEL_COMPILER]) 475AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ 476 #ifndef __INTEL_COMPILER 477 # error macro not defined 478 #endif]])], 479 [COB_USES_ICC_ONLY=yes 480 AC_MSG_RESULT([yes])], 481 [if test "$COB_USES_GCC" = "yes"; then 482 COB_USES_GCC_NO_ICC="yes" 483 fi 484 AC_MSG_RESULT([no])] 485 ) 486 487AC_MSG_CHECKING([for __clang__]) 488AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ 489 #ifndef __clang__ 490 # error macro not defined 491 #endif]])], 492 [COB_USES_CLANG_ONLY="yes" 493 AC_MSG_RESULT([yes])], 494 [AC_MSG_RESULT([no])]) 495 496AC_MSG_CHECKING([for __xlc__]) 497AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ 498 #ifndef __xlc__ 499 # error macro not defined 500 #endif]])], 501 [COB_USES_XLC_ONLY="yes" 502 AC_MSG_RESULT([yes])], 503 [AC_MSG_RESULT([no])]) 504 505AC_MSG_CHECKING([for __WATCOMC__]) 506AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ 507 #ifndef __WATCOMC__ 508 # error macro not defined 509 #endif]])], 510 [COB_USES_WATCOMC_ONLY="yes" 511 AC_MSG_RESULT([yes])], 512 [AC_MSG_RESULT([no])]) 513 514if test "x$COB_CC" = "x"; then 515 COB_CC="$CC" 516fi 517 518# FIXME: -lm should only be used if needed (which it often is not), see Bug #559 519if test "$COB_USES_ICC_ONLY" = "yes"; then 520 COMMON_LIBS="-limf -lm" 521else 522 COMMON_LIBS="-lm" 523fi 524if test "x$LIBCOB_LIBS" != "x"; then 525 LIBCOB_LIBS="$LIBCOB_LIBS $COMMON_LIBS" 526else 527 LIBCOB_LIBS="$COMMON_LIBS" 528fi 529 530COB_LIBS="-L$libdir -lcob" 531if test "x$COMMON_LIBS" != "x"; then 532 if test "x$COB_LIBS" != "x"; then 533 COB_LIBS="$COB_LIBS $COMMON_LIBS" 534 else 535 COB_LIBS="$COMMON_LIBS" 536 fi 537fi 538if test "x$LDFLAGS" != "x"; then 539 if test "x$COB_LDFLAGS" != "x"; then 540 COB_LDFLAGS="$COB_LDFLAGS $LDFLAGS" 541 else 542 COB_LDFLAGS="$LDFLAGS" 543 fi 544fi 545 546# Add --enable-code-coverage and test for code-coverage tools if enabled 547AX_CODE_COVERAGE 548 549if test "$COB_USES_GCC_NO_ICC" != yes -a "$enable_code_coverage" = "yes"; then 550 AC_MSG_ERROR([Code coverage checks are only usable with GCC!]) 551fi 552 553 554# set PKG_CONFIG to use (cross-compile aware) 555PKG_PROG_PKG_CONFIG 556 557 558# Checks for gmp. 559AC_MSG_NOTICE([Checks for GMP/MPIR ...]) 560 561AC_ARG_WITH([math], 562 [AS_HELP_STRING([[--with-math[=ARG]]], 563 [(GnuCOBOL) Use math multiple precision library, where ARG may be: 564 check (default), gmp, mpir])], 565 [case "$with_math" in 566 gmp | mpir | check) 567 USE_MATH="$with_math" 568 ;; 569 yes) 570 USE_MATH="check" 571 ;; 572 no) 573 AC_MSG_ERROR([Cannot build GnuCOBOL without math multiple precision library)]) 574 ;; 575 *) 576 AC_MSG_ERROR([invalid value "$with_math" for --with-math, 577 must be one of the following: 578 gmp, mpir (use only the specified library) 579 check (use whatever library is usable)]) 580 ;; 581 esac], 582 [USE_MATH="check"]) 583 584curr_libs=$LIBS 585curr_cppflags=$CPPFLAGS 586 587AS_IF([test "$USE_MATH" = "gmp" -o "$USE_MATH" = "check"], [ 588 curr_libs="$LIBS"; curr_cppflags="$CPPFLAGS" 589 PKG_CHECK_MODULES([GMP], [gmp], [], [ 590 PKG_CHECK_MODULES([GMP], [libgmp], [], [# 591 ]) 592 ]) 593 if test -n "$GMP_CFLAGS"; then 594 CPPFLAGS="$CPPFLAGS $GMP_CFLAGS" 595 fi 596 if test -z "${GMP_LIBS+x}"; then 597 GMP_LIBS="-lgmp" 598 fi 599 LIBS="$LIBS $GMP_LIBS" 600 AC_CHECK_HEADERS([gmp.h], [ 601 AC_MSG_CHECKING([if linking against libgmp with "$GMP_LIBS" works]) 602 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gmp.h>]], 603 [[mpz_t integ; mpz_init (integ);]])], 604 [AC_MSG_RESULT([yes]) 605 curr_cppflags=$CPPFLAGS # for the include in cobc generated modules 606 LIBCOB_LIBS="$LIBCOB_LIBS $GMP_LIBS" 607 USE_MATH=gmp], 608 [AC_MSG_RESULT([no]) 609 if test "$USE_MATH" = "gmp"; then 610 AC_MSG_ERROR([[GMP is required for --with-math=gmp, you may adjust GMP_LIBS]]) 611 fi 612 LIBS="$curr_libs"; CPPFLAGS="$curr_cppflags"] 613 ) 614 ], [if test "$USE_MATH" = "gmp"; then 615 AC_MSG_ERROR([gmp.h is required for --with-math=gmp, you may adjust GMP_CFLAGS]) 616 fi 617 LIBS="$curr_libs"; CPPFLAGS="$curr_cppflags" 618 ]) 619]) 620 621AS_IF([test "$USE_MATH" = "mpir" -o "$USE_MATH" = "check"], [ 622 # note: currently MPIR does not ship a .pc file, but is expected to follow GMP 623 curr_libs="$LIBS"; curr_cppflags="$CPPFLAGS" 624 PKG_CHECK_MODULES([MPIR], [mpir], [], [# 625 ]) 626 if test -n "$MPIR_CFLAGS"; then 627 CPPFLAGS="$CPPFLAGS $MPIR_CFLAGS" 628 fi 629 if test -z "${MPIR_LIBS+x}"; then 630 MPIR_LIBS="-lmpir" 631 fi 632 LIBS="$LIBS $MPIR_LIBS" 633 AC_CHECK_HEADERS([mpir.h], [ 634 AC_MSG_CHECKING([if linking against libmpir with "$MPIR_LIBS" works]) 635 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <mpir.h>]], 636 [[mpz_t integ; mpz_init (integ);]])], 637 [AC_MSG_RESULT([yes]) 638 curr_cppflags=$CPPFLAGS # for the include in cobc generated modules 639 LIBCOB_LIBS="$LIBCOB_LIBS $MPIR_LIBS" 640 USE_MATH=mpir], 641 [AC_MSG_RESULT([no]) 642 if test "$USE_MATH" = "mpir"; then 643 AC_MSG_ERROR([[MPIR is required for --with-math=mpir, you may adjust MPIR_LIBS]]) 644 fi 645 LIBS="$curr_libs"; CPPFLAGS="$curr_cppflags"] 646 ) 647 ], [if test "$USE_MATH" = "mpir"; then 648 AC_MSG_ERROR([mpir.h is required for --with-math=mpir, you may adjust MPIR_CFLAGS]) 649 fi 650 LIBS="$curr_libs"; CPPFLAGS="$curr_cppflags" 651 ]) 652]) 653 654if test "$USE_MATH" = "check"; then 655 AC_MSG_ERROR([neither GMP nor MPIR library are found, but one of those is mandatory]) 656fi 657 658AC_MSG_CHECKING([matching GMP version]) 659# Check just major/minor levels between header and library 660# get GMP version from lib 661AC_RUN_IFELSE([AC_LANG_SOURCE([[ 662 #include <stdio.h> 663 #ifdef _WIN32 664 #ifndef __GMP_LIBGMP_DLL 665 #define __GMP_LIBGMP_DLL 1 666 #endif 667 #endif 668 #if defined HAVE_GMP_H 669 #include <gmp.h> 670 #elif defined HAVE_MPIR_H 671 #include <mpir.h> 672 #endif 673 int main (int argc, char **argv) 674 { 675 (void)argv; 676 if (argc > 1) 677 printf ("%s", gmp_version); 678 return 0; 679 } 680 ]])], 681 [COB_GMP_LIB=$(./conftest$ac_exeext x)], 682 [AC_MSG_ERROR([Unable to extract GMP version information from gmp_version])], 683 [AC_MSG_WARN([matching GMP version assumed])] 684 COB_GMP_LIB="cross") 685if test "x$COB_GMP_LIB" = "x"; then 686 AC_MSG_ERROR([Unable to extract GMP version information (library)]) 687fi 688 689# get GMP version from header 690AC_RUN_IFELSE([AC_LANG_SOURCE([[ 691 #include <stdio.h> 692 #if defined HAVE_GMP_H 693 #include <gmp.h> 694 #elif defined HAVE_MPIR_H 695 #include <mpir.h> 696 #endif 697 int main (int argc, char **argv) 698 { 699 (void)argv; 700 if (argc > 1) 701 printf ("%d.%d", __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR); 702 return 0; 703 } 704 ]])], 705 [COB_GMP_HEADER=$(./conftest$ac_exeext x)], 706 [AC_MSG_ERROR([Unable to extract GMP version information from header])], 707 [AC_MSG_WARN([cannot run test program while cross-compiling]) 708 COB_GMP_HEADER="cross-compilation - assumed"]) 709if test "x$COB_GMP_HEADER" = "x"; then 710 AC_MSG_ERROR([Unable to extract GMP version information (header)]) 711fi 712 713COB_GMP_LIB_MAJOR=$(echo "$COB_GMP_LIB" | cut -d. -f1) 714COB_GMP_LIB_MINOR=$(echo "$COB_GMP_LIB" | cut -d. -f2) 715 716if test "$COB_GMP_HEADER" = "$COB_GMP_LIB_MAJOR.$COB_GMP_LIB_MINOR" -o "$COB_GMP_LIB" = "cross"; then 717 AC_MSG_RESULT([yes ($COB_GMP_HEADER)]) 718else 719 AC_MSG_RESULT([no (header: $COB_GMP_HEADER / library: $COB_GMP_LIB)]) 720 AC_MSG_ERROR([Unable to use GMP - Please check config.log]) 721fi 722 723LIBS="$curr_libs" 724CPPFLAGS="$curr_cppflags" 725 726AC_CHECK_LIB([$USE_MATH], [__gmp_get_memory_functions], 727 [AC_DEFINE([HAVE_MP_GET_MEMORY_FUNCTIONS], [1])], [], []) 728 729 730# Configure options part II (needing compilation) 731AC_ARG_WITH([xml2], 732 [AS_HELP_STRING([--with-xml2], 733 [(GnuCOBOL) Use libxml2 as XML handler (default)])], 734 [], 735 [with_xml2=check]) 736 737AS_IF([test "$with_xml2" = "yes" -o "$with_xml2" = "check"], [ 738 PKG_CHECK_MODULES([XML2], [libxml-2.0], [], [ 739 if test -z "${XML2_CFLAGS+x}" -o -z "${XML2_LIBS+x}"; then 740 AC_CHECK_PROG(xml2_config_found, xml2-config, "yes") 741 if test "$xml2_config_found" = "yes"; then 742 if test -z "${XML2_CFLAGS+x}"; then 743 XML2_CFLAGS="$(xml2-config --cflags)" 744 fi 745 if test -z "${XML2_LIBS+x}"; then 746 XML2_LIBS="$(xml2-config --libs)" 747 fi 748 fi 749 fi]) 750 curr_libs="$LIBS"; curr_cppflags="$CPPFLAGS" 751 if test -n "$XML2_CFLAGS"; then 752 CPPFLAGS="$CPPFLAGS $XML2_CFLAGS" 753 fi 754 if test -z "${XML2_LIBS+x}"; then 755 XML2_LIBS="-lxml2" 756 fi 757 LIBS="$LIBS $XML2_LIBS" 758 for header in xmlversion uri xmlwriter 759 do 760 AC_CHECK_HEADER([libxml/$header.h], [], 761 [if test "$with_xml2" = "yes"; then 762 AC_MSG_ERROR([Headers for libxml2 are required for --with-xml2, you may adjust XML2_CFLAGS]) 763 else 764 with_xml2=not_found 765 break 766 fi] 767 ) 768 done 769 if test "$with_xml2" != "not_found"; then 770 AX_CHECK_DEFINE([libxml/xmlwriter.h], [LIBXML_WRITER_ENABLED], [], 771 [if test "$with_xml2" = "yes"; then 772 AC_MSG_ERROR([libxml2 is required to be configured with xmlWriter]) 773 else 774 AC_MSG_WARN([libxml2 is required to be configured with xmlWriter]) 775 with_xml2=not_found 776 fi] 777 ) 778 fi 779 if test "$with_xml2" != "not_found"; then 780 AC_MSG_CHECKING([if linking against libxml2 with "$XML2_LIBS" works]) 781 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <libxml/xmlwriter.h>]], 782 [[xmlNewTextWriterFilename (NULL, 0);]])], 783 [AC_DEFINE([WITH_XML2], [1]) AC_MSG_RESULT([yes]) 784 with_xml2=yes 785 LIBCOB_CPPFLAGS="$LIBCOB_CPPFLAGS $XML2_CFLAGS" 786 LIBCOB_LIBS="$LIBCOB_LIBS $XML2_LIBS"], 787 [AC_MSG_RESULT([no]) 788 if test "$with_xml2" = "yes"; then 789 AC_MSG_ERROR([[xml library is required for --with-xml2, you may adjust XML2_LIBS]]) 790 else 791 AC_MSG_WARN([xml library not found, you may adjust XML2_LIBS]) 792 with_xml2=not_found 793 fi]) 794 else 795 AC_MSG_WARN([Headers for libxml2 missing, you may adjust XML2_CFLAGS]) 796 with_xml2=not_found 797 fi 798 LIBS="$curr_libs"; CPPFLAGS="$curr_cppflags" 799]) 800 801 802 803# Checks for cjson/json-c. 804AC_MSG_NOTICE([Checks for JSON handler]) 805 806AC_ARG_WITH([json], 807 [AS_HELP_STRING([[--with-json[=ARG]]], 808 [(GnuCOBOL) Use json library/source as JSON handler, where ARG may be: 809 check (default), cjson, local, json-c, no])], 810 [case "$with_json" in 811 cjson | local | "json-c" | check | no ) 812 USE_JSON="$with_json" 813 ;; 814 yes) 815 USE_JSON="check" 816 ;; 817 *) 818 AC_MSG_ERROR([invalid value "$with_json" for --with-json, 819 must be one of the following: 820 cjson, json-c (use only the specified library) 821 local (use cjson source included in libcob) 822 check (use whatever json library is usable, disable if no one usable) 823 no (disable json usage)]) 824 ;; 825 esac], 826 [USE_JSON="check"]) 827 828curr_libs="$LIBS" 829AS_IF([test "$USE_JSON" = "cjson" -o "$USE_JSON" = "local" -o "$USE_JSON" = "check"], [ 830 AC_MSG_NOTICE([Checks for local cJSON ...]) 831 curr_libs="$LIBS"; curr_cppflags="$CPPFLAGS" 832 with_cjson_local=no 833 AC_CHECK_FILE([./libcob/cJSON.c], 834 [AC_MSG_CHECKING([if linking of ./libcob/cJSON.c works]) 835 CPPFLAGS="$curr_cppflags -I./libcob" 836 LIBS="$LIBS $COMMON_LIBS" 837 AC_LINK_IFELSE([ 838 AC_LANG_PROGRAM([[#include "cJSON.c"]], 839 [[#if (CJSON_VERSION_MAJOR * 100 + CJSON_VERSION_MINOR) < 103 840 #error Needs at least cJSON 1.3.0 841 #endif 842 cJSON_CreateNull ();]])], 843 [AC_MSG_RESULT([yes]) 844 AC_DEFINE([WITH_CJSON], [1]) 845 with_cjson_local="yes (in ./libcob)"], 846 [AC_MSG_RESULT([no])] 847 ) 848 LIBS="$curr_libs"] 849 ) 850 if test "$with_cjson_local" = "no"; then 851 AC_CHECK_FILE([$srcdir/libcob/cJSON.c], 852 [AC_MSG_CHECKING([if linking of $srcdir/libcob/cJSON.c works]) 853 CPPFLAGS="$curr_cppflags -I$srcdir/libcob" 854 LIBS="$LIBS $COMMON_LIBS" 855 AC_LINK_IFELSE([ 856 AC_LANG_PROGRAM([[#include "cJSON.c"]], 857 [[#if (CJSON_VERSION_MAJOR * 100 + CJSON_VERSION_MINOR) < 103 858 #error Needs at least cJSON 1.3.0 859 #endif 860 cJSON_CreateNull ();]])], 861 [AC_MSG_RESULT([yes]) 862 AC_DEFINE([WITH_CJSON], [1]) 863 with_cjson_local="yes (in $srcdir/libcob)"], 864 [AC_MSG_RESULT([no])] 865 ) 866 LIBS="$curr_libs"] 867 ) 868 fi 869 CPPFLAGS="$curr_cppflags" 870 AS_IF([test "$with_cjson_local" = "no"], [ 871 AC_MSG_NOTICE([using local cJSON: no]) 872 if test "$with_json" = "local"; then 873 AC_MSG_ERROR([[cJSON source is required in directory "libcob" for --with-json=local]]) 874 fi 875 PKG_CHECK_MODULES([CJSON], [libcjson], [], [# 876 ]) 877 if test -n "$CJSON_CFLAGS"; then 878 CPPFLAGS="$CPPFLAGS $CJSON_CFLAGS" 879 fi 880 if test -z "${CJSON_LIBS+x}"; then 881 CJSON_LIBS="-lcjson" 882 fi 883 LIBS="$LIBS $CJSON_LIBS" 884 AC_CHECK_HEADERS([cJSON.h], [], 885 [AC_CHECK_HEADERS([cjson/cJSON.h], [], 886 [if test "$with_json" = "cjson"; then 887 AC_MSG_ERROR([Headers for libcjson are required for --with-json, you may adjust CJSON_CFLAGS]) 888 else 889 AC_MSG_WARN([Headers for libcjson missing, you may adjust CJSON_CFLAGS or put cJSON sources in "libcob"]) 890 fi] 891 )]) 892 if test "x$ac_cv_header_cJSON_h" = "xyes" -o "x$ac_cv_header_cjson_cJSON_h" = "xyes"; then 893 AC_MSG_CHECKING([if linking against libcjson with "$CJSON_LIBS" works]) 894 AC_LINK_IFELSE([AC_LANG_PROGRAM([ 895 [#if defined HAVE_CJSON_CJSON_H 896 #include <cjson/cJSON.h> 897 #elif defined HAVE_CJSON_H 898 #include <cJSON.h> 899 #endif 900 #if (CJSON_VERSION_MAJOR * 100 + CJSON_VERSION_MINOR) < 103 901 #error Needs at least cJSON 1.3.0 902 #endif]], 903 [[cJSON_CreateNull ();]])], 904 [AC_MSG_RESULT([yes]) 905 AC_DEFINE([WITH_CJSON], [1]) 906 USE_JSON=cjson 907 LIBCOB_CPPFLAGS="$LIBCOB_CPPFLAGS $CJSON_CFLAGS" 908 LIBCOB_LIBS="$LIBCOB_LIBS $CJSON_LIBS"], 909 [AC_MSG_RESULT([no]) 910 if test "$with_json" = "cjson"; then 911 AC_MSG_ERROR([[cJSON library is required for --with-json=cjson, you may adjust CJSON_LIBS]]) 912 else 913 AC_MSG_WARN([cJSON library not found, you may adjust CJSON_LIBS]) 914 fi]) 915 fi 916 ], [ 917 AC_MSG_NOTICE([using local cJSON: $with_cjson_local]) 918 USE_JSON="local" 919 AC_DEFINE([HAVE_CJSON_H], [1]) 920 ]) 921 LIBS="$curr_libs"; CPPFLAGS="$curr_cppflags" 922]) 923 924AS_IF([test "$USE_JSON" = "json-c" -o "$USE_JSON" = "check"], [ 925 CPPFLAGS="$curr_cppflags" 926 PKG_CHECK_MODULES([JSON_C], [json-c], [], [# 927 ]) 928 # possibly set JSON_C_CFLAGS with $includedir/json-c; 929 # (has to consider user-setprefix --includir, ... -> left out for now) 930 if test -n "$JSON_C_CFLAGS"; then 931 CPPFLAGS="$CPPFLAGS $JSON_C_CFLAGS" 932 fi 933 if test -z "${JSON_C_LIBS+x}"; then 934 JSON_C_LIBS="-ljson-c" 935 fi 936 LIBS="$LIBS $JSON_C_LIBS" 937 AC_CHECK_HEADER([json.h], [ 938 AC_MSG_CHECKING([if linking against libjson-c with "$JSON_C_LIBS" works]) 939 AC_LINK_IFELSE([AC_LANG_PROGRAM([ 940 [#include <json.h>]], 941 [[#if (JSON_C_MAJOR_VERSION * 100 + JSON_C_MINOR_VERSION) < 12 942 #error Needs at least json-c 0.12 943 #endif 944 json_c_version ();]])], 945 [AC_MSG_RESULT([yes]) 946 AC_DEFINE([WITH_JSON_C], [1]) 947 USE_JSON=json-c 948 LIBCOB_CPPFLAGS="$LIBCOB_CPPFLAGS $JSON_C_CFLAGS" 949 LIBCOB_LIBS="$LIBCOB_LIBS $JSON_C_LIBS"], 950 [AC_MSG_RESULT([no]) 951 if test "$USE_JSON" = "json-c"; then 952 AC_MSG_ERROR([[JSON-C library is required for --with-json-c, you may adjust JSON_C_LIBS]]) 953 else 954 AC_MSG_WARN([JSON-C not found, you may adjust JSON_C_LIBS]) 955 fi]) 956 ], 957 [if test "$USE_JSON" = "json-c"; then 958 AC_MSG_ERROR([Headers for libjson-c are required for --with-json-c, you may adjust JSON_C_CFLAGS]) 959 else 960 AC_MSG_WARN([Headers for libjson-c missing, you may adjust JSON_C_CFLAGS"]) 961 fi]) 962 LIBS="$curr_libs"; CPPFLAGS="$curr_cppflags" 963]) 964 965case "$USE_JSON" in 966 check) 967 if test "$with_json" = yes; then 968 AC_MSG_ERROR([[No applicable handler for JSON found]]) 969 fi 970 USE_JSON="not_found" 971 AC_DEFINE([WITH_JSON], ["not found"]) 972 ;; 973 no) 974 AC_DEFINE([WITH_JSON], ["disabled"]) 975 ;; 976 cjson | local) 977 AC_DEFINE([WITH_JSON], ["cjson"]) 978 ;; 979 "json-c") 980 AC_DEFINE([WITH_JSON], ["json-c"]) 981 ;; 982esac 983 984 985AC_ARG_WITH([dl], 986 [AS_HELP_STRING([--with-dl], 987 [(GnuCOBOL) Use system dynamic loader (default)])], 988 [case $with_dl in 989 yes) 990 ;; 991 no) 992 ;; 993 *) AC_MSG_ERROR([[--with/without-dl can not have a value]]) 994 ;; 995 esac], 996 [with_dl=yes]) 997 998AC_ARG_WITH([varseq], 999 [AS_HELP_STRING([--with-varseq], 1000 [(GnuCOBOL) Define variable sequential format (default 0)])], 1001 [case $with_varseq in 1002 yes) AC_MSG_ERROR([[You must give --with-varseq an argument.]]) 1003 ;; 1004 no) AC_MSG_ERROR([[--without-varseq not supported.]]) 1005 ;; 1006 [[0-3]]) 1007 ;; 1008 *) AC_MSG_ERROR([[Invalid --with-varseq argument]]) 1009 ;; 1010 esac], 1011 [with_varseq=0]) 1012 1013AC_DEFINE_UNQUOTED([WITH_VARSEQ], [$with_varseq]) 1014 1015 1016# Solaris has nanosleep in other libraries 1017AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], 1018 [[nanosleep (NULL, NULL);]])], 1019 [AC_DEFINE([HAVE_NANO_SLEEP], [1])], 1020 [AC_CHECK_LIB([rt], [nanosleep], [], [], []) 1021 if test "x$ac_cv_lib_rt_nanosleep" = "xyes"; then 1022 AC_DEFINE([HAVE_NANO_SLEEP], [1]) 1023 LIBCOB_LIBS="$LIBCOB_LIBS -lrt" 1024 else 1025 AC_CHECK_LIB([posix4], [nanosleep], [], [], []) 1026 if test "x$ac_cv_lib_posix4_nanosleep" = "xyes"; then 1027 AC_DEFINE([HAVE_NANO_SLEEP], [1]) 1028 LIBCOB_LIBS="$LIBCOB_LIBS -lposix4" 1029 fi 1030 fi]) 1031 1032AC_MSG_CHECKING([for clock_gettime and CLOCK_REALTIME]) 1033AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], 1034 [[clock_gettime (CLOCK_REALTIME, NULL);]])], 1035 [AC_DEFINE([HAVE_CLOCK_GETTIME], [1]) AC_MSG_RESULT([yes])], 1036 [AC_MSG_RESULT([no])]) 1037 1038AC_MSG_CHECKING([for isfinite]) 1039AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]], 1040 [[isfinite ( 1.0 );]])], 1041 [AC_DEFINE([HAVE_ISFINITE], [1]) AC_MSG_RESULT([yes])], 1042 [AC_MSG_RESULT([no])] 1043 # Check prototype for finite in math.h (alternative ieeefp.h) 1044 AC_MSG_CHECKING([prototype for finite in <math.h>]) 1045 AC_EGREP_HEADER(finite, math.h, AC_MSG_RESULT([yes]), 1046 [AC_MSG_RESULT([no]) 1047 AC_MSG_CHECKING([prototype for finite in <ieeefp.h>]) 1048 AC_EGREP_HEADER(finite, ieeefp.h, 1049 [AC_DEFINE([HAVE_FINITE_IEEEFP_H], [1]) AC_MSG_RESULT([yes])], 1050 AC_MSG_ERROR([ 1051 Declaration for finite function neither in math.h nor in ieeefp.h])) 1052 ]) 1053) 1054 1055# Check for raise (optional) --> done via AC_CHECK_FUNCS 1056#AC_MSG_CHECKING([for raise]) 1057#AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>]], 1058# [[raise (SIGINT);]])], 1059# [AC_DEFINE([HAVE_RAISE], [1]) AC_MSG_RESULT([yes])], 1060# [AC_MSG_RESULT([no])], 1061# []) 1062 1063AC_CHECK_FUNCS([fdatasync sigaction fmemopen]) 1064AC_CHECK_DECLS([fdatasync]) # also check for declaration, missing on MacOS... 1065AC_CHECK_DECLS([fmemopen]) # also check for declaration, missing on AIX... 1066 1067# Checks for gettext. 1068 1069case $host_os in 1070 darwin* | rhapsody*) 1071 ;; 1072 *) 1073 gt_cv_func_CFPreferencesCopyAppValue=no 1074 gt_cv_func_CFLocaleCopyCurrent=no 1075 ;; 1076esac 1077 1078# Checks for ncurses/pdcurses/curses. 1079AC_MSG_NOTICE([Checks for curses ...]) 1080 1081AC_ARG_WITH([curses], 1082 [AS_HELP_STRING([[--with-curses[=ARG]]], 1083 [(GnuCOBOL) Use curses library for extended SCREEN I/O, where ARG may be: 1084 check (default), ncursesw, ncurses, pdcurses, curses, no])], 1085 [case "$with_curses" in 1086 ncursesw | ncurses | pdcurses | curses | check | no) 1087 USE_CURSES="$with_curses" 1088 ;; 1089 yes) 1090 USE_CURSES="check" 1091 ;; 1092 *) 1093 AC_MSG_ERROR([invalid value "$with_curses" for --with-curses, 1094 must be one of the following: 1095 ncursesw, ncurses, pdcurses, curses (use only the specified library) 1096 check (use whatever curses library is usable, disable if no one usable) 1097 no (disable curses usage)]) 1098 ;; 1099 esac], 1100 [USE_CURSES="check"]) 1101 1102curr_libs="$LIBS" 1103if test "$USE_CURSES" = "ncursesw" -o "$USE_CURSES" = "check"; then 1104 AC_CHECK_LIB([ncursesw], [initscr], [], [], []) 1105 if test "x$ac_cv_lib_ncursesw_initscr" = "xyes"; then 1106 AC_CHECK_HEADERS([ncursesw/ncurses.h], [USE_CURSES="ncursesw"], 1107 [AC_CHECK_HEADERS([ncursesw/curses.h], [USE_CURSES="ncursesw"], 1108 [if test "$USE_CURSES" = "ncursesw"; then 1109 USE_CURSES="missing_header" 1110 fi], [])], []) 1111 if test "$USE_CURSES" = "ncursesw"; then 1112 LIBCOB_LIBS="$LIBCOB_LIBS -lncursesw" 1113 fi 1114 else 1115 if test "$USE_CURSES" = "ncursesw"; then 1116 USE_CURSES="missing_lib" 1117 fi 1118 fi 1119fi 1120 1121if test "$USE_CURSES" = "ncurses" -o "$USE_CURSES" = "check"; then 1122 AC_CHECK_LIB([ncurses], [initscr], [], [], []) 1123 if test "x$ac_cv_lib_ncurses_initscr" = "xyes"; then 1124 AC_CHECK_HEADERS([ncurses.h], [USE_CURSES="ncurses"], 1125 [AC_CHECK_HEADERS([ncurses/ncurses.h], [USE_CURSES="ncurses"], 1126 [AC_CHECK_HEADERS([curses.h], [USE_CURSES="ncurses"], 1127 [if test "$USE_CURSES" = "ncurses"; then 1128 USE_CURSES="missing_header" 1129 fi], [])], [])], []) 1130 if test "$USE_CURSES" = "ncurses"; then 1131 LIBCOB_LIBS="$LIBCOB_LIBS -lncurses" 1132 fi 1133 else 1134 if test "$USE_CURSES" = "ncurses"; then 1135 USE_CURSES="missing_lib" 1136 fi 1137 fi 1138fi 1139 1140 1141if test "$USE_CURSES" = "pdcurses" -o "$USE_CURSES" = "check"; then 1142 AC_CHECK_LIB([pdcurses], [initscr], [], [], []) 1143 if test "x$ac_cv_lib_pdcurses_initscr" = "xyes"; then 1144 AC_CHECK_HEADERS([pdcurses.h], [USE_CURSES="pdcurses"], 1145 [AC_CHECK_HEADERS([curses.h], [USE_CURSES="pdcurses"], 1146 [if test "$USE_CURSES" = "pdcurses"; then 1147 USE_CURSES="missing_header" 1148 fi], [])], []) 1149 if test "$USE_CURSES" = "pdcurses"; then 1150 LIBCOB_LIBS="$LIBCOB_LIBS -lpdcurses" 1151 fi 1152 else 1153 if test "$USE_CURSES" = "pdcurses"; then 1154 USE_CURSES="missing_lib" 1155 fi 1156 fi 1157fi 1158 1159if test "$USE_CURSES" = "curses" -o "$USE_CURSES" = "check"; then 1160 AC_CHECK_LIB([curses], [initscr], [], [], []) 1161 if test "x$ac_cv_lib_curses_initscr" = "xyes"; then 1162 AC_CHECK_HEADERS([curses.h], [USE_CURSES="curses"], 1163 [if test "$USE_CURSES" = "curses"; then 1164 USE_CURSES="missing_header" 1165 fi], []) 1166 if test "$USE_CURSES" != "no"; then 1167 LIBCOB_LIBS="$LIBCOB_LIBS -lcurses" 1168 fi 1169 fi 1170else 1171 if test "$USE_CURSES" = "curses"; then 1172 USE_CURSES="missing_lib" 1173 fi 1174fi 1175 1176case "$USE_CURSES" in 1177 check) 1178 USE_CURSES="not_found" 1179 AC_DEFINE([WITH_CURSES], ["not found"]) 1180 ;; 1181 no) 1182 AC_DEFINE([WITH_CURSES], ["disabled"]) 1183 ;; 1184 missing_lib) 1185 AC_MSG_ERROR([[Not able to link configured library $with_curses]]) 1186 ;; 1187 missing_header) 1188 AC_MSG_ERROR([[No header found for configured library $with_curses]]) 1189 ;; 1190 ncursesw) 1191 AC_DEFINE([WITH_CURSES], ["ncursesw"]) 1192 ;; 1193 ncurses) 1194 AC_DEFINE([WITH_CURSES], ["ncurses"]) 1195 ;; 1196 pdcurses) 1197 AC_DEFINE([WITH_CURSES], ["pdcurses"]) 1198 ;; 1199 curses) 1200 AC_DEFINE([WITH_CURSES], ["curses"]) 1201 ;; 1202esac 1203 1204 1205if test "$USE_CURSES" = "ncurses" -o "$USE_CURSES" = "ncursesw"; then 1206 AC_MSG_CHECKING([for ncurses _nc_freeall function]) 1207 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 1208 extern void _nc_freeall (void);]], 1209 [[_nc_freeall ();]])], 1210 [AC_DEFINE([HAVE_CURSES_FREEALL], [1]) AC_MSG_RESULT([yes])], 1211 [AC_MSG_RESULT([no])], 1212 []) 1213 AC_MSG_CHECKING([for ncurses use_legacy_coding function]) 1214 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 1215 extern void use_legacy_coding (void);]], 1216 [[use_legacy_coding ();]])], 1217 [AC_DEFINE([HAVE_USE_LEGACY_CODING], [1]) AC_MSG_RESULT([yes])], 1218 [AC_MSG_RESULT([no])], 1219 []) 1220fi 1221 1222if test "$USE_CURSES" != "no" -a "$USE_CURSES" != "not_found"; then 1223 AC_MSG_CHECKING([for curses color_set function]) 1224 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 1225 #ifdef HAVE_NCURSESW_NCURSES_H 1226 #include <ncursesw/ncurses.h> 1227 #elif defined (HAVE_NCURSESW_CURSES_H) 1228 #include <ncursesw/curses.h> 1229 #elif defined (HAVE_NCURSES_H) 1230 #include <ncurses.h> 1231 #elif defined (HAVE_NCURSES_NCURSES_H) 1232 #include <ncurses/ncurses.h> 1233 #elif defined (HAVE_PDCURSES_H) 1234 #include <pdcurses.h> 1235 #elif defined (HAVE_CURSES_H) 1236 #include <curses.h> 1237 #endif]], [[ 1238 color_set (0, NULL); 1239 ]])], 1240 [AC_DEFINE([HAVE_COLOR_SET], [1]) AC_MSG_RESULT([yes])], 1241 [AC_MSG_RESULT([no])], 1242 []) 1243 1244 AC_MSG_CHECKING([for curses define_key function]) 1245 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 1246 #ifdef HAVE_NCURSESW_NCURSES_H 1247 #include <ncursesw/ncurses.h> 1248 #elif defined (HAVE_NCURSESW_CURSES_H) 1249 #include <ncursesw/curses.h> 1250 #elif defined (HAVE_NCURSES_H) 1251 #include <ncurses.h> 1252 #elif defined (HAVE_NCURSES_NCURSES_H) 1253 #include <ncurses/ncurses.h> 1254 #elif defined (HAVE_PDCURSES_H) 1255 #include <pdcurses.h> 1256 #elif defined (HAVE_CURSES_H) 1257 #include <curses.h> 1258 #endif]], [[ 1259 define_key ("\E-3;3~", (KEY_MAX + 1)); 1260 ]])], 1261 [AC_DEFINE([HAVE_DEFINE_KEY], [1]) AC_MSG_RESULT([yes])], 1262 [AC_MSG_RESULT([no])], 1263 []) 1264 1265 AC_MSG_CHECKING([for curses mouseinterval function]) 1266 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 1267 #ifdef HAVE_NCURSESW_NCURSES_H 1268 #include <ncursesw/ncurses.h> 1269 #elif defined (HAVE_NCURSESW_CURSES_H) 1270 #include <ncursesw/curses.h> 1271 #elif defined (HAVE_NCURSES_H) 1272 #include <ncurses.h> 1273 #elif defined (HAVE_NCURSES_NCURSES_H) 1274 #include <ncurses/ncurses.h> 1275 #elif defined (HAVE_PDCURSES_H) 1276 #include <pdcurses.h> 1277 #elif defined (HAVE_CURSES_H) 1278 #include <curses.h> 1279 #endif]], [[ 1280 mouseinterval (-1); 1281 ]])], 1282 [AC_DEFINE([HAVE_MOUSEINTERVAL], [1]) AC_MSG_RESULT([yes])], 1283 [AC_MSG_RESULT([no])], 1284 []) 1285 1286 AC_MSG_CHECKING([for curses has_mouse function]) 1287 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 1288 #ifdef HAVE_NCURSESW_NCURSES_H 1289 #include <ncursesw/ncurses.h> 1290 #elif defined (HAVE_NCURSESW_CURSES_H) 1291 #include <ncursesw/curses.h> 1292 #elif defined (HAVE_NCURSES_H) 1293 #include <ncurses.h> 1294 #elif defined (HAVE_NCURSES_NCURSES_H) 1295 #include <ncurses/ncurses.h> 1296 #elif defined (HAVE_PDCURSES_H) 1297 #include <pdcurses.h> 1298 #elif defined (HAVE_CURSES_H) 1299 #include <curses.h> 1300 #endif]], [[ 1301 has_mouse (); 1302 ]])], 1303 [AC_DEFINE([HAVE_HAS_MOUSE], [1]) AC_MSG_RESULT([yes])], 1304 [AC_MSG_RESULT([no])], 1305 []) 1306fi 1307LIBS="$curr_libs" # removing curses 1308 1309AC_ARG_WITH([seqra-extfh], 1310 [AS_HELP_STRING([--with-seqra-extfh], 1311 [(GnuCOBOL) Use external SEQ/RAN handler (obsolete)])], 1312 [ if test "$with_seqra_extfh" = "yes"; then 1313 AC_DEFINE([WITH_SEQRA_EXTFH], [1]) 1314 fi ], 1315 []) 1316 1317AC_ARG_WITH([cisam], 1318 [AS_HELP_STRING([--with-cisam], 1319 [(GnuCOBOL) Use CISAM for INDEXED I/O])], 1320 [ if test "$with_cisam" = "yes"; then 1321 AC_CHECK_HEADERS([isam.h], [], 1322 AC_MSG_ERROR([isam.h is required for CISAM])) 1323 AC_CHECK_LIB([ifisam], [isopen], 1324 [AC_DEFINE([WITH_CISAM], [1]) 1325 LIBCOB_LIBS="$LIBCOB_LIBS -lifisam -lifisamx"], 1326 AC_MSG_ERROR([libifisam is required for CISAM]), [-lifisamx]) 1327 fi ], 1328 []) 1329 1330AS_IF([test "$with_cisam" != "yes"], [ 1331 AC_ARG_WITH([disam], 1332 [AS_HELP_STRING([--with-disam], 1333 [(GnuCOBOL) Use DISAM for INDEXED I/O])], 1334 [ if test "$with_disam" = "yes"; then 1335 AC_CHECK_HEADERS([disam.h], [], 1336 AC_MSG_ERROR([disam.h is required for DISAM])) 1337 1338 for cobdisam in disam disam8 disam72 disam71 disam7 1339 do 1340 AC_CHECK_LIB([$cobdisam], [isopen], 1341 [AC_DEFINE([WITH_DISAM], [1]) 1342 LIBCOB_LIBS="$LIBCOB_LIBS -l$cobdisam"] 1343 cob_got_disam=yes 1344 break, 1345 [], []) 1346 done 1347 if test "$cob_got_disam" = "yes"; then 1348 AC_MSG_NOTICE([DISAM library found as -l$cobdisam]) 1349 else 1350 AC_MSG_ERROR([DISAM library not found]) 1351 fi 1352 unset cobdisam 1353 unset cob_got_disam 1354 fi ], 1355 []) 1356]) 1357 1358AS_IF([test "$with_cisam" != "yes" -a "$with_disam" != "yes"], [ 1359 AC_ARG_WITH([vbisam], 1360 [AS_HELP_STRING([--with-vbisam], 1361 [(GnuCOBOL) Use VBISAM for ISAM I/O])], 1362 [ if test "$with_vbisam" = "yes"; then 1363 AC_CHECK_HEADERS([vbisam.h], [], 1364 AC_MSG_ERROR([vbisam.h is required for VBISAM])) 1365 # note: isfullclose is available since 2.0, isopen since 1.0 1366 AC_CHECK_LIB([vbisam], [isfullclose], 1367 [AC_DEFINE([WITH_VBISAM], [1]) 1368 LIBCOB_LIBS="$LIBCOB_LIBS -lvbisam"], 1369 AC_MSG_ERROR([libvbisam >= 2.0 is required for VBISAM]), []) 1370 fi ], 1371 []) 1372]) 1373 1374AS_IF([test "$with_cisam" != "yes" -a "$with_disam" != "yes" -a "$with_vbisam" != "yes"], [ 1375 AC_ARG_WITH([index-extfh], 1376 [AS_HELP_STRING([--with-index-extfh], 1377 [(GnuCOBOL) Use external ISAM file handler (obsolete)])], 1378 [ if test "$with_index_extfh" = "yes"; then 1379 AC_DEFINE([WITH_INDEX_EXTFH], [1]) 1380 fi ], 1381 []) 1382]) 1383 1384AS_IF([test "$with_cisam" != "yes" -a "$with_disam" != "yes" -a "$with_vbisam" != "yes" -a "$with_index_extfh" != "yes"], [ 1385 AC_ARG_WITH([db], 1386 [AS_HELP_STRING([--with-db], 1387 [(GnuCOBOL) Use Berkeley DB >= 4.1 for ISAM I/O (default)])], 1388 [], 1389 [with_db=yes]) 1390]) 1391 1392# Checks for db. 1393if test "$with_db" = "yes"; then 1394 AC_MSG_NOTICE([Checks for Berkeley DB ...]) 1395 1396 AC_CHECK_HEADERS([db.h], [], AC_MSG_ERROR([Berkeley DB db.h is missing]), []) 1397 1398 # BDB header exists. Extract major/minor number pair 1399 COB_BDB_HEADER='' 1400 COB_BDB_HEADER_STR='' 1401 AC_RUN_IFELSE([AC_LANG_SOURCE([[ 1402 #include <stdio.h> 1403 #include <db.h> 1404 int main (int argc, char **argv) 1405 { 1406 (void)argv; 1407 if (argc == 2) 1408 printf ("%d.%d", DB_VERSION_MAJOR, DB_VERSION_MINOR); 1409 if (argc == 3) 1410 printf ("-%s-", DB_VERSION_STRING); 1411 return 0; 1412 } 1413 ]])], 1414 [COB_BDB_HEADER=$(./conftest$ac_exeext x)] 1415 [COB_BDB_HEADER_STR=$(./conftest$ac_exeext x y)], 1416 [AC_MSG_ERROR([Unable to extract Berkeley DB version information from db.h])], 1417 [AC_MSG_WARN([cannot run test program while cross-compiling]) 1418 COB_BDB_HEADER="cross" 1419 COB_BDB_HEADER_STR="cross"]) 1420 if test "x$COB_BDB_HEADER" = "x"; then 1421 AC_MSG_ERROR([Unable to extract Berkeley DB version information]) 1422 fi 1423 if test "x$COB_BDB_HEADER_STR" != "x"; then 1424 AC_MSG_NOTICE([db.h reports version "$COB_BDB_HEADER_STR"]) 1425 fi 1426 if test "$COB_BDB_HEADER_STR" != "cross"; then 1427 AC_MSG_CHECKING([for Berkeley DB db.h version >= 4.1]) 1428 COB_BDB_HEADER_MAJOR=$(echo "$COB_BDB_HEADER" | cut -d. -f1) 1429 if test $COB_BDB_HEADER_MAJOR -gt 4; then 1430 AC_MSG_RESULT([yes ($COB_BDB_HEADER)]) 1431 else 1432 COB_BDB_HEADER_MINOR=$(echo "$COB_BDB_HEADER" | cut -d. -f2) 1433 if test $COB_BDB_HEADER_MAJOR -eq 4 -a $COB_BDB_HEADER_MINOR -ge 1; then 1434 AC_MSG_RESULT([yes ($COB_BDB_HEADER)]) 1435 else 1436 AC_MSG_RESULT([no ($COB_BDB_HEADER)]) 1437 AC_MSG_ERROR([Berkeley DB db.h has incompatible version]) 1438 fi 1439 fi 1440 test_libs="$LIBS" 1441 cob_got_db=no 1442 AC_MSG_CHECKING([for Berkeley DB library with version $COB_BDB_HEADER]) 1443 # prefer library with version number included as some systems link against wrong version 1444 # of the library and to not break when a newer BDB version is installed, see bug #100 1445 for cobdb in db-$COB_BDB_HEADER db 1446 do 1447 LIBS="$test_libs -l$cobdb" 1448 AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h> 1449 #include <db.h>]], [[ 1450 int major = 0, minor = 0, patch = 0; 1451 db_version (&major, &minor, &patch); 1452 if (major == DB_VERSION_MAJOR && minor == DB_VERSION_MINOR) { 1453 return 0; 1454 } 1455 return 1;]])], 1456 [AC_DEFINE([WITH_DB], [1]) 1457 cob_got_db=yes 1458 LIBCOB_LIBS="$LIBCOB_LIBS -l$cobdb" 1459 break], 1460 [], 1461 []) 1462 done 1463 LIBS="$test_libs" 1464 unset test_libs 1465 if test "$cob_got_db" = "yes"; then 1466 AC_MSG_RESULT([yes]) 1467 AC_MSG_NOTICE([BDB library version $COB_BDB_HEADER found as -l$cobdb]) 1468 else 1469 AC_MSG_RESULT([no]) 1470 AC_MSG_ERROR([BDB library version $COB_BDB_HEADER not found]) 1471 fi 1472 else 1473 AC_MSG_WARN([Matching BDB version (>=4.1) assumed]) 1474 AC_CHECK_LIB([db], [db_version], 1475 [LIBCOB_LIBS="$LIBCOB_LIBS -ldb"], 1476 AC_MSG_ERROR([BDB library is required as -ldb]), []) 1477 fi 1478 unset cobdb 1479 unset cob_got_db 1480 unset COB_BDB_HEADER 1481fi 1482LIBS="$curr_libs" # removing INDEXED libraries 1483 1484# Checks for dl/ltdl. 1485DEFINE_DL="no" 1486 1487AC_MSG_CHECKING([for _WIN32]) 1488AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ 1489 #ifndef _WIN32 1490 # error macro not defined 1491 #endif]])], 1492 [DEFINE_DL="yes" 1493 AC_MSG_RESULT([yes])], 1494 [AC_MSG_RESULT([no])]) 1495 1496if test "$DEFINE_DL" = "no" -a "$with_dl" = "yes"; then 1497 if test "x$ac_cv_header_dlfcn_h" = "xyes"; then 1498 AC_CHECK_LIB([c], [dlopen], [DEFINE_DL="yes"], [], []) 1499 if test "$DEFINE_DL" = "no"; then 1500 AC_CHECK_LIB([dl], [dlopen], [DEFINE_DL="yes"], [], []) 1501 if test "$DEFINE_DL" = "yes"; then 1502 AC_DEFINE([USE_LIBDL], [1]) 1503 LIBCOB_LIBS="$LIBCOB_LIBS -ldl" 1504 AC_CHECK_LIB([dl], [dladdr], [AC_DEFINE([HAVE_DLADDR], [1])], [], []) 1505 else 1506 AC_CHECK_LIB([dld], [dlopen], [DEFINE_DL="yes"], [], []) 1507 if test "$DEFINE_DL" = "yes"; then 1508 AC_DEFINE([USE_LIBDL], [1]) 1509 LIBCOB_LIBS="$LIBCOB_LIBS -ldld" 1510 AC_CHECK_LIB([dld], [dladdr], [AC_DEFINE([HAVE_DLADDR], [1])], [], []) 1511 fi 1512 fi 1513 else 1514 AC_DEFINE([USE_LIBDL], [1]) 1515 AC_CHECK_LIB([c], [dladdr], [AC_DEFINE([HAVE_DLADDR], [1])], [], []) 1516 fi 1517 fi 1518fi 1519 1520if test "$DEFINE_DL" = "no"; then 1521 AC_CHECK_HEADERS([ltdl.h], [], AC_MSG_ERROR([ltdl.h is required]), []) 1522 AC_CHECK_LIB([ltdl], [lt_dlopen], 1523 [LIBCOB_LIBS="$LIBCOB_LIBS -lltdl"], 1524 AC_MSG_ERROR([libltdl is required]), []) 1525fi 1526 1527# Checks for compiling computed gotos 1528AC_MSG_CHECKING([for support of computed gotos]) 1529AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ 1530 int test () 1531 { 1532 void *test_ptr; 1533 test_ptr = &&lab; 1534 1535 goto *test_ptr; 1536 return 1; 1537 1538 lab: 1539 return 0; 1540 }]])], 1541 [AC_DEFINE([COB_COMPUTED_GOTO], [1]) 1542 AC_MSG_RESULT([yes])], 1543 [AC_MSG_RESULT([no])]) 1544 1545# Checks for size of long 1546AC_MSG_CHECKING([if size of long int = size of long long]) 1547AC_RUN_IFELSE([AC_LANG_PROGRAM([[]], [[ 1548 if (sizeof(long int) == sizeof(long long)) 1549 return 0; 1550 return 1; 1551 ]])], 1552 [AC_DEFINE([COB_LI_IS_LL], [1]) AC_MSG_RESULT([yes])], 1553 [AC_MSG_RESULT([no])], 1554 [if test "$COB_LI_IS_LL" = "0"; then 1555 AC_MSG_RESULT([specified "no" on configure line]) 1556 else 1557 if test "$COB_LI_IS_LL" = "1"; then 1558 AC_MSG_RESULT([specified "yes" on configure line]) 1559 else 1560 COB_LI_IS_LL=1 1561 AC_MSG_RESULT([assumed - cross-compilation]) 1562 fi 1563 fi 1564 AC_DEFINE([COB_LI_IS_LL], [$COB_LI_IS_LL]) 1565 AC_MSG_WARN([cannot run test program while cross-compiling])]) 1566 1567AC_MSG_CHECKING([if long is 32 bits]) 1568AC_RUN_IFELSE([AC_LANG_PROGRAM([[]], [[ 1569 if (sizeof (long) == 4) 1570 return 0; 1571 return 1; 1572 ]])], 1573 [AC_DEFINE([COB_32_BIT_LONG], [1]) AC_MSG_RESULT([yes])], 1574 [AC_MSG_RESULT([no])], 1575 [if test "$COB_32_BIT_LONG" = "0"; then 1576 AC_MSG_RESULT([specified "no" on configure line]) 1577 else 1578 if test "$COB_32_BIT_LONG" = "1"; then 1579 AC_MSG_RESULT([specified "yes" on configure line]) 1580 else 1581 COB_32_BIT_LONG=1 1582 AC_MSG_RESULT([assumed - cross-compilation]) 1583 fi 1584 fi 1585 AC_DEFINE([COB_32_BIT_LONG], [$COB_32_BIT_LONG]) 1586 AC_MSG_WARN([cannot run test program while cross-compiling])]) 1587 1588 1589if test "cross_compiling" != "yes"; then 1590 COB_HAS_64_BIT_POINTER="no" 1591fi 1592AC_MSG_CHECKING([if pointer is longer than 32 bits]) 1593AC_RUN_IFELSE([AC_LANG_PROGRAM([[]], [[ 1594 if (sizeof (void *) > 4U) 1595 return 0; 1596 return 1; 1597 ]])], 1598 [COB_HAS_64_BIT_POINTER="yes" 1599 AC_DEFINE([COB_64_BIT_POINTER], [1]) 1600 AC_MSG_RESULT([yes])], 1601 [AC_MSG_RESULT([no])], 1602 [if test "$COB_HAS_64_BIT_POINTER" = "0"; then 1603 COB_HAS_64_BIT_POINTER="no" 1604 AC_DEFINE([COB_64_BIT_POINTER], [0]) 1605 AC_MSG_RESULT([specified "no" on configure line]) 1606 else 1607 if test "$COB_HAS_64_BIT_POINTER" = "1"; then 1608 COB_HAS_64_BIT_POINTER="yes" 1609 AC_DEFINE([COB_64_BIT_POINTER], [1]) 1610 AC_MSG_RESULT([specified "yes" on configure line]) 1611 else 1612 COB_HAS_64_BIT_POINTER="no" 1613 AC_DEFINE([COB_64_BIT_POINTER], [0]) 1614 AC_MSG_RESULT([assumed "no" - cross-compilation]) 1615 fi 1616 fi 1617 AC_MSG_WARN([cannot run test program while cross-compiling])]) 1618 1619# Check gcc wrapv option 1620# We likely don't need this and remove it before 3.0 final release 1621#if test "$COB_USES_GCC_NO_ICC" = "yes"; then 1622# curr_cflags="$CFLAGS" 1623# CFLAGS="$CFLAGS -fwrapv" 1624# AC_MSG_CHECKING([for gcc -fwrapv option]) 1625# AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[int testint;]])], 1626# [AC_DEFINE([HAVE_FWRAPV_OPT], [1]) AC_MSG_RESULT([yes])], 1627# [AC_MSG_RESULT([no])]) 1628# [], 1629# [CFLAGS="$curr_cflags"]) 1630# CFLAGS="$curr_cflags" 1631#fi 1632 1633# Check if aligned attribute seems to work 1634# done: does not raise an error 1635# *TODO*: has same output as omitting it) 1636AC_MSG_CHECKING([for aligned attribute]) 1637AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], 1638 [[char testchar[4] __attribute__((aligned));]])], 1639 [AC_DEFINE([HAVE_ATTRIBUTE_ALIGNED], [1]) AC_MSG_RESULT([yes]) 1640 ], 1641 [AC_MSG_RESULT([no])]) 1642 1643# Simon: removed, use --disable-nls instead 1644## Disable for Cygwin 1645#AC_MSG_CHECKING([for __CYGWIN__]) 1646#AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ 1647# #ifndef __CYGWIN__ 1648# # error macro not defined 1649# #endif]])], 1650# [enable_nls=no 1651# AC_MSG_RESULT([yes])], 1652# [AC_MSG_RESULT([no])]) 1653 1654AM_GNU_GETTEXT([external]) 1655AM_GNU_GETTEXT_VERSION([0.19.8]) 1656if test "x$LTLIBINTL" != "x"; then 1657 if test "x$PROGRAMS_LIBS" != "x"; then 1658 PROGRAMS_LIBS="$PROGRAMS_LIBS $LTLIBINTL" 1659 else 1660 PROGRAMS_LIBS="$LTLIBINTL" 1661 fi 1662 LIBCOB_LIBS="$LIBCOB_LIBS $LTLIBINTL" 1663fi 1664 1665# Checks for internationalization stuff 1666# AM_ICONV 1667AM_LANGINFO_CODESET 1668 1669# GnuCOBOL Configuration 1670 1671COB_CONFIG_DIR="$datadir/$PACKAGE_TARNAME/config" 1672COB_COPY_DIR="$datadir/$PACKAGE_TARNAME/copy" 1673COB_LIBRARY_PATH="$libdir/$PACKAGE_TARNAME" 1674COB_EXE_EXT="$EXEEXT" 1675if test "$COB_EXE_EXT" = ".exe"; then 1676 COB_MODULE_EXT="dll" 1677else 1678 if test "$COB_EXE_EXT" = ".exe" -o "$COB_EXE_EXT" = ".EXE"; then 1679 COB_MODULE_EXT="dll" 1680 else 1681 # normal case... 1682 COB_MODULE_EXT=$(echo "$acl_cv_shlibext" | sed -e 's/dll\.a/dll/') 1683 fi 1684fi 1685COB_OBJECT_EXT="$OBJEXT" 1686LIBS="$curr_libs" 1687COB_EXPORT_DYN="$(eval echo $export_dynamic_flag_spec)" 1688# FIXME: lt_prog_compiler_pic is not always correct, for example with occ 1689COB_PIC_FLAGS=$(echo "$lt_prog_compiler_pic" | sed -e 's/^ //') 1690 1691if test "$enable_cflags_setting" = "yes"; then 1692 if test "$enable_hardening" != "yes"; then 1693 # Remove -O2 option added by AC_PROG_CC and add -O0 1694 if test "$enable_debug" = "yes" -o "$enable_code_coverage" = "yes"; then 1695 CFLAGS=$(echo "$CFLAGS" | sed -e 's/ *-O@<:@0-9a-zA-Z@:>@* */ /g' -e 's/ $//' -e 's/^ //') 1696 if test "$COB_USES_GCC" = "yes"; then 1697 CFLAGS="$CFLAGS -O0" 1698 fi 1699 fi 1700 fi 1701fi 1702 1703unset enable_cflags_setting 1704 1705# cobc.c assumed -g for all but _MSC_VER 1706COB_DEBUG_FLAGS="-g" 1707 1708# For debugging: add most expressive debug level if using GCC (compatible) 1709curr_cflags="$CFLAGS" 1710if test "$COB_USES_GCC" = "yes"; then 1711 cob_temp_flags="-ggdb3" 1712 CFLAGS="$curr_cflags $cob_temp_flags" 1713 AC_MSG_CHECKING([for debug option $cob_temp_flags]) 1714 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int testint;]])], 1715 [AC_MSG_RESULT([yes]) 1716 COB_DEBUG_FLAGS="$cob_temp_flags"], 1717 [AC_MSG_RESULT([no]) 1718 cob_temp_flags="-g3" 1719 CFLAGS="$curr_cflags $cob_temp_flags" 1720 AC_MSG_CHECKING([for debug option $cob_temp_flags]) 1721 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int testint;]])], 1722 [AC_MSG_RESULT([yes]) 1723 COB_DEBUG_FLAGS="$cob_temp_flags"], 1724 [AC_MSG_RESULT([no])]) 1725 ] 1726) 1727 1728 cob_temp_flags="-fasynchronous-unwind-tables" 1729 CFLAGS="$curr_cflags $cob_temp_flags" 1730 AC_MSG_CHECKING([for debug option $cob_temp_flags]) 1731 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int testint;]])], 1732 [AC_MSG_RESULT([yes]) 1733 COB_DEBUG_FLAGS="$COB_DEBUG_FLAGS $cob_temp_flags"], 1734 [AC_MSG_RESULT([no]) 1735 cob_temp_flags="-funwind-tables" 1736 CFLAGS="$curr_cflags $cob_temp_flags" 1737 AC_MSG_CHECKING([for debug option $cob_temp_flags]) 1738 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int testint;]])], 1739 [AC_MSG_RESULT([yes]) 1740 COB_DEBUG_FLAGS="$COB_DEBUG_FLAGS $cob_temp_flags"], 1741 [AC_MSG_RESULT([no])]) 1742 ] 1743 ) 1744fi 1745 1746if test "$enable_debug" = "yes"; then 1747 CFLAGS="$curr_cflags $COB_DEBUG_FLAGS" 1748else 1749 CFLAGS="$curr_cflags" 1750fi 1751 1752if test "$enable_hardening" = "yes"; then 1753 AC_MSG_NOTICE([Compile with hardening options]) 1754 # needs optimization 1755 #if test "$enable_debug" = "yes"; then 1756 # CFLAGS="$CFLAGS -O" 1757 #fi 1758 CPPFLAGS="$CPPFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2" 1759 1760 curr_cflags="$CFLAGS" 1761 cob_temp_flags="-fstack-protector-strong" 1762 CFLAGS="$curr_cflags $cob_temp_flags" 1763 AC_MSG_CHECKING([for $cob_temp_flags option]) 1764 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int testint;]])], 1765 [AC_MSG_RESULT([yes])], 1766 [AC_MSG_RESULT([no]) 1767 cob_temp_flags="-fstack-protector" 1768 CFLAGS="$curr_cflags $cob_temp_flags" 1769 AC_MSG_CHECKING([for $cob_temp_flags option]) 1770 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int testint;]])], 1771 [AC_MSG_RESULT([yes])], 1772 [CFLAGS="$curr_cflags"; cob_temp_flags=""; AC_MSG_RESULT([no])]) 1773 ]) 1774 if test "x$cob_temp_flags" != "x"; then 1775 if test "x$COB_LDFLAGS" != "x"; then 1776 COB_LDFLAGS="$COB_LDFLAGS $cob_temp_flags" 1777 else 1778 COB_LDFLAGS="$cob_temp_flags" 1779 fi 1780 fi 1781 unset cob_temp_flags 1782fi 1783 1784if test "$COB_USES_GCC" = "yes"; then 1785 if test "x$CFLAGS" != "x"; then 1786 CFLAGS="$CFLAGS -pipe" 1787 else 1788 CFLAGS="-pipe" 1789 fi 1790fi 1791 1792# include directory (install dir) 1793 1794if test "x$prefix" = "xNONE"; then 1795 if test "x$includedir" = "x\${prefix}/include"; then 1796 COB_CFLAGS="-I${ac_default_prefix}/include" 1797 else 1798 COB_CFLAGS="-I${includedir}" 1799 fi 1800else 1801 if test "x$includedir" = "x\${prefix}/include"; then 1802 if test "x$prefix" = "x/usr"; then 1803 COB_CFLAGS="" 1804 else 1805 COB_CFLAGS="-I${prefix}/include" 1806 fi 1807 else 1808 COB_CFLAGS="-I${includedir}" 1809 fi 1810fi 1811 1812 1813# compiler specific general options for COB_CFLAGS, originating from cobc.c (main) 1814 1815if test "$COB_USES_ICC_ONLY" = "yes"; then 1816 # these are deprecated... 1817 COB_CFLAGS="$COB_CFLAGS -vec-report0 -opt-report 0" 1818elif test "$COB_USES_WATCOMC_ONLY" = "yes"; then 1819 # -s = no overflow checks, otherwise need to code/link a CHK routine 1820 COB_CFLAGS="$COB_CFLAGS -s -wcd=118" 1821elif test "$COB_USES_XLC_ONLY" = "yes"; then 1822 # use read-only memory for string literals and constants 1823 COB_CFLAGS="$COB_CFLAGS -qro -qroconst" 1824 # allow nonstandard usage - CHECKME where do we need this ??? 1825 # do we need the additional check for __IBMC__ >= 700 we had in cobc? 1826 COB_CFLAGS="$COB_CFLAGS -qlanglvl=extended" 1827 # Suppress compiler warning about MAXMEM optimization 1828 COB_CFLAGS="$COB_CFLAGS -qsuppress=1500-030" 1829fi 1830 1831if test "$COB_USES_GCC_NO_ICC" = "yes"; then 1832 # comment from cobc.c: --param max-goto-duplication-insns=100000 1833 # /* RXWRXW - gcse */ 1834 # COB_CFLAGS="$COB_CFLAGS -Wno-unused -fsigned-char -fno-gcse" 1835 COB_CFLAGS="$COB_CFLAGS -Wno-unused -fsigned-char" 1836fi 1837 1838# Check gcc 4 pointer sign option (at least available with "recent" clang, too) 1839#if test "$COB_USES_GCC_NO_ICC" = "yes"; then 1840if test "$COB_USES_XLC_ONLY" != "yes"; then 1841 curr_cflags="$CFLAGS" 1842 CFLAGS="$CFLAGS -Wno-pointer-sign" 1843 AC_MSG_CHECKING([for gcc pointer sign option]) 1844 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[int testint;]])], 1845 [COB_CFLAGS="$COB_CFLAGS -Wno-pointer-sign"; AC_MSG_RESULT([yes])], 1846 [AC_MSG_RESULT([no])]) 1847 CFLAGS="$curr_cflags" 1848fi 1849#fi 1850 1851if test "$COB_USES_CLANG_ONLY" = "yes"; then 1852 # don't warn if cobc uses arguments which aren't picked up (likely because of the translation phase) 1853 COB_CFLAGS="$COB_CFLAGS -Qunused-arguments" 1854fi 1855 1856 1857# Include CFLAGS / CPPFLAGS in COB_CFLAGS without optimization/debug options. 1858 1859if test "x$CFLAGS" != "x"; then 1860 cob_temp_flags="$CFLAGS" 1861else 1862 cob_temp_flags="" 1863fi 1864if test "x$CPPFLAGS" != "x"; then 1865 if test "x$cob_temp_flags" != "x"; then 1866 cob_temp_flags="$CPPFLAGS $cob_temp_flags" 1867 else 1868 cob_temp_flags="$CPPFLAGS" 1869 fi 1870fi 1871 1872# 1873# Add CFLAGS and CPPFLAGS to COB_CFLAGS, minus optimization/debug options. 1874 1875cob_temp_flags="$CFLAGS $CPPFLAGS" 1876 1877if test "$enable_hardening" = no; then 1878 cob_temp_flags=$(echo x$cob_temp_flags | \ 1879 sed -e 's/^x//' \ 1880 -e 's/-Wp,-D_FORTIFY_SOURCE=.//g' \ 1881 -e 's/-D_FORTIFY_SOURCE=.//g' \ 1882 -e 's/-fmessage-length=0//g' \ 1883 -e 's/-fstack-protector-strong//g' \ 1884 -e 's/-fstack-protector-all//g' \ 1885 -e 's/-fstack-protector//g' \ 1886 ) 1887fi 1888 1889cob_temp_flags=$(echo x$cob_temp_flags | \ 1890 sed -e 's/^x//' \ 1891 -e 's/-g\(db\)\{0,1\}[[0-9 ]]//g' \ 1892 -e 's/-g\(db\)\{0,1\}$//' \ 1893 -e 's/[[+-]]O[[0-9s]]*//g' \ 1894 -e 's/-O//g' \ 1895 -e 's/-funwind-tables//g' \ 1896 -e 's/-fasynchronous-unwind-tables//g' \ 1897 -e 's/ / /g' \ 1898 -e 's/ $//g' \ 1899 ) 1900 1901if test "x$cob_temp_flags" != "x"; then 1902 COB_CFLAGS="$cob_temp_flags $COB_CFLAGS" 1903fi 1904if test "$enable_hardening" = "yes"; then 1905 # needs optimization 1906 COB_CFLAGS="$COB_CFLAGS -O" 1907fi 1908unset cob_temp_flags 1909 1910# Special stuff 1911 1912AH_VERBATIM([_XOPEN_SOURCE_EXTENDED], 1913[/* Define to 1 if on HPUX. */ 1914#ifndef _XOPEN_SOURCE_EXTENDED 1915# undef _XOPEN_SOURCE_EXTENDED 1916#endif])dnl 1917 1918# FIXME: COB_SHARED_OPT should at least be checked for "compiles"; 1919# for example breaks with occ and other non-GCC compilers, 1920# *at least* check that compilation still works when using this option... 1921COB_SHARED_OPT="-shared" 1922 1923COB_FIX_LIB="$COB_EXPORT_DYN" 1924COB_FIX_LIBTOOL="" 1925case $host_os in 1926 mingw*) 1927 if test "$prefix" = "NONE"; then 1928 COB_CONFIG_DIR="$(cd /usr && pwd -W)/local/share/$PACKAGE_TARNAME/config" 1929 COB_COPY_DIR="$(cd /usr && pwd -W)/local/share/$PACKAGE_TARNAME/copy" 1930 fi 1931 if test "$COB_USES_GCC" = "yes"; then 1932 COB_EXPORT_DYN="-Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-auto-image-base" 1933 COB_FIX_LIBTOOL="-Wl,--enable-auto-import" 1934 fi 1935 #COB_FIX_LIB="" 1936 ;; 1937 cygwin*) 1938 if test "$COB_USES_GCC" = "yes"; then 1939 COB_EXPORT_DYN="-Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-auto-image-base" 1940 COB_FIX_LIBTOOL="-Wl,--enable-auto-import" 1941 fi 1942 #COB_FIX_LIB="" 1943 ;; 1944 darwin* | rhapsody*) 1945 if test "$COB_USES_GCC" = "yes"; then 1946 COB_SHARED_OPT="-bundle -flat_namespace -undefined suppress" 1947 fi 1948 ;; 1949 hpux*) 1950 if test "$COB_USES_GCC" != "yes"; then 1951 COB_SHARED_OPT="-b" 1952 AC_DEFINE([_XOPEN_SOURCE_EXTENDED], [1]) 1953 rm -f hptest* 1954 echo 'int main() { return 0; }' > hptest.c 1955 ${CC} ${CFLAGS} +Olit=all -o hptest hptest.c > hptest.out 2>&1 1956 if test $? -ne 0 -o -s hptest.out; then 1957 CFLAGS="$CFLAGS +ESlit" 1958 COB_CFLAGS="$COB_CFLAGS +ESlit -w" 1959 else 1960 CFLAGS="$CFLAGS +Olit=all" 1961 COB_CFLAGS="$COB_CFLAGS +Olit=all -w" 1962 fi 1963 1964 if test "$enable_debug" = "yes"; then 1965 CFLAGS="$CFLAGS +O0" 1966 else 1967 CFLAGS="$CFLAGS +O2" 1968 fi 1969 1970 rm -f hptest* 1971 fi 1972 ;; 1973 aix*) 1974 COB_EXPORT_DYN="-Wl,-bexpfull -Wl,-brtl" 1975 if test "$COB_USES_GCC" != "yes"; then 1976 CFLAGS="$CFLAGS -Q -qro -qroconst" 1977 if test "$enable_debug" = "yes"; then 1978 CFLAGS="$CFLAGS -qnoopt" 1979 else 1980 CFLAGS="$CFLAGS -O2" 1981 fi 1982 1983 COB_SHARED_OPT="-G" 1984 COB_FIX_LIB="" 1985 # COB_FIX_LIB="-Wc,-G $COB_EXPORT_DYN" 1986 # COB_CFLAGS="$COB_CFLAGS -qchars=signed" 1987 else 1988 COB_FIX_LIB="$COB_EXPORT_DYN" 1989 fi 1990 ;; 1991 solaris*) 1992 if test "$COB_USES_GCC" != "yes"; then 1993 CFLAGS="$CFLAGS -xstrconst" 1994 if test "$enable_debug" != "yes"; then 1995 CFLAGS="$CFLAGS -xO2" 1996 fi 1997 COB_CFLAGS="$COB_CFLAGS -xstrconst" 1998 COB_SHARED_OPT="-G" 1999 fi 2000 ;; 2001esac 2002 2003if test "$COB_USES_ICC_ONLY" = "yes"; then 2004 if test "$enable_debug" != "yes"; then 2005 CFLAGS="$CFLAGS -finline-functions" 2006 fi 2007 CFLAGS="$CFLAGS -Wall -wd1419 -vec-report0 -opt-report 0" 2008elif test "$COB_USES_GCC" = "yes" && test "$with_gnu_ld" = "yes"; then 2009 curr_ldflags="$LDFLAGS" 2010 LDFLAGS="$LDFLAGS -Wl,-z,relro,-z,now,-O1" 2011 AC_MSG_CHECKING([for ld bind now option]) 2012 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int testint;]])], 2013 [AC_MSG_RESULT([yes])], 2014 [LDFLAGS=$curr_ldflags 2015 AC_MSG_RESULT([no])]) 2016 unset curr_ldflags 2017 if test "$enable_debug" != "yes"; then 2018 CFLAGS="$CFLAGS -finline-functions" 2019 fi 2020 CFLAGS="$CFLAGS -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k" 2021fi 2022 2023if test "x$lt_cv_dlopen_self" != "xyes"; then 2024 AC_DEFINE([COB_NO_SELFOPEN], [1]) 2025fi 2026 2027if test "$with_cisam" = "yes"; then 2028 COB_HAS_ISAM=cisam 2029elif test "$with_disam" = "yes"; then 2030 COB_HAS_ISAM=disam 2031elif test "$with_vbisam" = "yes"; then 2032 COB_HAS_ISAM=vbisam 2033elif test "$with_db" = "yes"; then 2034 COB_HAS_ISAM=db 2035elif test "$with_index_extfh" = "yes"; then 2036 COB_HAS_ISAM=index_extfh 2037else 2038 COB_HAS_ISAM=no 2039fi 2040 2041if test "$USE_CURSES" = "not_found" -o "$USE_CURSES" = "no"; then 2042 COB_HAS_CURSES=no 2043else 2044 COB_HAS_CURSES=yes 2045fi 2046 2047if test "$with_xml2" = "yes"; then 2048 COB_HAS_XML2=yes 2049 with_xml2=libxml2 2050else 2051 COB_HAS_XML2=no 2052fi 2053 2054if test "$USE_JSON" = "local"; then 2055 COB_HAS_JSON=cjson 2056elif test "$USE_JSON" = "not_found"; then 2057 COB_HAS_JSON=no 2058else 2059 COB_HAS_JSON=$USE_JSON 2060fi 2061 2062AM_CONDITIONAL([LOCAL_CJSON],[test "$USE_JSON" = "local"]) 2063 2064unset COB_USES_GCC 2065unset COB_USES_GCC_NO_ICC 2066unset COB_USES_ICC_ONLY 2067unset COB_USES_CLANG_ONLY 2068unset COB_USES_XLC_ONLY 2069unset COB_USES_WATCOM_ONLY 2070unset curr_cflags 2071unset curr_cppflags 2072unset curr_libs 2073 2074# Generate the output 2075 2076AM_CONDITIONAL([COB_MAKE_IX], [test "$COB_HAS_ISAM" != no]) 2077AM_CONDITIONAL([COB_MAKE_RUN_BINARIES], [test "$cross_compiling" != yes]) 2078# FIXME: Should be tested as the system may can actually run these (Bash on Windows?) 2079 2080AC_DEFINE_UNQUOTED([COB_CC], ["$COB_CC"], [compiler used by cobc]) 2081AX_AC_DEFINE_RESOLVED([COB_CFLAGS], [$COB_CFLAGS], [compiler flags passed to compiler by cobc]) 2082AX_AC_DEFINE_RESOLVED([COB_LDFLAGS], [$COB_LDFLAGS], [linker flags passed to linker by cobc]) 2083AX_AC_DEFINE_RESOLVED([COB_LIBS], [$COB_LIBS], [libraries passed to linker by cobc]) 2084AC_DEFINE_UNQUOTED([COB_PIC_FLAGS], ["$COB_PIC_FLAGS"]) 2085AC_DEFINE_UNQUOTED([COB_DEBUG_FLAGS], ["$COB_DEBUG_FLAGS"]) 2086AC_DEFINE_UNQUOTED([COB_EXPORT_DYN], ["$COB_EXPORT_DYN"]) 2087AC_DEFINE_UNQUOTED([COB_SHARED_OPT], ["$COB_SHARED_OPT"]) 2088AC_DEFINE_UNQUOTED([COB_MODULE_EXT], ["$COB_MODULE_EXT"]) 2089AC_DEFINE_UNQUOTED([COB_OBJECT_EXT], ["$OBJEXT"]) 2090AC_DEFINE_UNQUOTED([COB_EXE_EXT], ["$COB_EXE_EXT"]) 2091AX_AC_DEFINE_RESOLVED([COB_LIBRARY_PATH], [$COB_LIBRARY_PATH], [default search path for extra modules]) 2092if test "x$striplib" != "x"; then 2093 AC_DEFINE_UNQUOTED([COB_STRIP_CMD], ["$striplib"]) 2094fi 2095AX_AC_DEFINE_RESOLVED([COB_CONFIG_DIR], [$COB_CONFIG_DIR], [default search path for copybooks]) 2096AX_AC_DEFINE_RESOLVED([COB_COPY_DIR], [$COB_COPY_DIR], [default search path for configuration files]) 2097 2098#AX_AC_DEFINE_RESOLVED([DATADIR], [$datarootdir], [path for configuration files]) 2099#AX_AC_DEFINE_RESOLVED([LOCALEDIR], [$localedir], [path for locale-dependent data]) 2100 2101#AC_DEFINE_UNQUOTED([COBC_NAME], ["$(echo cobc | $SED "$program_transform_name")"], [executable name for compiler]) 2102AC_DEFINE_UNQUOTED([COBCRUN_NAME], ["$(echo cobcrun | $SED "$program_transform_name")"], [executable name for module runner]) 2103 2104# informational only 2105AC_DEFINE_UNQUOTED([COB_BLD_CC], ["$CC"], [informational: compiler during compilation]) 2106AC_DEFINE_UNQUOTED([COB_BLD_CFLAGS], ["$CFLAGS"], [informational: compiler flags during compilation]) 2107AC_DEFINE_UNQUOTED([COB_BLD_CPPFLAGS], ["$CPPFLAGS"], [informational: preparser flags during compilation]) 2108AC_DEFINE_UNQUOTED([COB_BLD_LD], ["$LD"], [informational: linker during compilation]) 2109AC_DEFINE_UNQUOTED([COB_BLD_LDFLAGS], ["$LDFLAGS"], [informational: linker flags during compilation]) 2110AC_DEFINE_UNQUOTED([COB_BLD_BUILD], ["$build"], [informational: build environment during compilation]) 2111 2112AC_SUBST([COB_CC]) 2113AC_SUBST([COB_CFLAGS]) 2114AC_SUBST([COB_LDFLAGS]) # needed for pre-inst-env 2115AC_SUBST([COB_LIBS]) 2116AC_SUBST([COB_CONFIG_DIR]) 2117AC_SUBST([COB_COPY_DIR]) 2118AC_SUBST([COB_LIBRARY_PATH]) 2119AC_SUBST([COB_OBJECT_EXT]) 2120AC_SUBST([COB_MODULE_EXT]) 2121AC_SUBST([COB_EXE_EXT]) 2122AC_SUBST([PROGRAMS_LIBS]) 2123AC_SUBST([LIBCOB_LIBS]) 2124AC_SUBST([LIBCOB_CPPFLAGS]) 2125 2126# was used in bin/Makefile.am - seems not to be needed 2127#AC_SUBST([COB_EXPORT_DYN]) 2128 2129# used in the testsuite 2130COB_BIGENDIAN="$ac_cv_c_bigendian" 2131AC_SUBST([COB_BIGENDIAN]) 2132 2133#AC_SUBST([COB_FIX_LIB]) 2134AC_SUBST([COB_FIX_LIBTOOL]) 2135 2136AC_SUBST([COB_HAS_ISAM]) 2137AC_SUBST([COB_HAS_CURSES]) 2138AC_SUBST([COB_HAS_XML2]) 2139AC_SUBST([COB_HAS_JSON]) 2140AC_SUBST([COB_HAS_64_BIT_POINTER]) 2141AC_SUBST([COB_PATCH_LEVEL], [$with_patch_level]) # needed for bin/cob-config 2142 2143AC_CONFIG_COMMANDS([chmod], 2144[chmod +x bin/cob-config; 2145chmod +x tests/atconfig; 2146chmod +x tests/atlocal]) 2147 2148AM_MISSING_PROG([HELP2MAN], [help2man]) 2149 2150AC_OUTPUT 2151 2152AC_MSG_NOTICE([GnuCOBOL Configuration:]) 2153AC_MSG_NOTICE([ CC ${CC}]) 2154AC_MSG_NOTICE([ CFLAGS ${CFLAGS}]) 2155AC_MSG_NOTICE([ LDFLAGS ${LDFLAGS}]) 2156if test "x$PROGRAMS_LIBS" != "x"; then 2157 AC_MSG_NOTICE([ PROGRAMS_LIBS ${PROGRAMS_LIBS}]) 2158fi 2159AC_MSG_NOTICE([ COB_CC ${COB_CC}]) 2160AC_MSG_NOTICE([ COB_CFLAGS ${COB_CFLAGS}]) 2161AC_MSG_NOTICE([ COB_LDFLAGS ${COB_LDFLAGS}]) 2162AC_MSG_NOTICE([ COB_DEBUG_FLAGS ${COB_DEBUG_FLAGS}]) 2163AC_MSG_NOTICE([ COB_LIBS ${COB_LIBS}]) 2164AC_MSG_NOTICE([ COB_CONFIG_DIR ${COB_CONFIG_DIR}]) 2165AC_MSG_NOTICE([ COB_COPY_DIR ${COB_COPY_DIR}]) 2166AC_MSG_NOTICE([ COB_LIBRARY_PATH ${COB_LIBRARY_PATH}]) 2167AC_MSG_NOTICE([ COB_OBJECT_EXT ${OBJEXT}]) 2168AC_MSG_NOTICE([ COB_MODULE_EXT ${COB_MODULE_EXT}]) 2169AC_MSG_NOTICE([ COB_EXE_EXT ${COB_EXE_EXT}]) 2170AC_MSG_NOTICE([ COB_SHARED_OPT ${COB_SHARED_OPT}]) 2171AC_MSG_NOTICE([ COB_PIC_FLAGS ${COB_PIC_FLAGS}]) 2172AC_MSG_NOTICE([ COB_EXPORT_DYN ${COB_EXPORT_DYN}]) 2173if test "x$striplib" != "x"; then 2174 AC_MSG_NOTICE([ COB_STRIP_CMD ${striplib}]) 2175fi 2176if test "${DEFINE_DL}" = "yes" ; then 2177 AC_MSG_NOTICE([ Dynamic loading: System]) 2178else 2179 AC_MSG_NOTICE([ Dynamic loading: Libtool]) 2180fi 2181AC_MSG_NOTICE([ Use gettext for international messages: ${USE_NLS}]) 2182AC_MSG_NOTICE([ Use fcntl for file locking: ${ac_cv_func_fcntl}]) 2183AC_MSG_NOTICE([ Use math multiple precision library: ${USE_MATH}]) 2184case "$USE_CURSES" in 2185 not_found) 2186 AC_MSG_NOTICE([ screen I/O (no curses found): NO]) 2187 ;; 2188 no) 2189 AC_MSG_NOTICE([ screen I/O (disabled): NO]) 2190 ;; 2191 *) 2192 AC_MSG_NOTICE([ Use curses library for screen I/O: ${USE_CURSES}]) 2193 ;; 2194esac 2195if test "$with_debug_log" = "yes"; then 2196 AC_MSG_NOTICE([ Enable GnuCOBOL developer logging yes]) 2197fi 2198if test "$with_seqra_extfh" = "yes"; then 2199 AC_MSG_NOTICE([ Use external SEQ/RAN file handler: yes]) 2200 AC_MSG_WARN([ Obsolete feature "OpenCOBOL-only-EXTFH" used!]) 2201fi 2202if test "$with_index_extfh" = "yes"; then 2203 AC_MSG_NOTICE([ Use external INDEXED file handler: yes]) 2204 AC_MSG_WARN([ Obsolete feature "OpenCOBOL-only-EXTFH" used!]) 2205elif test "$with_cisam" = "yes"; then 2206 AC_MSG_NOTICE([ Use CISAM for INDEXED I/O: yes]) 2207elif test "$with_disam" = "yes"; then 2208 AC_MSG_NOTICE([ Use DISAM for INDEXED I/O: yes]) 2209elif test "$with_vbisam" = "yes"; then 2210 AC_MSG_NOTICE([ Use VBISAM for INDEXED I/O: yes]) 2211elif test "$with_db" = "yes"; then 2212 AC_MSG_NOTICE([ Use Berkeley DB for INDEXED I/O: yes]) 2213else 2214 AC_MSG_NOTICE([ INDEXED I/O (no handler configured): NO]) 2215fi 2216 2217case "$with_xml2" in 2218 not_found) 2219 AC_MSG_NOTICE([ XML I/O (no handler found): NO]) 2220 ;; 2221 no) 2222 AC_MSG_NOTICE([ XML I/O (disabled): NO]) 2223 ;; 2224 *) 2225 AC_MSG_NOTICE([ Used for XML I/O: ${with_xml2}]) 2226 ;; 2227esac 2228case "$USE_JSON" in 2229 not_found) 2230 AC_MSG_NOTICE([ JSON I/O (no handler found): NO]) 2231 ;; 2232 no) 2233 AC_MSG_NOTICE([ JSON I/O (disabled): NO]) 2234 ;; 2235 *) 2236 AC_MSG_NOTICE([ Used for JSON I/O: ${USE_JSON}]) 2237 ;; 2238esac 2239 2240unset DEFINE_DL 2241