* configure, configure.in: generate support/regression/Makefile
[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/libs
76 # ===========================================================================
77 AC_CHECK_LIB(socket,socket)
78 AC_CHECK_LIB(nsl,xdr_short)
79
80
81 # Checking for functions
82 # ===========================================================================
83 AC_CHECK_FUNCS(strerror)
84 AC_CHECK_FUNCS(vsnprintf snprintf vsprintf mkstemp)
85
86
87 # Macro definitions
88 # ===========================================================================
89
90 # DD_COPT macro checks if the compiler specified as the 1st parameter
91 # supports option specified as the 2nd parameter
92 # For example: DD_CPORT(CXX, fPIC)
93
94 AC_DEFUN(DD_COPT, [
95 AC_CACHE_CHECK(whether $$1 accepts -$2,sdcc_cv_$1$2,
96 cat >_test_.c <<EOF
97 #include <stdio.h>
98 void main(void) {}
99 EOF
100 $$1 -v -$2 -c _test_.c 1>&5 2>&5
101 if test "$?" = "0"; then
102   sdcc_cv_$1$2="yes"
103 else
104   sdcc_cv_$1$2="no"
105 fi
106 rm -f _test_.* a.out)
107 ])
108
109 # This macro expands DIR and assigns it to RET.
110 # If DIR is NONE, then it's replaced by DEFAULT.
111 #
112 # Based on AC_DEFINE_DIR
113 #
114 # Examples:
115 #
116 #  AC_EXPAND(prefix, "/usr/local", expanded_prefix)
117
118 AC_DEFUN([AC_EXPAND], [
119   test "x$prefix" = xNONE && prefix="$ac_default_prefix"
120   test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
121   ac_expand=[$]$1
122   test "x$ac_expand" = xNONE && ac_expand="[$]$2"
123   ac_expand=`eval echo [$]ac_expand`
124   $3=`eval echo [$]ac_expand`
125 ])
126
127 # adl_NORMALIZE_PATH
128 #
129 #  - empty paths are changed to '.'
130 #  - trailing slashes are removed
131 #  - repeated slashes are squeezed except a leading doubled slash '//'
132 #    (which might indicate a networked disk on some OS).
133 #
134 #
135 # REFERENCE_STRING is used to turn '/' into '\' and vice-versa: if
136 # REFERENCE_STRING contains some backslashes, all slashes and backslashes
137 # are turned into backslashes, otherwise they are all turned into slashes.
138 #
139 # This makes processing of DOS filenames quite easier, because you can turn a
140 # filename to the Unix notation, make your processing, and turn it back to
141 # original notation.
142
143 dnl Available from the GNU Autoconf Macro Archive at:
144 dnl http://www.gnu.org/software/ac-archive/htmldoc/normpath.html
145 dnl
146 AC_DEFUN([adl_NORMALIZE_PATH],
147 [case ":[$]$1:" in
148 # change empty paths to '.'
149   ::) $1='.' ;;
150 # strip trailing slashes
151   :*[[\\/]]:) $1=`echo "[$]$1" | sed 's,[[\\/]]*[$],,'` ;;
152   :*:) ;;
153 esac
154 # squeze repeated slashes
155 case ifelse($2,,"[$]$1",$2) in
156 # if the path contains any backslashes, turn slashes into backslashes
157
158 # Bernhard Held 2003-04-06
159 # This was the original line. It doesn't:
160 # - convert the first slash
161 # - replace a slash with a double-backslash
162 # *\\*) $1=`echo "[$]$1" | sed 's,\(.\)[[\\/]][[\\/]]*,\1\\\\,g'` ;;
163  *\\*) $1=`echo "[$]$1" | sed 's,\(.\)[[\\/]][[\\/]]*,\1\\\\\\\\,g' | sed 's,^[[\\/]],\\\\\\\\,'` ;;
164
165 # if the path contains slashes, also turn backslashes into slashes
166  *) $1=`echo "[$]$1" | sed 's,\(.\)[[\\/]][[\\/]]*,\1/,g'` ;;
167 esac])
168
169
170 # adl_COMPUTE_RELATIVE_PATH
171 #
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.
176
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'
190 done])
191
192 ## Note:
193 ## *****
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.
198
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.
206 dnl
207 dnl For instance:
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"])
217
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.
221 dnl
222 dnl For instance:
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],
228 [$3=''
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"
236     else
237       _lcl_second_prefix_match=0
238     fi
239   fi
240 done])
241
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)
246 dnl to $RESULT.
247 dnl
248 dnl For instace:
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/*\(.*\)"`])
255
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.
263 dnl
264 dnl For instance:
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])
271 $3=''
272 _lcl_tmp='xxx'
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"
277      $3="../[$]$3"
278   fi
279 done])
280
281
282 dnl adl_RECURSIVE_EVAL(VALUE, RESULT)
283 dnl =================================
284 dnl Interpolate the VALUE in loop until it doesn't change,
285 dnl and set the result to $RESULT.
286 dnl WARNING: It's easy to get an infinite loop with some unsane input.
287 AC_DEFUN([adl_RECURSIVE_EVAL],
288 [_lcl_receval="$1"
289 $2=`(test "x$prefix" = xNONE && prefix="$ac_default_prefix"
290      test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
291      _lcl_receval_old=''
292      while test "[$]_lcl_receval_old" != "[$]_lcl_receval"; do
293        _lcl_receval_old="[$]_lcl_receval"
294        eval _lcl_receval="\"[$]_lcl_receval\""
295      done
296      echo "[$]_lcl_receval")`])
297
298
299 # AC_NORMALIZE_DEFINE_UNQUOTED(var, DEFINE, REFERENCE_STRING)
300
301 AC_DEFUN([AC_NORMALIZE_DEFINE_UNQUOTED], [
302   ac_ndu=[$]$1
303   adl_NORMALIZE_PATH([ac_ndu], [$]$3)
304   AC_DEFINE_UNQUOTED($2, "${ac_ndu}")
305 ])
306
307
308 # Checking characteristics of compilers and other programs
309 # ===========================================================================
310 AC_CACHE_CHECK(whether preprocessor accepts -MM or -M,sdcc_cv_MM,
311 echo "#include <stdio.h>" >_test_.c
312 echo "" >>_test_.c
313 $CPP -v -MM _test_.c 1>&5 2>&5
314 if test "$?" = "0"; then
315   sdcc_cv_MM="-MM"
316 else
317   sdcc_cv_MM="-M"
318 fi
319 rm -f _test_.*)
320 M_OR_MM=$sdcc_cv_MM
321 AC_SUBST(M_OR_MM)
322
323 # This is the first time when CFLAGS are set/modified!!
324 DD_COPT(CC, ggdb)
325 if test "$sdcc_cv_CCggdb" = "yes"; then
326   CFLAGS="-ggdb ${CFLAGS}"
327 fi
328
329 DD_COPT(CC, pipe)
330 if test "$sdcc_cv_CCpipe" = "yes"; then
331   CFLAGS="-pipe $CFLAGS"
332 fi
333
334
335 # Checks for typedefs, structures, and compiler characteristics.
336 # ===========================================================================
337 AC_TYPE_SIGNAL
338
339 AC_CHECK_SIZEOF(char)
340 AC_CHECK_SIZEOF(short)
341 AC_CHECK_SIZEOF(int)
342 AC_CHECK_SIZEOF(long)
343
344 type_name()
345 {
346     if expr "$ac_cv_sizeof_char" '>=' "$1" >/dev/null; then
347         echo "char"
348         exit
349     fi
350     if expr "$ac_cv_sizeof_short" '>=' "$1" >/dev/null; then
351         echo "short"
352         exit
353     fi
354     if expr "$ac_cv_sizeof_int" '>=' "$1" >/dev/null; then
355         echo "int"
356         exit
357     fi
358     if expr "$ac_cv_sizeof_long" '>=' "$1" >/dev/null; then
359         echo "long"
360         exit
361     fi
362     echo "long"
363 }
364
365 AC_MSG_CHECKING(type name for byte)
366 TYPE_BYTE=`type_name 1`
367 AC_MSG_RESULT($TYPE_BYTE)
368 AC_MSG_CHECKING(type name for word)
369 TYPE_WORD=`type_name 2`
370 AC_MSG_RESULT($TYPE_WORD)
371 AC_MSG_CHECKING(type name for dword)
372 TYPE_DWORD=`type_name 4`
373 AC_MSG_RESULT($TYPE_DWORD)
374 AC_DEFINE_UNQUOTED(TYPE_BYTE,  $TYPE_BYTE)
375 AC_DEFINE_UNQUOTED(TYPE_WORD,  $TYPE_WORD)
376 AC_DEFINE_UNQUOTED(TYPE_DWORD, $TYPE_DWORD)
377
378 AC_C_BIGENDIAN
379
380 # Set standard installation paths
381 # ===========================================================================
382
383 # In the Makefiles we need paths with '/' as directory separator, even if
384 # crosscompiling for Win32.
385 # And we want to preserve the macros (e.g. ${prefix}) in the Makefiles.
386 # The variables in the Makefiles are replaced by AC_SUBST()
387 #
388 # In sdccconf.h the '/' in paths can be replaced by "\\" (normalized), if
389 #
390 # The macros are expanded for the header.
391 # The variables in the header are replaced by AC_*DEFINE*()
392 # sdccconf_h_dir_separator contains a backslash.
393 AC_ARG_VAR(sdccconf_h_dir_separator, needed in sdccconf.h: either "/" (default) or "\\")
394 if test "${sdccconf_h_dir_separator}" = ""; then
395     sdccconf_h_dir_separator="/"
396 fi
397
398 # Makefiles
399 ###########
400
401 # include_dir_suffix:
402 # *nix default: "sdcc/include"
403
404 AC_ARG_VAR(include_dir_suffix, appended to datadir to define SDCC's include directory)
405 if test "${include_dir_suffix}" = ""; then
406     include_dir_suffix="sdcc/include"
407 fi
408 AC_SUBST(include_dir_suffix)
409
410 # lib_dir_suffix:
411 # *nix default: "sdcc/lib"
412 AC_ARG_VAR(lib_dir_suffix, appended to datadir to define SDCC's library root directory)
413 if test "${lib_dir_suffix}" = ""; then
414     lib_dir_suffix="sdcc/lib"
415 fi
416 AC_SUBST(lib_dir_suffix)
417
418 # docdir:
419 # *nix default: "${datadir}/sdcc/doc"
420 AC_ARG_VAR(docdir, documentation installation directory)
421 if test "${docdir}" = ""; then
422     docdir="\${datadir}"/sdcc/doc
423 fi
424 AC_SUBST(docdir)
425
426 AC_SUBST(EXEEXT)
427
428 # sdccconf.h
429 ############
430
431 AC_DEFINE_UNQUOTED(DIR_SEPARATOR_STRING, "${sdccconf_h_dir_separator}")
432 AC_DEFINE_UNQUOTED(DIR_SEPARATOR_CHAR  , '${sdccconf_h_dir_separator}')
433
434 # prefix:
435 # default: "NONE", ${ac_default_prefix}: "/usr/local"
436 AC_EXPAND(prefix, ac_default_prefix, expanded_prefix)
437 AC_NORMALIZE_DEFINE_UNQUOTED(expanded_prefix, PREFIX, sdccconf_h_dir_separator)
438
439 # exec_prefix:
440 # default: "${prefix}"
441 AC_EXPAND(exec_prefix, expanded_prefix, expanded_exec_prefix)
442 AC_NORMALIZE_DEFINE_UNQUOTED(expanded_exec_prefix, EXEC_PREFIX, sdccconf_h_dir_separator)
443
444 # bindir:
445 # default: "${exec_prefix}/bin"
446 AC_EXPAND(bindir, "NONE", expanded_bindir)
447 AC_NORMALIZE_DEFINE_UNQUOTED(expanded_bindir, BINDIR, sdccconf_h_dir_separator)
448
449 # datadir:
450 # default: "${prefix}/share"
451 AC_EXPAND(datadir, "NONE", expanded_datadir)
452 AC_NORMALIZE_DEFINE_UNQUOTED(expanded_datadir, DATADIR, sdccconf_h_dir_separator)
453
454 # include/lib suffix
455 norm_inc_dir_suffix=${include_dir_suffix}
456 adl_NORMALIZE_PATH([norm_inc_dir_suffix], [$sdccconf_h_dir_separator])
457 AC_DEFINE_UNQUOTED(INCLUDE_DIR_SUFFIX,
458                    DIR_SEPARATOR_STRING "${norm_inc_dir_suffix}")
459 norm_lib_dir_suffix=${lib_dir_suffix}
460 adl_NORMALIZE_PATH([norm_lib_dir_suffix], [$sdccconf_h_dir_separator])
461 AC_DEFINE_UNQUOTED(LIB_DIR_SUFFIX,
462                    DIR_SEPARATOR_STRING "${norm_lib_dir_suffix}")
463
464 # relative paths
465 adl_COMPUTE_RELATIVE_PATHS([expanded_bindir:expanded_datadir:bin2data_dir])
466 adl_NORMALIZE_PATH(bin2data_dir, [$sdccconf_h_dir_separator])
467 AC_DEFINE_UNQUOTED(BIN2DATA_DIR,
468                    DIR_SEPARATOR_STRING "${bin2data_dir}")
469
470 adl_COMPUTE_RELATIVE_PATHS([expanded_prefix:expanded_bindir:prefix2bin_dir])
471 adl_NORMALIZE_PATH(prefix2bin_dir, [$sdccconf_h_dir_separator])
472 AC_DEFINE_UNQUOTED(PREFIX2BIN_DIR,
473                    DIR_SEPARATOR_STRING "${prefix2bin_dir}")
474
475 adl_COMPUTE_RELATIVE_PATHS([expanded_prefix:expanded_datadir:prefix2data_dir])
476 adl_NORMALIZE_PATH(prefix2data_dir, [$sdccconf_h_dir_separator])
477 if test "${prefix2data_dir}" = "."; then
478     # small optimization for Mingw32; otherwise Borut will complain ;-)
479     AC_DEFINE_UNQUOTED(PREFIX2DATA_DIR, "")
480 else
481     AC_DEFINE_UNQUOTED(PREFIX2DATA_DIR,
482                        DIR_SEPARATOR_STRING "${prefix2data_dir}")
483 fi
484
485 # standard libs
486 AC_DEFINE_UNQUOTED(STD_LIB,       "libsdcc")
487 AC_DEFINE_UNQUOTED(STD_INT_LIB,   "libint")
488 AC_DEFINE_UNQUOTED(STD_LONG_LIB,  "liblong")
489 AC_DEFINE_UNQUOTED(STD_FP_LIB,    "libfloat")
490 AC_DEFINE_UNQUOTED(STD_DS390_LIB, "libds390")
491 AC_DEFINE_UNQUOTED(STD_DS400_LIB, "libds400")
492 AC_DEFINE_UNQUOTED(STD_XA51_LIB,  "libxa51")
493
494 # SDCC runtime environment variables
495 sdcc_dir_name="SDCC_HOME"
496 AC_DEFINE_UNQUOTED(SDCC_DIR_NAME, "${sdcc_dir_name}")
497
498 sdcc_include_name="SDCC_INCLUDE"
499 AC_DEFINE_UNQUOTED(SDCC_INCLUDE_NAME, "${sdcc_include_name}")
500
501 sdcc_lib_name="SDCC_LIB"
502 AC_DEFINE_UNQUOTED(SDCC_LIB_NAME, "${sdcc_lib_name}")
503
504 # Now handle the port selection
505 # ===========================================================================
506 rm -f ports.all ports.build
507 AC_ARG_ENABLE(mcs51-port,
508             AC_HELP_STRING([--disable-mcs51-port],
509                            [Excludes the Intel mcs51 port]))
510 echo mcs51 >>ports.all
511 if test "$enable_mcs51_port" = "no"; then
512     AC_DEFINE_UNQUOTED(OPT_DISABLE_MCS51, 1)
513 else
514     echo mcs51 >>ports.build
515     AC_DEFINE_UNQUOTED(OPT_DISABLE_MCS51, 0)
516 fi
517
518 AC_ARG_ENABLE(gbz80-port,
519             AC_HELP_STRING([--disable-gbz80-port],
520                            [Excludes the Gameboy gbz80 port]))
521 echo z80 >>ports.all
522 if test "$enable_gbz80_port" = "no"; then
523     AC_DEFINE_UNQUOTED(OPT_DISABLE_GBZ80, 1)
524 else
525     echo z80 >>ports.build
526     AC_DEFINE_UNQUOTED(OPT_DISABLE_GBZ80, 0)
527 fi
528
529 AC_ARG_ENABLE(z80-port,
530             AC_HELP_STRING([--disable-z80-port],
531                            [Excludes the z80 port]))
532 echo z80 >>ports.all
533 if test "$enable_z80_port" = "no"; then
534     AC_DEFINE_UNQUOTED(OPT_DISABLE_Z80, 1)
535 else
536     echo z80 >>ports.build
537     AC_DEFINE_UNQUOTED(OPT_DISABLE_Z80, 0)
538 fi
539
540 AC_ARG_ENABLE(avr-port,
541             AC_HELP_STRING([--disable-avr-port],
542                            [Excludes the AVR port]))
543 echo avr >>ports.all
544 if test "$enable_avr_port" = "no"; then
545     AC_DEFINE_UNQUOTED(OPT_DISABLE_AVR, 1)
546 else
547     echo avr >>ports.build
548     AC_DEFINE_UNQUOTED(OPT_DISABLE_AVR, 0)
549 fi
550
551 AC_ARG_ENABLE(ds390-port,
552             AC_HELP_STRING([--disable-ds390-port],
553                            [Excludes the DS390 port]))
554 echo ds390 >>ports.all
555 if test "$enable_ds390_port" = "no"; then
556     AC_DEFINE_UNQUOTED(OPT_DISABLE_DS390, 1)
557     AC_DEFINE_UNQUOTED(OPT_DISABLE_TININative, 1)
558 else
559     echo ds390 >>ports.build
560     AC_DEFINE_UNQUOTED(OPT_DISABLE_DS390, 0)
561     AC_DEFINE_UNQUOTED(OPT_DISABLE_TININative, 0)
562 fi
563
564 AC_ARG_ENABLE(ds400-port,
565             AC_HELP_STRING([--disable-ds400-port],
566                            [Excludes the DS400 port]))
567 echo ds400 >>ports.all
568 if test "$enable_ds400_port" = "no"; then
569     AC_DEFINE_UNQUOTED(OPT_DISABLE_DS400, 1)
570 else
571     echo ds400 >>ports.build
572     AC_DEFINE_UNQUOTED(OPT_DISABLE_DS400, 0)
573 fi
574
575 AC_ARG_ENABLE(pic-port,
576             AC_HELP_STRING([--disable-pic-port],
577                            [Excludes the PIC port]))
578 echo pic >>ports.all
579 if test "$enable_pic_port" = "no"; then
580     AC_DEFINE_UNQUOTED(OPT_DISABLE_PIC, 1)
581 else
582     echo pic >>ports.build
583     AC_DEFINE_UNQUOTED(OPT_DISABLE_PIC, 0)
584 fi
585
586 AC_ARG_ENABLE(pic16-port,
587             AC_HELP_STRING([--disable-pic16-port],
588                            [Excludes the PIC port]))
589 echo pic16 >>ports.all
590 if test "$enable_pic16_port" = "no"; then
591     AC_DEFINE_UNQUOTED(OPT_DISABLE_PIC16, 1)
592 else
593     echo pic16 >>ports.build
594     AC_DEFINE_UNQUOTED(OPT_DISABLE_PIC16, 0)
595 fi
596
597 AC_ARG_ENABLE(xa51-port,
598             AC_HELP_STRING([--disable-xa51-port],
599                            [Excludes the XA51 port]))
600 echo xa51 >>ports.all
601 if test "$enable_xa51_port" = "no"; then
602     AC_DEFINE_UNQUOTED(OPT_DISABLE_XA51, 1)
603 else
604     echo xa51 >>ports.build
605     AC_DEFINE_UNQUOTED(OPT_DISABLE_XA51, 0)
606 fi
607
608 AC_ARG_ENABLE(hc08-port,
609             AC_HELP_STRING([--disable-hc08-port],
610                            [Excludes the HC08 port]))
611 echo hc08 >>ports.all
612 if test "$enable_hc08_port" = "no"; then
613     AC_DEFINE_UNQUOTED(OPT_DISABLE_HC08, 1)
614 else
615     echo hc08 >>ports.build
616     AC_DEFINE_UNQUOTED(OPT_DISABLE_HC08, 0)
617 fi
618
619 AC_ARG_ENABLE(ucsim,
620               AC_HELP_STRING([--disable-ucsim],
621                              [Disables configuring and building of ucsim]))
622 OPT_ENABLE_UCSIM=$enable_ucsim
623 AC_SUBST(OPT_ENABLE_UCSIM)
624
625 AC_ARG_ENABLE(device-lib-build,
626               AC_HELP_STRING([--disable-device-lib-build],
627                              [Disables automatically building device libraries]))
628 OPT_ENABLE_DEVICE_LIB_BUILD=$enable_device_lib_build
629 AC_SUBST(OPT_ENABLE_DEVICE_LIB_BUILD)
630
631 AC_ARG_ENABLE(packihx,
632               AC_HELP_STRING([--disable-packihx],
633                              [Disables building packihx]))
634 OPT_ENABLE_PACKIHX=$enable_packihx
635 AC_SUBST(OPT_ENABLE_PACKIHX)
636
637 AC_ARG_ENABLE(libgc,
638               AC_HELP_STRING([--enable-libgc],
639                              [Use the Bohem memory allocator. Lower runtime footprint.]))
640 if test "$enable_libgc" = "yes"; then
641         AC_CHECK_LIB(gc, GC_malloc)
642         OPT_ENABLE_LIBGC=1
643 else
644         OPT_ENABLE_LIBGC=0
645 fi
646 AC_DEFINE_UNQUOTED(OPT_ENABLE_LIBGC, $OPT_ENABLE_LIBGC)
647
648 #remove duplicates
649 uniq ports.all ports
650 mv ports ports.all
651 uniq ports.build ports
652 mv ports ports.build
653
654 # Generating output files
655 # ===========================================================================
656 AC_CONFIG_SUBDIRS(support/cpp2)
657 AC_CONFIG_SUBDIRS(packihx)
658 AC_CONFIG_SUBDIRS(sim/ucsim)
659 AC_CONFIG_SUBDIRS(device/lib/pic16)
660
661 AC_CONFIG_FILES([main.mk:main_in.mk
662 src/Makefile
663 as/mcs51/Makefile
664 as/hc08/Makefile
665 device/include/Makefile
666 device/lib/Makefile
667 debugger/mcs51/Makefile
668 support/regression/Makefile
669 Makefile.common:Makefile.common.in
670 ])
671 AC_OUTPUT
672
673 # End of configure/configure.in