[osm2pgsql] Allow osm2pgsql to be compiled on mac osx

As reported in #4544 osm2pgsql was not portable to mac osx.

Add additional configure checks for functions that are not available
on mac osx and either disable the functionality or replace it through defines



git-svn-id: http://svn.openstreetmap.org/applications/utils/export/osm2pgsql@28646 b9d5c4c9-76e1-0310-9c85-f3177eceb1e4
Fix a logic bug in r28671 that made the return value of pgsql_filter_tags() incorrect when --hstore-column was set.

git-svn-id: http://svn.openstreetmap.org/applications/utils/export/osm2pgsql@28686 b9d5c4c9-76e1-0310-9c85-f3177eceb1e4
Fix a bug that caused --hstore-match-only to be ignored when --hstore-column is set.

git-svn-id: http://svn.openstreetmap.org/applications/utils/export/osm2pgsql@28687 b9d5c4c9-76e1-0310-9c85-f3177eceb1e4
Extend regression tests to compare results between runs.

git-svn-id: http://svn.openstreetmap.org/applications/utils/export/osm2pgsql@28688 b9d5c4c9-76e1-0310-9c85-f3177eceb1e4
[osm2pgsql] Remove debug check from binarysearcharray 
 
The binary search array had a sanity check in the add function 
to check that the ordering invariant holds true. This turned addition 
into a O(n) operation rather than an O(log(n)) 
 
Remove this sanity check as a performance optimisation



git-svn-id: http://svn.openstreetmap.org/applications/utils/export/osm2pgsql@28700 b9d5c4c9-76e1-0310-9c85-f3177eceb1e4
[osm2pgsql] Replace async I/O in flat-node-cache with posix_fadvise 
 
The idea behind using async I/O was to try and have more than a single I/O operation 
in flight, which can greatly increase performance of raid arrays or SSDs but also has some 
advantages on normal disks. 
 
The glib aio functions however did not work correctly, and were unnecessarily complex. 
 
This patch now replaces all of the async code with a simple call to posix_fadvise(WILLNEED) 
for all of the nodes in a get_nodes_list call. 
 
On my 32Gb SSD, the use of posix_fadvise improves performance of node retrieval from 
3.5k nodes/s to 22k nodes/s under ideal benchmark conditions. In real world usage, 
the speedup is likely to be a lot less, as less I/O can be predicted (most get_node_list calls 
only need to load a single 4k block) and thus less I/O can be parallelised.



git-svn-id: http://svn.openstreetmap.org/applications/utils/export/osm2pgsql@28701 b9d5c4c9-76e1-0310-9c85-f3177eceb1e4
[osm2pgsql] Improve cache management on initial writeout of flat-node-cache 
 
1) fsync the flat-node-cache file in regular intervals to make sure not too 
   much dirty data is in the disk cache which can then stall the whole system 
   during write out. However, instead of fsync, it uses the Linux specific function 
   sync_file_range 
 
2) After writing out the data, drop the information from the disk cache. 
   If one has enough RAM, then one should rather set the -C parameter high enough 
   which is its own ram cache for nodes. It is then a waste of 16GB RAM 
   to also cache the flat-node-cache in disk cache. 
   If one doesn't have enough cache, then chances are that the wrong 
   data is in the disk cache by the time one needs it again, so it is 
   probably also better to drop it from disk cache



git-svn-id: http://svn.openstreetmap.org/applications/utils/export/osm2pgsql@28702 b9d5c4c9-76e1-0310-9c85-f3177eceb1e4
[osm2pgsql] Enable 64bit IDs by default

Databases generated in 64bit and 32bit ID mode are not compatible with each other,
including applying diffs.

It is therefore necessary to reload the database to switch from 32bit ID mode to 64bit.

Also bump version number to 0.81.1



git-svn-id: http://svn.openstreetmap.org/applications/utils/export/osm2pgsql@28712 b9d5c4c9-76e1-0310-9c85-f3177eceb1e4
Add --sanitize-columns option to replace non-alphanumeric chars in column names with underscores.
Add an optional to *not* add spatial indexes.