* support/regression/tests/structflexarray.c: flexible array members
[fw/sdcc] / sim / ucsim / configure.in
index de2bcba66ac4579b37bd306063c5304bc0ac3e0f..172a9634dfc4f81a8ccab631b4d8affe4d87c956 100644 (file)
@@ -6,8 +6,8 @@ AC_CONFIG_HEADER(ddconfig.h:ddconfig_in.h)
 AC_PROG_AWK
 
 AC_MSG_CHECKING(version of the package)
-if test -f .version; then
-  VERSION=`cat .version`
+if test -f ${srcdir}/.version; then
+  VERSION=`cat ${srcdir}/.version`
   AC_MSG_RESULT($VERSION)
 else
   VERSION="0.0.0"
@@ -25,6 +25,81 @@ AC_DEFINE_UNQUOTED(VERSIONHI, $VERSIONHI)
 AC_DEFINE_UNQUOTED(VERSIONLO, $VERSIONLO)
 AC_DEFINE_UNQUOTED(VERSIONP, $VERSIONP)
 
+# Some options
+#==============
+# *nix default: "${datadir}/sdcc/doc"
+AC_ARG_VAR(docdir, documentation installation directory)
+if test "${docdir}" = ""; then
+    docdir="\${datadir}"/sdcc/doc
+fi
+AC_SUBST(docdir)
+
+AC_ARG_ENABLE(ucsim,
+[  --enable-ucsim          compile ucsim frontend],
+if test $enable_ucsim != "no"; then
+    enable_ucsim="yes"
+fi,
+#default
+enable_ucsim="no")
+AC_ARG_ENABLE(dlso,
+[  --enable-dlso           compile dynamically loadable shared libraries],
+if test $enable_dlso != "no"; then
+    enable_dlso="yes"
+fi,
+enable_dlso="no")
+AC_ARG_ENABLE(51,
+[  --disable-51            do not compile simulator for MCS51],
+if test $enable_51 != "no"; then
+    enable_51="yes"
+fi,
+enable_51="yes")
+AC_ARG_ENABLE(avr,
+[  --disable-avr           do not compile simulator for AVR],
+if test $enable_avr != "no"; then
+    enable_avr="yes"
+fi,
+enable_avr="yes")
+AC_ARG_ENABLE(z80,
+[  --disable-z80           do not compile simulator for Z80],
+if test $enable_z80 != "no"; then
+    enable_z80="yes"
+fi,
+enable_z80="yes")
+AC_ARG_ENABLE(hc08,
+[  --disable-hc08          do not compile simulator for hc08],
+if test $enable_hc08 != "no"; then
+    enable_hc08="yes"
+fi,
+enable_hc08="yes")
+AC_ARG_ENABLE(xa,
+[  --enable-xa             compile simulator for XA],
+if test $enable_xa != "no"; then
+    enable_xa="yes"
+fi,
+enable_xa="no")
+AC_ARG_ENABLE(portmon,
+[  --enable-serio          compile serio GUI tool (needs curses)],
+if test $enable_serio != "no"; then
+    enable_serio="yes"
+fi,
+enable_serio="no")
+AC_SUBST(enable_ucsim)
+AC_SUBST(enable_dlso)
+AC_SUBST(enable_51)
+AC_SUBST(enable_avr)
+AC_SUBST(enable_z80)
+AC_SUBST(enable_hc08)
+AC_SUBST(enable_xa)
+AC_SUBST(enable_serio)
+
+AC_ARG_ENABLE(statistic,
+[  --enable-statistic      compile statistical features (slower simulation)],
+if test $enable_statistic != "no"; then
+   enable_statistic="yes"
+fi,
+enable_statistic="no")
+AC_DEFINE_UNQUOTED(STATISTIC, $enable_statistic)
+
 
 # Required programs
 #-------------------
@@ -32,10 +107,25 @@ AC_PROG_CXX
 AC_PROG_CXXCPP
 AC_PROG_INSTALL
 AC_PROG_RANLIB
-AC_LANG_CPLUSPLUS
+dnl AC_LANG_CPLUSPLUS
 
 AC_CHECK_PROG(STRIP, strip, strip, :)
 
