Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Modules / FindPHP4.cmake
blob185d6287d8fdb1dd89af54762760e6c703e6ed26
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:
6 #  PHP4_INCLUDE_PATH       = path to where php.h can be found
7 #  PHP4_EXECUTABLE         = full path to the php4 binary
10 SET(PHP4_POSSIBLE_INCLUDE_PATHS
11   /usr/include/php4
12   /usr/local/include/php4
13   /usr/include/php
14   /usr/local/include/php
15   /usr/local/apache/php
16   )
18 SET(PHP4_POSSIBLE_LIB_PATHS
19   /usr/lib
20   )
22 FIND_PATH(PHP4_FOUND_INCLUDE_PATH main/php.h
23   ${PHP4_POSSIBLE_INCLUDE_PATHS})
25 IF(PHP4_FOUND_INCLUDE_PATH)
26   SET(php4_paths "${PHP4_POSSIBLE_INCLUDE_PATHS}")
27   FOREACH(php4_path Zend main TSRM)
28     SET(php4_paths ${php4_paths} "${PHP4_FOUND_INCLUDE_PATH}/${php4_path}")
29   ENDFOREACH(php4_path Zend main TSRM)
30   SET(PHP4_INCLUDE_PATH "${php4_paths}" INTERNAL "PHP4 include paths")
31 ENDIF(PHP4_FOUND_INCLUDE_PATH)
33 FIND_PROGRAM(PHP4_EXECUTABLE NAMES php4 php )
35 MARK_AS_ADVANCED(
36   PHP4_EXECUTABLE
37   PHP4_FOUND_INCLUDE_PATH
38   )
40 IF(APPLE)
41 # this is a hack for now
42   SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS 
43    "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -Wl,-flat_namespace")
44   FOREACH(symbol
45     __efree
46     __emalloc
47     __estrdup
48     __object_init_ex
49     __zend_get_parameters_array_ex
50     __zend_list_find
51     __zval_copy_ctor
52     _add_property_zval_ex
53     _alloc_globals
54     _compiler_globals
55     _convert_to_double
56     _convert_to_long
57     _zend_error
58     _zend_hash_find
59     _zend_register_internal_class_ex
60     _zend_register_list_destructors_ex
61     _zend_register_resource
62     _zend_rsrc_list_get_rsrc_type
63     _zend_wrong_param_count
64     _zval_used_for_init
65     )
66     SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS 
67       "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS},-U,${symbol}")
68   ENDFOREACH(symbol)
69 ENDIF(APPLE)
71 INCLUDE(FindPackageHandleStandardArgs)
72 FIND_PACKAGE_HANDLE_STANDARD_ARGS(PHP4 DEFAULT_MSG PHP4_EXECUTABLE PHP4_INCLUDE_PATH)