Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Changes reqiured to open source HipHop

  • Loading branch information...
commit c3f1ab2f0b67ea39923260749b7185cf1d757bb7 1 parent 3e8ebe8
Scott MacVicar authored
Showing with 231,858 additions and 8,944 deletions.
  1. +165 −0 CMake/FindBISON.cmake
  2. +134 −0 CMake/FindFLEX.cmake
  3. +121 −0 CMake/FindGD.cmake
  4. +77 −0 CMake/FindICU.cmake
  5. +36 −0 CMake/FindLibAfdt.cmake
  6. +36 −0 CMake/FindLibCh.cmake
  7. +37 −0 CMake/FindLibEvent.cmake
  8. +36 −0 CMake/FindLibEvent.cmake.bak
  9. +39 −0 CMake/FindMcrypt.cmake
  10. +114 −0 CMake/FindMySQL.cmake
  11. +35 −0 CMake/FindPCRE.cmake
  12. +56 −0 CMake/FindSqlite3.cmake
  13. +192 −0 CMake/FindTBB.cmake
  14. +170 −0 CMake/HPHPFindLibs.cmake
  15. +32 −0 CMake/HPHPFunctions.cmake
  16. +20 −0 CMake/HPHPSetup.cmake
  17. +16 −0 CMakeLists.txt
  18. +60 −0 bin/CMakeLists.base.txt
  19. +6 −6 bin/run.sh
  20. +114 −0 src/CMakeLists.txt
  21. +138 −0 src/cpp/base/externals.h
  22. +0 −3  src/cpp/ext/ext.h
  23. +0 −20 src/cpp/ext/phpmcc/Makefile
  24. +0 −22 src/cpp/ext/phpmcc/ext_php_mcc.h
  25. +0 −16 src/cpp/ext/phpmcc/release/Makefile
  26. +0 −822 src/cpp/ext/phpmcc/release/accessors.cpp
  27. +0 −35 src/cpp/ext/phpmcc/release/accessors.h
  28. +0 −65 src/cpp/ext/phpmcc/release/constants.h
  29. +0 −1,388 src/cpp/ext/phpmcc/release/ext_php_mcc.cpp
  30. +0 −180 src/cpp/ext/phpmcc/release/ext_php_mcc.h
  31. +0 −34 src/cpp/ext/phpmcc/release/ext_php_mcc_impl.h
  32. +0 −1,150 src/cpp/ext/phpmcc/release/operators.cpp
  33. +0 −269 src/cpp/ext/phpmcc/release/serialization.cpp
  34. +0 −52 src/cpp/ext/phpmcc/release/serialization.h
  35. +0 −261 src/cpp/ext/phpmcc/release/types.h
  36. +0 −132 src/cpp/ext/profile/extprofile_fbml.h
  37. +0 −32 src/cpp/ext/profile/extprofile_php_mcc.h
  38. +20 −0 src/hphp/CMakeLists.txt
  39. +84 −0 src/hphp/externals.cpp
  40. +0 −92 src/idl/fbml.idl.php
  41. +0 −269 src/idl/php_mcc.idl.php
  42. +48 −0 src/lib/CMakeLists.txt
  43. +0 −3  src/lib/system/ext.inc
  44. +0 −26 src/lib/system/fbml.inc
  45. +84 −14 src/lib/system/gen/php/globals/constants.cpp
  46. +84 −14 src/lib/system/gen/php/globals/constants.fw.h
  47. +0 −1,961 src/lib/system/gen/sys/dynamic_table_class.no.cpp
  48. +104 −37 src/lib/system/gen/sys/dynamic_table_constant.no.cpp
  49. +180 −1,281 src/lib/system/gen/sys/dynamic_table_func.no.cpp
  50. +0 −71 src/lib/system/gen/sys/system_globals.h
  51. +0 −78 src/lib/system/php_mcc.inc
  52. +10 −0 src/test/CMakeLists.txt
  53. +0 −3  src/test/test_ext.h
  54. +0 −3  src/test/test_ext.inc
  55. +0 −296 src/test/test_ext_fbml.cpp
  56. +0 −54 src/test/test_ext_fbml.h
  57. +0 −209 src/test/test_ext_php_mcc.cpp
  58. +0 −46 src/test/test_ext_php_mcc.h
  59. +343 −0 src/test/test_externals.cpp
  60. BIN  src/third_party/.DS_Store
  61. BIN  src/third_party/._.DS_Store
  62. +18 −0 src/third_party/libafdt/CMake/CheckLibeventVersion.c
  63. +37 −0 src/third_party/libafdt/CMake/FindLibEvent.cmake
  64. +88 −0 src/third_party/libafdt/CMakeLists.txt
  65. +26 −0 src/third_party/libafdt/COPYING
  66. +13 −0 src/third_party/libafdt/Doxyfile
  67. +59 −0 src/third_party/libafdt/Makefile.am
  68. +897 −0 src/third_party/libafdt/Makefile.in
  69. +14 −0 src/third_party/libafdt/README
  70. +1,064 −0 src/third_party/libafdt/aclocal.m4
  71. +23 −0 src/third_party/libafdt/bootstrap.sh
  72. +30 −0 src/third_party/libafdt/cleanup.sh
  73. +1,542 −0 src/third_party/libafdt/config.guess
  74. +16 −0 src/third_party/libafdt/config.h.cmake
  75. +140 −0 src/third_party/libafdt/config.h.in
  76. +1,677 −0 src/third_party/libafdt/config.sub
  77. +17,795 −0 src/third_party/libafdt/configure
  78. +73 −0 src/third_party/libafdt/configure.ac
  79. +589 −0 src/third_party/libafdt/depcomp
  80. +519 −0 src/third_party/libafdt/install-sh
  81. +8,406 −0 src/third_party/libafdt/ltmain.sh
  82. +194 −0 src/third_party/libafdt/m4/ax_lib_event.m4
  83. +7,357 −0 src/third_party/libafdt/m4/libtool.m4
  84. +368 −0 src/third_party/libafdt/m4/ltoptions.m4
  85. +123 −0 src/third_party/libafdt/m4/ltsugar.m4
  86. +23 −0 src/third_party/libafdt/m4/ltversion.m4
  87. +92 −0 src/third_party/libafdt/m4/lt~obsolete.m4
  88. +367 −0 src/third_party/libafdt/missing
  89. +501 −0 src/third_party/libafdt/src/afdt.h
  90. +357 −0 src/third_party/libafdt/src/async.c
  91. +16 −0 src/third_party/libafdt/src/config.h
  92. +16 −0 src/third_party/libafdt/src/internal.h
  93. +266 −0 src/third_party/libafdt/src/lowlevel.c
  94. +57 −0 src/third_party/libafdt/src/strlcpy.c
  95. +53 −0 src/third_party/libafdt/src/sync.c
  96. +42 −0 src/third_party/libafdt/src/util.c
  97. +238 −0 src/third_party/libafdt/test/catter.c
  98. +264 −0 src/third_party/libafdt/test/runtests.py
  99. +317 −0 src/third_party/libafdt/test/server.c
  100. +60 −0 src/third_party/libafdt/test/sync_catter.c
  101. +1 −0  src/third_party/libmbfl
  102. +110,860 −0 src/third_party/libsqlite3/sqlite3.c
  103. +5,662 −0 src/third_party/libsqlite3/sqlite3.h
  104. +378 −0 src/third_party/libsqlite3/sqlite3ext.h
  105. +10 −0 src/third_party/timelib/Makefile
  106. +14 −0 src/third_party/timelib/README
  107. +303 −0 src/third_party/timelib/astro.c
  108. +51 −0 src/third_party/timelib/astro.h
  109. +147 −0 src/third_party/timelib/dow.c
  110. +40 −0 src/third_party/timelib/fallbackmap.h
  111. +22,460 −0 src/third_party/timelib/parse_date.c
  112. +22,548 −0 src/third_party/timelib/parse_date.c.orig
  113. +1,692 −0 src/third_party/timelib/parse_date.re
  114. +405 −0 src/third_party/timelib/parse_tz.c
  115. +220 −0 src/third_party/timelib/timelib.c
  116. +106 −0 src/third_party/timelib/timelib.h
  117. +80 −0 src/third_party/timelib/timelib.m4
  118. +1 −0  src/third_party/timelib/timelib_config.h.win32
  119. +209 −0 src/third_party/timelib/timelib_structs.h
  120. +18,061 −0 src/third_party/timelib/timezonedb.h
  121. +1,698 −0 src/third_party/timelib/timezonemap.h
  122. +331 −0 src/third_party/timelib/tm2unixtime.c
  123. +253 −0 src/third_party/timelib/unixtime2tm.c
