1
0

FindPHP4.cmake 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. # - Find PHP4
  2. # This module finds if PHP4 is installed and determines where the include files
  3. # and libraries are. It also determines what the name of the library is. This
  4. # code sets the following variables:
  5. #
  6. # PHP4_INCLUDE_PATH = path to where php.h can be found
  7. # PHP4_EXECUTABLE = full path to the php4 binary
  8. #
  9. #=============================================================================
  10. # Copyright 2004-2009 Kitware, Inc.
  11. #
  12. # Distributed under the OSI-approved BSD License (the "License");
  13. # see accompanying file Copyright.txt for details.
  14. #
  15. # This software is distributed WITHOUT ANY WARRANTY; without even the
  16. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  17. # See the License for more information.
  18. #=============================================================================
  19. # (To distribute this file outside of CMake, substitute the full
  20. # License text for the above reference.)
  21. set(PHP4_POSSIBLE_INCLUDE_PATHS
  22. /usr/include/php4
  23. /usr/local/include/php4
  24. /usr/include/php
  25. /usr/local/include/php
  26. /usr/local/apache/php
  27. )
  28. set(PHP4_POSSIBLE_LIB_PATHS
  29. /usr/lib
  30. )
  31. find_path(PHP4_FOUND_INCLUDE_PATH main/php.h
  32. ${PHP4_POSSIBLE_INCLUDE_PATHS})
  33. if(PHP4_FOUND_INCLUDE_PATH)
  34. set(php4_paths "${PHP4_POSSIBLE_INCLUDE_PATHS}")
  35. foreach(php4_path Zend main TSRM)
  36. set(php4_paths ${php4_paths} "${PHP4_FOUND_INCLUDE_PATH}/${php4_path}")
  37. endforeach()
  38. set(PHP4_INCLUDE_PATH "${php4_paths}" INTERNAL "PHP4 include paths")
  39. endif()
  40. find_program(PHP4_EXECUTABLE NAMES php4 php )
  41. mark_as_advanced(
  42. PHP4_EXECUTABLE
  43. PHP4_FOUND_INCLUDE_PATH
  44. )
  45. if(APPLE)
  46. # this is a hack for now
  47. set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS
  48. "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -Wl,-flat_namespace")
  49. foreach(symbol
  50. __efree
  51. __emalloc
  52. __estrdup
  53. __object_init_ex
  54. __zend_get_parameters_array_ex
  55. __zend_list_find
  56. __zval_copy_ctor
  57. _add_property_zval_ex
  58. _alloc_globals
  59. _compiler_globals
  60. _convert_to_double
  61. _convert_to_long
  62. _zend_error
  63. _zend_hash_find
  64. _zend_register_internal_class_ex
  65. _zend_register_list_destructors_ex
  66. _zend_register_resource
  67. _zend_rsrc_list_get_rsrc_type
  68. _zend_wrong_param_count
  69. _zval_used_for_init
  70. )
  71. set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS
  72. "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS},-U,${symbol}")
  73. endforeach()
  74. endif()
  75. include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
  76. FIND_PACKAGE_HANDLE_STANDARD_ARGS(PHP4 DEFAULT_MSG PHP4_EXECUTABLE PHP4_INCLUDE_PATH)