[ucsim] Redesing use of OPT flag
[sdcc.git] / sdcc / sim / ucsim / configure.ac
blobd418243c7fa1795c6694375657cf08e733a22ad9
1 #!/bin/sh
3 AC_PREREQ(2.60)
4 AC_INIT
5 AC_CONFIG_SRCDIR(.version)
6 AC_CONFIG_HEADERS([ddconfig.h:ddconfig_in.h])
8 : ${CFLAGS="-g"}
9 : ${CXXFLAGS="-g"}
11 if test -z "$CFLAGS"; then
12     CFLAGS="-g"
14 if test -z "$CXXFLAGS"; then
15     CXXFLAGS="-g"
18     
19 def_ucsim="yes"
20 def_dlso="no"
21 def_mcs51_port="yes"
22 def_p1516="yes"
23 def_avr="yes"
24 def_serio="yes"
25 def_z80="yes"
26 def_tlcs="yes"
27 def_m6800="yes"
28 def_m6809="yes"
29 def_m68hc11="yes"
30 def_m68hc12="yes"
31 def_pblaze="yes"
32 def_i8085="yes"
33 def_i8048="yes"
34 def_st7="yes"
36 in_sdcc="no"
37 src_root=$(dirname $0)
38 dnl echo "src_root=$src_root"
39 if test "$src_root"x == "x" -o "$src_root" == "." ; then
40     src_root=$(pwd)
42 dnl echo "src_root=$src_root"
43 last_root=$(basename $src_root)
44 dnl echo "last_root=$last_root"
45 if test $last_root == "ucsim" ; then
46     up_src=$(dirname $src_root)
47     if test $(basename $up_src) == "sim" ; then
48         in_sdcc="yes"
49     fi
51 echo "In SDCC tree: $in_sdcc (CFLAGS=${CFLAGS}, CXXFLAGS=${CXXFLAGS})"
53 if test $in_sdcc == "yes" ; then
54     def_ucsim="no"
55     def_p1516="no"
56     def_avr="no"
57     def_serio="no"
58     def_m6800="no"
59     def_m6809="no"
60     def_m68hc11="no"
61     def_m68hc12="no"
62     def_pblaze="no"
63     def_i8085="no"
64     def_i8048="no"
65     def_st7="no"
69 AC_PROG_AWK
70 AC_PROG_SED
72 AC_MSG_CHECKING(version of the package)
73 if test -f ${srcdir}/.version; then
74   { read VERSION; } < ${srcdir}/.version
75   AC_MSG_RESULT($VERSION)
76 else
77   VERSION="0.0.0"
78   AC_MSG_RESULT(unknown using 0.0.0)
80 VERSIONHI=`echo $VERSION|$AWK 'BEGIN {FS="."} {print $1}'`
81 VERSIONLO=`echo $VERSION|$AWK 'BEGIN {FS="."} {print $2}'`
82 VERSIONP=`echo $VERSION|$AWK 'BEGIN {FS="."} {print $3}'`
83 AC_SUBST(VERSION)
84 AC_SUBST(VERSIONHI)
85 AC_SUBST(VERSIONLO)
86 AC_SUBST(VERSIONP)
87 AC_DEFINE_UNQUOTED(VERSIONSTR, "${VERSION}", [XXX])
88 AC_DEFINE_UNQUOTED(VERSIONHI, $VERSIONHI, [XXX])
89 AC_DEFINE_UNQUOTED(VERSIONLO, $VERSIONLO, [XXX])
90 AC_DEFINE_UNQUOTED(VERSIONP, $VERSIONP, [XXX])
91 AC_ARG_PROGRAM
92 # Some options
93 #==============
94 # *nix default: "${datadir}/sdcc/doc"
95 AC_ARG_VAR(docdir, documentation installation directory)
96 if test "${docdir}" = ""; then
97     docdir="\${datadir}"/sdcc/doc
99 AC_SUBST(docdir)
101 AC_ARG_ENABLE(ucsim,
102               AS_HELP_STRING([--enable-ucsim=ARG],
103                              [en/disable compile of exe wrapper (unfinished)]),
104               ,
105               enable_ucsim=$def_ucsim)
107 AC_ARG_ENABLE(dlso,
108               AS_HELP_STRING([--enable-dlso=ARG],
109                              [en/disable compile shared objects]),
110               ,
111               enable_dlso=$def_dlso)
113 AC_ARG_ENABLE(mcs51-port,
114               AS_HELP_STRING([--enable-mcs51-port=ARG],
115                              [en/disable compile mcs51 simulator]),
116               ,
117               enable_mcs51_port=$def_mcs51_port)
119 AC_ARG_ENABLE(avr-port,
120               AS_HELP_STRING([--enable-avr-port=ARG],
121                              [en/disable compile avr simulator]),
122               ,
123               enable_avr_port=$def_avr)
125 AC_ARG_ENABLE(z80-port,
126               AS_HELP_STRING([--enable-z80-port=ARG],
127                              [en/disable compile z80 simulator]),
128               ,
129               enable_z80_port=$def_z80)
131 AC_ARG_ENABLE(tlcs-port,
132               AS_HELP_STRING([--enable-tlcs-port=ARG],
133                              [en/disable compile tlcs simulator]),
134               ,
135               enable_tlcs_port=$def_tlcs)
137 AC_ARG_ENABLE(m68hc08-port,
138 [  --disable-m68hc08-port  do not compile simulator for m68hc08],
139 if test $enable_m68hc08_port != "no"; then
140     enable_m68hc08_port="yes"
142 enable_m68hc08_port="yes")
143 AC_ARG_ENABLE(s08-port,
144 [  --disable-s08-port      do not compile simulator for s08],
145 if test $enable_s08_port != "no"; then
146     enable_s08_port="yes"
148 enable_s08_port="yes")
149 AC_ARG_ENABLE(xa-port,
150 [  --disable-xa-port       do not compile simulator for xa],
151 if test $enable_xa_port != "no"; then
152     enable_xa_port="yes"
154 enable_xa_port="yes")
155 AC_ARG_ENABLE(stm8-port,
156 [  --disable-stm8-port     do not compile simulator for stm8],
157 if test $enable_stm8_port != "no"; then
158     enable_stm8_port="yes"
160 enable_stm8_port="yes")
161 AC_ARG_ENABLE(pdk-port,
162 [  --disable-pdk-port      do not compile simulator for pdk],
163 if test $enable_pdk_port != "no"; then
164     enable_pdk_port="yes"
166 enable_pdk_port="yes")
168 AC_ARG_ENABLE(st7-port,
169               AS_HELP_STRING([--enable-st7-port=ARG],
170                              [en/disable compile st7 simulator]),
171               ,
172               enable_st7_port=$def_st7)
174 AC_ARG_ENABLE(p1516-port,
175               AS_HELP_STRING([--disable-p1516-port],
176                              [en/dsbale compile p1516 simulator]),
177               ,
178               enable_p1516_port=$def_p1516)
180 AC_ARG_ENABLE(m6800-port,
181               AS_HELP_STRING([--enable-m6800-port=ARG],
182                              [en/disable compile m6800 simulator]),
183               ,
184               enable_m6800_port=$def_m6800)
186 AC_ARG_ENABLE(m6809-port,
187               AS_HELP_STRING([--enable-m6809-port=ARG],
188                              [en/disable compile m6809 simulator]),
189               ,
190               enable_m6809_port=$def_m6809)
192 AC_ARG_ENABLE(m68hc11-port,
193               AS_HELP_STRING([--enable-m68hc11-port=ARG],
194                              [en/disable compile m68hc11 simulator]),
195               ,
196               enable_m68hc11_port=$def_m68hc11)
198 AC_ARG_ENABLE(m68hc12-port,
199               AS_HELP_STRING([--enable-m68hc12-port=ARG],
200                              [en/disable compile m68hc12 simulator]),
201               ,
202               enable_m68hc12_port=$def_m68hc12)
204 AC_ARG_ENABLE(mos6502-port,
205 [  --disable-mos6502-port  do not compile simulator for mos6502],
206 if test $enable_mos6502_port  != "no"; then
207     enable_mos6502_port="yes"
209 enable_mos6502_port="yes")
210 AC_ARG_ENABLE(rxk-port,
211 [  --disable-rxk-port      do not compile simulator for Rabbit rXk],
212 if test $enable_rxk_port  != "no"; then
213     enable_rxk_port="yes"
215 enable_rxk_port="yes")
217 AC_ARG_ENABLE(pblaze-port,
218               AS_HELP_STRING([--enable-pblaze-port=ARG],
219                              [en/disable compile picoblaze simulator]),
220               ,
221               enable_pblaze_port=$def_pblaze)
223 AC_ARG_ENABLE(i8085-port,
224               AS_HELP_STRING([--enable-i8085-port=ARG],
225                              [en/disable compile i8085 simulator]),
226               ,
227               enable_i8085_port=$def_i8085)
229 AC_ARG_ENABLE(f8-port,
230 [  --disable-f8-port       do not compile simulator for f8],
231 if test $enable_f8_port  != "no"; then
232     enable_f8_port="yes"
234 enable_f8_port="yes")
236 AC_ARG_ENABLE(i8048-port,
237               AS_HELP_STRING([--enable-i8048-port=ARG],
238                              [en/disable compile i8048 simulator]),
239               ,
240               enable_i8048_port=$def_i8048)
242 AC_ARG_ENABLE(serio,
243               AS_HELP_STRING([--enable-serio=ARG],
244                              [en/disable compile serio GUI tool (needs curses)]),
245               ,
246               enable_serio=$def_serio)
248 AC_SUBST(enable_ucsim)
249 AC_SUBST(enable_dlso)
250 AC_SUBST(enable_mcs51_port)
251 AC_SUBST(enable_avr_port)
252 AC_SUBST(enable_z80_port)
253 AC_SUBST(enable_gbz80_port)
254 AC_SUBST(enable_r2k_port)
255 AC_SUBST(enable_r3ka_port)
256 AC_SUBST(enable_tlcs_port)
257 AC_SUBST(enable_m68hc08_port)
258 AC_SUBST(enable_s08_port)
259 AC_SUBST(enable_xa_port)
260 AC_SUBST(enable_stm8_port)
261 AC_SUBST(enable_st7_port)
262 AC_SUBST(enable_pdk_port)
263 AC_SUBST(enable_p1516_port)
264 AC_SUBST(enable_m6809_port)
265 AC_SUBST(enable_m6800_port)
266 AC_SUBST(enable_m68hc11_port)
267 AC_SUBST(enable_m68hc12_port)
268 AC_SUBST(enable_mos6502_port)
269 AC_SUBST(enable_rxk_port)
270 AC_SUBST(enable_pblaze_port)
271 AC_SUBST(enable_i8085_port)
272 AC_SUBST(enable_f8_port)
273 AC_SUBST(enable_i8048_port)
274 AC_SUBST(enable_serio)
277 AC_ARG_ENABLE(statistic,
278 [  --enable-statistic      compile statistical features (slower simulation)],
279 if test $enable_statistic != "no"; then
280    enable_statistic="yes"
282 enable_statistic="no")
283 AC_DEFINE_UNQUOTED(STATISTIC, $enable_statistic, [XXX])
286 # Required programs
287 #-------------------
288 AC_PROG_CXX
289 AC_PROG_CXXCPP
290 AC_PROG_INSTALL
291 AC_PROG_RANLIB
292 dnl AC_LANG_CPLUSPLUS
294 AC_CHECK_TOOL(STRIP, strip)
295 AC_CHECK_TOOL(AR, ar)
296 dnl AC_CHECK_TOOL(SREC_CAT, srec_cat)
298 dnl AC_LIBTOOL_DLOPEN
299 dnl dnl AC_LIBTOOL_WIN32_DLL
300 dnl AC_PROG_LIBTOOL
301 AC_SUBST(LIBTOOL_DEPS)
303 AC_PROG_LEX(noyywrap)
304 if test ${LEX} = "flex"; then
305         AC_DEFINE(HAVE_FLEX, 1, [XXX])
307 AC_PROG_YACC
310 AC_LANG([C++])
312 # Checking for header files.
313 # ===========================================================================
315 #if test -d /stuff/include; then
316 #  CPPFLAGS="$CPPFLAGS -I/stuff/include"
319 dnl AC_HEADER_STDC
320 AC_CHECK_HEADERS(endian.h sys/endian.h machine/endian.h sys/isa_defs.h)
321 AC_CHECK_HEADERS(getopt.h)
322 AC_CHECK_HEADERS(unistd.h)
323 AC_CHECK_HEADERS(termios.h)
324 AC_CHECK_HEADERS(inttypes.h)
325 AC_CHECK_HEADERS(cstdint.h)
326 AC_CHECK_HEADERS(stdint.h)
327 AC_CHECK_HEADERS(sys/wait.h)
328 AC_CHECK_HEADERS(wincon.h)
330 AC_CHECK_HEADER(curses.h,
331   AC_DEFINE(HAVE_CURSES_H, 1, [XXX])
332   curses_h_ok=yes,
333   curses_h_ok=no
336 ucsim_cv_socket="unknown"
337 AC_CHECK_HEADER(sys/socket.h,
338   AC_DEFINE(HAVE_SYS_SOCKET_H, 1, [XXX])
339   AC_DEFINE(SOCKET_AVAIL, 1, [XXX])
340   AC_DEFINE_UNQUOTED(UCSOCKET_T, int, [XXX])
341   ucsim_cv_socket="<sys/socket.h>"
344 WINSOCK_AVAIL=0
345 if test $ucsim_cv_socket = unknown; then
346   AC_CHECK_HEADER(winsock2.h,
347     AC_DEFINE(HAVE_WINSOCK2_H, 1, [XXX])
348     AC_DEFINE(SOCKET_AVAIL, 1, [XXX])
349     AC_DEFINE_UNQUOTED(UCSOCKET_T, SOCKET, [XXX])
350     ucsim_cv_socket="<winsock2.h>"
351     WINSOCK_AVAIL=1
352   )
354 AC_SUBST(WINSOCK_AVAIL)
356 if test $ucsim_cv_socket != unknown; then
357   AC_EGREP_HEADER(socklen_t,
358     $ucsim_cv_socket,
359     AC_DEFINE_UNQUOTED(SOCKLEN_T, socklen_t, [XXX]),
360     AC_DEFINE_UNQUOTED(SOCKLEN_T, uint, [XXX]))
362 AC_DEFINE_UNQUOTED(HEADER_SOCKET, ${ucsim_cv_socket}, [XXX])
364 AC_CHECK_HEADER(dlfcn.h)
365 AC_HEADER_DIRENT
367 # This must be after CXXCPP
369 AC_CACHE_CHECK(which header file defines FD_ macros, ucsim_cv_fd,
370 [ucsim_cv_fd="unknown"
371 AC_EGREP_CPP(yes, [
372 #include <winsock2.h>
373 #ifdef FD_ZERO
375 #endif], ucsim_cv_fd="<winsock2.h>")
376 AC_EGREP_CPP(yes, [
377 #include <sys/time.h>
378 #ifdef FD_ZERO
380 #endif], ucsim_cv_fd="<sys/time.h>")
381 AC_EGREP_CPP(yes, [
382 #include <sys/types.h>
383 #ifdef FD_ZERO
385 #endif], ucsim_cv_fd="<sys/types.h>")
386 AC_EGREP_CPP(yes, [
387 #include <sys/select.h>
388 #ifdef FD_ZERO
390 #endif], ucsim_cv_fd="<sys/select.h>")
391 AC_EGREP_CPP(yes, [
392 #include <gnu/types.h>
393 #ifdef FD_ZERO
395 #endif], ucsim_cv_fd="<gnu/types.h>")])
397 ucsim_cv_header_ok=0
398 if echo $ucsim_cv_fd|grep time >/dev/null 2>&1; then
399 AC_DEFINE(FD_NEED_TIME_H, 1, [XXX])
400 ucsim_cv_header_ok=1
401 else
402 AC_DEFINE(FD_NEED_TIME_H, 0, [XXX])
405 if echo $ucsim_cv_fd|grep sys/types >/dev/null 2>&1; then
406 AC_DEFINE(FD_NEED_TYPES_H, 1, [XXX])
407 ucsim_cv_header_ok=1
408 else
409 AC_DEFINE(FD_NEED_TYPES_H, 0, [XXX])
412 if echo $ucsim_cv_fd|grep gnu/types >/dev/null 2>&1; then
413 AC_DEFINE(FD_NEED_GNUTYPES_H, 1, [XXX])
414 ucsim_cv_header_ok=1
415 else
416 AC_DEFINE(FD_NEED_GNUTYPES_H, 0, [XXX])
419 if echo $ucsim_cv_fd|grep select >/dev/null 2>&1; then
420 AC_DEFINE(FD_NEED_SELECT_H, 1, [XXX])
421 ucsim_cv_header_ok=1
422 else
423 AC_DEFINE(FD_NEED_SELECT_H, 0, [XXX])
426 if echo $ucsim_cv_fd|grep winsock2 >/dev/null 2>&1; then
427 AC_DEFINE(FD_NEED_WINSOCK2_H, 1, [XXX])
428 ucsim_cv_header_ok=1
429 else
430 AC_DEFINE(FD_NEED_WINSOCK2_H, 0, [XXX])
433 dnl AC_DEFINE_UNQUOTED(FD_HEADER_OK, ${ucsim_cv_header_ok}, [XXX])
434 AC_DEFINE_UNQUOTED(HEADER_FD, ${ucsim_cv_fd}, [XXX])
437 # Checking for functions/libs
438 # ===========================================================================
439 if echo $ucsim_cv_socket|grep winsock2 >/dev/null 2>&1; then
440   LIBS="-lws2_32 $LIBS"
441 else
442   AC_CHECK_LIB(socket,socket)
443   AC_CHECK_LIB(nsl,xdr_short)
444   AC_CHECK_LIB(rt,nanosleep)
447 AC_CHECK_LIB(dl,dlopen,
448 dl_ok="yes"
449 DL="-ldl",
450 dl_ok="no"
451 DL="")
452 AC_SUBST(dl_ok)
453 AC_SUBST(DL)
455 CURSES_LIBS=""
456 if test $curses_h_ok != yes; then
457   panel_ok="no"
458   curses_ok="no"
459 else
460   AC_CHECK_LIB(panel,panel_above,
461     panel_ok="yes"
462     curses_ok="no"
463     CURSES_LIBS="-lpanel",
464     panel_ok="no"
465     curses_ok="no"
466   )
468   if test $curses_ok != yes; then
469     AC_CHECK_LIB(curses,nl,
470       curses_ok="yes"
471       CURSES_LIBS="${CURSES_LIBS} -lcurses",
472       curses_ok="no")
473   fi
475   if test $curses_ok != yes; then
476     AC_CHECK_LIB(ncurses,nl,
477       curses_ok="yes"
478       CURSES_LIBS="${CURSES_LIBS} -lncurses",
479       curses_ok="no")
480   fi
482   AC_CHECK_LIB(tinfo,curs_set,
483                curses_ok="yes"
484                CURSES_LIBS="${CURSES_LIBS} -ltinfo",
485                ,
486                $CURSES_LIBS)
487   
491 AC_SUBST(panel_ok)
492 AC_SUBST(curses_ok)
493 AC_SUBST(CURSES_LIBS)
495 AC_FUNC_FORK
496 AC_CHECK_FUNCS(_exit dup2 dup3 pipe pipe2 waitpid)
497 AC_CHECK_FUNCS(vasprintf)
498 AC_CHECK_FUNCS(vsnprintf)
499 dnl AC_CHECK_FUNCS(strdup)
500 dnl AC_CHECK_FUNCS(getline)
501 dnl AC_CHECK_FUNCS(getdelim)
502 AC_CHECK_FUNCS(yylex)
504 # AC_CACHE_CHECK(whether scanf knows %a, ucsim_cv_scanf_a,
505 # [echo "a b" >conftest.data
506 # AC_TRY_RUN([
507 # #include <stdio.h>
508 # void main(void)
509 # {
510 #   FILE *f;
511 #   char *a;
512 #   int  i;
513 #   if ((f= fopen("conftest.data", "r")) == NULL)
514 #     exit(1);
515 #   i= fscanf(f, " %a[a-z] ", &a);
516 #   fclose(f);
517 #   if (i == 0)
518 #     exit(2);
519 #   if (i == 1)
520 #     exit(0);
521 #   exit(3);
522 # }],
523 # ucsim_cv_scanf_a="yes",
524 # ucsim_cv_scanf_a="no",
525 # ucsim_cv_scanf_a="unknown")
526 # ])
527 # if test "$ucsim_cv_scanf_a" = "yes"; then
528 #   AC_DEFINE(SCANF_A, 1, [XXX])
529 # fi
531 # AC_CACHE_CHECK(whether getcwd is GNUish, ucsim_cv_getcwd,
532 # [AC_TRY_RUN([
533 # #include <unistd.h>
534 # void main(void)
535 # {
536 #   if ((getcwd(NULL, 0)) == NULL)
537 #     exit(1);
538 #   exit(0);
539 # }],
540 # ucsim_cv_getcwd="yes",
541 # ucsim_cv_getcwd="no",
542 # ucsim_cv_getcwd="unknown")
543 # ])
544 # if test "$ucsim_cv_getcwd" = "yes"; then
545 #   AC_DEFINE(GNU_GETCWD, 1, [XXX])
546 # fi
548 #AC_DEFUN([ucsim_ACCEPT_LENGTH_T],
549 # [AC_CACHE_CHECK([for type of length pointer parameter of accept],
550 #   ucsim_cv_accept_length_type,
551 #   [ac_save_CPPFLAGS="$CPPFLAGS"
552 #    ucsim_cv_accept_length_type=no
553 #    for ac_val in int size_t socklen_t; do
554 #      CPPFLAGS="$ac_save_CPPFLAGS -DACCEPT_SOCKLEN_T=$ac_val"
555 #      AC_TRY_COMPILE([#include <sys/types.h>
556 #        [struct sockaddr a; $ac_val len; accept (0, &a, &len);],
557 #        [ucsim_cv_accept_length_type=$ac_val; break])
558 #    done
559 #    CPPFLAGS="$ac_save_CPPFLAGS"])
560 #  if test "$ucsim_cv_accept_length_type" != no; then
561 #    AC_DEFINE_UNQUOTED(ACCEPT_SOCKLEN_T, $ucsim_cv_accept_length_type,
562 #      [Define to be the type of length parameter of accept (without the \*').])
563 #  fi
564 # ]
568 #ucsim_ACCEPT_LENGTH_T
570 # Macro definitions
571 ###################
573 # Check whether the compiler for the current language is SunPRO.
575 AC_DEFUN([sdcc_IS_SUNPRO],
576 [AC_CACHE_CHECK([whether we are using the SunPRO _AC_LANG compiler],
577   [sdcc_cv_[]_AC_LANG_ABBREV[]_compiler_sunpro],
578   [_AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[#if !defined __SUNPRO_C && !defined __SUNPRO_CC
579        choke me
580 #endif
581 ]])],
582     [sdcc_cv_[]_AC_LANG_ABBREV[]_compiler_sunpro=yes],
583     [sdcc_cv_[]_AC_LANG_ABBREV[]_compiler_sunpro=no])
584 ])])
586 # sdcc_IS_VALID_OPTION macro checks if the current compiler, selected by 
587 # AC_LANG, supports option specified as the 1st parameter. The test fails if
588 # the compiler returns an error or in case something is writeen to stderr.
589 # For example: sdcc_VALID_OPT(-fPIC)
591 AC_DEFUN([sdcc_IS_VALID_OPTION],
592 [arg1=`echo $1 | sed -e"s/^-*//" -e"s/-/_/g"`
593 ac_test_[]_AC_LANG_PREFIX[]FLAGS=${[]_AC_LANG_PREFIX[]FLAGS+set}
594 sdcc_save_[]_AC_LANG_PREFIX[]FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
595 AC_CACHE_CHECK(whether _AC_LANG accepts $1, sdcc_cv_[]_AC_LANG_ABBREV[]_$arg1,
596   [sdcc_save_[]_AC_LANG_ABBREV[]_werror_flag=$ac_[]_AC_LANG_ABBREV[]_werror_flag
597    ac_[]_AC_LANG_ABBREV[]_werror_flag=yes
598    
599    []_AC_LANG_PREFIX[]FLAGS="$1"
600    AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
601      [eval sdcc_cv_[]_AC_LANG_ABBREV[]_$arg1=yes],
602      [eval sdcc_cv_[]_AC_LANG_ABBREV[]_$arg1=no])
603    ac_[]_AC_LANG_ABBREV[]_werror_flag=$sdcc_save_[]_AC_LANG_ABBREV[]_werror_flag])
604    []_AC_LANG_PREFIX[]FLAGS=$sdcc_save_[]_AC_LANG_PREFIX[]FLAGS
607 # Checking characteristics of compilers and other programs
608 # --------------------------------------------------------
610 # Cross compiling overrides
611 # FIXME
612 if test "$CC" = "i586-mingw32msvc-gcc"; then
613   ac_cv_c_bigendian=no
614   ac_cv_sizeof_char=1
615   ac_cv_sizeof_short=2
616   ac_cv_sizeof_int=4
617   ac_cv_sizeof_long=4
618   ac_cv_sizeof_long_long=4
622 # Checking whether byte ordering is bigendian
623 # --------------------------------------------------------
624 AC_C_BIGENDIAN
626 PICOPT=""
627 SHAREDLIB="no"
629 if test "$ac_cv_cxx_compiler_gnu" = "yes"; then
630   AC_CACHE_CHECK(whether preprocessor accepts -MM or -M,ucsim_cv_MM,
631   echo "#include <stdio.h>" >_test_.c
632   echo "" >>_test_.c
633   $CXXCPP -v -MM _test_.c 1>&5 2>&5
634   if test "$?" = "0"; then
635     ucsim_cv_MM="-MM"
636   else
637     ucsim_cv_MM="-M"
638   fi
639   rm -f _test_.*)
641   # This is the first time when CFLAGS are set/modified!!
643 dnl  sdcc_IS_VALID_OPTION(-ggdb)
644 #  if test "$sdcc_cv_cxx_ggdb" = "yes"; then
645 #      CXXFLAGS="$CXXFLAGS -ggdb"
646 #  fi
647 dnl  sdcc_IS_VALID_OPTION(-gstabs)
648   sdcc_IS_VALID_OPTION(-pipe)
649   if test "$sdcc_cv_cxx_pipe" = "yes"; then
650     CXXFLAGS="$CXXFLAGS -pipe"
651   fi
652   
653 dnl  sdcc_IS_VALID_OPTION(-fhandle-exceptions)
654 #  if test "$sdcc_cv_cxx_fhandle_exceptions" = "yes"; then
655 #    CXXFLAGS="$CXXFLAGS -fhandle-exceptions"
656 #  fi
657   
658   MAKEDEP="$CXX $ucsim_cv_MM"
659   WALL_FLAG="-Wall"
661   sdcc_IS_VALID_OPTION(-Wno-overloaded-virtual)
662   if test "$sdcc_cv_cxx_Wno_overloaded_virtual" = "yes"; then
663       WALL_FLAG="$WALL_FLAG -Wno-overloaded-virtual"
664   fi
666   sdcc_IS_VALID_OPTION(-Wno-unused-parameters)
667   if test "$sdcc_cv_cxx_Wno_unused_parameters" = "yes"; then
668       WALL_FLAG="$WALL_FLAG -Wno-unused-parameters"
669   fi
671   sdcc_IS_VALID_OPTION(-Wno-unused)
672   if test "$sdcc_cv_cxx_Wno_unused" = "yes"; then
673       WALL_FLAG="$WALL_FLAG -Wno-unused"
674   fi
675 else
676   sdcc_IS_SUNPRO
677   if test "$sdcc_cv_cxx_compiler_sunpro" = "yes"; then
678     CXXFLAGS="-xO2 $CXXFLAGS"
679     MAKEDEP="$CXX -xM1"
680     WALL_FLAG=
681   fi
684 # pic_flag is defined by AC_PROG_LIBTOOL
685 PICOPT=$pic_flag
687 if test "$PICOPT"x != "x"; then
688     SHAREDLIB="yes"
690 AC_SUBST(MAKEDEP)
691 AC_SUBST(WALL_FLAG)
692 AC_SUBST(SHAREDLIB)
693 AC_SUBST(PICOPT)
695 dlso_ok="no"
696 if test $SHAREDLIB = "yes" -a $dl_ok = "yes" -a $enable_dlso = "yes"; then
697     dlso_ok="yes"
699 AC_SUBST(dlso_ok)
701 # Checks for typedefs, structures, and compiler characteristics.
702 # ===========================================================================
704 if $CXX -v 2>&1|grep "mingw" >/dev/null 2>&1; then
705     ac_cv_sizeof_char=1
706     ac_cv_sizeof_short=2
707     ac_cv_sizeof_int=4
708     ac_cv_sizeof_long=4
709     ac_cv_sizeof_long_long=4
710 else
711     AC_CHECK_SIZEOF(char)
712     AC_CHECK_SIZEOF(short)
713     AC_CHECK_SIZEOF(int)
714     AC_CHECK_SIZEOF(long)
715     AC_CHECK_SIZEOF(long long)
718 type_name()
720     if expr "$ac_cv_sizeof_char" '>=' "$1" >/dev/null; then
721         echo "char"
722         exit
723     fi
724     if expr "$ac_cv_sizeof_short" '>=' "$1" >/dev/null; then
725         echo "short"
726         exit
727     fi
728     if expr "$ac_cv_sizeof_int" '>=' "$1" >/dev/null; then
729         echo "int"
730         exit
731     fi
732     if expr "$ac_cv_sizeof_long" '>=' "$1" >/dev/null; then
733         echo "long"
734         exit
735     fi
736     if expr "$ac_cv_sizeof_long_long" '>=' "$1" >/dev/null; then
737         echo "long long"
738         exit
739     fi
740     echo "long long"
743 specifier_name()
745     if expr "$ac_cv_sizeof_char" '>=' "$1" >/dev/null; then
746         echo "\"\""
747         exit
748     fi
749     if expr "$ac_cv_sizeof_short" '>=' "$1" >/dev/null; then
750         echo "\"h\""
751         exit
752     fi
753     if expr "$ac_cv_sizeof_int" '>=' "$1" >/dev/null; then
754         echo "\"\""
755         exit
756     fi
757     if expr "$ac_cv_sizeof_long" '>=' "$1" >/dev/null; then
758         echo "\"l\""
759         exit
760     fi
761     if expr "$ac_cv_sizeof_long_long" '>=' "$1" >/dev/null; then
762         echo "\"L\""
763         exit
764     fi
765     echo "\"L\""
768 AC_MSG_CHECKING(type name for byte)
769 TYPE_BYTE=`type_name 1`
770 AC_MSG_RESULT($TYPE_BYTE)
771 AC_MSG_CHECKING(specifier for byte)
772 SPEC_BYTE=`specifier_name 1`
773 AC_MSG_RESULT($SPEC_BYTE)
774 AC_MSG_CHECKING(type name for word)
775 TYPE_WORD=`type_name 2`
776 AC_MSG_RESULT($TYPE_WORD)
777 AC_MSG_CHECKING(specifier for word)
778 SPEC_WORD=`specifier_name 2`
779 AC_MSG_RESULT($SPEC_WORD)
780 AC_MSG_CHECKING(type name for dword)
781 TYPE_DWORD=`type_name 4`
782 AC_MSG_RESULT($TYPE_DWORD)
783 AC_MSG_CHECKING(specifier for dword)
784 SPEC_DWORD=`specifier_name 4`
785 AC_MSG_RESULT($SPEC_DWORD)
786 AC_MSG_CHECKING(type name for qword)
787 TYPE_QWORD=`type_name 8`
788 AC_MSG_RESULT($TYPE_QWORD)
789 AC_MSG_CHECKING(specifier for qword)
790 SPEC_QWORD=`specifier_name 8`
791 AC_MSG_RESULT($SPEC_QWORD)
793 AC_DEFINE_UNQUOTED(TYPE_BYTE, [$TYPE_BYTE], [XXX])
794 AC_DEFINE_UNQUOTED(SPEC_BYTE, [$SPEC_BYTE], [XXX])
795 AC_DEFINE_UNQUOTED(TYPE_WORD, [$TYPE_WORD], [XXX])
796 AC_DEFINE_UNQUOTED(SPEC_WORD, [$SPEC_WORD], [XXX])
797 AC_DEFINE_UNQUOTED(TYPE_DWORD, [$TYPE_DWORD], [XXX])
798 AC_DEFINE_UNQUOTED(SPEC_DWORD, [$SPEC_DWORD], [XXX])
799 AC_DEFINE_UNQUOTED(TYPE_QWORD, [$TYPE_QWORD], [XXX])
800 AC_DEFINE_UNQUOTED(SPEC_QWORD, [$SPEC_QWORD], [XXX])
801 #AC_DEFINE_UNQUOTED(TYPE_UBYTE, [unsigned $TYPE_BYTE], [XXX])
802 #AC_DEFINE_UNQUOTED(TYPE_UWORD, [unsigned $TYPE_WORD], [XXX])
803 #AC_DEFINE_UNQUOTED(TYPE_UDWORD, [unsigned $TYPE_DWORD], [XXX])
805 AH_TOP([#ifndef DDCONFIG_HEADER
806 #define DDCONFIG_HEADER])
807 AH_BOTTOM([#endif])
808         
809 if echo $TYPE_DWORD|grep short >/dev/null; then
810     A="h"
811 elif echo $TYPE_DWORD|grep long >/dev/null; then
812     A="l"
813 else
814     A=""
817 if echo $TYPE_WORD|grep short >/dev/null; then M="h"
818 elif echo $TYPE_WORD|grep long >/dev/null; then M="l"
819 else M=""
822 AC_DEFINE_UNQUOTED(_A_, "${A}", [XXX])
823 AC_DEFINE_UNQUOTED(_M_, "${M}", [XXX])
825 # Generating output files
826 # ===========================================================================
828 AC_CONFIG_FILES(Makefile
829 main.mk:main_in.mk
830 packages.mk:packages_in.mk
831 cmd.src/Makefile
832 motorola.src/Makefile
834 sim.src/Makefile   sim.src/test/Makefile
836 avr.src/Makefile     avr.src/test/Makefile
837 m68hc08.src/Makefile m68hc08.src/test/Makefile
838 m6809.src/Makefile   m6809.src/test/Makefile
839 m6800.src/Makefile   m6800.src/test/Makefile
840 m68hc11.src/Makefile m68hc11.src/test/Makefile
841 m68hc12.src/Makefile m68hc12.src/test/Makefile
842 mos6502.src/Makefile mos6502.src/test/Makefile
843 rxk.src/Makefile     rxk.src/test/Makefile
844 pblaze.src/Makefile  pblaze.src/test/Makefile
845 i8085.src/Makefile   i8085.src/test/Makefile
846 f8.src/Makefile      f8.src/test/Makefile
847 i8048.src/Makefile   i8048.src/test/Makefile
848 p1516.src/Makefile   p1516.src/test/Makefile
849 pdk.src/Makefile     pdk.src/test/Makefile
850 s51.src/Makefile     s51.src/test/Makefile
851 st7.src/Makefile     st7.src/test/Makefile
852 stm8.src/Makefile    stm8.src/test/Makefile
853 tlcs.src/Makefile    tlcs.src/test/Makefile
854 xa.src/Makefile      xa.src/test/Makefile
855 z80.src/Makefile     z80.src/test/Makefile
857 gui.src/Makefile
858 gui.src/serio.src/Makefile
860 doc/Makefile
862 AC_OUTPUT
864 echo "Compile for SDCC  $in_sdcc"
865 echo "Compile dlso      $enable_dlso"
866 echo "Compile ucsim     $enable_ucsim"
867 echo "Compile s51       $enable_mcs51_port"
868 echo "Compile avr       $enable_avr_port"
869 echo "Compile z80       $enable_z80_port"
870 echo "Compile tlcs      $enable_tlcs_port"
871 echo "Compile m68hc08   $enable_m68hc08_port"
872 echo "Compile s08       $enable_s08_port"
873 echo "Compile xa        $enable_xa_port"
874 echo "Compile stm8      $enable_stm8_port"
875 echo "Compile pdk       $enable_pdk_port"
876 echo "Compile st7       $enable_st7_port"
877 echo "Compile p1516     $enable_p1516_port"
878 echo "Compile m6809     $enable_m6809_port"
879 echo "Compile m6800     $enable_m6800_port"
880 echo "Compile m68hc11   $enable_m68hc11_port"
881 echo "Compile m68hc12   $enable_m68hc12_port"
882 echo "Compile mos6502   $enable_mos6502_port"
883 echo "Compile rxk       $enable_rxk_port"
884 echo "Compile pblaze    $enable_pblaze_port"
885 echo "Compile i8085     $enable_i8085_port"
886 echo "Compile f8        $enable_f8_port"
887 echo "Compile i8048     $enable_i8048_port"
888 echo "Compile serio     $enable_serio"
890 #gui.src/portmon.src/Makefile
893 # End of configure.ac