5 AC_CONFIG_SRCDIR([Makefile])
6 AC_CONFIG_HEADER(sdccconf.h:sdccconf_in.h)
10 AC_MSG_CHECKING(version of the package)
11 if test -f .version; then
12 VERSION=`cat .version`
13 elif test -f ../.version; then
14 VERSION=`cat ../.version`
18 VERSIONHI=`echo $VERSION|$AWK 'BEGIN {FS="."} {print $1}'`
19 VERSIONLO=`echo $VERSION|$AWK 'BEGIN {FS="."} {print $2}'`
20 VERSIONP=`echo $VERSION|$AWK 'BEGIN {FS="."} {print $3}'`
21 # Assume no special extension
24 AC_MSG_RESULT(${VERSION})
29 AC_DEFINE_UNQUOTED(SDCC_VERSION_LO, ${VERSIONLO})
30 AC_DEFINE_UNQUOTED(SDCC_VERSION_HI, ${VERSIONHI})
31 AC_DEFINE_UNQUOTED(SDCC_VERSION_P, ${VERSIONP})
32 AC_DEFINE_UNQUOTED(SDCC_VERSION_STR, "${VERSION}")
34 sdcc_cv_version=$VERSION
35 sdcc_cv_versionhi=$VERSIONHI
36 sdcc_cv_versionlo=$VERSIONLO
37 sdcc_cv_versionp=$VERSIONP
41 # ===========================================================================
49 AC_CHECK_PROG(AUTOCONF, autoconf, autoconf, :)
50 AC_CHECK_PROG(STRIP, strip, strip, :)
51 AC_CHECK_PROG(AS, as, as, :)
52 AC_CHECK_PROG(CP, cp, cp, :)
54 AC_CHECK_PROG(LYX, lyx, lyx, :)
55 AC_CHECK_PROG(LATEX, latex, latex, :)
56 AC_CHECK_PROG(LATEX2HTML, latex2html, latex2html, :)
57 AC_CHECK_PROG(PDFLATEX, pdflatex, pdflatex, :)
58 AC_CHECK_PROG(DVIPDF, dvipdf, dvipdf, :)
60 AC_DEFUN(SDCC_REQUIRE_PROG,
61 [if test "$1" = ":"; then
62 AC_MSG_ERROR([Cannot find required program $2.])
66 SDCC_REQUIRE_PROG($YACC, bison)
67 SDCC_REQUIRE_PROG($LEX, lex)
72 # Checking for header files.
73 # ===========================================================================
74 AC_CHECK_HEADERS(sys/socket.h)
77 # Checking for functions
78 # ===========================================================================
79 AC_CHECK_FUNCS(strerror)
80 AC_CHECK_FUNCS(vsnprintf snprintf vsprintf mkstemp)
84 # ===========================================================================
86 # DD_COPT macro checks if the compiler specified as the 1st parameter
87 # supports option specified as the 2nd parameter
88 # For example: DD_CPORT(CXX, fPIC)
91 AC_CACHE_CHECK(whether $$1 accepts -$2,sdcc_cv_$1$2,
96 $$1 -v -$2 -c _test_.c 1>&5 2>&5
97 if test "$?" = "0"; then
102 rm -f _test_.* a.out)
105 # This macro _AC_DEFINEs VARNAME to the expansion of the DIR variable,
106 # taking care of fixing up ${prefix} and such.
108 # Note that the 3 argument form is only supported with autoconf 2.13
109 # and later (i.e. only where _AC_DEFINE supports 3 arguments).
113 # AC_DEFINE_DIR(DATADIR, datadir)
114 # AC_DEFINE_DIR(PROG_PATH, bindir, [Location of installed binaries])
116 AC_DEFUN([AC_DEFINE_DIR], [
117 test "x$prefix" = xNONE && prefix="$ac_default_prefix"
118 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
119 ac_define_dir=`eval echo [$]$2`
120 ac_define_dir=`eval echo [$]ac_define_dir`
122 AC_DEFINE_UNQUOTED($1, "$ac_define_dir"),
123 AC_DEFINE_UNQUOTED($1, "$ac_define_dir", $3))
127 # Checking characteristics of compilers and other programs
128 # ===========================================================================
129 AC_CACHE_CHECK(whether preprocessor accepts -MM or -M,sdcc_cv_MM,
130 echo "#include <stdio.h>" >_test_.c
132 $CPP -v -MM _test_.c 1>&5 2>&5
133 if test "$?" = "0"; then
142 # This is the first time when CFLAGS are set/modified!!
144 if test "$sdcc_cv_CCggdb" = "yes"; then
149 if test "$sdcc_cv_CCpipe" = "yes"; then
150 CFLAGS="$CFLAGS -pipe"
153 # Checks for typedefs, structures, and compiler characteristics.
154 # ===========================================================================
157 AC_CHECK_SIZEOF(char)
158 AC_CHECK_SIZEOF(short)
160 AC_CHECK_SIZEOF(long)
164 if expr "$ac_cv_sizeof_char" '>=' "$1" >/dev/null; then
168 if expr "$ac_cv_sizeof_short" '>=' "$1" >/dev/null; then
172 if expr "$ac_cv_sizeof_int" '>=' "$1" >/dev/null; then
176 if expr "$ac_cv_sizeof_long" '>=' "$1" >/dev/null; then
183 AC_MSG_CHECKING(type name for byte)
184 TYPE_BYTE=`type_name 1`
185 AC_MSG_RESULT($TYPE_BYTE)
186 AC_MSG_CHECKING(type name for word)
187 TYPE_WORD=`type_name 2`
188 AC_MSG_RESULT($TYPE_WORD)
189 AC_MSG_CHECKING(type name for dword)
190 TYPE_DWORD=`type_name 4`
191 AC_MSG_RESULT($TYPE_DWORD)
192 AC_DEFINE_UNQUOTED(TYPE_BYTE, $TYPE_BYTE)
193 AC_DEFINE_UNQUOTED(TYPE_WORD, $TYPE_WORD)
194 AC_DEFINE_UNQUOTED(TYPE_DWORD, $TYPE_DWORD)
198 # Set standard installation paths
199 # ===========================================================================
209 AC_MSG_CHECKING(host mingw32)
210 AC_MSG_RESULT($MINGW32_HOST)
212 # prefix: *nix default is "NONE"
213 # prefix: mingw32 default is "/sdcc"
214 if test "$prefix" = NONE; then
215 if test "$MINGW32_HOST" = "no"; then
222 # datadir: *nix default is "${prefix}/share"
223 if test "$datadir" = "\${prefix}/share"; then
224 if test "$MINGW32_HOST" = "no"; then
225 datadir="\${prefix}/share/sdcc"
227 # mingw32 default is "/sdcc"
228 elif test "$datadir" = "/sdcc"; then
229 if test "$MINGW32_HOST" = "yes"; then
235 AC_DEFINE_UNQUOTED(STD_LIB, "libsdcc")
236 AC_DEFINE_UNQUOTED(STD_INT_LIB, "libint")
237 AC_DEFINE_UNQUOTED(STD_LONG_LIB, "liblong")
238 AC_DEFINE_UNQUOTED(STD_FP_LIB, "libfloat")
239 AC_DEFINE_UNQUOTED(STD_DS390_LIB, "libds390")
240 AC_DEFINE_UNQUOTED(STD_xa51_LIB, "xa51")
242 AC_DEFINE_DIR(PREFIX, "${prefix}")
243 AC_DEFINE_DIR(DATADIR, "$datadir")
248 AC_DEFINE_DIR(BIN_DIR_SUFFIX, "${bin_dir_suffix}")
250 if test "$MINGW32_HOST" = "no"; then
251 search_suffix="share/sdcc"
255 AC_DEFINE_DIR(SEARCH_SUFFIX, "${search_suffix}")
257 include_dir_suffix="include"
258 AC_DEFINE_DIR(INCLUDE_DIR_SUFFIX, "${include_dir_suffix}")
261 AC_DEFINE_UNQUOTED(LIB_DIR_SUFFIX, "${lib_dir_suffix}")
264 # sdcc_datadir is still used in [device,lib]/Makefile
265 sdcc_datadir=${datadir}
266 AC_SUBST(sdcc_datadir)
268 # SDCC_[INCLUDE,LIB]_DIR is still used in SDCCmain.c
269 if test "${includedir}" = "\${prefix}/include"; then
270 includedir="${datadir}/include"
272 AC_DEFINE_DIR(SDCC_INCLUDE_DIR, "${includedir}")
273 AC_DEFINE_DIR(SDCC_LIB_DIR, "${datadir}/lib")
276 # environment variables
277 sdcc_dir_name="SDCC_HOME"
278 AC_DEFINE_DIR(SDCC_DIR_NAME, "${sdcc_dir_name}")
279 sdcc_include_name="SDCC_INCLUDE"
280 AC_DEFINE_DIR(SDCC_INCLUDE_NAME, "${sdcc_include_name}")
281 sdcc_lib_name="SDCC_LIB"
282 AC_DEFINE_DIR(SDCC_LIB_NAME, "${sdcc_lib_name}")
284 # Now handle the port selection
285 # ===========================================================================
286 rm -f ports.all ports.build
287 AC_ARG_ENABLE(mcs51-port,
288 AC_HELP_STRING([--disable-mcs51-port],
289 [Excludes the Intel mcs51 port]))
290 echo mcs51 >>ports.all
291 if test "$enable_mcs51_port" = "no"; then
292 AC_DEFINE_UNQUOTED(OPT_DISABLE_MCS51, 1)
294 echo mcs51 >>ports.build
295 AC_DEFINE_UNQUOTED(OPT_DISABLE_MCS51, 0)
298 AC_ARG_ENABLE(gbz80-port,
299 AC_HELP_STRING([--disable-gbz80-port],
300 [Excludes the Gameboy gbz80 port]))
302 if test "$enable_gbz80_port" = "no"; then
303 AC_DEFINE_UNQUOTED(OPT_DISABLE_GBZ80, 1)
305 echo z80 >>ports.build
306 AC_DEFINE_UNQUOTED(OPT_DISABLE_GBZ80, 0)
309 AC_ARG_ENABLE(z80-port,
310 AC_HELP_STRING([--disable-z80-port],
311 [Excludes the z80 port]))
313 if test "$enable_z80_port" = "no"; then
314 AC_DEFINE_UNQUOTED(OPT_DISABLE_Z80, 1)
316 echo z80 >>ports.build
317 AC_DEFINE_UNQUOTED(OPT_DISABLE_Z80, 0)
320 AC_ARG_ENABLE(avr-port,
321 AC_HELP_STRING([--disable-avr-port],
322 [Excludes the AVR port]))
324 if test "$enable_avr_port" = "no"; then
325 AC_DEFINE_UNQUOTED(OPT_DISABLE_AVR, 1)
327 echo avr >>ports.build
328 AC_DEFINE_UNQUOTED(OPT_DISABLE_AVR, 0)
331 AC_ARG_ENABLE(ds390-port,
332 AC_HELP_STRING([--disable-ds390-port],
333 [Excludes the DS390 port]))
334 echo ds390 >>ports.all
335 if test "$enable_ds390_port" = "no"; then
336 AC_DEFINE_UNQUOTED(OPT_DISABLE_DS390, 1)
337 AC_DEFINE_UNQUOTED(OPT_DISABLE_TININative, 1)
339 echo ds390 >>ports.build
340 AC_DEFINE_UNQUOTED(OPT_DISABLE_DS390, 0)
341 AC_DEFINE_UNQUOTED(OPT_DISABLE_TININative, 0)
344 AC_ARG_ENABLE(pic-port,
345 AC_HELP_STRING([--disable-pic-port],
346 [Excludes the PIC port]))
348 if test "$enable_pic_port" = "no"; then
349 AC_DEFINE_UNQUOTED(OPT_DISABLE_PIC, 1)
351 echo pic >>ports.build
352 AC_DEFINE_UNQUOTED(OPT_DISABLE_PIC, 0)
355 AC_ARG_ENABLE(xa51-port,
356 AC_HELP_STRING([--disable-xa51-port],
357 [Excludes the XA51 port]))
358 echo xa51 >>ports.all
359 if test "$enable_xa51_port" = "no"; then
360 AC_DEFINE_UNQUOTED(OPT_DISABLE_XA51, 1)
362 echo xa51 >>ports.build
363 AC_DEFINE_UNQUOTED(OPT_DISABLE_XA51, 0)
367 AC_HELP_STRING([--disable-ucsim],
368 [Disables configuring and building of ucsim]))
369 OPT_ENABLE_UCSIM=$enable_ucsim
370 AC_SUBST(OPT_ENABLE_UCSIM)
372 AC_ARG_ENABLE(device-lib-build,
373 AC_HELP_STRING([--disable-device-lib-build],
374 [Disables automatically building device libraries]))
375 OPT_ENABLE_DEVICE_LIB_BUILD=$enable_device_lib_build
376 AC_SUBST(OPT_ENABLE_DEVICE_LIB_BUILD)
378 AC_ARG_ENABLE(packihx,
379 AC_HELP_STRING([--disable-packihx],
380 [Disables building packihx]))
381 OPT_ENABLE_PACKIHX=$enable_packihx
382 AC_SUBST(OPT_ENABLE_PACKIHX)
385 AC_HELP_STRING([--enable-libgc],
386 [Use the Bohem memory allocator. Lower runtime footprint.]))
387 if test "$enable_libgc" = "yes"; then
388 AC_CHECK_LIB(gc, GC_malloc)
393 AC_DEFINE_UNQUOTED(OPT_ENABLE_LIBGC, $OPT_ENABLE_LIBGC)
396 cat ports.all | uniq >ports
398 cat ports.build | uniq >ports
401 # Generating output files
402 # ===========================================================================
403 AC_CONFIG_SUBDIRS(support/cpp2)
404 AC_CONFIG_SUBDIRS(packihx)
405 AC_CONFIG_SUBDIRS(sim/ucsim)
406 AC_CONFIG_FILES([main.mk:main_in.mk
409 device/include/Makefile
411 debugger/mcs51/Makefile
412 Makefile.common:Makefile.common.in
416 # End of configure/configure.in