Skip to content

Commit 2121751

Browse files
committed
Try to get configure to work on newer versions of debian
1 parent a453045 commit 2121751

1 file changed

Lines changed: 51 additions & 6 deletions

File tree

configure.ac

Lines changed: 51 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,20 @@ AC_CONFIG_MACRO_DIR([macros])
1515
AC_CONFIG_AUX_DIR([build-aux])
1616
AC_PROG_INSTALL
1717

18+
dnl Overwrite _LT_PROG_AR
19+
m4_pushdef([_LT_PROG_AR],
20+
[: ${AR_FLAGS=rs}
21+
PG_PROG_AR
22+
PG_PROG_RANLIB
23+
dnl Call original _LT_PROG_AR
24+
m4_popdef([_LT_PROG_AR])
25+
_LT_PROG_AR
26+
]) # _LT_PROG_AR
27+
1828

1929
dnl Invoke libtool: we do this as it is the easiest way to find the PIC
2030
dnl flags required to build liblwgeom
21-
AC_PROG_LIBTOOL
31+
LT_INIT
2232

2333
dnl
2434
dnl Compilers
@@ -750,6 +760,22 @@ CPPFLAGS="$GEOS_CPPFLAGS"
750760
AC_CHECK_HEADER([geos_c.h], [], [AC_MSG_ERROR([could not find geos_c.h - you may need to specify the directory of a geos-config file using --with-geosconfig])])
751761
CPPFLAGS="$CPPFLAGS_SAVE"
752762

763+
#
764+
# MacOS with XCode > 15 now requires rpath entries for
765+
# libraries like GEOS/Proj that might be flexibly installed
766+
# with movability expected
767+
#
768+
case $host_os in
769+
darwin*)
770+
GEOS_RPATH=`echo $GEOS_LDFLAGS | $PERL -nle 'print "$1" if /\-L ?(\S+) /'`
771+
AC_MSG_RESULT([checking for GEOS_RPATH under MacOS... $GEOS_RPATH])
772+
if test "x$GEOS_RPATH" != "x"; then
773+
# Add the rpath setting to the LDFLAGS
774+
GEOS_LDFLAGS="$GEOS_LDFLAGS -Wl,-rpath,$GEOS_RPATH"
775+
fi
776+
;;
777+
esac
778+
753779
dnl Ensure we can link against libgeos_c
754780
LIBS_SAVE="$LIBS"
755781
LIBS="$GEOS_LDFLAGS"
@@ -885,6 +911,7 @@ elif test ! -z "$PKG_CONFIG"; then
885911
[
886912
PROJ_CPPFLAGS="$PROJ_CFLAGS"
887913
PROJ_LDFLAGS="$PROJ_LIBS"
914+
POSTGIS_PROJ_VERSION=`$PKG_CONFIG proj --modversion | sed 's/\([[0-9]]\).*\([[0-9]]\).*\([[0-9]]\)/\1\2/'`
888915
],
889916
[
890917
PROJ_LDFLAGS="-lproj"
@@ -894,6 +921,21 @@ else
894921
PROJ_LDFLAGS="-lproj"
895922
fi
896923

924+
#
925+
# MacOS with XCode > 15 now requires rpath entries for
926+
# libraries like GEOS/Proj that might be flexibly installed
927+
# with movability expected
928+
#
929+
case $host_os in
930+
darwin*)
931+
PROJ_RPATH=`echo $PROJ_LDFLAGS | $PERL -nle 'print "$1" if /\-L ?(\S+) /'`
932+
AC_MSG_RESULT([checking for PROJ_RPATH under MacOS... $PROJ_RPATH])
933+
if test "x$PROJ_RPATH" != "x"; then
934+
# Add the rpath setting to the LDFLAGS
935+
PROJ_LDFLAGS="$PROJ_LDFLAGS -Wl,-rpath,$PROJ_RPATH"
936+
fi
937+
;;
938+
esac
897939

898940
dnl Check that we can find the proj_api.h header file
899941
CPPFLAGS_SAVE="$CPPFLAGS"
@@ -906,8 +948,10 @@ AC_CHECK_HEADER([proj_api.h],
906948
)]
907949
)
908950

909-
dnl Return the PROJ.4 version number
910-
AC_PROJ_VERSION([POSTGIS_PROJ_VERSION])
951+
dnl Return the PROJ.4 version number if not detected by pkg-config
952+
if test "x$POSTGIS_PROJ_VERSION" = "x"; then
953+
AC_PROJ_VERSION([POSTGIS_PROJ_VERSION])
954+
fi
911955
AC_DEFINE_UNQUOTED([POSTGIS_PROJ_VERSION], [$POSTGIS_PROJ_VERSION], [PROJ library version])
912956
AC_SUBST([POSTGIS_PROJ_VERSION])
913957
CPPFLAGS="$CPPFLAGS_SAVE"
@@ -1022,6 +1066,7 @@ if test "$CHECK_PROTOBUF" != "no"; then
10221066
PKG_CHECK_MODULES([PROTOBUFC], [libprotobuf-c >= 1.0.0], [
10231067
PROTOBUF_CPPFLAGS="$PROTOBUFC_CFLAGS";
10241068
PROTOBUF_LDFLAGS="$PROTOBUFC_LIBS";
1069+
PROTOC_VERSION=`$PKG_CONFIG libprotobuf-c --modversion | sed 's/\([[0-9]]\).*\([[0-9]]\).*\([[0-9]]\)/\100\200\3/'`
10251070
], [
10261071
AC_MSG_RESULT([libprotobuf-c not found in pkg-config])
10271072
])
@@ -1048,11 +1093,11 @@ if test "$CHECK_PROTOBUF" != "no"; then
10481093
],[])
10491094

10501095
if test -n "$PROTOBUF_CPPFLAGS"; then
1051-
CPPFLAGS="$PROTOBUF_CPPFLAGS"
1096+
CPPFLAGS="$CPPFLAGS $PROTOBUF_CPPFLAGS"
10521097
fi
10531098

10541099
if test -n "$PROTOBUF_LDFLAGS"; then
1055-
LDFLAGS="$PROTOBUF_LDFLAGS"
1100+
LDFLAGS="$LDFLAGS $PROTOBUF_LDFLAGS"
10561101
fi
10571102

10581103
dnl confirm that discovered/configured include path works
@@ -1114,7 +1159,7 @@ AC_ARG_WITH([gui],
11141159
[GUI="yes"], [GUI="no"])
11151160

11161161
if test "x$GUI" = "xyes"; then
1117-
AC_MSG_RESULT([GUI: Build requested, checking for dependencies (GKT+2.0)])
1162+
AC_MSG_RESULT([GUI: Build requested, checking for dependencies (GTK+2.0)])
11181163
dnl Try to find the GTK libs with pkgconfig
11191164
AM_PATH_GTK_2_0([2.8.0], [GTK_BUILD="gui"], [GTK_BUILD=""])
11201165

0 commit comments

Comments
 (0)