+AC_LIBTOOL_DLOPEN
+dnl AC_LIBTOOL_WIN32_DLL
+AC_PROG_LIBTOOL
+AC_SUBST(LIBTOOL_DEPS)
+
+AC_PROG_LEX
+if test ${LEX} = "flex"; then
+       AC_DEFINE(HAVE_FLEX)
+fi
+AC_PROG_YACC
+AC_CHECK_PROG(BISON_PLUS_PLUS, bison++, bison++, :)
+
+
+AC_LANG_CPLUSPLUS
+
 # Checking for header files.
 # ===========================================================================
 
@@ -111,25 +201,50 @@ dl_ok="no"
 DL="")
 AC_SUBST(dl_ok)
 AC_SUBST(DL)
+
+#AC_CHECK_LIB(panel,panel_above,
+#panel_ok="yes"
+#curses_ok="yes"
+#CURSES_LIBS="-lpanel -lcurses"
+#,
+#panel_ok="no"
+#AC_CHECK_LIB(curses,nl,
+#curses_ok="yes"
+#CURSES_LIBS="-lcurses"
+#,
+#curses_ok="no")
+#,
+#-lcurses)
+
 AC_CHECK_LIB(panel,panel_above,
 panel_ok="yes"
 curses_ok="yes"
-CURSES_LIBS="-lpanel -lcurses"
-,
+CURSES_LIBS="-lpanel",
 panel_ok="no"
-AC_CHECK_LIB(curses,nl,
-curses_ok="yes"
-CURSES_LIBS="-lcurses"
-,
-ncurses_ok="no")
-,
--lcurses)
+curses_ok="no"
+)
+
+if test $curses_ok != yes; then
+  AC_CHECK_LIB(curses,nl,
+  curses_ok="yes"
+  CURSES_LIBS="-lcurses",
+  curses_ok="no")
+fi
+
+if test $curses_ok != yes; then
+  AC_CHECK_LIB(ncurses,nl,
+  curses_ok="yes"
+  CURSES_LIBS="-lncurses",
+  curses_ok="no")
+fi
+
 AC_SUBST(panel_ok)
 AC_SUBST(curses_ok)
 AC_SUBST(CURSES_LIBS)
 
 AC_FUNC_VPRINTF
-AC_CHECK_FUNCS(vsnprintf vasprintf)
+AC_CHECK_FUNCS(vsnprintf)
+AC_CHECK_FUNCS(vasprintf)
 AC_CHECK_FUNCS(strlen strcpy strcat strstr strcmp strerror strtok strdup)
 AC_CHECK_FUNCS(strchr memcpy)
 dnl AC_CHECK_FUNCS(getline)
@@ -194,8 +309,7 @@ AC_DEFUN(ucsim_ACCEPT_LENGTH_T,
         [ucsim_cv_accept_length_type=$ac_val; break])
     done
     CPPFLAGS="$ac_save_CPPFLAGS"])
