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 VERSION=`cat ${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 if test "$cross_compiling" = "no"
437 if $CXX -v 2>&1|grep "mingw" >/dev/null 2>&1; then
442 #echo "CROSS ENDIAN DONE"
445 AC_CACHE_CHECK(whether preprocessor accepts -MM or -M,ucsim_cv_MM,
446 echo "#include <stdio.h>" >_test_.c
448 $CXXCPP -v -MM _test_.c 1>&5 2>&5
449 if test "$?" = "0"; then
458 # This is the first time when CFLAGS are set/modified!!
462 if test "$ucsim_cv_CXXgstabs" = "yes"; then
464 elif test "$ucsim_cv_CXXggdb" = "yes"; then
469 if test "$CXXFLAGS"x = x ;then
472 CXXFLAGS="$CXXFLAGS $gopt"
476 if test "$ucsim_cv_CXXpipe" = "yes"; then
477 CXXFLAGS="$CXXFLAGS -pipe"
482 DD_COPT_NO_IGNORE(CXX, fPIC)
483 if test "$ucsim_cv_CXXfPIC" = "yes"; then
486 DD_COPT_NO_IGNORE(CXX, fpic)
487 if test "$ucsim_cv_CXXfpic" = "yes"; then
491 if test "$PICOPT"x != "x"; then
498 if test $SHAREDLIB = "yes" -a $dl_ok = "yes" -a $enable_dlso = "yes"; then
503 # Checks for typedefs, structures, and compiler characteristics.
504 # ===========================================================================
507 if test "$cross_compiling" = "no"; then
508 AC_CHECK_SIZEOF(char)
509 AC_CHECK_SIZEOF(short)
511 AC_CHECK_SIZEOF(long)
512 AC_CHECK_SIZEOF(long long)
514 if $CXX -v 2>&1|grep "mingw" >/dev/null 2>&1; then
519 ac_cv_sizeof_long_long=4
528 if expr "$ac_cv_sizeof_char" '>=' "$1" >/dev/null; then
532 if expr "$ac_cv_sizeof_short" '>=' "$1" >/dev/null; then
536 if expr "$ac_cv_sizeof_int" '>=' "$1" >/dev/null; then
540 if expr "$ac_cv_sizeof_long" '>=' "$1" >/dev/null; then
544 if expr "$ac_cv_sizeof_long_long" '>=' "$1" >/dev/null; then
551 AC_MSG_CHECKING(type name for byte)
552 TYPE_BYTE=`type_name 1`
553 AC_MSG_RESULT($TYPE_BYTE)
554 AC_MSG_CHECKING(type name for word)
555 TYPE_WORD=`type_name 2`
556 AC_MSG_RESULT($TYPE_WORD)
557 AC_MSG_CHECKING(type name for dword)
558 TYPE_DWORD=`type_name 4`
559 AC_MSG_RESULT($TYPE_DWORD)
560 AC_DEFINE_UNQUOTED(TYPE_BYTE, $TYPE_BYTE)
561 AC_DEFINE_UNQUOTED(TYPE_WORD, $TYPE_WORD)
562 AC_DEFINE_UNQUOTED(TYPE_DWORD, $TYPE_DWORD)
564 if echo $TYPE_DWORD|grep short >/dev/null; then
566 elif echo $TYPE_DWORD|grep long >/dev/null; then
572 if echo $TYPE_WORD|grep short >/dev/null; then M="h"
573 elif echo $TYPE_WORD|grep long >/dev/null; then M="l"
577 AC_DEFINE_UNQUOTED(_A_, "${A}")
578 AC_DEFINE_UNQUOTED(_M_, "${M}")
580 # Generating output files
581 # ===========================================================================
585 packages.mk:packages_in.mk
594 gui.src/serio.src/Makefile
598 #gui.src/portmon.src/Makefile
601 # End of configure/configure.in