-
Notifications
You must be signed in to change notification settings - Fork 10
/
config.m4
65 lines (53 loc) · 1.79 KB
/
config.m4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
dnl $Id$
dnl config.m4 for extension ogr
PHP_ARG_WITH(ogr, for ogr support,
[ --with-ogr[=DIR] Include OGR support (DIR=GDAL/OGR install dir.)])
if test "$PHP_OGR" != "no"; then
dnl # --with-ogr -> check with-path
SEARCH_PATH="/usr/local /usr"
SEARCH_DIRS="include include/gdal"
SEARCH_FOR="ogr_api.h"
if test -r $PHP_OGR/; then
OGR_DIR=$PHP_OGR
else # search default path list
AC_MSG_CHECKING([for ORG files in default path])
for i in $SEARCH_PATH ; do
for j in $SEARCH_DIRS ; do
if test -r $i/$j/$SEARCH_FOR; then
OGR_DIR=$i
AC_MSG_RESULT(found in $i)
fi
done
done
fi
if test -z "$OGR_DIR"; then
AC_MSG_RESULT([not found])
AC_MSG_ERROR([Please install the OGR distribution])
fi
if ${OGR_DIR}/bin/gdal-config --libs print > /dev/null 2>&1; then
OGR_CONFIG=${OGR_DIR}/bin/gdal-config
else
if ${OGR_DIR}/gdal-config --libs print > /dev/null 2>&1; then
OGR_CONFIG=${OGR_DIR}/gdal-config
fi
fi
ogr_version_full=`$OGR_CONFIG --version`
ogr_version=`echo ${ogr_version_full} | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
if test "$ogr_version" -ge 1001008; then
AC_MSG_RESULT($ogr_version_full)
OGR_LIBS=`$OGR_CONFIG --libs`
OGR_CFLAGS=`$OGR_CONFIG --cflags`
else
AC_MSG_ERROR(GDAL/OGR version 1.1.8 or later is required to compile php with OGR support)
fi
PHP_EVAL_INCLINE($OGR_CFLAGS)
PHP_ADD_INCLUDE($OGR_DIR/include)
PHP_EVAL_LIBLINE($OGR_LIBS, OGR_SHARED_LIBADD)
if test x`$OGR_CONFIG --ogr-enabled` = "xyes" ; then
AC_DEFINE(HAVE_OGR,1,[ ])
else
AC_MSG_ERROR(OGR support not found. Please make sure your GDAL includes OGR support.)
fi
PHP_SUBST(OGR_SHARED_LIBADD)
PHP_NEW_EXTENSION(ogr, ogr.c, $ext_shared)
fi