home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / gnurecod.zip / aclocal.m4 < prev    next >
Text File  |  1994-11-01  |  3KB  |  86 lines

  1. # Local additions to Autoconf macros.
  2. # Copyright (C) 1992, 1994 Free Software Foundation, Inc.
  3. # Francois Pinard <pinard@iro.umontreal.ca>, 1992.
  4.  
  5. # @defmac AC_PROG_CC_STDC
  6. # @maindex PROG_CC_STDC
  7. # @ovindex CC
  8. # If the C compiler in not in ANSI C mode by default, try to add an option
  9. # to output variable @code{CC} to make it so.  This macro tries various
  10. # options that select ANSI C on some system or another.  It considers the
  11. # compiler to be in ANSI C mode if it defines @code{__STDC__} to 1 and
  12. # handles function prototypes correctly.
  13. # If you use this macro, you should check after calling it whether the C
  14. # compiler has been set to accept ANSI C; if not, the shell variable
  15. # @code{ac_cv_prog_cc_stdc} is set to @samp{no}.  If you wrote your source
  16. # code in ANSI C, you can make an un-ANSIfied copy of it by using the
  17. # program @code{ansi2knr}, which comes with Ghostscript.
  18. # @end defmac
  19.  
  20. define(fp_PROG_CC_STDC,
  21. [AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
  22. AC_CACHE_VAL(ac_cv_prog_cc_stdc,
  23. [ac_cv_prog_cc_stdc=no
  24. ac_save_CFLAGS="$CFLAGS"
  25. # Don't try gcc -ansi; that turns off useful extensions and
  26. # breaks some systems' header files.
  27. # AIX            -qlanglvl=ansi
  28. # Ultrix and OSF/1    -std1
  29. # HP-UX            -Aa -D_HPUX_SOURCE
  30. # SVR4            -Xc
  31. for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" -Xc
  32. do
  33.   CFLAGS="$ac_save_CFLAGS $ac_arg"
  34.   AC_TRY_COMPILE(
  35. [#if !defined(__STDC__) || __STDC__ != 1
  36. choke me
  37. #endif    
  38. ], [int test (int i, double x);
  39. struct s1 {int (*f) (int a);};
  40. struct s2 {int (*f) (double a);};],
  41. [ac_cv_prog_cc_stdc="$ac_arg"; break])
  42. done
  43. CFLAGS="$ac_save_CFLAGS"
  44. ])
  45. AC_MSG_RESULT($ac_cv_prog_cc_stdc)
  46. case "x$ac_cv_prog_cc_stdc" in
  47.   x|xno) ;;
  48.   *) CC="$CC $ac_cv_prog_cc_stdc" ;;
  49. esac
  50. ])
  51.  
  52. # Check for function prototypes.
  53.  
  54. AC_DEFUN(fp_C_PROTOTYPES,
  55. [AC_REQUIRE([fp_PROG_CC_STDC])
  56. AC_MSG_CHECKING([for function prototypes])
  57. if test "$ac_cv_prog_cc_stdc" != no; then
  58.   AC_MSG_RESULT(yes)
  59.   AC_DEFINE(PROTOTYPES)
  60.   U= ANSI2KNR=
  61. else
  62.   AC_MSG_RESULT(no)
  63.   U=_ ANSI2KNR=ansi2knr
  64. fi
  65. AC_SUBST(U)dnl
  66. AC_SUBST(ANSI2KNR)dnl
  67. ])
  68.  
  69. # Check if --with-dmalloc was given.
  70.  
  71. AC_DEFUN(fp_WITH_DMALLOC,
  72. [AC_MSG_CHECKING(if malloc debugging is wanted)
  73. AC_ARG_WITH(dmalloc,
  74. [  --with-dmalloc          use dmalloc, as in dmalloc.tar.gz from
  75.                           @/ftp.antaire.com:antaire/src/dmalloc.],
  76. [if test "$withval" = yes; then
  77.   AC_MSG_RESULT(yes)
  78.   AC_DEFINE(WITH_DMALLOC)
  79.   LIBS="$LIBS -ldmalloc"
  80.   LDFLAGS="$LDFLAGS -g"
  81. else
  82.   AC_MSG_RESULT(no)
  83. fi], [AC_MSG_RESULT(no)])])
  84.  
  85.