proto.m4 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. dnl Copyright (C) 1993-2002 Free Software Foundation, Inc.
  2. dnl This file is free software, distributed under the terms of the GNU
  3. dnl General Public License. As a special exception to the GNU General
  4. dnl Public License, this file may be distributed as part of a program
  5. dnl that contains a configuration script generated by Autoconf, under
  6. dnl the same distribution terms as the rest of that program.
  7. dnl From Bruno Haible, Marcus Daniels.
  8. AC_PREREQ(2.13)
  9. dnl CL_PROTO(IDENTIFIER, ACTION-IF-NOT-FOUND, FINAL-PROTOTYPE)
  10. AC_DEFUN([CL_PROTO],
  11. [AC_MSG_CHECKING([for $1 declaration])
  12. AC_CACHE_VAL(cl_cv_proto_[$1], [$2
  13. cl_cv_proto_$1="$3"])
  14. cl_cv_proto_$1=`echo "[$]cl_cv_proto_$1" | tr -s ' ' | sed -e 's/( /(/'`
  15. AC_MSG_RESULT([$]{ac_t:-
  16. }[$]cl_cv_proto_$1)
  17. ])
  18. dnl CL_PROTO_RET(INCLUDES, DECL, CACHE-ID, TYPE-IF-OK, TYPE-IF-FAILS)
  19. AC_DEFUN([CL_PROTO_RET],
  20. [AC_TRY_COMPILE([$1]
  21. AC_LANG_EXTERN[$2
  22. ], [], $3="$4", $3="$5")
  23. ])
  24. dnl CL_PROTO_TRY(INCLUDES, ANSI-DECL, TRAD-DECL, ACTION-IF-OK, ACTION-IF-FAILS)
  25. AC_DEFUN([CL_PROTO_TRY],
  26. [AC_TRY_COMPILE([$1]
  27. AC_LANG_EXTERN
  28. [#if defined(__STDC__) || defined(__cplusplus)
  29. $2
  30. #else
  31. $3
  32. #endif
  33. ], [], [$4], [$5])
  34. ])
  35. dnl CL_PROTO_CONST(INCLUDES, ANSI-DECL, TRAD-DECL, CACHE-ID)
  36. AC_DEFUN([CL_PROTO_CONST],
  37. [CL_PROTO_TRY([$1], [$2], [$3], $4="", $4="const")]
  38. )