# sanity check if PHP binary exists
if (NOT EXISTS ${PHP_BIN})
message(FATAL_ERROR "PHP binary not found. Install php or provide location with -DPHP_BIN=/path/php ")
+ else()
+ message (STATUS "Using PHP binary " ${PHP_BIN})
+ endif()
+ if (NOT PHPCGI_BIN)
+ find_program (PHPCGI_BIN php-cgi)
+ endif()
+ # sanity check if PHP binary exists
+ if (NOT EXISTS ${PHPCGI_BIN})
+ message(WARNING "php-cgi binary not found. nominatim tool will not provide query functions.")
+ set (PHPCGI_BIN "")
+ else()
+ message (STATUS "Using php-cgi binary " ${PHPCGI_BIN})
endif()
- message (STATUS "Using PHP binary " ${PHP_BIN})
endif()
#-----------------------------------------------------------------------------
exit(cli.nominatim(module_dir='@CMAKE_BINARY_DIR@/module',
osm2pgsql_path='@CMAKE_BINARY_DIR@/osm2pgsql/osm2pgsql',
phplib_dir='@CMAKE_SOURCE_DIR@/lib',
- data_dir='@CMAKE_SOURCE_DIR@'))
+ data_dir='@CMAKE_SOURCE_DIR@',
+ phpcgi_path='@PHPCGI_BIN@'))
class QueryExport:
"""\
- Export addresses as CSV file from a Nominatim database.
+ Export addresses as CSV file from the database.
"""
@staticmethod
parser.add_subcommand('refresh', UpdateRefresh)
parser.add_subcommand('export', QueryExport)
- parser.add_subcommand('search', QueryTodo)
- parser.add_subcommand('reverse', QueryTodo)
- parser.add_subcommand('lookup', QueryTodo)
- parser.add_subcommand('details', QueryTodo)
- parser.add_subcommand('status', QueryTodo)
+
+ if kwargs.get('phpcgi_path'):
+ parser.add_subcommand('search', QueryTodo)
+ parser.add_subcommand('reverse', QueryTodo)
+ parser.add_subcommand('lookup', QueryTodo)
+ parser.add_subcommand('details', QueryTodo)
+ parser.add_subcommand('status', QueryTodo)
+ else:
+ parser.parser.epilog = 'php-cgi not found. Query commands not available.'
return parser.run(**kwargs)