* configure.in: added missing mcs51 in status output
[fw/sdcc] / support / cpp2 / configure.in
1 # configure.in for GCC
2 # Process this file with autoconf to generate a configuration script.
3
4 # Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
5
6 #This file is part of GCC.
7
8 #GCC is free software; you can redistribute it and/or modify it under
9 #the terms of the GNU General Public License as published by the Free
10 #Software Foundation; either version 2, or (at your option) any later
11 #version.
12
13 #GCC is distributed in the hope that it will be useful, but WITHOUT
14 #ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 #FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16 #for more details.
17
18 #You should have received a copy of the GNU General Public License
19 #along with GCC; see the file COPYING.  If not, write to the Free
20 #Software Foundation, 59 Temple Place - Suite 330, Boston, MA
21 #02111-1307, USA.
22
23 # Initialization and defaults
24 AC_PREREQ(2.60)
25 AC_INIT(sdcpp.c)
26 AC_CONFIG_HEADER(auto-host.h:config.in)
27
28 remove=rm
29 hard_link=ln
30 symbolic_link='ln -s'
31 copy=cp
32
33 # Check for additional parameters
34
35 # With GNU ld
36 AC_ARG_WITH(gnu-ld,
37 [  --with-gnu-ld           arrange to work with GNU ld.],
38 gnu_ld_flag="$with_gnu_ld",
39 gnu_ld_flag=no)
40
41 # With pre-defined ld
42 AC_ARG_WITH(ld,
43 [  --with-ld               arrange to use the specified ld (full pathname)],
44 DEFAULT_LINKER="$with_ld")
45 if test x"${DEFAULT_LINKER+set}" = x"set"; then
46   if test ! -x "$DEFAULT_LINKER"; then
47     AC_MSG_WARN([cannot execute: $DEFAULT_LINKER: check --with-ld or env. var. DEFAULT_LINKER])
48   elif $DEFAULT_LINKER -v < /dev/null 2>&1 | grep GNU > /dev/null; then
49     gnu_ld_flag=yes
50   fi
51   AC_DEFINE_UNQUOTED(DEFAULT_LINKER,"$DEFAULT_LINKER",
52         [Define to enable the use of a default linker.])
53 fi
54
55 # With GNU as
56 AC_ARG_WITH(gnu-as,
57 [  --with-gnu-as           arrange to work with GNU as],
58 gas_flag="$with_gnu_as",
59 gas_flag=no)
60
61 AC_ARG_WITH(as,
62 [  --with-as               arrange to use the specified as (full pathname)],
63 DEFAULT_ASSEMBLER="$with_as")
64 if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then
65   if test ! -x "$DEFAULT_ASSEMBLER"; then
66     AC_MSG_WARN([cannot execute: $DEFAULT_ASSEMBLER: check --with-as or env. var. DEFAULT_ASSEMBLER])
67   elif $DEFAULT_ASSEMBLER -v < /dev/null 2>&1 | grep GNU > /dev/null; then
68     gas_flag=yes
69   fi
70   AC_DEFINE_UNQUOTED(DEFAULT_ASSEMBLER,"$DEFAULT_ASSEMBLER",
71         [Define to enable the use of a default assembler.])
72 fi
73
74 # With stabs
75 AC_ARG_WITH(stabs,
76 [  --with-stabs            arrange to use stabs instead of host debug format],
77 stabs="$with_stabs",
78 stabs=no)
79
80 # With ELF
81 AC_ARG_WITH(elf,
82 [  --with-elf              arrange to use ELF instead of host debug format],
83 elf="$with_elf",
84 elf=no)
85
86 # Specify the local prefix
87 local_prefix=
88 AC_ARG_WITH(local-prefix,
89 [  --with-local-prefix=DIR specifies directory to put local include],
90 [case "${withval}" in
91 yes)    AC_MSG_ERROR(bad value ${withval} given for local include directory prefix) ;;
92 no)     ;;
93 *)      local_prefix=$with_local_prefix ;;
94 esac])
95
96 # Default local prefix if it is empty
97 if test x$local_prefix = x; then
98         local_prefix=/usr/local
99 fi
100
101 AC_ARG_PROGRAM
102
103 # Enable Multibyte Characters for C/C++
104 AC_ARG_ENABLE(c-mbchar,
105 [  --enable-c-mbchar       enable multibyte characters for C and C++],
106 if test x$enable_c_mbchar != xno; then
107   AC_DEFINE(MULTIBYTE_CHARS, 1,
108   [Define if you want the C and C++ compilers to support multibyte
109    character sets for source code.])
110 fi)
111
112 # Find the native compiler
113 AC_PROG_CC
114 AC_PROG_CC_C_O
115 # autoconf is lame and doesn't give us any substitution variable for this.
116 if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
117   NO_MINUS_C_MINUS_O=yes
118 else
119   OUTPUT_OPTION='-o $@'
120 fi
121 AC_SUBST(NO_MINUS_C_MINUS_O)
122 AC_SUBST(OUTPUT_OPTION)
123
124 AC_PROG_CPP
125 AC_C_INLINE
126
127 gcc_AC_C__BOOL
128
129 # sizeof(char) is 1 by definition.
130 gcc_AC_COMPILE_CHECK_SIZEOF(short)
131 gcc_AC_COMPILE_CHECK_SIZEOF(int)
132 gcc_AC_COMPILE_CHECK_SIZEOF(long)
133
134 gcc_AC_C_CHARSET
135
136 # If the native compiler is GCC, we can enable warnings even in stage1.
137 # That's useful for people building cross-compilers, or just running a
138 # quick `make'.
139 warn_cflags=
140 if test "x$GCC" = "xyes"; then
141   warn_cflags='$(GCC_WARN_CFLAGS)'
142 fi
143 AC_SUBST(warn_cflags)
144
145 AC_PROG_MAKE_SET
146
147 AC_MSG_CHECKING([whether a default assembler was specified])
148 if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then
149     if test x"$gas_flag" = x"no"; then
150         AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER)])
151     else
152         AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER - GNU as)])
153     fi
154 else
155     AC_MSG_RESULT(no)
156 fi
157
158 AC_MSG_CHECKING([whether a default linker was specified])
159 if test x"${DEFAULT_LINKER+set}" = x"set"; then
160     if test x"$gnu_ld_flag" = x"no"; then
161         AC_MSG_RESULT([yes ($DEFAULT_LINKER)])
162     else
163         AC_MSG_RESULT([yes ($DEFAULT_LINKER - GNU ld)])
164     fi
165 else
166     AC_MSG_RESULT(no)
167 fi
168
169 # Find some useful tools
170 AC_PROG_AWK
171 # We need awk to run opts.sh (to create options.c and options.h).
172 # Bail out if it's missing.
173 case ${AWK} in
174   "") AC_MSG_ERROR([can't build without awk, bailing out]) ;;
175 esac
176
177 gcc_AC_PROG_LN
178 gcc_AC_PROG_LN_S
179 AC_PROG_RANLIB
180 gcc_AC_PROG_INSTALL
181
182 AC_HEADER_STDC
183 AC_HEADER_TIME
184 gcc_AC_HEADER_STDBOOL
185 gcc_AC_HEADER_STRING
186 AC_HEADER_SYS_WAIT
187 AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h \
188                  fcntl.h unistd.h sys/file.h sys/time.h \
189                  sys/param.h sys/stat.h \
190                  direct.h malloc.h)
191
192 # Check for thread headers.
193
194 # These tests can't be done till we know if we have limits.h.
195 gcc_AC_C_CHAR_BIT
196 gcc_AC_C_COMPILE_ENDIAN
197
198 # See if we have the mktemp command.
199 AC_CHECK_PROG(have_mktemp_command, mktemp, yes, no)
200
201 AC_CHECK_PROG(STRIP, strip, strip, :)
202
203 # See if the stage1 system preprocessor understands the ANSI C
204 # preprocessor stringification operator.  (Used by symcat.h.)
205 AC_C_STRINGIZE
206
207 dnl Disabled until we have a complete test for buggy enum bitfields.
208 dnl gcc_AC_C_ENUM_BF_UNSIGNED
209
210 AC_CHECK_FUNCS(clock strsignal strchr strrchr lstat)
211
212 AC_CHECK_TYPE(ssize_t, int)
213
214 AC_FUNC_MMAP_ANYWHERE
215 AC_FUNC_MMAP_FILE
216
217 # We will need to find libiberty.h and ansidecl.h
218 saved_CFLAGS="$CFLAGS"
219 CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include"
220 gcc_AC_CHECK_DECLS(getenv abort strsignal errno \
221         malloc realloc calloc free clock, , ,[
222 #include "ansidecl.h"
223 #include "system.h"])
224
225 # Restore CFLAGS from before the gcc_AC_NEED_DECLARATIONS tests.
226 CFLAGS="$saved_CFLAGS"
227
228 # mkdir takes a single argument on some systems.
229 gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG
230
231 # File extensions
232 manext='.1'
233 objext='.o'
234 AC_SUBST(manext)
235 AC_SUBST(objext)
236
237 build_xm_file=
238 build_xm_defines=
239 build_install_headers_dir=install-headers-tar
240 build_exeext=
241 host_xm_file=
242 host_xm_defines=
243 host_xmake_file=
244 host_truncate_target=
245 host_exeext=
246
247 # Decode the host machine, then the target machine.
248 # For the host machine, we save the xm_file variable as host_xm_file;
249 # then we decode the target machine and forget everything else
250 # that came from the host machine.
251 #for machine in $build $host $target; do
252 #       . ${srcdir}/config.gcc
253 #done
254
255 extra_objs="${host_extra_objs} ${extra_objs}"
256
257 # Default the target-machine variables that were not explicitly set.
258 if test x"$tm_file" = x
259 then tm_file=$cpu_type/$cpu_type.h; fi
260
261 if test x"$extra_headers" = x
262 then extra_headers=; fi
263
264 if test x$md_file = x
265 then md_file=$cpu_type/$cpu_type.md; fi
266
267 if test x$out_file = x
268 then out_file=$cpu_type/$cpu_type.c; fi
269
270 if test x"$tmake_file" = x
271 then tmake_file=$cpu_type/t-$cpu_type
272 fi
273
274 if test x"$dwarf2" = xyes
275 then tm_file="$tm_file tm-dwarf2.h"
276 fi
277
278 # Handle cpp installation.
279 if test x$enable_cpp != xno
280 then
281   tmake_file="$tmake_file t-install-cpp"
282 fi
283
284 # auto-host.h is the file containing items generated by autoconf and is
285 # the first file included by config.h.
286 # If host=build, it is correct to have hconfig include auto-host.h
287 # as well.  If host!=build, we are in error and need to do more
288 # work to find out the build config parameters.
289 if test x$host = x$build
290 then
291         build_auto=auto-host.h
292 else
293         # We create a subdir, then run autoconf in the subdir.
294         # To prevent recursion we set host and build for the new
295         # invocation of configure to the build for this invocation
296         # of configure.
297         tempdir=build.$$
298         rm -rf $tempdir
299         mkdir $tempdir
300         cd $tempdir
301         case ${srcdir} in
302         /* | [A-Za-z]:[\\/]* ) realsrcdir=${srcdir};;
303         *) realsrcdir=../${srcdir};;
304         esac
305         CC=${CC_FOR_BUILD} ${realsrcdir}/configure \
306                 --target=$target --host=$build --build=$build
307
308         # We just finished tests for the build machine, so rename
309         # the file auto-build.h in the gcc directory.
310         mv auto-host.h ../auto-build.h
311         cd ..
312         rm -rf $tempdir
313         build_auto=auto-build.h
314 fi
315
316 tm_file="${tm_file} defaults.h"
317 host_xm_file="auto-host.h ansidecl.h ${host_xm_file} ${tm_file}"
318 build_xm_file="${build_auto} ansidecl.h ${build_xm_file} ${tm_file}"
319 xm_file="ansidecl.h ${xm_file} ${tm_file}"
320
321 # Truncate the target if necessary
322 if test x$host_truncate_target != x; then
323         target=`echo $target | sed -e 's/\(..............\).*/\1/'`
324 fi
325
326 # Get the version trigger filename from the toplevel
327 if test "${with_gcc_version_trigger+set}" = set; then
328         gcc_version_trigger=$with_gcc_version_trigger
329 else
330         gcc_version_trigger=${srcdir}/version.c
331 fi
332 changequote(,)dnl
333 gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*"\([^"]*\)".*/\1/'`
334 gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'`
335
336 # Compile in configure arguments.
337 if test -f configargs.h ; then
338         # Being re-configured.
339         gcc_config_arguments=`grep configuration_arguments configargs.h | sed -e 's/.*"\([^"]*\)".*/\1/'`
340         gcc_config_arguments="$gcc_config_arguments : (reconfigured) $TOPLEVEL_CONFIGURE_ARGUMENTS"
341 else
342         gcc_config_arguments="$TOPLEVEL_CONFIGURE_ARGUMENTS"
343 fi
344 cat > configargs.h <<EOF
345 /* Generated automatically. */
346 static const char configuration_arguments[] = "$gcc_config_arguments";
347 static const char thread_model[] = "$thread_file";
348 EOF
349 changequote([,])dnl
350
351 # Internationalization
352 PACKAGE=sdcc
353 VERSION="$gcc_version"
354 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE",
355         [Define to the name of the distribution.])
356 AC_DEFINE_UNQUOTED(VERSION, "$VERSION",
357         [Define to the version of the distribution.])
358 AC_SUBST(PACKAGE)
359 AC_SUBST(VERSION)
360
361 ALL_LINGUAS="sv"
362
363 # Get an absolute path to the GCC top-level source directory
364 holddir=`pwd`
365 cd $srcdir
366 topdir=`pwd`
367 cd $holddir
368
369 out_object_file=`basename $out_file .c`.o
370
371 # Figure out what assembler we will be using.
372 AC_MSG_CHECKING(what assembler to use)
373 gcc_cv_as=
374 gcc_cv_gas_major_version=
375 gcc_cv_gas_minor_version=
376 gcc_cv_as_gas_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/gas
377 if test -x "$DEFAULT_ASSEMBLER"; then
378         gcc_cv_as="$DEFAULT_ASSEMBLER"
379 elif test -x "$AS"; then
380         gcc_cv_as="$AS"
381 elif test -x as$host_exeext; then
382         # Build using assembler in the current directory.
383         gcc_cv_as=./as$host_exeext
384 elif test -f $gcc_cv_as_gas_srcdir/configure.in -a -f ../gas/Makefile; then
385         # Single tree build which includes gas.
386         for f in $gcc_cv_as_gas_srcdir/configure $gcc_cv_as_gas_srcdir/configure.in $gcc_cv_as_gas_srcdir/Makefile.in
387         do
388 changequote(,)dnl
389                 gcc_cv_gas_version=`grep '^VERSION=[0-9]*\.[0-9]*' $f`
390 changequote([,])dnl
391                 if test x$gcc_cv_gas_version != x; then
392                         break
393                 fi
394         done
395 changequote(,)dnl
396         gcc_cv_gas_major_version=`expr "$gcc_cv_gas_version" : "VERSION=\([0-9]*\)"`
397         gcc_cv_gas_minor_version=`expr "$gcc_cv_gas_version" : "VERSION=[0-9]*\.\([0-9]*\)"`
398 changequote([,])dnl
399 fi
400
401 if test "x$gcc_cv_as" = x -a x$host = x$target; then
402         # Native build.
403         # Search the same directories that the installed compiler will
404         # search.  Else we may find the wrong assembler and lose.  If we
405         # do not find a suitable assembler binary, then try the user's
406         # path.
407         #
408         # Also note we have to check MD_EXEC_PREFIX before checking the
409         # user's path.  Unfortunately, there is no good way to get at the
410         # value of MD_EXEC_PREFIX here.  So we do a brute force search
411         # through all the known MD_EXEC_PREFIX values.  Ugh.  This needs
412         # to be fixed as part of the make/configure rewrite too.
413
414         if test "x$exec_prefix" = xNONE; then
415                 if test "x$prefix" = xNONE; then
416                         test_prefix=/usr/local
417                 else
418                         test_prefix=$prefix
419                 fi
420         else
421                 test_prefix=$exec_prefix
422         fi
423
424         # If the loop below does not find an assembler, then use whatever
425         # one we can find in the users's path.
426         # user's path.
427         gcc_cv_as=as$host_exeext
428
429         test_dirs="$test_prefix/lib/gcc-lib/$target/$gcc_version \
430                    $test_prefix/lib/gcc-lib/$target \
431                    /usr/lib/gcc/$target/$gcc_version \
432                    /usr/lib/gcc/$target \
433                    $test_prefix/$target/bin/$target/$gcc_version \
434                    $test_prefix/$target/bin \
435                    /usr/libexec \
436                    /usr/ccs/gcc \
437                    /usr/ccs/bin \
438                    /udk/usr/ccs/bin \
439                    /bsd43/usr/lib/cmplrs/cc \
440                    /usr/cross64/usr/bin \
441                    /usr/lib/cmplrs/cc \
442                    /sysv/usr/lib/cmplrs/cc \
443                    /svr4/usr/lib/cmplrs/cc \
444                    /usr/bin"
445
446         for dir in $test_dirs; do
447                 if test -f $dir/as$host_exeext; then
448                         gcc_cv_as=$dir/as$host_exeext
449                         break;
450                 fi
451         done
452 fi
453 if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then
454   AC_MSG_RESULT("newly built gas")
455 else
456   AC_MSG_RESULT($gcc_cv_as)
457 fi
458
459 # Figure out what nm we will be using.
460 AC_MSG_CHECKING(what nm to use)
461 if test -x nm$host_exeext; then
462         gcc_cv_nm=./nm$host_exeext
463 elif test x$host = x$target; then
464         # Native build.
465         gcc_cv_nm=nm$host_exeext
466 fi
467 AC_MSG_RESULT($gcc_cv_nm)
468
469 dnl Very limited version of automake's enable-maintainer-mode
470
471 AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
472   dnl maintainer-mode is disabled by default
473   AC_ARG_ENABLE(maintainer-mode,
474 [  --enable-maintainer-mode
475                           enable make rules and dependencies not useful
476                           (and sometimes confusing) to the casual installer],
477       maintainer_mode=$enableval,
478       maintainer_mode=no)
479
480 AC_MSG_RESULT($maintainer_mode)
481
482 if test "$maintainer_mode" = "yes"; then
483   MAINT=''
484 else
485   MAINT='#'
486 fi
487 AC_SUBST(MAINT)dnl
488
489 # These (without "all_") are set in each config-lang.in.
490 # `language' must be a single word so is spelled singularly.
491 all_stagestuff=
492 all_outputs='Makefile'
493 # List of language makefile fragments.
494
495 # Add the language fragments.
496 # Languages are added via two mechanisms.  Some information must be
497 # recorded in makefile variables, these are defined in config-lang.in.
498 # We accumulate them and plug them into the main Makefile.
499 # The other mechanism is a set of hooks for each of the main targets
500 # like `clean', `install', etc.
501
502 language_fragments="Make-lang"
503
504 # Define variables host_canonical and build_canonical
505 # because some Cygnus local changes in the Makefile depend on them.
506 build_canonical=${build}
507 host_canonical=${host}
508 target_subdir=
509 if test "${host}" != "${target}" ; then
510     target_subdir=${target_alias}/
511 fi
512 AC_SUBST(build_canonical)
513 AC_SUBST(host_canonical)
514 AC_SUBST(target_subdir)
515
516 # Nothing to do for FLOAT_H, float_format already handled.
517 objdir=`pwd`
518 AC_SUBST(objdir)
519
520 # Substitute configuration variables
521 AC_SUBST(all_stagestuff)
522 AC_SUBST(build_exeext)
523 AC_SUBST(build_install_headers_dir)
524 AC_SUBST(build_xm_file_list)
525 AC_SUBST(build_xm_file)
526 AC_SUBST(build_xm_defines)
527 AC_SUBST(check_languages)
528 AC_SUBST(dep_host_xmake_file)
529 AC_SUBST(dep_tmake_file)
530 AC_SUBST(extra_c_flags)
531 AC_SUBST(extra_headers_list)
532 AC_SUBST(extra_objs)
533 AC_SUBST(extra_parts)
534 AC_SUBST(extra_passes)
535 AC_SUBST(extra_programs)
536 AC_SUBST(gcc_config_arguments)
537 AC_SUBST(gcc_version)
538 AC_SUBST(gcc_version_full)
539 AC_SUBST(gcc_version_trigger)
540 AC_SUBST(host_exeext)
541 AC_SUBST(host_extra_gcc_objs)
542 AC_SUBST(install)
543 AC_SUBST(lang_tree_files)
544 AC_SUBST(local_prefix)
545 AC_SUBST(md_file)
546 AC_SUBST(out_file)
547 AC_SUBST(out_object_file)
548 AC_SUBST(symbolic_link)
549 AC_SUBST(thread_file)
550 AC_SUBST(c_target_objs)
551
552 #AC_SUBST_FILE(target_overrides)
553 #AC_SUBST_FILE(host_overrides)
554 #AC_SUBST(cross_defines)
555 #AC_SUBST_FILE(cross_overrides)
556 #AC_SUBST_FILE(build_overrides)
557
558 # Create the Makefile
559 # and configure language subdirectories
560 AC_OUTPUT($all_outputs,
561 [
562 case x$CONFIG_HEADERS in
563 xauto-host.h:config.in)
564 echo > cstamp-h ;;
565 esac
566
567 # Avoid having to add intl to our include paths.
568 if test -f intl/libintl.h; then
569   echo creating libintl.h
570   echo '#include "intl/libintl.h"' >libintl.h
571 fi
572 ],
573 [
574 host='${host}'
575 build='${build}'
576 target='${target}'
577 target_alias='${target_alias}'
578 srcdir='${srcdir}'
579 symbolic_link='${symbolic_link}'
580 program_transform_set='${program_transform_set}'
581 program_transform_name='${program_transform_name}'
582 dep_host_xmake_file='${dep_host_xmake_file}'
583 host_xmake_file='${host_xmake_file}'
584 dep_tmake_file='${dep_tmake_file}'
585 tmake_file='${tmake_file}'
586 thread_file='${thread_file}'
587 gcc_config_arguments='${gcc_config_arguments}'
588 gcc_version='${gcc_version}'
589 gcc_version_full='${gcc_version_full}'
590 gcc_version_trigger='${gcc_version_trigger}'
591 local_prefix='${local_prefix}'
592 build_install_headers_dir='${build_install_headers_dir}'
593 build_exeext='${build_exeext}'
594 host_exeext='${host_exeext}'
595 out_file='${out_file}'
596 gdb_needs_out_file_path='${gdb_needs_out_file_path}'
597 SET_MAKE='${SET_MAKE}'
598 target_list='${target_list}'
599 target_overrides='${target_overrides}'
600 host_overrides='${host_overrides}'
601 cross_defines='${cross_defines}'
602 cross_overrides='${cross_overrides}'
603 build_overrides='${build_overrides}'
604 cpp_install_dir='${cpp_install_dir}'
605 ])