aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Evers <kristianevers@gmail.com>2019-02-05 12:41:02 +0100
committerGitHub <noreply@github.com>2019-02-05 12:41:02 +0100
commitce83abc166015eab8a49ff9706c101dd8d5552a3 (patch)
tree687afe9e3d2c37726f4d35635fbb583e7af8b58e
parent2e6dde7a7eae34b8f93c078480db077891f03068 (diff)
parent49123c6767e6aff55701b21fa7256ae09b0b0b73 (diff)
downloadPROJ-ce83abc166015eab8a49ff9706c101dd8d5552a3.tar.gz
PROJ-ce83abc166015eab8a49ff9706c101dd8d5552a3.zip
Merge pull request #1246 from QuLogic/external-deps
Improve checks for external deps
-rw-r--r--configure.ac66
-rw-r--r--src/Makefile.am4
-rw-r--r--test/Makefile.am5
-rw-r--r--test/unit/CMakeLists.txt13
-rw-r--r--test/unit/Makefile.am16
-rwxr-xr-xtravis/mingw32/install.sh8
6 files changed, 61 insertions, 51 deletions
diff --git a/configure.ac b/configure.ac
index 95d587c6..f0caf4d8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -309,37 +309,9 @@ dnl ---------------------------------------------------------------------------
dnl Check for sqlite3 library and binary
dnl ---------------------------------------------------------------------------
-AC_ARG_WITH(sqlite3-include,
- [ --with-sqlite3-include=ARG sqlite3 include directory],,,)
-
-if test "x$with_sqlite3_include" = "x" ; then
-SQLITE3_FLAGS=""
-if test -z "`uname | grep Darwin`" ; then
- AC_CHECK_HEADERS([sqlite3.h])
- if test "$ac_cv_header_sqlite3_h" = "no" ; then
- AC_MSG_ERROR([Please install sqlite3 development package.])
- fi
-fi
-else
- SQLITE3_FLAGS="-I$with_sqlite3_include"
-fi
-AC_SUBST(SQLITE3_FLAGS,$SQLITE3_FLAGS)
-
-AC_ARG_WITH(sqlite3-ldflags,
- [ --with-sqlite3-ldflags=ARG sqlite3 link flags (i.e. -L/xxx -lsqlite3)],,,)
-
-SQLITE3_LDFLAGS=""
-if test "x$with_sqlite3_ldflags" = "x" ; then
- AC_CHECK_LIB(sqlite3,sqlite3_open,SQLITE3_LIB_FOUND=yes,SQLITE3_LIB_FOUND=no,)
- if test x"$SQLITE3_LIB_FOUND" != x"yes"; then
- AC_MSG_ERROR([Please install sqlite3 development package.])
- fi
- SQLITE3_LDFLAGS="-lsqlite3"
-else
- SQLITE3_LDFLAGS="$with_sqlite3_ldflags"
-fi
-AC_SUBST(SQLITE3_LDFLAGS,$SQLITE3_LDFLAGS)
-
+PKG_CHECK_MODULES([SQLITE3], [sqlite3 >= 3.7])
+AC_SUBST(SQLITE3_CFLAGS,$SQLITE3_CFLAGS)
+AC_SUBST(SQLITE3_LIBS,$SQLITE3_LIBS)
AC_CHECK_PROG(SQLITE3_CHECK,sqlite3,yes)
if test x"$SQLITE3_CHECK" != x"yes" ; then
@@ -347,18 +319,40 @@ if test x"$SQLITE3_CHECK" != x"yes" ; then
fi
dnl ---------------------------------------------------------------------------
+dnl Check for external Google Test
+dnl ---------------------------------------------------------------------------
+
+AC_ARG_WITH(external-gtest,
+ AS_HELP_STRING([--with-external-gtest],
+ [Whether to use external Google Test]),,)
+
+if test "x$with_external_gtest" == "xyes" ; then
+ AC_MSG_RESULT([using external GTest.])
+ PKG_CHECK_MODULES([GTEST], [gtest >= 1.8.0])
+else
+ AC_MSG_RESULT([using internal GTest.])
+ GTEST_CFLAGS="-I\$(top_srcdir)/test/googletest/include"
+ GTEST_LIBS="\$(top_builddir)/test/googletest/libgtest.la"
+fi
+AM_CONDITIONAL(USE_EXTERNAL_GTEST, [test "x$with_external_gtest" == "xyes"])
+AC_SUBST(GTEST_CFLAGS,$GTEST_CFLAGS)
+AC_SUBST(GTEST_LIBS,$GTEST_LIBS)
+
+dnl ---------------------------------------------------------------------------
dnl Generate files
dnl ---------------------------------------------------------------------------
AC_CONFIG_FILES([Makefile cmake/Makefile src/Makefile include/Makefile include/proj/Makefile include/proj/internal/Makefile
test/Makefile test/cli/Makefile test/gie/Makefile test/gigs/Makefile test/unit/Makefile
- test/googletest/Makefile test/googletest/include/Makefile
- test/googletest/include/gtest/Makefile
- test/googletest/include/gtest/internal/Makefile
- test/googletest/include/gtest/internal/custom/Makefile
- test/googletest/src/Makefile
man/Makefile man/man1/Makefile man/man3/Makefile data/Makefile
jniwrap/Makefile jniwrap/org.osgeo.proj/Makefile jniwrap/org.osgeo.proj/org/Makefile jniwrap/org.osgeo.proj/org/proj4/Makefile])
+if ! test "x$with_external_gtest" = "xyes" ; then
+ AC_CONFIG_FILES([test/googletest/Makefile test/googletest/include/Makefile
+ test/googletest/include/gtest/Makefile
+ test/googletest/include/gtest/internal/Makefile
+ test/googletest/include/gtest/internal/custom/Makefile
+ test/googletest/src/Makefile])
+fi
AC_CONFIG_FILES([data/install], [chmod +x data/install])
AC_CONFIG_FILES([proj.pc])
diff --git a/src/Makefile.am b/src/Makefile.am
index fabea4bf..e60cd3c5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -7,7 +7,7 @@ TESTS = geodtest
check_PROGRAMS = geodtest
AM_CPPFLAGS = -DPROJ_LIB=\"$(pkgdatadir)\" \
- -DMUTEX_@MUTEX_SETTING@ @JNI_INCLUDE@ -I$(top_srcdir)/include @SQLITE3_FLAGS@
+ -DMUTEX_@MUTEX_SETTING@ @JNI_INCLUDE@ -I$(top_srcdir)/include @SQLITE3_CFLAGS@
AM_CXXFLAGS = @CXX_WFLAGS@ @FLTO_FLAG@ -DPROJ_COMPILATION
include_HEADERS = proj.h proj_experimental.h proj_constants.h proj_api.h geodesic.h \
@@ -45,7 +45,7 @@ geodtest_LDADD = libproj.la
lib_LTLIBRARIES = libproj.la
libproj_la_LDFLAGS = -no-undefined -version-info 14:1:1
-libproj_la_LIBADD = @SQLITE3_LDFLAGS@
+libproj_la_LIBADD = @SQLITE3_LIBS@
libproj_la_SOURCES = \
pj_list.h proj_internal.h proj_math.h \
diff --git a/test/Makefile.am b/test/Makefile.am
index b65e9785..fa2c1e80 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -7,4 +7,7 @@ EXTRA_DIST = CMakeLists.txt
# libtestmain_la_LDFLAGS = -no-undefined
# libtestmain_la_SOURCES = test_main.cpp
-SUBDIRS = cli googletest . gie gigs unit
+if !USE_EXTERNAL_GTEST
+MAYBE_GTEST = googletest
+endif
+SUBDIRS = cli $(MAYBE_GTEST) . gie gigs unit
diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt
index a157f630..86e3484a 100644
--- a/test/unit/CMakeLists.txt
+++ b/test/unit/CMakeLists.txt
@@ -1,5 +1,16 @@
# CMake configuration for PROJ unit tests
+option(USE_EXTERNAL_GTEST "Compile against external GTest" OFF)
+
+if (USE_EXTERNAL_GTEST)
+
+message(STATUS "Using external GTest")
+find_package(GTest 1.8.0)
+
+else (USE_EXTERNAL_GTEST)
+
+message(STATUS "Using internal GTest")
+
# FIXME: Deal with our old-school CMakeLists.txt behaving badly
set(_save_c_flags "${CMAKE_C_FLAGS}")
set(_save_cxx_flags "${CMAKE_CXX_FLAGS}")
@@ -47,6 +58,8 @@ set(CMAKE_CXX_FLAGS "${_save_cxx_flags}")
unset(_save_c_flags)
unset(_save_cxx_flags)
+endif(USE_EXTERNAL_GTEST)
+
#
# Build PROJ unit tests
#
diff --git a/test/unit/Makefile.am b/test/unit/Makefile.am
index 34624b0d..210bdc90 100644
--- a/test/unit/Makefile.am
+++ b/test/unit/Makefile.am
@@ -4,7 +4,7 @@ EXTRA_DIST = CMakeLists.txt
noinst_HEADERS = gtest_include.h
-AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include -I$(top_srcdir)/test -I$(top_srcdir)/test/googletest/include @SQLITE3_FLAGS@
+AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include -I$(top_srcdir)/test @GTEST_CFLAGS@ @SQLITE3_CFLAGS@
AM_CXXFLAGS = @CXX_WFLAGS@ @NO_ZERO_AS_NULL_POINTER_CONSTANT_FLAG@
PROJ_LIB ?= ../../data
@@ -19,43 +19,43 @@ noinst_PROGRAMS += gie_self_tests
noinst_PROGRAMS += include_proj_h_from_c
pj_transform_test_SOURCES = pj_transform_test.cpp main.cpp
-pj_transform_test_LDADD = ../../src/libproj.la ../../test/googletest/libgtest.la
+pj_transform_test_LDADD = ../../src/libproj.la @GTEST_LIBS@
pj_transform_test-check: pj_transform_test
PROJ_LIB=$(PROJ_LIB) ./pj_transform_test
pj_phi2_test_SOURCES = pj_phi2_test.cpp main.cpp
-pj_phi2_test_LDADD = ../../src/libproj.la ../../test/googletest/libgtest.la
+pj_phi2_test_LDADD = ../../src/libproj.la @GTEST_LIBS@
pj_phi2_test-check: pj_phi2_test
./pj_phi2_test
proj_errno_string_test_SOURCES = proj_errno_string_test.cpp main.cpp
-proj_errno_string_test_LDADD= ../../src/libproj.la ../../test/googletest/libgtest.la
+proj_errno_string_test_LDADD= ../../src/libproj.la @GTEST_LIBS@
proj_errno_string_test-check: proj_errno_string_test
./proj_errno_string_test
proj_angular_io_test_SOURCES = proj_angular_io_test.cpp main.cpp
-proj_angular_io_test_LDADD = ../../src/libproj.la ../../test/googletest/libgtest.la
+proj_angular_io_test_LDADD = ../../src/libproj.la @GTEST_LIBS@
proj_angular_io_test-check: proj_angular_io_test
./proj_angular_io_test
proj_context_test_SOURCES = proj_context_test.cpp main.cpp
-proj_context_test_LDADD = ../../src/libproj.la ../../test/googletest/libgtest.la
+proj_context_test_LDADD = ../../src/libproj.la @GTEST_LIBS@
proj_context_test-check: proj_context_test
./proj_context_test
test_cpp_api_SOURCES = test_util.cpp test_common.cpp test_crs.cpp test_metadata.cpp test_io.cpp test_operation.cpp test_datum.cpp test_factory.cpp test_c_api.cpp main.cpp
-test_cpp_api_LDADD = ../../src/libproj.la ../../test/googletest/libgtest.la @SQLITE3_LDFLAGS@
+test_cpp_api_LDADD = ../../src/libproj.la @GTEST_LIBS@ @SQLITE3_LIBS@
test_cpp_api-check: test_cpp_api
PROJ_LIB=$(PROJ_LIB) ./test_cpp_api
gie_self_tests_SOURCES = gie_self_tests.cpp main.cpp
-gie_self_tests_LDADD = ../../src/libproj.la ../../test/googletest/libgtest.la @SQLITE3_LDFLAGS@
+gie_self_tests_LDADD = ../../src/libproj.la @GTEST_LIBS@ @SQLITE3_LIBS@
gie_self_tests-check: gie_self_tests
PROJ_LIB=$(PROJ_LIB) ./gie_self_tests
diff --git a/travis/mingw32/install.sh b/travis/mingw32/install.sh
index defe1485..e4fcfe72 100755
--- a/travis/mingw32/install.sh
+++ b/travis/mingw32/install.sh
@@ -13,15 +13,15 @@ ln -s /usr/x86_64-w64-mingw32/lib/libwinpthread-1.dll $HOME/.wine/drive_c/windo
# build sqlite3
wget https://sqlite.org/2018/sqlite-autoconf-3250100.tar.gz
tar xzf sqlite-autoconf-3250100.tar.gz
-(cd sqlite-autoconf-3250100 && CC="ccache x86_64-w64-mingw32-gcc" CXX="ccache x86_64-w64-mingw32-g++" LD=x86_64-w64-mingw32-ld ./configure --host=x86_64-w64-mingw32 --prefix=/tmp/proj_autoconf_install && make -j3 && make install)
-ln -s /tmp/proj_autoconf_install/bin/libsqlite3-0.dll $HOME/.wine/drive_c/windows
+(cd sqlite-autoconf-3250100 && CC="ccache x86_64-w64-mingw32-gcc" CXX="ccache x86_64-w64-mingw32-g++" LD=x86_64-w64-mingw32-ld ./configure --host=x86_64-w64-mingw32 --prefix=/usr/x86_64-w64-mingw32 && make -j3 && sudo make install)
+ln -s /usr/x86_64-w64-mingw32/bin/libsqlite3-0.dll $HOME/.wine/drive_c/windows
# prepare build files
./autogen.sh
# autoconf build
mkdir build_autoconf
cd build_autoconf
-CC="ccache x86_64-w64-mingw32-gcc" CXX="ccache x86_64-w64-mingw32-g++" LD=x86_64-w64-mingw32-ld ../configure --host=x86_64-w64-mingw32 --with-sqlite3_include=/tmp/proj_autoconf_install/include --with-sqlite3_ldflags="-L/tmp/proj_autoconf_install/lib -lsqlite3" --prefix=/tmp/proj_autoconf_install
+CC="ccache x86_64-w64-mingw32-gcc" CXX="ccache x86_64-w64-mingw32-g++" LD=x86_64-w64-mingw32-ld ../configure --host=x86_64-w64-mingw32 --prefix=/tmp/proj_autoconf_install
make -j3
make install
make dist-all
@@ -37,7 +37,7 @@ cd ..
# autoconf build with grids
mkdir build_autoconf_grids
cd build_autoconf_grids
-CC="ccache x86_64-w64-mingw32-gcc" CXX="ccache x86_64-w64-mingw32-g++" LD=x86_64-w64-mingw32-ld ../configure --host=x86_64-w64-mingw32 --with-sqlite3_include=/tmp/proj_autoconf_install/include --with-sqlite3_ldflags="-L/tmp/proj_autoconf_install/lib -lsqlite3" --prefix=/tmp/proj_autoconf_install_nad
+CC="ccache x86_64-w64-mingw32-gcc" CXX="ccache x86_64-w64-mingw32-g++" LD=x86_64-w64-mingw32-ld ../configure --host=x86_64-w64-mingw32 --prefix=/tmp/proj_autoconf_install_nad
make -j3
make install
find /tmp/proj_autoconf_install_nad