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 AC_MSG_RESULT(${VERSION})
24 AC_DEFINE_UNQUOTED(SDCC_VERSION_LO, ${VERSIONLO})
25 AC_DEFINE_UNQUOTED(SDCC_VERSION_HI, ${VERSIONHI})
26 AC_DEFINE_UNQUOTED(SDCC_VERSION_P, ${VERSIONP})
27 AC_DEFINE_UNQUOTED(SDCC_VERSION_STR, "${VERSION}")
28 sdcc_cv_version=$VERSION
29 sdcc_cv_versionhi=$VERSIONHI
30 sdcc_cv_versionlo=$VERSIONLO
31 sdcc_cv_versionp=$VERSIONP
41 AC_CHECK_PROG(YACC, bison, bison -y, :)
42 AC_CHECK_PROG(AUTOCONF, autoconf, autoconf, :)
43 AC_CHECK_PROG(AS, as, as, :)
44 AC_CHECK_PROG(CP, cp, cp, :)
46 AC_DEFUN(SDCC_REQUIRE_PROG,
47 [if test "$1" = ":"; then
48 AC_MSG_ERROR([Cannot find required program $2.])
52 SDCC_REQUIRE_PROG($YACC, bison)
53 SDCC_REQUIRE_PROG($LEX, lex)
57 # Checking for header files.
58 # ===========================================================================
60 AC_CHECK_HEADERS(getopt.h)
61 AC_CHECK_HEADERS(unistd.h)
62 AC_CHECK_HEADERS(endian.h)
63 AC_CHECK_HEADERS(malloc.h)
64 AC_CHECK_HEADERS(sys/isa_defs.h)
65 AC_CHECK_HEADERS(sys/socket.h)
68 # This must be after CPP
70 AC_CACHE_CHECK(which header file defines FD_ macros, s51_cv_fd,
76 #endif], sdcc_cv_fd="<sys/time.h>")
78 #include <sys/types.h>
81 #endif], sdcc_cv_fd="<sys/types.h>")
83 #include <sys/select.h>
86 #endif], sdcc_cv_fd="<sys/types.h>")])
88 AC_DEFINE(FD_HEADER_OK, 0)
89 if echo $sdcc_cv_fd|grep time >/dev/null 2>&1; then
90 AC_DEFINE(FD_NEED_TIME_H, 1)
91 AC_DEFINE(FD_HEADER_OK, 1)
93 AC_DEFINE(FD_NEED_TIME_H, 0)
95 if echo $sdcc_cv_fd|grep types >/dev/null 2>&1; then
96 AC_DEFINE(FD_NEED_TYPES_H, 1)
97 AC_DEFINE(FD_HEADER_OK, 1)
99 AC_DEFINE(FD_NEED_TYPES_H, 0)
101 if echo $sdcc_cv_fd|grep select >/dev/null 2>&1; then
102 AC_DEFINE(FD_NEED_SELECT_H, 1)
103 AC_DEFINE(FD_HEADER_OK, 1)
105 AC_DEFINE(FD_NEED_SELECT_H, 0)
108 AC_DEFINE_UNQUOTED(HEADER_FD, ${sdcc_cv_fd})
111 # Checking for functions
112 # ===========================================================================
113 AC_CHECK_FUNCS(strlen strcpy strcat strstr strcmp strerror strtok strdup)
114 AC_CHECK_FUNCS(strchr memcpy)
115 dnl AC_CHECK_FUNCS(getline)
116 dnl AC_CHECK_FUNCS(getdelim)
117 AC_CHECK_FUNCS(fgets)
118 AC_CHECK_FUNCS(yylex)
120 # check if -lsocket && -lxnet is required to compile socket stuff
121 AC_SEARCH_LIBS(socket,socket)
122 AC_SEARCH_LIBS(inet_addr,nsl xnet)
127 # DD_COPT macro checks if the compiler specified as the 1st parameter
128 # supports option specified as the 2nd parameter
129 # For example: DD_CPORT(CXX, fPIC)
132 AC_CACHE_CHECK(whether $$1 accepts -$2,sdcc_cv_$1$2,
137 $$1 -v -$2 -c _test_.c 1>&5 2>&5
138 if test "$?" = "0"; then
143 rm -f _test_.* a.out)
147 # Checking characteristics of compilers and other programs
148 # --------------------------------------------------------
149 AC_CACHE_CHECK(whether preprocessor accepts -MM or -M,sdcc_cv_MM,
150 echo "#include <stdio.h>" >_test_.c
152 $CPP -v -MM _test_.c 1>&5 2>&5
153 if test "$?" = "0"; then
162 # This is the first time when CFLAGS are set/modified!!
164 if test "$sdcc_cv_CCggdb" = "yes"; then
169 if test "$sdcc_cv_CCpipe" = "yes"; then
170 CFLAGS="$CFLAGS -pipe"
174 # Checks for typedefs, structures, and compiler characteristics.
175 # ===========================================================================
180 if test "${prefix}" = "NONE"; then
185 sdcc_datadir=${datadir}/sdcc
186 AC_SUBST(sdcc_datadir)
188 # For some unknown reason, putting this assignment in a subshell
189 # like this causes the rvalue to be fully substituted. We need this
190 # for the defines below to generate the right thing. We keep this
191 # separate from the substituted sdcc_datadir because we want the
192 # latter for makefiles.
193 if test "${datadir}" = "\${prefix}/share"; then
194 sdcc_datadir_tmp=${prefix}/share/sdcc
196 sdcc_datadir_tmp=${datadir}/sdcc
200 AC_DEFINE_UNQUOTED(STANDARD_INCLUDE_DIR, "${sdcc_datadir_tmp}/include")
201 AC_DEFINE_UNQUOTED(SDCC_INCLUDE_DIR, "${sdcc_datadir_tmp}/include")
202 AC_DEFINE_UNQUOTED(SDCC_LIB_DIR, "${sdcc_datadir_tmp}/lib")
203 AC_DEFINE_UNQUOTED(STD_LIB, "libsdcc")
204 AC_DEFINE_UNQUOTED(STD_INT_LIB, "libint")
205 AC_DEFINE_UNQUOTED(STD_LONG_LIB, "liblong")
206 AC_DEFINE_UNQUOTED(STD_FP_LIB, "libfloat")
207 AC_DEFINE_UNQUOTED(STD_DS390_LIB, "libds390")
209 AC_DEFINE_UNQUOTED(PREFIX, "${prefix}")
210 AC_DEFINE_UNQUOTED(DATADIR, "${sdcc_datadir_tmp}")
211 AC_DEFINE_UNQUOTED(SRCDIR, "${config_in}")
215 # Now handle the port selection
216 rm -f ports.all ports.build
217 AC_ARG_ENABLE(mcs51-port,[ --disable-mcs51-port Excludes the Intel mcs51 port])
218 echo mcs51 >>ports.all
219 if test "$enable_mcs51_port" = "no"; then
220 AC_DEFINE_UNQUOTED(OPT_DISABLE_MCS51, 1)
222 echo mcs51 >>ports.build
223 AC_DEFINE_UNQUOTED(OPT_DISABLE_MCS51, 0)
226 AC_ARG_ENABLE(gbz80-port,[ --disable-gbz80-port Excludes the Gameboy gbz80 port])
228 if test "$enable_gbz80_port" = "no"; then
229 AC_DEFINE_UNQUOTED(OPT_DISABLE_GBZ80, 1)
231 echo z80 >>ports.build
232 AC_DEFINE_UNQUOTED(OPT_DISABLE_GBZ80, 0)
235 AC_ARG_ENABLE(z80-port,[ --disable-z80-port Excludes the z80 port])
237 if test "$enable_z80_port" = "no"; then
238 AC_DEFINE_UNQUOTED(OPT_DISABLE_Z80, 1)
240 echo z80 >>ports.build
241 AC_DEFINE_UNQUOTED(OPT_DISABLE_Z80, 0)
244 AC_ARG_ENABLE(avr-port,[ --disable-avr-port Excludes the AVR port])
246 if test "$enable_avr_port" = "no"; then
247 AC_DEFINE_UNQUOTED(OPT_DISABLE_AVR, 1)
249 echo avr >>ports.build
250 AC_DEFINE_UNQUOTED(OPT_DISABLE_AVR, 0)
253 AC_ARG_ENABLE(ds390-port,[ --disable-ds390-port Excludes the DS390 port])
254 echo ds390 >>ports.all
255 if test "$enable_ds390_port" = "no"; then
256 AC_DEFINE_UNQUOTED(OPT_DISABLE_DS390, 1)
258 echo ds390 >>ports.build
259 AC_DEFINE_UNQUOTED(OPT_DISABLE_DS390, 0)
262 AC_ARG_ENABLE(pic-port,[ --disable-pic-port Excludes the PIC port])
264 if test "$enable_pic_port" = "no"; then
265 AC_DEFINE_UNQUOTED(OPT_DISABLE_PIC, 1)
267 echo pic >>ports.build
268 AC_DEFINE_UNQUOTED(OPT_DISABLE_PIC, 0)
271 AC_ARG_ENABLE(i186-port,[ --disable-i186-port Excludes the I186 port])
273 if test "$enable_i186_port" = "no"; then
274 AC_DEFINE_UNQUOTED(OPT_DISABLE_I186, 1)
276 echo izt >>ports.build
277 AC_DEFINE_UNQUOTED(OPT_DISABLE_I186, 0)
280 AC_ARG_ENABLE(tlcs900h-port,[ --disable-tlcs900h-port Excludes the TLCS900H port])
282 if test "$enable_tlcs900h_port" = "no"; then
283 AC_DEFINE_UNQUOTED(OPT_DISABLE_TLCS900H, 1)
285 echo izt >>ports.build
286 AC_DEFINE_UNQUOTED(OPT_DISABLE_TLCS900H, 0)
290 cat ports.all | uniq >ports
292 cat ports.build | uniq >ports
295 # Generating output files
296 # ===========================================================================
297 AC_CONFIG_SUBDIRS(sim/ucsim)
298 AC_CONFIG_SUBDIRS(packihx)
299 # MLH: removed as the rules are already in Makefile.common
302 AC_OUTPUT(main.mk:main_in.mk
306 device/include/Makefile
308 debugger/mcs51/Makefile
309 Makefile.common:Makefile.common.in
312 # End of configure/configure.in