FindPHP4.cmake 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. # file Copyright.txt or https://cmake.org/licensing for details.
  3. #[=======================================================================[.rst:
  4. FindPHP4
  5. --------
  6. Find PHP4
  7. This module finds if PHP4 is installed and determines where the
  8. include files and libraries are. It also determines what the name of
  9. the library is. This code sets the following variables:
  10. ::
  11. PHP4_INCLUDE_PATH = path to where php.h can be found
  12. PHP4_EXECUTABLE = full path to the php4 binary
  13. #]=======================================================================]
  14. set(PHP4_POSSIBLE_INCLUDE_PATHS
  15. /usr/include/php4
  16. /usr/local/include/php4
  17. /usr/include/php
  18. /usr/local/include/php
  19. /usr/local/apache/php
  20. )
  21. set(PHP4_POSSIBLE_LIB_PATHS
  22. /usr/lib
  23. )
  24. find_path(PHP4_FOUND_INCLUDE_PATH main/php.h
  25. ${PHP4_POSSIBLE_INCLUDE_PATHS})
  26. if(PHP4_FOUND_INCLUDE_PATH)
  27. set(php4_paths "${PHP4_POSSIBLE_INCLUDE_PATHS}")
  28. foreach(php4_path Zend main TSRM)
  29. set(php4_paths ${php4_paths} "${PHP4_FOUND_INCLUDE_PATH}/${php4_path}")
  30. endforeach()
  31. set(PHP4_INCLUDE_PATH "${php4_paths}")
  32. endif()
  33. find_program(PHP4_EXECUTABLE NAMES php4 php )
  34. mark_as_advanced(
  35. PHP4_EXECUTABLE
  36. PHP4_FOUND_INCLUDE_PATH
  37. )
  38. if(APPLE)
  39. # this is a hack for now
  40. string(APPEND CMAKE_SHARED_MODULE_CREATE_C_FLAGS
  41. " -Wl,-flat_namespace")
  42. foreach(symbol
  43. __efree
  44. __emalloc
  45. __estrdup
  46. __object_init_ex
  47. __zend_get_parameters_array_ex
  48. __zend_list_find
  49. __zval_copy_ctor
  50. _add_property_zval_ex
  51. _alloc_globals
  52. _compiler_globals
  53. _convert_to_double
  54. _convert_to_long
  55. _zend_error
  56. _zend_hash_find
  57. _zend_register_internal_class_ex
  58. _zend_register_list_destructors_ex
  59. _zend_register_resource
  60. _zend_rsrc_list_get_rsrc_type
  61. _zend_wrong_param_count
  62. _zval_used_for_init
  63. )
  64. string(APPEND CMAKE_SHARED_MODULE_CREATE_C_FLAGS
  65. ",-U,${symbol}")
  66. endforeach()
  67. endif()
  68. include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
  69. FIND_PACKAGE_HANDLE_STANDARD_ARGS(PHP4 DEFAULT_MSG PHP4_EXECUTABLE PHP4_INCLUDE_PATH)