STYLE: Nightly Version update
[cmake.git] / Modules / FindPHP4.cmake
blobe38413fcee518ae4493a2c5a00c876a60cc3621e
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 object.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
34   NAMES php4 php
35   PATHS
36   /usr/bin
37   /usr/local/bin
38   )
40 MARK_AS_ADVANCED(
41   PHP4_EXECUTABLE
42   PHP4_FOUND_INCLUDE_PATH
43   )
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(symbol)
74 ENDIF(APPLE)