5 AC_CONFIG_HEADER(ddconfig.h:ddconfig_in.h)
9 AC_MSG_CHECKING(version of the package)
10 if test -f ${srcdir}/.version; then
11 { read VERSION; } < ${srcdir}/.version
12 AC_MSG_RESULT($VERSION)
15 AC_MSG_RESULT(unknown using 0.0.0)
17 VERSIONHI=`echo $VERSION|$AWK 'BEGIN {FS="."} {print $1}'`
18 VERSIONLO=`echo $VERSION|$AWK 'BEGIN {FS="."} {print $2}'`
19 VERSIONP=`echo $VERSION|$AWK 'BEGIN {FS="."} {print $3}'`
24 AC_DEFINE_UNQUOTED(VERSIONSTR, "${VERSION}")
25 AC_DEFINE_UNQUOTED(VERSIONHI, $VERSIONHI)
26 AC_DEFINE_UNQUOTED(VERSIONLO, $VERSIONLO)
27 AC_DEFINE_UNQUOTED(VERSIONP, $VERSIONP)
31 # *nix default: "${datadir}/sdcc/doc"
32 AC_ARG_VAR(docdir, documentation installation directory)
33 if test "${docdir}" = ""; then
34 docdir="\${datadir}"/sdcc/doc
39 [ --enable-ucsim compile ucsim frontend],
40 if test $enable_ucsim != "no"; then
46 [ --enable-dlso compile dynamically loadable shared libraries],
47 if test $enable_dlso != "no"; then
52 [ --disable-51 do not compile simulator for MCS51],
53 if test $enable_51 != "no"; then
58 [ --disable-avr do not compile simulator for AVR],
59 if test $enable_avr != "no"; then
64 [ --disable-z80 do not compile simulator for Z80],
65 if test $enable_z80 != "no"; then
70 [ --disable-hc08 do not compile simulator for hc08],
71 if test $enable_hc08 != "no"; then
76 [ --enable-xa compile simulator for XA],
77 if test $enable_xa != "no"; then
81 AC_ARG_ENABLE(portmon,
82 [ --enable-serio compile serio GUI tool (needs curses)],
83 if test $enable_serio != "no"; then
87 AC_SUBST(enable_ucsim)
94 AC_SUBST(enable_serio)
96 AC_ARG_ENABLE(statistic,
97 [ --enable-statistic compile statistical features (slower simulation)],
98 if test $enable_statistic != "no"; then
99 enable_statistic="yes"
101 enable_statistic="no")
102 AC_DEFINE_UNQUOTED(STATISTIC, $enable_statistic)
111 dnl AC_LANG_CPLUSPLUS
113 AC_CHECK_PROG(STRIP, strip, strip, :)
116 dnl AC_LIBTOOL_WIN32_DLL
118 AC_SUBST(LIBTOOL_DEPS)
121 if test ${LEX} = "flex"; then
125 AC_CHECK_PROG(BISON_PLUS_PLUS, bison++, bison++, :)
130 # Checking for header files.
131 # ===========================================================================
133 if test -d /stuff/include; then
134 CPPFLAGS="$CPPFLAGS -I/stuff/include"
138 AC_CHECK_HEADERS(getopt.h unistd.h termios.h)
140 AC_CHECK_HEADER(curses.h,
141 AC_DEFINE(HAVE_CURSES_H)
146 ucsim_cv_socket="unknown"
147 AC_CHECK_HEADER(sys/socket.h,
148 AC_DEFINE(HAVE_SYS_SOCKET_H)
149 AC_DEFINE(SOCKET_AVAIL)
150 AC_DEFINE_UNQUOTED(UCSOCKET_T, int)
151 ucsim_cv_socket="<sys/socket.h>"
155 if test $ucsim_cv_socket = unknown; then
156 AC_CHECK_HEADER(winsock2.h,
157 AC_DEFINE(HAVE_WINSOCK2_H)
158 AC_DEFINE(SOCKET_AVAIL)
159 AC_DEFINE_UNQUOTED(UCSOCKET_T, SOCKET)
160 ucsim_cv_socket="<winsock2.h>"
164 AC_SUBST(WINSOCK_AVAIL)
166 if test $ucsim_cv_socket != unknown; then
167 AC_EGREP_HEADER(socklen_t,
169 AC_DEFINE_UNQUOTED(SOCKLEN_T, socklen_t),
170 AC_DEFINE_UNQUOTED(SOCKLEN_T, uint))
172 AC_DEFINE_UNQUOTED(HEADER_SOCKET, ${ucsim_cv_socket})
174 AC_CHECK_HEADER(dlfcn.h)
177 # This must be after CXXCPP
179 AC_CACHE_CHECK(which header file defines FD_ macros, ucsim_cv_fd,
180 [ucsim_cv_fd="unknown"
182 #include <winsock2.h>
185 #endif], ucsim_cv_fd="<winsock2.h>")
187 #include <sys/time.h>
190 #endif], ucsim_cv_fd="<sys/time.h>")
192 #include <sys/types.h>
195 #endif], ucsim_cv_fd="<sys/types.h>")
197 #include <sys/select.h>
200 #endif], ucsim_cv_fd="<sys/select.h>")])
203 if echo $ucsim_cv_fd|grep time >/dev/null 2>&1; then
204 AC_DEFINE(FD_NEED_TIME_H, 1)
207 AC_DEFINE(FD_NEED_TIME_H, 0)
209 if echo $ucsim_cv_fd|grep types >/dev/null 2>&1; then
210 AC_DEFINE(FD_NEED_TYPES_H, 1)
213 AC_DEFINE(FD_NEED_TYPES_H, 0)
215 if echo $ucsim_cv_fd|grep select >/dev/null 2>&1; then
216 AC_DEFINE(FD_NEED_SELECT_H, 1)
219 AC_DEFINE(FD_NEED_SELECT_H, 0)
221 if echo $ucsim_cv_fd|grep winsock2 >/dev/null 2>&1; then
222 AC_DEFINE(FD_NEED_WINSOCK2_H, 1)
225 AC_DEFINE(FD_NEED_WINSOCK2_H, 0)
228 AC_DEFINE_UNQUOTED(FD_HEADER_OK, ${ucsim_cv_header_ok})
229 AC_DEFINE_UNQUOTED(HEADER_FD, ${ucsim_cv_fd})
232 # Checking for functions/libs
233 # ===========================================================================
234 if echo $ucsim_cv_socket|grep winsock2 >/dev/null 2>&1; then
235 LIBS="-lws2_32 $LIBS"
237 AC_CHECK_LIB(socket,socket)
238 AC_CHECK_LIB(nsl,xdr_short)
241 AC_CHECK_LIB(dl,dlopen,
249 #AC_CHECK_LIB(panel,panel_above,
252 #CURSES_LIBS="-lpanel -lcurses"
255 #AC_CHECK_LIB(curses,nl,
257 #CURSES_LIBS="-lcurses"
263 if test $curses_h_ok != yes; then
267 AC_CHECK_LIB(panel,panel_above,
270 CURSES_LIBS="-lpanel",
275 if test $curses_ok != yes; then
276 AC_CHECK_LIB(curses,nl,
278 CURSES_LIBS="-lcurses",
282 if test $curses_ok != yes; then
283 AC_CHECK_LIB(ncurses,nl,
285 CURSES_LIBS="-lncurses",
292 AC_SUBST(CURSES_LIBS)
295 AC_CHECK_FUNCS(vsnprintf)
296 AC_CHECK_FUNCS(_vsnprintf)
297 AC_CHECK_FUNCS(vasprintf)
298 AC_CHECK_FUNCS(strlen strcpy strcat strstr strcmp strerror strtok strdup)
299 AC_CHECK_FUNCS(strchr memcpy)
300 dnl AC_CHECK_FUNCS(getline)
301 dnl AC_CHECK_FUNCS(getdelim)
302 AC_CHECK_FUNCS(fgets)
303 AC_CHECK_FUNCS(yylex)
305 AC_CACHE_CHECK(whether scanf knows %a, ucsim_cv_scanf_a,
306 [echo "a b" >conftest.data
314 if ((f= fopen("conftest.data", "r")) == NULL)
316 i= fscanf(f, " %a[a-z] ", &a);
324 ucsim_cv_scanf_a="yes",
325 ucsim_cv_scanf_a="no",
326 ucsim_cv_scanf_a="unknown")
328 if test "$ucsim_cv_scanf_a" = "yes"; then
332 AC_CACHE_CHECK(whether getcwd is GNUish, ucsim_cv_getcwd,
337 if ((getcwd(NULL, 0)) == NULL)
341 ucsim_cv_getcwd="yes",
342 ucsim_cv_getcwd="no",
343 ucsim_cv_getcwd="unknown")
345 if test "$ucsim_cv_getcwd" = "yes"; then
346 AC_DEFINE(GNU_GETCWD)
349 AC_DEFUN(ucsim_ACCEPT_LENGTH_T,
350 [AC_CACHE_CHECK([for type of length pointer parameter of accept],
351 ucsim_cv_accept_length_type,
352 [ac_save_CPPFLAGS="$CPPFLAGS"
353 ucsim_cv_accept_length_type=no
354 for ac_val in int size_t socklen_t; do
355 CPPFLAGS="$ac_save_CPPFLAGS -DACCEPT_SOCKLEN_T=$ac_val"
356 AC_TRY_COMPILE([#include <sys/types.h>
357 #include ${ucsim_cv_socket}],
358 [struct sockaddr a; $ac_val len; accept (0, &a, &len);],
359 [ucsim_cv_accept_length_type=$ac_val; break])
361 CPPFLAGS="$ac_save_CPPFLAGS"])
362 if test "$ucsim_cv_accept_length_type" != no; then
363 AC_DEFINE_UNQUOTED(ACCEPT_SOCKLEN_T, $ucsim_cv_accept_length_type,
364 [Define to be the type of length parameter of accept (without the \*').])
370 ucsim_ACCEPT_LENGTH_T
375 # DD_COPT macro checks if the compiler specified as the 1st parameter
376 # supports option specified as the 2nd parameter
377 # For example: DD_COPT(CXX, fPIC)
380 AC_CACHE_CHECK(whether $$1 accepts -$2,ucsim_cv_$1$2,
382 int main(void) {return(0);}
384 $$1 -v -$2 -c _test_.c 1>&5 2>&5
385 if test "$?" = "0"; then
390 rm -f _test_.* a.out)
393 # DD_COPT_NO_IGNORE macro checks if the compiler specified as the
394 # 1st parameter supports and doesn't ignore option specified as the
396 # For example: DD_COPT_NO_IGNORE(CXX, fPIC)
398 AC_DEFUN(DD_COPT_NO_IGNORE, [
399 AC_CACHE_CHECK(whether $$1 accepts and doesn't ignore -$2,ucsim_cv_$1$2,
401 int main(void) {return(0);}
403 ucsim_cv_$1$2=$($$1 -v -$2 -c _test_.c 2>&1 1>&5)
404 if test "$?" = "0"; then
405 expr "$ucsim_cv_$1$2" : '.*'-$2'.*ignored' 1>&5 2>&5
406 if test "$?" = "0"; then
414 rm -f _test_.* a.out)
418 # Checking characteristics of compilers and other programs
419 # --------------------------------------------------------
421 # Cross compiling overrides
423 if test "$CC" = "i586-mingw32msvc-gcc"; then
429 ac_cv_sizeof_long_long=4
432 # SDCC_BUILD_BIGENDIAN ([ACTION-IF-TRUE], [ACTION-IF-FALSE], [ACTION-IF-UNKNOWN])
433 # -------------------------------------------------------------------------
434 AC_DEFUN([SDCC_BUILD_BIGENDIAN],
435 [AC_CACHE_CHECK(whether host machine byte ordering is bigendian, sdcc_cv_build_bigendian,
436 [# See if sys/param.h defines the BYTE_ORDER macro.
437 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
438 #include <sys/param.h>
440 [#if ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \
441 && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN)
445 [# It does; now see whether it defined to BIG_ENDIAN or not.
446 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
447 #include <sys/param.h>
448 ], [#if BYTE_ORDER != BIG_ENDIAN
451 ])], [sdcc_cv_build_bigendian=yes], [sdcc_cv_build_bigendian=no])],
452 [# It does not; compile a test program.
454 [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], [[
455 /* Are we little or big endian? From Harbison&Steele. */
459 char c[sizeof (long int)];
462 return u.c[sizeof (long int) - 1] == 1;
464 [sdcc_cv_build_bigendian=no],
465 [sdcc_cv_build_bigendian=yes],
466 [# try to guess the endianness by grepping values into an object file
467 sdcc_cv_build_bigendian=unknown
468 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
469 [[short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
470 short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
471 void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; }
472 short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
473 short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
474 void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; }]],
475 [[ _ascii (); _ebcdic (); ]])],
476 [if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then
477 sdcc_cv_build_bigendian=yes
479 if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
480 if test "$sdcc_cv_build_bigendian" = unknown; then
481 sdcc_cv_build_bigendian=no
483 # finding both strings is unlikely to happen, but who knows?
484 sdcc_cv_build_bigendian=unknown
487 case $sdcc_cv_build_bigendian in
490 [AC_DEFINE([BUILD_WORDS_BIGENDIAN], 1,
491 [Define to 1 if your processor stores words with the most significant
492 byte first (like Motorola and SPARC, unlike Intel and VAX).])]) ;;
497 [AC_MSG_ERROR([unknown endianness
498 presetting sdcc_cv_build_bigendian=no (or yes) will help])]) ;;
500 ])# SDCC_BUILD_BIGENDIAN
504 AC_CACHE_CHECK(whether preprocessor accepts -MM or -M,ucsim_cv_MM,
505 echo "#include <stdio.h>" >_test_.c
507 $CXXCPP -v -MM _test_.c 1>&5 2>&5
508 if test "$?" = "0"; then
517 # This is the first time when CFLAGS are set/modified!!
521 if test "$ucsim_cv_CXXgstabs" = "yes"; then
523 elif test "$ucsim_cv_CXXggdb" = "yes"; then
528 if test "$CXXFLAGS"x = x ;then
531 CXXFLAGS="$CXXFLAGS $gopt"
535 if test "$ucsim_cv_CXXpipe" = "yes"; then
536 CXXFLAGS="$CXXFLAGS -pipe"
541 DD_COPT_NO_IGNORE(CXX, fPIC)
542 if test "$ucsim_cv_CXXfPIC" = "yes"; then
545 DD_COPT_NO_IGNORE(CXX, fpic)
546 if test "$ucsim_cv_CXXfpic" = "yes"; then
550 if test "$PICOPT"x != "x"; then
557 if test $SHAREDLIB = "yes" -a $dl_ok = "yes" -a $enable_dlso = "yes"; then
562 # Checks for typedefs, structures, and compiler characteristics.
563 # ===========================================================================
566 if test "$cross_compiling" = "no"; then
567 AC_CHECK_SIZEOF(char)
568 AC_CHECK_SIZEOF(short)
570 AC_CHECK_SIZEOF(long)
571 AC_CHECK_SIZEOF(long long)
573 if $CXX -v 2>&1|grep "mingw" >/dev/null 2>&1; then
578 ac_cv_sizeof_long_long=4
587 if expr "$ac_cv_sizeof_char" '>=' "$1" >/dev/null; then
591 if expr "$ac_cv_sizeof_short" '>=' "$1" >/dev/null; then
595 if expr "$ac_cv_sizeof_int" '>=' "$1" >/dev/null; then
599 if expr "$ac_cv_sizeof_long" '>=' "$1" >/dev/null; then
603 if expr "$ac_cv_sizeof_long_long" '>=' "$1" >/dev/null; then
610 AC_MSG_CHECKING(type name for byte)
611 TYPE_BYTE=`type_name 1`
612 AC_MSG_RESULT($TYPE_BYTE)
613 AC_MSG_CHECKING(type name for word)
614 TYPE_WORD=`type_name 2`
615 AC_MSG_RESULT($TYPE_WORD)
616 AC_MSG_CHECKING(type name for dword)
617 TYPE_DWORD=`type_name 4`
618 AC_MSG_RESULT($TYPE_DWORD)
619 AC_DEFINE_UNQUOTED(TYPE_BYTE, $TYPE_BYTE)
620 AC_DEFINE_UNQUOTED(TYPE_WORD, $TYPE_WORD)
621 AC_DEFINE_UNQUOTED(TYPE_DWORD, $TYPE_DWORD)
623 if echo $TYPE_DWORD|grep short >/dev/null; then
625 elif echo $TYPE_DWORD|grep long >/dev/null; then
631 if echo $TYPE_WORD|grep short >/dev/null; then M="h"
632 elif echo $TYPE_WORD|grep long >/dev/null; then M="l"
636 AC_DEFINE_UNQUOTED(_A_, "${A}")
637 AC_DEFINE_UNQUOTED(_M_, "${M}")
639 # Generating output files
640 # ===========================================================================
644 packages.mk:packages_in.mk
653 gui.src/serio.src/Makefile
657 #gui.src/portmon.src/Makefile
660 # End of configure/configure.in