Skip to content

Commit

Permalink
configure: use pkg-config for PDAL configuration (#2851)
Browse files Browse the repository at this point in the history
The pdal-config, which we used so far is not actively maintained,
pkg-config is the recommended way to configure for use of PDAL.

Configure flags are simplified, either  '--with-pdal' or '--without-pdal'.

CI runners are updated to reflect this change.
  • Loading branch information
nilason committed Feb 24, 2023
1 parent 2ad3235 commit b9f6c48
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 89 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build_centos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ export CXXFLAGS="-std=gnu++11"
--without-mysql \
--without-postgres \
--without-odbc \
--without-fftw
--without-fftw \
--without-pdal

make
make install
2 changes: 1 addition & 1 deletion .github/workflows/macos_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ CONFIGURE_FLAGS="\
--with-nls \
--with-libs=${CONDA_PREFIX}/lib \
--with-includes=${CONDA_PREFIX}/include \
--with-pdal=${CONDA_PREFIX}/bin/pdal-config \
--with-pdal \
--with-readline \
--with-readline-includes=${CONDA_PREFIX}/include/readline \
--with-readline-libs=${CONDA_PREFIX}/lib
Expand Down
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,18 @@ matrix:
dist: focal
compiler: gcc
sudo: required
env: CC=gcc
env: CC=gcc CXX=g++

- os: linux
dist: focal
compiler: clang
sudo: required
env: CC=clang
env: CC=clang CXX=clang++

env:
global:
- CFLAGS="-Werror=implicit-function-declaration"
- CXXFLAGS="-std=c++11"

before_install:
- ./.travis/$TRAVIS_OS_NAME.before_install.sh
Expand Down
1 change: 1 addition & 0 deletions .travis/linux.script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
set -e

export CC="ccache $CC"
export CXX="ccache $CXX"
./configure --host=x86_64-linux-gnu \
--build=x86_64-linux-gnu \
--prefix=/usr/lib \
Expand Down
82 changes: 18 additions & 64 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,6 @@ USE_PDAL
PDAL_INC
PDAL_CPPFLAGS
PDAL_LIBS
PDAL_CONFIG
USE_LIBLAS
LIBLAS_INC
LIBLAS_CFLAGS
Expand Down Expand Up @@ -886,10 +885,10 @@ with_openmp
with_opencl
with_bzlib
with_zstd
with_pdal
with_libpng
with_gdal
with_liblas
with_pdal
with_netcdf
with_geos
with_includes
Expand Down Expand Up @@ -1609,6 +1608,7 @@ Optional Packages:
--with-opencl support OpenCL functionality (default: no)
--with-bzlib support BZIP2 functionality (default: no)
--with-zstd support Zstandard functionality (default: yes)
--with-pdal support PDAL functionality (default: yes)
--with-libpng=path/libpng-config
enable PNG support (libpng-config with path,
e.g. '--with-libpng=/usr/local/bin/libpng-config')
Expand All @@ -1619,10 +1619,6 @@ Optional Packages:
enable libLAS support (liblas-config with path,
e.g. '--with-liblas=/usr/local/bin/liblas-config',
default: no)
--with-pdal=path/pdal-config
enable PDAL support (pdal-config with path,
e.g. '--with-pdal=/usr/local/bin/pdal-config',
default: no)
--with-netcdf=path/nc-config
enable NetCDF support (nc-config with path,
e.g. '--with-nc=/usr/local/bin/nc-config',
Expand Down Expand Up @@ -4698,6 +4694,16 @@ fi



# Check whether --with-pdal was given.
if test "${with_pdal+set}" = set; then :
withval=$with_pdal;
else
with_pdal=yes
fi




# Check whether --with-libpng was given.
if test "${with_libpng+set}" = set; then :
withval=$with_libpng;
Expand All @@ -4721,15 +4727,6 @@ fi



# Check whether --with-pdal was given.
if test "${with_pdal+set}" = set; then :
withval=$with_pdal;
else
with_pdal="no"
fi



# Check whether --with-netcdf was given.
if test "${with_netcdf+set}" = set; then :
withval=$with_netcdf;
Expand Down Expand Up @@ -9344,65 +9341,22 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
PDAL_LIBS=
PDAL_CPPFLAGS=
USE_PDAL=

if test "`basename xx/$with_pdal`" = "pdal-config" ; then
PDAL_CONFIG="$with_pdal"
fi
pdal="pdal"

if test "$with_pdal" = "no" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
# Extract the first word of "pdal-config", so it can be a program name with args.
set dummy pdal-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }

case $PDAL_CONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_PDAL_CONFIG="$PDAL_CONFIG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_PDAL_CONFIG="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
if test -s "${PKG_CONFIG} --exists ${pdal}" ; then
as_fn_error $? "*** Unable to locate PDAL package." "$LINENO" 5
fi
done
done
IFS=$as_save_IFS

test -z "$ac_cv_path_PDAL_CONFIG" && ac_cv_path_PDAL_CONFIG="no"
;;
esac
PDAL_CONFIG=$ac_cv_path_PDAL_CONFIG
if test -n "$PDAL_CONFIG"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PDAL_CONFIG" >&5
$as_echo "$PDAL_CONFIG" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi



if test "$PDAL_CONFIG" = "no" ; then
as_fn_error $? "*** could not find pdal-config" "$LINENO" 5
fi

if test "$PDAL_CONFIG" != "" ; then
PDAL_LIBS=`"$PDAL_CONFIG" --libs`
PDAL_INC=`"$PDAL_CONFIG" --includes`
USE_PDAL=1
fi
PDAL_LIBS=`${PKG_CONFIG} --libs "${pdal}"`
PDAL_INC=`${PKG_CONFIG} --cflags "${pdal}"`
USE_PDAL=1

PDAL=
ac_save_libs="$LIBS"
Expand Down
27 changes: 8 additions & 19 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ LOC_ARG_WITH(openmp, OpenMP, no)
LOC_ARG_WITH(opencl, OpenCL, no)
LOC_ARG_WITH(bzlib, BZIP2, no)
LOC_ARG_WITH(zstd, Zstandard)
LOC_ARG_WITH(pdal, PDAL)

AC_ARG_WITH(libpng,
[ --with-libpng[=path/libpng-config]
Expand All @@ -324,12 +325,6 @@ AC_ARG_WITH(liblas,
e.g. '--with-liblas=/usr/local/bin/liblas-config',
default: no)],, with_liblas="no")

AC_ARG_WITH(pdal,
[ --with-pdal[=path/pdal-config]
enable PDAL support (pdal-config with path,
e.g. '--with-pdal=/usr/local/bin/pdal-config',
default: no)],, with_pdal="no")

AC_ARG_WITH(netcdf,
[ --with-netcdf[=path/nc-config]
enable NetCDF support (nc-config with path,
Expand Down Expand Up @@ -1042,26 +1037,20 @@ AC_LANG_PUSH(C++)
PDAL_LIBS=
PDAL_CPPFLAGS=
USE_PDAL=

if test "`basename xx/$with_pdal`" = "pdal-config" ; then
PDAL_CONFIG="$with_pdal"
fi
pdal="pdal"

if test "$with_pdal" = "no" ; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
AC_PATH_PROG(PDAL_CONFIG, pdal-config, no)

if test "$PDAL_CONFIG" = "no" ; then
AC_MSG_ERROR([*** could not find pdal-config])
if test -s "${PKG_CONFIG} --exists ${pdal}" ; then
AC_MSG_ERROR([*** Unable to locate PDAL package.])
fi

if test "$PDAL_CONFIG" != "" ; then
PDAL_LIBS=`"$PDAL_CONFIG" --libs`
PDAL_INC=`"$PDAL_CONFIG" --includes`
USE_PDAL=1
fi
PDAL_LIBS=`${PKG_CONFIG} --libs "${pdal}"`
PDAL_INC=`${PKG_CONFIG} --cflags "${pdal}"`
USE_PDAL=1

PDAL=
ac_save_libs="$LIBS"
Expand All @@ -1080,7 +1069,7 @@ else
LIBS=${ac_save_libs}
CFLAGS=${ac_save_cflags}

AC_DEFINE(HAVE_PDAL, 1, [define if PDAL exists])
AC_DEFINE(HAVE_PDAL, 1, [Define to 1 if PDAL is to be used.])
fi

AC_SUBST(PDAL_LIBS)
Expand Down
2 changes: 1 addition & 1 deletion include/grass/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
/* define if glXCreatePbuffer exists */
#undef HAVE_PBUFFERS

/* define if PDAL exists */
/* Define to 1 if PDAL is to be used. */
#undef HAVE_PDAL

/* define if glXCreateGLXPixmap exists */
Expand Down
3 changes: 2 additions & 1 deletion mswindows/osgeo4w/build_osgeo4w.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ export ARCH=x86_64-w64-mingw32
--with-opengl=windows \
--with-bzlib \
--with-liblas=${SRC}/mswindows/osgeo4w/liblas-config \
--with-netcdf=${OSGEO4W_ROOT_MSYS}/bin/nc-config
--with-netcdf=${OSGEO4W_ROOT_MSYS}/bin/nc-config \
--without-pdal

make

Expand Down

0 comments on commit b9f6c48

Please sign in to comment.