]> git.gag.com Git - fw/sdcc/blob - configure.in
Changed "Insufficient DRAM memory" to "Insufficient space in data memory"
[fw/sdcc] / configure.in
1 #!/bin/sh
2
3 AC_PREREQ(2.54)
4 AC_INIT
5 AC_CONFIG_SRCDIR([Makefile])
6 AC_CONFIG_HEADER(sdccconf.h:sdccconf_in.h)
7
8 AC_PROG_AWK
9
10 AC_MSG_CHECKING(version of the package)
11 if test -f .version; then
12   VERSION=`cat .version`
13 elif test -f ../.version; then
14   VERSION=`cat ../.version`
15 else
16   VERSION="0.0.0"
17 fi
18 VERSIONHI=`echo $VERSION|$AWK 'BEGIN {FS="."} {print $1}'`
19 VERSIONLO=`echo $VERSION|$AWK 'BEGIN {FS="."} {print $2}'`
20 VERSIONP=`echo $VERSION|$AWK 'BEGIN {FS="."} {print $3}'`
21
22 AC_MSG_RESULT(${VERSION})
23 AC_SUBST(VERSION)
24 AC_SUBST(VERSIONHI)
25 AC_SUBST(VERSIONLO)
26 AC_SUBST(VERSIONP)
27 AC_DEFINE_UNQUOTED(SDCC_VERSION_LO, ${VERSIONLO})
28 AC_DEFINE_UNQUOTED(SDCC_VERSION_HI, ${VERSIONHI})
29 AC_DEFINE_UNQUOTED(SDCC_VERSION_P, ${VERSIONP})
30 AC_DEFINE_UNQUOTED(SDCC_VERSION_STR, "${VERSION}")
31 AC_ARG_PROGRAM
32 sdcc_cv_version=$VERSION
33 sdcc_cv_versionhi=$VERSIONHI
34 sdcc_cv_versionlo=$VERSIONLO
35 sdcc_cv_versionp=$VERSIONP
36
37
38 # Required programs
39 # ===========================================================================
40 AC_PROG_CC
41 AC_PROG_CXX
42 AC_PROG_CPP
43 AC_PROG_INSTALL
44 AC_PROG_RANLIB
45 AC_PROG_LEX
46 AC_PROG_YACC
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, :)
51
52 AC_CHECK_PROG(LYX,        lyx,        lyx, :)
53 AC_CHECK_PROG(LATEX,      latex,      latex, :)
54 AC_CHECK_PROG(LATEX2HTML, latex2html, latex2html, :)
55 AC_CHECK_PROG(PDFLATEX,   pdflatex,   pdflatex, :)
56 AC_CHECK_PROG(DVIPDF,     dvipdf,     dvipdf, :)
57
58 AC_DEFUN(SDCC_REQUIRE_PROG,
59 [if test "$1" = ":"; then
60   AC_MSG_ERROR([Cannot find required program $2.])
61  fi
62 ])
63
64 SDCC_REQUIRE_PROG($YACC, bison)
65 SDCC_REQUIRE_PROG($LEX, lex)
66
67 AC_LANG([C])
68
69
70 # Checking for header files.
71 # ===========================================================================
72 AC_CHECK_HEADERS(sys/socket.h)
73
74
75 # Checking for functions
76 # ===========================================================================
77 AC_CHECK_FUNCS(strerror)
78 AC_CHECK_FUNCS(vsnprintf snprintf vsprintf mkstemp)
79
80
81 # Macro definitions
82 # ===========================================================================
83
84 # DD_COPT macro checks if the compiler specified as the 1st parameter
85 # supports option specified as the 2nd parameter
86 # For example: DD_CPORT(CXX, fPIC)
87
88 AC_DEFUN(DD_COPT, [
89 AC_CACHE_CHECK(whether $$1 accepts -$2,sdcc_cv_$1$2,
90 cat >_test_.c <<EOF
91 #include <stdio.h>
92 void main(void) {}
93 EOF
94 $$1 -v -$2 -c _test_.c 1>&5 2>&5
95 if test "$?" = "0"; then
96   sdcc_cv_$1$2="yes"
97 else
98   sdcc_cv_$1$2="no"
99 fi
100 rm -f _test_.* a.out)
101 ])
102
103 # This macro expands DIR and assigns it to RET.
104 # If DIR is NONE, then it's replaced by DEFAULT.
105 #
106 # Based on AC_DEFINE_DIR
107 #
108 # Examples:
109 #
110 #  AC_EXPAND(prefix, "/usr/local", expanded_prefix)
111
112 AC_DEFUN([AC_EXPAND], [
113   test "x$prefix" = xNONE && prefix="$ac_default_prefix"
114   test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
115   ac_expand=[$]$1
116   test "x$ac_expand" = xNONE && ac_expand="[$]$2"
117   ac_expand=`eval echo [$]ac_expand`
118   $3=`eval echo [$]ac_expand`
119 ])
120
121 # adl_NORMALIZE_PATH
122 #
123 #  - empty paths are changed to '.'
124 #  - trailing slashes are removed
125 #  - repeated slashes are squeezed except a leading doubled slash '//'
126 #    (which might indicate a networked disk on some OS).
127 #
128 #
129 # REFERENCE_STRING is used to turn '/' into '\' and vice-versa: if
130 # REFERENCE_STRING contains some backslashes, all slashes and backslashes
131 # are turned into backslashes, otherwise they are all turned into slashes.
132 #
133 # This makes processing of DOS filenames quite easier, because you can turn a
134 # filename to the Unix notation, make your processing, and turn it back to
135 # original notation.
136
137 dnl Available from the GNU Autoconf Macro Archive at:
138 dnl http://www.gnu.org/software/ac-archive/htmldoc/normpath.html
139 dnl
140 AC_DEFUN([adl_NORMALIZE_PATH],
141 [case ":[$]$1:" in
142 # change empty paths to '.'
143   ::) $1='.' ;;
144 # strip trailing slashes
145   :*[[\\/]]:) $1=`echo "[$]$1" | sed 's,[[\\/]]*[$],,'` ;;
146   :*:) ;;
147 esac
148 # squeze repeated slashes
149 case ifelse($2,,"[$]$1",$2) in
150 # if the path contains any backslashes, turn slashes into backslashes
151
152 # Bernhard Held 2003-04-06
153 # This was the original line. It doesn't:
154 # - convert the first slash
155 # - replace a slash with a double-backslash
156 # *\\*) $1=`echo "[$]$1" | sed 's,\(.\)[[\\/]][[\\/]]*,\1\\\\,g'` ;;
157  *\\*) $1=`echo "[$]$1" | sed 's,\(.\)[[\\/]][[\\/]]*,\1\\\\\\\\,g' | sed 's,^[[\\/]],\\\\\\\\,'` ;;
158
159 # if the path contains slashes, also turn backslashes into slashes
160  *) $1=`echo "[$]$1" | sed 's,\(.\)[[\\/]][[\\/]]*,\1/,g'` ;;
161 esac])
162
163
164 # adl_COMPUTE_RELATIVE_PATH
165 #
166 # PATH_LIST is a space-separated list of colon-separated triplets of the form
167 # 'FROM:TO:RESULT'. This function iterates over these triplets and set $RESULT
168 # to the relative path from $FROM to $TO. Note that $FROM and $TO needs to be
169 # absolute filenames for this macro to success.
170
171 AC_DEFUN([adl_COMPUTE_RELATIVE_PATHS],
172 [for _lcl_i in $1; do
173   _lcl_from=\[$]`echo "[$]_lcl_i" | sed 's,:.*$,,'`
174   _lcl_to=\[$]`echo "[$]_lcl_i" | sed 's,^[[^:]]*:,,' | sed 's,:[[^:]]*$,,'`
175   _lcl_result_var=`echo "[$]_lcl_i" | sed 's,^.*:,,'`
176   adl_RECURSIVE_EVAL([[$]_lcl_from], [_lcl_from])
177   adl_RECURSIVE_EVAL([[$]_lcl_to], [_lcl_to])
178   _lcl_notation="$_lcl_from$_lcl_to"
179   adl_NORMALIZE_PATH([_lcl_from],['/'])
180   adl_NORMALIZE_PATH([_lcl_to],['/'])
181   adl_COMPUTE_RELATIVE_PATH([_lcl_from], [_lcl_to], [_lcl_result_tmp])
182   adl_NORMALIZE_PATH([_lcl_result_tmp],["[$]_lcl_notation"])
183   eval $_lcl_result_var='[$]_lcl_result_tmp'
184 done])
185
186 ## Note:
187 ## *****
188 ## The following helper macros are too fragile to be used out
189 ## of adl_COMPUTE_RELATIVE_PATHS (mainly because they assume that
190 ## paths are normalized), that's why I'm keeping them in the same file.
191 ## Still, some of them maybe worth to reuse.
192
193 dnl adl_COMPUTE_RELATIVE_PATH(FROM, TO, RESULT)
194 dnl ===========================================
195 dnl Compute the relative path to go from $FROM to $TO and set the value
196 dnl of $RESULT to that value.  This function work on raw filenames
197 dnl (for instead it will considerate /usr//local and /usr/local as
198 dnl two distinct paths), you should really use adl_COMPUTE_REALTIVE_PATHS
199 dnl instead to have the paths sanitized automatically.
200 dnl
201 dnl For instance:
202 dnl    first_dir=/somewhere/on/my/disk/bin
203 dnl    second_dir=/somewhere/on/another/disk/share
204 dnl    adl_COMPUTE_RELATIVE_PATH(first_dir, second_dir, first_to_second)
205 dnl will set $first_to_second to '../../../another/disk/share'.
206 AC_DEFUN([adl_COMPUTE_RELATIVE_PATH],
207 [adl_COMPUTE_COMMON_PATH([$1], [$2], [_lcl_common_prefix])
208 adl_COMPUTE_BACK_PATH([$1], [_lcl_common_prefix], [_lcl_first_rel])
209 adl_COMPUTE_SUFFIX_PATH([$2], [_lcl_common_prefix], [_lcl_second_suffix])
210 $3="[$]_lcl_first_rel[$]_lcl_second_suffix"])
211
212 dnl adl_COMPUTE_COMMON_PATH(LEFT, RIGHT, RESULT)
213 dnl ============================================
214 dnl Compute the common path to $LEFT and $RIGHT and set the result to $RESULT.
215 dnl
216 dnl For instance:
217 dnl    first_path=/somewhere/on/my/disk/bin
218 dnl    second_path=/somewhere/on/another/disk/share
219 dnl    adl_COMPUTE_COMMON_PATH(first_path, second_path, common_path)
220 dnl will set $common_path to '/somewhere/on'.
221 AC_DEFUN([adl_COMPUTE_COMMON_PATH],
222 [$3=''
223 _lcl_second_prefix_match=''
224 while test "[$]_lcl_second_prefix_match" != 0; do
225   _lcl_first_prefix=`expr "x[$]$1" : "x\([$]$3/*[[^/]]*\)"`
226   _lcl_second_prefix_match=`expr "x[$]$2" : "x[$]_lcl_first_prefix"`
227   if test "[$]_lcl_second_prefix_match" != 0; then
228     if test "[$]_lcl_first_prefix" != "[$]$3"; then
229       $3="[$]_lcl_first_prefix"
230     else
231       _lcl_second_prefix_match=0
232     fi
233   fi
234 done])
235
236 dnl adl_COMPUTE_SUFFIX_PATH(PATH, SUBPATH, RESULT)
237 dnl ==============================================
238 dnl Substrack $SUBPATH from $PATH, and set the resulting suffix
239 dnl (or the empty string if $SUBPATH is not a subpath of $PATH)
240 dnl to $RESULT.
241 dnl
242 dnl For instace:
243 dnl    first_path=/somewhere/on/my/disk/bin
244 dnl    second_path=/somewhere/on
245 dnl    adl_COMPUTE_SUFFIX_PATH(first_path, second_path, common_path)
246 dnl will set $common_path to '/my/disk/bin'.
247 AC_DEFUN([adl_COMPUTE_SUFFIX_PATH],
248 [$3=`expr "x[$]$1" : "x[$]$2/*\(.*\)"`])
249
250 dnl adl_COMPUTE_BACK_PATH(PATH, SUBPATH, RESULT)
251 dnl ============================================
252 dnl Compute the relative path to go from $PATH to $SUBPATH, knowing that
253 dnl $SUBPATH is a subpath of $PATH (any other words, only repeated '../'
254 dnl should be needed to move from $PATH to $SUBPATH) and set the value
255 dnl of $RESULT to that value.  If $SUBPATH is not a subpath of PATH,
256 dnl set $RESULT to the empty string.
257 dnl
258 dnl For instance:
259 dnl    first_path=/somewhere/on/my/disk/bin
260 dnl    second_path=/somewhere/on
261 dnl    adl_COMPUTE_BACK_PATH(first_path, second_path, back_path)
262 dnl will set $back_path to '../../../'.
263 AC_DEFUN([adl_COMPUTE_BACK_PATH],
264 [adl_COMPUTE_SUFFIX_PATH([$1], [$2], [_lcl_first_suffix])
265 $3=''
266 _lcl_tmp='xxx'
267 while test "[$]_lcl_tmp" != ''; do
268   _lcl_tmp=`expr "x[$]_lcl_first_suffix" : "x[[^/]]*/*\(.*\)"`
269   if test "[$]_lcl_first_suffix" != ''; then
270      _lcl_first_suffix="[$]_lcl_tmp"
271      $3="../[$]$3"
272   fi
273 done])
274
275
276 dnl adl_RECURSIVE_EVAL(VALUE, RESULT)
277 dnl =================================
278 dnl Interpolate the VALUE in loop until it doesn't change,
279 dnl and set the result to $RESULT.
280 dnl WARNING: It's easy to get an infinite loop with some unsane input.
281 AC_DEFUN([adl_RECURSIVE_EVAL],
282 [_lcl_receval="$1"
283 $2=`(test "x$prefix" = xNONE && prefix="$ac_default_prefix"
284      test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
285      _lcl_receval_old=''
286      while test "[$]_lcl_receval_old" != "[$]_lcl_receval"; do
287        _lcl_receval_old="[$]_lcl_receval"
288        eval _lcl_receval="\"[$]_lcl_receval\""
289      done
290      echo "[$]_lcl_receval")`])
291
292
293 # AC_NORMALIZE_DEFINE_UNQUOTED(var, DEFINE, REFERENCE_STRING)
294
295 AC_DEFUN([AC_NORMALIZE_DEFINE_UNQUOTED], [
296   ac_ndu=[$]$1
297   adl_NORMALIZE_PATH([ac_ndu], [$]$3)
298   AC_DEFINE_UNQUOTED($2, "${ac_ndu}")
299 ])
300
301
302 # Checking characteristics of compilers and other programs
303 # ===========================================================================
304 AC_CACHE_CHECK(whether preprocessor accepts -MM or -M,sdcc_cv_MM,
305 echo "#include <stdio.h>" >_test_.c
306 echo "" >>_test_.c
307 $CPP -v -MM _test_.c 1>&5 2>&5
308 if test "$?" = "0"; then
309   sdcc_cv_MM="-MM"
310 else
311   sdcc_cv_MM="-M"
312 fi
313 rm -f _test_.*)
314 M_OR_MM=$sdcc_cv_MM
315 AC_SUBST(M_OR_MM)
316
317 # This is the first time when CFLAGS are set/modified!!
318 DD_COPT(CC, ggdb)
319 if test "$sdcc_cv_CCggdb" = "yes"; then
320   CFLAGS="-ggdb ${CFLAGS}"
321 fi
322
323 DD_COPT(CC, pipe)
324 if test "$sdcc_cv_CCpipe" = "yes"; then
325   CFLAGS="-pipe $CFLAGS"
326 fi
327
328
329 # Checks for typedefs, structures, and compiler characteristics.
330 # ===========================================================================
331 AC_TYPE_SIGNAL
332
333 AC_CHECK_SIZEOF(char)
334 AC_CHECK_SIZEOF(short)
335 AC_CHECK_SIZEOF(int)
336 AC_CHECK_SIZEOF(long)
337
338 type_name()
339 {
340     if expr "$ac_cv_sizeof_char" '>=' "$1" >/dev/null; then
341         echo "char"
342         exit
343     fi
344     if expr "$ac_cv_sizeof_short" '>=' "$1" >/dev/null; then
345         echo "short"
346         exit
347     fi
348     if expr "$ac_cv_sizeof_int" '>=' "$1" >/dev/null; then
349         echo "int"
350         exit
351     fi
352     if expr "$ac_cv_sizeof_long" '>=' "$1" >/dev/null; then
353         echo "long"
354         exit
355     fi
356     echo "long"
357 }
358
359 AC_MSG_CHECKING(type name for byte)
360 TYPE_BYTE=`type_name 1`
361 AC_MSG_RESULT($TYPE_BYTE)
362 AC_MSG_CHECKING(type name for word)
363 TYPE_WORD=`type_name 2`
364 AC_MSG_RESULT($TYPE_WORD)
365 AC_MSG_CHECKING(type name for dword)
366 TYPE_DWORD=`type_name 4`
367 AC_MSG_RESULT($TYPE_DWORD)
368 AC_DEFINE_UNQUOTED(TYPE_BYTE,  $TYPE_BYTE)
369 AC_DEFINE_UNQUOTED(TYPE_WORD,  $TYPE_WORD)
370 AC_DEFINE_UNQUOTED(TYPE_DWORD, $TYPE_DWORD)
371
372 AC_C_BIGENDIAN
373
374 # Set standard installation paths
375 # ===========================================================================
376
377 # In the Makefiles we need paths with '/' as directory separator, even if
378 # crosscompiling for Win32.
379 # And we want to preserve the macros (e.g. ${prefix}) in the Makefiles.
380 # The variables in the Makefiles are replaced by AC_SUBST()
381 #
382 # In sdccconf.h the '/' in paths can be replaced by "\\" (normalized), if
383 #
384 # The macros are expanded for the header.
385 # The variables in the header are replaced by AC_*DEFINE*()
386 # sdccconf_h_dir_separator contains a backslash.
387 AC_ARG_VAR(sdccconf_h_dir_separator, needed in sdccconf.h: either "/" (default) or "\\")
388 if test "${sdccconf_h_dir_separator}" = ""; then
389     sdccconf_h_dir_separator="/"
390 fi
391
392 # Makefiles
393 ###########
394
395 # include_dir_suffix:
396 # *nix default: "sdcc/include"
397
398 AC_ARG_VAR(include_dir_suffix, appended to datadir to define SDCC's include directory)
399 if test "${include_dir_suffix}" = ""; then
400     include_dir_suffix="sdcc/include"
401 fi
402 AC_SUBST(include_dir_suffix)
403
404 # lib_dir_suffix:
405 # *nix default: "sdcc/lib"
406 AC_ARG_VAR(lib_dir_suffix, appended to datadir to define SDCC's library root directory)
407 if test "${lib_dir_suffix}" = ""; then
408     lib_dir_suffix="sdcc/lib"
409 fi
410 AC_SUBST(lib_dir_suffix)
411
412 # docdir:
413 # *nix default: "${datadir}/sdcc/doc"
414 AC_ARG_VAR(docdir, documentation installation directory)
415 if test "${docdir}" = ""; then
416     docdir="\${datadir}"/sdcc/doc
417 fi
418 AC_SUBST(docdir)
419
420 AC_SUBST(EXEEXT)
421
422 # sdccconf.h
423 ############
424
425 AC_DEFINE_UNQUOTED(DIR_SEPARATOR_STRING, "${sdccconf_h_dir_separator}")
426 AC_DEFINE_UNQUOTED(DIR_SEPARATOR_CHAR  , '${sdccconf_h_dir_separator}')
427
428 # prefix:
429 # default: "NONE", ${ac_default_prefix}: "/usr/local"
430 AC_EXPAND(prefix, ac_default_prefix, expanded_prefix)
431 AC_NORMALIZE_DEFINE_UNQUOTED(expanded_prefix, PREFIX, sdccconf_h_dir_separator)
432
433 # exec_prefix:
434 # default: "${prefix}"
435 AC_EXPAND(exec_prefix, expanded_prefix, expanded_exec_prefix)
436 AC_NORMALIZE_DEFINE_UNQUOTED(expanded_exec_prefix, EXEC_PREFIX, sdccconf_h_dir_separator)
437
438 # bindir:
439 # default: "${exec_prefix}/bin"
440 AC_EXPAND(bindir, "NONE", expanded_bindir)
441 AC_NORMALIZE_DEFINE_UNQUOTED(expanded_bindir, BINDIR, sdccconf_h_dir_separator)
442
443 # datadir:
444 # default: "${prefix}/share"
445 AC_EXPAND(datadir, "NONE", expanded_datadir)
446 AC_NORMALIZE_DEFINE_UNQUOTED(expanded_datadir, DATADIR, sdccconf_h_dir_separator)
447
448 # include/lib suffix
449 norm_inc_dir_suffix=${include_dir_suffix}
450 adl_NORMALIZE_PATH([norm_inc_dir_suffix], [$sdccconf_h_dir_separator])
451 AC_DEFINE_UNQUOTED(INCLUDE_DIR_SUFFIX,
452                    DIR_SEPARATOR_STRING "${norm_inc_dir_suffix}")
453 norm_lib_dir_suffix=${lib_dir_suffix}
454 adl_NORMALIZE_PATH([norm_lib_dir_suffix], [$sdccconf_h_dir_separator])
455 AC_DEFINE_UNQUOTED(LIB_DIR_SUFFIX,
456                    DIR_SEPARATOR_STRING "${norm_lib_dir_suffix}")
457
458 # relative paths
459 adl_COMPUTE_RELATIVE_PATHS([expanded_bindir:expanded_datadir:bin2data_dir])
460 adl_NORMALIZE_PATH(bin2data_dir, [$sdccconf_h_dir_separator])
461 AC_DEFINE_UNQUOTED(BIN2DATA_DIR,
462                    DIR_SEPARATOR_STRING "${bin2data_dir}")
463
464 adl_COMPUTE_RELATIVE_PATHS([expanded_prefix:expanded_bindir:prefix2bin_dir])
465 adl_NORMALIZE_PATH(prefix2bin_dir, [$sdccconf_h_dir_separator])
466 AC_DEFINE_UNQUOTED(PREFIX2BIN_DIR,
467                    DIR_SEPARATOR_STRING "${prefix2bin_dir}")
468
469 adl_COMPUTE_RELATIVE_PATHS([expanded_prefix:expanded_datadir:prefix2data_dir])
470 adl_NORMALIZE_PATH(prefix2data_dir, [$sdccconf_h_dir_separator])
471 if test "${prefix2data_dir}" = "."; then
472     # small optimization for Mingw32; otherwise Borut will complain ;-)
473     AC_DEFINE_UNQUOTED(PREFIX2DATA_DIR, "")
474 else
475     AC_DEFINE_UNQUOTED(PREFIX2DATA_DIR,
476                        DIR_SEPARATOR_STRING "${prefix2data_dir}")
477 fi
478
479 # standard libs
480 AC_DEFINE_UNQUOTED(STD_LIB,       "libsdcc")
481 AC_DEFINE_UNQUOTED(STD_INT_LIB,   "libint")
482 AC_DEFINE_UNQUOTED(STD_LONG_LIB,  "liblong")
483 AC_DEFINE_UNQUOTED(STD_FP_LIB,    "libfloat")
484 AC_DEFINE_UNQUOTED(STD_DS390_LIB, "libds390")
485 AC_DEFINE_UNQUOTED(STD_DS400_LIB, "libds400")
486 AC_DEFINE_UNQUOTED(STD_XA51_LIB,  "libxa51")
487
488 # SDCC runtime environment variables
489 sdcc_dir_name="SDCC_HOME"
490 AC_DEFINE_UNQUOTED(SDCC_DIR_NAME, "${sdcc_dir_name}")
491
492 sdcc_include_name="SDCC_INCLUDE"
493 AC_DEFINE_UNQUOTED(SDCC_INCLUDE_NAME, "${sdcc_include_name}")
494
495 sdcc_lib_name="SDCC_LIB"
496 AC_DEFINE_UNQUOTED(SDCC_LIB_NAME, "${sdcc_lib_name}")
497
498 # Now handle the port selection
499 # ===========================================================================
500 rm -f ports.all ports.build
501 AC_ARG_ENABLE(mcs51-port,
502             AC_HELP_STRING([--disable-mcs51-port],
503                            [Excludes the Intel mcs51 port]))
504 echo mcs51 >>ports.all
505 if test "$enable_mcs51_port" = "no"; then
506     AC_DEFINE_UNQUOTED(OPT_DISABLE_MCS51, 1)
507 else
508     echo mcs51 >>ports.build
509     AC_DEFINE_UNQUOTED(OPT_DISABLE_MCS51, 0)
510 fi
511
512 AC_ARG_ENABLE(gbz80-port,
513             AC_HELP_STRING([--disable-gbz80-port],
514                            [Excludes the Gameboy gbz80 port]))
515 echo z80 >>ports.all
516 if test "$enable_gbz80_port" = "no"; then
517     AC_DEFINE_UNQUOTED(OPT_DISABLE_GBZ80, 1)
518 else
519     echo z80 >>ports.build
520     AC_DEFINE_UNQUOTED(OPT_DISABLE_GBZ80, 0)
521 fi
522
523 AC_ARG_ENABLE(z80-port,
524             AC_HELP_STRING([--disable-z80-port],
525                            [Excludes the z80 port]))
526 echo z80 >>ports.all
527 if test "$enable_z80_port" = "no"; then
528     AC_DEFINE_UNQUOTED(OPT_DISABLE_Z80, 1)
529 else
530     echo z80 >>ports.build
531     AC_DEFINE_UNQUOTED(OPT_DISABLE_Z80, 0)
532 fi
533
534 AC_ARG_ENABLE(avr-port,
535             AC_HELP_STRING([--disable-avr-port],
536                            [Excludes the AVR port]))
537 echo avr >>ports.all
538 if test "$enable_avr_port" = "no"; then
539     AC_DEFINE_UNQUOTED(OPT_DISABLE_AVR, 1)
540 else
541     echo avr >>ports.build
542     AC_DEFINE_UNQUOTED(OPT_DISABLE_AVR, 0)
543 fi
544
545 AC_ARG_ENABLE(ds390-port,
546             AC_HELP_STRING([--disable-ds390-port],
547                            [Excludes the DS390 port]))
548 echo ds390 >>ports.all
549 if test "$enable_ds390_port" = "no"; then
550     AC_DEFINE_UNQUOTED(OPT_DISABLE_DS390, 1)
551     AC_DEFINE_UNQUOTED(OPT_DISABLE_TININative, 1)
552 else
553     echo ds390 >>ports.build
554     AC_DEFINE_UNQUOTED(OPT_DISABLE_DS390, 0)
555     AC_DEFINE_UNQUOTED(OPT_DISABLE_TININative, 0)
556 fi
557
558 AC_ARG_ENABLE(ds400-port,
559             AC_HELP_STRING([--disable-ds400-port],
560                            [Excludes the DS400 port]))
561 echo ds400 >>ports.all
562 if test "$enable_ds400_port" = "no"; then
563     AC_DEFINE_UNQUOTED(OPT_DISABLE_DS400, 1)
564 else
565     echo ds400 >>ports.build
566     AC_DEFINE_UNQUOTED(OPT_DISABLE_DS400, 0)
567 fi
568
569 AC_ARG_ENABLE(pic-port,
570             AC_HELP_STRING([--disable-pic-port],
571                            [Excludes the PIC port]))
572 echo pic >>ports.all
573 if test "$enable_pic_port" = "no"; then
574     AC_DEFINE_UNQUOTED(OPT_DISABLE_PIC, 1)
575 else
576     echo pic >>ports.build
577     AC_DEFINE_UNQUOTED(OPT_DISABLE_PIC, 0)
578 fi
579
580 AC_ARG_ENABLE(pic16-port,
581             AC_HELP_STRING([--disable-pic16-port],
582                            [Excludes the PIC port]))
583 echo pic16 >>ports.all
584 if test "$enable_pic16_port" = "no"; then
585     AC_DEFINE_UNQUOTED(OPT_DISABLE_PIC16, 1)
586 else
587     echo pic16 >>ports.build
588     AC_DEFINE_UNQUOTED(OPT_DISABLE_PIC16, 0)
589 fi
590
591 AC_ARG_ENABLE(xa51-port,
592             AC_HELP_STRING([--disable-xa51-port],
593                            [Excludes the XA51 port]))
594 echo xa51 >>ports.all
595 if test "$enable_xa51_port" = "no"; then
596     AC_DEFINE_UNQUOTED(OPT_DISABLE_XA51, 1)
597 else
598     echo xa51 >>ports.build
599     AC_DEFINE_UNQUOTED(OPT_DISABLE_XA51, 0)
600 fi
601
602 AC_ARG_ENABLE(ucsim,
603               AC_HELP_STRING([--disable-ucsim],
604                              [Disables configuring and building of ucsim]))
605 OPT_ENABLE_UCSIM=$enable_ucsim
606 AC_SUBST(OPT_ENABLE_UCSIM)
607
608 AC_ARG_ENABLE(device-lib-build,
609               AC_HELP_STRING([--disable-device-lib-build],
610                              [Disables automatically building device libraries]))
611 OPT_ENABLE_DEVICE_LIB_BUILD=$enable_device_lib_build
612 AC_SUBST(OPT_ENABLE_DEVICE_LIB_BUILD)
613
614 AC_ARG_ENABLE(packihx,
615               AC_HELP_STRING([--disable-packihx],
616                              [Disables building packihx]))
617 OPT_ENABLE_PACKIHX=$enable_packihx
618 AC_SUBST(OPT_ENABLE_PACKIHX)
619
620 AC_ARG_ENABLE(libgc,
621               AC_HELP_STRING([--enable-libgc],
622                              [Use the Bohem memory allocator. Lower runtime footprint.]))
623 if test "$enable_libgc" = "yes"; then
624         AC_CHECK_LIB(gc, GC_malloc)
625         OPT_ENABLE_LIBGC=1
626 else
627         OPT_ENABLE_LIBGC=0
628 fi
629 AC_DEFINE_UNQUOTED(OPT_ENABLE_LIBGC, $OPT_ENABLE_LIBGC)
630
631 #remove duplicates
632 uniq ports.all ports
633 mv ports ports.all
634 uniq ports.build ports
635 mv ports ports.build
636
637 # Generating output files
638 # ===========================================================================
639 AC_CONFIG_SUBDIRS(support/cpp2)
640 AC_CONFIG_SUBDIRS(packihx)
641 AC_CONFIG_SUBDIRS(sim/ucsim)
642 AC_CONFIG_FILES([main.mk:main_in.mk
643 src/Makefile
644 as/mcs51/Makefile
645 device/include/Makefile
646 device/lib/Makefile
647 debugger/mcs51/Makefile
648 Makefile.common:Makefile.common.in
649 ])
650 AC_OUTPUT
651
652 # End of configure/configure.in