tinycobol/configure.in

988 lines
27 KiB
Plaintext

# Tiny COBOL autoconf input.
#
# Process this file with autoconf to produce a configure script.
dnl Initialize with some random file to ensure the source is here.
AC_INIT(compiler/htcoboly.h)
# Minimum Autoconf version required.
AC_PREREQ(2.10)
#TCOB_MAJOR_VERSION=0
#TCOB_MINOR_VERSION=61
#TCOB_PATCH_LEVEL=0
#TCOB_PATCH_LEVEL=45
TCOB_MAJOR_VERSION=`grep '^TCOB_MAJOR_VERSION' version.txt | cut -f2 -d'='`
TCOB_MINOR_VERSION=`grep '^TCOB_MINOR_VERSION' version.txt | cut -f2 -d'='`
TCOB_PATCH_LEVEL=`grep '^TCOB_PATCH_LEVEL' version.txt | cut -f2 -d'='`
#
TCOB_VERSION=$TCOB_MAJOR_VERSION.$TCOB_MINOR_VERSION.$TCOB_PATCH_LEVEL
#TCOB_RELEASE_DATE=2003/09/11
TCOB_RELEASE_DATE=`date +%Y/%m/%d`
tcob_version=$TCOB_VERSION
TCOBPP_MAJOR_VERSION=0
TCOBPP_MINOR_VERSION=41
TCOBPP_PATCH_LEVEL=3
TCOBPP_VERSION=$TCOBPP_MAJOR_VERSION.$TCOBPP_MINOR_VERSION.$TCOBPP_PATCH_LEVEL
TCOBPP_RELEASE_DATE=2004/09/25
tcobpp_version=$TCOBPP_VERSION
AC_CONFIG_HEADER(htconfig.h)
#
# Check for System OS name
AC_CANONICAL_SYSTEM
# Checks for host/OS name
#AC_CANONICAL_HOST
#AC_DEFINE_UNQUOTED(OS_TYPE, "$host_os")
#AC_EXEEXT
exeext=''
shared_lib_extension='.so'
need_underscode='no'
htg_ld_args_m='m'
curses_header='ncurses.h'
curses_library='ncurses'
LIBS="-L/usr/lib -L/usr/local/lib"
INCLUDES="-I/usr/include -I/usr/local/include -I../lib -I../"
# Check for executable suffix
# Set include and libraries paths
# Set curses include and library
# Set math library
# Set executable extention (exeext), if any
# Set shared library extension
#
case "$host_os" in
*beos)
LIBS="-L/boot/home/config/lib $M_LIBS"
INCLUDES="-I/boot/home/config/include -I../lib -I../"
htg_ld_args_m="root"
;;
*cygwin)
htg_ld_args_m="cygwin"
exeext='.exe'
shared_lib_extension='.dll'
need_underscode='yes'
;;
*mingw32)
curses_header='pdcurses.h'
curses_library='pdcurses'
exeext='.exe'
shared_lib_extension='.dll'
need_underscode='yes'
;;
*mingw)
curses_header='pdcurses.h'
curses_library='pdcurses'
exeext='.exe'
shared_lib_extension='.dll'
need_underscode='yes'
;;
esac
#
#echo "OS host host_os=${host_os};"
# Set the compiler language option
tcob_lang=''
AC_ARG_WITH(with-lang,
[ --with-lang=[ARG] set language [en/fr/it/pt_BR/es default=en]],
,
,
)
#echo "debug 0a: with_lang=$with_lang, tcob_lang=$tcob_lang"
case "x$with_lang" in
x) tcob_lang='en';;
xen) tcob_lang='en';;
xfr) tcob_lang='fr';;
xit) tcob_lang='it';;
xpt_BR) tcob_lang='pt_BR';;
xes) tcob_lang='es';;
*) echo "Language option '$with_lang' not available, defaulting to language=en (English)"
tcob_lang='en';;
esac
#echo "debug 0b: with_lang=$with_lang, tcob_lang=$tcob_lang"
# Set the compiler
c_compiler="gcc"
AC_ARG_WITH(with-compiler,
[ --with-compiler=[ARG] use compiler [gcc/kgcc/egcs default=gcc]],
,
,
)
# c_compiler="gcc",
# c_compiler=$with_compiler
#echo "debug 1: compiler c_compiler:${c_compiler}: with_compiler:${with_compiler}:"
if test "x$with_compiler" = "x"; then
c_compiler="gcc"
else
c_compiler=$with_compiler
fi
#echo "debug 2: compiler c_compiler:${c_compiler}: with_compiler:${with_compiler}:"
dnl the prefix
dnl ==========
dnl
dnl move this earlier in the script... anyone know why this is handled
dnl in such a bizarre way?
test "x$prefix" = xNONE && prefix=$ac_default_prefix
#dnl Let make expand exec_prefix.
#test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
# Checks for required programs
#
#AC_PROG_CC
AC_CHECK_PROG(CC, "$c_compiler", "$c_compiler", no)
#echo "debug 3a: compiler c_compiler:${c_compiler}: ccx:$ccx: CC:$CC:"
if test "${CC}" = "no" ; then
AC_MSG_ERROR(C compiler not found... aborting)
fi
#echo "debug 3b: compiler c_compiler:${c_compiler}: ccx:$ccx: CC:$CC:"
#
#AC_PROG_GAS
AC_CHECK_PROG(AS, as, as, as)
asx_cmd="${AS}"
ccx_cmd="${CC}"
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
#AC_PROG_RANLIB
AC_CHECK_PROG(RANLIB, ranlib, ranlib, ranlib)
AC_CHECK_PROG(AR, ar, ar, ar)
ranlibx_cmd="${RANLIB}"
arx_cmd="${AR}"
#AC_PROG_LEX
AC_CHECK_PROG(FLEX, flex, flex, no)
if test "${FLEX}" = "no" ; then
AC_MSG_ERROR(required program not found... aborting)
else
LEX=${FLEX}
fi
#
yacc_name="bison"
yacc_prefix_cobpp="parser"
yacc_prefix_compiler="htcobol"
AC_ARG_WITH(with-yacc,
[ --with-yacc=[ARG] use YACC [default=bison]],
,
,
)
if test "x$with_yacc" = "x"; then
yacc_name="bison"
else
yacc_name=$with_yacc
fi
#
#AC_CHECK_PROG(YACC, "$with_yacc", "$with_yacc", no)
AC_CHECK_PROG(YACC, "$yacc_name", "$yacc_name", no)
#
if test "${YACC}" = "no" ; then
AC_MSG_ERROR(Compiler compiler (i.e. Berkeley's YACC version 1.9.3 or Bison) not found... aborting)
else
if test "${YACC}" = "yacc193" ; then
yacc_prefix_cobpp="y"
yacc_prefix_compiler="y"
fi
fi
#
# no longer used to expand tabs
#AC_CHECK_PROG(EXPAND, expand, expand, no)
# AC_MSG_ERROR(program not found required by pre-processor... aborting)
AC_PATH_PROG(expand_cmd_path, expand, no)
if test "${expand_cmd_path}" = "no" ; then
echo "warning: cobf2f utility may not work properly without tab expand utility"
fi
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(stdio.h alloca.h errno.h fcntl.h limits.h sys/time.h \
unistd.h malloc.h stdlib.h string.h strings.h utime.h \
ctype.h sys/stat.h sys/types.h getopt.h)
#AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h unistd.h)
#AC_CHECK_HEADERS([alloca.h errno.h fcntl.h limits.h malloc.h stdlib.h \
# string.h sys/param.h sys/time.h termios.h unistd.h])
#AC_CHECK_HEADERS(ctype.h stdlib.h string.h strings.h utime.h \
# sys/stat.h sys/time.h sys/types.h getopt.h)
# Intialize for ltdl library tests.
#use_ltdl_lib="0"
#ltdl_default="0"
## Check for libltdl header files.
#ltdl_header="0"
#AC_CHECK_HEADERS(ltdl.h, ltdl_header="1")
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_STRUCT_TM
# Checks for library functions.
AC_FUNC_MEMCMP
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(strcspn strdup strerror strspn putenv)
# Evaluate debugging options.
# Set debug compile switches
debug_default="0"
AC_ARG_ENABLE(debug,
[ --enable-debug set C compiler debug option on [-g] ],
debug_default="1"
)
AC_ARG_ENABLE(debug-all,
[ --enable-debug-all enable all debug options],
AC_DEFINE(DEBUG_COMPILER)
AC_DEFINE(PICTURE_TESTING)
AC_DEFINE(DEBUG_SCANNER)
AC_DEFINE(DEBUG_RTS)
AC_DEFINE(DEBUG_MOVE_RTS)
debug_default="1"
)
#AC_ARG_ENABLE(debug-comp,
# [ --disable-debug-comp disable all debug compiler options], ,
# AC_DEFINE(DEBUG_COMPILER)
# AC_DEFINE(PICTURE_TESTING)
# AC_DEFINE(DEBUG_SCANNER)
## AC_DEFINE(DEBUG_RTS)
#)
dnl Evaluate debugging options.
AC_ARG_ENABLE(debug-comp,
[ --enable-debug-comp enable compiler and scanner debug options],
AC_DEFINE(DEBUG_COMPILER)
# AC_DEFINE(PICTURE_TESTING)
AC_DEFINE(DEBUG_SCANNER)
# AC_DEFINE(DEBUG_RTS)
debug_default="1"
)
AC_ARG_ENABLE(debug-compiler,
[ --enable-debug-compiler enable compiler debug option],
AC_DEFINE(DEBUG_COMPILER)
debug_default="1"
)
AC_ARG_ENABLE(debug-scanner,
[ --enable-debug-scanner enable scanner debug option],
AC_DEFINE(DEBUG_SCANNER)
debug_default="1"
)
AC_ARG_ENABLE(debug-rts,
[ --enable-debug-rts enable debug Run-Time option],
AC_DEFINE(DEBUG_RTS)
AC_DEFINE(DEBUG_MOVE_RTS)
debug_default="1"
)
AC_ARG_ENABLE(debug-rts-move,
[ --enable-debug-rts-move enable debug Run-Time Move routines option],
AC_DEFINE(DEBUG_MOVE_RTS)
debug_default="1"
)
AC_ARG_ENABLE(debug-pp,
[ --enable-debug-pp enable debug pre-processor option],
AC_DEFINE(DEBUG_COBPP)
debug_default="1"
)
# Set MF compatibility features
#mf_compatibility="0"
AC_ARG_ENABLE(mfcomp,
[ --enable-mfcomp enable MF compatibility features ],
AC_DEFINE(USE_MF_COMPATABILITY)
)
# Set MYSQL gateway features
#mf_compatibility="0"
AC_ARG_ENABLE(mysql,
[ --enable-mysql enable MYSQL gateway features ],
AC_DEFINE(USE_MYSQL_GATEWAY)
AC_DEFINE(SQL_GATEWAY)
)
# Set PGSQL gateway features
#mf_compatibility="0"
AC_ARG_ENABLE(pgsql,
[ --enable-pgsql enable PGSQL gateway features ],
AC_DEFINE(USE_PGSQL_GATEWAY)
AC_DEFINE(SQL_GATEWAY)
)
# Enable file LOCK server feature option
#
#lockserv_default="0"
AC_ARG_ENABLE(lockserv,
[ --enable-lockserv enable file LOCK server feature ],
AC_DEFINE(USE_LOCKSERVER)
)
# Enable file SYNC server feature option
#
#lockserv_default="0"
AC_ARG_ENABLE(sync,
[ --enable-sync enable file SYNC server feature ],
AC_DEFINE(USE_SYNC)
)
# Set use ltdl library option.
#
#AC_ARG_WITH(libltdl,
# [ --with-libltdl use LTDL library for Run-Time dynamic load routines],
# ltdl_default="1" ,
# ,
# )
#
#AC_ARG_WITH(no-libltdl,
# [ --with-no-libltdl use internal Run-Time dynamic load routines ],
# ltdl_default="0" ,
# ,
# )
#
#if test "${ltdl_default}" = "1" && test "${ltdl_header}" = "1" ; then
# use_ltdl_lib="1"
#fi
#AC_ARG_WITH(with-yacc,
# [ --with-yacc=[ARG] use YACC [yacc193 default=bison]],
# ,
# ,
#)
#if test "x$with_yacc" = "x"; then
# yacc_name="bison"
#else
# yacc_name=$with_yacc
#fi
#
#
#
if test "${debug_default}" = "1"; then
CCXFLAGS="-g"
ACXFLAGS="-D -as"
else
# CCXFLAGS="-O2"
CCXFLAGS=""
ACXFLAGS="-as"
fi
dnl Checks for libraries and lib includes.
# check for math library
have_lib_m="no"
AC_CHECK_LIB("$htg_ld_args_m", asin,
have_lib_m="yes",
AC_MSG_ERROR(Math library "$htg_ld_args_m" is required to create COBOL executable)
)
#
if test "${have_lib_m}" = "yes" ; then
htg_ld_args_m="-l$htg_ld_args_m"
M_LIBS="$htg_ld_args_m $M_LIBS"
fi
# Step 0: check for library db headers db.h or db_185.h
echo "Beginning DB library header search sequence "
db_header="0"
db_version="0"
#
# Force the use of library db 2 or 3 or 4
AC_ARG_WITH(with-libdb,
[ --with-libdb=[ARG] use DB library version (2 3 4) ],
,
,
)
#echo "debug 5a: DB library header option with_libdb:$with_libdb:"
if test "x$with_libdb" != "x"; then
if test "x$with_libdb" != "x2" && test "x$with_libdb" != "x3" && test "x$with_libdb" != "x4"; then
AC_MSG_ERROR(invalid library db option selected... aborting)
fi
fi
#echo "debug 5b: DB library header option with_libdb:$with_libdb:"
if test "x$with_libdb" = "x2"; then
AC_CHECK_HEADERS("db2/db_185.h",
[db_header="2" ],
AC_MSG_ERROR(header db2/db_185.h for library db version 2.x not found... aborting)
)
fi
if test "x$with_libdb" = "x3"; then
AC_CHECK_HEADERS("db3/db_185.h",
[db_header="3" ],
AC_MSG_ERROR(header db3/db_185.h for library db version 3.x not found... aborting)
)
fi
if test "x$with_libdb" = "x4"; then
AC_CHECK_HEADERS("db4/db_185.h",
[db_header="4" ],
AC_MSG_ERROR(header db4/db_185.h for library db version 4.x not found... aborting)
)
fi
# Step 1: check for library db header db_185.h for version 2.x or 3.x
if test "${db_header}" = "0" ; then
AC_CHECK_HEADERS("db_185.h",
[ db_header="23" ],
)
fi
# Step 2: if header db_185.h not found check for header db.h for version 1.x
if test "${db_header}" = "0" ; then
AC_CHECK_HEADERS("db.h",
[ db_header="10" ],
)
fi
# Step 3: if header db.h not found check for header db1/db.h for version 1.x
if test "${db_header}" = "0" ; then
AC_CHECK_HEADERS("db1/db.h",
[ db_header="1" ],
)
fi
# Step 4: if header "db1/db.h" not found check for header db4/db_185.h for version 4.x
if test "${db_header}" = "0" ; then
AC_CHECK_HEADERS("db4/db_185.h",
[db_header="4" ],
)
fi
# Step 5: if header "db1/db.h" not found check for header db3/db_185.h for version 3.x
if test "${db_header}" = "0" ; then
AC_CHECK_HEADERS("db3/db_185.h",
[db_header="3" ],
)
fi
# Step 6: if header "db3/db_185.h" not found check for header db2/db_185.h for version 2.x
if test "${db_header}" = "0" ; then
AC_CHECK_HEADERS("db2/db_185.h",
[db_header="2" ],
)
fi
# Step 7: if no DB headers found abort
if test "${db_header}" = "0" ; then
AC_MSG_ERROR(library headers (db.h or db_185.h) not found... aborting)
#else
# echo "DB library header found db_header state is ${db_header}"
fi
# Step 7a: If header db.h found check library db is version 1.x (1.85-2.0)
echo "Beginning DB library test link sequence "
if test "${db_header}" = "10" ; then
AC_MSG_CHECKING(if db.h header belongs to version 1.x \(1.85-2\))
AC_EGREP_HEADER([dbopen], [db.h],
[ AC_MSG_RESULT(yes) ],
[ AC_MSG_RESULT(no);
AC_MSG_ERROR(header db.h for library db version 1.x \(1.85-2\) not found... aborting) ]
)
AC_CHECK_LIB(db, dbopen,
M_LIBS="$M_LIBS"; db_version="10",
)
fi
#
# Step 7b: If header db.h found check library db is version 1.x (1.85-2.0)
if test "${db_header}" = "1" ; then
AC_MSG_CHECKING(if db.h header belongs to version 1.x \(1.85-2.0\))
AC_EGREP_HEADER([dbopen], [db1/db.h],
[ AC_MSG_RESULT(yes) ],
[ AC_MSG_RESULT(no);
AC_MSG_ERROR(header db.h for library db version 1.x \(1.85-2.0\) not found... aborting) ]
)
AC_CHECK_LIB(db, dbopen,
M_LIBS="$M_LIBS"; db_version="1",
)
fi
#
# Step 7.5: Backup library paths
LIBS_BK="$LIBS"
# Step 8: If header db_185.h found check library db is version 2.x
if test "${db_header}" = "2" ; then
echo -n "checking for -ldb2 (with 1.85 API compatibility)..."
LIBS="$LIBS_BK -ldb2"
AC_TRY_LINK(#define DB_LIBRARY_COMPATIBILITY_API 1
#include <db2/db_185.h>
const char *c1;
int i1;
int i2;
DBTYPE dbv1;
const void *vv;
, dbopen(c1, i1, i2, dbv1, vv); ,
[ echo " yes"; db_version="2" ],
[ echo " no"; db_header="21" ]
)
fi
# Step 9a: If header db_185.h found check library db is version 3.x
if test "${db_header}" = "3" ; then
echo -n "checking for -ldb3 (with 1.85 API compatibility)..."
LIBS="$LIBS_BK -ldb3"
AC_TRY_LINK(#define DB_LIBRARY_COMPATIBILITY_API 1
#include <db3/db_185.h>
const char *c1;
int i1;
int i2;
DBTYPE dbv1;
const void *vv;
, dbopen(c1, i1, i2, dbv1, vv); ,
[ echo " yes"; db_version="3" ],
[ echo " no"; db_header="31" ]
)
fi
# Step 9b: If header db_185.h found check library db is version 4.x
if test "${db_header}" = "4" ; then
echo -n "checking for -ldb-4 (with 1.85 API compatibility)..."
LIBS="$LIBS_BK -ldb-4"
AC_TRY_LINK(#define DB_LIBRARY_COMPATIBILITY_API 1
#include <db4/db_185.h>
const char *c1;
int i1;
int i2;
DBTYPE dbv1;
const void *vv;
, dbopen(c1, i1, i2, dbv1, vv); ,
[ echo " yes"; db_version="4" ],
[ echo " no"; db_header="41" ]
)
fi
# Step 10: If header db_185.h found check if library db is version 2.x
if test "${db_header}" = "23" ; then
echo -n "checking for -ldb (version 2.x or 3.x with 1.85 API compatibility)..."
LIBS="$LIBS_BK -ldb"
AC_TRY_LINK(#define DB_LIBRARY_COMPATIBILITY_API 1
#include <db_185.h>
const char *c1;
int i1;
int i2;
DBTYPE dbv1;
const void *vv;
, dbopen(c1, i1, i2, dbv1, vv); ,
[ echo " yes"; db_version="23" ],
[ echo " no"; db_header="41" ]
)
fi
# Step 10a: If header db_185.h found check if library db is version 4.x
if test "${db_header}" = "41" ; then
echo -n "checking for -ldb-4 (with 1.85 API compatibility)..."
LIBS="$LIBS_BK -ldb-4"
AC_TRY_LINK(#define DB_LIBRARY_COMPATIBILITY_API 1
#include <db_185.h>
const char *c1;
int i1;
int i2;
DBTYPE dbv1;
const void *vv;
, dbopen(c1, i1, i2, dbv1, vv); ,
[ echo " yes"; db_version="41" ],
[ echo " no"; db_header="32" ]
)
fi
# Step 10b: If header db_185.h found check if library db is version 3.x
if test "${db_header}" = "32" ; then
echo -n "checking for -ldb3 (with 1.85 API compatibility)..."
LIBS="$LIBS_BK -ldb3"
AC_TRY_LINK(#define DB_LIBRARY_COMPATIBILITY_API 1
#include <db_185.h>
const char *c1;
int i1;
int i2;
DBTYPE dbv1;
const void *vv;
, dbopen(c1, i1, i2, dbv1, vv); ,
[ echo " yes"; db_version="32" ],
[ echo " no"; db_header="123" ]
)
fi
# Step 10c: If header db_185.h found check if library db is version 2.x or 3.x called db1
if test "${db_header}" = "123" ; then
echo -n "checking for -ldb2 (with 1.85 API compatibility)..."
LIBS="$LIBS_BK -ldb2"
AC_TRY_LINK(#define DB_LIBRARY_COMPATIBILITY_API 1
#include <db_185.h>
const char *c1;
int i1;
int i2;
DBTYPE dbv1;
const void *vv;
, dbopen(c1, i1, i2, dbv1, vv); ,
[ echo " yes"; db_version="123" ],
[ echo " no"; AC_MSG_ERROR(library test link failed for db3 or db2 and/or compatibility API to version 1.85 not found... aborting) ]
)
fi
# Step 11: If header db_185.h found check if library db is version 3.x
if test "${db_header}" = "31" ; then
echo -n "checking for -ldb (version 3.x with 1.85 API compatibility)..."
LIBS="$LIBS_BK -ldb"
AC_TRY_LINK(#define DB_LIBRARY_COMPATIBILITY_API 1
#include <db3/db_185.h>
const char *c1;
int i1;
int i2;
DBTYPE dbv1;
const void *vv;
, dbopen(c1, i1, i2, dbv1, vv); ,
[ echo " yes"; db_version="31" ],
[ echo " no"; AC_MSG_ERROR(library test link failed for db and/or compatibility API to version 1.85 not found... aborting) ]
)
fi
# Step 12: If header db_185.h found check if library db is version 3.x
if test "${db_header}" = "21" ; then
echo -n "checking for -ldb (version 2.x with 1.85 API compatibility)..."
LIBS="$LIBS_BK -ldb"
AC_TRY_LINK(#define DB_LIBRARY_COMPATIBILITY_API 1
#include <db2/db_185.h>
const char *c1;
int i1;
int i2;
DBTYPE dbv1;
const void *vv;
, dbopen(c1, i1, i2, dbv1, vv); ,
[ echo " yes"; db_version="21" ],
[ echo " no"; AC_MSG_ERROR(library test link failed for db and/or compatibility API to version 1.85 not found... aborting) ]
)
fi
#
htg_ld_args_ht1="-lhtcobol"
#htg_ld_args_ht2="-lhtcobol2"
htg_ld_args_default=""
htg_ld_args_curses=""
htg_ld_args_db=""
htg_ld_args_readline="-lreadline"
htg_ld_args_dl="-ldl"
# Step 13: Define which header to use
#echo "DB library db_version state is ${db_version}"
if test "${db_version}" = "1" ; then
AC_DEFINE(USE_DB_1)
htg_ld_args_db="-ldb1"
fi
if test "${db_version}" = "2" ; then
AC_DEFINE(USE_DB_2)
htg_ld_args_db="-ldb2"
fi
if test "${db_version}" = "23" ; then
AC_DEFINE(USE_DB_23)
htg_ld_args_db="-ldb"
fi
if test "${db_version}" = "3" ; then
AC_DEFINE(USE_DB_3)
htg_ld_args_db="-ldb3"
fi
if test "${db_version}" = "4" ; then
AC_DEFINE(USE_DB_4)
htg_ld_args_db="-ldb-4"
fi
if test "${db_version}" = "32" ; then
AC_DEFINE(USE_DB_23)
htg_ld_args_db="-ldb3"
fi
if test "${db_version}" = "10" ; then
AC_DEFINE(USE_DB)
htg_ld_args_db="-ldb"
fi
if test "${db_version}" = "123" ; then
AC_DEFINE(USE_DB_234)
htg_ld_args_db="-ldb"
fi
if test "${db_version}" = "21" ; then
AC_DEFINE(USE_DB_2)
htg_ld_args_db="-ldb"
fi
if test "${db_version}" = "31" ; then
AC_DEFINE(USE_DB_3)
htg_ld_args_db="-ldb"
fi
if test "${db_version}" = "41" ; then
AC_DEFINE(USE_DB_41)
htg_ld_args_db="-ldb-4"
fi
# check for curses header and library
#
define_with_curses="no"
AC_CHECK_HEADERS(${curses_header},
,
[ AC_MSG_ERROR(header "${curses_header}" not found... aborting) ]
)
AC_CHECK_LIB(${curses_library}, addch,
define_with_curses="yes",
# M_LIBS="$M_LIBS",
AC_MSG_ERROR(curses library is required to create COBOL executable... aborting)
)
if test "${define_with_curses}" = "yes" ; then
M_LIBS="$M_LIBS"
AC_DEFINE(HAVE_LIBCURSES)
htg_ld_args_curses="-l${curses_library}"
fi
# Check for color_set function availability
curses_with_color_set="no"
if test "${define_with_curses}" = "yes" ; then
AC_MSG_CHECKING(for color_set in -l${curses_library})
LIBS="$LIBS_BK -l${curses_library}"
AC_TRY_LINK(#include <${curses_header}>
short si1;
void *vp;
, color_set(si1, vp); ,
[ AC_MSG_RESULT(yes); curses_with_color_set="yes" ],
[ AC_MSG_RESULT(no) ]
)
fi
#
if test "${curses_with_color_set}" = "yes" ; then
AC_DEFINE(CURSES_HAS_COLOR_SET)
fi
# Check for ltdl library availability
#
# if test "${use_ltdl_lib}" = "0" ; then
# echo "Setting RTS to use internal TC dynamic load routines "
# fi
# #
# if test "${use_ltdl_lib}" = "1" && test "${ltdl_header}" = "0" ; then
# echo "Header files for ltdl library not found... "
# echo "Defaulting RTS ... "
# use_ltdl_lib="0"
# fi
# #
# htg_ld_args_ltdl=""
# if test "${use_ltdl_lib}" = "1" ; then
# AC_CHECK_LIB(ltdl, lt_dlgetsearchpath,
# htg_ld_args_ltdl="-lltdl",
# AC_MSG_ERROR(Dynamic load library ltdl not found... aborting),
# )
# fi
# check for header and library for readline
define_with_readline="no"
AC_ARG_WITH(readline,
[ --with-readline use readline library ],
[ define_with_readline="yes" ]
)
if test "${define_with_readline}" = "yes" ; then
AC_CHECK_HEADERS(readline/readline.h)
AC_CHECK_LIB(readline, rl_tilde_expand,
htg_ld_args_readline="-lreadline",
AC_MSG_ERROR(readline library not found... aborting),
"-lncurses")
AC_DEFINE(HAVE_LIBREADLINE)
AC_DEFINE(WANT_READLINE)
fi
# if dynamic loading requested, check for header and library dl
define_with_dl="no"
AC_ARG_WITH(dl,
[ --with-dl use dynamic loader for RTS libraries ],
[ define_with_dl="yes" ],
)
if test "${define_with_dl}" = "yes" ; then
AC_CHECK_HEADERS(dlfcn.h)
AC_CHECK_LIB(dl, dlopen,
htg_ld_args_dl="-ldl",
AC_MSG_ERROR(dynamic loader not found... aborting)
)
AC_DEFINE(HAVE_LIBDL)
AC_DEFINE(WANT_DYNAMIC_LIBS)
fi
# Restore library paths
LIBS="$LIBS_BK"
# Set the default directories
# pre-processor (htcobolpp) and options file directory
#
cobdir_default=""
cobpp_dir=""
optfile_dir=""
cobcpy_default=""
#
# set default directories
#
# set variables for installing
#
cobdir_default='${prefix}/share/htcobol'
optfile_dir='${prefix}/share/htcobol'
cobpp_dir='${prefix}/share/htcobol'
cobcpy_default='${prefix}/share/htcobol/copybooks'
#
cobbin_default='${prefix}/bin'
coblib_default='${prefix}/lib'
#optfile_default='cobopt'
optfile_default='htcobolrc'
rtoptfile_default='htrtconf'
#
# set variables for config file
#
cobdir_default_config="${prefix}/share/htcobol"
cobbin_default_config="${prefix}/bin"
coblib_default_config="${prefix}/lib"
#
if test "${define_with_readline}" = "yes" ; then
#htg_ld_args_default="${htg_ld_args_ht1} ${htg_ld_args_ht2} ${htg_ld_args_readline} ${htg_ld_args_db} ${htg_ld_args_curses}"
htg_ld_args_default="${htg_ld_args_ht1} ${htg_ld_args_readline} ${htg_ld_args_db} ${htg_ld_args_curses}"
else
#fi
#if test "${define_with_readline}" = "no" ; then
#htg_ld_args_default="${htg_ld_args_ht1} ${htg_ld_args_ht2} ${htg_ld_args_db} ${htg_ld_args_curses}"
htg_ld_args_default="${htg_ld_args_ht1} ${htg_ld_args_db} ${htg_ld_args_curses}"
fi
#
htg_ld_args_default="${htg_ld_args_default} ${htg_ld_args_m}"
#htg_ld_args_default="${htg_ld_args_default} -lm"
#
#if test "${define_with_dl}" = "yes" ; then
#htg_ld_args_default="${htg_ld_args_default} $(htg_ld_args_m) ${htg_ld_args_dl}"
#fi
#
#if test "${define_with_dl}" = "no" ; then
#htg_ld_args_default="${htg_ld_args_default} $(htg_ld_args_m)"
#fi
#
#
AC_DEFINE(HAVE_LIBM)
AC_SUBST(LEX)
AC_SUBST(YACC)
AC_SUBST(INCLUDES)
AC_SUBST(CCXFLAGS)
AC_SUBST(ACXFLAGS)
AC_SUBST(exeext)
AC_SUBST(cobbin_default)
AC_SUBST(cobdir_default)
AC_SUBST(optfile_default)
AC_SUBST(rtoptfile_default)
AC_SUBST(cobcpy_default)
AC_SUBST(yacc_prefix_cobpp)
AC_SUBST(yacc_prefix_compiler)
AC_SUBST(TCOB_MAJOR_VERSION)
AC_SUBST(TCOB_MINOR_VERSION)
AC_SUBST(TCOB_PATCH_LEVEL)
AC_SUBST(TCOB_VERSION)
AC_SUBST(TCOB_RELEASE_DATE)
AC_SUBST(tcob_version)
AC_SUBST(host_os)
AC_SUBST(TCOBPP_MAJOR_VERSION)
AC_SUBST(TCOBPP_MINOR_VERSION)
AC_SUBST(TCOBPP_PATCH_LEVEL)
AC_SUBST(TCOBPP_VERSION)
AC_SUBST(TCOBPP_RELEASE_DATE)
AC_SUBST(tcobpp_version)
AC_SUBST(htg_ld_args_m)
AC_SUBST(htg_ld_args_db)
#AC_SUBST(htg_ld_args_ltdl)
AC_SUBST(asx_cmd)
AC_SUBST(ccx_cmd)
AC_SUBST(ranlibx_cmd)
AC_SUBST(arx_cmd)
#echo "debug 10a: with_lang=$with_lang, tcob_lang=$tcob_lang"
AC_SUBST(tcob_lang)
case "x$tcob_lang" in
xen) AC_DEFINE(TCOB_LANGUAGE_en)
AC_DEFINE(TCOBPP_LANGUAGE_en)
;;
xfr) AC_DEFINE(TCOB_LANGUAGE_fr)
AC_DEFINE(TCOBPP_LANGUAGE_fr)
;;
xit) AC_DEFINE(TCOB_LANGUAGE_it)
AC_DEFINE(TCOBPP_LANGUAGE_it)
;;
xpt_BR) AC_DEFINE(TCOB_LANGUAGE_pt_BR)
AC_DEFINE(TCOBPP_LANGUAGE_pt_BR)
;;
xes) AC_DEFINE(TCOB_LANGUAGE_es)
AC_DEFINE(TCOBPP_LANGUAGE_es)
;;
esac
#echo "debug 10b: with_lang=$with_lang, tcob_lang=$tcob_lang"
AC_DEFINE_UNQUOTED(TCOB_CCX_CMD, "${CC}")
AC_DEFINE_UNQUOTED(TCOB_ASX_CMD, "${AS}")
AC_DEFINE_UNQUOTED(COBDIR_DEFAULT, "${cobdir_default_config}")
AC_DEFINE_UNQUOTED(OPTFILE_DEFAULT, "${optfile_default}")
AC_DEFINE_UNQUOTED(RTOPTFILE_DEFAULT, "${rtoptfile_default}")
AC_DEFINE_UNQUOTED(COBBIN_DEFAULT, "${cobbin_default_config}")
AC_DEFINE_UNQUOTED(COBLIB_DEFAULT, "${coblib_default_config}")
AC_DEFINE_UNQUOTED(COBPP_EXPAND_CMD_PATH, "${expand_cmd_path}")
AC_DEFINE_UNQUOTED(HTG_LD_PATHS_DEFAULT, "-L/usr/lib -L${prefix}/lib -L../../lib")
AC_DEFINE_UNQUOTED(HTG_LD_ARGS_MATH, "$htg_ld_args_m")
AC_DEFINE_UNQUOTED(HTG_LD_ARGS_HT1, "$htg_ld_args_ht1")
#AC_DEFINE_UNQUOTED(HTG_LD_ARGS_HT2, "$htg_ld_args_ht2")
AC_DEFINE_UNQUOTED(HTG_LD_ARGS_DB, "$htg_ld_args_db")
AC_DEFINE_UNQUOTED(HTG_LD_ARGS_CURSES, "$htg_ld_args_curses")
AC_DEFINE_UNQUOTED(HTG_LD_ARGS_READLINE, "$htg_ld_args_readline")
AC_DEFINE_UNQUOTED(HTG_LD_ARGS_DL, "$htg_ld_args_dl")
#shared_lib_extension='.dll'
#need_underscode='yes'
#AC_DEFINE_UNQUOTED(LTDL_SHLIB_EXT, "$shared_lib_extension")
if test "${need_underscode}" = "yes" ; then
AC_DEFINE(NEED_USCORE)
fi
# if test "${use_ltdl_lib}" = "1" ; then
# AC_DEFINE(USE_LTDL_LIB)
# AC_DEFINE_UNQUOTED(HTG_LD_ARGS_LTDL, "$htg_ld_args_ltdl")
# fi
AC_DEFINE_UNQUOTED(HTG_LD_ARGS_DEFAULT, "$htg_ld_args_default")
AC_OUTPUT(Makefile compiler/Makefile compiler/htversion.h \
compiler/htcobolrc lib/Makefile cobrun/Makefile \
cobpp/Makefile cobpp/tcppversion.h \
utils/Makefile utils/cobf2f/Makefile test.code/Makefile \
test.code/copybooks/Makefile info/Makefile lockserver/Makefile)