Sorry, we could not display the entire diff because it was too big.
View
165 CMake/FindBISON.cmake
@@ -0,0 +1,165 @@
+# - Find bison executable and provides macros to generate custom build rules
+# The module defined the following variables:
+# BISON_EXECUTABLE - path to the bison program
+# BISON_VERSION - version of bison
+# BISON_FOUND - true if the program was found
+# If bison is found, the module defines the macros:
+# BISON_TARGET(<Name> <YaccInput> <CodeOutput> [VERBOSE <file>]
+# [COMPILE_FLAGS <string>])
+# which will create a custom rule to generate a parser. <YaccInput> is
+# the path to a yacc file. <CodeOutput> is the name of the source file
+# generated by bison. A header file is also be generated, and contains
+# the token list. If COMPILE_FLAGS option is specified, the next
+# parameter is added in the bison command line. if VERBOSE option is
+# specified, <file> is created and contains verbose descriptions of the
+# grammar and parser. The macro defines a set of variables:
+# BISON_${Name}_DEFINED - true is the macro ran successfully
+# BISON_${Name}_INPUT - The input source file, an alias for <YaccInput>
+# BISON_${Name}_OUTPUT_SOURCE - The source file generated by bison
+# BISON_${Name}_OUTPUT_HEADER - The header file generated by bison
+# BISON_${Name}_OUTPUTS - The sources files generated by bison
+# BISON_${Name}_COMPILE_FLAGS - Options used in the bison command line
+#
+# Example:
+# FIND_PACKAGE(BISON)
+# BISON_TARGET(MyParser parser.y ${PROJECT_BINARY_DIR}/parser.cpp)
+# ADD_EXECUTABLE(Foo main.cpp ${BISON_MyParser_OUTPUTS})
+#
+
+# Copyright (c) 2006, Tristan Carel
+# All rights reserved.
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of the University of California, Berkeley nor the
+# names of its contributors may be used to endorse or promote products
+# derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# $Id:: FindBISON.cmake 3 2006-11-03 02:42:02Z ken $
+
+SET(BISON_FOUND FALSE)
+
+FIND_PROGRAM(BISON_EXECUTABLE bison DOC "path to the bison executable")
+MARK_AS_ADVANCED(BISON_EXECUTABLE)
+
+IF(BISON_EXECUTABLE)
+ SET(BISON_FOUND TRUE)
+
+ EXECUTE_PROCESS(COMMAND ${BISON_EXECUTABLE} --version
+ OUTPUT_VARIABLE BISON_version_output
+ ERROR_VARIABLE BISON_version_error
+ RESULT_VARIABLE BISON_version_result
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ IF(NOT ${BISON_version_result} EQUAL 0)
+ MESSAGE(SEND_ERROR "Command \"${BISON_EXECUTABLE} --version\" failed with output:\n${BISON_version_error}")
+ ELSE(NOT ${BISON_version_result} EQUAL 0)
+ STRING(REGEX REPLACE "^bison \\(GNU Bison\\) ([^\n]+)\n.*" "\\1"
+ BISON_VERSION "${BISON_version_output}")
+ ENDIF(NOT ${BISON_version_result} EQUAL 0)
+
+ # internal macro
+ MACRO(BISON_TARGET_option_verbose Name BisonOutput filename)
+ LIST(APPEND BISON_TARGET_cmdopt "--verbose")
+ GET_FILENAME_COMPONENT(BISON_TARGET_output_path "${BisonOutput}" PATH)
+ GET_FILENAME_COMPONENT(BISON_TARGET_output_name "${BisonOutput}" NAME_WE)
+ ADD_CUSTOM_COMMAND(OUTPUT ${filename}
+ COMMAND ${CMAKE_COMMAND} -E copy
+ "${BISON_TARGET_output_path}/${BISON_TARGET_output_name}.output"
+ "${filename}"
+ DEPENDS
+ "${BISON_TARGET_output_path}/${BISON_TARGET_output_name}.output"
+ COMMENT "[BISON][${Name}] Copying bison verbose table to ${filename}"
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
+ SET(BISON_${Name}_VERBOSE_FILE ${filename})
+ LIST(APPEND BISON_TARGET_extraoutputs
+ "${BISON_TARGET_output_path}/${BISON_TARGET_output_name}.output")
+ ENDMACRO(BISON_TARGET_option_verbose)
+
+ # internal macro
+ MACRO(BISON_TARGET_option_extraopts Options)
+ SET(BISON_TARGET_extraopts "${Options}")
+ SEPARATE_ARGUMENTS(BISON_TARGET_extraopts)
+ LIST(APPEND BISON_TARGET_cmdopt ${BISON_TARGET_extraopts})
+ ENDMACRO(BISON_TARGET_option_extraopts)
+
+ MACRO(BISON_TARGET Name BisonInput BisonOutput)
+ SET(BISON_TARGET_output_header "")
+ SET(BISON_TARGET_cmdopt "")
+ SET(BISON_TARGET_outputs "${BisonOutput}")
+
+ IF(NOT ${ARGC} EQUAL 3 AND NOT ${ARGC} EQUAL 5 AND NOT ${ARGC} EQUAL 7)
+ MESSAGE(SEND_ERROR "Usage")
+ ELSE(NOT ${ARGC} EQUAL 3 AND NOT ${ARGC} EQUAL 5 AND NOT ${ARGC} EQUAL 7)
+ # Parsing parameters
+ IF(${ARGC} GREATER 5 OR ${ARGC} EQUAL 5)
+ IF("${ARGV3}" STREQUAL "VERBOSE")
+ BISON_TARGET_option_verbose(${Name} ${BisonOutput} "${ARGV4}")
+ ENDIF("${ARGV3}" STREQUAL "VERBOSE")
+ IF("${ARGV3}" STREQUAL "COMPILE_FLAGS")
+ BISON_TARGET_option_extraopts("${ARGV4}")
+ ENDIF("${ARGV3}" STREQUAL "COMPILE_FLAGS")
+ ENDIF(${ARGC} GREATER 5 OR ${ARGC} EQUAL 5)
+ IF(${ARGC} EQUAL 7)
+ IF("${ARGV5}" STREQUAL "VERBOSE")
+ BISON_TARGET_option_verbose(${Name} ${BisonOutput} "${ARGV6}")
+ ENDIF("${ARGV5}" STREQUAL "VERBOSE")
+ IF("${ARGV5}" STREQUAL "COMPILE_FLAGS")
+ BISON_TARGET_option_extraopts("${ARGV6}")
+ ENDIF("${ARGV5}" STREQUAL "COMPILE_FLAGS")
+ ENDIF(${ARGC} EQUAL 7)
+
+ # Header's name generated by bison (see option -d)
+ LIST(APPEND BISON_TARGET_cmdopt "-d")
+ STRING(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\2" _fileext "${ARGV2}")
+ STRING(REPLACE "c" "h" _fileext ${_fileext})
+ STRING(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\1${_fileext}"
+ BISON_${Name}_OUTPUT_HEADER "${ARGV2}")
+ LIST(APPEND BISON_TARGET_outputs "${BISON_${Name}_OUTPUT_HEADER}")
+
+ ADD_CUSTOM_COMMAND(OUTPUT ${BISON_TARGET_outputs}
+ ${BISON_TARGET_extraoutputs}
+ COMMAND ${BISON_EXECUTABLE} ${BISON_TARGET_cmdopt} -o ${ARGV2} ${ARGV1}
+ DEPENDS ${ARGV1}
+ COMMENT "[BISON][${Name}] Building parser with bison ${BISON_VERSION}"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+
+ # define target variables
+ SET(BISON_${Name}_DEFINED TRUE)
+ SET(BISON_${Name}_INPUT ${ARGV1})
+ SET(BISON_${Name}_OUTPUTS ${BISON_TARGET_outputs})
+ SET(BISON_${Name}_COMPILE_FLAGS ${BISON_TARGET_cmdopt})
+ SET(BISON_${Name}_OUTPUT_SOURCE "${BisonOutput}")
+
+ ENDIF(NOT ${ARGC} EQUAL 3 AND NOT ${ARGC} EQUAL 5 AND NOT ${ARGC} EQUAL 7)
+ ENDMACRO(BISON_TARGET)
+
+ENDIF(BISON_EXECUTABLE)
+
+
+IF(NOT BISON_FOUND)
+ IF(NOT BISON_FIND_QUIETLY)
+ MESSAGE(STATUS "BISON was not found.")
+ ELSE(NOT BISON_FIND_QUIETLY)
+ IF(BISON_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "BISON was not found.")
+ ENDIF(BISON_FIND_REQUIRED)
+ ENDIF(NOT BISON_FIND_QUIETLY)
+ENDIF(NOT BISON_FOUND)
+
+# FindBISON.cmake ends here
View
134 CMake/FindFLEX.cmake
@@ -0,0 +1,134 @@
+# - Find flex executable and provides a macro to generate custom build rules
+# The module defines the following variables:
+# FLEX_FOUND - true is flex executable is found
+# FLEX_VERSION - the version of flex
+# If flex is found on the system, the module provides the macro:
+# FLEX_TARGET(Name FlexInput FlexOutput [COMPILE_FLAGS <string>])
+# which creates a custom command to generate the <FlexOutput> file from
+# the <FlexInput> file. If COMPILE_FLAGS option is specified, the next
+# parameter is added to the flex command line. Name is an alias used to
+# get details of this custom command. Indeed the macro defines the
+# following variables:
+# FLEX_${Name}_DEFINED - true is the macro ran successfully
+# FLEX_${Name}_OUTPUTS - the source file generated by the custom rule, an
+# alias for FlexOutput
+# FLEX_${Name}_INPUT - the flex source file, an alias for ${FlexInput}
+#
+# Flex scanners oftenly use tokens defined by Bison: the code generated
+# by Flex depends of the header generated by Bison. This module also
+# defines a macro:
+# ADD_FLEX_BISON_DEPENDENCY(FlexTarget BisonTarget)
+# which adds the required dependency between a scanner and a parser
+# where <FlexTarget> and <BisonTarget> are the first parameters of
+# respectively FLEX_TARGET and BISON_TARGET macros.
+#
+# Example:
+# FIND_PACKAGE(BISON)
+# FIND_PACKAGE(FLEX)
+# BISON_TARGET(MyParser parser.y ${PROJECT_BINARY_DIR}/parser.cpp
+# FLEX_TARGET(MyScanner lexer.l ${PROJECT_BINARY_DIR}/lexer.cpp)
+# ADD_FLEX_BISON_DEPENDENCY(MyScanner MyParser)
+#
+
+# Copyright (c) 2006, Tristan Carel
+# All rights reserved.
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of the University of California, Berkeley nor the
+# names of its contributors may be used to endorse or promote products
+# derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# $Id:: FindFLEX.cmake 3 2006-11-03 02:42:02Z ken $
+
+SET(FLEX_FOUND FALSE)
+
+FIND_PROGRAM(FLEX_EXECUTABLE NAMES flex35 flex DOC "path to the flex executable")
+MARK_AS_ADVANCED(FLEX_EXECUTABLE)
+
+FIND_LIBRARY(FL_LIBRARY NAMES fl
+ PATHS /usr/lib DOC "path to the fl library")
+SET(FLEX_LIBRARIES ${FL_LIBRARY})
+
+IF(FLEX_EXECUTABLE)
+ SET(FLEX_FOUND TRUE)
+
+ EXECUTE_PROCESS(COMMAND ${FLEX_EXECUTABLE} --version
+ OUTPUT_VARIABLE FLEX_version_output
+ ERROR_VARIABLE FLEX_version_error
+ RESULT_VARIABLE FLEX_version_result
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ IF(NOT ${FLEX_version_result} EQUAL 0)
+ MESSAGE(SEND_ERROR "Command \"${FLEX_EXECUTABLE} --version\" failed with output:\n${FLEX_version_error}")
+ ELSE(NOT ${FLEX_version_result} EQUAL 0)
+ STRING(REGEX REPLACE "^flex (.*)$" "\\1"
+ FLEX_VERSION "${FLEX_version_output}")
+ ENDIF(NOT ${FLEX_version_result} EQUAL 0)
+
+ MACRO(FLEX_TARGET Name Input Output)
+ SET(FLEX_TARGET_usage "FLEX_TARGET(<Name> <Input> <Output> [COMPILE_FLAGS <string>]")
+ IF(${ARGC} GREATER 3)
+ IF(${ARGC} EQUAL 5)
+ IF("${ARGV3}" STREQUAL "COMPILE_FLAGS")
+ SET(FLEX_EXECUTABLE_opts "${ARGV4}")
+ SEPARATE_ARGUMENTS(FLEX_EXECUTABLE_opts)
+ ELSE("${ARGV3}" STREQUAL "COMPILE_FLAGS")
+ MESSAGE(SEND_ERROR ${FLEX_TARGET_usage})
+ ENDIF("${ARGV3}" STREQUAL "COMPILE_FLAGS")
+ ELSE(${ARGC} EQUAL 5)
+ MESSAGE(SEND_ERROR ${FLEX_TARGET_usage})
+ ENDIF(${ARGC} EQUAL 5)
+ ENDIF(${ARGC} GREATER 3)
+ ADD_CUSTOM_COMMAND(OUTPUT ${Output}
+ COMMAND ${FLEX_EXECUTABLE} ${FLEX_EXECUTABLE_opts} -o${Output} ${Input}
+ DEPENDS ${Input}
+ COMMENT "[FLEX][${Name}] Building scanner with flex ${FLEX_VERSION}"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+
+ SET(FLEX_${Name}_DEFINED TRUE)
+ SET(FLEX_${Name}_OUTPUTS ${Output})
+ SET(FLEX_${Name}_INPUT ${Input})
+ SET(FLEX_${Name}_COMPILE_FLAGS ${FLEX_EXECUTABLE_opts})
+ ENDMACRO(FLEX_TARGET)
+
+ MACRO(ADD_FLEX_BISON_DEPENDENCY FlexTarget BisonTarget)
+ IF(NOT FLEX_${FlexTarget}_OUTPUTS)
+ MESSAGE(SEND_ERROR "Flex target `${FlexTarget}' does not exists.")
+ ENDIF(NOT FLEX_${FlexTarget}_OUTPUTS)
+ IF(NOT BISON_${BisonTarget}_OUTPUT_HEADER)
+ MESSAGE(SEND_ERROR "Bison target `${BisonTarget}' does not exists.")
+ ENDIF(NOT BISON_${BisonTarget}_OUTPUT_HEADER)
+
+ SET_SOURCE_FILES_PROPERTIES(${FLEX_${FlexTarget}_OUTPUTS}
+ PROPERTIES OBJECT_DEPENDS ${BISON_${BisonTarget}_OUTPUT_HEADER})
+ ENDMACRO(ADD_FLEX_BISON_DEPENDENCY)
+
+ENDIF(FLEX_EXECUTABLE)
+
+IF(NOT FLEX_FOUND)
+ IF(NOT FLEX_FIND_QUIETLY)
+ MESSAGE(STATUS "FLEX was not found.")
+ ELSE(NOT FLEX_FIND_QUIETLY)
+ IF(FLEX_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "FLEX was not found.")
+ ENDIF(FLEX_FIND_REQUIRED)
+ ENDIF(NOT FLEX_FIND_QUIETLY)
+ENDIF(NOT FLEX_FOUND)
+
+# FindFLEX.cmake ends here
View
121 CMake/FindGD.cmake
@@ -0,0 +1,121 @@
+# - Find GD
+# Find the native GD includes and library
+# This module defines
+# GD_INCLUDE_DIR, where to find gd.h, etc.
+# GD_LIBRARIES, the libraries needed to use GD.
+# GD_FOUND, If false, do not try to use GD.
+# also defined, but not for general use are
+# GD_LIBRARY, where to find the GD library.
+# GD_SUPPORTS_PNG, GD_SUPPORTS_JPEG, GD_SUPPORTS_GIF, test
+# support for image formats in GD.
+
+FIND_PATH(GD_INCLUDE_DIR gd.h
+/usr/local/include
+/usr/include
+)
+
+if(WIN32 AND NOT CYGWIN)
+ SET(GD_NAMES ${GD_NAMES} bgd)
+else(WIN32)
+ SET(GD_NAMES ${GD_NAMES} gd)
+endif(WIN32 AND NOT CYGWIN)
+
+FIND_LIBRARY(GD_LIBRARY
+ NAMES ${GD_NAMES}
+ PATHS /usr/lib64 /usr/lib /usr/local/lib
+ )
+
+IF (GD_LIBRARY AND GD_INCLUDE_DIR)
+ SET(GD_LIBRARIES ${GD_LIBRARY})
+ SET(GD_FOUND "YES")
+ELSE (GD_LIBRARY AND GD_INCLUDE_DIR)
+ SET(GD_FOUND "NO")
+ENDIF (GD_LIBRARY AND GD_INCLUDE_DIR)
+
+IF (GD_FOUND)
+ IF (WIN32 AND NOT CYGWIN)
+ SET(GD_SUPPORTS_PNG ON)
+ SET(GD_SUPPORTS_JPEG ON)
+ SET(GD_SUPPORTS_GIF ON)
+ get_filename_component(GD_LIBRARY_DIR ${GD_LIBRARY} PATH)
+ ELSE (WIN32 AND NOT CYGWIN)
+ INCLUDE(CheckLibraryExists)
+ GET_FILENAME_COMPONENT(GD_LIB_PATH ${GD_LIBRARY} PATH)
+ GET_FILENAME_COMPONENT(GD_LIB ${GD_LIBRARY} NAME)
+
+ CHECK_LIBRARY_EXISTS("${GD_LIBRARY}" "gdImagePng" "${GD_LIB_PATH}" GD_SUPPORTS_PNG)
+ IF (GD_SUPPORTS_PNG)
+ find_package(PNG)
+ IF (PNG_FOUND)
+ SET(GD_LIBRARIES ${GD_LIBRARIES} ${PNG_LIBRARIES})
+ SET(GD_INCLUDE_DIR ${GD_INCLUDE_DIR} ${PNG_INCLUDE_DIR})
+ ELSE (PNG_FOUND)
+ SET(GD_SUPPORTS_PNG "NO")
+ ENDIF (PNG_FOUND)
+ ENDIF (GD_SUPPORTS_PNG)
+
+ CHECK_LIBRARY_EXISTS("${GD_LIBRARY}" "gdImageJpeg" "${GD_LIB_PATH}" GD_SUPPORTS_JPEG)
+ IF (GD_SUPPORTS_JPEG)
+ find_package(JPEG)
+ IF (JPEG_FOUND)
+ SET(GD_LIBRARIES ${GD_LIBRARIES} ${JPEG_LIBRARIES})
+ SET(GD_INCLUDE_DIR ${GD_INCLUDE_DIR} ${JPEG_INCLUDE_DIR})
+ ELSE (JPEG_FOUND)
+ SET(GD_SUPPORTS_JPEG "NO")
+ ENDIF (JPEG_FOUND)
+ ENDIF (GD_SUPPORTS_JPEG)
+
+ CHECK_LIBRARY_EXISTS("${GD_LIBRARY}" "gdImageGif" "${GD_LIB_PATH}" GD_SUPPORTS_GIF)
+
+ # Trim the list of include directories
+ SET(GDINCTRIM)
+ FOREACH(GD_DIR ${GD_INCLUDE_DIR})
+ SET(GD_TMP_FOUND OFF)
+ FOREACH(GD_TRIMMED ${GDINCTRIM})
+ IF ("${GD_DIR}" STREQUAL "${GD_TRIMMED}")
+ SET(GD_TMP_FOUND ON)
+ ENDIF ("${GD_DIR}" STREQUAL "${GD_TRIMMED}")
+ ENDFOREACH(GD_TRIMMED ${GDINCTRIM})
+ IF (NOT GD_TMP_FOUND)
+ SET(GDINCTRIM "${GDINCTRIM}" "${GD_DIR}")
+ ENDIF (NOT GD_TMP_FOUND)
+ ENDFOREACH(GD_DIR ${GD_INCLUDE_DIR})
+ SET(GD_INCLUDE_DIR ${GDINCTRIM})
+
+ SET(GD_LIBRARY_DIR)
+
+ # Generate trimmed list of library directories and list of libraries
+ FOREACH(GD_LIB ${GD_LIBRARIES})
+ GET_FILENAME_COMPONENT(GD_NEXTLIBDIR ${GD_LIB} PATH)
+ SET(GD_TMP_FOUND OFF)
+ FOREACH(GD_LIBDIR ${GD_LIBRARY_DIR})
+ IF ("${GD_NEXTLIBDIR}" STREQUAL "${GD_LIBDIR}")
+ SET(GD_TMP_FOUND ON)
+ ENDIF ("${GD_NEXTLIBDIR}" STREQUAL "${GD_LIBDIR}")
+ ENDFOREACH(GD_LIBDIR ${GD_LIBRARIES})
+ IF (NOT GD_TMP_FOUND)
+ SET(GD_LIBRARY_DIR "${GD_LIBRARY_DIR}" "${GD_NEXTLIBDIR}")
+ ENDIF (NOT GD_TMP_FOUND)
+ ENDFOREACH(GD_LIB ${GD_LIBRARIES})
+ ENDIF (WIN32 AND NOT CYGWIN)
+ENDIF (GD_FOUND)
+
+IF (GD_FOUND)
+ IF (NOT GD_FIND_QUIETLY)
+ MESSAGE(STATUS "Found GD: ${GD_LIBRARY}")
+ ENDIF (NOT GD_FIND_QUIETLY)
+ELSE (GD_FOUND)
+ IF (GD_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find GD library")
+ ENDIF (GD_FIND_REQUIRED)
+ENDIF (GD_FOUND)
+
+MARK_AS_ADVANCED(
+ GD_LIBRARY
+ GD_LIBRARIES
+ GD_INCLUDE_DIR
+ GD_LIBRARY_DIR
+ GD_SUPPORTS_PNG
+ GD_SUPPORTS_JPEG
+ GD_SUPPORTS_GIF
+)
View
77 CMake/FindICU.cmake
@@ -0,0 +1,77 @@
+# Finds the International Components for Unicode (ICU) Library
+#
+# ICU_FOUND - True if ICU found.
+# ICU_I18N_FOUND - True if ICU's internationalization library found.
+# ICU_INCLUDE_DIRS - Directory to include to get ICU headers
+# Note: always include ICU headers as, e.g.,
+# unicode/utypes.h
+# ICU_LIBRARIES - Libraries to link against for the common ICU
+# ICU_I18N_LIBRARIES - Libraries to link against for ICU internationaliation
+# (note: in addition to ICU_LIBRARIES)
+
+# Look for the header file.
+find_path(
+ ICU_INCLUDE_DIR
+ NAMES unicode/utypes.h
+ DOC "Include directory for the ICU library")
+mark_as_advanced(ICU_INCLUDE_DIR)
+
+# Look for the library.
+find_library(
+ ICU_LIBRARY
+ NAMES icuuc cygicuuc cygicuuc32
+ DOC "Libraries to link against for the common parts of ICU")
+mark_as_advanced(ICU_LIBRARY)
+
+# Copy the results to the output variables.
+if(ICU_INCLUDE_DIR AND ICU_LIBRARY)
+ set(ICU_FOUND 1)
+ set(ICU_LIBRARIES ${ICU_LIBRARY})
+ set(ICU_INCLUDE_DIRS ${ICU_INCLUDE_DIR})
+
+ set(ICU_VERSION 0)
+ set(ICU_MAJOR_VERSION 0)
+ set(ICU_MINOR_VERSION 0)
+ FILE(READ "${ICU_INCLUDE_DIR}/unicode/uversion.h" _ICU_VERSION_CONENTS)
+ STRING(REGEX REPLACE ".*#define U_ICU_VERSION_MAJOR_NUM ([0-9]+).*" "\\1" ICU_MAJOR_VERSION "${_ICU_VERSION_CONENTS}")
+ STRING(REGEX REPLACE ".*#define U_ICU_VERSION_MINOR_NUM ([0-9]+).*" "\\1" ICU_MINOR_VERSION "${_ICU_VERSION_CONENTS}")
+
+ set(ICU_VERSION "${ICU_MAJOR_VERSION}.${ICU_MINOR_VERSION}")
+
+ # Look for the ICU internationalization libraries
+ find_library(
+ ICU_I18N_LIBRARY
+ NAMES icuin icui18n cygicuin cygicuin32
+ DOC "Libraries to link against for ICU internationalization")
+ mark_as_advanced(ICU_I18N_LIBRARY)
+ if (ICU_I18N_LIBRARY)
+ set(ICU_I18N_FOUND 1)
+ set(ICU_I18N_LIBRARIES ${ICU_I18N_LIBRARY})
+ else (ICU_I18N_LIBRARY)
+ set(ICU_I18N_FOUND 0)
+ set(ICU_I18N_LIBRARIES)
+ endif (ICU_I18N_LIBRARY)
+else(ICU_INCLUDE_DIR AND ICU_LIBRARY)
+ set(ICU_FOUND 0)
+ set(ICU_I18N_FOUND 0)
+ set(ICU_LIBRARIES)
+ set(ICU_I18N_LIBRARIES)
+ set(ICU_INCLUDE_DIRS)
+ set(ICU_VERSION)
+ set(ICU_MAJOR_VERSION)
+ set(ICU_MINOR_VERSION)
+endif(ICU_INCLUDE_DIR AND ICU_LIBRARY)
+
+IF(ICU_FOUND)
+ IF( NOT ICU_FIND_QUIETLY )
+ MESSAGE( STATUS "Found ICU header files in ${ICU_INCLUDE_DIRS}")
+ MESSAGE( STATUS "Found ICU libraries: ${ICU_LIBRARIES}")
+ ENDIF( NOT ICU_FIND_QUIETLY )
+ELSE(ICU_FOUND)
+ IF(ICU_FIND_REQUIRED)
+ MESSAGE( FATAL_ERROR "Could not find ICU" )
+ ELSE(ICU_FIND_REQUIRED)
+ MESSAGE( STATUS "Optional package ICU was not found" )
+ ENDIF(ICU_FIND_REQUIRED)
+ENDIF(ICU_FOUND)
+
View
36 CMake/FindLibAfdt.cmake
@@ -0,0 +1,36 @@
+# - Find LibAfdt (a cross platform RPC lib/tool)
+# This module defines
+# LibAfdt_INCLUDE_DIR, where to find LibAfdt headers
+# LibAfdt_LIBS, LibAfdt libraries
+# LibAfdt_FOUND, If false, do not try to use LibAfdt
+
+find_path(LibAfdt_INCLUDE_DIR afdt.h PATHS
+ /usr/local/include
+ /opt/local/include
+ )
+
+set(LibAfdt_LIB_PATHS /usr/local/lib /opt/local/lib)
+find_library(LibAfdt_LIB NAMES afdt PATHS ${LibAfdt_LIB_PATHS})
+
+if (LibAfdt_LIB AND LibAfdt_INCLUDE_DIR)
+ set(LibAfdt_FOUND TRUE)
+ set(LibAfdt_LIBS ${LibAfdt_LIB})
+else ()
+ set(LibAfdt_FOUND FALSE)
+endif ()
+
+if (LibAfdt_FOUND)
+ if (NOT LibAfdt_FIND_QUIETLY)
+ message(STATUS "Found libafdt: ${LibAfdt_LIBS}")
+ endif ()
+else ()
+ if (LibAfdt_FIND_REQUIRED)
+ message(FATAL_ERROR "Could NOT find libafdt.")
+ endif ()
+ message(STATUS "libafdt NOT found.")
+endif ()
+
+mark_as_advanced(
+ LibAfdt_LIB
+ LibAfdt_INCLUDE_DIR
+ )
View
36 CMake/FindLibCh.cmake
@@ -0,0 +1,36 @@
+# - Find LibCh (a cross platform RPC lib/tool)
+# This module defines
+# LibCh_INCLUDE_DIR, where to find LibCh headers
+# LibCh_LIBS, LibCh libraries
+# LibCh_FOUND, If false, do not try to use LibCh
+
+find_path(LibCh_INCLUDE_DIR ch/continuum.h PATHS
+ /usr/local/include
+ /opt/local/include
+ )
+
+set(LibCh_LIB_PATHS /usr/local/lib /opt/local/lib)
+find_library(LibCh_LIB NAMES ch PATHS ${LibCh_LIB_PATHS})
+
+if (LibCh_LIB AND LibCh_INCLUDE_DIR)
+ set(LibCh_FOUND TRUE)
+ set(LibCh_LIBS ${LibCh_LIB})
+else ()
+ set(LibCh_FOUND FALSE)
+endif ()
+
+if (LibCh_FOUND)
+ if (NOT LibCh_FIND_QUIETLY)
+ message(STATUS "Found libCh: ${LibCh_LIBS}")
+ endif ()
+else ()
+ if (LibCh_FIND_REQUIRED)
+ message(FATAL_ERROR "Could NOT find libch library.")
+ endif ()
+ message(STATUS "libCh NOT found.")
+endif ()
+
+mark_as_advanced(
+ LibCh_LIB
+ LibCh_INCLUDE_DIR
+ )
View
37 CMake/FindLibEvent.cmake
@@ -0,0 +1,37 @@
+# - Find LibEvent (a cross event library)
+# This module defines
+# LIBEVENT_INCLUDE_DIR, where to find LibEvent headers
+# LIBEVENT_LIB, LibEvent libraries
+# LibEvent_FOUND, If false, do not try to use libevent
+
+set(LibEvent_EXTRA_PREFIXES /usr/local /opt/local "$ENV{HOME}")
+foreach(prefix ${LibEvent_EXTRA_PREFIXES})
+ list(APPEND LibEvent_INCLUDE_PATHS "${prefix}/include")
+ list(APPEND LibEvent_LIB_PATHS "${prefix}/lib")
+endforeach()
+
+find_path(LIBEVENT_INCLUDE_DIR event.h PATHS ${LibEvent_INCLUDE_PATHS})
+find_library(LIBEVENT_LIB NAMES event PATHS ${LibEvent_LIB_PATHS})
+
+if (LIBEVENT_LIB AND LIBEVENT_INCLUDE_DIR)
+ set(LibEvent_FOUND TRUE)
+ set(LIBEVENT_LIB ${LIBEVENT_LIB})
+else ()
+ set(LibEvent_FOUND FALSE)
+endif ()
+
+if (LibEvent_FOUND)
+ if (NOT LibEvent_FIND_QUIETLY)
+ message(STATUS "Found libevent: ${LIBEVENT_LIB}")
+ endif ()
+else ()
+ if (LibEvent_FIND_REQUIRED)
+ message(FATAL_ERROR "Could NOT find libevent.")
+ endif ()
+ message(STATUS "libevent NOT found.")
+endif ()
+
+mark_as_advanced(
+ LIBEVENT_LIB
+ LIBEVENT_INCLUDE_DIR
+ )
View
36 CMake/FindLibEvent.cmake.bak
@@ -0,0 +1,36 @@
+# - Find LibEvent (a cross platform RPC lib/tool)
+# This module defines
+# LibEvent_INCLUDE_DIR, where to find LibEvent headers
+# LibEvent_LIBS, LibEvent libraries
+# LibEvent_FOUND, If false, do not try to use ant
+
+find_path(LibEvent_INCLUDE_DIR event.h PATHS
+ /usr/local/include
+ /opt/local/include
+ )
+
+set(LibEvent_LIB_PATHS /usr/local/lib /opt/local/lib)
+find_library(LibEvent_LIB NAMES event PATHS ${LibEvent_LIB_PATHS})
+
+if (LibEvent_LIB AND LibEvent_INCLUDE_DIR)
+ set(LibEvent_FOUND TRUE)
+ set(LibEvent_LIB ${LibEvent_LIB})
+else ()
+ set(LibEvent_FOUND FALSE)
+endif ()
+
+if (LibEvent_FOUND)
+ if (NOT LibEvent_FIND_QUIETLY)
+ message(STATUS "Found libevent: ${LibEvent_LIB}")
+ endif ()
+else (LibEvent_FOUND)
+ if (LibEvent_FIND_REQUIRED)
+ message(FATAL_ERROR "Could NOT find libevent library.")
+ endif (LibEvent_FIND_REQUIRED)
+ message(STATUS "libevent NOT found.")
+endif (LibEvent_FOUND)
+
+mark_as_advanced(
+ LibEvent_LIB
+ LibEvent_INCLUDE_DIR
+ )
View
39 CMake/FindMcrypt.cmake
@@ -0,0 +1,39 @@
+# - Find Mcrypt (a cross platform RPC lib/tool)
+# This module defines
+# Mcrypt_INCLUDE_DIR, where to find Mcrypt headers
+# Mcrypt_LIBS, Mcrypt libraries
+# Mcrypt_FOUND, If false, do not try to use Mcrypt
+
+find_path(Mcrypt_INCLUDE_DIR mcrypt.h PATHS
+ /usr/local/include
+ /opt/local/include
+ )
+
+
+#find_library can't seem to find a 64-bit binary if the 32-bit isn't there
+
+set(Mcrypt_LIB_PATHS /usr/local/lib /opt/local/lib /usr/lib64)
+find_library(Mcrypt_LIB NAMES mcrypt PATHS ${Mcrypt_LIB_PATHS})
+
+if (Mcrypt_LIB AND Mcrypt_INCLUDE_DIR)
+ set(Mcrypt_FOUND TRUE)
+ set(Mcrypt_LIBS ${Mcrypt_LIB})
+else ()
+ set(Mcrypt_FOUND FALSE)
+endif ()
+
+if (Mcrypt_FOUND)
+ if (NOT Mcrypt_FIND_QUIETLY)
+ message(STATUS "Found mcrypt: ${Mcrypt_LIBS}")
+ endif ()
+else ()
+ if (Mcrypt_FIND_REQUIRED)
+ message(FATAL_ERROR "Could NOT find mcrypt library.")
+ endif ()
+ message(STATUS "mcrypt NOT found.")
+endif ()
+
+mark_as_advanced(
+ Mcrypt_LIB
+ Mcrypt_INCLUDE_DIR
+ )
View
114 CMake/FindMySQL.cmake
@@ -0,0 +1,114 @@
+#--------------------------------------------------------
+# Copyright (C) 1995-2007 MySQL AB
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of version 2 of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# There are special exceptions to the terms and conditions of the GPL
+# as it is applied to this software. View the full text of the exception
+# in file LICENSE.exceptions in the top-level directory of this software
+# distribution.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# The MySQL Connector/ODBC is licensed under the terms of the
+# GPL, like most MySQL Connectors. There are special exceptions
+# to the terms and conditions of the GPL as it is applied to
+# this software, see the FLOSS License Exception available on
+# mysql.com.
+
+##########################################################################
+
+
+#-------------- FIND MYSQL_INCLUDE_DIR ------------------
+FIND_PATH(MYSQL_INCLUDE_DIR mysql.h
+ $ENV{MYSQL_INCLUDE_DIR}
+ $ENV{MYSQL_DIR}/include
+ /usr/include/mysql
+ /usr/local/include/mysql
+ /opt/mysql/mysql/include
+ /opt/mysql/mysql/include/mysql
+ /usr/local/mysql/include
+ /usr/local/mysql/include/mysql
+ $ENV{ProgramFiles}/MySQL/*/include
+ $ENV{SystemDrive}/MySQL/*/include)
+
+#----------------- FIND MYSQL_LIB_DIR -------------------
+IF (WIN32)
+ # Set lib path suffixes
+ # dist = for mysql binary distributions
+ # build = for custom built tree
+ IF (CMAKE_BUILD_TYPE STREQUAL Debug)
+ SET(libsuffixDist debug)
+ SET(libsuffixBuild Debug)
+ ELSE (CMAKE_BUILD_TYPE STREQUAL Debug)
+ SET(libsuffixDist opt)
+ SET(libsuffixBuild Release)
+ ADD_DEFINITIONS(-DDBUG_OFF)
+ ENDIF (CMAKE_BUILD_TYPE STREQUAL Debug)
+
+ FIND_LIBRARY(MYSQL_LIB NAMES mysqlclient
+ PATHS
+ $ENV{MYSQL_DIR}/lib/${libsuffixDist}
+ $ENV{MYSQL_DIR}/libmysql
+ $ENV{MYSQL_DIR}/libmysql/${libsuffixBuild}
+ $ENV{MYSQL_DIR}/client/${libsuffixBuild}
+ $ENV{MYSQL_DIR}/libmysql/${libsuffixBuild}
+ $ENV{ProgramFiles}/MySQL/*/lib/${libsuffixDist}
+ $ENV{SystemDrive}/MySQL/*/lib/${libsuffixDist})
+ELSE (WIN32)
+ FIND_LIBRARY(MYSQL_LIB NAMES mysqlclient_r
+ PATHS
+ $ENV{MYSQL_DIR}/libmysql_r/.libs
+ $ENV{MYSQL_DIR}/lib
+ $ENV{MYSQL_DIR}/lib/mysql
+ /usr/lib/mysql
+ /usr/local/lib/mysql
+ /usr/local/mysql/lib
+ /usr/local/mysql/lib/mysql
+ /opt/mysql/mysql/lib
+ /opt/mysql/mysql/lib/mysql)
+ENDIF (WIN32)
+
+IF(MYSQL_LIB)
+ GET_FILENAME_COMPONENT(MYSQL_LIB_DIR ${MYSQL_LIB} PATH)
+ENDIF(MYSQL_LIB)
+
+IF (MYSQL_INCLUDE_DIR AND MYSQL_LIB_DIR)
+ SET(MYSQL_FOUND TRUE)
+
+ INCLUDE_DIRECTORIES(${MYSQL_INCLUDE_DIR})
+ LINK_DIRECTORIES(${MYSQL_LIB_DIR})
+
+ FIND_LIBRARY(MYSQL_ZLIB zlib PATHS ${MYSQL_LIB_DIR})
+ FIND_LIBRARY(MYSQL_YASSL yassl PATHS ${MYSQL_LIB_DIR})
+ FIND_LIBRARY(MYSQL_TAOCRYPT taocrypt PATHS ${MYSQL_LIB_DIR})
+ SET(MYSQL_CLIENT_LIBS mysqlclient)
+ IF (MYSQL_ZLIB)
+ SET(MYSQL_CLIENT_LIBS ${MYSQL_CLIENT_LIBS} zlib)
+ ENDIF (MYSQL_ZLIB)
+ IF (MYSQL_YASSL)
+ SET(MYSQL_CLIENT_LIBS ${MYSQL_CLIENT_LIBS} yassl)
+ ENDIF (MYSQL_YASSL)
+ IF (MYSQL_TAOCRYPT)
+ SET(MYSQL_CLIENT_LIBS ${MYSQL_CLIENT_LIBS} taocrypt)
+ ENDIF (MYSQL_TAOCRYPT)
+ # Added needed mysqlclient dependencies on Windows
+ IF (WIN32)
+ SET(MYSQL_CLIENT_LIBS ${MYSQL_CLIENT_LIBS} ws2_32)
+ ENDIF (WIN32)
+
+ MESSAGE(STATUS "MySQL Include dir: ${MYSQL_INCLUDE_DIR} library dir: ${MYSQL_LIB_DIR}")
+ MESSAGE(STATUS "MySQL client libraries: ${MYSQL_CLIENT_LIBS}")
+ELSE (MYSQL_INCLUDE_DIR AND MYSQL_LIB_DIR)
+ MESSAGE(FATAL_ERROR "Cannot find MySQL. Include dir: ${MYSQL_INCLUDE_DIR} library dir: ${MYSQL_LIB_DIR}")
+ENDIF (MYSQL_INCLUDE_DIR AND MYSQL_LIB_DIR)
+
View
35 CMake/FindPCRE.cmake
@@ -0,0 +1,35 @@
+#
+# $Id$
+#
+# - Find pcre
+# Find the native PCRE includes and library
+#
+# PCRE_INCLUDE_DIRS - where to find pcre.h, etc.
+# PCRE_LIBRARIES - List of libraries when using pcre.
+# PCRE_FOUND - True if pcre found.
+
+
+IF (PCRE_INCLUDE_DIRS)
+ # Already in cache, be silent
+ SET(PCRE_FIND_QUIETLY TRUE)
+ENDIF (PCRE_INCLUDE_DIRS)
+
+FIND_PATH(PCRE_INCLUDE_DIR pcre.h)
+
+SET(PCRE_NAMES pcre)
+FIND_LIBRARY(PCRE_LIBRARY NAMES ${PCRE_NAMES} )
+
+# handle the QUIETLY and REQUIRED arguments and set PCRE_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE DEFAULT_MSG PCRE_LIBRARY PCRE_INCLUDE_DIR)
+
+IF(PCRE_FOUND)
+ SET( PCRE_LIBRARIES ${PCRE_LIBRARY} )
+ SET( PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIR} )
+ELSE(PCRE_FOUND)
+ SET( PCRE_LIBRARIES )
+ SET( PCRE_INCLUDE_DIRS )
+ENDIF(PCRE_FOUND)
+
+MARK_AS_ADVANCED( PCRE_LIBRARIES PCRE_INCLUDE_DIRS )
View
56 CMake/FindSqlite3.cmake
@@ -0,0 +1,56 @@
+# - find Sqlite 3
+# SQLITE3_INCLUDE_DIR - Where to find Sqlite 3 header files (directory)
+# SQLITE3_LIBRARIES - Sqlite 3 libraries
+# SQLITE3_LIBRARY_RELEASE - Where the release library is
+# SQLITE3_LIBRARY_DEBUG - Where the debug library is
+# SQLITE3_FOUND - Set to TRUE if we found everything (library, includes and executable)
+
+# Copyright (c) 2010 Pau Garcia i Quiles, <pgquiles@elpauer.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+#
+# Generated by CModuler, a CMake Module Generator - http://gitorious.org/cmoduler
+
+IF( SQLITE3_INCLUDE_DIR AND SQLITE3_LIBRARY_RELEASE AND SQLITE3_LIBRARY_DEBUG )
+ SET(SQLITE3_FIND_QUIETLY TRUE)
+ENDIF( SQLITE3_INCLUDE_DIR AND SQLITE3_LIBRARY_RELEASE AND SQLITE3_LIBRARY_DEBUG )
+
+FIND_PATH( SQLITE3_INCLUDE_DIR sqlite3.h )
+
+FIND_LIBRARY(SQLITE3_LIBRARY_RELEASE NAMES sqlite3 )
+
+FIND_LIBRARY(SQLITE3_LIBRARY_DEBUG NAMES sqlite3 sqlite3d HINTS /usr/lib/debug/usr/lib/ )
+
+IF( SQLITE3_LIBRARY_RELEASE OR SQLITE3_LIBRARY_DEBUG AND SQLITE3_INCLUDE_DIR )
+ SET( SQLITE3_FOUND TRUE )
+ENDIF( SQLITE3_LIBRARY_RELEASE OR SQLITE3_LIBRARY_DEBUG AND SQLITE3_INCLUDE_DIR )
+
+IF( SQLITE3_LIBRARY_DEBUG AND SQLITE3_LIBRARY_RELEASE )
+ # if the generator supports configuration types then set
+ # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value
+ IF( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
+ SET( SQLITE3_LIBRARIES optimized ${SQLITE3_LIBRARY_RELEASE} debug ${SQLITE3_LIBRARY_DEBUG} )
+ ELSE( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
+ # if there are no configuration types and CMAKE_BUILD_TYPE has no value
+ # then just use the release libraries
+ SET( SQLITE3_LIBRARIES ${SQLITE3_LIBRARY_RELEASE} )
+ ENDIF( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
+ELSEIF( SQLITE3_LIBRARY_RELEASE )
+ SET( SQLITE3_LIBRARIES ${SQLITE3_LIBRARY_RELEASE} )
+ELSE( SQLITE3_LIBRARY_DEBUG AND SQLITE3_LIBRARY_RELEASE )
+ SET( SQLITE3_LIBRARIES ${SQLITE3_LIBRARY_DEBUG} )
+ENDIF( SQLITE3_LIBRARY_DEBUG AND SQLITE3_LIBRARY_RELEASE )
+
+IF( SQLITE3_FOUND )
+ IF( NOT SQLITE3_FIND_QUIETLY )
+ MESSAGE( STATUS "Found Sqlite3 header file in ${SQLITE3_INCLUDE_DIR}")
+ MESSAGE( STATUS "Found Sqlite3 libraries: ${SQLITE3_LIBRARIES}")
+ ENDIF( NOT SQLITE3_FIND_QUIETLY )
+ELSE(SQLITE3_FOUND)
+ IF( SQLITE3_FIND_REQUIRED)
+ MESSAGE( FATAL_ERROR "Could not find Sqlite3" )
+ ELSE( SQLITE3_FIND_REQUIRED)
+ MESSAGE( STATUS "Optional package Sqlite3 was not found" )
+ ENDIF( SQLITE3_FIND_REQUIRED)
+ENDIF(SQLITE3_FOUND)
View
192 CMake/FindTBB.cmake
@@ -0,0 +1,192 @@
+# Locate Intel Threading Building Blocks include paths and libraries
+# TBB can be found at http://www.threadingbuildingblocks.org/
+# Written by Hannes Hofmann, hannes.hofmann _at_ informatik.uni-erlangen.de
+# Adapted by Gino van den Bergen gino _at_ dtecta.com
+
+# GvdB: This module uses the environment variable TBB_ARCH_PLATFORM which defines architecture and compiler.
+# e.g. "ia32/vc8" or "em64t/cc4.1.0_libc2.4_kernel2.6.16.21"
+# TBB_ARCH_PLATFORM is set by the build script tbbvars[.bat|.sh|.csh], which can be found
+# in the TBB installation directory (TBB_INSTALL_DIR).
+#
+# For backwards compatibility, you may explicitely set the CMake variables TBB_ARCHITECTURE and TBB_COMPILER.
+# TBB_ARCHITECTURE [ ia32 | em64t | itanium ]
+# which architecture to use
+# TBB_COMPILER e.g. vc9 or cc3.2.3_libc2.3.2_kernel2.4.21 or cc4.0.1_os10.4.9
+# which compiler to use (detected automatically on Windows)
+
+# This module respects
+# TBB_INSTALL_DIR or $ENV{TBB21_INSTALL_DIR} or $ENV{TBB_INSTALL_DIR}
+
+# This module defines
+# TBB_INCLUDE_DIRS, where to find task_scheduler_init.h, etc.
+# TBB_LIBRARY_DIRS, where to find libtbb, libtbbmalloc
+# TBB_INSTALL_DIR, the base TBB install directory
+# TBB_LIBRARIES, the libraries to link against to use TBB.
+# TBB_DEBUG_LIBRARIES, the libraries to link against to use TBB with debug symbols.
+# TBB_FOUND, If false, don't try to use TBB.
+
+
+if (WIN32)
+ # has em64t/vc8 em64t/vc9
+ # has ia32/vc7.1 ia32/vc8 ia32/vc9
+ set(_TBB_DEFAULT_INSTALL_DIR "C:/Program Files/Intel/TBB" "C:/Program Files (x86)/Intel/TBB")
+ set(_TBB_LIB_NAME "tbb")
+ set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
+ set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
+ set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")
+ if (MSVC71)
+ set (_TBB_COMPILER "vc7.1")
+ endif(MSVC71)
+ if (MSVC80)
+ set(_TBB_COMPILER "vc8")
+ endif(MSVC80)
+ if (MSVC90)
+ set(_TBB_COMPILER "vc9")
+ endif(MSVC90)
+ if (NOT _TBB_COMPILER)
+ message("ERROR: TBB supports only VC 7.1, 8 and 9 compilers on Windows platforms.")
+ endif (NOT _TBB_COMPILER)
+ set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
+endif (WIN32)
+
+if (UNIX)
+ if (APPLE)
+ # MAC
+ set(_TBB_DEFAULT_INSTALL_DIR "/Library/Frameworks/Intel_TBB.framework/Versions")
+ # libs: libtbb.dylib, libtbbmalloc.dylib, *_debug
+ set(_TBB_LIB_NAME "tbb")
+ set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
+ set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
+ set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")
+ # has only one flavor: ia32/cc4.0.1_os10.4.9
+ set(_TBB_COMPILER "cc4.0.1_os10.4.9")
+ set(_TBB_ARCHITECTURE "ia32")
+ else (APPLE)
+ # LINUX
+ set(_TBB_DEFAULT_INSTALL_DIR "/opt/intel/tbb" "/usr/local/include" "/usr/include")
+ set(_TBB_LIB_NAME "tbb")
+ set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
+ set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
+ set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")
+ # has em64t/cc3.2.3_libc2.3.2_kernel2.4.21 em64t/cc3.3.3_libc2.3.3_kernel2.6.5 em64t/cc3.4.3_libc2.3.4_kernel2.6.9 em64t/cc4.1.0_libc2.4_kernel2.6.16.21
+ # has ia32/*
+ # has itanium/*
+ set(_TBB_COMPILER ${TBB_COMPILER})
+ set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE})
+ endif (APPLE)
+endif (UNIX)
+
+if (CMAKE_SYSTEM MATCHES "SunOS.*")
+# SUN
+# not yet supported
+# has em64t/cc3.4.3_kernel5.10
+# has ia32/*
+endif (CMAKE_SYSTEM MATCHES "SunOS.*")
+
+
+#-- Clear the public variables
+set (TBB_FOUND "NO")
+
+
+#-- Find TBB install dir and set ${_TBB_INSTALL_DIR} and cached ${TBB_INSTALL_DIR}
+# first: use CMake variable TBB_INSTALL_DIR
+if (TBB_INSTALL_DIR)
+ set (_TBB_INSTALL_DIR ${TBB_INSTALL_DIR})
+endif (TBB_INSTALL_DIR)
+# second: use environment variable
+if (NOT _TBB_INSTALL_DIR)
+ if (NOT "$ENV{TBB_INSTALL_DIR}" STREQUAL "")
+ set (_TBB_INSTALL_DIR $ENV{TBB_INSTALL_DIR})
+ endif (NOT "$ENV{TBB_INSTALL_DIR}" STREQUAL "")
+ # Intel recommends setting TBB21_INSTALL_DIR
+ if (NOT "$ENV{TBB21_INSTALL_DIR}" STREQUAL "")
+ set (_TBB_INSTALL_DIR $ENV{TBB21_INSTALL_DIR})
+ endif (NOT "$ENV{TBB21_INSTALL_DIR}" STREQUAL "")
+endif (NOT _TBB_INSTALL_DIR)
+# third: try to find path automatically
+if (NOT _TBB_INSTALL_DIR)
+ if (_TBB_DEFAULT_INSTALL_DIR)
+ set (_TBB_INSTALL_DIR $ENV{_TBB_DEFAULT_INSTALL_DIR})
+ endif (_TBB_DEFAULT_INSTALL_DIR)
+endif (NOT _TBB_INSTALL_DIR)
+# sanity check
+if (NOT _TBB_INSTALL_DIR)
+ message ("ERROR: Unable to find Intel TBB install directory. ${_TBB_INSTALL_DIR}")
+else (NOT _TBB_INSTALL_DIR)
+# finally: set the cached CMake variable TBB_INSTALL_DIR
+if (NOT TBB_INSTALL_DIR)
+ set (TBB_INSTALL_DIR ${_TBB_INSTALL_DIR} CACHE PATH "Intel TBB install directory")
+ mark_as_advanced(TBB_INSTALL_DIR)
+endif (NOT TBB_INSTALL_DIR)
+
+
+#-- A macro to rewrite the paths of the library. This is necessary, because
+# find_library() always found the em64t/vc9 version of the TBB libs
+macro(TBB_CORRECT_LIB_DIR var_name)
+# if (NOT "${_TBB_ARCHITECTURE}" STREQUAL "em64t")
+ string(REPLACE em64t "${_TBB_ARCHITECTURE}" ${var_name} ${${var_name}})
+# endif (NOT "${_TBB_ARCHITECTURE}" STREQUAL "em64t")
+ string(REPLACE ia32 "${_TBB_ARCHITECTURE}" ${var_name} ${${var_name}})
+ string(REPLACE vc7.1 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
+ string(REPLACE vc8 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
+ string(REPLACE vc9 "${_TBB_COMPILER}" ${var_name} ${${var_name}})
+endmacro(TBB_CORRECT_LIB_DIR var_content)
+
+
+#-- Look for include directory and set ${TBB_INCLUDE_DIR}
+set (TBB_INC_SEARCH_DIR ${_TBB_INSTALL_DIR}/include)
+find_path(TBB_INCLUDE_DIR
+ tbb/task_scheduler_init.h
+ PATHS ${TBB_INC_SEARCH_DIR}
+)
+mark_as_advanced(TBB_INCLUDE_DIR)
+
+
+#-- Look for libraries
+# GvdB: $ENV{TBB_ARCH_PLATFORM} is set by the build script tbbvars[.bat|.sh|.csh]
+if (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "")
+ set (TBB_LIBRARY_DIR "${_TBB_INSTALL_DIR}/$ENV{TBB_ARCH_PLATFORM}/lib")
+else (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "")
+ # HH: deprecated
+ message(STATUS "[Warning] FindTBB.cmake: The use of TBB_ARCHITECTURE and TBB_COMPILER is deprecated and may not be supported in future versions. Please set $ENV{TBB_ARCH_PLATFORM} (using tbbvars.[bat|csh|sh]).")
+ set (TBB_LIBRARY_DIR "${_TBB_INSTALL_DIR}/${_TBB_ARCHITECTURE}/${_TBB_COMPILER}/lib")
+endif (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "")
+
+
+find_library(TBB_LIBRARY ${_TBB_LIB_NAME} ${TBB_LIBRARY_DIR} NO_DEFAULT_PATH)
+find_library(TBB_MALLOC_LIBRARY ${_TBB_LIB_MALLOC_NAME} ${TBB_LIBRARY_DIR} NO_DEFAULT_PATH)
+#TBB_CORRECT_LIB_DIR(TBB_LIBRARY)
+#TBB_CORRECT_LIB_DIR(TBB_MALLOC_LIBRARY)
+mark_as_advanced(TBB_LIBRARY TBB_MALLOC_LIBRARY)
+
+#-- Look for debug libraries
+find_library(TBB_LIBRARY_DEBUG ${_TBB_LIB_DEBUG_NAME} ${TBB_LIBRARY_DIR} NO_DEFAULT_PATH)
+find_library(TBB_MALLOC_LIBRARY_DEBUG ${_TBB_LIB_MALLOC_DEBUG_NAME} ${TBB_LIBRARY_DIR} NO_DEFAULT_PATH)
+#TBB_CORRECT_LIB_DIR(TBB_LIBRARY_DEBUG)
+#TBB_CORRECT_LIB_DIR(TBB_MALLOC_LIBRARY_DEBUG)
+mark_as_advanced(TBB_LIBRARY_DEBUG TBB_MALLOC_LIBRARY_DEBUG)
+
+
+if (TBB_INCLUDE_DIR)
+ if (TBB_LIBRARY)
+ set (TBB_FOUND "YES")
+ set (TBB_LIBRARIES ${TBB_LIBRARY} ${TBB_MALLOC_LIBRARY} ${TBB_LIBRARIES})
+ set (TBB_DEBUG_LIBRARIES ${TBB_LIBRARY_DEBUG} ${TBB_MALLOC_LIBRARY_DEBUG} ${TBB_DEBUG_LIBRARIES})
+ set (TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR} CACHE PATH "TBB include directory" FORCE)
+ set (TBB_LIBRARY_DIRS ${TBB_LIBRARY_DIR} CACHE PATH "TBB library directory" FORCE)
+ mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARY_DIRS TBB_LIBRARIES TBB_DEBUG_LIBRARIES)
+ message(STATUS "Found Intel TBB")
+ endif (TBB_LIBRARY)
+endif (TBB_INCLUDE_DIR)
+
+if (NOT TBB_FOUND)
+ message("ERROR: Intel TBB NOT found!")
+ message(STATUS "Looked for Threading Building Blocks in ${_TBB_INSTALL_DIR}")
+ # do only throw fatal, if this pkg is REQUIRED
+ if (TBB_FIND_REQUIRED)
+ message(FATAL_ERROR "Could NOT find TBB library.")
+ endif (TBB_FIND_REQUIRED)
+endif (NOT TBB_FOUND)
+
+endif (NOT _TBB_INSTALL_DIR)
+
View
170 CMake/HPHPFindLibs.cmake
@@ -0,0 +1,170 @@
+#
+# +----------------------------------------------------------------------+
+# | HipHop for PHP |
+# +----------------------------------------------------------------------+
+# | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) |
+# | Copyright (c) 1997-2010 The PHP Group |
+# +----------------------------------------------------------------------+
+# | This source file is subject to version 3.01 of the PHP license, |
+# | that is bundled with this package in the file LICENSE, and is |
+# | available through the world-wide-web at the following url: |
+# | http://www.php.net/license/3_01.txt |
+# | If you did not receive a copy of the PHP license and are unable to |
+# | obtain it through the world-wide-web, please send a note to |
+# | license@php.net so we can mail you a copy immediately. |
+# +----------------------------------------------------------------------+
+#
+
+# boost checks
+
+find_package(Boost 1.37.0 COMPONENTS system;program_options;filesystem REQUIRED)
+include_directories(${Boost_INCLUDE_DIRS})
+link_directories(${Boost_LIBRARY_DIRS})
+
+# mysql checks
+find_package(MySQL REQUIRED)
+include_directories(${MYSQL_INCLUDE_DIR})
+link_directories(${MYSQL_LIB_DIR})
+
+# pcre checks
+find_package(PCRE REQUIRED)
+
+# libevent checks
+find_package(LibEvent REQUIRED)
+include_directories(${LIBEVENT_INCLUDE_DIR})
+
+set(CMAKE_REQUIRED_LIBRARIES "${LIBEVENT_LIB}")
+CHECK_FUNCTION_EXISTS("evhttp_bind_socket_with_fd" HAVE_CUSTOM_LIBEVENT)
+if (NOT HAVE_CUSTOM_LIBEVENT)
+ message(SEND_ERROR "Custom libevent is required with HipHop patches")
+endif ()
+set(CMAKE_REQUIRED_LIBRARIES)
+
+# libafdt checks
+#find_package(LibAfdt REQUIRED)
+#include_directories(${LibAfdt_INCLUDE_DIR})
+
+# GD checks
+find_package(GD REQUIRED)
+
+option(WANT_FB_LIBMCC "want FB Memcache" 0)
+option(WANT_FB_LIBFML "want FB libfbml" 0)
+
+if (WANT_FB_LIBMCC)
+ add_definitions(-DHPHP_WITH_LIBMCC)
+ message(FATAL_ERROR Need to add libmcc and libch for linking)
+else ()
+ # nothing for now
+endif()
+
+if (WANT_FB_LIBFBML)
+ message(FATAL_ERROR Need to find the mozilla stuff for linking)
+else ()
+ # nothing for now
+endif()
+
+# CURL checks
+find_package(CURL REQUIRED)
+include_directories(${CURL_INCLUDE_DIR})
+
+set(CMAKE_REQUIRED_LIBRARIES "${CURL_LIBRARIES}")
+CHECK_FUNCTION_EXISTS("curl_multi_select" HAVE_CUSTOM_CURL)
+if (NOT HAVE_CUSTOM_CURL)
+ message(SEND_ERROR "Custom libcurl is required with HipHop patches ${HAVE_CUSTOM_CURL}")
+endif ()
+set(CMAKE_REQUIRED_LIBRARIES)
+
+# LibXML2 checks
+find_package(LibXml2 REQUIRED)
+include_directories(${LIBXML2_INCLUDE_DIR})
+add_definitions(${LIBXML2_DEFINITIONS})
+
+# SQLite3 + timelib are bundled in HPHP sources
+include_directories("${HPHP_HOME}/src/third_party/libsqlite3")
+include_directories("${HPHP_HOME}/src/third_party/timelib")
+include_directories("${HPHP_HOME}/src/third_party/xhp/xhp")
+include_directories("${HPHP_HOME}/src/third_party/libafdt/src")
+include_directories("${HPHP_HOME}/src/third_party/mbfl/mbfl")
+include_directories("${HPHP_HOME}/src/third_party/mbfl/filter")
+
+# ICU
+
+find_package(ICU REQUIRED)
+if (ICU_FOUND)
+ if (ICU_VERSION VERSION_LESS "4.2")
+ message(SEND_ERROR "ICU is too old, found ${ICU_VERSION} and we need 4.2")
+ endif (ICU_VERSION VERSION_LESS "4.2")
+ include_directories(${ICU_INCLUDE_DIRS})
+endif (ICU_FOUND)
+
+# (google heap OR cpu profiler) AND libunwind
+
+# Google tmalloc
+
+# xhplibs
+
+
+# tbb libs
+find_package(TBB REQUIRED)
+include_directories(${TBB_INCLUDE_DIRS})
+link_directories(${TBB_LIBRARY_DIRS})
+
+# mcrypt libs
+find_package(Mcrypt REQUIRED)
+include_directories(${Mcrypt_INCLUDE_DIR})
+
+# OpenSSL libs
+find_package(OpenSSL REQUIRED)
+include_directories(${OPENSSL_INCLUDE_DIR})
+
+# ZLIB
+find_package(ZLIB REQUIRED)
+include_directories(${ZLIB_INCLUDE_DIR})
+
+#oniguruma
+FIND_LIBRARY(ONIG_LIB onig)
+#FIND_LIBRARY(MBFL_LIB mbfl)
+
+#LINK_LIBS = -lpthread $(BFD_LIBS) -lrt -lstdc++ -lresolv
+#-lcrypto -lcrypt
+
+
+FIND_LIBRARY (CAP_LIB cap)
+
+# potentially make it look in a different directory for the google apps
+FIND_LIBRARY (BFD_LIB bfd)
+FIND_LIBRARY (BINUTIL_LIB iberty)
+FIND_LIBRARY (DL_LIB dl)
+
+
+include_directories(${HPHP_HOME}/src)
+include_directories(${HPHP_HOME}/src/lib/system/gen)
+
+macro(hphp_link target)
+ target_link_libraries(${target} ${Boost_LIBRARIES})
+ target_link_libraries(${target} ${MYSQL_CLIENT_LIBS})
+ target_link_libraries(${target} ${PCRE_LIBRARY})
+ target_link_libraries(${target} ${ICU_LIBRARIES} ${ICU_I18N_LIBRARIES})
+ target_link_libraries(${target} ${LIBEVENT_LIB})
+ target_link_libraries(${target} ${CURL_LIBRARIES})
+
+ target_link_libraries(${target} ${CAP_LIB})
+ target_link_libraries(${target} ${BFD_LIB})
+ target_link_libraries(${target} ${BINUTIL_LIB})
+ target_link_libraries(${target} ${DL_LIB})
+ target_link_libraries(${target} pthread)
+ target_link_libraries(${target} ${TBB_LIBRARIES})
+ target_link_libraries(${target} ${OPENSSL_LIBRARIES})
+ target_link_libraries(${target} ${ZLIB_LIBRARIES})
+
+ target_link_libraries(${target} timelib)
+ target_link_libraries(${target} sqlite3)
+ target_link_libraries(${target} xhp)
+ target_link_libraries(${target} afdt)
+ target_link_libraries(${target} mbfl)
+ target_link_libraries(${target} ${LIBXML2_LIBRARIES})
+ target_link_libraries(${target} ${ONIG_LIB})
+ target_link_libraries(${target} ${Mcrypt_LIB})
+ target_link_libraries(${target} ${GD_LIBRARY})
+ #target_link_libraries(${target} ${MBFL_LIB})
+endmacro()
View
32 CMake/HPHPFunctions.cmake
@@ -0,0 +1,32 @@
+function(auto_sources RETURN_VALUE PATTERN SOURCE_SUBDIRS)
+
+ if ("${SOURCE_SUBDIRS}" STREQUAL "RECURSE")
+ SET(PATH ".")
+ if (${ARGC} EQUAL 4)
+ list(GET ARGV 3 PATH)
+ endif (${ARGC} EQUAL 4)
+ endif("${SOURCE_SUBDIRS}" STREQUAL "RECURSE")
+
+ if ("${SOURCE_SUBDIRS}" STREQUAL "RECURSE")
+
+ file(GLOB_RECURSE ${RETURN_VALUE} "${PATH}/${PATTERN}")
+
+ else ("${SOURCE_SUBDIRS}" STREQUAL "RECURSE")
+
+ file(GLOB ${RETURN_VALUE} "${PATTERN}")
+
+ foreach (PATH ${SOURCE_SUBDIRS})
+ file(GLOB SUBDIR_FILES "${PATH}/${PATTERN}")
+ list(APPEND ${RETURN_VALUE} ${SUBDIR_FILES})
+ endforeach(PATH ${SOURCE_SUBDIRS})
+
+ endif ("${SOURCE_SUBDIRS}" STREQUAL "RECURSE")
+
+ if (${FILTER_OUT})
+ list(REMOVE_ITEM ${RETURN_VALUE} ${FILTER_OUT})
+ endif(${FILTER_OUT})
+
+ set(${RETURN_VALUE} ${${RETURN_VALUE}} PARENT_SCOPE)
+
+endfunction(auto_sources)
+
View
20 CMake/HPHPSetup.cmake
@@ -0,0 +1,20 @@
+include(HPHPFunctions)
+include(HPHPFindLibs)
+
+OPTION(INFINITE_LOOP_DETECTION "Enable Infinite Loop Detection" ON)
+OPTION(INFINITE_RECURSION_DETECTION "Enable Infinite Recursion Detection" ON)
+OPTION(REQUEST_TIMEOUT_DETECTION "Enable Timeout Detection" ON)
+
+add_definitions(-D_GNU_SOURCE -D_REENTRANT=1 -D_PTHREADS=1)
+
+set(CMAKE_C_FLAGS "-w -fPIC")
+set(CMAKE_CXX_FLAGS "-fPIC -fno-omit-frame-pointer -ftemplate-depth-60 -Wall -Woverloaded-virtual -Wno-deprecated -Wno-parentheses -Wno-strict-aliasing -Wno-write-strings ")
+
+IF(0)
+ set(HPHP_OPT "-O3")
+ add_definitions(-DRELEASE=1)
+ENDIF()
+
+
+include_directories(${HPHP_HOME}/src)
+include_directories(${HPHP_HOME}/src/lib/system/gen)
View
16 CMakeLists.txt
@@ -0,0 +1,16 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)
+PROJECT(hphp C CXX)
+
+IF("$ENV{HPHP_HOME}" STREQUAL "")
+ message(FATAL_ERROR "You should set the HPHP_HOME environmental")
+ENDIF()
+
+file(TO_CMAKE_PATH "$ENV{HPHP_HOME}" HPHP_HOME)
+
+SET(CMAKE_MODULE_PATH "${HPHP_HOME}/CMake" ${CMAKE_MODULE_PATH})
+
+include("${HPHP_HOME}/CMake/HPHPFunctions.cmake")
+include(CheckFunctionExists)
+
+add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src)
+
View
60 bin/CMakeLists.base.txt
@@ -0,0 +1,60 @@
+#
+# +----------------------------------------------------------------------+
+# | HipHop for PHP |
+# +----------------------------------------------------------------------+
+# | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) |
+# | Copyright (c) 1997-2010 The PHP Group |
+# +----------------------------------------------------------------------+
+# | This source file is subject to version 3.01 of the PHP license, |
+# | that is bundled with this package in the file LICENSE, and is |
+# | available through the world-wide-web at the following url: |
+# | http://www.php.net/license/3_01.txt |
+# | If you did not receive a copy of the PHP license and are unable to |
+# | obtain it through the world-wide-web, please send a note to |
+# | license@php.net so we can mail you a copy immediately. |
+# +----------------------------------------------------------------------+
+#
+
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)
+PROJECT(hphp C CXX)
+
+IF("$ENV{HPHP_HOME}" STREQUAL "")
+ message(FATAL_ERROR "You should set the HPHP_HOME environmental")
+ENDIF()
+
+file(TO_CMAKE_PATH "$ENV{HPHP_HOME}" HPHP_HOME)
+
+SET(CMAKE_MODULE_PATH "${HPHP_HOME}/CMake" ${CMAKE_MODULE_PATH})
+
+include(HPHPFunctions)
+include(CheckFunctionExists)
+include(HPHPSetup)
+
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+
+auto_sources(SOURCES "*.cpp" "RECURSE" "${CMAKE_CURRENT_SOURCE_DIR}/php")
+auto_sources(SOURCES2 "*.cpp" "RECURSE" "${CMAKE_CURRENT_SOURCE_DIR}/sys")
+add_executable(program ${SOURCES} ${SOURCES2})
+
+add_library(libhphp_runtime STATIC IMPORTED)
+SET_PROPERTY(TARGET libhphp_runtime PROPERTY IMPORTED_LOCATION "${HPHP_HOME}/bin/libhphp_runtime.a")
+
+add_library(timelib STATIC IMPORTED)
+SET_PROPERTY(TARGET timelib PROPERTY IMPORTED_LOCATION "${HPHP_HOME}/bin/libtimelib.a")
+
+add_library(sqlite3 STATIC IMPORTED)
+SET_PROPERTY(TARGET sqlite3 PROPERTY IMPORTED_LOCATION "${HPHP_HOME}/bin/libsqlite3.a")
+
+add_library(xhp STATIC IMPORTED)
+SET_PROPERTY(TARGET xhp PROPERTY IMPORTED_LOCATION "${HPHP_HOME}/bin/libxhp.a")
+
+add_library(afdt STATIC IMPORTED)
+SET_PROPERTY(TARGET afdt PROPERTY IMPORTED_LOCATION "${HPHP_HOME}/bin/libafdt.a")
+
+add_library(mbfl STATIC IMPORTED)
+SET_PROPERTY(TARGET mbfl PROPERTY IMPORTED_LOCATION "${HPHP_HOME}/bin/libmbfl.a")
+
+
+target_link_libraries(program libhphp_runtime)
+
+hphp_link(program)
View
12 bin/run.sh
@@ -2,9 +2,9 @@
#$1: output directory
#$2: program name
#$3: extra flags, for exmaple, RELEASE=1
-if [ ${#SHOW_COMPILE} -gt 0 ] ; then
- echo cp $HPHP_HOME/bin/run.mk $1/Makefile
- echo make -j $3 PROJECT_NAME=$2 TIME_LINK=1 -C $1
-fi
-cp $HPHP_HOME/bin/run.mk $1/Makefile
-make -j $3 PROJECT_NAME=$2 TIME_LINK=1 -C $1
+ #echo make -j $3 PROJECT_NAME=$2 TIME_LINK=1 -C $1
+cp $HPHP_HOME/bin/CMakeLists.base.txt $1/CMakeLists.txt
+cd $1
+cmake .
+make
+
View
114 src/CMakeLists.txt
@@ -0,0 +1,114 @@
+#
+# +----------------------------------------------------------------------+
+# | HipHop for PHP |
+# +----------------------------------------------------------------------+
+# | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) |
+# | Copyright (c) 1997-2010 The PHP Group |
+# +----------------------------------------------------------------------+
+# | This source file is subject to version 3.01 of the PHP license, |
+# | that is bundled with this package in the file LICENSE, and is |
+# | available through the world-wide-web at the following url: |
+# | http://www.php.net/license/3_01.txt |
+# | If you did not receive a copy of the PHP license and are unable to |
+# | obtain it through the world-wide-web, please send a note to |
+# | license@php.net so we can mail you a copy immediately. |
+# +----------------------------------------------------------------------+
+#
+
+include(HPHPSetup)
+
+# find all the source files
+set(RECURSIVE_SOURCE_SUBDIRS cpp/base cpp/eval cpp/ext lib/system/gen util)
+foreach (dir ${RECURSIVE_SOURCE_SUBDIRS})
+
+ auto_sources(files "*.no.cpp" "RECURSE" "${CMAKE_CURRENT_SOURCE_DIR}/${dir}")
+ list(APPEND CXX_NOOPT_SOURCES ${files})
+
+ auto_sources(files "*.cpp" "RECURSE" "${CMAKE_CURRENT_SOURCE_DIR}/${dir}")
+ list(APPEND CXX_SOURCES ${files})
+
+ auto_sources(files "*.c" "RECURSE" "${CMAKE_CURRENT_SOURCE_DIR}/${dir}")
+ list(APPEND C_SOURCES ${files})
+
+endforeach(dir ${RECURSIVE_SOURCE_SUBDIRS})
+
+if (EXISTS "${hphp_SOURCE_DIR}/HPHP_EXCLUDE_FILES.txt")
+ FILE(READ ${hphp_SOURCE_DIR}/HPHP_EXCLUDE_FILES.txt HPHP_EXCLUDE_FILES)
+ STRING(REGEX REPLACE "[\n\r]" ";" HPHP_EXCLUDE_FILES "${HPHP_EXCLUDE_FILES}")
+else ()
+ SET(HPHP_EXCLUDE_FILES)
+endif ()
+
+foreach (t ${HPHP_EXCLUDE_FILES})
+ string(SUBSTRING ${t} 0 1 T_FIRST_CHAR)
+ if (${T_FIRST_CHAR} STREQUAL "D")
+
+ string(REGEX REPLACE "^[D]" "" SKIP_DIR "${t}")
+ file(TO_CMAKE_PATH "${hphp_SOURCE_DIR}/${SKIP_DIR}" SKIP_DIR)
+ string(LENGTH "${SKIP_DIR}" SKIP_DIR_LENGTH)
+
+ message(STATUS "Let's remove ${SKIP_DIR}")
+
+ foreach (file ${CXX_SOURCES})
+ string(LENGTH "${file}" FILE_LENGTH)
+ if (${FILE_LENGTH} GREATER ${SKIP_DIR_LENGTH})
+ string(SUBSTRING ${file} 0 ${SKIP_DIR_LENGTH} FILE_PATH)
+ if (${FILE_PATH} STREQUAL ${SKIP_DIR})
+ list(REMOVE_ITEM CXX_SOURCES ${file})
+ endif ()
+ endif ()
+ endforeach(file ${CXX_SOURCES})
+
+ elseif (${T_FIRST_CHAR} STREQUAL "#")
+
+ # doing nothing since this is a comment
+
+ else ()
+ list(FIND CXX_SOURCES "${hphp_SOURCE_DIR}/${t}" FOUND_T)
+ if (FOUND_T GREATER -1)
+ LIST(REMOVE_AT CXX_SOURCES ${FOUND_T})
+ endif()
+ endif ()
+endforeach(t ${HPHP_EXCLUDE_FILES})
+
+#list(REMOVE_ITEM CXX_SOURCES "${CXX_NOOPT_SOURCES}")
+
+find_package(BISON REQUIRED)
+find_package(FLEX REQUIRED)
+
+FLEX_TARGET(HphpScanner ${CMAKE_CURRENT_SOURCE_DIR}/cpp/eval/parser/hphp.x ${CMAKE_CURRENT_SOURCE_DIR}/cpp/eval/parser/lex.eval_.cpp COMPILE_FLAGS " -w -i -Peval_")
+BISON_TARGET(HphpParser ${CMAKE_CURRENT_SOURCE_DIR}/cpp/eval/parser/hphp.y ${CMAKE_CURRENT_SOURCE_DIR}/cpp/eval/parser/hphp.tab.cpp COMPILE_FLAGS " -v -d -p eval_")
+ADD_FLEX_BISON_DEPENDENCY(HphpScanner HphpParser)
+
+# required to remove warning when a file is there twice
+list(REMOVE_ITEM CXX_SOURCES ${FLEX_HphpScanner_OUTPUTS} ${BISON_HphpParser_OUTPUTS})
+list(APPEND CXX_SOURCES ${FLEX_HphpScanner_OUTPUTS} ${BISON_HphpParser_OUTPUTS})
+
+#list(APPEND C_SOURCES ${TIMELIB_SOURCES})
+
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin")
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin")
+
+add_library(sqlite3 STATIC "${CMAKE_CURRENT_SOURCE_DIR}/third_party/libsqlite3/sqlite3.c")
+
+auto_sources(TIMELIB_SOURCES "*.c" "RECURSE" "${CMAKE_CURRENT_SOURCE_DIR}/third_party/timelib")
+add_library(timelib STATIC ${TIMELIB_SOURCES})
+
+add_subdirectory(third_party/xhp/xhp)
+add_subdirectory(third_party/libafdt)
+add_subdirectory(third_party/libmbfl)
+
+ADD_LIBRARY(hphp_runtime_static STATIC ${C_SOURCES} ${CXX_SOURCES})
+#ADD_LIBRARY(hphp_runtime SHARED ${C_SOURCES} ${CXX_SOURCES})
+SET_TARGET_PROPERTIES(hphp_runtime_static PROPERTIES OUTPUT_NAME "hphp_runtime")
+SET_TARGET_PROPERTIES(hphp_runtime_static PROPERTIES PREFIX "lib")
+#SET_TARGET_PROPERTIES(hphp_runtime PROPERTIES CLEAN_DIRECT_OUTPUT 1)
+SET_TARGET_PROPERTIES(hphp_runtime_static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
+
+hphp_link(hphp_runtime_static)
+
+add_subdirectory(lib)
+
+add_subdirectory(hphp)
+
+add_subdirectory(test)
View
138 src/cpp/base/externals.h
@@ -0,0 +1,138 @@
+/*
+ +----------------------------------------------------------------------+
+ | HipHop for PHP |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+*/
+
+#ifndef __CPP_BASE_EXTERNALS_H__
+#define __CPP_BASE_EXTERNALS_H__
+
+///////////////////////////////////////////////////////////////////////////////
+
+/**
+ * All external dependencies of cpp/base. This file may not include any
+ * generated file based on user code, as this file is included by some cpp/base
+ * .cpp files.
+ */
+
+#include <cpp/base/types.h>
+
+namespace HPHP {
+///////////////////////////////////////////////////////////////////////////////
+// global declarations that have generated implementations
+
+/**
+ * Invoking an arbitrary user-defined function.
+ */
+extern Variant invoke(const char *function, CArrRef params, int64 hash = -1,
+ bool tryInterp = true, bool fatal = true);
+
+/**
+ * Invoking an arbitrary system function. This is the fallback for invoke.
+ */
+extern Variant invoke_builtin(const char *s, const Array &params, int64 hash,
+ bool fatal);
+
+/**
+ * Invoking an arbitrary static method.
+ */
+extern Variant invoke_static_method(const char *s, const char *method,
+ const Array &params, bool fatal = true);
+/**
+ * Invoking an arbitrary system static method.
+ */
+extern Variant invoke_builtin_static_method(const char *s, const char *method,
+ const Array &params, bool fatal);
+/**
+ * Getting a static property
+ */
+extern Variant get_static_property(const char *s, const char *prop);
+extern Variant get_builtin_static_property(const char *s, const char *prop);
+extern Variant *get_static_property_lv(const char *s, const char *prop);
+extern Variant *get_builtin_static_property_lv(const char *s, const char *prop);
+
+/**
+ * Getting a constant
+ */
+extern Variant get_constant(CStrRef name);
+extern Variant get_builtin_constant(CStrRef name);
+
+/**
+ * Getting a class constant
+ */
+extern Variant get_class_constant(const char *s, const char *prop);
+extern Variant get_builtin_class_constant(const char *s, const char *prop);
+
+/**
+ * Class/function meta info entirely encoded here as a const char * array.
+ */
+extern const char *g_class_map[];
+extern const char *g_source_root;
+extern const char *g_source_info[];
+extern const char *g_source_cls2file[];
+extern const char *g_source_func2file[];
+extern const char *g_paramrtti_map[];
+
+/**
+ * Dynamically create an object.
+ */
+extern Object create_object(const char *s, const Array &params,
+ bool init = true, ObjectData *root = NULL);
+/**
+ * Dynamically create a system object.
+ */
+extern Object create_builtin_object(const char *s, const Array &params,
+ bool init = true, ObjectData *root = NULL);
+/**
+ * Dynamically include a file.
+ */
+class LVariableTable;
+extern Variant invoke_file(CStrRef file, bool once = false,
+ LVariableTable* variables = NULL,
+ const char *currentDir = NULL);
+
+/**
+ * Initializes constant strings and scalar arrays.
+ */
+extern void init_static_variables();
+
+/**
+ * Returns a thread local global variable class pointer.
+ */
+class GlobalVariables;
+extern GlobalVariables *get_global_variables();
+extern void init_global_variables();
+extern void free_global_variables();
+extern Array get_global_array_wrapper();
+extern void output_global_state(FILE *fp);
+
+/**
+ * Returns a thread local global variable table pointer.
+ */
+extern LVariableTable *get_variable_table();
+class Globals;
+extern Globals *get_globals();
+class SystemGlobals;
+extern SystemGlobals *get_system_globals();
+
+/**
+ * Precomputed literal strings
+ */
+extern StaticString literalStrings[];
+
+extern unsigned int *getRTTICounter(int id);
+
+///////////////////////////////////////////////////////////////////////////////
+}
+
+#endif // __CPP_BASE_HPHP_H__
View
3  src/cpp/ext/ext.h
@@ -29,9 +29,7 @@
#include <cpp/ext/profile/extprofile_datetime.h>
#include <cpp/ext/profile/extprofile_domdocument.h>
#include <cpp/ext/profile/extprofile_error.h>
-#include <cpp/ext/profile/extprofile_facebook.h>
#include <cpp/ext/profile/extprofile_fb.h>
-#include <cpp/ext/profile/extprofile_fbml.h>
#include <cpp/ext/profile/extprofile_file.h>
#include <cpp/ext/profile/extprofile_function.h>
#include <cpp/ext/profile/extprofile_hash.h>
@@ -55,7 +53,6 @@
#include <cpp/ext/profile/extprofile_options.h>
#include <cpp/ext/profile/extprofile_oracle.h>
#include <cpp/ext/profile/extprofile_output.h>
-#include <cpp/ext/profile/extprofile_php_mcc.h>
#include <cpp/ext/profile/extprofile_posix.h>
#include <cpp/ext/profile/extprofile_preg.h>
#include <cpp/ext/profile/extprofile_process.h>
View
20 src/cpp/ext/phpmcc/Makefile
@@ -1,20 +0,0 @@
-
-PROJECT_ROOT = ../../../..
-PROJECT_NAME = hphp_cpp_ext_phpmcc
-
-AUTO_SOURCES = 1
-ifdef HPHP_DEV
- SOURCE_SUBDIRS = release
-else
- SOURCE_SUBDIRS = beta
-endif
-
-include $(PROJECT_ROOT)/src/rules.mk
-
-ifdef MAC_OS_X
-TARGETS = $(STATIC_LIB)
-else
-TARGETS = $(STATIC_LIB) $(SHARED_LIB)
-endif
-
-all: $(TARGETS)
View
22 src/cpp/ext/phpmcc/ext_php_mcc.h
@@ -1,22 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | HipHop for PHP |
- +----------------------------------------------------------------------+
- | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) |
- | Copyright (c) 1997-2010 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
-*/
-// when building beta, should pick up the correct .h file.
-#if defined(HPHP_DEV)
-#include <cpp/ext/phpmcc/beta/ext_php_mcc.h>
-#else
-#include <cpp/ext/phpmcc/release/ext_php_mcc.h>
-#endif /* #if defined(HPHP_DEV) */
View
16 src/cpp/ext/phpmcc/release/Makefile
@@ -1,16 +0,0 @@
-
-PROJECT_ROOT = ../../../../..
-PROJECT_NAME = hphp_cpp_ext_phpmcc_release
-
-AUTO_SOURCES = 1
-SOURCE_SUBDIRS =
-
-include $(PROJECT_ROOT)/src/rules.mk
-
-ifdef MAC_OS_X
-TARGETS = $(STATIC_LIB)
-else
-TARGETS = $(STATIC_LIB) $(SHARED_LIB)
-endif
-
-all: $(TARGETS)
View
822 src/cpp/ext/phpmcc/release/accessors.cpp
@@ -1,822 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | HipHop for PHP |
- +----------------------------------------------------------------------+
- | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) |
- | Copyright (c) 1997-2010 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
-*/
-#include "constants.h"
-#include "types.h"
-
-using namespace HPHP;
-
-namespace HPHP {
-
-///////////////////////////////////////////////////////////////////////////////
-// properties
-
-///////////////////////////////////////////////////////////////////////////////
-// servers
-
-Array get_accesspoints(mcc_handle_t mcc, const nstring_t* server) {
- size_t naccesspoint;
- const nstring_t* accesspoints =
- mcc_server_get_accesspoints(mcc, server, &naccesspoint);
-
- Array aplist;
- if (accesspoints != NULL) {
- for (uint aix = 0; aix < naccesspoint; aix++) {
- aplist.append(String(accesspoints[aix].str, accesspoints[aix].len,
- CopyString));
- }
- mcc_server_free_accesspoint_list(mcc, accesspoints, naccesspoint);
- }
- return aplist;
-}
-
-Array get_serverpool_servers(mcc_handle_t mcc,
- const nstring_t* serverpool,
- bool is_mirror) {
- size_t nserver;
- const nstring_t* servers =
- mcc_serverpool_get_servers(mcc, serverpool, &nserver);
-
- Array slist = Array::Create();
- if (servers != NULL) {
- for (uint six = 0; six < nserver; six++) {
- Variant aplist = get_accesspoints(mcc, &servers[six]);
- if (is_mirror && aplist.isNull()) {
- continue;
- }
- slist.set(String(servers[six].str, servers[six].len, CopyString),
- aplist);
- }
- mcc_serverpool_free_server_list(mcc, servers, nserver);
- }
- return slist;
-}
-
-static Array get_serverpools(mcc_handle_t mcc, bool is_mirror) {
- size_t nserverpool;
- const nstring_t* serverpools = mcc_get_serverpools(mcc, &nserverpool);
-
- Array splist;
- if (serverpools != NULL) {
- for (uint spix = 0; spix < nserverpool; spix++) {
- Array slist = get_serverpool_servers(mcc, &serverpools[spix], is_mirror);
- splist.set(String(serverpools[spix].str, serverpools[spix].len,
- CopyString), slist);
- }
- mcc_free_serverpool_list(mcc, serverpools, nserverpool);
- }
- return splist;
-}
-
-static Array get_mirror_cfg(MccResourcePtr &phpmcc) {
- Array mlist = Array::Create();
- for (MirrorIt mirror = phpmcc->m_mirror_mccs.begin();
- mirror != phpmcc->m_mirror_mccs.end(); ++mirror) {
- Array mirror_cfg;
- mirror_cfg.set(PHPMCC_ARG_MIRROR_CFG_NAME, String((*mirror)->m_name));
- mirror_cfg.set(PHPMCC_ARG_MIRROR_CFG_MODEL, (*mirror)->m_model);
- Variant serverpools;
- if (!(serverpools = get_serverpools((*mirror)->m_mcc, 1)).isNull()) {
- mirror_cfg.set(PHPMCC_ARG_MIRROR_CFG_SERVERPOOLS, serverpools);
- }
- mlist.append(mirror_cfg);
- }
- return mlist;
-}
-
-/* XXX revert to bool once support for libch 2.0.0 is dropped. */
-/**
- * Presently, the consistent hashing prefixes array stores a flag corresponding
- * to the last digit of the port on which the corresponding memcached instance
- * is running. This flag is decoded as:
- * 0: inconsistent hashing
- * 1: consistent hashing v2
- * 2: consistent hashing v3
- */
-static Array get_consistent_hashing_prefixes(MccResourcePtr &phpmcc) {
- size_t nserverpool;
- const nstring_t* serverpools =
- mcc_get_serverpools(phpmcc->m_mcc, &nserverpool);
-
- Array splist = Array::Create();
- if (serverpools != NULL) {
- for (uint spix = 0; spix < nserverpool; spix++) {
- const nstring_t* const pool_name = &serverpools[spix];
- uint8_t version = mcc_serverpool_get_consistent_hashing_version
- (phpmcc->m_mcc, pool_name);
- if (version != 0) {
- /* Translates from version to version flag. */
- splist.set(String(serverpools[spix].str, serverpools[spix].len,
- CopyString), (int64)(version - 1));
- }
- }
- mcc_free_serverpool_list(phpmcc->m_mcc, serverpools, nserverpool);
- }
- return splist;
-}
-
-static void phpmcc_get_compression_threshold(MccResourcePtr &phpmcc,
- Variant& retval) {
- retval = (int64)phpmcc->m_compression_threshold;
-}
-
-static void phpmcc_set_compression_threshold(MccResourcePtr &phpmcc,
- CVarRef value) {
- if (value.isInteger()) {
- phpmcc->m_compression_threshold = (size_t)value.toInt64();
- } else if (value.is(KindOfBoolean)) {
- phpmcc->m_compression_threshold = value ? 1 : 0;
- }
-}
-
-static void phpmcc_get_nzlib_compression(MccResourcePtr &phpmcc,
- Variant& retval) {
- retval = (int64)phpmcc->m_nzlib_compression;
-}
-
-static void phpmcc_set_nzlib_compression(MccResourcePtr &phpmcc,
- CVarRef value) {
- if (value.isInteger()) {
- phpmcc->m_nzlib_compression = value;
- } else if (value.is(KindOfBoolean)) {
- phpmcc->m_nzlib_compression = value.toBoolean() ? 1 : 0 ;
- }
-}
-
-static void phpmcc_get_conn_tmo(MccResourcePtr &phpmcc, Variant& retval) {
- retval = (int64)mcc_get_conn_tmo(phpmcc->m_mcc);
-}
-
-static void phpmcc_set_conn_tmo(MccResourcePtr &phpmcc, CVarRef value) {
- if (value.isInteger()) {
- int64 tmo = value;
-
- mcc_set_conn_tmo(phpmcc->m_mcc, tmo);
-
- /* propagate to mirrors */
- for (MirrorIt mirror = phpmcc->m_mirror_mccs.begin();
- mirror != phpmcc->m_mirror_mccs.end(); ++mirror) {
- mcc_set_conn_tmo((*mirror)->m_mcc, tmo);
- }
- }
-}
-
-static void phpmcc_get_conn_ntries(MccResourcePtr &phpmcc, Variant& retval) {
- retval = (int64)mcc_get_conn_ntries(phpmcc->m_mcc);
-}
-
-static void phpmcc_set_conn_ntries(MccResourcePtr &phpmcc, CVarRef value) {
- if (value.isInteger()) {
- int64 ntries = value;
-
- mcc_set_conn_ntries(phpmcc->m_mcc, ntries);
-
- /* propagate to mirrors */
- for (MirrorIt mirror = phpmcc->m_mirror_mccs.begin();
- mirror != phpmcc->m_mirror_mccs.end(); ++mirror) {
- mcc_set_conn_ntries((*mirror)->m_mcc, ntries);
- }
- }
-}
-
-#if defined(HAVE_DEBUG_LOG)
-static void phpmcc_get_debug(MccResourcePtr &phpmcc, Variant& retval) {
- retval = mcc_get_debug(phpmcc->m_mcc));
-}
-
-static void phpmcc_set_debug(MccResourcePtr &phpmcc, CVarRef value) {
- if (value.isInteger()) {
- mcc_set_debug(phpmcc->m_mcc, value);
- }
-}
-
-static void phpmcc_get_debug_logfile(MccResourcePtr &phpmcc, Variant& retval) {
- const nstring_t* result = mcc_get_debug_logfile(phpmcc->m_mcc);
- if (result != NULL) {
- retval = String(result->str, result->len, CopyString);
- } else {
- retval = null;
- }
-}
-
-static void phpmcc_set_debug_logfile(MccResourcePtr &phpmcc, CVarRef value) {
- nstring_t svalue;
- phpstring_to_nstring(svalue, value);
- mcc_set_debug_logfile(phpmcc->m_mcc, &svalue);
-}
-#endif /* defined(HAVE_DEBUG_LOG) */
-
-static void phpmcc_get_delproxy(MccResourcePtr &phpmcc, Variant& retval) {
- const nstring_t* proxy;
- if ((proxy = mcc_get_delproxy(phpmcc->m_mcc)) == NULL) {
- retval = null;
- } else {
- Variant accesspoints;
- String prox(proxy->str, proxy->len, CopyString);
- accesspoints = get_accesspoints(phpmcc->m_mcc,
- proxy);
- if (!accesspoints.isNull()) {
- retval.set(prox, accesspoints);
- } else {
- retval.set(prox, null);
- }
- }
-}
-
-static void phpmcc_set_delproxy(MccResourcePtr &phpmcc, CVarRef value) {
- nstring_t host;
- nstring_t default_port =
- NSTRING_CONST(const_cast<char*>("PHPMCC_PROXY_PORT_DEFAULT"));
- nstring_t port;
-
- phpstring_to_nstring(host, value.toString());
-
- port.len = 0;
- port.str = (char*)memchr(host.str, ':', host.len);
-
- if (port.str != NULL) {
- port.str++;
- port.len = host.str + host.len - port.str;
- host.len-= port.len + 1;
- }
- if (port.len == 0) {
- port = default_port;
- }
- if (mcc_set_delproxy(phpmcc->m_mcc, &host, &port) != NULL) {
- phpmcc->m_proxy_ops = mcc_get_proxy_ops(phpmcc->m_mcc);
- } else {
- phpmcc->m_proxy_ops = 0;
- }
-}
-
-static void phpmcc_get_default_serverpool(MccResourcePtr &phpmcc,
- Variant& retval) {
- const nstring_t* name = mcc_get_default_serverpool(phpmcc->m_mcc);
- if (name != NULL) {
- retval = String(name->str, name->len, CopyString);
- } else {
- retval = null;
- }
-}
-
-static void phpmcc_set_default_serverpool(MccResourcePtr &phpmcc,
- CVarRef value) {
- nstring_t name;
- phpstring_to_nstring(name, value);
-
- mcc_set_default_serverpool(phpmcc->m_mcc, &name);
- for (MirrorIt mirror = phpmcc->m_mirror_mccs.begin();
- mirror != phpmcc->m_mirror_mccs.end(); ++mirror) {
- mcc_set_default_serverpool((*mirror)->m_mcc, &name);
- }
-}
-
-static void phpmcc_get_dgram_ntries(MccResourcePtr &phpmcc, Variant& retval) {
- retval = (int64)mcc_get_dgram_ntries(phpmcc->m_mcc);
-}
-
-static void phpmcc_set_dgram_ntries(MccResourcePtr &phpmcc, CVarRef value) {
- if (value.isInteger()) {
- int64 ntries = value;
-
- mcc_set_dgram_ntries(phpmcc->m_mcc, ntries);
-
- /* propagate to mirrors */
- for (MirrorIt mirror = phpmcc->m_mirror_mccs.begin();
- mirror != phpmcc->m_mirror_mccs.end(); ++mirror) {
- mcc_set_dgram_ntries((*mirror)->m_mcc, ntries);
- }
- }
-}
-
-static void phpmcc_get_dgram_tmo_weight(MccResourcePtr &phpmcc,
- Variant& retval) {
- retval = mcc_get_dgram_tmo_weight(phpmcc->m_mcc);
-}
-
-static void phpmcc_set_dgram_tmo_weight(MccResourcePtr &phpmcc,
- CVarRef value) {
- double tmo_weight = 0;
-
- if (value.is(KindOfDouble)) {
- tmo_weight = value.toDouble();
- } else if (value.isInteger()) {
- tmo_weight = (double)value.toInt64();
- } else {
- return;
- }
-
- mcc_set_dgram_tmo_weight(phpmcc->m_mcc, tmo_weight);
- /* propagate to mirrors */
- for (MirrorIt mirror = phpmcc->m_mirror_mccs.begin();
- mirror != phpmcc->m_mirror_mccs.end(); ++mirror) {
- mcc_set_dgram_tmo_weight((*mirror)->m_mcc, tmo_weight);
- }
-}
-
-static void phpmcc_get_fb_serialize_enabled(MccResourcePtr &phpmcc,
- Variant& retval) {
- retval = phpmcc->m_fb_serialize_enabled;
-}
-
-static void phpmcc_set_fb_serialize_enabled(MccResourcePtr &phpmcc,
- CVarRef value) {
- if (value.is(KindOfBoolean)) {
- phpmcc->m_fb_serialize_enabled = value.toBoolean();
- } else if (value.isInteger()) {
- phpmcc->m_fb_serialize_enabled = value.toInt64() != 0;
- }
-}
-
-static void phpmcc_get_name(MccResourcePtr &phpmcc, Variant& retval) {
- retval = String(phpmcc->m_name);
-}
-
-static void phpmcc_get_nodelay(MccResourcePtr &phpmcc, Variant& retval) {
- retval = mcc_get_nodelay(phpmcc->m_mcc);
-}
-
-static void phpmcc_set_nodelay(MccResourcePtr &phpmcc, CVarRef value) {
- if (value.is(KindOfBoolean)) {
- mcc_set_nodelay(phpmcc->m_mcc, value.toBoolean());
- } else if (value.isInteger()) {
- mcc_set_nodelay(phpmcc->m_mcc, value.toInt64() != 0);
- }
-}
-
-static void phpmcc_get_persistent(MccResourcePtr &phpmcc,
- Variant& retval) {
- retval = phpmcc->m_persistent;
-}
-
-static void phpmcc_get_poll_tmo(MccResourcePtr &phpmcc,
- Variant& retval) {
- retval = (int64)mcc_get_poll_tmo(phpmcc->m_mcc);
-}
-
-static void phpmcc_set_poll_tmo(MccResourcePtr &phpmcc, CVarRef value) {
- if (value.isInteger()) {
- mcc_set_poll_tmo(phpmcc->m_mcc, value.toInt64());
- }
-}
-
-static void phpmcc_get_proxy(MccResourcePtr &phpmcc, Variant& retval) {
- const nstring_t* proxy;
-
- if ((proxy = mcc_get_proxy(phpmcc->m_mcc)) == NULL) {
- retval = null;
- } else {
- Array accesspoints;
- accesspoints = get_accesspoints(phpmcc->m_mcc, proxy);
- String s(proxy->str, proxy->len, CopyString);
- if (!accesspoints.empty()) {
- retval.set(s, accesspoints);
- } else {
- retval.set(s, null);
- }
- }
-}
-
-static void phpmcc_set_proxy(MccResourcePtr &phpmcc, CVarRef value) {
- nstring_t host;
- nstring_t default_port =
- NSTRING_CONST(const_cast<char*>("PHPMCC_PROXY_PORT_DEFAULT"));
- nstring_t port;
-
- phpstring_to_nstring(host, value);
-
- port.len = 0;
- port.str = (char*)memchr(host.str, ':', host.len);
-
- if (port.str != NULL) {
- port.str++;
- port.len = host.str + host.len - port.str;
- host.len-= port.len + 1;
- }
- if (port.len == 0) {
- port = default_port;
- }
- if (mcc_set_proxy(phpmcc->m_mcc, &host, &port,
- (mcc_proxy_op_t)(mcc_proxy_delete_op | mcc_proxy_arith_op))
- != NULL) {
- phpmcc->m_proxy_ops = mcc_get_proxy_ops(phpmcc->m_mcc);
- } else {
- phpmcc->m_proxy_ops = 0;
- }
-}
-
-static void phpmcc_get_proxy_ops(MccResourcePtr &phpmcc, Variant& retval) {
- retval = mcc_get_proxy_ops(phpmcc->m_mcc);
-}
-
-static void phpmcc_set_proxy_ops(MccResourcePtr &phpmcc, CVarRef value) {
- if (value.isInteger()) {
- phpmcc->m_proxy_ops = (mcc_proxy_op_t)value.toInt64();
- mcc_set_proxy_ops(phpmcc->m_mcc, (mcc_proxy_op_t)value.toInt64());
- }
-}
-
-static void phpmcc_get_server_retry_tmo(MccResourcePtr &phpmcc,
- Variant& retval) {
- retval = (int64)mcc_get_server_retry_tmo(phpmcc->m_mcc);
-}
-
-static void phpmcc_set_server_retry_tmo(MccResourcePtr &phpmcc,
- CVarRef value) {
- if (value.isInteger()) {
- int64 tmo = value.toInt64();
- mcc_set_server_retry_tmo(phpmcc->m_mcc, tmo);
-
- /* propagate to mirrors */
- for (MirrorIt mirror = phpmcc->m_mirror_mccs.begin();
- mirror != phpmcc->m_mirror_mccs.end(); ++mirror) {
- mcc_set_server_retry_tmo((*mirror)->m_mcc, tmo);
- }
- }
-}
-
-static void phpmcc_get_dgram_tmo_threshold(MccResourcePtr &phpmcc,
- Variant& retval) {