ast_func_fork.m4 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. # AST_FUNC_FORK
  2. # -------------
  3. AN_FUNCTION([fork], [AST_FUNC_FORK])
  4. AN_FUNCTION([vfork], [AST_FUNC_FORK])
  5. AC_DEFUN([AST_FUNC_FORK],
  6. [AC_REQUIRE([AC_TYPE_PID_T])dnl
  7. AC_CHECK_HEADERS(vfork.h)
  8. AC_CHECK_FUNCS(fork vfork)
  9. if test "x$ac_cv_func_fork" = xyes; then
  10. _AST_FUNC_FORK
  11. else
  12. ac_cv_func_fork_works=$ac_cv_func_fork
  13. fi
  14. if test "x$ac_cv_func_fork_works" = xcross; then
  15. case $host in
  16. *-*-amigaos* | *-*-msdosdjgpp* | *-*-uclinux* )
  17. # Override, as these systems have only a dummy fork() stub
  18. ac_cv_func_fork_works=no
  19. ;;
  20. *)
  21. ac_cv_func_fork_works=yes
  22. ;;
  23. esac
  24. AC_MSG_WARN([result $ac_cv_func_fork_works guessed because of cross compilation])
  25. fi
  26. ac_cv_func_vfork_works=$ac_cv_func_vfork
  27. if test "x$ac_cv_func_vfork" = xyes; then
  28. _AC_FUNC_VFORK
  29. fi;
  30. if test "x$ac_cv_func_fork_works" = xcross; then
  31. ac_cv_func_vfork_works=$ac_cv_func_vfork
  32. AC_MSG_WARN([result $ac_cv_func_vfork_works guessed because of cross compilation])
  33. fi
  34. if test "x$ac_cv_func_vfork_works" = xyes; then
  35. AC_DEFINE(HAVE_WORKING_VFORK, 1, [Define to 1 if `vfork' works.])
  36. else
  37. AC_DEFINE(vfork, fork, [Define as `fork' if `vfork' does not work.])
  38. fi
  39. if test "x$ac_cv_func_fork_works" = xyes; then
  40. AC_DEFINE(HAVE_WORKING_FORK, 1, [Define to 1 if `fork' works.])
  41. PBX_WORKING_FORK=1
  42. AC_SUBST(PBX_WORKING_FORK)
  43. fi
  44. ])# AST_FUNC_FORK
  45. # _AST_FUNC_FORK
  46. # -------------
  47. AC_DEFUN([_AST_FUNC_FORK],
  48. [AC_CACHE_CHECK(for working fork, ac_cv_func_fork_works,
  49. [AC_RUN_IFELSE(
  50. [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
  51. [
  52. /* By Ruediger Kuhlmann. */
  53. return fork () < 0;
  54. ])],
  55. [ac_cv_func_fork_works=yes],
  56. [ac_cv_func_fork_works=no],
  57. [ac_cv_func_fork_works=cross])])]
  58. )# _AST_FUNC_FORK