4 AC_CONFIG_HEADER(sdccconf.h:sdccconf_in.h)
8 AC_MSG_CHECKING(version of the package)
9 if test -f .version; then
10 VERSION=`cat .version`
11 elif test -f ../.version; then
12 VERSION=`cat ../.version`
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}'`
19 # Assume no special extension
22 AC_MSG_RESULT(${VERSION})
27 AC_DEFINE_UNQUOTED(SDCC_VERSION_LO, ${VERSIONLO})
28 AC_DEFINE_UNQUOTED(SDCC_VERSION_HI, ${VERSIONHI})
29 AC_DEFINE_UNQUOTED(SDCC_VERSION_P, ${VERSIONP})
30 AC_DEFINE_UNQUOTED(SDCC_VERSION_STR, "${VERSION}")
32 sdcc_cv_version=$VERSION
33 sdcc_cv_versionhi=$VERSIONHI
34 sdcc_cv_versionlo=$VERSIONLO
35 sdcc_cv_versionp=$VERSIONP
45 AC_CHECK_PROG(YACC, bison, bison -y, :)
46 AC_CHECK_PROG(AUTOCONF, autoconf, autoconf, :)
47 AC_CHECK_PROG(STRIP, strip, strip, :)
48 AC_CHECK_PROG(AS, as, as, :)
49 AC_CHECK_PROG(CP, cp, cp, :)
51 AC_DEFUN(SDCC_REQUIRE_PROG,
52 [if test "$1" = ":"; then
53 AC_MSG_ERROR([Cannot find required program $2.])
57 SDCC_REQUIRE_PROG($YACC, bison)
58 SDCC_REQUIRE_PROG($LEX, lex)
62 # Checking for header files.
63 # ===========================================================================
65 AC_CHECK_HEADERS(getopt.h)
66 AC_CHECK_HEADERS(unistd.h)
67 AC_CHECK_HEADERS(endian.h)
68 AC_CHECK_HEADERS(machine/endian.h)
69 AC_CHECK_HEADERS(malloc.h)
70 AC_CHECK_HEADERS(sys/isa_defs.h)
71 AC_CHECK_HEADERS(sys/socket.h)
74 # This must be after CPP
76 AC_CACHE_CHECK(which header file defines FD_ macros, s51_cv_fd,
82 #endif], sdcc_cv_fd="<sys/time.h>")
84 #include <sys/types.h>
87 #endif], sdcc_cv_fd="<sys/types.h>")
89 #include <sys/select.h>
92 #endif], sdcc_cv_fd="<sys/types.h>")])
94 AC_DEFINE(FD_HEADER_OK, 0)
95 if echo $sdcc_cv_fd|grep time >/dev/null 2>&1; then
96 AC_DEFINE(FD_NEED_TIME_H, 1)
97 AC_DEFINE(FD_HEADER_OK, 1)
99 AC_DEFINE(FD_NEED_TIME_H, 0)
101 if echo $sdcc_cv_fd|grep types >/dev/null 2>&1; then
102 AC_DEFINE(FD_NEED_TYPES_H, 1)
103 AC_DEFINE(FD_HEADER_OK, 1)
105 AC_DEFINE(FD_NEED_TYPES_H, 0)
107 if echo $sdcc_cv_fd|grep select >/dev/null 2>&1; then
108 AC_DEFINE(FD_NEED_SELECT_H, 1)
109 AC_DEFINE(FD_HEADER_OK, 1)
111 AC_DEFINE(FD_NEED_SELECT_H, 0)
114 AC_DEFINE_UNQUOTED(HEADER_FD, ${sdcc_cv_fd})
117 # Checking for functions
118 # ===========================================================================
119 AC_CHECK_FUNCS(strlen strcpy strcat strstr strcmp strerror strtok strdup)
120 AC_CHECK_FUNCS(strchr memcpy)
121 dnl AC_CHECK_FUNCS(getline)
122 dnl AC_CHECK_FUNCS(getdelim)
123 AC_CHECK_FUNCS(fgets)
124 AC_CHECK_FUNCS(yylex)
126 # check if -lsocket && -lxnet is required to compile socket stuff
127 AC_SEARCH_LIBS(socket,socket)
128 AC_SEARCH_LIBS(inet_addr,nsl xnet)
133 # DD_COPT macro checks if the compiler specified as the 1st parameter
134 # supports option specified as the 2nd parameter
135 # For example: DD_CPORT(CXX, fPIC)
138 AC_CACHE_CHECK(whether $$1 accepts -$2,sdcc_cv_$1$2,
143 $$1 -v -$2 -c _test_.c 1>&5 2>&5
144 if test "$?" = "0"; then
149 rm -f _test_.* a.out)
153 # Checking characteristics of compilers and other programs
154 # --------------------------------------------------------
155 AC_CACHE_CHECK(whether preprocessor accepts -MM or -M,sdcc_cv_MM,
156 echo "#include <stdio.h>" >_test_.c
158 $CPP -v -MM _test_.c 1>&5 2>&5
159 if test "$?" = "0"; then
168 # This is the first time when CFLAGS are set/modified!!
170 if test "$sdcc_cv_CCggdb" = "yes"; then
175 if test "$sdcc_cv_CCpipe" = "yes"; then
176 CFLAGS="$CFLAGS -pipe"
180 # Checks for typedefs, structures, and compiler characteristics.
181 # ===========================================================================
186 if test "${prefix}" = "NONE"; then
191 sdcc_datadir=${datadir}/sdcc
192 AC_SUBST(sdcc_datadir)
194 # For some unknown reason, putting this assignment in a subshell
195 # like this causes the rvalue to be fully substituted. We need this
196 # for the defines below to generate the right thing. We keep this
197 # separate from the substituted sdcc_datadir because we want the
198 # latter for makefiles.
199 if test "${datadir}" = "\${prefix}/share"; then
200 sdcc_datadir_tmp=${prefix}/share/sdcc
202 sdcc_datadir_tmp=${datadir}/sdcc
206 AC_DEFINE_UNQUOTED(STANDARD_INCLUDE_DIR, "${sdcc_datadir_tmp}/include")
207 AC_DEFINE_UNQUOTED(SDCC_INCLUDE_DIR, "${sdcc_datadir_tmp}/include")
208 AC_DEFINE_UNQUOTED(SDCC_LIB_DIR, "${sdcc_datadir_tmp}/lib")
209 AC_DEFINE_UNQUOTED(STD_LIB, "libsdcc")
210 AC_DEFINE_UNQUOTED(STD_INT_LIB, "libint")
211 AC_DEFINE_UNQUOTED(STD_LONG_LIB, "liblong")
212 AC_DEFINE_UNQUOTED(STD_FP_LIB, "libfloat")
213 AC_DEFINE_UNQUOTED(STD_DS390_LIB, "libds390")
215 AC_DEFINE_UNQUOTED(PREFIX, "${prefix}")
216 AC_DEFINE_UNQUOTED(DATADIR, "${sdcc_datadir_tmp}")
217 AC_DEFINE_UNQUOTED(SRCDIR, "${config_in}")
221 # Now handle the port selection
222 rm -f ports.all ports.build
223 AC_ARG_ENABLE(mcs51-port,[ --disable-mcs51-port Excludes the Intel mcs51 port])
224 echo mcs51 >>ports.all
225 if test "$enable_mcs51_port" = "no"; then
226 AC_DEFINE_UNQUOTED(OPT_DISABLE_MCS51, 1)
228 echo mcs51 >>ports.build
229 AC_DEFINE_UNQUOTED(OPT_DISABLE_MCS51, 0)
232 AC_ARG_ENABLE(gbz80-port,[ --disable-gbz80-port Excludes the Gameboy gbz80 port])
234 if test "$enable_gbz80_port" = "no"; then
235 AC_DEFINE_UNQUOTED(OPT_DISABLE_GBZ80, 1)
237 echo z80 >>ports.build
238 AC_DEFINE_UNQUOTED(OPT_DISABLE_GBZ80, 0)
241 AC_ARG_ENABLE(z80-port,[ --disable-z80-port Excludes the z80 port])
243 if test "$enable_z80_port" = "no"; then
244 AC_DEFINE_UNQUOTED(OPT_DISABLE_Z80, 1)
246 echo z80 >>ports.build
247 AC_DEFINE_UNQUOTED(OPT_DISABLE_Z80, 0)
250 AC_ARG_ENABLE(avr-port,[ --disable-avr-port Excludes the AVR port])
252 if test "$enable_avr_port" = "no"; then
253 AC_DEFINE_UNQUOTED(OPT_DISABLE_AVR, 1)
255 echo avr >>ports.build
256 AC_DEFINE_UNQUOTED(OPT_DISABLE_AVR, 0)
259 AC_ARG_ENABLE(ds390-port,[ --disable-ds390-port Excludes the DS390 port])
260 echo ds390 >>ports.all
261 if test "$enable_ds390_port" = "no"; then
262 AC_DEFINE_UNQUOTED(OPT_DISABLE_DS390, 1)
264 echo ds390 >>ports.build
265 AC_DEFINE_UNQUOTED(OPT_DISABLE_DS390, 0)
268 AC_ARG_ENABLE(pic-port,[ --disable-pic-port Excludes the PIC port])
270 if test "$enable_pic_port" = "no"; then
271 AC_DEFINE_UNQUOTED(OPT_DISABLE_PIC, 1)
273 echo pic >>ports.build
274 AC_DEFINE_UNQUOTED(OPT_DISABLE_PIC, 0)
277 AC_ARG_ENABLE(i186-port,[ --disable-i186-port Excludes the I186 port])
279 if test "$enable_i186_port" = "no"; then
280 AC_DEFINE_UNQUOTED(OPT_DISABLE_I186, 1)
282 echo izt >>ports.build
283 AC_DEFINE_UNQUOTED(OPT_DISABLE_I186, 0)
286 AC_ARG_ENABLE(tlcs900h-port,[ --disable-tlcs900h-port Excludes the TLCS900H port])
288 if test "$enable_tlcs900h_port" = "no"; then
289 AC_DEFINE_UNQUOTED(OPT_DISABLE_TLCS900H, 1)
291 echo izt >>ports.build
292 AC_DEFINE_UNQUOTED(OPT_DISABLE_TLCS900H, 0)
295 AC_ARG_ENABLE(ucsim,[ --disable-ucsim Disables configuring and building of ucsim])
296 OPT_ENABLE_UCSIM=$enable_ucsim
297 AC_SUBST(OPT_ENABLE_UCSIM)
299 AC_ARG_ENABLE(device-lib-build,[ --disable-device-lib-build Disables automatically building device libraries])
300 OPT_ENABLE_DEVICE_LIB_BUILD=$enable_device_lib_build
301 AC_SUBST(OPT_ENABLE_DEVICE_LIB_BUILD)
303 AC_ARG_ENABLE(packihx,[ --disable-packihx Disables building packihx])
304 OPT_ENABLE_PACKIHX=$enable_packihx
305 AC_SUBST(OPT_ENABLE_PACKIHX)
307 AC_ARG_ENABLE(libgc,[ --enable-libgc Use the Bohem memory allocator. Lower runtime footprint.])
308 if test "$enable_libgc" = "yes"; then
309 AC_CHECK_LIB(gc, GC_malloc)
314 AC_DEFINE_UNQUOTED(OPT_ENABLE_LIBGC, $OPT_ENABLE_LIBGC)
317 cat ports.all | uniq >ports
319 cat ports.build | uniq >ports
322 # Generating output files
323 # ===========================================================================
324 AC_CONFIG_SUBDIRS(support/cpp2)
325 AC_CONFIG_SUBDIRS(packihx)
326 AC_CONFIG_SUBDIRS(sim/ucsim)
327 # MLH: removed as the rules are already in Makefile.common
330 AC_OUTPUT(main.mk:main_in.mk
333 device/include/Makefile
335 debugger/mcs51/Makefile
336 Makefile.common:Makefile.common.in
339 # End of configure/configure.in