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_SUBST(PACKAGE, [sdcc])
30 AC_DEFINE_UNQUOTED(SDCC_VERSION_LO, ${VERSIONLO})
31 AC_DEFINE_UNQUOTED(SDCC_VERSION_HI, ${VERSIONHI})
32 AC_DEFINE_UNQUOTED(SDCC_VERSION_P, ${VERSIONP})
33 AC_DEFINE_UNQUOTED(SDCC_VERSION_STR, "${VERSION}")
35 sdcc_cv_version=$VERSION
36 sdcc_cv_versionhi=$VERSIONHI
37 sdcc_cv_versionlo=$VERSIONLO
38 sdcc_cv_versionp=$VERSIONP
42 # ===========================================================================
47 AC_CHECK_PROG(AUTOCONF, autoconf, autoconf, :)
48 AC_CHECK_PROG(STRIP, strip, strip, :)
49 AC_CHECK_PROG(AS, as, as, :)
50 AC_CHECK_PROG(CP, cp, cp, :)
52 dnl Don't use AC_PROG_LEX
53 dnl LEXLIB is not useful in gcc.
54 AC_CHECK_PROGS(LEX, flex lex, :)
56 dnl Don't use AC_PROG_YACC
57 AC_CHECK_PROGS(YACC, 'bison -y' byacc yacc, :)
59 AC_DEFUN([SDCC_REQUIRE_PROG],
60 [if test "$1" = ":"; then
61 AC_MSG_ERROR([Cannot find required program $2.])
65 SDCC_REQUIRE_PROG($YACC, bison)
66 SDCC_REQUIRE_PROG($LEX, flex)
71 AC_HELP_STRING([--without-ccache], [do not use ccache even if available]),
73 case x${with_ccache-yes} in
74 xyes) AC_CHECK_PROG([CCACHE], [ccache], [ccache], []) ;;
75 xno) AC_SUBST([CCACHE], []) ;;
76 *) AC_SUBST([CCACHE], [$with_ccache]) ;;
80 # Checking for functions
81 # ===========================================================================
82 AC_CHECK_FUNCS(strerror)
83 AC_CHECK_FUNCS(vsnprintf snprintf vsprintf mkstemp)
87 # ===========================================================================
89 # adl_DD_COPT macro checks if the compiler specified as the 1st parameter
90 # supports option specified as the 2nd parameter
91 # For example: DD_CPORT(CXX, fPIC)
93 AC_DEFUN([adl_DD_COPT], [
94 AC_CACHE_CHECK(whether $$1 accepts -$2,sdcc_cv_$1$2,
99 $$1 -v -$2 -c _test_.c 1>&5 2>&5
100 if test "$?" = "0"; then
105 rm -f _test_.* a.out)
108 # This macro expands DIR and assigns it to RET.
109 # If DIR is NONE, then it's replaced by DEFAULT.
111 # Based on AC_DEFINE_DIR
115 # adl_EXPAND(prefix, "/usr/local", expanded_prefix)
117 AC_DEFUN([adl_EXPAND], [
118 test "x$prefix" = xNONE && prefix="$ac_default_prefix"
119 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
121 test "x$ac_expand" = xNONE && ac_expand="[$]$2"
122 ac_expand=`eval echo [$]ac_expand`
123 $3=`eval echo [$]ac_expand`
128 # - empty paths are changed to '.'
129 # - trailing slashes are removed
130 # - repeated slashes are squeezed except a leading doubled slash '//'
131 # (which might indicate a networked disk on some OS).
134 # REFERENCE_STRING is used to turn '/' into '\' and vice-versa: if
135 # REFERENCE_STRING contains some backslashes, all slashes and backslashes
136 # are turned into backslashes, otherwise they are all turned into slashes.
138 # This makes processing of DOS filenames quite easier, because you can turn a
139 # filename to the Unix notation, make your processing, and turn it back to
142 dnl Available from the GNU Autoconf Macro Archive at:
143 dnl http://www.gnu.org/software/ac-archive/htmldoc/normpath.html
145 AC_DEFUN([adl_NORMALIZE_PATH],
147 dnl change empty paths to '.'
149 dnl strip trailing slashes
150 :*[[\\/]]:) $1=`echo "[$]$1" | sed 's,[[\\/]]*[$],,'` ;;
153 dnl squeze repeated slashes
154 case ifelse($2,,"[$]$1",$2) in
155 dnl if the path contains any backslashes, turn slashes into backslashes
157 dnl Bernhard Held 2003-04-06
158 dnl This was the original line. It does not:
159 dnl - convert the first slash
160 dnl - replace a slash with a double-backslash
161 dnl *\\*) $1=`echo "[$]$1" | sed 's,\(.\)[[\\/]][[\\/]]*,\1\\\\,g'` ;;
162 *\\*) $1=`echo "[$]$1" | sed 's,\(.\)[[\\/]][[\\/]]*,\1\\\\\\\\,g
163 s,^[[\\/]],\\\\\\\\,'` ;;
165 dnl if the path contains slashes, also turn backslashes into slashes
166 *) $1=`echo "[$]$1" | sed 's,\(.\)[[\\/]][[\\/]]*,\1/,g'` ;;
170 # adl_COMPUTE_RELATIVE_PATH
172 # PATH_LIST is a space-separated list of colon-separated triplets of the form
173 # 'FROM:TO:RESULT'. This function iterates over these triplets and set $RESULT
174 # to the relative path from $FROM to $TO. Note that $FROM and $TO needs to be
175 # absolute filenames for this macro to success.
177 AC_DEFUN([adl_COMPUTE_RELATIVE_PATHS],
178 [for _lcl_i in $1; do
179 _lcl_from=\[$]`echo "[$]_lcl_i" | sed 's,:.*$,,'`
180 _lcl_to=\[$]`echo "[$]_lcl_i" | sed 's,^[[^:]]*:,,' | sed 's,:[[^:]]*$,,'`
181 _lcl_result_var=`echo "[$]_lcl_i" | sed 's,^.*:,,'`
182 adl_RECURSIVE_EVAL([[$]_lcl_from], [_lcl_from])
183 adl_RECURSIVE_EVAL([[$]_lcl_to], [_lcl_to])
184 _lcl_notation="$_lcl_from$_lcl_to"
185 adl_NORMALIZE_PATH([_lcl_from],['/'])
186 adl_NORMALIZE_PATH([_lcl_to],['/'])
187 adl_COMPUTE_RELATIVE_PATH([_lcl_from], [_lcl_to], [_lcl_result_tmp])
188 adl_NORMALIZE_PATH([_lcl_result_tmp],["[$]_lcl_notation"])
189 eval $_lcl_result_var='[$]_lcl_result_tmp'
194 ## The following helper macros are too fragile to be used out
195 ## of adl_COMPUTE_RELATIVE_PATHS (mainly because they assume that
196 ## paths are normalized), that's why I'm keeping them in the same file.
197 ## Still, some of them maybe worth to reuse.
199 dnl adl_COMPUTE_RELATIVE_PATH(FROM, TO, RESULT)
200 dnl ===========================================
201 dnl Compute the relative path to go from $FROM to $TO and set the value
202 dnl of $RESULT to that value. This function work on raw filenames
203 dnl (for instead it will considerate /usr//local and /usr/local as
204 dnl two distinct paths), you should really use adl_COMPUTE_REALTIVE_PATHS
205 dnl instead to have the paths sanitized automatically.
208 dnl first_dir=/somewhere/on/my/disk/bin
209 dnl second_dir=/somewhere/on/another/disk/share
210 dnl adl_COMPUTE_RELATIVE_PATH(first_dir, second_dir, first_to_second)
211 dnl will set $first_to_second to '../../../another/disk/share'.
212 AC_DEFUN([adl_COMPUTE_RELATIVE_PATH],
213 [adl_COMPUTE_COMMON_PATH([$1], [$2], [_lcl_common_prefix])
214 adl_COMPUTE_BACK_PATH([$1], [_lcl_common_prefix], [_lcl_first_rel])
215 adl_COMPUTE_SUFFIX_PATH([$2], [_lcl_common_prefix], [_lcl_second_suffix])
216 $3="[$]_lcl_first_rel[$]_lcl_second_suffix"])
218 dnl adl_COMPUTE_COMMON_PATH(LEFT, RIGHT, RESULT)
219 dnl ============================================
220 dnl Compute the common path to $LEFT and $RIGHT and set the result to $RESULT.
223 dnl first_path=/somewhere/on/my/disk/bin
224 dnl second_path=/somewhere/on/another/disk/share
225 dnl adl_COMPUTE_COMMON_PATH(first_path, second_path, common_path)
226 dnl will set $common_path to '/somewhere/on'.
227 AC_DEFUN([adl_COMPUTE_COMMON_PATH],
229 _lcl_second_prefix_match=''
230 while test "[$]_lcl_second_prefix_match" != 0; do
231 _lcl_first_prefix=`expr "x[$]$1" : "x\([$]$3/*[[^/]]*\)"`
232 _lcl_second_prefix_match=`expr "x[$]$2" : "x[$]_lcl_first_prefix"`
233 if test "[$]_lcl_second_prefix_match" != 0; then
234 if test "[$]_lcl_first_prefix" != "[$]$3"; then
235 $3="[$]_lcl_first_prefix"
237 _lcl_second_prefix_match=0
242 dnl adl_COMPUTE_SUFFIX_PATH(PATH, SUBPATH, RESULT)
243 dnl ==============================================
244 dnl Substrack $SUBPATH from $PATH, and set the resulting suffix
245 dnl (or the empty string if $SUBPATH is not a subpath of $PATH)
249 dnl first_path=/somewhere/on/my/disk/bin
250 dnl second_path=/somewhere/on
251 dnl adl_COMPUTE_SUFFIX_PATH(first_path, second_path, common_path)
252 dnl will set $common_path to '/my/disk/bin'.
253 AC_DEFUN([adl_COMPUTE_SUFFIX_PATH],
254 [$3=`expr "x[$]$1" : "x[$]$2/*\(.*\)"`])
256 dnl adl_COMPUTE_BACK_PATH(PATH, SUBPATH, RESULT)
257 dnl ============================================
258 dnl Compute the relative path to go from $PATH to $SUBPATH, knowing that
259 dnl $SUBPATH is a subpath of $PATH (any other words, only repeated '../'
260 dnl should be needed to move from $PATH to $SUBPATH) and set the value
261 dnl of $RESULT to that value. If $SUBPATH is not a subpath of PATH,
262 dnl set $RESULT to the empty string.
265 dnl first_path=/somewhere/on/my/disk/bin
266 dnl second_path=/somewhere/on
267 dnl adl_COMPUTE_BACK_PATH(first_path, second_path, back_path)
268 dnl will set $back_path to '../../../'.
269 AC_DEFUN([adl_COMPUTE_BACK_PATH],
270 [adl_COMPUTE_SUFFIX_PATH([$1], [$2], [_lcl_first_suffix])
273 while test "[$]_lcl_tmp" != ''; do
274 _lcl_tmp=`expr "x[$]_lcl_first_suffix" : "x[[^/]]*/*\(.*\)"`
275 if test "[$]_lcl_first_suffix" != ''; then
276 _lcl_first_suffix="[$]_lcl_tmp"
282 dnl adl_RECURSIVE_EVAL(VALUE, RESULT)
283 dnl =================================
284 dnl Interpolate the VALUE in loop until it does not change,
285 dnl and set the result to $RESULT.
286 dnl WARNING: It is easy to get an infinite loop with some unsane input.
287 AC_DEFUN([adl_RECURSIVE_EVAL],
289 $2=`(test "x$prefix" = xNONE && prefix="$ac_default_prefix"
290 test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
292 while test "[$]_lcl_receval_old" != "[$]_lcl_receval"; do
293 _lcl_receval_old="[$]_lcl_receval"
294 eval _lcl_receval="\"[$]_lcl_receval\""
296 echo "[$]_lcl_receval")`])
298 dnl adl_NORMALIZE_DEFINE_UNQUOTED(var, DEFINE, REFERENCE_STRING)
299 AC_DEFUN([adl_NORMALIZE_DEFINE_UNQUOTED], [
301 adl_NORMALIZE_PATH([ac_ndu], [$]$3)
302 AC_DEFINE_UNQUOTED($2, "${ac_ndu}")
305 dnl adl_NORMALIZE_PATH_MSG(input_string, var, dir_separator)
306 dnl ========================================================
307 dnl call adl_NORMALIZE_PATH and format it for the result message
308 AC_DEFUN([adl_NORMALIZE_PATH_MSG], [
310 $2=`echo "$1" | sed 's,/\./,/,g'`
311 adl_NORMALIZE_PATH([$2], [$3])
313 $2=`echo "[$]$2" | sed 's,\\\\\\\\,\\\\,g'`
317 # Checking characteristics of compilers and other programs
318 # ===========================================================================
319 AC_CACHE_CHECK(whether preprocessor accepts -MM or -M,sdcc_cv_MM,
320 echo "#include <stdio.h>" >_test_.c
322 $CPP -v -MM _test_.c 1>&5 2>&5
323 if test "$?" = "0"; then
332 # This is the first time when CFLAGS are set/modified!!
333 adl_DD_COPT(CC, ggdb)
334 if test "$sdcc_cv_CCggdb" = "yes"; then
335 CFLAGS="-ggdb ${CFLAGS}"
338 adl_DD_COPT(CC, pipe)
339 if test "$sdcc_cv_CCpipe" = "yes"; then
340 CFLAGS="-pipe $CFLAGS"
344 # Checks for typedefs, structures, and compiler characteristics.
345 # ===========================================================================
348 AC_CHECK_SIZEOF(char)
349 AC_CHECK_SIZEOF(short)
351 AC_CHECK_SIZEOF(long)
356 if expr "$ac_cv_sizeof_char" '>=' "$1" >/dev/null; then
360 if expr "$ac_cv_sizeof_short" '>=' "$1" >/dev/null; then
364 if expr "$ac_cv_sizeof_int" '>=' "$1" >/dev/null; then
368 if expr "$ac_cv_sizeof_long" '>=' "$1" >/dev/null; then
375 AC_MSG_CHECKING(type name for byte)
376 TYPE_CHAR=`type_name 1`
377 if test "$ac_cv_c_char_unsigned" = "yes"; then
378 TYPE_BYTE="signed $TYPE_CHAR"
382 AC_MSG_RESULT($TYPE_BYTE)
383 AC_MSG_CHECKING(type name for word)
384 TYPE_WORD=`type_name 2`
385 AC_MSG_RESULT($TYPE_WORD)
386 AC_MSG_CHECKING(type name for dword)
387 TYPE_DWORD=`type_name 4`
388 AC_MSG_RESULT($TYPE_DWORD)
390 AC_DEFINE_UNQUOTED(TYPE_BYTE, $TYPE_BYTE)
391 AC_DEFINE_UNQUOTED(TYPE_WORD, $TYPE_WORD)
392 AC_DEFINE_UNQUOTED(TYPE_DWORD, $TYPE_DWORD)
394 AC_DEFINE_UNQUOTED(TYPE_UBYTE, unsigned $TYPE_CHAR)
395 AC_DEFINE_UNQUOTED(TYPE_UWORD, unsigned $TYPE_WORD)
396 AC_DEFINE_UNQUOTED(TYPE_UDWORD, unsigned $TYPE_DWORD)
399 # SDCC_BUILD_BIGENDIAN ([ACTION-IF-TRUE], [ACTION-IF-FALSE], [ACTION-IF-UNKNOWN])
400 # -------------------------------------------------------------------------
401 AC_DEFUN([SDCC_BUILD_BIGENDIAN],
402 [AC_CACHE_CHECK(whether host machine byte ordering is bigendian, sdcc_cv_build_bigendian,
403 [# See if sys/param.h defines the BYTE_ORDER macro.
404 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
405 #include <sys/param.h>
407 [#if ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \
408 && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN)
412 [# It does; now see whether it defined to BIG_ENDIAN or not.
413 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
414 #include <sys/param.h>
415 ], [#if BYTE_ORDER != BIG_ENDIAN
418 ])], [sdcc_cv_build_bigendian=yes], [sdcc_cv_build_bigendian=no])],
419 [# It does not; compile a test program.
421 [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], [[
422 /* Are we little or big endian? From Harbison&Steele. */
426 char c[sizeof (long int)];
429 return u.c[sizeof (long int) - 1] == 1;
431 [sdcc_cv_build_bigendian=no],
432 [sdcc_cv_build_bigendian=yes],
433 [# try to guess the endianness by grepping values into an object file
434 sdcc_cv_build_bigendian=unknown
435 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
436 [[short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
437 short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
438 void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; }
439 short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
440 short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
441 void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; }]],
442 [[ _ascii (); _ebcdic (); ]])],
443 [if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then
444 sdcc_cv_build_bigendian=yes
446 if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
447 if test "$sdcc_cv_build_bigendian" = unknown; then
448 sdcc_cv_build_bigendian=no
450 # finding both strings is unlikely to happen, but who knows?
451 sdcc_cv_build_bigendian=unknown
454 case $sdcc_cv_build_bigendian in
457 [AC_DEFINE([BUILD_WORDS_BIGENDIAN], 1,
458 [Define to 1 if your processor stores words with the most significant
459 byte first (like Motorola and SPARC, unlike Intel and VAX).])]) ;;
464 [AC_MSG_ERROR([unknown endianness
465 presetting sdcc_cv_build_bigendian=no (or yes) will help])]) ;;
467 ])# SDCC_BUILD_BIGENDIAN
471 # Set standard installation paths
472 # ===========================================================================
474 # In the Makefiles we need paths with '/' as directory separator, even if
475 # crosscompiling for Win32.
476 # And we want to preserve the macros (e.g. ${prefix}) in the Makefiles.
477 # The variables in the Makefiles are replaced by AC_SUBST()
479 # In sdccconf.h the '/' in paths can be replaced by "\\" (normalized), if
481 # The macros are expanded for the header.
482 # The variables in the header are replaced by AC_*DEFINE*()
483 # sdccconf_h_dir_separator contains a backslash.
484 AC_ARG_VAR([sdccconf_h_dir_separator], [needed in sdccconf.h: either "/" (default) or "\\"])
485 if test "x${sdccconf_h_dir_separator}" = "x"; then
486 sdccconf_h_dir_separator="/"
492 # include_dir_suffix:
493 # *nix default: "sdcc/include"
495 AC_ARG_VAR([include_dir_suffix], [appended to datadir to define SDCC's include directory])
496 if test "${include_dir_suffix}" = ""; then
497 include_dir_suffix="sdcc/include"
501 # *nix default: "sdcc/lib"
502 AC_ARG_VAR([lib_dir_suffix], [appended to datadir to define SDCC's library root directory])
503 if test "${lib_dir_suffix}" = ""; then
504 lib_dir_suffix="sdcc/lib"
508 # *nix default: "${datadir}/sdcc/doc"
509 AC_ARG_VAR([docdir], [documentation installation directory])
510 if test "${docdir}" = ""; then
511 docdir="\${datadir}"/sdcc/doc
519 AC_DEFINE_UNQUOTED(DIR_SEPARATOR_STRING, "${sdccconf_h_dir_separator}")
520 AC_DEFINE_UNQUOTED(DIR_SEPARATOR_CHAR , '${sdccconf_h_dir_separator}')
523 # default: "NONE", ${ac_default_prefix}: "/usr/local"
524 adl_EXPAND(prefix, ac_default_prefix, expanded_prefix)
525 adl_NORMALIZE_DEFINE_UNQUOTED(expanded_prefix, PREFIX, sdccconf_h_dir_separator)
528 # default: "${prefix}"
529 adl_EXPAND(exec_prefix, expanded_prefix, expanded_exec_prefix)
530 adl_NORMALIZE_DEFINE_UNQUOTED(expanded_exec_prefix, EXEC_PREFIX, sdccconf_h_dir_separator)
533 # default: "${exec_prefix}/bin"
534 adl_EXPAND(bindir, "NONE", expanded_bindir)
535 adl_NORMALIZE_DEFINE_UNQUOTED(expanded_bindir, BINDIR, sdccconf_h_dir_separator)
538 # default: "${prefix}/share"
539 adl_EXPAND(datadir, "NONE", expanded_datadir)
540 adl_NORMALIZE_DEFINE_UNQUOTED(expanded_datadir, DATADIR, sdccconf_h_dir_separator)
543 norm_inc_dir_suffix=${include_dir_suffix}
544 adl_NORMALIZE_PATH([norm_inc_dir_suffix], [$sdccconf_h_dir_separator])
545 AC_DEFINE_UNQUOTED(INCLUDE_DIR_SUFFIX,
546 DIR_SEPARATOR_STRING "${norm_inc_dir_suffix}")
547 norm_lib_dir_suffix=${lib_dir_suffix}
548 adl_NORMALIZE_PATH([norm_lib_dir_suffix], [$sdccconf_h_dir_separator])
549 AC_DEFINE_UNQUOTED(LIB_DIR_SUFFIX,
550 DIR_SEPARATOR_STRING "${norm_lib_dir_suffix}")
553 adl_COMPUTE_RELATIVE_PATHS([expanded_bindir:expanded_datadir:bin2data_dir])
554 adl_NORMALIZE_PATH(bin2data_dir, [$sdccconf_h_dir_separator])
555 AC_DEFINE_UNQUOTED(BIN2DATA_DIR,
556 DIR_SEPARATOR_STRING "${bin2data_dir}")
558 adl_COMPUTE_RELATIVE_PATHS([expanded_prefix:expanded_bindir:prefix2bin_dir])
559 adl_NORMALIZE_PATH(prefix2bin_dir, [$sdccconf_h_dir_separator])
560 AC_DEFINE_UNQUOTED(PREFIX2BIN_DIR,
561 DIR_SEPARATOR_STRING "${prefix2bin_dir}")
563 adl_COMPUTE_RELATIVE_PATHS([expanded_prefix:expanded_datadir:prefix2data_dir])
564 adl_NORMALIZE_PATH(prefix2data_dir, [$sdccconf_h_dir_separator])
565 if test "${prefix2data_dir}" = "."; then
566 # small optimization for Mingw32; otherwise Borut will complain ;-)
567 AC_DEFINE_UNQUOTED(PREFIX2DATA_DIR, "")
569 AC_DEFINE_UNQUOTED(PREFIX2DATA_DIR,
570 DIR_SEPARATOR_STRING "${prefix2data_dir}")
574 AC_DEFINE_UNQUOTED(STD_LIB, "libsdcc")
575 AC_DEFINE_UNQUOTED(STD_INT_LIB, "libint")
576 AC_DEFINE_UNQUOTED(STD_LONG_LIB, "liblong")
577 AC_DEFINE_UNQUOTED(STD_FP_LIB, "libfloat")
578 AC_DEFINE_UNQUOTED(STD_DS390_LIB, "libds390")
579 AC_DEFINE_UNQUOTED(STD_DS400_LIB, "libds400")
580 AC_DEFINE_UNQUOTED(STD_XA51_LIB, "libxa51")
582 # SDCC runtime environment variables
583 sdcc_dir_name="SDCC_HOME"
584 AC_DEFINE_UNQUOTED(SDCC_DIR_NAME, "${sdcc_dir_name}")
586 sdcc_include_name="SDCC_INCLUDE"
587 AC_DEFINE_UNQUOTED(SDCC_INCLUDE_NAME, "${sdcc_include_name}")
589 sdcc_lib_name="SDCC_LIB"
590 AC_DEFINE_UNQUOTED(SDCC_LIB_NAME, "${sdcc_lib_name}")
592 # Port selection helper
593 # ===========================================================================
594 # macro AC_DO_ENABLER()
595 # $1 used to access enable_$1, e.g. enable_doc
596 # $2 OPT_DISABLE_$2, normally uppercase of $1, e.g. DOC
598 AC_DEFUN([AC_DO_ENABLER], [
599 AC_ARG_ENABLE($1, AC_HELP_STRING([--enable-$1], $3))
601 if test "[$]enable_$1" = "yes"; then
607 AC_DEFINE_UNQUOTED(OPT_ENABLE_$2, [$]OPT_ENABLE_$2)
608 AC_SUBST(OPT_ENABLE_$2)
611 # macro AC_DO_DISABLER()
612 # $1 used to access disable_$1, e.g. ucsim
613 # $2 OPT_DISABLE_$2, normally uppercase of $1, e.g. UCSIM
615 AC_DEFUN([AC_DO_DISABLER], [
616 AC_ARG_ENABLE($1, AC_HELP_STRING([--disable-$1], $3))
618 dnl the '-' in 'device-lib' needs special handling,
619 dnl because the variable is 'enable_device_lib'
620 arg1=`echo $1 | sed s/-/_/`
622 if test "`eval echo \\$enable_$arg1`" = "no"; then
628 AC_DEFINE_UNQUOTED(OPT_DISABLE_$2, [$]OPT_DISABLE_$2)
629 AC_SUBST(OPT_DISABLE_$2)
632 # macro AC_DO_PORT($1, $2, $3, $4)
633 # $1 used to access enable_$2_port, e.g. gbz80
634 # $2 port name in ports.all and ports.build, e.g. z80
635 # $3 OPT_DISABLE_$3, normally uppercase of $2, e.g. GBZ80
637 AC_DEFUN([AC_DO_PORT], [
638 AC_ARG_ENABLE($1-port,
639 AC_HELP_STRING([--disable-$1-port], $4))
641 if test "[$]enable_$1_port" = "no"; then
648 AC_DEFINE_UNQUOTED(OPT_DISABLE_$3, [$]OPT_DISABLE_$3)
649 AC_SUBST(OPT_DISABLE_$3)
652 if test [$]OPT_DISABLE_$3 = 0; then
653 echo $2 >>ports.build
657 # Now handle the port selection
658 # ===========================================================================
659 rm -f ports.all ports.build
660 AC_DO_PORT(mcs51, mcs51, MCS51, [Excludes the Intel mcs51 port])
661 AC_DO_PORT(gbz80, z80, GBZ80, [Excludes the Gameboy gbz80 port])
662 AC_DO_PORT(z80, z80, Z80, [Excludes the z80 port])
663 AC_DO_PORT(avr, avr, AVR, [Excludes the AVR port])
664 AC_DO_PORT(ds390, ds390, DS390, [Excludes the DS390 port])
665 AC_DEFINE_UNQUOTED(OPT_DISABLE_TININative, $OPT_DISABLE_DS390)
666 AC_DO_PORT(ds400, ds400, DS400, [Excludes the DS400 port])
667 AC_DO_PORT(pic, pic, PIC, [Excludes the PIC port])
668 AC_DO_PORT(pic16, pic16, PIC16, [Excludes the PIC16 port])
669 AC_DO_PORT(xa51, xa51, XA51, [Excludes the XA51 port])
670 AC_DO_PORT(hc08, hc08, HC08, [Excludes the HC08 port])
672 AC_DO_DISABLER(ucsim, UCSIM, [Disables configuring and building of ucsim])
673 AC_DO_DISABLER(device-lib, DEVICE_LIB, [Disables building device libraries])
674 AC_DO_DISABLER(packihx, PACKIHX, [Disables building packihx])
675 AC_DO_DISABLER(sdcpp, SDCPP, [Disables building sdcpp])
676 AC_DO_DISABLER(sdcdb, SDCDB, [Disables building sdcdb])
678 AC_DO_ENABLER(doc, DOC, [Enables building the documentation])
679 AC_CHECK_PROG([LYX], [lyx], [lyx], [:])
680 AC_CHECK_PROG([LATEX2HTML], [latex2html], [latex2html], [:])
681 AC_CHECK_PROG([PDFLATEX], [pdflatex], [pdflatex], [:])
682 AC_CHECK_PROG([PDFOPT], [pdfopt], [pdfopt], [:])
683 AC_CHECK_PROG([MAKEINDEX], [makeindex], [makeindex], [:])
685 if test $OPT_ENABLE_DOC = 1; then
686 SDCC_REQUIRE_PROG($LYX, lyx)
687 SDCC_REQUIRE_PROG($LATEX2HTML, latex2html)
688 SDCC_REQUIRE_PROG($PDFLATEX, pdflatex)
689 SDCC_REQUIRE_PROG($PDFOPT, pdfopt)
690 SDCC_REQUIRE_PROG($MAKEINDEX, makeindex)
693 AC_DO_ENABLER(libgc, LIBGC, [Use the Bohem memory allocator. Lower runtime footprint.])
694 if test $OPT_ENABLE_LIBGC = 1; then
695 AC_CHECK_LIB(gc, GC_malloc)
696 if test $ac_cv_lib_gc_GC_malloc = no; then
697 AC_MSG_ERROR([Cannot find library libgc with Bohem memory allocator.])
704 uniq ports.build ports
707 # Generating output files
708 # ===========================================================================
709 test $OPT_DISABLE_SDCPP = 0 && AC_CONFIG_SUBDIRS(support/cpp)
710 test $OPT_DISABLE_PACKIHX = 0 && AC_CONFIG_SUBDIRS(support/packihx)
711 test $OPT_DISABLE_UCSIM = 0 && AC_CONFIG_SUBDIRS(sim/ucsim)
712 test $OPT_DISABLE_SDCDB = 0 && AC_CONFIG_SUBDIRS(debugger/mcs51)
713 AC_CONFIG_FILES([doc/Makefile])
715 test $OPT_DISABLE_AVR = 0 && AC_CONFIG_FILES([src/avr/Makefile])
717 if test $OPT_DISABLE_DS390 = 0; then
718 AC_CONFIG_FILES([src/ds390/Makefile])
719 test $OPT_DISABLE_DEVICE_LIB = 0 && AC_CONFIG_FILES([device/lib/ds390/Makefile])
722 if test $OPT_DISABLE_DS400 = 0; then
723 AC_CONFIG_FILES([src/ds400/Makefile])
724 test $OPT_DISABLE_DEVICE_LIB = 0 && AC_CONFIG_FILES([device/lib/ds400/Makefile])
727 if test $OPT_DISABLE_HC08 = 0; then
728 AC_CONFIG_FILES([src/hc08/Makefile
730 as/link/hc08/Makefile])
731 test $OPT_DISABLE_DEVICE_LIB = 0 && AC_CONFIG_FILES([device/lib/hc08/Makefile])
734 if test $OPT_DISABLE_MCS51 = 0; then
735 AC_CONFIG_FILES([src/mcs51/Makefile
737 as/link/mcs51/Makefile])
738 test $OPT_DISABLE_DEVICE_LIB = 0 && AC_CONFIG_FILES([device/lib/mcs51/Makefile
739 device/lib/small/Makefile
740 device/lib/medium/Makefile
741 device/lib/large/Makefile])
744 if test $OPT_DISABLE_PIC = 0; then
745 AC_CONFIG_FILES(src/pic/Makefile)
746 test $OPT_DISABLE_DEVICE_LIB = 0 && AC_CONFIG_SUBDIRS(device/lib/pic)
748 if test $OPT_DISABLE_PIC16 = 0; then
749 AC_CONFIG_FILES(src/pic16/Makefile)
750 test $OPT_DISABLE_DEVICE_LIB = 0 && AC_CONFIG_SUBDIRS(device/lib/pic16)
753 test $OPT_DISABLE_XA51 = 0 && AC_CONFIG_FILES([src/xa51/Makefile])
755 if test $OPT_DISABLE_Z80 = 0; then
756 AC_CONFIG_FILES([src/z80/Makefile
760 as/link/z80/Makefile])
761 test $OPT_DISABLE_DEVICE_LIB = 0 && AC_CONFIG_FILES([device/lib/z80/Makefile
762 device/lib/gbz80/Makefile])
765 test $OPT_DISABLE_DEVICE_LIB = 0 && AC_CONFIG_FILES([device/lib/Makefile])
767 AC_CONFIG_FILES([main.mk:main_in.mk
769 device/include/Makefile
770 support/librarian/Makefile
771 support/makebin/Makefile
772 support/regression/Makefile
773 support/valdiag/Makefile
775 Makefile.common:Makefile.common.in
779 # I found no better place
782 # Prepare result message
783 # ======================
785 # In the C-header we need \\ as dir-separator, but in the message only \
786 dirch=${sdccconf_h_dir_separator}
787 test ${dirch} = '\\' && dirch='\'
789 # calc friendly strings
790 adl_NORMALIZE_PATH_MSG(/${prefix2bin_dir}, [binPath], [$dirch])
791 adl_NORMALIZE_PATH_MSG(/${prefix2data_dir}/${norm_inc_dir_suffix}, [incPath1], [$dirch])
792 adl_NORMALIZE_PATH_MSG(/${bin2data_dir}/${norm_inc_dir_suffix}, [incPath2], [$dirch])
793 adl_NORMALIZE_PATH_MSG(${expanded_datadir}/${norm_inc_dir_suffix}, [incPath3], [$dirch])
794 adl_NORMALIZE_PATH_MSG(/${prefix2data_dir}/${norm_lib_dir_suffix}, [libPath1], [$dirch])
795 adl_NORMALIZE_PATH_MSG(/${bin2data_dir}/${norm_lib_dir_suffix}, [libPath2], [$dirch])
796 adl_NORMALIZE_PATH_MSG(${expanded_datadir}/${norm_lib_dir_suffix}, [libPath3], [$dirch])
799 sdcc ${VERSION} is now configured for
801 Build: ${build_alias}
803 Source directory: ${srcdir}
808 avr ${enable_avr_port}
809 ds390 ${enable_ds390_port}
810 ds400 ${enable_ds400_port}
811 gbz80 ${enable_gbz80_port}
812 hc08 ${enable_hc08_port}
813 mcs51 ${enable_mcs51_port}
814 pic ${enable_pic_port}
815 pic16 ${enable_pic16_port}
816 xa51 ${enable_xa51_port}
817 z80 ${enable_z80_port}
819 Disable packihx: ${OPT_DISABLE_PACKIHX}
820 Disable ucsim: ${OPT_DISABLE_UCSIM}
821 Disable device lib: ${OPT_DISABLE_DEVICE_LIB}
822 Disable sdcpp: ${OPT_DISABLE_SDCPP}
823 Disable sdcdb: ${OPT_DISABLE_SDCDB}
824 Enable documentation: ${OPT_ENABLE_DOC}
825 Enable libgc: ${OPT_ENABLE_LIBGC}
828 binary files: ${exec_prefix}
829 include files: ${datadir}/${include_dir_suffix}
830 library files: ${datadir}/${lib_dir_suffix}
831 documentation: ${docdir}
835 datarootdir: ${datarootdir}
837 Search paths (incomplete, see manual for all search paths):
838 binary files: \$SDCC_HOME${binPath}
839 include files: ${incPath1}
840 path(argv[[0]])${incPath2}
842 library files: \$SDCC_HOME${libPath1}${dirch}<model>
843 path(argv[[0]])${libPath2}${dirch}<model>
844 ${libPath3}${dirch}<model>
846 # End of configure/configure.in