FindPHP4.cmake 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. # file LICENSE.rst or https://cmake.org/licensing for details.
  3. #[=======================================================================[.rst:
  4. FindPHP4
  5. --------
  6. Finds PHP version 4, a general-purpose scripting language:
  7. .. code-block:: cmake
  8. find_package(PHP4 [...])
  9. .. note::
  10. This module is specifically for PHP version 4, which is obsolete and no longer
  11. supported. For modern development, use a newer PHP version.
  12. This module checks if PHP 4 is installed and determines the locations of the
  13. include directories and the PHP command-line interpreter.
  14. Result Variables
  15. ^^^^^^^^^^^^^^^^
  16. This module defines the following variables:
  17. ``PHP4_FOUND``
  18. Boolean indicating whether PHP 4 was found.
  19. Cache Variables
  20. ^^^^^^^^^^^^^^^
  21. The following cache variables may also be set:
  22. ``PHP4_INCLUDE_PATH``
  23. The directory containing ``php.h`` and other headers needed to use PHP.
  24. ``PHP4_EXECUTABLE``
  25. The full path to the ``php`` command-line interpreter executable.
  26. Examples
  27. ^^^^^^^^
  28. Finding PHP:
  29. .. code-block:: cmake
  30. find_package(PHP4)
  31. #]=======================================================================]
  32. set(PHP4_POSSIBLE_INCLUDE_PATHS
  33. /usr/include/php4
  34. /usr/local/include/php4
  35. /usr/include/php
  36. /usr/local/include/php
  37. /usr/local/apache/php
  38. )
  39. set(PHP4_POSSIBLE_LIB_PATHS
  40. /usr/lib
  41. )
  42. find_path(PHP4_FOUND_INCLUDE_PATH main/php.h
  43. ${PHP4_POSSIBLE_INCLUDE_PATHS})
  44. if(PHP4_FOUND_INCLUDE_PATH)
  45. set(php4_paths "${PHP4_POSSIBLE_INCLUDE_PATHS}")
  46. foreach(php4_path Zend main TSRM)
  47. set(php4_paths ${php4_paths} "${PHP4_FOUND_INCLUDE_PATH}/${php4_path}")
  48. endforeach()
  49. set(PHP4_INCLUDE_PATH "${php4_paths}")
  50. endif()
  51. find_program(PHP4_EXECUTABLE NAMES php4 php )
  52. mark_as_advanced(
  53. PHP4_EXECUTABLE
  54. PHP4_FOUND_INCLUDE_PATH
  55. )
  56. if(APPLE)
  57. # this is a hack for now
  58. string(APPEND CMAKE_SHARED_MODULE_CREATE_C_FLAGS
  59. " -Wl,-flat_namespace")
  60. foreach(symbol
  61. __efree
  62. __emalloc
  63. __estrdup
  64. __object_init_ex
  65. __zend_get_parameters_array_ex
  66. __zend_list_find
  67. __zval_copy_ctor
  68. _add_property_zval_ex
  69. _alloc_globals
  70. _compiler_globals
  71. _convert_to_double
  72. _convert_to_long
  73. _zend_error
  74. _zend_hash_find
  75. _zend_register_internal_class_ex
  76. _zend_register_list_destructors_ex
  77. _zend_register_resource
  78. _zend_rsrc_list_get_rsrc_type
  79. _zend_wrong_param_count
  80. _zval_used_for_init
  81. )
  82. string(APPEND CMAKE_SHARED_MODULE_CREATE_C_FLAGS
  83. ",-U,${symbol}")
  84. endforeach()
  85. endif()
  86. include(FindPackageHandleStandardArgs)
  87. find_package_handle_standard_args(PHP4 DEFAULT_MSG PHP4_EXECUTABLE PHP4_INCLUDE_PATH)