dnl
dnl Process this file with autoconf to produce a configure script.
dnl ie autoconf configur.in > configur
dnl
dnl The generated configur script is used by "clients" of Rexx/Wrapper
dnl when wrapping a Rexx program
dnl
AC_INIT(intbuild.c)

dnl Checks for system first
AC_CANONICAL_SYSTEM

dnl ---------------------- check for REXX argument -----------------
dnl allow --with-rexx for Rexx support
AC_ARG_WITH(rexx,
	[  --with-rexx=int         specify Rexx interpeter (rexxtrans|regina|rexximc|objrexx|unirexx|rexx6000)],
	[with_rexx=$withval],
	[with_rexx=no],
)
CHECK_REXX

dnl ---------------------- check for C compiler -----------------
dnl Checks for one of the C compilers below - change if yours not there.
CC_LIST="gcc cc c89 acc"
MH_PROG_CC

AC_CONFIG_HEADER(config.h)
AC_ISC_POSIX

dnl ---------------------- check packages -----------------------

on_qnx=no

SHL="so"
case "$target" in
	*hp-hpux9*)
		SYS_DEFS="-D_HPUX_SOURCE"
		SHL="sl"
		;;
	*hp-hpux1*)
		SYS_DEFS="-D_HPUX_SOURCE"
		SHL="sl"
		;;
	*ibm-aix3*)
		SYS_DEFS="-DAIX -D_ALL_SOURCE"
		SHL="a"
		;;
	*ibm-aix4*)
		SYS_DEFS="-DAIX -D_ALL_SOURCE"
		SHL="a"
		;;
	*dec-osf*)
		DYNLD="ld"
		;;
	*sequent-dynix*)
		;;
	*solaris*)
		;;
	sparc*sunos*)
		;;
	*linux*)
		;;
	*pc-sco3.2*)
		SYS_DEFS="-b elf"
		;;
	*qnx*)
		on_qnx=yes
		SYS_DEFS="-Q"
		;;
esac

dnl Check for libraries - don't include libfl or libl
MH_LIBS_TO_CHECK="dld m dl socket nls nsl_s thread rpc"
MH_CHECK_LIB(${MH_LIBS_TO_CHECK})

if test "$with_tokenized" = yes; then
	AC_DEFINE(USE_TOKENIZED)
fi

AC_SUBST(SYS_DEFS)
AC_SUBST(MH_EXTRA_LIBS)

AC_PROG_GCC_TRADITIONAL

dnl --------------------- Check for other programs. ---------------
AC_PROG_LN_S
AC_PROG_MAKE_SET

dnl -------------------- Checks for header files. -----------------
AC_HEADER_STDC
AC_CHECK_HEADERS( \
	ctype.h \
	dirent.h \
	malloc.h \
	io.h \
	sys/types.h \
	sys/stat.h \
	unistd.h \
	stdlib.h \
	stdarg.h \
	string.h \
	errno.h \
	getopt.h \
	assert.h \
	stat.h \
	time.h \
	)

MH_HAVE_PROTO

dnl Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_TIME
MH_CHECK_CC_O

dnl Checks for library functions.
AC_FUNC_MEMCMP
AC_CHECK_FUNCS(memcpy random readlink)

dnl --------------- Force definition of pre-compiler macro UNIX ----------
AC_DEFINE(UNIX)

AC_OUTPUT(defined_values)
