4 AC_CONFIG_HEADER(ddconfig.h:ddconfig_in.h)
8 AC_MSG_CHECKING(version of the package)
9 if test -f ${srcdir}/.version; then
10 VERSION=`cat ${srcdir}/.version`
11 AC_MSG_RESULT($VERSION)
14 AC_MSG_RESULT(unknown using 0.0.0)
16 VERSIONHI=`echo $VERSION|$AWK 'BEGIN {FS="."} {print $1}'`
17 VERSIONLO=`echo $VERSION|$AWK 'BEGIN {FS="."} {print $2}'`
18 VERSIONP=`echo $VERSION|$AWK 'BEGIN {FS="."} {print $3}'`
23 AC_DEFINE_UNQUOTED(VERSIONSTR, "${VERSION}")
24 AC_DEFINE_UNQUOTED(VERSIONHI, $VERSIONHI)
25 AC_DEFINE_UNQUOTED(VERSIONLO, $VERSIONLO)
26 AC_DEFINE_UNQUOTED(VERSIONP, $VERSIONP)
30 # *nix default: "${datadir}/sdcc/doc"
31 AC_ARG_VAR(docdir, documentation installation directory)
32 if test "${docdir}" = ""; then
33 docdir="\${datadir}"/sdcc/doc
38 [ --enable-ucsim compile ucsim frontend],
39 if test $enable_ucsim != "no"; then
45 [ --enable-dlso compile dynamically loadable shared libraries],
46 if test $enable_dlso != "no"; then
51 [ --disable-51 do not compile simulator for MCS51],
52 if test $enable_51 != "no"; then
57 [ --disable-avr do not compile simulator for AVR],
58 if test $enable_avr != "no"; then
63 [ --disable-z80 do not compile simulator for Z80],
64 if test $enable_z80 != "no"; then
69 [ --disable-hc08 do not compile simulator for hc08],
70 if test $enable_hc08 != "no"; then
75 [ --enable-xa compile simulator for XA],
76 if test $enable_xa != "no"; then
80 AC_ARG_ENABLE(portmon,
81 [ --enable-serio compile serio GUI tool (needs curses)],
82 if test $enable_serio != "no"; then
86 AC_SUBST(enable_ucsim)
93 AC_SUBST(enable_serio)
95 AC_ARG_ENABLE(statistic,
96 [ --enable-statistic compile statistical features (slower simulation)],
97 if test $enable_statistic != "no"; then
98 enable_statistic="yes"
100 enable_statistic="no")
101 AC_DEFINE_UNQUOTED(STATISTIC, $enable_statistic)
110 dnl AC_LANG_CPLUSPLUS
112 AC_CHECK_PROG(STRIP, strip, strip, :)
115 dnl AC_LIBTOOL_WIN32_DLL
117 AC_SUBST(LIBTOOL_DEPS)
120 if test ${LEX} = "flex"; then
124 AC_CHECK_PROG(BISON_PLUS_PLUS, bison++, bison++, :)
129 # Checking for header files.
130 # ===========================================================================
132 if test -d /stuff/include; then
133 CPPFLAGS="$CPPFLAGS -I/stuff/include"
137 AC_CHECK_HEADERS(getopt.h)
138 AC_CHECK_HEADERS(unistd.h)
140 AC_CHECK_HEADER(termios.h,
141 AC_DEFINE(HAVE_TERMIOS_H)
145 AC_SUBST(SERIAL_AVAIL)
147 AC_CHECK_HEADER(curses.h,
148 AC_DEFINE(HAVE_CURSES_H)
153 ucsim_cv_socket="unknown"
154 AC_CHECK_HEADER(sys/socket.h,
155 AC_DEFINE(HAVE_SYS_SOCKET_H)
156 AC_DEFINE(SOCKET_AVAIL)
157 AC_DEFINE_UNQUOTED(UCSOCKET_T, int)
158 ucsim_cv_socket="<sys/socket.h>"
161 if test $ucsim_cv_socket = unknown; then
162 AC_CHECK_HEADER(winsock2.h,
163 AC_DEFINE(HAVE_WINSOCK2_H)
164 AC_DEFINE(SOCKET_AVAIL)
165 AC_DEFINE_UNQUOTED(UCSOCKET_T, SOCKET)
166 ucsim_cv_socket="<winsock2.h>"
170 if test $ucsim_cv_socket != unknown; then
171 AC_EGREP_HEADER(socklen_t,
173 AC_DEFINE_UNQUOTED(SOCKLEN_T, socklen_t),
174 AC_DEFINE_UNQUOTED(SOCKLEN_T, uint))
176 AC_DEFINE_UNQUOTED(HEADER_SOCKET, ${ucsim_cv_socket})
178 AC_CHECK_HEADER(dlfcn.h)
181 # This must be after CXXCPP
183 AC_CACHE_CHECK(which header file defines FD_ macros, ucsim_cv_fd,
184 [ucsim_cv_fd="unknown"
186 #include <winsock2.h>
189 #endif], ucsim_cv_fd="<winsock2.h>")
191 #include <sys/time.h>
194 #endif], ucsim_cv_fd="<sys/time.h>")
196 #include <sys/types.h>
199 #endif], ucsim_cv_fd="<sys/types.h>")
201 #include <sys/select.h>
204 #endif], ucsim_cv_fd="<sys/select.h>")])
207 if echo $ucsim_cv_fd|grep time >/dev/null 2>&1; then
208 AC_DEFINE(FD_NEED_TIME_H, 1)
211 AC_DEFINE(FD_NEED_TIME_H, 0)
213 if echo $ucsim_cv_fd|grep types >/dev/null 2>&1; then
214 AC_DEFINE(FD_NEED_TYPES_H, 1)
217 AC_DEFINE(FD_NEED_TYPES_H, 0)
219 if echo $ucsim_cv_fd|grep select >/dev/null 2>&1; then
220 AC_DEFINE(FD_NEED_SELECT_H, 1)
223 AC_DEFINE(FD_NEED_SELECT_H, 0)
225 if echo $ucsim_cv_fd|grep winsock2 >/dev/null 2>&1; then
226 AC_DEFINE(FD_NEED_WINSOCK2_H, 1)
229 AC_DEFINE(FD_NEED_WINSOCK2_H, 0)
232 AC_DEFINE_UNQUOTED(FD_HEADER_OK, ${ucsim_cv_header_ok})
233 AC_DEFINE_UNQUOTED(HEADER_FD, ${ucsim_cv_fd})
236 # Checking for functions/libs
237 # ===========================================================================
238 if echo $ucsim_cv_socket|grep winsock2 >/dev/null 2>&1; then
239 LIBS="-lwsock32 $LIBS"
241 AC_CHECK_LIB(socket,socket)
242 AC_CHECK_LIB(nsl,xdr_short)
245 AC_CHECK_LIB(dl,dlopen,
253 #AC_CHECK_LIB(panel,panel_above,
256 #CURSES_LIBS="-lpanel -lcurses"
259 #AC_CHECK_LIB(curses,nl,
261 #CURSES_LIBS="-lcurses"
267 if test $curses_h_ok != yes; then
271 AC_CHECK_LIB(panel,panel_above,
274 CURSES_LIBS="-lpanel",
279 if test $curses_ok != yes; then
280 AC_CHECK_LIB(curses,nl,
282 CURSES_LIBS="-lcurses",
286 if test $curses_ok != yes; then
287 AC_CHECK_LIB(ncurses,nl,
289 CURSES_LIBS="-lncurses",
296 AC_SUBST(CURSES_LIBS)
299 AC_CHECK_FUNCS(vsnprintf)
300 AC_CHECK_FUNCS(vasprintf)
301 AC_CHECK_FUNCS(strlen strcpy strcat strstr strcmp strerror strtok strdup)
302 AC_CHECK_FUNCS(strchr memcpy)
303 dnl AC_CHECK_FUNCS(getline)
304 dnl AC_CHECK_FUNCS(getdelim)
305 AC_CHECK_FUNCS(fgets)
306 AC_CHECK_FUNCS(yylex)
308 AC_CACHE_CHECK(whether scanf knows %a, ucsim_cv_scanf_a,
309 [echo "a b" >conftest.data
317 if ((f= fopen("conftest.data", "r")) == NULL)
319 i= fscanf(f, " %a[a-z] ", &a);
327 ucsim_cv_scanf_a="yes",
328 ucsim_cv_scanf_a="no",
329 ucsim_cv_scanf_a="unknown")
331 if test "$ucsim_cv_scanf_a" = "yes"; then
335 AC_CACHE_CHECK(whether getcwd is GNUish, ucsim_cv_getcwd,
340 if ((getcwd(NULL, 0)) == NULL)
344 ucsim_cv_getcwd="yes",
345 ucsim_cv_getcwd="no",
346 ucsim_cv_getcwd="unknown")
348 if test "$ucsim_cv_getcwd" = "yes"; then
349 AC_DEFINE(GNU_GETCWD)
352 AC_DEFUN(ucsim_ACCEPT_LENGTH_T,
353 [AC_CACHE_CHECK([for type of length pointer parameter of accept],
354 ucsim_cv_accept_length_type,
355 [ac_save_CPPFLAGS="$CPPFLAGS"
356 ucsim_cv_accept_length_type=no
357 for ac_val in int size_t socklen_t; do
358 CPPFLAGS="$ac_save_CPPFLAGS -DACCEPT_SOCKLEN_T=$ac_val"
359 AC_TRY_COMPILE([#include <sys/types.h>
360 #include ${ucsim_cv_socket}],
361 [struct sockaddr a; $ac_val len; accept (0, &a, &len);],
362 [ucsim_cv_accept_length_type=$ac_val; break])
364 CPPFLAGS="$ac_save_CPPFLAGS"])
365 if test "$ucsim_cv_accept_length_type" != no; then
366 AC_DEFINE_UNQUOTED(ACCEPT_SOCKLEN_T, $ucsim_cv_accept_length_type,
367 [Define to be the type of length parameter of accept (without the \*').])
373 ucsim_ACCEPT_LENGTH_T
378 # DD_COPT macro checks if the compiler specified as the 1st parameter
379 # supports option specified as the 2nd parameter
380 # For example: DD_COPT(CXX, fPIC)
383 AC_CACHE_CHECK(whether $$1 accepts -$2,ucsim_cv_$1$2,
386 int main(void) {return(0);}
388 $$1 -v -$2 -c _test_.c 1>&5 2>&5
389 if test "$?" = "0"; then
394 rm -f _test_.* a.out)
398 # Checking characteristics of compilers and other programs
399 # --------------------------------------------------------
401 # Cross compiling overrides
403 if test "$CC" = "i586-mingw32msvc-gcc"; then
409 ac_cv_sizeof_long_long=4
412 if test "$cross_compiling" = "no"
417 if $CXX -v 2>&1|grep "mingw" >/dev/null 2>&1; then
422 #echo "CROSS ENDIAN DONE"
425 AC_CACHE_CHECK(whether preprocessor accepts -MM or -M,ucsim_cv_MM,
426 echo "#include <stdio.h>" >_test_.c
428 $CXXCPP -v -MM _test_.c 1>&5 2>&5
429 if test "$?" = "0"; then
438 # This is the first time when CFLAGS are set/modified!!
442 if test "$ucsim_cv_CXXgstabs" = "yes"; then
444 elif test "$ucsim_cv_CXXggdb" = "yes"; then
449 if test "$CXXFLAGS"x = x ;then
452 CXXFLAGS="$CXXFLAGS $gopt"
456 if test "$ucsim_cv_CXXpipe" = "yes"; then
457 CXXFLAGS="$CXXFLAGS -pipe"
463 if test "$ucsim_cv_CXXfPIC" = "yes"; then
467 if test "$ucsim_cv_CXXfpic" = "yes"; then
471 if test "$PICOPT"x != "x"; then
474 # If this is Cygwin neither use Position Independant Code
476 # Quick + dirty by Bernhard
478 if $CXX --version 2>&1 | grep -i cygming 1>&5 2>&5 || $CXX --version 2>&1 | grep -i cygwin 1>&5 2>&5; then
486 if test $SHAREDLIB = "yes" -a $dl_ok = "yes" -a $enable_dlso = "yes"; then
491 # Checks for typedefs, structures, and compiler characteristics.
492 # ===========================================================================
495 if test "$cross_compiling" = "no"; then
496 AC_CHECK_SIZEOF(char)
497 AC_CHECK_SIZEOF(short)
499 AC_CHECK_SIZEOF(long)
500 AC_CHECK_SIZEOF(long long)
502 if $CXX -v 2>&1|grep "mingw" >/dev/null 2>&1; then
507 ac_cv_sizeof_long_long=4
516 if expr "$ac_cv_sizeof_char" '>=' "$1" >/dev/null; then
520 if expr "$ac_cv_sizeof_short" '>=' "$1" >/dev/null; then
524 if expr "$ac_cv_sizeof_int" '>=' "$1" >/dev/null; then
528 if expr "$ac_cv_sizeof_long" '>=' "$1" >/dev/null; then
532 if expr "$ac_cv_sizeof_long_long" '>=' "$1" >/dev/null; then
539 AC_MSG_CHECKING(type name for byte)
540 TYPE_BYTE=`type_name 1`
541 AC_MSG_RESULT($TYPE_BYTE)
542 AC_MSG_CHECKING(type name for word)
543 TYPE_WORD=`type_name 2`
544 AC_MSG_RESULT($TYPE_WORD)
545 AC_MSG_CHECKING(type name for dword)
546 TYPE_DWORD=`type_name 4`
547 AC_MSG_RESULT($TYPE_DWORD)
548 AC_DEFINE_UNQUOTED(TYPE_BYTE, $TYPE_BYTE)
549 AC_DEFINE_UNQUOTED(TYPE_WORD, $TYPE_WORD)
550 AC_DEFINE_UNQUOTED(TYPE_DWORD, $TYPE_DWORD)
552 if echo $TYPE_DWORD|grep short >/dev/null; then
554 elif echo $TYPE_DWORD|grep long >/dev/null; then
560 if echo $TYPE_WORD|grep short >/dev/null; then M="h"
561 elif echo $TYPE_WORD|grep long >/dev/null; then M="l"
565 AC_DEFINE_UNQUOTED(_A_, "${A}")
566 AC_DEFINE_UNQUOTED(_M_, "${M}")
568 # Generating output files
569 # ===========================================================================
573 packages.mk:packages_in.mk
582 gui.src/serio.src/Makefile
586 #gui.src/portmon.src/Makefile
589 # End of configure/configure.in