FindPHP4.cmake 2.0 KB

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