1
# Check for the extension used for executables on build platform.
2
# This is necessary for cross-compiling where the build platform
3
# may differ from the host platform.
4
AC_DEFUN([AC_BUILD_EXEEXT],
6
AC_MSG_CHECKING([for executable suffix on build platform])
7
AC_CACHE_VAL(ac_cv_build_exeext,
8
[if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
9
ac_cv_build_exeext=.exe
11
ac_build_prefix=${build_alias}-
13
AC_CHECK_PROG(BUILD_CC, ${ac_build_prefix}gcc, ${ac_build_prefix}gcc)
14
if test -z "$BUILD_CC"; then
15
AC_CHECK_PROG(BUILD_CC, gcc, gcc)
16
if test -z "$BUILD_CC"; then
17
AC_CHECK_PROG(BUILD_CC, cc, cc, , , /usr/ucb/cc)
20
test -z "$BUILD_CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
21
ac_build_link='${BUILD_CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AS_MESSAGE_LOG_FD'
23
echo 'int main () { return 0; }' > conftest.$ac_ext
25
if AC_TRY_EVAL(ac_build_link); then
26
for file in conftest.*; do
28
*.c | *.o | *.obj | *.dSYM) ;;
29
*) ac_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
33
AC_MSG_ERROR([installation or configuration problem: compiler cannot create executables.])
36
test x"${ac_cv_build_exeext}" = x && ac_cv_build_exeext=blank
39
test x"${ac_cv_build_exeext}" != xblank && BUILD_EXEEXT=${ac_cv_build_exeext}
40
AC_MSG_RESULT(${ac_cv_build_exeext})
41
ac_build_exeext=$BUILD_EXEEXT
42
AC_SUBST(BUILD_EXEEXT)])