1c9710b42Smrg# =========================================================================== 2c9710b42Smrg# http://www.gnu.org/software/autoconf-archive/ax_cc_for_build.html 3c9710b42Smrg# =========================================================================== 4c9710b42Smrg# 5c9710b42Smrg# SYNOPSIS 6c9710b42Smrg# 7c9710b42Smrg# AX_CC_FOR_BUILD 8c9710b42Smrg# 9c9710b42Smrg# DESCRIPTION 10c9710b42Smrg# 11c9710b42Smrg# Find a build-time compiler. Sets CC_FOR_BUILD and EXEEXT_FOR_BUILD. 12c9710b42Smrg# 13c9710b42Smrg# LICENSE 14c9710b42Smrg# 15c9710b42Smrg# Copyright (c) 2010 Reuben Thomas <rrt@sc3d.org> 16c9710b42Smrg# Copyright (c) 1999 Richard Henderson <rth@redhat.com> 17c9710b42Smrg# 18c9710b42Smrg# This program is free software: you can redistribute it and/or modify it 19c9710b42Smrg# under the terms of the GNU General Public License as published by the 20c9710b42Smrg# Free Software Foundation, either version 3 of the License, or (at your 21c9710b42Smrg# option) any later version. 22c9710b42Smrg# 23c9710b42Smrg# This program is distributed in the hope that it will be useful, but 24c9710b42Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of 25c9710b42Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 26c9710b42Smrg# Public License for more details. 27c9710b42Smrg# 28c9710b42Smrg# You should have received a copy of the GNU General Public License along 29c9710b42Smrg# with this program. If not, see <http://www.gnu.org/licenses/>. 30c9710b42Smrg# 31c9710b42Smrg# As a special exception, the respective Autoconf Macro's copyright owner 32c9710b42Smrg# gives unlimited permission to copy, distribute and modify the configure 33c9710b42Smrg# scripts that are the output of Autoconf when processing the Macro. You 34c9710b42Smrg# need not follow the terms of the GNU General Public License when using 35c9710b42Smrg# or distributing such scripts, even though portions of the text of the 36c9710b42Smrg# Macro appear in them. The GNU General Public License (GPL) does govern 37c9710b42Smrg# all other use of the material that constitutes the Autoconf Macro. 38c9710b42Smrg# 39c9710b42Smrg# This special exception to the GPL applies to versions of the Autoconf 40c9710b42Smrg# Macro released by the Autoconf Archive. When you make and distribute a 41c9710b42Smrg# modified version of the Autoconf Macro, you may extend this special 42c9710b42Smrg# exception to the GPL to apply to your modified version as well. 43c9710b42Smrg 44c9710b42Smrg#serial 2 45c9710b42Smrg 46c9710b42Smrgdnl Get a default for CC_FOR_BUILD to put into Makefile. 47c9710b42SmrgAC_DEFUN([AX_CC_FOR_BUILD], 48c9710b42Smrg[# Put a plausible default for CC_FOR_BUILD in Makefile. 49c9710b42Smrgif test -z "$CC_FOR_BUILD"; then 50c9710b42Smrg if test "x$cross_compiling" = "xno"; then 51c9710b42Smrg CC_FOR_BUILD='$(CC)' 52c9710b42Smrg else 53c9710b42Smrg CC_FOR_BUILD=gcc 54c9710b42Smrg fi 55c9710b42Smrgfi 56c9710b42SmrgAC_SUBST(CC_FOR_BUILD) 57c9710b42Smrg# Also set EXEEXT_FOR_BUILD. 58c9710b42Smrgif test "x$cross_compiling" = "xno"; then 59c9710b42Smrg EXEEXT_FOR_BUILD='$(EXEEXT)' 60c9710b42Smrgelse 61c9710b42Smrg AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext, 62c9710b42Smrg [rm -f conftest* 63c9710b42Smrg echo 'int main () { return 0; }' > conftest.c 64c9710b42Smrg bfd_cv_build_exeext= 65c9710b42Smrg ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5 66c9710b42Smrg for file in conftest.*; do 67c9710b42Smrg case $file in 68c9710b42Smrg *.c | *.o | *.obj | *.ilk | *.pdb) ;; 69c9710b42Smrg *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;; 70c9710b42Smrg esac 71c9710b42Smrg done 72c9710b42Smrg rm -f conftest* 73c9710b42Smrg test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no]) 74c9710b42Smrg EXEEXT_FOR_BUILD="" 75c9710b42Smrg test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext} 76c9710b42Smrgfi 77c9710b42SmrgAC_SUBST(EXEEXT_FOR_BUILD)])dnl 78