-
-  if test $ucsim_cv_accept_length_type != no; then
+  if test "$ucsim_cv_accept_length_type" != no; then
     AC_DEFINE_UNQUOTED(ACCEPT_SOCKLEN_T, $ucsim_cv_accept_length_type,
       [Define to be the type of length parameter of accept (without the \*').])
   fi
@@ -216,7 +330,7 @@ AC_DEFUN(DD_COPT, [
 AC_CACHE_CHECK(whether $$1 accepts -$2,ucsim_cv_$1$2,
 cat >_test_.c <<EOF
 #include <stdio.h>
-void main(void) {}
+int main(void) {return(0);}
 EOF
 $$1 -v -$2 -c _test_.c 1>&5 2>&5
 if test "$?" = "0"; then
@@ -232,6 +346,7 @@ rm -f _test_.* a.out)
 # --------------------------------------------------------
 
 # Cross compiling overrides
+# FIXME
 if test "$CC" = "i586-mingw32msvc-gcc"; then
   ac_cv_c_bigendian=no
   ac_cv_sizeof_char=1
@@ -241,7 +356,19 @@ if test "$CC" = "i586-mingw32msvc-gcc"; then
   ac_cv_sizeof_long_long=4
 fi
 
-AC_C_BIGENDIAN
+if test "$cross_compiling" = "no"
+then
+    AC_C_BIGENDIAN
+else
+#echo "CROSS ENDIAN"
+    if $CXX -v 2>&1|grep "mingw" >/dev/null 2>&1; then
+       ac_cv_c_bigendian=no
+    else
+       : # FIXME
+    fi
+#echo "CROSS ENDIAN DONE"
+fi
+
 AC_CACHE_CHECK(whether preprocessor accepts -MM or -M,ucsim_cv_MM,
 echo "#include <stdio.h>" >_test_.c
 echo "" >>_test_.c
@@ -258,12 +385,18 @@ AC_SUBST(M_OR_MM)
 # This is the first time when CFLAGS are set/modified!!
 
 DD_COPT(CXX, ggdb)
-if test "$ucsim_cv_CXXggdb" = "yes"; then
-    if test "$CXXFLAGS"x = x ;then
-       CXXFLAGS="-ggdb -O"
-    else
-       CXXFLAGS="$CXXFLAGS -ggdb"
-    fi
+DD_COPT(CXX, gstabs)
+if test "$ucsim_cv_CXXgstabs" = "yes"; then
+   gopt="-gstabs+ -g3"
+elif test "$ucsim_cv_CXXggdb" = "yes"; then
+     gopt="-ggdb -g3"
+else 
+     gopt="-g"
+fi
+if test "$CXXFLAGS"x = x ;then
+       CXXFLAGS="$gopt"
+else
+       CXXFLAGS="$CXXFLAGS $gopt"
 fi
 
 DD_COPT(CXX, pipe)
@@ -288,6 +421,7 @@ fi
 # If this is Cygwin neither use Position Independant Code
 # nor build .so
 # Quick + dirty by Bernhard
+# FIXME
 if $CXX -v 2>&1 | grep -i cygwin 1>&5 2>&5; then
     PICOPT=""
     SHAREDLIB="no"
@@ -295,17 +429,34 @@ fi
 AC_SUBST(SHAREDLIB)
 AC_SUBST(PICOPT)
 
+dlso_ok="no"
+if test $SHAREDLIB = "yes" -a $dl_ok = "yes" -a $enable_dlso = "yes"; then
+    dlso_ok="yes"
+fi
+AC_SUBST(dlso_ok)
 
 # Checks for typedefs, structures, and compiler characteristics.
 # ===========================================================================
 
-
 AC_TYPE_SIGNAL
+if test "$cross_compiling" = "no"; then
 AC_CHECK_SIZEOF(char)
 AC_CHECK_SIZEOF(short)
 AC_CHECK_SIZEOF(int)
 AC_CHECK_SIZEOF(long)
 AC_CHECK_SIZEOF(long long)
+else
+    if $CXX -v 2>&1|grep "mingw" >/dev/null 2>&1; then
+       ac_cv_sizeof_char=1
+       ac_cv_sizeof_short=2
+       ac_cv_sizeof_int=4 
+       ac_cv_sizeof_long=4
+       ac_cv_sizeof_long_long=4
+    else
+       : # FIXME
+    fi
+#echo
+fi
 
 type_name()
 {
@@ -345,15 +496,35 @@ AC_DEFINE_UNQUOTED(TYPE_BYTE, $TYPE_BYTE)
 AC_DEFINE_UNQUOTED(TYPE_WORD, $TYPE_WORD)
 AC_DEFINE_UNQUOTED(TYPE_DWORD, $TYPE_DWORD)
 
+if echo $TYPE_DWORD|grep short >/dev/null; then
+    A="h"
+elif echo $TYPE_DWORD|grep long >/dev/null; then
+    A="l"
+else
+    A=""
+fi
+
+if echo $TYPE_WORD|grep short >/dev/null; then M="h"
+elif echo $TYPE_WORD|grep long >/dev/null; then M="l"
+else M=""
+fi
+
+AC_DEFINE_UNQUOTED(_A_, "${A}")
+AC_DEFINE_UNQUOTED(_M_, "${M}")
+
 # Generating output files
 # ===========================================================================
 
-AC_OUTPUT(main.mk:main_in.mk
+AC_OUTPUT(Makefile
+main.mk:main_in.mk
+packages.mk:packages_in.mk
 sim.src/Makefile
 cmd.src/Makefile
 s51.src/Makefile
 avr.src/Makefile
 z80.src/Makefile
+hc08.src/Makefile
+xa.src/Makefile
 gui.src/Makefile
 gui.src/serio.src/Makefile
 doc/Makefile