prestogres 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (393) hide show
  1. data/.gitignore +4 -0
  2. data/Gemfile +2 -0
  3. data/Gemfile.lock +20 -0
  4. data/LICENSE +202 -0
  5. data/NOTICE +22 -0
  6. data/README.md +217 -0
  7. data/Rakefile +13 -0
  8. data/VERSION +1 -0
  9. data/bin/prestogres +254 -0
  10. data/config/pcp.conf.sample +28 -0
  11. data/config/pgpool.conf +678 -0
  12. data/config/pool_hba.conf +84 -0
  13. data/config/pool_passwd +0 -0
  14. data/config/postgresql.conf +2 -0
  15. data/ext/.gitignore +6 -0
  16. data/ext/depend +26 -0
  17. data/ext/extconf.rb +4 -0
  18. data/ext/prestogres_config.c +12 -0
  19. data/pgpool2/.gitignore +36 -0
  20. data/pgpool2/AUTHORS +4 -0
  21. data/pgpool2/COPYING +12 -0
  22. data/pgpool2/ChangeLog +1 -0
  23. data/pgpool2/INSTALL +1 -0
  24. data/pgpool2/Makefile.am +159 -0
  25. data/pgpool2/Makefile.in +1187 -0
  26. data/pgpool2/NEWS +4960 -0
  27. data/pgpool2/README +1 -0
  28. data/pgpool2/README.euc_jp +1 -0
  29. data/pgpool2/README.online-recovery +62 -0
  30. data/pgpool2/TODO +103 -0
  31. data/pgpool2/ac_func_accept_argtypes.m4 +85 -0
  32. data/pgpool2/aclocal.m4 +1088 -0
  33. data/pgpool2/c-compiler.m4 +134 -0
  34. data/pgpool2/c-library.m4 +325 -0
  35. data/pgpool2/child.c +2097 -0
  36. data/pgpool2/config.guess +1532 -0
  37. data/pgpool2/config.h.in +332 -0
  38. data/pgpool2/config.sub +1640 -0
  39. data/pgpool2/configure +15752 -0
  40. data/pgpool2/configure.in +392 -0
  41. data/pgpool2/depcomp +522 -0
  42. data/pgpool2/doc/basebackup.sh +17 -0
  43. data/pgpool2/doc/pgpool-de.html +4220 -0
  44. data/pgpool2/doc/pgpool-en.html +5738 -0
  45. data/pgpool2/doc/pgpool-fr.html +4118 -0
  46. data/pgpool2/doc/pgpool-ja.css +198 -0
  47. data/pgpool2/doc/pgpool-ja.html +11279 -0
  48. data/pgpool2/doc/pgpool-zh_cn.html +4445 -0
  49. data/pgpool2/doc/pgpool.css +280 -0
  50. data/pgpool2/doc/pgpool_remote_start +13 -0
  51. data/pgpool2/doc/recovery.conf.sample +117 -0
  52. data/pgpool2/doc/tutorial-en.html +707 -0
  53. data/pgpool2/doc/tutorial-ja.html +422 -0
  54. data/pgpool2/doc/tutorial-memqcache-en.html +325 -0
  55. data/pgpool2/doc/tutorial-memqcache-ja.html +370 -0
  56. data/pgpool2/doc/tutorial-memqcache-zh_cn.html +322 -0
  57. data/pgpool2/doc/tutorial-watchdog-en.html +306 -0
  58. data/pgpool2/doc/tutorial-watchdog-ja.html +343 -0
  59. data/pgpool2/doc/tutorial-watchdog-zh_cn.html +301 -0
  60. data/pgpool2/doc/tutorial-zh_cn.html +537 -0
  61. data/pgpool2/doc/watchdog.png +0 -0
  62. data/pgpool2/doc/wd-en.html +236 -0
  63. data/pgpool2/doc/wd-en.jpg +0 -0
  64. data/pgpool2/doc/wd-ja.html +219 -0
  65. data/pgpool2/doc/wd-ja.jpg +0 -0
  66. data/pgpool2/doc/wd-zh_cn.html +201 -0
  67. data/pgpool2/doc/where_to_send_queries.odg +0 -0
  68. data/pgpool2/doc/where_to_send_queries.pdf +0 -0
  69. data/pgpool2/general.m4 +166 -0
  70. data/pgpool2/getopt_long.c +200 -0
  71. data/pgpool2/getopt_long.h +44 -0
  72. data/pgpool2/install-sh +251 -0
  73. data/pgpool2/ltmain.sh +8406 -0
  74. data/pgpool2/m4/libtool.m4 +7360 -0
  75. data/pgpool2/m4/ltoptions.m4 +368 -0
  76. data/pgpool2/m4/ltsugar.m4 +123 -0
  77. data/pgpool2/m4/ltversion.m4 +23 -0
  78. data/pgpool2/m4/lt~obsolete.m4 +92 -0
  79. data/pgpool2/main.c +2971 -0
  80. data/pgpool2/md5.c +444 -0
  81. data/pgpool2/md5.h +28 -0
  82. data/pgpool2/missing +360 -0
  83. data/pgpool2/mkinstalldirs +40 -0
  84. data/pgpool2/parser/Makefile.am +50 -0
  85. data/pgpool2/parser/Makefile.in +559 -0
  86. data/pgpool2/parser/copyfuncs.c +3310 -0
  87. data/pgpool2/parser/gram.c +39100 -0
  88. data/pgpool2/parser/gram.h +940 -0
  89. data/pgpool2/parser/gram.y +13408 -0
  90. data/pgpool2/parser/gramparse.h +74 -0
  91. data/pgpool2/parser/keywords.c +32 -0
  92. data/pgpool2/parser/keywords.h +39 -0
  93. data/pgpool2/parser/kwlist.h +425 -0
  94. data/pgpool2/parser/kwlookup.c +88 -0
  95. data/pgpool2/parser/list.c +1156 -0
  96. data/pgpool2/parser/makefuncs.c +518 -0
  97. data/pgpool2/parser/makefuncs.h +83 -0
  98. data/pgpool2/parser/memnodes.h +79 -0
  99. data/pgpool2/parser/nodes.c +29 -0
  100. data/pgpool2/parser/nodes.h +609 -0
  101. data/pgpool2/parser/outfuncs.c +5790 -0
  102. data/pgpool2/parser/parsenodes.h +2615 -0
  103. data/pgpool2/parser/parser.c +262 -0
  104. data/pgpool2/parser/parser.h +46 -0
  105. data/pgpool2/parser/pg_class.h +158 -0
  106. data/pgpool2/parser/pg_config_manual.h +273 -0
  107. data/pgpool2/parser/pg_list.h +352 -0
  108. data/pgpool2/parser/pg_trigger.h +147 -0
  109. data/pgpool2/parser/pg_wchar.h +492 -0
  110. data/pgpool2/parser/pool_memory.c +342 -0
  111. data/pgpool2/parser/pool_memory.h +77 -0
  112. data/pgpool2/parser/pool_parser.h +222 -0
  113. data/pgpool2/parser/pool_string.c +121 -0
  114. data/pgpool2/parser/pool_string.h +37 -0
  115. data/pgpool2/parser/primnodes.h +1280 -0
  116. data/pgpool2/parser/scan.c +4094 -0
  117. data/pgpool2/parser/scan.l +1451 -0
  118. data/pgpool2/parser/scanner.h +120 -0
  119. data/pgpool2/parser/scansup.c +221 -0
  120. data/pgpool2/parser/scansup.h +28 -0
  121. data/pgpool2/parser/snprintf.c +1102 -0
  122. data/pgpool2/parser/stringinfo.c +294 -0
  123. data/pgpool2/parser/stringinfo.h +178 -0
  124. data/pgpool2/parser/value.c +78 -0
  125. data/pgpool2/parser/value.h +62 -0
  126. data/pgpool2/parser/wchar.c +2048 -0
  127. data/pgpool2/pcp.conf.sample +28 -0
  128. data/pgpool2/pcp/Makefile.am +40 -0
  129. data/pgpool2/pcp/Makefile.in +771 -0
  130. data/pgpool2/pcp/libpcp_ext.h +250 -0
  131. data/pgpool2/pcp/md5.c +444 -0
  132. data/pgpool2/pcp/md5.h +28 -0
  133. data/pgpool2/pcp/pcp.c +1652 -0
  134. data/pgpool2/pcp/pcp.h +61 -0
  135. data/pgpool2/pcp/pcp_attach_node.c +172 -0
  136. data/pgpool2/pcp/pcp_detach_node.c +185 -0
  137. data/pgpool2/pcp/pcp_error.c +87 -0
  138. data/pgpool2/pcp/pcp_node_count.c +160 -0
  139. data/pgpool2/pcp/pcp_node_info.c +198 -0
  140. data/pgpool2/pcp/pcp_pool_status.c +166 -0
  141. data/pgpool2/pcp/pcp_proc_count.c +166 -0
  142. data/pgpool2/pcp/pcp_proc_info.c +261 -0
  143. data/pgpool2/pcp/pcp_promote_node.c +185 -0
  144. data/pgpool2/pcp/pcp_recovery_node.c +172 -0
  145. data/pgpool2/pcp/pcp_stop_pgpool.c +179 -0
  146. data/pgpool2/pcp/pcp_stream.c +385 -0
  147. data/pgpool2/pcp/pcp_stream.h +52 -0
  148. data/pgpool2/pcp/pcp_systemdb_info.c +194 -0
  149. data/pgpool2/pcp/pcp_watchdog_info.c +211 -0
  150. data/pgpool2/pcp_child.c +1493 -0
  151. data/pgpool2/pg_md5.c +305 -0
  152. data/pgpool2/pgpool.8.in +121 -0
  153. data/pgpool2/pgpool.conf +553 -0
  154. data/pgpool2/pgpool.conf.sample +666 -0
  155. data/pgpool2/pgpool.conf.sample-master-slave +665 -0
  156. data/pgpool2/pgpool.conf.sample-replication +664 -0
  157. data/pgpool2/pgpool.conf.sample-stream +664 -0
  158. data/pgpool2/pgpool.spec +264 -0
  159. data/pgpool2/pgpool_adm/TODO +7 -0
  160. data/pgpool2/pgpool_adm/pgpool_adm--1.0.sql +85 -0
  161. data/pgpool2/pgpool_adm/pgpool_adm.c +558 -0
  162. data/pgpool2/pgpool_adm/pgpool_adm.control +5 -0
  163. data/pgpool2/pgpool_adm/pgpool_adm.h +46 -0
  164. data/pgpool2/pgpool_adm/pgpool_adm.sql.in +85 -0
  165. data/pgpool2/pool.h +655 -0
  166. data/pgpool2/pool_auth.c +1390 -0
  167. data/pgpool2/pool_config.c +5007 -0
  168. data/pgpool2/pool_config.h +284 -0
  169. data/pgpool2/pool_config.l +3281 -0
  170. data/pgpool2/pool_config_md5.c +29 -0
  171. data/pgpool2/pool_connection_pool.c +812 -0
  172. data/pgpool2/pool_error.c +242 -0
  173. data/pgpool2/pool_globals.c +27 -0
  174. data/pgpool2/pool_hba.c +1723 -0
  175. data/pgpool2/pool_hba.conf.sample +67 -0
  176. data/pgpool2/pool_ip.c +567 -0
  177. data/pgpool2/pool_ip.h +65 -0
  178. data/pgpool2/pool_ipc.h +38 -0
  179. data/pgpool2/pool_lobj.c +242 -0
  180. data/pgpool2/pool_lobj.h +32 -0
  181. data/pgpool2/pool_memqcache.c +3818 -0
  182. data/pgpool2/pool_memqcache.h +268 -0
  183. data/pgpool2/pool_params.c +163 -0
  184. data/pgpool2/pool_passwd.c +249 -0
  185. data/pgpool2/pool_passwd.h +41 -0
  186. data/pgpool2/pool_path.c +193 -0
  187. data/pgpool2/pool_path.h +81 -0
  188. data/pgpool2/pool_process_context.c +247 -0
  189. data/pgpool2/pool_process_context.h +62 -0
  190. data/pgpool2/pool_process_query.c +5001 -0
  191. data/pgpool2/pool_process_reporting.c +1671 -0
  192. data/pgpool2/pool_process_reporting.h +44 -0
  193. data/pgpool2/pool_proto2.c +671 -0
  194. data/pgpool2/pool_proto_modules.c +3524 -0
  195. data/pgpool2/pool_proto_modules.h +185 -0
  196. data/pgpool2/pool_query_cache.c +1020 -0
  197. data/pgpool2/pool_query_context.c +1871 -0
  198. data/pgpool2/pool_query_context.h +105 -0
  199. data/pgpool2/pool_relcache.c +284 -0
  200. data/pgpool2/pool_relcache.h +78 -0
  201. data/pgpool2/pool_rewrite_outfuncs.c +9060 -0
  202. data/pgpool2/pool_rewrite_query.c +715 -0
  203. data/pgpool2/pool_rewrite_query.h +192 -0
  204. data/pgpool2/pool_select_walker.c +1150 -0
  205. data/pgpool2/pool_select_walker.h +68 -0
  206. data/pgpool2/pool_sema.c +161 -0
  207. data/pgpool2/pool_session_context.c +952 -0
  208. data/pgpool2/pool_session_context.h +203 -0
  209. data/pgpool2/pool_shmem.c +185 -0
  210. data/pgpool2/pool_signal.c +158 -0
  211. data/pgpool2/pool_signal.h +61 -0
  212. data/pgpool2/pool_ssl.c +339 -0
  213. data/pgpool2/pool_stream.c +962 -0
  214. data/pgpool2/pool_stream.h +61 -0
  215. data/pgpool2/pool_system.c +659 -0
  216. data/pgpool2/pool_timestamp.c +1215 -0
  217. data/pgpool2/pool_timestamp.h +38 -0
  218. data/pgpool2/pool_type.h +171 -0
  219. data/pgpool2/pool_worker_child.c +384 -0
  220. data/pgpool2/ps_status.c +404 -0
  221. data/pgpool2/recovery.c +435 -0
  222. data/pgpool2/redhat/pgpool.conf.sample.patch +52 -0
  223. data/pgpool2/redhat/pgpool.init +201 -0
  224. data/pgpool2/redhat/pgpool.sysconfig +7 -0
  225. data/pgpool2/redhat/rpm_installer/basebackup-replication.sh +53 -0
  226. data/pgpool2/redhat/rpm_installer/basebackup-stream.sh +55 -0
  227. data/pgpool2/redhat/rpm_installer/config_for_script +17 -0
  228. data/pgpool2/redhat/rpm_installer/failover.sh +64 -0
  229. data/pgpool2/redhat/rpm_installer/getsources.sh +141 -0
  230. data/pgpool2/redhat/rpm_installer/install.sh +1363 -0
  231. data/pgpool2/redhat/rpm_installer/pgpool_recovery_pitr +47 -0
  232. data/pgpool2/redhat/rpm_installer/pgpool_remote_start +15 -0
  233. data/pgpool2/redhat/rpm_installer/recovery.conf +4 -0
  234. data/pgpool2/redhat/rpm_installer/uninstall.sh +57 -0
  235. data/pgpool2/sample/dist_def_pgbench.sql +73 -0
  236. data/pgpool2/sample/pgpool.pam +3 -0
  237. data/pgpool2/sample/pgpool_recovery +20 -0
  238. data/pgpool2/sample/pgpool_recovery_pitr +19 -0
  239. data/pgpool2/sample/pgpool_remote_start +13 -0
  240. data/pgpool2/sample/replicate_def_pgbench.sql +18 -0
  241. data/pgpool2/sql/insert_lock.sql +15 -0
  242. data/pgpool2/sql/pgpool-recovery/pgpool-recovery.c +280 -0
  243. data/pgpool2/sql/pgpool-recovery/pgpool-recovery.sql.in +19 -0
  244. data/pgpool2/sql/pgpool-recovery/pgpool_recovery--1.0.sql +24 -0
  245. data/pgpool2/sql/pgpool-recovery/pgpool_recovery.control +5 -0
  246. data/pgpool2/sql/pgpool-recovery/uninstall_pgpool-recovery.sql +3 -0
  247. data/pgpool2/sql/pgpool-regclass/pgpool-regclass.c +206 -0
  248. data/pgpool2/sql/pgpool-regclass/pgpool-regclass.sql.in +4 -0
  249. data/pgpool2/sql/pgpool-regclass/pgpool_regclass--1.0.sql +7 -0
  250. data/pgpool2/sql/pgpool-regclass/pgpool_regclass.control +5 -0
  251. data/pgpool2/sql/pgpool-regclass/uninstall_pgpool-regclass.sql +1 -0
  252. data/pgpool2/sql/system_db.sql +38 -0
  253. data/pgpool2/strlcpy.c +85 -0
  254. data/pgpool2/test/C/test_extended.c +98 -0
  255. data/pgpool2/test/jdbc/.cvsignore +2 -0
  256. data/pgpool2/test/jdbc/AutoCommitTest.java +45 -0
  257. data/pgpool2/test/jdbc/BatchTest.java +55 -0
  258. data/pgpool2/test/jdbc/ColumnTest.java +60 -0
  259. data/pgpool2/test/jdbc/CreateTempTableTest.java +48 -0
  260. data/pgpool2/test/jdbc/InsertTest.java +34 -0
  261. data/pgpool2/test/jdbc/LockTest.java +36 -0
  262. data/pgpool2/test/jdbc/PgpoolTest.java +75 -0
  263. data/pgpool2/test/jdbc/README.euc_jp +73 -0
  264. data/pgpool2/test/jdbc/RunTest.java +83 -0
  265. data/pgpool2/test/jdbc/SelectTest.java +37 -0
  266. data/pgpool2/test/jdbc/UpdateTest.java +32 -0
  267. data/pgpool2/test/jdbc/expected/CreateTempTable +1 -0
  268. data/pgpool2/test/jdbc/expected/autocommit +10 -0
  269. data/pgpool2/test/jdbc/expected/batch +1 -0
  270. data/pgpool2/test/jdbc/expected/column +100 -0
  271. data/pgpool2/test/jdbc/expected/insert +1 -0
  272. data/pgpool2/test/jdbc/expected/lock +100 -0
  273. data/pgpool2/test/jdbc/expected/select +2 -0
  274. data/pgpool2/test/jdbc/expected/update +1 -0
  275. data/pgpool2/test/jdbc/pgpool.properties +7 -0
  276. data/pgpool2/test/jdbc/prepare.sql +54 -0
  277. data/pgpool2/test/jdbc/run.sh +6 -0
  278. data/pgpool2/test/parser/.cvsignore +6 -0
  279. data/pgpool2/test/parser/README +32 -0
  280. data/pgpool2/test/parser/expected/copy.out +17 -0
  281. data/pgpool2/test/parser/expected/create.out +64 -0
  282. data/pgpool2/test/parser/expected/cursor.out +37 -0
  283. data/pgpool2/test/parser/expected/delete.out +10 -0
  284. data/pgpool2/test/parser/expected/drop.out +12 -0
  285. data/pgpool2/test/parser/expected/insert.out +13 -0
  286. data/pgpool2/test/parser/expected/misc.out +28 -0
  287. data/pgpool2/test/parser/expected/prepare.out +4 -0
  288. data/pgpool2/test/parser/expected/privileges.out +31 -0
  289. data/pgpool2/test/parser/expected/scanner.out +30 -0
  290. data/pgpool2/test/parser/expected/select.out +89 -0
  291. data/pgpool2/test/parser/expected/transaction.out +38 -0
  292. data/pgpool2/test/parser/expected/update.out +11 -0
  293. data/pgpool2/test/parser/expected/v84.out +37 -0
  294. data/pgpool2/test/parser/expected/v90.out +25 -0
  295. data/pgpool2/test/parser/expected/var.out +22 -0
  296. data/pgpool2/test/parser/input/alter.sql +2 -0
  297. data/pgpool2/test/parser/input/copy.sql +17 -0
  298. data/pgpool2/test/parser/input/create.sql +64 -0
  299. data/pgpool2/test/parser/input/cursor.sql +37 -0
  300. data/pgpool2/test/parser/input/delete.sql +10 -0
  301. data/pgpool2/test/parser/input/drop.sql +12 -0
  302. data/pgpool2/test/parser/input/insert.sql +13 -0
  303. data/pgpool2/test/parser/input/misc.sql +28 -0
  304. data/pgpool2/test/parser/input/prepare.sql +4 -0
  305. data/pgpool2/test/parser/input/privileges.sql +31 -0
  306. data/pgpool2/test/parser/input/scanner.sql +34 -0
  307. data/pgpool2/test/parser/input/select.sql +89 -0
  308. data/pgpool2/test/parser/input/transaction.sql +38 -0
  309. data/pgpool2/test/parser/input/update.sql +11 -0
  310. data/pgpool2/test/parser/input/v84.sql +37 -0
  311. data/pgpool2/test/parser/input/v90.sql +38 -0
  312. data/pgpool2/test/parser/input/var.sql +22 -0
  313. data/pgpool2/test/parser/main.c +96 -0
  314. data/pgpool2/test/parser/parse_schedule +16 -0
  315. data/pgpool2/test/parser/pool.h +13 -0
  316. data/pgpool2/test/parser/run-test +62 -0
  317. data/pgpool2/test/pdo-test/README.euc_jp +58 -0
  318. data/pgpool2/test/pdo-test/SQLlist/test1.sql +3 -0
  319. data/pgpool2/test/pdo-test/SQLlist/test2.sql +3 -0
  320. data/pgpool2/test/pdo-test/collections.inc +11 -0
  321. data/pgpool2/test/pdo-test/def.inc +7 -0
  322. data/pgpool2/test/pdo-test/log.txt +0 -0
  323. data/pgpool2/test/pdo-test/mod/database.inc +36 -0
  324. data/pgpool2/test/pdo-test/mod/def.inc +0 -0
  325. data/pgpool2/test/pdo-test/mod/errorhandler.inc +27 -0
  326. data/pgpool2/test/pdo-test/pdotest.php +11 -0
  327. data/pgpool2/test/pdo-test/regsql.inc +56 -0
  328. data/pgpool2/test/pgpool_setup +898 -0
  329. data/pgpool2/test/regression/README +39 -0
  330. data/pgpool2/test/regression/clean.sh +21 -0
  331. data/pgpool2/test/regression/libs.sh +16 -0
  332. data/pgpool2/test/regression/regress.sh +166 -0
  333. data/pgpool2/test/regression/tests/001.load_balance/test.sh +128 -0
  334. data/pgpool2/test/regression/tests/002.native_replication/PgTester.java +47 -0
  335. data/pgpool2/test/regression/tests/002.native_replication/create.sql +6 -0
  336. data/pgpool2/test/regression/tests/002.native_replication/test.sh +71 -0
  337. data/pgpool2/test/regression/tests/003.failover/expected.r +6 -0
  338. data/pgpool2/test/regression/tests/003.failover/expected.s +6 -0
  339. data/pgpool2/test/regression/tests/003.failover/test.sh +45 -0
  340. data/pgpool2/test/regression/tests/004.watchdog/master.conf +12 -0
  341. data/pgpool2/test/regression/tests/004.watchdog/standby.conf +19 -0
  342. data/pgpool2/test/regression/tests/004.watchdog/test.sh +52 -0
  343. data/pgpool2/test/regression/tests/050.bug58/test.sh +50 -0
  344. data/pgpool2/test/regression/tests/051.bug60/bug.sql +12 -0
  345. data/pgpool2/test/regression/tests/051.bug60/database-clean.sql +6 -0
  346. data/pgpool2/test/regression/tests/051.bug60/database-setup.sql +28 -0
  347. data/pgpool2/test/regression/tests/051.bug60/test.sh +79 -0
  348. data/pgpool2/test/regression/tests/052.do_query/test.sh +44 -0
  349. data/pgpool2/test/regression/tests/053.insert_lock_hangs/test.sh +81 -0
  350. data/pgpool2/test/regression/tests/054.postgres_fdw/test.sh +67 -0
  351. data/pgpool2/test/regression/tests/055.backend_all_down/test.sh +52 -0
  352. data/pgpool2/test/regression/tests/056.bug63/jdbctest2.java +66 -0
  353. data/pgpool2/test/regression/tests/056.bug63/test.sh +47 -0
  354. data/pgpool2/test/regression/tests/057.bug61/test.sh +40 -0
  355. data/pgpool2/test/regression/tests/058.bug68/jdbctest3.java +45 -0
  356. data/pgpool2/test/regression/tests/058.bug68/test.sh +47 -0
  357. data/pgpool2/test/timestamp/expected/insert.out +16 -0
  358. data/pgpool2/test/timestamp/expected/misc.out +3 -0
  359. data/pgpool2/test/timestamp/expected/update.out +6 -0
  360. data/pgpool2/test/timestamp/input/insert.sql +16 -0
  361. data/pgpool2/test/timestamp/input/misc.sql +3 -0
  362. data/pgpool2/test/timestamp/input/update.sql +6 -0
  363. data/pgpool2/test/timestamp/main.c +129 -0
  364. data/pgpool2/test/timestamp/parse_schedule +3 -0
  365. data/pgpool2/test/timestamp/run-test +69 -0
  366. data/pgpool2/version.h +1 -0
  367. data/pgpool2/watchdog/Makefile.am +17 -0
  368. data/pgpool2/watchdog/Makefile.in +505 -0
  369. data/pgpool2/watchdog/test/stab.c +266 -0
  370. data/pgpool2/watchdog/test/test.c +85 -0
  371. data/pgpool2/watchdog/test/wd_child_t.c +87 -0
  372. data/pgpool2/watchdog/test/wd_lifecheck_t.c +87 -0
  373. data/pgpool2/watchdog/test/wd_packet_t.c +87 -0
  374. data/pgpool2/watchdog/test/wd_ping_t.c +20 -0
  375. data/pgpool2/watchdog/watchdog.c +408 -0
  376. data/pgpool2/watchdog/watchdog.h +209 -0
  377. data/pgpool2/watchdog/wd_child.c +444 -0
  378. data/pgpool2/watchdog/wd_ext.h +123 -0
  379. data/pgpool2/watchdog/wd_heartbeat.c +577 -0
  380. data/pgpool2/watchdog/wd_if.c +216 -0
  381. data/pgpool2/watchdog/wd_init.c +126 -0
  382. data/pgpool2/watchdog/wd_interlock.c +347 -0
  383. data/pgpool2/watchdog/wd_lifecheck.c +512 -0
  384. data/pgpool2/watchdog/wd_list.c +429 -0
  385. data/pgpool2/watchdog/wd_packet.c +1159 -0
  386. data/pgpool2/watchdog/wd_ping.c +330 -0
  387. data/pgpool2/ylwrap +223 -0
  388. data/pgsql/presto_client.py +346 -0
  389. data/pgsql/prestogres.py +156 -0
  390. data/pgsql/setup_functions.sql +21 -0
  391. data/pgsql/setup_language.sql +3 -0
  392. data/prestogres.gemspec +23 -0
  393. metadata +496 -0
