5 AC_CONFIG_SRCDIR([Makefile.in])
6 AC_CONFIG_HEADER(sdccconf.h:sdccconf_in.h)
10 AC_MSG_CHECKING(version of the package)
11 if test -f ${srcdir}/.version; then
12 { read VERSION; } < ${srcdir}/.version
13 AC_MSG_RESULT($VERSION)
14 elif test -f ../.version; then
15 { read VERSION; } < ../.version
16 AC_MSG_RESULT($VERSION)
19 AC_MSG_RESULT(unknown using 0.0.0)
21 VERSIONHI=`echo $VERSION|$AWK 'BEGIN {FS="."} {print $1}'`
22 VERSIONLO=`echo $VERSION|$AWK 'BEGIN {FS="."} {print $2}'`
23 VERSIONP=`echo $VERSION|$AWK 'BEGIN {FS="."} {print $3}'`
25 AC_MSG_RESULT(${VERSION})
26 AC_SUBST(PACKAGE, [sdcc])
31 AC_DEFINE_UNQUOTED(SDCC_VERSION_LO, ${VERSIONLO})
32 AC_DEFINE_UNQUOTED(SDCC_VERSION_HI, ${VERSIONHI})
33 AC_DEFINE_UNQUOTED(SDCC_VERSION_P, ${VERSIONP})
34 AC_DEFINE_UNQUOTED(SDCC_VERSION_STR, "${VERSION}")
36 sdcc_cv_version=$VERSION
37 sdcc_cv_versionhi=$VERSIONHI
38 sdcc_cv_versionlo=$VERSIONLO
39 sdcc_cv_versionp=$VERSIONP
43 # ===========================================================================
48 AC_CHECK_PROG(AUTOCONF, autoconf, autoconf, :)
49 AC_CHECK_PROG(STRIP, strip, strip, :)
50 AC_CHECK_PROG(AS, as, as, :)
51 AC_CHECK_PROG(CP, cp, cp, :)
53 dnl Don't use AC_PROG_LEX
54 dnl LEXLIB is not useful in gcc.
55 AC_CHECK_PROGS(LEX, flex lex, :)
57 dnl Don't use AC_PROG_YACC
58 AC_CHECK_PROGS(YACC, 'bison -y' byacc yacc, :)
60 AC_DEFUN([SDCC_REQUIRE_PROG],
61 [if test "$1" = ":"; then
62 AC_MSG_ERROR([Cannot find required program $2.])
66 SDCC_REQUIRE_PROG($YACC, bison)
67 SDCC_REQUIRE_PROG($LEX, flex)
72 # Checking for functions
73 # ===========================================================================
74 AC_CHECK_FUNCS(strerror)
75 AC_CHECK_FUNCS(vsnprintf snprintf vsprintf mkstemp)
79 # ===========================================================================
81 # adl_DD_COPT macro checks if the compiler specified as the 1st parameter
82 # supports option specified as the 2nd parameter
83 # For example: DD_CPORT(CXX, fPIC)
85 AC_DEFUN([adl_DD_COPT], [
86 AC_CACHE_CHECK(whether $$1 accepts -$2,sdcc_cv_$1$2,
91 $$1 -v -$2 -c _test_.c 1>&5 2>&5
92 if test "$?" = "0"; then
100 # This macro expands DIR and assigns it to RET.
101 # If DIR is NONE, then it's replaced by DEFAULT.
103 # Based on AC_DEFINE_DIR
107 # adl_EXPAND(prefix, "/usr/local", expanded_prefix)
109 AC_DEFUN([adl_EXPAND], [
110 test "x$prefix" = xNONE && prefix="$ac_default_prefix"
111 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
113 test "x$ac_expand" = xNONE && ac_expand="[$]$2"
114 ac_expand=`eval echo [$]ac_expand`
115 $3=`eval echo [$]ac_expand`
120 # - empty paths are changed to '.'
121 # - trailing slashes are removed
122 # - repeated slashes are squeezed except a leading doubled slash '//'
123 # (which might indicate a networked disk on some OS).
126 # REFERENCE_STRING is used to turn '/' into '\' and vice-versa: if
127 # REFERENCE_STRING contains some backslashes, all slashes and backslashes
128 # are turned into backslashes, otherwise they are all turned into slashes.
130 # This makes processing of DOS filenames quite easier, because you can turn a
131 # filename to the Unix notation, make your processing, and turn it back to
134 dnl Available from the GNU Autoconf Macro Archive at:
135 dnl http://www.gnu.org/software/ac-archive/htmldoc/normpath.html
137 AC_DEFUN([adl_NORMALIZE_PATH],
139 dnl change empty paths to '.'
141 dnl strip trailing slashes
142 :*[[\\/]]:) $1=`echo "[$]$1" | sed 's,[[\\/]]*[$],,'` ;;
145 dnl squeze repeated slashes
146 case ifelse($2,,"[$]$1",$2) in
147 dnl if the path contains any backslashes, turn slashes into backslashes
149 dnl Bernhard Held 2003-04-06
150 dnl This was the original line. It does not:
151 dnl - convert the first slash
152 dnl - replace a slash with a double-backslash
153 dnl *\\*) $1=`echo "[$]$1" | sed 's,\(.\)[[\\/]][[\\/]]*,\1\\\\,g'` ;;
154 *\\*) $1=`echo "[$]$1" | sed 's,\(.\)[[\\/]][[\\/]]*,\1\\\\\\\\,g
155 s,^[[\\/]],\\\\\\\\,'` ;;
157 dnl if the path contains slashes, also turn backslashes into slashes
158 *) $1=`echo "[$]$1" | sed 's,\(.\)[[\\/]][[\\/]]*,\1/,g'` ;;
162 # adl_COMPUTE_RELATIVE_PATH
164 # PATH_LIST is a space-separated list of colon-separated triplets of the form
165 # 'FROM:TO:RESULT'. This function iterates over these triplets and set $RESULT
166 # to the relative path from $FROM to $TO. Note that $FROM and $TO needs to be
167 # absolute filenames for this macro to success.
169 AC_DEFUN([adl_COMPUTE_RELATIVE_PATHS],
170 [for _lcl_i in $1; do
171 _lcl_from=\[$]`echo "[$]_lcl_i" | sed 's,:.*$,,'`
172 _lcl_to=\[$]`echo "[$]_lcl_i" | sed 's,^[[^:]]*:,,' | sed 's,:[[^:]]*$,,'`
173 _lcl_result_var=`echo "[$]_lcl_i" | sed 's,^.*:,,'`
174 adl_RECURSIVE_EVAL([[$]_lcl_from], [_lcl_from])
175 adl_RECURSIVE_EVAL([[$]_lcl_to], [_lcl_to])
176 _lcl_notation="$_lcl_from$_lcl_to"
177 adl_NORMALIZE_PATH([_lcl_from],['/'])
178 adl_NORMALIZE_PATH([_lcl_to],['/'])
179 adl_COMPUTE_RELATIVE_PATH([_lcl_from], [_lcl_to], [_lcl_result_tmp])
180 adl_NORMALIZE_PATH([_lcl_result_tmp],["[$]_lcl_notation"])
181 eval $_lcl_result_var='[$]_lcl_result_tmp'
186 ## The following helper macros are too fragile to be used out
187 ## of adl_COMPUTE_RELATIVE_PATHS (mainly because they assume that
188 ## paths are normalized), that's why I'm keeping them in the same file.
189 ## Still, some of them maybe worth to reuse.
191 dnl adl_COMPUTE_RELATIVE_PATH(FROM, TO, RESULT)
192 dnl ===========================================
193 dnl Compute the relative path to go from $FROM to $TO and set the value
194 dnl of $RESULT to that value. This function work on raw filenames
195 dnl (for instead it will considerate /usr//local and /usr/local as
196 dnl two distinct paths), you should really use adl_COMPUTE_REALTIVE_PATHS
197 dnl instead to have the paths sanitized automatically.
200 dnl first_dir=/somewhere/on/my/disk/bin
201 dnl second_dir=/somewhere/on/another/disk/share
202 dnl adl_COMPUTE_RELATIVE_PATH(first_dir, second_dir, first_to_second)
203 dnl will set $first_to_second to '../../../another/disk/share'.
204 AC_DEFUN([adl_COMPUTE_RELATIVE_PATH],
205 [adl_COMPUTE_COMMON_PATH([$1], [$2], [_lcl_common_prefix])
206 adl_COMPUTE_BACK_PATH([$1], [_lcl_common_prefix], [_lcl_first_rel])
207 adl_COMPUTE_SUFFIX_PATH([$2], [_lcl_common_prefix], [_lcl_second_suffix])
208 $3="[$]_lcl_first_rel[$]_lcl_second_suffix"])
210 dnl adl_COMPUTE_COMMON_PATH(LEFT, RIGHT, RESULT)
211 dnl ============================================
212 dnl Compute the common path to $LEFT and $RIGHT and set the result to $RESULT.
215 dnl first_path=/somewhere/on/my/disk/bin
216 dnl second_path=/somewhere/on/another/disk/share
217 dnl adl_COMPUTE_COMMON_PATH(first_path, second_path, common_path)
218 dnl will set $common_path to '/somewhere/on'.
219 AC_DEFUN([adl_COMPUTE_COMMON_PATH],
221 _lcl_second_prefix_match=''
222 while test "[$]_lcl_second_prefix_match" != 0; do
223 _lcl_first_prefix=`expr "x[$]$1" : "x\([$]$3/*[[^/]]*\)"`
224 _lcl_second_prefix_match=`expr "x[$]$2" : "x[$]_lcl_first_prefix"`
225 if test "[$]_lcl_second_prefix_match" != 0; then
226 if test "[$]_lcl_first_prefix" != "[$]$3"; then
227 $3="[$]_lcl_first_prefix"
229 _lcl_second_prefix_match=0
234 dnl adl_COMPUTE_SUFFIX_PATH(PATH, SUBPATH, RESULT)
235 dnl ==============================================
236 dnl Substrack $SUBPATH from $PATH, and set the resulting suffix
237 dnl (or the empty string if $SUBPATH is not a subpath of $PATH)
241 dnl first_path=/somewhere/on/my/disk/bin
242 dnl second_path=/somewhere/on
243 dnl adl_COMPUTE_SUFFIX_PATH(first_path, second_path, common_path)
244 dnl will set $common_path to '/my/disk/bin'.
245 AC_DEFUN([adl_COMPUTE_SUFFIX_PATH],
246 [$3=`expr "x[$]$1" : "x[$]$2/*\(.*\)"`])
248 dnl adl_COMPUTE_BACK_PATH(PATH, SUBPATH, RESULT)
249 dnl ============================================
250 dnl Compute the relative path to go from $PATH to $SUBPATH, knowing that
251 dnl $SUBPATH is a subpath of $PATH (any other words, only repeated '../'
252 dnl should be needed to move from $PATH to $SUBPATH) and set the value
253 dnl of $RESULT to that value. If $SUBPATH is not a subpath of PATH,
254 dnl set $RESULT to the empty string.
257 dnl first_path=/somewhere/on/my/disk/bin
258 dnl second_path=/somewhere/on
259 dnl adl_COMPUTE_BACK_PATH(first_path, second_path, back_path)
260 dnl will set $back_path to '../../../'.
261 AC_DEFUN([adl_COMPUTE_BACK_PATH],
262 [adl_COMPUTE_SUFFIX_PATH([$1], [$2], [_lcl_first_suffix])
265 while test "[$]_lcl_tmp" != ''; do
266 _lcl_tmp=`expr "x[$]_lcl_first_suffix" : "x[[^/]]*/*\(.*\)"`
267 if test "[$]_lcl_first_suffix" != ''; then
268 _lcl_first_suffix="[$]_lcl_tmp"
274 dnl adl_RECURSIVE_EVAL(VALUE, RESULT)
275 dnl =================================
276 dnl Interpolate the VALUE in loop until it does not change,
277 dnl and set the result to $RESULT.
278 dnl WARNING: It is easy to get an infinite loop with some unsane input.
279 AC_DEFUN([adl_RECURSIVE_EVAL],
281 $2=`(test "x$prefix" = xNONE && prefix="$ac_default_prefix"
282 test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
284 while test "[$]_lcl_receval_old" != "[$]_lcl_receval"; do
285 _lcl_receval_old="[$]_lcl_receval"
286 eval _lcl_receval="\"[$]_lcl_receval\""
288 echo "[$]_lcl_receval")`])
290 dnl adl_NORMALIZE_DEFINE_UNQUOTED(var, DEFINE, REFERENCE_STRING)
291 AC_DEFUN([adl_NORMALIZE_DEFINE_UNQUOTED], [
293 adl_NORMALIZE_PATH([ac_ndu], [$]$3)
294 AC_DEFINE_UNQUOTED($2, "${ac_ndu}")
297 dnl adl_NORMALIZE_PATH_MSG(input_string, var, dir_separator)
298 dnl ========================================================
299 dnl call adl_NORMALIZE_PATH and format it for the result message
300 AC_DEFUN([adl_NORMALIZE_PATH_MSG], [
302 $2=`echo "$1" | sed 's,/\./,/,g'`
303 adl_NORMALIZE_PATH([$2], [$3])
305 $2=`echo "[$]$2" | sed 's,\\\\\\\\,\\\\,g'`
309 # Checking characteristics of compilers and other programs
310 # ===========================================================================
311 AC_CACHE_CHECK(whether preprocessor accepts -MM or -M,sdcc_cv_MM,
312 echo "#include <stdio.h>" >_test_.c
314 $CPP -v -MM _test_.c 1>&5 2>&5
315 if test "$?" = "0"; then
324 # This is the first time when CFLAGS are set/modified!!
325 adl_DD_COPT(CC, ggdb)
326 if test "$sdcc_cv_CCggdb" = "yes"; then
327 CFLAGS="-ggdb ${CFLAGS}"
330 adl_DD_COPT(CC, pipe)
331 if test "$sdcc_cv_CCpipe" = "yes"; then
332 CFLAGS="-pipe $CFLAGS"
336 # Checks for typedefs, structures, and compiler characteristics.
337 # ===========================================================================
340 AC_CHECK_SIZEOF(char)
341 AC_CHECK_SIZEOF(short)
343 AC_CHECK_SIZEOF(long)
348 if expr "$ac_cv_sizeof_char" '>=' "$1" >/dev/null; then
352 if expr "$ac_cv_sizeof_short" '>=' "$1" >/dev/null; then
356 if expr "$ac_cv_sizeof_int" '>=' "$1" >/dev/null; then
360 if expr "$ac_cv_sizeof_long" '>=' "$1" >/dev/null; then
367 AC_MSG_CHECKING(type name for byte)
368 TYPE_CHAR=`type_name 1`
369 if test "$ac_cv_c_char_unsigned" = "yes"; then
370 TYPE_BYTE="signed $TYPE_CHAR"
374 AC_MSG_RESULT($TYPE_BYTE)
375 AC_MSG_CHECKING(type name for word)
376 TYPE_WORD=`type_name 2`
377 AC_MSG_RESULT($TYPE_WORD)
378 AC_MSG_CHECKING(type name for dword)
379 TYPE_DWORD=`type_name 4`
380 AC_MSG_RESULT($TYPE_DWORD)
382 AC_DEFINE_UNQUOTED(TYPE_BYTE, $TYPE_BYTE)
383 AC_DEFINE_UNQUOTED(TYPE_WORD, $TYPE_WORD)
384 AC_DEFINE_UNQUOTED(TYPE_DWORD, $TYPE_DWORD)
386 AC_DEFINE_UNQUOTED(TYPE_UBYTE, unsigned $TYPE_CHAR)
387 AC_DEFINE_UNQUOTED(TYPE_UWORD, unsigned $TYPE_WORD)
388 AC_DEFINE_UNQUOTED(TYPE_UDWORD, unsigned $TYPE_DWORD)
391 # SDCC_BUILD_BIGENDIAN ([ACTION-IF-TRUE], [ACTION-IF-FALSE], [ACTION-IF-UNKNOWN])
392 # -------------------------------------------------------------------------
393 AC_DEFUN([SDCC_BUILD_BIGENDIAN],
394 [AC_CACHE_CHECK(whether host machine byte ordering is bigendian, sdcc_cv_build_bigendian,
395 [# See if sys/param.h defines the BYTE_ORDER macro.
396 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
397 #include <sys/param.h>
399 [#if ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \
400 && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN)
404 [# It does; now see whether it defined to BIG_ENDIAN or not.
405 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
406 #include <sys/param.h>
407 ], [#if BYTE_ORDER != BIG_ENDIAN
410 ])], [sdcc_cv_build_bigendian=yes], [sdcc_cv_build_bigendian=no])],
411 [# It does not; compile a test program.
413 [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], [[
414 /* Are we little or big endian? From Harbison&Steele. */
418 char c[sizeof (long int)];
421 return u.c[sizeof (long int) - 1] == 1;
423 [sdcc_cv_build_bigendian=no],
424 [sdcc_cv_build_bigendian=yes],
425 [# try to guess the endianness by grepping values into an object file
426 sdcc_cv_build_bigendian=unknown
427 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
428 [[short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
429 short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
430 void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; }
431 short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
432 short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
433 void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; }]],
434 [[ _ascii (); _ebcdic (); ]])],
435 [if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then
436 sdcc_cv_build_bigendian=yes
438 if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
439 if test "$sdcc_cv_build_bigendian" = unknown; then
440 sdcc_cv_build_bigendian=no
442 # finding both strings is unlikely to happen, but who knows?
443 sdcc_cv_build_bigendian=unknown
446 case $sdcc_cv_build_bigendian in
449 [AC_DEFINE([BUILD_WORDS_BIGENDIAN], 1,
450 [Define to 1 if your processor stores words with the most significant
451 byte first (like Motorola and SPARC, unlike Intel and VAX).])]) ;;
456 [AC_MSG_ERROR([unknown endianness
457 presetting sdcc_cv_build_bigendian=no (or yes) will help])]) ;;
459 ])# SDCC_BUILD_BIGENDIAN
463 # Set standard installation paths
464 # ===========================================================================
466 # In the Makefiles we need paths with '/' as directory separator, even if
467 # crosscompiling for Win32.
468 # And we want to preserve the macros (e.g. ${prefix}) in the Makefiles.
469 # The variables in the Makefiles are replaced by AC_SUBST()
471 # In sdccconf.h the '/' in paths can be replaced by "\\" (normalized), if
473 # The macros are expanded for the header.
474 # The variables in the header are replaced by AC_*DEFINE*()
475 # sdccconf_h_dir_separator contains a backslash.
476 AC_ARG_VAR(sdccconf_h_dir_separator, needed in sdccconf.h: either "/" (default) or "\\")
477 if test "x${sdccconf_h_dir_separator}" = "x"; then
478 sdccconf_h_dir_separator="/"
484 # include_dir_suffix:
485 # *nix default: "sdcc/include"
487 AC_ARG_VAR(include_dir_suffix, appended to datadir to define SDCC's include directory)
488 if test "${include_dir_suffix}" = ""; then
489 include_dir_suffix="sdcc/include"
491 AC_SUBST(include_dir_suffix)
494 # *nix default: "sdcc/lib"
495 AC_ARG_VAR(lib_dir_suffix, appended to datadir to define SDCC's library root directory)
496 if test "${lib_dir_suffix}" = ""; then
497 lib_dir_suffix="sdcc/lib"
499 AC_SUBST(lib_dir_suffix)
502 # *nix default: "${datadir}/sdcc/doc"
503 AC_ARG_VAR(docdir, documentation installation directory)
504 if test "${docdir}" = ""; then
505 docdir="\${datadir}"/sdcc/doc
514 AC_DEFINE_UNQUOTED(DIR_SEPARATOR_STRING, "${sdccconf_h_dir_separator}")
515 AC_DEFINE_UNQUOTED(DIR_SEPARATOR_CHAR , '${sdccconf_h_dir_separator}')
518 # default: "NONE", ${ac_default_prefix}: "/usr/local"
519 adl_EXPAND(prefix, ac_default_prefix, expanded_prefix)
520 adl_NORMALIZE_DEFINE_UNQUOTED(expanded_prefix, PREFIX, sdccconf_h_dir_separator)
523 # default: "${prefix}"
524 adl_EXPAND(exec_prefix, expanded_prefix, expanded_exec_prefix)
525 adl_NORMALIZE_DEFINE_UNQUOTED(expanded_exec_prefix, EXEC_PREFIX, sdccconf_h_dir_separator)
528 # default: "${exec_prefix}/bin"
529 adl_EXPAND(bindir, "NONE", expanded_bindir)
530 adl_NORMALIZE_DEFINE_UNQUOTED(expanded_bindir, BINDIR, sdccconf_h_dir_separator)
533 # default: "${prefix}/share"
534 adl_EXPAND(datadir, "NONE", expanded_datadir)
535 adl_NORMALIZE_DEFINE_UNQUOTED(expanded_datadir, DATADIR, sdccconf_h_dir_separator)
538 norm_inc_dir_suffix=${include_dir_suffix}
539 adl_NORMALIZE_PATH([norm_inc_dir_suffix], [$sdccconf_h_dir_separator])
540 AC_DEFINE_UNQUOTED(INCLUDE_DIR_SUFFIX,
541 DIR_SEPARATOR_STRING "${norm_inc_dir_suffix}")
542 norm_lib_dir_suffix=${lib_dir_suffix}
543 adl_NORMALIZE_PATH([norm_lib_dir_suffix], [$sdccconf_h_dir_separator])
544 AC_DEFINE_UNQUOTED(LIB_DIR_SUFFIX,
545 DIR_SEPARATOR_STRING "${norm_lib_dir_suffix}")
548 adl_COMPUTE_RELATIVE_PATHS([expanded_bindir:expanded_datadir:bin2data_dir])
549 adl_NORMALIZE_PATH(bin2data_dir, [$sdccconf_h_dir_separator])
550 AC_DEFINE_UNQUOTED(BIN2DATA_DIR,
551 DIR_SEPARATOR_STRING "${bin2data_dir}")
553 adl_COMPUTE_RELATIVE_PATHS([expanded_prefix:expanded_bindir:prefix2bin_dir])
554 adl_NORMALIZE_PATH(prefix2bin_dir, [$sdccconf_h_dir_separator])
555 AC_DEFINE_UNQUOTED(PREFIX2BIN_DIR,
556 DIR_SEPARATOR_STRING "${prefix2bin_dir}")
558 adl_COMPUTE_RELATIVE_PATHS([expanded_prefix:expanded_datadir:prefix2data_dir])
559 adl_NORMALIZE_PATH(prefix2data_dir, [$sdccconf_h_dir_separator])
560 if test "${prefix2data_dir}" = "."; then
561 # small optimization for Mingw32; otherwise Borut will complain ;-)
562 AC_DEFINE_UNQUOTED(PREFIX2DATA_DIR, "")
564 AC_DEFINE_UNQUOTED(PREFIX2DATA_DIR,
565 DIR_SEPARATOR_STRING "${prefix2data_dir}")
569 AC_DEFINE_UNQUOTED(STD_LIB, "libsdcc")
570 AC_DEFINE_UNQUOTED(STD_INT_LIB, "libint")
571 AC_DEFINE_UNQUOTED(STD_LONG_LIB, "liblong")
572 AC_DEFINE_UNQUOTED(STD_FP_LIB, "libfloat")
573 AC_DEFINE_UNQUOTED(STD_DS390_LIB, "libds390")
574 AC_DEFINE_UNQUOTED(STD_DS400_LIB, "libds400")
575 AC_DEFINE_UNQUOTED(STD_XA51_LIB, "libxa51")
577 # SDCC runtime environment variables
578 sdcc_dir_name="SDCC_HOME"
579 AC_DEFINE_UNQUOTED(SDCC_DIR_NAME, "${sdcc_dir_name}")
581 sdcc_include_name="SDCC_INCLUDE"
582 AC_DEFINE_UNQUOTED(SDCC_INCLUDE_NAME, "${sdcc_include_name}")
584 sdcc_lib_name="SDCC_LIB"
585 AC_DEFINE_UNQUOTED(SDCC_LIB_NAME, "${sdcc_lib_name}")
587 # Port selection helper
588 # ===========================================================================
589 # macro AC_DO_ENABLER()
590 # $1 used to access enable_$1, e.g. enable-doc
591 # $2 OPT_DISABLE_$2, normally uppercase of $1, e.g. DOC
593 AC_DEFUN([AC_DO_ENABLER], [
594 AC_ARG_ENABLE($1, AC_HELP_STRING([--enable-$1], $3))
596 if test "[$]enable_$1" = "yes"; then
602 AC_DEFINE_UNQUOTED(OPT_ENABLE_$2, [$]OPT_ENABLE_$2)
603 AC_SUBST(OPT_ENABLE_$2)
606 # macro AC_DO_DISABLER()
607 # $1 used to access disable_$1, e.g. ucsim
608 # $2 OPT_DISABLE_$2, normally uppercase of $1, e.g. UCSIM
610 AC_DEFUN([AC_DO_DISABLER], [
611 AC_ARG_ENABLE($1, AC_HELP_STRING([--disable-$1], $3))
613 dnl the '-' in 'device-lib' needs special handling,
614 dnl because the variable is 'enable_device_lib'
615 arg1=`echo $1 | sed s/-/_/`
617 if test "`eval echo \\$enable_$arg1`" = "no"; then
623 AC_DEFINE_UNQUOTED(OPT_DISABLE_$2, [$]OPT_DISABLE_$2)
624 AC_SUBST(OPT_DISABLE_$2)
627 # macro AC_DO_PORT($1, $2, $3, $4)
628 # $1 used to access enable_$2_port, e.g. gbz80
629 # $2 port name in ports.all and ports.build, e.g. z80
630 # $3 OPT_DISABLE_$3, normally uppercase of $2, e.g. GBZ80
632 AC_DEFUN([AC_DO_PORT], [
633 AC_ARG_ENABLE($1-port,
634 AC_HELP_STRING([--disable-$1-port], $4))
636 if test "[$]enable_$1_port" = "no"; then
643 AC_DEFINE_UNQUOTED(OPT_DISABLE_$3, [$]OPT_DISABLE_$3)
644 AC_SUBST(OPT_DISABLE_$3)
647 if test [$]OPT_DISABLE_$3 = 0; then
648 echo $2 >>ports.build
652 # Now handle the port selection
653 # ===========================================================================
654 rm -f ports.all ports.build
655 AC_DO_PORT(mcs51, mcs51, MCS51, [Excludes the Intel mcs51 port])
656 AC_DO_PORT(gbz80, z80, GBZ80, [Excludes the Gameboy gbz80 port])
657 AC_DO_PORT(z80, z80, Z80, [Excludes the z80 port])
658 AC_DO_PORT(avr, avr, AVR, [Excludes the AVR port])
659 AC_DO_PORT(ds390, ds390, DS390, [Excludes the DS390 port])
660 AC_DEFINE_UNQUOTED(OPT_DISABLE_TININative, $OPT_DISABLE_DS390)
661 AC_DO_PORT(ds400, ds400, DS400, [Excludes the DS400 port])
662 AC_DO_PORT(pic, pic, PIC, [Excludes the PIC port])
663 AC_DO_PORT(pic16, pic16, PIC16, [Excludes the PIC16 port])
664 AC_DO_PORT(xa51, xa51, XA51, [Excludes the XA51 port])
665 AC_DO_PORT(hc08, hc08, HC08, [Excludes the HC08 port])
667 AC_DO_DISABLER(ucsim, UCSIM, [Disables configuring and building of ucsim])
668 AC_DO_DISABLER(device-lib, DEVICE_LIB, [Disables building device libraries])
669 AC_DO_DISABLER(packihx, PACKIHX, [Disables building packihx])
670 AC_DO_DISABLER(sdcpp, SDCPP, [Disables building sdcpp])
671 AC_DO_DISABLER(sdcdb, SDCDB, [Disables building sdcdb])
673 AC_DO_ENABLER(doc, DOC, [Enables building the documentation])
674 if test $OPT_ENABLE_DOC = 1; then
675 AC_CHECK_PROG(LYX, lyx, lyx, :)
676 AC_CHECK_PROG(LATEX2HTML, latex2html, latex2html, :)
677 AC_CHECK_PROG(PDFLATEX, pdflatex, pdflatex, :)
678 AC_CHECK_PROG(PDFOPT, pdfopt, pdfopt, :)
679 AC_CHECK_PROG(MAKEINDEX, makeindex, makeindex, :)
681 SDCC_REQUIRE_PROG($LYX, lyx)
682 SDCC_REQUIRE_PROG($LATEX2HTML, latex2html)
683 SDCC_REQUIRE_PROG($PDFLATEX, pdflatex)
684 SDCC_REQUIRE_PROG($PDFOPT, pdfopt)
685 SDCC_REQUIRE_PROG($MAKEINDEX, makeindex)
688 AC_DO_ENABLER(libgc, LIBGC, [Use the Bohem memory allocator. Lower runtime footprint.])
689 if test $OPT_ENABLE_LIBGC = 1; then
690 AC_CHECK_LIB(gc, GC_malloc)
691 if test $ac_cv_lib_gc_GC_malloc = no; then
692 AC_MSG_ERROR([Cannot find library libgc with Bohem memory allocator.])
699 uniq ports.build ports
702 # Generating output files
703 # ===========================================================================
704 test $OPT_DISABLE_SDCPP = 0 && AC_CONFIG_SUBDIRS(support/cpp)
705 test $OPT_DISABLE_PACKIHX = 0 && AC_CONFIG_SUBDIRS(support/packihx)
706 test $OPT_DISABLE_UCSIM = 0 && AC_CONFIG_SUBDIRS(sim/ucsim)
707 test $OPT_DISABLE_SDCDB = 0 && AC_CONFIG_SUBDIRS(debugger/mcs51)
708 AC_CONFIG_FILES([doc/Makefile])
710 test $OPT_DISABLE_AVR = 0 && AC_CONFIG_FILES([src/avr/Makefile])
712 if test $OPT_DISABLE_DS390 = 0; then
713 AC_CONFIG_FILES([src/ds390/Makefile])
714 test $OPT_DISABLE_DEVICE_LIB = 0 && AC_CONFIG_FILES([device/lib/ds390/Makefile])
717 if test $OPT_DISABLE_DS400 = 0; then
718 AC_CONFIG_FILES([src/ds400/Makefile])
719 test $OPT_DISABLE_DEVICE_LIB = 0 && AC_CONFIG_FILES([device/lib/ds400/Makefile])
722 if test $OPT_DISABLE_HC08 = 0; then
723 AC_CONFIG_FILES([src/hc08/Makefile
725 as/link/hc08/Makefile])
726 test $OPT_DISABLE_DEVICE_LIB = 0 && AC_CONFIG_FILES([device/lib/hc08/Makefile])
729 if test $OPT_DISABLE_MCS51 = 0; then
730 AC_CONFIG_FILES([src/mcs51/Makefile
732 as/link/mcs51/Makefile])
733 test $OPT_DISABLE_DEVICE_LIB = 0 && AC_CONFIG_FILES([device/lib/mcs51/Makefile
734 device/lib/small/Makefile
735 device/lib/medium/Makefile
736 device/lib/large/Makefile])
739 if test $OPT_DISABLE_PIC = 0; then
740 AC_CONFIG_FILES(src/pic/Makefile)
741 test $OPT_DISABLE_DEVICE_LIB = 0 && AC_CONFIG_SUBDIRS(device/lib/pic)
743 if test $OPT_DISABLE_PIC16 = 0; then
744 AC_CONFIG_FILES(src/pic16/Makefile)
745 test $OPT_DISABLE_DEVICE_LIB = 0 && AC_CONFIG_SUBDIRS(device/lib/pic16)
748 test $OPT_DISABLE_XA51 = 0 && AC_CONFIG_FILES([src/xa51/Makefile])
750 if test $OPT_DISABLE_Z80 = 0; then
751 AC_CONFIG_FILES([src/z80/Makefile
755 as/link/z80/Makefile])
756 test $OPT_DISABLE_DEVICE_LIB = 0 && AC_CONFIG_FILES([device/lib/z80/Makefile
757 device/lib/gbz80/Makefile])
760 test $OPT_DISABLE_DEVICE_LIB = 0 && AC_CONFIG_FILES([device/lib/Makefile])
762 AC_CONFIG_FILES([main.mk:main_in.mk
764 device/include/Makefile
765 support/librarian/Makefile
766 support/makebin/Makefile
767 support/regression/Makefile
768 support/valdiag/Makefile
770 Makefile.common:Makefile.common.in
774 # I found no better place
777 # Prepare result message
778 # ======================
780 # In the C-header we need \\ as dir-separator, but in the message only \
781 dirch=${sdccconf_h_dir_separator}
782 test ${dirch} = '\\' && dirch='\'
784 # calc friendly strings
785 adl_NORMALIZE_PATH_MSG(/${prefix2bin_dir}, [binPath], [$dirch])
786 adl_NORMALIZE_PATH_MSG(/${prefix2data_dir}/${norm_inc_dir_suffix}, [incPath1], [$dirch])
787 adl_NORMALIZE_PATH_MSG(/${bin2data_dir}/${norm_inc_dir_suffix}, [incPath2], [$dirch])
788 adl_NORMALIZE_PATH_MSG(${expanded_datadir}/${norm_inc_dir_suffix}, [incPath3], [$dirch])
789 adl_NORMALIZE_PATH_MSG(/${prefix2data_dir}/${norm_lib_dir_suffix}, [libPath1], [$dirch])
790 adl_NORMALIZE_PATH_MSG(/${bin2data_dir}/${norm_lib_dir_suffix}, [libPath2], [$dirch])
791 adl_NORMALIZE_PATH_MSG(${expanded_datadir}/${norm_lib_dir_suffix}, [libPath3], [$dirch])
794 sdcc ${VERSION} is now configured for
796 Build: ${build_alias}
798 Source directory: ${srcdir}
803 avr ${enable_avr_port}
804 ds390 ${enable_ds390_port}
805 ds400 ${enable_ds400_port}
806 gbz80 ${enable_gbz80_port}
807 hc08 ${enable_hc08_port}
808 mcs51 ${enable_mcs51_port}
809 pic ${enable_pic_port}
810 pic16 ${enable_pic16_port}
811 xa51 ${enable_xa51_port}
812 z80 ${enable_z80_port}
814 Disable packihx: ${OPT_DISABLE_PACKIHX}
815 Disable ucsim: ${OPT_DISABLE_UCSIM}
816 Disable device lib: ${OPT_DISABLE_DEVICE_LIB}
817 Disable sdcpp: ${OPT_DISABLE_SDCPP}
818 Disable sdcdb: ${OPT_DISABLE_SDCDB}
819 Enable documentation: ${OPT_ENABLE_DOC}
820 Enable libgc: ${OPT_ENABLE_LIBGC}
823 binary files: ${exec_prefix}
824 include files: ${datadir}/${include_dir_suffix}
825 library files: ${datadir}/${lib_dir_suffix}
826 documentation: ${docdir}
830 datarootdir: ${datarootdir}
832 Search paths (incomplete, see manual for all search paths):
833 binary files: \$SDCC_HOME${binPath}
834 include files: ${incPath1}
835 path(argv[[0]])${incPath2}
837 library files: \$SDCC_HOME${libPath1}${dirch}<model>
838 path(argv[[0]])${libPath2}${dirch}<model>
839 ${libPath3}${dirch}<model>
841 # End of configure/configure.in