[llvm-commits] CVS: llvm/autoconf/m4/build_exeext.m4

Reid Spencer reid at x10sys.com
Wed Jul 26 13:45:26 PDT 2006



Changes in directory llvm/autoconf/m4:

build_exeext.m4 added (r1.1)
---
Log message:

For PR814: http://llvm.org/PR814 :
Add a macro for getting the build host extension for executable. Patch
contributed by Anton Korobeynikov. Thanks!


---
Diffs of the changes:  (+42 -0)

 build_exeext.m4 |   42 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 42 insertions(+)


Index: llvm/autoconf/m4/build_exeext.m4
diff -c /dev/null llvm/autoconf/m4/build_exeext.m4:1.1
*** /dev/null	Wed Jul 26 15:45:22 2006
--- llvm/autoconf/m4/build_exeext.m4	Wed Jul 26 15:45:12 2006
***************
*** 0 ****
--- 1,42 ----
+ # Check for the extension used for executables on build platform.
+ # This is necessary for cross-compiling where the build platform
+ # may differ from the host platform.
+ AC_DEFUN([AC_BUILD_EXEEXT],
+ [
+ AC_MSG_CHECKING([for executable suffix on build platform])
+ AC_CACHE_VAL(ac_cv_build_exeext,
+ [if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
+   ac_cv_build_exeext=.exe
+ else
+   ac_build_prefix=${build_alias}-
+ 
+   AC_CHECK_PROG(BUILD_CC, ${ac_build_prefix}gcc, ${ac_build_prefix}gcc)
+   if test -z "$BUILD_CC"; then
+      AC_CHECK_PROG(BUILD_CC, gcc, gcc)
+      if test -z "$BUILD_CC"; then
+        AC_CHECK_PROG(BUILD_CC, cc, cc, , , /usr/ucb/cc)
+      fi
+   fi
+   test -z "$BUILD_CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
+   ac_build_link='${BUILD_CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AS_MESSAGE_LOG_FD'
+   rm -f conftest*
+   echo 'int main () { return 0; }' > conftest.$ac_ext
+   ac_cv_build_exeext=
+   if AC_TRY_EVAL(ac_build_link); then
+     for file in conftest.*; do
+       case $file in
+       *.c | *.o | *.obj) ;;
+       *) ac_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
+       esac
+     done
+   else
+     AC_MSG_ERROR([installation or configuration problem: compiler cannot create executables.])
+   fi
+   rm -f conftest*
+   test x"${ac_cv_build_exeext}" = x && ac_cv_build_exeext=blank
+ fi])
+ BUILD_EXEEXT=""
+ test x"${ac_cv_build_exeext}" != xblank && BUILD_EXEEXT=${ac_cv_build_exeext}
+ AC_MSG_RESULT(${ac_cv_build_exeext})
+ ac_build_exeext=$BUILD_EXEEXT
+ AC_SUBST(BUILD_EXEEXT)])






More information about the llvm-commits mailing list