#!/bin/sh
-AC_INIT(Makefile)
+AC_PREREQ(2.54)
+AC_INIT
+AC_CONFIG_SRCDIR([Makefile])
AC_CONFIG_HEADER(sdccconf.h:sdccconf_in.h)
AC_PROG_AWK
VERSIONHI=`echo $VERSION|$AWK 'BEGIN {FS="."} {print $1}'`
VERSIONLO=`echo $VERSION|$AWK 'BEGIN {FS="."} {print $2}'`
VERSIONP=`echo $VERSION|$AWK 'BEGIN {FS="."} {print $3}'`
-# Assume no special extension
-EXEEXT=`echo $EXEEXT`
AC_MSG_RESULT(${VERSION})
AC_SUBST(VERSION)
sdcc_cv_versionlo=$VERSIONLO
sdcc_cv_versionp=$VERSIONP
+
# Required programs
-#-------------------
+# ===========================================================================
AC_PROG_CC
AC_PROG_CXX
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_RANLIB
-AC_PROG_LEX(flex, :)
-AC_CHECK_PROG(YACC, bison, bison -y, :)
+AC_PROG_LEX
+AC_PROG_YACC
AC_CHECK_PROG(AUTOCONF, autoconf, autoconf, :)
AC_CHECK_PROG(STRIP, strip, strip, :)
AC_CHECK_PROG(AS, as, as, :)
AC_CHECK_PROG(CP, cp, cp, :)
-AC_DEFUN(SDCC_REQUIRE_PROG,
+AC_CHECK_PROG(LYX, lyx, lyx, :)
+AC_CHECK_PROG(LATEX, latex, latex, :)
+AC_CHECK_PROG(LATEX2HTML, latex2html, latex2html, :)
+AC_CHECK_PROG(PDFLATEX, pdflatex, pdflatex, :)
+AC_CHECK_PROG(DVIPDF, dvipdf, dvipdf, :)
+
+AC_DEFUN(SDCC_REQUIRE_PROG,
[if test "$1" = ":"; then
AC_MSG_ERROR([Cannot find required program $2.])
fi
SDCC_REQUIRE_PROG($YACC, bison)
SDCC_REQUIRE_PROG($LEX, lex)
-AC_LANG_C
+AC_LANG([C])
+
# Checking for header files.
# ===========================================================================
-AC_HEADER_STDC
-AC_CHECK_HEADERS(getopt.h)
-AC_CHECK_HEADERS(unistd.h)
-AC_CHECK_HEADERS(endian.h)
-AC_CHECK_HEADERS(machine/endian.h)
-AC_CHECK_HEADERS(malloc.h)
-AC_CHECK_HEADERS(sys/isa_defs.h)
AC_CHECK_HEADERS(sys/socket.h)
-AC_HEADER_DIRENT
-
-# This must be after CPP
-
-AC_CACHE_CHECK(which header file defines FD_ macros, s51_cv_fd,
-[sdcc_cv_fd="unknown"
-AC_EGREP_CPP(yes, [
-#include <sys/time.h>
-#ifdef FD_ZERO
-yes
-#endif], sdcc_cv_fd="<sys/time.h>")
-AC_EGREP_CPP(yes, [
-#include <sys/types.h>
-#ifdef FD_ZERO
-yes
-#endif], sdcc_cv_fd="<sys/types.h>")
-AC_EGREP_CPP(yes, [
-#include <sys/select.h>
-#ifdef FD_ZERO
-yes
-#endif], sdcc_cv_fd="<sys/types.h>")])
-
-AC_DEFINE(FD_HEADER_OK, 0)
-if echo $sdcc_cv_fd|grep time >/dev/null 2>&1; then
-AC_DEFINE(FD_NEED_TIME_H, 1)
-AC_DEFINE(FD_HEADER_OK, 1)
-else
-AC_DEFINE(FD_NEED_TIME_H, 0)
-fi
-if echo $sdcc_cv_fd|grep types >/dev/null 2>&1; then
-AC_DEFINE(FD_NEED_TYPES_H, 1)
-AC_DEFINE(FD_HEADER_OK, 1)
-else
-AC_DEFINE(FD_NEED_TYPES_H, 0)
-fi
-if echo $sdcc_cv_fd|grep select >/dev/null 2>&1; then
-AC_DEFINE(FD_NEED_SELECT_H, 1)
-AC_DEFINE(FD_HEADER_OK, 1)
-else
-AC_DEFINE(FD_NEED_SELECT_H, 0)
-fi
-
-AC_DEFINE_UNQUOTED(HEADER_FD, ${sdcc_cv_fd})
# Checking for functions
# ===========================================================================
-AC_CHECK_FUNCS(strlen strcpy strcat strstr strcmp strerror strtok strdup)
-AC_CHECK_FUNCS(strchr memcpy)
-dnl AC_CHECK_FUNCS(getline)
-dnl AC_CHECK_FUNCS(getdelim)
-AC_CHECK_FUNCS(fgets)
-AC_CHECK_FUNCS(yylex)
+AC_CHECK_FUNCS(strerror)
+AC_CHECK_FUNCS(vsnprintf snprintf vsprintf mkstemp)
-# check if -lsocket && -lxnet is required to compile socket stuff
-AC_SEARCH_LIBS(socket,socket)
-AC_SEARCH_LIBS(inet_addr,nsl xnet)
# Macro definitions
-###################
+# ===========================================================================
# DD_COPT macro checks if the compiler specified as the 1st parameter
# supports option specified as the 2nd parameter
rm -f _test_.* a.out)
])
+# This macro expands DIR and assigns it to RET.
+# If DIR is NONE, then it's replaced by DEFAULT.
+#
+# Based on AC_DEFINE_DIR
+#
+# Examples:
+#
+# AC_EXPAND(prefix, "/usr/local", expanded_prefix)
+
+AC_DEFUN([AC_EXPAND], [
+ test "x$prefix" = xNONE && prefix="$ac_default_prefix"
+ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+ ac_expand=[$]$1
+ test "x$ac_expand" = xNONE && ac_expand="[$]$2"
+ ac_expand=`eval echo [$]ac_expand`
+ $3=`eval echo [$]ac_expand`
+])
+
+# adl_NORMALIZE_PATH
+#
+# - empty paths are changed to '.'
+# - trailing slashes are removed
+# - repeated slashes are squeezed except a leading doubled slash '//'
+# (which might indicate a networked disk on some OS).
+#
+#
+# REFERENCE_STRING is used to turn '/' into '\' and vice-versa: if
+# REFERENCE_STRING contains some backslashes, all slashes and backslashes
+# are turned into backslashes, otherwise they are all turned into slashes.
+#
+# This makes processing of DOS filenames quite easier, because you can turn a
+# filename to the Unix notation, make your processing, and turn it back to
+# original notation.
+
+dnl Available from the GNU Autoconf Macro Archive at:
+dnl http://www.gnu.org/software/ac-archive/htmldoc/normpath.html
+dnl
+AC_DEFUN([adl_NORMALIZE_PATH],
+[case ":[$]$1:" in
+# change empty paths to '.'
+ ::) $1='.' ;;
+# strip trailing slashes
+ :*[[\\/]]:) $1=`echo "[$]$1" | sed 's,[[\\/]]*[$],,'` ;;
+ :*:) ;;
+esac
+# squeze repeated slashes
+case ifelse($2,,"[$]$1",$2) in
+# if the path contains any backslashes, turn slashes into backslashes
+
+# Bernhard Held 2003-04-06
+# This was the original line. It doesn't:
+# - convert the first slash
+# - replace a slash with a double-backslash
+# *\\*) $1=`echo "[$]$1" | sed 's,\(.\)[[\\/]][[\\/]]*,\1\\\\,g'` ;;
+ *\\*) $1=`echo "[$]$1" | sed 's,\(.\)[[\\/]][[\\/]]*,\1\\\\\\\\,g' | sed 's,^[[\\/]],\\\\\\\\,'` ;;
+
+# if the path contains slashes, also turn backslashes into slashes
+ *) $1=`echo "[$]$1" | sed 's,\(.\)[[\\/]][[\\/]]*,\1/,g'` ;;
+esac])
+
+
+# adl_COMPUTE_RELATIVE_PATH
+#
+# PATH_LIST is a space-separated list of colon-separated triplets of the form
+# 'FROM:TO:RESULT'. This function iterates over these triplets and set $RESULT
+# to the relative path from $FROM to $TO. Note that $FROM and $TO needs to be
+# absolute filenames for this macro to success.
+
+AC_DEFUN([adl_COMPUTE_RELATIVE_PATHS],
+[for _lcl_i in $1; do
+ _lcl_from=\[$]`echo "[$]_lcl_i" | sed 's,:.*$,,'`
+ _lcl_to=\[$]`echo "[$]_lcl_i" | sed 's,^[[^:]]*:,,' | sed 's,:[[^:]]*$,,'`
+ _lcl_result_var=`echo "[$]_lcl_i" | sed 's,^.*:,,'`
+ adl_RECURSIVE_EVAL([[$]_lcl_from], [_lcl_from])
+ adl_RECURSIVE_EVAL([[$]_lcl_to], [_lcl_to])
+ _lcl_notation="$_lcl_from$_lcl_to"
+ adl_NORMALIZE_PATH([_lcl_from],['/'])
+ adl_NORMALIZE_PATH([_lcl_to],['/'])
+ adl_COMPUTE_RELATIVE_PATH([_lcl_from], [_lcl_to], [_lcl_result_tmp])
+ adl_NORMALIZE_PATH([_lcl_result_tmp],["[$]_lcl_notation"])
+ eval $_lcl_result_var='[$]_lcl_result_tmp'
+done])
+
+## Note:
+## *****
+## The following helper macros are too fragile to be used out
+## of adl_COMPUTE_RELATIVE_PATHS (mainly because they assume that
+## paths are normalized), that's why I'm keeping them in the same file.
+## Still, some of them maybe worth to reuse.
+
+dnl adl_COMPUTE_RELATIVE_PATH(FROM, TO, RESULT)
+dnl ===========================================
+dnl Compute the relative path to go from $FROM to $TO and set the value
+dnl of $RESULT to that value. This function work on raw filenames
+dnl (for instead it will considerate /usr//local and /usr/local as
+dnl two distinct paths), you should really use adl_COMPUTE_REALTIVE_PATHS
+dnl instead to have the paths sanitized automatically.
+dnl
+dnl For instance:
+dnl first_dir=/somewhere/on/my/disk/bin
+dnl second_dir=/somewhere/on/another/disk/share
+dnl adl_COMPUTE_RELATIVE_PATH(first_dir, second_dir, first_to_second)
+dnl will set $first_to_second to '../../../another/disk/share'.
+AC_DEFUN([adl_COMPUTE_RELATIVE_PATH],
+[adl_COMPUTE_COMMON_PATH([$1], [$2], [_lcl_common_prefix])
+adl_COMPUTE_BACK_PATH([$1], [_lcl_common_prefix], [_lcl_first_rel])
+adl_COMPUTE_SUFFIX_PATH([$2], [_lcl_common_prefix], [_lcl_second_suffix])
+$3="[$]_lcl_first_rel[$]_lcl_second_suffix"])
+
+dnl adl_COMPUTE_COMMON_PATH(LEFT, RIGHT, RESULT)
+dnl ============================================
+dnl Compute the common path to $LEFT and $RIGHT and set the result to $RESULT.
+dnl
+dnl For instance:
+dnl first_path=/somewhere/on/my/disk/bin
+dnl second_path=/somewhere/on/another/disk/share
+dnl adl_COMPUTE_COMMON_PATH(first_path, second_path, common_path)
+dnl will set $common_path to '/somewhere/on'.
+AC_DEFUN([adl_COMPUTE_COMMON_PATH],
+[$3=''
+_lcl_second_prefix_match=''
+while test "[$]_lcl_second_prefix_match" != 0; do
+ _lcl_first_prefix=`expr "x[$]$1" : "x\([$]$3/*[[^/]]*\)"`
+ _lcl_second_prefix_match=`expr "x[$]$2" : "x[$]_lcl_first_prefix"`
+ if test "[$]_lcl_second_prefix_match" != 0; then
+ if test "[$]_lcl_first_prefix" != "[$]$3"; then
+ $3="[$]_lcl_first_prefix"
+ else
+ _lcl_second_prefix_match=0
+ fi
+ fi
+done])
+
+dnl adl_COMPUTE_SUFFIX_PATH(PATH, SUBPATH, RESULT)
+dnl ==============================================
+dnl Substrack $SUBPATH from $PATH, and set the resulting suffix
+dnl (or the empty string if $SUBPATH is not a subpath of $PATH)
+dnl to $RESULT.
+dnl
+dnl For instace:
+dnl first_path=/somewhere/on/my/disk/bin
+dnl second_path=/somewhere/on
+dnl adl_COMPUTE_SUFFIX_PATH(first_path, second_path, common_path)
+dnl will set $common_path to '/my/disk/bin'.
+AC_DEFUN([adl_COMPUTE_SUFFIX_PATH],
+[$3=`expr "x[$]$1" : "x[$]$2/*\(.*\)"`])
+
+dnl adl_COMPUTE_BACK_PATH(PATH, SUBPATH, RESULT)
+dnl ============================================
+dnl Compute the relative path to go from $PATH to $SUBPATH, knowing that
+dnl $SUBPATH is a subpath of $PATH (any other words, only repeated '../'
+dnl should be needed to move from $PATH to $SUBPATH) and set the value
+dnl of $RESULT to that value. If $SUBPATH is not a subpath of PATH,
+dnl set $RESULT to the empty string.
+dnl
+dnl For instance:
+dnl first_path=/somewhere/on/my/disk/bin
+dnl second_path=/somewhere/on
+dnl adl_COMPUTE_BACK_PATH(first_path, second_path, back_path)
+dnl will set $back_path to '../../../'.
+AC_DEFUN([adl_COMPUTE_BACK_PATH],
+[adl_COMPUTE_SUFFIX_PATH([$1], [$2], [_lcl_first_suffix])
+$3=''
+_lcl_tmp='xxx'
+while test "[$]_lcl_tmp" != ''; do
+ _lcl_tmp=`expr "x[$]_lcl_first_suffix" : "x[[^/]]*/*\(.*\)"`
+ if test "[$]_lcl_first_suffix" != ''; then
+ _lcl_first_suffix="[$]_lcl_tmp"
+ $3="../[$]$3"
+ fi
+done])
+
+
+dnl adl_RECURSIVE_EVAL(VALUE, RESULT)
+dnl =================================
+dnl Interpolate the VALUE in loop until it doesn't change,
+dnl and set the result to $RESULT.
+dnl WARNING: It's easy to get an infinite loop with some unsane input.
+AC_DEFUN([adl_RECURSIVE_EVAL],
+[_lcl_receval="$1"
+$2=`(test "x$prefix" = xNONE && prefix="$ac_default_prefix"
+ test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
+ _lcl_receval_old=''
+ while test "[$]_lcl_receval_old" != "[$]_lcl_receval"; do
+ _lcl_receval_old="[$]_lcl_receval"
+ eval _lcl_receval="\"[$]_lcl_receval\""
+ done
+ echo "[$]_lcl_receval")`])
+
+
+# AC_NORMALIZE_DEFINE_UNQUOTED(var, DEFINE, REFERENCE_STRING)
+
+AC_DEFUN([AC_NORMALIZE_DEFINE_UNQUOTED], [
+ ac_ndu=[$]$1
+ adl_NORMALIZE_PATH([ac_ndu], [$]$3)
+ AC_DEFINE_UNQUOTED($2, "${ac_ndu}")
+])
+
# Checking characteristics of compilers and other programs
-# --------------------------------------------------------
+# ===========================================================================
AC_CACHE_CHECK(whether preprocessor accepts -MM or -M,sdcc_cv_MM,
echo "#include <stdio.h>" >_test_.c
echo "" >>_test_.c
# This is the first time when CFLAGS are set/modified!!
DD_COPT(CC, ggdb)
if test "$sdcc_cv_CCggdb" = "yes"; then
- CFLAGS="-ggdb -O2"
+ CFLAGS="-ggdb ${CFLAGS}"
fi
DD_COPT(CC, pipe)
if test "$sdcc_cv_CCpipe" = "yes"; then
- CFLAGS="$CFLAGS -pipe"
+ CFLAGS="-pipe $CFLAGS"
fi
# ===========================================================================
AC_TYPE_SIGNAL
+AC_CHECK_SIZEOF(char)
+AC_CHECK_SIZEOF(short)
+AC_CHECK_SIZEOF(int)
+AC_CHECK_SIZEOF(long)
+
+type_name()
+{
+ if expr "$ac_cv_sizeof_char" '>=' "$1" >/dev/null; then
+ echo "char"
+ exit
+ fi
+ if expr "$ac_cv_sizeof_short" '>=' "$1" >/dev/null; then
+ echo "short"
+ exit
+ fi
+ if expr "$ac_cv_sizeof_int" '>=' "$1" >/dev/null; then
+ echo "int"
+ exit
+ fi
+ if expr "$ac_cv_sizeof_long" '>=' "$1" >/dev/null; then
+ echo "long"
+ exit
+ fi
+ echo "long"
+}
+
+AC_MSG_CHECKING(type name for byte)
+TYPE_BYTE=`type_name 1`
+AC_MSG_RESULT($TYPE_BYTE)
+AC_MSG_CHECKING(type name for word)
+TYPE_WORD=`type_name 2`
+AC_MSG_RESULT($TYPE_WORD)
+AC_MSG_CHECKING(type name for dword)
+TYPE_DWORD=`type_name 4`
+AC_MSG_RESULT($TYPE_DWORD)
+AC_DEFINE_UNQUOTED(TYPE_BYTE, $TYPE_BYTE)
+AC_DEFINE_UNQUOTED(TYPE_WORD, $TYPE_WORD)
+AC_DEFINE_UNQUOTED(TYPE_DWORD, $TYPE_DWORD)
+
+AC_C_BIGENDIAN
+
+# Set standard installation paths
+# ===========================================================================
+
+# In the Makefiles we need paths with '/' as directory separator, even if
+# crosscompiling for Win32.
+# And we want to preserve the macros (e.g. ${prefix}) in the Makefiles.
+# The variables in the Makefiles are replaced by AC_SUBST()
#
+# In sdccconf.h the '/' in paths can be replaced by "\\" (normalized), if
#
-if test "${prefix}" = "NONE"; then
- prefix="/usr/local"
+# The macros are expanded for the header.
+# The variables in the header are replaced by AC_*DEFINE*()
+# sdccconf_h_dir_separator contains a backslash.
+AC_ARG_VAR(sdccconf_h_dir_separator, needed in sdccconf.h: either "/" (default) or "\\")
+if test "${sdccconf_h_dir_separator}" = ""; then
+ sdccconf_h_dir_separator="/"
fi
-config_in=`pwd`
-sdcc_datadir=${datadir}/sdcc
-AC_SUBST(sdcc_datadir)
-
-# For some unknown reason, putting this assignment in a subshell
-# like this causes the rvalue to be fully substituted. We need this
-# for the defines below to generate the right thing. We keep this
-# separate from the substituted sdcc_datadir because we want the
-# latter for makefiles.
-if test "${datadir}" = "\${prefix}/share"; then
- sdcc_datadir_tmp=${prefix}/share/sdcc
-else
- sdcc_datadir_tmp=${datadir}/sdcc
+# Makefiles
+###########
+
+# include_dir_suffix:
+# *nix default: "sdcc/include"
+
+AC_ARG_VAR(include_dir_suffix, appended to datadir to define SDCC's include directory)
+if test "${include_dir_suffix}" = ""; then
+ include_dir_suffix="sdcc/include"
+fi
+AC_SUBST(include_dir_suffix)
+
+# lib_dir_suffix:
+# *nix default: "sdcc/lib"
+AC_ARG_VAR(lib_dir_suffix, appended to datadir to define SDCC's library root directory)
+if test "${lib_dir_suffix}" = ""; then
+ lib_dir_suffix="sdcc/lib"
fi
+AC_SUBST(lib_dir_suffix)
+# docdir:
+# *nix default: "${datadir}/sdcc/doc"
+AC_ARG_VAR(docdir, documentation installation directory)
+if test "${docdir}" = ""; then
+ docdir="\${datadir}"/sdcc/doc
+fi
+AC_SUBST(docdir)
+
+AC_SUBST(EXEEXT)
+
+# sdccconf.h
+############
+
+AC_DEFINE_UNQUOTED(DIR_SEPARATOR_STRING, "${sdccconf_h_dir_separator}")
+AC_DEFINE_UNQUOTED(DIR_SEPARATOR_CHAR , '${sdccconf_h_dir_separator}')
+
+# prefix:
+# default: "NONE", ${ac_default_prefix}: "/usr/local"
+AC_EXPAND(prefix, ac_default_prefix, expanded_prefix)
+AC_NORMALIZE_DEFINE_UNQUOTED(expanded_prefix, PREFIX, sdccconf_h_dir_separator)
+
+# exec_prefix:
+# default: "${prefix}"
+AC_EXPAND(exec_prefix, expanded_prefix, expanded_exec_prefix)
+AC_NORMALIZE_DEFINE_UNQUOTED(expanded_exec_prefix, EXEC_PREFIX, sdccconf_h_dir_separator)
+
+# bindir:
+# default: "${exec_prefix}/bin"
+AC_EXPAND(bindir, "NONE", expanded_bindir)
+AC_NORMALIZE_DEFINE_UNQUOTED(expanded_bindir, BINDIR, sdccconf_h_dir_separator)
+
+# datadir:
+# default: "${prefix}/share"
+AC_EXPAND(datadir, "NONE", expanded_datadir)
+AC_NORMALIZE_DEFINE_UNQUOTED(expanded_datadir, DATADIR, sdccconf_h_dir_separator)
+
+# include/lib suffix
+norm_inc_dir_suffix=${include_dir_suffix}
+adl_NORMALIZE_PATH([norm_inc_dir_suffix], [$sdccconf_h_dir_separator])
+AC_DEFINE_UNQUOTED(INCLUDE_DIR_SUFFIX,
+ DIR_SEPARATOR_STRING "${norm_inc_dir_suffix}")
+norm_lib_dir_suffix=${lib_dir_suffix}
+adl_NORMALIZE_PATH([norm_lib_dir_suffix], [$sdccconf_h_dir_separator])
+AC_DEFINE_UNQUOTED(LIB_DIR_SUFFIX,
+ DIR_SEPARATOR_STRING "${norm_lib_dir_suffix}")
+
+# relative paths
+adl_COMPUTE_RELATIVE_PATHS([expanded_bindir:expanded_datadir:bin2data_dir])
+adl_NORMALIZE_PATH(bin2data_dir, [$sdccconf_h_dir_separator])
+AC_DEFINE_UNQUOTED(BIN2DATA_DIR,
+ DIR_SEPARATOR_STRING "${bin2data_dir}")
+
+adl_COMPUTE_RELATIVE_PATHS([expanded_prefix:expanded_bindir:prefix2bin_dir])
+adl_NORMALIZE_PATH(prefix2bin_dir, [$sdccconf_h_dir_separator])
+AC_DEFINE_UNQUOTED(PREFIX2BIN_DIR,
+ DIR_SEPARATOR_STRING "${prefix2bin_dir}")
+
+adl_COMPUTE_RELATIVE_PATHS([expanded_prefix:expanded_datadir:prefix2data_dir])
+adl_NORMALIZE_PATH(prefix2data_dir, [$sdccconf_h_dir_separator])
+if test "${prefix2data_dir}" = "."; then
+ # small optimization for Mingw32; otherwise Borut will complain ;-)
+ AC_DEFINE_UNQUOTED(PREFIX2DATA_DIR, "")
+else
+ AC_DEFINE_UNQUOTED(PREFIX2DATA_DIR,
+ DIR_SEPARATOR_STRING "${prefix2data_dir}")
+fi
-AC_DEFINE_UNQUOTED(STANDARD_INCLUDE_DIR, "${sdcc_datadir_tmp}/include")
-AC_DEFINE_UNQUOTED(SDCC_INCLUDE_DIR, "${sdcc_datadir_tmp}/include")
-AC_DEFINE_UNQUOTED(SDCC_LIB_DIR, "${sdcc_datadir_tmp}/lib")
-AC_DEFINE_UNQUOTED(STD_LIB, "libsdcc")
-AC_DEFINE_UNQUOTED(STD_INT_LIB, "libint")
-AC_DEFINE_UNQUOTED(STD_LONG_LIB, "liblong")
-AC_DEFINE_UNQUOTED(STD_FP_LIB, "libfloat")
+# standard libs
+AC_DEFINE_UNQUOTED(STD_LIB, "libsdcc")
+AC_DEFINE_UNQUOTED(STD_INT_LIB, "libint")
+AC_DEFINE_UNQUOTED(STD_LONG_LIB, "liblong")
+AC_DEFINE_UNQUOTED(STD_FP_LIB, "libfloat")
AC_DEFINE_UNQUOTED(STD_DS390_LIB, "libds390")
-AC_DEFINE_UNQUOTED(STD_xa51_LIB, "xa51")
+AC_DEFINE_UNQUOTED(STD_DS400_LIB, "libds400")
+AC_DEFINE_UNQUOTED(STD_XA51_LIB, "libxa51")
-AC_DEFINE_UNQUOTED(PREFIX, "${prefix}")
-AC_DEFINE_UNQUOTED(DATADIR, "${sdcc_datadir_tmp}")
-AC_DEFINE_UNQUOTED(SRCDIR, "${config_in}")
+# SDCC runtime environment variables
+sdcc_dir_name="SDCC_HOME"
+AC_DEFINE_UNQUOTED(SDCC_DIR_NAME, "${sdcc_dir_name}")
+sdcc_include_name="SDCC_INCLUDE"
+AC_DEFINE_UNQUOTED(SDCC_INCLUDE_NAME, "${sdcc_include_name}")
+sdcc_lib_name="SDCC_LIB"
+AC_DEFINE_UNQUOTED(SDCC_LIB_NAME, "${sdcc_lib_name}")
# Now handle the port selection
+# ===========================================================================
rm -f ports.all ports.build
-AC_ARG_ENABLE(mcs51-port,[ --disable-mcs51-port Excludes the Intel mcs51 port])
+AC_ARG_ENABLE(mcs51-port,
+ AC_HELP_STRING([--disable-mcs51-port],
+ [Excludes the Intel mcs51 port]))
echo mcs51 >>ports.all
if test "$enable_mcs51_port" = "no"; then
AC_DEFINE_UNQUOTED(OPT_DISABLE_MCS51, 1)
AC_DEFINE_UNQUOTED(OPT_DISABLE_MCS51, 0)
fi
-AC_ARG_ENABLE(gbz80-port,[ --disable-gbz80-port Excludes the Gameboy gbz80 port])
+AC_ARG_ENABLE(gbz80-port,
+ AC_HELP_STRING([--disable-gbz80-port],
+ [Excludes the Gameboy gbz80 port]))
echo z80 >>ports.all
if test "$enable_gbz80_port" = "no"; then
AC_DEFINE_UNQUOTED(OPT_DISABLE_GBZ80, 1)
AC_DEFINE_UNQUOTED(OPT_DISABLE_GBZ80, 0)
fi
-AC_ARG_ENABLE(z80-port,[ --disable-z80-port Excludes the z80 port])
+AC_ARG_ENABLE(z80-port,
+ AC_HELP_STRING([--disable-z80-port],
+ [Excludes the z80 port]))
echo z80 >>ports.all
if test "$enable_z80_port" = "no"; then
AC_DEFINE_UNQUOTED(OPT_DISABLE_Z80, 1)
AC_DEFINE_UNQUOTED(OPT_DISABLE_Z80, 0)
fi
-AC_ARG_ENABLE(avr-port,[ --disable-avr-port Excludes the AVR port])
+AC_ARG_ENABLE(avr-port,
+ AC_HELP_STRING([--disable-avr-port],
+ [Excludes the AVR port]))
echo avr >>ports.all
if test "$enable_avr_port" = "no"; then
AC_DEFINE_UNQUOTED(OPT_DISABLE_AVR, 1)
AC_DEFINE_UNQUOTED(OPT_DISABLE_AVR, 0)
fi
-AC_ARG_ENABLE(ds390-port,[ --disable-ds390-port Excludes the DS390 port])
+AC_ARG_ENABLE(ds390-port,
+ AC_HELP_STRING([--disable-ds390-port],
+ [Excludes the DS390 port]))
echo ds390 >>ports.all
if test "$enable_ds390_port" = "no"; then
AC_DEFINE_UNQUOTED(OPT_DISABLE_DS390, 1)
+ AC_DEFINE_UNQUOTED(OPT_DISABLE_TININative, 1)
else
echo ds390 >>ports.build
AC_DEFINE_UNQUOTED(OPT_DISABLE_DS390, 0)
+ AC_DEFINE_UNQUOTED(OPT_DISABLE_TININative, 0)
+fi
+
+AC_ARG_ENABLE(ds400-port,
+ AC_HELP_STRING([--disable-ds400-port],
+ [Excludes the DS400 port]))
+echo ds400 >>ports.all
+if test "$enable_ds400_port" = "no"; then
+ AC_DEFINE_UNQUOTED(OPT_DISABLE_DS400, 1)
+else
+ echo ds400 >>ports.build
+ AC_DEFINE_UNQUOTED(OPT_DISABLE_DS400, 0)
fi
-AC_ARG_ENABLE(pic-port,[ --disable-pic-port Excludes the PIC port])
+AC_ARG_ENABLE(pic-port,
+ AC_HELP_STRING([--disable-pic-port],
+ [Excludes the PIC port]))
echo pic >>ports.all
if test "$enable_pic_port" = "no"; then
AC_DEFINE_UNQUOTED(OPT_DISABLE_PIC, 1)
AC_DEFINE_UNQUOTED(OPT_DISABLE_PIC, 0)
fi
-AC_ARG_ENABLE(i186-port,[ --disable-i186-port Excludes the I186 port])
-echo izt >>ports.all
-if test "$enable_i186_port" = "no"; then
- AC_DEFINE_UNQUOTED(OPT_DISABLE_I186, 1)
-else
- echo izt >>ports.build
- AC_DEFINE_UNQUOTED(OPT_DISABLE_I186, 0)
-fi
-
-AC_ARG_ENABLE(tlcs900h-port,[ --disable-tlcs900h-port Excludes the TLCS900H port])
-echo izt >>ports.all
-if test "$enable_tlcs900h_port" = "no"; then
- AC_DEFINE_UNQUOTED(OPT_DISABLE_TLCS900H, 1)
-else
- echo izt >>ports.build
- AC_DEFINE_UNQUOTED(OPT_DISABLE_TLCS900H, 0)
-fi
-
-AC_ARG_ENABLE(xa51-port,[ --disable-xa51-port Excludes the XA51 port])
+AC_ARG_ENABLE(xa51-port,
+ AC_HELP_STRING([--disable-xa51-port],
+ [Excludes the XA51 port]))
echo xa51 >>ports.all
if test "$enable_xa51_port" = "no"; then
AC_DEFINE_UNQUOTED(OPT_DISABLE_XA51, 1)
AC_DEFINE_UNQUOTED(OPT_DISABLE_XA51, 0)
fi
-AC_ARG_ENABLE(ucsim,[ --disable-ucsim Disables configuring and building of ucsim])
+AC_ARG_ENABLE(ucsim,
+ AC_HELP_STRING([--disable-ucsim],
+ [Disables configuring and building of ucsim]))
OPT_ENABLE_UCSIM=$enable_ucsim
AC_SUBST(OPT_ENABLE_UCSIM)
-AC_ARG_ENABLE(device-lib-build,[ --disable-device-lib-build Disables automatically building device libraries])
+AC_ARG_ENABLE(device-lib-build,
+ AC_HELP_STRING([--disable-device-lib-build],
+ [Disables automatically building device libraries]))
OPT_ENABLE_DEVICE_LIB_BUILD=$enable_device_lib_build
AC_SUBST(OPT_ENABLE_DEVICE_LIB_BUILD)
-AC_ARG_ENABLE(packihx,[ --disable-packihx Disables building packihx])
+AC_ARG_ENABLE(packihx,
+ AC_HELP_STRING([--disable-packihx],
+ [Disables building packihx]))
OPT_ENABLE_PACKIHX=$enable_packihx
AC_SUBST(OPT_ENABLE_PACKIHX)
-AC_ARG_ENABLE(libgc,[ --enable-libgc Use the Bohem memory allocator. Lower runtime footprint.])
+AC_ARG_ENABLE(libgc,
+ AC_HELP_STRING([--enable-libgc],
+ [Use the Bohem memory allocator. Lower runtime footprint.]))
if test "$enable_libgc" = "yes"; then
AC_CHECK_LIB(gc, GC_malloc)
OPT_ENABLE_LIBGC=1
AC_DEFINE_UNQUOTED(OPT_ENABLE_LIBGC, $OPT_ENABLE_LIBGC)
#remove duplicates
-cat ports.all | uniq >ports
+uniq ports.all ports
mv ports ports.all
-cat ports.build | uniq >ports
+uniq ports.build ports
mv ports ports.build
# Generating output files
AC_CONFIG_SUBDIRS(support/cpp2)
AC_CONFIG_SUBDIRS(packihx)
AC_CONFIG_SUBDIRS(sim/ucsim)
-# MLH: removed as the rules are already in Makefile.common
-#as/z80/Makefile
-#link/z80/Makefile
-AC_OUTPUT(main.mk:main_in.mk
+AC_CONFIG_FILES([main.mk:main_in.mk
src/Makefile
as/mcs51/Makefile
device/include/Makefile
device/lib/Makefile
debugger/mcs51/Makefile
Makefile.common:Makefile.common.in
-)
+])
+AC_OUTPUT
# End of configure/configure.in