@@ -0,0 +1,392 @@
1
+ dnl Process this file with autoconf to produce a configure script.
2
+ AC_INIT
3
+
4
+ dnl Checks for programs.
5
+ AC_PROG_CC
6
+
7
+ AM_INIT_AUTOMAKE(pgpool-II, 3.3.2)
8
+ # AC_PROG_RANLIB
9
+ AC_PROG_LIBTOOL
10
+
11
+ AM_PROG_LEX
12
+ AC_PROG_YACC
13
+
14
+ dnl suggested by libtoolize --force
15
+ AC_CONFIG_MACRO_DIR([m4])
16
+
17
+ dnl Check compiler option
18
+ dnl check -Wall option
19
+ OLD_CFLAGS=$CFLAGS
20
+ CFLAGS="$CFLAGS -Wall"
21
+ AC_MSG_CHECKING(for -Wall option)
22
+ AC_CACHE_VAL(ac_cv_wall,
23
+ AC_TRY_COMPILE([], [char a;], ac_cv_wall=yes, ac_cv_wall=no))
24
+ echo $ac_cv_wall
25
+ if test $ac_cv_wall = no; then
26
+ CFLAGS=$OLD_CFLAGS
27
+ fi
28
+
29
+ dnl check -Wmissing-prototypes
30
+ OLD_CFLAGS=$CFLAGS
31
+ CFLAGS="$CFLAGS -Wmissing-prototypes"
32
+ AC_MSG_CHECKING(for -Wmissing-prototypes option)
33
+ AC_CACHE_VAL(ac_cv_wmissing_prototypes,
34
+ AC_TRY_COMPILE([], [char a;], ac_cv_wmissing_prototypes=yes,
35
+ ac_cv_wmissing_prototypes=no))
36
+ echo $ac_cv_wmissing_prototypes
37
+ if test $ac_cv_wmissing_prototypes = no; then
38
+ CFLAGS=$OLD_CFLAGS
39
+ fi
40
+
41
+
42
+ dnl check -Wmissing-prototypes
43
+ OLD_CFLAGS=$CFLAGS
44
+ CFLAGS="$CFLAGS -Wmissing-declarations"
45
+ AC_MSG_CHECKING(for -Wmissing-declarations option)
46
+ AC_CACHE_VAL(ac_cv_wmissing_declarations,
47
+ AC_TRY_COMPILE([], [char a;], ac_cv_wmissing_declarations=yes,
48
+ ac_cv_wmissing_declarations=no))
49
+ echo $ac_cv_wmissing_declarations
50
+ if test $ac_cv_wmissing_declarations = no; then
51
+ CFLAGS=$OLD_CFLAGS
52
+ fi
53
+
54
+ dnl Checks for libraries.
55
+ AC_CHECK_LIB(m, main)
56
+ AC_CHECK_LIB(nsl, main)
57
+ AC_CHECK_LIB(socket, main)
58
+ AC_CHECK_LIB(ipc, main)
59
+ AC_CHECK_LIB(IPC, main)
60
+ AC_CHECK_LIB(lc, main)
61
+ AC_CHECK_LIB(BSD, main)
62
+ AC_CHECK_LIB(gen, main)
63
+ AC_CHECK_LIB(PW, main)
64
+ AC_CHECK_LIB(resolv, main)
65
+ AC_CHECK_LIB(crypt, main)
66
+
67
+ dnl Checks for header files.
68
+ AC_HEADER_STDC
69
+ AC_HEADER_SYS_WAIT
70
+ AC_CHECK_HEADERS(fcntl.h unistd.h getopt.h netinet/tcp.h netinet/in.h netdb.h sys/param.h sys/types.h sys/socket.h sys/un.h sys/time.h sys/sem.h sys/shm.h sys/select.h crypt.h sys/pstat.h)
71
+
72
+ dnl Checks for typedefs, structures, and compiler characteristics.
73
+ AC_C_CONST
74
+ AC_TYPE_PID_T
75
+ AC_HEADER_TIME
76
+
77
+
78
+ dnl ===== Copied from PostgreSQL's configure start =====
79
+ dnl
80
+ dnl Check to see if we have a working 64-bit integer type.
81
+ dnl This breaks down into two steps:
82
+ dnl (1) figure out if the compiler has a 64-bit int type with working
83
+ dnl arithmetic, and if so
84
+ dnl (2) see whether snprintf() can format the type correctly. (Currently,
85
+ dnl snprintf is the only library routine we really need for int8 support.)
86
+ dnl It's entirely possible to have a compiler that handles a 64-bit type
87
+ dnl when the C library doesn't; this is fairly likely when using gcc on
88
+ dnl an older platform, for example.
89
+ dnl If there is no native snprintf() or it does not handle the 64-bit type,
90
+ dnl we force our own version of snprintf() to be used instead.
91
+ dnl Note this test must be run after our initial check for snprintf/vsnprintf.
92
+ m4_include([c-compiler.m4])
93
+ m4_include([c-library.m4])
94
+ m4_include([general.m4])
95
+
96
+ dnl This mazic variable is set to "yes" in PostgreSQL's configure.in
97
+ dnl if PORTNAME is "win32".
98
+ dnl pgpool-II does not suppport Windows at the moment, so we set to "no".
99
+ pgac_need_repl_snprintf=no
100
+
101
+ PGAC_TYPE_64BIT_INT([long int])
102
+
103
+ if test x"$HAVE_LONG_INT_64" = x"no" ; then
104
+ PGAC_TYPE_64BIT_INT([long long int])
105
+ fi
106
+
107
+ dnl If we need to use "long long int", figure out whether nnnLL notation works.
108
+
109
+ if test x"$HAVE_LONG_LONG_INT_64" = xyes ; then
110
+ AC_TRY_COMPILE([
111
+ #define INT64CONST(x) x##LL
112
+ long long int foo = INT64CONST(0x1234567890123456);
113
+ ],
114
+ [],
115
+ [AC_DEFINE(HAVE_LL_CONSTANTS, 1, [Define to 1 if constants of type 'long long int' should have the suffix LL.])],
116
+ [])
117
+ fi
118
+
119
+ # If we found "long int" is 64 bits, assume snprintf handles it. If
120
+ # we found we need to use "long long int", better check. We cope with
121
+ # snprintfs that use %lld, %qd, or %I64d as the format. If none of these
122
+ # work, fall back to our own snprintf emulation (which we know uses %lld).
123
+
124
+ if test "$HAVE_LONG_LONG_INT_64" = yes ; then
125
+ if test $pgac_need_repl_snprintf = no; then
126
+ PGAC_FUNC_SNPRINTF_LONG_LONG_INT_FORMAT
127
+ if test "$LONG_LONG_INT_FORMAT" = ""; then
128
+ # Force usage of our own snprintf, since system snprintf is broken
129
+ pgac_need_repl_snprintf=yes
130
+ LONG_LONG_INT_FORMAT='%lld'
131
+ fi
132
+ else
133
+ # Here if we previously decided we needed to use our own snprintf
134
+ LONG_LONG_INT_FORMAT='%lld'
135
+ fi
136
+ LONG_LONG_UINT_FORMAT=`echo "$LONG_LONG_INT_FORMAT" | sed 's/d$/u/'`
137
+ INT64_FORMAT="\"$LONG_LONG_INT_FORMAT\""
138
+ UINT64_FORMAT="\"$LONG_LONG_UINT_FORMAT\""
139
+ else
140
+ # Here if we are not using 'long long int' at all
141
+ INT64_FORMAT='"%ld"'
142
+ UINT64_FORMAT='"%lu"'
143
+ fi
144
+
145
+ AC_DEFINE_UNQUOTED(INT64_FORMAT, $INT64_FORMAT,
146
+ [Define to the appropriate snprintf format for 64-bit ints, if any.])
147
+
148
+ AC_DEFINE_UNQUOTED(UINT64_FORMAT, $UINT64_FORMAT,
149
+ [Define to the appropriate snprintf format for unsigned 64-bit ints, if any.])
150
+
151
+ # Now we have checked all the reasons to replace snprintf
152
+ if test $pgac_need_repl_snprintf = yes; then
153
+ AC_DEFINE(USE_REPL_SNPRINTF, 1, [Use replacement snprintf() functions.])
154
+ AC_LIBOBJ(snprintf)
155
+ fi
156
+
157
+ # Need a #define for the size of Datum (unsigned long)
158
+ AC_CHECK_SIZEOF([unsigned long])
159
+
160
+ # And check size of void *, size_t (enables tweaks for > 32bit address space)
161
+ AC_CHECK_SIZEOF([void *])
162
+ AC_CHECK_SIZEOF([size_t])
163
+
164
+ # Decide whether float4 is passed by value: user-selectable, enabled by default
165
+ AC_MSG_CHECKING([whether to build with float4 passed by value])
166
+ PGAC_ARG_BOOL(enable, float4-byval, yes, [disable float4 passed by value],
167
+ [AC_DEFINE([USE_FLOAT4_BYVAL], 1,
168
+ [Define to 1 if you want float4 values to be passed by value. (--enable-float4-byval)])
169
+ float4passbyval=true],
170
+ [float4passbyval=false])
171
+ AC_MSG_RESULT([$enable_float4_byval])
172
+ AC_DEFINE_UNQUOTED([FLOAT4PASSBYVAL], [$float4passbyval], [float4 values are passed by value if 'true', by reference if 'false'])
173
+
174
+ # Decide whether float8 is passed by value.
175
+ # Note: this setting also controls int8 and related types such as timestamp.
176
+ # If sizeof(Datum) >= 8, this is user-selectable, enabled by default.
177
+ # If not, trying to select it is an error.
178
+ AC_MSG_CHECKING([whether to build with float8 passed by value])
179
+ if test $ac_cv_sizeof_unsigned_long -ge 8 ; then
180
+ PGAC_ARG_BOOL(enable, float8-byval, yes, [disable float8 passed by value])
181
+ else
182
+ PGAC_ARG_BOOL(enable, float8-byval, no, [disable float8 passed by value])
183
+ if test "$enable_float8_byval" = yes ; then
184
+ AC_MSG_ERROR([--enable-float8-byval is not supported on 32-bit platforms.])
185
+ fi
186
+ fi
187
+ if test "$enable_float8_byval" = yes ; then
188
+ AC_DEFINE([USE_FLOAT8_BYVAL], 1,
189
+ [Define to 1 if you want float8, int8, etc values to be passed by value. (--enable-float8-byval)])
190
+ float8passbyval=true
191
+ else
192
+ float8passbyval=false
193
+ fi
194
+ AC_MSG_RESULT([$enable_float8_byval])
195
+ AC_DEFINE_UNQUOTED([FLOAT8PASSBYVAL], [$float8passbyval], [float8, int8, and related values are passed by value if 'true', by reference if 'false'])
196
+
197
+ dnl Rest of part cannot be executed by autocnf-2.59.
198
+ dnl AC_CHECK_ALIGNOF is supported autoconf-2.60 or higher.
199
+ dnl ===== Copied from PostgreSQL's configure start =====
200
+
201
+
202
+
203
+ dnl Checks for sockaddr_storage structure, members and necessary types
204
+ m4_include([ac_func_accept_argtypes.m4])
205
+ AC_CHECK_TYPES([struct sockaddr_storage], [], [],
206
+ [#include <sys/types.h>
207
+ #ifdef HAVE_SYS_SOCKET_H
208
+ #include <sys/socket.h>
209
+ #endif
210
+ ])
211
+ AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family,
212
+ struct sockaddr_storage.__ss_family,
213
+ struct sockaddr_storage.ss_len,
214
+ struct sockaddr_storage.__ss_len,
215
+ struct sockaddr.sa_len], [], [],
216
+ [#include <sys/types.h>
217
+ #ifdef HAVE_SYS_SOCKET_H
218
+ #include <sys/socket.h>
219
+ #endif
220
+ ])
221
+
222
+ AC_CHECK_TYPES([union semun],[],[],[#include <sys/types.h>
223
+ #include <sys/ipc.h>
224
+ #include <sys/sem.h>])
225
+
226
+ dnl Checks for library functions.
227
+ AC_TYPE_SIGNAL
228
+ AC_FUNC_VPRINTF
229
+ AC_FUNC_WAIT3
230
+ AC_FUNC_ACCEPT_ARGTYPES
231
+ AC_CHECK_FUNCS(setsid select socket sigprocmask strdup strerror strftime strtok asprintf vasprintf gai_strerror hstrerror pstat setproctitle vsyslog)
232
+
233
+ dnl Checks for pg_config command.
234
+ AC_CHECK_PROGS(PGCONFIG, pg_config)
235
+
236
+ if test -z $PGCONFIG
237
+ then
238
+ PGSQL_INCLUDE_DIR=/usr/local/pgsql/include
239
+ PGSQL_LIB_DIR=/usr/local/pgsql/lib
240
+ else
241
+ PGSQL_INCLUDE_DIR=`pg_config --includedir`
242
+ PGSQL_LIB_DIR=`pg_config --libdir`
243
+ fi
244
+
245
+ AC_ARG_WITH(pgsql,
246
+ [ --with-pgsql=DIR site header files for PostgreSQL in DIR],
247
+ [
248
+ case "$withval" in
249
+ "" | y | ye | yes | n | no)
250
+ AC_MSG_ERROR([*** You must supply an argument to the --with-pgsql option.])
251
+ ;;
252
+ esac
253
+ PGSQL_INCLUDE_DIR="$withval"/include
254
+ PGSQL_LIB_DIR="$withval"/lib
255
+ ])
256
+
257
+ AC_ARG_WITH(pgsql-includedir,
258
+ [ --with-pgsql-includedir=DIR site header files for PostgreSQL in DIR],
259
+ [
260
+ case "$withval" in
261
+ "" | y | ye | yes | n | no)
262
+ AC_MSG_ERROR([*** You must supply an argument to the --with-pgsql-includedir option.])
263
+ ;;
264
+ esac
265
+ PGSQL_INCLUDE_DIR="$withval"
266
+ ])
267
+
268
+ AC_ARG_WITH(pgsql-libdir,
269
+ [ --with-pgsql-libdir=DIR site library files for PostgreSQL in DIR],
270
+ [
271
+ case "$withval" in
272
+ "" | y | ye | yes | n | no)
273
+ AC_MSG_ERROR([*** You must supply an argument to the --with-pgsql-libdir option.])
274
+ ;;
275
+ esac
276
+ PGSQL_LIB_DIR="$withval"
277
+ ])
278
+
279
+
280
+ AC_ARG_WITH(openssl,
281
+ [ --with-openssl build with OpenSSL support],
282
+ [],
283
+ [openssl=no])
284
+
285
+ if test "$with_openssl" = yes || test "$with_openssl" = auto; then
286
+ AC_CHECK_HEADERS(openssl/ssl.h,
287
+ [AC_DEFINE([USE_SSL], 1,
288
+ [Define to 1 to build with SSL support. (--with-openssl)])],
289
+ [
290
+ if test "$with_openssl" = yes; then
291
+ AC_MSG_ERROR([header file <openssl/ssl.h> is required for SSL])
292
+ else
293
+ AC_MSG_WARN([header file <openssl/ssl.h> is required for SSL])
294
+ fi
295
+ ])
296
+
297
+ AC_CHECK_LIB(crypto, CRYPTO_new_ex_data, [], [AC_MSG_ERROR([library 'crypto' is required for OpenSSL])])
298
+ AC_CHECK_LIB(ssl, SSL_library_init, [], [AC_MSG_ERROR([library 'ssl' is required for OpenSSL])])
299
+ fi
300
+
301
+ AC_ARG_WITH(pam,
302
+ [ --with-pam build with PAM support],
303
+ [AC_DEFINE([USE_PAM], 1, [Define to 1 to build with PAM support. (--with-pam)])])
304
+ if test "$with_pam" = yes ; then
305
+ AC_CHECK_LIB(pam, pam_start, [], [AC_MSG_ERROR([library 'pam' is required for PAM])])
306
+ AC_CHECK_HEADERS(security/pam_appl.h, [],
307
+ [AC_CHECK_HEADERS(pam/pam_appl.h, [],
308
+ [AC_MSG_ERROR([header file <security/pam_appl.h> or <pam/pam_appl.h> is required for PAM.])])])
309
+ fi
310
+
311
+ AC_ARG_WITH(memcached,
312
+ [ --with-memcached=DIR site header files for libmemcached in DIR],
313
+ [
314
+ case "$withval" in
315
+ "" | y | ye | yes | n | no)
316
+ AC_MSG_ERROR([*** You must supply an argument to the --with-memcached option.])
317
+ ;;
318
+ *)
319
+
320
+ MEMCACHED_INCLUDE_DIR="$withval"/include
321
+ MEMCACHED_LIB_DIR="$withval"/lib
322
+ OLD_CFLAGS="$CFLAGS"
323
+ CFLAGS="$CFLAGS -I$MEMCACHED_INCLUDE_DIR"
324
+ AC_CHECK_HEADERS(
325
+ [libmemcached/memcached.h],
326
+ [AC_DEFINE([USE_MEMCACHED], 1, [Define to 1 to build with memcached support])],
327
+ [AC_MSG_ERROR([header file <libmemcached/memcached.h> is required for memcached support])])
328
+ CFLAGS=$OLD_CFLAGS
329
+ AC_CHECK_LIB(memcached, memcached_create, [], [AC_MSG_ERROR(libmemcached is not installed)])
330
+ MEMCACHED_INCLUDE_OPT="-I $MEMCACHED_INCLUDE_DIR"
331
+ MEMCACHED_LINK_OPT="-L$MEMCACHED_LIB_DIR"
332
+ MEMCACHED_RPATH_OPT="-rpath $MEMCACHED_LIB_DIR"
333
+ ;;
334
+ esac
335
+ ])
336
+
337
+ AC_SUBST(MEMCACHED_INCLUDE_OPT)
338
+ AC_SUBST(MEMCACHED_LINK_OPT)
339
+ AC_SUBST(MEMCACHED_RPATH_OPT)
340
+
341
+ OLD_LDFLAGS="$LDFLAGS"
342
+ LDFLAGS="-L$PGSQL_LIB_DIR"
343
+ OLD_LIBS="$LIBS"
344
+ AC_CHECK_LIB(pq, PQexecPrepared, [], [AC_MSG_ERROR(libpq is not installed or libpq is old)])
345
+ AC_CHECK_FUNCS(PQprepare)
346
+ LDFLAGS="$OLD_LDFLAGS"
347
+ LIBS="$OLD_LIBS"
348
+
349
+ AC_SUBST(PGSQL_INCLUDE_DIR)
350
+ AC_SUBST(PGSQL_LIB_DIR)
351
+ AC_SUBST(MEMCACHED_DIR)
352
+
353
+ # --enable(disable)-rpath option
354
+ AC_ARG_ENABLE(rpath,
355
+ [ --disable-rpath do not embed shared library search path in executables],
356
+ [case "${enableval}" in
357
+ yes) rpath=yes ;;
358
+ no) rpath=no ;;
359
+ esac],
360
+ [rpath=yes]
361
+ )
362
+ AM_CONDITIONAL([enable_rpath], test x$rpath = xyes)
363
+
364
+ # Decide whether to use row lock against the sequence table for insert_lock.
365
+ # This lock method is compatible with pgpool-II 3.0 series(until 3.0.4).
366
+ AC_MSG_CHECKING([whether to use row lock against the sequence table for insert_lock])
367
+ PGAC_ARG_BOOL(enable, sequence-lock, no, [insert_lock compatible with pgpool-II 3.0 series (until 3.0.4)])
368
+ if test "$enable_sequence_lock" = yes && test "$enable_table_lock" = yes ; then
369
+ AC_MSG_ERROR([--enable-table-lock cannot be enabled at the same time.])
370
+ fi
371
+ if test "$enable_sequence_lock" = yes ; then
372
+ AC_DEFINE([USE_SEQUENCE_LOCK], 1,
373
+ [Define to 1 if you want to use row lock against the sequence table for insert_lock. (--enable-sequence-lock)])
374
+ fi
375
+ AC_MSG_RESULT([$enable_sequence_lock])
376
+
377
+ # Decide whether to use table lock against the target table for insert_lock.
378
+ # This lock method is compatible with pgpool-II 2.2 and 2.3 series.
379
+ AC_MSG_CHECKING([whether to use table lock against the target table for insert_lock])
380
+ PGAC_ARG_BOOL(enable, table-lock, no, [insert_lock compatible with pgpool-II 2.2 and 2.3 series])
381
+ if test "$enable_table_lock" = yes && test "$enable_sequence_lock" = yes ; then
382
+ AC_MSG_ERROR([--enable-sequence-lock cannot be enabled at the same time.])
383
+ fi
384
+ if test "$enable_table_lock" = yes ; then
385
+ AC_DEFINE([USE_TABLE_LOCK], 1,
386
+ [Define to 1 if you want to use table lock against the target table for insert_lock. (--enable-table-lock)])
387
+ fi
388
+ AC_MSG_RESULT([$enable_table_lock])
389
+
390
+ AM_CONFIG_HEADER(config.h)
391
+
392
+ AC_OUTPUT([Makefile parser/Makefile pcp/Makefile watchdog/Makefile])
data/pgpool2/depcomp ADDED
@@ -0,0 +1,522 @@
1
+ #! /bin/sh
2
+ # depcomp - compile a program generating dependencies as side-effects
3
+
4
+ scriptversion=2004-05-31.23
5
+
6
+ # Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
7
+
8
+ # This program is free software; you can redistribute it and/or modify
9
+ # it under the terms of the GNU General Public License as published by
10
+ # the Free Software Foundation; either version 2, or (at your option)
11
+ # any later version.
12
+
13
+ # This program is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU General Public License for more details.
17
+
18
+ # You should have received a copy of the GNU General Public License
19
+ # along with this program; if not, write to the Free Software
20
+ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21
+ # 02111-1307, USA.
22
+
23
+ # As a special exception to the GNU General Public License, if you
24
+ # distribute this file as part of a program that contains a
25
+ # configuration script generated by Autoconf, you may include it under
26
+ # the same distribution terms that you use for the rest of that program.
27
+
28
+ # Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
29
+
30
+ case $1 in
31
+ '')
32
+ echo "$0: No command. Try \`$0 --help' for more information." 1>&2
33
+ exit 1;
34
+ ;;
35
+ -h | --h*)
36
+ cat <<\EOF
37
+ Usage: depcomp [--help] [--version] PROGRAM [ARGS]
38
+
39
+ Run PROGRAMS ARGS to compile a file, generating dependencies
40
+ as side-effects.
41
+
42
+ Environment variables:
43
+ depmode Dependency tracking mode.
44
+ source Source file read by `PROGRAMS ARGS'.
45
+ object Object file output by `PROGRAMS ARGS'.
46
+ DEPDIR directory where to store dependencies.
47
+ depfile Dependency file to output.
48
+ tmpdepfile Temporary file to use when outputing dependencies.
49
+ libtool Whether libtool is used (yes/no).
50
+
51
+ Report bugs to <bug-automake@gnu.org>.
52
+ EOF
53
+ exit 0
54
+ ;;
55
+ -v | --v*)
56
+ echo "depcomp $scriptversion"
57
+ exit 0
58
+ ;;
59
+ esac
60
+
61
+ if test -z "$depmode" || test -z "$source" || test -z "$object"; then
62
+ echo "depcomp: Variables source, object and depmode must be set" 1>&2
63
+ exit 1
64
+ fi
65
+
66
+ # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
67
+ depfile=${depfile-`echo "$object" |
68
+ sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
69
+ tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
70
+
71
+ rm -f "$tmpdepfile"
72
+
73
+ # Some modes work just like other modes, but use different flags. We
74
+ # parameterize here, but still list the modes in the big case below,
75
+ # to make depend.m4 easier to write. Note that we *cannot* use a case
76
+ # here, because this file can only contain one case statement.
77
+ if test "$depmode" = hp; then
78
+ # HP compiler uses -M and no extra arg.
79
+ gccflag=-M
80
+ depmode=gcc
81
+ fi
82
+
83
+ if test "$depmode" = dashXmstdout; then
84
+ # This is just like dashmstdout with a different argument.
85
+ dashmflag=-xM
86
+ depmode=dashmstdout
87
+ fi
88
+
89
+ case "$depmode" in
90
+ gcc3)
91
+ ## gcc 3 implements dependency tracking that does exactly what
92
+ ## we want. Yay! Note: for some reason libtool 1.4 doesn't like
93
+ ## it if -MD -MP comes after the -MF stuff. Hmm.
94
+ "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
95
+ stat=$?
96
+ if test $stat -eq 0; then :
97
+ else
98
+ rm -f "$tmpdepfile"
99
+ exit $stat
100
+ fi
101
+ mv "$tmpdepfile" "$depfile"
102
+ ;;
103
+
104
+ gcc)
105
+ ## There are various ways to get dependency output from gcc. Here's
106
+ ## why we pick this rather obscure method:
107
+ ## - Don't want to use -MD because we'd like the dependencies to end
108
+ ## up in a subdir. Having to rename by hand is ugly.
109
+ ## (We might end up doing this anyway to support other compilers.)
110
+ ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
111
+ ## -MM, not -M (despite what the docs say).
112
+ ## - Using -M directly means running the compiler twice (even worse
113
+ ## than renaming).
114
+ if test -z "$gccflag"; then
115
+ gccflag=-MD,
116
+ fi
117
+ "$@" -Wp,"$gccflag$tmpdepfile"
118
+ stat=$?
119
+ if test $stat -eq 0; then :
120
+ else
121
+ rm -f "$tmpdepfile"
122
+ exit $stat
123
+ fi
124
+ rm -f "$depfile"
125
+ echo "$object : \\" > "$depfile"
126
+ alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
127
+ ## The second -e expression handles DOS-style file names with drive letters.
128
+ sed -e 's/^[^:]*: / /' \
129
+ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
130
+ ## This next piece of magic avoids the `deleted header file' problem.
131
+ ## The problem is that when a header file which appears in a .P file
132
+ ## is deleted, the dependency causes make to die (because there is
133
+ ## typically no way to rebuild the header). We avoid this by adding
134
+ ## dummy dependencies for each header file. Too bad gcc doesn't do
135
+ ## this for us directly.
136
+ tr ' ' '
137
+ ' < "$tmpdepfile" |
138
+ ## Some versions of gcc put a space before the `:'. On the theory
139
+ ## that the space means something, we add a space to the output as
140
+ ## well.
141
+ ## Some versions of the HPUX 10.20 sed can't process this invocation
142
+ ## correctly. Breaking it into two sed invocations is a workaround.
143
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
144
+ rm -f "$tmpdepfile"
145
+ ;;
146
+
147
+ hp)
148
+ # This case exists only to let depend.m4 do its work. It works by
149
+ # looking at the text of this script. This case will never be run,
150
+ # since it is checked for above.
151
+ exit 1
152
+ ;;
153
+
154
+ sgi)
155
+ if test "$libtool" = yes; then
156
+ "$@" "-Wp,-MDupdate,$tmpdepfile"
157
+ else
158
+ "$@" -MDupdate "$tmpdepfile"
159
+ fi
160
+ stat=$?
161
+ if test $stat -eq 0; then :
162
+ else
163
+ rm -f "$tmpdepfile"
164
+ exit $stat
165
+ fi
166
+ rm -f "$depfile"
167
+
168
+ if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
169
+ echo "$object : \\" > "$depfile"
170
+
171
+ # Clip off the initial element (the dependent). Don't try to be
172
+ # clever and replace this with sed code, as IRIX sed won't handle
173
+ # lines with more than a fixed number of characters (4096 in
174
+ # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
175
+ # the IRIX cc adds comments like `#:fec' to the end of the
176
+ # dependency line.
177
+ tr ' ' '
178
+ ' < "$tmpdepfile" \
179
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
180
+ tr '
181
+ ' ' ' >> $depfile
182
+ echo >> $depfile
183
+
184
+ # The second pass generates a dummy entry for each header file.
185
+ tr ' ' '
186
+ ' < "$tmpdepfile" \
187
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
188
+ >> $depfile
189
+ else
190
+ # The sourcefile does not contain any dependencies, so just
191
+ # store a dummy comment line, to avoid errors with the Makefile
192
+ # "include basename.Plo" scheme.
193
+ echo "#dummy" > "$depfile"
194
+ fi
195
+ rm -f "$tmpdepfile"
196
+ ;;
197
+
198
+ aix)
199
+ # The C for AIX Compiler uses -M and outputs the dependencies
200
+ # in a .u file. In older versions, this file always lives in the
201
+ # current directory. Also, the AIX compiler puts `$object:' at the
202
+ # start of each line; $object doesn't have directory information.
203
+ # Version 6 uses the directory in both cases.
204
+ stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
205
+ tmpdepfile="$stripped.u"
206
+ if test "$libtool" = yes; then
207
+ "$@" -Wc,-M
208
+ else
209
+ "$@" -M
210
+ fi
211
+ stat=$?
212
+
213
+ if test -f "$tmpdepfile"; then :
214
+ else
215
+ stripped=`echo "$stripped" | sed 's,^.*/,,'`
216
+ tmpdepfile="$stripped.u"
217
+ fi
218
+
219
+ if test $stat -eq 0; then :
220
+ else
221
+ rm -f "$tmpdepfile"
222
+ exit $stat
223
+ fi
224
+
225
+ if test -f "$tmpdepfile"; then
226
+ outname="$stripped.o"
227
+ # Each line is of the form `foo.o: dependent.h'.
228
+ # Do two passes, one to just change these to
229
+ # `$object: dependent.h' and one to simply `dependent.h:'.
230
+ sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
231
+ sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
232
+ else
233
+ # The sourcefile does not contain any dependencies, so just
234
+ # store a dummy comment line, to avoid errors with the Makefile
235
+ # "include basename.Plo" scheme.
236
+ echo "#dummy" > "$depfile"
237
+ fi
238
+ rm -f "$tmpdepfile"
239
+ ;;
240
+
241
+ icc)
242
+ # Intel's C compiler understands `-MD -MF file'. However on
243
+ # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
244
+ # ICC 7.0 will fill foo.d with something like
245
+ # foo.o: sub/foo.c
246
+ # foo.o: sub/foo.h
247
+ # which is wrong. We want:
248
+ # sub/foo.o: sub/foo.c
249
+ # sub/foo.o: sub/foo.h
250
+ # sub/foo.c:
251
+ # sub/foo.h:
252
+ # ICC 7.1 will output
253
+ # foo.o: sub/foo.c sub/foo.h
254
+ # and will wrap long lines using \ :
255
+ # foo.o: sub/foo.c ... \
256
+ # sub/foo.h ... \
257
+ # ...
258
+
259
+ "$@" -MD -MF "$tmpdepfile"
260
+ stat=$?
261
+ if test $stat -eq 0; then :
262
+ else
263
+ rm -f "$tmpdepfile"
264
+ exit $stat
265
+ fi
266
+ rm -f "$depfile"
267
+ # Each line is of the form `foo.o: dependent.h',
268
+ # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
269
+ # Do two passes, one to just change these to
270
+ # `$object: dependent.h' and one to simply `dependent.h:'.
271
+ sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
272
+ # Some versions of the HPUX 10.20 sed can't process this invocation
273
+ # correctly. Breaking it into two sed invocations is a workaround.
274
+ sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
275
+ sed -e 's/$/ :/' >> "$depfile"
276
+ rm -f "$tmpdepfile"
277
+ ;;
278
+
279
+ tru64)
280
+ # The Tru64 compiler uses -MD to generate dependencies as a side
281
+ # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
282
+ # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
283
+ # dependencies in `foo.d' instead, so we check for that too.
284
+ # Subdirectories are respected.
285
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
286
+ test "x$dir" = "x$object" && dir=
287
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
288
+
289
+ if test "$libtool" = yes; then
290
+ # Dependencies are output in .lo.d with libtool 1.4.
291
+ # With libtool 1.5 they are output both in $dir.libs/$base.o.d
292
+ # and in $dir.libs/$base.o.d and $dir$base.o.d. We process the
293
+ # latter, because the former will be cleaned when $dir.libs is
294
+ # erased.
295
+ tmpdepfile1="$dir.libs/$base.lo.d"
296
+ tmpdepfile2="$dir$base.o.d"
297
+ tmpdepfile3="$dir.libs/$base.d"
298
+ "$@" -Wc,-MD
299
+ else
300
+ tmpdepfile1="$dir$base.o.d"
301
+ tmpdepfile2="$dir$base.d"
302
+ tmpdepfile3="$dir$base.d"
303
+ "$@" -MD
304
+ fi
305
+
306
+ stat=$?
307
+ if test $stat -eq 0; then :
308
+ else
309
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
310
+ exit $stat
311
+ fi
312
+
313
+ if test -f "$tmpdepfile1"; then
314
+ tmpdepfile="$tmpdepfile1"
315
+ elif test -f "$tmpdepfile2"; then
316
+ tmpdepfile="$tmpdepfile2"
317
+ else
318
+ tmpdepfile="$tmpdepfile3"
319
+ fi
320
+ if test -f "$tmpdepfile"; then
321
+ sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
322
+ # That's a tab and a space in the [].
323
+ sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
324
+ else
325
+ echo "#dummy" > "$depfile"
326
+ fi
327
+ rm -f "$tmpdepfile"
328
+ ;;
329
+
330
+ #nosideeffect)
331
+ # This comment above is used by automake to tell side-effect
332
+ # dependency tracking mechanisms from slower ones.
333
+
334
+ dashmstdout)
335
+ # Important note: in order to support this mode, a compiler *must*
336
+ # always write the preprocessed file to stdout, regardless of -o.
337
+ "$@" || exit $?
338
+
339
+ # Remove the call to Libtool.
340
+ if test "$libtool" = yes; then
341
+ while test $1 != '--mode=compile'; do
342
+ shift
343
+ done
344
+ shift
345
+ fi
346
+
347
+ # Remove `-o $object'.
348
+ IFS=" "
349
+ for arg
350
+ do
351
+ case $arg in
352
+ -o)
353
+ shift
354
+ ;;
355
+ $object)
356
+ shift
357
+ ;;
358
+ *)
359
+ set fnord "$@" "$arg"
360
+ shift # fnord
361
+ shift # $arg
362
+ ;;
363
+ esac
364
+ done
365
+
366
+ test -z "$dashmflag" && dashmflag=-M
367
+ # Require at least two characters before searching for `:'
368
+ # in the target name. This is to cope with DOS-style filenames:
369
+ # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
370
+ "$@" $dashmflag |
371
+ sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
372
+ rm -f "$depfile"
373
+ cat < "$tmpdepfile" > "$depfile"
374
+ tr ' ' '
375
+ ' < "$tmpdepfile" | \
376
+ ## Some versions of the HPUX 10.20 sed can't process this invocation
377
+ ## correctly. Breaking it into two sed invocations is a workaround.
378
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
379
+ rm -f "$tmpdepfile"
380
+ ;;
381
+
382
+ dashXmstdout)
383
+ # This case only exists to satisfy depend.m4. It is never actually
384
+ # run, as this mode is specially recognized in the preamble.
385
+ exit 1
386
+ ;;
387
+
388
+ makedepend)
389
+ "$@" || exit $?
390
+ # Remove any Libtool call
391
+ if test "$libtool" = yes; then
392
+ while test $1 != '--mode=compile'; do
393
+ shift
394
+ done
395
+ shift
396
+ fi
397
+ # X makedepend
398
+ shift
399
+ cleared=no
400
+ for arg in "$@"; do
401
+ case $cleared in
402
+ no)
403
+ set ""; shift
404
+ cleared=yes ;;
405
+ esac
406
+ case "$arg" in
407
+ -D*|-I*)
408
+ set fnord "$@" "$arg"; shift ;;
409
+ # Strip any option that makedepend may not understand. Remove
410
+ # the object too, otherwise makedepend will parse it as a source file.
411
+ -*|$object)
412
+ ;;
413
+ *)
414
+ set fnord "$@" "$arg"; shift ;;
415
+ esac
416
+ done
417
+ obj_suffix="`echo $object | sed 's/^.*\././'`"
418
+ touch "$tmpdepfile"
419
+ ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
420
+ rm -f "$depfile"
421
+ cat < "$tmpdepfile" > "$depfile"
422
+ sed '1,2d' "$tmpdepfile" | tr ' ' '
423
+ ' | \
424
+ ## Some versions of the HPUX 10.20 sed can't process this invocation
425
+ ## correctly. Breaking it into two sed invocations is a workaround.
426
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
427
+ rm -f "$tmpdepfile" "$tmpdepfile".bak
428
+ ;;
429
+
430
+ cpp)
431
+ # Important note: in order to support this mode, a compiler *must*
432
+ # always write the preprocessed file to stdout.
433
+ "$@" || exit $?
434
+
435
+ # Remove the call to Libtool.
436
+ if test "$libtool" = yes; then
437
+ while test $1 != '--mode=compile'; do
438
+ shift
439
+ done
440
+ shift
441
+ fi
442
+
443
+ # Remove `-o $object'.
444
+ IFS=" "
445
+ for arg
446
+ do
447
+ case $arg in
448
+ -o)
449
+ shift
450
+ ;;
451
+ $object)
452
+ shift
453
+ ;;
454
+ *)
455
+ set fnord "$@" "$arg"
456
+ shift # fnord
457
+ shift # $arg
458
+ ;;
459
+ esac
460
+ done
461
+
462
+ "$@" -E |
463
+ sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
464
+ sed '$ s: \\$::' > "$tmpdepfile"
465
+ rm -f "$depfile"
466
+ echo "$object : \\" > "$depfile"
467
+ cat < "$tmpdepfile" >> "$depfile"
468
+ sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
469
+ rm -f "$tmpdepfile"
470
+ ;;
471
+
472
+ msvisualcpp)
473
+ # Important note: in order to support this mode, a compiler *must*
474
+ # always write the preprocessed file to stdout, regardless of -o,
475
+ # because we must use -o when running libtool.
476
+ "$@" || exit $?
477
+ IFS=" "
478
+ for arg
479
+ do
480
+ case "$arg" in
481
+ "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
482
+ set fnord "$@"
483
+ shift
484
+ shift
485
+ ;;
486
+ *)
487
+ set fnord "$@" "$arg"
488
+ shift
489
+ shift
490
+ ;;
491
+ esac
492
+ done
493
+ "$@" -E |
494
+ sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
495
+ rm -f "$depfile"
496
+ echo "$object : \\" > "$depfile"
497
+ . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
498
+ echo " " >> "$depfile"
499
+ . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
500
+ rm -f "$tmpdepfile"
501
+ ;;
502
+
503
+ none)
504
+ exec "$@"
505
+ ;;
506
+
507
+ *)
508
+ echo "Unknown depmode $depmode" 1>&2
509
+ exit 1
510
+ ;;
511
+ esac
512
+
513
+ exit 0
514
+
515
+ # Local Variables:
516
+ # mode: shell-script
517
+ # sh-indentation: 2
518
+ # eval: (add-hook 'write-file-hooks 'time-stamp)
519
+ # time-stamp-start: "scriptversion="
520
+ # time-stamp-format: "%:y-%02m-%02d.%02H"
521
+ # time-stamp-end: "$"
522
+ # End: