You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.5 KiB

  1. dnl -*- Autoconf -*-
  2. dnl Copyright (C) 1993-2005 Free Software Foundation, Inc.
  3. dnl This file is free software, distributed under the terms of the GNU
  4. dnl General Public License. As a special exception to the GNU General
  5. dnl Public License, this file may be distributed as part of a program
  6. dnl that contains a configuration script generated by Autoconf, under
  7. dnl the same distribution terms as the rest of that program.
  8. dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
  9. AC_PREREQ(2.13)
  10. dnl CL_MACHINE([MESSAGE], [PROGRAM_TO_RUN], [CROSS_MACRO], [DESTINATION], [CACHE_VAR])
  11. AC_DEFUN([CL_MACHINE],
  12. [AC_REQUIRE([AC_PROG_CC])dnl
  13. AC_REQUIRE([AC_C_CHAR_UNSIGNED])dnl
  14. cl_machine_file_c=$2
  15. if test -z "$[$5]"; then
  16. AC_CHECKING(for [$1])
  17. if test $cross_compiling = no; then
  18. cl_machine_file_h=$4
  19. cat > conftest.$ac_ext <<EOF
  20. #include "confdefs.h"
  21. EOF
  22. cat "$cl_machine_file_c" >> conftest.$ac_ext
  23. ORIGCC="$CC"
  24. if test $ac_cv_prog_gcc = yes; then
  25. # gcc -O (gcc version <= 2.3.2) crashes when compiling long long shifts for
  26. # target 80386. Strip "-O".
  27. CC=`echo "$CC " | sed -e 's/-O //g'`
  28. fi
  29. AC_TRY_EVAL(ac_link)
  30. CC="$ORIGCC"
  31. if test -s conftest; then
  32. echo "creating $cl_machine_file_h"
  33. ./conftest > conftest.h
  34. if cmp -s "$cl_machine_file_h" conftest.h 2>/dev/null; then
  35. # The file exists and we would not be changing it
  36. rm -f conftest.h
  37. else
  38. rm -f "$cl_machine_file_h"
  39. mv conftest.h "$cl_machine_file_h"
  40. fi
  41. [$5]=1
  42. else
  43. echo "creation of $cl_machine_file_h failed"
  44. fi
  45. rm -f conftest*
  46. else
  47. $3([$4])
  48. fi
  49. fi
  50. ])