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