OLD | NEW |
1 # This file contains common code used by all simulators. | 1 # This file contains common code used by all simulators. |
2 # | 2 # |
3 # SIM_AC_COMMON invokes AC macros used by all simulators and by the common | 3 # SIM_AC_COMMON invokes AC macros used by all simulators and by the common |
4 # directory. It is intended to be invoked before any target specific stuff. | 4 # directory. It is intended to be invoked before any target specific stuff. |
5 # SIM_AC_OUTPUT is a cover function to AC_OUTPUT to generate the Makefile. | 5 # SIM_AC_OUTPUT is a cover function to AC_OUTPUT to generate the Makefile. |
6 # It is intended to be invoked last. | 6 # It is intended to be invoked last. |
7 # | 7 # |
8 # The simulator's configure.in should look like: | 8 # The simulator's configure.in should look like: |
9 # | 9 # |
10 # dnl Process this file with autoconf to produce a configure script. | 10 # dnl Process this file with autoconf to produce a configure script. |
(...skipping 11 matching lines...) Expand all Loading... |
22 m4_include(../../config/override.m4) | 22 m4_include(../../config/override.m4) |
23 sinclude([../../config/zlib.m4]) | 23 sinclude([../../config/zlib.m4]) |
24 sinclude([../../config/depstand.m4]) | 24 sinclude([../../config/depstand.m4]) |
25 | 25 |
26 AC_DEFUN([SIM_AC_COMMON], | 26 AC_DEFUN([SIM_AC_COMMON], |
27 [ | 27 [ |
28 AC_REQUIRE([AC_PROG_CC]) | 28 AC_REQUIRE([AC_PROG_CC]) |
29 # autoconf.info says this should be called right after AC_INIT. | 29 # autoconf.info says this should be called right after AC_INIT. |
30 AC_CONFIG_HEADER(ifelse([$1],,config.h,[$1]):config.in) | 30 AC_CONFIG_HEADER(ifelse([$1],,config.h,[$1]):config.in) |
31 AC_CANONICAL_SYSTEM | 31 AC_CANONICAL_SYSTEM |
| 32 AC_USE_SYSTEM_EXTENSIONS |
32 AC_ARG_PROGRAM | 33 AC_ARG_PROGRAM |
33 AC_PROG_INSTALL | 34 AC_PROG_INSTALL |
34 | 35 |
35 # Put a plausible default for CC_FOR_BUILD in Makefile. | 36 # Put a plausible default for CC_FOR_BUILD in Makefile. |
36 if test "x$cross_compiling" = "xno"; then | 37 if test "x$cross_compiling" = "xno"; then |
37 CC_FOR_BUILD='$(CC)' | 38 CC_FOR_BUILD='$(CC)' |
38 else | 39 else |
39 CC_FOR_BUILD=gcc | 40 CC_FOR_BUILD=gcc |
40 fi | 41 fi |
41 AC_SUBST(CC_FOR_BUILD) | 42 AC_SUBST(CC_FOR_BUILD) |
42 | 43 |
43 AC_SUBST(CFLAGS) | 44 AC_SUBST(CFLAGS) |
44 AC_SUBST(HDEFINES) | 45 AC_SUBST(HDEFINES) |
45 AR=${AR-ar} | 46 AR=${AR-ar} |
46 AC_SUBST(AR) | 47 AC_SUBST(AR) |
47 AC_PROG_RANLIB | 48 AC_PROG_RANLIB |
48 | 49 |
| 50 # Some of the common include files depend on bfd.h, and bfd.h checks |
| 51 # that config.h is included first by testing that the PACKAGE macro |
| 52 # is defined. |
| 53 PACKAGE=sim |
| 54 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package. ]) |
| 55 AC_SUBST(PACKAGE) |
| 56 |
49 # Dependency checking. | 57 # Dependency checking. |
50 ZW_CREATE_DEPDIR | 58 ZW_CREATE_DEPDIR |
51 ZW_PROG_COMPILER_DEPENDENCIES([CC]) | 59 ZW_PROG_COMPILER_DEPENDENCIES([CC]) |
52 | 60 |
53 # Check for the 'make' the user wants to use. | 61 # Check for the 'make' the user wants to use. |
54 AC_CHECK_PROGS(MAKE, make) | 62 AC_CHECK_PROGS(MAKE, make) |
55 MAKE_IS_GNU= | 63 MAKE_IS_GNU= |
56 case "`$MAKE --version 2>&1 | sed 1q`" in | 64 case "`$MAKE --version 2>&1 | sed 1q`" in |
57 *GNU*) | 65 *GNU*) |
58 MAKE_IS_GNU=yes | 66 MAKE_IS_GNU=yes |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 dnl up to the simulator], or is a comma separated list of names of tracing | 179 dnl up to the simulator], or is a comma separated list of names of tracing |
172 dnl elements to enable. The latter is only supported on simulators that | 180 dnl elements to enable. The latter is only supported on simulators that |
173 dnl use WITH_TRACE. | 181 dnl use WITH_TRACE. |
174 AC_ARG_ENABLE(sim-trace, | 182 AC_ARG_ENABLE(sim-trace, |
175 [ --enable-sim-trace=opts Enable tracing flags], | 183 [ --enable-sim-trace=opts Enable tracing flags], |
176 [case "${enableval}" in | 184 [case "${enableval}" in |
177 yes) sim_trace="-DTRACE=1 -DWITH_TRACE=-1";; | 185 yes) sim_trace="-DTRACE=1 -DWITH_TRACE=-1";; |
178 no) sim_trace="-DTRACE=0 -DWITH_TRACE=0";; | 186 no) sim_trace="-DTRACE=0 -DWITH_TRACE=0";; |
179 [[-0-9]]*) | 187 [[-0-9]]*) |
180 sim_trace="-DTRACE='(${enableval})' -DWITH_TRACE='(${enableval})'";; | 188 sim_trace="-DTRACE='(${enableval})' -DWITH_TRACE='(${enableval})'";; |
181 [[a-z]]*) | 189 [[[:lower:]]]*) |
182 sim_trace="" | 190 sim_trace="" |
183 for x in `echo "$enableval" | sed -e "s/,/ /g"`; do | 191 for x in `echo "$enableval" | sed -e "s/,/ /g"`; do |
184 if test x"$sim_trace" = x; then | 192 if test x"$sim_trace" = x; then |
185 sim_trace="-DWITH_TRACE='(TRACE_$x" | 193 sim_trace="-DWITH_TRACE='(TRACE_$x" |
186 else | 194 else |
187 sim_trace="${sim_trace}|TRACE_$x" | 195 sim_trace="${sim_trace}|TRACE_$x" |
188 fi | 196 fi |
189 done | 197 done |
190 sim_trace="$sim_trace)'" ;; | 198 sim_trace="$sim_trace)'" ;; |
191 esac | 199 esac |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 echo "Setting xor-endian flag = $sim_xor_endian" 6>&1 | 817 echo "Setting xor-endian flag = $sim_xor_endian" 6>&1 |
810 fi],[sim_xor_endian="-DWITH_XOR_ENDIAN=${default_sim_xor_endian}"])dnl | 818 fi],[sim_xor_endian="-DWITH_XOR_ENDIAN=${default_sim_xor_endian}"])dnl |
811 ]) | 819 ]) |
812 AC_SUBST(sim_xor_endian) | 820 AC_SUBST(sim_xor_endian) |
813 | 821 |
814 | 822 |
815 dnl --enable-build-warnings is for developers of the simulator. | 823 dnl --enable-build-warnings is for developers of the simulator. |
816 dnl it enables extra GCC specific warnings. | 824 dnl it enables extra GCC specific warnings. |
817 AC_DEFUN([SIM_AC_OPTION_WARNINGS], | 825 AC_DEFUN([SIM_AC_OPTION_WARNINGS], |
818 [ | 826 [ |
819 # NOTE: Don't add -Wall or -Wunused, they both include | 827 AC_ARG_ENABLE(werror, |
820 # -Wunused-parameter which reports bogus warnings. | 828 AS_HELP_STRING([--enable-werror], [treat compile warnings as errors]), |
821 # NOTE: If you add to this list, remember to update | 829 [case "${enableval}" in |
| 830 yes | y) ERROR_ON_WARNING="yes" ;; |
| 831 no | n) ERROR_ON_WARNING="no" ;; |
| 832 *) AC_MSG_ERROR(bad value ${enableval} for --enable-werror) ;; |
| 833 esac]) |
| 834 |
| 835 # Enable -Werror by default when using gcc |
| 836 if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then |
| 837 ERROR_ON_WARNING=yes |
| 838 fi |
| 839 |
| 840 WERROR_CFLAGS="" |
| 841 if test "${ERROR_ON_WARNING}" = yes ; then |
| 842 # NOTE: Disabled in the sim dir due to most sims generating warnings. |
| 843 # WERROR_CFLAGS="-Werror" |
| 844 true |
| 845 fi |
| 846 |
| 847 # The entries after -Wno-pointer-sign are disabled warnings which may |
| 848 # be enabled in the future, which can not currently be used to build |
| 849 # GDB. |
| 850 # NOTE: If you change this list, remember to update |
822 # gdb/doc/gdbint.texinfo. | 851 # gdb/doc/gdbint.texinfo. |
823 build_warnings="-Wimplicit -Wreturn-type -Wcomment -Wtrigraphs \ | 852 build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \ |
824 -Wformat -Wparentheses -Wpointer-arith" | 853 -Wformat-nonliteral -Wno-pointer-sign \ |
825 # GCC supports -Wuninitialized only with -O or -On, n != 0. | 854 -Wno-unused -Wunused-value -Wunused-function \ |
826 if test x${CFLAGS+set} = xset; then | 855 -Wno-switch -Wno-char-subscripts -Wmissing-prototypes" |
827 case "${CFLAGS}" in | 856 |
828 *"-O0"* ) ;; | 857 # Enable -Wno-format by default when using gcc on mingw since many |
829 *"-O"* ) | 858 # GCC versions complain about %I64. |
830 build_warnings="${build_warnings} -Wuninitialized" | 859 case "${host}" in |
831 ;; | 860 *-*-mingw32*) build_warnings="$build_warnings -Wno-format" ;; |
832 esac | 861 esac |
833 else | 862 |
834 build_warnings="${build_warnings} -Wuninitialized" | |
835 fi | |
836 # Up for debate: -Wswitch -Wcomment -trigraphs -Wtrigraphs | |
837 # -Wunused-function -Wunused-label -Wunused-variable -Wunused-value | |
838 # -Wchar-subscripts -Wtraditional -Wshadow -Wcast-qual | |
839 # -Wcast-align -Wwrite-strings -Wconversion -Wstrict-prototypes | |
840 # -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls | |
841 # -Woverloaded-virtual -Winline -Werror" | |
842 AC_ARG_ENABLE(build-warnings, | 863 AC_ARG_ENABLE(build-warnings, |
843 [ --enable-build-warnings Enable build-time compiler warnings if gcc is used], | 864 AS_HELP_STRING([--enable-build-warnings], [enable build-time compiler warnings i
f gcc is used]), |
844 [case "${enableval}" in | 865 [case "${enableval}" in |
845 yes) ;; | 866 yes) ;; |
846 no) build_warnings="-w";; | 867 no) build_warnings="-w";; |
847 ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` | 868 ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` |
848 build_warnings="${build_warnings} ${t}";; | 869 build_warnings="${build_warnings} ${t}";; |
849 *,) t=`echo "${enableval}" | sed -e "s/,/ /g"` | 870 *,) t=`echo "${enableval}" | sed -e "s/,/ /g"` |
850 build_warnings="${t} ${build_warnings}";; | 871 build_warnings="${t} ${build_warnings}";; |
851 *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;; | 872 *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;; |
852 esac | 873 esac |
853 if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then | 874 if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then |
854 echo "Setting compiler warning flags = $build_warnings" 6>&1 | 875 echo "Setting compiler warning flags = $build_warnings" 6>&1 |
855 fi])dnl | 876 fi])dnl |
856 AC_ARG_ENABLE(sim-build-warnings, | 877 AC_ARG_ENABLE(sim-build-warnings, |
857 [ --enable-gdb-build-warnings Enable SIM specific build-time compiler warnings
if gcc is used], | 878 AS_HELP_STRING([--enable-sim-build-warnings], [enable SIM specific build-time co
mpiler warnings if gcc is used]), |
858 [case "${enableval}" in | 879 [case "${enableval}" in |
859 yes) ;; | 880 yes) ;; |
860 no) build_warnings="-w";; | 881 no) build_warnings="-w";; |
861 ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` | 882 ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` |
862 build_warnings="${build_warnings} ${t}";; | 883 build_warnings="${build_warnings} ${t}";; |
863 *,) t=`echo "${enableval}" | sed -e "s/,/ /g"` | 884 *,) t=`echo "${enableval}" | sed -e "s/,/ /g"` |
864 build_warnings="${t} ${build_warnings}";; | 885 build_warnings="${t} ${build_warnings}";; |
865 *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;; | 886 *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;; |
866 esac | 887 esac |
867 if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then | 888 if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then |
868 echo "Setting GDB specific compiler warning flags = $build_warnings" 6>&1 | 889 echo "Setting GDB specific compiler warning flags = $build_warnings" 6>&1 |
869 fi])dnl | 890 fi])dnl |
870 WARN_CFLAGS="" | 891 WARN_CFLAGS="" |
871 WERROR_CFLAGS="" | |
872 if test "x${build_warnings}" != x -a "x$GCC" = xyes | 892 if test "x${build_warnings}" != x -a "x$GCC" = xyes |
873 then | 893 then |
874 AC_MSG_CHECKING(compiler warning flags) | 894 AC_MSG_CHECKING(compiler warning flags) |
875 # Separate out the -Werror flag as some files just cannot be | 895 # Separate out the -Werror flag as some files just cannot be |
876 # compiled with it enabled. | 896 # compiled with it enabled. |
877 for w in ${build_warnings}; do | 897 for w in ${build_warnings}; do |
878 case $w in | 898 case $w in |
879 -Werr*) WERROR_CFLAGS=-Werror ;; | 899 -Werr*) WERROR_CFLAGS=-Werror ;; |
880 *) # Check that GCC accepts it | 900 *) # Check that GCC accepts it |
881 saved_CFLAGS="$CFLAGS" | 901 saved_CFLAGS="$CFLAGS" |
882 CFLAGS="$CFLAGS $w" | 902 CFLAGS="$CFLAGS $w" |
883 AC_TRY_COMPILE([],[],WARN_CFLAGS="${WARN_CFLAGS} $w",) | 903 AC_TRY_COMPILE([],[],WARN_CFLAGS="${WARN_CFLAGS} $w",) |
884 CFLAGS="$saved_CFLAGS" | 904 CFLAGS="$saved_CFLAGS" |
885 esac | 905 esac |
886 done | 906 done |
887 AC_MSG_RESULT(${WARN_CFLAGS}${WERROR_CFLAGS}) | 907 AC_MSG_RESULT(${WARN_CFLAGS} ${WERROR_CFLAGS}) |
888 fi | 908 fi |
889 ]) | 909 ]) |
890 AC_SUBST(WARN_CFLAGS) | 910 AC_SUBST(WARN_CFLAGS) |
891 AC_SUBST(WERROR_CFLAGS) | 911 AC_SUBST(WERROR_CFLAGS) |
892 | 912 |
893 | 913 |
894 dnl Generate the Makefile in a target specific directory. | 914 dnl Generate the Makefile in a target specific directory. |
895 dnl Substitutions aren't performed on the file in AC_SUBST_FILE, | 915 dnl Substitutions aren't performed on the file in AC_SUBST_FILE, |
896 dnl so this is a cover macro to tuck the details away of how we cope. | 916 dnl so this is a cover macro to tuck the details away of how we cope. |
897 dnl We cope by having autoconf generate two files and then merge them into | 917 dnl We cope by having autoconf generate two files and then merge them into |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
955 dnl AM_CONDITIONAL(CGEN_MAINT, test x${cgen_maint} != xno) | 975 dnl AM_CONDITIONAL(CGEN_MAINT, test x${cgen_maint} != xno) |
956 if test x${cgen_maint} != xno ; then | 976 if test x${cgen_maint} != xno ; then |
957 CGEN_MAINT='' | 977 CGEN_MAINT='' |
958 else | 978 else |
959 CGEN_MAINT='#' | 979 CGEN_MAINT='#' |
960 fi | 980 fi |
961 AC_SUBST(CGEN_MAINT) | 981 AC_SUBST(CGEN_MAINT) |
962 AC_SUBST(cgendir) | 982 AC_SUBST(cgendir) |
963 AC_SUBST(cgen) | 983 AC_SUBST(cgen) |
964 ]) | 984 ]) |
OLD | NEW |