proj-8.2.1/000755 000765 000024 00000000000 14164067216 013145 5ustar00keversstaff000000 000000 proj-8.2.1/CITATION000644 000765 000024 00000000706 14162105275 014301 0ustar00keversstaff000000 000000 To cite PROJ in publications use: PROJ contributors (2020). PROJ coordinate transformation software library. Open Source Geospatial Foundation. URL https://proj.org/. A BibTeX entry for LaTeX users is .. code-block:: latex @Manual{, title = {{PROJ} coordinate transformation software library}, author = {{PROJ contributors}}, organization = {Open Source Geospatial Foundation}, year = {2022}, url = {https://proj.org/}, } proj-8.2.1/man/000755 000765 000024 00000000000 14164067215 013717 5ustar00keversstaff000000 000000 proj-8.2.1/install-sh000755 000765 000024 00000036010 13426641720 015147 0ustar00keversstaff000000 000000 #!/bin/sh # install - install a program, script, or datafile scriptversion=2018-03-11.20; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. tab=' ' nl=' ' IFS=" $tab$nl" # Set DOITPROG to "echo" to test this script. doit=${DOITPROG-} doit_exec=${doit:-exec} # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false is_target_a_directory=possibly usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) is_target_a_directory=always dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) is_target_a_directory=never;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done # We allow the use of options -d and -T together, by making -d # take the precedence; this is for compatibility with GNU install. if test -n "$dir_arg"; then if test -n "$dst_arg"; then echo "$0: target directory not allowed when installing a directory." >&2 exit 1 fi fi if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then if test $# -gt 1 || test "$is_target_a_directory" = always; then if test ! -d "$dst_arg"; then echo "$0: $dst_arg: Is not a directory." >&2 exit 1 fi fi fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dstbase=`basename "$src"` case $dst in */) dst=$dst$dstbase;; *) dst=$dst/$dstbase;; esac dstdir_status=0 else dstdir=`dirname "$dst"` test -d "$dstdir" dstdir_status=$? fi fi case $dstdir in */) dstdirslash=$dstdir;; *) dstdirslash=$dstdir/;; esac obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) # Note that $RANDOM variable is not portable (e.g. dash); Use it # here however when possible just to lower collision chance. tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0 # Because "mkdir -p" follows existing symlinks and we likely work # directly in world-writeable /tmp, make sure that the '$tmpdir' # directory is successfully created first before we actually test # 'mkdir -p' feature. if (umask $mkdir_umask && $mkdirprog $mkdir_mode "$tmpdir" && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. test_tmpdir="$tmpdir/a" ls_ld_tmpdir=`ls -ld "$test_tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac oIFS=$IFS IFS=/ set -f set fnord $dstdir shift set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=${dstdirslash}_inst.$$_ rmtmp=${dstdirslash}_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: proj-8.2.1/configure.ac000644 000765 000024 00000043110 14164067106 015430 0ustar00keversstaff000000 000000 dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) AC_INIT([PROJ], [8.2.1], [https://github.com/OSGeo/PROJ/issues], proj, [https://proj.org]) AC_CONFIG_MACRO_DIR([m4]) AC_LANG(C) AC_CONFIG_AUX_DIR([.]) AM_INIT_AUTOMAKE([subdir-objects]) AM_CONFIG_HEADER(src/proj_config.h) dnl Checks for programs. AC_PROG_CC AC_PROG_CC_C99 AC_PROG_CXX AX_CXX_COMPILE_STDCXX_11([noext],[mandatory]) AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET AM_PROG_LIBTOOL PKG_PROG_PKG_CONFIG dnl Enable as much warnings as possible AX_CFLAGS_WARN_ALL(C_WFLAGS) AX_CXXFLAGS_WARN_ALL(CXX_WFLAGS) dnl For ICC: it needs -we10006 instead of -Werror to turn unknown options to errors dnl Some gcc/clang versions might succeed on this test, so also include -Werror in ERROR_ON_UNKNOWN_OPTIONS AX_CHECK_COMPILE_FLAG([-Werror -we10006],[ERROR_ON_UNKNOWN_OPTIONS="-Werror -we10006"],[ERROR_ON_UNKNOWN_OPTIONS="-Werror"]) dnl A few ICC warnings to turn off dnl warning #188: enumerated type mixed with another type (needed on libcsf) dnl warning #1684: conversion from pointer to same-sized integral type (potential portability problem) (needed on frmts/mrf) dnl warning #2259: non-pointer conversion from "size_t={unsigned long}" to "int" may lose significant bits dnl warning #2304: non-explicit constructor with single argument may cause implicit type conversion dnl warning #3280: declaration hides member dnl remark #11074: Inlining inhibited by limit max-size dnl remark #11076: To get full report use -qopt-report=4 -qopt-report-phase ipo AX_CHECK_COMPILE_FLAG([-diag-disable 188,1684,2259,2304,3280,11074,11076],[C_WFLAGS="$C_WFLAGS -diag-disable 188,1684,2259,2304,3280,11074,11076" CXX_WFLAGS="$CXX_WFLAGS -diag-disable 188,1684,2259,2304,3280,11074,11076"],,[$ERROR_ON_UNKNOWN_OPTIONS]) AX_CHECK_COMPILE_FLAG([-Wextra],[C_WFLAGS="$C_WFLAGS -Wextra" CXX_WFLAGS="$CXX_WFLAGS -Wextra"],,[$ERROR_ON_UNKNOWN_OPTIONS]) AX_CHECK_COMPILE_FLAG([-Winit-self],[C_WFLAGS="$C_WFLAGS -Winit-self" CXX_WFLAGS="$CXX_WFLAGS -Winit-self"],,[$ERROR_ON_UNKNOWN_OPTIONS]) AX_CHECK_COMPILE_FLAG([-Wunused-parameter], [C_WFLAGS="$C_WFLAGS -Wunused-parameter" CXX_WFLAGS="$CXX_WFLAGS -Wunused-parameter" NO_UNUSED_PARAMETER_FLAG="-Wno-unused-parameter"],,[$ERROR_ON_UNKNOWN_OPTIONS]) AX_CHECK_COMPILE_FLAG([-Wmissing-prototypes], [C_WFLAGS="$C_WFLAGS -Wmissing-prototypes"],,[$ERROR_ON_UNKNOWN_OPTIONS]) AX_CHECK_COMPILE_FLAG([-Wmissing-declarations], [C_WFLAGS="$C_WFLAGS -Wmissing-declarations"],,[$ERROR_ON_UNKNOWN_OPTIONS]) AX_CHECK_COMPILE_FLAG([-Wformat], [C_WFLAGS="$C_WFLAGS -Wformat" CXX_WFLAGS="$CXX_WFLAGS -Wformat"],,[$ERROR_ON_UNKNOWN_OPTIONS]) AX_CHECK_COMPILE_FLAG([-Wformat -Werror=format-security -Wno-format-nonliteral], [C_WFLAGS="$C_WFLAGS -Werror=format-security -Wno-format-nonliteral" CXX_WFLAGS="$CXX_WFLAGS -Werror=format-security -Wno-format-nonliteral"],,[$ERROR_ON_UNKNOWN_OPTIONS]) AX_CHECK_COMPILE_FLAG([-Wshorten-64-to-32], [C_WFLAGS="$C_WFLAGS -Wshorten-64-to-32" CXX_WFLAGS="$CXX_WFLAGS -Wshorten-64-to-32"],,[$ERROR_ON_UNKNOWN_OPTIONS]) AX_CHECK_COMPILE_FLAG([-Wlogical-op], [C_WFLAGS="$C_WFLAGS -Wlogical-op" CXX_WFLAGS="$CXX_WFLAGS -Wlogical-op" NO_LOGICAL_OP_FLAG="-Wno-logical-op"],,[$ERROR_ON_UNKNOWN_OPTIONS]) AX_CHECK_COMPILE_FLAG([-Wshadow], [C_WFLAGS="$C_WFLAGS -Wshadow" CXX_WFLAGS="$CXX_WFLAGS -Wshadow"],,[$ERROR_ON_UNKNOWN_OPTIONS]) dnl Error out on things that will fail with MSVC AX_CHECK_COMPILE_FLAG([-Werror=vla], [C_WFLAGS="$C_WFLAGS -Werror=vla" CXX_WFLAGS="$CXX_WFLAGS -Werror=vla"],,[$ERROR_ON_UNKNOWN_OPTIONS]) AX_CHECK_COMPILE_FLAG([-Werror=declaration-after-statement], [C_WFLAGS="$C_WFLAGS -Wdeclaration-after-statement"],,[$ERROR_ON_UNKNOWN_OPTIONS]) dnl -Wclobbered is not reliable on most gcc versions dnl AX_CHECK_COMPILE_FLAG([-Wno-clobbered], [C_WFLAGS="$C_WFLAGS -Wno-clobbered" CXX_WFLAGS="$CXX_WFLAGS -Wno-clobbered"],,[$ERROR_ON_UNKNOWN_OPTIONS]) dnl Warn when macros __TIME__, __DATE__ or __TIMESTAMP__ are encountered as they might prevent bit-wise-identical reproducible compilations. AX_CHECK_COMPILE_FLAG([-Wdate-time], [C_WFLAGS="$C_WFLAGS -Wdate-time" CXX_WFLAGS="$CXX_WFLAGS -Wdate-time"],,[$ERROR_ON_UNKNOWN_OPTIONS]) dnl GCC 6 warnings AX_CHECK_COMPILE_FLAG([-Wnull-dereference], [C_WFLAGS="$C_WFLAGS -Wnull-dereference" CXX_WFLAGS="$CXX_WFLAGS -Wnull-dereference"],,[$ERROR_ON_UNKNOWN_OPTIONS]) AX_CHECK_COMPILE_FLAG([-Wduplicated-cond], [C_WFLAGS="$C_WFLAGS -Wduplicated-cond" CXX_WFLAGS="$CXX_WFLAGS -Wduplicated-cond"],,[$ERROR_ON_UNKNOWN_OPTIONS]) dnl GCC 7 warnings dnl Do not enable yet. Causes warning in alg/gdalthinplate.cpp due to armadillo templates dnl AX_CHECK_COMPILE_FLAG([-Wduplicated-branches], [C_WFLAGS="$C_WFLAGS -Wduplicated-branches" CXX_WFLAGS="$CXX_WFLAGS -Wduplicated-branches"],,[$ERROR_ON_UNKNOWN_OPTIONS]) dnl GCC 8 warnings AC_LANG_PUSH([C++]) AX_CHECK_COMPILE_FLAG([-Wextra-semi], [CXX_WFLAGS="$CXX_WFLAGS -Wextra-semi"],,[$ERROR_ON_UNKNOWN_OPTIONS]) AC_LANG_POP([C++]) AX_CHECK_COMPILE_FLAG([-Wno-sign-compare], [NO_SIGN_COMPARE="-Wno-sign-compare"],,[$ERROR_ON_UNKNOWN_OPTIONS]) dnl clang >= 3.9 AX_CHECK_COMPILE_FLAG([-Wcomma], [C_WFLAGS="$C_WFLAGS -Wcomma" CXX_WFLAGS="$CXX_WFLAGS -Wcomma"],,[$ERROR_ON_UNKNOWN_OPTIONS]) dnl clang and gcc 5 AX_CHECK_COMPILE_FLAG([-Wfloat-conversion], [C_WFLAGS="$C_WFLAGS -Wfloat-conversion" CXX_WFLAGS="$CXX_WFLAGS -Wfloat-conversion"],,[$ERROR_ON_UNKNOWN_OPTIONS]) dnl clang >= 3.2 AX_CHECK_COMPILE_FLAG([-Wdocumentation -Wno-documentation-deprecated-sync], [C_WFLAGS="$C_WFLAGS -Wdocumentation -Wno-documentation-deprecated-sync" CXX_WFLAGS="$CXX_WFLAGS -Wdocumentation -Wno-documentation-deprecated-sync"],,[$ERROR_ON_UNKNOWN_OPTIONS]) dnl C++ specific stuff AC_LANG_PUSH([C++]) AX_CHECK_COMPILE_FLAG([-Wunused-private-field], [CXX_WFLAGS="$CXX_WFLAGS -Wunused-private-field"],,[$ERROR_ON_UNKNOWN_OPTIONS]) AX_CHECK_COMPILE_FLAG([-Wmissing-declarations], [CXX_WFLAGS="$CXX_WFLAGS -Wmissing-declarations"],,[$ERROR_ON_UNKNOWN_OPTIONS]) AX_CHECK_COMPILE_FLAG([-Wnon-virtual-dtor], [CXX_WFLAGS="$CXX_WFLAGS -Wnon-virtual-dtor" NO_NON_VIRTUAL_DTOR_FLAG="-Wno-non-virtual-dtor"],,[$ERROR_ON_UNKNOWN_OPTIONS]) AX_CHECK_COMPILE_FLAG([-Wold-style-cast], [WARN_OLD_STYLE_CAST="-Wold-style-cast"],,[$ERROR_ON_UNKNOWN_OPTIONS]) AX_CHECK_COMPILE_FLAG([-Weffc++], [WARN_EFFCPLUSPLUS="-Weffc++"],,[$ERROR_ON_UNKNOWN_OPTIONS]) dnl g++-4.8 complain a bit too much with -Weffc++ if test "$WARN_EFFCPLUSPLUS" != ""; then SAVED_CXXFLAGS=$CXXFLAGS CXXFLAGS="$CXXFLAGS $WARN_EFFCPLUSPLUS -Werror" AC_MSG_CHECKING([if -Weffc++ should be enabled]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [[ class Base {}; class A: public Base {}; ]])], [AC_MSG_RESULT([yes])], [WARN_EFFCPLUSPLUS=""] [AC_MSG_RESULT([no])]) CXXFLAGS="$SAVED_CXXFLAGS" CXX_WFLAGS="$CXX_WFLAGS $WARN_EFFCPLUSPLUS" fi dnl Clang enables -Woverloaded-virtual if -Wall is defined, but not GCC AX_CHECK_COMPILE_FLAG([-Woverloaded-virtual], [CXX_WFLAGS="$CXX_WFLAGS -Woverloaded-virtual"],,[$ERROR_ON_UNKNOWN_OPTIONS]) AX_CHECK_COMPILE_FLAG([-Wweak-vtables], [CXX_WFLAGS="$CXX_WFLAGS -Wweak-vtables"],,[$ERROR_ON_UNKNOWN_OPTIONS]) AX_CHECK_COMPILE_FLAG([-Wdeprecated], [CXX_WFLAGS="$CXX_WFLAGS -Wdeprecated"],,[$ERROR_ON_UNKNOWN_OPTIONS]) AX_CHECK_COMPILE_FLAG([-Wabstract-vbase-init], [CXX_WFLAGS="$CXX_WFLAGS -Wabstract-vbase-init"],,[$ERROR_ON_UNKNOWN_OPTIONS]) AX_CHECK_COMPILE_FLAG([-Winconsistent-missing-destructor-override], [CXX_WFLAGS="$CXX_WFLAGS -Winconsistent-missing-destructor-override"],,[$ERROR_ON_UNKNOWN_OPTIONS]) HAVE_GCC_WARNING_ZERO_AS_NULL_POINTER_CONSTANT=no AX_CHECK_COMPILE_FLAG([-Wzero-as-null-pointer-constant], [CXX_WFLAGS="$CXX_WFLAGS -Wzero-as-null-pointer-constant" HAVE_GCC_WARNING_ZERO_AS_NULL_POINTER_CONSTANT=yes NO_ZERO_AS_NULL_POINTER_CONSTANT_FLAG="-Wno-zero-as-null-pointer-constant"],,[$ERROR_ON_UNKNOWN_OPTIONS]) if test "$HAVE_GCC_WARNING_ZERO_AS_NULL_POINTER_CONSTANT" = "yes"; then AC_DEFINE_UNQUOTED(HAVE_GCC_WARNING_ZERO_AS_NULL_POINTER_CONSTANT, 1, [Define to 1 if the compiler supports -Wzero-as-null-pointer-constant]) fi AC_LANG_POP([C++]) dnl --------------------------------------------------------------------------- dnl Check for --enable-lto dnl --------------------------------------------------------------------------- AC_MSG_CHECKING([to enable LTO (link time optimization) build]) AC_ARG_ENABLE(lto, AS_HELP_STRING([--enable-lto], [enable LTO(link time optimization) (disabled by default)])) FLTO_FLAG="" if test "x$enable_lto" = "xyes"; then AC_LANG_PUSH([C++]) AX_CHECK_COMPILE_FLAG([-flto], [FLTO_FLAG="-flto"],,[$ERROR_ON_UNKNOWN_OPTIONS]) if test "$FLTO_FLAG" != ""; then SAVED_CXXFLAGS=$CXXFLAGS CXXFLAGS="$CXXFLAGS $FLTO_FLAG -Werror" AC_MSG_CHECKING([if -flto is available at link time]) AC_LINK_IFELSE([AC_LANG_PROGRAM( [[]])], [AC_MSG_RESULT([yes])], [FLTO_FLAG=""] [AC_MSG_RESULT([no])]) CXXFLAGS="$SAVED_CXXFLAGS" fi AC_LANG_POP([C++]) AX_CHECK_COMPILE_FLAG([-Wodr], [CXX_WFLAGS="$CXX_WFLAGS -Wodr"],,[$ERROR_ON_UNKNOWN_OPTIONS]) else AC_MSG_RESULT([no]) fi AC_SUBST(FLTO_FLAG,$FLTO_FLAG) dnl Result in better inlining, but larger file dnl AX_CHECK_COMPILE_FLAG([-fno-semantic-interposition], [CFLAGS="$CFLAGS -fno-semantic-interposition" CXXFLAGS="$CXXFLAGS -fno-semantic-interposition"],,[$ERROR_ON_UNKNOWN_OPTIONS]) AC_SUBST(C_WFLAGS,$C_WFLAGS) AC_SUBST(CXX_WFLAGS,$CXX_WFLAGS) AC_SUBST(NO_ZERO_AS_NULL_POINTER_CONSTANT_FLAG,$NO_ZERO_AS_NULL_POINTER_CONSTANT_FLAG) CFLAGS="${CFLAGS} -fvisibility=hidden" CXXFLAGS="${CXXFLAGS} -fvisibility=hidden" case "${host_os}" in cygwin* | mingw32* | pw32* | beos* | darwin*) CFLAGS="${CFLAGS} -DNOMINMAX" CXXFLAGS="${CXXFLAGS} -DNOMINMAX" ;; *) ;; esac dnl Checks for libraries. save_CFLAGS="$CFLAGS" CFLAGS=`echo "$CFLAGS" | sed "s/-Werror/ /"` AC_CHECK_LIB(m,exp,,HAVE_LIBM=no,) CFLAGS="$save_CFLAGS" dnl We check for headers AC_HEADER_STDC dnl Check flag for accurate arithmetic with Intel compiler. This is dnl needed to stop the compiler from ignoring parentheses in expressions dnl like (a + b) + c and from simplifying 0.0 + x to x (which is wrong if dnl x = -0.0). AX_CHECK_COMPILE_FLAG([-fp-model precise], [CFLAGS="$CFLAGS -fp-model precise"],,[-Werror]) AC_SEARCH_LIBS([sqrt], [m]) AC_CHECK_FUNC(localeconv, [AC_DEFINE(HAVE_LOCALECONV,1,[Define to 1 if you have localeconv])]) AC_CHECK_FUNCS([strerror]) AC_CHECK_LIB(dl,dladdr,,HAVE_LIBDL=no,) dnl --------------------------------------------------------------------------- dnl Provide a mechanism to disable real mutex support (if lacking win32 or dnl posix mutexes for instance). dnl --------------------------------------------------------------------------- AC_ARG_WITH([mutex], AS_HELP_STRING([--without-mutex], [Disable real mutex locks (lacking pthreads)]),,) AC_MSG_CHECKING([for mutexes]) THREAD_LIB="" if test "$with_mutex" = yes -o x"$with_mutex" = x ; then MUTEX_SETTING=pthread AC_CHECK_LIB(pthread,pthread_create,PTHREAD_EXISTS=YES,,,) if test -n "$PTHREAD_EXISTS" ; then THREAD_LIB="-lpthread" fi AC_CHECK_LIB(pthread,pthread_mutexattr_settype,,,) AC_CHECK_DECL(PTHREAD_MUTEX_RECURSIVE, AC_DEFINE(HAVE_PTHREAD_MUTEX_RECURSIVE, [], [Define if your pthreads implementation have PTHREAD_MUTEX_RECURSIVE]), , [#include ]) AC_MSG_RESULT([enabled, pthread]) else MUTEX_SETTING=stub AC_MSG_RESULT([disabled by user]) fi AC_SUBST(MUTEX_SETTING,$MUTEX_SETTING) AC_SUBST(THREAD_LIB,$THREAD_LIB) dnl --------------------------------------------------------------------------- dnl Check for sqlite3 library and binary dnl --------------------------------------------------------------------------- if test "x$SQLITE3_CFLAGS$SQLITE3_LIBS" = "x" ; then dnl Would build and run with older versions, but with horrible performance dnl See https://github.com/OSGeo/PROJ/issues/1718 PKG_CHECK_MODULES([SQLITE3], [sqlite3 >= 3.11]) fi 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 AC_MSG_ERROR([Please install sqlite3 binary.]) fi dnl --------------------------------------------------------------------------- dnl Check for libtiff dnl --------------------------------------------------------------------------- AC_ARG_ENABLE([tiff], AS_HELP_STRING([--enable-tiff], [Enable TIFF support; strongly encouraged to read some grids [default=yes]])) if test "x$enable_tiff" != "xno" -o "x$enable_tiff" = ""; then if test "x$TIFF_CFLAGS$TIFF_LIBS" = "x" ; then if $PKG_CONFIG libtiff; then PKG_CHECK_MODULES([TIFF], [libtiff]) else PKG_CHECK_MODULES([TIFF], [libtiff-4]) fi fi TIFF_ENABLED_FLAGS=-DTIFF_ENABLED fi AC_SUBST(TIFF_CFLAGS,$TIFF_CFLAGS) AC_SUBST(TIFF_LIBS,$TIFF_LIBS) AC_SUBST(TIFF_ENABLED_FLAGS,$TIFF_ENABLED_FLAGS) dnl --------------------------------------------------------------------------- dnl Check for curl dnl --------------------------------------------------------------------------- FOUND_CURL=no CURL_CFLAGS= CURL_LIB= AC_ARG_WITH(curl, [ --with-curl[=ARG] Enable curl support (ARG=path to curl-config.)],,,) dnl Clear some cache variables unset ac_cv_path_LIBCURL if test "`basename xx/$with_curl`" = "curl-config" ; then LIBCURL_CONFIG="$with_curl" elif test "$with_curl" = "no" ; then LIBCURL_CONFIG=no else AC_PATH_PROG(LIBCURL_CONFIG, curl-config, not-found) fi if test "$LIBCURL_CONFIG" = "not-found" ; then AC_MSG_ERROR([curl not found. If wanting to do a build without curl support (and thus without built-in networking capability), explictly disable it with --without-curl]) elif test "$LIBCURL_CONFIG" != "no" ; then CURL_VERNUM=`$LIBCURL_CONFIG --vernum` CURL_VER=`$LIBCURL_CONFIG --version | awk '{print $2}'` AC_MSG_RESULT([ found libcurl version $CURL_VER]) AC_CHECK_LIB(curl,curl_global_init,FOUND_CURL=yes,FOUND_CURL=no,`$LIBCURL_CONFIG --libs`) if test "$FOUND_CURL" = "no" ; then AC_MSG_ERROR([curl not found. If wanting to do a build without curl support (and thus without built-in networking capability), explictly disable it with --without-curl]) fi CURL_ENABLED_FLAGS=-DCURL_ENABLED fi if test "$FOUND_CURL" = "yes" ; then CURL_CFLAGS=`$LIBCURL_CONFIG --cflags` CURL_LIBS=`$LIBCURL_CONFIG --libs` fi AC_SUBST(CURL_CFLAGS,$CURL_CFLAGS) AC_SUBST(CURL_LIBS,$CURL_LIBS) AC_SUBST(CURL_ENABLED_FLAGS,$CURL_ENABLED_FLAGS) AM_CONDITIONAL(HAVE_CURL, [test "x$FOUND_CURL" = "xyes"]) dnl --------------------------------------------------------------------------- dnl Check for extra libraries, required for static linking with pkg-config dnl --------------------------------------------------------------------------- EXTRA_LIBS="-lstdc++ -lsqlite3" if test "no$THREAD_LIB" != "no"; then EXTRA_LIBS="$EXTRA_LIBS $THREAD_LIB" fi if test "x$enable_tiff" != "xno" -o "x$enable_tiff" = ""; then EXTRA_LIBS="$EXTRA_LIBS -ltiff" fi if test "$FOUND_CURL" = "yes" ; then EXTRA_LIBS="$EXTRA_LIBS -lcurl" fi if test "$HAVE_LIBM" != "no" ; then EXTRA_LIBS="$EXTRA_LIBS -lm" fi if test "$HAVE_LIBDL" != "no" ; then EXTRA_LIBS="$EXTRA_LIBS -ldl" fi AC_SUBST(EXTRA_LIBS,$EXTRA_LIBS) dnl --------------------------------------------------------------------------- dnl proj-lib-env-var-tried-last dnl --------------------------------------------------------------------------- AC_ARG_ENABLE(proj-lib-env-var-tried-last, AS_HELP_STRING([--enable-proj-lib-env-var-tried-last], [Whether the PROJ_LIB environment variable should be tried after the hardcoded location [default=no]])) if test "x$enable_proj_lib_env_var_tried_last" = "xyes"; then AC_SUBST(PROJ_LIB_ENV_VAR_TRIED_LAST_FLAGS,-DPROJ_LIB_ENV_VAR_TRIED_LAST) 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 include/proj/internal/vendor/Makefile include/proj/internal/vendor/nlohmann/Makefile test/Makefile test/cli/Makefile test/gie/Makefile test/gigs/Makefile test/unit/Makefile man/Makefile man/man1/Makefile data/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([proj.pc]) AC_OUTPUT proj-8.2.1/INSTALL000644 000765 000024 00000017227 13612256475 014213 0ustar00keversstaff000000 000000 Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, a file `config.cache' that saves the results of its tests to speed up reconfiguring, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.in' is used to create `configure' by a program called `autoconf'. You only need `configure.in' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. You can give `configure' initial values for variables by setting them in the environment. Using a Bourne-compatible shell, you can do that on the command line like this: CC=c99 CFLAGS=-O2 LIBS=-lposix ./configure Or on systems that have the `env' program, you can do it like this: env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not supports the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' can not figure out automatically, but needs to determine by the type of host the package will run on. Usually `configure' can figure that out, but if it prints a message saying it can not guess the host type, give it the `--host=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name with three fields: CPU-COMPANY-SYSTEM See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the host type. If you are building compiler tools for cross-compiling, you can also use the `--target=TYPE' option to select the type of system they will produce code for and the `--build=TYPE' option to select the type of system on which you are compiling the package. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Operation Controls ================== `configure' recognizes the following options to control how it operates. `--cache-file=FILE' Use and save the results of the tests in FILE instead of `./config.cache'. Set FILE to `/dev/null' to disable caching, for debugging `configure'. `--help' Print a summary of the options to `configure', and exit. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--version' Print the version of Autoconf used to generate the `configure' script, and exit. `configure' also accepts some other, not widely useful, options. proj-8.2.1/ltmain.sh000644 000765 000024 00001170771 14162103551 014772 0ustar00keversstaff000000 000000 #! /bin/sh ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in ## by inline-source v2014-01-03.01 # libtool (GNU libtool) 2.4.6 # Provide generalized library-building support services. # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . PROGRAM=libtool PACKAGE=libtool VERSION=2.4.6 package_revision=2.4.6 ## ------ ## ## Usage. ## ## ------ ## # Run './libtool --help' for help with using this script from the # command line. ## ------------------------------- ## ## User overridable command paths. ## ## ------------------------------- ## # After configure completes, it has a better idea of some of the # shell tools we need than the defaults used by the functions shared # with bootstrap, so set those here where they can still be over- # ridden by the user, but otherwise take precedence. : ${AUTOCONF="autoconf"} : ${AUTOMAKE="automake"} ## -------------------------- ## ## Source external libraries. ## ## -------------------------- ## # Much of our low-level functionality needs to be sourced from external # libraries, which are installed to $pkgauxdir. # Set a version string for this script. scriptversion=2015-01-20.17; # UTC # General shell script boiler plate, and helper functions. # Written by Gary V. Vaughan, 2004 # Copyright (C) 2004-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # As a special exception to the GNU General Public License, if you distribute # this file as part of a program or library that is built using GNU Libtool, # you may include this file under the same distribution terms that you use # for the rest of that program. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # Please report bugs or propose patches to gary@gnu.org. ## ------ ## ## Usage. ## ## ------ ## # Evaluate this file near the top of your script to gain access to # the functions and variables defined here: # # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh # # If you need to override any of the default environment variable # settings, do that before evaluating this file. ## -------------------- ## ## Shell normalisation. ## ## -------------------- ## # Some shells need a little help to be as Bourne compatible as possible. # Before doing anything else, make sure all that help has been provided! DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # NLS nuisances: We save the old values in case they are required later. _G_user_locale= _G_safe_locale= for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test set = \"\${$_G_var+set}\"; then save_$_G_var=\$$_G_var $_G_var=C export $_G_var _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\" _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\" fi" done # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Make sure IFS has a sensible default sp=' ' nl=' ' IFS="$sp $nl" # There are apparently some retarded systems that use ';' as a PATH separator! if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi ## ------------------------- ## ## Locate command utilities. ## ## ------------------------- ## # func_executable_p FILE # ---------------------- # Check that FILE is an executable regular file. func_executable_p () { test -f "$1" && test -x "$1" } # func_path_progs PROGS_LIST CHECK_FUNC [PATH] # -------------------------------------------- # Search for either a program that responds to --version with output # containing "GNU", or else returned by CHECK_FUNC otherwise, by # trying all the directories in PATH with each of the elements of # PROGS_LIST. # # CHECK_FUNC should accept the path to a candidate program, and # set $func_check_prog_result if it truncates its output less than # $_G_path_prog_max characters. func_path_progs () { _G_progs_list=$1 _G_check_func=$2 _G_PATH=${3-"$PATH"} _G_path_prog_max=0 _G_path_prog_found=false _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:} for _G_dir in $_G_PATH; do IFS=$_G_save_IFS test -z "$_G_dir" && _G_dir=. for _G_prog_name in $_G_progs_list; do for _exeext in '' .EXE; do _G_path_prog=$_G_dir/$_G_prog_name$_exeext func_executable_p "$_G_path_prog" || continue case `"$_G_path_prog" --version 2>&1` in *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;; *) $_G_check_func $_G_path_prog func_path_progs_result=$func_check_prog_result ;; esac $_G_path_prog_found && break 3 done done done IFS=$_G_save_IFS test -z "$func_path_progs_result" && { echo "no acceptable sed could be found in \$PATH" >&2 exit 1 } } # We want to be able to use the functions in this file before configure # has figured out where the best binaries are kept, which means we have # to search for them ourselves - except when the results are already set # where we skip the searches. # Unless the user overrides by setting SED, search the path for either GNU # sed, or the sed that truncates its output the least. test -z "$SED" && { _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for _G_i in 1 2 3 4 5 6 7; do _G_sed_script=$_G_sed_script$nl$_G_sed_script done echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed _G_sed_script= func_check_prog_sed () { _G_path_prog=$1 _G_count=0 printf 0123456789 >conftest.in while : do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo '' >> conftest.nl "$_G_path_prog" -f conftest.sed conftest.out 2>/dev/null || break diff conftest.out conftest.nl >/dev/null 2>&1 || break _G_count=`expr $_G_count + 1` if test "$_G_count" -gt "$_G_path_prog_max"; then # Best one so far, save it but keep looking for a better one func_check_prog_result=$_G_path_prog _G_path_prog_max=$_G_count fi # 10*(2^10) chars as input seems more than enough test 10 -lt "$_G_count" && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out } func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin rm -f conftest.sed SED=$func_path_progs_result } # Unless the user overrides by setting GREP, search the path for either GNU # grep, or the grep that truncates its output the least. test -z "$GREP" && { func_check_prog_grep () { _G_path_prog=$1 _G_count=0 _G_path_prog_max=0 printf 0123456789 >conftest.in while : do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo 'GREP' >> conftest.nl "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' conftest.out 2>/dev/null || break diff conftest.out conftest.nl >/dev/null 2>&1 || break _G_count=`expr $_G_count + 1` if test "$_G_count" -gt "$_G_path_prog_max"; then # Best one so far, save it but keep looking for a better one func_check_prog_result=$_G_path_prog _G_path_prog_max=$_G_count fi # 10*(2^10) chars as input seems more than enough test 10 -lt "$_G_count" && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out } func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin GREP=$func_path_progs_result } ## ------------------------------- ## ## User overridable command paths. ## ## ------------------------------- ## # All uppercase variable names are used for environment variables. These # variables can be overridden by the user before calling a script that # uses them if a suitable command of that name is not already available # in the command search PATH. : ${CP="cp -f"} : ${ECHO="printf %s\n"} : ${EGREP="$GREP -E"} : ${FGREP="$GREP -F"} : ${LN_S="ln -s"} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} ## -------------------- ## ## Useful sed snippets. ## ## -------------------- ## sed_dirname='s|/[^/]*$||' sed_basename='s|^.*/||' # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='s|\([`"$\\]\)|\\\1|g' # Same as above, but do not quote variable references. sed_double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution that turns a string into a regex matching for the # string literally. sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g' # Sed substitution that converts a w32 file name or path # that contains forward slashes, into one that contains # (escaped) backslashes. A very naive implementation. sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Re-'\' parameter expansions in output of sed_double_quote_subst that # were '\'-ed in input to the same. If an odd number of '\' preceded a # '$' in input to sed_double_quote_subst, that '$' was protected from # expansion. Since each input '\' is now two '\'s, look for any number # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'. _G_bs='\\' _G_bs2='\\\\' _G_bs4='\\\\\\\\' _G_dollar='\$' sed_double_backslash="\ s/$_G_bs4/&\\ /g s/^$_G_bs2$_G_dollar/$_G_bs&/ s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g s/\n//g" ## ----------------- ## ## Global variables. ## ## ----------------- ## # Except for the global variables explicitly listed below, the following # functions in the '^func_' namespace, and the '^require_' namespace # variables initialised in the 'Resource management' section, sourcing # this file will not pollute your global namespace with anything # else. There's no portable way to scope variables in Bourne shell # though, so actually running these functions will sometimes place # results into a variable named after the function, and often use # temporary variables in the '^_G_' namespace. If you are careful to # avoid using those namespaces casually in your sourcing script, things # should continue to work as you expect. And, of course, you can freely # overwrite any of the functions or variables defined here before # calling anything to customize them. EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. # Allow overriding, eg assuming that you follow the convention of # putting '$debug_cmd' at the start of all your functions, you can get # bash to show function call trace with: # # debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name debug_cmd=${debug_cmd-":"} exit_cmd=: # By convention, finish your script with: # # exit $exit_status # # so that you can set exit_status to non-zero if you want to indicate # something went wrong during execution without actually bailing out at # the point of failure. exit_status=$EXIT_SUCCESS # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath=$0 # The name of this program. progname=`$ECHO "$progpath" |$SED "$sed_basename"` # Make sure we have an absolute progpath for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=`$ECHO "$progpath" |$SED "$sed_dirname"` progdir=`cd "$progdir" && pwd` progpath=$progdir/$progname ;; *) _G_IFS=$IFS IFS=${PATH_SEPARATOR-:} for progdir in $PATH; do IFS=$_G_IFS test -x "$progdir/$progname" && break done IFS=$_G_IFS test -n "$progdir" || progdir=`pwd` progpath=$progdir/$progname ;; esac ## ----------------- ## ## Standard options. ## ## ----------------- ## # The following options affect the operation of the functions defined # below, and should be set appropriately depending on run-time para- # meters passed on the command line. opt_dry_run=false opt_quiet=false opt_verbose=false # Categories 'all' and 'none' are always available. Append any others # you will pass as the first argument to func_warning from your own # code. warning_categories= # By default, display warnings according to 'opt_warning_types'. Set # 'warning_func' to ':' to elide all warnings, or func_fatal_error to # treat the next displayed warning as a fatal error. warning_func=func_warn_and_continue # Set to 'all' to display all warnings, 'none' to suppress all # warnings, or a space delimited list of some subset of # 'warning_categories' to display only the listed warnings. opt_warning_types=all ## -------------------- ## ## Resource management. ## ## -------------------- ## # This section contains definitions for functions that each ensure a # particular resource (a file, or a non-empty configuration variable for # example) is available, and if appropriate to extract default values # from pertinent package files. Call them using their associated # 'require_*' variable to ensure that they are executed, at most, once. # # It's entirely deliberate that calling these functions can set # variables that don't obey the namespace limitations obeyed by the rest # of this file, in order that that they be as useful as possible to # callers. # require_term_colors # ------------------- # Allow display of bold text on terminals that support it. require_term_colors=func_require_term_colors func_require_term_colors () { $debug_cmd test -t 1 && { # COLORTERM and USE_ANSI_COLORS environment variables take # precedence, because most terminfo databases neglect to describe # whether color sequences are supported. test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"} if test 1 = "$USE_ANSI_COLORS"; then # Standard ANSI escape sequences tc_reset='' tc_bold=''; tc_standout='' tc_red=''; tc_green='' tc_blue=''; tc_cyan='' else # Otherwise trust the terminfo database after all. test -n "`tput sgr0 2>/dev/null`" && { tc_reset=`tput sgr0` test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold` tc_standout=$tc_bold test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso` test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1` test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2` test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4` test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5` } fi } require_term_colors=: } ## ----------------- ## ## Function library. ## ## ----------------- ## # This section contains a variety of useful functions to call in your # scripts. Take note of the portable wrappers for features provided by # some modern shells, which will fall back to slower equivalents on # less featureful shells. # func_append VAR VALUE # --------------------- # Append VALUE onto the existing contents of VAR. # We should try to minimise forks, especially on Windows where they are # unreasonably slow, so skip the feature probes when bash or zsh are # being used: if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then : ${_G_HAVE_ARITH_OP="yes"} : ${_G_HAVE_XSI_OPS="yes"} # The += operator was introduced in bash 3.1 case $BASH_VERSION in [12].* | 3.0 | 3.0*) ;; *) : ${_G_HAVE_PLUSEQ_OP="yes"} ;; esac fi # _G_HAVE_PLUSEQ_OP # Can be empty, in which case the shell is probed, "yes" if += is # useable or anything else if it does not work. test -z "$_G_HAVE_PLUSEQ_OP" \ && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \ && _G_HAVE_PLUSEQ_OP=yes if test yes = "$_G_HAVE_PLUSEQ_OP" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_append () { $debug_cmd eval "$1+=\$2" }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_append () { $debug_cmd eval "$1=\$$1\$2" } fi # func_append_quoted VAR VALUE # ---------------------------- # Quote VALUE and append to the end of shell variable VAR, separated # by a space. if test yes = "$_G_HAVE_PLUSEQ_OP"; then eval 'func_append_quoted () { $debug_cmd func_quote_for_eval "$2" eval "$1+=\\ \$func_quote_for_eval_result" }' else func_append_quoted () { $debug_cmd func_quote_for_eval "$2" eval "$1=\$$1\\ \$func_quote_for_eval_result" } fi # func_append_uniq VAR VALUE # -------------------------- # Append unique VALUE onto the existing contents of VAR, assuming # entries are delimited by the first character of VALUE. For example: # # func_append_uniq options " --another-option option-argument" # # will only append to $options if " --another-option option-argument " # is not already present somewhere in $options already (note spaces at # each end implied by leading space in second argument). func_append_uniq () { $debug_cmd eval _G_current_value='`$ECHO $'$1'`' _G_delim=`expr "$2" : '\(.\)'` case $_G_delim$_G_current_value$_G_delim in *"$2$_G_delim"*) ;; *) func_append "$@" ;; esac } # func_arith TERM... # ------------------ # Set func_arith_result to the result of evaluating TERMs. test -z "$_G_HAVE_ARITH_OP" \ && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \ && _G_HAVE_ARITH_OP=yes if test yes = "$_G_HAVE_ARITH_OP"; then eval 'func_arith () { $debug_cmd func_arith_result=$(( $* )) }' else func_arith () { $debug_cmd func_arith_result=`expr "$@"` } fi # func_basename FILE # ------------------ # Set func_basename_result to FILE with everything up to and including # the last / stripped. if test yes = "$_G_HAVE_XSI_OPS"; then # If this shell supports suffix pattern removal, then use it to avoid # forking. Hide the definitions single quotes in case the shell chokes # on unsupported syntax... _b='func_basename_result=${1##*/}' _d='case $1 in */*) func_dirname_result=${1%/*}$2 ;; * ) func_dirname_result=$3 ;; esac' else # ...otherwise fall back to using sed. _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`' _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"` if test "X$func_dirname_result" = "X$1"; then func_dirname_result=$3 else func_append func_dirname_result "$2" fi' fi eval 'func_basename () { $debug_cmd '"$_b"' }' # func_dirname FILE APPEND NONDIR_REPLACEMENT # ------------------------------------------- # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. eval 'func_dirname () { $debug_cmd '"$_d"' }' # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT # -------------------------------------------------------- # Perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # For efficiency, we do not delegate to the functions above but instead # duplicate the functionality here. eval 'func_dirname_and_basename () { $debug_cmd '"$_b"' '"$_d"' }' # func_echo ARG... # ---------------- # Echo program name prefixed message. func_echo () { $debug_cmd _G_message=$* func_echo_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_IFS $ECHO "$progname: $_G_line" done IFS=$func_echo_IFS } # func_echo_all ARG... # -------------------- # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } # func_echo_infix_1 INFIX ARG... # ------------------------------ # Echo program name, followed by INFIX on the first line, with any # additional lines not showing INFIX. func_echo_infix_1 () { $debug_cmd $require_term_colors _G_infix=$1; shift _G_indent=$_G_infix _G_prefix="$progname: $_G_infix: " _G_message=$* # Strip color escape sequences before counting printable length for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan" do test -n "$_G_tc" && { _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"` _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"` } done _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes func_echo_infix_1_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_infix_1_IFS $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2 _G_prefix=$_G_indent done IFS=$func_echo_infix_1_IFS } # func_error ARG... # ----------------- # Echo program name prefixed message to standard error. func_error () { $debug_cmd $require_term_colors func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2 } # func_fatal_error ARG... # ----------------------- # Echo program name prefixed message to standard error, and exit. func_fatal_error () { $debug_cmd func_error "$*" exit $EXIT_FAILURE } # func_grep EXPRESSION FILENAME # ----------------------------- # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $debug_cmd $GREP "$1" "$2" >/dev/null 2>&1 } # func_len STRING # --------------- # Set func_len_result to the length of STRING. STRING may not # start with a hyphen. test -z "$_G_HAVE_XSI_OPS" \ && (eval 'x=a/b/c; test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ && _G_HAVE_XSI_OPS=yes if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_len () { $debug_cmd func_len_result=${#1} }' else func_len () { $debug_cmd func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` } fi # func_mkdir_p DIRECTORY-PATH # --------------------------- # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { $debug_cmd _G_directory_path=$1 _G_dir_list= if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then # Protect directory names starting with '-' case $_G_directory_path in -*) _G_directory_path=./$_G_directory_path ;; esac # While some portion of DIR does not yet exist... while test ! -d "$_G_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. _G_dir_list=$_G_directory_path:$_G_dir_list # If the last portion added has no slash in it, the list is done case $_G_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"` done _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'` func_mkdir_p_IFS=$IFS; IFS=: for _G_dir in $_G_dir_list; do IFS=$func_mkdir_p_IFS # mkdir can fail with a 'File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! $MKDIR "$_G_dir" 2>/dev/null || : done IFS=$func_mkdir_p_IFS # Bail out if we (or some other process) failed to create a directory. test -d "$_G_directory_path" || \ func_fatal_error "Failed to create '$1'" fi } # func_mktempdir [BASENAME] # ------------------------- # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, BASENAME is the basename for that directory. func_mktempdir () { $debug_cmd _G_template=${TMPDIR-/tmp}/${1-$progname} if test : = "$opt_dry_run"; then # Return a directory name, but don't create it in dry-run mode _G_tmpdir=$_G_template-$$ else # If mktemp works, use that first and foremost _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null` if test ! -d "$_G_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race _G_tmpdir=$_G_template-${RANDOM-0}$$ func_mktempdir_umask=`umask` umask 0077 $MKDIR "$_G_tmpdir" umask $func_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$_G_tmpdir" || \ func_fatal_error "cannot create temporary directory '$_G_tmpdir'" fi $ECHO "$_G_tmpdir" } # func_normal_abspath PATH # ------------------------ # Remove doubled-up and trailing slashes, "." path components, # and cancel out any ".." path components in PATH after making # it an absolute path. func_normal_abspath () { $debug_cmd # These SED scripts presuppose an absolute path with a trailing slash. _G_pathcar='s|^/\([^/]*\).*$|\1|' _G_pathcdr='s|^/[^/]*||' _G_removedotparts=':dotsl s|/\./|/|g t dotsl s|/\.$|/|' _G_collapseslashes='s|/\{1,\}|/|g' _G_finalslash='s|/*$|/|' # Start from root dir and reassemble the path. func_normal_abspath_result= func_normal_abspath_tpath=$1 func_normal_abspath_altnamespace= case $func_normal_abspath_tpath in "") # Empty path, that just means $cwd. func_stripname '' '/' "`pwd`" func_normal_abspath_result=$func_stripname_result return ;; # The next three entries are used to spot a run of precisely # two leading slashes without using negated character classes; # we take advantage of case's first-match behaviour. ///*) # Unusual form of absolute path, do nothing. ;; //*) # Not necessarily an ordinary path; POSIX reserves leading '//' # and for example Cygwin uses it to access remote file shares # over CIFS/SMB, so we conserve a leading double slash if found. func_normal_abspath_altnamespace=/ ;; /*) # Absolute path, do nothing. ;; *) # Relative path, prepend $cwd. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath ;; esac # Cancel out all the simple stuff to save iterations. We also want # the path to end with a slash for ease of parsing, so make sure # there is one (and only one) here. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"` while :; do # Processed it all yet? if test / = "$func_normal_abspath_tpath"; then # If we ascended to the root using ".." the result may be empty now. if test -z "$func_normal_abspath_result"; then func_normal_abspath_result=/ fi break fi func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_pathcar"` func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_pathcdr"` # Figure out what to do with it case $func_normal_abspath_tcomponent in "") # Trailing empty path component, ignore it. ;; ..) # Parent dir; strip last assembled component from result. func_dirname "$func_normal_abspath_result" func_normal_abspath_result=$func_dirname_result ;; *) # Actual path component, append it. func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent" ;; esac done # Restore leading double-slash if one was found on entry. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result } # func_notquiet ARG... # -------------------- # Echo program name prefixed message only when not in quiet mode. func_notquiet () { $debug_cmd $opt_quiet || func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to # work around that: : } # func_relative_path SRCDIR DSTDIR # -------------------------------- # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR. func_relative_path () { $debug_cmd func_relative_path_result= func_normal_abspath "$1" func_relative_path_tlibdir=$func_normal_abspath_result func_normal_abspath "$2" func_relative_path_tbindir=$func_normal_abspath_result # Ascend the tree starting from libdir while :; do # check if we have found a prefix of bindir case $func_relative_path_tbindir in $func_relative_path_tlibdir) # found an exact match func_relative_path_tcancelled= break ;; $func_relative_path_tlibdir*) # found a matching prefix func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" func_relative_path_tcancelled=$func_stripname_result if test -z "$func_relative_path_result"; then func_relative_path_result=. fi break ;; *) func_dirname $func_relative_path_tlibdir func_relative_path_tlibdir=$func_dirname_result if test -z "$func_relative_path_tlibdir"; then # Have to descend all the way to the root! func_relative_path_result=../$func_relative_path_result func_relative_path_tcancelled=$func_relative_path_tbindir break fi func_relative_path_result=../$func_relative_path_result ;; esac done # Now calculate path; take care to avoid doubling-up slashes. func_stripname '' '/' "$func_relative_path_result" func_relative_path_result=$func_stripname_result func_stripname '/' '/' "$func_relative_path_tcancelled" if test -n "$func_stripname_result"; then func_append func_relative_path_result "/$func_stripname_result" fi # Normalisation. If bindir is libdir, return '.' else relative path. if test -n "$func_relative_path_result"; then func_stripname './' '' "$func_relative_path_result" func_relative_path_result=$func_stripname_result fi test -n "$func_relative_path_result" || func_relative_path_result=. : } # func_quote_for_eval ARG... # -------------------------- # Aesthetically quote ARGs to be evaled later. # This function returns two values: # i) func_quote_for_eval_result # double-quoted, suitable for a subsequent eval # ii) func_quote_for_eval_unquoted_result # has all characters that are still active within double # quotes backslashified. func_quote_for_eval () { $debug_cmd func_quote_for_eval_unquoted_result= func_quote_for_eval_result= while test 0 -lt $#; do case $1 in *[\\\`\"\$]*) _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; *) _G_unquoted_arg=$1 ;; esac if test -n "$func_quote_for_eval_unquoted_result"; then func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg" else func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg" fi case $_G_unquoted_arg in # Double-quote args containing shell metacharacters to delay # word splitting, command substitution and variable expansion # for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") _G_quoted_arg=\"$_G_unquoted_arg\" ;; *) _G_quoted_arg=$_G_unquoted_arg ;; esac if test -n "$func_quote_for_eval_result"; then func_append func_quote_for_eval_result " $_G_quoted_arg" else func_append func_quote_for_eval_result "$_G_quoted_arg" fi shift done } # func_quote_for_expand ARG # ------------------------- # Aesthetically quote ARG to be evaled later; same as above, # but do not quote variable references. func_quote_for_expand () { $debug_cmd case $1 in *[\\\`\"]*) _G_arg=`$ECHO "$1" | $SED \ -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;; *) _G_arg=$1 ;; esac case $_G_arg in # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") _G_arg=\"$_G_arg\" ;; esac func_quote_for_expand_result=$_G_arg } # func_stripname PREFIX SUFFIX NAME # --------------------------------- # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_stripname () { $debug_cmd # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary variable first. func_stripname_result=$3 func_stripname_result=${func_stripname_result#"$1"} func_stripname_result=${func_stripname_result%"$2"} }' else func_stripname () { $debug_cmd case $2 in .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;; *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;; esac } fi # func_show_eval CMD [FAIL_EXP] # ----------------------------- # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { $debug_cmd _G_cmd=$1 _G_fail_exp=${2-':'} func_quote_for_expand "$_G_cmd" eval "func_notquiet $func_quote_for_expand_result" $opt_dry_run || { eval "$_G_cmd" _G_status=$? if test 0 -ne "$_G_status"; then eval "(exit $_G_status); $_G_fail_exp" fi } } # func_show_eval_locale CMD [FAIL_EXP] # ------------------------------------ # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { $debug_cmd _G_cmd=$1 _G_fail_exp=${2-':'} $opt_quiet || { func_quote_for_expand "$_G_cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || { eval "$_G_user_locale $_G_cmd" _G_status=$? eval "$_G_safe_locale" if test 0 -ne "$_G_status"; then eval "(exit $_G_status); $_G_fail_exp" fi } } # func_tr_sh # ---------- # Turn $1 into a string suitable for a shell variable name. # Result is stored in $func_tr_sh_result. All characters # not in the set a-zA-Z0-9_ are replaced with '_'. Further, # if $1 begins with a digit, a '_' is prepended as well. func_tr_sh () { $debug_cmd case $1 in [0-9]* | *[!a-zA-Z0-9_]*) func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'` ;; * ) func_tr_sh_result=$1 ;; esac } # func_verbose ARG... # ------------------- # Echo program name prefixed message in verbose mode only. func_verbose () { $debug_cmd $opt_verbose && func_echo "$*" : } # func_warn_and_continue ARG... # ----------------------------- # Echo program name prefixed warning message to standard error. func_warn_and_continue () { $debug_cmd $require_term_colors func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2 } # func_warning CATEGORY ARG... # ---------------------------- # Echo program name prefixed warning message to standard error. Warning # messages can be filtered according to CATEGORY, where this function # elides messages where CATEGORY is not listed in the global variable # 'opt_warning_types'. func_warning () { $debug_cmd # CATEGORY must be in the warning_categories list! case " $warning_categories " in *" $1 "*) ;; *) func_internal_error "invalid warning category '$1'" ;; esac _G_category=$1 shift case " $opt_warning_types " in *" $_G_category "*) $warning_func ${1+"$@"} ;; esac } # func_sort_ver VER1 VER2 # ----------------------- # 'sort -V' is not generally available. # Note this deviates from the version comparison in automake # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a # but this should suffice as we won't be specifying old # version formats or redundant trailing .0 in bootstrap.conf. # If we did want full compatibility then we should probably # use m4_version_compare from autoconf. func_sort_ver () { $debug_cmd printf '%s\n%s\n' "$1" "$2" \ | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n } # func_lt_ver PREV CURR # --------------------- # Return true if PREV and CURR are in the correct order according to # func_sort_ver, otherwise false. Use it like this: # # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..." func_lt_ver () { $debug_cmd test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q` } # Local variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: #! /bin/sh # Set a version string for this script. scriptversion=2014-01-07.03; # UTC # A portable, pluggable option parser for Bourne shell. # Written by Gary V. Vaughan, 2010 # Copyright (C) 2010-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # Please report bugs or propose patches to gary@gnu.org. ## ------ ## ## Usage. ## ## ------ ## # This file is a library for parsing options in your shell scripts along # with assorted other useful supporting features that you can make use # of too. # # For the simplest scripts you might need only: # # #!/bin/sh # . relative/path/to/funclib.sh # . relative/path/to/options-parser # scriptversion=1.0 # func_options ${1+"$@"} # eval set dummy "$func_options_result"; shift # ...rest of your script... # # In order for the '--version' option to work, you will need to have a # suitably formatted comment like the one at the top of this file # starting with '# Written by ' and ending with '# warranty; '. # # For '-h' and '--help' to work, you will also need a one line # description of your script's purpose in a comment directly above the # '# Written by ' line, like the one at the top of this file. # # The default options also support '--debug', which will turn on shell # execution tracing (see the comment above debug_cmd below for another # use), and '--verbose' and the func_verbose function to allow your script # to display verbose messages only when your user has specified # '--verbose'. # # After sourcing this file, you can plug processing for additional # options by amending the variables from the 'Configuration' section # below, and following the instructions in the 'Option parsing' # section further down. ## -------------- ## ## Configuration. ## ## -------------- ## # You should override these variables in your script after sourcing this # file so that they reflect the customisations you have added to the # option parser. # The usage line for option parsing errors and the start of '-h' and # '--help' output messages. You can embed shell variables for delayed # expansion at the time the message is displayed, but you will need to # quote other shell meta-characters carefully to prevent them being # expanded when the contents are evaled. usage='$progpath [OPTION]...' # Short help message in response to '-h' and '--help'. Add to this or # override it after sourcing this library to reflect the full set of # options your script accepts. usage_message="\ --debug enable verbose shell tracing -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] -v, --verbose verbosely report processing --version print version information and exit -h, --help print short or long help message and exit " # Additional text appended to 'usage_message' in response to '--help'. long_help_message=" Warning categories include: 'all' show all warnings 'none' turn off all the warnings 'error' warnings are treated as fatal errors" # Help message printed before fatal option parsing errors. fatal_help="Try '\$progname --help' for more information." ## ------------------------- ## ## Hook function management. ## ## ------------------------- ## # This section contains functions for adding, removing, and running hooks # to the main code. A hook is just a named list of of function, that can # be run in order later on. # func_hookable FUNC_NAME # ----------------------- # Declare that FUNC_NAME will run hooks added with # 'func_add_hook FUNC_NAME ...'. func_hookable () { $debug_cmd func_append hookable_fns " $1" } # func_add_hook FUNC_NAME HOOK_FUNC # --------------------------------- # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must # first have been declared "hookable" by a call to 'func_hookable'. func_add_hook () { $debug_cmd case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not accept hook functions." ;; esac eval func_append ${1}_hooks '" $2"' } # func_remove_hook FUNC_NAME HOOK_FUNC # ------------------------------------ # Remove HOOK_FUNC from the list of functions called by FUNC_NAME. func_remove_hook () { $debug_cmd eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`' } # func_run_hooks FUNC_NAME [ARG]... # --------------------------------- # Run all hook functions registered to FUNC_NAME. # It is assumed that the list of hook functions contains nothing more # than a whitespace-delimited list of legal shell function names, and # no effort is wasted trying to catch shell meta-characters or preserve # whitespace. func_run_hooks () { $debug_cmd case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not support hook funcions.n" ;; esac eval _G_hook_fns=\$$1_hooks; shift for _G_hook in $_G_hook_fns; do eval $_G_hook '"$@"' # store returned options list back into positional # parameters for next 'cmd' execution. eval _G_hook_result=\$${_G_hook}_result eval set dummy "$_G_hook_result"; shift done func_quote_for_eval ${1+"$@"} func_run_hooks_result=$func_quote_for_eval_result } ## --------------- ## ## Option parsing. ## ## --------------- ## # In order to add your own option parsing hooks, you must accept the # full positional parameter list in your hook function, remove any # options that you action, and then pass back the remaining unprocessed # options in '_result', escaped suitably for # 'eval'. Like this: # # my_options_prep () # { # $debug_cmd # # # Extend the existing usage message. # usage_message=$usage_message' # -s, --silent don'\''t print informational messages # ' # # func_quote_for_eval ${1+"$@"} # my_options_prep_result=$func_quote_for_eval_result # } # func_add_hook func_options_prep my_options_prep # # # my_silent_option () # { # $debug_cmd # # # Note that for efficiency, we parse as many options as we can # # recognise in a loop before passing the remainder back to the # # caller on the first unrecognised argument we encounter. # while test $# -gt 0; do # opt=$1; shift # case $opt in # --silent|-s) opt_silent=: ;; # # Separate non-argument short options: # -s*) func_split_short_opt "$_G_opt" # set dummy "$func_split_short_opt_name" \ # "-$func_split_short_opt_arg" ${1+"$@"} # shift # ;; # *) set dummy "$_G_opt" "$*"; shift; break ;; # esac # done # # func_quote_for_eval ${1+"$@"} # my_silent_option_result=$func_quote_for_eval_result # } # func_add_hook func_parse_options my_silent_option # # # my_option_validation () # { # $debug_cmd # # $opt_silent && $opt_verbose && func_fatal_help "\ # '--silent' and '--verbose' options are mutually exclusive." # # func_quote_for_eval ${1+"$@"} # my_option_validation_result=$func_quote_for_eval_result # } # func_add_hook func_validate_options my_option_validation # # You'll alse need to manually amend $usage_message to reflect the extra # options you parse. It's preferable to append if you can, so that # multiple option parsing hooks can be added safely. # func_options [ARG]... # --------------------- # All the functions called inside func_options are hookable. See the # individual implementations for details. func_hookable func_options func_options () { $debug_cmd func_options_prep ${1+"$@"} eval func_parse_options \ ${func_options_prep_result+"$func_options_prep_result"} eval func_validate_options \ ${func_parse_options_result+"$func_parse_options_result"} eval func_run_hooks func_options \ ${func_validate_options_result+"$func_validate_options_result"} # save modified positional parameters for caller func_options_result=$func_run_hooks_result } # func_options_prep [ARG]... # -------------------------- # All initialisations required before starting the option parse loop. # Note that when calling hook functions, we pass through the list of # positional parameters. If a hook function modifies that list, and # needs to propogate that back to rest of this script, then the complete # modified list must be put in 'func_run_hooks_result' before # returning. func_hookable func_options_prep func_options_prep () { $debug_cmd # Option defaults: opt_verbose=false opt_warning_types= func_run_hooks func_options_prep ${1+"$@"} # save modified positional parameters for caller func_options_prep_result=$func_run_hooks_result } # func_parse_options [ARG]... # --------------------------- # The main option parsing loop. func_hookable func_parse_options func_parse_options () { $debug_cmd func_parse_options_result= # this just eases exit handling while test $# -gt 0; do # Defer to hook functions for initial option parsing, so they # get priority in the event of reusing an option name. func_run_hooks func_parse_options ${1+"$@"} # Adjust func_parse_options positional parameters to match eval set dummy "$func_run_hooks_result"; shift # Break out of the loop if we already parsed every option. test $# -gt 0 || break _G_opt=$1 shift case $_G_opt in --debug|-x) debug_cmd='set -x' func_echo "enabling shell trace mode" $debug_cmd ;; --no-warnings|--no-warning|--no-warn) set dummy --warnings none ${1+"$@"} shift ;; --warnings|--warning|-W) test $# = 0 && func_missing_arg $_G_opt && break case " $warning_categories $1" in *" $1 "*) # trailing space prevents matching last $1 above func_append_uniq opt_warning_types " $1" ;; *all) opt_warning_types=$warning_categories ;; *none) opt_warning_types=none warning_func=: ;; *error) opt_warning_types=$warning_categories warning_func=func_fatal_error ;; *) func_fatal_error \ "unsupported warning category: '$1'" ;; esac shift ;; --verbose|-v) opt_verbose=: ;; --version) func_version ;; -\?|-h) func_usage ;; --help) func_help ;; # Separate optargs to long options (plugins may need this): --*=*) func_split_equals "$_G_opt" set dummy "$func_split_equals_lhs" \ "$func_split_equals_rhs" ${1+"$@"} shift ;; # Separate optargs to short options: -W*) func_split_short_opt "$_G_opt" set dummy "$func_split_short_opt_name" \ "$func_split_short_opt_arg" ${1+"$@"} shift ;; # Separate non-argument short options: -\?*|-h*|-v*|-x*) func_split_short_opt "$_G_opt" set dummy "$func_split_short_opt_name" \ "-$func_split_short_opt_arg" ${1+"$@"} shift ;; --) break ;; -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; esac done # save modified positional parameters for caller func_quote_for_eval ${1+"$@"} func_parse_options_result=$func_quote_for_eval_result } # func_validate_options [ARG]... # ------------------------------ # Perform any sanity checks on option settings and/or unconsumed # arguments. func_hookable func_validate_options func_validate_options () { $debug_cmd # Display all warnings if -W was not given. test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" func_run_hooks func_validate_options ${1+"$@"} # Bail if the options were screwed! $exit_cmd $EXIT_FAILURE # save modified positional parameters for caller func_validate_options_result=$func_run_hooks_result } ## ----------------- ## ## Helper functions. ## ## ----------------- ## # This section contains the helper functions used by the rest of the # hookable option parser framework in ascii-betical order. # func_fatal_help ARG... # ---------------------- # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { $debug_cmd eval \$ECHO \""Usage: $usage"\" eval \$ECHO \""$fatal_help"\" func_error ${1+"$@"} exit $EXIT_FAILURE } # func_help # --------- # Echo long help message to standard output and exit. func_help () { $debug_cmd func_usage_message $ECHO "$long_help_message" exit 0 } # func_missing_arg ARGNAME # ------------------------ # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { $debug_cmd func_error "Missing argument for '$1'." exit_cmd=exit } # func_split_equals STRING # ------------------------ # Set func_split_equals_lhs and func_split_equals_rhs shell variables after # splitting STRING at the '=' sign. test -z "$_G_HAVE_XSI_OPS" \ && (eval 'x=a/b/c; test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ && _G_HAVE_XSI_OPS=yes if test yes = "$_G_HAVE_XSI_OPS" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_split_equals () { $debug_cmd func_split_equals_lhs=${1%%=*} func_split_equals_rhs=${1#*=} test "x$func_split_equals_lhs" = "x$1" \ && func_split_equals_rhs= }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_split_equals () { $debug_cmd func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'` func_split_equals_rhs= test "x$func_split_equals_lhs" = "x$1" \ || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'` } fi #func_split_equals # func_split_short_opt SHORTOPT # ----------------------------- # Set func_split_short_opt_name and func_split_short_opt_arg shell # variables after splitting SHORTOPT after the 2nd character. if test yes = "$_G_HAVE_XSI_OPS" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_split_short_opt () { $debug_cmd func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"} }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_split_short_opt () { $debug_cmd func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'` func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'` } fi #func_split_short_opt # func_usage # ---------- # Echo short help message to standard output and exit. func_usage () { $debug_cmd func_usage_message $ECHO "Run '$progname --help |${PAGER-more}' for full usage" exit 0 } # func_usage_message # ------------------ # Echo short help message to standard output. func_usage_message () { $debug_cmd eval \$ECHO \""Usage: $usage"\" echo $SED -n 's|^# || /^Written by/{ x;p;x } h /^Written by/q' < "$progpath" echo eval \$ECHO \""$usage_message"\" } # func_version # ------------ # Echo version message to standard output and exit. func_version () { $debug_cmd printf '%s\n' "$progname $scriptversion" $SED -n ' /(C)/!b go :more /\./!{ N s|\n# | | b more } :go /^# Written by /,/# warranty; / { s|^# || s|^# *$|| s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| p } /^# Written by / { s|^# || p } /^warranty; /q' < "$progpath" exit $? } # Local variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: # Set a version string. scriptversion='(GNU libtool) 2.4.6' # func_echo ARG... # ---------------- # Libtool also displays the current mode in messages, so override # funclib.sh func_echo with this custom definition. func_echo () { $debug_cmd _G_message=$* func_echo_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_IFS $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line" done IFS=$func_echo_IFS } # func_warning ARG... # ------------------- # Libtool warnings are not categorized, so override funclib.sh # func_warning with this simpler definition. func_warning () { $debug_cmd $warning_func ${1+"$@"} } ## ---------------- ## ## Options parsing. ## ## ---------------- ## # Hook in the functions to make sure our own options are parsed during # the option parsing loop. usage='$progpath [OPTION]... [MODE-ARG]...' # Short help message in response to '-h'. usage_message="Options: --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information and exit --mode=MODE use operation mode MODE --no-warnings equivalent to '-Wnone' --preserve-dup-deps don't remove duplicate dependency libraries --quiet, --silent don't print informational messages --tag=TAG use configuration variables from tag TAG -v, --verbose print more informational messages than default --version print version information -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] -h, --help, --help-all print short, long, or detailed help message " # Additional text appended to 'usage_message' in response to '--help'. func_help () { $debug_cmd func_usage_message $ECHO "$long_help_message MODE must be one of the following: clean remove files from the build directory compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries install install libraries or executables link create a library or an executable uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. When passed as first option, '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that. Try '$progname --help --mode=MODE' for a more detailed description of MODE. When reporting a bug, please describe a test case to reproduce it and include the following information: host-triplet: $host shell: $SHELL compiler: $LTCC compiler flags: $LTCFLAGS linker: $LD (gnu? $with_gnu_ld) version: $progname (GNU libtool) 2.4.6 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` Report bugs to . GNU libtool home page: . General help using GNU software: ." exit 0 } # func_lo2o OBJECT-NAME # --------------------- # Transform OBJECT-NAME from a '.lo' suffix to the platform specific # object suffix. lo2o=s/\\.lo\$/.$objext/ o2lo=s/\\.$objext\$/.lo/ if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_lo2o () { case $1 in *.lo) func_lo2o_result=${1%.lo}.$objext ;; * ) func_lo2o_result=$1 ;; esac }' # func_xform LIBOBJ-OR-SOURCE # --------------------------- # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise) # suffix to a '.lo' libtool-object suffix. eval 'func_xform () { func_xform_result=${1%.*}.lo }' else # ...otherwise fall back to using sed. func_lo2o () { func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"` } func_xform () { func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'` } fi # func_fatal_configuration ARG... # ------------------------------- # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func__fatal_error ${1+"$@"} \ "See the $PACKAGE documentation for more information." \ "Fatal configuration error." } # func_config # ----------- # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $? } # func_features # ------------- # Display the features supported by this script. func_features () { echo "host: $host" if test yes = "$build_libtool_libs"; then echo "enable shared libraries" else echo "disable shared libraries" fi if test yes = "$build_old_libs"; then echo "enable static libraries" else echo "disable static libraries" fi exit $? } # func_enable_tag TAGNAME # ----------------------- # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname=$1 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf=/$re_begincf/,/$re_endcf/p # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable quotes within backquotes within # quotes we have to do it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } # func_check_version_match # ------------------------ # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # libtool_options_prep [ARG]... # ----------------------------- # Preparation for options parsed by libtool. libtool_options_prep () { $debug_mode # Option defaults: opt_config=false opt_dlopen= opt_dry_run=false opt_help=false opt_mode= opt_preserve_dup_deps=false opt_quiet=false nonopt= preserve_args= # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set dummy --mode clean ${1+"$@"}; shift ;; compile|compil|compi|comp|com|co|c) shift; set dummy --mode compile ${1+"$@"}; shift ;; execute|execut|execu|exec|exe|ex|e) shift; set dummy --mode execute ${1+"$@"}; shift ;; finish|finis|fini|fin|fi|f) shift; set dummy --mode finish ${1+"$@"}; shift ;; install|instal|insta|inst|ins|in|i) shift; set dummy --mode install ${1+"$@"}; shift ;; link|lin|li|l) shift; set dummy --mode link ${1+"$@"}; shift ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; esac # Pass back the list of options. func_quote_for_eval ${1+"$@"} libtool_options_prep_result=$func_quote_for_eval_result } func_add_hook func_options_prep libtool_options_prep # libtool_parse_options [ARG]... # --------------------------------- # Provide handling for libtool specific options. libtool_parse_options () { $debug_cmd # Perform our own loop to consume as many options as possible in # each iteration. while test $# -gt 0; do _G_opt=$1 shift case $_G_opt in --dry-run|--dryrun|-n) opt_dry_run=: ;; --config) func_config ;; --dlopen|-dlopen) opt_dlopen="${opt_dlopen+$opt_dlopen }$1" shift ;; --preserve-dup-deps) opt_preserve_dup_deps=: ;; --features) func_features ;; --finish) set dummy --mode finish ${1+"$@"}; shift ;; --help) opt_help=: ;; --help-all) opt_help=': help-all' ;; --mode) test $# = 0 && func_missing_arg $_G_opt && break opt_mode=$1 case $1 in # Valid mode arguments: clean|compile|execute|finish|install|link|relink|uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $_G_opt" exit_cmd=exit break ;; esac shift ;; --no-silent|--no-quiet) opt_quiet=false func_append preserve_args " $_G_opt" ;; --no-warnings|--no-warning|--no-warn) opt_warning=false func_append preserve_args " $_G_opt" ;; --no-verbose) opt_verbose=false func_append preserve_args " $_G_opt" ;; --silent|--quiet) opt_quiet=: opt_verbose=false func_append preserve_args " $_G_opt" ;; --tag) test $# = 0 && func_missing_arg $_G_opt && break opt_tag=$1 func_append preserve_args " $_G_opt $1" func_enable_tag "$1" shift ;; --verbose|-v) opt_quiet=false opt_verbose=: func_append preserve_args " $_G_opt" ;; # An option not handled by this hook function: *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; esac done # save modified positional parameters for caller func_quote_for_eval ${1+"$@"} libtool_parse_options_result=$func_quote_for_eval_result } func_add_hook func_parse_options libtool_parse_options # libtool_validate_options [ARG]... # --------------------------------- # Perform any sanity checks on option settings and/or unconsumed # arguments. libtool_validate_options () { # save first non-option argument if test 0 -lt $#; then nonopt=$1 shift fi # preserve --debug test : = "$debug_cmd" || func_append preserve_args " --debug" case $host in # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788 *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps ;; esac $opt_help || { # Sanity checks first: func_check_version_match test yes != "$build_libtool_libs" \ && test yes != "$build_old_libs" \ && func_fatal_configuration "not configured to build any kind of library" # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$opt_dlopen" && test execute != "$opt_mode"; then func_error "unrecognized option '-dlopen'" $ECHO "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help=$help help="Try '$progname --help --mode=$opt_mode' for more information." } # Pass back the unparsed argument list func_quote_for_eval ${1+"$@"} libtool_validate_options_result=$func_quote_for_eval_result } func_add_hook func_validate_options libtool_validate_options # Process options as early as possible so that --help and --version # can return quickly. func_options ${1+"$@"} eval set dummy "$func_options_result"; shift ## ----------- ## ## Main. ## ## ----------- ## magic='%%%MAGIC variable%%%' magic_exe='%%%MAGIC EXE variable%%%' # Global variables. extracted_archives= extracted_serial=0 # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } # func_generated_by_libtool # True iff stdin has been generated by Libtool. This function is only # a basic sanity check; it will hardly flush out determined imposters. func_generated_by_libtool_p () { $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_p file # True iff FILE is a libtool '.la' library or '.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p } # func_lalib_unsafe_p file # True iff FILE is a libtool '.la' library or '.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be # fatal anyway. Works if 'file' does not exist. func_lalib_unsafe_p () { lalib_p=no if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case $lalib_p_line in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi test yes = "$lalib_p" } # func_ltwrapper_script_p file # True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () { test -f "$1" && $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p } # func_ltwrapper_executable_p file # True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () { func_ltwrapper_exec_suffix= case $1 in *.exe) ;; *) func_ltwrapper_exec_suffix=.exe ;; esac $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 } # func_ltwrapper_scriptname file # Assumes file is an ltwrapper_executable # uses $file to determine the appropriate filename for a # temporary ltwrapper_script. func_ltwrapper_scriptname () { func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper } # func_ltwrapper_p file # True iff FILE is a libtool wrapper script or wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_p () { func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" } # func_execute_cmds commands fail_cmd # Execute tilde-delimited COMMANDS. # If FAIL_CMD is given, eval that upon failure. # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { $debug_cmd save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$sp$nl eval cmd=\"$cmd\" IFS=$save_ifs func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs } # func_source file # Source FILE, adding directory component if necessary. # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # 'FILE.' does not work on cygwin managed mounts. func_source () { $debug_cmd case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac } # func_resolve_sysroot PATH # Replace a leading = in PATH with a sysroot. Store the result into # func_resolve_sysroot_result func_resolve_sysroot () { func_resolve_sysroot_result=$1 case $func_resolve_sysroot_result in =*) func_stripname '=' '' "$func_resolve_sysroot_result" func_resolve_sysroot_result=$lt_sysroot$func_stripname_result ;; esac } # func_replace_sysroot PATH # If PATH begins with the sysroot, replace it with = and # store the result into func_replace_sysroot_result. func_replace_sysroot () { case $lt_sysroot:$1 in ?*:"$lt_sysroot"*) func_stripname "$lt_sysroot" '' "$1" func_replace_sysroot_result='='$func_stripname_result ;; *) # Including no sysroot. func_replace_sysroot_result=$1 ;; esac } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { $debug_cmd if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case "$@ " in " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with '--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_write_libtool_object output_name pic_name nonpic_name # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. func_write_libtool_object () { write_libobj=$1 if test yes = "$build_libtool_libs"; then write_lobj=\'$2\' else write_lobj=none fi if test yes = "$build_old_libs"; then write_oldobj=\'$3\' else write_oldobj=none fi $opt_dry_run || { cat >${write_libobj}T </dev/null` if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | $SED -e "$sed_naive_backslashify"` else func_convert_core_file_wine_to_w32_result= fi fi } # end: func_convert_core_file_wine_to_w32 # func_convert_core_path_wine_to_w32 ARG # Helper function used by path conversion functions when $build is *nix, and # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly # configured wine environment available, with the winepath program in $build's # $PATH. Assumes ARG has no leading or trailing path separator characters. # # ARG is path to be converted from $build format to win32. # Result is available in $func_convert_core_path_wine_to_w32_result. # Unconvertible file (directory) names in ARG are skipped; if no directory names # are convertible, then the result may be empty. func_convert_core_path_wine_to_w32 () { $debug_cmd # unfortunately, winepath doesn't convert paths, only file names func_convert_core_path_wine_to_w32_result= if test -n "$1"; then oldIFS=$IFS IFS=: for func_convert_core_path_wine_to_w32_f in $1; do IFS=$oldIFS func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" if test -n "$func_convert_core_file_wine_to_w32_result"; then if test -z "$func_convert_core_path_wine_to_w32_result"; then func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result else func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" fi fi done IFS=$oldIFS fi } # end: func_convert_core_path_wine_to_w32 # func_cygpath ARGS... # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or # (2), returns the Cygwin file name or path in func_cygpath_result (input # file name or path is assumed to be in w32 format, as previously converted # from $build's *nix or MSYS format). In case (3), returns the w32 file name # or path in func_cygpath_result (input file name or path is assumed to be in # Cygwin format). Returns an empty string on error. # # ARGS are passed to cygpath, with the last one being the file name or path to # be converted. # # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH # environment variable; do not put it in $PATH. func_cygpath () { $debug_cmd if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` if test "$?" -ne 0; then # on failure, ensure result is empty func_cygpath_result= fi else func_cygpath_result= func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'" fi } #end: func_cygpath # func_convert_core_msys_to_w32 ARG # Convert file name or path ARG from MSYS format to w32 format. Return # result in func_convert_core_msys_to_w32_result. func_convert_core_msys_to_w32 () { $debug_cmd # awkward: cmd appends spaces to result func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"` } #end: func_convert_core_msys_to_w32 # func_convert_file_check ARG1 ARG2 # Verify that ARG1 (a file name in $build format) was converted to $host # format in ARG2. Otherwise, emit an error message, but continue (resetting # func_to_host_file_result to ARG1). func_convert_file_check () { $debug_cmd if test -z "$2" && test -n "$1"; then func_error "Could not determine host file name corresponding to" func_error " '$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: func_to_host_file_result=$1 fi } # end func_convert_file_check # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH # Verify that FROM_PATH (a path in $build format) was converted to $host # format in TO_PATH. Otherwise, emit an error message, but continue, resetting # func_to_host_file_result to a simplistic fallback value (see below). func_convert_path_check () { $debug_cmd if test -z "$4" && test -n "$3"; then func_error "Could not determine the host path corresponding to" func_error " '$3'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This is a deliberately simplistic "conversion" and # should not be "improved". See libtool.info. if test "x$1" != "x$2"; then lt_replace_pathsep_chars="s|$1|$2|g" func_to_host_path_result=`echo "$3" | $SED -e "$lt_replace_pathsep_chars"` else func_to_host_path_result=$3 fi fi } # end func_convert_path_check # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT # and appending REPL if ORIG matches BACKPAT. func_convert_path_front_back_pathsep () { $debug_cmd case $4 in $1 ) func_to_host_path_result=$3$func_to_host_path_result ;; esac case $4 in $2 ) func_append func_to_host_path_result "$3" ;; esac } # end func_convert_path_front_back_pathsep ################################################## # $build to $host FILE NAME CONVERSION FUNCTIONS # ################################################## # invoked via '$to_host_file_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # Result will be available in $func_to_host_file_result. # func_to_host_file ARG # Converts the file name ARG from $build format to $host format. Return result # in func_to_host_file_result. func_to_host_file () { $debug_cmd $to_host_file_cmd "$1" } # end func_to_host_file # func_to_tool_file ARG LAZY # converts the file name ARG from $build format to toolchain format. Return # result in func_to_tool_file_result. If the conversion in use is listed # in (the comma separated) LAZY, no conversion takes place. func_to_tool_file () { $debug_cmd case ,$2, in *,"$to_tool_file_cmd",*) func_to_tool_file_result=$1 ;; *) $to_tool_file_cmd "$1" func_to_tool_file_result=$func_to_host_file_result ;; esac } # end func_to_tool_file # func_convert_file_noop ARG # Copy ARG to func_to_host_file_result. func_convert_file_noop () { func_to_host_file_result=$1 } # end func_convert_file_noop # func_convert_file_msys_to_w32 ARG # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_file_result. func_convert_file_msys_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_to_host_file_result=$func_convert_core_msys_to_w32_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_w32 # func_convert_file_cygwin_to_w32 ARG # Convert file name ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_file_cygwin_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then # because $build is cygwin, we call "the" cygpath in $PATH; no need to use # LT_CYGPATH in this case. func_to_host_file_result=`cygpath -m "$1"` fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_cygwin_to_w32 # func_convert_file_nix_to_w32 ARG # Convert file name ARG from *nix to w32 format. Requires a wine environment # and a working winepath. Returns result in func_to_host_file_result. func_convert_file_nix_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_file_wine_to_w32 "$1" func_to_host_file_result=$func_convert_core_file_wine_to_w32_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_w32 # func_convert_file_msys_to_cygwin ARG # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_file_msys_to_cygwin () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_cygpath -u "$func_convert_core_msys_to_w32_result" func_to_host_file_result=$func_cygpath_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_cygwin # func_convert_file_nix_to_cygwin ARG # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed # in a wine environment, working winepath, and LT_CYGPATH set. Returns result # in func_to_host_file_result. func_convert_file_nix_to_cygwin () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. func_convert_core_file_wine_to_w32 "$1" func_cygpath -u "$func_convert_core_file_wine_to_w32_result" func_to_host_file_result=$func_cygpath_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_cygwin ############################################# # $build to $host PATH CONVERSION FUNCTIONS # ############################################# # invoked via '$to_host_path_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # The result will be available in $func_to_host_path_result. # # Path separators are also converted from $build format to $host format. If # ARG begins or ends with a path separator character, it is preserved (but # converted to $host format) on output. # # All path conversion functions are named using the following convention: # file name conversion function : func_convert_file_X_to_Y () # path conversion function : func_convert_path_X_to_Y () # where, for any given $build/$host combination the 'X_to_Y' value is the # same. If conversion functions are added for new $build/$host combinations, # the two new functions must follow this pattern, or func_init_to_host_path_cmd # will break. # func_init_to_host_path_cmd # Ensures that function "pointer" variable $to_host_path_cmd is set to the # appropriate value, based on the value of $to_host_file_cmd. to_host_path_cmd= func_init_to_host_path_cmd () { $debug_cmd if test -z "$to_host_path_cmd"; then func_stripname 'func_convert_file_' '' "$to_host_file_cmd" to_host_path_cmd=func_convert_path_$func_stripname_result fi } # func_to_host_path ARG # Converts the path ARG from $build format to $host format. Return result # in func_to_host_path_result. func_to_host_path () { $debug_cmd func_init_to_host_path_cmd $to_host_path_cmd "$1" } # end func_to_host_path # func_convert_path_noop ARG # Copy ARG to func_to_host_path_result. func_convert_path_noop () { func_to_host_path_result=$1 } # end func_convert_path_noop # func_convert_path_msys_to_w32 ARG # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_path_result. func_convert_path_msys_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # Remove leading and trailing path separator characters from ARG. MSYS # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; # and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result=$func_convert_core_msys_to_w32_result func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_msys_to_w32 # func_convert_path_cygwin_to_w32 ARG # Convert path ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_path_cygwin_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_cygwin_to_w32 # func_convert_path_nix_to_w32 ARG # Convert path ARG from *nix to w32 format. Requires a wine environment and # a working winepath. Returns result in func_to_host_file_result. func_convert_path_nix_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result=$func_convert_core_path_wine_to_w32_result func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_nix_to_w32 # func_convert_path_msys_to_cygwin ARG # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_path_msys_to_cygwin () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_msys_to_w32_result" func_to_host_path_result=$func_cygpath_result func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_msys_to_cygwin # func_convert_path_nix_to_cygwin ARG # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a # a wine environment, working winepath, and LT_CYGPATH set. Returns result in # func_to_host_file_result. func_convert_path_nix_to_cygwin () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them # into '.;' and ';.', and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" func_to_host_path_result=$func_cygpath_result func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_nix_to_cygwin # func_dll_def_p FILE # True iff FILE is a Windows DLL '.def' file. # Keep in sync with _LT_DLL_DEF_P in libtool.m4 func_dll_def_p () { $debug_cmd func_dll_def_p_tmp=`$SED -n \ -e 's/^[ ]*//' \ -e '/^\(;.*\)*$/d' \ -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \ -e q \ "$1"` test DEF = "$func_dll_def_p_tmp" } # func_mode_compile arg... func_mode_compile () { $debug_cmd # Get the compilation command and the source file. base_compile= srcfile=$nonopt # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= pie_flag= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg=$arg arg_mode=normal ;; target ) libobj=$arg arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify '-o' more than once" arg_mode=target continue ;; -pie | -fpie | -fPIE) func_append pie_flag " $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) func_append later " $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result lastarg= save_ifs=$IFS; IFS=, for arg in $args; do IFS=$save_ifs func_append_quoted lastarg "$arg" done IFS=$save_ifs func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. func_append base_compile " $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg=$srcfile srcfile=$arg ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with '-o'" ;; *) # Get the name of the library object. test -z "$libobj" && { func_basename "$srcfile" libobj=$func_basename_result } ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo case $libobj in *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) func_xform "$libobj" libobj=$func_xform_result ;; esac case $libobj in *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; *) func_fatal_error "cannot determine name of library object from '$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test yes = "$build_libtool_libs" \ || func_fatal_configuration "cannot build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done func_quote_for_eval "$libobj" test "X$libobj" != "X$func_quote_for_eval_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ && func_warning "libobj name '$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" objname=$func_basename_result xdir=$func_dirname_result lobj=$xdir$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test yes = "$build_old_libs"; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2* | cegcc*) pic_mode=default ;; esac if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test no = "$compiler_c_o"; then output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext lockfile=$output_obj.lock else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test yes = "$need_locks"; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done elif test warn = "$need_locks"; then if test -f "$lockfile"; then $ECHO "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi func_append removelist " $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist func_append removelist " $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 srcfile=$func_to_tool_file_result func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. if test yes = "$build_libtool_libs"; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test no != "$pic_mode"; then command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code command="$base_compile $qsrcfile" fi func_mkdir_p "$xdir$objdir" if test -z "$output_obj"; then # Place PIC objects in $objdir func_append command " -o $lobj" fi func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' if test warn = "$need_locks" && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then func_show_eval '$MV "$output_obj" "$lobj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi # Allow error messages only from the first compilation. if test yes = "$suppress_opt"; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. if test yes = "$build_old_libs"; then if test yes != "$pic_mode"; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test yes = "$compiler_c_o"; then func_append command " -o $obj" fi # Suppress compiler output if we already did a PIC compilation. func_append command "$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' if test warn = "$need_locks" && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then func_show_eval '$MV "$output_obj" "$obj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi fi $opt_dry_run || { func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked if test no != "$need_locks"; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test compile = "$opt_mode" && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. case $opt_mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $ECHO \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $ECHO \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to build PIC objects only -prefer-non-pic try to build non-PIC objects only -shared do not build a '.o' file suitable for static linking -static only build a '.o' file suitable for static linking -Wc,FLAG pass FLAG directly to the compiler COMPILE-COMMAND is a command to be used in creating a 'standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix '.c' with the library object suffix, '.lo'." ;; execute) $ECHO \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to '-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $ECHO \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the '--dry-run' option if you just want to see what would be executed." ;; install) $ECHO \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the 'install' or 'cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $ECHO \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -bindir BINDIR specify path to binaries directory (for systems where libraries must be found in the PATH setting at runtime) -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE use a list of object files found in FILE to specify objects -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes) -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface -Wc,FLAG -Xcompiler FLAG pass linker-specific FLAG directly to the compiler -Wl,FLAG -Xlinker FLAG pass linker-specific FLAG directly to the linker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) All other options (arguments beginning with '-') are ignored. Every other argument is treated as a filename. Files ending in '.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in '.la', then a libtool library is created, only library objects ('.lo' files) may be specified, and '-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created using 'ar' and 'ranlib', or on Windows using 'lib'. If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $ECHO \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode '$opt_mode'" ;; esac echo $ECHO "Try '$progname --help' for more information about other modes." } # Now that we've collected a possible --mode arg, show help if necessary if $opt_help; then if test : = "$opt_help"; then func_mode_help else { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do func_mode_help done } | $SED -n '1p; 2,$s/^Usage:/ or: /p' { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do echo func_mode_help done } | $SED '1d /^When reporting/,/^Report/{ H d } $x /information about other modes/d /more detailed .*MODE/d s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' fi exit $? fi # func_mode_execute arg... func_mode_execute () { $debug_cmd # The first argument is the command name. cmd=$nonopt test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $opt_dlopen; do test -f "$file" \ || func_fatal_help "'$file' is not a file" dir= case $file in *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "'$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= func_source "$file" # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "'$file' was not linked with '-export-dynamic'" continue fi func_dirname "$file" "" "." dir=$func_dirname_result if test -f "$dir/$objdir/$dlname"; then func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'" fi fi ;; *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." dir=$func_dirname_result ;; *) func_warning "'-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir=$absdir # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic=$magic # Check if any of the arguments is a wrapper script. args= for file do case $file in -* | *.la | *.lo ) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. file=$progdir/$program elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. file=$progdir/$program fi ;; esac # Quote arguments (to preserve shell metacharacters). func_append_quoted args "$file" done if $opt_dry_run; then # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" echo "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS else if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # Now prepare to actually exec the command. exec_cmd=\$cmd$args fi } test execute = "$opt_mode" && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $debug_cmd libs= libdirs= admincmds= for opt in "$nonopt" ${1+"$@"} do if test -d "$opt"; then func_append libdirs " $opt" elif test -f "$opt"; then if func_lalib_unsafe_p "$opt"; then func_append libs " $opt" else func_warning "'$opt' is not a valid libtool archive" fi else func_fatal_error "invalid argument '$opt'" fi done if test -n "$libs"; then if test -n "$lt_sysroot"; then sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" else sysroot_cmd= fi # Remove sysroot references if $opt_dry_run; then for lib in $libs; do echo "removing references to $lt_sysroot and '=' prefixes from $lib" done else tmpdir=`func_mktempdir` for lib in $libs; do $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ > $tmpdir/tmp-la mv -f $tmpdir/tmp-la $lib done ${RM}r "$tmpdir" fi fi if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds '"$cmd"'"' fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $opt_dry_run || eval "$cmds" || func_append admincmds " $cmds" fi done fi # Exit here if they wanted silent mode. $opt_quiet && exit $EXIT_SUCCESS if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do $ECHO " $libdir" done echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" echo "specify the full pathname of the library, or use the '-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the '$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then echo " - add LIBDIR to the '$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $ECHO " - use the '$flag' linker flag" fi if test -n "$admincmds"; then $ECHO " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'" fi echo echo "See any operating system documentation about shared libraries for" case $host in solaris2.[6789]|solaris2.1[0-9]) echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" echo "pages." ;; *) echo "more information, such as the ld(1) and ld.so(8) manual pages." ;; esac echo "----------------------------------------------------------------------" fi exit $EXIT_SUCCESS } test finish = "$opt_mode" && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $debug_cmd # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" || # Allow the use of GNU shtool's install command. case $nonopt in *shtool*) :;; *) false;; esac then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " arg=$1 shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" func_append install_prog "$func_quote_for_eval_result" install_shared_prog=$install_prog case " $install_prog " in *[\\\ /]cp\ *) install_cp=: ;; *) install_cp=false ;; esac # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=false stripme= no_mode=: for arg do arg2= if test -n "$dest"; then func_append files " $dest" dest=$arg continue fi case $arg in -d) isdir=: ;; -f) if $install_cp; then :; else prev=$arg fi ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then if test X-m = "X$prev" && test -n "$install_override_mode"; then arg2=$install_override_mode no_mode=false fi prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. func_quote_for_eval "$arg" func_append install_prog " $func_quote_for_eval_result" if test -n "$arg2"; then func_quote_for_eval "$arg2" fi func_append install_shared_prog " $func_quote_for_eval_result" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the '$prev' option requires an argument" if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else func_quote_for_eval "$install_override_mode" func_append install_shared_prog " -m $func_quote_for_eval_result" fi fi if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. func_stripname '' '/' "$dest" dest=$func_stripname_result # Check to see that the destination is a directory. test -d "$dest" && isdir=: if $isdir; then destdir=$dest destname= else func_dirname_and_basename "$dest" "" "." destdir=$func_dirname_result destname=$func_basename_result # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ func_fatal_help "'$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "'$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic=$magic staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. func_append staticlibs " $file" ;; *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "'$file' is not a valid libtool archive" library_names= old_library= relink_command= func_source "$file" # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) func_append current_libdirs " $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) func_append future_libdirs " $libdir" ;; esac fi func_dirname "$file" "/" "" dir=$func_dirname_result func_append dir "$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking '$file'" func_show_eval "$relink_command" \ 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then realname=$1 shift srcname=$realname test -n "$relink_command" && srcname=${realname}T # Install the shared library and build the symlinks. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme=$stripme case $host_os in cygwin* | mingw* | pw32* | cegcc*) case $realname in *.dll.a) tstripme= ;; esac ;; os2*) case $realname in *_dll.a) tstripme= ;; esac ;; esac if test -n "$tstripme" && test -n "$striplib"; then func_show_eval "$striplib $destdir/$realname" 'exit $?' fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try 'ln -sf' first, because the 'ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do test "$linkname" != "$realname" \ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" done fi # Do each command in the postinstall commands. lib=$destdir/$realname func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" name=$func_basename_result instname=$dir/${name}i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. test -n "$old_library" && func_append staticlibs " $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile=$destdir/$destname else func_basename "$file" destfile=$func_basename_result destfile=$destdir/$destfile fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) func_lo2o "$destfile" staticdest=$func_lo2o_result ;; *.$objext) staticdest=$destfile destfile= ;; *) func_fatal_help "cannot copy a libtool object to '$destfile'" ;; esac # Install the libtool object if requested. test -n "$destfile" && \ func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. if test yes = "$build_old_libs"; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile=$destdir/$destname else func_basename "$file" destfile=$func_basename_result destfile=$destdir/$destfile fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext= case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result stripped_ext=.exe fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin* | *mingw*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result else func_stripname '' '.exe' "$file" wrapper=$func_stripname_result fi ;; *) wrapper=$file ;; esac if func_ltwrapper_script_p "$wrapper"; then notinst_deplibs= relink_command= func_source "$wrapper" # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ func_fatal_error "invalid libtool wrapper script '$wrapper'" finalize=: for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'` if test -n "$libdir" && test ! -f "$libfile"; then func_warning "'$lib' has not been installed in '$libdir'" finalize=false fi done relink_command= func_source "$wrapper" outputname= if test no = "$fast_install" && test -n "$relink_command"; then $opt_dry_run || { if $finalize; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" file=$func_basename_result outputname=$tmpdir/$file # Replace the output file specification. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_quiet || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else func_error "error: relink '$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi file=$outputname else func_warning "cannot relink '$file'" fi } else # Install the binary that we compiled earlier. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) func_stripname '' '.exe' "$destfile" destfile=$func_stripname_result ;; esac ;; esac func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' $opt_dry_run || if test -n "$outputname"; then ${RM}r "$tmpdir" fi ;; esac done for file in $staticlibs; do func_basename "$file" name=$func_basename_result # Set up the ranlib parameters. oldlib=$destdir/$name func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then func_show_eval "$old_striplib $tool_oldlib" 'exit $?' fi # Do each command in the postinstall commands. func_execute_cmds "$old_postinstall_cmds" 'exit $?' done test -n "$future_libdirs" && \ func_warning "remember to run '$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } test install = "$opt_mode" && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { $debug_cmd my_outputname=$1 my_originator=$2 my_pic_p=${3-false} my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms=${my_outputname}S.c else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist=$output_objdir/$my_outputname.nm func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" #endif /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) /* External symbol declarations for the compiler. */\ " if test yes = "$dlself"; then func_verbose "generating symbol list for '$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do func_to_tool_file "$progfile" func_convert_file_msys_to_w32 func_verbose "extracting global C symbols from '$func_to_tool_file_result'" $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $opt_dry_run || { eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi if test -n "$export_symbols_regex"; then $opt_dry_run || { eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols=$output_objdir/$outputname.exp $opt_dry_run || { $RM $export_symbols eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac } else $opt_dry_run || { eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac } fi fi for dlprefile in $dlprefiles; do func_verbose "extracting global C symbols from '$dlprefile'" func_basename "$dlprefile" name=$func_basename_result case $host in *cygwin* | *mingw* | *cegcc* ) # if an import library, we need to obtain dlname if func_win32_import_lib_p "$dlprefile"; then func_tr_sh "$dlprefile" eval "curr_lafile=\$libfile_$func_tr_sh_result" dlprefile_dlbasename= if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then # Use subshell, to avoid clobbering current variable values dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` if test -n "$dlprefile_dlname"; then func_basename "$dlprefile_dlname" dlprefile_dlbasename=$func_basename_result else # no lafile. user explicitly requested -dlpreopen . $sharedlib_from_linklib_cmd "$dlprefile" dlprefile_dlbasename=$sharedlib_from_linklib_result fi fi $opt_dry_run || { if test -n "$dlprefile_dlbasename"; then eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' else func_warning "Could not compute DLL name from $name" eval '$ECHO ": $name " >> "$nlist"' fi func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" } else # not an import lib $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } fi ;; *) $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } ;; esac done $opt_dry_run || { # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $MV "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi func_show_eval '$RM "${nlist}I"' if test -n "$global_symbol_to_import"; then eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I' fi echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; extern LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[];\ " if test -s "$nlist"I; then echo >> "$output_objdir/$my_dlsyms" "\ static void lt_syminit(void) { LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols; for (; symbol->name; ++symbol) {" $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms" echo >> "$output_objdir/$my_dlsyms" "\ } }" fi echo >> "$output_objdir/$my_dlsyms" "\ LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = { {\"$my_originator\", (void *) 0}," if test -s "$nlist"I; then echo >> "$output_objdir/$my_dlsyms" "\ {\"@INIT@\", (void *) <_syminit}," fi case $need_lib_prefix in no) eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; *) eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } # !$opt_dry_run pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) $my_pic_p && pic_flag_for_symtable=" $pic_flag" ;; esac ;; esac symtab_cflags= for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; *) func_append symtab_cflags " $arg" ;; esac done # Now compile the dynamic symbol file. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"' # Transform the symbol file into the correct name. symfileobj=$output_objdir/${my_outputname}S.$objext case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` fi ;; *) compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` ;; esac ;; *) func_fatal_error "unknown suffix for '$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` fi } # func_cygming_gnu_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is a GNU/binutils-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_gnu_implib_p () { $debug_cmd func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` test -n "$func_cygming_gnu_implib_tmp" } # func_cygming_ms_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is an MS-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_ms_implib_p () { $debug_cmd func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` test -n "$func_cygming_ms_implib_tmp" } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. # Despite the name, also deal with 64 bit binaries. func_win32_libid () { $debug_cmd win32_libid_type=unknown win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then case $nm_interface in "MS dumpbin") if func_cygming_ms_implib_p "$1" || func_cygming_gnu_implib_p "$1" then win32_nmres=import else win32_nmres= fi ;; *) func_to_tool_file "$1" func_convert_file_msys_to_w32 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | $SED -n -e ' 1,100{ / I /{ s|.*|import| p q } }'` ;; esac case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $ECHO "$win32_libid_type" } # func_cygming_dll_for_implib ARG # # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib () { $debug_cmd sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` } # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs # # The is the core of a fallback implementation of a # platform-specific function to extract the name of the # DLL associated with the specified import library LIBNAME. # # SECTION_NAME is either .idata$6 or .idata$7, depending # on the platform and compiler that created the implib. # # Echos the name of the DLL associated with the # specified import library. func_cygming_dll_for_implib_fallback_core () { $debug_cmd match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` $OBJDUMP -s --section "$1" "$2" 2>/dev/null | $SED '/^Contents of section '"$match_literal"':/{ # Place marker at beginning of archive member dllname section s/.*/====MARK====/ p d } # These lines can sometimes be longer than 43 characters, but # are always uninteresting /:[ ]*file format pe[i]\{,1\}-/d /^In archive [^:]*:/d # Ensure marker is printed /^====MARK====/p # Remove all lines with less than 43 characters /^.\{43\}/!d # From remaining lines, remove first 43 characters s/^.\{43\}//' | $SED -n ' # Join marker and all lines until next marker into a single line /^====MARK====/ b para H $ b para b :para x s/\n//g # Remove the marker s/^====MARK====// # Remove trailing dots and whitespace s/[\. \t]*$// # Print /./p' | # we now have a list, one entry per line, of the stringified # contents of the appropriate section of all members of the # archive that possess that section. Heuristic: eliminate # all those that have a first or second character that is # a '.' (that is, objdump's representation of an unprintable # character.) This should work for all archives with less than # 0x302f exports -- but will fail for DLLs whose name actually # begins with a literal '.' or a single character followed by # a '.'. # # Of those that remain, print the first one. $SED -e '/^\./d;/^.\./d;q' } # func_cygming_dll_for_implib_fallback ARG # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # # This fallback implementation is for use when $DLLTOOL # does not support the --identify-strict option. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib_fallback () { $debug_cmd if func_cygming_gnu_implib_p "$1"; then # binutils import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` elif func_cygming_ms_implib_p "$1"; then # ms-generated import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` else # unknown sharedlib_from_linklib_result= fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { $debug_cmd f_ex_an_ar_dir=$1; shift f_ex_an_ar_oldlib=$1 if test yes = "$lock_old_archive_extraction"; then lockfile=$f_ex_an_ar_oldlib.lock until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done fi func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 'stat=$?; rm -f "$lockfile"; exit $stat' if test yes = "$lock_old_archive_extraction"; then $opt_dry_run || rm -f "$lockfile" fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" fi } # func_extract_archives gentop oldlib ... func_extract_archives () { $debug_cmd my_gentop=$1; shift my_oldlibs=${1+"$@"} my_oldobjs= my_xlib= my_xabs= my_xdir= for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" my_xlib=$func_basename_result my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) func_arith $extracted_serial + 1 extracted_serial=$func_arith_result my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir=$my_gentop/$my_xlib_u func_mkdir_p "$my_xdir" case $host in *-darwin*) func_verbose "Extracting $my_xabs" # Do not bother doing anything if just a dry run $opt_dry_run || { darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` func_basename "$darwin_archive" darwin_base_archive=$func_basename_result darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches; do func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch" $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive" cd "unfat-$$/$darwin_base_archive-$darwin_arch" func_extract_an_archive "`pwd`" "$darwin_base_archive" cd "$darwin_curdir" $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches } # !$opt_dry_run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done func_extract_archives_result=$my_oldobjs } # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to # incorporate the script contents within a cygwin/mingw # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory where it is stored is # the $objdir directory. This is a cygwin/mingw-specific # behavior. func_emit_wrapper () { func_emit_wrapper_arg1=${1-no} $ECHO "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='$sed_quote_subst' # Be Bourne compatible if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variables: generated_by_libtool_version='$macro_version' notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$ECHO are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then file=\"\$0\"" qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` $ECHO "\ # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } ECHO=\"$qECHO\" fi # Very basic option parsing. These options are (a) specific to # the libtool wrapper, (b) are identical between the wrapper # /script/ and the wrapper /executable/ that is used only on # windows platforms, and (c) all begin with the string "--lt-" # (application programs are unlikely to have options that match # this pattern). # # There are only two supported options: --lt-debug and # --lt-dump-script. There is, deliberately, no --lt-help. # # The first argument to this parsing function should be the # script's $0 value, followed by "$@". lt_option_debug= func_parse_lt_options () { lt_script_arg0=\$0 shift for lt_opt do case \"\$lt_opt\" in --lt-debug) lt_option_debug=1 ;; --lt-dump-script) lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` cat \"\$lt_dump_D/\$lt_dump_F\" exit 0 ;; --lt-*) \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 exit 1 ;; esac done # Print the debug banner immediately: if test -n \"\$lt_option_debug\"; then echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2 fi } # Used when --lt-debug. Prints its arguments to stdout # (redirection is the responsibility of the caller) func_lt_dump_args () { lt_dump_args_N=1; for lt_arg do \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\" lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` done } # Core function for launching the target application func_exec_program_core () { " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2* | *-cegcc*) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $ECHO "\ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 exit 1 } # A function to encapsulate launching the target application # Strips options in the --lt-* namespace from \$@ and # launches target application with the remaining arguments. func_exec_program () { case \" \$* \" in *\\ --lt-*) for lt_wr_arg do case \$lt_wr_arg in --lt-*) ;; *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; esac shift done ;; esac func_exec_program_core \${1+\"\$@\"} } # Parse options func_parse_lt_options \"\$0\" \${1+\"\$@\"} # Find the directory that this script lives in. thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` done # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then thisdir=\`pwd\` fi # remove .libs from thisdir case \"\$thisdir\" in *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test yes = "$fast_install"; then $ECHO "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $MKDIR \"\$progdir\" else $RM \"\$progdir/\$file\" fi" $ECHO "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else \$ECHO \"\$relink_command_output\" >&2 $RM \"\$progdir/\$file\" exit 1 fi fi $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $RM \"\$progdir/\$program\"; $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } $RM \"\$progdir/\$file\" fi" else $ECHO "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $ECHO "\ if test -f \"\$progdir/\$program\"; then" # fixup the dll searchpath if we need to. # # Fix the DLL searchpath if we need to. Do this before prepending # to shlibpath, because on Windows, both are PATH and uninstalled # libraries must come first. if test -n "$dllsearchpath"; then $ECHO "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi # Export our shlibpath_var if we have one. if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` export $shlibpath_var " fi $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. func_exec_program \${1+\"\$@\"} fi else # The program doesn't exist. \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " } # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout # Must ONLY be called from within func_mode_link because # it depends on a number of variable set therein. func_emit_cwrapperexe_src () { cat < #include #ifdef _MSC_VER # include # include # include #else # include # include # ifdef __CYGWIN__ # include # endif #endif #include #include #include #include #include #include #include #include #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) /* declarations of non-ANSI functions */ #if defined __MINGW32__ # ifdef __STRICT_ANSI__ int _putenv (const char *); # endif #elif defined __CYGWIN__ # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif /* #elif defined other_platform || defined ... */ #endif /* portability defines, excluding path handling macros */ #if defined _MSC_VER # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv # define S_IXUSR _S_IEXEC #elif defined __MINGW32__ # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv #elif defined __CYGWIN__ # define HAVE_SETENV # define FOPEN_WB "wb" /* #elif defined other platforms ... */ #endif #if defined PATH_MAX # define LT_PATHMAX PATH_MAX #elif defined MAXPATHLEN # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef S_IXOTH # define S_IXOTH 0 #endif #ifndef S_IXGRP # define S_IXGRP 0 #endif /* path handling portability macros */ #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \ defined __OS2__ # define HAVE_DOS_BASED_FILE_SYSTEM # define FOPEN_WB "wb" # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #ifndef FOPEN_WB # define FOPEN_WB "w" #endif #ifndef _O_BINARY # define _O_BINARY 0 #endif #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free (stale); stale = 0; } \ } while (0) #if defined LT_DEBUGWRAPPER static int lt_debug = 1; #else static int lt_debug = 0; #endif const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ void *xmalloc (size_t num); char *xstrdup (const char *string); const char *base_name (const char *name); char *find_executable (const char *wrapper); char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); void lt_debugprintf (const char *file, int line, const char *fmt, ...); void lt_fatal (const char *file, int line, const char *message, ...); static const char *nonnull (const char *s); static const char *nonempty (const char *s); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); char **prepare_spawn (char **argv); void lt_dump_script (FILE *f); EOF cat <= 0) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) return 1; else return 0; } int make_executable (const char *path) { int rval = 0; struct stat st; lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", nonempty (path)); if ((!path) || (!*path)) return 0; if (stat (path, &st) >= 0) { rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); } return rval; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise Does not chase symlinks, even on platforms that support them. */ char * find_executable (const char *wrapper) { int has_slash = 0; const char *p; const char *p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; size_t tmp_len; char *concat_name; lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", nonempty (wrapper)); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined HAVE_DOS_BASED_FILE_SYSTEM if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } #if defined HAVE_DOS_BASED_FILE_SYSTEM } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char *path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char *q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR (*q)) break; p_len = (size_t) (q - p); p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); return NULL; } char * chase_symlinks (const char *pathspec) { #ifndef S_ISLNK return xstrdup (pathspec); #else char buf[LT_PATHMAX]; struct stat s; char *tmp_pathspec = xstrdup (pathspec); char *p; int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { lt_debugprintf (__FILE__, __LINE__, "checking path component for symlinks: %s\n", tmp_pathspec); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) { has_symlinks = 1; break; } /* search backwards for last DIR_SEPARATOR */ p = tmp_pathspec + strlen (tmp_pathspec) - 1; while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) p--; if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) { /* no more DIR_SEPARATORS left */ break; } *p = '\0'; } else { lt_fatal (__FILE__, __LINE__, "error accessing file \"%s\": %s", tmp_pathspec, nonnull (strerror (errno))); } } XFREE (tmp_pathspec); if (!has_symlinks) { return xstrdup (pathspec); } tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { lt_fatal (__FILE__, __LINE__, "could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif } char * strendzap (char *str, const char *pat) { size_t len, patlen; assert (str != NULL); assert (pat != NULL); len = strlen (str); patlen = strlen (pat); if (patlen <= len) { str += len - patlen; if (STREQ (str, pat)) *str = '\0'; } return str; } void lt_debugprintf (const char *file, int line, const char *fmt, ...) { va_list args; if (lt_debug) { (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); va_start (args, fmt); (void) vfprintf (stderr, fmt, args); va_end (args); } } static void lt_error_core (int exit_status, const char *file, int line, const char *mode, const char *message, va_list ap) { fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *file, int line, const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); va_end (ap); } static const char * nonnull (const char *s) { return s ? s : "(null)"; } static const char * nonempty (const char *s) { return (s && !*s) ? "(empty)" : nonnull (s); } void lt_setenv (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_setenv) setting '%s' to '%s'\n", nonnull (name), nonnull (value)); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ char *str = xstrdup (value); setenv (name, str, 1); #else size_t len = strlen (name) + 1 + strlen (value) + 1; char *str = XMALLOC (char, len); sprintf (str, "%s=%s", name, value); if (putenv (str) != EXIT_SUCCESS) { XFREE (str); } #endif } } char * lt_extend_str (const char *orig_value, const char *add, int to_end) { char *new_value; if (orig_value && *orig_value) { size_t orig_value_len = strlen (orig_value); size_t add_len = strlen (add); new_value = XMALLOC (char, add_len + orig_value_len + 1); if (to_end) { strcpy (new_value, orig_value); strcpy (new_value + orig_value_len, add); } else { strcpy (new_value, add); strcpy (new_value + add_len, orig_value); } } else { new_value = xstrdup (add); } return new_value; } void lt_update_exe_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); /* some systems can't cope with a ':'-terminated path #' */ size_t len = strlen (new_value); while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[--len] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); } } void lt_update_lib_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); } } EOF case $host_os in mingw*) cat <<"EOF" /* Prepares an argument vector before calling spawn(). Note that spawn() does not by itself call the command interpreter (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&v); v.dwPlatformId == VER_PLATFORM_WIN32_NT; }) ? "cmd.exe" : "command.com"). Instead it simply concatenates the arguments, separated by ' ', and calls CreateProcess(). We must quote the arguments since Win32 CreateProcess() interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a special way: - Space and tab are interpreted as delimiters. They are not treated as delimiters if they are surrounded by double quotes: "...". - Unescaped double quotes are removed from the input. Their only effect is that within double quotes, space and tab are treated like normal characters. - Backslashes not followed by double quotes are not special. - But 2*n+1 backslashes followed by a double quote become n backslashes followed by a double quote (n >= 0): \" -> " \\\" -> \" \\\\\" -> \\" */ #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" char ** prepare_spawn (char **argv) { size_t argc; char **new_argv; size_t i; /* Count number of arguments. */ for (argc = 0; argv[argc] != NULL; argc++) ; /* Allocate new argument vector. */ new_argv = XMALLOC (char *, argc + 1); /* Put quoted arguments into the new argument vector. */ for (i = 0; i < argc; i++) { const char *string = argv[i]; if (string[0] == '\0') new_argv[i] = xstrdup ("\"\""); else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) { int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); size_t length; unsigned int backslashes; const char *s; char *quoted_string; char *p; length = 0; backslashes = 0; if (quote_around) length++; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') length += backslashes + 1; length++; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) length += backslashes + 1; quoted_string = XMALLOC (char, length + 1); p = quoted_string; backslashes = 0; if (quote_around) *p++ = '"'; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') { unsigned int j; for (j = backslashes + 1; j > 0; j--) *p++ = '\\'; } *p++ = c; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) { unsigned int j; for (j = backslashes; j > 0; j--) *p++ = '\\'; *p++ = '"'; } *p = '\0'; new_argv[i] = quoted_string; } else new_argv[i] = (char *) string; } new_argv[argc] = NULL; return new_argv; } EOF ;; esac cat <<"EOF" void lt_dump_script (FILE* f) { EOF func_emit_wrapper yes | $SED -n -e ' s/^\(.\{79\}\)\(..*\)/\1\ \2/ h s/\([\\"]\)/\\\1/g s/$/\\n/ s/\([^\n]*\).*/ fputs ("\1", f);/p g D' cat <<"EOF" } EOF } # end: func_emit_cwrapperexe_src # func_win32_import_lib_p ARG # True if ARG is an import lib, as indicated by $file_magic_cmd func_win32_import_lib_p () { $debug_cmd case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in *import*) : ;; *) false ;; esac } # func_suncc_cstd_abi # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!! # Several compiler flags select an ABI that is incompatible with the # Cstd library. Avoid specifying it if any are in CXXFLAGS. func_suncc_cstd_abi () { $debug_cmd case " $compile_command " in *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*) suncc_use_cstd_abi=no ;; *) suncc_use_cstd_abi=yes ;; esac } # func_mode_link arg... func_mode_link () { $debug_cmd case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # what system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll that has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args=$nonopt base_compile="$nonopt $@" compile_command=$nonopt finalize_command=$nonopt compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= new_inherited_linker_flags= avoid_version=no bindir= dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= os2dllname= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=false prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= single_module=$wl-single_module func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test yes != "$build_libtool_libs" \ && func_fatal_configuration "cannot build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg=$1 shift func_quote_for_eval "$arg" qarg=$func_quote_for_eval_unquoted_result func_append libtool_args " $func_quote_for_eval_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) func_append compile_command " @OUTPUT@" func_append finalize_command " @OUTPUT@" ;; esac case $prev in bindir) bindir=$arg prev= continue ;; dlfiles|dlprefiles) $preload || { # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" preload=: } case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test no = "$dlself"; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test dlprefiles = "$prev"; then dlself=yes elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test dlfiles = "$prev"; then func_append dlfiles " $arg" else func_append dlprefiles " $arg" fi prev= continue ;; esac ;; expsyms) export_symbols=$arg test -f "$arg" \ || func_fatal_error "symbol file '$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex=$arg prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) func_append deplibs " $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir=$arg prev= continue ;; mllvm) # Clang does not use LLVM to link, so we can simply discard any # '-mllvm $arg' options when doing the link step. prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat "$save_arg"` do # func_append moreargs " $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test none = "$pic_object" && test none = "$non_pic_object"; then func_fatal_error "cannot find name of object for '$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result if test none != "$pic_object"; then # Prepend the subdirectory the object is found in. pic_object=$xdir$pic_object if test dlfiles = "$prev"; then if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test dlprefiles = "$prev"; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg=$pic_object fi # Non-PIC object. if test none != "$non_pic_object"; then # Prepend the subdirectory the object is found in. non_pic_object=$xdir$non_pic_object # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test none = "$pic_object"; then arg=$non_pic_object fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object=$pic_object func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "'$arg' is not a valid libtool object" fi fi done else func_fatal_error "link input file '$arg' does not exist" fi arg=$save_arg prev= continue ;; os2dllname) os2dllname=$arg prev= continue ;; precious_regex) precious_files_regex=$arg prev= continue ;; release) release=-$arg prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test rpath = "$prev"; then case "$rpath " in *" $arg "*) ;; *) func_append rpath " $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) func_append xrpath " $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds=$arg prev= continue ;; weak) func_append weak_libs " $arg" prev= continue ;; xcclinker) func_append linker_flags " $qarg" func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) func_append linker_flags " $qarg" func_append compiler_flags " $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg=$arg case $arg in -all-static) if test -n "$link_static_flag"; then # See comment for -static flag below, for more details. func_append compile_command " $link_static_flag" func_append finalize_command " $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "'-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -bindir) prev=bindir continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test X-export-symbols = "X$arg"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) func_append compile_command " $arg" func_append finalize_command " $arg" ;; esac continue ;; -L*) func_stripname "-L" '' "$arg" if test -z "$func_stripname_result"; then if test "$#" -gt 0; then func_fatal_error "require no space between '-L' and '$1'" else func_fatal_error "need path for '-L' option" fi fi func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of '$dir'" dir=$absdir ;; esac case "$deplibs " in *" -L$dir "* | *" $arg "*) # Will only happen for absolute or sysroot arguments ;; *) # Preserve sysroot, but never include relative directories case $dir in [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; *) func_append deplibs " -L$dir" ;; esac func_append lib_search_path " $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; *) func_append dllsearchpath ":$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac continue ;; -l*) if test X-lc = "X$arg" || test X-lm = "X$arg"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test X-lc = "X$arg" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc due to us having libc/libc_r. test X-lc = "X$arg" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test X-lc = "X$arg" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test X-lc = "X$arg" && continue ;; esac elif test X-lc_r = "X$arg"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi func_append deplibs " $arg" continue ;; -mllvm) prev=mllvm continue ;; -module) module=yes continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. -model|-arch|-isysroot|--sysroot) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) func_append new_inherited_linker_flags " $arg" ;; esac continue ;; -multi_module) single_module=$wl-multi_module continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. func_warning "'-no-install' is ignored for $host" func_warning "assuming '-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -os2dllname) prev=os2dllname continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) func_stripname '-R' '' "$arg" dir=$func_stripname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; =*) func_stripname '=' '' "$dir" dir=$lt_sysroot$func_stripname_result ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs func_quote_for_eval "$flag" func_append arg " $func_quote_for_eval_result" func_append compiler_flags " $func_quote_for_eval_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Wl,*) func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs func_quote_for_eval "$flag" func_append arg " $wl$func_quote_for_eval_result" func_append compiler_flags " $wl$func_quote_for_eval_result" func_append linker_flags " $func_quote_for_eval_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; # Flags to be passed through unchanged, with rationale: # -64, -mips[0-9] enable 64-bit mode for the SGI compiler # -r[0-9][0-9]* specify processor for the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler # +DA*, +DD* enable 64-bit mode for the HP compiler # -q* compiler args for the IBM compiler # -m*, -t[45]*, -txscale* architecture-specific flags for GCC # -F/path path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* profiling flags for GCC # -fstack-protector* stack protector flags for GCC # @file GCC response files # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization # -stdlib=* select c++ std lib with clang -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result func_append compile_command " $arg" func_append finalize_command " $arg" func_append compiler_flags " $arg" continue ;; -Z*) if test os2 = "`expr $host : '.*\(os2\)'`"; then # OS/2 uses -Zxxx to specify OS/2-specific options compiler_flags="$compiler_flags $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case $arg in -Zlinker | -Zstack) prev=xcompiler ;; esac continue else # Otherwise treat like 'Some other compiler flag' below func_quote_for_eval "$arg" arg=$func_quote_for_eval_result fi ;; # Some other compiler flag. -* | +*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; *.$objext) # A standard object. func_append objs " $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test none = "$pic_object" && test none = "$non_pic_object"; then func_fatal_error "cannot find name of object for '$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result test none = "$pic_object" || { # Prepend the subdirectory the object is found in. pic_object=$xdir$pic_object if test dlfiles = "$prev"; then if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test dlprefiles = "$prev"; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg=$pic_object } # Non-PIC object. if test none != "$non_pic_object"; then # Prepend the subdirectory the object is found in. non_pic_object=$xdir$non_pic_object # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test none = "$pic_object"; then arg=$non_pic_object fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object=$pic_object func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "'$arg' is not a valid libtool object" fi fi ;; *.$libext) # An archive. func_append deplibs " $arg" func_append old_deplibs " $arg" continue ;; *.la) # A libtool-controlled library. func_resolve_sysroot "$arg" if test dlfiles = "$prev"; then # This library was specified with -dlopen. func_append dlfiles " $func_resolve_sysroot_result" prev= elif test dlprefiles = "$prev"; then # The library was specified with -dlpreopen. func_append dlprefiles " $func_resolve_sysroot_result" prev= else func_append deplibs " $func_resolve_sysroot_result" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then func_append compile_command " $arg" func_append finalize_command " $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the '$prevarg' option requires an argument" if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" func_append compile_command " $arg" func_append finalize_command " $arg" fi oldlibs= # calculate the name of the file, without its directory func_basename "$output" outputname=$func_basename_result libobjs_save=$libobjs if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" # Definition is injected by LT_CONFIG during libtool generation. func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH" func_dirname "$output" "/" "" output_objdir=$func_dirname_result$objdir func_to_tool_file "$output_objdir/" tool_output_objdir=$func_to_tool_file_result # Create the object directory. func_mkdir_p "$output_objdir" # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_preserve_dup_deps; then case "$libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append libs " $deplib" done if test lib = "$linkmode"; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; esac func_append pre_post_deps " $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can '-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=false newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... if test lib,link = "$linkmode,$pass"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done deplibs=$tmp_deplibs fi if test lib,link = "$linkmode,$pass" || test prog,scan = "$linkmode,$pass"; then libs=$deplibs deplibs= fi if test prog = "$linkmode"; then case $pass in dlopen) libs=$dlfiles ;; dlpreopen) libs=$dlprefiles ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi if test lib,dlpreopen = "$linkmode,$pass"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= func_resolve_sysroot "$lib" case $lib in *.la) func_source "$func_resolve_sysroot_result" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do func_basename "$deplib" deplib_base=$func_basename_result case " $weak_libs " in *" $deplib_base "*) ;; *) func_append deplibs " $deplib" ;; esac done done libs=$dlprefiles fi if test dlopen = "$pass"; then # Collect dlpreopened libraries save_deplibs=$deplibs deplibs= fi for deplib in $libs; do lib= found=false case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append compiler_flags " $deplib" if test lib = "$linkmode"; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -l*) if test lib != "$linkmode" && test prog != "$linkmode"; then func_warning "'-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result if test lib = "$linkmode"; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" fi for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib=$searchdir/lib$name$search_ext if test -f "$lib"; then if test .la = "$search_ext"; then found=: else found=false fi break 2 fi done done if $found; then # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test yes = "$allow_libtool_libs_with_static_runtimes"; then case " $predeps $postdeps " in *" $deplib "*) if func_lalib_p "$lib"; then library_names= old_library= func_source "$lib" for l in $old_library $library_names; do ll=$l done if test "X$ll" = "X$old_library"; then # only static version available found=false func_dirname "$lib" "" "." ladir=$func_dirname_result lib=$ladir/$old_library if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi else # deplib doesn't seem to be a libtool library if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" fi continue fi ;; # -l *.ltframework) if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test lib = "$linkmode"; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test conv = "$pass" && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) if test conv = "$pass"; then deplibs="$deplib $deplibs" continue fi if test scan = "$pass"; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) func_warning "'-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test link = "$pass"; then func_stripname '-R' '' "$deplib" func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) func_resolve_sysroot "$deplib" lib=$func_resolve_sysroot_result ;; *.$libext) if test conv = "$pass"; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $deplib "*) ;; *) valid_a_lib=false case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=: fi ;; pass_all) valid_a_lib=: ;; esac if $valid_a_lib; then echo $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" else echo $ECHO "*** Warning: Trying to link with static lib archive $deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because the file extensions .$libext of this argument makes me believe" echo "*** that it is just a static archive that I should not use here." fi ;; esac continue ;; prog) if test link != "$pass"; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test conv = "$pass"; then deplibs="$deplib $deplibs" elif test prog = "$linkmode"; then if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then # If there is no dlopen support or we're linking statically, # we need to preload. func_append newdlprefiles " $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append newdlfiles " $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=: continue ;; esac # case $deplib $found || test -f "$lib" \ || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'" # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$lib" \ || func_fatal_error "'$lib' is not a valid libtool archive" func_dirname "$lib" "" "." ladir=$func_dirname_result dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file func_source "$lib" # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; esac done fi dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` if test lib,link = "$linkmode,$pass" || test prog,scan = "$linkmode,$pass" || { test prog != "$linkmode" && test lib != "$linkmode"; }; then test -n "$dlopen" && func_append dlfiles " $dlopen" test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi if test conv = "$pass"; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for '$lib'" fi # It is a libtool convenience library, so add in its objects. func_append convenience " $ladir/$objdir/$old_library" func_append old_convenience " $ladir/$objdir/$old_library" elif test prog != "$linkmode" && test lib != "$linkmode"; then func_fatal_error "'$lib' is not a convenience library" fi tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done continue fi # $pass = conv # Get the name of the library we link against. linklib= if test -n "$old_library" && { test yes = "$prefer_static_libs" || test built,no = "$prefer_static_libs,$installed"; }; then linklib=$old_library else for l in $old_library $library_names; do linklib=$l done fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for '$lib'" fi # This library was specified with -dlopen. if test dlopen = "$pass"; then test -z "$libdir" \ && func_fatal_error "cannot -dlopen a convenience library: '$lib'" if test -z "$dlname" || test yes != "$dlopen_support" || test no = "$build_libtool_libs" then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. func_append dlprefiles " $lib $dependency_libs" else func_append newdlfiles " $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of '$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir=$ladir fi ;; esac func_basename "$lib" laname=$func_basename_result # Find the relevant object directory and library name. if test yes = "$installed"; then if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library '$lib' was moved." dir=$ladir absdir=$abs_ladir libdir=$abs_ladir else dir=$lt_sysroot$libdir absdir=$lt_sysroot$libdir fi test yes = "$hardcode_automatic" && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir=$ladir absdir=$abs_ladir # Remove this search path later func_append notinst_path " $abs_ladir" else dir=$ladir/$objdir absdir=$abs_ladir/$objdir # Remove this search path later func_append notinst_path " $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" name=$func_stripname_result # This library was specified with -dlpreopen. if test dlpreopen = "$pass"; then if test -z "$libdir" && test prog = "$linkmode"; then func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'" fi case $host in # special handling for platforms with PE-DLLs. *cygwin* | *mingw* | *cegcc* ) # Linker will automatically link against shared library if both # static and shared are present. Therefore, ensure we extract # symbols from the import library if a shared library is present # (otherwise, the dlopen module name will be incorrect). We do # this by putting the import library name into $newdlprefiles. # We recover the dlopen module name by 'saving' the la file # name in a special purpose variable, and (later) extracting the # dlname from the la file. if test -n "$dlname"; then func_tr_sh "$dir/$linklib" eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" func_append newdlprefiles " $dir/$linklib" else func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" fi ;; * ) # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then func_append newdlprefiles " $dir/$dlname" else func_append newdlprefiles " $dir/$linklib" fi ;; esac fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test lib = "$linkmode"; then deplibs="$dir/$old_library $deplibs" elif test prog,link = "$linkmode,$pass"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test prog = "$linkmode" && test link != "$pass"; then func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" linkalldeplibs=false if test no != "$link_all_deplibs" || test -z "$library_names" || test no = "$build_libtool_libs"; then linkalldeplibs=: fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; esac # Need to link against all dependency_libs? if $linkalldeplibs; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done # for deplib continue fi # $linkmode = prog... if test prog,link = "$linkmode,$pass"; then if test -n "$library_names" && { { test no = "$prefer_static_libs" || test built,yes = "$prefer_static_libs,$installed"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then # Make sure the rpath contains only unique directories. case $temp_rpath: in *"$absdir:"*) ;; *) func_append temp_rpath "$absdir:" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi # $linkmode,$pass = prog,link... if $alldeplibs && { test pass_all = "$deplibs_check_method" || { test yes = "$build_libtool_libs" && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test built = "$use_static_libs" && test yes = "$installed"; then use_static_libs=no fi if test -n "$library_names" && { test no = "$use_static_libs" || test -z "$old_library"; }; then case $host in *cygwin* | *mingw* | *cegcc* | *os2*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no ;; *) if test no = "$installed"; then func_append notinst_deplibs " $lib" need_relink=yes fi ;; esac # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule= for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule=$dlpremoduletest break fi done if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then echo if test prog = "$linkmode"; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi if test lib = "$linkmode" && test yes = "$hardcode_into_libs"; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names shift realname=$1 shift libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname=$dlname elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw* | *cegcc* | *os2*) func_arith $current - $age major=$func_arith_result versuffix=-$major ;; esac eval soname=\"$soname_spec\" else soname=$realname fi # Make a new name for the extract_expsyms_cmds to use soroot=$soname func_basename "$soroot" soname=$func_basename_result func_stripname 'lib' '.dll' "$soname" newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else func_verbose "extracting exported symbol list from '$soname'" func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else func_verbose "generating import library for '$soname'" func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test prog = "$linkmode" || test relink != "$opt_mode"; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test no = "$hardcode_direct"; then add=$dir/$linklib case $host in *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;; *-*-sysv4*uw2*) add_dir=-L$dir ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir=-L$dir ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we cannot # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP ": [^:]* bundle" >/dev/null; then if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library"; then echo echo "*** And there doesn't seem to be a static archive available" echo "*** The link will probably fail, sorry" else add=$dir/$old_library fi elif test -n "$old_library"; then add=$dir/$old_library fi fi esac elif test no = "$hardcode_minus_L"; then case $host in *-*-sunos*) add_shlibpath=$dir ;; esac add_dir=-L$dir add=-l$name elif test no = "$hardcode_shlibpath_var"; then add_shlibpath=$dir add=-l$name else lib_linked=no fi ;; relink) if test yes = "$hardcode_direct" && test no = "$hardcode_direct_absolute"; then add=$dir/$linklib elif test yes = "$hardcode_minus_L"; then add_dir=-L$absdir # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add=-l$name elif test yes = "$hardcode_shlibpath_var"; then add_shlibpath=$dir add=-l$name else lib_linked=no fi ;; *) lib_linked=no ;; esac if test yes != "$lib_linked"; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) func_append compile_shlibpath "$add_shlibpath:" ;; esac fi if test prog = "$linkmode"; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test yes != "$hardcode_direct" && test yes != "$hardcode_minus_L" && test yes = "$hardcode_shlibpath_var"; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi if test prog = "$linkmode" || test relink = "$opt_mode"; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test yes = "$hardcode_direct" && test no = "$hardcode_direct_absolute"; then add=$libdir/$linklib elif test yes = "$hardcode_minus_L"; then add_dir=-L$libdir add=-l$name elif test yes = "$hardcode_shlibpath_var"; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac add=-l$name elif test yes = "$hardcode_automatic"; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib"; then add=$inst_prefix_dir$libdir/$linklib else add=$libdir/$linklib fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir=-L$libdir # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add=-l$name fi if test prog = "$linkmode"; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test prog = "$linkmode"; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test unsupported != "$hardcode_direct"; then test -n "$old_library" && linklib=$old_library compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test yes = "$build_libtool_libs"; then # Not a shared library if test pass_all != "$deplibs_check_method"; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo $ECHO "*** Warning: This system cannot link to static lib archive $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." if test yes = "$module"; then echo "*** But as you try to build a module library, libtool will still create " echo "*** a static module, that should work as long as the dlopening application" echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using 'nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** 'nm' from GNU binutils and a full rebuild may help." fi if test no = "$build_old_libs"; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test lib = "$linkmode"; then if test -n "$dependency_libs" && { test yes != "$hardcode_into_libs" || test yes = "$build_old_libs" || test yes = "$link_static"; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) func_stripname '-R' '' "$libdir" temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; *) func_append xrpath " $temp_xrpath";; esac;; *) func_append temp_deplibs " $libdir";; esac done dependency_libs=$temp_deplibs fi func_append newlib_search_path " $absdir" # Link against this library test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result";; *) func_resolve_sysroot "$deplib" ;; esac if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $func_resolve_sysroot_result "*) func_append specialdeplibs " $func_resolve_sysroot_result" ;; esac fi func_append tmp_libs " $func_resolve_sysroot_result" done if test no != "$link_all_deplibs"; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do path= case $deplib in -L*) path=$deplib ;; *.la) func_resolve_sysroot "$deplib" deplib=$func_resolve_sysroot_result func_dirname "$deplib" "" "." dir=$func_dirname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of '$dir'" absdir=$dir fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names"; then for tmp in $deplibrary_names; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl"; then depdepl=$absdir/$objdir/$depdepl darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` if test -z "$darwin_install_name"; then darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl" func_append linker_flags " -dylib_file $darwin_install_name:$depdepl" path= fi fi ;; *) path=-L$absdir/$objdir ;; esac else eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "'$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "'$deplib' seems to be moved" path=-L$absdir fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test link = "$pass"; then if test prog = "$linkmode"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs=$newdependency_libs if test dlpreopen = "$pass"; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test dlopen != "$pass"; then test conv = "$pass" || { # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) func_append lib_search_path " $dir" ;; esac done newlib_search_path= } if test prog,link = "$linkmode,$pass"; then vars="compile_deplibs finalize_deplibs" else vars=deplibs fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) func_append tmp_libs " $deplib" ;; esac ;; *) func_append tmp_libs " $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Add Sun CC postdeps if required: test CXX = "$tagname" && { case $host_os in linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 func_suncc_cstd_abi if test no != "$suncc_use_cstd_abi"; then func_append postdeps ' -library=Cstd -library=Crun' fi ;; esac ;; solaris*) func_cc_basename "$CC" case $func_cc_basename_result in CC* | sunCC*) func_suncc_cstd_abi if test no != "$suncc_use_cstd_abi"; then func_append postdeps ' -library=Cstd -library=Crun' fi ;; esac ;; esac } # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i= ;; esac if test -n "$i"; then func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs done # for pass if test prog = "$linkmode"; then dlfiles=$newdlfiles fi if test prog = "$linkmode" || test lib = "$linkmode"; then dlprefiles=$newdlprefiles fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then func_warning "'-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "'-l' and '-L' are ignored for archives" ;; esac test -n "$rpath" && \ func_warning "'-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "'-R' is ignored for archives" test -n "$vinfo" && \ func_warning "'-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "'-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "'-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs=$output func_append objs "$old_deplibs" ;; lib) # Make sure we only generate libraries of the form 'libNAME.la'. case $outputname in lib*) func_stripname 'lib' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test no = "$module" \ && func_fatal_help "libtool library '$output' must begin with 'lib'" if test no != "$need_lib_prefix"; then # Add the "lib" prefix for modules if required func_stripname '' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else func_stripname '' '.la' "$outputname" libname=$func_stripname_result fi ;; esac if test -n "$objs"; then if test pass_all != "$deplibs_check_method"; then func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs" else echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" func_append libobjs " $objs" fi fi test no = "$dlself" \ || func_warning "'-dlopen self' is ignored for libtool libraries" set dummy $rpath shift test 1 -lt "$#" \ && func_warning "ignoring multiple '-rpath's for a libtool library" install_libdir=$1 oldlibs= if test -z "$rpath"; then if test yes = "$build_libtool_libs"; then # Building a libtool convenience library. # Some compilers have problems with a '.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "'-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "'-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs=$IFS; IFS=: set dummy $vinfo 0 0 0 shift IFS=$save_ifs test -n "$7" && \ func_fatal_help "too many parameters to '-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major=$1 number_minor=$2 number_revision=$3 # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # that has an extra 1 added just for fun # case $version_type in # correct linux to gnu/linux during the next big refactor darwin|freebsd-elf|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age=$number_minor revision=$number_revision ;; freebsd-aout|qnx|sunos) current=$number_major revision=$number_minor age=0 ;; irix|nonstopux) func_arith $number_major + $number_minor current=$func_arith_result age=$number_minor revision=$number_minor lt_irix_increment=no ;; esac ;; no) current=$1 revision=$2 age=$3 ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "CURRENT '$current' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "REVISION '$revision' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "AGE '$age' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE '$age' is greater than the current interface number '$current'" func_fatal_error "'$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" # On Darwin other compilers case $CC in nagfor*) verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" ;; *) verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; esac ;; freebsd-aout) major=.$current versuffix=.$current.$revision ;; freebsd-elf) func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision ;; irix | nonstopux) if test no = "$lt_irix_increment"; then func_arith $current - $age else func_arith $current - $age + 1 fi major=$func_arith_result case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring=$verstring_prefix$major.$revision # Add in all the interfaces that we are compatible with. loop=$revision while test 0 -ne "$loop"; do func_arith $revision - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring=$verstring_prefix$major.$iface:$verstring done # Before this point, $major must not contain '.'. major=.$major versuffix=$major.$revision ;; linux) # correct to gnu/linux during the next big refactor func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision ;; osf) func_arith $current - $age major=.$func_arith_result versuffix=.$current.$age.$revision verstring=$current.$age.$revision # Add in all the interfaces that we are compatible with. loop=$age while test 0 -ne "$loop"; do func_arith $current - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring=$verstring:$iface.0 done # Make executables depend on our current version. func_append verstring ":$current.0" ;; qnx) major=.$current versuffix=.$current ;; sco) major=.$current versuffix=.$current ;; sunos) major=.$current versuffix=.$current.$revision ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 file systems. func_arith $current - $age major=$func_arith_result versuffix=-$major ;; *) func_fatal_configuration "unknown library version type '$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring=0.0 ;; esac if test no = "$need_version"; then versuffix= else versuffix=.0.0 fi fi # Remove version info from name if versioning should be avoided if test yes,no = "$avoid_version,$need_version"; then major= versuffix= verstring= fi # Check to see if the archive will have undefined symbols. if test yes = "$allow_undefined"; then if test unsupported = "$allow_undefined_flag"; then if test yes = "$build_old_libs"; then func_warning "undefined symbols not allowed in $host shared libraries; building static only" build_libtool_libs=no else func_fatal_error "can't build $host shared library unless -no-undefined is specified" fi fi else # Don't allow undefined symbols. allow_undefined_flag=$no_undefined_flag fi fi func_generate_dlsyms "$libname" "$libname" : func_append libobjs " $symfileobj" test " " = "$libobjs" && libobjs= if test relink != "$opt_mode"; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$ECHO "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext | *.gcno) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*) if test -n "$precious_files_regex"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi func_append removelist " $p" ;; *) ;; esac done test -n "$removelist" && \ func_show_eval "${RM}r \$removelist" fi # Now set the variables for building old libraries. if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do func_replace_sysroot "$libdir" func_append temp_xrpath " -R$func_replace_sysroot_result" case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles=$dlfiles dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) func_append dlfiles " $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles=$dlprefiles dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) func_append dlprefiles " $lib" ;; esac done if test yes = "$build_libtool_libs"; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework func_append deplibs " System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test yes = "$build_libtool_need_lc"; then func_append deplibs " -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release= versuffix= major= newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $opt_dry_run || $RM conftest.c cat > conftest.c </dev/null` $nocaseglob else potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` fi for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib=$potent_lib while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | $SED 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;; *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib= break 2 fi done done fi if test -n "$a_deplib"; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib"; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a file magic. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do case $a_deplib in -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result if test yes = "$allow_libtool_libs_with_static_runtimes"; then case " $predeps $postdeps " in *" $a_deplib "*) func_append newdeplibs " $a_deplib" a_deplib= ;; esac fi if test -n "$a_deplib"; then libname=`eval "\\$ECHO \"$libname_spec\""` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib=$potent_lib # see symlink-check above in file_magic test if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib= break 2 fi done done fi if test -n "$a_deplib"; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib"; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a regex pattern. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs= tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` if test yes = "$allow_libtool_libs_with_static_runtimes"; then for i in $predeps $postdeps; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"` done fi case $tmp_deplibs in *[!\ \ ]*) echo if test none = "$deplibs_check_method"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." fi echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes ;; esac ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac if test yes = "$droppeddeps"; then if test yes = "$module"; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" echo "*** a static module, that should work as long as the dlopening" echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using 'nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** 'nm' from GNU binutils and a full rebuild may help." fi if test no = "$build_old_libs"; then oldlibs=$output_objdir/$libname.$libext build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." if test no = "$allow_undefined"; then echo echo "*** Since this library must not contain undefined symbols," echo "*** because either the platform does not support them or" echo "*** it was explicitly requested with -no-undefined," echo "*** libtool will only create a static version of it." if test no = "$build_old_libs"; then oldlibs=$output_objdir/$libname.$libext build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done deplibs=$new_libs # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test yes = "$build_libtool_libs"; then # Remove $wl instances when linking with ld. # FIXME: should test the right _cmds variable. case $archive_cmds in *\$LD\ *) wl= ;; esac if test yes = "$hardcode_into_libs"; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath=$finalize_rpath test relink = "$opt_mode" || rpath=$compile_rpath$rpath for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then func_replace_sysroot "$libdir" libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append dep_rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath=$finalize_shlibpath test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names shift realname=$1 shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname=$realname fi if test -z "$dlname"; then dlname=$soname fi lib=$output_objdir/$realname linknames= for link do func_append linknames " $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols=$output_objdir/$libname.uexp func_append delfiles " $export_symbols" fi orig_export_symbols= case $host_os in cygwin* | mingw* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile func_dll_def_p "$export_symbols" || { # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. orig_export_symbols=$export_symbols export_symbols= always_export_symbols=yes } fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then func_verbose "generating symbol list for '$libname.la'" export_symbols=$output_objdir/$libname.exp $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs=$IFS; IFS='~' for cmd1 in $cmds; do IFS=$save_ifs # Take the normal branch if the nm_file_list_spec branch # doesn't work or if tool conversion is not needed. case $nm_file_list_spec~$to_tool_file_cmd in *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) try_normal_branch=yes eval cmd=\"$cmd1\" func_len " $cmd" len=$func_len_result ;; *) try_normal_branch=no ;; esac if test yes = "$try_normal_branch" \ && { test "$len" -lt "$max_cmd_len" \ || test "$max_cmd_len" -le -1; } then func_show_eval "$cmd" 'exit $?' skipped_export=false elif test -n "$nm_file_list_spec"; then func_basename "$output" output_la=$func_basename_result save_libobjs=$libobjs save_output=$output output=$output_objdir/$output_la.nm func_to_tool_file "$output" libobjs=$nm_file_list_spec$func_to_tool_file_result func_append delfiles " $output" func_verbose "creating $NM input file list: $output" for obj in $save_libobjs; do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > "$output" eval cmd=\"$cmd1\" func_show_eval "$cmd" 'exit $?' output=$save_output libobjs=$save_libobjs skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS=$save_ifs if test -n "$export_symbols_regex" && test : != "$skipped_export"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols=$export_symbols test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test : != "$skipped_export" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for '$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands, which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) func_append tmp_deplibs " $test_deplib" ;; esac done deplibs=$tmp_deplibs if test -n "$convenience"; then if test -n "$whole_archive_flag_spec" && test yes = "$compiler_needs_object" && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. whole_archive_flag_spec= fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $convenience func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking if test relink = "$opt_mode"; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test yes = "$module" && test -n "$module_cmds"; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test : != "$skipped_export" && func_len " $test_cmds" && len=$func_len_result && test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output func_basename "$output" output_la=$func_basename_result # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= last_robj= k=1 if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then output=$output_objdir/$output_la.lnkscript func_verbose "creating GNU ld script: $output" echo 'INPUT (' > $output for obj in $save_libobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done echo ')' >> $output func_append delfiles " $output" func_to_tool_file "$output" output=$func_to_tool_file_result elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then output=$output_objdir/$output_la.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= if test yes = "$compiler_needs_object"; then firstobj="$1 " shift fi for obj do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done func_append delfiles " $output" func_to_tool_file "$output" output=$firstobj\"$file_list_spec$func_to_tool_file_result\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." output=$output_objdir/$output_la-$k.$objext eval test_cmds=\"$reload_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 # Loop over the list of objects to be linked. for obj in $save_libobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result if test -z "$objlist" || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test 1 -eq "$k"; then # The first file doesn't have a previous command to add. reload_objs=$objlist eval concat_cmds=\"$reload_cmds\" else # All subsequent reloadable object files will link in # the last one created. reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-$k.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-$k.$objext objlist=" $obj" func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds$reload_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi func_append delfiles " $output" else output= fi ${skipped_export-false} && { func_verbose "generating symbol list for '$libname.la'" export_symbols=$output_objdir/$libname.exp $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi } test -n "$save_libobjs" && func_verbose "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs=$IFS; IFS='~' for cmd in $concat_cmds; do IFS=$save_ifs $opt_quiet || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test relink = "$opt_mode"; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS=$save_ifs if test -n "$export_symbols_regex" && ${skipped_export-false}; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi ${skipped_export-false} && { if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols=$export_symbols test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for '$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands, which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi } libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test yes = "$module" && test -n "$module_cmds"; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi fi if test -n "$delfiles"; then # Append the command to remove temporary files to $cmds. eval cmds=\"\$cmds~\$RM $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi save_ifs=$IFS; IFS='~' for cmd in $cmds; do IFS=$sp$nl eval cmd=\"$cmd\" IFS=$save_ifs $opt_quiet || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test relink = "$opt_mode"; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS=$save_ifs # Restore the uninstalled library and exit if test relink = "$opt_mode"; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then func_show_eval '${RM}r "$gentop"' fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' fi done # If -module or -export-dynamic was specified, set the dlname. if test yes = "$module" || test yes = "$export_dynamic"; then # On all known operating systems, these are identical. dlname=$soname fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then func_warning "'-dlopen' is ignored for objects" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "'-l' and '-L' are ignored for objects" ;; esac test -n "$rpath" && \ func_warning "'-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "'-R' is ignored for objects" test -n "$vinfo" && \ func_warning "'-version-info' is ignored for objects" test -n "$release" && \ func_warning "'-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object '$output' from non-libtool objects" libobj=$output func_lo2o "$libobj" obj=$func_lo2o_result ;; *) libobj= obj=$output ;; esac # Delete the old objects. $opt_dry_run || $RM $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # if reload_cmds runs $LD directly, get rid of -Wl from # whole_archive_flag_spec and hope we can get by with turning comma # into space. case $reload_cmds in *\$LD[\ \$]*) wl= ;; esac if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags else gentop=$output_objdir/${obj}x func_append generated " $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # If we're not building shared, we need to use non_pic_objs test yes = "$build_libtool_libs" || libobjs=$non_pic_objects # Create the old-style object. reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs output=$obj func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS fi test yes = "$build_libtool_libs" || { if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS } if test -n "$pic_flag" || test default != "$pic_mode"; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output=$libobj func_execute_cmds "$reload_cmds" 'exit $?' fi if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) func_stripname '' '.exe' "$output" output=$func_stripname_result.exe;; esac test -n "$vinfo" && \ func_warning "'-version-info' is ignored for programs" test -n "$release" && \ func_warning "'-release' is ignored for programs" $preload \ && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \ && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors # But is supposedly fixed on 10.4 or later (yay!). if test CXX = "$tagname"; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) func_append compile_command " $wl-bind_at_load" func_append finalize_command " $wl-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done compile_deplibs=$new_libs func_append compile_command " $compile_deplibs" func_append finalize_command " $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; *) func_append dllsearchpath ":$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath=$rpath rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) func_append finalize_perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath=$rpath if test -n "$libobjs" && test yes = "$build_old_libs"; then # Transform all the library objects into standard objects. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" false # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi wrappers_required=: case $host in *cegcc* | *mingw32ce*) # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. wrappers_required=false ;; *cygwin* | *mingw* ) test yes = "$build_libtool_libs" || wrappers_required=false ;; *) if test no = "$need_relink" || test yes != "$build_libtool_libs"; then wrappers_required=false fi ;; esac $wrappers_required || { # Replace the output file specification. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` link_command=$compile_command$compile_rpath # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Delete the generated files. if test -f "$output_objdir/${outputname}S.$objext"; then func_show_eval '$RM "$output_objdir/${outputname}S.$objext"' fi exit $exit_status } if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do func_append rpath "$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test yes = "$no_install"; then # We don't need to create a wrapper script. link_command=$compile_var$compile_command$compile_rpath # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi exit $EXIT_SUCCESS fi case $hardcode_action,$fast_install in relink,*) # Fast installation is not supported link_command=$compile_var$compile_command$compile_rpath relink_command=$finalize_var$finalize_command$finalize_rpath func_warning "this platform does not like uninstalled shared libraries" func_warning "'$output' will be relinked during installation" ;; *,yes) link_command=$finalize_var$compile_command$finalize_rpath relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` ;; *,no) link_command=$compile_var$compile_command$compile_rpath relink_command=$finalize_var$finalize_command$finalize_rpath ;; *,needless) link_command=$finalize_var$compile_command$finalize_rpath relink_command= ;; esac # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output_objdir/$outputname" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Now create the wrapper script. func_verbose "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. $opt_dry_run || { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) func_stripname '' '.exe' "$output" output=$func_stripname_result ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe func_stripname '' '.exe' "$outputname" outputname=$func_stripname_result ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result cwrappersource=$output_path/$objdir/lt-$output_name.c cwrapper=$output_path/$output_name.exe $RM $cwrappersource $cwrapper trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 func_emit_cwrapperexe_src > $cwrappersource # The wrapper executable is built using the $host compiler, # because it contains $host paths and files. If cross- # compiling, it, like the target executable, must be # executed on the $host or under an emulation environment. $opt_dry_run || { $LTCC $LTCFLAGS -o $cwrapper $cwrappersource $STRIP $cwrapper } # Now, create the wrapper script for func_source use: func_ltwrapper_scriptname $cwrapper $RM $func_ltwrapper_scriptname_result trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 $opt_dry_run || { # note: this script will not be executed, so do not chmod. if test "x$build" = "x$host"; then $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result else func_emit_wrapper no > $func_ltwrapper_scriptname_result fi } ;; * ) $RM $output trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 func_emit_wrapper no > $output chmod +x $output ;; esac } exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do case $build_libtool_libs in convenience) oldobjs="$libobjs_save $symfileobj" addlibs=$convenience build_libtool_libs=no ;; module) oldobjs=$libobjs_save addlibs=$old_convenience build_libtool_libs=no ;; *) oldobjs="$old_deplibs $non_pic_objects" $preload && test -f "$symfileobj" \ && func_append oldobjs " $symfileobj" addlibs=$old_convenience ;; esac if test -n "$addlibs"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $addlibs func_append oldobjs " $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append oldobjs " $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do func_basename "$obj" $ECHO "$func_basename_result" done | sort | sort -uc >/dev/null 2>&1); then : else echo "copying selected object files to avoid basename conflicts..." gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do func_basename "$obj" objbase=$func_basename_result case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase func_arith $counter + 1 counter=$func_arith_result case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" func_append oldobjs " $gentop/$newobj" ;; *) func_append oldobjs " $obj" ;; esac done fi func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result eval cmds=\"$old_archive_cmds\" func_len " $cmds" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds elif test -n "$archiver_list_spec"; then func_verbose "using command file archive linking..." for obj in $oldobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > $output_objdir/$libname.libcmd func_to_tool_file "$output_objdir/$libname.libcmd" oldobjs=" $archiver_list_spec$func_to_tool_file_result" cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs oldobjs= # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done eval test_cmds=\"$old_archive_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 for obj in $save_oldobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result func_append objlist " $obj" if test "$len" -lt "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj"; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$old_archive_cmds\" objlist= len=$len0 fi done RANLIB=$save_RANLIB oldobjs=$objlist if test -z "$oldobjs"; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi func_execute_cmds "$cmds" 'exit $?' done test -n "$generated" && \ func_show_eval "${RM}r$generated" # Now create the libtool archive. case $output in *.la) old_library= test yes = "$build_old_libs" && old_library=$libname.$libext func_verbose "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` if test yes = "$hardcode_automatic"; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do if test yes = "$installed"; then if test -z "$install_libdir"; then break fi output=$output_objdir/${outputname}i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) func_basename "$deplib" name=$func_basename_result func_resolve_sysroot "$deplib" eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` test -z "$libdir" && \ func_fatal_error "'$deplib' is not a valid libtool archive" func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" ;; -L*) func_stripname -L '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -L$func_replace_sysroot_result" ;; -R*) func_stripname -R '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -R$func_replace_sysroot_result" ;; *) func_append newdependency_libs " $deplib" ;; esac done dependency_libs=$newdependency_libs newdlfiles= for lib in $dlfiles; do case $lib in *.la) func_basename "$lib" name=$func_basename_result eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "'$lib' is not a valid libtool archive" func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" ;; *) func_append newdlfiles " $lib" ;; esac done dlfiles=$newdlfiles newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: func_basename "$lib" name=$func_basename_result eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "'$lib' is not a valid libtool archive" func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" ;; esac done dlprefiles=$newdlprefiles else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlfiles " $abs" done dlfiles=$newdlfiles newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlprefiles " $abs" done dlprefiles=$newdlprefiles fi $RM $output # place dlname in correct position for cygwin # In fact, it would be nice if we could use this code for all target # systems that can't hard-code library paths into their executables # and that have no shared library path variable independent of PATH, # but it turns out we can't easily determine that from inspecting # libtool variables, so we have to hard-code the OSs to which it # applies here; at the moment, that means platforms that use the PE # object format with DLL files. See the long comment at the top of # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) # If a -bindir argument was supplied, place the dll there. if test -n "$bindir"; then func_relative_path "$install_libdir" "$bindir" tdlname=$func_relative_path_result/$dlname else # Otherwise fall back on heuristic. tdlname=../bin/$dlname fi ;; esac $ECHO > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that cannot go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test no,yes = "$installed,$need_relink"; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi done } # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' ;; esac exit $EXIT_SUCCESS } if test link = "$opt_mode" || test relink = "$opt_mode"; then func_mode_link ${1+"$@"} fi # func_mode_uninstall arg... func_mode_uninstall () { $debug_cmd RM=$nonopt files= rmforce=false exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic=$magic for arg do case $arg in -f) func_append RM " $arg"; rmforce=: ;; -*) func_append RM " $arg" ;; *) func_append files " $arg" ;; esac done test -z "$RM" && \ func_fatal_help "you must specify an RM program" rmdirs= for file in $files; do func_dirname "$file" "" "." dir=$func_dirname_result if test . = "$dir"; then odir=$objdir else odir=$dir/$objdir fi func_basename "$file" name=$func_basename_result test uninstall = "$opt_mode" && odir=$dir # Remember odir for removal later, being careful to avoid duplicates if test clean = "$opt_mode"; then case " $rmdirs " in *" $odir "*) ;; *) func_append rmdirs " $odir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if { test -L "$file"; } >/dev/null 2>&1 || { test -h "$file"; } >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif $rmforce; then continue fi rmfiles=$file case $name in *.la) # Possibly a libtool archive, so verify it. if func_lalib_p "$file"; then func_source $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do func_append rmfiles " $odir/$n" done test -n "$old_library" && func_append rmfiles " $odir/$old_library" case $opt_mode in clean) case " $library_names " in *" $dlname "*) ;; *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; esac test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if func_lalib_p "$file"; then # Read the .lo file func_source $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test none != "$pic_object"; then func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test none != "$non_pic_object"; then func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) if test clean = "$opt_mode"; then noexename=$name case $file in *.exe) func_stripname '' '.exe' "$file" file=$func_stripname_result func_stripname '' '.exe' "$name" noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe func_append rmfiles " $file" ;; esac # Do a test to see if this is a libtool program. if func_ltwrapper_p "$file"; then if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result func_append rmfiles " $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename fi # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles func_append rmfiles " $odir/$name $odir/${name}S.$objext" if test yes = "$fast_install" && test -n "$relink_command"; then func_append rmfiles " $odir/lt-$name" fi if test "X$noexename" != "X$name"; then func_append rmfiles " $odir/lt-$noexename.c" fi fi fi ;; esac func_show_eval "$RM $rmfiles" 'exit_status=1' done # Try to remove the $objdir's in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then func_show_eval "rmdir $dir >/dev/null 2>&1" fi done exit $exit_status } if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then func_mode_uninstall ${1+"$@"} fi test -z "$opt_mode" && { help=$generic_help func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode '$opt_mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi exit $exit_status # The TAGs below are defined such that we never get into a situation # where we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: proj-8.2.1/CMakeLists.txt000644 000765 000024 00000031505 14164067106 015707 0ustar00keversstaff000000 000000 ################################################################################ # # This file is part of CMake configuration for PROJ library (inspired from SOCI # CMake, Copyright (C) 2009-2010 Mateusz Loskot ) # # Copyright (C) 2011 Nicolas David # Distributed under the MIT license # ################################################################################ # General settings ################################################################################ cmake_minimum_required(VERSION 3.9 FATAL_ERROR) project(PROJ DESCRIPTION "PROJ coordinate transformation software library" LANGUAGES C CXX ) # Only interpret if() arguments as variables or keywords when unquoted cmake_policy(SET CMP0054 NEW) # Set C++ version # Make CMAKE_CXX_STANDARD available as cache option overridable by user set(CMAKE_CXX_STANDARD 11 CACHE STRING "C++ standard version to use (default is 11)") message(STATUS "Requiring C++${CMAKE_CXX_STANDARD}") set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) message(STATUS "Requiring C++${CMAKE_CXX_STANDARD} - done") # Set C99 version # Make CMAKE_C_STANDARD available as cache option overridable by user set(CMAKE_C_STANDARD 99 CACHE STRING "C standard version to use (default is 99)") message(STATUS "Requiring C${CMAKE_C_STANDARD}") set(CMAKE_C_STANDARD_REQUIRED ON) set(CMAKE_C_EXTENSIONS OFF) message(STATUS "Requiring C${CMAKE_C_STANDARD} - done") set(CMAKE_SKIP_BUILD_RPATH FALSE) set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) if(APPLE) set(MACOSX_RPATH ON) endif() # Set global -fvisibility=hidden set(CMAKE_C_VISIBILITY_PRESET hidden) set(CMAKE_CXX_VISIBILITY_PRESET hidden) # Set warnings as variables, then store as cache options set(PROJ_common_WARN_FLAGS # common only to GNU/Clang C/C++ -Wall -Wextra -Wswitch -Wshadow -Wunused-parameter -Wmissing-declarations -Wformat -Wformat-security ) if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") set(PROJ_C_WARN_FLAGS ${PROJ_common_WARN_FLAGS} -Wmissing-prototypes ) set(PROJ_CXX_WARN_FLAGS ${PROJ_common_WARN_FLAGS}) elseif("${CMAKE_C_COMPILER_ID}" MATCHES "Clang") set(PROJ_C_WARN_FLAGS ${PROJ_common_WARN_FLAGS} -Wmissing-prototypes -Wfloat-conversion -Wc11-extensions ) set(PROJ_CXX_WARN_FLAGS ${PROJ_common_WARN_FLAGS} -Wfloat-conversion ) elseif("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC") add_definitions(/D_CRT_SECURE_NO_WARNINGS) # Eliminate deprecation warnings set(PROJ_C_WARN_FLAGS /W4 /wd4706 # Suppress warning about assignment within conditional expression /wd4996 # Suppress warning about sprintf, etc., being unsafe ) set(PROJ_CXX_WARN_FLAGS /EHsc ${PROJ_C_WARN_FLAGS}) elseif("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel") if(MSVC) set(PROJ_C_WARN_FLAGS /Wall) set(PROJ_CXX_WARN_FLAGS /Wall) else() set(PROJ_C_WARN_FLAGS -Wall) set(PROJ_CXX_WARN_FLAGS -Wall) endif() endif() if (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") # Intel CXX compiler based on clang defaults to -ffast-math, which # breaks std::isinf(), std::isnan(), etc. set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -fno-fast-math) set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -fno-fast-math) endif () set(PROJ_C_WARN_FLAGS "${PROJ_C_WARN_FLAGS}" CACHE STRING "C flags used to compile PROJ targets") set(PROJ_CXX_WARN_FLAGS "${PROJ_CXX_WARN_FLAGS}" CACHE STRING "C++ flags used to compile PROJ targets") ################################################################################ # PROJ CMake modules ################################################################################ # Path to additional CMake modules set(CMAKE_MODULE_PATH ${PROJ_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) include(ProjUtilities) message(STATUS "Configuring PROJ:") ################################################################################ #PROJ version information ################################################################################ include(ProjVersion) proj_version(MAJOR 8 MINOR 2 PATCH 1) # Use libtool convention to build the CMake's VERSION and SOVERSION # See https://github.com/pvanhoof/dir-examples#cmake-in-the-cmake-example set(PROJ_LIBTOOL_CURRENT 24) set(PROJ_LIBTOOL_REVISION 1) set(PROJ_LIBTOOL_AGE 2) math(EXPR PROJ_API_VERSION "${PROJ_LIBTOOL_CURRENT} - ${PROJ_LIBTOOL_AGE}") set(PROJ_BUILD_VERSION "${PROJ_API_VERSION}.${PROJ_LIBTOOL_AGE}.${PROJ_LIBTOOL_REVISION}") ################################################################################ # Build features and variants ################################################################################ include(ProjConfig) include(ProjMac) include(policies) ################################################################################ # Check for nlohmann_json ################################################################################ set(NLOHMANN_JSON_ORIGIN "auto" CACHE STRING "nlohmann/json origin. The default auto will try to use external \ nlohmann/json if possible") set_property(CACHE NLOHMANN_JSON_ORIGIN PROPERTY STRINGS auto internal external) # Probably not the strictest minimum, but known to work with it set(MIN_NLOHMANN_JSON_VERSION 3.7.0) if(NLOHMANN_JSON_ORIGIN STREQUAL "external") find_package(nlohmann_json REQUIRED) set(NLOHMANN_JSON "external") elseif(NLOHMANN_JSON_ORIGIN STREQUAL "internal") set(NLOHMANN_JSON "internal") else() find_package(nlohmann_json QUIET) if(nlohmann_json_FOUND) set(NLOHMANN_JSON "external") else() set(NLOHMANN_JSON "internal") endif() endif() if(NLOHMANN_JSON STREQUAL "external") # Check minimum version if(nlohmann_json_VERSION VERSION_LESS MIN_NLOHMANN_JSON_VERSION) message(STATUS "external nlohmann/json version ${nlohmann_json_VERSION} " "is older than minimum requirement ${MIN_NLOHMANN_JSON_VERSION}") set(NLOHMANN_JSON "internal") else() message(STATUS "found nlohmann/json version ${nlohmann_json_VERSION}") endif() endif() message(STATUS "nlohmann/json: ${NLOHMANN_JSON}") ################################################################################ # Check for sqlite3 ################################################################################ find_program(EXE_SQLITE3 sqlite3) if(NOT EXE_SQLITE3) message(SEND_ERROR "sqlite3 binary not found!") endif() find_package(Sqlite3 REQUIRED) if(NOT SQLITE3_FOUND) message(SEND_ERROR "sqlite3 dependency not found!") endif() # Would build and run with older versions, but with horrible performance # See https://github.com/OSGeo/PROJ/issues/1718 if("${SQLITE3_VERSION}" VERSION_LESS "3.11") message(SEND_ERROR "sqlite3 >= 3.11 required!") endif() ################################################################################ # Check for libtiff ################################################################################ option(ENABLE_TIFF "Enable TIFF support to read some grids" ON) mark_as_advanced(ENABLE_TIFF) set(TIFF_ENABLED FALSE) if(ENABLE_TIFF) find_package(TIFF REQUIRED) if(TIFF_FOUND) set(TIFF_ENABLED TRUE) else() message(SEND_ERROR "libtiff dependency not found! Use ENABLE_TIFF=OFF to force it off") endif() else() message(WARNING "TIFF support is not enabled and will result in the inability to read " "some grids") endif() ################################################################################ # Check for curl ################################################################################ option(ENABLE_CURL "Enable Curl support" ON) set(CURL_ENABLED FALSE) if(ENABLE_CURL) find_package(CURL REQUIRED) if(CURL_FOUND) set(CURL_ENABLED TRUE) else() message(SEND_ERROR "curl dependency not found!") endif() endif() ################################################################################ option(PROJ_LIB_ENV_VAR_TRIED_LAST "Whether the PROJ_LIB environment variable should be tried after the hardcoded location" OFF) if(PROJ_LIB_ENV_VAR_TRIED_LAST) add_definitions(-DPROJ_LIB_ENV_VAR_TRIED_LAST) endif() ################################################################################ # threading configuration ################################################################################ set(CMAKE_THREAD_PREFER_PTHREAD TRUE) find_package(Threads) include(CheckCSourceCompiles) if(MSVC) set(CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} /WX /W4") else() set(CMAKE_REQUIRED_LIBRARIES m) set(CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} -Werror -Wall") endif() if(Threads_FOUND AND CMAKE_USE_PTHREADS_INIT) set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}") check_c_source_compiles(" #include int main(int argc, char* argv[]) { (void)PTHREAD_MUTEX_RECURSIVE; (void)argv; return argc; } " HAVE_PTHREAD_MUTEX_RECURSIVE_DEFN) if(HAVE_PTHREAD_MUTEX_RECURSIVE_DEFN) add_definitions(-DHAVE_PTHREAD_MUTEX_RECURSIVE=1) endif() endif() # Set a default build type for single-configuration cmake generators if # no build type is set. if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release) endif() if(MSVC OR CMAKE_CONFIGURATION_TYPES) # For multi-config systems and for Visual Studio, the debug version of # the library has _d appended. set(CMAKE_DEBUG_POSTFIX _d) endif() # Put the libraries and binaries that get built into directories at the # top of the build tree rather than in hard-to-find leaf # directories. This simplifies manual testing and the use of the build # tree rather than installed PROJ libraries. set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJ_BINARY_DIR}/lib) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJ_BINARY_DIR}/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJ_BINARY_DIR}/bin) link_directories(${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) ################################################################################ # Installation ################################################################################ include(ProjInstallPath) set(BINDIR "${DEFAULT_BINDIR}" CACHE PATH "The directory to install binaries into.") set(LIBDIR "${DEFAULT_LIBDIR}" CACHE PATH "The directory to install libraries into.") set(DATADIR "${DEFAULT_DATADIR}" CACHE PATH "The directory to install data files into.") set(DOCDIR "${DEFAULT_DOCDIR}" CACHE PATH "The directory to install doc files into.") set(INCLUDEDIR "${DEFAULT_INCLUDEDIR}" CACHE PATH "The directory to install includes into.") set(CMAKECONFIGDIR "${DEFAULT_CMAKEDIR}" CACHE PATH "Parent of the directory to install cmake config files into.") ################################################################################ # Tests ################################################################################ include(CTest) if(BUILD_TESTING) include(ProjTest) else() message(STATUS "Testing disabled") endif() ################################################################################ # Build configured components ################################################################################ include_directories(${PROJ_SOURCE_DIR}/src) add_subdirectory(data) add_subdirectory(include) add_subdirectory(src) add_subdirectory(man) add_subdirectory(cmake) if(BUILD_TESTING) add_subdirectory(test) endif() set(docfiles COPYING NEWS AUTHORS) install(FILES ${docfiles} DESTINATION "${DOCDIR}") ################################################################################ # pkg-config support ################################################################################ if(UNIX OR MINGW) configure_proj_pc() install(FILES ${CMAKE_CURRENT_BINARY_DIR}/proj.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) endif() ################################################################################ # "make dist" workalike ################################################################################ set(CPACK_SOURCE_GENERATOR "TGZ;ZIP") set(CPACK_SOURCE_PACKAGE_FILE_NAME "proj-${PROJ_VERSION}") set(CPACK_PACKAGE_VENDOR "OSGeo") set(CPACK_PACKAGE_VERSION_MAJOR ${PROJ_VERSION_MAJOR}) set(CPACK_PACKAGE_VERSION_MINOR ${PROJ_VERSION_MINOR}) set(CPACK_PACKAGE_VERSION_PATCH ${PROJ_VERSION_PATCH}) set(CPACK_VERBATIM_VARIABLES TRUE) set(CPACK_SOURCE_IGNORE_FILES /\\..* # any file/directory starting with . /.*\\.yml /.*\\.gz /.*\\.zip /.*build.*/ \\.deps /autogen\\.sh /autom4te\\.cache /CODE_OF_CONDUCT.md /CONTRIBUTING.md /Dockerfile /docs/ /Doxyfile /examples/ /HOWTO-RELEASE /m4/lt* /m4/libtool* /media/ /schemas/ /scripts/ /test/fuzzers/ /test/gigs/.*gie\\.failing /test/postinstall/ /travis/ ${PROJECT_BINARY_DIR} ) include(CPack) # Simplify README.md to README add_custom_target(README COMMAND ${CMAKE_COMMAND} -D PROJ_SOURCE_DIR=${PROJ_SOURCE_DIR} -P ${PROJ_SOURCE_DIR}/cmake/ProjReadme.cmake ) get_property(_is_multi_config_generator GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(NOT _is_multi_config_generator) add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source DEPENDS README ) message(STATUS "PROJ: Configured 'dist' target") endif() proj-8.2.1/test/000755 000765 000024 00000000000 14164067220 014117 5ustar00keversstaff000000 000000 proj-8.2.1/cmake/000755 000765 000024 00000000000 14164067216 014225 5ustar00keversstaff000000 000000 proj-8.2.1/configure000755 000765 000024 00002447254 14164067171 015076 0ustar00keversstaff000000 000000 #! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for PROJ 8.2.1. # # Report bugs to . # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and $0: https://github.com/OSGeo/PROJ/issues about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='PROJ' PACKAGE_TARNAME='proj' PACKAGE_VERSION='8.2.1' PACKAGE_STRING='PROJ 8.2.1' PACKAGE_BUGREPORT='https://github.com/OSGeo/PROJ/issues' PACKAGE_URL='https://proj.org' # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS USE_EXTERNAL_GTEST_FALSE USE_EXTERNAL_GTEST_TRUE GTEST_LIBS GTEST_CFLAGS PROJ_LIB_ENV_VAR_TRIED_LAST_FLAGS EXTRA_LIBS HAVE_CURL_FALSE HAVE_CURL_TRUE CURL_ENABLED_FLAGS CURL_LIBS CURL_CFLAGS LIBCURL_CONFIG TIFF_ENABLED_FLAGS TIFF_LIBS TIFF_CFLAGS SQLITE3_CHECK SQLITE3_LIBS SQLITE3_CFLAGS THREAD_LIB MUTEX_SETTING NO_ZERO_AS_NULL_POINTER_CONSTANT_FLAG CXX_WFLAGS C_WFLAGS FLTO_FLAG PKG_CONFIG CXXCPP CPP LT_SYS_LIBRARY_PATH OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL RANLIB ac_ct_AR AR DLLTOOL OBJDUMP NM ac_ct_DUMPBIN DUMPBIN LD FGREP EGREP GREP SED host_os host_vendor host_cpu host build_os build_vendor build_cpu build LIBTOOL LN_S HAVE_CXX11 am__fastdepCXX_FALSE am__fastdepCXX_TRUE CXXDEPMODE ac_ct_CXX CXXFLAGS CXX am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL am__quote' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_dependency_tracking enable_shared enable_static with_pic enable_fast_install with_aix_soname with_gnu_ld with_sysroot enable_libtool_lock enable_lto with_mutex enable_tiff with_curl enable_proj_lib_env_var_tried_last with_external_gtest ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CXX CXXFLAGS CCC LT_SYS_LIBRARY_PATH CPP CXXCPP PKG_CONFIG SQLITE3_CFLAGS SQLITE3_LIBS TIFF_CFLAGS TIFF_LIBS GTEST_CFLAGS GTEST_LIBS' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures PROJ 8.2.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/proj] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of PROJ 8.2.1:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --enable-lto enable LTO(link time optimization) (disabled by default) --enable-tiff Enable TIFF support; strongly encouraged to read some grids [default=yes] --enable-proj-lib-env-var-tried-last Whether the PROJ_LIB environment variable should be tried after the hardcoded location [default=no] Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] --with-aix-soname=aix|svr4|both shared library versioning (aka "SONAME") variant to provide on AIX, [default=aix]. --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified). --without-mutex Disable real mutex locks (lacking pthreads) --with-curl=ARG Enable curl support (ARG=path to curl-config.) --with-external-gtest Whether to use external Google Test Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CXX C++ compiler command CXXFLAGS C++ compiler flags LT_SYS_LIBRARY_PATH User-defined run-time library search path. CPP C preprocessor CXXCPP C++ preprocessor PKG_CONFIG path to pkg-config utility SQLITE3_CFLAGS C compiler flags for SQLITE3, overriding pkg-config SQLITE3_LIBS linker flags for SQLITE3, overriding pkg-config TIFF_CFLAGS C compiler flags for TIFF, overriding pkg-config TIFF_LIBS linker flags for TIFF, overriding pkg-config GTEST_CFLAGS C compiler flags for GTEST, overriding pkg-config GTEST_LIBS linker flags for GTEST, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . PROJ home page: . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF PROJ configure 8.2.1 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_cxx_try_compile LINENO # ---------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_cxx_try_cpp LINENO # ------------------------ # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_cpp # ac_fn_cxx_try_link LINENO # ------------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_link # ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES # --------------------------------------------- # Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR # accordingly. ac_fn_c_check_decl () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack as_decl_name=`echo $2|sed 's/ *(.*//'` as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 $as_echo_n "checking whether $as_decl_name is declared... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { #ifndef $as_decl_name #ifdef __cplusplus (void) $as_decl_use; #else (void) $as_decl_name; #endif #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_decl cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by PROJ $as_me 8.2.1, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in . "$srcdir"/.; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in . \"$srcdir\"/." "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. am__api_version='1.16' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else 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_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else 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_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else 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_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='proj' VERSION='8.2.1' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar pax cpio none' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 fi fi ac_config_headers="$ac_config_headers src/proj_config.h" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else 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_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else 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_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else 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_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no 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 if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else 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_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else 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_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 $as_echo_n "checking whether $CC understands -c and -o together... " >&6; } if ${am_cv_prog_cc_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 $as_echo "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 $as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; } cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } case $?:`cat confinc.out 2>/dev/null` in #( '0:this is the am__doit target') : case $s in #( BSD) : am__include='.include' am__quote='"' ;; #( *) : am__include='include' am__quote='' ;; esac ;; #( *) : ;; esac if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 $as_echo "${_am_result}" >&6; } # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5 $as_echo_n "checking for $CC option to accept ISO C99... " >&6; } if ${ac_cv_prog_cc_c99+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c99=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include #include // Check varargs macros. These examples are taken from C99 6.10.3.5. #define debug(...) fprintf (stderr, __VA_ARGS__) #define showlist(...) puts (#__VA_ARGS__) #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) static void test_varargs_macros (void) { int x = 1234; int y = 5678; debug ("Flag"); debug ("X = %d\n", x); showlist (The first, second, and third items.); report (x>y, "x is %d but y is %d", x, y); } // Check long long types. #define BIG64 18446744073709551615ull #define BIG32 4294967295ul #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) #if !BIG_OK your preprocessor is broken; #endif #if BIG_OK #else your preprocessor is broken; #endif static long long int bignum = -9223372036854775807LL; static unsigned long long int ubignum = BIG64; struct incomplete_array { int datasize; double data[]; }; struct named_init { int number; const wchar_t *name; double average; }; typedef const char *ccp; static inline int test_restrict (ccp restrict text) { // See if C++-style comments work. // Iterate through items via the restricted pointer. // Also check for declarations in for loops. for (unsigned int i = 0; *(text+i) != '\0'; ++i) continue; return 0; } // Check varargs and va_copy. static void test_varargs (const char *format, ...) { va_list args; va_start (args, format); va_list args_copy; va_copy (args_copy, args); const char *str; int number; float fnumber; while (*format) { switch (*format++) { case 's': // string str = va_arg (args_copy, const char *); break; case 'd': // int number = va_arg (args_copy, int); break; case 'f': // float fnumber = va_arg (args_copy, double); break; default: break; } } va_end (args_copy); va_end (args); } int main () { // Check bool. _Bool success = false; // Check restrict. if (test_restrict ("String literal") == 0) success = true; char *restrict newvar = "Another string"; // Check varargs. test_varargs ("s, d' f .", "string", 65, 34.234); test_varargs_macros (); // Check flexible array members. struct incomplete_array *ia = malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); ia->datasize = 10; for (int i = 0; i < ia->datasize; ++i) ia->data[i] = i * 1.234; // Check named initializers. struct named_init ni = { .number = 34, .name = L"Test wide string", .average = 543.34343, }; ni.number = 58; int dynamic_array[ni.number]; dynamic_array[ni.number - 1] = 543; // work around unused variable warnings return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' || dynamic_array[ni.number - 1] != 543); ; return 0; } _ACEOF for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc99 do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c99=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c99" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c99" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c99" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 $as_echo "$ac_cv_prog_cc_c99" >&6; } ;; esac if test "x$ac_cv_prog_cc_c99" != xno; then : fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else 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_prog_CXX="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 $as_echo "$CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else 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_prog_ac_ct_CXX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 $as_echo "$ac_ct_CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CXX" && break done if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 $as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } if ${ac_cv_cxx_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 $as_echo "$ac_cv_cxx_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 $as_echo_n "checking whether $CXX accepts -g... " >&6; } if ${ac_cv_prog_cxx_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes else CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : else ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 $as_echo "$ac_cv_prog_cxx_g" >&6; } if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CXX" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CXX_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CXX_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CXX_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CXX_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 $as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then am__fastdepCXX_TRUE= am__fastdepCXX_FALSE='#' else am__fastdepCXX_TRUE='#' am__fastdepCXX_FALSE= fi ax_cxx_compile_cxx11_required=true ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ac_success=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features by default" >&5 $as_echo_n "checking whether $CXX supports C++11 features by default... " >&6; } if ${ax_cv_cxx_compile_cxx11+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ // If the compiler admits that it is not ready for C++11, why torture it? // Hopefully, this will speed up the test. #ifndef __cplusplus #error "This is not a C++ compiler" #elif __cplusplus < 201103L #error "This is not a C++11 compiler" #else namespace cxx11 { namespace test_static_assert { template struct check { static_assert(sizeof(int) <= sizeof(T), "not big enough"); }; } namespace test_final_override { struct Base { virtual void f() {} }; struct Derived : public Base { virtual void f() override {} }; } namespace test_double_right_angle_brackets { template < typename T > struct check {}; typedef check single_type; typedef check> double_type; typedef check>> triple_type; typedef check>>> quadruple_type; } namespace test_decltype { int f() { int a = 1; decltype(a) b = 2; return a + b; } } namespace test_type_deduction { template < typename T1, typename T2 > struct is_same { static const bool value = false; }; template < typename T > struct is_same { static const bool value = true; }; template < typename T1, typename T2 > auto add(T1 a1, T2 a2) -> decltype(a1 + a2) { return a1 + a2; } int test(const int c, volatile int v) { static_assert(is_same::value == true, ""); static_assert(is_same::value == false, ""); static_assert(is_same::value == false, ""); auto ac = c; auto av = v; auto sumi = ac + av + 'x'; auto sumf = ac + av + 1.0; static_assert(is_same::value == true, ""); static_assert(is_same::value == true, ""); static_assert(is_same::value == true, ""); static_assert(is_same::value == false, ""); static_assert(is_same::value == true, ""); return (sumf > 0.0) ? sumi : add(c, v); } } namespace test_noexcept { int f() { return 0; } int g() noexcept { return 0; } static_assert(noexcept(f()) == false, ""); static_assert(noexcept(g()) == true, ""); } namespace test_constexpr { template < typename CharT > unsigned long constexpr strlen_c_r(const CharT *const s, const unsigned long acc) noexcept { return *s ? strlen_c_r(s + 1, acc + 1) : acc; } template < typename CharT > unsigned long constexpr strlen_c(const CharT *const s) noexcept { return strlen_c_r(s, 0UL); } static_assert(strlen_c("") == 0UL, ""); static_assert(strlen_c("1") == 1UL, ""); static_assert(strlen_c("example") == 7UL, ""); static_assert(strlen_c("another\0example") == 7UL, ""); } namespace test_rvalue_references { template < int N > struct answer { static constexpr int value = N; }; answer<1> f(int&) { return answer<1>(); } answer<2> f(const int&) { return answer<2>(); } answer<3> f(int&&) { return answer<3>(); } void test() { int i = 0; const int c = 0; static_assert(decltype(f(i))::value == 1, ""); static_assert(decltype(f(c))::value == 2, ""); static_assert(decltype(f(0))::value == 3, ""); } } namespace test_uniform_initialization { struct test { static const int zero {}; static const int one {1}; }; static_assert(test::zero == 0, ""); static_assert(test::one == 1, ""); } namespace test_lambdas { void test1() { auto lambda1 = [](){}; auto lambda2 = lambda1; lambda1(); lambda2(); } int test2() { auto a = [](int i, int j){ return i + j; }(1, 2); auto b = []() -> int { return '0'; }(); auto c = [=](){ return a + b; }(); auto d = [&](){ return c; }(); auto e = [a, &b](int x) mutable { const auto identity = [](int y){ return y; }; for (auto i = 0; i < a; ++i) a += b--; return x + identity(a + b); }(0); return a + b + c + d + e; } int test3() { const auto nullary = [](){ return 0; }; const auto unary = [](int x){ return x; }; using nullary_t = decltype(nullary); using unary_t = decltype(unary); const auto higher1st = [](nullary_t f){ return f(); }; const auto higher2nd = [unary](nullary_t f1){ return [unary, f1](unary_t f2){ return f2(unary(f1())); }; }; return higher1st(nullary) + higher2nd(nullary)(unary); } } namespace test_variadic_templates { template struct sum; template struct sum { static constexpr auto value = N0 + sum::value; }; template <> struct sum<> { static constexpr auto value = 0; }; static_assert(sum<>::value == 0, ""); static_assert(sum<1>::value == 1, ""); static_assert(sum<23>::value == 23, ""); static_assert(sum<1, 2>::value == 3, ""); static_assert(sum<5, 5, 11>::value == 21, ""); static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); } // https://stackoverflow.com/q/13728184 // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function // because of this. namespace test_template_alias_sfinae { struct foo {}; template using member = typename T::member_type; template void func(...) {} template void func(member*) {} void test(); void test() { func(0); } } } // namespace cxx11 #endif // __cplusplus >= 201103L _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ax_cv_cxx_compile_cxx11=yes else ax_cv_cxx_compile_cxx11=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_cxx_compile_cxx11" >&5 $as_echo "$ax_cv_cxx_compile_cxx11" >&6; } if test x$ax_cv_cxx_compile_cxx11 = xyes; then ac_success=yes fi if test x$ac_success = xno; then for switch in -std=c++11 -std=c++0x +std=c++11 "-h std=c++11"; do cachevar=`$as_echo "ax_cv_cxx_compile_cxx11_$switch" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features with $switch" >&5 $as_echo_n "checking whether $CXX supports C++11 features with $switch... " >&6; } if eval \${$cachevar+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_CXX="$CXX" CXX="$CXX $switch" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ // If the compiler admits that it is not ready for C++11, why torture it? // Hopefully, this will speed up the test. #ifndef __cplusplus #error "This is not a C++ compiler" #elif __cplusplus < 201103L #error "This is not a C++11 compiler" #else namespace cxx11 { namespace test_static_assert { template struct check { static_assert(sizeof(int) <= sizeof(T), "not big enough"); }; } namespace test_final_override { struct Base { virtual void f() {} }; struct Derived : public Base { virtual void f() override {} }; } namespace test_double_right_angle_brackets { template < typename T > struct check {}; typedef check single_type; typedef check> double_type; typedef check>> triple_type; typedef check>>> quadruple_type; } namespace test_decltype { int f() { int a = 1; decltype(a) b = 2; return a + b; } } namespace test_type_deduction { template < typename T1, typename T2 > struct is_same { static const bool value = false; }; template < typename T > struct is_same { static const bool value = true; }; template < typename T1, typename T2 > auto add(T1 a1, T2 a2) -> decltype(a1 + a2) { return a1 + a2; } int test(const int c, volatile int v) { static_assert(is_same::value == true, ""); static_assert(is_same::value == false, ""); static_assert(is_same::value == false, ""); auto ac = c; auto av = v; auto sumi = ac + av + 'x'; auto sumf = ac + av + 1.0; static_assert(is_same::value == true, ""); static_assert(is_same::value == true, ""); static_assert(is_same::value == true, ""); static_assert(is_same::value == false, ""); static_assert(is_same::value == true, ""); return (sumf > 0.0) ? sumi : add(c, v); } } namespace test_noexcept { int f() { return 0; } int g() noexcept { return 0; } static_assert(noexcept(f()) == false, ""); static_assert(noexcept(g()) == true, ""); } namespace test_constexpr { template < typename CharT > unsigned long constexpr strlen_c_r(const CharT *const s, const unsigned long acc) noexcept { return *s ? strlen_c_r(s + 1, acc + 1) : acc; } template < typename CharT > unsigned long constexpr strlen_c(const CharT *const s) noexcept { return strlen_c_r(s, 0UL); } static_assert(strlen_c("") == 0UL, ""); static_assert(strlen_c("1") == 1UL, ""); static_assert(strlen_c("example") == 7UL, ""); static_assert(strlen_c("another\0example") == 7UL, ""); } namespace test_rvalue_references { template < int N > struct answer { static constexpr int value = N; }; answer<1> f(int&) { return answer<1>(); } answer<2> f(const int&) { return answer<2>(); } answer<3> f(int&&) { return answer<3>(); } void test() { int i = 0; const int c = 0; static_assert(decltype(f(i))::value == 1, ""); static_assert(decltype(f(c))::value == 2, ""); static_assert(decltype(f(0))::value == 3, ""); } } namespace test_uniform_initialization { struct test { static const int zero {}; static const int one {1}; }; static_assert(test::zero == 0, ""); static_assert(test::one == 1, ""); } namespace test_lambdas { void test1() { auto lambda1 = [](){}; auto lambda2 = lambda1; lambda1(); lambda2(); } int test2() { auto a = [](int i, int j){ return i + j; }(1, 2); auto b = []() -> int { return '0'; }(); auto c = [=](){ return a + b; }(); auto d = [&](){ return c; }(); auto e = [a, &b](int x) mutable { const auto identity = [](int y){ return y; }; for (auto i = 0; i < a; ++i) a += b--; return x + identity(a + b); }(0); return a + b + c + d + e; } int test3() { const auto nullary = [](){ return 0; }; const auto unary = [](int x){ return x; }; using nullary_t = decltype(nullary); using unary_t = decltype(unary); const auto higher1st = [](nullary_t f){ return f(); }; const auto higher2nd = [unary](nullary_t f1){ return [unary, f1](unary_t f2){ return f2(unary(f1())); }; }; return higher1st(nullary) + higher2nd(nullary)(unary); } } namespace test_variadic_templates { template struct sum; template struct sum { static constexpr auto value = N0 + sum::value; }; template <> struct sum<> { static constexpr auto value = 0; }; static_assert(sum<>::value == 0, ""); static_assert(sum<1>::value == 1, ""); static_assert(sum<23>::value == 23, ""); static_assert(sum<1, 2>::value == 3, ""); static_assert(sum<5, 5, 11>::value == 21, ""); static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); } // https://stackoverflow.com/q/13728184 // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function // because of this. namespace test_template_alias_sfinae { struct foo {}; template using member = typename T::member_type; template void func(...) {} template void func(member*) {} void test(); void test() { func(0); } } } // namespace cxx11 #endif // __cplusplus >= 201103L _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval $cachevar=yes else eval $cachevar=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXX="$ac_save_CXX" fi eval ac_res=\$$cachevar { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test x\$$cachevar = xyes; then CXX="$CXX $switch" if test -n "$CXXCPP" ; then CXXCPP="$CXXCPP $switch" fi ac_success=yes break fi done fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test x$ax_cxx_compile_cxx11_required = xtrue; then if test x$ac_success = xno; then as_fn_error $? "*** A compiler with support for C++11 language features is required." "$LINENO" 5 fi fi if test x$ac_success = xno; then HAVE_CXX11=0 { $as_echo "$as_me:${as_lineno-$LINENO}: No compiler with C++11 support was found" >&5 $as_echo "$as_me: No compiler with C++11 support was found" >&6;} else HAVE_CXX11=1 $as_echo "#define HAVE_CXX11 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.4.6' macro_revision='2.4.6' ltmain=$ac_aux_dir/ltmain.sh # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac # Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "" } case $ECHO in printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 $as_echo "printf" >&6; } ;; print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 $as_echo "print -r" >&6; } ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 $as_echo "cat" >&6; } ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST 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_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD=$ac_prog ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test yes = "$with_gnu_ld"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD=$ac_dir/$ac_prog # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM=$NM else lt_nm_to_check=${ac_tool_prefix}nm if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. tmp_nm=$ac_dir/$lt_tmp_nm if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then # Check to see if the nm accepts a BSD-compat flag. # Adding the 'sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty case $build_os in mingw*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break 2 ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS=$lt_save_ifs done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test no != "$lt_cv_path_NM"; then NM=$lt_cv_path_NM else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else if test -n "$ac_tool_prefix"; then for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else 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_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else 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_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; *) DUMPBIN=: ;; esac fi if test : != "$DUMPBIN"; then NM=$DUMPBIN fi fi test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else i=0 teststring=ABCD case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test X`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test 17 != "$i" # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n "$lt_cv_sys_max_cmd_len"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 $as_echo_n "checking how to convert $build file names to $host format... " >&6; } if ${lt_cv_to_host_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 $as_echo "$lt_cv_to_host_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 $as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } if ${lt_cv_to_tool_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 $as_echo "$lt_cv_to_tool_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test yes != "$GCC"; then reload_cmds=false fi ;; darwin*) if test yes = "$GCC"; then reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else 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_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else 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_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # 'unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # that responds to the $file_magic_cmd with a given extended regex. # If you have 'file' or equivalent on your system and you're not sure # whether 'pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd* | bitrig*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; os2*) lt_cv_deplibs_check_method=pass_all ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else 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_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else 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_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 $as_echo_n "checking how to associate runtime and link libraries... " >&6; } if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh; # decide which one to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd=$ECHO ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 $as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else 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_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else 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_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} : ${AR_FLAGS=cru} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 $as_echo_n "checking for archiver @FILE support... " >&6; } if ${lt_cv_ar_at_file+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 $as_echo "$lt_cv_ar_at_file" >&6; } if test no = "$lt_cv_ar_at_file"; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else 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_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else 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_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else 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_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else 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_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in bitrig* | openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test ia64 = "$host_cpu"; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Gets list of data symbols to import. lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" # Adjust the below global symbol transforms to fixup imported variables. lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" lt_c_name_lib_hook="\ -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" else # Disable hooks by default. lt_cv_sys_global_symbol_to_import= lt_cdecl_hook= lt_c_name_hook= lt_c_name_lib_hook= fi # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n"\ $lt_cdecl_hook\ " -e 's/^T .* \(.*\)$/extern int \1();/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ $lt_c_name_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" # Transform an extracted symbol line into symbol name with lib prefix and # symbol address. lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ $lt_c_name_lib_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function, # D for any global variable and I for any imported variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ " /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ " /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ " {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ " s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS=conftstm.$ac_objext CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test yes = "$pipe_works"; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then nm_file_list_spec='@' fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 $as_echo_n "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. if test "${with_sysroot+set}" = set; then : withval=$with_sysroot; else with_sysroot=no fi lt_sysroot= case $with_sysroot in #( yes) if test yes = "$GCC"; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 $as_echo "$with_sysroot" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 $as_echo "${lt_sysroot:-no}" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 $as_echo_n "checking for a working dd... " >&6; } if ${ac_cv_path_lt_DD+:} false; then : $as_echo_n "(cached) " >&6 else printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i : ${lt_DD:=$DD} if test -z "$lt_DD"; then ac_path_lt_DD_found=false # Loop through the user's path and test for each of PROGNAME-LIST 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_prog in dd; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_lt_DD="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_lt_DD" || continue if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: fi $ac_path_lt_DD_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_lt_DD"; then : fi else ac_cv_path_lt_DD=$lt_DD fi rm -f conftest.i conftest2.i conftest.out fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 $as_echo "$ac_cv_path_lt_DD" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 $as_echo_n "checking how to truncate binary pipes... " >&6; } if ${lt_cv_truncate_bin+:} false; then : $as_echo_n "(cached) " >&6 else printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i lt_cv_truncate_bin= if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" fi rm -f conftest.i conftest2.i conftest.out test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 $as_echo "$lt_cv_truncate_bin" >&6; } # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in $*""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test no = "$enable_libtool_lock" || enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out what ABI is being produced by ac_compile, and set mode # options accordingly. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE=32 ;; *ELF-64*) HPUX_IA64_MODE=64 ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test yes = "$lt_cv_prog_gnu_ld"; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; mips64*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then emul=elf case `/usr/bin/file conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; *64-bit*) emul="${emul}64" ;; esac case `/usr/bin/file conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; *LSB*) emul="${emul}ltsmip" ;; esac case `/usr/bin/file conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; esac LD="${LD-ld} -m $emul" fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. Note that the listed cases only cover the # situations where additional linker options are needed (such as when # doing 32-bit compilation for a host where ld defaults to 64-bit, or # vice versa); the common cases where no linker options are needed do # not appear in the list. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*linux*) LD="${LD-ld} -m elf32lppclinux" ;; powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*linux*) LD="${LD-ld} -m elf64lppc" ;; powerpc-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if ${lt_cv_cc_needs_belf+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes else lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } if test yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS=$SAVE_CFLAGS fi ;; *-*solaris*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*|x86_64-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD=${LD-ld}_sol2 fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks=$enable_libtool_lock if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else 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_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 $as_echo "$MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else 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_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 $as_echo "$ac_ct_MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 $as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if ${lt_cv_path_mainfest_tool+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 $as_echo "$lt_cv_path_mainfest_tool" >&6; } if test yes != "$lt_cv_path_mainfest_tool"; then MANIFEST_TOOL=: fi case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else 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_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else 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_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else 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_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else 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_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else 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_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else 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_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else 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_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else 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_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else 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_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else 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_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no if test -z "$LT_MULTI_MODULE"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&5 # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test 0 = "$_lt_result"; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if ${lt_cv_ld_exported_symbols_list+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes else lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 $as_echo_n "checking for -force_load linker flag... " >&6; } if ${lt_cv_ld_force_load+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&5 elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then lt_cv_ld_force_load=yes else cat conftest.err >&5 fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 $as_echo "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 10.[012][,.]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test yes = "$lt_cv_apple_cc_single_mod"; then _lt_dar_single_mod='$single_module' fi if test yes = "$lt_cv_ld_exported_symbols_list"; then _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' fi if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac # func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x$2 in x) ;; *:) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" ;; x:*) eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" ;; *::*) eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" ;; *) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" ;; esac } ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF fi done func_stripname_cnf () { case $2 in .*) func_stripname_result=`$ECHO "$3" | $SED "s%^$1%%; s%\\\\$2\$%%"`;; *) func_stripname_result=`$ECHO "$3" | $SED "s%^$1%%; s%$2\$%%"`;; esac } # func_stripname_cnf # Set options enable_dlopen=no enable_win32_dll=no # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS=$lt_save_ifs ;; esac else enable_shared=yes fi # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS=$lt_save_ifs ;; esac else enable_static=yes fi # Check whether --with-pic was given. if test "${with_pic+set}" = set; then : withval=$with_pic; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for lt_pkg in $withval; do IFS=$lt_save_ifs if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS=$lt_save_ifs ;; esac else pic_mode=default fi # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS=$lt_save_ifs ;; esac else enable_fast_install=yes fi shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[5-9]*,yes) { $as_echo "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 $as_echo_n "checking which variant of shared library versioning to provide... " >&6; } # Check whether --with-aix-soname was given. if test "${with_aix_soname+set}" = set; then : withval=$with_aix_soname; case $withval in aix|svr4|both) ;; *) as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5 ;; esac lt_cv_with_aix_soname=$with_aix_soname else if ${lt_cv_with_aix_soname+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_with_aix_soname=aix fi with_aix_soname=$lt_cv_with_aix_soname fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 $as_echo "$with_aix_soname" >&6; } if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, # the AIX toolchain works better with OBJECT_MODE set (default 32). if test 64 = "${OBJECT_MODE-32}"; then shared_archive_member_spec=shr_64 else shared_archive_member_spec=shr fi fi ;; *) with_aix_soname=aix ;; esac # This can be used to rebuild libtool when needed LIBTOOL_DEPS=$ltmain # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF #define LT_OBJDIR "$lt_cv_objdir/" _ACEOF case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a '.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld=$lt_cv_prog_gnu_ld old_CC=$CC old_CFLAGS=$CFLAGS # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o func_cc_basename $compiler cc_basename=$func_cc_basename_result # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/${ac_tool_prefix}file"; then lt_cv_path_MAGIC_CMD=$ac_dir/"${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/file"; then lt_cv_path_MAGIC_CMD=$ac_dir/"file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC=$CC ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test yes = "$GCC"; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; *) lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test yes = "$GCC"; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi lt_prog_compiler_pic='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' if test -n "$lt_prog_compiler_pic"; then lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' case $cc_basename in nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; esac ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='$wl-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64, which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; tcc*) # Fabrice Bellard et al's Tiny C Compiler lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; *Sun\ F* | *Sun*Fortran*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Intel*\ [CF]*Compiler*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; *Portland\ Group*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 $as_echo "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test yes = "$lt_cv_prog_compiler_pic_works"; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test yes = "$lt_cv_prog_compiler_static_works"; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links=nottested if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test no = "$hard_links"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ' (' and ')$', so one must not match beginning or # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', # as well as any symbol that contains 'd'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd* | bitrig*) with_gnu_ld=no ;; esac ld_shlibs=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test yes = "$with_gnu_ld"; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test yes = "$lt_use_gnu_ld_interface"; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='$wl' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' export_dynamic_flag_spec='$wl--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v | $SED -e 's/(^)\+)\s\+//' 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test ia64 != "$host_cpu"; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' export_dynamic_flag_spec='$wl--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' link_all_deplibs=yes ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='$wl-rpath,$libdir' export_dynamic_flag_spec='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test linux-dietlibc = "$host_os"; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test no = "$tmp_diet" then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; nagfor*) # NAGFOR 5.3 tmp_sharedflag='-Wl,-shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi case $cc_basename in tcc*) export_dynamic_flag_spec='-rdynamic' ;; xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test no = "$ld_shlibs"; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then aix_use_runtimelinking=yes break fi done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # traditional, no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. hardcode_direct=no hardcode_direct_absolute=no ;; esac if test yes = "$GCC"; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag="$shared_flag "'$wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi export_dynamic_flag_spec='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then hardcode_libdir_flag_spec='$wl-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' $wl-bernotok' allow_undefined_flag=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols archive_expsym_cmds="$archive_expsym_cmds"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported if test yes = "$lt_cv_ld_force_load"; then whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes allow_undefined_flag=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" archive_expsym_cmds="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" module_expsym_cmds="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test yes = "$GCC"; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='$wl-E' ;; hpux10*) if test yes,no = "$GCC,$with_gnu_ld"; then archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test yes,no = "$GCC,$with_gnu_ld"; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 $as_echo_n "checking if $CC understands -b... " >&6; } if ${lt_cv_prog_compiler__b+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler__b=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler__b=yes fi else lt_cv_prog_compiler__b=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 $as_echo "$lt_cv_prog_compiler__b" >&6; } if test yes = "$lt_cv_prog_compiler__b"; then archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi ;; esac fi if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test yes = "$GCC"; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_irix_exported_symbol=yes else lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$lt_cv_irix_exported_symbol" >&6; } if test yes = "$lt_cv_irix_exported_symbol"; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; linux*) case $cc_basename in tcc*) # Fabrice Bellard et al's Tiny C Compiler ld_shlibs=yes archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='$wl-rpath,$libdir' export_dynamic_flag_spec='$wl-E' else archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='$wl-rpath,$libdir' fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes ;; osf3*) if test yes = "$GCC"; then allow_undefined_flag=' $wl-expect_unresolved $wl\*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test yes = "$GCC"; then allow_undefined_flag=' $wl-expect_unresolved $wl\*' archive_cmds='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test yes = "$GCC"; then wlarc='$wl' archive_cmds='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='$wl' archive_cmds='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. GCC discards it without '$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test yes = "$GCC"; then whole_archive_flag_spec='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test sequent = "$host_vendor"; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='$wl-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='$wl-z,text' allow_undefined_flag='$wl-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='$wl-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='$wl-Bexport' runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test sni = "$host_vendor"; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='$wl-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test no = "$ld_shlibs" && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test yes,yes = "$GCC,$enable_shared"; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no else lt_cv_archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 $as_echo "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test yes = "$GCC"; then case $host_os in darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; *) lt_awk_arg='/^libraries:/' ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;; *) lt_sed_strip_eq='s|=/|/|g' ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary... lt_tmp_lt_search_path_spec= lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` # ...but if some path component already ends with the multilib dir we assume # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). case "$lt_multi_os_dir; $lt_search_path_spec " in "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) lt_multi_os_dir= ;; esac for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" elif test -n "$lt_multi_os_dir"; then test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS = " "; FS = "/|\n";} { lt_foo = ""; lt_count = 0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo = "/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's|/\([A-Za-z]:\)|\1|g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=.so postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='$libname$release$shared_ext$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line '#! .'. This would cause the generated library to # depend on '.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a(lib.so.V)' # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. hardcode_libdir_flag_spec='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec; then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' soname_spec='$libname$shared_ext.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=sco need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test yes = "$with_gnu_ld"; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test yes = "$hardcode_automatic"; then # We can hardcode non-existent directories. if test no != "$hardcode_direct" && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, )" && test no != "$hardcode_minus_L"; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test relink = "$hardcode_action" || test yes = "$inherit_rpath"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi if test yes != "$enable_dlopen"; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen=load_add_on lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen=LoadLibrary lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen=dlopen lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl else lt_cv_dlopen=dyld lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; tpf*) # Don't try to run any link tests for TPF. We know it's impossible # because TPF is a cross-compiler, and we know how we open DSOs. lt_cv_dlopen=dlopen lt_cv_dlopen_libs= lt_cv_dlopen_self=no ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes; then : lt_cv_dlopen=shl_load else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes; then : lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes; then : lt_cv_dlopen=dlopen else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes; then : lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld fi fi fi fi fi fi ;; esac if test no = "$lt_cv_dlopen"; then enable_dlopen=no else enable_dlopen=yes fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS=$CPPFLAGS test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS=$LDFLAGS wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS=$LIBS LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else if test yes = "$cross_compiling"; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } if test yes = "$lt_cv_dlopen_self"; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else if test yes = "$cross_compiling"; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS=$save_CPPFLAGS LDFLAGS=$save_LDFLAGS LIBS=$save_LIBS ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP"; then striplib="$STRIP -x" old_striplib="$STRIP -S" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report what library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC=$lt_save_CC if test -n "$CXX" && ( test no != "$CXX" && ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || (test g++ != "$CXX"))); then ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 $as_echo_n "checking how to run the C++ preprocessor... " >&6; } if test -z "$CXXCPP"; then if ${ac_cv_prog_CXXCPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CXXCPP needs to be expanded for CXXCPP in "$CXX -E" "/lib/cpp" do ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CXXCPP=$CXXCPP fi CXXCPP=$ac_cv_prog_CXXCPP else ac_cv_prog_CXXCPP=$CXXCPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 $as_echo "$CXXCPP" >&6; } ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu else _lt_caught_CXX_error=yes fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu archive_cmds_need_lc_CXX=no allow_undefined_flag_CXX= always_export_symbols_CXX=no archive_expsym_cmds_CXX= compiler_needs_object_CXX=no export_dynamic_flag_spec_CXX= hardcode_direct_CXX=no hardcode_direct_absolute_CXX=no hardcode_libdir_flag_spec_CXX= hardcode_libdir_separator_CXX= hardcode_minus_L_CXX=no hardcode_shlibpath_var_CXX=unsupported hardcode_automatic_CXX=no inherit_rpath_CXX=no module_cmds_CXX= module_expsym_cmds_CXX= link_all_deplibs_CXX=unknown old_archive_cmds_CXX=$old_archive_cmds reload_flag_CXX=$reload_flag reload_cmds_CXX=$reload_cmds no_undefined_flag_CXX= whole_archive_flag_spec_CXX= enable_shared_with_static_runtimes_CXX=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o objext_CXX=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_caught_CXX_error"; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC compiler_CXX=$CC func_cc_basename $compiler cc_basename=$func_cc_basename_result if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test yes = "$GXX"; then lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' else lt_prog_compiler_no_builtin_flag_CXX= fi if test yes = "$GXX"; then # Set up default GNU C++ configuration # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD=$ac_prog ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test yes = "$with_gnu_ld"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD=$ac_dir/$ac_prog # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test yes = "$with_gnu_ld"; then archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='$wl' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_CXX=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else whole_archive_flag_spec_CXX= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } ld_shlibs_CXX=yes case $host_os in aix3*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aix[4-9]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_CXX='' hardcode_direct_CXX=yes hardcode_direct_absolute_CXX=yes hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes file_list_spec_CXX='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. hardcode_direct_CXX=no hardcode_direct_absolute_CXX=no ;; esac if test yes = "$GXX"; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct_CXX=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_CXX=yes hardcode_libdir_flag_spec_CXX='-L$libdir' hardcode_libdir_separator_CXX= fi esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag=$shared_flag' $wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi export_dynamic_flag_spec_CXX='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. always_export_symbols_CXX=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. # The "-G" linker flag allows undefined symbols. no_undefined_flag_CXX='-bernotok' # Determine the default libpath from the value encoded in an empty # executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath__CXX+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath__CXX fi hardcode_libdir_flag_spec_CXX='$wl-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then hardcode_libdir_flag_spec_CXX='$wl-R $libdir:/usr/lib:/lib' allow_undefined_flag_CXX="-z nodefs" archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath__CXX+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath__CXX fi hardcode_libdir_flag_spec_CXX='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_CXX=' $wl-bernotok' allow_undefined_flag_CXX=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec_CXX='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_CXX='$convenience' fi archive_cmds_need_lc_CXX=yes archive_expsym_cmds_CXX='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$RM -r $output_objdir/$realname.d' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_CXX=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else ld_shlibs_CXX=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec_CXX=' ' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=yes file_list_spec_CXX='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' archive_expsym_cmds_CXX='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, CXX)='true' enable_shared_with_static_runtimes_CXX=yes # Don't use ranlib old_postinstall_cmds_CXX='chmod 644 $oldlib' postlink_cmds_CXX='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ func_to_tool_file "$lt_outputfile"~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_CXX='-L$libdir' export_dynamic_flag_spec_CXX='$wl--export-all-symbols' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=no enable_shared_with_static_runtimes_CXX=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... archive_expsym_cmds_CXX='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_CXX=no fi ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc_CXX=no hardcode_direct_CXX=no hardcode_automatic_CXX=yes hardcode_shlibpath_var_CXX=unsupported if test yes = "$lt_cv_ld_force_load"; then whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec_CXX='' fi link_all_deplibs_CXX=yes allow_undefined_flag_CXX=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" archive_expsym_cmds_CXX="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" module_expsym_cmds_CXX="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" if test yes != "$lt_cv_apple_cc_single_mod"; then archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" archive_expsym_cmds_CXX="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" fi else ld_shlibs_CXX=no fi ;; os2*) hardcode_libdir_flag_spec_CXX='-L$libdir' hardcode_minus_L_CXX=yes allow_undefined_flag_CXX=unsupported shrext_cmds=.dll archive_cmds_CXX='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds_CXX='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds_CXX='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes_CXX=yes ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF ld_shlibs_CXX=no ;; freebsd-elf*) archive_cmds_need_lc_CXX=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions ld_shlibs_CXX=yes ;; haiku*) archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' link_all_deplibs_CXX=yes ;; hpux9*) hardcode_libdir_flag_spec_CXX='$wl+b $wl$libdir' hardcode_libdir_separator_CXX=: export_dynamic_flag_spec_CXX='$wl-E' hardcode_direct_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; hpux10*|hpux11*) if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec_CXX='$wl+b $wl$libdir' hardcode_libdir_separator_CXX=: case $host_cpu in hppa*64*|ia64*) ;; *) export_dynamic_flag_spec_CXX='$wl-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no ;; *) hardcode_direct_CXX=yes hardcode_direct_absolute_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; interix[3-9]*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' export_dynamic_flag_spec_CXX='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_CXX='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib' fi fi link_all_deplibs_CXX=yes ;; esac hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' hardcode_libdir_separator_CXX=: inherit_rpath_CXX=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac archive_cmds_need_lc_CXX=no hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' whole_archive_flag_spec_CXX='$wl--whole-archive$convenience $wl--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [1-5].* | *pgcpp\ [1-5].*) prelink_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' old_archive_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' archive_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac hardcode_libdir_flag_spec_CXX='$wl--rpath $wl$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' whole_archive_flag_spec_CXX='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' ;; cxx*) # Compaq C++ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_CXX='-rpath $libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' export_dynamic_flag_spec_CXX='$wl--export-dynamic' archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' hardcode_libdir_flag_spec_CXX='-R$libdir' whole_archive_flag_spec_CXX='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object_CXX=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; m88k*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) ld_shlibs_CXX=yes ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no hardcode_direct_absolute_CXX=yes archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' export_dynamic_flag_spec_CXX='$wl-E' whole_archive_flag_spec_CXX=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else ld_shlibs_CXX=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' hardcode_libdir_separator_CXX=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; cxx*) case $host in osf3*) allow_undefined_flag_CXX=' $wl-expect_unresolved $wl\*' archive_cmds_CXX='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' ;; *) allow_undefined_flag_CXX=' -expect_unresolved \*' archive_cmds_CXX='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~ $RM $lib.exp' hardcode_libdir_flag_spec_CXX='-rpath $libdir' ;; esac hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes,no = "$GXX,$with_gnu_ld"; then allow_undefined_flag_CXX=' $wl-expect_unresolved $wl\*' case $host in osf3*) archive_cmds_CXX='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; *) archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; esac hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ archive_cmds_need_lc_CXX=yes no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_shlibpath_var_CXX=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract' ;; esac link_all_deplibs_CXX=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test yes,no = "$GXX,$with_gnu_ld"; then no_undefined_flag_CXX=' $wl-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require '-G' NOT '-shared' on this # platform. archive_cmds_CXX='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi hardcode_libdir_flag_spec_CXX='$wl-R $wl$libdir' case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) whole_archive_flag_spec_CXX='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag_CXX='$wl-z,text' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag_CXX='$wl-z,text' allow_undefined_flag_CXX='$wl-z,nodefs' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='$wl-R,$libdir' hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes export_dynamic_flag_spec_CXX='$wl-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~ '"$old_archive_cmds_CXX" reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~ '"$reload_cmds_CXX" ;; *) archive_cmds_CXX='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 $as_echo "$ld_shlibs_CXX" >&6; } test no = "$ld_shlibs_CXX" && can_build_shared=no GCC_CXX=$GXX LD_CXX=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... # Dependencies to place before and after the object being linked: predep_objects_CXX= postdep_objects_CXX= predeps_CXX= postdeps_CXX= compiler_lib_search_path_CXX= cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; esac if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case $prev$p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test x-L = "$p" || test x-R = "$p"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test no = "$pre_test_object_deps_done"; then case $prev in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$compiler_lib_search_path_CXX"; then compiler_lib_search_path_CXX=$prev$p else compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} $prev$p" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$postdeps_CXX"; then postdeps_CXX=$prev$p else postdeps_CXX="${postdeps_CXX} $prev$p" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test no = "$pre_test_object_deps_done"; then if test -z "$predep_objects_CXX"; then predep_objects_CXX=$p else predep_objects_CXX="$predep_objects_CXX $p" fi else if test -z "$postdep_objects_CXX"; then postdep_objects_CXX=$p else postdep_objects_CXX="$postdep_objects_CXX $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling CXX test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken case $host_os in interix[3-9]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. predep_objects_CXX= postdep_objects_CXX= postdeps_CXX= ;; esac case " $postdeps_CXX " in *" -lc "*) archive_cmds_need_lc_CXX=no ;; esac compiler_lib_search_dirs_CXX= if test -n "${compiler_lib_search_path_CXX}"; then compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | $SED -e 's! -L! !g' -e 's!^ !!'` fi lt_prog_compiler_wl_CXX= lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX= # C++ specific cases for pic, static, wl, etc. if test yes = "$GXX"; then lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' fi lt_prog_compiler_pic_CXX='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic_CXX='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic_CXX='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static_CXX='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_CXX='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all lt_prog_compiler_pic_CXX= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static_CXX= ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_CXX=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic_CXX='-fPIC -shared' ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac else case $host_os in aix[4-9]*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' else lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_CXX='-DDLL_EXPORT' ;; dgux*) case $cc_basename in ec++*) lt_prog_compiler_pic_CXX='-KPIC' ;; ghcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='$wl-a ${wl}archive' if test ia64 != "$host_cpu"; then lt_prog_compiler_pic_CXX='+Z' fi ;; aCC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='$wl-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_CXX='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # KAI C++ Compiler lt_prog_compiler_wl_CXX='--backend -Wl,' lt_prog_compiler_pic_CXX='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64, which still supported -KPIC. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fPIC' lt_prog_compiler_static_CXX='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fpic' lt_prog_compiler_static_CXX='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; xlc* | xlC* | bgxl[cC]* | mpixl[cC]*) # IBM XL 8.0, 9.0 on PPC and BlueGene lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-qpic' lt_prog_compiler_static_CXX='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) lt_prog_compiler_pic_CXX='-W c,exportall' ;; *) ;; esac ;; netbsd*) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic_CXX='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) lt_prog_compiler_wl_CXX='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 lt_prog_compiler_pic_CXX='-pic' ;; cxx*) # Digital/Compaq C++ lt_prog_compiler_wl_CXX='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x lt_prog_compiler_pic_CXX='-pic' lt_prog_compiler_static_CXX='-Bstatic' ;; lcc*) # Lucid lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 lt_prog_compiler_pic_CXX='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) lt_prog_compiler_can_build_shared_CXX=no ;; esac fi case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_CXX= ;; *) lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5 $as_echo "$lt_cv_prog_compiler_pic_CXX" >&6; } lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; } if ${lt_cv_prog_compiler_pic_works_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works_CXX=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works_CXX=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 $as_echo "$lt_cv_prog_compiler_pic_works_CXX" >&6; } if test yes = "$lt_cv_prog_compiler_pic_works_CXX"; then case $lt_prog_compiler_pic_CXX in "" | " "*) ;; *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; esac else lt_prog_compiler_pic_CXX= lt_prog_compiler_can_build_shared_CXX=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works_CXX=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works_CXX=yes fi else lt_cv_prog_compiler_static_works_CXX=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5 $as_echo "$lt_cv_prog_compiler_static_works_CXX" >&6; } if test yes = "$lt_cv_prog_compiler_static_works_CXX"; then : else lt_prog_compiler_static_CXX= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o_CXX=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 $as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o_CXX=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 $as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } hard_links=nottested if test no = "$lt_cv_prog_compiler_c_o_CXX" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test no = "$hard_links"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' case $host_os in aix[4-9]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_CXX='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi ;; pw32*) export_symbols_cmds_CXX=$ltdll_cmds ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' ;; esac ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 $as_echo "$ld_shlibs_CXX" >&6; } test no = "$ld_shlibs_CXX" && can_build_shared=no with_gnu_ld_CXX=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_CXX" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_CXX=yes if test yes,yes = "$GCC,$enable_shared"; then case $archive_cmds_CXX in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc_CXX+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_CXX pic_flag=$lt_prog_compiler_pic_CXX compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_CXX allow_undefined_flag_CXX= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc_CXX=no else lt_cv_archive_cmds_need_lc_CXX=yes fi allow_undefined_flag_CXX=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5 $as_echo "$lt_cv_archive_cmds_need_lc_CXX" >&6; } archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=.so postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='$libname$release$shared_ext$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line '#! .'. This would cause the generated library to # depend on '.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a(lib.so.V)' # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. hardcode_libdir_flag_spec_CXX='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec; then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' soname_spec='$libname$shared_ext.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=sco need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test yes = "$with_gnu_ld"; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action_CXX= if test -n "$hardcode_libdir_flag_spec_CXX" || test -n "$runpath_var_CXX" || test yes = "$hardcode_automatic_CXX"; then # We can hardcode non-existent directories. if test no != "$hardcode_direct_CXX" && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" && test no != "$hardcode_minus_L_CXX"; then # Linking always hardcodes the temporary library directory. hardcode_action_CXX=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_CXX=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_CXX=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5 $as_echo "$hardcode_action_CXX" >&6; } if test relink = "$hardcode_action_CXX" || test yes = "$inherit_rpath_CXX"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test yes != "$_lt_caught_CXX_error" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_commands="$ac_config_commands libtool" # Only expand once: if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_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_PKG_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 fi done done IFS=$as_save_IFS ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_PKG_CONFIG"; then ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_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_ac_pt_PKG_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 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 $as_echo "$ac_pt_PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then PKG_CONFIG="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac PKG_CONFIG=$ac_pt_PKG_CONFIG fi else PKG_CONFIG="$ac_cv_path_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 $as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } PKG_CONFIG="" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking C_WFLAGS for maximum warnings" >&5 $as_echo_n "checking C_WFLAGS for maximum warnings... " >&6; } if ${ac_cv_cflags_warn_all+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_cflags_warn_all="no, unknown" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_save_CFLAGS="$CFLAGS" for ac_arg in "-pedantic -Wdeclaration-after-statement % -Wall -Wdeclaration-after-statement" "-pedantic % -Wall" "-xstrconst % -v" "-std1 % -verbose -w0 -warnprotos" "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" "-ansi -ansiE % -fullwarn" "+ESlit % +w1" "-Xc % -pvctl,fullmsg" "-h conform % -h msglevel 2" # do CFLAGS="$ac_save_CFLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_cflags_warn_all=`echo $ac_arg | sed -e 's,.*% *,,'` ; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done CFLAGS="$ac_save_CFLAGS" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags_warn_all" >&5 $as_echo "$ac_cv_cflags_warn_all" >&6; } case ".$ac_cv_cflags_warn_all" in .ok|.ok,*) ;; .|.no|.no,*) ;; *) if echo " $C_WFLAGS " | grep " $ac_cv_cflags_warn_all " 2>&1 >/dev/null then { { $as_echo "$as_me:${as_lineno-$LINENO}: : C_WFLAGS does contain \$ac_cv_cflags_warn_all"; } >&5 (: C_WFLAGS does contain $ac_cv_cflags_warn_all) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } else { { $as_echo "$as_me:${as_lineno-$LINENO}: : C_WFLAGS=\"\$C_WFLAGS \$ac_cv_cflags_warn_all\""; } >&5 (: C_WFLAGS="$C_WFLAGS $ac_cv_cflags_warn_all") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } C_WFLAGS="$C_WFLAGS $ac_cv_cflags_warn_all" fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking CXX_WFLAGS for maximum warnings" >&5 $as_echo_n "checking CXX_WFLAGS for maximum warnings... " >&6; } if ${ac_cv_cxxflags_warn_all+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_cxxflags_warn_all="no, unknown" ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ac_save_CXXFLAGS="$CXXFLAGS" for ac_arg in "-pedantic % -Wall" "-xstrconst % -v" "-std1 % -verbose -w0 -warnprotos" "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" "-ansi -ansiE % -fullwarn" "+ESlit % +w1" "-Xc % -pvctl,fullmsg" "-h conform % -h msglevel 2" # do CXXFLAGS="$ac_save_CXXFLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return 0; ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_cxxflags_warn_all=`echo $ac_arg | sed -e 's,.*% *,,'` ; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done CXXFLAGS="$ac_save_CXXFLAGS" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxxflags_warn_all" >&5 $as_echo "$ac_cv_cxxflags_warn_all" >&6; } case ".$ac_cv_cxxflags_warn_all" in .ok|.ok,*) ;; .|.no|.no,*) ;; *) if echo " $CXX_WFLAGS " | grep " $ac_cv_cxxflags_warn_all " 2>&1 >/dev/null then { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXX_WFLAGS does contain \$ac_cv_cxxflags_warn_all"; } >&5 (: CXX_WFLAGS does contain $ac_cv_cxxflags_warn_all) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } else { { $as_echo "$as_me:${as_lineno-$LINENO}: : CXX_WFLAGS=\"\$CXX_WFLAGS \$ac_cv_cxxflags_warn_all\""; } >&5 (: CXX_WFLAGS="$CXX_WFLAGS $ac_cv_cxxflags_warn_all") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CXX_WFLAGS="$CXX_WFLAGS $ac_cv_cxxflags_warn_all" fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Werror -we10006" >&5 $as_echo_n "checking whether C compiler accepts -Werror -we10006... " >&6; } if ${ax_cv_check_cflags___Werror__we10006+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror -we10006" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ax_cv_check_cflags___Werror__we10006=yes else ax_cv_check_cflags___Werror__we10006=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Werror__we10006" >&5 $as_echo "$ax_cv_check_cflags___Werror__we10006" >&6; } if test "x$ax_cv_check_cflags___Werror__we10006" = xyes; then : ERROR_ON_UNKNOWN_OPTIONS="-Werror -we10006" else ERROR_ON_UNKNOWN_OPTIONS="-Werror" fi as_CACHEVAR=`$as_echo "ax_cv_check_cflags_$ERROR_ON_UNKNOWN_OPTIONS_-diag-disable 188,1684,2259,2304,3280,11074,11076" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -diag-disable 188,1684,2259,2304,3280,11074,11076" >&5 $as_echo_n "checking whether C compiler accepts -diag-disable 188,1684,2259,2304,3280,11074,11076... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS $ERROR_ON_UNKNOWN_OPTIONS -diag-disable 188,1684,2259,2304,3280,11074,11076" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : C_WFLAGS="$C_WFLAGS -diag-disable 188,1684,2259,2304,3280,11074,11076" CXX_WFLAGS="$CXX_WFLAGS -diag-disable 188,1684,2259,2304,3280,11074,11076" else : fi as_CACHEVAR=`$as_echo "ax_cv_check_cflags_$ERROR_ON_UNKNOWN_OPTIONS_-Wextra" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wextra" >&5 $as_echo_n "checking whether C compiler accepts -Wextra... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS $ERROR_ON_UNKNOWN_OPTIONS -Wextra" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : C_WFLAGS="$C_WFLAGS -Wextra" CXX_WFLAGS="$CXX_WFLAGS -Wextra" else : fi as_CACHEVAR=`$as_echo "ax_cv_check_cflags_$ERROR_ON_UNKNOWN_OPTIONS_-Winit-self" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Winit-self" >&5 $as_echo_n "checking whether C compiler accepts -Winit-self... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS $ERROR_ON_UNKNOWN_OPTIONS -Winit-self" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : C_WFLAGS="$C_WFLAGS -Winit-self" CXX_WFLAGS="$CXX_WFLAGS -Winit-self" else : fi as_CACHEVAR=`$as_echo "ax_cv_check_cflags_$ERROR_ON_UNKNOWN_OPTIONS_-Wunused-parameter" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wunused-parameter" >&5 $as_echo_n "checking whether C compiler accepts -Wunused-parameter... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS $ERROR_ON_UNKNOWN_OPTIONS -Wunused-parameter" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : C_WFLAGS="$C_WFLAGS -Wunused-parameter" CXX_WFLAGS="$CXX_WFLAGS -Wunused-parameter" NO_UNUSED_PARAMETER_FLAG="-Wno-unused-parameter" else : fi as_CACHEVAR=`$as_echo "ax_cv_check_cflags_$ERROR_ON_UNKNOWN_OPTIONS_-Wmissing-prototypes" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wmissing-prototypes" >&5 $as_echo_n "checking whether C compiler accepts -Wmissing-prototypes... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS $ERROR_ON_UNKNOWN_OPTIONS -Wmissing-prototypes" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : C_WFLAGS="$C_WFLAGS -Wmissing-prototypes" else : fi as_CACHEVAR=`$as_echo "ax_cv_check_cflags_$ERROR_ON_UNKNOWN_OPTIONS_-Wmissing-declarations" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wmissing-declarations" >&5 $as_echo_n "checking whether C compiler accepts -Wmissing-declarations... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS $ERROR_ON_UNKNOWN_OPTIONS -Wmissing-declarations" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : C_WFLAGS="$C_WFLAGS -Wmissing-declarations" else : fi as_CACHEVAR=`$as_echo "ax_cv_check_cflags_$ERROR_ON_UNKNOWN_OPTIONS_-Wformat" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wformat" >&5 $as_echo_n "checking whether C compiler accepts -Wformat... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS $ERROR_ON_UNKNOWN_OPTIONS -Wformat" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : C_WFLAGS="$C_WFLAGS -Wformat" CXX_WFLAGS="$CXX_WFLAGS -Wformat" else : fi as_CACHEVAR=`$as_echo "ax_cv_check_cflags_$ERROR_ON_UNKNOWN_OPTIONS_-Wformat -Werror=format-security -Wno-format-nonliteral" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wformat -Werror=format-security -Wno-format-nonliteral" >&5 $as_echo_n "checking whether C compiler accepts -Wformat -Werror=format-security -Wno-format-nonliteral... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS $ERROR_ON_UNKNOWN_OPTIONS -Wformat -Werror=format-security -Wno-format-nonliteral" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : C_WFLAGS="$C_WFLAGS -Werror=format-security -Wno-format-nonliteral" CXX_WFLAGS="$CXX_WFLAGS -Werror=format-security -Wno-format-nonliteral" else : fi as_CACHEVAR=`$as_echo "ax_cv_check_cflags_$ERROR_ON_UNKNOWN_OPTIONS_-Wshorten-64-to-32" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wshorten-64-to-32" >&5 $as_echo_n "checking whether C compiler accepts -Wshorten-64-to-32... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS $ERROR_ON_UNKNOWN_OPTIONS -Wshorten-64-to-32" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : C_WFLAGS="$C_WFLAGS -Wshorten-64-to-32" CXX_WFLAGS="$CXX_WFLAGS -Wshorten-64-to-32" else : fi as_CACHEVAR=`$as_echo "ax_cv_check_cflags_$ERROR_ON_UNKNOWN_OPTIONS_-Wlogical-op" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wlogical-op" >&5 $as_echo_n "checking whether C compiler accepts -Wlogical-op... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS $ERROR_ON_UNKNOWN_OPTIONS -Wlogical-op" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : C_WFLAGS="$C_WFLAGS -Wlogical-op" CXX_WFLAGS="$CXX_WFLAGS -Wlogical-op" NO_LOGICAL_OP_FLAG="-Wno-logical-op" else : fi as_CACHEVAR=`$as_echo "ax_cv_check_cflags_$ERROR_ON_UNKNOWN_OPTIONS_-Wshadow" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wshadow" >&5 $as_echo_n "checking whether C compiler accepts -Wshadow... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS $ERROR_ON_UNKNOWN_OPTIONS -Wshadow" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : C_WFLAGS="$C_WFLAGS -Wshadow" CXX_WFLAGS="$CXX_WFLAGS -Wshadow" else : fi as_CACHEVAR=`$as_echo "ax_cv_check_cflags_$ERROR_ON_UNKNOWN_OPTIONS_-Werror=vla" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Werror=vla" >&5 $as_echo_n "checking whether C compiler accepts -Werror=vla... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS $ERROR_ON_UNKNOWN_OPTIONS -Werror=vla" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : C_WFLAGS="$C_WFLAGS -Werror=vla" CXX_WFLAGS="$CXX_WFLAGS -Werror=vla" else : fi as_CACHEVAR=`$as_echo "ax_cv_check_cflags_$ERROR_ON_UNKNOWN_OPTIONS_-Werror=declaration-after-statement" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Werror=declaration-after-statement" >&5 $as_echo_n "checking whether C compiler accepts -Werror=declaration-after-statement... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS $ERROR_ON_UNKNOWN_OPTIONS -Werror=declaration-after-statement" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : C_WFLAGS="$C_WFLAGS -Wdeclaration-after-statement" else : fi as_CACHEVAR=`$as_echo "ax_cv_check_cflags_$ERROR_ON_UNKNOWN_OPTIONS_-Wdate-time" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wdate-time" >&5 $as_echo_n "checking whether C compiler accepts -Wdate-time... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS $ERROR_ON_UNKNOWN_OPTIONS -Wdate-time" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : C_WFLAGS="$C_WFLAGS -Wdate-time" CXX_WFLAGS="$CXX_WFLAGS -Wdate-time" else : fi as_CACHEVAR=`$as_echo "ax_cv_check_cflags_$ERROR_ON_UNKNOWN_OPTIONS_-Wnull-dereference" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wnull-dereference" >&5 $as_echo_n "checking whether C compiler accepts -Wnull-dereference... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS $ERROR_ON_UNKNOWN_OPTIONS -Wnull-dereference" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : C_WFLAGS="$C_WFLAGS -Wnull-dereference" CXX_WFLAGS="$CXX_WFLAGS -Wnull-dereference" else : fi as_CACHEVAR=`$as_echo "ax_cv_check_cflags_$ERROR_ON_UNKNOWN_OPTIONS_-Wduplicated-cond" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wduplicated-cond" >&5 $as_echo_n "checking whether C compiler accepts -Wduplicated-cond... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS $ERROR_ON_UNKNOWN_OPTIONS -Wduplicated-cond" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : C_WFLAGS="$C_WFLAGS -Wduplicated-cond" CXX_WFLAGS="$CXX_WFLAGS -Wduplicated-cond" else : fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_$ERROR_ON_UNKNOWN_OPTIONS_-Wextra-semi" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -Wextra-semi" >&5 $as_echo_n "checking whether C++ compiler accepts -Wextra-semi... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS $ERROR_ON_UNKNOWN_OPTIONS -Wextra-semi" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : CXX_WFLAGS="$CXX_WFLAGS -Wextra-semi" else : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu as_CACHEVAR=`$as_echo "ax_cv_check_cflags_$ERROR_ON_UNKNOWN_OPTIONS_-Wno-sign-compare" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wno-sign-compare" >&5 $as_echo_n "checking whether C compiler accepts -Wno-sign-compare... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS $ERROR_ON_UNKNOWN_OPTIONS -Wno-sign-compare" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : NO_SIGN_COMPARE="-Wno-sign-compare" else : fi as_CACHEVAR=`$as_echo "ax_cv_check_cflags_$ERROR_ON_UNKNOWN_OPTIONS_-Wcomma" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wcomma" >&5 $as_echo_n "checking whether C compiler accepts -Wcomma... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS $ERROR_ON_UNKNOWN_OPTIONS -Wcomma" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : C_WFLAGS="$C_WFLAGS -Wcomma" CXX_WFLAGS="$CXX_WFLAGS -Wcomma" else : fi as_CACHEVAR=`$as_echo "ax_cv_check_cflags_$ERROR_ON_UNKNOWN_OPTIONS_-Wfloat-conversion" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wfloat-conversion" >&5 $as_echo_n "checking whether C compiler accepts -Wfloat-conversion... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS $ERROR_ON_UNKNOWN_OPTIONS -Wfloat-conversion" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : C_WFLAGS="$C_WFLAGS -Wfloat-conversion" CXX_WFLAGS="$CXX_WFLAGS -Wfloat-conversion" else : fi as_CACHEVAR=`$as_echo "ax_cv_check_cflags_$ERROR_ON_UNKNOWN_OPTIONS_-Wdocumentation -Wno-documentation-deprecated-sync" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wdocumentation -Wno-documentation-deprecated-sync" >&5 $as_echo_n "checking whether C compiler accepts -Wdocumentation -Wno-documentation-deprecated-sync... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS $ERROR_ON_UNKNOWN_OPTIONS -Wdocumentation -Wno-documentation-deprecated-sync" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : C_WFLAGS="$C_WFLAGS -Wdocumentation -Wno-documentation-deprecated-sync" CXX_WFLAGS="$CXX_WFLAGS -Wdocumentation -Wno-documentation-deprecated-sync" else : fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_$ERROR_ON_UNKNOWN_OPTIONS_-Wunused-private-field" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -Wunused-private-field" >&5 $as_echo_n "checking whether C++ compiler accepts -Wunused-private-field... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS $ERROR_ON_UNKNOWN_OPTIONS -Wunused-private-field" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : CXX_WFLAGS="$CXX_WFLAGS -Wunused-private-field" else : fi as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_$ERROR_ON_UNKNOWN_OPTIONS_-Wmissing-declarations" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -Wmissing-declarations" >&5 $as_echo_n "checking whether C++ compiler accepts -Wmissing-declarations... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS $ERROR_ON_UNKNOWN_OPTIONS -Wmissing-declarations" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : CXX_WFLAGS="$CXX_WFLAGS -Wmissing-declarations" else : fi as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_$ERROR_ON_UNKNOWN_OPTIONS_-Wnon-virtual-dtor" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -Wnon-virtual-dtor" >&5 $as_echo_n "checking whether C++ compiler accepts -Wnon-virtual-dtor... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS $ERROR_ON_UNKNOWN_OPTIONS -Wnon-virtual-dtor" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : CXX_WFLAGS="$CXX_WFLAGS -Wnon-virtual-dtor" NO_NON_VIRTUAL_DTOR_FLAG="-Wno-non-virtual-dtor" else : fi as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_$ERROR_ON_UNKNOWN_OPTIONS_-Wold-style-cast" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -Wold-style-cast" >&5 $as_echo_n "checking whether C++ compiler accepts -Wold-style-cast... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS $ERROR_ON_UNKNOWN_OPTIONS -Wold-style-cast" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : WARN_OLD_STYLE_CAST="-Wold-style-cast" else : fi as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_$ERROR_ON_UNKNOWN_OPTIONS_-Weffc++" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -Weffc++" >&5 $as_echo_n "checking whether C++ compiler accepts -Weffc++... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS $ERROR_ON_UNKNOWN_OPTIONS -Weffc++" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : WARN_EFFCPLUSPLUS="-Weffc++" else : fi if test "$WARN_EFFCPLUSPLUS" != ""; then SAVED_CXXFLAGS=$CXXFLAGS CXXFLAGS="$CXXFLAGS $WARN_EFFCPLUSPLUS -Werror" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -Weffc++ should be enabled" >&5 $as_echo_n "checking if -Weffc++ should be enabled... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ class Base {}; class A: public Base {}; int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else WARN_EFFCPLUSPLUS="" { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS="$SAVED_CXXFLAGS" CXX_WFLAGS="$CXX_WFLAGS $WARN_EFFCPLUSPLUS" fi as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_$ERROR_ON_UNKNOWN_OPTIONS_-Woverloaded-virtual" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -Woverloaded-virtual" >&5 $as_echo_n "checking whether C++ compiler accepts -Woverloaded-virtual... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS $ERROR_ON_UNKNOWN_OPTIONS -Woverloaded-virtual" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : CXX_WFLAGS="$CXX_WFLAGS -Woverloaded-virtual" else : fi as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_$ERROR_ON_UNKNOWN_OPTIONS_-Wweak-vtables" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -Wweak-vtables" >&5 $as_echo_n "checking whether C++ compiler accepts -Wweak-vtables... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS $ERROR_ON_UNKNOWN_OPTIONS -Wweak-vtables" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : CXX_WFLAGS="$CXX_WFLAGS -Wweak-vtables" else : fi as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_$ERROR_ON_UNKNOWN_OPTIONS_-Wdeprecated" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -Wdeprecated" >&5 $as_echo_n "checking whether C++ compiler accepts -Wdeprecated... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS $ERROR_ON_UNKNOWN_OPTIONS -Wdeprecated" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : CXX_WFLAGS="$CXX_WFLAGS -Wdeprecated" else : fi as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_$ERROR_ON_UNKNOWN_OPTIONS_-Wabstract-vbase-init" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -Wabstract-vbase-init" >&5 $as_echo_n "checking whether C++ compiler accepts -Wabstract-vbase-init... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS $ERROR_ON_UNKNOWN_OPTIONS -Wabstract-vbase-init" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : CXX_WFLAGS="$CXX_WFLAGS -Wabstract-vbase-init" else : fi as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_$ERROR_ON_UNKNOWN_OPTIONS_-Winconsistent-missing-destructor-override" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -Winconsistent-missing-destructor-override" >&5 $as_echo_n "checking whether C++ compiler accepts -Winconsistent-missing-destructor-override... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS $ERROR_ON_UNKNOWN_OPTIONS -Winconsistent-missing-destructor-override" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : CXX_WFLAGS="$CXX_WFLAGS -Winconsistent-missing-destructor-override" else : fi HAVE_GCC_WARNING_ZERO_AS_NULL_POINTER_CONSTANT=no as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_$ERROR_ON_UNKNOWN_OPTIONS_-Wzero-as-null-pointer-constant" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -Wzero-as-null-pointer-constant" >&5 $as_echo_n "checking whether C++ compiler accepts -Wzero-as-null-pointer-constant... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS $ERROR_ON_UNKNOWN_OPTIONS -Wzero-as-null-pointer-constant" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : CXX_WFLAGS="$CXX_WFLAGS -Wzero-as-null-pointer-constant" HAVE_GCC_WARNING_ZERO_AS_NULL_POINTER_CONSTANT=yes NO_ZERO_AS_NULL_POINTER_CONSTANT_FLAG="-Wno-zero-as-null-pointer-constant" else : fi if test "$HAVE_GCC_WARNING_ZERO_AS_NULL_POINTER_CONSTANT" = "yes"; then cat >>confdefs.h <<_ACEOF #define HAVE_GCC_WARNING_ZERO_AS_NULL_POINTER_CONSTANT 1 _ACEOF fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking to enable LTO (link time optimization) build" >&5 $as_echo_n "checking to enable LTO (link time optimization) build... " >&6; } # Check whether --enable-lto was given. if test "${enable_lto+set}" = set; then : enableval=$enable_lto; fi FLTO_FLAG="" if test "x$enable_lto" = "xyes"; then ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_$ERROR_ON_UNKNOWN_OPTIONS_-flto" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -flto" >&5 $as_echo_n "checking whether C++ compiler accepts -flto... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS $ERROR_ON_UNKNOWN_OPTIONS -flto" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : FLTO_FLAG="-flto" else : fi if test "$FLTO_FLAG" != ""; then SAVED_CXXFLAGS=$CXXFLAGS CXXFLAGS="$CXXFLAGS $FLTO_FLAG -Werror" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -flto is available at link time" >&5 $as_echo_n "checking if -flto is available at link time... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else FLTO_FLAG="" { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CXXFLAGS="$SAVED_CXXFLAGS" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu as_CACHEVAR=`$as_echo "ax_cv_check_cflags_$ERROR_ON_UNKNOWN_OPTIONS_-Wodr" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wodr" >&5 $as_echo_n "checking whether C compiler accepts -Wodr... " >&6; } if eval \${$as_CACHEVAR+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS $ERROR_ON_UNKNOWN_OPTIONS -Wodr" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_CACHEVAR=yes" else eval "$as_CACHEVAR=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi eval ac_res=\$$as_CACHEVAR { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : CXX_WFLAGS="$CXX_WFLAGS -Wodr" else : fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi FLTO_FLAG=$FLTO_FLAG C_WFLAGS=$C_WFLAGS CXX_WFLAGS=$CXX_WFLAGS NO_ZERO_AS_NULL_POINTER_CONSTANT_FLAG=$NO_ZERO_AS_NULL_POINTER_CONSTANT_FLAG CFLAGS="${CFLAGS} -fvisibility=hidden" CXXFLAGS="${CXXFLAGS} -fvisibility=hidden" case "${host_os}" in cygwin* | mingw32* | pw32* | beos* | darwin*) CFLAGS="${CFLAGS} -DNOMINMAX" CXXFLAGS="${CXXFLAGS} -DNOMINMAX" ;; *) ;; esac save_CFLAGS="$CFLAGS" CFLAGS=`echo "$CFLAGS" | sed "s/-Werror/ /"` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for exp in -lm" >&5 $as_echo_n "checking for exp in -lm... " >&6; } if ${ac_cv_lib_m_exp+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char exp (); int main () { return exp (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_m_exp=yes else ac_cv_lib_m_exp=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_exp" >&5 $as_echo "$ac_cv_lib_m_exp" >&6; } if test "x$ac_cv_lib_m_exp" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBM 1 _ACEOF LIBS="-lm $LIBS" else HAVE_LIBM=no fi CFLAGS="$save_CFLAGS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fp-model precise" >&5 $as_echo_n "checking whether C compiler accepts -fp-model precise... " >&6; } if ${ax_cv_check_cflags__Werror__fp_model_precise+:} false; then : $as_echo_n "(cached) " >&6 else ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror -fp-model precise" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ax_cv_check_cflags__Werror__fp_model_precise=yes else ax_cv_check_cflags__Werror__fp_model_precise=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$ax_check_save_flags fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror__fp_model_precise" >&5 $as_echo "$ax_cv_check_cflags__Werror__fp_model_precise" >&6; } if test "x$ax_cv_check_cflags__Werror__fp_model_precise" = xyes; then : CFLAGS="$CFLAGS -fp-model precise" else : fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sqrt" >&5 $as_echo_n "checking for library containing sqrt... " >&6; } if ${ac_cv_search_sqrt+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char sqrt (); int main () { return sqrt (); ; return 0; } _ACEOF for ac_lib in '' m; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_sqrt=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_sqrt+:} false; then : break fi done if ${ac_cv_search_sqrt+:} false; then : else ac_cv_search_sqrt=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_sqrt" >&5 $as_echo "$ac_cv_search_sqrt" >&6; } ac_res=$ac_cv_search_sqrt if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi ac_fn_c_check_func "$LINENO" "localeconv" "ac_cv_func_localeconv" if test "x$ac_cv_func_localeconv" = xyes; then : $as_echo "#define HAVE_LOCALECONV 1" >>confdefs.h fi for ac_func in strerror do : ac_fn_c_check_func "$LINENO" "strerror" "ac_cv_func_strerror" if test "x$ac_cv_func_strerror" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRERROR 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dladdr in -ldl" >&5 $as_echo_n "checking for dladdr in -ldl... " >&6; } if ${ac_cv_lib_dl_dladdr+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dladdr (); int main () { return dladdr (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dladdr=yes else ac_cv_lib_dl_dladdr=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dladdr" >&5 $as_echo "$ac_cv_lib_dl_dladdr" >&6; } if test "x$ac_cv_lib_dl_dladdr" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBDL 1 _ACEOF LIBS="-ldl $LIBS" else HAVE_LIBDL=no fi # Check whether --with-mutex was given. if test "${with_mutex+set}" = set; then : withval=$with_mutex; fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mutexes" >&5 $as_echo_n "checking for mutexes... " >&6; } THREAD_LIB="" if test "$with_mutex" = yes -o x"$with_mutex" = x ; then MUTEX_SETTING=pthread { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 $as_echo_n "checking for pthread_create in -lpthread... " >&6; } if ${ac_cv_lib_pthread_pthread_create+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_create (); int main () { return pthread_create (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_pthread_pthread_create=yes else ac_cv_lib_pthread_pthread_create=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 $as_echo "$ac_cv_lib_pthread_pthread_create" >&6; } if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then : PTHREAD_EXISTS=YES fi if test -n "$PTHREAD_EXISTS" ; then THREAD_LIB="-lpthread" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_mutexattr_settype in -lpthread" >&5 $as_echo_n "checking for pthread_mutexattr_settype in -lpthread... " >&6; } if ${ac_cv_lib_pthread_pthread_mutexattr_settype+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_mutexattr_settype (); int main () { return pthread_mutexattr_settype (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_pthread_pthread_mutexattr_settype=yes else ac_cv_lib_pthread_pthread_mutexattr_settype=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_mutexattr_settype" >&5 $as_echo "$ac_cv_lib_pthread_pthread_mutexattr_settype" >&6; } if test "x$ac_cv_lib_pthread_pthread_mutexattr_settype" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBPTHREAD 1 _ACEOF LIBS="-lpthread $LIBS" fi ac_fn_c_check_decl "$LINENO" "PTHREAD_MUTEX_RECURSIVE" "ac_cv_have_decl_PTHREAD_MUTEX_RECURSIVE" "#include " if test "x$ac_cv_have_decl_PTHREAD_MUTEX_RECURSIVE" = xyes; then : $as_echo "#define HAVE_PTHREAD_MUTEX_RECURSIVE /**/" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabled, pthread" >&5 $as_echo "enabled, pthread" >&6; } else MUTEX_SETTING=stub { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled by user" >&5 $as_echo "disabled by user" >&6; } fi MUTEX_SETTING=$MUTEX_SETTING THREAD_LIB=$THREAD_LIB if test "x$SQLITE3_CFLAGS$SQLITE3_LIBS" = "x" ; then pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SQLITE3" >&5 $as_echo_n "checking for SQLITE3... " >&6; } if test -n "$PKG_CONFIG"; then if test -n "$SQLITE3_CFLAGS"; then pkg_cv_SQLITE3_CFLAGS="$SQLITE3_CFLAGS" else if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sqlite3 >= 3.11\""; } >&5 ($PKG_CONFIG --exists --print-errors "sqlite3 >= 3.11") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_SQLITE3_CFLAGS=`$PKG_CONFIG --cflags "sqlite3 >= 3.11" 2>/dev/null` else pkg_failed=yes fi fi else pkg_failed=untried fi if test -n "$PKG_CONFIG"; then if test -n "$SQLITE3_LIBS"; then pkg_cv_SQLITE3_LIBS="$SQLITE3_LIBS" else if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sqlite3 >= 3.11\""; } >&5 ($PKG_CONFIG --exists --print-errors "sqlite3 >= 3.11") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_SQLITE3_LIBS=`$PKG_CONFIG --libs "sqlite3 >= 3.11" 2>/dev/null` else pkg_failed=yes fi fi else pkg_failed=untried fi if test $pkg_failed = yes; then if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then SQLITE3_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "sqlite3 >= 3.11"` else SQLITE3_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "sqlite3 >= 3.11"` fi # Put the nasty error message in config.log where it belongs echo "$SQLITE3_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (sqlite3 >= 3.11) were not met: $SQLITE3_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables SQLITE3_CFLAGS and SQLITE3_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. " "$LINENO" 5 elif test $pkg_failed = untried; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables SQLITE3_CFLAGS and SQLITE3_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } else SQLITE3_CFLAGS=$pkg_cv_SQLITE3_CFLAGS SQLITE3_LIBS=$pkg_cv_SQLITE3_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } : fi fi SQLITE3_CFLAGS=$SQLITE3_CFLAGS SQLITE3_LIBS=$SQLITE3_LIBS # Extract the first word of "sqlite3", so it can be a program name with args. set dummy sqlite3; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_SQLITE3_CHECK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$SQLITE3_CHECK"; then ac_cv_prog_SQLITE3_CHECK="$SQLITE3_CHECK" # Let the user override the test. else 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_prog_SQLITE3_CHECK="yes" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi SQLITE3_CHECK=$ac_cv_prog_SQLITE3_CHECK if test -n "$SQLITE3_CHECK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SQLITE3_CHECK" >&5 $as_echo "$SQLITE3_CHECK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test x"$SQLITE3_CHECK" != x"yes" ; then as_fn_error $? "Please install sqlite3 binary." "$LINENO" 5 fi # Check whether --enable-tiff was given. if test "${enable_tiff+set}" = set; then : enableval=$enable_tiff; fi if test "x$enable_tiff" != "xno" -o "x$enable_tiff" = ""; then if test "x$TIFF_CFLAGS$TIFF_LIBS" = "x" ; then if $PKG_CONFIG libtiff; then pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for TIFF" >&5 $as_echo_n "checking for TIFF... " >&6; } if test -n "$PKG_CONFIG"; then if test -n "$TIFF_CFLAGS"; then pkg_cv_TIFF_CFLAGS="$TIFF_CFLAGS" else if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libtiff\""; } >&5 ($PKG_CONFIG --exists --print-errors "libtiff") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_TIFF_CFLAGS=`$PKG_CONFIG --cflags "libtiff" 2>/dev/null` else pkg_failed=yes fi fi else pkg_failed=untried fi if test -n "$PKG_CONFIG"; then if test -n "$TIFF_LIBS"; then pkg_cv_TIFF_LIBS="$TIFF_LIBS" else if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libtiff\""; } >&5 ($PKG_CONFIG --exists --print-errors "libtiff") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_TIFF_LIBS=`$PKG_CONFIG --libs "libtiff" 2>/dev/null` else pkg_failed=yes fi fi else pkg_failed=untried fi if test $pkg_failed = yes; then if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then TIFF_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "libtiff"` else TIFF_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libtiff"` fi # Put the nasty error message in config.log where it belongs echo "$TIFF_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (libtiff) were not met: $TIFF_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables TIFF_CFLAGS and TIFF_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. " "$LINENO" 5 elif test $pkg_failed = untried; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables TIFF_CFLAGS and TIFF_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } else TIFF_CFLAGS=$pkg_cv_TIFF_CFLAGS TIFF_LIBS=$pkg_cv_TIFF_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } : fi else pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for TIFF" >&5 $as_echo_n "checking for TIFF... " >&6; } if test -n "$PKG_CONFIG"; then if test -n "$TIFF_CFLAGS"; then pkg_cv_TIFF_CFLAGS="$TIFF_CFLAGS" else if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libtiff-4\""; } >&5 ($PKG_CONFIG --exists --print-errors "libtiff-4") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_TIFF_CFLAGS=`$PKG_CONFIG --cflags "libtiff-4" 2>/dev/null` else pkg_failed=yes fi fi else pkg_failed=untried fi if test -n "$PKG_CONFIG"; then if test -n "$TIFF_LIBS"; then pkg_cv_TIFF_LIBS="$TIFF_LIBS" else if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libtiff-4\""; } >&5 ($PKG_CONFIG --exists --print-errors "libtiff-4") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_TIFF_LIBS=`$PKG_CONFIG --libs "libtiff-4" 2>/dev/null` else pkg_failed=yes fi fi else pkg_failed=untried fi if test $pkg_failed = yes; then if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then TIFF_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "libtiff-4"` else TIFF_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libtiff-4"` fi # Put the nasty error message in config.log where it belongs echo "$TIFF_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (libtiff-4) were not met: $TIFF_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables TIFF_CFLAGS and TIFF_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. " "$LINENO" 5 elif test $pkg_failed = untried; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables TIFF_CFLAGS and TIFF_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } else TIFF_CFLAGS=$pkg_cv_TIFF_CFLAGS TIFF_LIBS=$pkg_cv_TIFF_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } : fi fi fi TIFF_ENABLED_FLAGS=-DTIFF_ENABLED fi TIFF_CFLAGS=$TIFF_CFLAGS TIFF_LIBS=$TIFF_LIBS TIFF_ENABLED_FLAGS=$TIFF_ENABLED_FLAGS FOUND_CURL=no CURL_CFLAGS= CURL_LIB= # Check whether --with-curl was given. if test "${with_curl+set}" = set; then : withval=$with_curl; fi unset ac_cv_path_LIBCURL if test "`basename xx/$with_curl`" = "curl-config" ; then LIBCURL_CONFIG="$with_curl" elif test "$with_curl" = "no" ; then LIBCURL_CONFIG=no else # Extract the first word of "curl-config", so it can be a program name with args. set dummy curl-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_LIBCURL_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $LIBCURL_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_LIBCURL_CONFIG="$LIBCURL_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_LIBCURL_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 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_LIBCURL_CONFIG" && ac_cv_path_LIBCURL_CONFIG="not-found" ;; esac fi LIBCURL_CONFIG=$ac_cv_path_LIBCURL_CONFIG if test -n "$LIBCURL_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBCURL_CONFIG" >&5 $as_echo "$LIBCURL_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test "$LIBCURL_CONFIG" = "not-found" ; then as_fn_error $? "curl not found. If wanting to do a build without curl support (and thus without built-in networking capability), explictly disable it with --without-curl" "$LINENO" 5 elif test "$LIBCURL_CONFIG" != "no" ; then CURL_VERNUM=`$LIBCURL_CONFIG --vernum` CURL_VER=`$LIBCURL_CONFIG --version | awk '{print $2}'` { $as_echo "$as_me:${as_lineno-$LINENO}: result: found libcurl version $CURL_VER" >&5 $as_echo " found libcurl version $CURL_VER" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for curl_global_init in -lcurl" >&5 $as_echo_n "checking for curl_global_init in -lcurl... " >&6; } if ${ac_cv_lib_curl_curl_global_init+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcurl `$LIBCURL_CONFIG --libs` $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char curl_global_init (); int main () { return curl_global_init (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_curl_curl_global_init=yes else ac_cv_lib_curl_curl_global_init=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_curl_curl_global_init" >&5 $as_echo "$ac_cv_lib_curl_curl_global_init" >&6; } if test "x$ac_cv_lib_curl_curl_global_init" = xyes; then : FOUND_CURL=yes else FOUND_CURL=no fi if test "$FOUND_CURL" = "no" ; then as_fn_error $? "curl not found. If wanting to do a build without curl support (and thus without built-in networking capability), explictly disable it with --without-curl" "$LINENO" 5 fi CURL_ENABLED_FLAGS=-DCURL_ENABLED fi if test "$FOUND_CURL" = "yes" ; then CURL_CFLAGS=`$LIBCURL_CONFIG --cflags` CURL_LIBS=`$LIBCURL_CONFIG --libs` fi CURL_CFLAGS=$CURL_CFLAGS CURL_LIBS=$CURL_LIBS CURL_ENABLED_FLAGS=$CURL_ENABLED_FLAGS if test "x$FOUND_CURL" = "xyes"; then HAVE_CURL_TRUE= HAVE_CURL_FALSE='#' else HAVE_CURL_TRUE='#' HAVE_CURL_FALSE= fi EXTRA_LIBS="-lstdc++ -lsqlite3" if test "no$THREAD_LIB" != "no"; then EXTRA_LIBS="$EXTRA_LIBS $THREAD_LIB" fi if test "x$enable_tiff" != "xno" -o "x$enable_tiff" = ""; then EXTRA_LIBS="$EXTRA_LIBS -ltiff" fi if test "$FOUND_CURL" = "yes" ; then EXTRA_LIBS="$EXTRA_LIBS -lcurl" fi if test "$HAVE_LIBM" != "no" ; then EXTRA_LIBS="$EXTRA_LIBS -lm" fi if test "$HAVE_LIBDL" != "no" ; then EXTRA_LIBS="$EXTRA_LIBS -ldl" fi EXTRA_LIBS=$EXTRA_LIBS # Check whether --enable-proj-lib-env-var-tried-last was given. if test "${enable_proj_lib_env_var_tried_last+set}" = set; then : enableval=$enable_proj_lib_env_var_tried_last; fi if test "x$enable_proj_lib_env_var_tried_last" = "xyes"; then PROJ_LIB_ENV_VAR_TRIED_LAST_FLAGS=-DPROJ_LIB_ENV_VAR_TRIED_LAST fi # Check whether --with-external-gtest was given. if test "${with_external_gtest+set}" = set; then : withval=$with_external_gtest; fi if test "x$with_external_gtest" = "xyes" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: using external GTest." >&5 $as_echo "using external GTest." >&6; } pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GTEST" >&5 $as_echo_n "checking for GTEST... " >&6; } if test -n "$PKG_CONFIG"; then if test -n "$GTEST_CFLAGS"; then pkg_cv_GTEST_CFLAGS="$GTEST_CFLAGS" else if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gtest >= 1.8.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "gtest >= 1.8.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_GTEST_CFLAGS=`$PKG_CONFIG --cflags "gtest >= 1.8.0" 2>/dev/null` else pkg_failed=yes fi fi else pkg_failed=untried fi if test -n "$PKG_CONFIG"; then if test -n "$GTEST_LIBS"; then pkg_cv_GTEST_LIBS="$GTEST_LIBS" else if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gtest >= 1.8.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "gtest >= 1.8.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_GTEST_LIBS=`$PKG_CONFIG --libs "gtest >= 1.8.0" 2>/dev/null` else pkg_failed=yes fi fi else pkg_failed=untried fi if test $pkg_failed = yes; then if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then GTEST_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "gtest >= 1.8.0"` else GTEST_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gtest >= 1.8.0"` fi # Put the nasty error message in config.log where it belongs echo "$GTEST_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (gtest >= 1.8.0) were not met: $GTEST_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables GTEST_CFLAGS and GTEST_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. " "$LINENO" 5 elif test $pkg_failed = untried; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables GTEST_CFLAGS and GTEST_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } else GTEST_CFLAGS=$pkg_cv_GTEST_CFLAGS GTEST_LIBS=$pkg_cv_GTEST_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } : fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: using internal GTest." >&5 $as_echo "using internal GTest." >&6; } GTEST_CFLAGS="-I\$(top_srcdir)/test/googletest/include" GTEST_LIBS="\$(top_builddir)/test/googletest/libgtest.la" fi if test "x$with_external_gtest" = "xyes"; then USE_EXTERNAL_GTEST_TRUE= USE_EXTERNAL_GTEST_FALSE='#' else USE_EXTERNAL_GTEST_TRUE='#' USE_EXTERNAL_GTEST_FALSE= fi GTEST_CFLAGS=$GTEST_CFLAGS GTEST_LIBS=$GTEST_LIBS ac_config_files="$ac_config_files Makefile cmake/Makefile src/Makefile include/Makefile include/proj/Makefile include/proj/internal/Makefile include/proj/internal/vendor/Makefile include/proj/internal/vendor/nlohmann/Makefile test/Makefile test/cli/Makefile test/gie/Makefile test/gigs/Makefile test/unit/Makefile man/Makefile man/man1/Makefile data/Makefile" if ! test "x$with_external_gtest" = "xyes" ; then ac_config_files="$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="$ac_config_files proj.pc" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 $as_echo_n "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_CURL_TRUE}" && test -z "${HAVE_CURL_FALSE}"; then as_fn_error $? "conditional \"HAVE_CURL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${USE_EXTERNAL_GTEST_TRUE}" && test -z "${USE_EXTERNAL_GTEST_FALSE}"; then as_fn_error $? "conditional \"USE_EXTERNAL_GTEST\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by PROJ $as_me 8.2.1, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to . PROJ home page: ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ PROJ config.status 8.2.1 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' shared_archive_member_spec='`$ECHO "$shared_archive_member_spec" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_import='`$ECHO "$lt_cv_sys_global_symbol_to_import" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' lt_cv_nm_interface='`$ECHO "$lt_cv_nm_interface" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' lt_cv_truncate_bin='`$ECHO "$lt_cv_truncate_bin" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' configure_time_dlsearch_path='`$ECHO "$configure_time_dlsearch_path" | $SED "$delay_single_quote_subst"`' configure_time_lt_sys_library_path='`$ECHO "$configure_time_lt_sys_library_path" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`' predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`' postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`' predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`' postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`' compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`' LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`' reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`' reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`' old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`' GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`' archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`' module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`' allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`' hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`' hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`' hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`' inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`' link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`' always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`' export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`' exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`' include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`' prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`' postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`' file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`' hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`' compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`' predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`' postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`' predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`' postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`' compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } # Quote evaled strings. for var in SHELL \ ECHO \ PATH_SEPARATOR \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ DLLTOOL \ sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_import \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ lt_cv_nm_interface \ nm_file_list_spec \ lt_cv_truncate_bin \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib \ compiler_lib_search_dirs \ predep_objects \ postdep_objects \ predeps \ postdeps \ compiler_lib_search_path \ LD_CXX \ reload_flag_CXX \ compiler_CXX \ lt_prog_compiler_no_builtin_flag_CXX \ lt_prog_compiler_pic_CXX \ lt_prog_compiler_wl_CXX \ lt_prog_compiler_static_CXX \ lt_cv_prog_compiler_c_o_CXX \ export_dynamic_flag_spec_CXX \ whole_archive_flag_spec_CXX \ compiler_needs_object_CXX \ with_gnu_ld_CXX \ allow_undefined_flag_CXX \ no_undefined_flag_CXX \ hardcode_libdir_flag_spec_CXX \ hardcode_libdir_separator_CXX \ exclude_expsyms_CXX \ include_expsyms_CXX \ file_list_spec_CXX \ compiler_lib_search_dirs_CXX \ predep_objects_CXX \ postdep_objects_CXX \ predeps_CXX \ postdeps_CXX \ compiler_lib_search_path_CXX; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ configure_time_dlsearch_path \ configure_time_lt_sys_library_path \ reload_cmds_CXX \ old_archive_cmds_CXX \ old_archive_from_new_cmds_CXX \ old_archive_from_expsyms_cmds_CXX \ archive_cmds_CXX \ archive_expsym_cmds_CXX \ module_cmds_CXX \ module_expsym_cmds_CXX \ export_symbols_cmds_CXX \ prelink_cmds_CXX \ postlink_cmds_CXX; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "src/proj_config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/proj_config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "cmake/Makefile") CONFIG_FILES="$CONFIG_FILES cmake/Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; "include/proj/Makefile") CONFIG_FILES="$CONFIG_FILES include/proj/Makefile" ;; "include/proj/internal/Makefile") CONFIG_FILES="$CONFIG_FILES include/proj/internal/Makefile" ;; "include/proj/internal/vendor/Makefile") CONFIG_FILES="$CONFIG_FILES include/proj/internal/vendor/Makefile" ;; "include/proj/internal/vendor/nlohmann/Makefile") CONFIG_FILES="$CONFIG_FILES include/proj/internal/vendor/nlohmann/Makefile" ;; "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; "test/cli/Makefile") CONFIG_FILES="$CONFIG_FILES test/cli/Makefile" ;; "test/gie/Makefile") CONFIG_FILES="$CONFIG_FILES test/gie/Makefile" ;; "test/gigs/Makefile") CONFIG_FILES="$CONFIG_FILES test/gigs/Makefile" ;; "test/unit/Makefile") CONFIG_FILES="$CONFIG_FILES test/unit/Makefile" ;; "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; "man/man1/Makefile") CONFIG_FILES="$CONFIG_FILES man/man1/Makefile" ;; "data/Makefile") CONFIG_FILES="$CONFIG_FILES data/Makefile" ;; "test/googletest/Makefile") CONFIG_FILES="$CONFIG_FILES test/googletest/Makefile" ;; "test/googletest/include/Makefile") CONFIG_FILES="$CONFIG_FILES test/googletest/include/Makefile" ;; "test/googletest/include/gtest/Makefile") CONFIG_FILES="$CONFIG_FILES test/googletest/include/gtest/Makefile" ;; "test/googletest/include/gtest/internal/Makefile") CONFIG_FILES="$CONFIG_FILES test/googletest/include/gtest/internal/Makefile" ;; "test/googletest/include/gtest/internal/custom/Makefile") CONFIG_FILES="$CONFIG_FILES test/googletest/include/gtest/internal/custom/Makefile" ;; "test/googletest/src/Makefile") CONFIG_FILES="$CONFIG_FILES test/googletest/src/Makefile" ;; "proj.pc") CONFIG_FILES="$CONFIG_FILES proj.pc" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. case $CONFIG_FILES in #( *\'*) : eval set x "$CONFIG_FILES" ;; #( *) : set x $CONFIG_FILES ;; #( *) : ;; esac shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`$as_dirname -- "$am_mf" || $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$am_mf" : 'X\(//\)[^/]' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` am_filepart=`$as_basename -- "$am_mf" || $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$am_mf" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` { echo "$as_me:$LINENO: cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles" >&5 (cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } || am_rc=$? done if test $am_rc -ne 0; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Something went wrong bootstrapping makefile fragments for automatic dependency tracking. Try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking). See \`config.log' for more details" "$LINENO" 5; } fi { am_dirpart=; unset am_dirpart;} { am_filepart=; unset am_filepart;} { am_mf=; unset am_mf;} { am_rc=; unset am_rc;} rm -f conftest-deps.mk } ;; "libtool":C) # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi cfgfile=${ofile}T trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. # Written by Gordon Matzigkeit, 1996 # Copyright (C) 2014 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program or library that is built # using GNU Libtool, you may include this file under the same # distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # The names of the tagged configurations supported by this script. available_tags='CXX ' # Configured defaults for sys_lib_dlsearch_path munging. : \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} # ### BEGIN LIBTOOL CONFIG # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # Shared archive member basename,for filename based shared library versioning on AIX. shared_archive_member_spec=$shared_archive_member_spec # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The PATH separator for the build system. PATH_SEPARATOR=$lt_PATH_SEPARATOR # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # An object symbol dumper. OBJDUMP=$lt_OBJDUMP # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # DLL creation program. DLLTOOL=$lt_DLLTOOL # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Whether to use a lock for old archive extraction. lock_old_archive_extraction=$lock_old_archive_extraction # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm into a list of symbols to manually relocate. global_symbol_to_import=$lt_lt_cv_sys_global_symbol_to_import # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # The name lister interface. nm_interface=$lt_lt_cv_nm_interface # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec # The root where to search for dependent libraries,and where our libraries should be installed. lt_sysroot=$lt_sysroot # Command to truncate a binary pipe. lt_truncate_bin=$lt_lt_cv_truncate_bin # The name of the directory that contains temporary libtool files. objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Manifest tool. MANIFEST_TOOL=$lt_MANIFEST_TOOL # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Permission mode override for installation of shared libraries. install_override_mode=$lt_install_override_mode # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Detected run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_configure_time_dlsearch_path # Explicit LT_SYS_LIBRARY_PATH set during ./configure time. configure_time_lt_sys_library_path=$lt_configure_time_lt_sys_library_path # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \$shlibpath_var if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # The directories searched by this compiler when creating a shared library. compiler_lib_search_dirs=$lt_compiler_lib_search_dirs # Dependencies to place before and after the objects being linked to # create a shared library. predep_objects=$lt_predep_objects postdep_objects=$lt_postdep_objects predeps=$lt_predeps postdeps=$lt_postdeps # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path # ### END LIBTOOL CONFIG _LT_EOF cat <<'_LT_EOF' >> "$cfgfile" # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE # func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x$2 in x) ;; *:) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" ;; x:*) eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" ;; *::*) eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" ;; *) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" ;; esac } # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in $*""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } # ### END FUNCTIONS SHARED WITH CONFIGURE _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain=$ac_aux_dir/ltmain.sh # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" cat <<_LT_EOF >> "$ofile" # ### BEGIN LIBTOOL TAG CONFIG: CXX # The linker used to build libraries. LD=$lt_LD_CXX # How to create reloadable object files. reload_flag=$lt_reload_flag_CXX reload_cmds=$lt_reload_cmds_CXX # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds_CXX # A language specific compiler. CC=$lt_compiler_CXX # Is the compiler the GNU compiler? with_gcc=$GCC_CXX # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_CXX # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_CXX # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_CXX # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_CXX # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object_CXX # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds_CXX archive_expsym_cmds=$lt_archive_expsym_cmds_CXX # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds_CXX module_expsym_cmds=$lt_module_expsym_cmds_CXX # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld_CXX # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_CXX # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_CXX # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct_CXX # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \$shlibpath_var if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute_CXX # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L_CXX # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic_CXX # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath_CXX # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_CXX # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols_CXX # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_CXX # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_CXX # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_CXX # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds_CXX # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds_CXX # Specify filename containing input files. file_list_spec=$lt_file_list_spec_CXX # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_CXX # The directories searched by this compiler when creating a shared library. compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX # Dependencies to place before and after the objects being linked to # create a shared library. predep_objects=$lt_predep_objects_CXX postdep_objects=$lt_postdep_objects_CXX predeps=$lt_predeps_CXX postdeps=$lt_postdeps_CXX # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_CXX # ### END LIBTOOL TAG CONFIG: CXX _LT_EOF ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi proj-8.2.1/ChangeLog000644 000765 000024 00000175100 14051166645 014724 0ustar00keversstaff000000 000000 2015-12-13: jswhit * : Add inverse hammer transform (pull request #329). 2015-09-10 sisyphus * : Rename PVALUE in pj_param.cto prevent Windows variable name clash 2015-09-10 Bas Couwenberg * : Don't include files in proj dist, also included in proj-datumgrids dist #301 2015-09-10 Ture Pålsson * : PTHREAD_MUTEX_RECURSIVE detection issue on FreeBSD #303 2015-09-10 Martin Raspaud * : Don't return values when doing inverse projections outside of the mollweide map #304 2015-09-08 Charles Karney * : Update Geodesic library from GeographicLib * Improve accuracy of calculations by evaluating trigonometric functions more carefully and replacing the series for the reduced length with one with a smaller truncation error. * The allowed ranges for longitudes and azimuths is now unlimited; it used to be [-540d, 540d). * Enforce the restriction of latitude to [-90d, 90d] by returning NaNs if the latitude is outside this range. * The inverse calculation sets s12 to zero for coincident points at pole (instead of returning a tiny quantity). * This commit also includes a work-around for an inaccurate value for pi/180 in dmstor.c (see the definitions of DEG_IN and DEG_OUT in geod_interface.c). 2015-09-06 Even Rouault * re-add proj_def.dat which was missing from source distribution https://github.com/OSGeo/proj.4/issues/274 https://github.com/OSGeo/proj.4/issues/296 and https://github.com/OSGeo/proj.4/issues/297 2015-07-27 Even Rouault * : Remove setlocale() use in pj_init_ctx(), and replace uses of atof() & strtod() by their locale safe variants pj_atof() and pj_strtod(). Proj versions from now advertize #define PJ_LOCALE_SAFE 1 in proj_api.h and export pj_atof() & pj_strtod() (#226) 2015-06-01 Charles Karney Make PJ_aeqd.c use geodesics for inverse and forward projection modification so that the geodesic structure is not global https://github.com/OSGeo/proj.4/pull/281 2015-05-25 Elliott Sales de Andrade * : Fix inverse stereo projection on an ellipsoid https://github.com/OSGeo/proj.4/pull/277 2015-02-21 Even Rouault * nad/epsg: regenerate nad/epsg with GDAL r28536 to avoid precision loss in TOWGS84 parameters, e.g. on Amersfoort / RD EPSG:4289 (#260) 2015-02-21 Howard Butler * cmake/Proj4Version.cmake src\lib_proj.cmake: Align SOVERSION CMake configuration with autotools #263 2015-02-21 Howard Butler * src/lib_proj.cmake: define PROJ_LIB as part of the compilation defines #261 2015-02-21 Even Rouault * src/lib_proj.cmake nad/CMakeLists.txt: cmake build: install nad.lst, geodesic.h. But not emess.h and pj_list.h (from Charles Karney) 2015-02-21 Even Rouault * src/pj_gridinfo.c: remove trailing / from preprocessor line (from Charles Karney) 2015-02-21 Even Rouault * src/PJ_aitoff.c: define M_PI and M_PI_2 (needed for Windows) (from Charles Karney) 2015-02-21 Even Rouault * src/lib_proj.cmake: remove space from variable name to suppress policy warning. (from Charles Karney) 2015-02-21 Even Rouault * src/bin_nad2bin.cmake: backward test for nad2nad warning. bad directory specified for emess (from Charles Karney) 2015-02-21 Even Rouault * man/man1/proj.1 man/man1/cs2cs.1 man/man1/geod.1 man/man3/pj_init.3: fix various issues (#259) 2015-02-21 Even Rouault * nad/Makefile.am: compatibility with proj-datumgrids-1.6RC1 (patch by sebastic, #249) 2015-02-21 Even Rouault * nad/Makefile.am: fix install target when no .lla files are in nad subdirectory. 2015-02-21 Even Rouault * cmake/Makefile.am man/Makefile.am: install missing CMake support files for dist-all target 2015-02-20 Howard Butler * CMakeLists.txt cmake/Proj4Mac.cmake man/CMakeLists.txt src/bin_cs2cs.cmake src/lib_proj.cmake: Adapt Charles Karney CMake patches for smoother build #258 2015-02-20 Howard Butler * config.guess config.sub: #257 update very old config.guess and config.sub 2015-02-17 Howard Butler * src/PJ_aitoff.c: #250 Inverse solution for Winkel Tripel from Drazan Tutic 2015-02-17 Howard Butler * CMakeLists.txt cmake/policies.cmake src/lib_proj.cmake: #256 CMake tweaks to shut off some noisy policies, fix installation of proj_config header, and shut off Framework building by default on OSX 2015-02-17 Howard Butler * src/lib_proj.cmake CMakeLists: Fix #248 healpix compilation typo 2015-02-16 Howard Butler * src/pj_init.c: Fix #237 warning about initialization ordering due to setlocale 2015-02-16 Howard Butler * nad/Makefile.am nad/Makefile.in and others in nad/: Fix #247 to allow out-of-tree autoconf builds 2014-09-17 Even Rouault * src/pj_datums.c, src/pj_ellps.c: Add clrk80ign ellipsoid and use it in carthage datum def (#245) 2014-09-16 Frank Warmerdam * Generate 4.9.0 RC2. * nad/epsg: updated with Pulkova 1942(58) reverted, and vertical coordinate system names coming through properly. * src/pj_gridinfo.c, pj_apply_vgridshift.c, pj_apply_gridshift.c: Fix problems with NTv2 files with improper parent structure (#177). 2014-09-13 Frank Warmerdam * Generate 4.9.0 release. 2014-19-13 Howard Butler * CMake: Implement CMake build system for proj.4 #243 2014-09-13 Frank Warmerdam * src/pj_datums.c: fix spelling of clrk80 in carthage datum def (#245) 2014-19-13 Howard Butler * pj_gridinfo.c: Don't crash when nad_ctable_init doesn't return a ctx. #231 2014-09-13 Frank Warmerdam * nad/epsg: Updated to EPSG 8.5 2014-19-08 Even Rouault * src/pj_gridinfo.c: Make pj_gridinfo_load() thread-safe (#228) 2014-19-08 Howard Butler * src/pj_init.c: apply fix specified in #229 -- pj_init_plus() with init and other parms fails in 4.9.0beta 2014-06-06 Even Rouault * src/PJ_omerc.c: mark no_off/no_uoff as used for round-tripping pj_init_ctxt()/pj_get_def() (#239) 2014-05-14 Even Rouault * nad/epsg: Upgraded to EPSG 8.4 2013-12-09 Frank Warmerdam * src/PJ_geos.c, testvarious: reverse sense of sweep flag. (#146) 2013-12-05 Frank Warmerdam * src/PJ_qsc.c: Add QSC projection (#179) 2013-10-27 Frank Warmerdam * Prepare 4.9.0beta2 release. 2013-10-21 Frank Warmerdam * src/PJ_omerc.c: Change handling of values nearly 90degrees away from the origin (#114). * src/pj_datums.c: Switch to using EPSG:1618 COORD_OP_CODE to transform hermannskogel to WGS84 (same as used to ETRS89) (#207). 2013-10-20 Frank Warmerdam * src/Makefile.am: Given up on restricting access to projects.h, and move it back into the list of files installed normally. * configure.in: Add C_WFLAGS support, in particular use -Wdeclaration-after-statement to warn about code that won't work with MSVC (#224). * src/cs2cs.c: Support -I when there is no +to projection. * src/PJ_ob_tran.c: Propagate ctx into sub-projection (#225). 2013-10-03 Frank Warmerdam * src/PJ_healpix.c: Fix healpix build on msvc. (#223) 2013-10-01 Frank Warmerdam * nad/epsg: Upgraded to EPSG 8.2. 2013-07-21 Frank Warmerdam * src/proj_etmerc.c: Fix two errors in the n**5 coefficients. Add sixth order coefficients. Fix rounding problems (#222) 2013-07-19 Frank Warmerdam * src/PJ_healpix.c: major update for polar scaling and parms (#219) 2013-07-12 Frank Warmerdam * src/geodesic.{c,h}: allow polygon vertices to be specified incrementally for geodesic area (#221). 2013-07-08 Frank Warmerdam * src/PJ_calcofi.c: Add Cal Coop Ocean Fish Invest Lines/Stations projections (calcofi) (#135) 2013-07-02 Frank Warmerdam * nad/testvarious, nad/tv_out.dist: add new robinson forward test, and backwards tests. * src/PJ_robin.c: Applied new coefficients supplied by Ed Campbell pretty much on faith. (#113) 2013-06-26 Frank Warmerdam * src/pj_open_lib.c: change filename and access args to const. 2013-06-25 Frank Warmerdam * nad/Makefile.am: add CH to pkgdata_DATA (#145). * src/PJ_putp3.c: Fix putp3p usage line to remove "no inv" (#167). * src/PJ_aitoff.c: note that aitoff and wintri projections have no inverse (#160, #168). * src/PJ_urm5.c: Note that there is no inverse, fix spelling of alpha in the short description (#169). * src/pj_ell_set.c: Ensure thread context is forwarded. * src/multistresstest.c: add windows support (#199) * src/pj_ctx.c: avoid race condition on setting of default_context_initialized. (#199) * config.guess, config.sub: updated to newer versions (#208). * src/proj.def: add pj_get_spheroid_defn to proj.def. (#214) * install-sh: upgrade to support multiple files (#217) 2013-06-24 Frank Warmerdam * src/projects.h, src/proj_api.h: move pj_open_lib() into proj_api.h. * src/projects.h: Do not define PROJ_LIB to "PROJ_LIB". 2013-06-22 Frank Warmerdam * Preparing for 4.9.0 beta release. * src/geodesic.{c,h}: sync relative to GeographicLib 1.31. (#216) * src/pj_fileapi.c, etc: Implement a virtual file api accessible through the context for init file and grid shift file access. * src/mk_cheby.c: reformat, add braces to avoid warnings. 2013-06-19 Frank Warmerdam * src/PJ_healpix.c: correct various warnings about unused variables. 2013-06-19 Frank Warmerdam * src/pj_mutex.c, configure.in: Ensure that the core mutex lock is created in recursive mode. Results in -lpthread being required. 2013-06-18 Frank Warmerdam * src/PJ_healpix.c: rename sign() to pj_sign() and make it static. No need to risk conflicting with sign() in other packages like gctpc. 2012-12-17 Frank Warmerdam * src/pj_init.c: Recover gracefully if setlocale() returns NULL like on Android (#204). 2012-12-07 Frank Warmerdam * src/geod*: Replace geodesic implementation with one from Charles Karney, add public interface (#197). 2012-12-05 Frank Warmerdam * nad/epsg: Upgraded to EPSG 8.0. 2012-07-24 Frank Warmerdam * src/pj_gridcatalog.c, src/makefile.vc: fixes for visual studio builds (#182). 2012-07-04 Frank Warmerdam * src/PJ_healpix.c: Incorporate a polar fix (#176). 2012-06-27 Frank Warmerdam * src/nad2bin.c: Fix byte swapping for bigendian platforms (#157) 2012-06-07 Frank Warmerdam * src/pj_init.c: avoid leaking vgridlist_geoid (#175). 2012-06-01 Martin Desruisseaux * Removed the old JNI wrappers from trunk. Those wrappers are still present on the 4.8 branch as deprecated classes. 2012-05-31 Martin Desruisseaux * Replaced usages of NAN C/C++ constant by the java.lang.Double.NaN constant. This was done because not all C/C++ compilers define the NAN constant, and for making sure that the bits pattern is exactly the one expected by Java. 2012-03-25 Frank Warmerdam * src/Makefile.am: Add org_proj4_PJ.h to files to distribute. 2012-03-13 Frank Warmerdam * src/projects.h, src/pj_list.c: avoid using #include directly on a macro expansion - it is unnecessary and makes for problems in my work environment. 2012-03-06 Frank Warmerdam * Preparing 4.8.0 release candidate. * nad/epsg: regenerate with +no_uoff for hotine oblique mercator (#104) * src/PJ_sconics.c: Fix missing P->sig term in pconic forward projection equation (#148). 2012-03-03 Frank Warmerdam * src/PJ_omerc.c: Support +no_uoff and +no_off (#128) * src/PJ_stere.c: Cleanup odd code construct (#147) 2012-02-26 Frank Warmerdam * src/PJ_geos.c, nad/testvarious: Added GEOS +sweep and add GEOS to the test suite (#146) * nad/CH: added swiss datum related definitions from strk (#145) * src/Makefile.am, src/mutltistresstest.c: provide for building multistresstest in the makefile, and slightly improve it. 2012-02-25 Frank Warmerdam * nad/epsg: regenerate with +datum (#122) 2012-02-20 Frank Warmerdam * Prepare 4.8.0 Beta1. * src/PJ_isea.c: Add Icosahedral Snyder Equal Area projection (#111) * src/nad2nad.c: completely removed as part of the ctable2 overhaul. * src/cs2cs.c, src/pj_init.c, src/geod_set.c, src/nad2nad.c, src/geod.c: Use parenthesis around assignments in if statements (#123). * src/nad2bin.c: improve io error checking (#140). * src/PJ_healpix.c: fix windows build issues (#133) 2012-02-15 Frank Warmerdam * src/pj_utils.c: Add pj_get_spheroid_defn() (#142) 2012-02-08 Frank Warmerdam * src/pj_apply_gridshift.c: Ensure that one among many points falling outside the grid areas will not cause the remainder to not be datum shifted in a way that is hard to diagnose. (#45) 2012-02-01 Frank Warmerdam * src/pj_apply_gridshift.c: ensure we try to use grids as long as we are within epsilon of the edge (#141). 2012-01-31 Frank Warmerdam * src/nad2bin.c: fix comparison test for -f flag (#139). 2011-12-22 Frank Warmerdam * src/pj_init.c; Only split arguments on pluses following spaces in pj_init_plus() (#132) 2011-12-14 Frank Warmerdam * src/pj_open_lib.c: make sure we check errno before logging messages (#131). 2011-12-13 Frank Warmerdam * src/PJ_healpix.c, etc: added healpix support contributed by Landcare in New Zealand. 2011-11-22 Frank Warmerdam * src/nad_init.c, src/pj_gridinfo.c, src/nad2bin.c: Implement support for "ctable2" format grid shift files. 2011-11-18 Frank Warmerdam * src/pj_mutex.c, src/pj_apply_vgridshift.c: avoid unused warnings. 2011-11-13 Frank Warmerdam * src/nad2bin.c: Modified to write NTv2 format files. * src/pj_init.c: avoid casting warning with old_locale. 2011-09-28 Frank Warmerdam * nad/epsg: Upgrade to EPSG 7.9. Ideal datum selection rules also changed a bit upstream. 2011-09-01 Martin Desruisseaux * Updated jniwrap/build.xml Ant script and README file. 2011-08-27 Martin Desruisseaux * Fixed some (but not all) memory leaks in org.proj4.Projections JNI bindings * Deprecated org.proj4.Projections JNI bindings * Added org.proj4.PJ JNI bindings in replacement of org.proj4.Projections 2011-08-27 Frank Warmerdam * pj_pr_list.c, pj_sterrno.c: doc typo fixes from Martin. 2011-08-07 Frank Warmerdam * src/pj_datums.c: Updated Potsdam (DHDN) towgs84 parameters to match EPSG 7 parameter list for EPSG:4314 (#115). * src/pj_mutex.c: alter name of core_lock to avoid conflict on AIX (#55) 2011-07-23 * configure.in, Makefile.am, proj.pc.in: Added pkg-config support (#3) 2011-07-05 Frank Warmerdam * src/pj_init.c, src/pj_gridinfo.c: Correct error handling for missing grid shift files and defaults files (#116) 2011-06-09 Frank Warmerdam * src/PJ_robin.c: fix mistaken constant value (#113). * src/pj_init.c: fix for +axis validation (#87) * nad/IGNF: addition/fix of Kerguelen, Amsterdam and St Paul, Terre Adélie, INSPIRE CRSes in IGNF catalogue (#88) 2011-05-31 Frank Warmerdam * src/PJ_igh.c: use project free instead of free() in FREEUP (#112). * src/projects.h: memset PJ structure to zeros after allocation to avoid problems getting everything initialized properly (#112). 2011-05-23 Frank Warmerdam * nad/esri.extra, nad/other.extra: moved 900913 definition from esri.extra to other.extra since it has nothing to do with esri. * nad/epsg: updated to EPSG 7.6. 2011-05-20 Frank Warmerdam * src/PJ_sterea.c: ensure P->en is properly initialized (#109) 2011-05-10 Frank Warmerdam * src/projects.h, src/pj_init.c, src/pj_transform.c: Implement support for vto_meter and vunits vertical units transformation. 2011-05-04 Frank Warmerdam * src/PJ_igh.c: Added goodes interrupted homolosine (#106). 2011-03-28 Frank Warmerdam * src/pj_gridlist.c: avoid possible buffer overflow. https://bugs.meego.com/show_bug.cgi?id=14963 2011-03-23 Frank Warmerdam * src/pj_initcache.c: Fix reversed memcpy that causes a crash on the 16th item put in the initcache. (#100). 2011-02-21 Frank Warmerdam * src/pj_init.c: fix serious bug in locale handling, wasn't copying the old locale so it would sometimes get corrupted. * src/proj_etmerc.c: added extended transverse mercator impl. (#97) * Rerun autogen.sh with the latest versions of automake, autoconf and libtool. 2011-02-10 Frank Warmerdam * src/pj_gridinfo.c: fix debug bounds reported (#95). 2011-02-08 Frank Warmerdam * src/PJ_cea.c: Fix particular CEA case (#94). * src/pj_auth.c: correct precision of constants (#93) * src/pj_init.c, pj_malloc.c, jniproj.c: avoid C++ comments (#92) 2011-01-11 Frank Warmerdam * src/PJ_goode.c: fix propagation of es and ctx to sub-projections. 2010-10-19 Frank Warmerdam * src/proj_api.h, src/projects.h: move pj_clear_initcache() to public api and update to 4.8.0 PJ_VERSION to identify when this is available. 2010-08-31 Frank Warmerdam * src/pj_gridinfo.c: Move grids in 180 to 360 region to -180 to 0. Improve error/debug reporting. 2010-08-21 Frank Warmerdam * nad/test*: default to using ../src/cs2cs 2010-07-31 Frank Warmerdam * nad/epsg: updated from GDAL. Adds TMSO projection definitions, and replaces all named datums with fully defined datums. 2010-07-05 Frank Warmerdam * src/projects.h: I_ERROR macro must set context errno. 2010-06-10 Frank Warmerdam * src/*: Preliminary implementation of projCtx multithreading change. 2010-05-11 Frank Warmerdam * src/pj_apply_vgridshift.c (+more): preliminary addition of vertical grid shifting support. 2010-03-16 Frank Warmerdam * src/pj_transform.c, src/pj_init.c, src/projects.h, src/pj_gridlist.c, src/pj_apply_gridshift.c: rework the translation of nadgrids parameters into a list of gridshift files to avoid use of static "lastnadgrids" information which screws up multithreading. Changes the PJ structure. * src/multistresstest.c: new harnass for multithreaded testing. 2010-03-03 Frank Warmerdam * src/*: fix a variety of warnings when -Wall is used. Mostly unused variables, and use of assignment results in an if statement without extra brackets. * src/*: treat most grid shift errors as not-transient, with the exception of not having a grid shift file for the area of interest. This is done by adding a new error code for no grid shift file for target area. Also ensure that cs2cs reports pj_transform() errors via emess so we have a chance of seeing the error message. 2010-02-28 Frank Warmerdam * src/pj_init.c, src/pj_transform.c: added support for +axis setting to control axis orientation (#18). * nad/epsg: Regenerated from EPSG 7.4.1 with the big datum selection upgrade. 2010-02-20 Frank Warmerdam * src/PJ_omerc.c: wholesale update from libproj4.3 (20081120) (#62) 2010-01-25 Frank Warmerdam * src/pj_mutex.c: avoid conflict between pthread and win32 mutex implementations on unix-like build environments on windows. (#56) * src/pj_init,src/projects.h,src/pj_transform.c,nad/testvarious: Correct seriously broken +lon_wrap implementation. (#62) * src/pj_mutex.c: fix creation of mutex on win32 to be in unacquired state in pj_init_lock to avoid an extra reference. (#63) 2009-10-19 Frank Warmerdam * nad/ntf_r93.gsb: updated with file from IGN (#52). * docs/*: files moved out of source tree (still in svn) 2009-09-29 Frank Warmerdam * nmake.opt: Update so that various items can be externally overridden (#54). 2009-09-24 Frank Warmerdam * nad/Makefile.am: add ntv2 and ignf testing if grid shift files are available. 2009-09-23 Frank Warmerdam * Preparing for 4.7.0 release. * nad/makefile.vc: do not attempt to install ntf_r93.gsb by default. * src/pj_init.c: Temporarily set locale to "C" to avoid locale specific number parsing (#49). * src/pj_rho.c: move rho out of structure, threadsafety issue (#41). * nmake.opt: improve comments (#50). * nad/epsg: regenerated - use more symbolic ellipsoid/datum names, and fix EPSG 3857 and 3785 (#51). * src/pj_gridlist.c: Implement mutex protection for grid loader/cacher. * src/pj_mutex.c: fix up windows support. * nad/ntf_r93.gsb: set mime-type to binary so it isn't corrupted on windows systems. 2009-06-17 Frank Warmerdam * src/pj_mutex.c: Implement win32 and pthread mutex support. * configure, src/Makefile.am: add --without-mutex support to configure 2009-06-16 Frank Warmerdam * README: Update windows build instructions (#30). * nad/epsg: Upgraded to EPSG 7.1. 2009-05-19 Frank Warmerdam * nad/testvarious,nad/testdatumfile: split datum file specific stuff into testdatumfile, and add kav5 test in testvarious (#40). 2009-05-18 Frank Warmerdam * src/PJ_sts.c: Remove duplicate division o lp.phi by P->C_p (#40). 2009-05-13 Frank Warmerdam * src/PJ_imw_p.c: Correct handling of yc in loc_for() (#39). 2009-04-02 Frank Warmerdam * nad/Makefile.am: Changes to ensure grid shift files are processed before running check-local, and to use the local grid shift files if available, and to avoid testvarious if grid shift files are not available. * src: Fix various warnings. 2009-03-11 Frank Warmerdam * man/man1: fix Snyder reference (#29) 2009-03-10 Howard Butler * autogen.sh: Use autogen.sh from libLAS for wider platform (OSX, Solaris) compatibility * config.guess config.log: remove autoconf temporary files 2009-03-10 Mateusz Loskot * makefile.vc: Added new files pj_mutex.c, pj_initcache.c. 2009-03-09 Frank Warmerdam * pj_init.c, pj_mutex.c, pj_initcache.c: Introduced in-memory caching of init file search results. 2009-03-08 IGNF * src/PJ_gstmerc.c: Correction of a bug in inv() function : the projected origin coordinates where descaled. * nad/testIGNF: Add a comment on the mandatory existence of the world grid in order to make the test. * ChangeLog: this comments 2009-01-26 Frank Warmerdam * src/*.c: Remove SCCSID and lint stuff from all source files. 2009-01-23 Frank Warmerdam * src/biveval.c: Avoid use of static variables which interfere with re-entrancy (#24)" 2009-01-05 Frank Warmerdam * src: Removed CVS log messages from various files since they are not maintained by subversion. 2008-09-16 Frank Warmerdam * src/{Makefile.am, Makefile.in}: Added '-no-undefined' option to LDFLAGS. This is required to properly build a library in some environments, MinGW in particular. 2008-08-21 Frank Warmerdam * Prepare 4.6.1RC2 * nad/td_out.dist: backed out erroneous changes in 4.6.0 that lost datum shifts with grid shift files. Added stere (#12) test. * nmake.opt: Added /Op to avoid stere errors per ticket #12. 2008-08-07 Frank Warmerdam * nmake.opt, nad/makefile.vc: Make sure we use PROJ_LIB_DIR when installing nad directory support files on windows. 2008-07-28 IGNF * PJ_glabsgm.c : refactoring for better understanding of the projection's formula. * copy of PJ_glabsgm.c to PJ_gstmerc.c and make changes accordingly in src and nad directories. 2008-07-21 Frank Warmerdam * Prepare 4.6.1 release. * rename INSTALL.TXT to INSTALL since the damn distribution generator won't stand for the alternate naming. Change makefile.vc to use install-all target instead of install. What are the chances anyone will think of trying that? Not high. * nad/epsg: regenerated from EPSG 6.17. This should also correct the odd precision problems in the last version or two caused by GDAL numeric processing issues. 2008-06-17 Frank Warmerdam * src/PJ_tmerc.c: Ensure that tmerc forward projection inputs are within 90 degrees of the central meridian. This should be considered a preliminary patch until such time as Gerald comes up with a better solution. http://trac.osgeo.org/proj/ticket/5 2008-04-24 Frank Warmerdam * src/cs2cs.c: Fix process() so it passes through extra text as the docs claim. 2008-03-15 Frank Warmerdam * rename INSTALL to INSTALL.TXT to avoid screwing up "make install" * Rework win32 makefiles to support "make install", and better knowledge of grid shift files, 2008-01-18 IGNF * PJ_eqc.c : Merged eqr and eqc after advise from Gerald. eqc is now generalized (supports latitude of origin). Cleaned files including eqr. * IGNF catalogue : changed accordingly. Added proj_outIGN.dist-real in nad directory to get real coordinates for unit tests. 2008-01-05 IGNF * PJ_eqr.c: src/PJ_eqr.c added. src/pj_list.h modified (added eqr). src/Makefile.am, src/makefile.vc modified (added PJ_eqr.c and al). As automake 1.10 is missing, src/Makefile.in modified by hand. * PJ_glabsgm.c: src/PJ_glabsgm.c added. src/pj_list.h modified (added glabsgm). src/Makefile.am, src/makefile.vc modified (added PJ_glabgsm.c and al). As automake 1.10 is missing, src/Makefile.in modified by hand. * IGNF catalogue: nad/IGNF added. nad/ntf_r93.gsb added, nad/Makefile.am modified (added IGNF, ntf_r93.gsb little endian release) nad/README modified (added IGNF, ntf_r93.gsb). As automake 1.10 is missing, nad/Makefile.in modified by hand. * Specific IGN release : configure.in ChangeLog 2007-12-21 Frank Warmerdam * Prepare 4.6.0 final release. 2007-12-21 Andrey Kiselv * PJ_wag3.c: Added missed "lat_ts" parameter to projection description string. 2007-12-20 Frank Warmerdam * pj_list.h, Makefile.am, PJ_mpoly.c: Removed mpoly projection. It was just a dummy (no actual transformation). 2007-12-06 Frank Warmerdam * pj_factors.c: in the case of phi=90, the derived should be calculated at [90-delta,90] instead of at [90,90+delta] (the same is true for -90) http://bugzilla.remotesensing.org/show_bug.cgi?id=1605 2007-12-03 Frank Warmerdam * pj_transform.c: Small improvement in WGS84_ES precision to avoid an unnecessary trip through geocentric space (eg bug 1531). 2007-11-30 Frank Warmerdam * add latlon and lonlat as aliases. 2007-11-29 Frank Warmerdam * Prepare 4.6.0beta1 release. * nad/epsg: Upgrade to EPSG 6.13 2007-11-25 Frank Warmerdam * pj_transform.c: Do ellipsoid comparisons using the _orig ellipse values rather than the adjusted one. Use these original values for any conversion to/from geocentric coordinates. Also, only do pj_datum_transform if neither the source nor destination is PJD_UNKNOWN. This means we will no longer attempt via-geocentric adjustments for coordinate systems lacking a datum definition (having only an ellipsoid. * projects.h, pj_init.c: added a_orig and es_orig values in the PJ structure so we can distinguish between the originally requested ellipsoid, and the ellipsoid after adjustment for spherical projections Todays changes courtesy of bug 1602. 2007-09-28 Frank Warmerdam * nad/esri.extra: Add "900913" code for google mercator. 2007-09-11 Frank Warmerdam * src/gencent.c/h, src/pj_transform.c: Restructure so geocentric code does not use static variables - reentrancy fix. * src/nad_init.c: Improve error recovery if ctable datum shift files fails to load. 2007-08-20 Frank Warmerdam * src/proj_api.h: include void in arg list for prototypes with no arguments to avoid warning about not being a function declaration. 2007-07-06 Frank Warmerdam * src/pj_open_lib.c: Per suggestion from Janne, ensure pj_set_searchpath(0,NULL) clears the search path cleanly. 2007-06-04 Frank Warmerdam * src/proj.c: pj_free() the definition to simplify leak testing. 2007-04-04 Frank Warmerdam * src/PJ_laea.c: Fix memory leak of apa field. 2007-04-03 Frank Warmerdam * src/PJ_gn_sinu.c: remove duplicate call to pj_enfn() (bug #1536) 2007-03-12 Frank Warmerdam * src/pj_utils.c: Removed duplicate appending of towgs84 parameter. 2007-03-11 Frank Warmerdam * src/projects.h: Ensure that WIN32 is defined on win32 systems. * src/pj_open_lib.c: support drive letter prefixes on absolute paths. Support either \ or / as a dir delimiter on windows (bug 1499) 2007-03-07 Frank Warmerdam * src/PJ_krovak.c: info string change to report ellipsoidal instead of spherical per email from Markus. 2007-01-31 Frank Warmerdam * src/pj_datum_set.cpp: Don't parse more datum shift parameters than we have space to store in datum_params[]. 2006-11-02 Frank Warmerdam * src/rtodms.c: Fix computation of degree per bug described on the mailing list. 2006-10-22 Frank Warmerdam * Prepare for 4.5.0 final release. 2006-10-18 Frank Warmerdam * nad/epsg: added polish zones (2172-2175) manually per request from Maciek on the mailing list. * Preparing 4.5.0 beta4 release. 2006-10-17 Frank Warmerdam * src/proj_mdist.c, proj_rouss.c: Incorporated these from libproj4 for http://bugzilla.remotesensing.org/show_bug.cgi?id=967. * nad/epsg: Regenerated from EPSG 6.11.1 with a few other fixes (datum shift values) from several bug reports. 2006-10-12 Frank Warmerdam * Added experimental +lon_wrap argument to set a "center point" for longitude wrapping of longitude values coming out of pj_transform(). 2006-10-10 Frank Warmerdam * src/proj.c,nad2nad.c,cs2cs.c: Increase MAX_LINE to 1000 per request from Dan Scheirer. 2006-10-01 Frank Warmerdam * nad/Makefile.am: added test target. 2006-09-23 Frank Warmerdam * nad/epsg: upgraded to EPSG 6.11 2006-09-22 Frank Warmerdam * src/pj_init.c: removed static "start" variable to resolve thread-safety problems (bug 1283). 2006-09-14 Frank Warmerdam * Produce 4.5.0beta2 release. * src/PJ_krovak.c: Add +czech flag to apply non-useful sign reversal that someone once apparently thought was a good idea. By default work like folks want. Contributed by Martin Landa and Radim Blazek. Bug 1133, and 147. 2006-07-07 Frank Warmerdam * Added esri.extra and other.extra to distributed and installed files in nad/Makefile.am. * autotools update. 2006-06-23 Andrey Kiselev * src/PJ_eqdc.c: Do not call pj_enfn() twice avoiding memory leak. 2006-05-01 Frank Warmerdam * src/pj_transform.c: Ensure that out-of-range lat/long values in geodetic_to_geocentric are considered transient errors. Rel. 4.5.0 2006-04-21 ------------------------------------------------------------------------- 2006-04-21 Frank Warmerdam * nad/epsg: Upgraded using GDAL 1.3.2 with prime meridian fixes, and reporting of deprecated PCSes. 2006-04-20 Frank Warmerdam * Fixed direction of Bogota meridian (west not east). 2006-04-19 Frank Warmerdam * Preparing 4.5.0 release. 2006-03-30 Frank Warmerdam * projects.h, cs2cs.c, pj_strerrno.c, p_series.c, gen_cheb.c: Added _CRT_SECURE_NO_DEPRECATE declaration for VC8+, and ensure projects.h gets included first where needed. Avoids loud warnings on VC8. http://bugzilla.remotesensing.org/show_bug.cgi?id=1145 2006-03-29 Frank Warmerdam * pj_krovak.c: Removed MessageBox() DEBUG stuff. 2006-03-20 Frank Warmerdam * src/pj_transform.c: Return error -14 (latitude or longitude exceeds bounds) for failed geodetic to geocentric (lat out of +-90). 2006-03-10 Frank Warmerdam * nad/epsg: updated to EPSG 6.9. 2006-02-16 Frank Warmerdam * src/pj_transform.c: Treat errno=33 (EDOM) and errno=34 (ERANGE) as transient errors, and continue trying to transform the rest of the points. 2006-01-19 Frank Warmerdam * nad/world: Fixed definition of as per: http://bugzilla.remotesensing.org/show_bug.cgi?id=1041 2006-01-12 Frank Warmerdam * geocent.c: Make global variables static. Among other things this avoids conflicts for apps that link in geotrans. 2005-12-04 Frank Warmerdam * src/pj_transform.c: improve code with some symbolic names. 2005-11-08 Frank Warmerdam * src/pj_datums.c: Added OSGB36 transformation to list. 2005-07-06 Frank Warmerdam * nad/Makefile.am: added .gsb installation logic to capture nz file. * pj_gridinfo.c: fixed debug format string per: http://bugzilla.remotesensing.org/show_bug.cgi?id=886 * pj_utils.c: fixed precision of es encoding in pj_latlong_from_proj. http://bugzilla.remotesensing.org/show_bug.cgi?id=881 2005-04-20 Frank Warmerdam * pj_apply_gridshift.c: Fixed problem that was resulted in points after the first apparently succeeding to shift when a gridshift file wasn't found. Bug 834. 2004-11-05 Frank Warmerdam * src/pj_transform.c: Fixed pj_geocentric_to_geodetic() to not try and process HUGE_VAL values (those that have failed some previous transform step). Related to bug: http://bugzilla.remotesensing.org/show_bug.cgi?id=642 2004-10-30 Frank Warmerdam * Improved --with-jni support in configure to allow specification of an include directory. Rel. 4.4.9 2004-10-29 ------------------------------------------------------------------------- 2004-10-29 Frank Warmerdam * Preparing 4.4.9 release. * src/pj_gridinfo.c: Fixed reported information in ctable debug msg. * src/nad_cvt.c: Fixed problem with domai of tb.lam that caused failure of eastern hemisphere locations to transform with null grid (which is world sized). 2004-10-28 Frank Warmerdam * src/makefile.vc: Changed to build executables against a proj.dll by default. * proj.def: added lots of methods, including some private ones used only by proj.c, and geod.c. * Added pj_get_*_ref() accessors for all the definition lists. * Makefile.am: added jniwrap make support. * configure.in: various updates, including use of AC_MAINTAINER_MODE, and setting version to 4.4.9. Fixes annoying .so problem. * updated to latest libtoolish stuff. 2004-10-25 Frank Warmerdam * fixtimes.sh: Run this after a CVS checkout to setup times of various build files to avoid re-running automake and friends. * src/geocent.c,geocent.h,pj_transform.c: Added pj_ prefix to all Geotrans functions to avoid name conflict if both linked in. * configure.in: added --with-jni option. * Added src/jniproj.c, src/org_proj4_Projections.h. * Added jniwrap subtree (actually Andrea Antonello). 2004-10-21 Frank Warmerdam * src/makefile.vc: added support for new files. 2004-10-19 Frank Warmerdam * src/pj_gauss.c, src/PJ_geos.c, src/PJ_sterea.c: Incorporated geos and sterea projections from Gerald's libproj4. 2004-09-16 Frank Warmerdam * src/pj_open_lib.c: added pj_set_searchpath() provided by Eric Miller. 2004-09-14 Frank Warmerdam * src/pj_pr_list.c: Ensure unused parameters are not included in the returned string (provided by Eric Miller). 2004-05-17 Frank Warmerdam * proj.spec: Change PACKAGE_NAME from "PROJ" to "proj". 2004-05-12 Frank Warmerdam * nad/epsg: update translation for potsdam datum. http://bugzilla.remotesensing.org/show_bug.cgi?id=566 2004-05-04 Frank Warmerdam * src/pj_init.c: Made sword[] larger in get_opt() so long +towgs84 parameters or long +nadgrids parameters aren't truncated. Rel. 4.4.8 2004-05-04 ------------------------------------------------------------------------- 2004-05-04 Frank Warmerdam * 4.4.8 release re-issued. * nad/epsg: regenerated with prime meridian problems corrected. http://bugzilla.remotesensing.org/show_bug.cgi?id=510 2004-05-03 Frank Warmerdam * Preparing 4.4.8 release. * src/pj_datums.c: added nzgd49 datum definition http://bugzilla.remotesensing.org/show_bug.cgi?id=339 * nad/epsg: updated to EPSG 6.5. * src/pj_transform.c: fixed so that raw ellipsoids are handled in datum shifting as if they had a +towgs84=0,0,0. * src/pj_transform.c: Fixed so that prime meridian offsets are applied even if the coordinate system is not lat/long. http://bugzilla.remotesensing.org/show_bug.cgi?id=510 * src/geocent.c: Updated Geocentric_To_Geodetic computation to be iterative to reduce error as per Wenzel, H.-G.(1985): Hochauflösende Kugelfunktionsmodelle für das Gravitationspotential der Erde. Wiss. Arb. Univ. Hannover Nr. 137, p. 130-131. Fix adapted to geocent.c and submitted by Lothar Gorling. http://bugzilla.remotesensing.org/show_bug.cgi?id=563 2004-04-15 Frank Warmerdam * src/makefile.vc: Define HAVE_STRERROR. * src/projects.h: PJD_ERR_GEOCENTRIC now -45, and added to pj_strerrno.c. * src/pj_release.c: added pj_get_release() function. 2004-02-19 Frank Warmerdam * nad/other.extra: updated from some WKT definition Daniel got from CubeWerx. 2004-01-24 Frank Warmerdam * src/pj_transform.c: Ensure pj_transform() will try to transform all points in provided list if even some might transform properly. 2003-08-18 Frank Warmerdam * src/PJ_aea.c: fixed initialization of en variable. http://bugzilla.remotesensing.org/show_bug.cgi?id=380 2003-06-27 Frank Warmerdam * src/pj_init.c: changed tokenizing in pj_init_plus() so that if a value has an exponent with a plus sign this won't trigger a brand new token. See bug 355 in bugzilla. 2003-06-09 Frank Warmerdam * src/pj_init.c: ensure start is initialized at the very beginning of the function to avoid crashes in case where the input arg list is empty. 2003-04-24 Frank Warmerdam * src/geod.c: Don't emit an error message after listing ellipsoids or units, as per request from Dan Jacobson. 2003-04-09 Frank Warmerdam * man/man1/{proj,cs2cs}.1: moved -m option from cs2cs.1 to proj.1 since it is only supported by proj. * nad/Makefile.am: added DESTDIR in three missing places as per bug report from Peter Galbraith - proj debian package manager. Rel. 4.4.7 2003-03-31 ------------------------------------------------------------------------- 2003-03-31 Frank Warmerdam * Prepare 4.4.7 Release. * nad/esri: incorporated Paul Ramsey's update. ESRI specific coordinate systems in nad/esri.extra. * nad/epsg: Regenerated with towgs84 parameters properly generated for non-greenwich prime meridians. http://bugzilla.remotesensing.org/show_bug.cgi?id=304 2003-03-28 Frank Warmerdam * config.guess, config.sub: updated from ftp://ftp.gnu.org/pub/gnu/config/ in order to resolve Debian build problems on MIPS architecture. http://bugs.debian.org/cgi-bin/bugreport.cgi?archive=no&bug=186586 * src/pj_datums.c: fixed ire65 definition to refer to mod_airy, not modif_airy as per: http://bugzilla.remotesensing.org/show_bug.cgi?id=312 2003-03-26 Frank Warmerdam * src/pj_transform.c: Added check that srcdefn->inv actually exists! Per http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=301 2003-03-25 Frank Warmerdam * src/cs2cs.c: modified so that -f formats are used for Z as well as x and y values. As per http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=169056 * src/man/man1/cs2cs.1: removed -V flag ... it is not supported. As per http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=162331 2003-03-17 Frank Warmerdam * src/pj_datums.c: changed NAD27 definition to make everything optional, and to include alaska, and ntv2_0.gsb. nadgrids=@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat * src/pj_grid*, src/pj_apply_gridshift.c, src/nad_init.c: Lots of changes introducing the PJ_GRIDINFO structure, support for skippable grids ('@' prefix), delayed grid data loading and support for NTv2 grids. 2003-03-16 Frank Warmerdam * Modified get_opt() to terminate reading the definition when a new definition (a word starting with '<') is encountered, in addition to when the definition terminator '<>' is encountered, so that unterminated definitions like those in the distributed esri file will work properly. Patch provided by Carl Anderson. http://bugzilla.remotesensing.org/show_bug.cgi?id=302 2003-03-03 Frank Warmerdam * Prepare 4.4.6 Release. * nad/epsg: updated to EPSG 6.2.2. * src/Makefile.am, nad/Makefile.am: a few fixes for Cygwin compatibility, ensure /usr/local/share/proj get pre-created. * Incorporate src/PJ_lcca.c, the new "alternate" LCC implementation provided by Gerald for some old maps. See his site for details. * Rebuild dependent files with automake 1.6.3, libtool 1.4.2 and autoconf 2.53. 2003-01-15 Frank Warmerdam * src/pj_datums.c: added some datums as suggested by the GRASS team. 2002-12-14 Frank Warmerdam * src/projects.h, various others: updated header style in some files. * src/pj_geocent.c, src/pj_transform.c, src/pj_list.h, src/projects.h: added support for geocentric coordinates in pj_transform() api. * src/pj_utils.c: Fixed pj_get_def() to return info on prime meridian. 2002-12-08 Frank Warmerdam * src/cs2cs.c: added support for the -lm switch to report all prime meridians. * src/pj_init.c, pj_transform.c, pj_datum.c: added preliminary support for the +pm switch to set the prime meridian. 2002-12-01 Frank Warmerdam * src/pj_transform.c: Applied fix for 7 parameter shifts in pj_geocentric_from_wgs84() as per suggestion from Harald Lernbeiss in: http://bugzilla.remotesensing.org/show_bug.cgi?id=194 2002-11-19 Frank Warmerdam * src/cs2cs.c: cleanup memory at end to facility memory leak testing. 2002-07-29 Frank Warmerdam * nad/esri: applied gradian related patches as per bug 184: http://bugzilla.remotesensing.org/show_bug.cgi?id=184 2002-07-25 Frank Warmerdam * nad/esri: added new ESRI translation file. Includes EPSG values plus various ESRI extensions. 2002-07-07 Frank Warmerdam * src/*.c, src/*.h, src/makefile.vc: *Many* changes to support compiling all of the PROJ.4 source as C++ source. Add /TP to CFLAGS in makefile.vc to test this on Windows. projects.h, and proj_api.h attempt to export all externally visible functions with C linkage but all code should now compile as C++. Currently only tested with VC++ 6. 2002-06-11 Frank Warmerdam * src/pj_pr_list.c, proj.def, proj_api.h: Added the pj_get_def() function to return an expanded definition from a projPJ handle, including having the +init= section expanded. 2002-05-30 Frank Warmerdam * src/geod/{geod.c,geod_for.c,geod_inv.c,geod_set.c,geodesic.h}: Renamed a, S and f to geod_a, geod_S and geod_f to slightly reduce the horrible naming conflict situations with geodesic.h. http://bugzilla.remotesensing.org/show_bug.cgi?id=148 2002-04-30 Frank Warmerdam * html/faq.html: new * src/pj_apply_gridshift.c,pj_open_lib.c,nad_init.c: try to improve debug output when datum shifting fails. 2002-04-16 Frank Warmerdam * src/pj_list.c,src/PJ_krovak.c: Incorporated support for Krovak projection as per submission by Thomas Fleming and Markus Neteler. 2002-03-01 Frank Warmerdam * src/geod.c: Moved ctype.h up to avoid compile failure on MacOS X. 2002-02-15 Frank Warmerdam * pj_transform.c: Provide zerod Z array in pj_datum_transform() if none passed in. 2002-01-23 Frank Warmerdam * Added proj.spec file provided by Intevation (FreeGIS CD). Rel. 4.4.5 2002/01/09 ------------------------------------------------------------------------- 2002-01-09 Frank Warmerdam * src/geocent.c: Fixed serious bug in Convert_Geodetic_To_Geocentric() that essentially ruins all datum shifting (except NAD tables). This bug was introduced just in time for the PROJ 4.4.4 release. 2001-11-05 Frank Warmerdam * src/proj.def: added pj_strerrno and pj_errno as per request from Bernhard Herzog. Rel. 4.4.4 2001/09/15 ------------------------------------------------------------------------- 2001-09-15 Frank Warmerdam * src/geocent.c: I have modified the Convert_Geodetic_To_Geocentric() function to clamp Latitudes just a little out of the range -PI/2 to PI/2 and to no longer do error checks on Longitudes since they will be auto-wrapped by sin() and cos(). See http://bugzilla.remotesensing.org/show_bug.cgi?id=17 * nad/epsg: committed new updates with fixed units for us state plane zones in feet, as reported by Marc-Andre. 2001-08-23 Frank Warmerdam * src/makefile.vc: improved the setting of PROJ_LIB defaults. * src/pj_open_lib.c: added the pj_set_finder() entry point. * nad/epsg: fixed all LCC projections. The parameters were badly mixed up. 2001-08-11 Frank Warmerdam * src/proj.c: Generate an error message if +proj=latlong is used with this program. As per bugzilla bug 70. 2001-06-01 Frank Warmerdam * makefile.vc: emess.c directly linked into mainline programs. * pj_errno.c: added pj_get_errno_ref(). 2001-05-14 Frank Warmerdam * upraded config.sub and config.guess as per debian bug report 97374. Rel. 4.4.3 2001/04/20 ------------------------------------------------------------------------- 2001-04-20 Frank Warmerdam * Don't install test files in /usr/local/share/proj. * Made WGS84 the default in proj_def.dat * nad/test27,test83: Use -b flag for diff to avoid differences on Windows due to CR/LF issues. * src/makefile.vc: default to building "all". * src/pj_init.c: call pj_open_lib() with mode of "rt" to ensure correct handling of def files on DOS based systems. * Updated for 4.4.3 release (pj_release.c, Makefile.am, etc). 2001-04-05 Frank Warmerdam * Introduce proj_api.h as a public include file with projects.h now intended to be private. * pj_datums.c: added ntv1_can.dat to list for NAD27 datum. * nad_init(): added support for loading NTv1 style datum shift files. * cs2cs.c: use pj_latlong_from_proj() * pj_init.c: added pj_init_plus(). * pj_utils.c: new with pj_is_latlong(), and pj_latlong_from_proj() functions. * pj_strerror.c: added error -43. 2001-04-04 Frank Warmerdam * rewrote 7 param datum shift to match EPSG:9606, now works with example. 2001-03-20 Frank Warmerdam * Added -DPROJ_LIB=\"C:/PROJ/\" in src/makefile.vc to provide for a default proj data file search directory. * Added HOWTO-RELEASE document in CVS. 2001-03-15 Frank Warmerdam * src/pj_apply_gridshift.c: fixed bug in pj_load_nadgrids() which would sometimes result in the load function failing because of a buffer overrun in the grid list string. 2001-03-14 Frank Warmerdam * added nad/epsg database of translations between EPSG PCS/GCS codes and PROJ.4 definitions. 2001-02-24 Frank Warmerdam * Include +ellps in proj example as per suggestion from Michael DeChaine. 2001-02-07 Frank Warmerdam * Cleaned up various warnings when compiled with -Wall. 2001-02-03 Frank Warmerdam * Added cs2cs.1 man page, and minor updates to nad2nad.1 and proj.1. * Added pj_transform docs to pj_init.3. 2001-01-25 Frank Warmerdam * Fixed pj_init() check for WGS84 match as per Bart Adriaanse bug rep. 2000-12-15 Frank Warmerdam * src/makefile.vc: only delete proj.lib if it exists. 2000-12-01 Frank Warmerdam * Added proj.def to extra_dist in src/Makefile.am. 2000-11-29 Frank Warmerdam * Changed strtod() to proj_strtod() in strtod.c, and make use of it in dmstor() to avoid having stuff like "5d10" interpreted as exponential notation on MSVC. 2000-11-18 Frank Warmerdam * Patch from Craig Bruce to adjlon.c to avoid wrong results, and near-hangs when adjusting very large numbers. http://bugzilla.remotesensing.org/show_bug.cgi?id=27 Rel. 4.4.2 2000/09/22 ------------------------------------------------------------------------- 2000-09-22 Frank Warmerdam * Fixed src/Makefile.am install-exec-local target, and added geocent.h, and emess.h. Reissued 4.4.2 distribution files. * Update version to 4.4.2, in preparation for 4.4.2 release. * Ensure makefile.vc is distributed, and mention windows building in README. * Cast args to freev2() in bch2bps.c, and mk_cheby.c to avoid errors on the Cray. 2000-09-21 Frank Warmerdam * Added "sphere" to pj_ellps.c. 2000-07-06 Frank Warmerdam * Fixed bug in nad_init() with path for datum shifting files. * Implemented cs2cs program for transforming between coordinate systems including datum shifts. * Implemented proj=latlong pseudo-projection. * Implemented pj_transform() to transform from one coordinate system to another, including applying geocentric datum shifts, and NAD27 grid shifts. * Implemented 3/7 parameter geocentric datum shift support. * Added support for +datum, +towgs84, and +nadgrids parameters when defining PJ's (for pj_init()). Added datum_type, and datum_params to PJ structure. 2000-07-04 Frank Warmerdam * Patched proj.c to handle binary io properly on Windows and DOS. Patch submitted by Thomas Knudsen . 2000-04-26 Frank Warmerdam * Added #define USE_PROJUV to projects.h to allow apps to work properly against old and new version. 2000-04-04 Frank Warmerdam * Patch from Craig Bruce (cbruce@cubewerx.com) for PJ_ortho.c to make INVERSE() work well for points near zero. 2000-03-29 Frank Warmerdam * Added hard links for invproj->proj and invgeod->geod in src/Makefile.{am,in}. Rel. 4.4.1 2000/03/27 ------------------------------------------------------------------------- 2000-03-27 Frank Warmerdam * Issued V4.4.1 Release. * Re-added install target for NADCON data files when available. * At the suggestion of John Evans, I have rolled the nad conversion functions into the core library. * Updated COPYING file to MIT style license. Added man_proj.html in html directory. * Add rules to install nad data files in $(prefix)/share/proj. 2000-03-21 Frank Warmerdam * Converted to use libtool. * Wrote new configure.in, and use automake to generate makefiles. * Renamed UV to projUV to avoid conflicts on windows. * Reorganize ChangeLog, and start work on 4.4. Rel. 4.3.2 94/10/30 Base-line ------------------------------------------------------------------------- 95/4/27 Corrected rf factor for GRS67. Thanks to: Peter Shih tyshih@cc.nctu.edu.tw 95/6/3 Gave an initializing value for pj_errno. Someone's compiler ignored the whole module because nothing happened(!!!). Thanks to: Mark Crispin . 95/7/6 Corrected function pj_inv_mlfn for improper derivative code. Previous computations not in error but convergence was slower. Thanks to: Tony Fisher fisher@minster.york.ac.uk. 95/8/8 Added Swiss Oblique Mercator projection. CH1903 Swiss grid system parameters added to nad/world. added to nad/world file and N-somerc.ps.Z added to documentation notes. Thanks to: Daniel Ebneter, ebneter@iap.unibe.ch. 95/9/5 Changed declaration of "char c" to "int c" to more properly monitor error return value in pj_init.c. Thanks to: Alejo Hausner (ah@cs.princeton.edu) 95/9/10 Some minor file/internal name changes to facilitate xport to primitive systems. Documented entries unchanged. Rel. 4.3.1 94/2/16 Base-line ------------------------------------------------------------------------- 94/6/2 Transverse Mercator, spherical inverse fixed. Misplaced parenthsis. 94/10/5 Dropped dependency on FILENAME_MAX---too poorly defined in both POSIX and ANSI standards. Adopted MAX_PATH_FILENAME which is set to 1024 (should be enough for most cases). This should solve problem with HP installations. 94/10/29 Problems with ellipsoidal for of azimuthal equidistant (PJ_aeqd.c). Some discrepancies remain on comparison with Snyder's examples but felt due to his use of TI calculator. Procedure should be replaced with better geodesic routine. 94/10/29 Corrected and added examples to geod.1 documentation. 94/10/30 Added mkdir in nad/install otherwise nad2783 install may fail. Rel. 4.3 94/2/16 Base-line ------------------------------------------------------------------------- 94/3/13 Equidistant Conic forced es to 0, thus previous ellipsoid usage flawed. Correction to sign of convergence angle and other details in pj_factors.c. Lambert Conf. conic corrected for +lat_0=90. Convergence sign in pj_factors.c corrected to conform to Bomford's definition. Also procedure corrected for usage when projection returns some of its own factors. 94/3/17 Added procedure pj_phi12 to support library. It gets and checks standard parallels for some of the conics. Added SPECIAL entry to conics Lambert, Albers and Equidistant. Corrected nad/install.in test so as to only look for conus.lla.Z as test for installation of NADCON datum matricies. 94/3/19 Problems with MAPGEN's mapdef choking on call to proj. Fixed with PROJ.4.3-patch-01. 94/3/22 Bumb mode of handling memory allocation for 2D arrays, so that execution of -L may not work on some systems. Interim corrections distributed with PROJ.4.3-patch-02. Patched Make.2 to properly use $(LIBS). Not in patch. Apple's Unix libc has problems---no strerror and no %n in ?format. 94/5/22 Added several simple conics but not totally verified. Corrected proj.c so that resultant earth figure comments in -V are prefixed with # and do not blow *mapdef*. Releasing current code without documentation on new conics pending communications with Snyder on their veracity. Release mainly to clean up patches. Rel. 4.2.2 93/9/30 Base-line ------------------------------------------------------------------------- 93/11/14 1. Minor change to projects.h to correct prototype. 2. Changes to pj_init.c regarding ignoring failure to open proj_def.dat. 3. Alternate method of initializing automatic array. 93/11/16 DOS distribution. 93/11/28 Added "Final" figure line to beginning of -V option output. Allows user to see results of +ellps and +R_V, etc. arguments. "Feature," not an error. Mod to proj.c. 93/12/03 Removed non-ANSI usage of errno from PJ_laea. Added test for previous definition of NULL in strtod.c. 93/12/12 Made aatan2 (compensates for 0,0 args) global. 93/12/30 Removed proj "error" message at end of -l option list. 94/1 Major revision to projection structure to facilitate maintenance. Introduced PROJ_HEAD macro that is defined in several ways dependent upon use. Allows generation of pj_list table from `grep'ed projection files. Structure PJ now contains pointer to const string giving ascii description of projection. Limited application projection list much easier to generate with this system. Many new pseudocylindrical projections added as well as a few new miscellaneous projections. Total projection count now 110. Rel. 4.2.1 93/9/30 Base-line ------------------------------------------------------------------------- 93/10/3 Geod incorrectly computed some forward values when geodesic on the merdian. 93/11/2 Projection stere fails for polar cases because of 0 lat_ts. Fixed by testing for lat_ts specification and setting to 90 degrees when lat_ts not specified. UPS not affected. 93/11/5 Inverse polar stereographic also failed on 0 x xor y. Corrected. 93/11/10 Changed "install" to include "plain" system type for systems that do not require special consideration. Rel. 4.2 93/8/25 Base-line ------------------------------------------------------------------------- 93/9/13 Improved bch2bps.c code. Old code not in error. Still problems with DEC native C compiler. 93/9/28 Modified install script for DEC entry, forcing gcc for compilation. 93/9/29 Problem with due South forward in geod. Current version will not be fixed as it is to be replaced with Vincente algorithm. 93/9/30 Two corrections in src/Makefile. Rel. 4.1.3 93/4/15 Base-line ------------------------------------------------------------------------- 93/5/22 Extensively revised Chebychev approximation procedures and added conversion to power series. 93/6/8 Changed type of pj_param, plus mods to some other internal procedures. 93/6/13 Modified pj_factors. Principle mod was that calling program must provide base for structure FACTORS. Additional mods reflect optional analytic input from projection modules (see next entry). Modified base of PJ structure for projections to supply analytic values of partial derivatives, scale factors and/or convergence when formulary available. Added -V option for proj so as to provide more complete, verbose analysis of projection characteristics at selected geographic or cartesian point. 93/6/14 Pj_errno given its own module and projects.h declares it external. To cover ANSI standards related to global variable. SG linker should stop complaining. 93/7/15 Several additions and a couple of minor corrections to elliptical tables. 93/8/4 PJ_ocea.c error in applying k0. 93/8/19 Minor general corrections. Added nadcon conversion procedures and nad2nad program. Projects.h modified to reflect nadcon prototypes and structures. pj_open_lib extracted from pj_init and made global for use in nad_init. 93/8/25 Corrected pj_open_lib open for both binary and text modes. Mostly for brain damaged DOS. Also affected calls in pj_init.c and nad_init.c Installs and other scripts updated. Rel. 4.1.2 93/4/4 Base-line ------------------------------------------------------------------------- 93/4/8 Corrected pj_inv so that errno and pj_errno are reset on entry. 93/4/14 Added elliptical forms to Azimuthal Equidistant (aeqd). 93/4/15 Corrected positive error return to negative in PJ_lcc.c . Added Indian units conversions to pj_units. Rel. 4.1.1 93/3/26 Base-line ------------------------------------------------------------------------- 93/4/2 gen_cheby.c - added header. 93/4/3-4 gen_cheby.c, projects.h - corrected gen_cheby argument declarations related to 'proj' argument and prototype. Often signalled warnings, but still managed to execute OK. pj_init.c - local function get_init had insufficient storage defined for copy of file name and id. Added id define. Strncat replaced with correct strncpy (amazingly did not cause problems except of one system). Proj now compiles on DOS Microsoft 5.0 C compiler. MS suffers same brain-damage as DEC, so requires local strtod function. pj_strerrno prototype added to projects.h DOS option in strtod.c for MS C's lack of standard macros in neaders. Rel. 4.1 93/3/8 Base-line --- @(#)CHANGE-LOG 4.14 95/09/23 GIE REL ------------------------------------------------------------------------- 93/3/20 pj_init -- added +k_0 as alternative to +k so as to match documentation. 93/3/21 Laborde projection added. Primarily for Madagascar grid. Considered BETA at moment until info obtained to give adequate documentation. 93/3/26 Oblique Mercator modified to allow processing of Malasian Grid. +no_uoff and +rot_conv options added. 93/3/26 Corrected text in Interim Report: p. 12 - +phi's changed to +lat's p. 12 - added updated Oblique Mercator documentation Unresolved: Reports of errno 25 persist. Do not know what platform. Reviewed code and can't see problem. Unknown platform has problem with pj_errno global and linker storage allocation. Seems similar to SG problem that was over come with -common switch. proj-8.2.1/AUTHORS000644 000765 000024 00000002404 13612256475 014221 0ustar00keversstaff000000 000000 -------------------------------------------------------------------------------- Authors -------------------------------------------------------------------------------- Original Author ................................................................................ Gerald Evenden (1935-2016) Maintainer(s) ................................................................................ Kristian Evers Even Rouault Project Steering Committee -------------------------------------------------------------------------------- Process and membership can be found at: https://proj.org/community/rfc/rfc-1.html Chair ................................................................................ Kristian Evers Members ................................................................................ Frank Warmerdam Howard Butler Charles Karney Thomas Knudsen Even Rouault Kurt Schwehr Contributors -------------------------------------------------------------------------------- The full list of contributors can be found on GitHub https://github.com/OSGeo/PROJ/graphs/contributors proj-8.2.1/include/000755 000765 000024 00000000000 14164067213 014565 5ustar00keversstaff000000 000000 proj-8.2.1/proj.pc.in000644 000765 000024 00000000465 14162105274 015050 0ustar00keversstaff000000 000000 prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ datarootdir=@datarootdir@ datadir=@datadir@/@PACKAGE@ Name: PROJ Description: Coordinate transformation software library Requires: Version: @VERSION@ Libs: -L${libdir} -lproj Libs.private: @EXTRA_LIBS@ Cflags: -I${includedir} proj-8.2.1/config.guess000755 000765 000024 00000126206 13426641720 015472 0ustar00keversstaff000000 000000 #! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2018 Free Software Foundation, Inc. timestamp='2018-03-08' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess # # Please send patches to . me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > "$dummy.c" ; for c in cc gcc c89 c99 ; do if ($c -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "$UNAME_SYSTEM" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval "$set_cc_for_build" cat <<-EOF > "$dummy.c" #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" # If ldd exists, use it to detect musl libc. if command -v ldd >/dev/null && \ ldd --version 2>&1 | grep -q ^musl then LIBC=musl fi ;; esac # Note: order is significant - the case branches are not exclusive. case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ "/sbin/$sysctl" 2>/dev/null || \ "/usr/sbin/$sysctl" 2>/dev/null || \ echo unknown)` case "$UNAME_MACHINE_ARCH" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; earmv*) arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` machine="${arch}${endian}"-unknown ;; *) machine="$UNAME_MACHINE_ARCH"-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently (or will in the future) and ABI. case "$UNAME_MACHINE_ARCH" in earm*) os=netbsdelf ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval "$set_cc_for_build" if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # Determine ABI tags. case "$UNAME_MACHINE_ARCH" in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "$UNAME_VERSION" in Debian*) release='-gnu' ;; *) release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "$machine-${os}${release}${abi}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" exit ;; *:LibertyBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" exit ;; *:MidnightBSD:*:*) echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" exit ;; *:ekkoBSD:*:*) echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" exit ;; *:SolidBSD:*:*) echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:MirBSD:*:*) echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:Sortix:*:*) echo "$UNAME_MACHINE"-unknown-sortix exit ;; *:Redox:*:*) echo "$UNAME_MACHINE"-unknown-redox exit ;; mips:OSF1:*.*) echo mips-dec-osf1 exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE=alpha ;; "EV4.5 (21064)") UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") UNAME_MACHINE=alpha ;; "EV5 (21164)") UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`" # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix"$UNAME_RELEASE" exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux"$UNAME_RELEASE" exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval "$set_cc_for_build" SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH=x86_64 fi fi echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`" exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos"$UNAME_RELEASE" exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos"$UNAME_RELEASE" ;; sun4) echo sparc-sun-sunos"$UNAME_RELEASE" ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos"$UNAME_RELEASE" exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint"$UNAME_RELEASE" exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint"$UNAME_RELEASE" exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint"$UNAME_RELEASE" exit ;; m68k:machten:*:*) echo m68k-apple-machten"$UNAME_RELEASE" exit ;; powerpc:machten:*:*) echo powerpc-apple-machten"$UNAME_RELEASE" exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix"$UNAME_RELEASE" exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix"$UNAME_RELEASE" exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix"$UNAME_RELEASE" exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`"$dummy" "$dummyarg"` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos"$UNAME_RELEASE" exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ] then if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \ [ "$TARGET_BINARY_INTERFACE"x = x ] then echo m88k-dg-dgux"$UNAME_RELEASE" else echo m88k-dg-dguxbcs"$UNAME_RELEASE" fi else echo i586-dg-dgux"$UNAME_RELEASE" fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`" exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV" exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/lslpp ] ; then IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi echo "$IBM_ARCH"-ibm-aix"$IBM_REV" exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` case "$UNAME_MACHINE" in 9000/31?) HP_ARCH=m68000 ;; 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "$sc_cpu_version" in 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "$sc_kernel_bits" in 32) HP_ARCH=hppa2.0n ;; 64) HP_ARCH=hppa2.0w ;; '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi if [ "$HP_ARCH" = "" ]; then eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ "$HP_ARCH" = hppa2.0w ] then eval "$set_cc_for_build" # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH=hppa2.0w else HP_ARCH=hppa64 fi fi echo "$HP_ARCH"-hp-hpux"$HPUX_REV" exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux"$HPUX_REV" exit ;; 3050*:HI-UX:*:*) eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo "$UNAME_MACHINE"-unknown-osf1mk else echo "$UNAME_MACHINE"-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE" exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi"$UNAME_RELEASE" exit ;; *:BSD/OS:*:*) echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case "$UNAME_PROCESSOR" in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; i*:CYGWIN*:*) echo "$UNAME_MACHINE"-pc-cygwin exit ;; *:MINGW64*:*) echo "$UNAME_MACHINE"-pc-mingw64 exit ;; *:MINGW*:*) echo "$UNAME_MACHINE"-pc-mingw32 exit ;; *:MSYS*:*) echo "$UNAME_MACHINE"-pc-msys exit ;; i*:PW*:*) echo "$UNAME_MACHINE"-pc-pw32 exit ;; *:Interix*:*) case "$UNAME_MACHINE" in x86) echo i586-pc-interix"$UNAME_RELEASE" exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix"$UNAME_RELEASE" exit ;; IA64) echo ia64-unknown-interix"$UNAME_RELEASE" exit ;; esac ;; i*:UWIN*:*) echo "$UNAME_MACHINE"-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; *:GNU:*:*) # the GNU system echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`" exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" exit ;; i*86:Minix:*:*) echo "$UNAME_MACHINE"-pc-minix exit ;; aarch64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC=gnulibc1 ; fi echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arm*:Linux:*:*) eval "$set_cc_for_build" if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi else echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf fi fi exit ;; avr32*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; cris:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; crisv32:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; e2k:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; frv:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; hexagon:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:Linux:*:*) echo "$UNAME_MACHINE"-pc-linux-"$LIBC" exit ;; ia64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; k1om:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m32r*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m68*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`" test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; } ;; mips64el:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-"$LIBC" exit ;; or32:Linux:*:* | or1k*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; padre:Linux:*:*) echo sparc-unknown-linux-"$LIBC" exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-"$LIBC" exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; *) echo hppa-unknown-linux-"$LIBC" ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-"$LIBC" exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-"$LIBC" exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-"$LIBC" exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-"$LIBC" exit ;; riscv32:Linux:*:* | riscv64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" exit ;; sh64*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sh*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; tile*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; vax:Linux:*:*) echo "$UNAME_MACHINE"-dec-linux-"$LIBC" exit ;; x86_64:Linux:*:*) echo "$UNAME_MACHINE"-pc-linux-"$LIBC" exit ;; xtensa*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION" exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo "$UNAME_MACHINE"-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo "$UNAME_MACHINE"-unknown-stop exit ;; i*86:atheos:*:*) echo "$UNAME_MACHINE"-unknown-atheos exit ;; i*86:syllable:*:*) echo "$UNAME_MACHINE"-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos"$UNAME_RELEASE" exit ;; i*86:*DOS:*:*) echo "$UNAME_MACHINE"-pc-msdosdjgpp exit ;; i*86:*:4.*:*) UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" else echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL" fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}" exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL" else echo "$UNAME_MACHINE"-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos"$UNAME_RELEASE" exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos"$UNAME_RELEASE" exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos"$UNAME_RELEASE" exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos"$UNAME_RELEASE" exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv"$UNAME_RELEASE" exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo "$UNAME_MACHINE"-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo "$UNAME_MACHINE"-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux"$UNAME_RELEASE" exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv"$UNAME_RELEASE" else echo mips-unknown-sysv"$UNAME_RELEASE" fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux"$UNAME_RELEASE" exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux"$UNAME_RELEASE" exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux"$UNAME_RELEASE" exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux"$UNAME_RELEASE" exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux"$UNAME_RELEASE" exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux"$UNAME_RELEASE" exit ;; SX-ACE:SUPER-UX:*:*) echo sxace-nec-superux"$UNAME_RELEASE" exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Rhapsody:*:*) echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval "$set_cc_for_build" if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_PPC >/dev/null then UNAME_PROCESSOR=powerpc fi fi elif test "$UNAME_PROCESSOR" = i386 ; then # Avoid executing cc on OS X 10.9, as it ships with a stub # that puts up a graphical alert prompting to install # developer tools. Any system running Mac OS X 10.7 or # later (Darwin 11 and later) is required to have a 64-bit # processor. This is not true of the ARM version of Darwin # that Apple uses in portable devices. UNAME_PROCESSOR=x86_64 fi echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE" exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-*:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk"$UNAME_RELEASE" exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk"$UNAME_RELEASE" exit ;; NSR-*:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk"$UNAME_RELEASE" exit ;; NSV-*:NONSTOP_KERNEL:*:*) echo nsv-tandem-nsk"$UNAME_RELEASE" exit ;; NSX-*:NONSTOP_KERNEL:*:*) echo nsx-tandem-nsk"$UNAME_RELEASE" exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = 386; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo "$UNAME_MACHINE"-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux"$UNAME_RELEASE" exit ;; *:DragonFly:*:*) echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "$UNAME_MACHINE" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`" exit ;; i*86:rdos:*:*) echo "$UNAME_MACHINE"-pc-rdos exit ;; i*86:AROS:*:*) echo "$UNAME_MACHINE"-pc-aros exit ;; x86_64:VMkernel:*:*) echo "$UNAME_MACHINE"-unknown-esx exit ;; amd64:Isilon\ OneFS:*:*) echo x86_64-unknown-onefs exit ;; esac echo "$0: unable to guess system type" >&2 case "$UNAME_MACHINE:$UNAME_SYSTEM" in mips:Linux | mips64:Linux) # If we got here on MIPS GNU/Linux, output extra information. cat >&2 <&2 </dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = "$UNAME_MACHINE" UNAME_RELEASE = "$UNAME_RELEASE" UNAME_SYSTEM = "$UNAME_SYSTEM" UNAME_VERSION = "$UNAME_VERSION" EOF exit 1 # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: proj-8.2.1/depcomp000755 000765 000024 00000056020 14162103552 014515 0ustar00keversstaff000000 000000 #! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2018-03-07.03; # UTC # Copyright (C) 1999-2018 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: proj-8.2.1/missing000755 000765 000024 00000015336 14162103552 014544 0ustar00keversstaff000000 000000 #! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1996-2018 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=https://www.perl.org/ flex_URL=https://github.com/westes/flex gnu_software_URL=https://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: proj-8.2.1/README000644 000765 000024 00000005406 14162104164 014022 0ustar00keversstaff000000 000000 # PROJ PROJ is a generic coordinate transformation software, that transforms coordinates from one coordinate reference system (CRS) to another. This includes cartographic projections as well as geodetic transformations. For more information on the PROJ project please see the web page at: https://proj.org/ The PROJ mailing list can be found at: https://lists.osgeo.org/mailman/listinfo/proj/ See the NEWS file for changes between versions. The following command line utilities are included in the PROJ package: - `proj`: for cartographic projection of geodetic coordinates. - `cs2cs`: for transformation from one CRS to another CRS. - `geod`: for geodesic (great circle) computations. - `cct`: for generic Coordinate Conversions and Transformations. - `gie`: the Geospatial Integrity Investigation Environment. - `projinfo`: for geodetic object and coordinate operation queries. - `projsync`: for synchronizing PROJ datum and transformation support data. > More information on the utilities can be found on the [PROJ website](https://proj.org/apps). ## Installation Consult the [Installation](https://proj.org/install.html) page of the official documentation. For builds on the master branch, [install.rst](https://github.com/OSGeo/PROJ/blob/master/docs/source/install.rst) might be more up-to-date. ## Distribution files and format Sources are distributed in one or more files. The principle elements of the system are stored in a compressed tar file named `proj-x.y.z.tar.gz` where "x" will indicate the major release number, "y" indicates the minor release number, and "z" indicates the patch number of the release. In addition to the PROJ software package, distributions of datum conversion grid files and PROJ parameter files are also available. The grid package is distributed under the name `proj-data-x.y.zip`, where "x" is the major release version and "y" is the minor release version numbers. The resource packages can be downloaded from the [PROJ website](https://proj.org/download.html). More info on the contents of the proj-data package can be found at the [PROJ-data GitHub repository](https://github.com/OSGeo/PROJ-data). The resource file packages should be extracted to `PROJ_LIB` where PROJ will find them after installation. The default location of `PROJ_LIB` on UNIX-based systems is `/usr/local/share/proj` but it may be changed to a different directory. On Windows you have to define `PROJ_LIB` yourself. As an alternative to installing the data package on the local system, the resource files can be retrieved on-the-fly from the [PROJ CDN](https://cdn.proj.org/). A [network-enabled](https://proj.org/usage/network.html) PROJ build, will automatically fetch resource files that are not present locally from the CDN. ## Citing PROJ in publications See [CITATION](CITATION) proj-8.2.1/Makefile.am000644 000765 000024 00000000634 14017154140 015172 0ustar00keversstaff000000 000000 SUBDIRS = include src man data cmake DIST_SUBDIRS = include src man data cmake test EXTRA_DIST = CMakeLists.txt CITATION README.md dist_doc_DATA = COPYING NEWS AUTHORS pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = proj.pc AUTOMAKE_OPTIONS = dist-zip ACLOCAL_AMFLAGS = -I m4 check-local: cd test; $(MAKE) check all-local: README README: README.md fgrep -v "[![" $< > $@ clean-local: $(RM) README proj-8.2.1/README.md000644 000765 000024 00000007357 14067153334 014437 0ustar00keversstaff000000 000000 # PROJ [![Travis Status](https://travis-ci.com/OSGeo/PROJ.svg?branch=master)](https://travis-ci.com/OSGeo/PROJ) [![AppVeyor Status](https://ci.appveyor.com/api/projects/status/github/OSGeo/PROJ?branch=master&svg=true)](https://ci.appveyor.com/project/OSGeo/PROJ?branch=master) [![Docker build Status](https://img.shields.io/docker/cloud/build/osgeo/proj)](https://hub.docker.com/r/osgeo/proj/builds) [![Coveralls Status](https://coveralls.io/repos/github/OSGeo/PROJ/badge.svg?branch=master)](https://coveralls.io/github/OSGeo/PROJ?branch=master) [![Gitter](https://badges.gitter.im/OSGeo/proj.4.svg)](https://gitter.im/OSGeo/proj.4) [![Mailing List](https://img.shields.io/badge/PROJ-mailing%20list-4eb899.svg)](http://lists.osgeo.org/mailman/listinfo/proj) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v1.4%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md) PROJ is a generic coordinate transformation software, that transforms coordinates from one coordinate reference system (CRS) to another. This includes cartographic projections as well as geodetic transformations. For more information on the PROJ project please see the web page at: https://proj.org/ The PROJ mailing list can be found at: https://lists.osgeo.org/mailman/listinfo/proj/ See the NEWS file for changes between versions. The following command line utilities are included in the PROJ package: - `proj`: for cartographic projection of geodetic coordinates. - `cs2cs`: for transformation from one CRS to another CRS. - `geod`: for geodesic (great circle) computations. - `cct`: for generic Coordinate Conversions and Transformations. - `gie`: the Geospatial Integrity Investigation Environment. - `projinfo`: for geodetic object and coordinate operation queries. - `projsync`: for synchronizing PROJ datum and transformation support data. > More information on the utilities can be found on the [PROJ website](https://proj.org/apps). ## Installation Consult the [Installation](https://proj.org/install.html) page of the official documentation. For builds on the master branch, [install.rst](https://github.com/OSGeo/PROJ/blob/master/docs/source/install.rst) might be more up-to-date. ## Distribution files and format Sources are distributed in one or more files. The principle elements of the system are stored in a compressed tar file named `proj-x.y.z.tar.gz` where "x" will indicate the major release number, "y" indicates the minor release number, and "z" indicates the patch number of the release. In addition to the PROJ software package, distributions of datum conversion grid files and PROJ parameter files are also available. The grid package is distributed under the name `proj-data-x.y.zip`, where "x" is the major release version and "y" is the minor release version numbers. The resource packages can be downloaded from the [PROJ website](https://proj.org/download.html). More info on the contents of the proj-data package can be found at the [PROJ-data GitHub repository](https://github.com/OSGeo/PROJ-data). The resource file packages should be extracted to `PROJ_LIB` where PROJ will find them after installation. The default location of `PROJ_LIB` on UNIX-based systems is `/usr/local/share/proj` but it may be changed to a different directory. On Windows you have to define `PROJ_LIB` yourself. As an alternative to installing the data package on the local system, the resource files can be retrieved on-the-fly from the [PROJ CDN](https://cdn.proj.org/). A [network-enabled](https://proj.org/usage/network.html) PROJ build, will automatically fetch resource files that are not present locally from the CDN. ## Citing PROJ in publications See [CITATION](CITATION) proj-8.2.1/config.sub000755 000765 000024 00000106455 13426641720 015141 0ustar00keversstaff000000 000000 #! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2018 Free Software Foundation, Inc. timestamp='2018-03-08' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo "$1" exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ kopensolaris*-gnu* | cloudabi*-eabi* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo "$1" | sed 's/-[^-]*$//'` if [ "$basic_machine" != "$1" ] then os=`echo "$1" | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | ba \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ | e2k | epiphany \ | fido | fr30 | frv | ft32 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia16 | ia64 \ | ip2k | iq2000 \ | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 | or1k | or1knd | or32 \ | pdp10 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pru \ | pyramid \ | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | visium \ | wasm32 \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; leon|leon[3-9]) basic_machine=sparc-$basic_machine ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | ba-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | e2k-* | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia16-* | ia64-* \ | ip2k-* | iq2000-* \ | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pru-* \ | pyramid-* \ | riscv32-* | riscv64-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | visium-* \ | wasm32-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-pc os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; asmjs) basic_machine=asmjs-unknown ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2*) basic_machine=m68k-bull os=-sysv3 ;; e500v[12]) basic_machine=powerpc-unknown os=$os"spe" ;; e500v[12]-*) basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=$os"spe" ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; leon-*|leon[3-9]-*) basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'` ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=-linux ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i686-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; moxiebox) basic_machine=moxie-unknown os=-moxiebox ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i686-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; nsv-tandem) basic_machine=nsv-tandem ;; nsx-tandem) basic_machine=nsx-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh5el) basic_machine=sh5le-unknown ;; simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; x64) basic_machine=x86_64-pc ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases that might get confused # with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # es1800 is here to avoid being matched by es* (a different OS) -es1800*) os=-ose ;; # Now accept the basic system types. # The portable systems comes first. # Each alternative MUST end in a * to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* | -cloudabi* | -sortix* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* | -hcos* \ | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox* | -bme* \ | -midnightbsd*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -xray | -os68k* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo "$os" | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo "$os" | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo "$os" | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4*) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -pikeos*) # Until real need of OS specific support for # particular features comes up, bare metal # configurations are quite functional. case $basic_machine in arm*) os=-eabi ;; *) os=-elf ;; esac ;; -nacl*) ;; -ios) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; c8051-*) os=-elf ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; pru-*) os=-elf ;; *-be) os=-beos ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"` ;; esac echo "$basic_machine$os" exit # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: proj-8.2.1/COPYING000644 000765 000024 00000003370 14017154140 014171 0ustar00keversstaff000000 000000 All source, data files and other contents of the PROJ package are available under the following terms. Note that the PROJ 4.3 and earlier was "public domain" as is common with US government work, but apparently this is not a well defined legal term in many countries. Frank Warmerdam placed everything under the following MIT style license because he believed it is effectively the same as public domain, allowing anyone to use the code as they wish, including making proprietary derivatives. Initial PROJ 4.3 public domain code was put as Frank Warmerdam as copyright holder, but he didn't mean to imply he did the work. Essentially all work was done by Gerald Evenden. Copyright information can be found in source files. -------------- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. proj-8.2.1/compile000755 000765 000024 00000016327 14162103552 014524 0ustar00keversstaff000000 000000 #! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1999-2018 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: proj-8.2.1/NEWS000644 000765 000024 00000213765 14162105275 013656 0ustar00keversstaff000000 000000 8.2.1 Release Notes ------------------- Updates ------- o Database updated with EPSG v. 10.041 (#2974) Bug fixes --------- o BoundCRS WKT import: fix setting of name (#2917) o PROJStringFormatter::toString(): avoid invalid iterator increment (#2932) o Ensure CApi test are cross-platform (#2934) o createOperations(): do not stop at the first operation in the PROJ namespace for vertical transformations (#2937) o createOperationsCompoundToCompound(): fix null pointer dereference when connection to proj.db doesn't exist. (#2938) o Fix windows.h conflict with Criterion::STRICT (#2950) o Cache result of proj_get_type() to help for performance of proj_factors() (#2967) o createOperations(): improvement for "NAD83(CSRS) + CGVD28 height" to "NAD83(CSRS) + CGVD2013(CGG2013) height" (#2977) o WKT1 import: correctly deal with missing rectified_grid_angle parameter (#2986) o Fix and additional options for Peirce Quincuncial projections (#2978) o Fix build with Intel C++ compiler (#2995) 8.2.0 Release Notes ------------------- Announcements ------------- From PROJ 9.0.0 and onwards CMake will be the only build system bundled with the PROJ package. As a consequence support for Autotools builds will stop when the 8.2 branch of PROJ reaches end of life. We encourage everyone to adjust their build workflows as soon as possible and report any discrepancies discovered between Autotools and CMake builds. Details about the build system unification can be found in PROJ RFC 7. Updates ------- o Added the S2 projection (#2749) o Added support for Degree Sign on input (#2791) o ESRI WKT: add support for import/export of (non interrupted) Goode Homolosine (#2827) o Make filemanager aware of UWP Win32 API (#2831) o Add proj_create_conversion_pole_rotation_netcdf_cf_convention() to address netCDF datasets using a pole rotation method (#2835) o Emit better debug message when a grid isn't found (#2838) o Add support for GeodeticCRS using a Spherical planetocentric coordinate system (#2847) o PROJJSON: support additional properties allowed in id object (version, authority_citation, uri) for parity with WKT2:2019 (#2850) o Database layout modified to include "anchor" field to geodetic_datum and vertical_datum tables, consequently database layout version is increased to 1.2 (#2859) o proj_factors(): accept P to be a projected CRS (#2868) o Add IAU_2015 CRS definitions (#2876) o CRS::extractGeodeticCRS(): implement for DerivedProjectedCRS (#2877) o Added proj_trans_bounds() (#2882) o CMake: add a BUILD_APPS to be able to disable build of all applications (#2895) o CMake: generate invproj/invgeod binaries (symlinks on Unix, copy otherwise) (#2897) o CMake build: add generate_wkt1_parser and generate_wkt2_parser manual target, and logic to detect when they must be run (#2900) o Add fallback strategy for tinshift transform to use closest triangle for points not in any (#2907) o Database: update to EPSG v10.038 (#2910) o CMake: revise handling of symbol export and static builds (#2912) Bug fixes --------- o Fix O(n^2) performance patterns where n is the number of steps of a pipeline (#2820) o Detect ESRI WKT better in certain circumstances (#2823) o Fix performance issue on pipeline instanciation of huge (broken) pipelines (#2824) o Make sure to re-order projection parameters according to their canonical order if needed (#2842) o Fix database access across fork() when SQLite3 doesn't use pread[64]() (#2845) o Fix error in implementation of Inverse ellipsoidal orthographic projection that cause convergence to sometimes fail (#2853) o Fix handling of edge-case coordinates in invers ortho ellipsoidal oblique (#2855) o proj_normalize_for_visualization(): set input and output units when there are several alternative transformations (#2867) o CRS::identify(): fix ignoring CS order when identifying a geodetic CRS by a PROJ string with just the ellipsoid (#2881) o Fix CRS Equality with PROJ parameter order (#2887) o WKT concatenated operation parsing: fix when a axis order reversal conversion is the first or last operation (#2891) o WKT1 parser: recognize Lambert_Conformal_Conic as projection name for LCC 1SP or 2SP (#2893) o CMake: Always build gie if testing is requested (#2899) o Geographic 3D CRS: allow to export to WKT1:ESRI if only the GEOGCS is known (and thus extrapolating a VERTCS) (#2902) o lib_proj.cmake: add a PROJ::proj alias and add BUILD_INTERFACE include directories, so that proj can be used as a subdirectory of a larger project (#2913) THANKS TO --------- Thomas Knudsen Alan D. Snow Johannes Schauer Marin Rodrigues Howard Butler Geoff Evans Joris Van den Bossche marcus-elia Waheed Barghouthi snowman2 Ben Boeckel Mike Taves Javier Jimenez Shaw Brendan Jurd Kristian Evers Even Rouault 8.1.1 Release Notes ------------------- Updates ------- o EPSG Database updated to version 10.028 (#2773) Bug Fixes --------- o Include algorithm header file to avoid build errors on Alpine Linux (#2769) o CMake: fix installation of executables on iOS (#2766) o Associate extents to transformations of CRS's that include GEOIDMODEL (#2769) o Logging: avoid some overhead when logging is not enabled (#2775) o ortho: remove useless and invalid log trace (#2777) o CMake: remove external nlohmann_json from INTERFACE_LINK_LIBRARIES target (#2781) o reateOperations(): fix SourceTargetCRSExtentUse::NONE mode (#2783) o GeoTIFF grid reading: perf improvements (#2788) o Conversion::createUTM(): avoid integer overflow (#2796) o Inverse laea ellipsoidal: return PROJ_ERR_COORD_TRANSFM_OUTSIDE_PROJECTION_DOMAIN when appropriates (#2801) o Make sure that proj_crs_promote_to_3D returns a derived CRS (#2806) o createOperations(): fix missing deg<-->rad conversion when transforming with a CRS that has a fallback-to-PROJ4-string behaviour and is a BoundCRS of a GeographicCRS (#2808) o WKT2 import/export: preserve PROJ.4 CRS extension string in REMARKS[] (#2812) o BoundCRS: accept importing/exporting in WKT2 and PROJJSON the scope/area/extent/id attributes (#2815) o ConcatenatedOperation::fixStepsDirection(): fix bad chaining of steps when inverse map projection is involved in non-final step (#2819) THANKS TO --------- Brendan Jurd Kristian Evers Even Rouault 8.1.0 Release Notes ------------------- Updates ------- + Database o Update to EPSG v10.027 (#2751) o Decrease DB size by using WITHOUT ROWID tables (#2730) (#2647) o Add a ANALYZE step during proj.db creation allowing for faster lookups (#2729) o Added a PROJ.VERSION metadata entry (#2646) o Added NGO48 (EPSG:4273) to ETRS89 (EPSG:4258) triangulation-based transformation (#2554) o Additions to the norwegian NKG2020 transformation (#2548) o ESRI projection database updated to version 12.8 (#2717) + API additions o Added proj_get_geoid_models_from_database() function that returns a list of geoid models available for a given CRS (#2681) o Added proj_get_celestial_body_list_from_database that returns a list of celestial bodies in the PROJ database (#2667) o Added proj_get_celestial_body_name() (#2662) + Various improvements o proj_trans/cs2cs: If two operations have the same accuracy, use the one that is contained within a larger one (#2750) o Share SQLite database handle among all contexts (#2738) o Add proj/internal/mutex.hpp as compat layer for mingw32 for std::mutex (#2736) o projsync: make it filter out files not intended for the current version (#2725) o Improvements related to DerivedVerticalCRS using Change Unit and Height/Depth reversal methods (#2696) o Update internal nlohmann/json to 3.9.1, and add a CMake option to be able to use external nlohmann/json (#2686) o createFromUserInput(): change name of CRS built from URN combined references to match the convention of EPSG projected CRS (#2677) o Parse compound id with two authorities, like ESRI:103668+EPSG:5703 (#2669) o Added projinfo option --list-crs (supports --area) (#2663) o Added support for hyperbolic Cassini-Soldner (#2637) o Added capability to get SQL statements to add custom CRS in the database (#2577) Bug fixes --------- o Fix 'Please include winsock2.h before windows.h' warning with msys (#2692) o Minor changes to address lint in geodesic.c (#2752) o BoundCRS::identify(): avoid incompatible transformation for WKT1 / TOWGS84 export (#2747) o proj_create(): do not open proj.db if string is a PROJ string, even if proj_context_set_autoclose_database() has been set (#2735) o Fix export of transformation to PROJ string in a particular situation where CompoundCRS are involved (#2721) Thanks to --------- Howard Butler Alan D. Snow Roel van den Berg Heidi Vanparys Sveinung Himle 積丹尼 Dan Jacobson Nyall Dawson Javier Jimenez Shaw Charles Karney Mike Taves Kristian Evers Even Rouault 8.0.1 Release Notes ------------------- Updates ------- o Database: update to EPSG v10.018 (#2636) o Add transformations for CHGeo2004, Swiss geoid model (#2604) o Additions to the norwegian NKG2020 transformation (#2600) Bug fixes --------- o pj_vlog(): fix buffer overflow in case of super lengthy error message (#2693) o Revert "proj_create_crs_to_crs_from_pj(): do not use PROJ_SPATIAL_CRITERION_PARTIAL_INTERSECTION if area is specified" (#2679) o UTM: error out when value of +zone= is not an integer (#2672) o getCRSInfoList(): make result order deterministic (by increasing auth_name, code) (#2661) o createOperation(): make sure no to discard deprecated operations if the replacement uses an unknow grid (#2623) o Fix build on Solaris 11.4 (#2621) o Add mapping of ESRI Equal_Area projection method to EPSG (#2612) o Fix incorrect EPGS extent code for EPSG:7789>EPSG:4976 NKG transformation (#2599) o fix wrong capitalization of CHENyx06_ETRS.gsb (#2597) o createOperations(): improve handling of vertical transforms when when compound CRSs are used (#2592) o CRS::promoteTo3D(): propagate the extent from the 2D CRS (#2589) o createFromCRSCodesWithIntermediates(): improve performance when there is no match (#2583) o Fix proj_clone() to work on 'meta' coordinate operation PJ* objects that can be returned by proj_create_crs_to_crs() (#2582) o add PROJ_COMPUTE_VERSION, PROJ_VERSION_NUMBER, PROJ_AT_LEAST_VERSION macros (#2581) o Make proj_lp_dist() and proj_geod() work on a PJ* CRS object (#2570) o Fix gcc 11 -Wnonnull compilation warnings (#2559) o Fix use of uninitialized memory in gie tests (#2558) o createOperations(): fix incorrect height transformation between 3D promoted RGF93 and CH1903+ (#2555) THANKS TO --------- Dan Jacobson Sveinung Himle Mike Taves Javier Jimenez Shaw Kristian Evers Even Rouault 8.0.0 Release Notes ------------------- With the release of PROJ 8 the proj_api.h API is finally removed. See https://proj.org/development/migration.html for more info on how to migrate from the old to the proj.h API. With the removal of proj_api.h it has been possible to simplify error codes and messages given by the software. The error codes are exposed in the API. Several improvements has been made to the command line utilities as well as tweaks in the underlying API. Updates ------- o Public header file proj_api.h removed (#837) o Improved accuracy of the Mercator projection (#2397) o Copyright statement wording updated (#2417) o Allow cct to instantiate operations via object codes or names (#2419) o Allow @filename syntax in cct (#2420) o Added geocentric->topocentric conversion (+proj=topocentric) (#2444) o Update GeographicLib to version 1.51 (#2445) o Added option to allow export of Geographic/Projected 3D CRS in WKT1_GDAL (#2450) o Added --area and --bbox options in cs2cs to restrict candidate coordinate operations (#2466) o Added build time option to make PROJ_LIB env var tested last (#2476) o Added --authority switch in cs2cs to control where coordinate operations are looked for. C API function proj_create_crs_to_crs_from_pj() updated accordingly (#2477) o Error codes revised and exposed in the public API (#2487) o Added --accuracy options to projinfo. C API function proj_create_crs_to_crs_from_pj() updated accordingly (#2488) o Added proj_crs_is_derived() function to C API (#2496) o Enabled linking against static cURL on Windows (#2514) o Updated ESRI CRS database to 12.7 (10.8.1/2.6) (#2519) o Allow a WKT BoundCRS to use a PROJ string transformation (#2521) o Update to EPSG v10.015 (#2539) o Default log level set to PJ_LOG_ERROR (#2542) o CMake installs a pkg-config file proj.pc, where supported (#2547) Bug fixes --------- o Do not restrict longitude to [-90;90] range in spherical transverse Mercator forward projection (#2471) o createOperations(): fix Compound to Geog3D/Projected3D CRS with non-metre ellipsoidal height (#2500) o Avoid error messages to be emitted log level is set to PJ_LOG_NONE (#2527) o Close database connection when autoclose set to True (#2532) THANKS TO --------- Zac Miller Juan Hernando Thomas Knudsen Sveinung Himle Olli Raisa Nomit Rawat Modern Slave J.H. van de Water Guillaume Lostis Martin Steinisch Javier Jimenez Shaw Mateusz Łoskot Martijn Visser Alan D. Snow Mike Taves Nyall Dawson Charles Karney Kristian Evers Even Rouault 7.2.1 Release Notes ------------------- Updates ------- o Add metadata with the version number of the database layout (#2474) o Split coordinateoperation.cpp and test_operation.cpp in several parts (#2484) o Update to EPSG v10.008 (#2490) o Added the NKG 2008 and 2020 transformations in proj.db (#2495) Bug fixes --------- o Set CURL_ENABLED definition on projinfo build (#2405) o createBoundCRSToWGS84IfPossible(): make it return same result with a CRS built from EPSG code or WKT1 (#2412) o WKT2 parsing: several fixes related to map projection parameter units (#2428) o createOperation(): make it work properly when one of the CRS is a BoundCRS of a DerivedGeographicCRS (+proj=ob_tran +o_proj=lonlat +towgs84=....) (#2441) o WKT parsing: fix ingestion of WKT with a Geocentric CRS as the base of the projected CRS (#2443) o GeographicCRS::_isEquivalentTo(EQUIVALENT_EXCEPT_AXIS_ORDER_GEOGCRS): make it work when comparing easting,northing,up and northing,easting,up (#2446) o createOperation(): add a ballpark vertical transformation when dealing with GEOIDMODEL[] (#2449) o Use same arguments to printf format string for both radians and degrees in output by cct (#2453) o PRIMEM WKT handling: fixes on import for 'sexagesimal DMS' or from WKT1:GDAL/ESRI when GEOGCS UNIT != Degree; morph to ESRI the PRIMEM name on export (#2455) o createObjectsFromName(): in exact match, make looking for 'ETRS89 / UTM zone 32N' return only the exact match (#2462) o Inverse tmerc spherical: fix wrong sign of latitude when lat_0 is used (#2469) o Add option to allow export of Geographic/Projected 3D CRS in WKT1_GDAL (#2470) o Fix building proj.db with SQLite built with -DSQLITE_DQS=0 (#2480) o Include JSON Schema files in CMake builds (#2485) o createOperations(): fix inconsistent chaining exception when transforming from BoundCRS of projected CRS based on NTF Paris to BoundCRS of geog CRS NTF Paris (#2486) THANKS TO --------- Zac Miller Nomit Rawat Guillaume Lostis J.H. van de Water Kristian Evers Even Rouault 7.2.0 Release Notes ------------------- Updates ------- + Command line tools: o Add multi-line PROJ string export capability, and use it by default in projinfo (unless --single-line is specified) (#2381) + Coordinate operations: o +proj=col_urban projection, implementing a EPSG projection method used by a number of projected CRS in Colombia (#2395) o +proj=tinshift for triangulation-based transformations (#2344) o Added ellipsoidal formulation of +proj=ortho (#2361) + Database o Update to EPSG 10.003 and make code base robust to dealing with WKT CRS with DatumEnsemble (#2370) o Added Finland tinshift operations (#2392) o Added transformation from JGD2011 Geographic 3D to JGD2011 height using GSIGEO2011 (#2393) o Improve CompoundCRS identification and name morphing in VerticalCRS with ESRI WKT1 (#2386) o Added OGC:CRS27 and OGC:CRS83 CRS entries for NAD27 and NAD83 in longitude, latitude order (#2350) + API o Added temporal, engineering, and parametric datum PJ_TYPE enumerations (#2274) o Various improvements to context handling (#2329, #2331) o proj_create_vertical_crs_ex(): add a ACCURACY option to provide an explicit accuracy, or derive it from the grid name if it is known (#2342) o proj_crs_create_bound_crs_to_WGS84(): make it work on verticalCRS/compoundCRS such as EPSG:4326+5773 and EPSG:4326+3855 (#2365) o promoteTo3D(): add a remark with the original CRS identifier (#2369) o Added proj_context_clone (#2383) Bug fixes --------- o Avoid core dumps when copying contexts in certain scenarios (#2324) o proj_trans(): reset errno before attemptying a retry with a new coordinate operation (#2353) o PROJJSON schema corrected to allow prime meridians values with explicitly stating a unit (degrees assumed) (#2354) o Adjust createBoundCRSToWGS84IfPossible() and operation filtering (for POSGAR 2007 to WGS84 issues) (#2357) o createOperations(): several fixes affecting NAD83 -> NAD83(2011) (#2364) o WKT2:2019 import/export: handle DATUM (at top level object) with PRIMEM o WKT1_ESRI: fix import and export of CompoundCRS (#2389) THANKS TO --------- Alexander Saprykin Jeff McKenna Nyall Dawson Kai Pastor Juan Hernando Javier Jimenez Shaw Howard Butler Alan D. Snow Charles Karney Kristian Evers Even Rouault 7.1.1 Release Notes ------------------- Updates ------- o Added various Brazillian grids to the database #2277 o Added geoid file for Canary Islands to the database #2312 o Updated EPSG database to version 9.8.15 #2310 Bug fixes --------- o WKT parser: do not raise warning when parsing a WKT2:2015 TIMECRS whose TIMEUNIT is at the CS level, and not inside #2281 o Parse '+proj=something_not_latlong +vunits=' without +geoidgrids as a Projected3D CRS and not a compound CRS with a unknown datum #2289 o C API: Avoid crashing due to missing SANITIZE_CTX() in entry points #2293 o CMake build: Check "target_clones" before use #2297 o PROJ string export of +proj=krovak +czech: make sure we export +czech… #2301 o Helmert 2D: do not require a useless +convention= parameter #2305 o Fix a few spelling errors ("vgridshit" vs. "vgridshift") #2307 o Fix ability to identify EPSG:2154 as a candidate for 'RGF93_Lambert_93' #2316 o WKT importer: tune for Oracle WKT and 'Lambert Conformal Conic' #2322 o Revert compiler generated Fused Multiply Addition optimized routines #2328 THANKS TO --------- Jeff McKenna Kai Pastor Javier Jimenez Shaw Kristian Evers Even Rouault 7.1.0 Release Notes ------------------- Updates ------- + New transformations: o Add a +proj=defmodel transformation for multi-component time-based deformation models (#2206) + New projections: o Add square conformal projections from libproject: - Adams Hemisphere in a Square - Adams World in a Square I - Adams World in a Square II - Guyou - Pierce Quincuncial (#2148) o Adams Square II: map ESRI WKT to PROJ string, and implement iterative inverse method (#2157) o Added IGH Oceanic View projection (#2226) o Add wink2 inverse by generic inversion of forward method (#2243) + Database: o Update to EPSG 9.8.12, ESRI 10.8.1 and import scope and remarks for conversion (#2238) (#2267) o Map the Behrmann projection to cae when converting ESRI CRSes (#1986) o Support conversion of Flat_Polar_Quartic projection method (#1987) o Register 4 new Austrian height grids (see https://github.com/OSGeo/PROJ-data/pull/13) and handle 'Vertical Offset by Grid Interpolation (BEV AT)' method (#1989) o Add ESRI projection method mappings for Mercator_Variant_A, Mercator_Variant_B and Transverse_Cylindrical_Equal_Area and various grid mappings (#2020) (#2195) o Map ESRI Transverse_Mercator_Complex to Transverse Mercator (#2040) o Register grids for New Caledonia (see https://github.com/OSGeo/PROJ-data/pull/16) (#2051) (#2239) o Register NZGD2000 -> ITRF96 transformation for NZGD2000 database (#2248) o Register geoid file for UK added (see https://github.com/OSGeo//PROJ-data/pull/25() (#2250) o Register Slovakian geoid transformations with needed code changes (#2259) o Register Spanish SPED2ETV2 grid for ED50->ETRS89 (#2261) + API: o Add API function proj_get_units_from_database() (#2065) o Add API function proj_get_suggested_operation() (#2068) o Add API functions proj_degree_input() and proj_degree_output() (#2144) o Moved proj_context_get_url_endpoint & proj_context_get_user_writable_directory from proj_experimental.h to proj.h (#2162) o createFromUserInput(): allow compound CRS with the 2 parts given by names, e.g. 'WGS 84 + EGM96 height' (#2126) o createOperations(): when converting CompoundCRS<-->Geographic3DCrs, do not use discard change of ellipsoidal height if a Helmert transformation is involved (#2227) o proj_list_units() deprecated, superceeded by proj_get_units_from_database() o proj_list_angular_units() deprecated, superceeded by proj_get_units_from_database() + Optimizations: o tmerc/utm: add a +algo=auto/evenden_snyder/poder_engsager parameter (#2030) o Extended tmerc (Poder/Engsager): speed optimizations (#2036) o Approximate tmerc (Snyder): speed optimizations (#2039) o pj_phi2(): speed-up computation (and thus inverse ellipsoidal Mercator and LCC) (#2052) o Inverse cart: speed-up computation by 33% (#2145) o Extended tmerc: speed-up forward path by ~5% (#2147) + Various: o Follow PDAL's CMake RPATH strategy (#2009) o WKT import/export: add support for WKT1_ESRI VERTCS synta (#2024) o projinfo: add a --hide-ballpark option (#2127) o gie: implement a strict mode with (#2168) o Allow importing WKT1 COMPD_CS with a VERT_DATUM[Ellipsoid,2002] (#2229) o Add runtime checking that sqlite3 is >= 3.11 (#2235) Bug fixes --------- o createOperations(): do not remove ballpark transformation if there are only grid based operations, even if they cover the whole area of use (#2155) o createFromProjString(): handle default parameters of '+krovak +type=crs', and handle +czech correctly (#2200) o ProjectedCRS::identify(): fix identification of EPSG:3059 (#2215) o Database: add a 'WGS84' alias for the EPSG:4326 CRS (#2218) o Fixes related to CompoundCRS and BoundCRS (#2222) o Avoid 2 warnings about missing database indices (#2223) o Make projinfo --3d --boundcrs-to-wgs84 work better (#2224) o Many fixes regarding BoundCRS, CompoundCRS, Geographic3D CRS with non-metre units (#2234) o Fix identification of (one of the) ESRI WKT formulations of EPSG:3035 (#2240) o Avoid using deprecated and removed Windows API function with Mingw32 (#2246) o normalizeForVisualization(): make it switch axis for EPSG:5482 (RSRGD2000 / RSPS2000) (#2256) o Fix access violation in proj_context_get_database_metadata (#2260) THANKS TO --------- Martin Raspaud Jeroen Ooms Jeff McKenna Colin Doig Chris Mayo Chatziargyriou Eleftheria Bas Couwenberg B R S Recht 積丹尼 Dan Jacobson Alan D. Snow GitHub user @chrodger Pedro Venancio Olli Räisä John Krasting Andrei Marshalov Javier Jimenez Shaw Martin Dobias Howard Butler Nyall Dawson Mike Taves Kristian Evers Even Rouault 7.0.1 Release Notes ------------------- Updates ------- o Database: update to EPSG v9.8.9 #2141 Bug fixes --------- o Make tests independent of proj-datumgrid (#1995) o Add missing projection property tables (#1996) o Avoid crash when running against SQLite3 binary built with -DSQLITE_OMIT_AUTOINIT (#1999) o createOperations(): fix wrong pipeline generation with CRS that has +nadgrids= and +pm= (#2002) o Fix bad copy&replace pattern on HEALPix and rHEALPix projection names (#2007) o createUnitOfMeasure(): use full double resolution for the conversion factor (#2014) o Update README with info on PROJ-data (#2015) o utm/ups: make sure to set errno to PJD_ERR_ELLIPSOID_USE_REQUIRED if es==0 (#2045) o data/Makefile.am: remove bashism (#2048) o ProjectedCRS::identify(): tune it to better work with ESRI WKT representation of EPSG:2193 (#2059) o Fix build with gcc 4.8.5 (#2066) o Autotools/pkg-conf: Define datarootdir (#2069) o cs2cs: don't require +to for '{source_crs} {target_crs} filename...' syntax (#2081) o CMake: fix bug with find_package(PROJ) with macOS (#2082) o ESRI WKT import / identification: special case for NAD_1983_HARN_StatePlane_Colorado_North_FIPS_0501 with Foot_US unit (#2088) o ESRI WKT import / identification: special case for NAD_1983_HARN_StatePlane_Colorado_North_FIPS_0501 with Foot_US unit (#2089) o EngineeringCRS: when exporting to WKT1_GDAL, output unit and axis (#2092) o Use jtsk03-jtsk horizontal grid from CDN (#2098) o CMake: prefer to use use PROJ_SOURCE_DIR and PROJ_BINARY_DIR (#2100) o Fix wrong grids file name in esri.sql (#2104) o Fix identification of projected CRS whose name is close but not strictly equal to a ESRI alias (#2106) o Fix working of Helmert transform between the horizontal part of 2 compoundCRS (#2111) o Database: fix registration of custom entries of grid_transformation_custom.sql for geoid grids (#2114) o ESRI_WKT ingestion: make sure to identify to non-deprecated EPSG entry when possible (#2119) o Make sure that importing a Projected 3D CRS from WKT:2019 keeps the base geographic CRS as 3D (#2125) o createOperations(): improve results of compoundCRS to compoundCRS case (#2131) o hgridshift/vgridshift: defer grid opening when grid has already been opened (#2132) o Resolve a few shadowed declaration warnings (#2142) o ProjectedCRS identification: deal with switched 1st/2nd std parallels for LCC_2SP(#2153) o Fix Robinson inverse projection (#2154) o createOperations(): do not remove ballpark transformation if there are only grid based operations, even if they cover the whole area of use (#2156) o createFromCoordinateReferenceSystemCodes(): 'optimization' to avoid using C++ exceptions (#2161) o Ingestion of WKT1_GDAL: correctly map 'Cylindrical_Equal_Area' (#2167) o Add limited support for non-conformant WKT1 LAS COMPD_CS[] (#2172) o PROJ4 string import: take into correctly non-metre unit when the string looks like the one for WGS 84 / Pseudo Mercator (#2177) o io.hpp: avoid dependency to proj_json_streaming_writer.hpp (#2184) o Fix support of WKT1_GDAL with netCDF rotated pole formulation (#2186) THANKS TO --------- Mike Taves Chris Mayo Kristian Evers Even Rouault 7.0.0 Release Notes ------------------- The major feature in PROJ 7 is significantly improved handling of gridded models. This was implemented in RFC4 (https://proj.org/community/rfc/rfc-4.html). The main features of the RFC4 work is that PROJ now implements a new grid format, Geodetic TIFF grids, for exchaning gridded transformation models. In addition to the new grid format, PROJ can now also access grids online using a data store in the cloud. The grids that was previously available via the proj-datumgrid packages are now available in two places: 1. As a single combined data archive including all available resource files 2. From the cloud via https://cdn.proj.org In Addition, provided with PROJ is a utility called projsync that can be used download grids from the data store in the cloud. The use of the new grid format and the data from the cloud requires that PROJ is build against libtiff and libcurl. Both are optional dependencies to PROJ but it is highly encouraged that the software is build against both. ATTENTION: PROJ 7 will be last major release version that includes the proj_api.h header. The functionality in proj_api.h is deprecated and only supported in maintenance mode. It is inferior to the functionality provided by functions in the proj.h header and all projects still relying on proj_api.h are encouraged to migrate to the new API in proj.h. See https://proj.org/development/migration.html for more info on how to migrate from the old to the new API. Updates ------- o Added new file access API to proj.h #866 o Updated the name of the most recent version of the WKT2 standard from WKT2_2018 to WKT2_2019 to reflect the proper name of the standard (#1585) o Improvements in transformations from/to WGS 84 (Gxxxx) realizations and vertical <--> geog transormations #1608 o Update to version 1.50 of the geodesic library (#1629) o Promote proj_assign_context to proj.h from proj_experimental.h (#1630) o Add rotation support to the HEALPix projection (#1638) o Add c function proj_crs_create_bound_vertical_crs() (#1689) o Use Win32 Unicode APIs and expect all strings to be UTF-8 (#1765) o Improved name aliases lookup (#1827) o CMake: Employ better use of CTest with the BUILD_TESTING option (#1870) o Grid correction: fix handling grids spanning antimeridian (#1882) o Remove legacy CMake target name "proj" #1883 o projinfo: add --searchpaths switch (#1892) o Add +proj=set operation to set component(s) of a coordinate to a fixed value (#1896) o Add EPSG records for 'Geocentric translation by Grid Interpolation (IGN)' (gr3df97a.txt) and map them to new +proj=xyzgridshift (#1897) o Remove 'null' grid file as it is now a special hardcoded case in grid code (#1898) o Add projsync utility (#1903) o Make PROJ the CMake project name #1910 o Use relative directory to locate PROJ resource files (#1921) Bug fixes --------- o Horizontal grid shift: fix failures on points slightly outside a subgrid (#209) o Fix ASAN issue with SQLite3VFS class (#1902) o tests: force use of bash for proj_add_test_script_sh (#1905) Breaking changes ---------------- o Reject NTV2 files where GS_TYPE != SECONDS #1294 o On Windows the name of the library is now fixed to ``proj.lib`` instead of encoding the version number in the library name (#1581) o Require C99 compiler (#1624) o Remove deprecated JNI bindings (#1825) o Remove -ld option from proj and cs2cs (#1844) o Increase CMake minimum version from 3.5 to 3.9 (#1907) THANKS TO --------- Jeff McKenna Calum Robinson Anshul Singhvi Bas Couwenberg Mike Taves Alan D. Snow Charles Karney Kristian Evers Even Rouault 6.3.1 Release Notes ------------------- Updates ------- o Update the EPSG database to version 9.8.6 o Database: add mapping for gg10_smv2.mnt and gg10_sbv2.mnt French grids o Database: add mapping for TOR27CSv1.GSB Bug fixes --------- o Fix wrong use of derivingConversionRef() that caused issues with use of +init=epsg:XXXX by GDAL (affecting R spatial libraries) or in MapServer o fix exporting CoordinateSystem to PROJ JSON with ID o projinfo: use No. abbreviation instead of UTF-8 character (#1828) o CompoundCRS::identify(): avoid exception when horiz/vertical part is a BoundCRS o createOperations(): fix dealing with projected 3D CRS whose Z units != metre o WKT1_GDAL export: limit datum name massaging to names matching EPSG (#1835) o unitconvert with mjd time format: avoid potential integer overflow (ossfuzz 20072) o ProjectedCRS::identify(): fix wrong identification of some ESRI WKT linked to units o Database: add a geoid_like value for proj_method column of grid_alternatives, fix related entries and simplify/robustify logic to deal with EPSG 'Geographic3D to GravityRelatedHeight' methods o Fix ingestion of +proj=cea with +k_0 (#1881) o Fix performance issue, affecting PROJ.4 string generation of EPSG:7842 (#1913) o Fix identification of ESRI-style datum names starting with D_ but without alias (#1911) o cart: Avoid discontinuity at poles in the inverse case (#1906) o Various updates to make regression test suite pass with gcc on i386 (#1906) THANKS TO --------- Alan D. Snow GitHub user @russkel Gerrit Holl Anshul Singhvi Raven Kopelman Kristian Evers Even Rouault 6.3.0 Release Notes ------------------- Updates ------- o Database: tune accuracy of Canadian NTv1 file w.r.t NTv2 (#1812) o Modify verbosity level of some debug/trace messages (#1811) o projinfo: no longer call createBoundCRSToWGS84IfPossible() for WKT1:GDAL (#1810) o proj_trans: add retry logic to select other transformation if the best one fails. (#1809) o BoundCRS::identify(): improvements to discard CRS that aren't relevant (#1802) o Database: update to IGNF v3.1.0 (#1785) o Build: Only export symbols if building DLL (#1773) o Database: update ESRI entries with ArcGIS Desktop version 10.8.0 database (#1762) o createOperations(): chain operations whose middle CRSs are not identical but have the same datum (#1734) o import/export PROJJSON: support a interpolation_crs key to geoid_model (#1732) o Database: update to EPSG v9.8.4 (#1725) o Build: require SQLite 3.11 (#1721) o Add support for GEOIDMODEL (#1710) o Better filtering based on extent and performance improvements (#1709) Bug fixes --------- o Horizontal grid shift: fix issue on iterative inverse computation when switching between (sub)grids (#1797) o createOperations(): make filtering out of 'uninteresting' operations less aggressive (#1788) o Make EPSG:102100 resolve to ESRI:102100 (#1786) o ob_tran: restore traditional handling of +to_meter with pj_transform() and proj utility (#1783) o CRS identification: use case insensitive comparison for authority name (#1780) o normalizeForVisualization() and other methods applying on a ProjectedCRS: do not mess the derivingConversion object of the original object (#1746) o createOperations(): fix transformation computation from/to a CRS with +geoidgrids and +vunits != m (#1731) o Fix proj_assign_context()/pj_set_ctx() with pipelines and alternative coord operations (#1726) o Database: add an auxiliary concatenated_operation_step table to allow arbitrary number of steps (#1696) o Fix errors running gie-based tests in Debug mode on Windows (#1688) THANKS TO --------- Pedro Venancio Owen Rudge Nyall Dawson Mateusz Łoskot Markus Neteler Juergen E. Fischer Joaquim Luis Jeff McKenna Jakob Egger Guillaume Lostis GitHub user @yonarw Asa Packer Joe Mann Stephan Hügel Simon Schneegans R. Schmunk Alan D. Snow Chris Crook Howard Butler Fabrice Fontaine Kai Pastor Martin Desruisseaux Dalia Prizginiene Mike Taves Charles Karney Kristian Evers Even Rouault 6.2.1 Release Notes ------------------- Updates ------- o Update the EPSG database to version 9.8.2 Bug fixes ------- o Fixed erroneous spelling of "Potsdam" (#1573) o Calculate y-coordinate correctly in bertin1953 in all cases (#1579) o proj_create_crs_to_crs_from_pj(): make the PJ* arguments const PJ* (#1583) o PROJStringParser::createFromPROJString(): avoid potential infinite recursion (#1574) o Avoid core dump when setting ctx==NULL in functions proj_coordoperation_is_instantiable and proj_coordoperation_has_ballpark_transformation (#1590) o createOperations(): fix conversion from/to PROJ.4 CRS strings with non-ISO-kosher options and +towgs84/+nadgrids (#1602) o proj_trans_generic(): properly set coordinate time to HUGE_VAL when no value is passed to the function (#1604) o Fix support for +proj=ob_tran +o_proj=lonlat/latlong/latlon instead of only only allowing +o_proj=longlat (#1601) o Improve backwards compatibility of vertical transforms (#1613) o Improve emulation of deprecated +init style initialization (#1614) o cs2cs: autopromote CRS to 3D when there's a mix of 2D and 3D (#1563) o Avoid divisions by zero in odd situations (#1620) o Avoid compile error on Solaris (#1639) o proj_create_crs_to_crs(): fix when there are only transformations with ballpark steps (#1643) o PROJ string CRS ingester: recognize more unit-less parameters, and general handling of +key=string_value parameters (#1645) o Only call pkg-config in configure when necessary (#1652) o aeqd: for spherical forward path, go to higher precision ellipsoidal case when the point coordinates are super close to the origin (#1654) o proj_create_crs_to_crs(): remove elimination of Ballpark operations that caused transformation failures in some cases (#1665) o createOperations(): allow transforming from a compoundCRS of a bound verticalCRS to a 2D CRS (#1667) o Avoid segfaults in case of out-of-memory situations (#1679) o createOperations(): fix double vertical unit conversion from CompoundCRS to other CRS when the horizontal part of the projected CRS uses non-metre unit (#1683) o importFromWkt(): fix axis orientation for non-standard ESRI WKT (#1690) THANKS TO --------- R. Schmunk Jakob Egger Alan D. Snow Stephan Hügel Kai Pastor Kristian Evers Even Rouault 6.2.0 Release Notes ------------------- Updates ------- o Introduced PROJJSON, a JSON encoding of WKT2 (#1547) o Support CRS instantiation of OGC URN's (#1505) o Expose scope and remarks of database objects (#1537) o EPSG Database updated to version 9.7.0 (#1558) o Added C API function proj_grid_get_info_from_database() (#1494) o Added C API function proj_operation_factory_context_set_discard_superseded() (#1534) o Added C API function proj_context_set_autoclose_database() (#1566) o Added C API function proj_create_crs_to_crs_from_pj() (#1567) o Added C API function proj_cleanup() (#1569) Bug Fixes --------- o Fixed build failure on Solaris systems (#1554) THANKS TO --------- Version 6.2.0 is made possible by the following contributors: GitHub user @edechaux Michael D. Smith Matt Littlemore Kristian Evers Even Rouault 6.1.1 Release Notes ------------------- Updates ------- o Update EPSG registry to version 9.6.3 (1485) Bug Fixes --------- o Take the passed authority into account when identifying objects (#1466) o Avoid exception when transforming from NAD83 to projected CRS using NAD83(2011) (#1477) o Avoid off-by-one reading of name argument if name of resource file has length 1 (#1489) o Do not include PROJ_LIB in proj_info().searchpath when context search path is set (#1498) o Use correct delimeter for the current platform when parsing PROJ_LIB (#1497) o Do not confuse 'ID74' CRS with WKT2 ID[] node (#1506) o WKT1 importer: do case insensitive comparison for axis direction (#1509) o Avoid compile errors on GCC 4.9.3 (#1512) o Make sure that pipelines including +proj=ob_tran can be created (#1526) THANKS TO ------------ Version 6.1.1 is made possible by the following contributors: Alan D. Snow Paul Menzel Mateusz Łoskot Bas Couwenberg Peter Limkilde Svendsen Mike Taves Howard Butler Nyall Dawson Andrew Bell Kristian Evers Even Rouault 6.1.0 Release Notes ------------------- Updates ------- o Include custom ellipsoid definitions from QGIS (#1337) o Add "-k ellipsoid" option to projinfo (#1338) o Make cs2cs support 4D coordinates (#1355) o WKT2 parser: update to OGC 18-010r6 (#1360 #1366) o Update internal version of googletest to v1.8.1 (#1361) o Database update: EPSG v9.6.2 (#1462), IGNF v3.0.3, ESRI 10.7.0 and add operation_version column (#1368) o Add proj_normalize_for_visualization() that attempts to apply axis ordering as used by most GIS applications and PROJ <6 (#1387) o Added noop operation (#1391) o Paths set by user take priority over PROJ_LIB for search paths (#1398) o Reduced database size (#1438) o add support for compoundCRS and concatenatedOperation named from their components (#1441) Bug fixes --------- o Have gie return non-zero code when file can't be opened (#1312) o CMake cross-compilation fix (#1316) o Use 1st eccentricity instead of 2nd eccentricity in Molodensky (#1324) o Make sure to include grids when doing Geocentric to CompoundCRS with nadgrids+geoidgrids transformations (#1326) o Handle coordinates outside of bbox better (#1333) o Enable system error messages in command line automatically in builds (#1336) o Make sure to install projinfo man page with CMake (#1347) o Add data dir to pkg-config file proj.pc (#1348) o Fix GCC 9 warning about useless std::move() (#1352) o Grid related fixes (#1369) o Make sure that ISO19111 C++ code sets pj_errno on errors (#1405) o vgridshift: handle longitude wrap-around for grids with 360deg longitude extent (#1429) o proj/cs2cs: validate value of -f parameter to avoid potential crashes (#1434) o Many division by zero and similar bug fixes found by OSS Fuzz. THANKS TO ------------ Version 6.1.0 is made possible by the following contributors: Andrew Hardin Sean Warren Dan Baston Howard Butler Joris Van den Bossche Elliott Sales de Andrade Alan D. Snow Nyall Dawson Chris Mayo Mike Taves Kristian Evers Even Rouault 6.0.0 Release Notes ------------------- PROJ 6 has undergone extensive changes to increase its functional scope from a cartographic projection engine with so-called "early-binding" geodetic datum transformation capabilities to a more complete library supporting coordinate transformations and coordinate reference systems. As a foundation for other enhancements, PROJ now includes a C++ implementation of the modelisation propopsed by the ISO-19111:2019 standard / OGC Abstract Specification Topic 2: "Referencing By Coordinates", for geodetic reference frames (datums), coordinate reference systems and coordinate operations. Construction and query of those geodetic objects is available through a new C++ API, and also accessible for the most part from bindings in the C API. Those geodetic objects can be imported and exported from and into the OGC Well-Known Text format (WKT) in its different variants: ESRI WKT, GDAL WKT 1, WKT2:2015 (ISO 19162:2015) and WKT2:2018 (ISO 19162:2018). Import and export of CRS objects from and into PROJ strings is also supported. This functionality was previously available in the GDAL software library (except WKT2 support which is a new feature), and is now an integral part of PROJ. A unified database of geodetic objects, coordinate reference systems and their metadata, and coordinate operations between those CRS is now available in a SQLite3 database file, proj.db. This includes definitions imported from the IOGP EPSG dataset (v9.6.0 release), the IGNF (French national mapping agency) geodetic registry and the ESRI projection engine database. PROJ is now the reference software in the "OSGeo C stack" for this CRS and coordinate operation database, whereas previously this functionality was spread over PROJ, GDAL and libgeotiff, and used CSV or other adhoc text-based formats. Late-binding coordinate operation capabilities, that takes metadata such as area of use and accuracy into account, has been added. This can avoid in a number of situations the past requirement of using WGS84 as a pivot system, which could cause unneeded accuracy loss, or was not doable at all sometimes when transformation to WGS84 was not available. Those late-binding capabilities are now used by the proj_create_crs_to_crs() function and the cs2cs utility. A new command line utility, projinfo, has been added to query information about a geodetic object of the database, import and export geodetic objects from/into WKT and PROJ strings, and display coordinate operations available between two CRSs. UPDATES ------- o Removed projects.h as a public interface (#835) o Deprecated the proj_api.h interface. The header file is still available but will be removed with the next major version release of PROJ. It is now required to define ACCEPT_USE_OF_DEPRECATED_PROJ_API_H before the interface can be used (#836) o Removed support for the nmake build system (#838) o Removed support for the proj_def.dat defaults file (#201) o C++11 required for building PROJ (#1203) o Added build dependency on SQLite 3.7 (#1175) o Added projinfo command line application (#1189) o Added many functions to proj.h for handling ISO19111 functionality (#1175) o Added C++ API exposing ISO19111 functionality (#1175) o Updated cs2cs to use late-binding features (#1182) o Removed the nad2bin application. Now available in the proj-datumgrid git repository (#1236) o Removed support for Chebyshev polynomials in proj (#1226) o Removed proj_geocentric_latitude from proj.h API (#1170) o Changed behaviour of proj: Now only allow initialization of projections (#1162) o Changed behaviour of tmerc: Now default to the Extended Transverse Mercator algorithm (etmerc). Old implementation available by adding +approx (#404) o Chaged behaviour: Default ellipsoid now set to GRS80 (was WGS84) (#1210) o Allow multiple directories in PROJ_LIB environment variable (#1281) o Added Lambert Conic Conformal (2SP Michigan) projection (#1142) o Added Bertin1953 projection (#1133) o Added Tobler-Mercator projection (#1153) o Added Molodensky-Badekas transform (#1160) o Added push and pop coordinate operations (#1250) o Removed +t_obs parameter from helmert and deformation (#1264) o Added +dt parameter to deformation as replacement for removed +t_obs (#1264) BUG FIXES --------- o Read +towgs84 values correctly on locales not using dot as comma separator (#1136) o Fixed file offset for reading of shift values in NTv1 files (#1144) o Avoid problems with PTHREAD_MUTEX_RECURSIVE when using CMake (#1158) o Avoid raising errors when setting ellipsoid flattening to zero (#1191) o Fixed lower square calculations in rHealpix projection (#1206) o Allow Molodensky transform parameters to be zero (#1194) o Fixed wrong parameter in ITRF2000 init file (#1240) o Fixed use of grid paths including spaces (#1152) o Robinson: fix wrong values for forward path for latitudes >= 87.5 (#1172), and fix inaccurate inverse method. THANKS TO ------------ Version 6.0.0 is made possible by the following contributors: Aaron Puchert Thomas Knudsen Phil Elson Mateusz Łoskot Markus Neteler Jürgen Fischer Charles Karney Bas Couwenberg Karoline Skaar Alan D. Snow Howard Butler Marco Bernasocchi Ben Boeckel Ivan Veselov Philippe Rivière Mike Taves Elliott Sales de Andrade Kai Pastor Kristian Evers Even Rouault 5.2.0 Release Notes ------------------- UPDATES ------- o Added support for deg, rad and grad in unitconvert (#1054) o Assume +t_epoch as time input when not otherwise specified (#1065) o Added inverse Lagrange projection (#1058) o Added +multiplier option to vgridshift (#1072) o Added Equal Earth projection (#1085) o Added "require_grid" option to gie (#1088) o Replace +transpose option of Helmert transform with +convention. From now on the convention used should be explicitly written. An error will be returned when using the +transpose option (#1091) o Improved numerical precision of inverse spherical Mercator projection (#1105) o cct will now forward text after coordinate input to output stream (#1111) BUG FIXES ------------ o Do not pivot over WGS84 when doing cs2cs-emulation with geocent (#1026) o Do not scan past the end of the read data in pj_ctx_fgets (#1042) o Make sure proj_errno_string() is available in DLL (#1050) o Respect +to_meter setting when doing cs2cs-emulation (#1053) o Fixed unit conversion factors for geod (#1075) o Fixed test failures related to GCC 8 (#1084) o Improved handling of +geoc flag (#1093) o Calculate correct projection factors for Webmercator (#1095) o cs2cs now always outputs degrees when transformed coordinates are in angular units (#1112) All bug fix numbers refer to issues or pull requests indexed at https://github.com/OSGeo/proj.4/ THANKS TO ------------ Version 5.2.0 is made possible by the following contributors: Søren Holm Mateusz Łoskot Jürnjakob Dugge Greg Minshall Aaron Puchert Vedran Stojnović Bojan Šavrič Charles Karney Mateusz Loskot Howard Butler Mike Toews Kurt Schwehr Even Rouault Kristian Evers 5.1.0 Release Notes ------------------- UPDATES ------- o Function proj_errno_string() added to proj.h API (#847) o Validate units between pipeline steps and ensure transformation sanity (#906) o Print help when calling cct and gie without arguments (#907) o CITATION file added to source distribution (#914) o Webmercator operation added (#925) o Enhanced numerical precision of forward spherical Mercator near the Equator (#928) o Added --skip-lines option to cct (#923) o Consistently return NaN values on NaN input (#949) o Removed unused src/org_proj4_Projections.h file (#956) o Java Native Interface bindings updated (#957, #969) o Horizontal and vertical gridshift operations extended to the temporal domain (#1015) BUG FIXES ------------ o Handle nan float cast overflow in PJ_robin.c and nad_intr.c (#887) o Avoid overflow when Horner order is unreasonably large (#893) o Avoid unwanted NaN conversions in etmerc (#899) o Avoid memory failure in gie when not specifying x,y,z in gie files (#902) o Avoid memory failure when +sweep is initialized incorrectly in geos (#908) o Return HUGE_VAL on erroneous input in ortho (#912) o Handle commented lines correctly in cct (#933) o Avoid segmentation fault when transformation coordinates outside grid area in deformation (#934) o Avoid doing false easting/northing adjustments on cartesian coordinates (#936) o Thread-safe creation of proj mutex (#954) o Avoid errors when setting up geos with +lat_0!=0 (#986) o Reset errno when running proj in verbose mode (#988) o Do not interpolate node values at nodata value in vertical grid shifts (#1004) o Restrict Horner degrees to positive integer values to avoid memory allocation issues (#1005) All bug fix numbers refer to issues or pull requests indexed at https://github.com/OSGeo/proj.4/ THANKS TO ------------ Version 5.1.0 is made possible by the following contributors: Kristian Evers Even Rouault Kurt Schwehr Mike Toews Martin Desruisseaux Charles Karney Thomas Knudsen Javier Goizueta Bas Couwenberg Adam Wulkiewicz Aaron Puchert 5.0.1 Release Notes ------------------- BUG FIXES ------------ All bug fix numbers refer to issues or pull requests indexed at https://github.com/OSGeo/proj.4/ o Handle ellipsoid change correctly in pipelines when +towgs84=0,0,0 is set #881 o Handle the case where nad_ctable2_init returns NULL #883 o Avoid shadowed declaration errors with old gcc #880 o Expand +datum properly +datum in pipelines #872 o Fail gracefully when incorrect headers are encountered in grid files #875 o Improve roundtrip stability in pipelines using +towgs84 #871 o Fixed typo in gie error codes #861 o Numerical stability fixes to the geodesic package #826 #843 o Make sure that transient errors are returned correctly #857 o Make sure that locally installed header files are not used when building PROJ #849 o Fix inconsistent parameter names in proj.h/proj_4D_api.c #842 o Make sure +vunits is applied #833 o Fix incorrect Web Mercator transformations #834 THANKS TO ------------ Version 5.0.1 is made possible by the following contributors: Mike Toews Kurt Schwehr Even Rouault Charles Karney Thomas Knudsen Kristian Evers 5.0.0 Release Notes ------------------- This version of PROJ introduces some significant extensions and improvements to (primarily) the geodetic functionality of the system. The main driver for introducing the new features is the emergence of dynamic reference frames, the increasing use of high accuracy GNSS, and the related growing demand for accurate coordinate transformations. While older versions of PROJ included some geodetic functionality, the new framework lays the foundation for turning PROJ into a generic geospatial coordinate transformation engine. The core of the library is still the well established projection code. The new functionality is primarily exposed in a new programming interface and a new command line utility, "cct" (for "Coordinate Conversion and Transformation"). The old programming interface is still available and can - to some extent - use the new geodetic transformation features. The internal architecture has also seen many changes and much improvement. So far, these improvements respect the existing programming interface. But the process has revealed a need to simplify and reduce the code base, in order to support sustained active development. !!! !!! Therefore we have scheduled regular releases over the coming years !!! which will gradually remove the old programming interface. !!! !!! This will cause breaking changes with the next two major version !!! releases, which will affect all projects that depend on PROJ !!! (cf. section "deprecations" below). !!! The decision to break the existing API has not been easy, but has ultimately been deemed necessary to ensure the long term survival of the project. Not only by improving the maintainability immensely, but also by extending the potential user (and hence developer) community. The end goal is to deliver a generic coordinate transformation software package with a clean and concise code base appealing to both users and developers. VERSIONING AND NAMING --------------------- For the first time in more than 25 years the major version number of the software is changed. The decision to do this is based on the many new features and new API. While backwards compatibility remains - except in a few rare corner cases - the addition of a new and improved programming interface warrants a new major release. The new major version number unfortunately leaves the project in a bit of a conundrum regarding the name. For the majority of the life-time of the product it has been known as PROJ.4, but since we have now reached version 5 the name is no longer aligned with the version number. Hence we have decided to decouple the name from the version number and from this version and onwards the product will simply be called PROJ. In recognition of the history of the software we are keeping PROJ.4 as the *name of the organizing project*. The same project team also produces the datum-grid package. In summary: o The PROJ.4 project provides the product PROJ, which is now at version 5.0.0. o The foundational component of PROJ is the library libproj. o Other PROJ components include the application proj, which provides a command line interface to libproj. o The PROJ.4 project also distributes the datum-grid package, which at the time of writing is at version 1.6.0. UPDATES ------- o Introduced new API in proj.h. - The new API is orthogonal to the existing proj_api.h API and the internally used projects.h API. - The new API adds the ability to transform spatiotemporal (4D) coordinates. - Functions in the new API use the "proj_" namespace. - Data types in the new API use the "PJ_" namespace, with a few historic exceptions such as XY, XYZ, LP and LPZ. o Introduced the concept of "transformation pipelines" that makes it possible to do complex geodetic transformations of spatiotemporal coordinates by daisy chaining simple coordinate operations. o Introduced cct, the Coordinate Conversion and Transformation application. o Introduced gie, the Geospatial Integrity Investigation Environment. - Selftest invoked by -C flag in proj has been removed - Ported approx. 1300 built-in selftests to gie format - Ported approx. 1000 tests from the gigs test framework - Added approx. 200 new tests o Adopted terminology from the OGC/ISO-19100 geospatial standards series. Key definitions are: - At the most generic level, a *coordinate operation* is a change of coordinates, based on a one-to-one relationship, from one coordinate reference system to another. - A *transformation* is a coordinate operation in which the two coordinate reference systems are based on different datums, e.g. a change from a global reference frame to a regional frame. - A *conversion* is a coordinate operation in which both coordinate reference systems are based on the same datum, e.g. change of units of coordinates. - A *projection* is a coordinate conversion from an ellipsoidal coordinate system to a plane. Although projections are simply conversions according to the standard, they are treated as separate entities in PROJ as they make up the vast majority of operations in the library. o New operations: - The pipeline operator (pipeline) - Transformations: + Helmert transform (helmert) + Horner real and complex polynomial evaluation (horner) + Horizontal gridshift (hgridshift) + Vertical gridshift (vgridshift) + Molodensky transform (molodensky) + Kinematic gridshift with deformation model (deformation) - Conversions: + Unit conversion (unitconvert) + Axis swap (axisswap) - Projections: + Central Conic projection (ccon) o Significant documentation updates, including - Overhaul of the structure of the documentation - A better introduction to the use of PROJ - A complete reference to the new proj.h API - a complete rewrite of the section on geodesic calculations - Figures for all projections o New "free format" option for operation definitions, which permits separating tokens by whitespace when specifying key/value- pairs, e.g. "proj = merc lat_0 = 45". o Added metadata to init-files that can be read with the proj_init_info() function in the new proj.h API. o Added ITRF2000, ITRF2008 and ITRF2014 init-files with ITRF transformation parameters, including plate motion model parameters. o Added ellipsoid parameters for GSK2011, PZ90 and "danish". The latter is similar to the already supported andrae ellipsoid, but has a slightly different semimajor axis. o Added Copenhagen prime meridian. o Updated EPSG database to version 9.2.0. o Geodesic library updated to version 1.49.2-c. o Support for analytical partial derivatives has been removed. o Improved performance in Winkel Tripel and Aitoff. o Introduced pj_has_inverse() function to proj_api.h. Checks if an operation has an inverse. Use this instead of checking whether P->inv exists, since that can no longer be relied on. o ABI version number updated to 13:0:0. o Removed support for Windows CE. o Removed the VB6 COM interface. BUG FIXES ------------ All bug fix numbers refer to issues indexed at https://github.com/OSGeo/proj.4/issues/ o Fixed incorrect convergence calculation in Lambert Conformal Conic. #16. o Handle ellipsoid parameters correctly when using +nadgrids=@null. #22. o Return correct latitude when using negative northings in Transverse Mercator (tmerc). #138. o Return correct result at origin in inverse Modified Stereographic of Alaska. #161. o Return correct result at origin in inverse Modified Stereographic of 48 U.S. #162. o Return correct result at origin in inverse Modified Stereographic of 50 U.S. #163. o Return correct result at origin in inverse Lee Oblated Stereographic. #164. o Return correct result at origin in inverse Miller Oblated Stereographic. #164. o Fixed scaling and wrap-around issues in Oblique Cylindrical Equal Area. #166. o Corrected a coefficient error in inverse Transverse Mercator. #174. o Respect -r flag when calling proj with -V. #184. o Remove multiplication by 2 at the equator error in Stereographic projection. #194. o Allow +alpha=0 and +gamma=0 when using Oblique Mercator. #195. o Return correct result of inverse Oblique Mercator when alpha is between 90 and 270. #331. o Avoid segmentation fault when accessing point outside grid. #369. o Avoid segmentation fault on NaN input in Robin inverse. #463. o Very verbose use of proj (-V) on Windows is fixed. #484. o Fixed memory leak in General Oblique Transformation. #497. o Equations for meridian convergence and partial derivatives have been corrected for non-conformal projections. #526. o Fixed scaling of cartesian coordinates in pj_transform(). #726. o Additional bug fixes courtesy of Google's OSS-Fuzz program: https://bugs.chromium.org/p/oss-fuzz/issues/list?can=1&q=proj4 DEPRECATIONS ------------ o The projects.h header and the functions related to it is considered deprecated from version 5.0.0 and onwards. !!! PROJECTS.H WILL BE REMOVED FROM THE LIBRARY !!! !!! WITH VERSION 6.0.0 !!! o The nmake build system on Windows will not be supported from version 6.0.0 on onwards. Use CMake instead. !!! NMAKE BUILD SYSTEM WILL BE REMOVED FROM THE LIBRARY !!! !!! WITH VERSION 6.0.0 !!! o The proj_api.h header and the functions related to it is consided deprecated from version 5.0.0 and onwards. !!! PROJ_API.H WILL BE REMOVED FROM THE LIBRARY !!! !!! WITH VERSION 7.0.0 !!! THANKS TO ------------ Version 5.0.0 is made possible by the following contributors: Lukasz Komsta Maxim Churilin edechaux dusanjovic Zoltan Siki Tom Fili Nicolas David Mike Toews Micah Cochran Luke Campbell Ilya Oshchepkov Adam Wulkiewicz Jonas Tittmann Mateusz Loskot Etienne Jacques Bas Couwenberg Elliott Sales de Andrade Charles Karney Aaron Puchert Julien Moquet Charles Karney Howard Butler Even Rouault Thomas Knudsen Kristian Evers 4.9.3 Release Notes ------------------- o UTM now uses etmerc, following NGA recommendations. Tests adjusted for tiny changes in values. o new projections: Times, Natural Earth II, Compact Miller, Patterson Cylindrical, and inverse for Hammer and Eckert-Greifendorff. o runtime self tests are now opt-in instead of opt-out o math constants moved to projects.h o bugfixes o New (optional) runtime self tests added to proj 4.9.2 Release Notes ------------------- o proj_def.dat was missing from source distribution see https://github.com/OSGeo/proj.4/issues/274 for more detail o Update Geodesic library from GeographicLib o Remove setlocale() use in pj_init_ctx() o Renamed PVALUE in pj_param.c to prevent clash with Windows 4.9.1 Release Notes ------------------- o 4.9.0RC2 release was abandoned because it was not promoted in a timely fashion. Subsequent maintenance of tickets has continued, and a new 4.9.1 release was issued in its place. o Implement inverse solution for Winkel Tripel from Drazan Tutic #250 o More CMake configuration tweaks. The CMake configuration is probably not at feature parity with the autotools builds at this point but it is converging #256 o Tweak initialization ordering around setlocal which may have caused issues #237 o Support out-of-tree autoconf builds more completely #247 o Fix NaN handling by geod_inverse and geod_polygon_addedge #251 & #253 o Update config.sub and config.guess #257 o Adapt Charles Karney's CMake patches for smoother build #258 o Define default PROJ_LIB location for CMake compilation #261 o Fix Windows compilation on PJ_aitoff.c o Align CMake SOVERSION with autotools #263 o Regenerate nad/epsg with GDAL r28536 to avoid precision loss in TOWGS84 parameters, e.g. on Amersfoort / RD EPSG:4289 (#260) o Add CMake project-config.cmake scripts (#264 from Charles Karney) o Dial back test sensitivity #255 4.9.0 Release Notes ------------------- o Implement CMake as an option for building PROJ.4 o Implement new virtual file api (projFileAPI) so that all access to grid shift and init files can be hooked. o Replace geodesic implementation with one from Charles Karney and add a supported public interface (geodesic.h). o Upgraded to EPSG 8.5. o Removed old (deprecated) Java bindings in favor of the new api introduced in 4.8.0. o Implement the calcofi (Cal Coop Ocean Fish Invest Lines/Stations) projection o Install projects.h again for applications that want access to internal structures and functions despite the inherent fragility. o Various bug fixes and cleanup. o Added the CalCOFI pseudo-projection, #135 4.8.0 Release Notes ------------------- o Added the Natural Earth projection. o Added HEALPIX, rHEALPIX and Icosahedral Snyder Equal Area projections. o nad2bin now produces "CTable2" format grid shift files by default which are platform independent. o nad2nad removed, use cs2cs for datum shift operations. o projects.h no longer installed as a public include file. Please try to only use proj_api.h. o Add pj_get_spheroid_defn() accessor. o Added an alternate version of pj_init() that takes a projCtx (execution context) structure to address multithreading issues with error management and to provide a support for application hookable error reporting and logging. o Upgrade to EPSG 7.9. Some changes in ideal datum selection. o JNI bindings reworked, org.proj4.Projections deprecated in favor of org.proj4.PJ. o Added preliminary vertical datum support. o Fix various multithreading issues, particular in datum grid handling code. o Added support for the +axis= option for alternate axis orientations as part of a coordinate system (used for TM South Orientated support). o +proj=omerc implementatioin replaced with code from libproj4. +rot_conv flag no longer works, and some coordinate systems (ie. Malaysian) will need to use +gamma instead. "epsg" init file updated accordingly. 4.7.0 Release Notes ------------------- o Added in memory caching of init file search results for substantial acceleration in some application environments (like MapServer). o Regenerated nad/epsg init file with EPSG 7.1 database, including new support for Google Mercator (EPSG:3857). o Various thread safety improvements, including preliminary support for a mutex lock around some operations, like grid loading. 4.6.1 Release Notes ------------------- o Upgraded to EPSG 6.17 version for nad/epsg. Also corrected the precision problem introduced in the last version. o Added logic for tmerc projection to fail rather than return crazy results if more than 90 degrees away from the central meridian (#5). This change may only be temporary till a more comprehensive solution is found. o Fixed handling of extra text in cs2cs. o Renamed INSTALL to INSTALL.TXT. o The eqc projection has been generalized to include a latitude of origin. o Added the glabsgm (Gauss Laborde / Sphere Geometric Mean) projection, and gstmerc variation. o nad/IGNF init catalogue created. o added the ntf_r93.gsb datum shift file. o Add /Op in nmake.opt compile options to avoid VC7 optimization bug (#12) o Fix testvarious test script so it works properly when grid files available 4.6.0 Release Notes ------------------- o MAJOR: Rework pj_transform() to avoid applying ellipsoid to ellipsoid transformations as a datum shift when no datum info is available. o Avoid applying "change of ellipsoid" during datum shifting based on ellipsoids getting changed to spheres for spherical projections. o Upgrade to EPSG 6.13 o Added "900913" "Google Mercator" code in nad/esri.extra. o Avoid some static variable based multi-threading problems. o Improve error recovery if ctable style datum shift grid fails to load. o Support drive letters properly in PROJ_LIB paths for win32. o Fix occasional problem with DMS parsing. o Removed non-functional mpoly projection. o add lonlat, and latlon as aliases for longlat. 4.5.0 Release Notes ------------------- o Microsoft Visual Studio 8 compatibility changes. o Upgraded to EPSG 6.11.1 database. o Several bug fixes to pj_transform() to handle transient errors properly. o Fix Krovak projection (include +czech flag) o Added Roussilhe Stereographic projection from libproj4 (proj=rouss). o Added experimental +lon_wrap flag for alternate pj_transform() longitude wrapping behavior on output. 4.4.9 Release Notes ------------------- o Win32 build uses proj.dll by default now. o Added accessor functions for the datums, ellps, prime_meridians, units and main projection definition lists so they can be used on windows where data objects exported from the DLL don't work easily. o Added JNI (Java Native Interface) support within the jniwrap directory, and some supporting entry points directly in the proj dll/so. See --with-jni configure switch, and jniwrap/README. o Added the proj=stereoa and proj=geos projections, incorporated from Gerald's libproj4. o A few other bug fixes. 4.4.8 Release Notes ------------------- o Updated epsg file to EPSG 6.5, added other.extra pseudo-EPSG WMS definitions o Made significant fixes to prime meridian support. o Substantially change pj_datum_transform(), so it and pj_transform() will work between coordinate systems with different ellipsoids but no datum shift information (assume +towgs84=0,0,0). o Added pj_get_release() function. o Ensure pj_transform() will try to transform all points in provided list if even some might transform properly. o Improved the accuracy of Geocentric_To_Geodetic() via an iterative solution. o Various other bug fixes. 4.4.7 Release Notes ------------------- o Added NTv2 (.gsb) grid shift file support. o Modified datum shift support so that data file data is only loaded if needed. Also added 'null' grid as a fallback option, and support for making grids optional (prefix with '@' in +nadgrids). o Regenerated nad/epsg file with towgs84 parameters for non-greenwich prime meridians. o Updated nad/esri file with better generated form from Paul Ramsey. o Various bug fixes. 4.4.6 Release Notes ------------------- o Incorporated new lcca (Lambert Conformal Conic Alternate) projection from Gerald. o Updated 'espg' translation file for EPSG 6.2.2 with better support for prime meridians. o Added Prime Meridians via +pm command switch to cs2cs (and pj_transform). o Fixed bug with 7 parameter transforms. o Added 'esri' pseudo-epsg coordinate system file. o Cleanup so that PROJ.4 compiles clean as C++ code. o Added pj_get_def() to expand definitions of stuff like +init clauses. o Added a Krovak implementation (proj=krov). Note this may change again in the next release. proj-8.2.1/test-driver000755 000765 000024 00000011042 13440031147 015327 0ustar00keversstaff000000 000000 #! /bin/sh # test-driver - basic testsuite driver script. scriptversion=2018-03-07.03; # UTC # Copyright (C) 2011-2018 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . # Make unconditional expansion of undefined variables an error. This # helps a lot in preventing typo-related bugs. set -u usage_error () { echo "$0: $*" >&2 print_usage >&2 exit 2 } print_usage () { cat <$log_file 2>&1 estatus=$? if test $enable_hard_errors = no && test $estatus -eq 99; then tweaked_estatus=1 else tweaked_estatus=$estatus fi case $tweaked_estatus:$expect_failure in 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; 0:*) col=$grn res=PASS recheck=no gcopy=no;; 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; *:*) col=$red res=FAIL recheck=yes gcopy=yes;; esac # Report the test outcome and exit status in the logs, so that one can # know whether the test passed or failed simply by looking at the '.log' # file, without the need of also peaking into the corresponding '.trs' # file (automake bug#11814). echo "$res $test_name (exit status: $estatus)" >>$log_file # Report outcome to console. echo "${col}${res}${std}: $test_name" # Register the test result, and other relevant metadata. echo ":test-result: $res" > $trs_file echo ":global-test-result: $res" >> $trs_file echo ":recheck: $recheck" >> $trs_file echo ":copy-in-global-log: $gcopy" >> $trs_file # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: proj-8.2.1/m4/000755 000765 000024 00000000000 14164067212 013461 5ustar00keversstaff000000 000000 proj-8.2.1/data/000755 000765 000024 00000000000 14164067216 014056 5ustar00keversstaff000000 000000 proj-8.2.1/Makefile.in000644 000765 000024 00000072113 14164067170 015215 0ustar00keversstaff000000 000000 # Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ $(am__configure_deps) $(dist_doc_DATA) $(am__DIST_COMMON) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/proj_config.h CONFIG_CLEAN_FILES = proj.pc CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(docdir)" "$(DESTDIR)$(pkgconfigdir)" DATA = $(dist_doc_DATA) $(pkgconfig_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ cscope distdir distdir-am dist dist-all distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags CSCOPE = cscope am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/proj.pc.in AUTHORS \ COPYING ChangeLog INSTALL NEWS README compile config.guess \ config.sub depcomp install-sh ltmain.sh missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz $(distdir).zip GZIP_ENV = --best DIST_TARGETS = dist-gzip dist-zip distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURL_CFLAGS = @CURL_CFLAGS@ CURL_ENABLED_FLAGS = @CURL_ENABLED_FLAGS@ CURL_LIBS = @CURL_LIBS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CXX_WFLAGS = @CXX_WFLAGS@ CYGPATH_W = @CYGPATH_W@ C_WFLAGS = @C_WFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ EXTRA_LIBS = @EXTRA_LIBS@ FGREP = @FGREP@ FLTO_FLAG = @FLTO_FLAG@ GREP = @GREP@ GTEST_CFLAGS = @GTEST_CFLAGS@ GTEST_LIBS = @GTEST_LIBS@ HAVE_CXX11 = @HAVE_CXX11@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBCURL_CONFIG = @LIBCURL_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MUTEX_SETTING = @MUTEX_SETTING@ NM = @NM@ NMEDIT = @NMEDIT@ NO_ZERO_AS_NULL_POINTER_CONSTANT_FLAG = @NO_ZERO_AS_NULL_POINTER_CONSTANT_FLAG@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PROJ_LIB_ENV_VAR_TRIED_LAST_FLAGS = @PROJ_LIB_ENV_VAR_TRIED_LAST_FLAGS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ SQLITE3_CHECK = @SQLITE3_CHECK@ SQLITE3_LIBS = @SQLITE3_LIBS@ STRIP = @STRIP@ THREAD_LIB = @THREAD_LIB@ TIFF_CFLAGS = @TIFF_CFLAGS@ TIFF_ENABLED_FLAGS = @TIFF_ENABLED_FLAGS@ TIFF_LIBS = @TIFF_LIBS@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = include src man data cmake DIST_SUBDIRS = include src man data cmake test EXTRA_DIST = CMakeLists.txt CITATION README.md dist_doc_DATA = COPYING NEWS AUTHORS pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = proj.pc AUTOMAKE_OPTIONS = dist-zip ACLOCAL_AMFLAGS = -I m4 all: all-recursive .SUFFIXES: am--refresh: Makefile @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): proj.pc: $(top_builddir)/config.status $(srcdir)/proj.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool config.lt install-dist_docDATA: $(dist_doc_DATA) @$(NORMAL_INSTALL) @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(docdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(docdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(docdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(docdir)" || exit $$?; \ done uninstall-dist_docDATA: @$(NORMAL_UNINSTALL) @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(docdir)'; $(am__uninstall_files_from_dir) install-pkgconfigDATA: $(pkgconfig_DATA) @$(NORMAL_INSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ done uninstall-pkgconfigDATA: @$(NORMAL_UNINSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscope: cscope.files test ! -s cscope.files \ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) clean-cscope: -rm -f cscope.files cscope.files: clean-cscope cscopelist cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) dist-tarZ: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build/sub \ && ../../configure \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am $(MAKE) $(AM_MAKEFLAGS) check-local check: check-recursive all-am: Makefile $(DATA) all-local installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(docdir)" "$(DESTDIR)$(pkgconfigdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool clean-local mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-libtool \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dist_docDATA install-pkgconfigDATA install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-dist_docDATA uninstall-pkgconfigDATA .MAKE: $(am__recursive_targets) check-am install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am all-local \ am--refresh check check-am check-local clean clean-cscope \ clean-generic clean-libtool clean-local cscope cscopelist-am \ ctags ctags-am dist dist-all dist-bzip2 dist-gzip dist-lzip \ dist-shar dist-tarZ dist-xz dist-zip distcheck distclean \ distclean-generic distclean-libtool distclean-tags \ distcleancheck distdir distuninstallcheck dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dist_docDATA install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkgconfigDATA install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am uninstall-dist_docDATA uninstall-pkgconfigDATA .PRECIOUS: Makefile check-local: cd test; $(MAKE) check all-local: README README: README.md fgrep -v "[![" $< > $@ clean-local: $(RM) README # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: proj-8.2.1/aclocal.m4000644 000765 000024 00000124345 14164067167 015023 0ustar00keversstaff000000 000000 # generated automatically by aclocal 1.16.1 -*- Autoconf -*- # Copyright (C) 1996-2018 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # Copyright (C) 2002-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.16' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.16.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.16.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. AS_CASE([$CONFIG_FILES], [*\'*], [eval set x "$CONFIG_FILES"], [*], [set x $CONFIG_FILES]) shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`AS_DIRNAME(["$am_mf"])` am_filepart=`AS_BASENAME(["$am_mf"])` AM_RUN_LOG([cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles]) || am_rc=$? done if test $am_rc -ne 0; then AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments for automatic dependency tracking. Try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking).]) fi AS_UNSET([am_dirpart]) AS_UNSET([am_filepart]) AS_UNSET([am_mf]) AS_UNSET([am_rc]) rm -f conftest-deps.mk } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking is enabled. # This creates each '.Po' and '.Plo' makefile fragment that we'll need in # order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC]) [_AM_PROG_CC_C_O ]) # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) AM_MISSING_PROG([AUTOCONF], [autoconf]) AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) AM_MISSING_PROG([AUTOHEADER], [autoheader]) AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi fi dnl The trailing newline in this macro's definition is deliberate, for dnl backward compatibility and to allow trailing 'dnl'-style comments dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. ]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAKE_INCLUDE() # ----------------- # Check whether make has an 'include' directive that can support all # the idioms we need for our automatic dependency tracking code. AC_DEFUN([AM_MAKE_INCLUDE], [AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) AS_CASE([$?:`cat confinc.out 2>/dev/null`], ['0:this is the am__doit target'], [AS_CASE([$s], [BSD], [am__include='.include' am__quote='"'], [am__include='include' am__quote=''])]) if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* AC_MSG_RESULT([${_am_result}]) AC_SUBST([am__include])]) AC_SUBST([am__quote])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it is modern enough. # If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # -*- Autoconf -*- # Obsolete and "removed" macros, that must however still report explicit # error messages when used, to smooth transition. # # Copyright (C) 1996-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. AC_DEFUN([AM_CONFIG_HEADER], [AC_DIAGNOSE([obsolete], ['$0': this macro is obsolete. You should use the 'AC][_CONFIG_HEADERS' macro instead.])dnl AC_CONFIG_HEADERS($@)]) AC_DEFUN([AM_PROG_CC_STDC], [AC_PROG_CC am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc AC_DIAGNOSE([obsolete], ['$0': this macro is obsolete. You should simply use the 'AC][_PROG_CC' macro instead. Also, your code should no longer depend upon 'am_cv_prog_cc_stdc', but upon 'ac_cv_prog_cc_stdc'.])]) AC_DEFUN([AM_C_PROTOTYPES], [AC_FATAL([automatic de-ANSI-fication support has been removed])]) AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Copyright (C) 1999-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_CC_C_O # --------------- # Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC # to automatically call this. AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl AC_LANG_PUSH([C])dnl AC_CACHE_CHECK( [whether $CC understands -c and -o together], [am_cv_prog_cc_c_o], [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i]) if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) # Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. # (This has been adapted from Autoconf's _AC_RUN_LOG macro.) AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT([yes]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar # AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([m4/ax_cflags_warn_all.m4]) m4_include([m4/ax_check_compile_flag.m4]) m4_include([m4/ax_cxx_compile_stdcxx.m4]) m4_include([m4/ax_cxx_compile_stdcxx_11.m4]) m4_include([m4/libtool.m4]) m4_include([m4/ltoptions.m4]) m4_include([m4/ltsugar.m4]) m4_include([m4/ltversion.m4]) m4_include([m4/lt~obsolete.m4]) m4_include([m4/pkg.m4]) proj-8.2.1/src/000755 000765 000024 00000000000 14164067215 013733 5ustar00keversstaff000000 000000 proj-8.2.1/src/factors.cpp000644 000765 000024 00000006120 14017154140 016066 0ustar00keversstaff000000 000000 /* projection scale factors */ #define PJ_LIB__ #include "proj.h" #include "proj_internal.h" #include #include #ifndef DEFAULT_H #define DEFAULT_H 1e-5 /* radian default for numeric h */ #endif #define EPS 1.0e-12 int pj_factors(PJ_LP lp, const PJ *P, double h, struct FACTORS *fac) { double cosphi, t, n, r; int err; PJ_COORD coo = {{0, 0, 0, 0}}; coo.lp = lp; /* Failing the 3 initial checks will most likely be due to */ /* earlier errors, so we leave errno alone */ if (nullptr==fac) return 1; if (nullptr==P) return 1; if (HUGE_VAL==lp.lam) return 1; /* But from here, we're ready to make our own mistakes */ err = proj_errno_reset (P); /* Indicate that all factors are numerical approximations */ fac->code = 0; /* Check for latitude or longitude overange */ if ((fabs (lp.phi)-M_HALFPI) > EPS ) { proj_log_error(P, _("Invalid latitude")); proj_errno_set (P, PROJ_ERR_COORD_TRANSFM_INVALID_COORD); return 1; } if( fabs (lp.lam) > 10.) { proj_log_error(P, _("Invalid longitude")); proj_errno_set (P, PROJ_ERR_COORD_TRANSFM_INVALID_COORD); return 1; } /* Set a reasonable step size for the numerical derivatives */ h = fabs (h); if (h < EPS) h = DEFAULT_H; /* If input latitudes are geocentric, convert to geographic */ if (P->geoc) lp = pj_geocentric_latitude (P, PJ_INV, coo).lp; /* If latitude + one step overshoots the pole, move it slightly inside, */ /* so the numerical derivative still exists */ if (fabs (lp.phi) > (M_HALFPI - h)) lp.phi = lp.phi < 0. ? -(M_HALFPI-h) : (M_HALFPI-h); /* Longitudinal distance from central meridian */ lp.lam -= P->lam0; if (!P->over) lp.lam = adjlon(lp.lam); /* Derivatives */ if (pj_deriv (lp, h, P, &(fac->der))) { proj_log_error(P, _("Invalid latitude or longitude")); proj_errno_set (P, PROJ_ERR_COORD_TRANSFM_INVALID_COORD); return 1; } /* Scale factors */ cosphi = cos (lp.phi); fac->h = hypot (fac->der.x_p, fac->der.y_p); fac->k = hypot (fac->der.x_l, fac->der.y_l) / cosphi; if (P->es != 0.0) { t = sin(lp.phi); t = 1. - P->es * t * t; n = sqrt(t); fac->h *= t * n / P->one_es; fac->k *= n; r = t * t / P->one_es; } else r = 1.; /* Convergence */ fac->conv = -atan2 (fac->der.x_p, fac->der.y_p); /* Areal scale factor */ fac->s = (fac->der.y_p * fac->der.x_l - fac->der.x_p * fac->der.y_l) * r / cosphi; /* Meridian-parallel angle (theta prime) */ fac->thetap = aasin(P->ctx,fac->s / (fac->h * fac->k)); /* Tissot ellipse axis */ t = fac->k * fac->k + fac->h * fac->h; fac->a = sqrt(t + 2. * fac->s); t = t - 2. * fac->s; t = t > 0? sqrt(t): 0; fac->b = 0.5 * (fac->a - t); fac->a = 0.5 * (fac->a + t); /* Angular distortion */ fac->omega = 2. * aasin(P->ctx, (fac->a - fac->b) / (fac->a + fac->b) ); proj_errno_restore (P, err); return 0; } proj-8.2.1/src/units.cpp000644 000765 000024 00000005504 13747523460 015612 0ustar00keversstaff000000 000000 /* definition of standard cartesian units */ #include #include "proj.h" #define PJ_UNITS__ #include "proj_internal.h" /* Field 2 that contains the multiplier to convert named units to meters ** may be expressed by either a simple floating point constant or a ** numerator/denomenator values (e.g. 1/1000) */ static const struct PJ_UNITS pj_units[] = { {"km", "1000", "Kilometer", 1000.0}, {"m", "1", "Meter", 1.0}, {"dm", "1/10", "Decimeter", 0.1}, {"cm", "1/100", "Centimeter", 0.01}, {"mm", "1/1000", "Millimeter", 0.001}, {"kmi", "1852", "International Nautical Mile", 1852.0}, {"in", "0.0254", "International Inch", 0.0254}, {"ft", "0.3048", "International Foot", 0.3048}, {"yd", "0.9144", "International Yard", 0.9144}, {"mi", "1609.344", "International Statute Mile", 1609.344}, {"fath", "1.8288", "International Fathom", 1.8288}, {"ch", "20.1168", "International Chain", 20.1168}, {"link", "0.201168", "International Link", 0.201168}, {"us-in", "1/39.37", "U.S. Surveyor's Inch", 100/3937.0}, {"us-ft", "0.304800609601219", "U.S. Surveyor's Foot", 1200/3937.0}, {"us-yd", "0.914401828803658", "U.S. Surveyor's Yard", 3600/3937.0}, {"us-ch", "20.11684023368047", "U.S. Surveyor's Chain", 79200/3937.0}, {"us-mi", "1609.347218694437", "U.S. Surveyor's Statute Mile", 6336000/3937.0}, {"ind-yd", "0.91439523", "Indian Yard", 0.91439523}, {"ind-ft", "0.30479841", "Indian Foot", 0.30479841}, {"ind-ch", "20.11669506", "Indian Chain", 20.11669506}, {nullptr, nullptr, nullptr, 0.0} }; // For internal use const PJ_UNITS *pj_list_linear_units() { return pj_units; } const PJ_UNITS *proj_list_units() { return pj_units; } /* M_PI / 200 */ #define GRAD_TO_RAD 0.015707963267948967 const struct PJ_UNITS pj_angular_units[] = { {"rad", "1.0", "Radian", 1.0}, {"deg", "0.017453292519943296", "Degree", DEG_TO_RAD}, {"grad", "0.015707963267948967", "Grad", GRAD_TO_RAD}, {nullptr, nullptr, nullptr, 0.0} }; // For internal use const PJ_UNITS *pj_list_angular_units() { return pj_angular_units; } const PJ_UNITS *proj_list_angular_units() { return pj_angular_units; } proj-8.2.1/src/geodesic.h000644 000765 000024 00000130311 14067153334 015665 0ustar00keversstaff000000 000000 /** * \file geodesic.h * \brief API for the geodesic routines in C * * This an implementation in C of the geodesic algorithms described in * - C. F. F. Karney, * * Algorithms for geodesics, * J. Geodesy 87, 43--55 (2013); * DOI: * 10.1007/s00190-012-0578-z; * addenda: * geod-addenda.html. * . * The principal advantages of these algorithms over previous ones (e.g., * Vincenty, 1975) are * - accurate to round off for |f| < 1/50; * - the solution of the inverse problem is always found; * - differential and integral properties of geodesics are computed. * * The shortest path between two points on the ellipsoid at (\e lat1, \e * lon1) and (\e lat2, \e lon2) is called the geodesic. Its length is * \e s12 and the geodesic from point 1 to point 2 has forward azimuths * \e azi1 and \e azi2 at the two end points. * * Traditionally two geodesic problems are considered: * - the direct problem -- given \e lat1, \e lon1, \e s12, and \e azi1, * determine \e lat2, \e lon2, and \e azi2. This is solved by the function * geod_direct(). * - the inverse problem -- given \e lat1, \e lon1, and \e lat2, \e lon2, * determine \e s12, \e azi1, and \e azi2. This is solved by the function * geod_inverse(). * * The ellipsoid is specified by its equatorial radius \e a (typically in * meters) and flattening \e f. The routines are accurate to round off with * double precision arithmetic provided that |f| < 1/50; for the * WGS84 ellipsoid, the errors are less than 15 nanometers. (Reasonably * accurate results are obtained for |f| < 1/5.) For a prolate * ellipsoid, specify \e f < 0. * * The routines also calculate several other quantities of interest * - \e S12 is the area between the geodesic from point 1 to point 2 and the * equator; i.e., it is the area, measured counter-clockwise, of the * quadrilateral with corners (\e lat1,\e lon1), (0,\e lon1), (0,\e lon2), * and (\e lat2,\e lon2). * - \e m12, the reduced length of the geodesic is defined such that if * the initial azimuth is perturbed by \e dazi1 (radians) then the * second point is displaced by \e m12 \e dazi1 in the direction * perpendicular to the geodesic. On a curved surface the reduced * length obeys a symmetry relation, \e m12 + \e m21 = 0. On a flat * surface, we have \e m12 = \e s12. * - \e M12 and \e M21 are geodesic scales. If two geodesics are * parallel at point 1 and separated by a small distance \e dt, then * they are separated by a distance \e M12 \e dt at point 2. \e M21 * is defined similarly (with the geodesics being parallel to one * another at point 2). On a flat surface, we have \e M12 = \e M21 * = 1. * - \e a12 is the arc length on the auxiliary sphere. This is a * construct for converting the problem to one in spherical * trigonometry. \e a12 is measured in degrees. The spherical arc * length from one equator crossing to the next is always 180°. * * If points 1, 2, and 3 lie on a single geodesic, then the following * addition rules hold: * - \e s13 = \e s12 + \e s23 * - \e a13 = \e a12 + \e a23 * - \e S13 = \e S12 + \e S23 * - \e m13 = \e m12 \e M23 + \e m23 \e M21 * - \e M13 = \e M12 \e M23 − (1 − \e M12 \e M21) \e * m23 / \e m12 * - \e M31 = \e M32 \e M21 − (1 − \e M23 \e M32) \e * m12 / \e m23 * * The shortest distance returned by the solution of the inverse problem is * (obviously) uniquely defined. However, in a few special cases there are * multiple azimuths which yield the same shortest distance. Here is a * catalog of those cases: * - \e lat1 = −\e lat2 (with neither point at a pole). If \e azi1 = \e * azi2, the geodesic is unique. Otherwise there are two geodesics and the * second one is obtained by setting [\e azi1, \e azi2] → [\e azi2, \e * azi1], [\e M12, \e M21] → [\e M21, \e M12], \e S12 → −\e * S12. (This occurs when the longitude difference is near ±180° * for oblate ellipsoids.) * - \e lon2 = \e lon1 ± 180° (with neither point at a pole). If \e * azi1 = 0° or ±180°, the geodesic is unique. Otherwise * there are two geodesics and the second one is obtained by setting [\e * azi1, \e azi2] → [−\e azi1, −\e azi2], \e S12 → * −\e S12. (This occurs when \e lat2 is near −\e lat1 for * prolate ellipsoids.) * - Points 1 and 2 at opposite poles. There are infinitely many geodesics * which can be generated by setting [\e azi1, \e azi2] → [\e azi1, \e * azi2] + [\e d, −\e d], for arbitrary \e d. (For spheres, this * prescription applies when points 1 and 2 are antipodal.) * - \e s12 = 0 (coincident points). There are infinitely many geodesics which * can be generated by setting [\e azi1, \e azi2] → [\e azi1, \e azi2] + * [\e d, \e d], for arbitrary \e d. * * These routines are a simple transcription of the corresponding C++ classes * in GeographicLib. The * "class data" is represented by the structs geod_geodesic, geod_geodesicline, * geod_polygon and pointers to these objects are passed as initial arguments * to the member functions. Most of the internal comments have been retained. * However, in the process of transcription some documentation has been lost * and the documentation for the C++ classes, GeographicLib::Geodesic, * GeographicLib::GeodesicLine, and GeographicLib::PolygonAreaT, should be * consulted. The C++ code remains the "reference implementation". Think * twice about restructuring the internals of the C code since this may make * porting fixes from the C++ code more difficult. * * Copyright (c) Charles Karney (2012-2021) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ * * This library was distributed with * GeographicLib 1.52. **********************************************************************/ #if !defined(GEODESIC_H) #define GEODESIC_H 1 /** * The major version of the geodesic library. (This tracks the version of * GeographicLib.) **********************************************************************/ #define GEODESIC_VERSION_MAJOR 1 /** * The minor version of the geodesic library. (This tracks the version of * GeographicLib.) **********************************************************************/ #define GEODESIC_VERSION_MINOR 52 /** * The patch level of the geodesic library. (This tracks the version of * GeographicLib.) **********************************************************************/ #define GEODESIC_VERSION_PATCH 0 /** * Pack the version components into a single integer. Users should not rely on * this particular packing of the components of the version number; see the * documentation for GEODESIC_VERSION, below. **********************************************************************/ #define GEODESIC_VERSION_NUM(a,b,c) ((((a) * 10000 + (b)) * 100) + (c)) /** * The version of the geodesic library as a single integer, packed as MMmmmmpp * where MM is the major version, mmmm is the minor version, and pp is the * patch level. Users should not rely on this particular packing of the * components of the version number. Instead they should use a test such as * @code{.c} #if GEODESIC_VERSION >= GEODESIC_VERSION_NUM(1,40,0) ... #endif * @endcode **********************************************************************/ #define GEODESIC_VERSION \ GEODESIC_VERSION_NUM(GEODESIC_VERSION_MAJOR, \ GEODESIC_VERSION_MINOR, \ GEODESIC_VERSION_PATCH) #if !defined(GEOD_DLL) #if defined(_MSC_VER) && defined(PROJ_MSVC_DLL_EXPORT) #define GEOD_DLL __declspec(dllexport) #elif defined(__GNUC__) #define GEOD_DLL __attribute__ ((visibility("default"))) #else #define GEOD_DLL #endif #endif #if defined(PROJ_RENAME_SYMBOLS) #include "proj_symbol_rename.h" #endif #if defined(__cplusplus) extern "C" { #endif /** * The struct containing information about the ellipsoid. This must be * initialized by geod_init() before use. **********************************************************************/ struct geod_geodesic { double a; /**< the equatorial radius */ double f; /**< the flattening */ /**< @cond SKIP */ double f1, e2, ep2, n, b, c2, etol2; double A3x[6], C3x[15], C4x[21]; /**< @endcond */ }; /** * The struct containing information about a single geodesic. This must be * initialized by geod_lineinit(), geod_directline(), geod_gendirectline(), * or geod_inverseline() before use. **********************************************************************/ struct geod_geodesicline { double lat1; /**< the starting latitude */ double lon1; /**< the starting longitude */ double azi1; /**< the starting azimuth */ double a; /**< the equatorial radius */ double f; /**< the flattening */ double salp1; /**< sine of \e azi1 */ double calp1; /**< cosine of \e azi1 */ double a13; /**< arc length to reference point */ double s13; /**< distance to reference point */ /**< @cond SKIP */ double b, c2, f1, salp0, calp0, k2, ssig1, csig1, dn1, stau1, ctau1, somg1, comg1, A1m1, A2m1, A3c, B11, B21, B31, A4, B41; double C1a[6+1], C1pa[6+1], C2a[6+1], C3a[6], C4a[6]; /**< @endcond */ unsigned caps; /**< the capabilities */ }; /** * The struct for accumulating information about a geodesic polygon. This is * used for computing the perimeter and area of a polygon. This must be * initialized by geod_polygon_init() before use. **********************************************************************/ struct geod_polygon { double lat; /**< the current latitude */ double lon; /**< the current longitude */ /**< @cond SKIP */ double lat0; double lon0; double A[2]; double P[2]; int polyline; int crossings; /**< @endcond */ unsigned num; /**< the number of points so far */ }; /** * Initialize a geod_geodesic object. * * @param[out] g a pointer to the object to be initialized. * @param[in] a the equatorial radius (meters). * @param[in] f the flattening. **********************************************************************/ void GEOD_DLL geod_init(struct geod_geodesic* g, double a, double f); /** * Solve the direct geodesic problem. * * @param[in] g a pointer to the geod_geodesic object specifying the * ellipsoid. * @param[in] lat1 latitude of point 1 (degrees). * @param[in] lon1 longitude of point 1 (degrees). * @param[in] azi1 azimuth at point 1 (degrees). * @param[in] s12 distance from point 1 to point 2 (meters); it can be * negative. * @param[out] plat2 pointer to the latitude of point 2 (degrees). * @param[out] plon2 pointer to the longitude of point 2 (degrees). * @param[out] pazi2 pointer to the (forward) azimuth at point 2 (degrees). * * \e g must have been initialized with a call to geod_init(). \e lat1 * should be in the range [−90°, 90°]. The values of \e lon2 * and \e azi2 returned are in the range [−180°, 180°]. Any of * the "return" arguments \e plat2, etc., may be replaced by 0, if you do not * need some quantities computed. * * If either point is at a pole, the azimuth is defined by keeping the * longitude fixed, writing \e lat = ±(90° − ε), and * taking the limit ε → 0+. An arc length greater that 180° * signifies a geodesic which is not a shortest path. (For a prolate * ellipsoid, an additional condition is necessary for a shortest path: the * longitudinal extent must not exceed of 180°.) * * Example, determine the point 10000 km NE of JFK: @code{.c} struct geod_geodesic g; double lat, lon; geod_init(&g, 6378137, 1/298.257223563); geod_direct(&g, 40.64, -73.78, 45.0, 10e6, &lat, &lon, 0); printf("%.5f %.5f\n", lat, lon); @endcode **********************************************************************/ void GEOD_DLL geod_direct(const struct geod_geodesic* g, double lat1, double lon1, double azi1, double s12, double* plat2, double* plon2, double* pazi2); /** * The general direct geodesic problem. * * @param[in] g a pointer to the geod_geodesic object specifying the * ellipsoid. * @param[in] lat1 latitude of point 1 (degrees). * @param[in] lon1 longitude of point 1 (degrees). * @param[in] azi1 azimuth at point 1 (degrees). * @param[in] flags bitor'ed combination of geod_flags(); \e flags & * GEOD_ARCMODE determines the meaning of \e s12_a12 and \e flags & * GEOD_LONG_UNROLL "unrolls" \e lon2. * @param[in] s12_a12 if \e flags & GEOD_ARCMODE is 0, this is the distance * from point 1 to point 2 (meters); otherwise it is the arc length * from point 1 to point 2 (degrees); it can be negative. * @param[out] plat2 pointer to the latitude of point 2 (degrees). * @param[out] plon2 pointer to the longitude of point 2 (degrees). * @param[out] pazi2 pointer to the (forward) azimuth at point 2 (degrees). * @param[out] ps12 pointer to the distance from point 1 to point 2 * (meters). * @param[out] pm12 pointer to the reduced length of geodesic (meters). * @param[out] pM12 pointer to the geodesic scale of point 2 relative to * point 1 (dimensionless). * @param[out] pM21 pointer to the geodesic scale of point 1 relative to * point 2 (dimensionless). * @param[out] pS12 pointer to the area under the geodesic * (meters2). * @return \e a12 arc length from point 1 to point 2 (degrees). * * \e g must have been initialized with a call to geod_init(). \e lat1 * should be in the range [−90°, 90°]. The function value \e * a12 equals \e s12_a12 if \e flags & GEOD_ARCMODE. Any of the "return" * arguments, \e plat2, etc., may be replaced by 0, if you do not need some * quantities computed. * * With \e flags & GEOD_LONG_UNROLL bit set, the longitude is "unrolled" so * that the quantity \e lon2 − \e lon1 indicates how many times and in * what sense the geodesic encircles the ellipsoid. **********************************************************************/ double GEOD_DLL geod_gendirect(const struct geod_geodesic* g, double lat1, double lon1, double azi1, unsigned flags, double s12_a12, double* plat2, double* plon2, double* pazi2, double* ps12, double* pm12, double* pM12, double* pM21, double* pS12); /** * Solve the inverse geodesic problem. * * @param[in] g a pointer to the geod_geodesic object specifying the * ellipsoid. * @param[in] lat1 latitude of point 1 (degrees). * @param[in] lon1 longitude of point 1 (degrees). * @param[in] lat2 latitude of point 2 (degrees). * @param[in] lon2 longitude of point 2 (degrees). * @param[out] ps12 pointer to the distance from point 1 to point 2 * (meters). * @param[out] pazi1 pointer to the azimuth at point 1 (degrees). * @param[out] pazi2 pointer to the (forward) azimuth at point 2 (degrees). * * \e g must have been initialized with a call to geod_init(). \e lat1 and * \e lat2 should be in the range [−90°, 90°]. The values of * \e azi1 and \e azi2 returned are in the range [−180°, 180°]. * Any of the "return" arguments, \e ps12, etc., may be replaced by 0, if you * do not need some quantities computed. * * If either point is at a pole, the azimuth is defined by keeping the * longitude fixed, writing \e lat = ±(90° − ε), and * taking the limit ε → 0+. * * The solution to the inverse problem is found using Newton's method. If * this fails to converge (this is very unlikely in geodetic applications * but does occur for very eccentric ellipsoids), then the bisection method * is used to refine the solution. * * Example, determine the distance between JFK and Singapore Changi Airport: @code{.c} struct geod_geodesic g; double s12; geod_init(&g, 6378137, 1/298.257223563); geod_inverse(&g, 40.64, -73.78, 1.36, 103.99, &s12, 0, 0); printf("%.3f\n", s12); @endcode **********************************************************************/ void GEOD_DLL geod_inverse(const struct geod_geodesic* g, double lat1, double lon1, double lat2, double lon2, double* ps12, double* pazi1, double* pazi2); /** * The general inverse geodesic calculation. * * @param[in] g a pointer to the geod_geodesic object specifying the * ellipsoid. * @param[in] lat1 latitude of point 1 (degrees). * @param[in] lon1 longitude of point 1 (degrees). * @param[in] lat2 latitude of point 2 (degrees). * @param[in] lon2 longitude of point 2 (degrees). * @param[out] ps12 pointer to the distance from point 1 to point 2 * (meters). * @param[out] pazi1 pointer to the azimuth at point 1 (degrees). * @param[out] pazi2 pointer to the (forward) azimuth at point 2 (degrees). * @param[out] pm12 pointer to the reduced length of geodesic (meters). * @param[out] pM12 pointer to the geodesic scale of point 2 relative to * point 1 (dimensionless). * @param[out] pM21 pointer to the geodesic scale of point 1 relative to * point 2 (dimensionless). * @param[out] pS12 pointer to the area under the geodesic * (meters2). * @return \e a12 arc length from point 1 to point 2 (degrees). * * \e g must have been initialized with a call to geod_init(). \e lat1 and * \e lat2 should be in the range [−90°, 90°]. Any of the * "return" arguments \e ps12, etc., may be replaced by 0, if you do not need * some quantities computed. **********************************************************************/ double GEOD_DLL geod_geninverse(const struct geod_geodesic* g, double lat1, double lon1, double lat2, double lon2, double* ps12, double* pazi1, double* pazi2, double* pm12, double* pM12, double* pM21, double* pS12); /** * Initialize a geod_geodesicline object. * * @param[out] l a pointer to the object to be initialized. * @param[in] g a pointer to the geod_geodesic object specifying the * ellipsoid. * @param[in] lat1 latitude of point 1 (degrees). * @param[in] lon1 longitude of point 1 (degrees). * @param[in] azi1 azimuth at point 1 (degrees). * @param[in] caps bitor'ed combination of geod_mask() values specifying the * capabilities the geod_geodesicline object should possess, i.e., which * quantities can be returned in calls to geod_position() and * geod_genposition(). * * \e g must have been initialized with a call to geod_init(). \e lat1 * should be in the range [−90°, 90°]. * * The geod_mask values are [see geod_mask()]: * - \e caps |= GEOD_LATITUDE for the latitude \e lat2; this is * added automatically, * - \e caps |= GEOD_LONGITUDE for the latitude \e lon2, * - \e caps |= GEOD_AZIMUTH for the latitude \e azi2; this is * added automatically, * - \e caps |= GEOD_DISTANCE for the distance \e s12, * - \e caps |= GEOD_REDUCEDLENGTH for the reduced length \e m12, * - \e caps |= GEOD_GEODESICSCALE for the geodesic scales \e M12 * and \e M21, * - \e caps |= GEOD_AREA for the area \e S12, * - \e caps |= GEOD_DISTANCE_IN permits the length of the * geodesic to be given in terms of \e s12; without this capability the * length can only be specified in terms of arc length. * . * A value of \e caps = 0 is treated as GEOD_LATITUDE | GEOD_LONGITUDE | * GEOD_AZIMUTH | GEOD_DISTANCE_IN (to support the solution of the "standard" * direct problem). * * When initialized by this function, point 3 is undefined (l->s13 = l->a13 = * NaN). **********************************************************************/ void GEOD_DLL geod_lineinit(struct geod_geodesicline* l, const struct geod_geodesic* g, double lat1, double lon1, double azi1, unsigned caps); /** * Initialize a geod_geodesicline object in terms of the direct geodesic * problem. * * @param[out] l a pointer to the object to be initialized. * @param[in] g a pointer to the geod_geodesic object specifying the * ellipsoid. * @param[in] lat1 latitude of point 1 (degrees). * @param[in] lon1 longitude of point 1 (degrees). * @param[in] azi1 azimuth at point 1 (degrees). * @param[in] s12 distance from point 1 to point 2 (meters); it can be * negative. * @param[in] caps bitor'ed combination of geod_mask() values specifying the * capabilities the geod_geodesicline object should possess, i.e., which * quantities can be returned in calls to geod_position() and * geod_genposition(). * * This function sets point 3 of the geod_geodesicline to correspond to point * 2 of the direct geodesic problem. See geod_lineinit() for more * information. **********************************************************************/ void GEOD_DLL geod_directline(struct geod_geodesicline* l, const struct geod_geodesic* g, double lat1, double lon1, double azi1, double s12, unsigned caps); /** * Initialize a geod_geodesicline object in terms of the direct geodesic * problem specified in terms of either distance or arc length. * * @param[out] l a pointer to the object to be initialized. * @param[in] g a pointer to the geod_geodesic object specifying the * ellipsoid. * @param[in] lat1 latitude of point 1 (degrees). * @param[in] lon1 longitude of point 1 (degrees). * @param[in] azi1 azimuth at point 1 (degrees). * @param[in] flags either GEOD_NOFLAGS or GEOD_ARCMODE to determining the * meaning of the \e s12_a12. * @param[in] s12_a12 if \e flags = GEOD_NOFLAGS, this is the distance * from point 1 to point 2 (meters); if \e flags = GEOD_ARCMODE, it is * the arc length from point 1 to point 2 (degrees); it can be * negative. * @param[in] caps bitor'ed combination of geod_mask() values specifying the * capabilities the geod_geodesicline object should possess, i.e., which * quantities can be returned in calls to geod_position() and * geod_genposition(). * * This function sets point 3 of the geod_geodesicline to correspond to point * 2 of the direct geodesic problem. See geod_lineinit() for more * information. **********************************************************************/ void GEOD_DLL geod_gendirectline(struct geod_geodesicline* l, const struct geod_geodesic* g, double lat1, double lon1, double azi1, unsigned flags, double s12_a12, unsigned caps); /** * Initialize a geod_geodesicline object in terms of the inverse geodesic * problem. * * @param[out] l a pointer to the object to be initialized. * @param[in] g a pointer to the geod_geodesic object specifying the * ellipsoid. * @param[in] lat1 latitude of point 1 (degrees). * @param[in] lon1 longitude of point 1 (degrees). * @param[in] lat2 latitude of point 2 (degrees). * @param[in] lon2 longitude of point 2 (degrees). * @param[in] caps bitor'ed combination of geod_mask() values specifying the * capabilities the geod_geodesicline object should possess, i.e., which * quantities can be returned in calls to geod_position() and * geod_genposition(). * * This function sets point 3 of the geod_geodesicline to correspond to point * 2 of the inverse geodesic problem. See geod_lineinit() for more * information. **********************************************************************/ void GEOD_DLL geod_inverseline(struct geod_geodesicline* l, const struct geod_geodesic* g, double lat1, double lon1, double lat2, double lon2, unsigned caps); /** * Compute the position along a geod_geodesicline. * * @param[in] l a pointer to the geod_geodesicline object specifying the * geodesic line. * @param[in] s12 distance from point 1 to point 2 (meters); it can be * negative. * @param[out] plat2 pointer to the latitude of point 2 (degrees). * @param[out] plon2 pointer to the longitude of point 2 (degrees); requires * that \e l was initialized with \e caps |= GEOD_LONGITUDE. * @param[out] pazi2 pointer to the (forward) azimuth at point 2 (degrees). * * \e l must have been initialized with a call, e.g., to geod_lineinit(), * with \e caps |= GEOD_DISTANCE_IN (or \e caps = 0). The values of \e lon2 * and \e azi2 returned are in the range [−180°, 180°]. Any of * the "return" arguments \e plat2, etc., may be replaced by 0, if you do not * need some quantities computed. * * Example, compute way points between JFK and Singapore Changi Airport * the "obvious" way using geod_direct(): @code{.c} struct geod_geodesic g; double s12, azi1, lat[101],lon[101]; int i; geod_init(&g, 6378137, 1/298.257223563); geod_inverse(&g, 40.64, -73.78, 1.36, 103.99, &s12, &azi1, 0); for (i = 0; i < 101; ++i) { geod_direct(&g, 40.64, -73.78, azi1, i * s12 * 0.01, lat + i, lon + i, 0); printf("%.5f %.5f\n", lat[i], lon[i]); } @endcode * A faster way using geod_position(): @code{.c} struct geod_geodesic g; struct geod_geodesicline l; double lat[101],lon[101]; int i; geod_init(&g, 6378137, 1/298.257223563); geod_inverseline(&l, &g, 40.64, -73.78, 1.36, 103.99, 0); for (i = 0; i <= 100; ++i) { geod_position(&l, i * l.s13 * 0.01, lat + i, lon + i, 0); printf("%.5f %.5f\n", lat[i], lon[i]); } @endcode **********************************************************************/ void GEOD_DLL geod_position(const struct geod_geodesicline* l, double s12, double* plat2, double* plon2, double* pazi2); /** * The general position function. * * @param[in] l a pointer to the geod_geodesicline object specifying the * geodesic line. * @param[in] flags bitor'ed combination of geod_flags(); \e flags & * GEOD_ARCMODE determines the meaning of \e s12_a12 and \e flags & * GEOD_LONG_UNROLL "unrolls" \e lon2; if \e flags & GEOD_ARCMODE is 0, * then \e l must have been initialized with \e caps |= GEOD_DISTANCE_IN. * @param[in] s12_a12 if \e flags & GEOD_ARCMODE is 0, this is the * distance from point 1 to point 2 (meters); otherwise it is the * arc length from point 1 to point 2 (degrees); it can be * negative. * @param[out] plat2 pointer to the latitude of point 2 (degrees). * @param[out] plon2 pointer to the longitude of point 2 (degrees); requires * that \e l was initialized with \e caps |= GEOD_LONGITUDE. * @param[out] pazi2 pointer to the (forward) azimuth at point 2 (degrees). * @param[out] ps12 pointer to the distance from point 1 to point 2 * (meters); requires that \e l was initialized with \e caps |= * GEOD_DISTANCE. * @param[out] pm12 pointer to the reduced length of geodesic (meters); * requires that \e l was initialized with \e caps |= GEOD_REDUCEDLENGTH. * @param[out] pM12 pointer to the geodesic scale of point 2 relative to * point 1 (dimensionless); requires that \e l was initialized with \e caps * |= GEOD_GEODESICSCALE. * @param[out] pM21 pointer to the geodesic scale of point 1 relative to * point 2 (dimensionless); requires that \e l was initialized with \e caps * |= GEOD_GEODESICSCALE. * @param[out] pS12 pointer to the area under the geodesic * (meters2); requires that \e l was initialized with \e caps |= * GEOD_AREA. * @return \e a12 arc length from point 1 to point 2 (degrees). * * \e l must have been initialized with a call to geod_lineinit() with \e * caps |= GEOD_DISTANCE_IN. The value \e azi2 returned is in the range * [−180°, 180°]. Any of the "return" arguments \e plat2, * etc., may be replaced by 0, if you do not need some quantities * computed. Requesting a value which \e l is not capable of computing * is not an error; the corresponding argument will not be altered. * * With \e flags & GEOD_LONG_UNROLL bit set, the longitude is "unrolled" so * that the quantity \e lon2 − \e lon1 indicates how many times and in * what sense the geodesic encircles the ellipsoid. * * Example, compute way points between JFK and Singapore Changi Airport using * geod_genposition(). In this example, the points are evenly space in arc * length (and so only approximately equally spaced in distance). This is * faster than using geod_position() and would be appropriate if drawing the * path on a map. @code{.c} struct geod_geodesic g; struct geod_geodesicline l; double lat[101], lon[101]; int i; geod_init(&g, 6378137, 1/298.257223563); geod_inverseline(&l, &g, 40.64, -73.78, 1.36, 103.99, GEOD_LATITUDE | GEOD_LONGITUDE); for (i = 0; i <= 100; ++i) { geod_genposition(&l, GEOD_ARCMODE, i * l.a13 * 0.01, lat + i, lon + i, 0, 0, 0, 0, 0, 0); printf("%.5f %.5f\n", lat[i], lon[i]); } @endcode **********************************************************************/ double GEOD_DLL geod_genposition(const struct geod_geodesicline* l, unsigned flags, double s12_a12, double* plat2, double* plon2, double* pazi2, double* ps12, double* pm12, double* pM12, double* pM21, double* pS12); /** * Specify position of point 3 in terms of distance. * * @param[in,out] l a pointer to the geod_geodesicline object. * @param[in] s13 the distance from point 1 to point 3 (meters); it * can be negative. * * This is only useful if the geod_geodesicline object has been constructed * with \e caps |= GEOD_DISTANCE_IN. **********************************************************************/ void GEOD_DLL geod_setdistance(struct geod_geodesicline* l, double s13); /** * Specify position of point 3 in terms of either distance or arc length. * * @param[in,out] l a pointer to the geod_geodesicline object. * @param[in] flags either GEOD_NOFLAGS or GEOD_ARCMODE to determining the * meaning of the \e s13_a13. * @param[in] s13_a13 if \e flags = GEOD_NOFLAGS, this is the distance * from point 1 to point 3 (meters); if \e flags = GEOD_ARCMODE, it is * the arc length from point 1 to point 3 (degrees); it can be * negative. * * If flags = GEOD_NOFLAGS, this calls geod_setdistance(). If flags = * GEOD_ARCMODE, the \e s13 is only set if the geod_geodesicline object has * been constructed with \e caps |= GEOD_DISTANCE. **********************************************************************/ void GEOD_DLL geod_gensetdistance(struct geod_geodesicline* l, unsigned flags, double s13_a13); /** * Initialize a geod_polygon object. * * @param[out] p a pointer to the object to be initialized. * @param[in] polylinep non-zero if a polyline instead of a polygon. * * If \e polylinep is zero, then the sequence of vertices and edges added by * geod_polygon_addpoint() and geod_polygon_addedge() define a polygon and * the perimeter and area are returned by geod_polygon_compute(). If \e * polylinep is non-zero, then the vertices and edges define a polyline and * only the perimeter is returned by geod_polygon_compute(). * * The area and perimeter are accumulated at two times the standard floating * point precision to guard against the loss of accuracy with many-sided * polygons. At any point you can ask for the perimeter and area so far. * * An example of the use of this function is given in the documentation for * geod_polygon_compute(). **********************************************************************/ void GEOD_DLL geod_polygon_init(struct geod_polygon* p, int polylinep); /** * Clear the polygon, allowing a new polygon to be started. * * @param[in,out] p a pointer to the object to be cleared. **********************************************************************/ void GEOD_DLL geod_polygon_clear(struct geod_polygon* p); /** * Add a point to the polygon or polyline. * * @param[in] g a pointer to the geod_geodesic object specifying the * ellipsoid. * @param[in,out] p a pointer to the geod_polygon object specifying the * polygon. * @param[in] lat the latitude of the point (degrees). * @param[in] lon the longitude of the point (degrees). * * \e g and \e p must have been initialized with calls to geod_init() and * geod_polygon_init(), respectively. The same \e g must be used for all the * points and edges in a polygon. \e lat should be in the range * [−90°, 90°]. * * An example of the use of this function is given in the documentation for * geod_polygon_compute(). **********************************************************************/ void GEOD_DLL geod_polygon_addpoint(const struct geod_geodesic* g, struct geod_polygon* p, double lat, double lon); /** * Add an edge to the polygon or polyline. * * @param[in] g a pointer to the geod_geodesic object specifying the * ellipsoid. * @param[in,out] p a pointer to the geod_polygon object specifying the * polygon. * @param[in] azi azimuth at current point (degrees). * @param[in] s distance from current point to next point (meters). * * \e g and \e p must have been initialized with calls to geod_init() and * geod_polygon_init(), respectively. The same \e g must be used for all the * points and edges in a polygon. This does nothing if no points have been * added yet. The \e lat and \e lon fields of \e p give the location of the * new vertex. **********************************************************************/ void GEOD_DLL geod_polygon_addedge(const struct geod_geodesic* g, struct geod_polygon* p, double azi, double s); /** * Return the results for a polygon. * * @param[in] g a pointer to the geod_geodesic object specifying the * ellipsoid. * @param[in] p a pointer to the geod_polygon object specifying the polygon. * @param[in] reverse if non-zero then clockwise (instead of * counter-clockwise) traversal counts as a positive area. * @param[in] sign if non-zero then return a signed result for the area if * the polygon is traversed in the "wrong" direction instead of returning * the area for the rest of the earth. * @param[out] pA pointer to the area of the polygon (meters2); * only set if \e polyline is non-zero in the call to geod_polygon_init(). * @param[out] pP pointer to the perimeter of the polygon or length of the * polyline (meters). * @return the number of points. * * The area and perimeter are accumulated at two times the standard floating * point precision to guard against the loss of accuracy with many-sided * polygons. Arbitrarily complex polygons are allowed. In the case of * self-intersecting polygons the area is accumulated "algebraically", e.g., * the areas of the 2 loops in a figure-8 polygon will partially cancel. * There's no need to "close" the polygon by repeating the first vertex. Set * \e pA or \e pP to zero, if you do not want the corresponding quantity * returned. * * More points can be added to the polygon after this call. * * Example, compute the perimeter and area of the geodesic triangle with * vertices (0°N,0°E), (0°N,90°E), (90°N,0°E). @code{.c} double A, P; int n; struct geod_geodesic g; struct geod_polygon p; geod_init(&g, 6378137, 1/298.257223563); geod_polygon_init(&p, 0); geod_polygon_addpoint(&g, &p, 0, 0); geod_polygon_addpoint(&g, &p, 0, 90); geod_polygon_addpoint(&g, &p, 90, 0); n = geod_polygon_compute(&g, &p, 0, 1, &A, &P); printf("%d %.8f %.3f\n", n, P, A); @endcode **********************************************************************/ unsigned GEOD_DLL geod_polygon_compute(const struct geod_geodesic* g, const struct geod_polygon* p, int reverse, int sign, double* pA, double* pP); /** * Return the results assuming a tentative final test point is added; * however, the data for the test point is not saved. This lets you report a * running result for the perimeter and area as the user moves the mouse * cursor. Ordinary floating point arithmetic is used to accumulate the data * for the test point; thus the area and perimeter returned are less accurate * than if geod_polygon_addpoint() and geod_polygon_compute() are used. * * @param[in] g a pointer to the geod_geodesic object specifying the * ellipsoid. * @param[in] p a pointer to the geod_polygon object specifying the polygon. * @param[in] lat the latitude of the test point (degrees). * @param[in] lon the longitude of the test point (degrees). * @param[in] reverse if non-zero then clockwise (instead of * counter-clockwise) traversal counts as a positive area. * @param[in] sign if non-zero then return a signed result for the area if * the polygon is traversed in the "wrong" direction instead of returning * the area for the rest of the earth. * @param[out] pA pointer to the area of the polygon (meters2); * only set if \e polyline is non-zero in the call to geod_polygon_init(). * @param[out] pP pointer to the perimeter of the polygon or length of the * polyline (meters). * @return the number of points. * * \e lat should be in the range [−90°, 90°]. **********************************************************************/ unsigned GEOD_DLL geod_polygon_testpoint(const struct geod_geodesic* g, const struct geod_polygon* p, double lat, double lon, int reverse, int sign, double* pA, double* pP); /** * Return the results assuming a tentative final test point is added via an * azimuth and distance; however, the data for the test point is not saved. * This lets you report a running result for the perimeter and area as the * user moves the mouse cursor. Ordinary floating point arithmetic is used * to accumulate the data for the test point; thus the area and perimeter * returned are less accurate than if geod_polygon_addedge() and * geod_polygon_compute() are used. * * @param[in] g a pointer to the geod_geodesic object specifying the * ellipsoid. * @param[in] p a pointer to the geod_polygon object specifying the polygon. * @param[in] azi azimuth at current point (degrees). * @param[in] s distance from current point to final test point (meters). * @param[in] reverse if non-zero then clockwise (instead of * counter-clockwise) traversal counts as a positive area. * @param[in] sign if non-zero then return a signed result for the area if * the polygon is traversed in the "wrong" direction instead of returning * the area for the rest of the earth. * @param[out] pA pointer to the area of the polygon (meters2); * only set if \e polyline is non-zero in the call to geod_polygon_init(). * @param[out] pP pointer to the perimeter of the polygon or length of the * polyline (meters). * @return the number of points. **********************************************************************/ unsigned GEOD_DLL geod_polygon_testedge(const struct geod_geodesic* g, const struct geod_polygon* p, double azi, double s, int reverse, int sign, double* pA, double* pP); /** * A simple interface for computing the area of a geodesic polygon. * * @param[in] g a pointer to the geod_geodesic object specifying the * ellipsoid. * @param[in] lats an array of latitudes of the polygon vertices (degrees). * @param[in] lons an array of longitudes of the polygon vertices (degrees). * @param[in] n the number of vertices. * @param[out] pA pointer to the area of the polygon (meters2). * @param[out] pP pointer to the perimeter of the polygon (meters). * * \e lats should be in the range [−90°, 90°]. * * Arbitrarily complex polygons are allowed. In the case self-intersecting * of polygons the area is accumulated "algebraically", e.g., the areas of * the 2 loops in a figure-8 polygon will partially cancel. There's no need * to "close" the polygon by repeating the first vertex. The area returned * is signed with counter-clockwise traversal being treated as positive. * * Example, compute the area of Antarctica: @code{.c} double lats[] = {-72.9, -71.9, -74.9, -74.3, -77.5, -77.4, -71.7, -65.9, -65.7, -66.6, -66.9, -69.8, -70.0, -71.0, -77.3, -77.9, -74.7}, lons[] = {-74, -102, -102, -131, -163, 163, 172, 140, 113, 88, 59, 25, -4, -14, -33, -46, -61}; struct geod_geodesic g; double A, P; geod_init(&g, 6378137, 1/298.257223563); geod_polygonarea(&g, lats, lons, (sizeof lats) / (sizeof lats[0]), &A, &P); printf("%.0f %.2f\n", A, P); @endcode **********************************************************************/ void GEOD_DLL geod_polygonarea(const struct geod_geodesic* g, double lats[], double lons[], int n, double* pA, double* pP); /** * mask values for the \e caps argument to geod_lineinit(). **********************************************************************/ enum geod_mask { GEOD_NONE = 0U, /**< Calculate nothing */ GEOD_LATITUDE = 1U<<7 | 0U, /**< Calculate latitude */ GEOD_LONGITUDE = 1U<<8 | 1U<<3, /**< Calculate longitude */ GEOD_AZIMUTH = 1U<<9 | 0U, /**< Calculate azimuth */ GEOD_DISTANCE = 1U<<10 | 1U<<0, /**< Calculate distance */ GEOD_DISTANCE_IN = 1U<<11 | 1U<<0 | 1U<<1,/**< Allow distance as input */ GEOD_REDUCEDLENGTH= 1U<<12 | 1U<<0 | 1U<<2,/**< Calculate reduced length */ GEOD_GEODESICSCALE= 1U<<13 | 1U<<0 | 1U<<2,/**< Calculate geodesic scale */ GEOD_AREA = 1U<<14 | 1U<<4, /**< Calculate reduced length */ GEOD_ALL = 0x7F80U| 0x1FU /**< Calculate everything */ }; /** * flag values for the \e flags argument to geod_gendirect() and * geod_genposition() **********************************************************************/ enum geod_flags { GEOD_NOFLAGS = 0U, /**< No flags */ GEOD_ARCMODE = 1U<<0, /**< Position given in terms of arc distance */ GEOD_LONG_UNROLL = 1U<<15 /**< Unroll the longitude */ }; #if defined(__cplusplus) } #endif #endif proj-8.2.1/src/release.cpp000644 000765 000024 00000000545 14164067106 016062 0ustar00keversstaff000000 000000 /* <<< Release Notice for library >>> */ #include "proj.h" #include "proj_internal.h" #define STR_HELPER(x) #x #define STR(x) STR_HELPER(x) char const pj_release[] = "Rel. " STR(PROJ_VERSION_MAJOR)"." STR(PROJ_VERSION_MINOR)"." STR(PROJ_VERSION_PATCH)", " "January 1st, 2022"; const char *pj_get_release() { return pj_release; } proj-8.2.1/src/quadtree.hpp000644 000765 000024 00000022246 14042216156 016257 0ustar00keversstaff000000 000000 /****************************************************************************** * Project: PROJ * Purpose: Implementation of quadtree building and searching functions. * Derived from shapelib, mapserver and GDAL implementations * Author: Even Rouault, * ****************************************************************************** * Copyright (c) 1999-2008, Frank Warmerdam * Copyright (c) 2008-2020, Even Rouault * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. *****************************************************************************/ #ifndef QUADTREE_HPP #define QUADTREE_HPP #include "proj/util.hpp" #include #include //! @cond Doxygen_Suppress NS_PROJ_START namespace QuadTree { /* -------------------------------------------------------------------- */ /* If the following is 0.5, psNodes will be split in half. If it */ /* is 0.6 then each apSubNode will contain 60% of the parent */ /* psNode, with 20% representing overlap. This can be help to */ /* prevent small objects on a boundary from shifting too high */ /* up the hQuadTree. */ /* -------------------------------------------------------------------- */ constexpr double DEFAULT_SPLIT_RATIO = 0.55; /** Describe a rectangle */ struct RectObj { double minx = 0; /**< Minimum x */ double miny = 0; /**< Minimum y */ double maxx = 0; /**< Maximum x */ double maxy = 0; /**< Maximum y */ /* Returns whether this rectangle is contained by other */ inline bool isContainedBy(const RectObj &other) const { return minx >= other.minx && maxx <= other.maxx && miny >= other.miny && maxy <= other.maxy; } /* Returns whether this rectangles overlaps other */ inline bool overlaps(const RectObj &other) const { return minx <= other.maxx && maxx >= other.minx && miny <= other.maxy && maxy >= other.miny; } /* Returns whether this rectangles contains the specified point */ inline bool contains(double x, double y) const { return minx <= x && maxx >= x && miny <= y && maxy >= y; } /* Return whether this rectangles is different from other */ inline bool operator!=(const RectObj &other) const { return minx != other.minx || miny != other.miny || maxx != other.maxx || maxy != other.maxy; } }; /** Quadtree */ template class QuadTree { struct Node { RectObj rect{}; /* area covered by this psNode */ /* list of shapes stored at this node. */ std::vector> features{}; std::vector subnodes{}; explicit Node(const RectObj &rectIn) : rect(rectIn) {} }; Node root{}; unsigned nBucketCapacity = 8; double dfSplitRatio = DEFAULT_SPLIT_RATIO; public: /** Construct a new quadtree with the global bounds of all objects to be * inserted */ explicit QuadTree(const RectObj &globalBounds) : root(globalBounds) {} /** Add a new feature, with its bounds specified in featureBounds */ void insert(const Feature &feature, const RectObj &featureBounds) { insert(root, feature, featureBounds); } #ifdef UNUSED /** Retrieve all features whose bounds intersects aoiRect */ void search(const RectObj &aoiRect, std::vector> &features) const { search(root, aoiRect, features); } #endif /** Retrieve all features whose bounds contains (x,y) */ void search(double x, double y, std::vector &features) const { search(root, x, y, features); } private: void splitBounds(const RectObj &in, RectObj &out1, RectObj &out2) { // The output bounds will be very similar to the input bounds, // so just copy over to start. out1 = in; out2 = in; // Split in X direction. if ((in.maxx - in.minx) > (in.maxy - in.miny)) { const double range = in.maxx - in.minx; out1.maxx = in.minx + range * dfSplitRatio; out2.minx = in.maxx - range * dfSplitRatio; } // Otherwise split in Y direction. else { const double range = in.maxy - in.miny; out1.maxy = in.miny + range * dfSplitRatio; out2.miny = in.maxy - range * dfSplitRatio; } } void insert(Node &node, const Feature &feature, const RectObj &featureBounds) { if (node.subnodes.empty()) { // If we have reached the max bucket capacity, try to insert // in a subnode if possible. if (node.features.size() >= nBucketCapacity) { RectObj half1; RectObj half2; RectObj quad1; RectObj quad2; RectObj quad3; RectObj quad4; splitBounds(node.rect, half1, half2); splitBounds(half1, quad1, quad2); splitBounds(half2, quad3, quad4); if (node.rect != quad1 && node.rect != quad2 && node.rect != quad3 && node.rect != quad4 && (featureBounds.isContainedBy(quad1) || featureBounds.isContainedBy(quad2) || featureBounds.isContainedBy(quad3) || featureBounds.isContainedBy(quad4))) { node.subnodes.reserve(4); node.subnodes.emplace_back(Node(quad1)); node.subnodes.emplace_back(Node(quad2)); node.subnodes.emplace_back(Node(quad3)); node.subnodes.emplace_back(Node(quad4)); auto features = std::move(node.features); node.features.clear(); for (auto &pair : features) { insert(node, pair.first, pair.second); } /* recurse back on this psNode now that it has apSubNodes */ insert(node, feature, featureBounds); return; } } } else { // If we have sub nodes, then consider whether this object will // fit in them. for (auto &subnode : node.subnodes) { if (featureBounds.isContainedBy(subnode.rect)) { insert(subnode, feature, featureBounds); return; } } } // If none of that worked, just add it to this nodes list. node.features.push_back( std::pair(feature, featureBounds)); } #ifdef UNUSED void search(const Node &node, const RectObj &aoiRect, std::vector> &features) const { // Does this node overlap the area of interest at all? If not, // return without adding to the list at all. if (!node.rect.overlaps(aoiRect)) return; // Add the local features to the list. for (const auto &pair : node.features) { if (pair.second.overlaps(aoiRect)) { features.push_back( std::reference_wrapper(pair.first)); } } // Recurse to subnodes if they exist. for (const auto &subnode : node.subnodes) { search(subnode, aoiRect, features); } } #endif void search(const Node &node, double x, double y, std::vector &features) const { // Does this node overlap the area of interest at all? If not, // return without adding to the list at all. if (!node.rect.contains(x, y)) return; // Add the local features to the list. for (const auto &pair : node.features) { if (pair.second.contains(x, y)) { features.push_back(pair.first); } } // Recurse to subnodes if they exist. for (const auto &subnode : node.subnodes) { search(subnode, x, y, features); } } }; } // namespace QuadTree NS_PROJ_END //! @endcond #endif // QUADTREE_HPP proj-8.2.1/src/tsfn.cpp000644 000765 000024 00000002324 14017154140 015401 0ustar00keversstaff000000 000000 /* determine small t */ #include #include "proj.h" #include "proj_internal.h" double pj_tsfn(double phi, double sinphi, double e) { /**************************************************************************** * Determine function ts(phi) defined in Snyder (1987), Eq. (7-10) * Inputs: * phi = geographic latitude (radians) * e = eccentricity of the ellipsoid (dimensionless) * Output: * ts = exp(-psi) where psi is the isometric latitude (dimensionless) * = 1 / (tan(chi) + sec(chi)) * Here isometric latitude is defined by * psi = log( tan(pi/4 + phi/2) * * ( (1 - e*sin(phi)) / (1 + e*sin(phi)) )^(e/2) ) * = asinh(tan(phi)) - e * atanh(e * sin(phi)) * = asinh(tan(chi)) * chi = conformal latitude ***************************************************************************/ double cosphi = cos(phi); // exp(-asinh(tan(phi))) = 1 / (tan(phi) + sec(phi)) // = cos(phi) / (1 + sin(phi)) good for phi > 0 // = (1 - sin(phi)) / cos(phi) good for phi < 0 return exp(e * atanh(e * sinphi)) * ( sinphi > 0 ? cosphi / (1 + sinphi) : (1 - sinphi) / cosphi ); } proj-8.2.1/src/mutex.cpp000644 000765 000024 00000022101 14017154140 015564 0ustar00keversstaff000000 000000 /****************************************************************************** * Project: PROJ.4 * Purpose: Mutex (thread lock) functions. * Author: Frank Warmerdam, warmerdam@pobox.com * ****************************************************************************** * Copyright (c) 2009, Frank Warmerdam * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. *****************************************************************************/ /* For PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include "proj.h" #ifndef _WIN32 #include "proj_config.h" #endif #include "proj_internal.h" /* on win32 we always use win32 mutexes, even if pthreads are available */ #if defined(_WIN32) && !defined(MUTEX_stub) #ifndef MUTEX_win32 # define MUTEX_win32 #endif # undef MUTEX_pthread #endif #if !defined(MUTEX_stub) && !defined(MUTEX_pthread) && !defined(MUTEX_win32) # define MUTEX_stub #endif /************************************************************************/ /* ==================================================================== */ /* stub mutex implementation */ /* ==================================================================== */ /************************************************************************/ #ifdef MUTEX_stub /************************************************************************/ /* pj_acquire_lock() */ /* */ /* Acquire the PROJ.4 lock. */ /************************************************************************/ void pj_acquire_lock() { } /************************************************************************/ /* pj_release_lock() */ /* */ /* Release the PROJ.4 lock. */ /************************************************************************/ void pj_release_lock() { } /************************************************************************/ /* pj_cleanup_lock() */ /************************************************************************/ void pj_cleanup_lock() { } #endif /* def MUTEX_stub */ /************************************************************************/ /* ==================================================================== */ /* pthread mutex implementation */ /* ==================================================================== */ /************************************************************************/ #ifdef MUTEX_pthread #include "pthread.h" #ifdef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP #ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" #endif static pthread_mutex_t core_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; #ifdef __GNUC__ #pragma GCC diagnostic pop #endif #else static pthread_mutex_t core_lock; /************************************************************************/ /* pj_create_lock() */ /************************************************************************/ static void pj_create_lock() { /* ** We need to ensure the core mutex is created in recursive mode */ pthread_mutexattr_t mutex_attr; pthread_mutexattr_init(&mutex_attr); #ifdef HAVE_PTHREAD_MUTEX_RECURSIVE pthread_mutexattr_settype(&mutex_attr, PTHREAD_MUTEX_RECURSIVE); #else pthread_mutexattr_settype(&mutex_attr, PTHREAD_MUTEX_RECURSIVE_NP); #endif pthread_mutex_init(&core_lock, &mutex_attr); } #endif /* PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP */ /************************************************************************/ /* pj_acquire_lock() */ /* */ /* Acquire the PROJ.4 lock. */ /************************************************************************/ void pj_acquire_lock() { #ifndef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP static pthread_once_t sOnceKey = PTHREAD_ONCE_INIT; if( pthread_once(&sOnceKey, pj_create_lock) != 0 ) { fprintf(stderr, "pthread_once() failed in pj_acquire_lock().\n"); } #endif pthread_mutex_lock( &core_lock); } /************************************************************************/ /* pj_release_lock() */ /* */ /* Release the PROJ.4 lock. */ /************************************************************************/ void pj_release_lock() { pthread_mutex_unlock( &core_lock ); } /************************************************************************/ /* pj_cleanup_lock() */ /************************************************************************/ void pj_cleanup_lock() { } #endif /* def MUTEX_pthread */ /************************************************************************/ /* ==================================================================== */ /* win32 mutex implementation */ /* ==================================================================== */ /************************************************************************/ #ifdef MUTEX_win32 #include static HANDLE mutex_lock = nullptr; #if _WIN32_WINNT >= 0x0600 /************************************************************************/ /* pj_create_lock() */ /************************************************************************/ static BOOL CALLBACK pj_create_lock(PINIT_ONCE InitOnce, PVOID Parameter, PVOID *Context) { (void)InitOnce; (void)Parameter; (void)Context; mutex_lock = CreateMutex( nullptr, FALSE, nullptr ); return TRUE; } #endif /************************************************************************/ /* pj_init_lock() */ /************************************************************************/ static void pj_init_lock() { #if _WIN32_WINNT >= 0x0600 static INIT_ONCE sInitOnce = INIT_ONCE_STATIC_INIT; InitOnceExecuteOnce( &sInitOnce, pj_create_lock, nullptr, nullptr ); #else if( mutex_lock == nullptr ) mutex_lock = CreateMutex( nullptr, FALSE, nullptr ); #endif } /************************************************************************/ /* pj_acquire_lock() */ /* */ /* Acquire the PROJ.4 lock. */ /************************************************************************/ void pj_acquire_lock() { if( mutex_lock == nullptr ) pj_init_lock(); WaitForSingleObject( mutex_lock, INFINITE ); } /************************************************************************/ /* pj_release_lock() */ /* */ /* Release the PROJ.4 lock. */ /************************************************************************/ void pj_release_lock() { if( mutex_lock == nullptr ) pj_init_lock(); else ReleaseMutex( mutex_lock ); } /************************************************************************/ /* pj_cleanup_lock() */ /************************************************************************/ void pj_cleanup_lock() { if( mutex_lock != nullptr ) { CloseHandle( mutex_lock ); mutex_lock = nullptr; } } #endif /* def MUTEX_win32 */ proj-8.2.1/src/log.cpp000644 000765 000024 00000016171 14111601677 015224 0ustar00keversstaff000000 000000 /****************************************************************************** * Project: PROJ.4 * Purpose: Implementation of pj_log() function. * Author: Frank Warmerdam, warmerdam@pobox.com * ****************************************************************************** * Copyright (c) 2010, Frank Warmerdam * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. *****************************************************************************/ #include #include #include #include #include "proj.h" #include "proj_internal.h" /************************************************************************/ /* pj_stderr_logger() */ /************************************************************************/ void pj_stderr_logger( void *app_data, int level, const char *msg ) { (void) app_data; (void) level; fprintf( stderr, "%s\n", msg ); } /************************************************************************/ /* pj_log_active() */ /************************************************************************/ bool pj_log_active( PJ_CONTEXT *ctx, int level ) { int debug_level = ctx->debug_level; int shutup_unless_errno_set = debug_level < 0; /* For negative debug levels, we first start logging when errno is set */ if (ctx->last_errno==0 && shutup_unless_errno_set) return false; if (debug_level < 0) debug_level = -debug_level; if( level > debug_level ) return false; return true; } /************************************************************************/ /* pj_vlog() */ /************************************************************************/ static void pj_vlog( PJ_CONTEXT *ctx, int level, const PJ* P, const char *fmt, va_list args ) { char *msg_buf; if( !pj_log_active(ctx, level) ) return; constexpr size_t BUF_SIZE = 100000; msg_buf = (char *) malloc(BUF_SIZE); if( msg_buf == nullptr ) return; if( P == nullptr || P->short_name == nullptr ) vsnprintf( msg_buf, BUF_SIZE, fmt, args ); else { std::string fmt_with_P_short_name(P->short_name); fmt_with_P_short_name += ": "; fmt_with_P_short_name += fmt; vsnprintf( msg_buf, BUF_SIZE, fmt_with_P_short_name.c_str(), args ); } msg_buf[BUF_SIZE-1] = '\0'; ctx->logger( ctx->logger_app_data, level, msg_buf ); free( msg_buf ); } /************************************************************************/ /* pj_log() */ /************************************************************************/ void pj_log( PJ_CONTEXT *ctx, int level, const char *fmt, ... ) { va_list args; if( level > ctx->debug_level ) return; va_start( args, fmt ); pj_vlog( ctx, level, nullptr, fmt, args ); va_end( args ); } /***************************************************************************************/ PJ_LOG_LEVEL proj_log_level (PJ_CONTEXT *ctx, PJ_LOG_LEVEL log_level) { /**************************************************************************************** Set logging level 0-3. Higher number means more debug info. 0 turns it off ****************************************************************************************/ PJ_LOG_LEVEL previous; if (nullptr==ctx) ctx = pj_get_default_ctx(); if (nullptr==ctx) return PJ_LOG_TELL; previous = static_cast(abs (ctx->debug_level)); if (PJ_LOG_TELL==log_level) return previous; ctx->debug_level = log_level; return previous; } /*****************************************************************************/ void proj_log_error (const PJ *P, const char *fmt, ...) { /****************************************************************************** For reporting the most severe events. ******************************************************************************/ va_list args; va_start( args, fmt ); pj_vlog (pj_get_ctx ((PJ*)P), PJ_LOG_ERROR, P, fmt, args); va_end( args ); } /*****************************************************************************/ void proj_log_debug (PJ *P, const char *fmt, ...) { /****************************************************************************** For reporting debugging information. ******************************************************************************/ va_list args; va_start( args, fmt ); pj_vlog (pj_get_ctx (P), PJ_LOG_DEBUG, P, fmt, args); va_end( args ); } /*****************************************************************************/ void proj_context_log_debug (PJ_CONTEXT *ctx, const char *fmt, ...) { /****************************************************************************** For reporting debugging information. ******************************************************************************/ va_list args; va_start( args, fmt ); pj_vlog (ctx, PJ_LOG_DEBUG, nullptr, fmt, args); va_end( args ); } /*****************************************************************************/ void proj_log_trace (PJ *P, const char *fmt, ...) { /****************************************************************************** For reporting embarrassingly detailed debugging information. ******************************************************************************/ va_list args; va_start( args, fmt ); pj_vlog (pj_get_ctx (P), PJ_LOG_TRACE, P, fmt, args); va_end( args ); } /*****************************************************************************/ void proj_log_func (PJ_CONTEXT *ctx, void *app_data, PJ_LOG_FUNCTION logf) { /****************************************************************************** Put a new logging function into P's context. The opaque object app_data is passed as first arg at each call to the logger ******************************************************************************/ if (nullptr==ctx) ctx = pj_get_default_ctx (); ctx->logger_app_data = app_data; if (nullptr!=logf) ctx->logger = logf; } proj-8.2.1/src/bin_geodtest.cmake000644 000765 000024 00000000627 14140020570 017373 0ustar00keversstaff000000 000000 set(GEODTEST_SRC tests/geodtest.cpp) set(GEODTEST_INCLUDE) source_group("Source Files\\Bin" FILES ${GEODTEST_SRC} ${GEODTEST_INCLUDE}) add_executable(geodtest ${GEODTEST_SRC} ${GEODTEST_INCLUDE}) target_link_libraries(geodtest PRIVATE ${PROJ_LIBRARIES}) target_compile_options(geodtest PRIVATE ${PROJ_CXX_WARN_FLAGS}) # Do not install, instead run as a test add_test(NAME geodesic-test COMMAND geodtest) proj-8.2.1/src/wkt_parser.cpp000644 000765 000024 00000004746 13437770506 016641 0ustar00keversstaff000000 000000 /****************************************************************************** * Project: PROJ * Purpose: WKT parser common routines * Author: Even Rouault, * ****************************************************************************** * Copyright (c) 2018 Even Rouault, * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. ****************************************************************************/ #include "wkt_parser.hpp" #include #include // --------------------------------------------------------------------------- void pj_wkt_error(pj_wkt_parse_context *context, const char *msg) { context->errorMsg = "Parsing error : "; context->errorMsg += msg; context->errorMsg += ". Error occurred around:\n"; std::string ctxtMsg; const int n = static_cast(context->pszLastSuccess - context->pszInput); int start_i = std::max(0, n - 40); for (int i = start_i; i < n + 40 && context->pszInput[i]; i++) { if (context->pszInput[i] == '\r' || context->pszInput[i] == '\n') { if (i > n) { break; } else { ctxtMsg.clear(); start_i = i + 1; } } else { ctxtMsg += context->pszInput[i]; } } context->errorMsg += ctxtMsg; context->errorMsg += '\n'; for (int i = start_i; i < n; i++) context->errorMsg += ' '; context->errorMsg += '^'; } proj-8.2.1/src/CMakeLists.txt000644 000765 000024 00000005231 14140020570 016457 0ustar00keversstaff000000 000000 # first include proj library # always need include(lib_proj.cmake) # configure executable build option(BUILD_APPS "Build PROJ applications (default value for BUILD_CCT, BUILD_CS2CS, etc.)" ON) option(BUILD_CCT "Build cct (coordinate conversion and transformation tool)" "${BUILD_APPS}") option(BUILD_CS2CS "Build cs2cs (coordinate systems to coordinate systems translation tool)" "${BUILD_APPS}") option(BUILD_GEOD "Build geod (computation of geodesic lines)" "${BUILD_APPS}") option(BUILD_GIE "Build gie (geospatial integrity investigation environment)" "${BUILD_APPS}") option(BUILD_PROJ "Build proj (cartographic projection tool)" "${BUILD_APPS}") option(BUILD_PROJINFO "Build projinfo (SRS and coordinate operation metadata/query tool)" "${BUILD_APPS}") option(BUILD_PROJSYNC "Build projsync (synchronize transformation support data)" "${BUILD_APPS}") if(NOT MSVC) if(NOT APPLE) # Use relative path so that package is relocatable set(CMAKE_INSTALL_RPATH "\$ORIGIN/../${LIBDIR}") else() set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${LIBDIR}") # TO DO: cmake 2.8.12 introduces a way to make the install tree # relocatable with OSX via # (1) set(CMAKE_MACOSX_RPATH ON) and # (2) setting the INSTALL_RPATH property on the executables to # "@loader_path/../${LIBDIR}" endif() else() # Linking to setargv.obj enables wildcard globbing for the # command line utilities, when compiling with MSVC # https://docs.microsoft.com/cpp/c-language/expanding-wildcard-arguments set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} setargv.obj") endif() if(BUILD_CCT) include(bin_cct.cmake) set(BIN_TARGETS ${BIN_TARGETS} cct) endif() if(BUILD_CS2CS) include(bin_cs2cs.cmake) set(BIN_TARGETS ${BIN_TARGETS} cs2cs) endif() if(BUILD_GEOD) include(bin_geod.cmake) if(BUILD_TESTING) include(bin_geodtest.cmake) endif() set(BIN_TARGETS ${BIN_TARGETS} geod) endif() if(BUILD_PROJ) include(bin_proj.cmake) set(BIN_TARGETS ${BIN_TARGETS} binproj) endif() if(BUILD_PROJINFO) include(bin_projinfo.cmake) set(BIN_TARGETS ${BIN_TARGETS} binprojinfo) endif() # Always build gie if testing is requested if(BUILD_GIE OR BUILD_TESTING) include(bin_gie.cmake) set(BIN_TARGETS ${BIN_TARGETS} gie) endif() if(BUILD_PROJSYNC) if(NOT ENABLE_CURL) message(SEND_ERROR "projsync requires Curl") endif() include(bin_projsync.cmake) set(BIN_TARGETS ${BIN_TARGETS} bin_projsync) endif() if(MSVC OR CMAKE_CONFIGURATION_TYPES) if(BIN_TARGETS) # Add _d suffix for your debug versions of the tools set_target_properties(${BIN_TARGETS} PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) endif() endif() proj-8.2.1/src/ell_set.cpp000644 000765 000024 00000047437 14162105274 016101 0ustar00keversstaff000000 000000 /* set ellipsoid parameters a and es */ #include #include #include #include "proj.h" #include "proj_internal.h" /* Prototypes of the pj_ellipsoid helper functions */ static int ellps_ellps (PJ *P); static int ellps_size (PJ *P); static int ellps_shape (PJ *P); static int ellps_spherification (PJ *P); static paralist *pj_get_param (paralist *list, const char *key); static char *pj_param_value (paralist *list); static const PJ_ELLPS *pj_find_ellps (const char *name); /***************************************************************************************/ int pj_ellipsoid (PJ *P) { /**************************************************************************************** This is a replacement for the classic PROJ pj_ell_set function. The main difference is that pj_ellipsoid augments the PJ object with a copy of the exact tags used to define its related ellipsoid. This makes it possible to let a new PJ object inherit the geometrical properties of an existing one. A complete ellipsoid definition comprises a size (primary) and a shape (secondary) parameter. Size parameters supported are: R, defining the radius of a spherical planet a, defining the semimajor axis of an ellipsoidal planet Shape parameters supported are: rf, the reverse flattening of the ellipsoid f, the flattening of the ellipsoid es, the eccentricity squared e, the eccentricity b, the semiminor axis The ellps=xxx parameter provides both size and shape for a number of built in ellipsoid definitions. The ellipsoid definition may be augmented with a spherification flag, turning the ellipsoid into a sphere with features defined by the ellipsoid. Spherification parameters supported are: R_A, which gives a sphere with the same surface area as the ellipsoid R_V, which gives a sphere with the same volume as the ellipsoid R_a, which gives a sphere with R = (a + b)/2 (arithmetic mean) R_g, which gives a sphere with R = sqrt(a*b) (geometric mean) R_h, which gives a sphere with R = 2*a*b/(a+b) (harmonic mean) R_lat_a=phi, which gives a sphere with R being the arithmetic mean of of the corresponding ellipsoid at latitude phi. R_lat_g=phi, which gives a sphere with R being the geometric mean of of the corresponding ellipsoid at latitude phi. If R is given as size parameter, any shape and spherification parameters given are ignored. If size and shape are given as ellps=xxx, later shape and size parameters are are taken into account as modifiers for the built in ellipsoid definition. While this may seem strange, it is in accordance with historical PROJ behavior. It can e.g. be used to define coordinates on the ellipsoid scaled to unit semimajor axis by specifying "+ellps=xxx +a=1" ****************************************************************************************/ int err = proj_errno_reset (P); const char *empty = {""}; free(P->def_size); P->def_size = nullptr; free(P->def_shape); P->def_shape = nullptr; free(P->def_spherification); P->def_spherification = nullptr; free(P->def_ellps); P->def_ellps = nullptr; /* Specifying R overrules everything */ if (pj_get_param (P->params, "R")) { if (0 != ellps_size (P)) return 1; pj_calc_ellipsoid_params (P, P->a, 0); if (proj_errno (P)) return 1; return proj_errno_restore (P, err); } /* If an ellps argument is specified, start by using that */ if (0 != ellps_ellps (P)) return 1; /* We may overwrite the size */ if (0 != ellps_size (P)) return 2; /* We may also overwrite the shape */ if (0 != ellps_shape (P)) return 3; /* When we're done with it, we compute all related ellipsoid parameters */ pj_calc_ellipsoid_params (P, P->a, P->es); /* And finally, we may turn it into a sphere */ if (0 != ellps_spherification (P)) return 4; proj_log_trace (P, "pj_ellipsoid - final: a=%.3f f=1/%7.3f, errno=%d", P->a, P->f!=0? 1/P->f: 0, proj_errno (P)); proj_log_trace (P, "pj_ellipsoid - final: %s %s %s %s", P->def_size? P->def_size: empty, P->def_shape? P->def_shape: empty, P->def_spherification? P->def_spherification: empty, P->def_ellps? P->def_ellps: empty ); if (proj_errno (P)) return 5; /* success */ return proj_errno_restore (P, err); } /***************************************************************************************/ static int ellps_ellps (PJ *P) { /***************************************************************************************/ const PJ_ELLPS *ellps; paralist *par = nullptr; char *name; int err; /* Sail home if ellps=xxx is not specified */ par = pj_get_param (P->params, "ellps"); if (nullptr==par) return 0; /* Then look up the right size and shape parameters from the builtin list */ if (strlen (par->param) < 7) { proj_log_error(P, _("Invalid value for +ellps")); return proj_errno_set (P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); } name = par->param + 6; ellps = pj_find_ellps (name); if (nullptr==ellps) { proj_log_error(P, _("Unrecognized value for +ellps")); return proj_errno_set (P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); } /* Now, get things ready for ellps_size/ellps_shape, make them do their thing */ err = proj_errno_reset (P); paralist* new_params = pj_mkparam (ellps->major); if (nullptr == new_params) return proj_errno_set (P, PROJ_ERR_OTHER /*ENOMEM*/); new_params->next = pj_mkparam (ellps->ell); if (nullptr == new_params->next) { free(new_params); return proj_errno_set (P, PROJ_ERR_OTHER /*ENOMEM*/); } paralist* old_params = P->params; P->params = new_params; { PJ empty_PJ; pj_inherit_ellipsoid_def(&empty_PJ, P); } ellps_size (P); ellps_shape (P); P->params = old_params; free (new_params->next); free (new_params); if (proj_errno (P)) return proj_errno (P); /* Finally update P and sail home */ P->def_ellps = pj_strdup(par->param); par->used = 1; return proj_errno_restore (P, err); } /***************************************************************************************/ static int ellps_size (PJ *P) { /***************************************************************************************/ paralist *par = nullptr; int a_was_set = 0; free(P->def_size); P->def_size = nullptr; /* A size parameter *must* be given, but may have been given as ellps prior */ if (P->a != 0) a_was_set = 1; /* Check which size key is specified */ par = pj_get_param (P->params, "R"); if (nullptr==par) par = pj_get_param (P->params, "a"); if (nullptr==par) { if( a_was_set ) return 0; if( P->need_ellps ) proj_log_error(P, _("Major axis not given")); return proj_errno_set (P, PROJ_ERR_INVALID_OP_MISSING_ARG); } P->def_size = pj_strdup(par->param); par->used = 1; P->a = pj_atof (pj_param_value (par)); if (P->a <= 0) { proj_log_error(P, _("Invalid value for major axis")); return proj_errno_set (P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); } if (HUGE_VAL==P->a) { proj_log_error(P, _("Invalid value for major axis")); return proj_errno_set (P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); } if ('R'==par->param[0]) { P->es = P->f = P->e = P->rf = 0; P->b = P->a; } return 0; } /***************************************************************************************/ static int ellps_shape (PJ *P) { /***************************************************************************************/ const char *keys[] = {"rf", "f", "es", "e", "b"}; paralist *par = nullptr; size_t i, len; par = nullptr; len = sizeof (keys) / sizeof (char *); free(P->def_shape); P->def_shape = nullptr; /* Check which shape key is specified */ for (i = 0; i < len; i++) { par = pj_get_param (P->params, keys[i]); if (par) break; } /* Not giving a shape parameter means selecting a sphere, unless shape */ /* has been selected previously via ellps=xxx */ if (nullptr==par && P->es != 0) return 0; if (nullptr==par && P->es==0) { P->es = P->f = 0; P->b = P->a; return 0; } P->def_shape = pj_strdup(par->param); par->used = 1; P->es = P->f = P->b = P->e = P->rf = 0; switch (i) { /* reverse flattening, rf */ case 0: P->rf = pj_atof (pj_param_value (par)); if (HUGE_VAL==P->rf || P->rf <= 0) { proj_log_error(P, _("Invalid value for rf. Should be > 0")); return proj_errno_set (P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); } P->f = 1 / P->rf; P->es = 2*P->f - P->f*P->f; break; /* flattening, f */ case 1: P->f = pj_atof (pj_param_value (par)); if (HUGE_VAL==P->f || P->f < 0) { proj_log_error(P, _("Invalid value for f. Should be >= 0")); return proj_errno_set (P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); } P->rf = P->f != 0.0 ? 1.0/P->f: HUGE_VAL; P->es = 2*P->f - P->f*P->f; break; /* eccentricity squared, es */ case 2: P->es = pj_atof (pj_param_value (par)); if (HUGE_VAL==P->es || P->es < 0 || P->es >= 1) { proj_log_error(P, _("Invalid value for es. Should be in [0,1[ range")); return proj_errno_set (P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); } break; /* eccentricity, e */ case 3: P->e = pj_atof (pj_param_value (par)); if (HUGE_VAL==P->e || P->e < 0 || P->e >= 1) { proj_log_error(P, _("Invalid value for e. Should be in [0,1[ range")); return proj_errno_set (P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); } P->es = P->e * P->e; break; /* semiminor axis, b */ case 4: P->b = pj_atof (pj_param_value (par)); if (HUGE_VAL==P->b || P->b <= 0) { proj_log_error(P, _("Invalid value for b. Should be > 0")); return proj_errno_set (P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); } if (P->b==P->a) break; P->f = (P->a - P->b) / P->a; P->es = 2*P->f - P->f*P->f; break; default: // shouldn't happen return PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE; } // Written that way to catch NaN if (!(P->es >= 0)) { proj_log_error(P, _("Invalid eccentricity")); return proj_errno_set (P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); } return 0; } /* series coefficients for calculating ellipsoid-equivalent spheres */ static const double SIXTH = 1/6.; static const double RA4 = 17/360.; static const double RA6 = 67/3024.; static const double RV4 = 5/72.; static const double RV6 = 55/1296.; /***************************************************************************************/ static int ellps_spherification (PJ *P) { /***************************************************************************************/ const char *keys[] = {"R_A", "R_V", "R_a", "R_g", "R_h", "R_lat_a", "R_lat_g"}; size_t len, i; paralist *par = nullptr; double t; char *v, *endp; len = sizeof (keys) / sizeof (char *); /* Check which spherification key is specified */ for (i = 0; i < len; i++) { par = pj_get_param (P->params, keys[i]); if (par) break; } /* No spherification specified? Then we're done */ if (i==len) return 0; /* Store definition */ P->def_spherification = pj_strdup(par->param); par->used = 1; switch (i) { /* R_A - a sphere with same area as ellipsoid */ case 0: P->a *= 1. - P->es * (SIXTH + P->es * (RA4 + P->es * RA6)); break; /* R_V - a sphere with same volume as ellipsoid */ case 1: P->a *= 1. - P->es * (SIXTH + P->es * (RV4 + P->es * RV6)); break; /* R_a - a sphere with R = the arithmetic mean of the ellipsoid */ case 2: P->a = (P->a + P->b) / 2; break; /* R_g - a sphere with R = the geometric mean of the ellipsoid */ case 3: P->a = sqrt (P->a * P->b); break; /* R_h - a sphere with R = the harmonic mean of the ellipsoid */ case 4: if (P->a + P->b == 0) return proj_errno_set (P, PROJ_ERR_COORD_TRANSFM_OUTSIDE_PROJECTION_DOMAIN); P->a = (2*P->a * P->b) / (P->a + P->b); break; /* R_lat_a - a sphere with R = the arithmetic mean of the ellipsoid at given latitude */ case 5: /* R_lat_g - a sphere with R = the geometric mean of the ellipsoid at given latitude */ case 6: v = pj_param_value (par); t = proj_dmstor (v, &endp); if (fabs (t) > M_HALFPI) { proj_log_error(P, _("Invalid value for lat_g. |lat_g| should be <= 90°")); return proj_errno_set (P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); } t = sin (t); t = 1 - P->es * t * t; if (t == 0.) { proj_log_error(P, _("Invalid eccentricity")); return proj_errno_set (P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); } if (i==5) /* arithmetic */ P->a *= (1. - P->es + t) / (2 * t * sqrt(t)); else /* geometric */ P->a *= sqrt (1 - P->es) / t; break; } if (P->a <= 0.) { proj_log_error(P, _("Invalid or missing major axis")); return proj_errno_set (P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); } /* Clean up the ellipsoidal parameters to reflect the sphere */ P->es = P->e = P->f = 0; P->rf = HUGE_VAL; P->b = P->a; pj_calc_ellipsoid_params (P, P->a, 0); return 0; } /* locate parameter in list */ static paralist *pj_get_param (paralist *list, const char *key) { size_t l = strlen(key); while (list && !(0==strncmp(list->param, key, l) && (0==list->param[l] || list->param[l] == '=') ) ) list = list->next; return list; } static char *pj_param_value (paralist *list) { char *key, *value; if (nullptr==list) return nullptr; key = list->param; value = strchr (key, '='); /* a flag (i.e. a key without value) has its own name (key) as value */ return value? value + 1: key; } static const PJ_ELLPS *pj_find_ellps (const char *name) { int i; const char *s; const PJ_ELLPS *ellps; if (nullptr==name) return nullptr; ellps = proj_list_ellps(); /* Search through internal ellipsoid list for name */ for (i = 0; (s = ellps[i].id) && strcmp(name, s) ; ++i); if (nullptr==s) return nullptr; return ellps + i; } /**************************************************************************************/ void pj_inherit_ellipsoid_def (const PJ *src, PJ *dst) { /*************************************************************************************** Brute force copy the ellipsoidal parameters from src to dst. This code was written before the actual ellipsoid setup parameters were kept available in the PJ->def_xxx elements. ***************************************************************************************/ /* The linear parameters */ dst->a = src->a; dst->b = src->b; dst->ra = src->ra; dst->rb = src->rb; /* The eccentricities */ dst->alpha = src->alpha; dst->e = src->e; dst->es = src->es; dst->e2 = src->e2; dst->e2s = src->e2s; dst->e3 = src->e3; dst->e3s = src->e3s; dst->one_es = src->one_es; dst->rone_es = src->rone_es; /* The flattenings */ dst->f = src->f; dst->f2 = src->f2; dst->n = src->n; dst->rf = src->rf; dst->rf2 = src->rf2; dst->rn = src->rn; /* This one's for GRS80 */ dst->J = src->J; /* es and a before any +proj related adjustment */ dst->es_orig = src->es_orig; dst->a_orig = src->a_orig; } /***************************************************************************************/ int pj_calc_ellipsoid_params (PJ *P, double a, double es) { /**************************************************************************************** Calculate a large number of ancillary ellipsoidal parameters, in addition to the two traditional PROJ defining parameters: Semimajor axis, a, and the eccentricity squared, es. Most of these parameters are fairly cheap to compute in comparison to the overall effort involved in initializing a PJ object. They may, however, take a substantial part of the time taken in computing an individual point transformation. So by providing them up front, we can amortize the (already modest) cost over all transformations carried out over the entire lifetime of a PJ object, rather than incur that cost for every single transformation. Most of the parameter calculations here are based on the "angular eccentricity", i.e. the angle, measured from the semiminor axis, of a line going from the north pole to one of the foci of the ellipsoid - or in other words: The arc sine of the eccentricity. The formulae used are mostly taken from: Richard H. Rapp: Geometric Geodesy, Part I, (178 pp, 1991). Columbus, Ohio: Dept. of Geodetic Science and Surveying, Ohio State University. ****************************************************************************************/ P->a = a; P->es = es; /* Compute some ancillary ellipsoidal parameters */ if (P->e==0) P->e = sqrt(P->es); /* eccentricity */ P->alpha = asin (P->e); /* angular eccentricity */ /* second eccentricity */ P->e2 = tan (P->alpha); P->e2s = P->e2 * P->e2; /* third eccentricity */ P->e3 = (0!=P->alpha)? sin (P->alpha) / sqrt(2 - sin (P->alpha)*sin (P->alpha)): 0; P->e3s = P->e3 * P->e3; /* flattening */ if (0==P->f) P->f = 1 - cos (P->alpha); /* = 1 - sqrt (1 - PIN->es); */ if (P->f == 1.0) { proj_log_error(P, _("Invalid eccentricity")); proj_errno_set (P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); return PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE; } P->rf = P->f != 0.0 ? 1.0/P->f: HUGE_VAL; /* second flattening */ P->f2 = (cos(P->alpha)!=0)? 1/cos (P->alpha) - 1: 0; P->rf2 = P->f2 != 0.0 ? 1/P->f2: HUGE_VAL; /* third flattening */ P->n = pow (tan (P->alpha/2), 2); P->rn = P->n != 0.0 ? 1/P->n: HUGE_VAL; /* ...and a few more */ if (0==P->b) P->b = (1 - P->f)*P->a; P->rb = 1. / P->b; P->ra = 1. / P->a; P->one_es = 1. - P->es; if (P->one_es == 0.) { proj_log_error(P, _("Invalid eccentricity")); proj_errno_set (P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); return PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE; } P->rone_es = 1./P->one_es; return 0; } /**************************************************************************************/ int pj_ell_set (PJ_CONTEXT *ctx, paralist *pl, double *a, double *es) { /*************************************************************************************** Initialize ellipsoidal parameters by emulating the original ellipsoid setup function by Gerald Evenden, through a call to pj_ellipsoid ***************************************************************************************/ PJ B; int ret; B.ctx = ctx; B.params = pl; ret = pj_ellipsoid (&B); if (ret) return ret; *a = B.a; *es = B.es; return 0; } proj-8.2.1/src/iso19111/000755 000765 000024 00000000000 14164067214 015121 5ustar00keversstaff000000 000000 proj-8.2.1/src/transformations/000755 000765 000024 00000000000 14164067215 017164 5ustar00keversstaff000000 000000 proj-8.2.1/src/gauss.cpp000644 000765 000024 00000006621 14017154140 015555 0ustar00keversstaff000000 000000 /* ** libproj -- library of cartographic projections ** ** Copyright (c) 2003 Gerald I. Evenden */ /* ** Permission is hereby granted, free of charge, to any person obtaining ** a copy of this software and associated documentation files (the ** "Software"), to deal in the Software without restriction, including ** without limitation the rights to use, copy, modify, merge, publish, ** distribute, sublicense, and/or sell copies of the Software, and to ** permit persons to whom the Software is furnished to do so, subject to ** the following conditions: ** ** The above copyright notice and this permission notice shall be ** included in all copies or substantial portions of the Software. ** ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #define PJ_LIB__ #include #include #include "proj.h" #include "proj_internal.h" #define MAX_ITER 20 namespace { // anonymous namespace struct GAUSS { double C; double K; double e; double ratexp; }; } // anonymous namespace #define DEL_TOL 1e-14 static double srat(double esinp, double ratexp) { return(pow((1.-esinp)/(1.+esinp), ratexp)); } void *pj_gauss_ini(double e, double phi0, double *chi, double *rc) { double sphi, cphi, es; struct GAUSS *en; if ((en = (struct GAUSS *)malloc(sizeof(struct GAUSS))) == nullptr) return (nullptr); es = e * e; en->e = e; sphi = sin(phi0); cphi = cos(phi0); cphi *= cphi; *rc = sqrt(1. - es) / (1. - es * sphi * sphi); en->C = sqrt(1. + es * cphi * cphi / (1. - es)); if (en->C == 0.0) { free(en); return nullptr; } *chi = asin(sphi / en->C); en->ratexp = 0.5 * en->C * e; double srat_val = srat(en->e * sphi, en->ratexp); if (srat_val == 0.0) { free(en); return nullptr; } if( .5 * phi0 + M_FORTPI < 1e-10 ) { en->K = 1.0 / srat_val; } else { en->K = tan(.5 * *chi + M_FORTPI) / ( pow(tan(.5 * phi0 + M_FORTPI), en->C) * srat_val ); } return ((void *)en); } PJ_LP pj_gauss(PJ_CONTEXT *ctx, PJ_LP elp, const void *data) { const struct GAUSS *en = (const struct GAUSS *)data; PJ_LP slp; (void) ctx; slp.phi = 2. * atan( en->K * pow(tan(.5 * elp.phi + M_FORTPI), en->C) * srat(en->e * sin(elp.phi), en->ratexp) ) - M_HALFPI; slp.lam = en->C * (elp.lam); return(slp); } PJ_LP pj_inv_gauss(PJ_CONTEXT *ctx, PJ_LP slp, const void *data) { const struct GAUSS *en = (const struct GAUSS *)data; PJ_LP elp; double num; int i; elp.lam = slp.lam / en->C; num = pow(tan(.5 * slp.phi + M_FORTPI)/en->K, 1./en->C); for (i = MAX_ITER; i; --i) { elp.phi = 2. * atan(num * srat(en->e * sin(slp.phi), -.5 * en->e)) - M_HALFPI; if (fabs(elp.phi - slp.phi) < DEL_TOL) break; slp.phi = elp.phi; } /* convergence failed */ if (!i) proj_context_errno_set(ctx, PROJ_ERR_COORD_TRANSFM_OUTSIDE_PROJECTION_DOMAIN); return (elp); } proj-8.2.1/src/bin_cct.cmake000644 000765 000024 00000000553 14140020570 016324 0ustar00keversstaff000000 000000 set(CCT_SRC apps/cct.cpp apps/proj_strtod.cpp apps/proj_strtod.h ) set(CCT_INCLUDE apps/optargpm.h) source_group("Source Files\\Bin" FILES ${CCT_SRC}) add_executable(cct ${CCT_SRC} ${CCT_INCLUDE}) target_link_libraries(cct PRIVATE ${PROJ_LIBRARIES}) target_compile_options(cct PRIVATE ${PROJ_CXX_WARN_FLAGS}) install(TARGETS cct DESTINATION ${BINDIR}) proj-8.2.1/src/proj_constants.h000644 000765 000024 00000067501 14140020570 017146 0ustar00keversstaff000000 000000 /****************************************************************************** * * Project: PROJ * Purpose: Constants * Author: Even Rouault * ****************************************************************************** * Copyright (c) 2018, Even Rouault * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. ****************************************************************************/ #ifndef PROJ_CONSTANTS_INCLUDED #define PROJ_CONSTANTS_INCLUDED /* Projection methods */ #define EPSG_NAME_METHOD_TRANSVERSE_MERCATOR "Transverse Mercator" #define EPSG_CODE_METHOD_TRANSVERSE_MERCATOR 9807 #define EPSG_NAME_METHOD_TRANSVERSE_MERCATOR_SOUTH_ORIENTATED \ "Transverse Mercator (South Orientated)" #define EPSG_CODE_METHOD_TRANSVERSE_MERCATOR_SOUTH_ORIENTATED 9808 #define PROJ_WKT2_NAME_METHOD_TWO_POINT_EQUIDISTANT "Two Point Equidistant" #define EPSG_NAME_METHOD_LAMBERT_CONIC_CONFORMAL_1SP \ "Lambert Conic Conformal (1SP)" #define EPSG_CODE_METHOD_LAMBERT_CONIC_CONFORMAL_1SP 9801 #define EPSG_NAME_METHOD_NZMG "New Zealand Map Grid" #define EPSG_CODE_METHOD_NZMG 9811 #define EPSG_NAME_METHOD_TUNISIA_MAPPING_GRID "Tunisia Mapping Grid" #define EPSG_CODE_METHOD_TUNISIA_MAPPING_GRID 9816 #define EPSG_NAME_METHOD_ALBERS_EQUAL_AREA "Albers Equal Area" #define EPSG_CODE_METHOD_ALBERS_EQUAL_AREA 9822 #define EPSG_NAME_METHOD_LAMBERT_CONIC_CONFORMAL_2SP \ "Lambert Conic Conformal (2SP)" #define EPSG_CODE_METHOD_LAMBERT_CONIC_CONFORMAL_2SP 9802 #define EPSG_NAME_METHOD_LAMBERT_CONIC_CONFORMAL_2SP_BELGIUM \ "Lambert Conic Conformal (2SP Belgium)" #define EPSG_CODE_METHOD_LAMBERT_CONIC_CONFORMAL_2SP_BELGIUM 9803 #define EPSG_NAME_METHOD_LAMBERT_CONIC_CONFORMAL_2SP_MICHIGAN \ "Lambert Conic Conformal (2SP Michigan)" #define EPSG_CODE_METHOD_LAMBERT_CONIC_CONFORMAL_2SP_MICHIGAN 1051 #define EPSG_NAME_METHOD_MODIFIED_AZIMUTHAL_EQUIDISTANT \ "Modified Azimuthal Equidistant" #define EPSG_CODE_METHOD_MODIFIED_AZIMUTHAL_EQUIDISTANT 9832 #define EPSG_NAME_METHOD_GUAM_PROJECTION "Guam Projection" #define EPSG_CODE_METHOD_GUAM_PROJECTION 9831 #define EPSG_NAME_METHOD_BONNE "Bonne" #define EPSG_CODE_METHOD_BONNE 9827 #define PROJ_WKT2_NAME_METHOD_COMPACT_MILLER "Compact Miller" #define EPSG_NAME_METHOD_LAMBERT_CYLINDRICAL_EQUAL_AREA_SPHERICAL \ "Lambert Cylindrical Equal Area (Spherical)" #define EPSG_CODE_METHOD_LAMBERT_CYLINDRICAL_EQUAL_AREA_SPHERICAL 9834 #define EPSG_NAME_METHOD_LAMBERT_CYLINDRICAL_EQUAL_AREA \ "Lambert Cylindrical Equal Area" #define EPSG_CODE_METHOD_LAMBERT_CYLINDRICAL_EQUAL_AREA 9835 #define EPSG_NAME_METHOD_CASSINI_SOLDNER "Cassini-Soldner" #define EPSG_CODE_METHOD_CASSINI_SOLDNER 9806 #define EPSG_NAME_METHOD_HYPERBOLIC_CASSINI_SOLDNER "Hyperbolic Cassini-Soldner" #define EPSG_CODE_METHOD_HYPERBOLIC_CASSINI_SOLDNER 9833 #define PROJ_WKT2_NAME_METHOD_EQUIDISTANT_CONIC "Equidistant Conic" #define PROJ_WKT2_NAME_METHOD_ECKERT_I "Eckert I" #define PROJ_WKT2_NAME_METHOD_ECKERT_II "Eckert II" #define PROJ_WKT2_NAME_METHOD_ECKERT_III "Eckert III" #define PROJ_WKT2_NAME_METHOD_ECKERT_IV "Eckert IV" #define PROJ_WKT2_NAME_METHOD_ECKERT_V "Eckert V" #define PROJ_WKT2_NAME_METHOD_ECKERT_VI "Eckert VI" #define EPSG_NAME_METHOD_EQUIDISTANT_CYLINDRICAL "Equidistant Cylindrical" #define EPSG_CODE_METHOD_EQUIDISTANT_CYLINDRICAL 1028 #define EPSG_NAME_METHOD_EQUIDISTANT_CYLINDRICAL_SPHERICAL \ "Equidistant Cylindrical (Spherical)" #define EPSG_CODE_METHOD_EQUIDISTANT_CYLINDRICAL_SPHERICAL 1029 #define PROJ_WKT2_NAME_METHOD_FLAT_POLAR_QUARTIC "Flat Polar Quartic" #define PROJ_WKT2_NAME_METHOD_GALL_STEREOGRAPHIC "Gall Stereographic" #define PROJ_WKT2_NAME_METHOD_GOODE_HOMOLOSINE "Goode Homolosine" #define PROJ_WKT2_NAME_METHOD_INTERRUPTED_GOODE_HOMOLOSINE \ "Interrupted Goode Homolosine" #define PROJ_WKT2_NAME_METHOD_INTERRUPTED_GOODE_HOMOLOSINE_OCEAN \ "Interrupted Goode Homolosine Ocean" #define PROJ_WKT2_NAME_METHOD_GEOSTATIONARY_SATELLITE_SWEEP_X \ "Geostationary Satellite (Sweep X)" #define PROJ_WKT2_NAME_METHOD_GEOSTATIONARY_SATELLITE_SWEEP_Y \ "Geostationary Satellite (Sweep Y)" #define PROJ_WKT2_NAME_METHOD_GAUSS_SCHREIBER_TRANSVERSE_MERCATOR \ "Gauss Schreiber Transverse Mercator" #define PROJ_WKT2_NAME_METHOD_GNOMONIC "Gnomonic" #define EPSG_NAME_METHOD_HOTINE_OBLIQUE_MERCATOR_VARIANT_A \ "Hotine Oblique Mercator (variant A)" #define EPSG_CODE_METHOD_HOTINE_OBLIQUE_MERCATOR_VARIANT_A 9812 #define EPSG_NAME_METHOD_HOTINE_OBLIQUE_MERCATOR_VARIANT_B \ "Hotine Oblique Mercator (variant B)" #define EPSG_CODE_METHOD_HOTINE_OBLIQUE_MERCATOR_VARIANT_B 9815 #define PROJ_WKT2_NAME_METHOD_HOTINE_OBLIQUE_MERCATOR_TWO_POINT_NATURAL_ORIGIN \ "Hotine Oblique Mercator Two Point Natural Origin" #define PROJ_WKT2_NAME_INTERNATIONAL_MAP_WORLD_POLYCONIC \ "International Map of the World Polyconic" #define EPSG_NAME_METHOD_KROVAK_NORTH_ORIENTED "Krovak (North Orientated)" #define EPSG_CODE_METHOD_KROVAK_NORTH_ORIENTED 1041 #define EPSG_NAME_METHOD_KROVAK "Krovak" #define EPSG_CODE_METHOD_KROVAK 9819 #define EPSG_NAME_METHOD_LAMBERT_AZIMUTHAL_EQUAL_AREA \ "Lambert Azimuthal Equal Area" #define EPSG_CODE_METHOD_LAMBERT_AZIMUTHAL_EQUAL_AREA 9820 #define EPSG_NAME_METHOD_LAMBERT_AZIMUTHAL_EQUAL_AREA_SPHERICAL \ "Lambert Azimuthal Equal Area (Spherical)" #define EPSG_CODE_METHOD_LAMBERT_AZIMUTHAL_EQUAL_AREA_SPHERICAL 1027 #define PROJ_WKT2_NAME_METHOD_MILLER_CYLINDRICAL "Miller Cylindrical" #define EPSG_CODE_METHOD_MERCATOR_VARIANT_A 9804 #define EPSG_NAME_METHOD_MERCATOR_VARIANT_A "Mercator (variant A)" #define EPSG_CODE_METHOD_MERCATOR_VARIANT_B 9805 #define EPSG_NAME_METHOD_MERCATOR_VARIANT_B "Mercator (variant B)" #define EPSG_NAME_METHOD_POPULAR_VISUALISATION_PSEUDO_MERCATOR \ "Popular Visualisation Pseudo Mercator" #define EPSG_CODE_METHOD_POPULAR_VISUALISATION_PSEUDO_MERCATOR 1024 #define PROJ_WKT2_NAME_METHOD_MOLLWEIDE "Mollweide" #define PROJ_WKT2_NAME_METHOD_NATURAL_EARTH "Natural Earth" #define PROJ_WKT2_NAME_METHOD_NATURAL_EARTH_II "Natural Earth II" #define EPSG_NAME_METHOD_OBLIQUE_STEREOGRAPHIC "Oblique Stereographic" #define EPSG_CODE_METHOD_OBLIQUE_STEREOGRAPHIC 9809 #define EPSG_NAME_METHOD_ORTHOGRAPHIC "Orthographic" #define EPSG_CODE_METHOD_ORTHOGRAPHIC 9840 #define PROJ_WKT2_NAME_ORTHOGRAPHIC_SPHERICAL \ "Orthographic (Spherical)" #define PROJ_WKT2_NAME_METHOD_PATTERSON "Patterson" #define EPSG_NAME_METHOD_AMERICAN_POLYCONIC "American Polyconic" #define EPSG_CODE_METHOD_AMERICAN_POLYCONIC 9818 #define EPSG_NAME_METHOD_POLAR_STEREOGRAPHIC_VARIANT_A \ "Polar Stereographic (variant A)" #define EPSG_CODE_METHOD_POLAR_STEREOGRAPHIC_VARIANT_A 9810 #define EPSG_NAME_METHOD_POLAR_STEREOGRAPHIC_VARIANT_B \ "Polar Stereographic (variant B)" #define EPSG_CODE_METHOD_POLAR_STEREOGRAPHIC_VARIANT_B 9829 #define PROJ_WKT2_NAME_METHOD_ROBINSON "Robinson" #define PROJ_WKT2_NAME_METHOD_SINUSOIDAL "Sinusoidal" #define PROJ_WKT2_NAME_METHOD_STEREOGRAPHIC "Stereographic" #define PROJ_WKT2_NAME_METHOD_TIMES "Times" #define PROJ_WKT2_NAME_METHOD_VAN_DER_GRINTEN "Van Der Grinten" #define PROJ_WKT2_NAME_METHOD_WAGNER_I "Wagner I" #define PROJ_WKT2_NAME_METHOD_WAGNER_II "Wagner II" #define PROJ_WKT2_NAME_METHOD_WAGNER_III "Wagner III" #define PROJ_WKT2_NAME_METHOD_WAGNER_IV "Wagner IV" #define PROJ_WKT2_NAME_METHOD_WAGNER_V "Wagner V" #define PROJ_WKT2_NAME_METHOD_WAGNER_VI "Wagner VI" #define PROJ_WKT2_NAME_METHOD_WAGNER_VII "Wagner VII" #define PROJ_WKT2_NAME_METHOD_QUADRILATERALIZED_SPHERICAL_CUBE \ "Quadrilateralized Spherical Cube" #define PROJ_WKT2_NAME_METHOD_S2 \ "S2" #define PROJ_WKT2_NAME_METHOD_SPHERICAL_CROSS_TRACK_HEIGHT \ "Spherical Cross-Track Height" #define EPSG_NAME_METHOD_EQUAL_EARTH "Equal Earth" #define EPSG_CODE_METHOD_EQUAL_EARTH 1078 #define EPSG_NAME_METHOD_LABORDE_OBLIQUE_MERCATOR "Laborde Oblique Mercator" #define EPSG_CODE_METHOD_LABORDE_OBLIQUE_MERCATOR 9813 #define EPSG_NAME_METHOD_VERTICAL_PERSPECTIVE "Vertical Perspective" #define EPSG_CODE_METHOD_VERTICAL_PERSPECTIVE 9838 #define PROJ_WKT2_NAME_METHOD_POLE_ROTATION_GRIB_CONVENTION "Pole rotation (GRIB convention)" #define PROJ_WKT2_NAME_METHOD_POLE_ROTATION_NETCDF_CF_CONVENTION "Pole rotation (netCDF CF convention)" #define EPSG_CODE_METHOD_COLOMBIA_URBAN 1052 #define EPSG_NAME_METHOD_COLOMBIA_URBAN "Colombia Urban" /* ------------------------------------------------------------------------ */ /* Projection parameters */ #define EPSG_NAME_PARAMETER_COLATITUDE_CONE_AXIS "Co-latitude of cone axis" #define EPSG_CODE_PARAMETER_COLATITUDE_CONE_AXIS 1036 #define EPSG_NAME_PARAMETER_LATITUDE_OF_NATURAL_ORIGIN \ "Latitude of natural origin" #define EPSG_CODE_PARAMETER_LATITUDE_OF_NATURAL_ORIGIN 8801 #define EPSG_NAME_PARAMETER_LONGITUDE_OF_NATURAL_ORIGIN \ "Longitude of natural origin" #define EPSG_CODE_PARAMETER_LONGITUDE_OF_NATURAL_ORIGIN 8802 #define EPSG_NAME_PARAMETER_SCALE_FACTOR_AT_NATURAL_ORIGIN \ "Scale factor at natural origin" #define EPSG_CODE_PARAMETER_SCALE_FACTOR_AT_NATURAL_ORIGIN 8805 #define EPSG_NAME_PARAMETER_FALSE_EASTING "False easting" #define EPSG_CODE_PARAMETER_FALSE_EASTING 8806 #define EPSG_NAME_PARAMETER_FALSE_NORTHING "False northing" #define EPSG_CODE_PARAMETER_FALSE_NORTHING 8807 #define EPSG_NAME_PARAMETER_LATITUDE_PROJECTION_CENTRE \ "Latitude of projection centre" #define EPSG_CODE_PARAMETER_LATITUDE_PROJECTION_CENTRE 8811 #define EPSG_NAME_PARAMETER_LONGITUDE_PROJECTION_CENTRE \ "Longitude of projection centre" #define EPSG_CODE_PARAMETER_LONGITUDE_PROJECTION_CENTRE 8812 #define EPSG_NAME_PARAMETER_AZIMUTH_INITIAL_LINE "Azimuth of initial line" #define EPSG_CODE_PARAMETER_AZIMUTH_INITIAL_LINE 8813 #define EPSG_NAME_PARAMETER_ANGLE_RECTIFIED_TO_SKEW_GRID \ "Angle from Rectified to Skew Grid" #define EPSG_CODE_PARAMETER_ANGLE_RECTIFIED_TO_SKEW_GRID 8814 #define EPSG_NAME_PARAMETER_SCALE_FACTOR_INITIAL_LINE \ "Scale factor on initial line" #define EPSG_CODE_PARAMETER_SCALE_FACTOR_INITIAL_LINE 8815 #define EPSG_NAME_PARAMETER_EASTING_PROJECTION_CENTRE \ "Easting at projection centre" #define EPSG_CODE_PARAMETER_EASTING_PROJECTION_CENTRE 8816 #define EPSG_NAME_PARAMETER_NORTHING_PROJECTION_CENTRE \ "Northing at projection centre" #define EPSG_CODE_PARAMETER_NORTHING_PROJECTION_CENTRE 8817 #define EPSG_NAME_PARAMETER_LATITUDE_PSEUDO_STANDARD_PARALLEL \ "Latitude of pseudo standard parallel" #define EPSG_CODE_PARAMETER_LATITUDE_PSEUDO_STANDARD_PARALLEL 8818 #define EPSG_NAME_PARAMETER_SCALE_FACTOR_PSEUDO_STANDARD_PARALLEL \ "Scale factor on pseudo standard parallel" #define EPSG_CODE_PARAMETER_SCALE_FACTOR_PSEUDO_STANDARD_PARALLEL 8819 #define EPSG_NAME_PARAMETER_LATITUDE_FALSE_ORIGIN "Latitude of false origin" #define EPSG_CODE_PARAMETER_LATITUDE_FALSE_ORIGIN 8821 #define EPSG_NAME_PARAMETER_LONGITUDE_FALSE_ORIGIN "Longitude of false origin" #define EPSG_CODE_PARAMETER_LONGITUDE_FALSE_ORIGIN 8822 #define EPSG_NAME_PARAMETER_LATITUDE_1ST_STD_PARALLEL \ "Latitude of 1st standard parallel" #define EPSG_CODE_PARAMETER_LATITUDE_1ST_STD_PARALLEL 8823 #define EPSG_NAME_PARAMETER_LATITUDE_2ND_STD_PARALLEL \ "Latitude of 2nd standard parallel" #define EPSG_CODE_PARAMETER_LATITUDE_2ND_STD_PARALLEL 8824 #define EPSG_NAME_PARAMETER_EASTING_FALSE_ORIGIN "Easting at false origin" #define EPSG_CODE_PARAMETER_EASTING_FALSE_ORIGIN 8826 #define EPSG_NAME_PARAMETER_NORTHING_FALSE_ORIGIN "Northing at false origin" #define EPSG_CODE_PARAMETER_NORTHING_FALSE_ORIGIN 8827 #define EPSG_NAME_PARAMETER_LATITUDE_STD_PARALLEL "Latitude of standard parallel" #define EPSG_CODE_PARAMETER_LATITUDE_STD_PARALLEL 8832 #define EPSG_NAME_PARAMETER_LONGITUDE_OF_ORIGIN "Longitude of origin" #define EPSG_CODE_PARAMETER_LONGITUDE_OF_ORIGIN 8833 #define EPSG_NAME_PARAMETER_ELLIPSOID_SCALE_FACTOR "Ellipsoid scaling factor" #define EPSG_CODE_PARAMETER_ELLIPSOID_SCALE_FACTOR 1038 #define EPSG_NAME_PARAMETER_LATITUDE_TOPOGRAPHIC_ORIGIN "Latitude of topocentric origin" #define EPSG_CODE_PARAMETER_LATITUDE_TOPOGRAPHIC_ORIGIN 8834 #define EPSG_NAME_PARAMETER_LONGITUDE_TOPOGRAPHIC_ORIGIN "Longitude of topocentric origin" #define EPSG_CODE_PARAMETER_LONGITUDE_TOPOGRAPHIC_ORIGIN 8835 #define EPSG_NAME_PARAMETER_ELLIPSOIDAL_HEIGHT_TOPOCENTRIC_ORIGIN "Ellipsoidal height of topocentric origin" #define EPSG_CODE_PARAMETER_ELLIPSOIDAL_HEIGHT_TOPOCENTRIC_ORIGIN 8836 #define EPSG_NAME_PARAMETER_VIEWPOINT_HEIGHT "Viewpoint height" #define EPSG_CODE_PARAMETER_VIEWPOINT_HEIGHT 8840 #define EPSG_NAME_PARAMETER_PROJECTION_PLANE_ORIGIN_HEIGHT "Projection plane origin height" #define EPSG_CODE_PARAMETER_PROJECTION_PLANE_ORIGIN_HEIGHT 1039 /* ------------------------------------------------------------------------ */ /* Other conversions and transformations */ #define EPSG_NAME_METHOD_COORDINATE_FRAME_GEOCENTRIC \ "Coordinate Frame rotation (geocentric domain)" #define EPSG_CODE_METHOD_COORDINATE_FRAME_GEOCENTRIC 1032 #define EPSG_NAME_METHOD_COORDINATE_FRAME_GEOGRAPHIC_2D \ "Coordinate Frame rotation (geog2D domain)" #define EPSG_CODE_METHOD_COORDINATE_FRAME_GEOGRAPHIC_2D 9607 #define EPSG_NAME_METHOD_COORDINATE_FRAME_GEOGRAPHIC_3D \ "Coordinate Frame rotation (geog3D domain)" #define EPSG_CODE_METHOD_COORDINATE_FRAME_GEOGRAPHIC_3D 1038 #define EPSG_NAME_METHOD_POSITION_VECTOR_GEOCENTRIC \ "Position Vector transformation (geocentric domain)" #define EPSG_CODE_METHOD_POSITION_VECTOR_GEOCENTRIC 1033 #define EPSG_NAME_METHOD_POSITION_VECTOR_GEOGRAPHIC_2D \ "Position Vector transformation (geog2D domain)" #define EPSG_CODE_METHOD_POSITION_VECTOR_GEOGRAPHIC_2D 9606 #define EPSG_NAME_METHOD_POSITION_VECTOR_GEOGRAPHIC_3D \ "Position Vector transformation (geog3D domain)" #define EPSG_CODE_METHOD_POSITION_VECTOR_GEOGRAPHIC_3D 1037 #define EPSG_NAME_METHOD_GEOCENTRIC_TRANSLATION_GEOCENTRIC \ "Geocentric translations (geocentric domain)" #define EPSG_CODE_METHOD_GEOCENTRIC_TRANSLATION_GEOCENTRIC 1031 #define EPSG_NAME_METHOD_GEOCENTRIC_TRANSLATION_GEOGRAPHIC_2D \ "Geocentric translations (geog2D domain)" #define EPSG_CODE_METHOD_GEOCENTRIC_TRANSLATION_GEOGRAPHIC_2D 9603 #define EPSG_NAME_METHOD_GEOCENTRIC_TRANSLATION_GEOGRAPHIC_3D \ "Geocentric translations (geog3D domain)" #define EPSG_CODE_METHOD_GEOCENTRIC_TRANSLATION_GEOGRAPHIC_3D 1035 #define EPSG_NAME_METHOD_TIME_DEPENDENT_POSITION_VECTOR_GEOCENTRIC \ "Time-dependent Position Vector tfm (geocentric)" #define EPSG_CODE_METHOD_TIME_DEPENDENT_POSITION_VECTOR_GEOCENTRIC 1053 #define EPSG_NAME_METHOD_TIME_DEPENDENT_POSITION_VECTOR_GEOGRAPHIC_2D \ "Time-dependent Position Vector tfm (geog2D)" #define EPSG_CODE_METHOD_TIME_DEPENDENT_POSITION_VECTOR_GEOGRAPHIC_2D 1054 #define EPSG_NAME_METHOD_TIME_DEPENDENT_POSITION_VECTOR_GEOGRAPHIC_3D \ "Time-dependent Position Vector tfm (geog3D)" #define EPSG_CODE_METHOD_TIME_DEPENDENT_POSITION_VECTOR_GEOGRAPHIC_3D 1055 #define EPSG_NAME_METHOD_TIME_DEPENDENT_COORDINATE_FRAME_GEOCENTRIC \ "Time-dependent Coordinate Frame rotation geocen)" #define EPSG_CODE_METHOD_TIME_DEPENDENT_COORDINATE_FRAME_GEOCENTRIC \ 1056 #define EPSG_NAME_METHOD_TIME_DEPENDENT_COORDINATE_FRAME_GEOGRAPHIC_2D \ "Time-dependent Coordinate Frame rotation (geog2D)" #define EPSG_CODE_METHOD_TIME_DEPENDENT_COORDINATE_FRAME_GEOGRAPHIC_2D 1057 #define EPSG_NAME_METHOD_TIME_DEPENDENT_COORDINATE_FRAME_GEOGRAPHIC_3D \ "Time-dependent Coordinate Frame rotation (geog3D)" #define EPSG_CODE_METHOD_TIME_DEPENDENT_COORDINATE_FRAME_GEOGRAPHIC_3D 1058 #define EPSG_NAME_METHOD_MOLODENSKY_BADEKAS_CF_GEOCENTRIC \ "Molodensky-Badekas (CF geocentric domain)" #define EPSG_CODE_METHOD_MOLODENSKY_BADEKAS_CF_GEOCENTRIC 1034 #define EPSG_NAME_METHOD_MOLODENSKY_BADEKAS_PV_GEOCENTRIC \ "Molodensky-Badekas (PV geocentric domain)" #define EPSG_CODE_METHOD_MOLODENSKY_BADEKAS_PV_GEOCENTRIC 1061 #define EPSG_NAME_METHOD_MOLODENSKY_BADEKAS_CF_GEOGRAPHIC_3D \ "Molodensky-Badekas (CF geog3D domain)" #define EPSG_CODE_METHOD_MOLODENSKY_BADEKAS_CF_GEOGRAPHIC_3D 1039 #define EPSG_NAME_METHOD_MOLODENSKY_BADEKAS_PV_GEOGRAPHIC_3D \ "Molodensky-Badekas (PV geog3D domain)" #define EPSG_CODE_METHOD_MOLODENSKY_BADEKAS_PV_GEOGRAPHIC_3D 1062 #define EPSG_NAME_METHOD_MOLODENSKY_BADEKAS_CF_GEOGRAPHIC_2D \ "Molodensky-Badekas (CF geog2D domain)" #define EPSG_CODE_METHOD_MOLODENSKY_BADEKAS_CF_GEOGRAPHIC_2D 9636 #define EPSG_NAME_METHOD_MOLODENSKY_BADEKAS_PV_GEOGRAPHIC_2D \ "Molodensky-Badekas (PV geog2D domain)" #define EPSG_CODE_METHOD_MOLODENSKY_BADEKAS_PV_GEOGRAPHIC_2D 1063 #define EPSG_CODE_PARAMETER_X_AXIS_TRANSLATION 8605 #define EPSG_CODE_PARAMETER_Y_AXIS_TRANSLATION 8606 #define EPSG_CODE_PARAMETER_Z_AXIS_TRANSLATION 8607 #define EPSG_CODE_PARAMETER_X_AXIS_ROTATION 8608 #define EPSG_CODE_PARAMETER_Y_AXIS_ROTATION 8609 #define EPSG_CODE_PARAMETER_Z_AXIS_ROTATION 8610 #define EPSG_CODE_PARAMETER_SCALE_DIFFERENCE 8611 #define EPSG_CODE_PARAMETER_RATE_X_AXIS_TRANSLATION 1040 #define EPSG_CODE_PARAMETER_RATE_Y_AXIS_TRANSLATION 1041 #define EPSG_CODE_PARAMETER_RATE_Z_AXIS_TRANSLATION 1042 #define EPSG_CODE_PARAMETER_RATE_X_AXIS_ROTATION 1043 #define EPSG_CODE_PARAMETER_RATE_Y_AXIS_ROTATION 1044 #define EPSG_CODE_PARAMETER_RATE_Z_AXIS_ROTATION 1045 #define EPSG_CODE_PARAMETER_RATE_SCALE_DIFFERENCE 1046 #define EPSG_CODE_PARAMETER_REFERENCE_EPOCH 1047 #define EPSG_CODE_PARAMETER_TRANSFORMATION_REFERENCE_EPOCH 1049 #define EPSG_NAME_PARAMETER_X_AXIS_TRANSLATION "X-axis translation" #define EPSG_NAME_PARAMETER_Y_AXIS_TRANSLATION "Y-axis translation" #define EPSG_NAME_PARAMETER_Z_AXIS_TRANSLATION "Z-axis translation" #define EPSG_NAME_PARAMETER_X_AXIS_ROTATION "X-axis rotation" #define EPSG_NAME_PARAMETER_Y_AXIS_ROTATION "Y-axis rotation" #define EPSG_NAME_PARAMETER_Z_AXIS_ROTATION "Z-axis rotation" #define EPSG_NAME_PARAMETER_SCALE_DIFFERENCE "Scale difference" #define EPSG_NAME_PARAMETER_RATE_X_AXIS_TRANSLATION \ "Rate of change of X-axis translation" #define EPSG_NAME_PARAMETER_RATE_Y_AXIS_TRANSLATION \ "Rate of change of Y-axis translation" #define EPSG_NAME_PARAMETER_RATE_Z_AXIS_TRANSLATION \ "Rate of change of Z-axis translation" #define EPSG_NAME_PARAMETER_RATE_X_AXIS_ROTATION \ "Rate of change of X-axis rotation" #define EPSG_NAME_PARAMETER_RATE_Y_AXIS_ROTATION \ "Rate of change of Y-axis rotation" #define EPSG_NAME_PARAMETER_RATE_Z_AXIS_ROTATION \ "Rate of change of Z-axis rotation" #define EPSG_NAME_PARAMETER_RATE_SCALE_DIFFERENCE \ "Rate of change of Scale difference" #define EPSG_NAME_PARAMETER_REFERENCE_EPOCH "Parameter reference epoch" #define EPSG_CODE_PARAMETER_ORDINATE_1_EVAL_POINT 8617 #define EPSG_CODE_PARAMETER_ORDINATE_2_EVAL_POINT 8618 #define EPSG_CODE_PARAMETER_ORDINATE_3_EVAL_POINT 8667 #define \ EPSG_NAME_PARAMETER_ORDINATE_1_EVAL_POINT "Ordinate 1 of evaluation point" #define \ EPSG_NAME_PARAMETER_ORDINATE_2_EVAL_POINT "Ordinate 2 of evaluation point" #define \ EPSG_NAME_PARAMETER_ORDINATE_3_EVAL_POINT "Ordinate 3 of evaluation point" #define EPSG_NAME_PARAMETER_TRANSFORMATION_REFERENCE_EPOCH \ "Transformation reference epoch" #define EPSG_NAME_METHOD_MOLODENSKY "Molodensky" #define EPSG_CODE_METHOD_MOLODENSKY 9604 #define EPSG_NAME_METHOD_ABRIDGED_MOLODENSKY "Abridged Molodensky" #define EPSG_CODE_METHOD_ABRIDGED_MOLODENSKY 9605 #define EPSG_CODE_PARAMETER_SEMI_MAJOR_AXIS_DIFFERENCE 8654 #define EPSG_CODE_PARAMETER_FLATTENING_DIFFERENCE 8655 #define EPSG_NAME_PARAMETER_SEMI_MAJOR_AXIS_DIFFERENCE \ "Semi-major axis length difference" #define \ EPSG_NAME_PARAMETER_FLATTENING_DIFFERENCE "Flattening difference" #define PROJ_WKT2_NAME_PARAMETER_SOUTH_POLE_LATITUDE_GRIB_CONVENTION \ "Latitude of the southern pole (GRIB convention)" #define PROJ_WKT2_NAME_PARAMETER_SOUTH_POLE_LONGITUDE_GRIB_CONVENTION \ "Longitude of the southern pole (GRIB convention)" #define PROJ_WKT2_NAME_PARAMETER_AXIS_ROTATION_GRIB_CONVENTION \ "Axis rotation (GRIB convention)" #define PROJ_WKT2_NAME_PARAMETER_GRID_NORTH_POLE_LATITUDE_NETCDF_CONVENTION \ "Grid north pole latitude (netCDF CF convention)" #define PROJ_WKT2_NAME_PARAMETER_GRID_NORTH_POLE_LONGITUDE_NETCDF_CONVENTION \ "Grid north pole longitude (netCDF CF convention)" #define PROJ_WKT2_NAME_PARAMETER_NORTH_POLE_GRID_LONGITUDE_NETCDF_CONVENTION \ "North pole grid longitude (netCDF CF convention)" /* ------------------------------------------------------------------------ */ #define EPSG_CODE_METHOD_NTV1 9614 #define EPSG_NAME_METHOD_NTV1 "NTv1" #define EPSG_CODE_METHOD_NTV2 9615 #define EPSG_NAME_METHOD_NTV2 "NTv2" #define EPSG_CODE_PARAMETER_LATITUDE_LONGITUDE_DIFFERENCE_FILE 8656 #define EPSG_NAME_PARAMETER_LATITUDE_LONGITUDE_DIFFERENCE_FILE \ "Latitude and longitude difference file" #define EPSG_NAME_PARAMETER_GEOID_CORRECTION_FILENAME \ "Geoid (height correction) model file" #define EPSG_CODE_PARAMETER_GEOID_CORRECTION_FILENAME 8666 #define EPSG_NAME_METHOD_GEOCENTRIC_TRANSLATION_BY_GRID_INTERPOLATION_IGN \ "Geocentric translation by Grid Interpolation (IGN)" #define EPSG_CODE_METHOD_GEOCENTRIC_TRANSLATION_BY_GRID_INTERPOLATION_IGN 1087 #define EPSG_CODE_PARAMETER_GEOCENTRIC_TRANSLATION_FILE 8727 #define EPSG_NAME_PARAMETER_GEOCENTRIC_TRANSLATION_FILE \ "Geocentric translation file" /* ------------------------------------------------------------------------ */ #define PROJ_WKT2_NAME_METHOD_HEIGHT_TO_GEOG3D \ "GravityRelatedHeight to Geographic3D" #define PROJ_WKT2_NAME_METHOD_CTABLE2 "CTABLE2" #define PROJ_WKT2_NAME_METHOD_HORIZONTAL_SHIFT_GTIFF "HORIZONTAL_SHIFT_GTIFF" /* ------------------------------------------------------------------------ */ #define EPSG_CODE_METHOD_VERTCON 9658 #define EPSG_NAME_METHOD_VERTCON_OLDNAME "VERTCON" #define EPSG_NAME_METHOD_VERTCON "Vertical Offset by Grid Interpolation (VERTCON)" #define EPSG_CODE_METHOD_VERTICALGRID_NZLVD 1071 #define EPSG_NAME_METHOD_VERTICALGRID_NZLVD "Vertical Offset by Grid Interpolation (NZLVD)" #define EPSG_CODE_METHOD_VERTICALGRID_BEV_AT 1080 #define EPSG_NAME_METHOD_VERTICALGRID_BEV_AT "Vertical Offset by Grid Interpolation (BEV AT)" #define EPSG_CODE_METHOD_VERTICALGRID_GTX 1084 #define EPSG_NAME_METHOD_VERTICALGRID_GTX "Vertical Offset by Grid Interpolation (gtx)" #define EPSG_CODE_METHOD_VERTICALGRID_PL_TXT 1101 #define EPSG_NAME_METHOD_VERTICALGRID_PL_TXT "Vertical Offset by Grid Interpolation (PL txt)" #define EPSG_NAME_PARAMETER_VERTICAL_OFFSET_FILE "Vertical offset file" #define EPSG_CODE_PARAMETER_VERTICAL_OFFSET_FILE 8732 /* ------------------------------------------------------------------------ */ #define EPSG_CODE_METHOD_NADCON 9613 #define EPSG_NAME_METHOD_NADCON "NADCON" #define EPSG_NAME_PARAMETER_LATITUDE_DIFFERENCE_FILE "Latitude difference file" #define EPSG_CODE_PARAMETER_LATITUDE_DIFFERENCE_FILE 8657 #define \ EPSG_NAME_PARAMETER_LONGITUDE_DIFFERENCE_FILE "Longitude difference file" #define EPSG_CODE_PARAMETER_LONGITUDE_DIFFERENCE_FILE 8658 /* ------------------------------------------------------------------------ */ #define EPSG_CODE_METHOD_CHANGE_VERTICAL_UNIT 1069 #define EPSG_NAME_METHOD_CHANGE_VERTICAL_UNIT "Change of Vertical Unit" #define EPSG_CODE_METHOD_CHANGE_VERTICAL_UNIT_NO_CONV_FACTOR 1104 #define EPSG_NAME_METHOD_CHANGE_VERTICAL_UNIT_NO_CONV_FACTOR "Change of Vertical Unit" #define EPSG_NAME_PARAMETER_UNIT_CONVERSION_SCALAR "Unit conversion scalar" #define EPSG_CODE_PARAMETER_UNIT_CONVERSION_SCALAR 1051 /* ------------------------------------------------------------------------ */ #define EPSG_CODE_METHOD_LONGITUDE_ROTATION 9601 #define EPSG_NAME_METHOD_LONGITUDE_ROTATION "Longitude rotation" #define EPSG_CODE_METHOD_VERTICAL_OFFSET 9616 #define EPSG_NAME_METHOD_VERTICAL_OFFSET "Vertical Offset" #define EPSG_CODE_METHOD_GEOGRAPHIC2D_OFFSETS 9619 #define EPSG_NAME_METHOD_GEOGRAPHIC2D_OFFSETS "Geographic2D offsets" #define EPSG_CODE_METHOD_GEOGRAPHIC2D_WITH_HEIGHT_OFFSETS 9618 #define EPSG_NAME_METHOD_GEOGRAPHIC2D_WITH_HEIGHT_OFFSETS \ "Geographic2D with Height Offsets" #define EPSG_CODE_METHOD_GEOGRAPHIC3D_OFFSETS 9660 #define EPSG_NAME_METHOD_GEOGRAPHIC3D_OFFSETS "Geographic3D offsets" #define EPSG_CODE_METHOD_GEOGRAPHIC_GEOCENTRIC 9602 #define \ EPSG_NAME_METHOD_GEOGRAPHIC_GEOCENTRIC "Geographic/geocentric conversions" #define EPSG_NAME_PARAMETER_LATITUDE_OFFSET "Latitude offset" #define EPSG_CODE_PARAMETER_LATITUDE_OFFSET 8601 #define EPSG_NAME_PARAMETER_LONGITUDE_OFFSET "Longitude offset" #define EPSG_CODE_PARAMETER_LONGITUDE_OFFSET 8602 #define EPSG_NAME_PARAMETER_VERTICAL_OFFSET "Vertical Offset" #define EPSG_CODE_PARAMETER_VERTICAL_OFFSET 8603 #define EPSG_NAME_PARAMETER_GEOID_UNDULATION "Geoid undulation" #define EPSG_CODE_PARAMETER_GEOID_UNDULATION 8604 /* ------------------------------------------------------------------------ */ #define EPSG_CODE_METHOD_AFFINE_PARAMETRIC_TRANSFORMATION 9624 #define EPSG_NAME_METHOD_AFFINE_PARAMETRIC_TRANSFORMATION \ "Affine parametric transformation" #define EPSG_NAME_PARAMETER_A0 "A0" #define EPSG_CODE_PARAMETER_A0 8623 #define EPSG_NAME_PARAMETER_A1 "A1" #define EPSG_CODE_PARAMETER_A1 8624 #define EPSG_NAME_PARAMETER_A2 "A2" #define EPSG_CODE_PARAMETER_A2 8625 #define EPSG_NAME_PARAMETER_B0 "B0" #define EPSG_CODE_PARAMETER_B0 8639 #define EPSG_NAME_PARAMETER_B1 "B1" #define EPSG_CODE_PARAMETER_B1 8640 #define EPSG_NAME_PARAMETER_B2 "B2" #define EPSG_CODE_PARAMETER_B2 8641 /* ------------------------------------------------------------------------ */ #define EPSG_CODE_METHOD_AXIS_ORDER_REVERSAL_2D 9843 #define EPSG_NAME_METHOD_AXIS_ORDER_REVERSAL_2D "Axis Order Reversal (2D)" #define EPSG_CODE_METHOD_AXIS_ORDER_REVERSAL_3D 9844 #define EPSG_NAME_METHOD_AXIS_ORDER_REVERSAL_3D \ "Axis Order Reversal (Geographic3D horizontal)" /* ------------------------------------------------------------------------ */ #define EPSG_CODE_METHOD_HEIGHT_DEPTH_REVERSAL 1068 #define EPSG_NAME_METHOD_HEIGHT_DEPTH_REVERSAL "Height Depth Reversal" /* ------------------------------------------------------------------------ */ #define EPSG_NAME_METHOD_GEOCENTRIC_TOPOCENTRIC "Geocentric/topocentric conversions" #define EPSG_CODE_METHOD_GEOCENTRIC_TOPOCENTRIC 9836 #define EPSG_NAME_PARAMETER_GEOCENTRIC_X_TOPOCENTRIC_ORIGIN "Geocentric X of topocentric origin" #define EPSG_CODE_PARAMETER_GEOCENTRIC_X_TOPOCENTRIC_ORIGIN 8837 #define EPSG_NAME_PARAMETER_GEOCENTRIC_Y_TOPOCENTRIC_ORIGIN "Geocentric Y of topocentric origin" #define EPSG_CODE_PARAMETER_GEOCENTRIC_Y_TOPOCENTRIC_ORIGIN 8838 #define EPSG_NAME_PARAMETER_GEOCENTRIC_Z_TOPOCENTRIC_ORIGIN "Geocentric Z of topocentric origin" #define EPSG_CODE_PARAMETER_GEOCENTRIC_Z_TOPOCENTRIC_ORIGIN 8839 /* ------------------------------------------------------------------------ */ #define EPSG_NAME_METHOD_GEOGRAPHIC_TOPOCENTRIC "Geographic/topocentric conversions" #define EPSG_CODE_METHOD_GEOGRAPHIC_TOPOCENTRIC 9837 /* ------------------------------------------------------------------------ */ #define PROJ_WKT2_NAME_METHOD_GEOGRAPHIC_GEOCENTRIC_LATITUDE \ "Geographic latitude / Geocentric latitude" #endif /* PROJ_CONSTANTS_INCLUDED */ proj-8.2.1/src/bin_cs2cs.cmake000644 000765 000024 00000000522 14140020570 016564 0ustar00keversstaff000000 000000 set(CS2CS_SRC apps/cs2cs.cpp apps/emess.cpp apps/utils.cpp ) source_group("Source Files\\Bin" FILES ${CS2CS_SRC}) add_executable(cs2cs ${CS2CS_SRC} ${CS2CS_INCLUDE}) target_link_libraries(cs2cs PRIVATE ${PROJ_LIBRARIES}) target_compile_options(cs2cs PRIVATE ${PROJ_CXX_WARN_FLAGS}) install(TARGETS cs2cs DESTINATION ${BINDIR}) proj-8.2.1/src/ellps.cpp000644 000765 000024 00000006170 14017154140 015551 0ustar00keversstaff000000 000000 /* definition of standard geoids */ #include #include "proj.h" #include "proj_internal.h" static const struct PJ_ELLPS pj_ellps[] = { {"MERIT", "a=6378137.0", "rf=298.257", "MERIT 1983"}, {"SGS85", "a=6378136.0", "rf=298.257", "Soviet Geodetic System 85"}, {"GRS80", "a=6378137.0", "rf=298.257222101", "GRS 1980(IUGG, 1980)"}, {"IAU76", "a=6378140.0", "rf=298.257", "IAU 1976"}, {"airy", "a=6377563.396", "rf=299.3249646", "Airy 1830"}, {"APL4.9", "a=6378137.0", "rf=298.25", "Appl. Physics. 1965"}, {"NWL9D", "a=6378145.0", "rf=298.25", "Naval Weapons Lab., 1965"}, {"mod_airy", "a=6377340.189", "b=6356034.446", "Modified Airy"}, {"andrae", "a=6377104.43", "rf=300.0", "Andrae 1876 (Den., Iclnd.)"}, {"danish", "a=6377019.2563", "rf=300.0", "Andrae 1876 (Denmark, Iceland)"}, {"aust_SA", "a=6378160.0", "rf=298.25", "Australian Natl & S. Amer. 1969"}, {"GRS67", "a=6378160.0", "rf=298.2471674270", "GRS 67(IUGG 1967)"}, {"GSK2011", "a=6378136.5", "rf=298.2564151", "GSK-2011"}, {"bessel", "a=6377397.155", "rf=299.1528128", "Bessel 1841"}, {"bess_nam", "a=6377483.865", "rf=299.1528128", "Bessel 1841 (Namibia)"}, {"clrk66", "a=6378206.4", "b=6356583.8", "Clarke 1866"}, {"clrk80", "a=6378249.145", "rf=293.4663", "Clarke 1880 mod."}, {"clrk80ign", "a=6378249.2", "rf=293.4660212936269", "Clarke 1880 (IGN)."}, {"CPM", "a=6375738.7", "rf=334.29", "Comm. des Poids et Mesures 1799"}, {"delmbr", "a=6376428.", "rf=311.5", "Delambre 1810 (Belgium)"}, {"engelis", "a=6378136.05", "rf=298.2566", "Engelis 1985"}, {"evrst30", "a=6377276.345", "rf=300.8017", "Everest 1830"}, {"evrst48", "a=6377304.063", "rf=300.8017", "Everest 1948"}, {"evrst56", "a=6377301.243", "rf=300.8017", "Everest 1956"}, {"evrst69", "a=6377295.664", "rf=300.8017", "Everest 1969"}, {"evrstSS", "a=6377298.556", "rf=300.8017", "Everest (Sabah & Sarawak)"}, {"fschr60", "a=6378166.", "rf=298.3", "Fischer (Mercury Datum) 1960"}, {"fschr60m", "a=6378155.", "rf=298.3", "Modified Fischer 1960"}, {"fschr68", "a=6378150.", "rf=298.3", "Fischer 1968"}, {"helmert", "a=6378200.", "rf=298.3", "Helmert 1906"}, {"hough", "a=6378270.0", "rf=297.", "Hough"}, {"intl", "a=6378388.0", "rf=297.", "International 1924 (Hayford 1909, 1910)"}, {"krass", "a=6378245.0", "rf=298.3", "Krassovsky, 1942"}, {"kaula", "a=6378163.", "rf=298.24", "Kaula 1961"}, {"lerch", "a=6378139.", "rf=298.257", "Lerch 1979"}, {"mprts", "a=6397300.", "rf=191.", "Maupertius 1738"}, {"new_intl", "a=6378157.5", "b=6356772.2", "New International 1967"}, {"plessis", "a=6376523.", "b=6355863.", "Plessis 1817 (France)"}, {"PZ90", "a=6378136.0", "rf=298.25784", "PZ-90"}, {"SEasia", "a=6378155.0", "b=6356773.3205", "Southeast Asia"}, {"walbeck", "a=6376896.0", "b=6355834.8467", "Walbeck"}, {"WGS60", "a=6378165.0", "rf=298.3", "WGS 60"}, {"WGS66", "a=6378145.0", "rf=298.25", "WGS 66"}, {"WGS72", "a=6378135.0", "rf=298.26", "WGS 72"}, {"WGS84", "a=6378137.0", "rf=298.257223563", "WGS 84"}, {"sphere", "a=6370997.0", "b=6370997.0", "Normal Sphere (r=6370997)"}, {nullptr, nullptr, nullptr, nullptr} }; const PJ_ELLPS *proj_list_ellps(void) { return pj_ellps; } proj-8.2.1/src/datums.cpp000644 000765 000024 00000011120 13607156433 015731 0ustar00keversstaff000000 000000 /****************************************************************************** * Project: PROJ.4 * Purpose: Built in datum list. * Author: Frank Warmerdam, warmerda@home.com * ****************************************************************************** * Copyright (c) 2000, Frank Warmerdam * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. *****************************************************************************/ #include #include "proj.h" #define PJ_DATUMS__ #include "proj_internal.h" /* * The ellipse code must match one from pj_ellps.c. The datum id should * be kept to 12 characters or less if possible. Use the official OGC * datum name for the comments if available. */ C_NAMESPACE_VAR const struct PJ_DATUMS pj_datums[] = { /* id definition ellipse comments */ /* -- ---------- ------- -------- */ {"WGS84", "towgs84=0,0,0", "WGS84", ""}, {"GGRS87", "towgs84=-199.87,74.79,246.62", "GRS80", "Greek_Geodetic_Reference_System_1987"}, {"NAD83", "towgs84=0,0,0", "GRS80", "North_American_Datum_1983"}, {"NAD27", "nadgrids=@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat", "clrk66", "North_American_Datum_1927"}, {"potsdam", /*"towgs84=598.1,73.7,418.2,0.202,0.045,-2.455,6.7",*/ "nadgrids=@BETA2007.gsb", "bessel", "Potsdam Rauenberg 1950 DHDN"}, {"carthage","towgs84=-263.0,6.0,431.0", "clrk80ign", "Carthage 1934 Tunisia"}, {"hermannskogel", "towgs84=577.326,90.129,463.919,5.137,1.474,5.297,2.4232", "bessel", "Hermannskogel"}, {"ire65", "towgs84=482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15", "mod_airy", "Ireland 1965"}, {"nzgd49", "towgs84=59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993", "intl", "New Zealand Geodetic Datum 1949"}, {"OSGB36", "towgs84=446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894", "airy", "Airy 1830"}, {nullptr, nullptr, nullptr, nullptr} }; struct PJ_DATUMS *pj_get_datums_ref() { return (struct PJ_DATUMS *)pj_datums; } static const struct PJ_PRIME_MERIDIANS pj_prime_meridians[] = { /* id definition */ /* -- ---------- */ {"greenwich", "0dE"}, {"lisbon", "9d07'54.862\"W"}, {"paris", "2d20'14.025\"E"}, {"bogota", "74d04'51.3\"W"}, {"madrid", "3d41'16.58\"W"}, {"rome", "12d27'8.4\"E"}, {"bern", "7d26'22.5\"E"}, {"jakarta", "106d48'27.79\"E"}, {"ferro", "17d40'W"}, {"brussels", "4d22'4.71\"E"}, {"stockholm", "18d3'29.8\"E"}, {"athens", "23d42'58.815\"E"}, {"oslo", "10d43'22.5\"E"}, {"copenhagen","12d34'40.35\"E"}, {nullptr, nullptr} }; const PJ_PRIME_MERIDIANS *proj_list_prime_meridians(void) { return pj_prime_meridians; } proj-8.2.1/src/conversions/000755 000765 000024 00000000000 14164067215 016303 5ustar00keversstaff000000 000000 proj-8.2.1/src/wkt1_generated_parser.c000644 000765 000024 00000174462 14067153334 020375 0ustar00keversstaff000000 000000 /* A Bison parser, made by GNU Bison 3.5.1. */ /* Bison implementation for Yacc-like parsers in C Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Undocumented macros, especially those whose name start with YY_, are private implementation details. Do not rely on them. */ /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ #define YYBISON_VERSION "3.5.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 1 /* Push parsers. */ #define YYPUSH 0 /* Pull parsers. */ #define YYPULL 1 /* Substitute the variable and function names. */ #define yyparse pj_wkt1_parse #define yylex pj_wkt1_lex #define yyerror pj_wkt1_error #define yydebug pj_wkt1_debug #define yynerrs pj_wkt1_nerrs /* First part of user prologue. */ /****************************************************************************** * Project: PROJ * Purpose: WKT1 parser grammar * Author: Even Rouault, * ****************************************************************************** * Copyright (c) 2013-2018 Even Rouault, * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. ****************************************************************************/ #include "wkt1_parser.h" # ifndef YY_CAST # ifdef __cplusplus # define YY_CAST(Type, Val) static_cast (Val) # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast (Val) # else # define YY_CAST(Type, Val) ((Type) (Val)) # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) # endif # endif # ifndef YY_NULLPTR # if defined __cplusplus # if 201103L <= __cplusplus # define YY_NULLPTR nullptr # else # define YY_NULLPTR 0 # endif # else # define YY_NULLPTR ((void*)0) # endif # endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 1 #endif /* Use api.header.include to #include this header instead of duplicating it here. */ #ifndef YY_PJ_WKT1_SRC_WKT1_GENERATED_PARSER_H_INCLUDED # define YY_PJ_WKT1_SRC_WKT1_GENERATED_PARSER_H_INCLUDED /* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif #if YYDEBUG extern int pj_wkt1_debug; #endif /* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE enum yytokentype { END = 0, T_PARAM_MT = 258, T_CONCAT_MT = 259, T_INVERSE_MT = 260, T_PASSTHROUGH_MT = 261, T_PROJCS = 262, T_PROJECTION = 263, T_GEOGCS = 264, T_DATUM = 265, T_SPHEROID = 266, T_PRIMEM = 267, T_UNIT = 268, T_GEOCCS = 269, T_AUTHORITY = 270, T_VERT_CS = 271, T_VERTCS = 272, T_VERT_DATUM = 273, T_VDATUM = 274, T_COMPD_CS = 275, T_AXIS = 276, T_TOWGS84 = 277, T_FITTED_CS = 278, T_LOCAL_CS = 279, T_LOCAL_DATUM = 280, T_PARAMETER = 281, T_EXTENSION = 282, T_STRING = 283, T_NUMBER = 284, T_IDENTIFIER = 285 }; #endif /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif int pj_wkt1_parse (pj_wkt1_parse_context *context); #endif /* !YY_PJ_WKT1_SRC_WKT1_GENERATED_PARSER_H_INCLUDED */ #ifdef short # undef short #endif /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure and (if available) are included so that the code can choose integer types of a good width. */ #ifndef __PTRDIFF_MAX__ # include /* INFRINGES ON USER NAME SPACE */ # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ # include /* INFRINGES ON USER NAME SPACE */ # define YY_STDINT_H # endif #endif /* Narrow types that promote to a signed type and that can represent a signed or unsigned integer of at least N bits. In tables they can save space and decrease cache pressure. Promoting to a signed type helps avoid bugs in integer arithmetic. */ #ifdef __INT_LEAST8_MAX__ typedef __INT_LEAST8_TYPE__ yytype_int8; #elif defined YY_STDINT_H typedef int_least8_t yytype_int8; #else typedef signed char yytype_int8; #endif #ifdef __INT_LEAST16_MAX__ typedef __INT_LEAST16_TYPE__ yytype_int16; #elif defined YY_STDINT_H typedef int_least16_t yytype_int16; #else typedef short yytype_int16; #endif #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ typedef __UINT_LEAST8_TYPE__ yytype_uint8; #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ && UINT_LEAST8_MAX <= INT_MAX) typedef uint_least8_t yytype_uint8; #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX typedef unsigned char yytype_uint8; #else typedef short yytype_uint8; #endif #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ typedef __UINT_LEAST16_TYPE__ yytype_uint16; #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ && UINT_LEAST16_MAX <= INT_MAX) typedef uint_least16_t yytype_uint16; #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX typedef unsigned short yytype_uint16; #else typedef int yytype_uint16; #endif #ifndef YYPTRDIFF_T # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ # define YYPTRDIFF_T __PTRDIFF_TYPE__ # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ # elif defined PTRDIFF_MAX # ifndef ptrdiff_t # include /* INFRINGES ON USER NAME SPACE */ # endif # define YYPTRDIFF_T ptrdiff_t # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX # else # define YYPTRDIFF_T long # define YYPTRDIFF_MAXIMUM LONG_MAX # endif #endif #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned # endif #endif #define YYSIZE_MAXIMUM \ YY_CAST (YYPTRDIFF_T, \ (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ ? YYPTRDIFF_MAXIMUM \ : YY_CAST (YYSIZE_T, -1))) #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) /* Stored state numbers (used for stacks). */ typedef yytype_int16 yy_state_t; /* State numbers in computations. */ typedef int yy_state_fast_t; #ifndef YY_ # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(Msgid) dgettext ("bison-runtime", Msgid) # endif # endif # ifndef YY_ # define YY_(Msgid) Msgid # endif #endif #ifndef YY_ATTRIBUTE_PURE # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) # else # define YY_ATTRIBUTE_PURE # endif #endif #ifndef YY_ATTRIBUTE_UNUSED # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) # else # define YY_ATTRIBUTE_UNUSED # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(E) ((void) (E)) #else # define YYUSE(E) /* empty */ #endif #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* Suppress an incorrect diagnostic about yylval being uninitialized. */ # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ _Pragma ("GCC diagnostic pop") #else # define YY_INITIAL_VALUE(Value) Value #endif #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN # define YY_IGNORE_MAYBE_UNINITIALIZED_END #endif #ifndef YY_INITIAL_VALUE # define YY_INITIAL_VALUE(Value) /* Nothing. */ #endif #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ # define YY_IGNORE_USELESS_CAST_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") # define YY_IGNORE_USELESS_CAST_END \ _Pragma ("GCC diagnostic pop") #endif #ifndef YY_IGNORE_USELESS_CAST_BEGIN # define YY_IGNORE_USELESS_CAST_BEGIN # define YY_IGNORE_USELESS_CAST_END #endif #define YY_ASSERT(E) ((void) (0 && (E))) #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR # include /* INFRINGES ON USER NAME SPACE */ # elif defined _AIX # define YYSTACK_ALLOC __alloca # elif defined _MSC_VER # include /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca # else # define YYSTACK_ALLOC alloca # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS # include /* INFRINGES ON USER NAME SPACE */ /* Use EXIT_SUCCESS as a witness for stdlib.h. */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's 'empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif # if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined EXIT_SUCCESS void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined EXIT_SUCCESS void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yy_state_t yyss_alloc; YYSTYPE yyvs_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) # define YYCOPY_NEEDED 1 /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYPTRDIFF_T yynewbytes; \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / YYSIZEOF (*yyptr); \ } \ while (0) #endif #if defined YYCOPY_NEEDED && YYCOPY_NEEDED /* Copy COUNT objects from SRC to DST. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(Dst, Src, Count) \ __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) # else # define YYCOPY(Dst, Src, Count) \ do \ { \ YYPTRDIFF_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ while (0) # endif # endif #endif /* !YYCOPY_NEEDED */ /* YYFINAL -- State number of the termination state. */ #define YYFINAL 32 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 230 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 36 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 70 /* YYNRULES -- Number of rules. */ #define YYNRULES 107 /* YYNSTATES -- Number of states. */ #define YYNSTATES 274 #define YYUNDEFTOK 2 #define YYMAXUTOK 285 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM as returned by yylex, with out-of-bounds checking. */ #define YYTRANSLATE(YYX) \ (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM as returned by yylex. */ static const yytype_int8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 32, 34, 2, 2, 35, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 31, 2, 33, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 }; #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_int16 yyrline[] = { 0, 80, 80, 92, 92, 95, 98, 98, 101, 101, 101, 101, 104, 107, 109, 110, 113, 115, 116, 119, 122, 126, 131, 131, 131, 131, 131, 131, 134, 135, 138, 138, 142, 146, 147, 150, 151, 153, 154, 155, 156, 158, 159, 162, 165, 168, 172, 174, 175, 176, 177, 180, 184, 187, 190, 193, 196, 199, 202, 205, 208, 211, 212, 213, 214, 217, 220, 223, 224, 227, 229, 230, 231, 234, 236, 236, 239, 241, 242, 243, 246, 249, 252, 257, 257, 259, 262, 267, 270, 272, 275, 278, 281, 284, 287, 290, 293, 296, 299, 302, 305, 308, 311, 313, 315, 316, 317, 320 }; #endif #if YYDEBUG || YYERROR_VERBOSE || 1 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "\"end of string\"", "error", "$undefined", "\"PARAM_MT\"", "\"CONCAT_MT\"", "\"INVERSE_MT\"", "\"PASSTHROUGH_MT\"", "\"PROJCS\"", "\"PROJECTION\"", "\"GEOGCS\"", "\"DATUM\"", "\"SPHEROID\"", "\"PRIMEM\"", "\"UNIT\"", "\"GEOCCS\"", "\"AUTHORITY\"", "\"VERT_CS\"", "\"VERTCS\"", "\"VERT_DATUM\"", "\"VDATUM\"", "\"COMPD_CS\"", "\"AXIS\"", "\"TOWGS84\"", "\"FITTED_CS\"", "\"LOCAL_CS\"", "\"LOCAL_DATUM\"", "\"PARAMETER\"", "\"EXTENSION\"", "\"string\"", "\"number\"", "\"identifier\"", "'['", "'('", "']'", "')'", "','", "$accept", "input", "begin_node", "begin_node_name", "end_node", "math_transform", "param_mt", "parameter", "opt_parameter_list", "concat_mt", "opt_math_transform_list", "inv_mt", "passthrough_mt", "integer", "coordinate_system", "horz_cs_with_opt_esri_vertcs", "horz_cs", "projected_cs", "opt_parameter_list_linear_unit", "parameter_list_linear_unit", "opt_twin_axis_extension_authority", "opt_authority", "extension", "projection", "geographic_cs", "datum", "opt_towgs84_authority_extension", "spheroid", "semi_major_axis", "inverse_flattening", "prime_meridian", "longitude", "angular_unit", "linear_unit", "unit", "conversion_factor", "geocentric_cs", "opt_three_axis_extension_authority", "three_axis", "authority", "vert_cs", "esri_vert_cs", "opt_axis_authority", "vert_datum", "vdatum_or_datum", "vdatum", "opt_extension_authority", "datum_type", "compd_cs", "head_cs", "tail_cs", "twin_axis", "axis", "towgs84", "towgs84_parameters", "three_parameters", "seven_parameters", "dx", "dy", "dz", "ex", "ey", "ez", "ppm", "fitted_cs", "to_base", "base_cs", "local_cs", "opt_axis_list_authority", "local_datum", YY_NULLPTR }; #endif # ifdef YYPRINT /* YYTOKNUM[NUM] -- (External) token number corresponding to the (internal) symbol number NUM (which must be that of a token). */ static const yytype_int16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 91, 40, 93, 41, 44 }; # endif #define YYPACT_NINF (-141) #define yypact_value_is_default(Yyn) \ ((Yyn) == YYPACT_NINF) #define YYTABLE_NINF (-1) #define yytable_value_is_error(Yyn) \ 0 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ static const yytype_int16 yypact[] = { 119, 41, 41, 41, 41, 41, 41, 41, 41, 31, -141, -141, 6, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, 16, 32, 34, 42, 55, 68, 69, 70, 23, -141, 37, -141, 99, 101, 101, 95, 19, 4, 141, -141, -141, 89, -141, -141, 80, 41, 82, 85, 41, 86, 41, -141, 87, -141, -141, 90, 41, 41, 41, 41, -141, -141, -141, -141, -141, 92, 41, 94, 123, 97, 125, 125, 103, 127, 63, -4, 30, 113, 141, 141, 120, 119, 115, 127, 41, 116, 142, 41, 117, 121, 126, 41, 124, -141, -141, 41, 133, 63, -141, -141, -141, -141, 134, 132, 63, 135, 63, -141, 136, -141, 63, 126, 137, 138, -4, 41, 140, 143, 127, 127, -141, 134, 144, 28, 63, 145, -4, -141, -3, 63, 113, -141, 141, 63, -141, 141, -141, 138, 139, 146, 63, 147, 148, 13, 63, 152, 147, -141, 149, 63, 156, 41, 41, -141, 138, -141, 157, -141, -141, 41, 138, -141, -141, -141, 135, -141, 63, 63, 153, -141, -141, 61, 63, 158, 41, 138, -141, 134, -141, -141, 138, 63, 61, 63, -141, -141, 138, 154, 155, -141, 63, 159, -141, -141, -141, -141, 28, 63, 138, -141, 134, 160, -141, -141, 161, 162, -141, -141, 63, -141, 138, 134, -141, 163, -141, 63, 164, 167, -141, 165, -141, 153, -141, -141, -141, 139, 170, -141, 63, -141, -141, 166, -141, -141, -141, 139, -141, 63, 63, 63, -141, -141, -141, 138, -141, 171, 168, -141, -141, -141, 63, -141, 169, 139, -141, 173, -141, -141, 172, 176, -141, 174, 177, -141, 175, 179, -141, 178, 182, -141, -141 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. Performed when YYTABLE does not specify something else to do. Zero means the default is an error. */ static const yytype_int8 yydefact[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 22, 28, 31, 30, 23, 24, 68, 25, 26, 27, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 0, 0, 6, 7, 0, 103, 29, 0, 0, 0, 0, 0, 0, 0, 75, 0, 74, 82, 0, 0, 0, 0, 0, 100, 8, 9, 10, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 70, 57, 76, 0, 0, 0, 34, 33, 83, 84, 77, 0, 0, 17, 0, 21, 0, 101, 0, 0, 0, 41, 0, 0, 47, 0, 0, 0, 80, 77, 0, 0, 0, 0, 0, 69, 0, 0, 14, 12, 0, 0, 19, 0, 99, 41, 0, 0, 0, 37, 0, 0, 0, 0, 37, 56, 61, 0, 0, 0, 0, 72, 41, 67, 0, 35, 36, 0, 41, 79, 81, 15, 17, 16, 0, 0, 104, 42, 44, 0, 0, 0, 0, 41, 50, 77, 46, 55, 41, 0, 0, 0, 73, 59, 41, 0, 0, 71, 0, 0, 78, 18, 20, 107, 0, 0, 41, 40, 77, 0, 32, 52, 0, 0, 49, 48, 0, 45, 41, 77, 64, 0, 60, 0, 0, 0, 13, 0, 105, 104, 102, 39, 38, 0, 0, 92, 0, 89, 88, 0, 54, 63, 62, 0, 58, 0, 0, 0, 106, 85, 53, 41, 87, 0, 0, 66, 86, 43, 0, 93, 0, 0, 51, 0, 65, 94, 90, 0, 95, 0, 0, 96, 0, 0, 97, 0, 0, 98, 91 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { -141, -141, -59, 12, -77, -55, -141, 56, 44, -141, 45, -141, -141, -141, 130, -141, 180, -141, 98, 88, 67, -89, -140, -141, -27, 48, -141, -141, -141, -141, 150, -141, -141, -43, -79, -141, -141, -141, -141, -121, 151, 185, -141, -141, -141, -141, -119, 105, -141, -141, -141, -141, -137, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -2, -141 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { -1, 9, 23, 24, 45, 63, 64, 99, 107, 65, 136, 66, 67, 111, 10, 11, 12, 13, 100, 101, 175, 143, 163, 88, 14, 49, 147, 119, 207, 246, 91, 183, 149, 102, 96, 189, 15, 186, 214, 156, 16, 17, 127, 52, 55, 56, 132, 124, 18, 58, 105, 203, 157, 180, 231, 232, 233, 234, 255, 261, 264, 267, 270, 273, 19, 68, 113, 20, 200, 70 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule whose number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int16 yytable[] = { 97, 81, 82, 83, 171, 152, 178, 115, 47, 94, 164, 1, 154, 2, 25, 26, 27, 28, 29, 30, 31, 172, 98, 130, 162, 179, 108, 109, 154, 48, 134, 32, 137, 95, 201, 177, 139, 204, 53, 2, 162, 33, 150, 154, 34, 213, 4, 5, 216, 155, 158, 170, 103, 202, 5, 165, 42, 43, 44, 168, 72, 210, 224, 75, 215, 77, 173, 35, 192, 36, 181, 80, 21, 22, 195, 187, 154, 37, 223, 151, 167, 85, 155, 169, 227, 50, 161, 54, 162, 209, 38, 244, 197, 198, 211, 237, 42, 43, 205, 116, 218, 249, 120, 39, 40, 41, 125, 212, 2, 217, 128, 48, 226, 51, 69, 71, 221, 73, 208, 259, 74, 76, 78, 225, 236, 79, 1, 84, 2, 86, 145, 87, 89, 3, 235, 4, 5, 90, 93, 6, 94, 239, 7, 8, 59, 60, 61, 62, 106, 110, 114, 117, 121, 118, 247, 123, 122, 253, 98, 126, 155, 154, 133, 250, 251, 252, 190, 191, 129, 131, 135, 138, 141, 142, 194, 146, 257, 166, 148, 153, 159, 182, 174, 176, 185, 188, 193, 206, 199, 219, 220, 230, 240, 242, 222, 228, 229, 241, 238, 245, 254, 248, 260, 256, 258, 263, 266, 262, 269, 265, 268, 272, 196, 271, 112, 144, 184, 160, 46, 140, 57, 0, 243, 0, 92, 0, 0, 0, 0, 0, 104 }; static const yytype_int16 yycheck[] = { 77, 60, 61, 62, 141, 124, 146, 86, 35, 13, 131, 7, 15, 9, 2, 3, 4, 5, 6, 7, 8, 142, 26, 100, 27, 146, 81, 82, 15, 10, 107, 0, 109, 76, 174, 22, 113, 174, 19, 9, 27, 35, 121, 15, 28, 185, 16, 17, 185, 21, 127, 140, 79, 174, 17, 132, 33, 34, 35, 136, 48, 180, 199, 51, 185, 53, 143, 35, 157, 35, 147, 59, 31, 32, 163, 152, 15, 35, 199, 122, 135, 69, 21, 138, 203, 37, 129, 39, 27, 178, 35, 228, 169, 170, 183, 214, 33, 34, 175, 87, 189, 238, 90, 35, 35, 35, 94, 184, 9, 186, 98, 10, 201, 18, 25, 35, 193, 35, 177, 256, 35, 35, 35, 200, 213, 35, 7, 35, 9, 35, 118, 8, 35, 14, 211, 16, 17, 12, 35, 20, 13, 218, 23, 24, 3, 4, 5, 6, 35, 29, 35, 35, 35, 11, 231, 29, 35, 246, 26, 35, 21, 15, 106, 240, 241, 242, 154, 155, 35, 35, 35, 35, 35, 35, 162, 35, 253, 133, 35, 35, 35, 29, 35, 35, 35, 29, 29, 29, 35, 35, 35, 29, 28, 28, 35, 35, 35, 30, 35, 29, 29, 35, 29, 35, 35, 29, 29, 35, 29, 35, 35, 29, 167, 35, 84, 117, 149, 129, 33, 114, 40, -1, 224, -1, 74, -1, -1, -1, -1, -1, 79 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_int8 yystos[] = { 0, 7, 9, 14, 16, 17, 20, 23, 24, 37, 50, 51, 52, 53, 60, 72, 76, 77, 84, 100, 103, 31, 32, 38, 39, 39, 39, 39, 39, 39, 39, 39, 0, 35, 28, 35, 35, 35, 35, 35, 35, 35, 33, 34, 35, 40, 77, 60, 10, 61, 61, 18, 79, 19, 61, 80, 81, 52, 85, 3, 4, 5, 6, 41, 42, 45, 47, 48, 101, 25, 105, 35, 39, 35, 35, 39, 35, 39, 35, 35, 39, 38, 38, 38, 35, 39, 35, 8, 59, 35, 12, 66, 66, 35, 13, 69, 70, 40, 26, 43, 54, 55, 69, 60, 76, 86, 35, 44, 41, 41, 29, 49, 50, 102, 35, 70, 39, 35, 11, 63, 39, 35, 35, 29, 83, 39, 35, 78, 39, 35, 40, 35, 82, 43, 40, 35, 46, 40, 35, 40, 83, 35, 35, 57, 54, 39, 35, 62, 35, 68, 70, 69, 82, 35, 15, 21, 75, 88, 40, 35, 55, 69, 27, 58, 75, 40, 44, 41, 40, 41, 57, 88, 75, 40, 35, 56, 35, 22, 58, 75, 89, 40, 29, 67, 56, 35, 73, 40, 29, 71, 39, 39, 57, 29, 39, 57, 46, 40, 40, 35, 104, 58, 75, 87, 88, 40, 29, 64, 38, 57, 82, 57, 40, 58, 74, 75, 88, 40, 57, 35, 35, 40, 35, 75, 88, 40, 57, 82, 35, 35, 29, 90, 91, 92, 93, 40, 57, 82, 35, 40, 28, 30, 28, 104, 88, 29, 65, 40, 35, 88, 40, 40, 40, 57, 29, 94, 35, 40, 35, 88, 29, 95, 35, 29, 96, 35, 29, 97, 35, 29, 98, 35, 29, 99 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_int8 yyr1[] = { 0, 36, 37, 38, 38, 39, 40, 40, 41, 41, 41, 41, 42, 43, 44, 44, 45, 46, 46, 47, 48, 49, 50, 50, 50, 50, 50, 50, 51, 51, 52, 52, 53, 54, 54, 55, 55, 56, 56, 56, 56, 57, 57, 58, 59, 60, 61, 62, 62, 62, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 73, 73, 73, 74, 75, 76, 76, 77, 78, 78, 78, 79, 80, 80, 81, 82, 82, 82, 83, 84, 85, 86, 86, 87, 88, 89, 90, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 103, 104, 104, 104, 105 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ static const yytype_int8 yyr2[] = { 0, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 5, 0, 3, 5, 0, 3, 4, 6, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 10, 1, 1, 3, 3, 0, 3, 3, 2, 0, 2, 5, 4, 10, 6, 0, 3, 3, 2, 8, 1, 1, 6, 1, 1, 1, 6, 1, 10, 0, 3, 3, 2, 5, 5, 8, 1, 7, 0, 3, 2, 6, 1, 1, 3, 0, 3, 2, 1, 8, 1, 1, 1, 3, 5, 4, 1, 1, 5, 13, 1, 1, 1, 1, 1, 1, 1, 7, 1, 1, 10, 3, 0, 2, 3, 6 }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY) \ { \ yychar = (Token); \ yylval = (Value); \ YYPOPSTACK (yylen); \ yystate = *yyssp; \ goto yybackup; \ } \ else \ { \ yyerror (context, YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (0) /* Error token number */ #define YYTERROR 1 #define YYERRCODE 256 /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (0) /* This macro is provided for backward compatibility. */ #ifndef YY_LOCATION_PRINT # define YY_LOCATION_PRINT(File, Loc) ((void) 0) #endif # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Type, Value, context); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) /*-----------------------------------. | Print this symbol's value on YYO. | `-----------------------------------*/ static void yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, pj_wkt1_parse_context *context) { FILE *yyoutput = yyo; YYUSE (yyoutput); YYUSE (context); if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyo, yytoknum[yytype], *yyvaluep); # endif YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN YYUSE (yytype); YY_IGNORE_MAYBE_UNINITIALIZED_END } /*---------------------------. | Print this symbol on YYO. | `---------------------------*/ static void yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, pj_wkt1_parse_context *context) { YYFPRINTF (yyo, "%s %s (", yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); yy_symbol_value_print (yyo, yytype, yyvaluep, context); YYFPRINTF (yyo, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ static void yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) { int yybot = *yybottom; YYFPRINTF (stderr, " %d", yybot); } YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (0) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ static void yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule, pj_wkt1_parse_context *context) { int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yystos[+yyssp[yyi + 1 - yynrhs]], &yyvsp[(yyi + 1) - (yynrhs)] , context); YYFPRINTF (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyssp, yyvsp, Rule, context); \ } while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #if YYERROR_VERBOSE # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H # define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S))) # else /* Return the length of YYSTR. */ static YYPTRDIFF_T yystrlen (const char *yystr) { YYPTRDIFF_T yylen; for (yylen = 0; yystr && yystr[yylen]; yylen++) continue; return yylen; } # endif # endif # ifndef yystpcpy # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ static char * yystpcpy (char *yydest, const char *yysrc) { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif # ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYPTRDIFF_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { YYPTRDIFF_T yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; else goto append; append: default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (yyres) return (YYPTRDIFF_T)(yystpcpy (yyres, yystr) - yyres); else return yystrlen (yystr); } # endif /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message about the unexpected token YYTOKEN for the state stack whose top is YYSSP. Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is not large enough to hold the message. In that case, also set *YYMSG_ALLOC to the required number of bytes. Return 2 if the required number of bytes is too large to store. */ static int yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, yy_state_t *yyssp, int yytoken) { enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ const char *yyformat = YY_NULLPTR; /* Arguments of yyformat: reported tokens (one for the "unexpected", one per "expected"). */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Actual size of YYARG. */ int yycount = 0; /* Cumulated lengths of YYARG. */ YYPTRDIFF_T yysize = 0; /* There are many possibilities here to consider: - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't check for expected tokens because there are none. - The only way there can be no lookahead present (in yychar) is if this state is a consistent state with a default action. Thus, detecting the absence of a lookahead is sufficient to determine that there is no unexpected or expected token to report. In that case, just report a simple "syntax error". - Don't assume there isn't a lookahead just because this state is a consistent state with a default action. There might have been a previous inconsistent state, consistent state with a non-default action, or user semantic action that manipulated yychar. - Of course, the expected token list depends on states to have correct lookahead information, and it depends on the parser not to perform extra reductions after fetching a lookahead from the scanner and before detecting a syntax error. Thus, state merging (from LALR or IELR) and default reductions corrupt the expected token list. However, the list is correct for canonical LR with one exception: it will still contain any token that will not be accepted due to an error action in a later state. */ if (yytoken != YYEMPTY) { int yyn = yypact[+*yyssp]; YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); yysize = yysize0; yyarg[yycount++] = yytname[yytoken]; if (!yypact_value_is_default (yyn)) { /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. In other words, skip the first -YYN actions for this state because they are default actions. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yyx; for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR && !yytable_value_is_error (yytable[yyx + yyn])) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; break; } yyarg[yycount++] = yytname[yyx]; { YYPTRDIFF_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) yysize = yysize1; else return 2; } } } } switch (yycount) { # define YYCASE_(N, S) \ case N: \ yyformat = S; \ break default: /* Avoid compiler warnings. */ YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); # undef YYCASE_ } { /* Don't count the "%s"s in the final size, but reserve room for the terminator. */ YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1; if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) yysize = yysize1; else return 2; } if (*yymsg_alloc < yysize) { *yymsg_alloc = 2 * yysize; if (! (yysize <= *yymsg_alloc && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; return 1; } /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ { char *yyp = *yymsg; int yyi = 0; while ((*yyp = *yyformat) != '\0') if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyformat += 2; } else { ++yyp; ++yyformat; } } return 0; } #endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, pj_wkt1_parse_context *context) { YYUSE (yyvaluep); YYUSE (context); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN YYUSE (yytype); YY_IGNORE_MAYBE_UNINITIALIZED_END } /*----------. | yyparse. | `----------*/ int yyparse (pj_wkt1_parse_context *context) { /* The lookahead symbol. */ int yychar; /* The semantic value of the lookahead symbol. */ /* Default value used for initialization, for pacifying older GCCs or non-GCC compilers. */ YY_INITIAL_VALUE (static YYSTYPE yyval_default;) YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); /* Number of syntax errors so far. */ int yynerrs; yy_state_fast_t yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* The stacks and their tools: 'yyss': related to states. 'yyvs': related to semantic values. Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yy_state_t yyssa[YYINITDEPTH]; yy_state_t *yyss; yy_state_t *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs; YYSTYPE *yyvsp; YYPTRDIFF_T yystacksize; int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ int yytoken = 0; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf; #endif #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; yyssp = yyss = yyssa; yyvsp = yyvs = yyvsa; yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ goto yysetstate; /*------------------------------------------------------------. | yynewstate -- push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; /*--------------------------------------------------------------------. | yysetstate -- set current state (the top of the stack) to yystate. | `--------------------------------------------------------------------*/ yysetstate: YYDPRINTF ((stderr, "Entering state %d\n", yystate)); YY_ASSERT (0 <= yystate && yystate < YYNSTATES); YY_IGNORE_USELESS_CAST_BEGIN *yyssp = YY_CAST (yy_state_t, yystate); YY_IGNORE_USELESS_CAST_END if (yyss + yystacksize - 1 <= yyssp) #if !defined yyoverflow && !defined YYSTACK_RELOCATE goto yyexhaustedlab; #else { /* Get the current used size of the three stacks, in elements. */ YYPTRDIFF_T yysize = (YYPTRDIFF_T)(yyssp - yyss + 1); # if defined yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ yy_state_t *yyss1 = yyss; YYSTYPE *yyvs1 = yyvs; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * YYSIZEOF (*yyssp), &yyvs1, yysize * YYSIZEOF (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } # else /* defined YYSTACK_RELOCATE */ /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yy_state_t *yyss1 = yyss; union yyalloc *yyptr = YY_CAST (union yyalloc *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YY_IGNORE_USELESS_CAST_BEGIN YYDPRINTF ((stderr, "Stack size increased to %ld\n", YY_CAST (long, yystacksize))); YY_IGNORE_USELESS_CAST_END if (yyss + yystacksize - 1 <= yyssp) YYABORT; } #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ if (yystate == YYFINAL) YYACCEPT; goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yypact_value_is_default (yyn)) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = yylex (&yylval, context); } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yytable_value_is_error (yyn)) goto yyerrlab; yyn = -yyn; goto yyreduce; } /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); yystate = yyn; YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END /* Discard the shifted token. */ yychar = YYEMPTY; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: '$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; YY_REDUCE_PRINT (yyn); switch (yyn) { default: break; } /* User semantic actions sometimes alter yychar, and that requires that yytoken be updated with the new translation. We take the approach of translating immediately before every use of yytoken. One alternative is translating here after every semantic action, but that translation would be missed if the semantic action invokes YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an incorrect destructor might then be invoked immediately. In the case of YYERROR or YYBACKUP, subsequent parser actions might lead to an incorrect destructor call or verbose syntax error message before the lookahead is translated. */ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ { const int yylhs = yyr1[yyn] - YYNTOKENS; const int yyi = yypgoto[yylhs] + *yyssp; yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp ? yytable[yyi] : yydefgoto[yylhs]); } goto yynewstate; /*--------------------------------------. | yyerrlab -- here on detecting error. | `--------------------------------------*/ yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (context, YY_("syntax error")); #else # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ yyssp, yytoken) { char const *yymsgp = YY_("syntax error"); int yysyntax_error_status; yysyntax_error_status = YYSYNTAX_ERROR; if (yysyntax_error_status == 0) yymsgp = yymsg; else if (yysyntax_error_status == 1) { if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc))); if (!yymsg) { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; yysyntax_error_status = 2; } else { yysyntax_error_status = YYSYNTAX_ERROR; yymsgp = yymsg; } } yyerror (context, yymsgp); if (yysyntax_error_status == 2) goto yyexhaustedlab; } # undef YYSYNTAX_ERROR #endif } if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval, context); yychar = YYEMPTY; } } /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ #if 0 yyerrorlab: /* Pacify compilers when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (0) YYERROR; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ #endif yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (!yypact_value_is_default (yyn)) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yydestruct ("Error: popping", yystos[yystate], yyvsp, context); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (context, YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif /*-----------------------------------------------------. | yyreturn -- parsing is finished, return the result. | `-----------------------------------------------------*/ yyreturn: if (yychar != YYEMPTY) { /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ yytoken = YYTRANSLATE (yychar); yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval, context); } /* Do not reclaim the symbols of the rule whose action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[+*yyssp], yyvsp, context); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif #if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif return yyresult; } proj-8.2.1/src/adjlon.cpp000644 000765 000024 00000000752 13437770506 015720 0ustar00keversstaff000000 000000 /* reduce argument to range +/- PI */ #include #include "proj.h" #include "proj_internal.h" double adjlon (double lon) { /* Let lon slightly overshoot, to avoid spurious sign switching at the date line */ if (fabs (lon) < M_PI + 1e-12) return lon; /* adjust to 0..2pi range */ lon += M_PI; /* remove integral # of 'revolutions'*/ lon -= M_TWOPI * floor(lon / M_TWOPI); /* adjust back to -pi..pi range */ lon -= M_PI; return lon; } proj-8.2.1/src/strerrno.cpp000644 000765 000024 00000005306 14164067106 016320 0ustar00keversstaff000000 000000 /* list of projection system errno values */ #include #include #include #include "proj.h" #include "proj_config.h" #include "proj_internal.h" const char* proj_errno_string(int err) { return proj_context_errno_string(pj_get_default_ctx(), err); } static const struct { int num; const char *str; } error_strings[] = { { PROJ_ERR_INVALID_OP_WRONG_SYNTAX, _("Invalid PROJ string syntax") }, { PROJ_ERR_INVALID_OP_MISSING_ARG, _("Missing argument") }, { PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE, _("Invalid value for an argument") }, { PROJ_ERR_INVALID_OP_MUTUALLY_EXCLUSIVE_ARGS, _("Mutually exclusive arguments") }, { PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID, _("File not found or invalid") }, { PROJ_ERR_COORD_TRANSFM_INVALID_COORD, _("Invalid coordinate") }, { PROJ_ERR_COORD_TRANSFM_OUTSIDE_PROJECTION_DOMAIN, _("Point outside of projection domain") }, { PROJ_ERR_COORD_TRANSFM_NO_OPERATION, _("No operation matching criteria found for coordinate") }, { PROJ_ERR_COORD_TRANSFM_OUTSIDE_GRID, _("Coordinate to transform falls outside grid") }, { PROJ_ERR_COORD_TRANSFM_GRID_AT_NODATA, _("Coordinate to transform falls into a grid cell that evaluates to nodata") }, { PROJ_ERR_OTHER_API_MISUSE, _("API misuse") }, { PROJ_ERR_OTHER_NO_INVERSE_OP, _("No inverse operation") }, { PROJ_ERR_OTHER_NETWORK_ERROR, _("Network error when accessing a remote resource") }, }; const char PROJ_DLL * proj_context_errno_string(PJ_CONTEXT* ctx, int err) { if( ctx == nullptr ) ctx = pj_get_default_ctx(); if (0==err) return nullptr; const char* str = nullptr; for( const auto& num_str_pair: error_strings ) { if( err == num_str_pair.num ) { str = num_str_pair.str; break; } } if( str == nullptr && err > 0 && (err & PROJ_ERR_INVALID_OP) != 0 ) { str = _("Unspecified error related to coordinate operation initialization"); } if( str == nullptr && err > 0 && (err & PROJ_ERR_COORD_TRANSFM) != 0 ) { str = _("Unspecified error related to coordinate transformation"); } if (str) { ctx->lastFullErrorMessage = str; } else { ctx->lastFullErrorMessage.resize(50); snprintf(&ctx->lastFullErrorMessage[0], ctx->lastFullErrorMessage.size(), _("Unknown error (code %d)"), err); ctx->lastFullErrorMessage.resize(strlen(ctx->lastFullErrorMessage.data())); } return ctx->lastFullErrorMessage.c_str(); } proj-8.2.1/src/aasincos.cpp000644 000765 000024 00000002001 14017154140 016217 0ustar00keversstaff000000 000000 /* arc sin, cosine, tan2 and sqrt that will NOT fail */ #include #include "proj.h" #include "proj_internal.h" #define ONE_TOL 1.00000000000001 #define ATOL 1e-50 double aasin(PJ_CONTEXT *ctx,double v) { double av; if ((av = fabs(v)) >= 1.) { if (av > ONE_TOL) proj_context_errno_set( ctx, PROJ_ERR_COORD_TRANSFM_OUTSIDE_PROJECTION_DOMAIN ); return (v < 0. ? -M_HALFPI : M_HALFPI); } return asin(v); } double aacos(PJ_CONTEXT *ctx, double v) { double av; if ((av = fabs(v)) >= 1.) { if (av > ONE_TOL) proj_context_errno_set( ctx, PROJ_ERR_COORD_TRANSFM_OUTSIDE_PROJECTION_DOMAIN ); return (v < 0. ? M_PI : 0.); } return acos(v); } double asqrt(double v) { return ((v <= 0) ? 0. : sqrt(v)); } double aatan2(double n, double d) { return ((fabs(n) < ATOL && fabs(d) < ATOL) ? 0. : atan2(n,d)); } proj-8.2.1/src/zpoly1.cpp000644 000765 000024 00000002055 13437770506 015705 0ustar00keversstaff000000 000000 /* evaluate complex polynomial */ #include "proj.h" #include "proj_internal.h" /* note: coefficients are always from C_1 to C_n ** i.e. C_0 == (0., 0) ** n should always be >= 1 though no checks are made */ COMPLEX pj_zpoly1(COMPLEX z, const COMPLEX *C, int n) { COMPLEX a; double t; a = *(C += n); while (n-- > 0) { a.r = (--C)->r + z.r * (t = a.r) - z.i * a.i; a.i = C->i + z.r * a.i + z.i * t; } a.r = z.r * (t = a.r) - z.i * a.i; a.i = z.r * a.i + z.i * t; return a; } /* evaluate complex polynomial and derivative */ COMPLEX pj_zpolyd1(COMPLEX z, const COMPLEX *C, int n, COMPLEX *der) { COMPLEX a, b; double t; int first = 1; a = *(C += n); b = a; while (n-- > 0) { if (first) { first = 0; } else { b.r = a.r + z.r * (t = b.r) - z.i * b.i; b.i = a.i + z.r * b.i + z.i * t; } a.r = (--C)->r + z.r * (t = a.r) - z.i * a.i; a.i = C->i + z.r * a.i + z.i * t; } b.r = a.r + z.r * (t = b.r) - z.i * b.i; b.i = a.i + z.r * b.i + z.i * t; a.r = z.r * (t = a.r) - z.i * a.i; a.i = z.r * a.i + z.i * t; *der = b; return a; } proj-8.2.1/src/phi2.cpp000644 000765 000024 00000012226 14017154140 015273 0ustar00keversstaff000000 000000 /* Determine latitude angle phi-2. */ #include #include #include #include "proj.h" #include "proj_internal.h" double pj_sinhpsi2tanphi(PJ_CONTEXT *ctx, const double taup, const double e) { /**************************************************************************** * Convert tau' = sinh(psi) = tan(chi) to tau = tan(phi). The code is taken * from GeographicLib::Math::tauf(taup, e). * * Here * phi = geographic latitude (radians) * psi is the isometric latitude * psi = asinh(tan(phi)) - e * atanh(e * sin(phi)) * = asinh(tan(chi)) * chi is the conformal latitude * * The representation of latitudes via their tangents, tan(phi) and tan(chi), * maintains full *relative* accuracy close to latitude = 0 and +/- pi/2. * This is sometimes important, e.g., to compute the scale of the transverse * Mercator projection which involves cos(phi)/cos(chi) tan(phi) * * From Karney (2011), Eq. 7, * * tau' = sinh(psi) = sinh(asinh(tan(phi)) - e * atanh(e * sin(phi))) * = tan(phi) * cosh(e * atanh(e * sin(phi))) - * sec(phi) * sinh(e * atanh(e * sin(phi))) * = tau * sqrt(1 + sigma^2) - sqrt(1 + tau^2) * sigma * where * sigma = sinh(e * atanh( e * tau / sqrt(1 + tau^2) )) * * For e small, * * tau' = (1 - e^2) * tau * * The relation tau'(tau) can therefore by reliably inverted by Newton's * method with * * tau = tau' / (1 - e^2) * * as an initial guess. Newton's method requires dtau'/dtau. Noting that * * dsigma/dtau = e^2 * sqrt(1 + sigma^2) / * (sqrt(1 + tau^2) * (1 + (1 - e^2) * tau^2)) * d(sqrt(1 + tau^2))/dtau = tau / sqrt(1 + tau^2) * * we have * * dtau'/dtau = (1 - e^2) * sqrt(1 + tau'^2) * sqrt(1 + tau^2) / * (1 + (1 - e^2) * tau^2) * * This works fine unless tau^2 and tau'^2 overflows. This may be partially * cured by writing, e.g., sqrt(1 + tau^2) as hypot(1, tau). However, nan * will still be generated with tau' = inf, since (inf - inf) will appear in * the Newton iteration. * * If we note that for sufficiently large |tau|, i.e., |tau| >= 2/sqrt(eps), * sqrt(1 + tau^2) = |tau| and * * tau' = exp(- e * atanh(e)) * tau * * So * * tau = exp(e * atanh(e)) * tau' * * can be returned unless |tau| >= 2/sqrt(eps); this then avoids overflow * problems for large tau' and returns the correct result for tau' = +/-inf * and nan. * * Newton's method usually take 2 iterations to converge to double precision * accuracy (for WGS84 flattening). However only 1 iteration is needed for * |chi| < 3.35 deg. In addition, only 1 iteration is needed for |chi| > * 89.18 deg (tau' > 70), if tau = exp(e * atanh(e)) * tau' is used as the * starting guess. ****************************************************************************/ constexpr int numit = 5; // min iterations = 1, max iterations = 2; mean = 1.954 static const double rooteps = sqrt(std::numeric_limits::epsilon()); static const double tol = rooteps / 10; // the criterion for Newton's method static const double tmax = 2 / rooteps; // threshold for large arg limit exact const double e2m = 1 - e * e; const double stol = tol * std::max(1.0, fabs(taup)); // The initial guess. 70 corresponds to chi = 89.18 deg (see above) double tau = fabs(taup) > 70 ? taup * exp(e * atanh(e)) : taup / e2m; if (!(fabs(tau) < tmax)) // handles +/-inf and nan and e = 1 return tau; // If we need to deal with e > 1, then we could include: // if (e2m < 0) return std::numeric_limits::quiet_NaN(); int i = numit; for (; i; --i) { double tau1 = sqrt(1 + tau * tau); double sig = sinh( e * atanh(e * tau / tau1) ); double taupa = sqrt(1 + sig * sig) * tau - sig * tau1; double dtau = ( (taup - taupa) * (1 + e2m * (tau * tau)) / (e2m * tau1 * sqrt(1 + taupa * taupa)) ); tau += dtau; if (!(fabs(dtau) >= stol)) // backwards test to allow nans to succeed. break; } if (i == 0) proj_context_errno_set(ctx, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); return tau; } /*****************************************************************************/ double pj_phi2(PJ_CONTEXT *ctx, const double ts0, const double e) { /**************************************************************************** * Determine latitude angle phi-2. * Inputs: * ts = exp(-psi) where psi is the isometric latitude (dimensionless) * this variable is defined in Snyder (1987), Eq. (7-10) * e = eccentricity of the ellipsoid (dimensionless) * Output: * phi = geographic latitude (radians) * Here isometric latitude is defined by * psi = log( tan(pi/4 + phi/2) * * ( (1 - e*sin(phi)) / (1 + e*sin(phi)) )^(e/2) ) * = asinh(tan(phi)) - e * atanh(e * sin(phi)) * = asinh(tan(chi)) * chi = conformal latitude * * This routine converts t = exp(-psi) to * * tau' = tan(chi) = sinh(psi) = (1/t - t)/2 * * returns atan(sinpsi2tanphi(tau')) ***************************************************************************/ return atan(pj_sinhpsi2tanphi(ctx, (1/ts0 - ts0) / 2, e)); } proj-8.2.1/src/grids.cpp000644 000765 000024 00000367051 14140020570 015546 0ustar00keversstaff000000 000000 /****************************************************************************** * Project: PROJ * Purpose: Grid management * Author: Even Rouault, * ****************************************************************************** * Copyright (c) 2000, Frank Warmerdam * Copyright (c) 2019, Even Rouault, * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. *****************************************************************************/ #ifndef FROM_PROJ_CPP #define FROM_PROJ_CPP #endif #define LRU11_DO_NOT_DEFINE_OUT_OF_CLASS_METHODS #include "grids.hpp" #include "filemanager.hpp" #include "proj/internal/internal.hpp" #include "proj/internal/lru_cache.hpp" #include "proj_internal.h" #ifdef TIFF_ENABLED #include "tiffio.h" #endif #include #include NS_PROJ_START using namespace internal; /************************************************************************/ /* swap_words() */ /* */ /* Convert the byte order of the given word(s) in place. */ /************************************************************************/ static const int byte_order_test = 1; #define IS_LSB (1 == ((const unsigned char *)(&byte_order_test))[0]) static void swap_words(void *dataIn, size_t word_size, size_t word_count) { unsigned char *data = static_cast(dataIn); for (size_t word = 0; word < word_count; word++) { for (size_t i = 0; i < word_size / 2; i++) { unsigned char t; t = data[i]; data[i] = data[word_size - i - 1]; data[word_size - i - 1] = t; } data += word_size; } } // --------------------------------------------------------------------------- void ExtentAndRes::computeInvRes() { invResX = 1.0 / resX; invResY = 1.0 / resY; } // --------------------------------------------------------------------------- bool ExtentAndRes::fullWorldLongitude() const { return isGeographic && east - west + resX >= 2 * M_PI - 1e-10; } // --------------------------------------------------------------------------- bool ExtentAndRes::contains(const ExtentAndRes &other) const { return other.west >= west && other.east <= east && other.south >= south && other.north <= north; } // --------------------------------------------------------------------------- bool ExtentAndRes::intersects(const ExtentAndRes &other) const { return other.west < east && west <= other.west && other.south < north && south <= other.north; } // --------------------------------------------------------------------------- Grid::Grid(const std::string &nameIn, int widthIn, int heightIn, const ExtentAndRes &extentIn) : m_name(nameIn), m_width(widthIn), m_height(heightIn), m_extent(extentIn) { } // --------------------------------------------------------------------------- Grid::~Grid() = default; // --------------------------------------------------------------------------- VerticalShiftGrid::VerticalShiftGrid(const std::string &nameIn, int widthIn, int heightIn, const ExtentAndRes &extentIn) : Grid(nameIn, widthIn, heightIn, extentIn) {} // --------------------------------------------------------------------------- VerticalShiftGrid::~VerticalShiftGrid() = default; // --------------------------------------------------------------------------- static ExtentAndRes globalExtent() { ExtentAndRes extent; extent.isGeographic = true; extent.west = -M_PI; extent.south = -M_PI / 2; extent.east = M_PI; extent.north = M_PI / 2; extent.resX = M_PI; extent.resY = M_PI / 2; extent.computeInvRes(); return extent; } // --------------------------------------------------------------------------- class NullVerticalShiftGrid : public VerticalShiftGrid { public: NullVerticalShiftGrid() : VerticalShiftGrid("null", 3, 3, globalExtent()) {} bool isNullGrid() const override { return true; } bool valueAt(int, int, float &out) const override; bool isNodata(float, double) const override { return false; } void reassign_context(PJ_CONTEXT *) override {} bool hasChanged() const override { return false; } }; // --------------------------------------------------------------------------- bool NullVerticalShiftGrid::valueAt(int, int, float &out) const { out = 0.0f; return true; } // --------------------------------------------------------------------------- class GTXVerticalShiftGrid : public VerticalShiftGrid { PJ_CONTEXT *m_ctx; std::unique_ptr m_fp; GTXVerticalShiftGrid(const GTXVerticalShiftGrid &) = delete; GTXVerticalShiftGrid &operator=(const GTXVerticalShiftGrid &) = delete; public: explicit GTXVerticalShiftGrid(PJ_CONTEXT *ctx, std::unique_ptr &&fp, const std::string &nameIn, int widthIn, int heightIn, const ExtentAndRes &extentIn) : VerticalShiftGrid(nameIn, widthIn, heightIn, extentIn), m_ctx(ctx), m_fp(std::move(fp)) {} ~GTXVerticalShiftGrid() override; bool valueAt(int x, int y, float &out) const override; bool isNodata(float val, double multiplier) const override; static GTXVerticalShiftGrid *open(PJ_CONTEXT *ctx, std::unique_ptr fp, const std::string &name); void reassign_context(PJ_CONTEXT *ctx) override { m_ctx = ctx; m_fp->reassign_context(ctx); } bool hasChanged() const override { return m_fp->hasChanged(); } }; // --------------------------------------------------------------------------- GTXVerticalShiftGrid::~GTXVerticalShiftGrid() = default; // --------------------------------------------------------------------------- GTXVerticalShiftGrid *GTXVerticalShiftGrid::open(PJ_CONTEXT *ctx, std::unique_ptr fp, const std::string &name) { unsigned char header[40]; /* -------------------------------------------------------------------- */ /* Read the header. */ /* -------------------------------------------------------------------- */ if (fp->read(header, sizeof(header)) != sizeof(header)) { pj_log(ctx, PJ_LOG_ERROR, _("Cannot read grid header")); proj_context_errno_set(ctx, PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID); return nullptr; } /* -------------------------------------------------------------------- */ /* Regularize fields of interest and extract. */ /* -------------------------------------------------------------------- */ if (IS_LSB) { swap_words(header + 0, 8, 4); swap_words(header + 32, 4, 2); } double xorigin, yorigin, xstep, ystep; int rows, columns; memcpy(&yorigin, header + 0, 8); memcpy(&xorigin, header + 8, 8); memcpy(&ystep, header + 16, 8); memcpy(&xstep, header + 24, 8); memcpy(&rows, header + 32, 4); memcpy(&columns, header + 36, 4); if (xorigin < -360 || xorigin > 360 || yorigin < -90 || yorigin > 90) { pj_log(ctx, PJ_LOG_ERROR, _("gtx file header has invalid extents, corrupt?")); proj_context_errno_set(ctx, PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID); return nullptr; } /* some GTX files come in 0-360 and we shift them back into the expected -180 to 180 range if possible. This does not solve problems with grids spanning the dateline. */ if (xorigin >= 180.0) xorigin -= 360.0; if (xorigin >= 0.0 && xorigin + xstep * columns > 180.0) { pj_log(ctx, PJ_LOG_DEBUG, "This GTX spans the dateline! This will cause problems."); } ExtentAndRes extent; extent.isGeographic = true; extent.west = xorigin * DEG_TO_RAD; extent.south = yorigin * DEG_TO_RAD; extent.resX = xstep * DEG_TO_RAD; extent.resY = ystep * DEG_TO_RAD; extent.east = (xorigin + xstep * (columns - 1)) * DEG_TO_RAD; extent.north = (yorigin + ystep * (rows - 1)) * DEG_TO_RAD; extent.computeInvRes(); return new GTXVerticalShiftGrid(ctx, std::move(fp), name, columns, rows, extent); } // --------------------------------------------------------------------------- bool GTXVerticalShiftGrid::valueAt(int x, int y, float &out) const { assert(x >= 0 && y >= 0 && x < m_width && y < m_height); m_fp->seek(40 + sizeof(float) * (y * m_width + x)); if (m_fp->read(&out, sizeof(out)) != sizeof(out)) { proj_context_errno_set(m_ctx, PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID); return false; } if (IS_LSB) { swap_words(&out, sizeof(float), 1); } return true; } // --------------------------------------------------------------------------- bool GTXVerticalShiftGrid::isNodata(float val, double multiplier) const { /* nodata? */ /* GTX official nodata value if -88.88880f, but some grids also */ /* use other big values for nodata (e.g naptrans2008.gtx has */ /* nodata values like -2147479936), so test them too */ return val * multiplier > 1000 || val * multiplier < -1000 || val == -88.88880f; } // --------------------------------------------------------------------------- VerticalShiftGridSet::VerticalShiftGridSet() = default; // --------------------------------------------------------------------------- VerticalShiftGridSet::~VerticalShiftGridSet() = default; // --------------------------------------------------------------------------- static bool IsTIFF(size_t header_size, const unsigned char *header) { // Test combinations of signature for ClassicTIFF/BigTIFF little/big endian return header_size >= 4 && (((header[0] == 'I' && header[1] == 'I') || (header[0] == 'M' && header[1] == 'M')) && ((header[2] == 0x2A && header[3] == 0) || (header[3] == 0x2A && header[2] == 0) || (header[2] == 0x2B && header[3] == 0) || (header[3] == 0x2B && header[2] == 0))); } #ifdef TIFF_ENABLED // --------------------------------------------------------------------------- enum class TIFFDataType { Int16, UInt16, Int32, UInt32, Float32, Float64 }; // --------------------------------------------------------------------------- constexpr uint16_t TIFFTAG_GEOPIXELSCALE = 33550; constexpr uint16_t TIFFTAG_GEOTIEPOINTS = 33922; constexpr uint16_t TIFFTAG_GEOTRANSMATRIX = 34264; constexpr uint16_t TIFFTAG_GEOKEYDIRECTORY = 34735; constexpr uint16_t TIFFTAG_GEODOUBLEPARAMS = 34736; constexpr uint16_t TIFFTAG_GEOASCIIPARAMS = 34737; #ifndef TIFFTAG_GDAL_METADATA // Starting with libtiff > 4.1.0, those symbolic names are #define in tiff.h constexpr uint16_t TIFFTAG_GDAL_METADATA = 42112; constexpr uint16_t TIFFTAG_GDAL_NODATA = 42113; #endif // --------------------------------------------------------------------------- class BlockCache { public: void insert(uint32_t ifdIdx, uint32_t blockNumber, const std::vector &data); const std::vector *get(uint32_t ifdIdx, uint32_t blockNumber); private: typedef uint64_t Key; static constexpr int NUM_BLOCKS_AT_CROSSING_TILES = 4; static constexpr int MAX_SAMPLE_COUNT = 3; lru11::Cache, lru11::NullLock> cache_{ NUM_BLOCKS_AT_CROSSING_TILES * MAX_SAMPLE_COUNT}; }; // --------------------------------------------------------------------------- void BlockCache::insert(uint32_t ifdIdx, uint32_t blockNumber, const std::vector &data) { cache_.insert((static_cast(ifdIdx) << 32) | blockNumber, data); } // --------------------------------------------------------------------------- const std::vector *BlockCache::get(uint32_t ifdIdx, uint32_t blockNumber) { return cache_.getPtr((static_cast(ifdIdx) << 32) | blockNumber); } // --------------------------------------------------------------------------- class GTiffGrid : public Grid { PJ_CONTEXT *m_ctx; // owned by the belonging GTiffDataset TIFF *m_hTIFF; // owned by the belonging GTiffDataset BlockCache &m_cache; // owned by the belonging GTiffDataset File *m_fp; // owned by the belonging GTiffDataset uint32_t m_ifdIdx; TIFFDataType m_dt; uint16_t m_samplesPerPixel; uint16_t m_planarConfig; // set to -1 if m_samplesPerPixel == 1 bool m_bottomUp; toff_t m_dirOffset; bool m_tiled; uint32_t m_blockWidth = 0; uint32_t m_blockHeight = 0; mutable std::vector m_buffer{}; unsigned m_blocksPerRow = 0; unsigned m_blocksPerCol = 0; unsigned m_blocks = 0; std::vector m_adfOffset{}; std::vector m_adfScale{}; std::map, std::string> m_metadata{}; bool m_hasNodata = false; bool m_blockIs256Pixel = false; bool m_isSingleBlock = false; float m_noData = 0.0f; uint32_t m_subfileType = 0; GTiffGrid(const GTiffGrid &) = delete; GTiffGrid &operator=(const GTiffGrid &) = delete; template float readValue(const std::vector &buffer, uint32_t offsetInBlock, uint16_t sample) const; public: GTiffGrid(PJ_CONTEXT *ctx, TIFF *hTIFF, BlockCache &cache, File *fp, uint32_t ifdIdx, const std::string &nameIn, int widthIn, int heightIn, const ExtentAndRes &extentIn, TIFFDataType dtIn, uint16_t samplesPerPixelIn, uint16_t planarConfig, bool bottomUpIn); ~GTiffGrid() override; uint16_t samplesPerPixel() const { return m_samplesPerPixel; } bool valueAt(uint16_t sample, int x, int y, float &out) const; bool isNodata(float val) const; std::string metadataItem(const std::string &key, int sample = -1) const; uint32_t subfileType() const { return m_subfileType; } void reassign_context(PJ_CONTEXT *ctx) { m_ctx = ctx; } bool hasChanged() const override { return m_fp->hasChanged(); } }; // --------------------------------------------------------------------------- GTiffGrid::GTiffGrid(PJ_CONTEXT *ctx, TIFF *hTIFF, BlockCache &cache, File *fp, uint32_t ifdIdx, const std::string &nameIn, int widthIn, int heightIn, const ExtentAndRes &extentIn, TIFFDataType dtIn, uint16_t samplesPerPixelIn, uint16_t planarConfig, bool bottomUpIn) : Grid(nameIn, widthIn, heightIn, extentIn), m_ctx(ctx), m_hTIFF(hTIFF), m_cache(cache), m_fp(fp), m_ifdIdx(ifdIdx), m_dt(dtIn), m_samplesPerPixel(samplesPerPixelIn), m_planarConfig(samplesPerPixelIn == 1 ? static_cast(-1) : planarConfig), m_bottomUp(bottomUpIn), m_dirOffset(TIFFCurrentDirOffset(hTIFF)), m_tiled(TIFFIsTiled(hTIFF) != 0) { if (m_tiled) { TIFFGetField(m_hTIFF, TIFFTAG_TILEWIDTH, &m_blockWidth); TIFFGetField(m_hTIFF, TIFFTAG_TILELENGTH, &m_blockHeight); } else { m_blockWidth = widthIn; TIFFGetField(m_hTIFF, TIFFTAG_ROWSPERSTRIP, &m_blockHeight); if (m_blockHeight > static_cast(m_height)) m_blockHeight = m_height; } m_blockIs256Pixel = (m_blockWidth == 256) && (m_blockHeight == 256); m_isSingleBlock = (m_blockWidth == static_cast(m_width)) && (m_blockHeight == static_cast(m_height)); TIFFGetField(m_hTIFF, TIFFTAG_SUBFILETYPE, &m_subfileType); m_blocksPerRow = (m_width + m_blockWidth - 1) / m_blockWidth; m_blocksPerCol = (m_height + m_blockHeight - 1) / m_blockHeight; m_blocks = m_blocksPerRow * m_blocksPerCol; const char *text = nullptr; // Poor-man XML parsing of TIFFTAG_GDAL_METADATA tag. Hopefully good // enough for our purposes. if (TIFFGetField(m_hTIFF, TIFFTAG_GDAL_METADATA, &text)) { const char *ptr = text; while (true) { ptr = strstr(ptr, "'); if (endTag == nullptr) break; const char *endValue = strchr(endTag, '<'); if (endValue == nullptr) break; std::string tag; tag.append(ptr, endTag - ptr); std::string value; value.append(endTag + 1, endValue - (endTag + 1)); std::string gridName; auto namePos = tag.find("name=\""); if (namePos == std::string::npos) break; { namePos += strlen("name=\""); const auto endQuote = tag.find('"', namePos); if (endQuote == std::string::npos) break; gridName = tag.substr(namePos, endQuote - namePos); } const auto samplePos = tag.find("sample=\""); int sample = -1; if (samplePos != std::string::npos) { sample = atoi(tag.c_str() + samplePos + strlen("sample=\"")); } m_metadata[std::pair(sample, gridName)] = value; auto rolePos = tag.find("role=\""); if (rolePos != std::string::npos) { rolePos += strlen("role=\""); const auto endQuote = tag.find('"', rolePos); if (endQuote == std::string::npos) break; const auto role = tag.substr(rolePos, endQuote - rolePos); if (role == "offset") { if (sample >= 0 && static_cast(sample) <= m_samplesPerPixel) { try { if (m_adfOffset.empty()) { m_adfOffset.resize(m_samplesPerPixel); m_adfScale.resize(m_samplesPerPixel, 1); } m_adfOffset[sample] = c_locale_stod(value); } catch (const std::exception &) { } } } else if (role == "scale") { if (sample >= 0 && static_cast(sample) <= m_samplesPerPixel) { try { if (m_adfOffset.empty()) { m_adfOffset.resize(m_samplesPerPixel); m_adfScale.resize(m_samplesPerPixel, 1); } m_adfScale[sample] = c_locale_stod(value); } catch (const std::exception &) { } } } } ptr = endValue + 1; } } if (TIFFGetField(m_hTIFF, TIFFTAG_GDAL_NODATA, &text)) { try { m_noData = static_cast(c_locale_stod(text)); m_hasNodata = true; } catch (const std::exception &) { } } auto oIter = m_metadata.find(std::pair(-1, "grid_name")); if (oIter != m_metadata.end()) { m_name += ", " + oIter->second; } } // --------------------------------------------------------------------------- GTiffGrid::~GTiffGrid() = default; // --------------------------------------------------------------------------- template float GTiffGrid::readValue(const std::vector &buffer, uint32_t offsetInBlock, uint16_t sample) const { const auto ptr = reinterpret_cast(buffer.data()); assert(offsetInBlock < buffer.size() / sizeof(T)); const auto val = ptr[offsetInBlock]; if ((!m_hasNodata || static_cast(val) != m_noData) && sample < m_adfScale.size()) { double scale = m_adfScale[sample]; double offset = m_adfOffset[sample]; return static_cast(val * scale + offset); } else { return static_cast(val); } } // --------------------------------------------------------------------------- bool GTiffGrid::valueAt(uint16_t sample, int x, int yFromBottom, float &out) const { assert(x >= 0 && yFromBottom >= 0 && x < m_width && yFromBottom < m_height); assert(sample < m_samplesPerPixel); // All non-TIFF grids have the first rows in the file being the one // corresponding to the southern-most row. In GeoTIFF, the convention is // *generally* different (when m_bottomUp == false), TIFF being an // image-oriented image. If m_bottomUp == true, then we had GeoTIFF hints // that the first row of the image is the southern-most. const int yTIFF = m_bottomUp ? yFromBottom : m_height - 1 - yFromBottom; int blockXOff; int blockYOff; uint32_t blockId; if (m_blockIs256Pixel) { const int blockX = x / 256; blockXOff = x % 256; const int blockY = yTIFF / 256; blockYOff = yTIFF % 256; blockId = blockY * m_blocksPerRow + blockX; } else if (m_isSingleBlock) { blockXOff = x; blockYOff = yTIFF; blockId = 0; } else { const int blockX = x / m_blockWidth; blockXOff = x % m_blockWidth; const int blockY = yTIFF / m_blockHeight; blockYOff = yTIFF % m_blockHeight; blockId = blockY * m_blocksPerRow + blockX; } if (m_planarConfig == PLANARCONFIG_SEPARATE) { blockId += sample * m_blocks; } const std::vector *pBuffer = m_cache.get(m_ifdIdx, blockId); if (pBuffer == nullptr) { if (TIFFCurrentDirOffset(m_hTIFF) != m_dirOffset && !TIFFSetSubDirectory(m_hTIFF, m_dirOffset)) { return false; } if (m_buffer.empty()) { const auto blockSize = static_cast( m_tiled ? TIFFTileSize64(m_hTIFF) : TIFFStripSize64(m_hTIFF)); try { m_buffer.resize(blockSize); } catch (const std::exception &e) { pj_log(m_ctx, PJ_LOG_ERROR, _("Exception %s"), e.what()); return false; } } if (m_tiled) { if (TIFFReadEncodedTile(m_hTIFF, blockId, m_buffer.data(), m_buffer.size()) == -1) { return false; } } else { if (TIFFReadEncodedStrip(m_hTIFF, blockId, m_buffer.data(), m_buffer.size()) == -1) { return false; } } pBuffer = &m_buffer; try { m_cache.insert(m_ifdIdx, blockId, m_buffer); } catch (const std::exception &e) { // Should normally not happen pj_log(m_ctx, PJ_LOG_ERROR, _("Exception %s"), e.what()); } } uint32_t offsetInBlock; if (m_blockIs256Pixel) offsetInBlock = blockXOff + blockYOff * 256U; else offsetInBlock = blockXOff + blockYOff * m_blockWidth; if (m_planarConfig == PLANARCONFIG_CONTIG) offsetInBlock = offsetInBlock * m_samplesPerPixel + sample; switch (m_dt) { case TIFFDataType::Int16: out = readValue(*pBuffer, offsetInBlock, sample); break; case TIFFDataType::UInt16: out = readValue(*pBuffer, offsetInBlock, sample); break; case TIFFDataType::Int32: out = readValue(*pBuffer, offsetInBlock, sample); break; case TIFFDataType::UInt32: out = readValue(*pBuffer, offsetInBlock, sample); break; case TIFFDataType::Float32: out = readValue(*pBuffer, offsetInBlock, sample); break; case TIFFDataType::Float64: out = readValue(*pBuffer, offsetInBlock, sample); break; } return true; } // --------------------------------------------------------------------------- bool GTiffGrid::isNodata(float val) const { return (m_hasNodata && val == m_noData) || std::isnan(val); } // --------------------------------------------------------------------------- std::string GTiffGrid::metadataItem(const std::string &key, int sample) const { auto iter = m_metadata.find(std::pair(sample, key)); if (iter == m_metadata.end()) { return std::string(); } return iter->second; } // --------------------------------------------------------------------------- class GTiffDataset { PJ_CONTEXT *m_ctx; std::unique_ptr m_fp; TIFF *m_hTIFF = nullptr; bool m_hasNextGrid = false; uint32_t m_ifdIdx = 0; toff_t m_nextDirOffset = 0; std::string m_filename{}; BlockCache m_cache{}; GTiffDataset(const GTiffDataset &) = delete; GTiffDataset &operator=(const GTiffDataset &) = delete; // libtiff I/O routines static tsize_t tiffReadProc(thandle_t fd, tdata_t buf, tsize_t size) { GTiffDataset *self = static_cast(fd); return self->m_fp->read(buf, size); } static tsize_t tiffWriteProc(thandle_t, tdata_t, tsize_t) { assert(false); return 0; } static toff_t tiffSeekProc(thandle_t fd, toff_t off, int whence) { GTiffDataset *self = static_cast(fd); if (self->m_fp->seek(off, whence)) return static_cast(self->m_fp->tell()); else return static_cast(-1); } static int tiffCloseProc(thandle_t) { // done in destructor return 0; } static toff_t tiffSizeProc(thandle_t fd) { GTiffDataset *self = static_cast(fd); const auto old_off = self->m_fp->tell(); self->m_fp->seek(0, SEEK_END); const auto file_size = static_cast(self->m_fp->tell()); self->m_fp->seek(old_off); return file_size; } static int tiffMapProc(thandle_t, tdata_t *, toff_t *) { return (0); } static void tiffUnmapProc(thandle_t, tdata_t, toff_t) {} public: GTiffDataset(PJ_CONTEXT *ctx, std::unique_ptr &&fp) : m_ctx(ctx), m_fp(std::move(fp)) {} virtual ~GTiffDataset(); bool openTIFF(const std::string &filename); std::unique_ptr nextGrid(); void reassign_context(PJ_CONTEXT *ctx) { m_ctx = ctx; m_fp->reassign_context(ctx); } }; // --------------------------------------------------------------------------- GTiffDataset::~GTiffDataset() { if (m_hTIFF) TIFFClose(m_hTIFF); } // --------------------------------------------------------------------------- class OneTimeTIFFTagInit { static TIFFExtendProc ParentExtender; // Function called by libtiff when initializing a TIFF directory static void GTiffTagExtender(TIFF *tif) { static const TIFFFieldInfo xtiffFieldInfo[] = { // GeoTIFF tags {TIFFTAG_GEOPIXELSCALE, -1, -1, TIFF_DOUBLE, FIELD_CUSTOM, TRUE, TRUE, const_cast("GeoPixelScale")}, {TIFFTAG_GEOTIEPOINTS, -1, -1, TIFF_DOUBLE, FIELD_CUSTOM, TRUE, TRUE, const_cast("GeoTiePoints")}, {TIFFTAG_GEOTRANSMATRIX, -1, -1, TIFF_DOUBLE, FIELD_CUSTOM, TRUE, TRUE, const_cast("GeoTransformationMatrix")}, {TIFFTAG_GEOKEYDIRECTORY, -1, -1, TIFF_SHORT, FIELD_CUSTOM, TRUE, TRUE, const_cast("GeoKeyDirectory")}, {TIFFTAG_GEODOUBLEPARAMS, -1, -1, TIFF_DOUBLE, FIELD_CUSTOM, TRUE, TRUE, const_cast("GeoDoubleParams")}, {TIFFTAG_GEOASCIIPARAMS, -1, -1, TIFF_ASCII, FIELD_CUSTOM, TRUE, FALSE, const_cast("GeoASCIIParams")}, // GDAL tags {TIFFTAG_GDAL_METADATA, -1, -1, TIFF_ASCII, FIELD_CUSTOM, TRUE, FALSE, const_cast("GDALMetadata")}, {TIFFTAG_GDAL_NODATA, -1, -1, TIFF_ASCII, FIELD_CUSTOM, TRUE, FALSE, const_cast("GDALNoDataValue")}, }; if (ParentExtender) (*ParentExtender)(tif); TIFFMergeFieldInfo(tif, xtiffFieldInfo, sizeof(xtiffFieldInfo) / sizeof(xtiffFieldInfo[0])); } public: OneTimeTIFFTagInit() { assert(ParentExtender == nullptr); // Install our TIFF tag extender ParentExtender = TIFFSetTagExtender(GTiffTagExtender); } }; TIFFExtendProc OneTimeTIFFTagInit::ParentExtender = nullptr; // --------------------------------------------------------------------------- bool GTiffDataset::openTIFF(const std::string &filename) { static OneTimeTIFFTagInit oneTimeTIFFTagInit; m_hTIFF = TIFFClientOpen(filename.c_str(), "r", static_cast(this), GTiffDataset::tiffReadProc, GTiffDataset::tiffWriteProc, GTiffDataset::tiffSeekProc, GTiffDataset::tiffCloseProc, GTiffDataset::tiffSizeProc, GTiffDataset::tiffMapProc, GTiffDataset::tiffUnmapProc); m_filename = filename; m_hasNextGrid = true; return m_hTIFF != nullptr; } // --------------------------------------------------------------------------- std::unique_ptr GTiffDataset::nextGrid() { if (!m_hasNextGrid) return nullptr; if (m_nextDirOffset) { TIFFSetSubDirectory(m_hTIFF, m_nextDirOffset); } uint32_t width = 0; uint32_t height = 0; TIFFGetField(m_hTIFF, TIFFTAG_IMAGEWIDTH, &width); TIFFGetField(m_hTIFF, TIFFTAG_IMAGELENGTH, &height); if (width == 0 || height == 0 || width > INT_MAX || height > INT_MAX) { pj_log(m_ctx, PJ_LOG_ERROR, _("Invalid image size")); return nullptr; } uint16_t samplesPerPixel = 0; if (!TIFFGetField(m_hTIFF, TIFFTAG_SAMPLESPERPIXEL, &samplesPerPixel)) { pj_log(m_ctx, PJ_LOG_ERROR, _("Missing SamplesPerPixel tag")); return nullptr; } if (samplesPerPixel == 0) { pj_log(m_ctx, PJ_LOG_ERROR, _("Invalid SamplesPerPixel value")); return nullptr; } uint16_t bitsPerSample = 0; if (!TIFFGetField(m_hTIFF, TIFFTAG_BITSPERSAMPLE, &bitsPerSample)) { pj_log(m_ctx, PJ_LOG_ERROR, _("Missing BitsPerSample tag")); return nullptr; } uint16_t planarConfig = 0; if (!TIFFGetField(m_hTIFF, TIFFTAG_PLANARCONFIG, &planarConfig)) { pj_log(m_ctx, PJ_LOG_ERROR, _("Missing PlanarConfig tag")); return nullptr; } uint16_t sampleFormat = 0; if (!TIFFGetField(m_hTIFF, TIFFTAG_SAMPLEFORMAT, &sampleFormat)) { pj_log(m_ctx, PJ_LOG_ERROR, _("Missing SampleFormat tag")); return nullptr; } TIFFDataType dt; if (sampleFormat == SAMPLEFORMAT_INT && bitsPerSample == 16) dt = TIFFDataType::Int16; else if (sampleFormat == SAMPLEFORMAT_UINT && bitsPerSample == 16) dt = TIFFDataType::UInt16; else if (sampleFormat == SAMPLEFORMAT_INT && bitsPerSample == 32) dt = TIFFDataType::Int32; else if (sampleFormat == SAMPLEFORMAT_UINT && bitsPerSample == 32) dt = TIFFDataType::UInt32; else if (sampleFormat == SAMPLEFORMAT_IEEEFP && bitsPerSample == 32) dt = TIFFDataType::Float32; else if (sampleFormat == SAMPLEFORMAT_IEEEFP && bitsPerSample == 64) dt = TIFFDataType::Float64; else { pj_log(m_ctx, PJ_LOG_ERROR, _("Unsupported combination of SampleFormat " "and BitsPerSample values")); return nullptr; } uint16_t photometric = PHOTOMETRIC_MINISBLACK; if (!TIFFGetField(m_hTIFF, TIFFTAG_PHOTOMETRIC, &photometric)) photometric = PHOTOMETRIC_MINISBLACK; if (photometric != PHOTOMETRIC_MINISBLACK) { pj_log(m_ctx, PJ_LOG_ERROR, _("Unsupported Photometric value")); return nullptr; } uint16_t compression = COMPRESSION_NONE; if (!TIFFGetField(m_hTIFF, TIFFTAG_COMPRESSION, &compression)) compression = COMPRESSION_NONE; if (compression != COMPRESSION_NONE && !TIFFIsCODECConfigured(compression)) { pj_log(m_ctx, PJ_LOG_ERROR, _("Cannot open TIFF file due to missing codec.")); return nullptr; } // We really don't want to try dealing with old-JPEG images if (compression == COMPRESSION_OJPEG) { pj_log(m_ctx, PJ_LOG_ERROR, _("Unsupported compression method.")); return nullptr; } const auto blockSize = TIFFIsTiled(m_hTIFF) ? TIFFTileSize64(m_hTIFF) : TIFFStripSize64(m_hTIFF); if (blockSize == 0 || blockSize > 64 * 1024 * 2014) { pj_log(m_ctx, PJ_LOG_ERROR, _("Unsupported block size.")); return nullptr; } unsigned short count = 0; unsigned short *geokeys = nullptr; bool pixelIsArea = false; ExtentAndRes extent; extent.isGeographic = true; if (!TIFFGetField(m_hTIFF, TIFFTAG_GEOKEYDIRECTORY, &count, &geokeys)) { pj_log(m_ctx, PJ_LOG_TRACE, "No GeoKeys tag"); } else { if (count < 4 || (count % 4) != 0) { pj_log(m_ctx, PJ_LOG_ERROR, _("Wrong number of values in GeoKeys tag")); return nullptr; } if (geokeys[0] != 1) { pj_log(m_ctx, PJ_LOG_ERROR, _("Unsupported GeoTIFF major version")); return nullptr; } // We only know that we support GeoTIFF 1.0 and 1.1 at that time if (geokeys[1] != 1 || geokeys[2] > 1) { pj_log(m_ctx, PJ_LOG_TRACE, "GeoTIFF %d.%d possibly not handled", geokeys[1], geokeys[2]); } for (unsigned int i = 4; i + 3 < count; i += 4) { constexpr unsigned short GTModelTypeGeoKey = 1024; constexpr unsigned short ModelTypeProjected = 1; constexpr unsigned short ModelTypeGeographic = 2; constexpr unsigned short GTRasterTypeGeoKey = 1025; constexpr unsigned short RasterPixelIsArea = 1; // constexpr unsigned short RasterPixelIsPoint = 2; if (geokeys[i] == GTModelTypeGeoKey) { if (geokeys[i + 3] == ModelTypeProjected) { extent.isGeographic = false; } else if (geokeys[i + 3] != ModelTypeGeographic) { pj_log(m_ctx, PJ_LOG_ERROR, _("Only GTModelTypeGeoKey = " "ModelTypeGeographic or ModelTypeProjected are " "supported")); return nullptr; } } else if (geokeys[i] == GTRasterTypeGeoKey) { if (geokeys[i + 3] == RasterPixelIsArea) { pixelIsArea = true; } } } } double hRes = 0; double vRes = 0; double west = 0; double north = 0; double *matrix = nullptr; if (TIFFGetField(m_hTIFF, TIFFTAG_GEOTRANSMATRIX, &count, &matrix) && count == 16) { // If using GDAL to produce a bottom-up georeferencing, it will produce // a GeoTransformationMatrix, since negative values in GeoPixelScale // have historically been implementation bugs. if (matrix[1] != 0 || matrix[4] != 0) { pj_log(m_ctx, PJ_LOG_ERROR, _("Rotational terms not supported in " "GeoTransformationMatrix tag")); return nullptr; } west = matrix[3]; hRes = matrix[0]; north = matrix[7]; vRes = -matrix[5]; // negation to simulate GeoPixelScale convention } else { double *geopixelscale = nullptr; if (TIFFGetField(m_hTIFF, TIFFTAG_GEOPIXELSCALE, &count, &geopixelscale) != 1) { pj_log(m_ctx, PJ_LOG_ERROR, _("No GeoPixelScale tag")); return nullptr; } if (count != 3) { pj_log(m_ctx, PJ_LOG_ERROR, _("Wrong number of values in GeoPixelScale tag")); return nullptr; } hRes = geopixelscale[0]; vRes = geopixelscale[1]; double *geotiepoints = nullptr; if (TIFFGetField(m_hTIFF, TIFFTAG_GEOTIEPOINTS, &count, &geotiepoints) != 1) { pj_log(m_ctx, PJ_LOG_ERROR, _("No GeoTiePoints tag")); return nullptr; } if (count != 6) { pj_log(m_ctx, PJ_LOG_ERROR, _("Wrong number of values in GeoTiePoints tag")); return nullptr; } west = geotiepoints[3] - geotiepoints[0] * hRes; north = geotiepoints[4] + geotiepoints[1] * vRes; } if (pixelIsArea) { west += 0.5 * hRes; north -= 0.5 * vRes; } const double mulFactor = extent.isGeographic ? DEG_TO_RAD : 1; extent.west = west * mulFactor; extent.north = north * mulFactor; extent.resX = hRes * mulFactor; extent.resY = fabs(vRes) * mulFactor; extent.east = (west + hRes * (width - 1)) * mulFactor; extent.south = (north - vRes * (height - 1)) * mulFactor; extent.computeInvRes(); if (vRes < 0) { std::swap(extent.north, extent.south); } if (!((!extent.isGeographic || (fabs(extent.west) <= 4 * M_PI && fabs(extent.east) <= 4 * M_PI && fabs(extent.north) <= M_PI + 1e-5 && fabs(extent.south) <= M_PI + 1e-5)) && extent.west < extent.east && extent.south < extent.north && extent.resX > 1e-10 && extent.resY > 1e-10)) { pj_log(m_ctx, PJ_LOG_ERROR, _("Inconsistent georeferencing for %s"), m_filename.c_str()); return nullptr; } auto ret = std::unique_ptr(new GTiffGrid( m_ctx, m_hTIFF, m_cache, m_fp.get(), m_ifdIdx, m_filename, width, height, extent, dt, samplesPerPixel, planarConfig, vRes < 0)); m_ifdIdx++; m_hasNextGrid = TIFFReadDirectory(m_hTIFF) != 0; m_nextDirOffset = TIFFCurrentDirOffset(m_hTIFF); return ret; } // --------------------------------------------------------------------------- class GTiffVGridShiftSet : public VerticalShiftGridSet { std::unique_ptr m_GTiffDataset; GTiffVGridShiftSet(PJ_CONTEXT *ctx, std::unique_ptr &&fp) : m_GTiffDataset(new GTiffDataset(ctx, std::move(fp))) {} public: ~GTiffVGridShiftSet() override; static std::unique_ptr open(PJ_CONTEXT *ctx, std::unique_ptr fp, const std::string &filename); void reassign_context(PJ_CONTEXT *ctx) override { VerticalShiftGridSet::reassign_context(ctx); if (m_GTiffDataset) { m_GTiffDataset->reassign_context(ctx); } } bool reopen(PJ_CONTEXT *ctx) override { pj_log(ctx, PJ_LOG_DEBUG, "Grid %s has changed. Re-loading it", m_name.c_str()); m_grids.clear(); m_GTiffDataset.reset(); auto fp = FileManager::open_resource_file(ctx, m_name.c_str()); if (!fp) { return false; } auto newGS = open(ctx, std::move(fp), m_name); if (newGS) { m_grids = std::move(newGS->m_grids); m_GTiffDataset = std::move(newGS->m_GTiffDataset); } return !m_grids.empty(); } }; #endif // TIFF_ENABLED // --------------------------------------------------------------------------- template static void insertIntoHierarchy(PJ_CONTEXT *ctx, std::unique_ptr &&grid, const std::string &gridName, const std::string &parentName, std::vector> &topGrids, std::map &mapGrids) { const auto &extent = grid->extentAndRes(); // If we have one or both of grid_name and parent_grid_name, try to use // the names to recreate the hierarchy if (!gridName.empty()) { if (mapGrids.find(gridName) != mapGrids.end()) { pj_log(ctx, PJ_LOG_DEBUG, "Several grids called %s found!", gridName.c_str()); } mapGrids[gridName] = grid.get(); } if (!parentName.empty()) { auto iter = mapGrids.find(parentName); if (iter == mapGrids.end()) { pj_log(ctx, PJ_LOG_DEBUG, "Grid %s refers to non-existing parent %s. " "Using bounding-box method.", gridName.c_str(), parentName.c_str()); } else { if (iter->second->extentAndRes().contains(extent)) { iter->second->m_children.emplace_back(std::move(grid)); return; } else { pj_log(ctx, PJ_LOG_DEBUG, "Grid %s refers to parent %s, but its extent is " "not included in it. Using bounding-box method.", gridName.c_str(), parentName.c_str()); } } } else if (!gridName.empty()) { topGrids.emplace_back(std::move(grid)); return; } // Fallback to analyzing spatial extents for (const auto &candidateParent : topGrids) { const auto &candidateParentExtent = candidateParent->extentAndRes(); if (candidateParentExtent.contains(extent)) { static_cast(candidateParent.get()) ->insertGrid(ctx, std::move(grid)); return; } else if (candidateParentExtent.intersects(extent)) { pj_log(ctx, PJ_LOG_DEBUG, "Partially intersecting grids found!"); } } topGrids.emplace_back(std::move(grid)); } #ifdef TIFF_ENABLED // --------------------------------------------------------------------------- class GTiffVGrid : public VerticalShiftGrid { friend void insertIntoHierarchy( PJ_CONTEXT *ctx, std::unique_ptr &&grid, const std::string &gridName, const std::string &parentName, std::vector> &topGrids, std::map &mapGrids); std::unique_ptr m_grid; uint16_t m_idxSample; public: GTiffVGrid(std::unique_ptr &&grid, uint16_t idxSample); ~GTiffVGrid() override; bool valueAt(int x, int y, float &out) const override { return m_grid->valueAt(m_idxSample, x, y, out); } bool isNodata(float val, double /* multiplier */) const override { return m_grid->isNodata(val); } void insertGrid(PJ_CONTEXT *ctx, std::unique_ptr &&subgrid); void reassign_context(PJ_CONTEXT *ctx) override { m_grid->reassign_context(ctx); } bool hasChanged() const override { return m_grid->hasChanged(); } }; // --------------------------------------------------------------------------- GTiffVGridShiftSet::~GTiffVGridShiftSet() = default; // --------------------------------------------------------------------------- GTiffVGrid::GTiffVGrid(std::unique_ptr &&grid, uint16_t idxSample) : VerticalShiftGrid(grid->name(), grid->width(), grid->height(), grid->extentAndRes()), m_grid(std::move(grid)), m_idxSample(idxSample) {} // --------------------------------------------------------------------------- GTiffVGrid::~GTiffVGrid() = default; // --------------------------------------------------------------------------- void GTiffVGrid::insertGrid(PJ_CONTEXT *ctx, std::unique_ptr &&subgrid) { bool gridInserted = false; const auto &extent = subgrid->extentAndRes(); for (const auto &candidateParent : m_children) { const auto &candidateParentExtent = candidateParent->extentAndRes(); if (candidateParentExtent.contains(extent)) { static_cast(candidateParent.get()) ->insertGrid(ctx, std::move(subgrid)); gridInserted = true; break; } else if (candidateParentExtent.intersects(extent)) { pj_log(ctx, PJ_LOG_DEBUG, "Partially intersecting grids found!"); } } if (!gridInserted) { m_children.emplace_back(std::move(subgrid)); } } // --------------------------------------------------------------------------- std::unique_ptr GTiffVGridShiftSet::open(PJ_CONTEXT *ctx, std::unique_ptr fp, const std::string &filename) { auto set = std::unique_ptr( new GTiffVGridShiftSet(ctx, std::move(fp))); set->m_name = filename; set->m_format = "gtiff"; if (!set->m_GTiffDataset->openTIFF(filename)) { return nullptr; } uint16_t idxSample = 0; std::map mapGrids; for (int ifd = 0;; ++ifd) { auto grid = set->m_GTiffDataset->nextGrid(); if (!grid) { if (ifd == 0) { return nullptr; } break; } const auto subfileType = grid->subfileType(); if (subfileType != 0 && subfileType != FILETYPE_PAGE) { if (ifd == 0) { pj_log(ctx, PJ_LOG_ERROR, _("Invalid subfileType")); return nullptr; } else { pj_log(ctx, PJ_LOG_DEBUG, "Ignoring IFD %d as it has a unsupported subfileType", ifd); continue; } } // Identify the index of the geoid_undulation/vertical_offset bool foundDescriptionForAtLeastOneSample = false; bool foundDescriptionForShift = false; for (int i = 0; i < static_cast(grid->samplesPerPixel()); ++i) { const auto desc = grid->metadataItem("DESCRIPTION", i); if (!desc.empty()) { foundDescriptionForAtLeastOneSample = true; } if (desc == "geoid_undulation" || desc == "vertical_offset") { idxSample = static_cast(i); foundDescriptionForShift = true; } } if (foundDescriptionForAtLeastOneSample) { if (!foundDescriptionForShift) { if (ifd > 0) { // Assuming that extra IFD without our channel of interest // can be ignored // One could imagine to put the accuracy values in separate // IFD for example pj_log(ctx, PJ_LOG_DEBUG, "Ignoring IFD %d as it has no " "geoid_undulation/vertical_offset channel", ifd); continue; } else { pj_log(ctx, PJ_LOG_DEBUG, "IFD 0 has channel descriptions, but no " "geoid_undulation/vertical_offset channel"); return nullptr; } } } if (idxSample >= grid->samplesPerPixel()) { pj_log(ctx, PJ_LOG_ERROR, _("Invalid sample index")); return nullptr; } const std::string gridName = grid->metadataItem("grid_name"); const std::string parentName = grid->metadataItem("parent_grid_name"); auto vgrid = internal::make_unique(std::move(grid), idxSample); insertIntoHierarchy(ctx, std::move(vgrid), gridName, parentName, set->m_grids, mapGrids); } return set; } #endif // TIFF_ENABLED // --------------------------------------------------------------------------- std::unique_ptr VerticalShiftGridSet::open(PJ_CONTEXT *ctx, const std::string &filename) { if (filename == "null") { auto set = std::unique_ptr(new VerticalShiftGridSet()); set->m_name = filename; set->m_format = "null"; set->m_grids.push_back(std::unique_ptr( new NullVerticalShiftGrid())); return set; } auto fp = FileManager::open_resource_file(ctx, filename.c_str()); if (!fp) { return nullptr; } const auto actualName(fp->name()); if (ends_with(actualName, "gtx") || ends_with(actualName, "GTX")) { auto grid = GTXVerticalShiftGrid::open(ctx, std::move(fp), actualName); if (!grid) { return nullptr; } auto set = std::unique_ptr(new VerticalShiftGridSet()); set->m_name = actualName; set->m_format = "gtx"; set->m_grids.push_back(std::unique_ptr(grid)); return set; } /* -------------------------------------------------------------------- */ /* Load a header, to determine the file type. */ /* -------------------------------------------------------------------- */ unsigned char header[4]; size_t header_size = fp->read(header, sizeof(header)); if (header_size != sizeof(header)) { return nullptr; } fp->seek(0); if (IsTIFF(header_size, header)) { #ifdef TIFF_ENABLED auto set = std::unique_ptr( GTiffVGridShiftSet::open(ctx, std::move(fp), actualName)); if (!set) proj_context_errno_set( ctx, PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID); return set; #else pj_log(ctx, PJ_LOG_ERROR, _("TIFF grid, but TIFF support disabled in this build")); return nullptr; #endif } pj_log(ctx, PJ_LOG_ERROR, "Unrecognized vertical grid format for filename '%s'", filename.c_str()); return nullptr; } // --------------------------------------------------------------------------- bool VerticalShiftGridSet::reopen(PJ_CONTEXT *ctx) { pj_log(ctx, PJ_LOG_DEBUG, "Grid %s has changed. Re-loading it", m_name.c_str()); auto newGS = open(ctx, m_name); m_grids.clear(); if (newGS) { m_grids = std::move(newGS->m_grids); } return !m_grids.empty(); } // --------------------------------------------------------------------------- static bool isPointInExtent(double x, double y, const ExtentAndRes &extent, double eps = 0) { if (!(y + eps >= extent.south && y - eps <= extent.north)) return false; if (extent.fullWorldLongitude()) return true; if (extent.isGeographic) { if (x + eps < extent.west) x += 2 * M_PI; else if (x - eps > extent.east) x -= 2 * M_PI; } if (!(x + eps >= extent.west && x - eps <= extent.east)) return false; return true; } // --------------------------------------------------------------------------- const VerticalShiftGrid *VerticalShiftGrid::gridAt(double lon, double lat) const { for (const auto &child : m_children) { const auto &extentChild = child->extentAndRes(); if (isPointInExtent(lon, lat, extentChild)) { return child->gridAt(lon, lat); } } return this; } // --------------------------------------------------------------------------- const VerticalShiftGrid *VerticalShiftGridSet::gridAt(double lon, double lat) const { for (const auto &grid : m_grids) { if (grid->isNullGrid()) { return grid.get(); } const auto &extent = grid->extentAndRes(); if (isPointInExtent(lon, lat, extent)) { return grid->gridAt(lon, lat); } } return nullptr; } // --------------------------------------------------------------------------- void VerticalShiftGridSet::reassign_context(PJ_CONTEXT *ctx) { for (const auto &grid : m_grids) { grid->reassign_context(ctx); } } // --------------------------------------------------------------------------- HorizontalShiftGrid::HorizontalShiftGrid(const std::string &nameIn, int widthIn, int heightIn, const ExtentAndRes &extentIn) : Grid(nameIn, widthIn, heightIn, extentIn) {} // --------------------------------------------------------------------------- HorizontalShiftGrid::~HorizontalShiftGrid() = default; // --------------------------------------------------------------------------- HorizontalShiftGridSet::HorizontalShiftGridSet() = default; // --------------------------------------------------------------------------- HorizontalShiftGridSet::~HorizontalShiftGridSet() = default; // --------------------------------------------------------------------------- class NullHorizontalShiftGrid : public HorizontalShiftGrid { public: NullHorizontalShiftGrid() : HorizontalShiftGrid("null", 3, 3, globalExtent()) {} bool isNullGrid() const override { return true; } bool valueAt(int, int, bool, float &lonShift, float &latShift) const override; void reassign_context(PJ_CONTEXT *) override {} bool hasChanged() const override { return false; } }; // --------------------------------------------------------------------------- bool NullHorizontalShiftGrid::valueAt(int, int, bool, float &lonShift, float &latShift) const { lonShift = 0.0f; latShift = 0.0f; return true; } // --------------------------------------------------------------------------- static double to_double(const void *data) { double d; memcpy(&d, data, sizeof(d)); return d; } // --------------------------------------------------------------------------- class NTv1Grid : public HorizontalShiftGrid { PJ_CONTEXT *m_ctx; std::unique_ptr m_fp; NTv1Grid(const NTv1Grid &) = delete; NTv1Grid &operator=(const NTv1Grid &) = delete; public: explicit NTv1Grid(PJ_CONTEXT *ctx, std::unique_ptr &&fp, const std::string &nameIn, int widthIn, int heightIn, const ExtentAndRes &extentIn) : HorizontalShiftGrid(nameIn, widthIn, heightIn, extentIn), m_ctx(ctx), m_fp(std::move(fp)) {} ~NTv1Grid() override; bool valueAt(int, int, bool, float &lonShift, float &latShift) const override; static NTv1Grid *open(PJ_CONTEXT *ctx, std::unique_ptr fp, const std::string &filename); void reassign_context(PJ_CONTEXT *ctx) override { m_ctx = ctx; m_fp->reassign_context(ctx); } bool hasChanged() const override { return m_fp->hasChanged(); } }; // --------------------------------------------------------------------------- NTv1Grid::~NTv1Grid() = default; // --------------------------------------------------------------------------- NTv1Grid *NTv1Grid::open(PJ_CONTEXT *ctx, std::unique_ptr fp, const std::string &filename) { unsigned char header[192]; /* -------------------------------------------------------------------- */ /* Read the header. */ /* -------------------------------------------------------------------- */ if (fp->read(header, sizeof(header)) != sizeof(header)) { proj_context_errno_set(ctx, PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID); return nullptr; } /* -------------------------------------------------------------------- */ /* Regularize fields of interest. */ /* -------------------------------------------------------------------- */ if (IS_LSB) { swap_words(header + 8, sizeof(int), 1); swap_words(header + 24, sizeof(double), 1); swap_words(header + 40, sizeof(double), 1); swap_words(header + 56, sizeof(double), 1); swap_words(header + 72, sizeof(double), 1); swap_words(header + 88, sizeof(double), 1); swap_words(header + 104, sizeof(double), 1); } if (*((int *)(header + 8)) != 12) { pj_log(ctx, PJ_LOG_ERROR, _("NTv1 grid shift file has wrong record count, corrupt?")); proj_context_errno_set(ctx, PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID); return nullptr; } ExtentAndRes extent; extent.isGeographic = true; extent.west = -to_double(header + 72) * DEG_TO_RAD; extent.south = to_double(header + 24) * DEG_TO_RAD; extent.east = -to_double(header + 56) * DEG_TO_RAD; extent.north = to_double(header + 40) * DEG_TO_RAD; extent.resX = to_double(header + 104) * DEG_TO_RAD; extent.resY = to_double(header + 88) * DEG_TO_RAD; extent.computeInvRes(); if (!(fabs(extent.west) <= 4 * M_PI && fabs(extent.east) <= 4 * M_PI && fabs(extent.north) <= M_PI + 1e-5 && fabs(extent.south) <= M_PI + 1e-5 && extent.west < extent.east && extent.south < extent.north && extent.resX > 1e-10 && extent.resY > 1e-10)) { pj_log(ctx, PJ_LOG_ERROR, _("Inconsistent georeferencing for %s"), filename.c_str()); proj_context_errno_set(ctx, PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID); return nullptr; } const int columns = static_cast( fabs((extent.east - extent.west) * extent.invResX + 0.5) + 1); const int rows = static_cast( fabs((extent.north - extent.south) * extent.invResY + 0.5) + 1); return new NTv1Grid(ctx, std::move(fp), filename, columns, rows, extent); } // --------------------------------------------------------------------------- bool NTv1Grid::valueAt(int x, int y, bool compensateNTConvention, float &lonShift, float &latShift) const { assert(x >= 0 && y >= 0 && x < m_width && y < m_height); double two_doubles[2]; // NTv1 is organized from east to west ! m_fp->seek(192 + 2 * sizeof(double) * (y * m_width + m_width - 1 - x)); if (m_fp->read(&two_doubles[0], sizeof(two_doubles)) != sizeof(two_doubles)) { proj_context_errno_set(m_ctx, PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID); return false; } if (IS_LSB) { swap_words(&two_doubles[0], sizeof(double), 2); } /* convert seconds to radians */ latShift = static_cast(two_doubles[0] * ((M_PI / 180.0) / 3600.0)); // west longitude positive convention ! lonShift = (compensateNTConvention ? -1 : 1) * static_cast(two_doubles[1] * ((M_PI / 180.0) / 3600.0)); return true; } // --------------------------------------------------------------------------- class CTable2Grid : public HorizontalShiftGrid { PJ_CONTEXT *m_ctx; std::unique_ptr m_fp; CTable2Grid(const CTable2Grid &) = delete; CTable2Grid &operator=(const CTable2Grid &) = delete; public: CTable2Grid(PJ_CONTEXT *ctx, std::unique_ptr fp, const std::string &nameIn, int widthIn, int heightIn, const ExtentAndRes &extentIn) : HorizontalShiftGrid(nameIn, widthIn, heightIn, extentIn), m_ctx(ctx), m_fp(std::move(fp)) {} ~CTable2Grid() override; bool valueAt(int, int, bool, float &lonShift, float &latShift) const override; static CTable2Grid *open(PJ_CONTEXT *ctx, std::unique_ptr fp, const std::string &filename); void reassign_context(PJ_CONTEXT *ctx) override { m_ctx = ctx; m_fp->reassign_context(ctx); } bool hasChanged() const override { return m_fp->hasChanged(); } }; // --------------------------------------------------------------------------- CTable2Grid::~CTable2Grid() = default; // --------------------------------------------------------------------------- CTable2Grid *CTable2Grid::open(PJ_CONTEXT *ctx, std::unique_ptr fp, const std::string &filename) { unsigned char header[160]; /* -------------------------------------------------------------------- */ /* Read the header. */ /* -------------------------------------------------------------------- */ if (fp->read(header, sizeof(header)) != sizeof(header)) { proj_context_errno_set(ctx, PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID); return nullptr; } /* -------------------------------------------------------------------- */ /* Regularize fields of interest. */ /* -------------------------------------------------------------------- */ if (!IS_LSB) { swap_words(header + 96, sizeof(double), 4); swap_words(header + 128, sizeof(int), 2); } ExtentAndRes extent; extent.isGeographic = true; static_assert(sizeof(extent.west) == 8, "wrong sizeof"); static_assert(sizeof(extent.south) == 8, "wrong sizeof"); static_assert(sizeof(extent.resX) == 8, "wrong sizeof"); static_assert(sizeof(extent.resY) == 8, "wrong sizeof"); memcpy(&extent.west, header + 96, 8); memcpy(&extent.south, header + 104, 8); memcpy(&extent.resX, header + 112, 8); memcpy(&extent.resY, header + 120, 8); if (!(fabs(extent.west) <= 4 * M_PI && fabs(extent.south) <= M_PI + 1e-5 && extent.resX > 1e-10 && extent.resY > 1e-10)) { pj_log(ctx, PJ_LOG_ERROR, _("Inconsistent georeferencing for %s"), filename.c_str()); proj_context_errno_set(ctx, PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID); return nullptr; } int width; int height; memcpy(&width, header + 128, 4); memcpy(&height, header + 132, 4); if (width <= 0 || height <= 0) { proj_context_errno_set(ctx, PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID); return nullptr; } extent.east = extent.west + (width - 1) * extent.resX; extent.north = extent.south + (height - 1) * extent.resX; return new CTable2Grid(ctx, std::move(fp), filename, width, height, extent); } // --------------------------------------------------------------------------- bool CTable2Grid::valueAt(int x, int y, bool compensateNTConvention, float &lonShift, float &latShift) const { assert(x >= 0 && y >= 0 && x < m_width && y < m_height); float two_floats[2]; m_fp->seek(160 + 2 * sizeof(float) * (y * m_width + x)); if (m_fp->read(&two_floats[0], sizeof(two_floats)) != sizeof(two_floats)) { proj_context_errno_set(m_ctx, PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID); return false; } if (!IS_LSB) { swap_words(&two_floats[0], sizeof(float), 2); } latShift = two_floats[1]; // west longitude positive convention ! lonShift = (compensateNTConvention ? -1 : 1) * two_floats[0]; return true; } // --------------------------------------------------------------------------- class NTv2GridSet : public HorizontalShiftGridSet { std::unique_ptr m_fp; NTv2GridSet(const NTv2GridSet &) = delete; NTv2GridSet &operator=(const NTv2GridSet &) = delete; explicit NTv2GridSet(std::unique_ptr &&fp) : m_fp(std::move(fp)) {} public: ~NTv2GridSet() override; static std::unique_ptr open(PJ_CONTEXT *ctx, std::unique_ptr fp, const std::string &filename); void reassign_context(PJ_CONTEXT *ctx) override { HorizontalShiftGridSet::reassign_context(ctx); m_fp->reassign_context(ctx); } }; // --------------------------------------------------------------------------- class NTv2Grid : public HorizontalShiftGrid { friend class NTv2GridSet; PJ_CONTEXT *m_ctx; // owned by the parent NTv2GridSet File *m_fp; // owned by the parent NTv2GridSet unsigned long long m_offset; bool m_mustSwap; NTv2Grid(const NTv2Grid &) = delete; NTv2Grid &operator=(const NTv2Grid &) = delete; public: NTv2Grid(const std::string &nameIn, PJ_CONTEXT *ctx, File *fp, unsigned long long offsetIn, bool mustSwapIn, int widthIn, int heightIn, const ExtentAndRes &extentIn) : HorizontalShiftGrid(nameIn, widthIn, heightIn, extentIn), m_ctx(ctx), m_fp(fp), m_offset(offsetIn), m_mustSwap(mustSwapIn) {} bool valueAt(int, int, bool, float &lonShift, float &latShift) const override; void reassign_context(PJ_CONTEXT *ctx) override { m_ctx = ctx; m_fp->reassign_context(ctx); } bool hasChanged() const override { return m_fp->hasChanged(); } }; // --------------------------------------------------------------------------- bool NTv2Grid::valueAt(int x, int y, bool compensateNTConvention, float &lonShift, float &latShift) const { assert(x >= 0 && y >= 0 && x < m_width && y < m_height); float two_float[2]; // NTv2 is organized from east to west ! // there are 4 components: lat shift, lon shift, lat error, lon error m_fp->seek(m_offset + 4 * sizeof(float) * (static_cast(y) * m_width + m_width - 1 - x)); if (m_fp->read(&two_float[0], sizeof(two_float)) != sizeof(two_float)) { proj_context_errno_set(m_ctx, PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID); return false; } if (m_mustSwap) { swap_words(&two_float[0], sizeof(float), 2); } /* convert seconds to radians */ latShift = static_cast(two_float[0] * ((M_PI / 180.0) / 3600.0)); // west longitude positive convention ! lonShift = (compensateNTConvention ? -1 : 1) * static_cast(two_float[1] * ((M_PI / 180.0) / 3600.0)); return true; } // --------------------------------------------------------------------------- NTv2GridSet::~NTv2GridSet() = default; // --------------------------------------------------------------------------- std::unique_ptr NTv2GridSet::open(PJ_CONTEXT *ctx, std::unique_ptr fp, const std::string &filename) { File *fpRaw = fp.get(); auto set = std::unique_ptr(new NTv2GridSet(std::move(fp))); set->m_name = filename; set->m_format = "ntv2"; char header[11 * 16]; /* -------------------------------------------------------------------- */ /* Read the header. */ /* -------------------------------------------------------------------- */ if (fpRaw->read(header, sizeof(header)) != sizeof(header)) { proj_context_errno_set(ctx, PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID); return nullptr; } constexpr int OFFSET_GS_TYPE = 56; if (memcmp(header + OFFSET_GS_TYPE, "SECONDS", 7) != 0) { pj_log(ctx, PJ_LOG_ERROR, _("Only GS_TYPE=SECONDS is supported")); proj_context_errno_set(ctx, PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID); return nullptr; } const bool must_swap = (header[8] == 11) ? !IS_LSB : IS_LSB; constexpr int OFFSET_NUM_SUBFILES = 8 + 32; if (must_swap) { // swap_words( header+8, 4, 1 ); // swap_words( header+8+16, 4, 1 ); swap_words(header + OFFSET_NUM_SUBFILES, 4, 1); // swap_words( header+8+7*16, 8, 1 ); // swap_words( header+8+8*16, 8, 1 ); // swap_words( header+8+9*16, 8, 1 ); // swap_words( header+8+10*16, 8, 1 ); } /* -------------------------------------------------------------------- */ /* Get the subfile count out ... all we really use for now. */ /* -------------------------------------------------------------------- */ unsigned int num_subfiles; memcpy(&num_subfiles, header + OFFSET_NUM_SUBFILES, 4); std::map mapGrids; /* ==================================================================== */ /* Step through the subfiles, creating a grid for each. */ /* ==================================================================== */ for (unsigned subfile = 0; subfile < num_subfiles; subfile++) { // Read header if (fpRaw->read(header, sizeof(header)) != sizeof(header)) { proj_context_errno_set( ctx, PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID); return nullptr; } if (strncmp(header, "SUB_NAME", 8) != 0) { proj_context_errno_set( ctx, PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID); return nullptr; } // Byte swap interesting fields if needed. constexpr int OFFSET_GS_COUNT = 8 + 16 * 10; constexpr int OFFSET_SOUTH_LAT = 8 + 16 * 4; if (must_swap) { // 6 double values: south, north, east, west, resY, // resX for (int i = 0; i < 6; i++) { swap_words(header + OFFSET_SOUTH_LAT + 16 * i, sizeof(double), 1); } swap_words(header + OFFSET_GS_COUNT, sizeof(int), 1); } std::string gridName; gridName.append(header + 8, 8); ExtentAndRes extent; extent.isGeographic = true; extent.south = to_double(header + OFFSET_SOUTH_LAT) * DEG_TO_RAD / 3600.0; /* S_LAT */ extent.north = to_double(header + OFFSET_SOUTH_LAT + 16) * DEG_TO_RAD / 3600.0; /* N_LAT */ extent.east = -to_double(header + OFFSET_SOUTH_LAT + 16 * 2) * DEG_TO_RAD / 3600.0; /* E_LONG */ extent.west = -to_double(header + OFFSET_SOUTH_LAT + 16 * 3) * DEG_TO_RAD / 3600.0; /* W_LONG */ extent.resY = to_double(header + OFFSET_SOUTH_LAT + 16 * 4) * DEG_TO_RAD / 3600.0; extent.resX = to_double(header + OFFSET_SOUTH_LAT + 16 * 5) * DEG_TO_RAD / 3600.0; extent.computeInvRes(); if (!(fabs(extent.west) <= 4 * M_PI && fabs(extent.east) <= 4 * M_PI && fabs(extent.north) <= M_PI + 1e-5 && fabs(extent.south) <= M_PI + 1e-5 && extent.west < extent.east && extent.south < extent.north && extent.resX > 1e-10 && extent.resY > 1e-10)) { pj_log(ctx, PJ_LOG_ERROR, _("Inconsistent georeferencing for %s"), filename.c_str()); proj_context_errno_set( ctx, PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID); return nullptr; } const int columns = static_cast( fabs((extent.east - extent.west) * extent.invResX + 0.5) + 1); const int rows = static_cast( fabs((extent.north - extent.south) * extent.invResY + 0.5) + 1); pj_log(ctx, PJ_LOG_TRACE, "NTv2 %s %dx%d: LL=(%.9g,%.9g) UR=(%.9g,%.9g)", gridName.c_str(), columns, rows, extent.west * RAD_TO_DEG, extent.south * RAD_TO_DEG, extent.east * RAD_TO_DEG, extent.north * RAD_TO_DEG); unsigned int gs_count; memcpy(&gs_count, header + OFFSET_GS_COUNT, 4); if (gs_count / columns != static_cast(rows)) { pj_log(ctx, PJ_LOG_ERROR, _("GS_COUNT(%u) does not match expected cells (%dx%d)"), gs_count, columns, rows); proj_context_errno_set( ctx, PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID); return nullptr; } const auto offset = fpRaw->tell(); auto grid = std::unique_ptr( new NTv2Grid(filename + ", " + gridName, ctx, fpRaw, offset, must_swap, columns, rows, extent)); std::string parentName; parentName.assign(header + 24, 8); auto iter = mapGrids.find(parentName); auto gridPtr = grid.get(); if (iter == mapGrids.end()) { set->m_grids.emplace_back(std::move(grid)); } else { iter->second->m_children.emplace_back(std::move(grid)); } mapGrids[gridName] = gridPtr; // Skip grid data. 4 components of size float fpRaw->seek(static_cast(gs_count) * 4 * 4, SEEK_CUR); } return set; } #ifdef TIFF_ENABLED // --------------------------------------------------------------------------- class GTiffHGridShiftSet : public HorizontalShiftGridSet { std::unique_ptr m_GTiffDataset; GTiffHGridShiftSet(PJ_CONTEXT *ctx, std::unique_ptr &&fp) : m_GTiffDataset(new GTiffDataset(ctx, std::move(fp))) {} public: ~GTiffHGridShiftSet() override; static std::unique_ptr open(PJ_CONTEXT *ctx, std::unique_ptr fp, const std::string &filename); void reassign_context(PJ_CONTEXT *ctx) override { HorizontalShiftGridSet::reassign_context(ctx); if (m_GTiffDataset) { m_GTiffDataset->reassign_context(ctx); } } bool reopen(PJ_CONTEXT *ctx) override { pj_log(ctx, PJ_LOG_DEBUG, "Grid %s has changed. Re-loading it", m_name.c_str()); m_grids.clear(); m_GTiffDataset.reset(); auto fp = FileManager::open_resource_file(ctx, m_name.c_str()); if (!fp) { return false; } auto newGS = open(ctx, std::move(fp), m_name); if (newGS) { m_grids = std::move(newGS->m_grids); m_GTiffDataset = std::move(newGS->m_GTiffDataset); } return !m_grids.empty(); } }; // --------------------------------------------------------------------------- class GTiffHGrid : public HorizontalShiftGrid { friend void insertIntoHierarchy( PJ_CONTEXT *ctx, std::unique_ptr &&grid, const std::string &gridName, const std::string &parentName, std::vector> &topGrids, std::map &mapGrids); std::unique_ptr m_grid; uint16_t m_idxLatShift; uint16_t m_idxLonShift; double m_convFactorToRadian; bool m_positiveEast; public: GTiffHGrid(std::unique_ptr &&grid, uint16_t idxLatShift, uint16_t idxLonShift, double convFactorToRadian, bool positiveEast); ~GTiffHGrid() override; bool valueAt(int x, int y, bool, float &lonShift, float &latShift) const override; void insertGrid(PJ_CONTEXT *ctx, std::unique_ptr &&subgrid); void reassign_context(PJ_CONTEXT *ctx) override { m_grid->reassign_context(ctx); } bool hasChanged() const override { return m_grid->hasChanged(); } }; // --------------------------------------------------------------------------- GTiffHGridShiftSet::~GTiffHGridShiftSet() = default; // --------------------------------------------------------------------------- GTiffHGrid::GTiffHGrid(std::unique_ptr &&grid, uint16_t idxLatShift, uint16_t idxLonShift, double convFactorToRadian, bool positiveEast) : HorizontalShiftGrid(grid->name(), grid->width(), grid->height(), grid->extentAndRes()), m_grid(std::move(grid)), m_idxLatShift(idxLatShift), m_idxLonShift(idxLonShift), m_convFactorToRadian(convFactorToRadian), m_positiveEast(positiveEast) {} // --------------------------------------------------------------------------- GTiffHGrid::~GTiffHGrid() = default; // --------------------------------------------------------------------------- bool GTiffHGrid::valueAt(int x, int y, bool, float &lonShift, float &latShift) const { if (!m_grid->valueAt(m_idxLatShift, x, y, latShift) || !m_grid->valueAt(m_idxLonShift, x, y, lonShift)) { return false; } // From arc-seconds to radians latShift = static_cast(latShift * m_convFactorToRadian); lonShift = static_cast(lonShift * m_convFactorToRadian); if (!m_positiveEast) { lonShift = -lonShift; } return true; } // --------------------------------------------------------------------------- void GTiffHGrid::insertGrid(PJ_CONTEXT *ctx, std::unique_ptr &&subgrid) { bool gridInserted = false; const auto &extent = subgrid->extentAndRes(); for (const auto &candidateParent : m_children) { const auto &candidateParentExtent = candidateParent->extentAndRes(); if (candidateParentExtent.contains(extent)) { static_cast(candidateParent.get()) ->insertGrid(ctx, std::move(subgrid)); gridInserted = true; break; } else if (candidateParentExtent.intersects(extent)) { pj_log(ctx, PJ_LOG_DEBUG, "Partially intersecting grids found!"); } } if (!gridInserted) { m_children.emplace_back(std::move(subgrid)); } } // --------------------------------------------------------------------------- std::unique_ptr GTiffHGridShiftSet::open(PJ_CONTEXT *ctx, std::unique_ptr fp, const std::string &filename) { auto set = std::unique_ptr( new GTiffHGridShiftSet(ctx, std::move(fp))); set->m_name = filename; set->m_format = "gtiff"; if (!set->m_GTiffDataset->openTIFF(filename)) { return nullptr; } // Defaults inspired from NTv2 uint16_t idxLatShift = 0; uint16_t idxLonShift = 1; constexpr double ARC_SECOND_TO_RADIAN = (M_PI / 180.0) / 3600.0; double convFactorToRadian = ARC_SECOND_TO_RADIAN; bool positiveEast = true; std::map mapGrids; for (int ifd = 0;; ++ifd) { auto grid = set->m_GTiffDataset->nextGrid(); if (!grid) { if (ifd == 0) { return nullptr; } break; } const auto subfileType = grid->subfileType(); if (subfileType != 0 && subfileType != FILETYPE_PAGE) { if (ifd == 0) { pj_log(ctx, PJ_LOG_ERROR, _("Invalid subfileType")); return nullptr; } else { pj_log(ctx, PJ_LOG_DEBUG, _("Ignoring IFD %d as it has a unsupported subfileType"), ifd); continue; } } if (grid->samplesPerPixel() < 2) { if (ifd == 0) { pj_log(ctx, PJ_LOG_ERROR, _("At least 2 samples per pixel needed")); return nullptr; } else { pj_log(ctx, PJ_LOG_DEBUG, _("Ignoring IFD %d as it has not at least 2 samples"), ifd); continue; } } // Identify the index of the latitude and longitude offset channels bool foundDescriptionForAtLeastOneSample = false; bool foundDescriptionForLatOffset = false; bool foundDescriptionForLonOffset = false; for (int i = 0; i < static_cast(grid->samplesPerPixel()); ++i) { const auto desc = grid->metadataItem("DESCRIPTION", i); if (!desc.empty()) { foundDescriptionForAtLeastOneSample = true; } if (desc == "latitude_offset") { idxLatShift = static_cast(i); foundDescriptionForLatOffset = true; } else if (desc == "longitude_offset") { idxLonShift = static_cast(i); foundDescriptionForLonOffset = true; } } if (foundDescriptionForAtLeastOneSample) { if (!foundDescriptionForLonOffset && !foundDescriptionForLatOffset) { if (ifd > 0) { // Assuming that extra IFD without // longitude_offset/latitude_offset can be ignored // One could imagine to put the accuracy values in separate // IFD for example pj_log(ctx, PJ_LOG_DEBUG, "Ignoring IFD %d as it has no " "longitude_offset/latitude_offset channel", ifd); continue; } else { pj_log(ctx, PJ_LOG_DEBUG, "IFD 0 has channel descriptions, but no " "longitude_offset/latitude_offset channel"); return nullptr; } } } if (foundDescriptionForLatOffset && !foundDescriptionForLonOffset) { pj_log( ctx, PJ_LOG_ERROR, _("Found latitude_offset channel, but not longitude_offset")); return nullptr; } else if (foundDescriptionForLonOffset && !foundDescriptionForLatOffset) { pj_log( ctx, PJ_LOG_ERROR, _("Found longitude_offset channel, but not latitude_offset")); return nullptr; } if (idxLatShift >= grid->samplesPerPixel() || idxLonShift >= grid->samplesPerPixel()) { pj_log(ctx, PJ_LOG_ERROR, _("Invalid sample index")); return nullptr; } if (foundDescriptionForLonOffset) { const std::string positiveValue = grid->metadataItem("positive_value", idxLonShift); if (!positiveValue.empty()) { if (positiveValue == "west") { positiveEast = false; } else if (positiveValue == "east") { positiveEast = true; } else { pj_log(ctx, PJ_LOG_ERROR, _("Unsupported value %s for 'positive_value'"), positiveValue.c_str()); return nullptr; } } } // Identify their unit { const auto unitLatShift = grid->metadataItem("UNITTYPE", idxLatShift); const auto unitLonShift = grid->metadataItem("UNITTYPE", idxLonShift); if (unitLatShift != unitLonShift) { pj_log(ctx, PJ_LOG_ERROR, _("Different unit for longitude and latitude offset")); return nullptr; } if (!unitLatShift.empty()) { if (unitLatShift == "arc-second") { convFactorToRadian = ARC_SECOND_TO_RADIAN; } else if (unitLatShift == "radian") { convFactorToRadian = 1.0; } else if (unitLatShift == "degree") { convFactorToRadian = M_PI / 180.0; } else { pj_log(ctx, PJ_LOG_ERROR, _("Unsupported unit %s"), unitLatShift.c_str()); return nullptr; } } } const std::string gridName = grid->metadataItem("grid_name"); const std::string parentName = grid->metadataItem("parent_grid_name"); auto hgrid = internal::make_unique( std::move(grid), idxLatShift, idxLonShift, convFactorToRadian, positiveEast); insertIntoHierarchy(ctx, std::move(hgrid), gridName, parentName, set->m_grids, mapGrids); } return set; } #endif // TIFF_ENABLED // --------------------------------------------------------------------------- std::unique_ptr HorizontalShiftGridSet::open(PJ_CONTEXT *ctx, const std::string &filename) { if (filename == "null") { auto set = std::unique_ptr( new HorizontalShiftGridSet()); set->m_name = filename; set->m_format = "null"; set->m_grids.push_back(std::unique_ptr( new NullHorizontalShiftGrid())); return set; } auto fp = FileManager::open_resource_file(ctx, filename.c_str()); if (!fp) { return nullptr; } const auto actualName(fp->name()); char header[160]; /* -------------------------------------------------------------------- */ /* Load a header, to determine the file type. */ /* -------------------------------------------------------------------- */ size_t header_size = fp->read(header, sizeof(header)); if (header_size != sizeof(header)) { /* some files may be smaller that sizeof(header), eg 160, so */ ctx->last_errno = 0; /* don't treat as a persistent error */ pj_log(ctx, PJ_LOG_DEBUG, "pj_gridinfo_init: short header read of %d bytes", (int)header_size); } fp->seek(0); /* -------------------------------------------------------------------- */ /* Determine file type. */ /* -------------------------------------------------------------------- */ if (header_size >= 144 + 16 && strncmp(header + 0, "HEADER", 6) == 0 && strncmp(header + 96, "W GRID", 6) == 0 && strncmp(header + 144, "TO NAD83 ", 16) == 0) { auto grid = NTv1Grid::open(ctx, std::move(fp), actualName); if (!grid) { return nullptr; } auto set = std::unique_ptr( new HorizontalShiftGridSet()); set->m_name = actualName; set->m_format = "ntv1"; set->m_grids.push_back(std::unique_ptr(grid)); return set; } else if (header_size >= 9 && strncmp(header + 0, "CTABLE V2", 9) == 0) { auto grid = CTable2Grid::open(ctx, std::move(fp), actualName); if (!grid) { return nullptr; } auto set = std::unique_ptr( new HorizontalShiftGridSet()); set->m_name = actualName; set->m_format = "ctable2"; set->m_grids.push_back(std::unique_ptr(grid)); return set; } else if (header_size >= 48 + 7 && strncmp(header + 0, "NUM_OREC", 8) == 0 && strncmp(header + 48, "GS_TYPE", 7) == 0) { return NTv2GridSet::open(ctx, std::move(fp), actualName); } else if (IsTIFF(header_size, reinterpret_cast(header))) { #ifdef TIFF_ENABLED auto set = std::unique_ptr( GTiffHGridShiftSet::open(ctx, std::move(fp), actualName)); if (!set) proj_context_errno_set( ctx, PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID); return set; #else pj_log(ctx, PJ_LOG_ERROR, _("TIFF grid, but TIFF support disabled in this build")); return nullptr; #endif } pj_log(ctx, PJ_LOG_ERROR, "Unrecognized horizontal grid format for filename '%s'", filename.c_str()); return nullptr; } // --------------------------------------------------------------------------- bool HorizontalShiftGridSet::reopen(PJ_CONTEXT *ctx) { pj_log(ctx, PJ_LOG_DEBUG, "Grid %s has changed. Re-loading it", m_name.c_str()); auto newGS = open(ctx, m_name); m_grids.clear(); if (newGS) { m_grids = std::move(newGS->m_grids); } return !m_grids.empty(); } // --------------------------------------------------------------------------- #define REL_TOLERANCE_HGRIDSHIFT 1e-5 const HorizontalShiftGrid *HorizontalShiftGrid::gridAt(double lon, double lat) const { for (const auto &child : m_children) { const auto &extentChild = child->extentAndRes(); const double epsilon = (extentChild.resX + extentChild.resY) * REL_TOLERANCE_HGRIDSHIFT; if (isPointInExtent(lon, lat, extentChild, epsilon)) { return child->gridAt(lon, lat); } } return this; } // --------------------------------------------------------------------------- const HorizontalShiftGrid *HorizontalShiftGridSet::gridAt(double lon, double lat) const { for (const auto &grid : m_grids) { if (grid->isNullGrid()) { return grid.get(); } const auto &extent = grid->extentAndRes(); const double epsilon = (extent.resX + extent.resY) * REL_TOLERANCE_HGRIDSHIFT; if (isPointInExtent(lon, lat, extent, epsilon)) { return grid->gridAt(lon, lat); } } return nullptr; } // --------------------------------------------------------------------------- void HorizontalShiftGridSet::reassign_context(PJ_CONTEXT *ctx) { for (const auto &grid : m_grids) { grid->reassign_context(ctx); } } #ifdef TIFF_ENABLED // --------------------------------------------------------------------------- class GTiffGenericGridShiftSet : public GenericShiftGridSet { std::unique_ptr m_GTiffDataset; GTiffGenericGridShiftSet(PJ_CONTEXT *ctx, std::unique_ptr &&fp) : m_GTiffDataset(new GTiffDataset(ctx, std::move(fp))) {} public: ~GTiffGenericGridShiftSet() override; static std::unique_ptr open(PJ_CONTEXT *ctx, std::unique_ptr fp, const std::string &filename); void reassign_context(PJ_CONTEXT *ctx) override { GenericShiftGridSet::reassign_context(ctx); if (m_GTiffDataset) { m_GTiffDataset->reassign_context(ctx); } } bool reopen(PJ_CONTEXT *ctx) override { pj_log(ctx, PJ_LOG_DEBUG, "Grid %s has changed. Re-loading it", m_name.c_str()); m_grids.clear(); m_GTiffDataset.reset(); auto fp = FileManager::open_resource_file(ctx, m_name.c_str()); if (!fp) { return false; } auto newGS = open(ctx, std::move(fp), m_name); if (newGS) { m_grids = std::move(newGS->m_grids); m_GTiffDataset = std::move(newGS->m_GTiffDataset); } return !m_grids.empty(); } }; // --------------------------------------------------------------------------- class GTiffGenericGrid : public GenericShiftGrid { friend void insertIntoHierarchy( PJ_CONTEXT *ctx, std::unique_ptr &&grid, const std::string &gridName, const std::string &parentName, std::vector> &topGrids, std::map &mapGrids); std::unique_ptr m_grid; public: GTiffGenericGrid(std::unique_ptr &&grid); ~GTiffGenericGrid() override; bool valueAt(int x, int y, int sample, float &out) const override; int samplesPerPixel() const override { return m_grid->samplesPerPixel(); } std::string unit(int sample) const override { return m_grid->metadataItem("UNITTYPE", sample); } std::string description(int sample) const override { return m_grid->metadataItem("DESCRIPTION", sample); } std::string metadataItem(const std::string &key, int sample = -1) const override { return m_grid->metadataItem(key, sample); } void insertGrid(PJ_CONTEXT *ctx, std::unique_ptr &&subgrid); void reassign_context(PJ_CONTEXT *ctx) override { m_grid->reassign_context(ctx); } bool hasChanged() const override { return m_grid->hasChanged(); } }; // --------------------------------------------------------------------------- GTiffGenericGridShiftSet::~GTiffGenericGridShiftSet() = default; // --------------------------------------------------------------------------- GTiffGenericGrid::GTiffGenericGrid(std::unique_ptr &&grid) : GenericShiftGrid(grid->name(), grid->width(), grid->height(), grid->extentAndRes()), m_grid(std::move(grid)) {} // --------------------------------------------------------------------------- GTiffGenericGrid::~GTiffGenericGrid() = default; // --------------------------------------------------------------------------- bool GTiffGenericGrid::valueAt(int x, int y, int sample, float &out) const { if (sample < 0 || static_cast(sample) >= m_grid->samplesPerPixel()) return false; return m_grid->valueAt(static_cast(sample), x, y, out); } // --------------------------------------------------------------------------- void GTiffGenericGrid::insertGrid(PJ_CONTEXT *ctx, std::unique_ptr &&subgrid) { bool gridInserted = false; const auto &extent = subgrid->extentAndRes(); for (const auto &candidateParent : m_children) { const auto &candidateParentExtent = candidateParent->extentAndRes(); if (candidateParentExtent.contains(extent)) { static_cast(candidateParent.get()) ->insertGrid(ctx, std::move(subgrid)); gridInserted = true; break; } else if (candidateParentExtent.intersects(extent)) { pj_log(ctx, PJ_LOG_DEBUG, "Partially intersecting grids found!"); } } if (!gridInserted) { m_children.emplace_back(std::move(subgrid)); } } #endif // TIFF_ENABLED // --------------------------------------------------------------------------- class NullGenericShiftGrid : public GenericShiftGrid { public: NullGenericShiftGrid() : GenericShiftGrid("null", 3, 3, globalExtent()) {} bool isNullGrid() const override { return true; } bool valueAt(int, int, int, float &out) const override; int samplesPerPixel() const override { return 0; } std::string unit(int) const override { return std::string(); } std::string description(int) const override { return std::string(); } std::string metadataItem(const std::string &, int) const override { return std::string(); } void reassign_context(PJ_CONTEXT *) override {} bool hasChanged() const override { return false; } }; // --------------------------------------------------------------------------- bool NullGenericShiftGrid::valueAt(int, int, int, float &out) const { out = 0.0f; return true; } // --------------------------------------------------------------------------- #ifdef TIFF_ENABLED std::unique_ptr GTiffGenericGridShiftSet::open(PJ_CONTEXT *ctx, std::unique_ptr fp, const std::string &filename) { auto set = std::unique_ptr( new GTiffGenericGridShiftSet(ctx, std::move(fp))); set->m_name = filename; set->m_format = "gtiff"; if (!set->m_GTiffDataset->openTIFF(filename)) { return nullptr; } std::map mapGrids; for (int ifd = 0;; ++ifd) { auto grid = set->m_GTiffDataset->nextGrid(); if (!grid) { if (ifd == 0) { return nullptr; } break; } const auto subfileType = grid->subfileType(); if (subfileType != 0 && subfileType != FILETYPE_PAGE) { if (ifd == 0) { pj_log(ctx, PJ_LOG_ERROR, _("Invalid subfileType")); return nullptr; } else { pj_log(ctx, PJ_LOG_DEBUG, _("Ignoring IFD %d as it has a unsupported subfileType"), ifd); continue; } } const std::string gridName = grid->metadataItem("grid_name"); const std::string parentName = grid->metadataItem("parent_grid_name"); auto hgrid = internal::make_unique(std::move(grid)); insertIntoHierarchy(ctx, std::move(hgrid), gridName, parentName, set->m_grids, mapGrids); } return set; } #endif // TIFF_ENABLED // --------------------------------------------------------------------------- GenericShiftGrid::GenericShiftGrid(const std::string &nameIn, int widthIn, int heightIn, const ExtentAndRes &extentIn) : Grid(nameIn, widthIn, heightIn, extentIn) {} // --------------------------------------------------------------------------- GenericShiftGrid::~GenericShiftGrid() = default; // --------------------------------------------------------------------------- GenericShiftGridSet::GenericShiftGridSet() = default; // --------------------------------------------------------------------------- GenericShiftGridSet::~GenericShiftGridSet() = default; // --------------------------------------------------------------------------- std::unique_ptr GenericShiftGridSet::open(PJ_CONTEXT *ctx, const std::string &filename) { if (filename == "null") { auto set = std::unique_ptr(new GenericShiftGridSet()); set->m_name = filename; set->m_format = "null"; set->m_grids.push_back( std::unique_ptr(new NullGenericShiftGrid())); return set; } auto fp = FileManager::open_resource_file(ctx, filename.c_str()); if (!fp) { return nullptr; } const auto actualName(fp->name()); /* -------------------------------------------------------------------- */ /* Load a header, to determine the file type. */ /* -------------------------------------------------------------------- */ unsigned char header[4]; size_t header_size = fp->read(header, sizeof(header)); if (header_size != sizeof(header)) { return nullptr; } fp->seek(0); if (IsTIFF(header_size, header)) { #ifdef TIFF_ENABLED auto set = std::unique_ptr( GTiffGenericGridShiftSet::open(ctx, std::move(fp), actualName)); if (!set) proj_context_errno_set( ctx, PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID); return set; #else pj_log(ctx, PJ_LOG_ERROR, _("TIFF grid, but TIFF support disabled in this build")); return nullptr; #endif } pj_log(ctx, PJ_LOG_ERROR, "Unrecognized generic grid format for filename '%s'", filename.c_str()); return nullptr; } // --------------------------------------------------------------------------- bool GenericShiftGridSet::reopen(PJ_CONTEXT *ctx) { pj_log(ctx, PJ_LOG_DEBUG, "Grid %s has changed. Re-loading it", m_name.c_str()); auto newGS = open(ctx, m_name); m_grids.clear(); if (newGS) { m_grids = std::move(newGS->m_grids); } return !m_grids.empty(); } // --------------------------------------------------------------------------- const GenericShiftGrid *GenericShiftGrid::gridAt(double x, double y) const { for (const auto &child : m_children) { const auto &extentChild = child->extentAndRes(); if (isPointInExtent(x, y, extentChild)) { return child->gridAt(x, y); } } return this; } // --------------------------------------------------------------------------- const GenericShiftGrid *GenericShiftGridSet::gridAt(double x, double y) const { for (const auto &grid : m_grids) { if (grid->isNullGrid()) { return grid.get(); } const auto &extent = grid->extentAndRes(); if (isPointInExtent(x, y, extent)) { return grid->gridAt(x, y); } } return nullptr; } // --------------------------------------------------------------------------- void GenericShiftGridSet::reassign_context(PJ_CONTEXT *ctx) { for (const auto &grid : m_grids) { grid->reassign_context(ctx); } } // --------------------------------------------------------------------------- ListOfGenericGrids pj_generic_grid_init(PJ *P, const char *gridkey) { std::string key("s"); key += gridkey; const char *gridnames = pj_param(P->ctx, P->params, key.c_str()).s; if (gridnames == nullptr) return {}; auto listOfGridNames = internal::split(std::string(gridnames), ','); ListOfGenericGrids grids; for (const auto &gridnameStr : listOfGridNames) { const char *gridname = gridnameStr.c_str(); bool canFail = false; if (gridname[0] == '@') { canFail = true; gridname++; } auto gridSet = GenericShiftGridSet::open(P->ctx, gridname); if (!gridSet) { if (!canFail) { if (proj_context_errno(P->ctx) != PROJ_ERR_OTHER_NETWORK_ERROR) { proj_context_errno_set( P->ctx, PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID); } return {}; } proj_context_errno_set(P->ctx, 0); // don't treat as a persistent error } else { grids.emplace_back(std::move(gridSet)); } } return grids; } // --------------------------------------------------------------------------- static const HorizontalShiftGrid * findGrid(const ListOfHGrids &grids, const PJ_LP &input, HorizontalShiftGridSet *&gridSetOut) { for (const auto &gridset : grids) { auto grid = gridset->gridAt(input.lam, input.phi); if (grid) { gridSetOut = gridset.get(); return grid; } } return nullptr; } // --------------------------------------------------------------------------- static ListOfHGrids getListOfGridSets(PJ_CONTEXT *ctx, const char *grids) { ListOfHGrids list; auto listOfGrids = internal::split(std::string(grids), ','); for (const auto &grid : listOfGrids) { const char *gridname = grid.c_str(); bool canFail = false; if (gridname[0] == '@') { canFail = true; gridname++; } auto gridSet = HorizontalShiftGridSet::open(ctx, gridname); if (!gridSet) { if (!canFail) { if (proj_context_errno(ctx) != PROJ_ERR_OTHER_NETWORK_ERROR) { proj_context_errno_set( ctx, PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID); } return {}; } proj_context_errno_set(ctx, 0); // don't treat as a persistent error } else { list.emplace_back(std::move(gridSet)); } } return list; } /**********************************************/ ListOfHGrids pj_hgrid_init(PJ *P, const char *gridkey) { /********************************************** Initizalize and populate list of horizontal grids. Takes a PJ-object and the plus-parameter name that is used in the proj-string to specify the grids to load, e.g. "+grids". The + should be left out here. Returns the number of loaded grids. ***********************************************/ std::string key("s"); key += gridkey; const char *grids = pj_param(P->ctx, P->params, key.c_str()).s; if (grids == nullptr) return {}; return getListOfGridSets(P->ctx, grids); } // --------------------------------------------------------------------------- typedef struct { pj_int32 lam, phi; } ILP; // Apply bilinear interpolation for horizontal shift grids static PJ_LP pj_hgrid_interpolate(PJ_LP t, const HorizontalShiftGrid *grid, bool compensateNTConvention) { PJ_LP val, frct; ILP indx; int in; const auto &extent = grid->extentAndRes(); t.lam /= extent.resX; indx.lam = std::isnan(t.lam) ? 0 : (pj_int32)lround(floor(t.lam)); t.phi /= extent.resY; indx.phi = std::isnan(t.phi) ? 0 : (pj_int32)lround(floor(t.phi)); frct.lam = t.lam - indx.lam; frct.phi = t.phi - indx.phi; val.lam = val.phi = HUGE_VAL; if (indx.lam < 0) { if (indx.lam == -1 && frct.lam > 1 - 10 * REL_TOLERANCE_HGRIDSHIFT) { ++indx.lam; frct.lam = 0.; } else return val; } else if ((in = indx.lam + 1) >= grid->width()) { if (in == grid->width() && frct.lam < 10 * REL_TOLERANCE_HGRIDSHIFT) { --indx.lam; frct.lam = 1.; } else return val; } if (indx.phi < 0) { if (indx.phi == -1 && frct.phi > 1 - 10 * REL_TOLERANCE_HGRIDSHIFT) { ++indx.phi; frct.phi = 0.; } else return val; } else if ((in = indx.phi + 1) >= grid->height()) { if (in == grid->height() && frct.phi < 10 * REL_TOLERANCE_HGRIDSHIFT) { --indx.phi; frct.phi = 1.; } else return val; } float f00Lon = 0, f00Lat = 0; float f10Lon = 0, f10Lat = 0; float f01Lon = 0, f01Lat = 0; float f11Lon = 0, f11Lat = 0; if (!grid->valueAt(indx.lam, indx.phi, compensateNTConvention, f00Lon, f00Lat) || !grid->valueAt(indx.lam + 1, indx.phi, compensateNTConvention, f10Lon, f10Lat) || !grid->valueAt(indx.lam, indx.phi + 1, compensateNTConvention, f01Lon, f01Lat) || !grid->valueAt(indx.lam + 1, indx.phi + 1, compensateNTConvention, f11Lon, f11Lat)) { return val; } double m10 = frct.lam; double m11 = m10; double m01 = 1. - frct.lam; double m00 = m01; m11 *= frct.phi; m01 *= frct.phi; frct.phi = 1. - frct.phi; m00 *= frct.phi; m10 *= frct.phi; val.lam = m00 * f00Lon + m10 * f10Lon + m01 * f01Lon + m11 * f11Lon; val.phi = m00 * f00Lat + m10 * f10Lat + m01 * f01Lat + m11 * f11Lat; return val; } // --------------------------------------------------------------------------- #define MAX_ITERATIONS 10 #define TOL 1e-12 static PJ_LP pj_hgrid_apply_internal(PJ_CONTEXT *ctx, PJ_LP in, PJ_DIRECTION direction, const HorizontalShiftGrid *grid, HorizontalShiftGridSet *gridset, const ListOfHGrids &grids, bool &shouldRetry) { PJ_LP t, tb, del, dif; int i = MAX_ITERATIONS; const double toltol = TOL * TOL; shouldRetry = false; if (in.lam == HUGE_VAL) return in; /* normalize input to ll origin */ tb = in; const auto *extent = &(grid->extentAndRes()); const double epsilon = (extent->resX + extent->resY) * REL_TOLERANCE_HGRIDSHIFT; tb.lam -= extent->west; if (tb.lam + epsilon < 0) tb.lam += 2 * M_PI; else if (tb.lam - epsilon > extent->east - extent->west) tb.lam -= 2 * M_PI; tb.phi -= extent->south; t = pj_hgrid_interpolate(tb, grid, true); if (grid->hasChanged()) { shouldRetry = gridset->reopen(ctx); return t; } if (t.lam == HUGE_VAL) return t; if (direction == PJ_FWD) { in.lam += t.lam; in.phi += t.phi; return in; } t.lam = tb.lam - t.lam; t.phi = tb.phi - t.phi; do { del = pj_hgrid_interpolate(t, grid, true); if (grid->hasChanged()) { shouldRetry = gridset->reopen(ctx); return t; } /* We can possibly go outside of the initial guessed grid, so try */ /* to fetch a new grid into which iterate... */ if (del.lam == HUGE_VAL) { PJ_LP lp; lp.lam = t.lam + extent->west; lp.phi = t.phi + extent->south; auto newGrid = findGrid(grids, lp, gridset); if (newGrid == nullptr || newGrid == grid || newGrid->isNullGrid()) break; pj_log(ctx, PJ_LOG_TRACE, "Switching from grid %s to grid %s", grid->name().c_str(), newGrid->name().c_str()); grid = newGrid; extent = &(grid->extentAndRes()); t.lam = lp.lam - extent->west; t.phi = lp.phi - extent->south; tb = in; tb.lam -= extent->west; if (tb.lam + epsilon < 0) tb.lam += 2 * M_PI; else if (tb.lam - epsilon > extent->east - extent->west) tb.lam -= 2 * M_PI; tb.phi -= extent->south; dif.lam = std::numeric_limits::max(); dif.phi = std::numeric_limits::max(); continue; } dif.lam = t.lam + del.lam - tb.lam; dif.phi = t.phi + del.phi - tb.phi; t.lam -= dif.lam; t.phi -= dif.phi; } while (--i && (dif.lam * dif.lam + dif.phi * dif.phi > toltol)); /* prob. slightly faster than hypot() */ if (i == 0) { /* If we had access to a context, this should go through pj_log, and we * should set ctx->errno */ if (getenv("PROJ_DEBUG")) fprintf(stderr, "Inverse grid shift iterator failed to converge.\n"); t.lam = t.phi = HUGE_VAL; return t; } /* and again: pj_log and ctx->errno */ if (del.lam == HUGE_VAL && getenv("PROJ_DEBUG")) fprintf(stderr, "Inverse grid shift iteration failed, presumably at " "grid edge.\nUsing first approximation.\n"); in.lam = adjlon(t.lam + extent->west); in.phi = t.phi + extent->south; return in; } // --------------------------------------------------------------------------- PJ_LP pj_hgrid_apply(PJ_CONTEXT *ctx, const ListOfHGrids &grids, PJ_LP lp, PJ_DIRECTION direction) { PJ_LP out; out.lam = HUGE_VAL; out.phi = HUGE_VAL; while (true) { HorizontalShiftGridSet *gridset = nullptr; const auto grid = findGrid(grids, lp, gridset); if (!grid) { proj_context_errno_set(ctx, PROJ_ERR_COORD_TRANSFM_OUTSIDE_GRID); return out; } if (grid->isNullGrid()) { return lp; } bool shouldRetry = false; out = pj_hgrid_apply_internal(ctx, lp, direction, grid, gridset, grids, shouldRetry); if (!shouldRetry) { break; } } if (out.lam == HUGE_VAL || out.phi == HUGE_VAL) proj_context_errno_set(ctx, PROJ_ERR_COORD_TRANSFM_OUTSIDE_GRID); return out; } /********************************************/ /* proj_hgrid_value() */ /* */ /* Return coordinate offset in grid */ /********************************************/ PJ_LP pj_hgrid_value(PJ *P, const ListOfHGrids &grids, PJ_LP lp) { PJ_LP out = proj_coord_error().lp; HorizontalShiftGridSet *gridset = nullptr; const auto grid = findGrid(grids, lp, gridset); if (!grid) { proj_context_errno_set(P->ctx, PROJ_ERR_COORD_TRANSFM_OUTSIDE_GRID); return out; } /* normalize input to ll origin */ const auto &extent = grid->extentAndRes(); if (!extent.isGeographic) { pj_log(P->ctx, PJ_LOG_ERROR, _("Can only handle grids referenced in a geographic CRS")); proj_context_errno_set(P->ctx, PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID); return out; } const double epsilon = (extent.resX + extent.resY) * REL_TOLERANCE_HGRIDSHIFT; lp.lam -= extent.west; if (lp.lam + epsilon < 0) lp.lam += 2 * M_PI; else if (lp.lam - epsilon > extent.east - extent.west) lp.lam -= 2 * M_PI; lp.phi -= extent.south; out = pj_hgrid_interpolate(lp, grid, false); if (grid->hasChanged()) { if (gridset->reopen(P->ctx)) { return pj_hgrid_value(P, grids, lp); } out.lam = HUGE_VAL; out.phi = HUGE_VAL; } if (out.lam == HUGE_VAL || out.phi == HUGE_VAL) { proj_context_errno_set(P->ctx, PROJ_ERR_COORD_TRANSFM_OUTSIDE_GRID); } return out; } // --------------------------------------------------------------------------- static double read_vgrid_value(PJ_CONTEXT *ctx, const ListOfVGrids &grids, const PJ_LP &input, const double vmultiplier) { /* do not deal with NaN coordinates */ /* cppcheck-suppress duplicateExpression */ if (std::isnan(input.phi) || std::isnan(input.lam)) { return HUGE_VAL; } VerticalShiftGridSet *curGridset = nullptr; const VerticalShiftGrid *grid = nullptr; for (const auto &gridset : grids) { grid = gridset->gridAt(input.lam, input.phi); if (grid) { curGridset = gridset.get(); break; } } if (!grid) { proj_context_errno_set(ctx, PROJ_ERR_COORD_TRANSFM_OUTSIDE_GRID); return HUGE_VAL; } if (grid->isNullGrid()) { return 0; } const auto &extent = grid->extentAndRes(); if (!extent.isGeographic) { pj_log(ctx, PJ_LOG_ERROR, _("Can only handle grids referenced in a geographic CRS")); proj_context_errno_set(ctx, PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID); return HUGE_VAL; } /* Interpolation of a location within the grid */ double grid_x = (input.lam - extent.west) * extent.invResX; if (input.lam < extent.west) { if (extent.fullWorldLongitude()) { // The first fmod goes to ]-lim, lim[ range // So we add lim again to be in ]0, 2*lim[ and fmod again grid_x = fmod(fmod(grid_x + grid->width(), grid->width()) + grid->width(), grid->width()); } else { grid_x = (input.lam + 2 * M_PI - extent.west) * extent.invResX; } } else if (input.lam > extent.east) { if (extent.fullWorldLongitude()) { // The first fmod goes to ]-lim, lim[ range // So we add lim again to be in ]0, 2*lim[ and fmod again grid_x = fmod(fmod(grid_x + grid->width(), grid->width()) + grid->width(), grid->width()); } else { grid_x = (input.lam - 2 * M_PI - extent.west) * extent.invResX; } } double grid_y = (input.phi - extent.south) * extent.invResY; int grid_ix = static_cast(lround(floor(grid_x))); if (!(grid_ix >= 0 && grid_ix < grid->width())) { // in the unlikely case we end up here... pj_log(ctx, PJ_LOG_ERROR, _("grid_ix not in grid")); proj_context_errno_set(ctx, PROJ_ERR_COORD_TRANSFM_OUTSIDE_GRID); return HUGE_VAL; } int grid_iy = static_cast(lround(floor(grid_y))); assert(grid_iy >= 0 && grid_iy < grid->height()); grid_x -= grid_ix; grid_y -= grid_iy; int grid_ix2 = grid_ix + 1; if (grid_ix2 >= grid->width()) { if (extent.fullWorldLongitude()) { grid_ix2 = 0; } else { grid_ix2 = grid->width() - 1; } } int grid_iy2 = grid_iy + 1; if (grid_iy2 >= grid->height()) grid_iy2 = grid->height() - 1; float value_a = 0; float value_b = 0; float value_c = 0; float value_d = 0; bool error = (!grid->valueAt(grid_ix, grid_iy, value_a) || !grid->valueAt(grid_ix2, grid_iy, value_b) || !grid->valueAt(grid_ix, grid_iy2, value_c) || !grid->valueAt(grid_ix2, grid_iy2, value_d)); if (grid->hasChanged()) { if (curGridset->reopen(ctx)) { return read_vgrid_value(ctx, grids, input, vmultiplier); } error = true; } if (error) { return HUGE_VAL; } double value = 0.0; const double grid_x_y = grid_x * grid_y; const bool a_valid = !grid->isNodata(value_a, vmultiplier); const bool b_valid = !grid->isNodata(value_b, vmultiplier); const bool c_valid = !grid->isNodata(value_c, vmultiplier); const bool d_valid = !grid->isNodata(value_d, vmultiplier); const int countValid = static_cast(a_valid) + static_cast(b_valid) + static_cast(c_valid) + static_cast(d_valid); if (countValid == 4) { { double weight = 1.0 - grid_x - grid_y + grid_x_y; value = value_a * weight; } { double weight = grid_x - grid_x_y; value += value_b * weight; } { double weight = grid_y - grid_x_y; value += value_c * weight; } { double weight = grid_x_y; value += value_d * weight; } } else if (countValid == 0) { proj_context_errno_set(ctx, PROJ_ERR_COORD_TRANSFM_GRID_AT_NODATA); value = HUGE_VAL; } else { double total_weight = 0.0; if (a_valid) { double weight = 1.0 - grid_x - grid_y + grid_x_y; value = value_a * weight; total_weight = weight; } if (b_valid) { double weight = grid_x - grid_x_y; value += value_b * weight; total_weight += weight; } if (c_valid) { double weight = grid_y - grid_x_y; value += value_c * weight; total_weight += weight; } if (d_valid) { double weight = grid_x_y; value += value_d * weight; total_weight += weight; } value /= total_weight; } return value * vmultiplier; } /**********************************************/ ListOfVGrids pj_vgrid_init(PJ *P, const char *gridkey) { /********************************************** Initizalize and populate gridlist. Takes a PJ-object and the plus-parameter name that is used in the proj-string to specify the grids to load, e.g. "+grids". The + should be left out here. Returns the number of loaded grids. ***********************************************/ std::string key("s"); key += gridkey; const char *gridnames = pj_param(P->ctx, P->params, key.c_str()).s; if (gridnames == nullptr) return {}; auto listOfGridNames = internal::split(std::string(gridnames), ','); ListOfVGrids grids; for (const auto &gridnameStr : listOfGridNames) { const char *gridname = gridnameStr.c_str(); bool canFail = false; if (gridname[0] == '@') { canFail = true; gridname++; } auto gridSet = VerticalShiftGridSet::open(P->ctx, gridname); if (!gridSet) { if (!canFail) { if (proj_context_errno(P->ctx) != PROJ_ERR_OTHER_NETWORK_ERROR) { proj_context_errno_set( P->ctx, PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID); } return {}; } proj_context_errno_set(P->ctx, 0); // don't treat as a persistent error } else { grids.emplace_back(std::move(gridSet)); } } return grids; } /***********************************************/ double pj_vgrid_value(PJ *P, const ListOfVGrids &grids, PJ_LP lp, double vmultiplier) { /*********************************************** Read grid value at position lp in grids loaded with proj_grid_init. Returns the grid value of the given coordinate. ************************************************/ double value; value = read_vgrid_value(P->ctx, grids, lp, vmultiplier); if (pj_log_active(P->ctx, PJ_LOG_TRACE)) { proj_log_trace(P, "proj_vgrid_value: (%f, %f) = %f", lp.lam * RAD_TO_DEG, lp.phi * RAD_TO_DEG, value); } return value; } // --------------------------------------------------------------------------- const GenericShiftGrid *pj_find_generic_grid(const ListOfGenericGrids &grids, const PJ_LP &input, GenericShiftGridSet *&gridSetOut) { for (const auto &gridset : grids) { auto grid = gridset->gridAt(input.lam, input.phi); if (grid) { gridSetOut = gridset.get(); return grid; } } return nullptr; } // --------------------------------------------------------------------------- // Used by +proj=deformation and +proj=xyzgridshift to do bilinear interpolation // on 3 sample values per node. bool pj_bilinear_interpolation_three_samples( PJ_CONTEXT *ctx, const GenericShiftGrid *grid, const PJ_LP &lp, int idx1, int idx2, int idx3, double &v1, double &v2, double &v3, bool &must_retry) { must_retry = false; if (grid->isNullGrid()) { v1 = 0.0; v2 = 0.0; v3 = 0.0; return true; } const auto &extent = grid->extentAndRes(); if (!extent.isGeographic) { pj_log(ctx, PJ_LOG_ERROR, "Can only handle grids referenced in a geographic CRS"); proj_context_errno_set(ctx, PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID); return false; } // From a input location lp, determine the grid cell into which it falls, // by identifying the lower-left x,y of it (ix, iy), and the upper-right // (ix2, iy2) double grid_x = (lp.lam - extent.west) * extent.invResX; // Special case for grids with world extent, and dealing with wrap-around if (lp.lam < extent.west) { grid_x = (lp.lam + 2 * M_PI - extent.west) * extent.invResX; } else if (lp.lam > extent.east) { grid_x = (lp.lam - 2 * M_PI - extent.west) * extent.invResX; } double grid_y = (lp.phi - extent.south) * extent.invResY; int ix = static_cast(grid_x); int iy = static_cast(grid_y); int ix2 = std::min(ix + 1, grid->width() - 1); int iy2 = std::min(iy + 1, grid->height() - 1); float dx1 = 0.0f, dy1 = 0.0f, dz1 = 0.0f; float dx2 = 0.0f, dy2 = 0.0f, dz2 = 0.0f; float dx3 = 0.0f, dy3 = 0.0f, dz3 = 0.0f; float dx4 = 0.0f, dy4 = 0.0f, dz4 = 0.0f; bool error = (!grid->valueAt(ix, iy, idx1, dx1) || !grid->valueAt(ix, iy, idx2, dy1) || !grid->valueAt(ix, iy, idx3, dz1) || !grid->valueAt(ix2, iy, idx1, dx2) || !grid->valueAt(ix2, iy, idx2, dy2) || !grid->valueAt(ix2, iy, idx3, dz2) || !grid->valueAt(ix, iy2, idx1, dx3) || !grid->valueAt(ix, iy2, idx2, dy3) || !grid->valueAt(ix, iy2, idx3, dz3) || !grid->valueAt(ix2, iy2, idx1, dx4) || !grid->valueAt(ix2, iy2, idx2, dy4) || !grid->valueAt(ix2, iy2, idx3, dz4)); if (grid->hasChanged()) { must_retry = true; return false; } if (error) { return false; } // Bilinear interpolation double frct_lam = grid_x - ix; double frct_phi = grid_y - iy; double m10 = frct_lam; double m11 = m10; double m01 = 1. - frct_lam; double m00 = m01; m11 *= frct_phi; m01 *= frct_phi; frct_phi = 1. - frct_phi; m00 *= frct_phi; m10 *= frct_phi; v1 = m00 * dx1 + m10 * dx2 + m01 * dx3 + m11 * dx4; v2 = m00 * dy1 + m10 * dy2 + m01 * dy3 + m11 * dy4; v3 = m00 * dz1 + m10 * dz2 + m01 * dz3 + m11 * dz4; return true; } NS_PROJ_END proj-8.2.1/src/pr_list.cpp000644 000765 000024 00000005114 14017154140 016103 0ustar00keversstaff000000 000000 /* print projection's list of parameters */ #include #include #include #include "proj.h" #include "proj_internal.h" #define LINE_LEN 72 static int pr_list(PJ *P, int not_used) { paralist *t; int l, n = 1, flag = 0; (void)putchar('#'); for (t = P->params; t; t = t->next) if ((!not_used && t->used) || (not_used && !t->used)) { l = (int)strlen(t->param) + 1; if (n + l > LINE_LEN) { (void)fputs("\n#", stdout); n = 2; } (void)putchar(' '); if (*(t->param) != '+') (void)putchar('+'); (void)fputs(t->param, stdout); n += l; } else flag = 1; if (n > 1) (void)putchar('\n'); return flag; } void /* print link list of projection parameters */ pj_pr_list(PJ *P) { char const *s; (void)putchar('#'); for (s = P->descr; *s ; ++s) { (void)putchar(*s); if (*s == '\n') (void)putchar('#'); } (void)putchar('\n'); if (pr_list(P, 0)) { (void)fputs("#--- following specified but NOT used\n", stdout); (void)pr_list(P, 1); } } /************************************************************************/ /* pj_get_def() */ /* */ /* Returns the PROJ.4 command string that would produce this */ /* definition expanded as much as possible. For instance, */ /* +init= calls and +datum= definitions would be expanded. */ /************************************************************************/ char *pj_get_def( PJ *P, int options ) { paralist *t; int l; char *definition; size_t def_max = 10; (void) options; definition = (char *) malloc(def_max); if (!definition) return nullptr; definition[0] = '\0'; for (t = P->params; t; t = t->next) { /* skip unused parameters ... mostly appended defaults and stuff */ if (!t->used) continue; /* grow the resulting string if needed */ l = (int)strlen(t->param) + 1; if( strlen(definition) + l + 5 > def_max ) { char *def2; def_max = def_max * 2 + l + 5; def2 = (char *) malloc(def_max); if (def2) { strcpy( def2, definition ); free( definition ); definition = def2; } else { free( definition ); return nullptr; } } /* append this parameter */ strcat( definition, " +" ); strcat( definition, t->param ); } return definition; } proj-8.2.1/src/proj_mdist.cpp000644 000765 000024 00000006637 14017154140 016614 0ustar00keversstaff000000 000000 /* ** libproj -- library of cartographic projections ** ** Copyright (c) 2003, 2006 Gerald I. Evenden */ /* ** Permission is hereby granted, free of charge, to any person obtaining ** a copy of this software and associated documentation files (the ** "Software"), to deal in the Software without restriction, including ** without limitation the rights to use, copy, modify, merge, publish, ** distribute, sublicense, and/or sell copies of the Software, and to ** permit persons to whom the Software is furnished to do so, subject to ** the following conditions: ** ** The above copyright notice and this permission notice shall be ** included in all copies or substantial portions of the Software. ** ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* Computes distance from equator along the meridian to latitude phi ** and inverse on unit ellipsoid. ** Precision commensurate with double precision. */ #define PJ_LIB__ #include #include #include "proj.h" #include "proj_internal.h" #define MAX_ITER 20 #define TOL 1e-14 namespace { // anonymous namespace struct MDIST { int nb; double es; double E; double b[1]; }; } // anonymous namespace void * proj_mdist_ini(double es) { double numf, numfi, twon1, denf, denfi, ens, T, twon; double den, El = 1., Es = 1.; double E[MAX_ITER] = { 1. }; struct MDIST *b; int i, j; /* generate E(e^2) and its terms E[] */ ens = es; numf = twon1 = denfi = 1.; denf = 1.; twon = 4.; for (i = 1; i < MAX_ITER ; ++i) { numf *= (twon1 * twon1); den = twon * denf * denf * twon1; T = numf/den; Es -= (E[i] = T * ens); ens *= es; twon *= 4.; denf *= ++denfi; twon1 += 2.; if (Es == El) /* jump out if no change */ break; El = Es; } if ((b = (struct MDIST *)malloc(sizeof(struct MDIST)+ (i*sizeof(double)))) == nullptr) return(nullptr); b->nb = i - 1; b->es = es; b->E = Es; /* generate b_n coefficients--note: collapse with prefix ratios */ b->b[0] = Es = 1. - Es; numf = denf = 1.; numfi = 2.; denfi = 3.; for (j = 1; j < i; ++j) { Es -= E[j]; numf *= numfi; denf *= denfi; b->b[j] = Es * numf / denf; numfi += 2.; denfi += 2.; } return (b); } double proj_mdist(double phi, double sphi, double cphi, const void *data) { const struct MDIST *b = (const struct MDIST *)data; double sc, sum, sphi2, D; int i; sc = sphi * cphi; sphi2 = sphi * sphi; D = phi * b->E - b->es * sc / sqrt(1. - b->es * sphi2); sum = b->b[i = b->nb]; while (i) sum = b->b[--i] + sphi2 * sum; return(D + sc * sum); } double proj_inv_mdist(PJ_CONTEXT *ctx, double dist, const void *data) { const struct MDIST *b = (const struct MDIST *)data; double s, t, phi, k; int i; k = 1./(1.- b->es); i = MAX_ITER; phi = dist; while ( i-- ) { s = sin(phi); t = 1. - b->es * s * s; phi -= t = (proj_mdist(phi, s, cos(phi), b) - dist) * (t * sqrt(t)) * k; if (fabs(t) < TOL) /* that is no change */ return phi; } /* convergence failed */ proj_context_errno_set(ctx, PROJ_ERR_COORD_TRANSFM_OUTSIDE_PROJECTION_DOMAIN); return phi; } proj-8.2.1/src/tests/000755 000765 000024 00000000000 14164067215 015075 5ustar00keversstaff000000 000000 proj-8.2.1/src/proj.h000644 000765 000024 00000174104 14164067106 015064 0ustar00keversstaff000000 000000 /****************************************************************************** * Project: PROJ.4 * Purpose: Revised, experimental API for PROJ.4, intended as the foundation * for added geodetic functionality. * * The original proj API (defined previously in projects.h) has grown * organically over the years, but it has also grown somewhat messy. * * The same has happened with the newer high level API (defined in * proj_api.h): To support various historical objectives, proj_api.h * contains a rather complex combination of conditional defines and * typedefs. Probably for good (historical) reasons, which are not * always evident from today's perspective. * * This is an evolving attempt at creating a re-rationalized API * with primary design goals focused on sanitizing the namespaces. * Hence, all symbols exposed are being moved to the proj_ namespace, * while all data types are being moved to the PJ_ namespace. * * Please note that this API is *orthogonal* to the previous APIs: * Apart from some inclusion guards, projects.h and proj_api.h are not * touched - if you do not include proj.h, the projects and proj_api * APIs should work as they always have. * * A few implementation details: * * Apart from the namespacing efforts, I'm trying to eliminate three * proj_api elements, which I have found especially confusing. * * FIRST and foremost, I try to avoid typedef'ing away pointer * semantics. I agree that it can be occasionally useful, but I * prefer having the pointer nature of function arguments being * explicitly visible. * * Hence, projCtx has been replaced by PJ_CONTEXT *. * and projPJ has been replaced by PJ * * * SECOND, I try to eliminate cases of information hiding implemented * by redefining data types to void pointers. * * I prefer using a combination of forward declarations and typedefs. * Hence: * typedef void *projCtx; * Has been replaced by: * struct projCtx_t; * typedef struct projCtx_t PJ_CONTEXT; * This makes it possible for the calling program to know that the * PJ_CONTEXT data type exists, and handle pointers to that data type * without having any idea about its internals. * * (obviously, in this example, struct projCtx_t should also be * renamed struct pj_ctx some day, but for backwards compatibility * it remains as-is for now). * * THIRD, I try to eliminate implicit type punning. Hence this API * introduces the PJ_COORD union data type, for generic 4D coordinate * handling. * * PJ_COORD makes it possible to make explicit the previously used * "implicit type punning", where a XY is turned into a LP by * re#defining both as UV, behind the back of the user. * * The PJ_COORD union is used for storing 1D, 2D, 3D and 4D coordinates. * * The bare essentials API presented here follows the PROJ.4 * convention of sailing the coordinate to be reprojected, up on * the stack ("call by value"), and symmetrically returning the * result on the stack. Although the PJ_COORD object is twice as large * as the traditional XY and LP objects, timing results have shown the * overhead to be very reasonable. * * Contexts and thread safety * -------------------------- * * After a year of experiments (and previous experience from the * trlib transformation library) it has become clear that the * context subsystem is unavoidable in a multi-threaded world. * Hence, instead of hiding it away, we move it into the limelight, * highly recommending (but not formally requiring) the bracketing * of any code block calling PROJ.4 functions with calls to * proj_context_create(...)/proj_context_destroy() * * Legacy single threaded code need not do anything, but *may* * implement a bit of future compatibility by using the backward * compatible call proj_context_create(0), which will not create * a new context, but simply provide a pointer to the default one. * * See proj_4D_api_test.c for examples of how to use the API. * * Author: Thomas Knudsen, * Benefitting from a large number of comments and suggestions * by (primarily) Kristian Evers and Even Rouault. * ****************************************************************************** * Copyright (c) 2016, 2017, Thomas Knudsen / SDFE * Copyright (c) 2018, Even Rouault * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO COORD SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. *****************************************************************************/ #ifndef PROJ_H #define PROJ_H #include /* For size_t */ #ifdef ACCEPT_USE_OF_DEPRECATED_PROJ_API_H #error "The proj_api.h header has been removed from PROJ with version 8.0.0" #endif #ifdef PROJ_RENAME_SYMBOLS #include "proj_symbol_rename.h" #endif #ifdef __cplusplus extern "C" { #endif /** * \file proj.h * * C API new generation */ /*! @cond Doxygen_Suppress */ #ifndef PROJ_DLL # if defined(_MSC_VER) # ifdef PROJ_MSVC_DLL_EXPORT # define PROJ_DLL __declspec(dllexport) # else # define PROJ_DLL __declspec(dllimport) # endif # elif defined(__GNUC__) # define PROJ_DLL __attribute__ ((visibility("default"))) # else # define PROJ_DLL # endif #endif #ifdef PROJ_SUPPRESS_DEPRECATION_MESSAGE #define PROJ_DEPRECATED(decl, msg) decl #elif defined(__has_extension) #if __has_extension(attribute_deprecated_with_message) #define PROJ_DEPRECATED(decl, msg) decl __attribute__ ((deprecated(msg))) #elif defined(__GNUC__) #define PROJ_DEPRECATED(decl, msg) decl __attribute__ ((deprecated)) #else #define PROJ_DEPRECATED(decl, msg) decl #endif #elif defined(__GNUC__) #define PROJ_DEPRECATED(decl, msg) decl __attribute__ ((deprecated)) #elif defined(_MSVC_VER) #define PROJ_DEPRECATED(decl, msg) __declspec(deprecated(msg)) decl #else #define PROJ_DEPRECATED(decl, msg) decl #endif /* The version numbers should be updated with every release! **/ #define PROJ_VERSION_MAJOR 8 #define PROJ_VERSION_MINOR 2 #define PROJ_VERSION_PATCH 1 /* Note: the following 3 defines have been introduced in PROJ 8.0.1 */ /* Macro to compute a PROJ version number from its components */ #define PROJ_COMPUTE_VERSION(maj,min,patch) ((maj)*10000+(min)*100+(patch)) /* Current PROJ version from the above version numbers */ #define PROJ_VERSION_NUMBER \ PROJ_COMPUTE_VERSION(PROJ_VERSION_MAJOR, PROJ_VERSION_MINOR, PROJ_VERSION_PATCH) /* Macro that returns true if the current PROJ version is at least the version specified by (maj,min,patch) */ #define PROJ_AT_LEAST_VERSION(maj,min,patch) \ (PROJ_VERSION_NUMBER >= PROJ_COMPUTE_VERSION(maj,min,patch)) extern char const PROJ_DLL pj_release[]; /* global release id string */ /* first forward declare everything needed */ /* Data type for generic geodetic 3D data plus epoch information */ union PJ_COORD; typedef union PJ_COORD PJ_COORD; struct PJ_AREA; typedef struct PJ_AREA PJ_AREA; struct P5_FACTORS { /* Common designation */ double meridional_scale; /* h */ double parallel_scale; /* k */ double areal_scale; /* s */ double angular_distortion; /* omega */ double meridian_parallel_angle; /* theta-prime */ double meridian_convergence; /* alpha */ double tissot_semimajor; /* a */ double tissot_semiminor; /* b */ double dx_dlam, dx_dphi; double dy_dlam, dy_dphi; }; typedef struct P5_FACTORS PJ_FACTORS; /* Data type for projection/transformation information */ struct PJconsts; typedef struct PJconsts PJ; /* the PJ object herself */ /* Data type for library level information */ struct PJ_INFO; typedef struct PJ_INFO PJ_INFO; struct PJ_PROJ_INFO; typedef struct PJ_PROJ_INFO PJ_PROJ_INFO; struct PJ_GRID_INFO; typedef struct PJ_GRID_INFO PJ_GRID_INFO; struct PJ_INIT_INFO; typedef struct PJ_INIT_INFO PJ_INIT_INFO; /* Data types for list of operations, ellipsoids, datums and units used in PROJ.4 */ struct PJ_LIST { const char *id; /* projection keyword */ PJ *(*proj)(PJ *); /* projection entry point */ const char * const *descr; /* description text */ }; typedef struct PJ_LIST PJ_OPERATIONS; struct PJ_ELLPS { const char *id; /* ellipse keyword name */ const char *major; /* a= value */ const char *ell; /* elliptical parameter */ const char *name; /* comments */ }; typedef struct PJ_ELLPS PJ_ELLPS; struct PJ_UNITS { const char *id; /* units keyword */ const char *to_meter; /* multiply by value to get meters */ const char *name; /* comments */ double factor; /* to_meter factor in actual numbers */ }; typedef struct PJ_UNITS PJ_UNITS; struct PJ_PRIME_MERIDIANS { const char *id; /* prime meridian keyword */ const char *defn; /* offset from greenwich in DMS format. */ }; typedef struct PJ_PRIME_MERIDIANS PJ_PRIME_MERIDIANS; /* Geodetic, mostly spatiotemporal coordinate types */ typedef struct { double x, y, z, t; } PJ_XYZT; typedef struct { double u, v, w, t; } PJ_UVWT; typedef struct { double lam, phi, z, t; } PJ_LPZT; typedef struct { double o, p, k; } PJ_OPK; /* Rotations: omega, phi, kappa */ typedef struct { double e, n, u; } PJ_ENU; /* East, North, Up */ typedef struct { double s, a1, a2; } PJ_GEOD; /* Geodesic length, fwd azi, rev azi */ /* Classic proj.4 pair/triplet types - moved into the PJ_ name space */ typedef struct { double u, v; } PJ_UV; typedef struct { double x, y; } PJ_XY; typedef struct { double lam, phi; } PJ_LP; typedef struct { double x, y, z; } PJ_XYZ; typedef struct { double u, v, w; } PJ_UVW; typedef struct { double lam, phi, z; } PJ_LPZ; /* Avoid preprocessor renaming and implicit type-punning: Use a union to make it explicit */ union PJ_COORD { double v[4]; /* First and foremost, it really is "just 4 numbers in a vector" */ PJ_XYZT xyzt; PJ_UVWT uvwt; PJ_LPZT lpzt; PJ_GEOD geod; PJ_OPK opk; PJ_ENU enu; PJ_XYZ xyz; PJ_UVW uvw; PJ_LPZ lpz; PJ_XY xy; PJ_UV uv; PJ_LP lp; }; struct PJ_INFO { int major; /* Major release number */ int minor; /* Minor release number */ int patch; /* Patch level */ const char *release; /* Release info. Version + date */ const char *version; /* Full version number */ const char *searchpath; /* Paths where init and grid files are */ /* looked for. Paths are separated by */ /* semi-colons on Windows, and colons */ /* on non-Windows platforms. */ const char * const *paths; size_t path_count; }; struct PJ_PROJ_INFO { const char *id; /* Name of the projection in question */ const char *description; /* Description of the projection */ const char *definition; /* Projection definition */ int has_inverse; /* 1 if an inverse mapping exists, 0 otherwise */ double accuracy; /* Expected accuracy of the transformation. -1 if unknown. */ }; struct PJ_GRID_INFO { char gridname[32]; /* name of grid */ char filename[260]; /* full path to grid */ char format[8]; /* file format of grid */ PJ_LP lowerleft; /* Coordinates of lower left corner */ PJ_LP upperright; /* Coordinates of upper right corner */ int n_lon, n_lat; /* Grid size */ double cs_lon, cs_lat; /* Cell size of grid */ }; struct PJ_INIT_INFO { char name[32]; /* name of init file */ char filename[260]; /* full path to the init file. */ char version[32]; /* version of the init file */ char origin[32]; /* origin of the file, e.g. EPSG */ char lastupdate[16]; /* Date of last update in YYYY-MM-DD format */ }; typedef enum PJ_LOG_LEVEL { PJ_LOG_NONE = 0, PJ_LOG_ERROR = 1, PJ_LOG_DEBUG = 2, PJ_LOG_TRACE = 3, PJ_LOG_TELL = 4, PJ_LOG_DEBUG_MAJOR = 2, /* for proj_api.h compatibility */ PJ_LOG_DEBUG_MINOR = 3 /* for proj_api.h compatibility */ } PJ_LOG_LEVEL; typedef void (*PJ_LOG_FUNCTION)(void *, int, const char *); /* The context type - properly namespaced synonym for pj_ctx */ struct pj_ctx; typedef struct pj_ctx PJ_CONTEXT; /* A P I */ /** * The objects returned by the functions defined in this section have minimal * interaction with the functions of the * \ref iso19111_functions section, and vice versa. See its introduction * paragraph for more details. */ /* Functionality for handling thread contexts */ #ifdef __cplusplus #define PJ_DEFAULT_CTX nullptr #else #define PJ_DEFAULT_CTX 0 #endif PJ_CONTEXT PROJ_DLL *proj_context_create (void); PJ_CONTEXT PROJ_DLL *proj_context_destroy (PJ_CONTEXT *ctx); PJ_CONTEXT PROJ_DLL *proj_context_clone (PJ_CONTEXT *ctx); /** Callback to resolve a filename to a full path */ typedef const char* (*proj_file_finder) (PJ_CONTEXT *ctx, const char*, void* user_data); void PROJ_DLL proj_context_set_file_finder(PJ_CONTEXT *ctx, proj_file_finder finder, void* user_data); /*! @endcond */ void PROJ_DLL proj_context_set_search_paths(PJ_CONTEXT *ctx, int count_paths, const char* const* paths); /*! @cond Doxygen_Suppress */ void PROJ_DLL proj_context_set_ca_bundle_path(PJ_CONTEXT *ctx, const char *path); void PROJ_DLL proj_context_use_proj4_init_rules(PJ_CONTEXT *ctx, int enable); int PROJ_DLL proj_context_get_use_proj4_init_rules(PJ_CONTEXT *ctx, int from_legacy_code_path); /*! @endcond */ /** Opaque structure for PROJ for a file handle. Implementations might cast it to their * structure/class of choice. */ typedef struct PROJ_FILE_HANDLE PROJ_FILE_HANDLE; /** Open access / mode */ typedef enum PROJ_OPEN_ACCESS { /** Read-only access. Equivalent to "rb" */ PROJ_OPEN_ACCESS_READ_ONLY, /** Read-update access. File should be created if not existing. Equivalent to "r+b" */ PROJ_OPEN_ACCESS_READ_UPDATE, /** Create access. File should be truncated to 0-byte if already existing. Equivalent to "w+b" */ PROJ_OPEN_ACCESS_CREATE } PROJ_OPEN_ACCESS; /** File API callbacks */ typedef struct PROJ_FILE_API { /** Version of this structure. Should be set to 1 currently. */ int version; /** Open file. Return NULL if error */ PROJ_FILE_HANDLE* (*open_cbk)(PJ_CONTEXT *ctx, const char *filename, PROJ_OPEN_ACCESS access, void* user_data); /** Read sizeBytes into buffer from current position and return number of bytes read */ size_t (*read_cbk)(PJ_CONTEXT *ctx, PROJ_FILE_HANDLE*, void* buffer, size_t sizeBytes, void* user_data); /** Write sizeBytes into buffer from current position and return number of bytes written */ size_t (*write_cbk)(PJ_CONTEXT *ctx, PROJ_FILE_HANDLE*, const void* buffer, size_t sizeBytes, void* user_data); /** Seek to offset using whence=SEEK_SET/SEEK_CUR/SEEK_END. Return TRUE in case of success */ int (*seek_cbk)(PJ_CONTEXT *ctx, PROJ_FILE_HANDLE*, long long offset, int whence, void* user_data); /** Return current file position */ unsigned long long (*tell_cbk)(PJ_CONTEXT *ctx, PROJ_FILE_HANDLE*, void* user_data); /** Close file */ void (*close_cbk)(PJ_CONTEXT *ctx, PROJ_FILE_HANDLE*, void* user_data); /** Return TRUE if a file exists */ int (*exists_cbk)(PJ_CONTEXT *ctx, const char *filename, void* user_data); /** Return TRUE if directory exists or could be created */ int (*mkdir_cbk)(PJ_CONTEXT *ctx, const char *filename, void* user_data); /** Return TRUE if file could be removed */ int (*unlink_cbk)(PJ_CONTEXT *ctx, const char *filename, void* user_data); /** Return TRUE if file could be renamed */ int (*rename_cbk)(PJ_CONTEXT *ctx, const char *oldPath, const char *newPath, void* user_data); } PROJ_FILE_API; int PROJ_DLL proj_context_set_fileapi( PJ_CONTEXT* ctx, const PROJ_FILE_API* fileapi, void* user_data); void PROJ_DLL proj_context_set_sqlite3_vfs_name(PJ_CONTEXT* ctx, const char* name); /** Opaque structure for PROJ for a network handle. Implementations might cast it to their * structure/class of choice. */ typedef struct PROJ_NETWORK_HANDLE PROJ_NETWORK_HANDLE; /** Network access: open callback * * Should try to read the size_to_read first bytes at the specified offset of * the file given by URL url, * and write them to buffer. *out_size_read should be updated with the actual * amount of bytes read (== size_to_read if the file is larger than size_to_read). * During this read, the implementation should make sure to store the HTTP * headers from the server response to be able to respond to * proj_network_get_header_value_cbk_type callback. * * error_string_max_size should be the maximum size that can be written into * the out_error_string buffer (including terminating nul character). * * @return a non-NULL opaque handle in case of success. */ typedef PROJ_NETWORK_HANDLE* (*proj_network_open_cbk_type)( PJ_CONTEXT* ctx, const char* url, unsigned long long offset, size_t size_to_read, void* buffer, size_t* out_size_read, size_t error_string_max_size, char* out_error_string, void* user_data); /** Network access: close callback */ typedef void (*proj_network_close_cbk_type)(PJ_CONTEXT* ctx, PROJ_NETWORK_HANDLE* handle, void* user_data); /** Network access: get HTTP headers */ typedef const char* (*proj_network_get_header_value_cbk_type)( PJ_CONTEXT* ctx, PROJ_NETWORK_HANDLE* handle, const char* header_name, void* user_data); /** Network access: read range * * Read size_to_read bytes from handle, starting at offset, into * buffer. * During this read, the implementation should make sure to store the HTTP * headers from the server response to be able to respond to * proj_network_get_header_value_cbk_type callback. * * error_string_max_size should be the maximum size that can be written into * the out_error_string buffer (including terminating nul character). * * @return the number of bytes actually read (0 in case of error) */ typedef size_t (*proj_network_read_range_type)( PJ_CONTEXT* ctx, PROJ_NETWORK_HANDLE* handle, unsigned long long offset, size_t size_to_read, void* buffer, size_t error_string_max_size, char* out_error_string, void* user_data); int PROJ_DLL proj_context_set_network_callbacks( PJ_CONTEXT* ctx, proj_network_open_cbk_type open_cbk, proj_network_close_cbk_type close_cbk, proj_network_get_header_value_cbk_type get_header_value_cbk, proj_network_read_range_type read_range_cbk, void* user_data); int PROJ_DLL proj_context_set_enable_network(PJ_CONTEXT* ctx, int enabled); int PROJ_DLL proj_context_is_network_enabled(PJ_CONTEXT* ctx); void PROJ_DLL proj_context_set_url_endpoint(PJ_CONTEXT* ctx, const char* url); const char PROJ_DLL *proj_context_get_url_endpoint(PJ_CONTEXT* ctx); const char PROJ_DLL *proj_context_get_user_writable_directory(PJ_CONTEXT *ctx, int create); void PROJ_DLL proj_grid_cache_set_enable(PJ_CONTEXT* ctx, int enabled); void PROJ_DLL proj_grid_cache_set_filename(PJ_CONTEXT* ctx, const char* fullname); void PROJ_DLL proj_grid_cache_set_max_size(PJ_CONTEXT* ctx, int max_size_MB); void PROJ_DLL proj_grid_cache_set_ttl(PJ_CONTEXT* ctx, int ttl_seconds); void PROJ_DLL proj_grid_cache_clear(PJ_CONTEXT* ctx); int PROJ_DLL proj_is_download_needed(PJ_CONTEXT* ctx, const char* url_or_filename, int ignore_ttl_setting); int PROJ_DLL proj_download_file(PJ_CONTEXT *ctx, const char *url_or_filename, int ignore_ttl_setting, int (*progress_cbk)(PJ_CONTEXT *, double pct, void *user_data), void *user_data); /*! @cond Doxygen_Suppress */ /* Manage the transformation definition object PJ */ PJ PROJ_DLL *proj_create (PJ_CONTEXT *ctx, const char *definition); PJ PROJ_DLL *proj_create_argv (PJ_CONTEXT *ctx, int argc, char **argv); PJ PROJ_DLL *proj_create_crs_to_crs(PJ_CONTEXT *ctx, const char *source_crs, const char *target_crs, PJ_AREA *area); PJ PROJ_DLL *proj_create_crs_to_crs_from_pj(PJ_CONTEXT *ctx, const PJ *source_crs, const PJ *target_crs, PJ_AREA *area, const char* const *options); /*! @endcond */ PJ PROJ_DLL *proj_normalize_for_visualization(PJ_CONTEXT *ctx, const PJ* obj); /*! @cond Doxygen_Suppress */ void PROJ_DLL proj_assign_context(PJ* pj, PJ_CONTEXT* ctx); PJ PROJ_DLL *proj_destroy (PJ *P); PJ_AREA PROJ_DLL *proj_area_create(void); void PROJ_DLL proj_area_set_bbox(PJ_AREA *area, double west_lon_degree, double south_lat_degree, double east_lon_degree, double north_lat_degree); void PROJ_DLL proj_area_destroy(PJ_AREA* area); /* Apply transformation to observation - in forward or inverse direction */ enum PJ_DIRECTION { PJ_FWD = 1, /* Forward */ PJ_IDENT = 0, /* Do nothing */ PJ_INV = -1 /* Inverse */ }; typedef enum PJ_DIRECTION PJ_DIRECTION; int PROJ_DLL proj_angular_input (PJ *P, enum PJ_DIRECTION dir); int PROJ_DLL proj_angular_output (PJ *P, enum PJ_DIRECTION dir); int PROJ_DLL proj_degree_input (PJ *P, enum PJ_DIRECTION dir); int PROJ_DLL proj_degree_output (PJ *P, enum PJ_DIRECTION dir); PJ_COORD PROJ_DLL proj_trans (PJ *P, PJ_DIRECTION direction, PJ_COORD coord); int PROJ_DLL proj_trans_array (PJ *P, PJ_DIRECTION direction, size_t n, PJ_COORD *coord); size_t PROJ_DLL proj_trans_generic ( PJ *P, PJ_DIRECTION direction, double *x, size_t sx, size_t nx, double *y, size_t sy, size_t ny, double *z, size_t sz, size_t nz, double *t, size_t st, size_t nt ); /*! @endcond */ int PROJ_DLL proj_trans_bounds( PJ_CONTEXT* context, PJ *P, PJ_DIRECTION direction, double xmin, double ymin, double xmax, double ymax, double* out_xmin, double* out_ymin, double* out_xmax, double* out_ymax, int densify_pts ); /*! @cond Doxygen_Suppress */ /* Initializers */ PJ_COORD PROJ_DLL proj_coord (double x, double y, double z, double t); /* Measure internal consistency - in forward or inverse direction */ double PROJ_DLL proj_roundtrip (PJ *P, PJ_DIRECTION direction, int n, PJ_COORD *coord); /* Geodesic distance between two points with angular 2D coordinates */ double PROJ_DLL proj_lp_dist (const PJ *P, PJ_COORD a, PJ_COORD b); /* The geodesic distance AND the vertical offset */ double PROJ_DLL proj_lpz_dist (const PJ *P, PJ_COORD a, PJ_COORD b); /* Euclidean distance between two points with linear 2D coordinates */ double PROJ_DLL proj_xy_dist (PJ_COORD a, PJ_COORD b); /* Euclidean distance between two points with linear 3D coordinates */ double PROJ_DLL proj_xyz_dist (PJ_COORD a, PJ_COORD b); /* Geodesic distance (in meter) + fwd and rev azimuth between two points on the ellipsoid */ PJ_COORD PROJ_DLL proj_geod (const PJ *P, PJ_COORD a, PJ_COORD b); /* PROJ error codes */ /** Error codes typically related to coordinate operation initialization * Note: some of them can also be emitted during coordinate transformation, * like PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID in case the resource loading * is deferred until it is really needed. */ #define PROJ_ERR_INVALID_OP 1024 /* other/unspecified error related to coordinate operation initialization */ #define PROJ_ERR_INVALID_OP_WRONG_SYNTAX (PROJ_ERR_INVALID_OP+1) /* invalid pipeline structure, missing +proj argument, etc */ #define PROJ_ERR_INVALID_OP_MISSING_ARG (PROJ_ERR_INVALID_OP+2) /* missing required operation parameter */ #define PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE (PROJ_ERR_INVALID_OP+3) /* one of the operation parameter has an illegal value */ #define PROJ_ERR_INVALID_OP_MUTUALLY_EXCLUSIVE_ARGS (PROJ_ERR_INVALID_OP+4) /* mutually exclusive arguments */ #define PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID (PROJ_ERR_INVALID_OP+5) /* file not found (particular case of PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE) */ /** Error codes related to transformation on a specific coordinate */ #define PROJ_ERR_COORD_TRANSFM 2048 /* other error related to coordinate transformation */ #define PROJ_ERR_COORD_TRANSFM_INVALID_COORD (PROJ_ERR_COORD_TRANSFM+1) /* for e.g lat > 90deg */ #define PROJ_ERR_COORD_TRANSFM_OUTSIDE_PROJECTION_DOMAIN (PROJ_ERR_COORD_TRANSFM+2) /* coordinate is outside of the projection domain. e.g approximate mercator with |longitude - lon_0| > 90deg, or iterative convergence method failed */ #define PROJ_ERR_COORD_TRANSFM_NO_OPERATION (PROJ_ERR_COORD_TRANSFM+3) /* no operation found, e.g if no match the required accuracy, or if ballpark transformations were asked to not be used and they would be only such candidate */ #define PROJ_ERR_COORD_TRANSFM_OUTSIDE_GRID (PROJ_ERR_COORD_TRANSFM+4) /* point to transform falls outside grid or subgrid */ #define PROJ_ERR_COORD_TRANSFM_GRID_AT_NODATA (PROJ_ERR_COORD_TRANSFM+5) /* point to transform falls in a grid cell that evaluates to nodata */ /** Other type of errors */ #define PROJ_ERR_OTHER 4096 #define PROJ_ERR_OTHER_API_MISUSE (PROJ_ERR_OTHER+1) /* error related to a misuse of PROJ API */ #define PROJ_ERR_OTHER_NO_INVERSE_OP (PROJ_ERR_OTHER+2) /* no inverse method available */ #define PROJ_ERR_OTHER_NETWORK_ERROR (PROJ_ERR_OTHER+3) /* failure when accessing a network resource */ /* Set or read error level */ int PROJ_DLL proj_context_errno (PJ_CONTEXT *ctx); int PROJ_DLL proj_errno (const PJ *P); int PROJ_DLL proj_errno_set (const PJ *P, int err); int PROJ_DLL proj_errno_reset (const PJ *P); int PROJ_DLL proj_errno_restore (const PJ *P, int err); const char PROJ_DLL * proj_errno_string (int err); /* deprecated. use proj_context_errno_string() */ const char PROJ_DLL * proj_context_errno_string(PJ_CONTEXT* ctx, int err); PJ_LOG_LEVEL PROJ_DLL proj_log_level (PJ_CONTEXT *ctx, PJ_LOG_LEVEL log_level); void PROJ_DLL proj_log_func (PJ_CONTEXT *ctx, void *app_data, PJ_LOG_FUNCTION logf); /* Scaling and angular distortion factors */ PJ_FACTORS PROJ_DLL proj_factors(PJ *P, PJ_COORD lp); /* Info functions - get information about various PROJ.4 entities */ PJ_INFO PROJ_DLL proj_info(void); PJ_PROJ_INFO PROJ_DLL proj_pj_info(PJ *P); PJ_GRID_INFO PROJ_DLL proj_grid_info(const char *gridname); PJ_INIT_INFO PROJ_DLL proj_init_info(const char *initname); /* List functions: */ /* Get lists of operations, ellipsoids, units and prime meridians. */ const PJ_OPERATIONS PROJ_DLL *proj_list_operations(void); const PJ_ELLPS PROJ_DLL *proj_list_ellps(void); PROJ_DEPRECATED(const PJ_UNITS PROJ_DLL *proj_list_units(void), "Deprecated by proj_get_units_from_database"); PROJ_DEPRECATED(const PJ_UNITS PROJ_DLL *proj_list_angular_units(void), "Deprecated by proj_get_units_from_database"); const PJ_PRIME_MERIDIANS PROJ_DLL *proj_list_prime_meridians(void); /* These are trivial, and while occasionally useful in real code, primarily here to */ /* simplify demo code, and in acknowledgement of the proj-internal discrepancy between */ /* angular units expected by classical proj, and by Charles Karney's geodesics subsystem */ double PROJ_DLL proj_torad (double angle_in_degrees); double PROJ_DLL proj_todeg (double angle_in_radians); double PROJ_DLL proj_dmstor(const char *is, char **rs); char PROJ_DLL * proj_rtodms(char *s, double r, int pos, int neg); void PROJ_DLL proj_cleanup(void); /*! @endcond */ /* ------------------------------------------------------------------------- */ /* Binding in C of C++ API */ /* ------------------------------------------------------------------------- */ /** @defgroup iso19111_types Data types for ISO19111 C API * Data types for ISO19111 C API * @{ */ /** \brief Type representing a NULL terminated list of NULL-terminate strings. */ typedef char **PROJ_STRING_LIST; /** \brief Guessed WKT "dialect". */ typedef enum { /** \ref WKT2_2019 */ PJ_GUESSED_WKT2_2019, /** Deprecated alias for PJ_GUESSED_WKT2_2019 */ PJ_GUESSED_WKT2_2018 = PJ_GUESSED_WKT2_2019, /** \ref WKT2_2015 */ PJ_GUESSED_WKT2_2015, /** \ref WKT1 */ PJ_GUESSED_WKT1_GDAL, /** ESRI variant of WKT1 */ PJ_GUESSED_WKT1_ESRI, /** Not WKT / unrecognized */ PJ_GUESSED_NOT_WKT } PJ_GUESSED_WKT_DIALECT; /** \brief Object category. */ typedef enum { PJ_CATEGORY_ELLIPSOID, PJ_CATEGORY_PRIME_MERIDIAN, PJ_CATEGORY_DATUM, PJ_CATEGORY_CRS, PJ_CATEGORY_COORDINATE_OPERATION, PJ_CATEGORY_DATUM_ENSEMBLE } PJ_CATEGORY; /** \brief Object type. */ typedef enum { PJ_TYPE_UNKNOWN, PJ_TYPE_ELLIPSOID, PJ_TYPE_PRIME_MERIDIAN, PJ_TYPE_GEODETIC_REFERENCE_FRAME, PJ_TYPE_DYNAMIC_GEODETIC_REFERENCE_FRAME, PJ_TYPE_VERTICAL_REFERENCE_FRAME, PJ_TYPE_DYNAMIC_VERTICAL_REFERENCE_FRAME, PJ_TYPE_DATUM_ENSEMBLE, /** Abstract type, not returned by proj_get_type() */ PJ_TYPE_CRS, PJ_TYPE_GEODETIC_CRS, PJ_TYPE_GEOCENTRIC_CRS, /** proj_get_type() will never return that type, but * PJ_TYPE_GEOGRAPHIC_2D_CRS or PJ_TYPE_GEOGRAPHIC_3D_CRS. */ PJ_TYPE_GEOGRAPHIC_CRS, PJ_TYPE_GEOGRAPHIC_2D_CRS, PJ_TYPE_GEOGRAPHIC_3D_CRS, PJ_TYPE_VERTICAL_CRS, PJ_TYPE_PROJECTED_CRS, PJ_TYPE_COMPOUND_CRS, PJ_TYPE_TEMPORAL_CRS, PJ_TYPE_ENGINEERING_CRS, PJ_TYPE_BOUND_CRS, PJ_TYPE_OTHER_CRS, PJ_TYPE_CONVERSION, PJ_TYPE_TRANSFORMATION, PJ_TYPE_CONCATENATED_OPERATION, PJ_TYPE_OTHER_COORDINATE_OPERATION, PJ_TYPE_TEMPORAL_DATUM, PJ_TYPE_ENGINEERING_DATUM, PJ_TYPE_PARAMETRIC_DATUM, } PJ_TYPE; /** Comparison criterion. */ typedef enum { /** All properties are identical. */ PJ_COMP_STRICT, /** The objects are equivalent for the purpose of coordinate * operations. They can differ by the name of their objects, * identifiers, other metadata. * Parameters may be expressed in different units, provided that the * value is (with some tolerance) the same once expressed in a * common unit. */ PJ_COMP_EQUIVALENT, /** Same as EQUIVALENT, relaxed with an exception that the axis order * of the base CRS of a DerivedCRS/ProjectedCRS or the axis order of * a GeographicCRS is ignored. Only to be used * with DerivedCRS/ProjectedCRS/GeographicCRS */ PJ_COMP_EQUIVALENT_EXCEPT_AXIS_ORDER_GEOGCRS, } PJ_COMPARISON_CRITERION; /** \brief WKT version. */ typedef enum { /** cf osgeo::proj::io::WKTFormatter::Convention::WKT2 */ PJ_WKT2_2015, /** cf osgeo::proj::io::WKTFormatter::Convention::WKT2_SIMPLIFIED */ PJ_WKT2_2015_SIMPLIFIED, /** cf osgeo::proj::io::WKTFormatter::Convention::WKT2_2019 */ PJ_WKT2_2019, /** Deprecated alias for PJ_WKT2_2019 */ PJ_WKT2_2018 = PJ_WKT2_2019, /** cf osgeo::proj::io::WKTFormatter::Convention::WKT2_2019_SIMPLIFIED */ PJ_WKT2_2019_SIMPLIFIED, /** Deprecated alias for PJ_WKT2_2019 */ PJ_WKT2_2018_SIMPLIFIED = PJ_WKT2_2019_SIMPLIFIED, /** cf osgeo::proj::io::WKTFormatter::Convention::WKT1_GDAL */ PJ_WKT1_GDAL, /** cf osgeo::proj::io::WKTFormatter::Convention::WKT1_ESRI */ PJ_WKT1_ESRI } PJ_WKT_TYPE; /** Specify how source and target CRS extent should be used to restrict * candidate operations (only taken into account if no explicit area of * interest is specified. */ typedef enum { /** Ignore CRS extent */ PJ_CRS_EXTENT_NONE, /** Test coordinate operation extent against both CRS extent. */ PJ_CRS_EXTENT_BOTH, /** Test coordinate operation extent against the intersection of both CRS extent. */ PJ_CRS_EXTENT_INTERSECTION, /** Test coordinate operation against the smallest of both CRS extent. */ PJ_CRS_EXTENT_SMALLEST } PROJ_CRS_EXTENT_USE; /** Describe how grid availability is used. */ typedef enum { /** Grid availability is only used for sorting results. Operations * where some grids are missing will be sorted last. */ PROJ_GRID_AVAILABILITY_USED_FOR_SORTING, /** Completely discard an operation if a required grid is missing. */ PROJ_GRID_AVAILABILITY_DISCARD_OPERATION_IF_MISSING_GRID, /** Ignore grid availability at all. Results will be presented as if * all grids were available. */ PROJ_GRID_AVAILABILITY_IGNORED, /** Results will be presented as if grids known to PROJ (that is * registered in the grid_alternatives table of its database) were * available. Used typically when networking is enabled. */ PROJ_GRID_AVAILABILITY_KNOWN_AVAILABLE, } PROJ_GRID_AVAILABILITY_USE; /** \brief PROJ string version. */ typedef enum { /** cf osgeo::proj::io::PROJStringFormatter::Convention::PROJ_5 */ PJ_PROJ_5, /** cf osgeo::proj::io::PROJStringFormatter::Convention::PROJ_4 */ PJ_PROJ_4 } PJ_PROJ_STRING_TYPE; /** Spatial criterion to restrict candidate operations. */ typedef enum { /** The area of validity of transforms should strictly contain the * are of interest. */ PROJ_SPATIAL_CRITERION_STRICT_CONTAINMENT, /** The area of validity of transforms should at least intersect the * area of interest. */ PROJ_SPATIAL_CRITERION_PARTIAL_INTERSECTION } PROJ_SPATIAL_CRITERION; /** Describe if and how intermediate CRS should be used */ typedef enum { /** Always search for intermediate CRS. */ PROJ_INTERMEDIATE_CRS_USE_ALWAYS, /** Only attempt looking for intermediate CRS if there is no direct * transformation available. */ PROJ_INTERMEDIATE_CRS_USE_IF_NO_DIRECT_TRANSFORMATION, /* Do not attempt looking for intermediate CRS. */ PROJ_INTERMEDIATE_CRS_USE_NEVER, } PROJ_INTERMEDIATE_CRS_USE; /** Type of coordinate system. */ typedef enum { PJ_CS_TYPE_UNKNOWN, PJ_CS_TYPE_CARTESIAN, PJ_CS_TYPE_ELLIPSOIDAL, PJ_CS_TYPE_VERTICAL, PJ_CS_TYPE_SPHERICAL, PJ_CS_TYPE_ORDINAL, PJ_CS_TYPE_PARAMETRIC, PJ_CS_TYPE_DATETIMETEMPORAL, PJ_CS_TYPE_TEMPORALCOUNT, PJ_CS_TYPE_TEMPORALMEASURE } PJ_COORDINATE_SYSTEM_TYPE; /** \brief Structure given overall description of a CRS. * * This structure may grow over time, and should not be directly allocated by * client code. */ typedef struct { /** Authority name. */ char* auth_name; /** Object code. */ char* code; /** Object name. */ char* name; /** Object type. */ PJ_TYPE type; /** Whether the object is deprecated */ int deprecated; /** Whereas the west_lon_degree, south_lat_degree, east_lon_degree and * north_lat_degree fields are valid. */ int bbox_valid; /** Western-most longitude of the area of use, in degrees. */ double west_lon_degree; /** Southern-most latitude of the area of use, in degrees. */ double south_lat_degree; /** Eastern-most longitude of the area of use, in degrees. */ double east_lon_degree; /** Northern-most latitude of the area of use, in degrees. */ double north_lat_degree; /** Name of the area of use. */ char* area_name; /** Name of the projection method for a projected CRS. Might be NULL even *for projected CRS in some cases. */ char* projection_method_name; /** Name of the celestial body of the CRS (e.g. "Earth"). * @since 8.1 */ char* celestial_body_name; } PROJ_CRS_INFO; /** \brief Structure describing optional parameters for proj_get_crs_list(); * * This structure may grow over time, and should not be directly allocated by * client code. */ typedef struct { /** Array of allowed object types. Should be NULL if all types are allowed*/ const PJ_TYPE* types; /** Size of types. Should be 0 if all types are allowed*/ size_t typesCount; /** If TRUE and bbox_valid == TRUE, then only CRS whose area of use * entirely contains the specified bounding box will be returned. * If FALSE and bbox_valid == TRUE, then only CRS whose area of use * intersects the specified bounding box will be returned. */ int crs_area_of_use_contains_bbox; /** To set to TRUE so that west_lon_degree, south_lat_degree, * east_lon_degree and north_lat_degree fields are taken into account. */ int bbox_valid; /** Western-most longitude of the area of use, in degrees. */ double west_lon_degree; /** Southern-most latitude of the area of use, in degrees. */ double south_lat_degree; /** Eastern-most longitude of the area of use, in degrees. */ double east_lon_degree; /** Northern-most latitude of the area of use, in degrees. */ double north_lat_degree; /** Whether deprecated objects are allowed. Default to FALSE. */ int allow_deprecated; /** Celestial body of the CRS (e.g. "Earth"). The default value, NULL, * means no restriction * @since 8.1 */ const char* celestial_body_name; } PROJ_CRS_LIST_PARAMETERS; /** \brief Structure given description of a unit. * * This structure may grow over time, and should not be directly allocated by * client code. * @since 7.1 */ typedef struct { /** Authority name. */ char* auth_name; /** Object code. */ char* code; /** Object name. For example "metre", "US survey foot", etc. */ char* name; /** Category of the unit: one of "linear", "linear_per_time", "angular", * "angular_per_time", "scale", "scale_per_time" or "time" */ char* category; /** Conversion factor to apply to transform from that unit to the * corresponding SI unit (metre for "linear", radian for "angular", etc.). * It might be 0 in some cases to indicate no known conversion factor. */ double conv_factor; /** PROJ short name, like "m", "ft", "us-ft", etc... Might be NULL */ char* proj_short_name; /** Whether the object is deprecated */ int deprecated; } PROJ_UNIT_INFO; /** \brief Structure given description of a celestial body. * * This structure may grow over time, and should not be directly allocated by * client code. * @since 8.1 */ typedef struct { /** Authority name. */ char* auth_name; /** Object name. For example "Earth" */ char* name; } PROJ_CELESTIAL_BODY_INFO; /**@}*/ /** * \defgroup iso19111_functions Binding in C of basic methods from the C++ API * Functions for ISO19111 C API * * The PJ* objects returned by proj_create_from_wkt(), * proj_create_from_database() and other functions in that section * will have generally minimal interaction with the functions declared in the * upper section of this header file (calling those functions on those objects * will either return an error or default/nonsensical values). The exception is * for ISO19111 objects of type CoordinateOperation that can be exported as a * valid PROJ pipeline. In this case, the PJ objects will work for example with * proj_trans_generic(). * Conversely, objects returned by proj_create() and proj_create_argv(), which * are not of type CRS, will return an error when used with functions of this section. * @{ */ /*! @cond Doxygen_Suppress */ typedef struct PJ_OBJ_LIST PJ_OBJ_LIST; /*! @endcond */ void PROJ_DLL proj_string_list_destroy(PROJ_STRING_LIST list); void PROJ_DLL proj_context_set_autoclose_database(PJ_CONTEXT *ctx, int autoclose); int PROJ_DLL proj_context_set_database_path(PJ_CONTEXT *ctx, const char *dbPath, const char *const *auxDbPaths, const char* const *options); const char PROJ_DLL *proj_context_get_database_path(PJ_CONTEXT *ctx); const char PROJ_DLL *proj_context_get_database_metadata(PJ_CONTEXT* ctx, const char* key); PROJ_STRING_LIST PROJ_DLL proj_context_get_database_structure( PJ_CONTEXT* ctx, const char* const *options); PJ_GUESSED_WKT_DIALECT PROJ_DLL proj_context_guess_wkt_dialect(PJ_CONTEXT *ctx, const char *wkt); PJ PROJ_DLL *proj_create_from_wkt(PJ_CONTEXT *ctx, const char *wkt, const char* const *options, PROJ_STRING_LIST *out_warnings, PROJ_STRING_LIST *out_grammar_errors); PJ PROJ_DLL *proj_create_from_database(PJ_CONTEXT *ctx, const char *auth_name, const char *code, PJ_CATEGORY category, int usePROJAlternativeGridNames, const char* const *options); int PROJ_DLL proj_uom_get_info_from_database(PJ_CONTEXT *ctx, const char *auth_name, const char *code, const char **out_name, double *out_conv_factor, const char **out_category); int PROJ_DLL proj_grid_get_info_from_database(PJ_CONTEXT *ctx, const char *grid_name, const char **out_full_name, const char **out_package_name, const char **out_url, int *out_direct_download, int *out_open_license, int *out_available); PJ PROJ_DLL *proj_clone(PJ_CONTEXT *ctx, const PJ *obj); PJ_OBJ_LIST PROJ_DLL *proj_create_from_name(PJ_CONTEXT *ctx, const char *auth_name, const char *searchedName, const PJ_TYPE* types, size_t typesCount, int approximateMatch, size_t limitResultCount, const char* const *options); PJ_TYPE PROJ_DLL proj_get_type(const PJ *obj); int PROJ_DLL proj_is_deprecated(const PJ *obj); PJ_OBJ_LIST PROJ_DLL *proj_get_non_deprecated(PJ_CONTEXT *ctx, const PJ *obj); int PROJ_DLL proj_is_equivalent_to(const PJ *obj, const PJ *other, PJ_COMPARISON_CRITERION criterion); int PROJ_DLL proj_is_equivalent_to_with_ctx(PJ_CONTEXT *ctx, const PJ *obj, const PJ *other, PJ_COMPARISON_CRITERION criterion); int PROJ_DLL proj_is_crs(const PJ *obj); const char PROJ_DLL* proj_get_name(const PJ *obj); const char PROJ_DLL* proj_get_id_auth_name(const PJ *obj, int index); const char PROJ_DLL* proj_get_id_code(const PJ *obj, int index); const char PROJ_DLL* proj_get_remarks(const PJ *obj); const char PROJ_DLL* proj_get_scope(const PJ *obj); int PROJ_DLL proj_get_area_of_use(PJ_CONTEXT *ctx, const PJ *obj, double* out_west_lon_degree, double* out_south_lat_degree, double* out_east_lon_degree, double* out_north_lat_degree, const char **out_area_name); const char PROJ_DLL* proj_as_wkt(PJ_CONTEXT *ctx, const PJ *obj, PJ_WKT_TYPE type, const char* const *options); const char PROJ_DLL* proj_as_proj_string(PJ_CONTEXT *ctx, const PJ *obj, PJ_PROJ_STRING_TYPE type, const char* const *options); const char PROJ_DLL* proj_as_projjson(PJ_CONTEXT *ctx, const PJ *obj, const char* const *options); PJ PROJ_DLL *proj_get_source_crs(PJ_CONTEXT *ctx, const PJ *obj); PJ PROJ_DLL *proj_get_target_crs(PJ_CONTEXT *ctx, const PJ *obj); PJ_OBJ_LIST PROJ_DLL *proj_identify(PJ_CONTEXT *ctx, const PJ *obj, const char *auth_name, const char* const *options, int **out_confidence); PROJ_STRING_LIST PROJ_DLL proj_get_geoid_models_from_database( PJ_CONTEXT *ctx, const char *auth_name, const char *code, const char *const *options); void PROJ_DLL proj_int_list_destroy(int* list); /* ------------------------------------------------------------------------- */ PROJ_STRING_LIST PROJ_DLL proj_get_authorities_from_database(PJ_CONTEXT *ctx); PROJ_STRING_LIST PROJ_DLL proj_get_codes_from_database(PJ_CONTEXT *ctx, const char *auth_name, PJ_TYPE type, int allow_deprecated); PROJ_CELESTIAL_BODY_INFO PROJ_DLL **proj_get_celestial_body_list_from_database( PJ_CONTEXT *ctx, const char *auth_name, int *out_result_count); void PROJ_DLL proj_celestial_body_list_destroy(PROJ_CELESTIAL_BODY_INFO** list); PROJ_CRS_LIST_PARAMETERS PROJ_DLL *proj_get_crs_list_parameters_create(void); void PROJ_DLL proj_get_crs_list_parameters_destroy( PROJ_CRS_LIST_PARAMETERS* params); PROJ_CRS_INFO PROJ_DLL **proj_get_crs_info_list_from_database( PJ_CONTEXT *ctx, const char *auth_name, const PROJ_CRS_LIST_PARAMETERS* params, int *out_result_count); void PROJ_DLL proj_crs_info_list_destroy(PROJ_CRS_INFO** list); PROJ_UNIT_INFO PROJ_DLL **proj_get_units_from_database( PJ_CONTEXT *ctx, const char *auth_name, const char *category, int allow_deprecated, int *out_result_count); void PROJ_DLL proj_unit_list_destroy(PROJ_UNIT_INFO** list); /* ------------------------------------------------------------------------- */ /*! @cond Doxygen_Suppress */ typedef struct PJ_INSERT_SESSION PJ_INSERT_SESSION; /*! @endcond */ PJ_INSERT_SESSION PROJ_DLL *proj_insert_object_session_create(PJ_CONTEXT *ctx); void PROJ_DLL proj_insert_object_session_destroy(PJ_CONTEXT *ctx, PJ_INSERT_SESSION *session); PROJ_STRING_LIST PROJ_DLL proj_get_insert_statements(PJ_CONTEXT *ctx, PJ_INSERT_SESSION *session, const PJ *object, const char *authority, const char *code, int numeric_codes, const char *const *allowed_authorities, const char *const *options); char PROJ_DLL *proj_suggests_code_for(PJ_CONTEXT *ctx, const PJ *object, const char *authority, int numeric_code, const char *const *options); void PROJ_DLL proj_string_destroy(char* str); /* ------------------------------------------------------------------------- */ /*! @cond Doxygen_Suppress */ typedef struct PJ_OPERATION_FACTORY_CONTEXT PJ_OPERATION_FACTORY_CONTEXT; /*! @endcond */ PJ_OPERATION_FACTORY_CONTEXT PROJ_DLL *proj_create_operation_factory_context( PJ_CONTEXT *ctx, const char *authority); void PROJ_DLL proj_operation_factory_context_destroy( PJ_OPERATION_FACTORY_CONTEXT *ctx); void PROJ_DLL proj_operation_factory_context_set_desired_accuracy( PJ_CONTEXT *ctx, PJ_OPERATION_FACTORY_CONTEXT *factory_ctx, double accuracy); void PROJ_DLL proj_operation_factory_context_set_area_of_interest( PJ_CONTEXT *ctx, PJ_OPERATION_FACTORY_CONTEXT *factory_ctx, double west_lon_degree, double south_lat_degree, double east_lon_degree, double north_lat_degree); void PROJ_DLL proj_operation_factory_context_set_crs_extent_use( PJ_CONTEXT *ctx, PJ_OPERATION_FACTORY_CONTEXT *factory_ctx, PROJ_CRS_EXTENT_USE use); void PROJ_DLL proj_operation_factory_context_set_spatial_criterion( PJ_CONTEXT *ctx, PJ_OPERATION_FACTORY_CONTEXT *factory_ctx, PROJ_SPATIAL_CRITERION criterion); void PROJ_DLL proj_operation_factory_context_set_grid_availability_use( PJ_CONTEXT *ctx, PJ_OPERATION_FACTORY_CONTEXT *factory_ctx, PROJ_GRID_AVAILABILITY_USE use); void PROJ_DLL proj_operation_factory_context_set_use_proj_alternative_grid_names( PJ_CONTEXT *ctx, PJ_OPERATION_FACTORY_CONTEXT *factory_ctx, int usePROJNames); void PROJ_DLL proj_operation_factory_context_set_allow_use_intermediate_crs( PJ_CONTEXT *ctx, PJ_OPERATION_FACTORY_CONTEXT *factory_ctx, PROJ_INTERMEDIATE_CRS_USE use); void PROJ_DLL proj_operation_factory_context_set_allowed_intermediate_crs( PJ_CONTEXT *ctx, PJ_OPERATION_FACTORY_CONTEXT *factory_ctx, const char* const *list_of_auth_name_codes); void PROJ_DLL proj_operation_factory_context_set_discard_superseded( PJ_CONTEXT *ctx, PJ_OPERATION_FACTORY_CONTEXT *factory_ctx, int discard); void PROJ_DLL proj_operation_factory_context_set_allow_ballpark_transformations( PJ_CONTEXT *ctx, PJ_OPERATION_FACTORY_CONTEXT *factory_ctx, int allow); /* ------------------------------------------------------------------------- */ PJ_OBJ_LIST PROJ_DLL *proj_create_operations( PJ_CONTEXT *ctx, const PJ *source_crs, const PJ *target_crs, const PJ_OPERATION_FACTORY_CONTEXT *operationContext); int PROJ_DLL proj_list_get_count(const PJ_OBJ_LIST *result); PJ PROJ_DLL *proj_list_get(PJ_CONTEXT *ctx, const PJ_OBJ_LIST *result, int index); void PROJ_DLL proj_list_destroy(PJ_OBJ_LIST *result); int PROJ_DLL proj_get_suggested_operation(PJ_CONTEXT *ctx, PJ_OBJ_LIST *operations, PJ_DIRECTION direction, PJ_COORD coord); /* ------------------------------------------------------------------------- */ int PROJ_DLL proj_crs_is_derived(PJ_CONTEXT *ctx, const PJ *crs); PJ PROJ_DLL *proj_crs_get_geodetic_crs(PJ_CONTEXT *ctx, const PJ *crs); PJ PROJ_DLL *proj_crs_get_horizontal_datum(PJ_CONTEXT *ctx, const PJ *crs); PJ PROJ_DLL *proj_crs_get_sub_crs(PJ_CONTEXT *ctx, const PJ *crs, int index); PJ PROJ_DLL *proj_crs_get_datum(PJ_CONTEXT *ctx, const PJ *crs); PJ PROJ_DLL *proj_crs_get_datum_ensemble(PJ_CONTEXT *ctx, const PJ *crs); PJ PROJ_DLL *proj_crs_get_datum_forced(PJ_CONTEXT *ctx, const PJ *crs); int PROJ_DLL proj_datum_ensemble_get_member_count(PJ_CONTEXT *ctx, const PJ *datum_ensemble); double PROJ_DLL proj_datum_ensemble_get_accuracy(PJ_CONTEXT *ctx, const PJ *datum_ensemble); PJ PROJ_DLL *proj_datum_ensemble_get_member(PJ_CONTEXT *ctx, const PJ *datum_ensemble, int member_index); double PROJ_DLL proj_dynamic_datum_get_frame_reference_epoch(PJ_CONTEXT *ctx, const PJ *datum); PJ PROJ_DLL *proj_crs_get_coordinate_system(PJ_CONTEXT *ctx, const PJ *crs); PJ_COORDINATE_SYSTEM_TYPE PROJ_DLL proj_cs_get_type(PJ_CONTEXT *ctx, const PJ *cs); int PROJ_DLL proj_cs_get_axis_count(PJ_CONTEXT *ctx, const PJ *cs); int PROJ_DLL proj_cs_get_axis_info(PJ_CONTEXT *ctx, const PJ *cs, int index, const char **out_name, const char **out_abbrev, const char **out_direction, double *out_unit_conv_factor, const char **out_unit_name, const char **out_unit_auth_name, const char **out_unit_code); PJ PROJ_DLL *proj_get_ellipsoid(PJ_CONTEXT *ctx, const PJ *obj); int PROJ_DLL proj_ellipsoid_get_parameters(PJ_CONTEXT *ctx, const PJ *ellipsoid, double *out_semi_major_metre, double *out_semi_minor_metre, int *out_is_semi_minor_computed, double *out_inv_flattening); const char PROJ_DLL *proj_get_celestial_body_name(PJ_CONTEXT *ctx, const PJ *obj); PJ PROJ_DLL *proj_get_prime_meridian(PJ_CONTEXT *ctx, const PJ *obj); int PROJ_DLL proj_prime_meridian_get_parameters(PJ_CONTEXT *ctx, const PJ *prime_meridian, double *out_longitude, double *out_unit_conv_factor, const char **out_unit_name); PJ PROJ_DLL *proj_crs_get_coordoperation(PJ_CONTEXT *ctx, const PJ *crs); int PROJ_DLL proj_coordoperation_get_method_info(PJ_CONTEXT *ctx, const PJ *coordoperation, const char **out_method_name, const char **out_method_auth_name, const char **out_method_code); int PROJ_DLL proj_coordoperation_is_instantiable(PJ_CONTEXT *ctx, const PJ *coordoperation); int PROJ_DLL proj_coordoperation_has_ballpark_transformation(PJ_CONTEXT *ctx, const PJ *coordoperation); int PROJ_DLL proj_coordoperation_get_param_count(PJ_CONTEXT *ctx, const PJ *coordoperation); int PROJ_DLL proj_coordoperation_get_param_index(PJ_CONTEXT *ctx, const PJ *coordoperation, const char *name); int PROJ_DLL proj_coordoperation_get_param(PJ_CONTEXT *ctx, const PJ *coordoperation, int index, const char **out_name, const char **out_auth_name, const char **out_code, double *out_value, const char **out_value_string, double *out_unit_conv_factor, const char **out_unit_name, const char **out_unit_auth_name, const char **out_unit_code, const char **out_unit_category); int PROJ_DLL proj_coordoperation_get_grid_used_count(PJ_CONTEXT *ctx, const PJ *coordoperation); int PROJ_DLL proj_coordoperation_get_grid_used(PJ_CONTEXT *ctx, const PJ *coordoperation, int index, const char **out_short_name, const char **out_full_name, const char **out_package_name, const char **out_url, int *out_direct_download, int *out_open_license, int *out_available); double PROJ_DLL proj_coordoperation_get_accuracy(PJ_CONTEXT *ctx, const PJ *obj); int PROJ_DLL proj_coordoperation_get_towgs84_values(PJ_CONTEXT *ctx, const PJ *coordoperation, double *out_values, int value_count, int emit_error_if_incompatible); PJ PROJ_DLL *proj_coordoperation_create_inverse(PJ_CONTEXT *ctx, const PJ *obj); int PROJ_DLL proj_concatoperation_get_step_count(PJ_CONTEXT *ctx, const PJ *concatoperation); PJ PROJ_DLL *proj_concatoperation_get_step(PJ_CONTEXT *ctx, const PJ *concatoperation, int i_step); /**@}*/ #ifdef __cplusplus } #endif #endif /* ndef PROJ_H */ proj-8.2.1/src/tracing.cpp000644 000765 000024 00000015423 13612256475 016100 0ustar00keversstaff000000 000000 /****************************************************************************** * * Project: PROJ * Purpose: Tracing/profiling * Author: Even Rouault * ****************************************************************************** * Copyright (c) 2019, Even Rouault * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. ****************************************************************************/ #ifdef ENABLE_TRACING #ifndef FROM_PROJ_CPP #define FROM_PROJ_CPP #endif #include #include "proj/internal/internal.hpp" #include "proj/internal/tracing.hpp" //! @cond Doxygen_Suppress #if defined(_WIN32) && !defined(__CYGWIN__) #include #else #include /* for gettimeofday() */ #define CPLTimeVal timeval #define CPLGettimeofday(t, u) gettimeofday(t, u) #endif NS_PROJ_START using namespace internal; namespace tracing { #if defined(_WIN32) && !defined(__CYGWIN__) struct CPLTimeVal { time_t tv_sec; /* seconds */ long tv_usec; /* and microseconds */ }; // --------------------------------------------------------------------------- static void CPLGettimeofday(struct CPLTimeVal *tp, void * /* timezonep*/) { struct _timeb theTime; _ftime(&theTime); tp->tv_sec = static_cast(theTime.time); tp->tv_usec = theTime.millitm * 1000; } #endif struct Singleton { FILE *f = nullptr; int callLevel = 0; int minDelayMicroSec = 10 * 1000; // 10 millisec long long startTimeStamp = 0; std::string componentsWhiteList{}; std::string componentsBlackList{}; Singleton(); ~Singleton(); Singleton(const Singleton &) = delete; Singleton &operator=(const Singleton &) = delete; void logTraceRaw(const std::string &str); }; // --------------------------------------------------------------------------- Singleton::Singleton() { const char *traceFile = getenv("PROJ_TRACE_FILE"); if (traceFile) f = fopen(traceFile, "wb"); if (!f) f = stderr; const char *minDelay = getenv("PROJ_TRACE_MIN_DELAY"); if (minDelay) { minDelayMicroSec = atoi(minDelay); } const char *whiteList = getenv("PROJ_TRACE_WHITE_LIST"); if (whiteList) { componentsWhiteList = whiteList; } const char *blackList = getenv("PROJ_TRACE_BLACK_LIST"); if (blackList) { componentsBlackList = blackList; } CPLTimeVal ts; CPLGettimeofday(&ts, nullptr); startTimeStamp = static_cast(ts.tv_sec) * 1000000 + ts.tv_usec; logTraceRaw(""); ++callLevel; } // --------------------------------------------------------------------------- Singleton::~Singleton() { --callLevel; logTraceRaw(""); fflush(f); if (f != stderr) fclose(f); } // --------------------------------------------------------------------------- static Singleton &getSingleton() { static Singleton singleton; return singleton; } // --------------------------------------------------------------------------- void Singleton::logTraceRaw(const std::string &str) { CPLTimeVal ts; CPLGettimeofday(&ts, nullptr); const auto ts_usec = static_cast(ts.tv_sec) * 1000000 + ts.tv_usec; fprintf(f, " ", static_cast((ts_usec - startTimeStamp) / 1000000), static_cast((ts_usec - startTimeStamp) % 1000000)); for (int i = 0; i < callLevel; i++) fprintf(f, " "); fprintf(f, "%s\n", str.c_str()); fflush(f); } // --------------------------------------------------------------------------- void logTrace(const std::string &str, const std::string &component) { auto &singleton = getSingleton(); if (!singleton.componentsWhiteList.empty() && (component.empty() || singleton.componentsWhiteList.find(component) == std::string::npos)) { return; } if (!singleton.componentsBlackList.empty() && !component.empty() && singleton.componentsBlackList.find(component) != std::string::npos) { return; } std::string rawStr("msg_ = msg; CPLGettimeofday(&d->startTimeStamp_, nullptr); singleton.logTraceRaw(""); ++singleton.callLevel; singleton.logTraceRaw("" + d->msg_ + ""); } // --------------------------------------------------------------------------- EnterBlock::~EnterBlock() { auto &singleton = getSingleton(); CPLTimeVal endTimeStamp; CPLGettimeofday(&endTimeStamp, nullptr); int delayMicroSec = static_cast( (endTimeStamp.tv_usec - d->startTimeStamp_.tv_usec) + 1000000 * (endTimeStamp.tv_sec - d->startTimeStamp_.tv_sec)); std::string lengthStr; if (delayMicroSec >= singleton.minDelayMicroSec) { lengthStr = " length='" + toString(delayMicroSec / 1000) + "." + toString((delayMicroSec % 1000) / 100) + " msec'"; } singleton.logTraceRaw("" + d->msg_ + ""); --singleton.callLevel; singleton.logTraceRaw(""); } } // namespace tracing NS_PROJ_END //! @endcond #endif // ENABLE_TRACING proj-8.2.1/src/wkt2_parser.h000644 000765 000024 00000004025 13437770506 016356 0ustar00keversstaff000000 000000 /****************************************************************************** * Project: PROJ * Purpose: WKT2 parser grammar * Author: Even Rouault, * ****************************************************************************** * Copyright (c) 2018 Even Rouault, * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. ****************************************************************************/ #ifndef PJ_WKT2_PARSER_H_INCLUDED #define PJ_WKT2_PARSER_H_INCLUDED #ifndef DOXYGEN_SKIP #ifdef __cplusplus extern "C" { #endif typedef struct pj_wkt2_parse_context pj_wkt2_parse_context; #include "wkt2_generated_parser.h" void pj_wkt2_error( pj_wkt2_parse_context *context, const char *msg ); int pj_wkt2_lex(YYSTYPE* pNode, pj_wkt2_parse_context *context); int pj_wkt2_parse(pj_wkt2_parse_context *context); #ifdef __cplusplus } std::string pj_wkt2_parse(const std::string& wkt); #endif #endif /* #ifndef DOXYGEN_SKIP */ #endif /* PJ_WKT2_PARSER_H_INCLUDED */ proj-8.2.1/src/filemanager.cpp000644 000765 000024 00000206244 14140020570 016704 0ustar00keversstaff000000 000000 /****************************************************************************** * Project: PROJ * Purpose: File manager * Author: Even Rouault, * ****************************************************************************** * Copyright (c) 2019, Even Rouault, * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. *****************************************************************************/ #ifndef FROM_PROJ_CPP #define FROM_PROJ_CPP #endif #define LRU11_DO_NOT_DEFINE_OUT_OF_CLASS_METHODS #include #include #include #include #include #include "filemanager.hpp" #include "proj.h" #include "proj/internal/internal.hpp" #include "proj/internal/io_internal.hpp" #include "proj/io.hpp" #include "proj_internal.h" #include #include "proj_config.h" #if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) #define UWP 1 #else #define UWP 0 #endif #ifdef _WIN32 #include #include #else #ifdef HAVE_LIBDL #include #endif #include #include #endif //! @cond Doxygen_Suppress #define STR_HELPER(x) #x #define STR(x) STR_HELPER(x) using namespace NS_PROJ::internal; NS_PROJ_START // --------------------------------------------------------------------------- File::File(const std::string &filename) : name_(filename) {} // --------------------------------------------------------------------------- File::~File() = default; // --------------------------------------------------------------------------- std::string File::read_line(size_t maxLen, bool &maxLenReached, bool &eofReached) { constexpr size_t MAX_MAXLEN = 1024 * 1024; maxLen = std::min(maxLen, MAX_MAXLEN); while (true) { // Consume existing lines in buffer size_t pos = readLineBuffer_.find_first_of("\r\n"); if (pos != std::string::npos) { if (pos > maxLen) { std::string ret(readLineBuffer_.substr(0, maxLen)); readLineBuffer_ = readLineBuffer_.substr(maxLen); maxLenReached = true; eofReached = false; return ret; } std::string ret(readLineBuffer_.substr(0, pos)); if (readLineBuffer_[pos] == '\r' && readLineBuffer_[pos + 1] == '\n') { pos += 1; } readLineBuffer_ = readLineBuffer_.substr(pos + 1); maxLenReached = false; eofReached = false; return ret; } const size_t prevSize = readLineBuffer_.size(); if (maxLen <= prevSize) { std::string ret(readLineBuffer_.substr(0, maxLen)); readLineBuffer_ = readLineBuffer_.substr(maxLen); maxLenReached = true; eofReached = false; return ret; } if (eofReadLine_) { std::string ret = readLineBuffer_; readLineBuffer_.clear(); maxLenReached = false; eofReached = ret.empty(); return ret; } readLineBuffer_.resize(maxLen); const size_t nRead = read(&readLineBuffer_[prevSize], maxLen - prevSize); if (nRead < maxLen - prevSize) eofReadLine_ = true; readLineBuffer_.resize(prevSize + nRead); } } // --------------------------------------------------------------------------- #ifdef _WIN32 /* The bulk of utf8towc()/utf8fromwc() is derived from the utf.c module from * FLTK. It was originally downloaded from: * http://svn.easysw.com/public/fltk/fltk/trunk/src/utf.c * And already used by GDAL */ /************************************************************************/ /* ==================================================================== */ /* UTF.C code from FLTK with some modifications. */ /* ==================================================================== */ /************************************************************************/ /* Set to 1 to turn bad UTF8 bytes into ISO-8859-1. If this is to zero they are instead turned into the Unicode REPLACEMENT CHARACTER, of value 0xfffd. If this is on utf8decode will correctly map most (perhaps all) human-readable text that is in ISO-8859-1. This may allow you to completely ignore character sets in your code because virtually everything is either ISO-8859-1 or UTF-8. */ #define ERRORS_TO_ISO8859_1 1 /* Set to 1 to turn bad UTF8 bytes in the 0x80-0x9f range into the Unicode index for Microsoft's CP1252 character set. You should also set ERRORS_TO_ISO8859_1. With this a huge amount of more available text (such as all web pages) are correctly converted to Unicode. */ #define ERRORS_TO_CP1252 1 /* A number of Unicode code points are in fact illegal and should not be produced by a UTF-8 converter. Turn this on will replace the bytes in those encodings with errors. If you do this then converting arbitrary 16-bit data to UTF-8 and then back is not an identity, which will probably break a lot of software. */ #define STRICT_RFC3629 0 #if ERRORS_TO_CP1252 // Codes 0x80..0x9f from the Microsoft CP1252 character set, translated // to Unicode: constexpr unsigned short cp1252[32] = { 0x20ac, 0x0081, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, 0x02c6, 0x2030, 0x0160, 0x2039, 0x0152, 0x008d, 0x017d, 0x008f, 0x0090, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, 0x02dc, 0x2122, 0x0161, 0x203a, 0x0153, 0x009d, 0x017e, 0x0178}; #endif /************************************************************************/ /* utf8decode() */ /************************************************************************/ /* Decode a single UTF-8 encoded character starting at \e p. The resulting Unicode value (in the range 0-0x10ffff) is returned, and \e len is set the number of bytes in the UTF-8 encoding (adding \e len to \e p will point at the next character). If \a p points at an illegal UTF-8 encoding, including one that would go past \e end, or where a code is uses more bytes than necessary, then *reinterpret_cast(p) is translated as though it is in the Microsoft CP1252 character set and \e len is set to 1. Treating errors this way allows this to decode almost any ISO-8859-1 or CP1252 text that has been mistakenly placed where UTF-8 is expected, and has proven very useful. If you want errors to be converted to error characters (as the standards recommend), adding a test to see if the length is unexpectedly 1 will work: \code if( *p & 0x80 ) { // What should be a multibyte encoding. code = utf8decode(p, end, &len); if( len<2 ) code = 0xFFFD; // Turn errors into REPLACEMENT CHARACTER. } else { // Handle the 1-byte utf8 encoding: code = *p; len = 1; } \endcode Direct testing for the 1-byte case (as shown above) will also speed up the scanning of strings where the majority of characters are ASCII. */ static unsigned utf8decode(const char *p, const char *end, int *len) { unsigned char c = *reinterpret_cast(p); if (c < 0x80) { *len = 1; return c; #if ERRORS_TO_CP1252 } else if (c < 0xa0) { *len = 1; return cp1252[c - 0x80]; #endif } else if (c < 0xc2) { goto FAIL; } if (p + 1 >= end || (p[1] & 0xc0) != 0x80) goto FAIL; if (c < 0xe0) { *len = 2; return ((p[0] & 0x1f) << 6) + ((p[1] & 0x3f)); } else if (c == 0xe0) { if ((reinterpret_cast(p))[1] < 0xa0) goto FAIL; goto UTF8_3; #if STRICT_RFC3629 } else if (c == 0xed) { // RFC 3629 says surrogate chars are illegal. if ((reinterpret_cast(p))[1] >= 0xa0) goto FAIL; goto UTF8_3; } else if (c == 0xef) { // 0xfffe and 0xffff are also illegal characters. if ((reinterpret_cast(p))[1] == 0xbf && (reinterpret_cast(p))[2] >= 0xbe) goto FAIL; goto UTF8_3; #endif } else if (c < 0xf0) { UTF8_3: if (p + 2 >= end || (p[2] & 0xc0) != 0x80) goto FAIL; *len = 3; return ((p[0] & 0x0f) << 12) + ((p[1] & 0x3f) << 6) + ((p[2] & 0x3f)); } else if (c == 0xf0) { if ((reinterpret_cast(p))[1] < 0x90) goto FAIL; goto UTF8_4; } else if (c < 0xf4) { UTF8_4: if (p + 3 >= end || (p[2] & 0xc0) != 0x80 || (p[3] & 0xc0) != 0x80) goto FAIL; *len = 4; #if STRICT_RFC3629 // RFC 3629 says all codes ending in fffe or ffff are illegal: if ((p[1] & 0xf) == 0xf && (reinterpret_cast(p))[2] == 0xbf && (reinterpret_cast(p))[3] >= 0xbe) goto FAIL; #endif return ((p[0] & 0x07) << 18) + ((p[1] & 0x3f) << 12) + ((p[2] & 0x3f) << 6) + ((p[3] & 0x3f)); } else if (c == 0xf4) { if ((reinterpret_cast(p))[1] > 0x8f) goto FAIL; // After 0x10ffff. goto UTF8_4; } else { FAIL: *len = 1; #if ERRORS_TO_ISO8859_1 return c; #else return 0xfffd; // Unicode REPLACEMENT CHARACTER #endif } } /************************************************************************/ /* utf8towc() */ /************************************************************************/ /* Convert a UTF-8 sequence into an array of wchar_t. These are used by some system calls, especially on Windows. \a src points at the UTF-8, and \a srclen is the number of bytes to convert. \a dst points at an array to write, and \a dstlen is the number of locations in this array. At most \a dstlen-1 words will be written there, plus a 0 terminating word. Thus this function will never overwrite the buffer and will always return a zero-terminated string. If \a dstlen is zero then \a dst can be null and no data is written, but the length is returned. The return value is the number of words that \e would be written to \a dst if it were long enough, not counting the terminating zero. If the return value is greater or equal to \a dstlen it indicates truncation, you can then allocate a new array of size return+1 and call this again. Errors in the UTF-8 are converted as though each byte in the erroneous string is in the Microsoft CP1252 encoding. This allows ISO-8859-1 text mistakenly identified as UTF-8 to be printed correctly. Notice that sizeof(wchar_t) is 2 on Windows and is 4 on Linux and most other systems. Where wchar_t is 16 bits, Unicode characters in the range 0x10000 to 0x10ffff are converted to "surrogate pairs" which take two words each (this is called UTF-16 encoding). If wchar_t is 32 bits this rather nasty problem is avoided. */ static unsigned utf8towc(const char *src, unsigned srclen, wchar_t *dst, unsigned dstlen) { const char *p = src; const char *e = src + srclen; unsigned count = 0; if (dstlen) while (true) { if (p >= e) { dst[count] = 0; return count; } if (!(*p & 0x80)) { // ASCII dst[count] = *p++; } else { int len = 0; unsigned ucs = utf8decode(p, e, &len); p += len; #ifdef _WIN32 if (ucs < 0x10000) { dst[count] = static_cast(ucs); } else { // Make a surrogate pair: if (count + 2 >= dstlen) { dst[count] = 0; count += 2; break; } dst[count] = static_cast( (((ucs - 0x10000u) >> 10) & 0x3ff) | 0xd800); dst[++count] = static_cast((ucs & 0x3ff) | 0xdc00); } #else dst[count] = static_cast(ucs); #endif } if (++count == dstlen) { dst[count - 1] = 0; break; } } // We filled dst, measure the rest: while (p < e) { if (!(*p & 0x80)) { p++; } else { int len = 0; #ifdef _WIN32 const unsigned ucs = utf8decode(p, e, &len); p += len; if (ucs >= 0x10000) ++count; #else utf8decode(p, e, &len); p += len; #endif } ++count; } return count; } // --------------------------------------------------------------------------- struct NonValidUTF8Exception : public std::exception {}; // May throw exceptions static std::wstring UTF8ToWString(const std::string &str) { std::wstring wstr; wstr.resize(str.size()); wstr.resize(utf8towc(str.data(), static_cast(str.size()), &wstr[0], static_cast(wstr.size()) + 1)); for (const auto ch : wstr) { if (ch == 0xfffd) { throw NonValidUTF8Exception(); } } return wstr; } // --------------------------------------------------------------------------- /************************************************************************/ /* utf8fromwc() */ /************************************************************************/ /* Turn "wide characters" as returned by some system calls (especially on Windows) into UTF-8. Up to \a dstlen bytes are written to \a dst, including a null terminator. The return value is the number of bytes that would be written, not counting the null terminator. If greater or equal to \a dstlen then if you malloc a new array of size n+1 you will have the space needed for the entire string. If \a dstlen is zero then nothing is written and this call just measures the storage space needed. \a srclen is the number of words in \a src to convert. On Windows this is not necessarily the number of characters, due to there possibly being "surrogate pairs" in the UTF-16 encoding used. On Unix wchar_t is 32 bits and each location is a character. On Unix if a src word is greater than 0x10ffff then this is an illegal character according to RFC 3629. These are converted as though they are 0xFFFD (REPLACEMENT CHARACTER). Characters in the range 0xd800 to 0xdfff, or ending with 0xfffe or 0xffff are also illegal according to RFC 3629. However I encode these as though they are legal, so that utf8towc will return the original data. On Windows "surrogate pairs" are converted to a single character and UTF-8 encoded (as 4 bytes). Mismatched halves of surrogate pairs are converted as though they are individual characters. */ static unsigned int utf8fromwc(char *dst, unsigned dstlen, const wchar_t *src, unsigned srclen) { unsigned int i = 0; unsigned int count = 0; if (dstlen) while (true) { if (i >= srclen) { dst[count] = 0; return count; } unsigned int ucs = src[i++]; if (ucs < 0x80U) { dst[count++] = static_cast(ucs); if (count >= dstlen) { dst[count - 1] = 0; break; } } else if (ucs < 0x800U) { // 2 bytes. if (count + 2 >= dstlen) { dst[count] = 0; count += 2; break; } dst[count++] = 0xc0 | static_cast(ucs >> 6); dst[count++] = 0x80 | static_cast(ucs & 0x3F); #ifdef _WIN32 } else if (ucs >= 0xd800 && ucs <= 0xdbff && i < srclen && src[i] >= 0xdc00 && src[i] <= 0xdfff) { // Surrogate pair. unsigned int ucs2 = src[i++]; ucs = 0x10000U + ((ucs & 0x3ff) << 10) + (ucs2 & 0x3ff); // All surrogate pairs turn into 4-byte utf8. #else } else if (ucs >= 0x10000) { if (ucs > 0x10ffff) { ucs = 0xfffd; goto J1; } #endif if (count + 4 >= dstlen) { dst[count] = 0; count += 4; break; } dst[count++] = 0xf0 | static_cast(ucs >> 18); dst[count++] = 0x80 | static_cast((ucs >> 12) & 0x3F); dst[count++] = 0x80 | static_cast((ucs >> 6) & 0x3F); dst[count++] = 0x80 | static_cast(ucs & 0x3F); } else { #ifndef _WIN32 J1: #endif // All others are 3 bytes: if (count + 3 >= dstlen) { dst[count] = 0; count += 3; break; } dst[count++] = 0xe0 | static_cast(ucs >> 12); dst[count++] = 0x80 | static_cast((ucs >> 6) & 0x3F); dst[count++] = 0x80 | static_cast(ucs & 0x3F); } } // We filled dst, measure the rest: while (i < srclen) { unsigned int ucs = src[i++]; if (ucs < 0x80U) { count++; } else if (ucs < 0x800U) { // 2 bytes. count += 2; #ifdef _WIN32 } else if (ucs >= 0xd800 && ucs <= 0xdbff && i < srclen - 1 && src[i + 1] >= 0xdc00 && src[i + 1] <= 0xdfff) { // Surrogate pair. ++i; #else } else if (ucs >= 0x10000 && ucs <= 0x10ffff) { #endif count += 4; } else { count += 3; } } return count; } // --------------------------------------------------------------------------- static std::string WStringToUTF8(const std::wstring &wstr) { std::string str; str.resize(wstr.size()); str.resize(utf8fromwc(&str[0], static_cast(str.size() + 1), wstr.data(), static_cast(wstr.size()))); return str; } // --------------------------------------------------------------------------- static std::string Win32Recode(const char *src, unsigned src_code_page, unsigned dst_code_page) { // Convert from source code page to Unicode. // Compute the length in wide characters. int wlen = MultiByteToWideChar(src_code_page, MB_ERR_INVALID_CHARS, src, -1, nullptr, 0); if (wlen == 0 && GetLastError() == ERROR_NO_UNICODE_TRANSLATION) { return std::string(); } // Do the actual conversion. std::wstring wbuf; wbuf.resize(wlen); MultiByteToWideChar(src_code_page, 0, src, -1, &wbuf[0], wlen); // Convert from Unicode to destination code page. // Compute the length in chars. int len = WideCharToMultiByte(dst_code_page, 0, &wbuf[0], -1, nullptr, 0, nullptr, nullptr); // Do the actual conversion. std::string out; out.resize(len); WideCharToMultiByte(dst_code_page, 0, &wbuf[0], -1, &out[0], len, nullptr, nullptr); out.resize(strlen(out.c_str())); return out; } // --------------------------------------------------------------------------- class FileWin32 : public File { PJ_CONTEXT *m_ctx; HANDLE m_handle; FileWin32(const FileWin32 &) = delete; FileWin32 &operator=(const FileWin32 &) = delete; protected: FileWin32(const std::string &name, PJ_CONTEXT *ctx, HANDLE handle) : File(name), m_ctx(ctx), m_handle(handle) {} public: ~FileWin32() override; size_t read(void *buffer, size_t sizeBytes) override; size_t write(const void *buffer, size_t sizeBytes) override; bool seek(unsigned long long offset, int whence = SEEK_SET) override; unsigned long long tell() override; void reassign_context(PJ_CONTEXT *ctx) override { m_ctx = ctx; } // We may lie, but the real use case is only for network files bool hasChanged() const override { return false; } static std::unique_ptr open(PJ_CONTEXT *ctx, const char *filename, FileAccess access); }; // --------------------------------------------------------------------------- FileWin32::~FileWin32() { CloseHandle(m_handle); } // --------------------------------------------------------------------------- size_t FileWin32::read(void *buffer, size_t sizeBytes) { DWORD dwSizeRead = 0; size_t nResult = 0; if (!ReadFile(m_handle, buffer, static_cast(sizeBytes), &dwSizeRead, nullptr)) nResult = 0; else nResult = dwSizeRead; return nResult; } // --------------------------------------------------------------------------- size_t FileWin32::write(const void *buffer, size_t sizeBytes) { DWORD dwSizeWritten = 0; size_t nResult = 0; if (!WriteFile(m_handle, buffer, static_cast(sizeBytes), &dwSizeWritten, nullptr)) nResult = 0; else nResult = dwSizeWritten; return nResult; } // --------------------------------------------------------------------------- bool FileWin32::seek(unsigned long long offset, int whence) { LONG dwMoveMethod, dwMoveHigh; uint32_t nMoveLow; LARGE_INTEGER li; switch (whence) { case SEEK_CUR: dwMoveMethod = FILE_CURRENT; break; case SEEK_END: dwMoveMethod = FILE_END; break; case SEEK_SET: default: dwMoveMethod = FILE_BEGIN; break; } li.QuadPart = offset; nMoveLow = li.LowPart; dwMoveHigh = li.HighPart; SetLastError(0); SetFilePointer(m_handle, nMoveLow, &dwMoveHigh, dwMoveMethod); return GetLastError() == NO_ERROR; } // --------------------------------------------------------------------------- unsigned long long FileWin32::tell() { LARGE_INTEGER li; li.HighPart = 0; li.LowPart = SetFilePointer(m_handle, 0, &(li.HighPart), FILE_CURRENT); return static_cast(li.QuadPart); } // --------------------------------------------------------------------------- std::unique_ptr FileWin32::open(PJ_CONTEXT *ctx, const char *filename, FileAccess access) { DWORD dwDesiredAccess = access == FileAccess::READ_ONLY ? GENERIC_READ : GENERIC_READ | GENERIC_WRITE; DWORD dwCreationDisposition = access == FileAccess::CREATE ? CREATE_ALWAYS : OPEN_EXISTING; DWORD dwFlagsAndAttributes = (dwDesiredAccess == GENERIC_READ) ? FILE_ATTRIBUTE_READONLY : FILE_ATTRIBUTE_NORMAL; try { #if UWP CREATEFILE2_EXTENDED_PARAMETERS extendedParameters; ZeroMemory(&extendedParameters, sizeof(extendedParameters)); extendedParameters.dwSize = sizeof(extendedParameters); extendedParameters.dwFileAttributes = dwFlagsAndAttributes; HANDLE hFile = CreateFile2( UTF8ToWString(std::string(filename)).c_str(), dwDesiredAccess, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, dwCreationDisposition, &extendedParameters); #else // UWP HANDLE hFile = CreateFileW( UTF8ToWString(std::string(filename)).c_str(), dwDesiredAccess, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, nullptr, dwCreationDisposition, dwFlagsAndAttributes, nullptr); #endif // UWP return std::unique_ptr(hFile != INVALID_HANDLE_VALUE ? new FileWin32(filename, ctx, hFile) : nullptr); } catch (const std::exception &e) { pj_log(ctx, PJ_LOG_DEBUG, "%s", e.what()); return nullptr; } } #else // --------------------------------------------------------------------------- class FileStdio : public File { PJ_CONTEXT *m_ctx; FILE *m_fp; FileStdio(const FileStdio &) = delete; FileStdio &operator=(const FileStdio &) = delete; protected: FileStdio(const std::string &filename, PJ_CONTEXT *ctx, FILE *fp) : File(filename), m_ctx(ctx), m_fp(fp) {} public: ~FileStdio() override; size_t read(void *buffer, size_t sizeBytes) override; size_t write(const void *buffer, size_t sizeBytes) override; bool seek(unsigned long long offset, int whence = SEEK_SET) override; unsigned long long tell() override; void reassign_context(PJ_CONTEXT *ctx) override { m_ctx = ctx; } // We may lie, but the real use case is only for network files bool hasChanged() const override { return false; } static std::unique_ptr open(PJ_CONTEXT *ctx, const char *filename, FileAccess access); }; // --------------------------------------------------------------------------- FileStdio::~FileStdio() { fclose(m_fp); } // --------------------------------------------------------------------------- size_t FileStdio::read(void *buffer, size_t sizeBytes) { return fread(buffer, 1, sizeBytes, m_fp); } // --------------------------------------------------------------------------- size_t FileStdio::write(const void *buffer, size_t sizeBytes) { return fwrite(buffer, 1, sizeBytes, m_fp); } // --------------------------------------------------------------------------- bool FileStdio::seek(unsigned long long offset, int whence) { // TODO one day: use 64-bit offset compatible API if (offset != static_cast(static_cast(offset))) { pj_log(m_ctx, PJ_LOG_ERROR, "Attempt at seeking to a 64 bit offset. Not supported yet"); return false; } return fseek(m_fp, static_cast(offset), whence) == 0; } // --------------------------------------------------------------------------- unsigned long long FileStdio::tell() { // TODO one day: use 64-bit offset compatible API return ftell(m_fp); } // --------------------------------------------------------------------------- std::unique_ptr FileStdio::open(PJ_CONTEXT *ctx, const char *filename, FileAccess access) { auto fp = fopen(filename, access == FileAccess::READ_ONLY ? "rb" : access == FileAccess::READ_UPDATE ? "r+b" : "w+b"); return std::unique_ptr(fp ? new FileStdio(filename, ctx, fp) : nullptr); } #endif // _WIN32 // --------------------------------------------------------------------------- class FileApiAdapter : public File { PJ_CONTEXT *m_ctx; PROJ_FILE_HANDLE *m_fp; FileApiAdapter(const FileApiAdapter &) = delete; FileApiAdapter &operator=(const FileApiAdapter &) = delete; protected: FileApiAdapter(const std::string &filename, PJ_CONTEXT *ctx, PROJ_FILE_HANDLE *fp) : File(filename), m_ctx(ctx), m_fp(fp) {} public: ~FileApiAdapter() override; size_t read(void *buffer, size_t sizeBytes) override; size_t write(const void *, size_t) override; bool seek(unsigned long long offset, int whence = SEEK_SET) override; unsigned long long tell() override; void reassign_context(PJ_CONTEXT *ctx) override { m_ctx = ctx; } // We may lie, but the real use case is only for network files bool hasChanged() const override { return false; } static std::unique_ptr open(PJ_CONTEXT *ctx, const char *filename, FileAccess access); }; // --------------------------------------------------------------------------- FileApiAdapter::~FileApiAdapter() { m_ctx->fileApi.close_cbk(m_ctx, m_fp, m_ctx->fileApi.user_data); } // --------------------------------------------------------------------------- size_t FileApiAdapter::read(void *buffer, size_t sizeBytes) { return m_ctx->fileApi.read_cbk(m_ctx, m_fp, buffer, sizeBytes, m_ctx->fileApi.user_data); } // --------------------------------------------------------------------------- size_t FileApiAdapter::write(const void *buffer, size_t sizeBytes) { return m_ctx->fileApi.write_cbk(m_ctx, m_fp, buffer, sizeBytes, m_ctx->fileApi.user_data); } // --------------------------------------------------------------------------- bool FileApiAdapter::seek(unsigned long long offset, int whence) { return m_ctx->fileApi.seek_cbk(m_ctx, m_fp, static_cast(offset), whence, m_ctx->fileApi.user_data) != 0; } // --------------------------------------------------------------------------- unsigned long long FileApiAdapter::tell() { return m_ctx->fileApi.tell_cbk(m_ctx, m_fp, m_ctx->fileApi.user_data); } // --------------------------------------------------------------------------- std::unique_ptr FileApiAdapter::open(PJ_CONTEXT *ctx, const char *filename, FileAccess eAccess) { PROJ_OPEN_ACCESS eCAccess = PROJ_OPEN_ACCESS_READ_ONLY; switch (eAccess) { case FileAccess::READ_ONLY: // Initialized above break; case FileAccess::READ_UPDATE: eCAccess = PROJ_OPEN_ACCESS_READ_UPDATE; break; case FileAccess::CREATE: eCAccess = PROJ_OPEN_ACCESS_CREATE; break; } auto fp = ctx->fileApi.open_cbk(ctx, filename, eCAccess, ctx->fileApi.user_data); return std::unique_ptr(fp ? new FileApiAdapter(filename, ctx, fp) : nullptr); } // --------------------------------------------------------------------------- std::unique_ptr FileManager::open(PJ_CONTEXT *ctx, const char *filename, FileAccess access) { if (starts_with(filename, "http://") || starts_with(filename, "https://")) { if (!proj_context_is_network_enabled(ctx)) { pj_log( ctx, PJ_LOG_ERROR, "Attempt at accessing remote resource not authorized. Either " "set PROJ_NETWORK=ON or " "proj_context_set_enable_network(ctx, TRUE)"); return nullptr; } return pj_network_file_open(ctx, filename); } if (ctx->fileApi.open_cbk != nullptr) { return FileApiAdapter::open(ctx, filename, access); } #ifdef _WIN32 return FileWin32::open(ctx, filename, access); #else return FileStdio::open(ctx, filename, access); #endif } // --------------------------------------------------------------------------- bool FileManager::exists(PJ_CONTEXT *ctx, const char *filename) { if (ctx->fileApi.exists_cbk) { return ctx->fileApi.exists_cbk(ctx, filename, ctx->fileApi.user_data) != 0; } #ifdef _WIN32 struct __stat64 buf; try { return _wstat64(UTF8ToWString(filename).c_str(), &buf) == 0; } catch (const std::exception &e) { pj_log(ctx, PJ_LOG_DEBUG, "%s", e.what()); return false; } #else (void)ctx; struct stat sStat; return stat(filename, &sStat) == 0; #endif } // --------------------------------------------------------------------------- bool FileManager::mkdir(PJ_CONTEXT *ctx, const char *filename) { if (ctx->fileApi.mkdir_cbk) { return ctx->fileApi.mkdir_cbk(ctx, filename, ctx->fileApi.user_data) != 0; } #ifdef _WIN32 try { return _wmkdir(UTF8ToWString(filename).c_str()) == 0; } catch (const std::exception &e) { pj_log(ctx, PJ_LOG_DEBUG, "%s", e.what()); return false; } #else (void)ctx; return ::mkdir(filename, 0755) == 0; #endif } // --------------------------------------------------------------------------- bool FileManager::unlink(PJ_CONTEXT *ctx, const char *filename) { if (ctx->fileApi.unlink_cbk) { return ctx->fileApi.unlink_cbk(ctx, filename, ctx->fileApi.user_data) != 0; } #ifdef _WIN32 try { return _wunlink(UTF8ToWString(filename).c_str()) == 0; } catch (const std::exception &e) { pj_log(ctx, PJ_LOG_DEBUG, "%s", e.what()); return false; } #else (void)ctx; return ::unlink(filename) == 0; #endif } // --------------------------------------------------------------------------- bool FileManager::rename(PJ_CONTEXT *ctx, const char *oldPath, const char *newPath) { if (ctx->fileApi.rename_cbk) { return ctx->fileApi.rename_cbk(ctx, oldPath, newPath, ctx->fileApi.user_data) != 0; } #ifdef _WIN32 try { return _wrename(UTF8ToWString(oldPath).c_str(), UTF8ToWString(newPath).c_str()) == 0; } catch (const std::exception &e) { pj_log(ctx, PJ_LOG_DEBUG, "%s", e.what()); return false; } #else (void)ctx; return ::rename(oldPath, newPath) == 0; #endif } // --------------------------------------------------------------------------- std::string FileManager::getProjLibEnvVar(PJ_CONTEXT *ctx) { if (!ctx->env_var_proj_lib.empty()) { return ctx->env_var_proj_lib; } (void)ctx; std::string str; const char *envvar = getenv("PROJ_LIB"); if (!envvar) return str; str = envvar; #ifdef _WIN32 // Assume this is UTF-8. If not try to convert from ANSI page bool looksLikeUTF8 = false; try { UTF8ToWString(envvar); looksLikeUTF8 = true; } catch (const std::exception &) { } if (!looksLikeUTF8 || !exists(ctx, envvar)) { str = Win32Recode(envvar, CP_ACP, CP_UTF8); if (str.empty() || !exists(ctx, str.c_str())) str = envvar; } #endif ctx->env_var_proj_lib = str; return str; } NS_PROJ_END // --------------------------------------------------------------------------- static void CreateDirectoryRecursively(PJ_CONTEXT *ctx, const std::string &path) { if (NS_PROJ::FileManager::exists(ctx, path.c_str())) return; auto pos = path.find_last_of("/\\"); if (pos == 0 || pos == std::string::npos) return; CreateDirectoryRecursively(ctx, path.substr(0, pos)); NS_PROJ::FileManager::mkdir(ctx, path.c_str()); } //! @endcond // --------------------------------------------------------------------------- /** Set a file API * * All callbacks should be provided (non NULL pointers). If read-only usage * is intended, then the callbacks might have a dummy implementation. * * \note Those callbacks will not be used for SQLite3 database access. If * custom I/O is desired for that, then proj_context_set_sqlite3_vfs_name() * should be used. * * @param ctx PROJ context, or NULL * @param fileapi Pointer to file API structure (content will be copied). * @param user_data Arbitrary pointer provided by the user, and passed to the * above callbacks. May be NULL. * @return TRUE in case of success. * @since 7.0 */ int proj_context_set_fileapi(PJ_CONTEXT *ctx, const PROJ_FILE_API *fileapi, void *user_data) { if (ctx == nullptr) { ctx = pj_get_default_ctx(); } if (!fileapi) { return false; } if (fileapi->version != 1) { return false; } if (!fileapi->open_cbk || !fileapi->close_cbk || !fileapi->read_cbk || !fileapi->write_cbk || !fileapi->seek_cbk || !fileapi->tell_cbk || !fileapi->exists_cbk || !fileapi->mkdir_cbk || !fileapi->unlink_cbk || !fileapi->rename_cbk) { return false; } ctx->fileApi.open_cbk = fileapi->open_cbk; ctx->fileApi.close_cbk = fileapi->close_cbk; ctx->fileApi.read_cbk = fileapi->read_cbk; ctx->fileApi.write_cbk = fileapi->write_cbk; ctx->fileApi.seek_cbk = fileapi->seek_cbk; ctx->fileApi.tell_cbk = fileapi->tell_cbk; ctx->fileApi.exists_cbk = fileapi->exists_cbk; ctx->fileApi.mkdir_cbk = fileapi->mkdir_cbk; ctx->fileApi.unlink_cbk = fileapi->unlink_cbk; ctx->fileApi.rename_cbk = fileapi->rename_cbk; ctx->fileApi.user_data = user_data; return true; } // --------------------------------------------------------------------------- /** Set the name of a custom SQLite3 VFS. * * This should be a valid SQLite3 VFS name, such as the one passed to the * sqlite3_vfs_register(). See https://www.sqlite.org/vfs.html * * It will be used to read proj.db or create&access the cache.db file in the * PROJ user writable directory. * * @param ctx PROJ context, or NULL * @param name SQLite3 VFS name. If NULL is passed, default implementation by * SQLite will be used. * @since 7.0 */ void proj_context_set_sqlite3_vfs_name(PJ_CONTEXT *ctx, const char *name) { if (ctx == nullptr) { ctx = pj_get_default_ctx(); } ctx->custom_sqlite3_vfs_name = name ? name : std::string(); } // --------------------------------------------------------------------------- /** Get the PROJ user writable directory for datumgrid files. * * @param ctx PROJ context, or NULL * @param create If set to TRUE, create the directory if it does not exist * already. * @return The path to the PROJ user writable directory. * @since 7.1 */ const char *proj_context_get_user_writable_directory(PJ_CONTEXT *ctx, int create) { if (!ctx) ctx = pj_get_default_ctx(); if (ctx->user_writable_directory.empty()) { // For testing purposes only const char *env_var_PROJ_USER_WRITABLE_DIRECTORY = getenv("PROJ_USER_WRITABLE_DIRECTORY"); if (env_var_PROJ_USER_WRITABLE_DIRECTORY && env_var_PROJ_USER_WRITABLE_DIRECTORY[0] != '\0') { ctx->user_writable_directory = env_var_PROJ_USER_WRITABLE_DIRECTORY; } } if (ctx->user_writable_directory.empty()) { std::string path; #ifdef _WIN32 #ifdef __MINGW32__ std::wstring wPath; wPath.resize(MAX_PATH); if (SHGetFolderPathW(nullptr, CSIDL_LOCAL_APPDATA, nullptr, 0, &wPath[0]) == S_OK) { wPath.resize(wcslen(wPath.data())); path = NS_PROJ::WStringToUTF8(wPath); #else #if UWP if (false) { #else // UWP wchar_t *wPath; if (SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, nullptr, &wPath) == S_OK) { std::wstring ws(wPath); std::string str = NS_PROJ::WStringToUTF8(ws); path = str; CoTaskMemFree(wPath); #endif // UWP #endif } else { const char *local_app_data = getenv("LOCALAPPDATA"); if (!local_app_data) { local_app_data = getenv("TEMP"); if (!local_app_data) { local_app_data = "c:/users"; } } path = local_app_data; } #else const char *xdg_data_home = getenv("XDG_DATA_HOME"); if (xdg_data_home != nullptr) { path = xdg_data_home; } else { const char *home = getenv("HOME"); if (home && access(home, W_OK) == 0) { #if defined(__MACH__) && defined(__APPLE__) path = std::string(home) + "/Library/Application Support"; #else path = std::string(home) + "/.local/share"; #endif } else { path = "/tmp"; } } #endif path += "/proj"; ctx->user_writable_directory = path; } if (create != FALSE) { CreateDirectoryRecursively(ctx, ctx->user_writable_directory); } return ctx->user_writable_directory.c_str(); } /** Get the URL endpoint to query for remote grids. * * @param ctx PROJ context, or NULL * @return Endpoint URL. The returned pointer would be invalidated * by a later call to proj_context_set_url_endpoint() * @since 7.1 */ const char *proj_context_get_url_endpoint(PJ_CONTEXT *ctx) { if (ctx == nullptr) { ctx = pj_get_default_ctx(); } if (!ctx->endpoint.empty()) { return ctx->endpoint.c_str(); } pj_load_ini(ctx); return ctx->endpoint.c_str(); } // --------------------------------------------------------------------------- //! @cond Doxygen_Suppress // --------------------------------------------------------------------------- void pj_context_set_user_writable_directory(PJ_CONTEXT *ctx, const std::string &path) { if (!ctx) ctx = pj_get_default_ctx(); ctx->user_writable_directory = path; } // --------------------------------------------------------------------------- #ifdef WIN32 static const char dir_chars[] = "/\\"; #else static const char dir_chars[] = "/"; #endif static bool is_tilde_slash(const char *name) { return *name == '~' && strchr(dir_chars, name[1]); } static bool is_rel_or_absolute_filename(const char *name) { return strchr(dir_chars, *name) || (*name == '.' && strchr(dir_chars, name[1])) || (!strncmp(name, "..", 2) && strchr(dir_chars, name[2])) || (name[0] != '\0' && name[1] == ':' && strchr(dir_chars, name[2])); } // --------------------------------------------------------------------------- static std::string pj_get_relative_share_proj_internal_no_check() { #if defined(_WIN32) || defined(HAVE_LIBDL) #ifdef _WIN32 HMODULE hm = NULL; #if !UWP if (GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, (LPCSTR)&pj_get_relative_share_proj, &hm) == 0) { return std::string(); } #endif // UWP DWORD path_size = 1024; std::wstring wout; for (;;) { wout.clear(); wout.resize(path_size); DWORD result = GetModuleFileNameW(hm, &wout[0], path_size - 1); DWORD last_error = GetLastError(); if (result == 0) { return std::string(); } else if (result == path_size - 1) { if (ERROR_INSUFFICIENT_BUFFER != last_error) { return std::string(); } path_size = path_size * 2; } else { break; } } wout.resize(wcslen(wout.c_str())); std::string out = NS_PROJ::WStringToUTF8(wout); constexpr char dir_sep = '\\'; #else Dl_info info; if (!dladdr((void *)pj_get_relative_share_proj, &info)) { return std::string(); } std::string out(info.dli_fname); constexpr char dir_sep = '/'; // "optimization" for cmake builds where RUNPATH is set to ${prefix}/lib out = replaceAll(out, "/bin/../", "/"); #ifdef __linux // If we get a filename without any path, this is most likely a static // binary. Resolve the executable name if (out.find(dir_sep) == std::string::npos) { constexpr size_t BUFFER_SIZE = 1024; std::vector path(BUFFER_SIZE + 1); ssize_t nResultLen = readlink("/proc/self/exe", &path[0], BUFFER_SIZE); if (nResultLen >= 0 && static_cast(nResultLen) < BUFFER_SIZE) { out.assign(path.data(), static_cast(nResultLen)); } } #endif if (starts_with(out, "./")) out = out.substr(2); #endif auto pos = out.find_last_of(dir_sep); if (pos == std::string::npos) { // The initial path was something like libproj.so" out = "../share/proj"; return out; } out.resize(pos); pos = out.find_last_of(dir_sep); if (pos == std::string::npos) { // The initial path was something like bin/libproj.so" out = "share/proj"; return out; } out.resize(pos); // The initial path was something like foo/bin/libproj.so" out += "/share/proj"; return out; #else return std::string(); #endif } static std::string pj_get_relative_share_proj_internal_check_exists(PJ_CONTEXT *ctx) { if (ctx == nullptr) { ctx = pj_get_default_ctx(); } std::string path(pj_get_relative_share_proj_internal_no_check()); if (!path.empty() && NS_PROJ::FileManager::exists(ctx, path.c_str())) { return path; } return std::string(); } std::string pj_get_relative_share_proj(PJ_CONTEXT *ctx) { static std::string path( pj_get_relative_share_proj_internal_check_exists(ctx)); return path; } // --------------------------------------------------------------------------- static const char *get_path_from_relative_share_proj(PJ_CONTEXT *ctx, const char *name, std::string &out) { out = pj_get_relative_share_proj(ctx); if (out.empty()) { return nullptr; } out += '/'; out += name; return NS_PROJ::FileManager::exists(ctx, out.c_str()) ? out.c_str() : nullptr; } /************************************************************************/ /* pj_open_lib_internal() */ /************************************************************************/ #ifdef WIN32 static const char dirSeparator = ';'; #else static const char dirSeparator = ':'; #endif static const char *proj_lib_name = #ifdef PROJ_LIB PROJ_LIB; #else nullptr; #endif #ifdef PROJ_LIB_ENV_VAR_TRIED_LAST static bool gbPROJ_LIB_ENV_VAR_TRIED_LAST = true; #else static bool gbPROJ_LIB_ENV_VAR_TRIED_LAST = false; #endif static bool dontReadUserWritableDirectory() { // Env var mostly for testing purposes and being independent from // an existing installation const char *envVar = getenv("PROJ_SKIP_READ_USER_WRITABLE_DIRECTORY"); return envVar != nullptr && envVar[0] != '\0'; } static void *pj_open_lib_internal( PJ_CONTEXT *ctx, const char *name, const char *mode, void *(*open_file)(PJ_CONTEXT *, const char *, const char *), char *out_full_filename, size_t out_full_filename_size) { try { std::string fname; const char *sysname = nullptr; void *fid = nullptr; std::string projLib; if (ctx == nullptr) { ctx = pj_get_default_ctx(); } if (out_full_filename != nullptr && out_full_filename_size > 0) out_full_filename[0] = '\0'; /* check if ~/name */ if (is_tilde_slash(name)) if ((sysname = getenv("HOME")) != nullptr) { fname = sysname; fname += DIR_CHAR; fname += name; sysname = fname.c_str(); } else return nullptr; /* or fixed path: /name, ./name or ../name */ else if (is_rel_or_absolute_filename(name)) { sysname = name; #ifdef _WIN32 try { NS_PROJ::UTF8ToWString(name); } catch (const std::exception &) { fname = NS_PROJ::Win32Recode(name, CP_ACP, CP_UTF8); sysname = fname.c_str(); } #endif } else if (starts_with(name, "http://") || starts_with(name, "https://")) sysname = name; /* or try to use application provided file finder */ else if (ctx->file_finder != nullptr && (sysname = ctx->file_finder( ctx, name, ctx->file_finder_user_data)) != nullptr) ; /* The user has search paths set */ else if (!ctx->search_paths.empty()) { for (const auto &path : ctx->search_paths) { try { fname = path; fname += DIR_CHAR; fname += name; sysname = fname.c_str(); fid = open_file(ctx, sysname, mode); } catch (const std::exception &) { } if (fid) break; } } else if (!dontReadUserWritableDirectory() && (fid = open_file( ctx, (std::string(proj_context_get_user_writable_directory( ctx, false)) + DIR_CHAR + name) .c_str(), mode)) != nullptr) { fname = proj_context_get_user_writable_directory(ctx, false); fname += DIR_CHAR; fname += name; sysname = fname.c_str(); } /* if the environment PROJ_LIB defined, and *not* tried as last possibility */ else if (!gbPROJ_LIB_ENV_VAR_TRIED_LAST && !(projLib = NS_PROJ::FileManager::getProjLibEnvVar(ctx)) .empty()) { auto paths = NS_PROJ::internal::split(projLib, dirSeparator); for (const auto &path : paths) { fname = path; fname += DIR_CHAR; fname += name; sysname = fname.c_str(); fid = open_file(ctx, sysname, mode); if (fid) break; } } else if ((sysname = get_path_from_relative_share_proj( ctx, name, fname)) != nullptr) { /* check if it lives in a ../share/proj dir of the proj dll */ } else if (proj_lib_name != nullptr && (fid = open_file( ctx, (std::string(proj_lib_name) + DIR_CHAR + name).c_str(), mode)) != nullptr) { /* or hardcoded path */ fname = proj_lib_name; fname += DIR_CHAR; fname += name; sysname = fname.c_str(); } /* if the environment PROJ_LIB defined, and tried as last possibility */ else if (gbPROJ_LIB_ENV_VAR_TRIED_LAST && !(projLib = NS_PROJ::FileManager::getProjLibEnvVar(ctx)) .empty()) { auto paths = NS_PROJ::internal::split(projLib, dirSeparator); for (const auto &path : paths) { fname = path; fname += DIR_CHAR; fname += name; sysname = fname.c_str(); fid = open_file(ctx, sysname, mode); if (fid) break; } } else { /* just try it bare bones */ sysname = name; } assert(sysname); // to make Coverity Scan happy if (fid != nullptr || (fid = open_file(ctx, sysname, mode)) != nullptr) { if (out_full_filename != nullptr && out_full_filename_size > 0) { // cppcheck-suppress nullPointer strncpy(out_full_filename, sysname, out_full_filename_size); out_full_filename[out_full_filename_size - 1] = '\0'; } errno = 0; } if (ctx->last_errno == 0 && errno != 0) proj_context_errno_set(ctx, errno); pj_log(ctx, PJ_LOG_DEBUG, "pj_open_lib(%s): call fopen(%s) - %s", name, sysname, fid == nullptr ? "failed" : "succeeded"); return (fid); } catch (const std::exception &) { pj_log(ctx, PJ_LOG_DEBUG, "pj_open_lib(%s): out of memory", name); return nullptr; } } /************************************************************************/ /* pj_get_default_searchpaths() */ /************************************************************************/ std::vector pj_get_default_searchpaths(PJ_CONTEXT *ctx) { std::vector ret; // Env var mostly for testing purposes and being independent from // an existing installation const char *ignoreUserWritableDirectory = getenv("PROJ_SKIP_READ_USER_WRITABLE_DIRECTORY"); if (ignoreUserWritableDirectory == nullptr || ignoreUserWritableDirectory[0] == '\0') { ret.push_back(proj_context_get_user_writable_directory(ctx, false)); } const std::string envPROJ_LIB = NS_PROJ::FileManager::getProjLibEnvVar(ctx); const std::string relativeSharedProj = pj_get_relative_share_proj(ctx); if (gbPROJ_LIB_ENV_VAR_TRIED_LAST) { /* Situation where PROJ_LIB environment variable is tried in last */ #ifdef PROJ_LIB ret.push_back(PROJ_LIB); #endif if (!relativeSharedProj.empty()) { ret.push_back(relativeSharedProj); } if (!envPROJ_LIB.empty()) { ret.push_back(envPROJ_LIB); } } else { /* Situation where PROJ_LIB environment variable is used if defined */ if (!envPROJ_LIB.empty()) { ret.push_back(envPROJ_LIB); } else { if (!relativeSharedProj.empty()) { ret.push_back(relativeSharedProj); } #ifdef PROJ_LIB ret.push_back(PROJ_LIB); #endif } } return ret; } /************************************************************************/ /* pj_open_file_with_manager() */ /************************************************************************/ static void *pj_open_file_with_manager(PJ_CONTEXT *ctx, const char *name, const char * /* mode */) { return NS_PROJ::FileManager::open(ctx, name, NS_PROJ::FileAccess::READ_ONLY) .release(); } // --------------------------------------------------------------------------- static NS_PROJ::io::DatabaseContextPtr getDBcontext(PJ_CONTEXT *ctx) { try { return ctx->get_cpp_context()->getDatabaseContext().as_nullable(); } catch (const std::exception &e) { pj_log(ctx, PJ_LOG_DEBUG, "%s", e.what()); return nullptr; } } /************************************************************************/ /* FileManager::open_resource_file() */ /************************************************************************/ std::unique_ptr NS_PROJ::FileManager::open_resource_file(PJ_CONTEXT *ctx, const char *name) { if (ctx == nullptr) { ctx = pj_get_default_ctx(); } auto file = std::unique_ptr( reinterpret_cast(pj_open_lib_internal( ctx, name, "rb", pj_open_file_with_manager, nullptr, 0))); // Retry with the new proj grid name if the file name doesn't end with .tif std::string tmpString; // keep it in this upper scope ! if (file == nullptr && !is_tilde_slash(name) && !is_rel_or_absolute_filename(name) && !starts_with(name, "http://") && !starts_with(name, "https://") && strcmp(name, "proj.db") != 0 && strstr(name, ".tif") == nullptr) { auto dbContext = getDBcontext(ctx); if (dbContext) { try { auto filename = dbContext->getProjGridName(name); if (!filename.empty()) { file.reset(reinterpret_cast( pj_open_lib_internal(ctx, filename.c_str(), "rb", pj_open_file_with_manager, nullptr, 0))); if (file) { proj_context_errno_set(ctx, 0); } else { // For final network access attempt, use the new // name. tmpString = filename; name = tmpString.c_str(); } } } catch (const std::exception &e) { pj_log(ctx, PJ_LOG_DEBUG, "%s", e.what()); return nullptr; } } } // Retry with the old proj grid name if the file name ends with .tif else if (file == nullptr && !is_tilde_slash(name) && !is_rel_or_absolute_filename(name) && !starts_with(name, "http://") && !starts_with(name, "https://") && strstr(name, ".tif") != nullptr) { auto dbContext = getDBcontext(ctx); if (dbContext) { try { auto filename = dbContext->getOldProjGridName(name); if (!filename.empty()) { file.reset(reinterpret_cast( pj_open_lib_internal(ctx, filename.c_str(), "rb", pj_open_file_with_manager, nullptr, 0))); if (file) { proj_context_errno_set(ctx, 0); } } } catch (const std::exception &e) { pj_log(ctx, PJ_LOG_DEBUG, "%s", e.what()); return nullptr; } } } if (file == nullptr && !is_tilde_slash(name) && !is_rel_or_absolute_filename(name) && !starts_with(name, "http://") && !starts_with(name, "https://") && proj_context_is_network_enabled(ctx)) { std::string remote_file(proj_context_get_url_endpoint(ctx)); if (!remote_file.empty()) { if (remote_file.back() != '/') { remote_file += '/'; } remote_file += name; file = open(ctx, remote_file.c_str(), NS_PROJ::FileAccess::READ_ONLY); if (file) { pj_log(ctx, PJ_LOG_DEBUG, "Using %s", remote_file.c_str()); proj_context_errno_set(ctx, 0); } } } return file; } /************************************************************************/ /* pj_find_file() */ /************************************************************************/ /** Returns the full filename corresponding to a proj resource file specified * as a short filename. * * @param ctx context. * @param short_filename short filename (e.g. us_nga_egm96_15.tif). * Must not be NULL. * @param out_full_filename output buffer, of size out_full_filename_size, that * will receive the full filename on success. * Will be zero-terminated. * @param out_full_filename_size size of out_full_filename. * @return 1 if the file was found, 0 otherwise. */ int pj_find_file(PJ_CONTEXT *ctx, const char *short_filename, char *out_full_filename, size_t out_full_filename_size) { auto file = std::unique_ptr( reinterpret_cast(pj_open_lib_internal( ctx, short_filename, "rb", pj_open_file_with_manager, out_full_filename, out_full_filename_size))); // Retry with the old proj grid name if the file name ends with .tif if (file == nullptr && strstr(short_filename, ".tif") != nullptr) { auto dbContext = getDBcontext(ctx); if (dbContext) { try { auto filename = dbContext->getOldProjGridName(short_filename); if (!filename.empty()) { file.reset(reinterpret_cast( pj_open_lib_internal(ctx, filename.c_str(), "rb", pj_open_file_with_manager, out_full_filename, out_full_filename_size))); } } catch (const std::exception &e) { pj_log(ctx, PJ_LOG_DEBUG, "%s", e.what()); return false; } } } return file != nullptr; } /************************************************************************/ /* trim() */ /************************************************************************/ static std::string trim(const std::string &s) { const auto first = s.find_first_not_of(' '); const auto last = s.find_last_not_of(' '); if (first == std::string::npos || last == std::string::npos) { return std::string(); } return s.substr(first, last - first + 1); } /************************************************************************/ /* pj_load_ini() */ /************************************************************************/ void pj_load_ini(PJ_CONTEXT *ctx) { if (ctx->iniFileLoaded) return; const char *endpoint_from_env = getenv("PROJ_NETWORK_ENDPOINT"); if (endpoint_from_env && endpoint_from_env[0] != '\0') { ctx->endpoint = endpoint_from_env; } ctx->iniFileLoaded = true; auto file = std::unique_ptr( reinterpret_cast(pj_open_lib_internal( ctx, "proj.ini", "rb", pj_open_file_with_manager, nullptr, 0))); if (!file) return; file->seek(0, SEEK_END); const auto filesize = file->tell(); if (filesize == 0 || filesize > 100 * 1024U) return; file->seek(0, SEEK_SET); std::string content; content.resize(static_cast(filesize)); const auto nread = file->read(&content[0], content.size()); if (nread != content.size()) return; content += '\n'; size_t pos = 0; while (pos != std::string::npos) { const auto eol = content.find_first_of("\r\n", pos); if (eol == std::string::npos) { break; } const auto equal = content.find('=', pos); if (equal < eol) { const auto key = trim(content.substr(pos, equal - pos)); const auto value = trim(content.substr(equal + 1, eol - (equal + 1))); if (ctx->endpoint.empty() && key == "cdn_endpoint") { ctx->endpoint = value; } else if (key == "network") { const char *enabled = getenv("PROJ_NETWORK"); if (enabled == nullptr || enabled[0] == '\0') { ctx->networking.enabled = ci_equal(value, "ON") || ci_equal(value, "YES") || ci_equal(value, "TRUE"); } } else if (key == "cache_enabled") { ctx->gridChunkCache.enabled = ci_equal(value, "ON") || ci_equal(value, "YES") || ci_equal(value, "TRUE"); } else if (key == "cache_size_MB") { const int val = atoi(value.c_str()); ctx->gridChunkCache.max_size = val > 0 ? static_cast(val) * 1024 * 1024 : -1; } else if (key == "cache_ttl_sec") { ctx->gridChunkCache.ttl = atoi(value.c_str()); } else if (key == "tmerc_default_algo") { if (value == "auto") { ctx->defaultTmercAlgo = TMercAlgo::AUTO; } else if (value == "evenden_snyder") { ctx->defaultTmercAlgo = TMercAlgo::EVENDEN_SNYDER; } else if (value == "poder_engsager") { ctx->defaultTmercAlgo = TMercAlgo::PODER_ENGSAGER; } else { pj_log( ctx, PJ_LOG_ERROR, "pj_load_ini(): Invalid value for tmerc_default_algo"); } } } pos = content.find_first_not_of("\r\n", eol); } } //! @endcond /************************************************************************/ /* proj_context_set_file_finder() */ /************************************************************************/ /** \brief Assign a file finder callback to a context. * * This callback will be used whenever PROJ must open one of its resource files * (proj.db database, grids, etc...) * * The callback will be called with the context currently in use at the moment * where it is used (not necessarily the one provided during this call), and * with the provided user_data (which may be NULL). * The user_data must remain valid during the whole lifetime of the context. * * A finder set on the default context will be inherited by contexts created * later. * * @param ctx PROJ context, or NULL for the default context. * @param finder Finder callback. May be NULL * @param user_data User data provided to the finder callback. May be NULL. * * @since PROJ 6.0 */ void proj_context_set_file_finder(PJ_CONTEXT *ctx, proj_file_finder finder, void *user_data) { if (!ctx) ctx = pj_get_default_ctx(); if (!ctx) return; ctx->file_finder = finder; ctx->file_finder_user_data = user_data; } /************************************************************************/ /* proj_context_set_search_paths() */ /************************************************************************/ /** \brief Sets search paths. * * Those search paths will be used whenever PROJ must open one of its resource * files * (proj.db database, grids, etc...) * * If set on the default context, they will be inherited by contexts created * later. * * Starting with PROJ 7.0, the path(s) should be encoded in UTF-8. * * @param ctx PROJ context, or NULL for the default context. * @param count_paths Number of paths. 0 if paths == NULL. * @param paths Paths. May be NULL. * * @since PROJ 6.0 */ void proj_context_set_search_paths(PJ_CONTEXT *ctx, int count_paths, const char *const *paths) { if (!ctx) ctx = pj_get_default_ctx(); if (!ctx) return; try { std::vector vector_of_paths; for (int i = 0; i < count_paths; i++) { vector_of_paths.emplace_back(paths[i]); } ctx->set_search_paths(vector_of_paths); } catch (const std::exception &) { } } /************************************************************************/ /* proj_context_set_ca_bundle_path() */ /************************************************************************/ /** \brief Sets CA Bundle path. * * Those CA Bundle path will be used by PROJ when curl and PROJ_NETWORK * are enabled. * * If set on the default context, they will be inherited by contexts created * later. * * The path should be encoded in UTF-8. * * @param ctx PROJ context, or NULL for the default context. * @param path Path. May be NULL. * * @since PROJ 7.2 */ void proj_context_set_ca_bundle_path(PJ_CONTEXT *ctx, const char *path) { if (!ctx) ctx = pj_get_default_ctx(); if (!ctx) return; try { ctx->set_ca_bundle_path(path != nullptr ? path : ""); } catch (const std::exception &) { } } proj-8.2.1/src/pj_list.h000644 000765 000024 00000016557 14140020570 015551 0ustar00keversstaff000000 000000 #ifdef DO_PJ_LIST_ID static const char PJ_LIST_H_ID[] = "@(#)pj_list.h 4.5 95/08/09 GIE REL"; #endif /* Full list of current projections for Tue Jan 11 12:27:04 EST 1994 ** ** Copy this file and retain only appropriate lines for subset list */ PROJ_HEAD(adams_hemi, "Adams Hemisphere in a Square") PROJ_HEAD(adams_ws1, "Adams World in a Square I") PROJ_HEAD(adams_ws2, "Adams World in a Square II") PROJ_HEAD(aea, "Albers Equal Area") PROJ_HEAD(aeqd, "Azimuthal Equidistant") PROJ_HEAD(affine, "Affine transformation") PROJ_HEAD(airy, "Airy") PROJ_HEAD(aitoff, "Aitoff") PROJ_HEAD(alsk, "Modified Stereographic of Alaska") PROJ_HEAD(apian, "Apian Globular I") PROJ_HEAD(august, "August Epicycloidal") PROJ_HEAD(axisswap, "Axis ordering") PROJ_HEAD(bacon, "Bacon Globular") PROJ_HEAD(bertin1953, "Bertin 1953") PROJ_HEAD(bipc, "Bipolar conic of western hemisphere") PROJ_HEAD(boggs, "Boggs Eumorphic") PROJ_HEAD(bonne, "Bonne (Werner lat_1=90)") PROJ_HEAD(calcofi, "Cal Coop Ocean Fish Invest Lines/Stations") PROJ_HEAD(cart, "Geodetic/cartesian conversions") PROJ_HEAD(cass, "Cassini") PROJ_HEAD(cc, "Central Cylindrical") PROJ_HEAD(ccon, "Central Conic") PROJ_HEAD(cea, "Equal Area Cylindrical") PROJ_HEAD(chamb, "Chamberlin Trimetric") PROJ_HEAD(collg, "Collignon") PROJ_HEAD(col_urban, "Colombia Urban") PROJ_HEAD(comill, "Compact Miller") PROJ_HEAD(crast, "Craster Parabolic (Putnins P4)") PROJ_HEAD(defmodel, "Deformation model") PROJ_HEAD(deformation, "Kinematic grid shift") PROJ_HEAD(denoy, "Denoyer Semi-Elliptical") PROJ_HEAD(eck1, "Eckert I") PROJ_HEAD(eck2, "Eckert II") PROJ_HEAD(eck3, "Eckert III") PROJ_HEAD(eck4, "Eckert IV") PROJ_HEAD(eck5, "Eckert V") PROJ_HEAD(eck6, "Eckert VI") PROJ_HEAD(eqearth, "Equal Earth") PROJ_HEAD(eqc, "Equidistant Cylindrical (Plate Carree)") PROJ_HEAD(eqdc, "Equidistant Conic") PROJ_HEAD(euler, "Euler") PROJ_HEAD(etmerc, "Extended Transverse Mercator" ) PROJ_HEAD(fahey, "Fahey") PROJ_HEAD(fouc, "Foucaut") PROJ_HEAD(fouc_s, "Foucaut Sinusoidal") PROJ_HEAD(gall, "Gall (Gall Stereographic)") PROJ_HEAD(geoc, "Geocentric Latitude") PROJ_HEAD(geocent, "Geocentric") PROJ_HEAD(geogoffset, "Geographic Offset") PROJ_HEAD(geos, "Geostationary Satellite View") PROJ_HEAD(gins8, "Ginsburg VIII (TsNIIGAiK)") PROJ_HEAD(gn_sinu, "General Sinusoidal Series") PROJ_HEAD(gnom, "Gnomonic") PROJ_HEAD(goode, "Goode Homolosine") PROJ_HEAD(gs48, "Modified Stereographic of 48 U.S.") PROJ_HEAD(gs50, "Modified Stereographic of 50 U.S.") PROJ_HEAD(guyou, "Guyou") PROJ_HEAD(hammer, "Hammer & Eckert-Greifendorff") PROJ_HEAD(hatano, "Hatano Asymmetrical Equal Area") PROJ_HEAD(healpix, "HEALPix") PROJ_HEAD(rhealpix, "rHEALPix") PROJ_HEAD(helmert, "3- and 7-parameter Helmert shift") PROJ_HEAD(hgridshift, "Horizontal grid shift") PROJ_HEAD(horner, "Horner polynomial evaluation") PROJ_HEAD(igh, "Interrupted Goode Homolosine") PROJ_HEAD(igh_o, "Interrupted Goode Homolosine Oceanic View") PROJ_HEAD(imw_p, "International Map of the World Polyconic") PROJ_HEAD(isea, "Icosahedral Snyder Equal Area") PROJ_HEAD(kav5, "Kavraisky V") PROJ_HEAD(kav7, "Kavraisky VII") PROJ_HEAD(krovak, "Krovak") PROJ_HEAD(labrd, "Laborde") PROJ_HEAD(laea, "Lambert Azimuthal Equal Area") PROJ_HEAD(lagrng, "Lagrange") PROJ_HEAD(larr, "Larrivee") PROJ_HEAD(lask, "Laskowski") PROJ_HEAD(lonlat, "Lat/long (Geodetic)") PROJ_HEAD(latlon, "Lat/long (Geodetic alias)") PROJ_HEAD(latlong, "Lat/long (Geodetic alias)") PROJ_HEAD(longlat, "Lat/long (Geodetic alias)") PROJ_HEAD(lcc, "Lambert Conformal Conic") PROJ_HEAD(lcca, "Lambert Conformal Conic Alternative") PROJ_HEAD(leac, "Lambert Equal Area Conic") PROJ_HEAD(lee_os, "Lee Oblated Stereographic") PROJ_HEAD(loxim, "Loximuthal") PROJ_HEAD(lsat, "Space oblique for LANDSAT") PROJ_HEAD(mbt_s, "McBryde-Thomas Flat-Polar Sine") PROJ_HEAD(mbt_fps, "McBryde-Thomas Flat-Pole Sine (No. 2)") PROJ_HEAD(mbtfpp, "McBride-Thomas Flat-Polar Parabolic") PROJ_HEAD(mbtfpq, "McBryde-Thomas Flat-Polar Quartic") PROJ_HEAD(mbtfps, "McBryde-Thomas Flat-Polar Sinusoidal") PROJ_HEAD(merc, "Mercator") PROJ_HEAD(mil_os, "Miller Oblated Stereographic") PROJ_HEAD(mill, "Miller Cylindrical") PROJ_HEAD(misrsom, "Space oblique for MISR") PROJ_HEAD(moll, "Mollweide") PROJ_HEAD(molobadekas, "Molodensky-Badekas transform") /* implemented in PJ_helmert.c */ PROJ_HEAD(molodensky, "Molodensky transform") PROJ_HEAD(murd1, "Murdoch I") PROJ_HEAD(murd2, "Murdoch II") PROJ_HEAD(murd3, "Murdoch III") PROJ_HEAD(natearth, "Natural Earth") PROJ_HEAD(natearth2, "Natural Earth II") PROJ_HEAD(nell, "Nell") PROJ_HEAD(nell_h, "Nell-Hammer") PROJ_HEAD(nicol, "Nicolosi Globular") PROJ_HEAD(nsper, "Near-sided perspective") PROJ_HEAD(nzmg, "New Zealand Map Grid") PROJ_HEAD(noop, "No operation") PROJ_HEAD(ob_tran, "General Oblique Transformation") PROJ_HEAD(ocea, "Oblique Cylindrical Equal Area") PROJ_HEAD(oea, "Oblated Equal Area") PROJ_HEAD(omerc, "Oblique Mercator") PROJ_HEAD(ortel, "Ortelius Oval") PROJ_HEAD(ortho, "Orthographic") PROJ_HEAD(pconic, "Perspective Conic") PROJ_HEAD(patterson, "Patterson Cylindrical") PROJ_HEAD(peirce_q, "Peirce Quincuncial") PROJ_HEAD(pipeline, "Transformation pipeline manager") PROJ_HEAD(poly, "Polyconic (American)") PROJ_HEAD(pop, "Retrieve coordinate value from pipeline stack") PROJ_HEAD(push, "Save coordinate value on pipeline stack") PROJ_HEAD(putp1, "Putnins P1") PROJ_HEAD(putp2, "Putnins P2") PROJ_HEAD(putp3, "Putnins P3") PROJ_HEAD(putp3p, "Putnins P3'") PROJ_HEAD(putp4p, "Putnins P4'") PROJ_HEAD(putp5, "Putnins P5") PROJ_HEAD(putp5p, "Putnins P5'") PROJ_HEAD(putp6, "Putnins P6") PROJ_HEAD(putp6p, "Putnins P6'") PROJ_HEAD(qua_aut, "Quartic Authalic") PROJ_HEAD(qsc, "Quadrilateralized Spherical Cube") PROJ_HEAD(robin, "Robinson") PROJ_HEAD(rouss, "Roussilhe Stereographic") PROJ_HEAD(rpoly, "Rectangular Polyconic") PROJ_HEAD(s2, "S2") PROJ_HEAD(sch, "Spherical Cross-track Height") PROJ_HEAD(set, "Set coordinate value") PROJ_HEAD(sinu, "Sinusoidal (Sanson-Flamsteed)") PROJ_HEAD(somerc, "Swiss. Obl. Mercator") PROJ_HEAD(stere, "Stereographic") PROJ_HEAD(sterea, "Oblique Stereographic Alternative") PROJ_HEAD(gstmerc, "Gauss-Schreiber Transverse Mercator (aka Gauss-Laborde Reunion)") PROJ_HEAD(tcc, "Transverse Central Cylindrical") PROJ_HEAD(tcea, "Transverse Cylindrical Equal Area") PROJ_HEAD(times, "Times Projection") PROJ_HEAD(tinshift, "Triangulation based transformation") PROJ_HEAD(tissot, "Tissot Conic") PROJ_HEAD(tmerc, "Transverse Mercator") PROJ_HEAD(tobmerc, "Tobler-Mercator") PROJ_HEAD(topocentric, "Geocentric/Topocentric conversion") PROJ_HEAD(tpeqd, "Two Point Equidistant") PROJ_HEAD(tpers, "Tilted perspective") PROJ_HEAD(unitconvert, "Unit conversion") PROJ_HEAD(ups, "Universal Polar Stereographic") PROJ_HEAD(urm5, "Urmaev V") PROJ_HEAD(urmfps, "Urmaev Flat-Polar Sinusoidal") PROJ_HEAD(utm, "Universal Transverse Mercator (UTM)") PROJ_HEAD(vandg, "van der Grinten (I)") PROJ_HEAD(vandg2, "van der Grinten II") PROJ_HEAD(vandg3, "van der Grinten III") PROJ_HEAD(vandg4, "van der Grinten IV") PROJ_HEAD(vitk1, "Vitkovsky I") PROJ_HEAD(vgridshift, "Vertical grid shift") PROJ_HEAD(wag1, "Wagner I (Kavraisky VI)") PROJ_HEAD(wag2, "Wagner II") PROJ_HEAD(wag3, "Wagner III") PROJ_HEAD(wag4, "Wagner IV") PROJ_HEAD(wag5, "Wagner V") PROJ_HEAD(wag6, "Wagner VI") PROJ_HEAD(wag7, "Wagner VII") PROJ_HEAD(webmerc, "Web Mercator / Pseudo Mercator") PROJ_HEAD(weren, "Werenskiold I") PROJ_HEAD(wink1, "Winkel I") PROJ_HEAD(wink2, "Winkel II") PROJ_HEAD(wintri, "Winkel Tripel") PROJ_HEAD(xyzgridshift, "XYZ grid shift") proj-8.2.1/src/strtod.cpp000644 000765 000024 00000015074 13751504466 015772 0ustar00keversstaff000000 000000 /****************************************************************************** * * Derived from GDAL port/cpl_strtod.cpp * Purpose: Functions to convert ASCII string to floating point number. * Author: Andrey Kiselev, dron@ak4719.spb.edu. * ****************************************************************************** * Copyright (c) 2006, Andrey Kiselev * Copyright (c) 2008-2012, Even Rouault * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. ****************************************************************************/ #include #include #include #include #include "proj.h" #include "proj_config.h" #include "proj_internal.h" #define PJ_STRTOD_WORK_BUFFER_SIZE 64 /************************************************************************/ /* pj_atof() */ /************************************************************************/ /** * Converts ASCII string to floating point number. * * This function converts the initial portion of the string pointed to * by nptr to double floating point representation. The behavior is the * same as * * pj_strtod(nptr, (char **)NULL); * * This function does the same as standard atof(3), but does not take * locale in account. That means, the decimal delimiter is always '.' * (decimal point). * * @param nptr Pointer to string to convert. * * @return Converted value. */ double pj_atof( const char* nptr ) { return pj_strtod(nptr, nullptr); } /************************************************************************/ /* replace_point_by_locale_point() */ /************************************************************************/ static char* replace_point_by_locale_point(const char* pszNumber, char point, char* pszWorkBuffer) { #if !defined(HAVE_LOCALECONV) #if defined(_MSC_VER) /* Visual C++ */ #pragma message("localeconv not available") #else #warning "localeconv not available" #endif static char byPoint = 0; if (byPoint == 0) { char szBuf[16]; sprintf(szBuf, "%.1f", 1.0); byPoint = szBuf[1]; } if (point != byPoint) { const char* pszPoint = strchr(pszNumber, point); if (pszPoint) { char* pszNew; if( strlen(pszNumber) < PJ_STRTOD_WORK_BUFFER_SIZE ) { strcpy(pszWorkBuffer, pszNumber); pszNew = pszWorkBuffer; } else { pszNew = pj_strdup(pszNumber); if (!pszNew) return NULL; } pszNew[pszPoint - pszNumber] = byPoint; return pszNew; } } #else struct lconv *poLconv = localeconv(); if ( poLconv && poLconv->decimal_point && poLconv->decimal_point[0] != '\0' ) { char byPoint = poLconv->decimal_point[0]; if (point != byPoint) { const char* pszLocalePoint = strchr(pszNumber, byPoint); const char* pszPoint = strchr(pszNumber, point); if (pszPoint || pszLocalePoint) { char* pszNew; if( strlen(pszNumber) < PJ_STRTOD_WORK_BUFFER_SIZE ) { strcpy(pszWorkBuffer, pszNumber); pszNew = pszWorkBuffer; } else { pszNew = pj_strdup(pszNumber); if (!pszNew) return nullptr; } if( pszLocalePoint ) pszNew[pszLocalePoint - pszNumber] = ' '; if( pszPoint ) pszNew[pszPoint - pszNumber] = byPoint; return pszNew; } } } #endif return (char*) pszNumber; } /************************************************************************/ /* pj_strtod() */ /************************************************************************/ /** * Converts ASCII string to floating point number. * * This function converts the initial portion of the string pointed to * by nptr to double floating point representation. This function does the * same as standard strtod(3), but does not take locale in account and use * decimal point. * * @param nptr Pointer to string to convert. * @param endptr If is not NULL, a pointer to the character after the last * character used in the conversion is stored in the location referenced * by endptr. * * @return Converted value. */ double pj_strtod( const char *nptr, char **endptr ) { /* -------------------------------------------------------------------- */ /* We are implementing a simple method here: copy the input string */ /* into the temporary buffer, replace the specified decimal delimiter */ /* with the one, taken from locale settings and use standard strtod() */ /* on that buffer. */ /* -------------------------------------------------------------------- */ double dfValue; int nError; char szWorkBuffer[PJ_STRTOD_WORK_BUFFER_SIZE]; char* pszNumber = replace_point_by_locale_point(nptr, '.', szWorkBuffer); dfValue = strtod( pszNumber, endptr ); nError = errno; if ( endptr ) *endptr = (char *)nptr + (*endptr - pszNumber); if (pszNumber != (char*) nptr && pszNumber != szWorkBuffer ) free( pszNumber ); errno = nError; return dfValue; } proj-8.2.1/src/mlfn.hpp000644 000765 000024 00000005000 14017154140 015362 0ustar00keversstaff000000 000000 #ifndef MLFN_HPP #define MLFN_HPP /* meridional distance for ellipsoid and inverse ** 8th degree - accurate to < 1e-5 meters when used in conjunction ** with typical major axis values. ** Inverse determines phi to EPS (1e-11) radians, about 1e-6 seconds. */ inline static double inline_pj_mlfn(double phi, double sphi, double cphi, const double *en) { cphi *= sphi; sphi *= sphi; return(en[0] * phi - cphi * (en[1] + sphi*(en[2] + sphi*(en[3] + sphi*en[4])))); } inline static double inline_pj_inv_mlfn(PJ_CONTEXT *ctx, double arg, double es, const double *en, double* sinphi, double* cosphi) { const double k = 1./(1.-es); constexpr double INV_MLFN_EPS = 1e-11; constexpr int INV_MFN_MAX_ITER = 10; double phi = arg; double s = sin(phi); double c = cos(phi); for (int i = INV_MFN_MAX_ITER; i ; --i) { /* rarely goes over 2 iterations */ double t = 1. - es * s * s; t = (inline_pj_mlfn(phi, s, c, en) - arg) * (t * sqrt(t)) * k; phi -= t; if (fabs(t) < INV_MLFN_EPS) { // Instead of recomputing sin(phi), cos(phi) from scratch, // use sin(phi-t) and cos(phi-t) approximate formulas with // 1-term approximation of sin(t) and cos(t) *sinphi = s - c * t; *cosphi = c + s * t; return phi; } if (fabs(t) < 1e-3) { // 2-term approximation of sin(t) and cos(t) // Max relative error is 4e-14 on cos(t), and 8e-15 on sin(t) const double t2 = t * t; const double cos_t = 1 - 0.5 * t2; const double sin_t = t * (1 - (1. / 6) * t2); const double s_new = s * cos_t - c * sin_t; c = c * cos_t + s * sin_t; s = s_new; } else if (fabs(t) < 1e-2) { // 3-term approximation of sin(t) and cos(t) // Max relative error is 2e-15 on cos(t), and 2e-16 on sin(t) const double t2 = t * t; const double cos_t = 1 - 0.5 * t2 * (1 - (1. / 12) * t2); const double sin_t = t * (1 - (1. / 6) * t2 * (1 - (1. / 20) * t2)); const double s_new = s * cos_t - c * sin_t; c = c * cos_t + s * sin_t; s = s_new; } else { s = sin(phi); c = cos(phi); } } *sinphi = s; *cosphi = c; proj_context_errno_set( ctx, PROJ_ERR_COORD_TRANSFM_OUTSIDE_PROJECTION_DOMAIN ); return phi; } #endif // MLFN_HPP proj-8.2.1/src/proj_json_streaming_writer.hpp000644 000765 000024 00000012311 13612256475 022117 0ustar00keversstaff000000 000000 /****************************************************************************** * * Project: CPL - Common Portability Library * Purpose: JSon streaming writer * Author: Even Rouault, even.rouault at spatialys.com * ****************************************************************************** * Copyright (c) 2019, Even Rouault * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. ****************************************************************************/ #ifndef PROJ_JSON_STREAMING_WRITER_H #define PROJ_JSON_STREAMING_WRITER_H /*! @cond Doxygen_Suppress */ #include #include #define CPL_DLL #include "proj/util.hpp" NS_PROJ_START typedef std::int64_t GIntBig; typedef std::uint64_t GUInt64; class CPL_DLL CPLJSonStreamingWriter { public: typedef void (*SerializationFuncType)(const char* pszTxt, void* pUserData); private: CPLJSonStreamingWriter(const CPLJSonStreamingWriter&) = delete; CPLJSonStreamingWriter& operator=(const CPLJSonStreamingWriter&) = delete; std::string m_osStr{}; SerializationFuncType m_pfnSerializationFunc = nullptr; void* m_pUserData = nullptr; bool m_bPretty = true; std::string m_osIndent = std::string(" "); std::string m_osIndentAcc{}; int m_nLevel = 0; bool m_bNewLineEnabled = true; struct State { bool bIsObj = false; bool bFirstChild = true; explicit State(bool bIsObjIn): bIsObj(bIsObjIn) {} }; std::vector m_states{}; bool m_bWaitForValue = false; void Print(const std::string& text); void IncIndent(); void DecIndent(); static std::string FormatString(const std::string& str); void EmitCommaIfNeeded(); public: CPLJSonStreamingWriter(SerializationFuncType pfnSerializationFunc, void* pUserData); ~CPLJSonStreamingWriter(); void SetPrettyFormatting(bool bPretty) { m_bPretty = bPretty; } void SetIndentationSize(int nSpaces); // cppcheck-suppress functionStatic const std::string& GetString() const { return m_osStr; } void Add(const std::string& str); void Add(const char* pszStr); void Add(bool bVal); void Add(int nVal) { Add(static_cast(nVal)); } void Add(unsigned int nVal) { Add(static_cast(nVal)); } void Add(GIntBig nVal); void Add(GUInt64 nVal); void Add(float fVal, int nPrecision = 9); void Add(double dfVal, int nPrecision = 18); void AddNull(); void StartObj(); void EndObj(); void AddObjKey(const std::string& key); struct CPL_DLL ObjectContext { CPLJSonStreamingWriter& m_serializer; ObjectContext(const ObjectContext &) = delete; ObjectContext(ObjectContext&&) = default; explicit inline ObjectContext(CPLJSonStreamingWriter& serializer): m_serializer(serializer) { m_serializer.StartObj(); } ~ObjectContext() { m_serializer.EndObj(); } }; inline ObjectContext MakeObjectContext() { return ObjectContext(*this); } void StartArray(); void EndArray(); struct CPL_DLL ArrayContext { CPLJSonStreamingWriter& m_serializer; bool m_bForceSingleLine; bool m_bNewLineEnabledBackup; ArrayContext(const ArrayContext &) = delete; ArrayContext(ArrayContext&&) = default; inline explicit ArrayContext(CPLJSonStreamingWriter& serializer, bool bForceSingleLine = false): m_serializer(serializer), m_bForceSingleLine(bForceSingleLine), m_bNewLineEnabledBackup(serializer.GetNewLine()) { if( m_bForceSingleLine ) serializer.SetNewline(false); m_serializer.StartArray(); } ~ArrayContext() { m_serializer.EndArray(); if( m_bForceSingleLine ) m_serializer.SetNewline(m_bNewLineEnabledBackup); } }; inline ArrayContext MakeArrayContext(bool bForceSingleLine = false) { return ArrayContext(*this, bForceSingleLine); } bool GetNewLine() const { return m_bNewLineEnabled; } void SetNewline(bool bEnabled) { m_bNewLineEnabled = bEnabled; } }; NS_PROJ_END /*! @endcond */ #endif // PROJ_JSON_STREAMING_WRITER_H proj-8.2.1/src/sqlite3_utils.hpp000644 000765 000024 00000010065 13747523460 017257 0ustar00keversstaff000000 000000 /****************************************************************************** * Project: PROJ * Purpose: SQLite3 related utilities * Author: Even Rouault, * ****************************************************************************** * Copyright (c) 2019, Even Rouault, * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. *****************************************************************************/ #ifndef SQLITE3_HPP_INCLUDED #define SQLITE3_HPP_INCLUDED #include #include #include "proj.h" #include "proj/util.hpp" NS_PROJ_START //! @cond Doxygen_Suppress // --------------------------------------------------------------------------- struct pj_sqlite3_vfs : public sqlite3_vfs { std::string namePtr{}; bool fakeSync = false; bool fakeLock = false; }; // --------------------------------------------------------------------------- class SQLite3VFS { pj_sqlite3_vfs *vfs_ = nullptr; explicit SQLite3VFS(pj_sqlite3_vfs *vfs); SQLite3VFS(const SQLite3VFS &) = delete; SQLite3VFS &operator=(const SQLite3VFS &) = delete; public: ~SQLite3VFS(); static std::unique_ptr create(bool fakeSync, bool fakeLock, bool skipStatJournalAndWAL); const char *name() const; sqlite3_vfs *raw() { return vfs_; } }; // --------------------------------------------------------------------------- class SQLiteStatement { sqlite3_stmt *hStmt = nullptr; int iBindIdx = 1; int iResIdx = 0; SQLiteStatement(const SQLiteStatement &) = delete; SQLiteStatement &operator=(const SQLiteStatement &) = delete; public: explicit SQLiteStatement(sqlite3_stmt *hStmtIn); ~SQLiteStatement() { sqlite3_finalize(hStmt); } int execute() { return sqlite3_step(hStmt); } void bindNull() { sqlite3_bind_null(hStmt, iBindIdx); iBindIdx++; } void bindText(const char *txt) { sqlite3_bind_text(hStmt, iBindIdx, txt, -1, nullptr); iBindIdx++; } void bindInt64(sqlite3_int64 v) { sqlite3_bind_int64(hStmt, iBindIdx, v); iBindIdx++; } void bindBlob(const void *blob, size_t blob_size) { sqlite3_bind_blob(hStmt, iBindIdx, blob, static_cast(blob_size), nullptr); iBindIdx++; } const char *getText() { auto ret = sqlite3_column_text(hStmt, iResIdx); iResIdx++; return reinterpret_cast(ret); } sqlite3_int64 getInt64() { auto ret = sqlite3_column_int64(hStmt, iResIdx); iResIdx++; return ret; } const void *getBlob(int &size) { size = sqlite3_column_bytes(hStmt, iResIdx); auto ret = sqlite3_column_blob(hStmt, iResIdx); iResIdx++; return ret; } void reset() { sqlite3_reset(hStmt); iBindIdx = 1; iResIdx = 0; } void resetResIndex() { iResIdx = 0; } }; //! @endcond Doxygen_Suppress NS_PROJ_END #endif // SQLITE3_HPP_INCLUDED proj-8.2.1/src/wkt2_parser.cpp000644 000765 000024 00000021534 13612256475 016714 0ustar00keversstaff000000 000000 /****************************************************************************** * Project: PROJ * Purpose: WKT2 parser grammar * Author: Even Rouault, * ****************************************************************************** * Copyright (c) 2018 Even Rouault, * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. ****************************************************************************/ #ifndef FROM_PROJ_CPP #define FROM_PROJ_CPP #endif #include "proj/internal/internal.hpp" #include #include #include #include #include "wkt2_parser.h" #include "wkt_parser.hpp" using namespace NS_PROJ::internal; //! @cond Doxygen_Suppress // --------------------------------------------------------------------------- struct pj_wkt2_parse_context : public pj_wkt_parse_context {}; // --------------------------------------------------------------------------- void pj_wkt2_error(pj_wkt2_parse_context *context, const char *msg) { pj_wkt_error(context, msg); } // --------------------------------------------------------------------------- std::string pj_wkt2_parse(const std::string &wkt) { pj_wkt2_parse_context context; context.pszInput = wkt.c_str(); context.pszLastSuccess = wkt.c_str(); context.pszNext = wkt.c_str(); if (pj_wkt2_parse(&context) != 0) { return context.errorMsg; } return std::string(); } // --------------------------------------------------------------------------- typedef struct { const char *pszToken; int nTokenVal; } wkt2_tokens; #define PAIR(X) \ { #X, T_##X } static const wkt2_tokens tokens[] = { PAIR(PARAMETER), PAIR(PROJECTION), PAIR(DATUM), PAIR(SPHEROID), PAIR(PRIMEM), PAIR(UNIT), PAIR(AXIS), PAIR(GEODCRS), PAIR(LENGTHUNIT), PAIR(ANGLEUNIT), PAIR(SCALEUNIT), PAIR(TIMEUNIT), PAIR(ELLIPSOID), PAIR(CS), PAIR(ID), PAIR(PROJCRS), PAIR(BASEGEODCRS), PAIR(MERIDIAN), PAIR(BEARING), PAIR(ORDER), PAIR(ANCHOR), PAIR(CONVERSION), PAIR(METHOD), PAIR(REMARK), PAIR(GEOGCRS), PAIR(BASEGEOGCRS), PAIR(SCOPE), PAIR(AREA), PAIR(BBOX), PAIR(CITATION), PAIR(URI), PAIR(VERTCRS), PAIR(VDATUM), PAIR(GEOIDMODEL), PAIR(COMPOUNDCRS), PAIR(PARAMETERFILE), PAIR(COORDINATEOPERATION), PAIR(SOURCECRS), PAIR(TARGETCRS), PAIR(INTERPOLATIONCRS), PAIR(OPERATIONACCURACY), PAIR(CONCATENATEDOPERATION), PAIR(STEP), PAIR(BOUNDCRS), PAIR(ABRIDGEDTRANSFORMATION), PAIR(DERIVINGCONVERSION), PAIR(TDATUM), PAIR(CALENDAR), PAIR(TIMEORIGIN), PAIR(TIMECRS), PAIR(VERTICALEXTENT), PAIR(TIMEEXTENT), PAIR(USAGE), PAIR(DYNAMIC), PAIR(FRAMEEPOCH), PAIR(MODEL), PAIR(VELOCITYGRID), PAIR(ENSEMBLE), PAIR(MEMBER), PAIR(ENSEMBLEACCURACY), PAIR(DERIVEDPROJCRS), PAIR(BASEPROJCRS), PAIR(EDATUM), PAIR(ENGCRS), PAIR(PDATUM), PAIR(PARAMETRICCRS), PAIR(PARAMETRICUNIT), PAIR(BASEVERTCRS), PAIR(BASEENGCRS), PAIR(BASEPARAMCRS), PAIR(BASETIMECRS), PAIR(GEODETICCRS), PAIR(GEODETICDATUM), PAIR(PROJECTEDCRS), PAIR(PRIMEMERIDIAN), PAIR(GEOGRAPHICCRS), PAIR(TRF), PAIR(VERTICALCRS), PAIR(VERTICALDATUM), PAIR(VRF), PAIR(TIMEDATUM), PAIR(TEMPORALQUANTITY), PAIR(ENGINEERINGDATUM), PAIR(ENGINEERINGCRS), PAIR(PARAMETRICDATUM), PAIR(EPOCH), PAIR(COORDEPOCH), PAIR(COORDINATEMETADATA), PAIR(POINTMOTIONOPERATION), PAIR(VERSION), // CS types PAIR(AFFINE), PAIR(CARTESIAN), PAIR(CYLINDRICAL), PAIR(ELLIPSOIDAL), PAIR(LINEAR), PAIR(PARAMETRIC), PAIR(POLAR), PAIR(SPHERICAL), PAIR(VERTICAL), PAIR(TEMPORAL), PAIR(TEMPORALCOUNT), PAIR(TEMPORALMEASURE), PAIR(ORDINAL), PAIR(TEMPORALDATETIME), // Axis directions PAIR(NORTH), PAIR(NORTHNORTHEAST), PAIR(NORTHEAST), PAIR(EASTNORTHEAST), PAIR(EAST), PAIR(EASTSOUTHEAST), PAIR(SOUTHEAST), PAIR(SOUTHSOUTHEAST), PAIR(SOUTH), PAIR(SOUTHSOUTHWEST), PAIR(SOUTHWEST), PAIR(WESTSOUTHWEST), PAIR(WEST), PAIR(WESTNORTHWEST), PAIR(NORTHWEST), PAIR(NORTHNORTHWEST), PAIR(UP), PAIR(DOWN), PAIR(GEOCENTRICX), PAIR(GEOCENTRICY), PAIR(GEOCENTRICZ), PAIR(COLUMNPOSITIVE), PAIR(COLUMNNEGATIVE), PAIR(ROWPOSITIVE), PAIR(ROWNEGATIVE), PAIR(DISPLAYRIGHT), PAIR(DISPLAYLEFT), PAIR(DISPLAYUP), PAIR(DISPLAYDOWN), PAIR(FORWARD), PAIR(AFT), PAIR(PORT), PAIR(STARBOARD), PAIR(CLOCKWISE), PAIR(COUNTERCLOCKWISE), PAIR(TOWARDS), PAIR(AWAYFROM), PAIR(FUTURE), PAIR(PAST), PAIR(UNSPECIFIED), }; // --------------------------------------------------------------------------- int pj_wkt2_lex(YYSTYPE * /*pNode */, pj_wkt2_parse_context *context) { size_t i; const char *pszInput = context->pszNext; /* -------------------------------------------------------------------- */ /* Skip white space. */ /* -------------------------------------------------------------------- */ while (*pszInput == ' ' || *pszInput == '\t' || *pszInput == 10 || *pszInput == 13) pszInput++; context->pszLastSuccess = pszInput; if (*pszInput == '\0') { context->pszNext = pszInput; return EOF; } /* -------------------------------------------------------------------- */ /* Recognize node names. */ /* -------------------------------------------------------------------- */ if (isalpha(*pszInput)) { for (i = 0; i < sizeof(tokens) / sizeof(tokens[0]); i++) { if (ci_starts_with(pszInput, tokens[i].pszToken) && !isalpha(pszInput[strlen(tokens[i].pszToken)])) { context->pszNext = pszInput + strlen(tokens[i].pszToken); return tokens[i].nTokenVal; } } } /* -------------------------------------------------------------------- */ /* Recognize unsigned integer */ /* -------------------------------------------------------------------- */ if (*pszInput >= '0' && *pszInput <= '9') { // Special case for 1, 2, 3 if ((*pszInput == '1' || *pszInput == '2' || *pszInput == '3') && !(pszInput[1] >= '0' && pszInput[1] <= '9')) { context->pszNext = pszInput + 1; return *pszInput; } pszInput++; while (*pszInput >= '0' && *pszInput <= '9') pszInput++; context->pszNext = pszInput; return T_UNSIGNED_INTEGER_DIFFERENT_ONE_TWO_THREE; } /* -------------------------------------------------------------------- */ /* Recognize double quoted strings. */ /* -------------------------------------------------------------------- */ if (*pszInput == '"') { pszInput++; while (*pszInput != '\0') { if (*pszInput == '"') { if (pszInput[1] == '"') pszInput++; else break; } pszInput++; } if (*pszInput == '\0') { context->pszNext = pszInput; return EOF; } context->pszNext = pszInput + 1; return T_STRING; } // As used in examples of OGC 12-063r5 const char *startPrintedQuote = "\xE2\x80\x9C"; const char *endPrintedQuote = "\xE2\x80\x9D"; if (strncmp(pszInput, startPrintedQuote, 3) == 0) { context->pszNext = strstr(pszInput, endPrintedQuote); if (context->pszNext == nullptr) { context->pszNext = pszInput + strlen(pszInput); return EOF; } context->pszNext += 3; return T_STRING; } /* -------------------------------------------------------------------- */ /* Handle special tokens. */ /* -------------------------------------------------------------------- */ context->pszNext = pszInput + 1; return *pszInput; } //! @endcond proj-8.2.1/src/check_md5sum.cmake000644 000765 000024 00000000436 14140020570 017272 0ustar00keversstaff000000 000000 file(READ "${IN_FILE}" CONTENTS) string(MD5 MD5SUM "${CONTENTS}") if(NOT("${MD5SUM}" STREQUAL "${EXPECTED_MD5SUM}")) message(FATAL_ERROR "File ${IN_FILE} has been modified. target ${TARGET} should be manually run. And lib_proj.cmake should be updated with \"${MD5SUM}\"") endif() proj-8.2.1/src/wkt2_grammar.y000644 000765 000024 00000170434 14017154140 016522 0ustar00keversstaff000000 000000 %{ /****************************************************************************** * Project: PROJ * Purpose: WKT2 parser grammar * Author: Even Rouault, * ****************************************************************************** * Copyright (c) 2018 Even Rouault, * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. ****************************************************************************/ #include "wkt2_parser.h" %} %define api.pure %define parse.error verbose %require "3.0" %parse-param {pj_wkt2_parse_context *context} %lex-param {pj_wkt2_parse_context *context} /* From WKT1 */ %token T_PROJECTION "PROJECTION" %token T_DATUM "DATUM" %token T_SPHEROID "SPHEROID" %token T_PRIMEM "PRIMEM" %token T_UNIT "UNIT" %token T_AXIS "AXIS" %token T_PARAMETER "PARAMETER" /* WKT2 preferred */ %token T_GEODCRS "GEODCRS"; %token T_LENGTHUNIT "LENGTHUNIT"; %token T_ANGLEUNIT "ANGLEUNIT"; %token T_SCALEUNIT "SCALEUNIT"; %token T_TIMEUNIT "TIMEUNIT"; %token T_ELLIPSOID "ELLIPSOID"; %token T_CS "CS"; %token T_ID "ID"; %token T_PROJCRS "PROJCRS"; %token T_BASEGEODCRS "BASEGEODCRS"; %token T_MERIDIAN "MERIDIAN"; %token T_BEARING "BEARING"; %token T_ORDER "ORDER"; %token T_ANCHOR "ANCHOR"; %token T_CONVERSION "CONVERSION"; %token T_METHOD "METHOD"; %token T_REMARK "REMARK"; %token T_GEOGCRS "GEOGCRS"; %token T_BASEGEOGCRS "BASEGEOGCRS"; %token T_SCOPE "SCOPE"; %token T_AREA "AREA"; %token T_BBOX "BBOX"; %token T_CITATION "CITATION"; %token T_URI "URI"; %token T_VERTCRS "VERTCRS"; %token T_VDATUM "VDATUM"; %token T_GEOIDMODEL "GEOIDMODEL"; %token T_COMPOUNDCRS "COMPOUNDCRS"; %token T_PARAMETERFILE "PARAMETERFILE"; %token T_COORDINATEOPERATION "COORDINATEOPERATION"; %token T_SOURCECRS "SOURCECRS"; %token T_TARGETCRS "TARGETCRS"; %token T_INTERPOLATIONCRS "INTERPOLATIONCRS"; %token T_OPERATIONACCURACY "OPERATIONACCURACY"; %token T_CONCATENATEDOPERATION "CONCATENATEDOPERATION"; %token T_STEP "STEP"; %token T_BOUNDCRS "BOUNDCRS"; %token T_ABRIDGEDTRANSFORMATION "ABRIDGEDTRANSFORMATION"; %token T_DERIVINGCONVERSION "DERIVINGCONVERSION"; %token T_TDATUM "TDATUM"; %token T_CALENDAR "CALENDAR"; %token T_TIMEORIGIN "TIMEORIGIN"; %token T_TIMECRS "TIMECRS"; %token T_VERTICALEXTENT "VERTICALEXTENT"; %token T_TIMEEXTENT "TIMEEXTENT"; %token T_USAGE "USAGE"; %token T_DYNAMIC "DYNAMIC"; %token T_FRAMEEPOCH "FRAMEEPOCH"; %token T_MODEL "MODEL"; %token T_VELOCITYGRID "VELOCITYGRID"; %token T_ENSEMBLE "ENSEMBLE"; %token T_MEMBER "MEMBER"; %token T_ENSEMBLEACCURACY "ENSEMBLEACCURACY"; %token T_DERIVEDPROJCRS "DERIVEDPROJCRS"; %token T_BASEPROJCRS "BASEPROJCRS"; %token T_EDATUM "EDATUM"; %token T_ENGCRS "ENGCRS"; %token T_PDATUM "PDATUM"; %token T_PARAMETRICCRS "PARAMETRICCRS"; %token T_PARAMETRICUNIT "PARAMETRICUNIT"; %token T_BASEVERTCRS "BASEVERTCRS"; %token T_BASEENGCRS "BASEENGCRS"; %token T_BASEPARAMCRS "BASEPARAMCRS"; %token T_BASETIMECRS "BASETIMECRS"; %token T_EPOCH "EPOCH" %token T_COORDEPOCH "COORDEPOCH" %token T_COORDINATEMETADATA "COORDINATEMETADATA" %token T_POINTMOTIONOPERATION "POINTMOTIONOPERATION" %token T_VERSION "VERSION" /* WKT2 alternate (longer or shorter) */ %token T_GEODETICCRS "GEODETICCRS"; %token T_GEODETICDATUM "GEODETICDATUM"; %token T_PROJECTEDCRS "PROJECTEDCRS"; %token T_PRIMEMERIDIAN "PRIMEMERIDIAN"; %token T_GEOGRAPHICCRS "GEOGRAPHICCRS"; %token T_TRF "TRF"; %token T_VERTICALCRS "VERTICALCRS"; %token T_VERTICALDATUM "VERTICALDATUM"; %token T_VRF "VRF"; %token T_TIMEDATUM "TIMEDATUM"; %token T_TEMPORALQUANTITY "TEMPORALQUANTITY"; %token T_ENGINEERINGDATUM "ENGINEERINGDATUM"; %token T_ENGINEERINGCRS "ENGINEERINGCRS"; %token T_PARAMETRICDATUM "PARAMETRICDATUM"; /* CS types */ %token T_AFFINE "affine"; %token T_CARTESIAN "Cartesian"; %token T_CYLINDRICAL "cylindrical"; %token T_ELLIPSOIDAL "ellipsoidal"; %token T_LINEAR "linear"; %token T_PARAMETRIC "parametric"; %token T_POLAR "polar"; %token T_SPHERICAL "spherical"; %token T_VERTICAL "vertical"; %token T_TEMPORAL "temporal"; // WKT2_2015 only %token T_TEMPORALCOUNT "temporalCount"; %token T_TEMPORALMEASURE "temporalMeasure"; %token T_ORDINAL "ordinal"; %token T_TEMPORALDATETIME "temporalDateTime"; /* Axis directions */ %token T_NORTH "north"; %token T_NORTHNORTHEAST "northNorthEast"; %token T_NORTHEAST "northEast"; %token T_EASTNORTHEAST "eastNorthEast"; %token T_EAST "east"; %token T_EASTSOUTHEAST "eastSouthEast"; %token T_SOUTHEAST "southEast"; %token T_SOUTHSOUTHEAST "southSouthEast"; %token T_SOUTH "south"; %token T_SOUTHSOUTHWEST "southSouthWest"; %token T_SOUTHWEST "southWest"; %token T_WESTSOUTHWEST "westSouthWest"; %token T_WEST "west"; %token T_WESTNORTHWEST "westNorthWest"; %token T_NORTHWEST "northWest"; %token T_NORTHNORTHWEST "northNorthWest"; %token T_UP "up"; %token T_DOWN "down"; %token T_GEOCENTRICX "geocentricX"; %token T_GEOCENTRICY "geocentricY"; %token T_GEOCENTRICZ "geocentricZ"; %token T_COLUMNPOSITIVE "columnPositive"; %token T_COLUMNNEGATIVE "columnNegative"; %token T_ROWPOSITIVE "rowPositive"; %token T_ROWNEGATIVE "rowNegative"; %token T_DISPLAYRIGHT "displayRight"; %token T_DISPLAYLEFT "displayLeft"; %token T_DISPLAYUP "displayUp"; %token T_DISPLAYDOWN "displayDown"; %token T_FORWARD "forward"; %token T_AFT "aft"; %token T_PORT "port"; %token T_STARBOARD "starboard"; %token T_CLOCKWISE "clockwise"; %token T_COUNTERCLOCKWISE "counterClockwise"; %token T_TOWARDS "towards"; %token T_AWAYFROM "awayFrom"; %token T_FUTURE "future"; %token T_PAST "part"; %token T_UNSPECIFIED "unspecified"; %token T_STRING "string" %token T_UNSIGNED_INTEGER_DIFFERENT_ONE_TWO_THREE "unsigned integer" %token END 0 "end of string" %% /* Derived from BNF grammar in OGC 18-010r3 (WKT2:2018), with a few back additions from GC 12-063r5 (WKT2:2015) */ input: identifier | ellipsoid | datum | crs | bound_crs | coordinate_metadata | coordinate_operation | point_motion_operation | concatenated_operation | map_projection datum: geodetic_reference_frame_with_opt_pm | datum_ensemble | vertical_reference_frame | engineering_datum | parametric_datum | temporal_datum crs: single_crs | compound_crs // Basic characters period: '.' // Numbers number: signed_numeric_literal_with_sign | unsigned_numeric_literal signed_numeric_literal_with_sign: sign unsigned_numeric_literal signed_numeric_literal: opt_sign unsigned_numeric_literal unsigned_numeric_literal: exact_numeric_literal | approximate_numeric_literal opt_sign: | sign approximate_numeric_literal: mantissa 'E' exponent mantissa: exact_numeric_literal exponent: signed_integer signed_integer: opt_sign unsigned_integer exact_numeric_literal: unsigned_integer opt_period_unsigned_integer | period unsigned_integer opt_period_unsigned_integer: | period unsigned_integer unsigned_integer: '1' | '2' | '3' | T_UNSIGNED_INTEGER_DIFFERENT_ONE_TWO_THREE sign: '+' | '-' // Date and time colon: ':' hyphen: '-' // Significantly modified to avoid shift-reduce ambiguities for Bison datetime: year opt_24_hour_clock | year hyphen unsigned_integer opt_24_hour_clock | year hyphen month hyphen day opt_24_hour_clock opt_24_hour_clock: | _24_hour_clock year: unsigned_integer month: unsigned_integer day: unsigned_integer _24_hour_clock: time_designator hour opt_colon_minute_colon_second_time_zone_designator opt_colon_minute_colon_second_time_zone_designator: colon minute opt_colon_second_time_zone_designator | time_zone_designator opt_colon_second_time_zone_designator: colon second_time_zone_designator | time_zone_designator time_designator: 'T' hour: unsigned_integer minute: unsigned_integer second_time_zone_designator: seconds_integer period time_zone_designator | seconds_integer period seconds_fraction time_zone_designator | seconds_integer time_zone_designator seconds_integer: unsigned_integer seconds_fraction: unsigned_integer time_zone_designator: utc_designator | local_time_zone_designator utc_designator: 'Z' local_time_zone_designator: sign hour opt_colon_minute | hour opt_colon_minute opt_colon_minute: | colon minute // CRS WKT characters left_delimiter: '[' | '(' right_delimiter: ']' | ')' wkt_separator: ',' quoted_latin_text: T_STRING quoted_unicode_text: T_STRING // Scope, extent, identifier and remark opt_separator_scope_extent_identifier_remark: | wkt_separator no_opt_separator_scope_extent_identifier_remark no_opt_separator_scope_extent_identifier_remark: scope_extent_opt_identifier_list_opt_remark | identifier opt_identifier_list_remark | remark opt_identifier_list_remark: | wkt_separator identifier opt_identifier_list_remark | wkt_separator remark scope_extent_opt_identifier_list_opt_remark: scope_extent_opt_identifier_list_remark | usage_list_opt_identifier_list_remark // WKT2-2015 way scope_extent_opt_identifier_list_remark: scope wkt_separator extent_opt_identifier_list_remark | scope opt_identifier_list_remark | extent_opt_identifier_list_remark // WKT2-2018 way usage_list_opt_identifier_list_remark: usage | usage wkt_separator remark | usage wkt_separator identifier opt_identifier_list_remark | usage wkt_separator usage_list_opt_identifier_list_remark usage: usage_keyword left_delimiter scope wkt_separator extent right_delimiter usage_keyword: T_USAGE scope: scope_keyword left_delimiter scope_text_description right_delimiter scope_keyword: T_SCOPE scope_text_description: quoted_latin_text extent: area_description | geographic_bounding_box | vertical_extent | temporal_extent | area_description wkt_separator geographic_bounding_box | area_description wkt_separator vertical_extent | area_description wkt_separator temporal_extent | geographic_bounding_box wkt_separator vertical_extent | geographic_bounding_box wkt_separator temporal_extent | vertical_extent wkt_separator temporal_extent | area_description wkt_separator geographic_bounding_box wkt_separator vertical_extent | area_description wkt_separator geographic_bounding_box wkt_separator temporal_extent | area_description wkt_separator vertical_extent wkt_separator temporal_extent | geographic_bounding_box wkt_separator vertical_extent wkt_separator temporal_extent | area_description wkt_separator geographic_bounding_box wkt_separator vertical_extent wkt_separator temporal_extent extent_opt_identifier_list_remark: area_description opt_identifier_list_remark | geographic_bounding_box opt_identifier_list_remark | vertical_extent opt_identifier_list_remark | temporal_extent opt_identifier_list_remark | area_description wkt_separator geographic_bounding_box opt_identifier_list_remark | area_description wkt_separator vertical_extent opt_identifier_list_remark | area_description wkt_separator temporal_extent opt_identifier_list_remark | geographic_bounding_box wkt_separator vertical_extent opt_identifier_list_remark | geographic_bounding_box wkt_separator temporal_extent opt_identifier_list_remark | vertical_extent wkt_separator temporal_extent opt_identifier_list_remark | area_description wkt_separator geographic_bounding_box wkt_separator vertical_extent opt_identifier_list_remark | area_description wkt_separator geographic_bounding_box wkt_separator temporal_extent opt_identifier_list_remark | area_description wkt_separator vertical_extent wkt_separator temporal_extent opt_identifier_list_remark | geographic_bounding_box wkt_separator vertical_extent wkt_separator temporal_extent opt_identifier_list_remark | area_description wkt_separator geographic_bounding_box wkt_separator vertical_extent wkt_separator temporal_extent opt_identifier_list_remark // Area description area_description: area_description_keyword left_delimiter area_text_description right_delimiter area_description_keyword: T_AREA area_text_description: quoted_latin_text // Geographic bounding box geographic_bounding_box: geographic_bounding_box_keyword left_delimiter lower_left_latitude wkt_separator lower_left_longitude wkt_separator upper_right_latitude wkt_separator upper_right_longitude right_delimiter geographic_bounding_box_keyword: T_BBOX lower_left_latitude: number lower_left_longitude: number upper_right_latitude: number upper_right_longitude: number // Vertical extent vertical_extent: vertical_extent_keyword left_delimiter vertical_extent_minimum_height wkt_separator vertical_extent_maximum_height opt_separator_length_unit right_delimiter opt_separator_length_unit: | wkt_separator length_unit vertical_extent_keyword: T_VERTICALEXTENT vertical_extent_minimum_height: number vertical_extent_maximum_height: number // Temporal extent temporal_extent: temporal_extent_keyword left_delimiter temporal_extent_start wkt_separator temporal_extent_end right_delimiter temporal_extent_keyword: T_TIMEEXTENT temporal_extent_start: datetime | quoted_latin_text temporal_extent_end: datetime | quoted_latin_text // Identifier identifier: identifier_keyword left_delimiter authority_name wkt_separator authority_unique_identifier opt_version_authority_citation_uri right_delimiter opt_version_authority_citation_uri: | wkt_separator version | wkt_separator version wkt_separator authority_citation | wkt_separator version wkt_separator authority_citation wkt_separator id_uri | wkt_separator authority_citation | wkt_separator authority_citation wkt_separator id_uri | wkt_separator id_uri identifier_keyword: T_ID authority_name: quoted_latin_text authority_unique_identifier: number | quoted_latin_text version: number | quoted_latin_text authority_citation: citation_keyword left_delimiter citation right_delimiter citation_keyword: T_CITATION citation: quoted_latin_text id_uri: uri_keyword left_delimiter uri right_delimiter uri_keyword: T_URI uri: quoted_latin_text // Remark remark: remark_keyword left_delimiter quoted_unicode_text right_delimiter remark_keyword: T_REMARK // Unit unit: spatial_unit | time_unit //spatial_unit: angle_unit | length_unit | parametric_unit | scale_unit spatial_unit: angle_or_length_or_parametric_or_scale_unit angle_or_length_or_parametric_or_scale_unit: angle_or_length_or_parametric_or_scale_unit_keyword left_delimiter unit_name wkt_separator conversion_factor opt_separator_identifier_list right_delimiter angle_or_length_or_parametric_or_scale_unit_keyword: T_ANGLEUNIT | T_LENGTHUNIT | T_PARAMETRICUNIT | T_SCALEUNIT | T_UNIT angle_or_length_or_scale_unit: angle_or_length_or_scale_unit_keyword left_delimiter unit_name wkt_separator conversion_factor opt_separator_identifier_list right_delimiter angle_or_length_or_scale_unit_keyword: T_ANGLEUNIT | T_LENGTHUNIT | T_SCALEUNIT | T_UNIT angle_unit: angle_unit_keyword left_delimiter unit_name wkt_separator conversion_factor opt_separator_identifier_list right_delimiter opt_separator_identifier_list: | wkt_separator identifier opt_separator_identifier_list length_unit: length_unit_keyword left_delimiter unit_name wkt_separator conversion_factor opt_separator_identifier_list right_delimiter /* parametric_unit: parametric_unit_keyword left_delimiter unit_name wkt_separator conversion_factor opt_separator_identifier_list right_delimiter */ /* scale_unit: scale_unit_keyword left_delimiter unit_name wkt_separator conversion_factor opt_separator_identifier_list right_delimiter */ time_unit: time_unit_keyword left_delimiter unit_name opt_separator_conversion_factor_identifier_list right_delimiter opt_separator_conversion_factor_identifier_list: | wkt_separator conversion_factor opt_separator_identifier_list angle_unit_keyword: T_ANGLEUNIT | T_UNIT length_unit_keyword: T_LENGTHUNIT | T_UNIT // parametric_unit_keyword: T_PARAMETRICUNIT // scale_unit_keyword: T_SCALEUNIT | T_UNIT time_unit_keyword: T_TIMEUNIT | T_TEMPORALQUANTITY unit_name: quoted_latin_text conversion_factor: unsigned_numeric_literal // Coordinate system // coordinate_system: spatial_cs | temporalcountmeasure_cs | ordinatedatetime_cs coordinate_system_scope_extent_identifier_remark: spatial_cs_scope_extent_identifier_remark | wkt2015temporal_cs_scope_extent_identifier_remark | temporalcountmeasure_cs_scope_extent_identifier_remark | ordinaldatetime_cs_scope_extent_identifier_remark spatial_cs_scope_extent_identifier_remark: cs_keyword left_delimiter spatial_cs_type wkt_separator dimension opt_separator_identifier_list right_delimiter wkt_separator spatial_axis opt_separator_spatial_axis_list_opt_separator_cs_unit_scope_extent_identifier_remark opt_separator_spatial_axis_list_opt_separator_cs_unit_scope_extent_identifier_remark: | wkt_separator cs_unit opt_separator_scope_extent_identifier_remark | wkt_separator spatial_axis opt_separator_spatial_axis_list_opt_separator_cs_unit_scope_extent_identifier_remark | wkt_separator no_opt_separator_scope_extent_identifier_remark wkt2015temporal_cs_scope_extent_identifier_remark: cs_keyword left_delimiter T_TEMPORAL wkt_separator dimension opt_separator_identifier_list right_delimiter wkt_separator temporalcountmeasure_axis opt_separator_cs_unit_scope_extent_identifier_remark opt_separator_cs_unit_scope_extent_identifier_remark: | wkt_separator cs_unit | wkt_separator cs_unit wkt_separator no_opt_separator_scope_extent_identifier_remark | wkt_separator no_opt_separator_scope_extent_identifier_remark temporalcountmeasure_cs_scope_extent_identifier_remark: cs_keyword left_delimiter temporalcountmeasure_cs_type wkt_separator dimension opt_separator_identifier_list right_delimiter wkt_separator temporalcountmeasure_axis opt_separator_scope_extent_identifier_remark ordinaldatetime_cs_scope_extent_identifier_remark: cs_keyword left_delimiter ordinaldatetime_cs_type wkt_separator dimension opt_separator_identifier_list right_delimiter wkt_separator ordinaldatetime_axis opt_separator_ordinaldatetime_axis_list_scope_extent_identifier_remark opt_separator_ordinaldatetime_axis_list_scope_extent_identifier_remark: | wkt_separator ordinaldatetime_axis opt_separator_ordinaldatetime_axis_list_scope_extent_identifier_remark | wkt_separator no_opt_separator_scope_extent_identifier_remark cs_keyword: T_CS spatial_cs_type: T_AFFINE | T_CARTESIAN | T_CYLINDRICAL | T_ELLIPSOIDAL | T_LINEAR | T_PARAMETRIC | T_POLAR | T_SPHERICAL | T_VERTICAL temporalcountmeasure_cs_type: T_TEMPORALCOUNT | T_TEMPORALMEASURE ordinaldatetime_cs_type: T_ORDINAL | T_TEMPORALDATETIME dimension: '1' | '2' | '3' spatial_axis: axis_keyword left_delimiter axis_name_abbrev wkt_separator axis_direction_opt_axis_order_spatial_unit_identifier_list right_delimiter temporalcountmeasure_axis: axis_keyword left_delimiter axis_name_abbrev wkt_separator axis_direction_except_n_s_cw_ccw opt_separator_axis_time_unit_identifier_list right_delimiter ordinaldatetime_axis: axis_keyword left_delimiter axis_name_abbrev wkt_separator axis_direction_opt_axis_order_identifier_list right_delimiter axis_keyword: T_AXIS // Approximation of { | | } axis_name_abbrev: quoted_latin_text axis_direction_opt_axis_order_spatial_unit_identifier_list: axis_direction_except_n_s_cw_ccw_opt_axis_spatial_unit_identifier_list | T_NORTH | T_NORTH wkt_separator north_south_options_spatial_unit | T_SOUTH | T_SOUTH wkt_separator north_south_options_spatial_unit | T_CLOCKWISE | T_CLOCKWISE wkt_separator clockwise_counter_clockwise_options_spatial_unit | T_COUNTERCLOCKWISE | T_COUNTERCLOCKWISE wkt_separator clockwise_counter_clockwise_options_spatial_unit north_south_options_spatial_unit: identifier opt_separator_identifier_list | meridian wkt_separator axis_order opt_separator_identifier_list | meridian wkt_separator axis_order wkt_separator spatial_unit opt_separator_identifier_list | meridian wkt_separator spatial_unit opt_separator_identifier_list | meridian opt_separator_identifier_list | axis_order wkt_separator spatial_unit opt_separator_identifier_list | axis_order opt_separator_identifier_list | spatial_unit opt_separator_identifier_list clockwise_counter_clockwise_options_spatial_unit: identifier opt_separator_identifier_list | bearing wkt_separator axis_order opt_separator_identifier_list | bearing wkt_separator axis_order wkt_separator spatial_unit opt_separator_identifier_list | bearing wkt_separator spatial_unit opt_separator_identifier_list | bearing opt_separator_identifier_list | axis_order wkt_separator spatial_unit opt_separator_identifier_list | axis_order opt_separator_identifier_list | spatial_unit opt_separator_identifier_list axis_direction_except_n_s_cw_ccw_opt_axis_spatial_unit_identifier_list: axis_direction_except_n_s_cw_ccw | axis_direction_except_n_s_cw_ccw wkt_separator axis_direction_except_n_s_cw_ccw_opt_axis_spatial_unit_identifier_list_options axis_direction_except_n_s_cw_ccw_opt_axis_spatial_unit_identifier_list_options: identifier opt_separator_identifier_list | axis_order opt_separator_identifier_list | axis_order wkt_separator spatial_unit opt_separator_identifier_list | spatial_unit opt_separator_identifier_list axis_direction_opt_axis_order_identifier_list: axis_direction_except_n_s_cw_ccw_opt_axis_identifier_list | T_NORTH | T_NORTH wkt_separator north_south_options | T_SOUTH | T_SOUTH wkt_separator north_south_options_spatial_unit | T_CLOCKWISE | T_CLOCKWISE wkt_separator clockwise_counter_clockwise_options | T_COUNTERCLOCKWISE | T_COUNTERCLOCKWISE wkt_separator clockwise_counter_clockwise_options north_south_options: identifier opt_separator_identifier_list | meridian wkt_separator axis_order opt_separator_identifier_list | meridian opt_separator_identifier_list | axis_order opt_separator_identifier_list clockwise_counter_clockwise_options: identifier opt_separator_identifier_list | bearing wkt_separator axis_order opt_separator_identifier_list | bearing opt_separator_identifier_list | axis_order opt_separator_identifier_list axis_direction_except_n_s_cw_ccw_opt_axis_identifier_list: axis_direction_except_n_s_cw_ccw | axis_direction_except_n_s_cw_ccw wkt_separator axis_direction_except_n_s_cw_ccw_opt_axis_identifier_list_options axis_direction_except_n_s_cw_ccw_opt_axis_identifier_list_options: identifier opt_separator_identifier_list | axis_order opt_separator_identifier_list opt_separator_axis_time_unit_identifier_list: | wkt_separator axis_direction_except_n_s_cw_ccw_opt_axis_time_unit_identifier_list_options axis_direction_except_n_s_cw_ccw_opt_axis_time_unit_identifier_list_options: identifier opt_separator_identifier_list | axis_order opt_separator_identifier_list | axis_order wkt_separator time_unit opt_separator_identifier_list | time_unit opt_separator_identifier_list axis_direction_except_n_s_cw_ccw: T_NORTHNORTHEAST | T_NORTHEAST | T_EASTNORTHEAST | T_EAST | T_EASTSOUTHEAST | T_SOUTHEAST | T_SOUTHSOUTHEAST | T_SOUTHSOUTHWEST | T_SOUTHWEST | T_WESTSOUTHWEST | T_WEST | T_WESTNORTHWEST | T_NORTHWEST | T_NORTHNORTHWEST | T_UP | T_DOWN | T_GEOCENTRICX | T_GEOCENTRICY | T_GEOCENTRICZ | T_COLUMNPOSITIVE | T_COLUMNNEGATIVE | T_ROWPOSITIVE | T_ROWNEGATIVE | T_DISPLAYRIGHT | T_DISPLAYLEFT | T_DISPLAYUP | T_DISPLAYDOWN | T_FORWARD | T_AFT | T_PORT | T_STARBOARD | T_TOWARDS | T_AWAYFROM | T_FUTURE | T_PAST | T_UNSPECIFIED meridian: meridian_keyword left_delimiter number wkt_separator angle_unit right_delimiter meridian_keyword: T_MERIDIAN bearing: bearing_keyword left_delimiter number right_delimiter bearing_keyword: T_BEARING axis_order: axis_order_keyword left_delimiter unsigned_integer right_delimiter axis_order_keyword: T_ORDER cs_unit: unit /* ellipsoidal_2D_coordinate_system: cs_keyword left_delimiter ellipsoidal_2D_cs_type wkt_separator ellipsoidal_2D_dimension opt_separator_identifier_list right_delimiter separator_spatial_axis_list opt_separator_cs_unit ellipsoidal_2D_cs_type: T_ELLIPSOIDAL ellipsoidal_2D_dimension: '2' */ // Datum ensemble datum_ensemble: geodetic_datum_ensemble_without_pm | vertical_datum_ensemble geodetic_datum_ensemble_without_pm: datum_ensemble_keyword left_delimiter datum_ensemble_name wkt_separator datum_ensemble_member datum_ensemble_member_list_ellipsoid_accuracy_identifier_list right_delimiter datum_ensemble_member_list_ellipsoid_accuracy_identifier_list: wkt_separator ellipsoid wkt_separator datum_ensemble_accuracy opt_separator_datum_ensemble_identifier_list | wkt_separator datum_ensemble_member datum_ensemble_member_list_ellipsoid_accuracy_identifier_list opt_separator_datum_ensemble_identifier_list: | wkt_separator datum_ensemble_identifier opt_separator_datum_ensemble_identifier_list vertical_datum_ensemble: datum_ensemble_keyword left_delimiter datum_ensemble_name wkt_separator datum_ensemble_member datum_ensemble_member_list_accuracy_identifier_list right_delimiter datum_ensemble_member_list_accuracy_identifier_list: wkt_separator datum_ensemble_accuracy opt_separator_datum_ensemble_identifier_list | wkt_separator datum_ensemble_member datum_ensemble_member_list_accuracy_identifier_list datum_ensemble_keyword: T_ENSEMBLE datum_ensemble_name: quoted_latin_text datum_ensemble_member: datum_ensemble_member_keyword left_delimiter datum_ensemble_member_name opt_datum_ensemble_member_identifier_list right_delimiter opt_datum_ensemble_member_identifier_list: | wkt_separator datum_ensemble_member_identifier opt_datum_ensemble_member_identifier_list datum_ensemble_member_keyword: T_MEMBER datum_ensemble_member_name: quoted_latin_text datum_ensemble_member_identifier: identifier datum_ensemble_accuracy: datum_ensemble_accuracy_keyword left_delimiter accuracy right_delimiter datum_ensemble_accuracy_keyword: T_ENSEMBLEACCURACY accuracy: number datum_ensemble_identifier: identifier // Dynamic coordinate reference systems dynamic_crs: dynamic_crs_keyword left_delimiter frame_reference_epoch opt_separator_deformation_model_id right_delimiter dynamic_crs_keyword: T_DYNAMIC frame_reference_epoch: frame_reference_epoch_keyword left_delimiter reference_epoch right_delimiter frame_reference_epoch_keyword: T_FRAMEEPOCH reference_epoch: unsigned_integer | unsigned_integer period | unsigned_integer period unsigned_integer opt_separator_deformation_model_id: | wkt_separator deformation_model_id deformation_model_id: deformation_model_id_keyword left_delimiter deformation_model_name opt_separator_identifier right_delimiter opt_separator_identifier: | wkt_separator identifier deformation_model_id_keyword: T_MODEL | T_VELOCITYGRID deformation_model_name: quoted_latin_text // Geodetic CRS geodetic_crs: static_geodetic_crs | dynamic_geodetic_crs | geographic_crs geographic_crs: static_geographic_crs | dynamic_geographic_crs static_geodetic_crs: geodetic_crs_keyword left_delimiter crs_name wkt_separator geodetic_reference_frame_or_geodetic_datum_ensemble_without_pm wkt_separator opt_prime_meridian_coordinate_system_scope_extent_identifier_remark right_delimiter dynamic_geodetic_crs: geodetic_crs_keyword left_delimiter crs_name wkt_separator dynamic_crs wkt_separator geodetic_reference_frame_without_pm wkt_separator opt_prime_meridian_coordinate_system_scope_extent_identifier_remark right_delimiter static_geographic_crs: geographic_crs_keyword left_delimiter crs_name wkt_separator geodetic_reference_frame_or_geodetic_datum_ensemble_without_pm wkt_separator opt_prime_meridian_coordinate_system_scope_extent_identifier_remark right_delimiter dynamic_geographic_crs: geographic_crs_keyword left_delimiter crs_name wkt_separator dynamic_crs wkt_separator geodetic_reference_frame_without_pm wkt_separator opt_prime_meridian_coordinate_system_scope_extent_identifier_remark right_delimiter opt_prime_meridian_coordinate_system_scope_extent_identifier_remark: prime_meridian wkt_separator coordinate_system_scope_extent_identifier_remark | coordinate_system_scope_extent_identifier_remark crs_name: quoted_latin_text geodetic_crs_keyword: T_GEODCRS | T_GEODETICCRS geographic_crs_keyword: T_GEOGCRS | T_GEOGRAPHICCRS geodetic_reference_frame_or_geodetic_datum_ensemble_without_pm: geodetic_reference_frame_without_pm | geodetic_datum_ensemble_without_pm // Ellipsoid ellipsoid: ellipsoid_keyword left_delimiter ellipsoid_name wkt_separator semi_major_axis wkt_separator inverse_flattening opt_separator_length_unit_identifier_list right_delimiter opt_separator_length_unit_identifier_list: | wkt_separator length_unit opt_separator_identifier_list | wkt_separator identifier opt_separator_identifier_list ellipsoid_keyword: T_ELLIPSOID | T_SPHEROID ellipsoid_name: quoted_latin_text semi_major_axis: unsigned_numeric_literal inverse_flattening: unsigned_numeric_literal // Prime meridian prime_meridian: prime_meridian_keyword left_delimiter prime_meridian_name wkt_separator irm_longitude_opt_separator_identifier_list right_delimiter prime_meridian_keyword: T_PRIMEM | T_PRIMEMERIDIAN prime_meridian_name: quoted_latin_text irm_longitude_opt_separator_identifier_list: signed_numeric_literal wkt_separator angle_unit opt_separator_identifier_list | signed_numeric_literal opt_separator_identifier_list // Geodetic reference frame geodetic_reference_frame_with_opt_pm: geodetic_reference_frame_without_pm | geodetic_reference_frame_without_pm wkt_separator prime_meridian geodetic_reference_frame_without_pm: geodetic_reference_frame_keyword left_delimiter datum_name wkt_separator ellipsoid opt_separator_datum_anchor_identifier_list right_delimiter geodetic_reference_frame_keyword: T_DATUM | T_TRF | T_GEODETICDATUM datum_name: quoted_latin_text opt_separator_datum_anchor_identifier_list: | wkt_separator datum_anchor | wkt_separator identifier opt_separator_identifier_list | wkt_separator datum_anchor wkt_separator identifier opt_separator_identifier_list datum_anchor: datum_anchor_keyword left_delimiter datum_anchor_description right_delimiter datum_anchor_keyword: T_ANCHOR datum_anchor_description: quoted_latin_text // Projected CRS projected_crs: projected_crs_keyword left_delimiter crs_name wkt_separator base_geodetic_crs wkt_separator map_projection wkt_separator coordinate_system_scope_extent_identifier_remark right_delimiter projected_crs_keyword: T_PROJCRS | T_PROJECTEDCRS // Base CRS base_geodetic_crs: base_static_geodetic_crs | base_dynamic_geodetic_crs | base_static_geographic_crs | base_dynamic_geographic_crs base_static_geodetic_crs: base_geodetic_crs_keyword left_delimiter base_crs_name wkt_separator geodetic_reference_frame_or_geodetic_datum_ensemble_without_pm opt_separator_pm_ellipsoidal_cs_unit_opt_separator_identifier_list right_delimiter opt_separator_pm_ellipsoidal_cs_unit_opt_separator_identifier_list: | wkt_separator prime_meridian opt_separator_identifier_list | wkt_separator prime_meridian wkt_separator ellipsoidal_cs_unit opt_separator_identifier_list | wkt_separator ellipsoidal_cs_unit opt_separator_identifier_list | wkt_separator identifier opt_separator_identifier_list base_dynamic_geodetic_crs: base_geodetic_crs_keyword left_delimiter base_crs_name wkt_separator dynamic_crs wkt_separator geodetic_reference_frame_without_pm opt_separator_pm_ellipsoidal_cs_unit_opt_separator_identifier_list right_delimiter base_static_geographic_crs: base_geographic_crs_keyword left_delimiter base_crs_name wkt_separator geodetic_reference_frame_or_geodetic_datum_ensemble_without_pm opt_separator_pm_ellipsoidal_cs_unit_opt_separator_identifier_list right_delimiter base_dynamic_geographic_crs: base_geographic_crs_keyword left_delimiter base_crs_name wkt_separator dynamic_crs wkt_separator geodetic_reference_frame_without_pm opt_separator_pm_ellipsoidal_cs_unit_opt_separator_identifier_list right_delimiter base_geodetic_crs_keyword: T_BASEGEODCRS base_geographic_crs_keyword: T_BASEGEOGCRS base_crs_name: quoted_latin_text ellipsoidal_cs_unit: angle_unit // Map projection map_projection: map_projection_keyword left_delimiter map_projection_name wkt_separator map_projection_method opt_separator_parameter_list_identifier_list right_delimiter opt_separator_parameter_list_identifier_list: | wkt_separator identifier opt_separator_identifier_list | wkt_separator map_projection_parameter opt_separator_parameter_list_identifier_list map_projection_keyword: T_CONVERSION map_projection_name: quoted_latin_text map_projection_method: map_projection_method_keyword left_delimiter map_projection_method_name opt_separator_identifier_list right_delimiter map_projection_method_keyword: T_METHOD | T_PROJECTION map_projection_method_name: quoted_latin_text map_projection_parameter: parameter_keyword left_delimiter parameter_name wkt_separator parameter_value opt_separator_param_unit_identifier_list right_delimiter opt_separator_param_unit_identifier_list: | wkt_separator identifier opt_separator_identifier_list | wkt_separator map_projection_parameter_unit opt_separator_identifier_list parameter_keyword: T_PARAMETER parameter_name: quoted_latin_text parameter_value: signed_numeric_literal map_projection_parameter_unit: angle_or_length_or_scale_unit // Vertical CRS vertical_crs: static_vertical_crs | dynamic_vertical_crs static_vertical_crs: vertical_crs_keyword left_delimiter crs_name wkt_separator vertical_reference_frame_or_vertical_datum_ensemble wkt_separator vertical_cs_opt_geoid_model_id_scope_extent_identifier_remark right_delimiter dynamic_vertical_crs: vertical_crs_keyword left_delimiter crs_name wkt_separator dynamic_crs wkt_separator vertical_reference_frame wkt_separator vertical_cs_opt_geoid_model_id_scope_extent_identifier_remark right_delimiter vertical_reference_frame_or_vertical_datum_ensemble: vertical_reference_frame | vertical_datum_ensemble vertical_cs_opt_geoid_model_id_scope_extent_identifier_remark: cs_keyword left_delimiter spatial_cs_type wkt_separator dimension opt_separator_identifier_list right_delimiter wkt_separator spatial_axis opt_separator_cs_unit_opt_geoid_model_id_scope_extent_identifier_remark opt_separator_cs_unit_opt_geoid_model_id_scope_extent_identifier_remark: | wkt_separator cs_unit opt_separator_scope_extent_identifier_remark | wkt_separator cs_unit wkt_separator geoid_model_id opt_separator_scope_extent_identifier_remark | wkt_separator geoid_model_id opt_separator_scope_extent_identifier_remark | wkt_separator no_opt_separator_scope_extent_identifier_remark geoid_model_id: geoid_model_keyword left_delimiter geoid_model_name opt_separator_identifier right_delimiter geoid_model_keyword: T_GEOIDMODEL geoid_model_name: quoted_latin_text vertical_crs_keyword: T_VERTCRS | T_VERTICALCRS // Vertical reference frame vertical_reference_frame: vertical_reference_frame_keyword left_delimiter datum_name opt_separator_datum_anchor_identifier_list right_delimiter vertical_reference_frame_keyword: T_VDATUM | T_VRF | T_VERTICALDATUM // Engineering CRS engineering_crs: engineering_crs_keyword left_delimiter crs_name wkt_separator engineering_datum wkt_separator coordinate_system_scope_extent_identifier_remark right_delimiter engineering_crs_keyword: T_ENGCRS | T_ENGINEERINGCRS engineering_datum: engineering_datum_keyword left_delimiter datum_name opt_separator_datum_anchor_identifier_list right_delimiter engineering_datum_keyword: T_EDATUM | T_ENGINEERINGDATUM // Parametric CRS parametric_crs: parametric_crs_keyword left_delimiter crs_name wkt_separator parametric_datum wkt_separator coordinate_system_scope_extent_identifier_remark right_delimiter parametric_crs_keyword: T_PARAMETRICCRS parametric_datum: parametric_datum_keyword left_delimiter datum_name opt_separator_datum_anchor_identifier_list right_delimiter parametric_datum_keyword: T_PDATUM | T_PARAMETRICDATUM // Temporal CRS temporal_crs: temporal_crs_keyword left_delimiter crs_name wkt_separator temporal_datum wkt_separator coordinate_system_scope_extent_identifier_remark right_delimiter temporal_crs_keyword: T_TIMECRS temporal_datum: temporal_datum_keyword left_delimiter datum_name opt_separator_temporal_datum_end right_delimiter opt_separator_temporal_datum_end: | wkt_separator calendar opt_separator_identifier_list | wkt_separator calendar wkt_separator temporal_origin opt_separator_identifier_list | wkt_separator temporal_origin opt_separator_identifier_list | wkt_separator identifier opt_separator_identifier_list temporal_datum_keyword: T_TDATUM | T_TIMEDATUM temporal_origin: temporal_origin_keyword left_delimiter temporal_origin_description right_delimiter temporal_origin_keyword: T_TIMEORIGIN temporal_origin_description: datetime | quoted_latin_text calendar: calendar_keyword left_delimiter calendar_identifier right_delimiter calendar_keyword: T_CALENDAR calendar_identifier: quoted_latin_text // Deriving conversion deriving_conversion: deriving_conversion_keyword left_delimiter deriving_conversion_name wkt_separator operation_method opt_separator_parameter_or_parameter_file_identifier_list right_delimiter opt_separator_parameter_or_parameter_file_identifier_list: | wkt_separator operation_parameter opt_separator_parameter_or_parameter_file_identifier_list | wkt_separator operation_parameter_file opt_separator_parameter_or_parameter_file_identifier_list | wkt_separator identifier opt_separator_identifier_list deriving_conversion_keyword: T_DERIVINGCONVERSION deriving_conversion_name: quoted_latin_text // Derived CRS conversion method operation_method: operation_method_keyword left_delimiter operation_method_name opt_separator_identifier right_delimiter operation_method_keyword: T_METHOD operation_method_name: quoted_latin_text // Derived CRS conversion parameter operation_parameter: parameter_keyword left_delimiter parameter_name wkt_separator parameter_value wkt_separator parameter_unit opt_separator_identifier right_delimiter parameter_unit: length_or_angle_or_scale_or_time_or_parametric_unit // Approximate definition: conversion_factor should be optional only for a timeunit (but not easy to detect if UNIT keyword is used!) length_or_angle_or_scale_or_time_or_parametric_unit: length_or_angle_or_scale_or_time_or_parametric_unit_keyword left_delimiter unit_name opt_separator_conversion_factor_identifier_list right_delimiter length_or_angle_or_scale_or_time_or_parametric_unit_keyword: T_LENGTHUNIT | T_ANGLEUNIT | T_SCALEUNIT | T_TIMEUNIT | T_PARAMETRICUNIT | T_UNIT // Derived CRS conversion parameter file operation_parameter_file: parameter_file_keyword left_delimiter parameter_name wkt_separator parameter_file_name opt_separator_identifier right_delimiter parameter_file_keyword: T_PARAMETERFILE parameter_file_name: quoted_latin_text // Derived geodetic CRS and derived geographic CRS derived_geodetic_crs: derived_static_geod_crs | derived_dynamic_geod_crs | derived_geographic_crs derived_geographic_crs: derived_static_geog_crs | derived_dynamic_geog_crs derived_static_geod_crs: geodetic_crs_keyword left_delimiter crs_name wkt_separator base_static_geod_crs_or_base_static_geog_crs wkt_separator deriving_conversion wkt_separator coordinate_system_scope_extent_identifier_remark right_delimiter base_static_geod_crs_or_base_static_geog_crs: base_static_geod_crs | base_static_geog_crs derived_dynamic_geod_crs: geodetic_crs_keyword left_delimiter crs_name wkt_separator base_dynamic_geod_crs_or_base_dynamic_geog_crs wkt_separator deriving_conversion wkt_separator coordinate_system_scope_extent_identifier_remark right_delimiter base_dynamic_geod_crs_or_base_dynamic_geog_crs: base_dynamic_geod_crs | base_dynamic_geog_crs derived_static_geog_crs: geographic_crs_keyword left_delimiter crs_name wkt_separator base_static_geod_crs_or_base_static_geog_crs wkt_separator deriving_conversion wkt_separator coordinate_system_scope_extent_identifier_remark right_delimiter derived_dynamic_geog_crs: geographic_crs_keyword left_delimiter crs_name wkt_separator base_dynamic_geod_crs_or_base_dynamic_geog_crs wkt_separator deriving_conversion wkt_separator coordinate_system_scope_extent_identifier_remark right_delimiter base_static_geod_crs: base_geodetic_crs_keyword left_delimiter base_crs_name wkt_separator geodetic_reference_frame_or_geodetic_datum_ensemble_without_pm opt_separator_pm_opt_separator_identifier_list right_delimiter opt_separator_pm_opt_separator_identifier_list: | wkt_separator prime_meridian opt_separator_identifier_list | wkt_separator identifier opt_separator_identifier_list base_dynamic_geod_crs: base_geodetic_crs_keyword left_delimiter base_crs_name wkt_separator dynamic_crs wkt_separator geodetic_reference_frame_without_pm opt_separator_pm_opt_separator_identifier_list right_delimiter base_static_geog_crs: base_geographic_crs_keyword left_delimiter base_crs_name wkt_separator geodetic_reference_frame_or_geodetic_datum_ensemble_without_pm opt_separator_pm_opt_separator_identifier_list right_delimiter base_dynamic_geog_crs: base_geographic_crs_keyword left_delimiter base_crs_name wkt_separator dynamic_crs wkt_separator geodetic_reference_frame_without_pm opt_separator_pm_opt_separator_identifier_list right_delimiter // Derived projected CRS derived_projected_crs: derived_projected_crs_keyword left_delimiter derived_crs_name wkt_separator base_projected_crs wkt_separator deriving_conversion wkt_separator coordinate_system_scope_extent_identifier_remark right_delimiter derived_projected_crs_keyword: T_DERIVEDPROJCRS derived_crs_name: quoted_latin_text base_projected_crs: base_projected_crs_keyword left_delimiter base_crs_name wkt_separator base_geodetic_geographic_crs wkt_separator map_projection opt_separator_identifier_list right_delimiter base_projected_crs_keyword: T_BASEPROJCRS base_geodetic_geographic_crs: base_static_geod_crs | base_dynamic_geod_crs | base_static_geog_crs | base_dynamic_geog_crs // Derived vertical CRS derived_vertical_crs: vertical_crs_keyword left_delimiter crs_name wkt_separator base_vertical_crs wkt_separator deriving_conversion wkt_separator coordinate_system_scope_extent_identifier_remark right_delimiter base_vertical_crs: base_static_vertical_crs | base_dynamic_vertical_crs base_static_vertical_crs: base_vertical_crs_keyword left_delimiter base_crs_name wkt_separator vertical_reference_frame opt_separator_identifier_list right_delimiter base_dynamic_vertical_crs: base_vertical_crs_keyword left_delimiter base_crs_name wkt_separator dynamic_crs wkt_separator vertical_reference_frame opt_separator_identifier_list right_delimiter base_vertical_crs_keyword: T_BASEVERTCRS // Derived engineering CRS derived_engineering_crs: engineering_crs_keyword left_delimiter crs_name wkt_separator base_engineering_crs wkt_separator deriving_conversion wkt_separator coordinate_system_scope_extent_identifier_remark right_delimiter base_engineering_crs: base_engineering_crs_keyword left_delimiter base_crs_name wkt_separator engineering_datum opt_separator_identifier_list right_delimiter base_engineering_crs_keyword: T_BASEENGCRS // Derived parametric CRS derived_parametric_crs: parametric_crs_keyword left_delimiter crs_name wkt_separator base_parametric_crs wkt_separator deriving_conversion wkt_separator coordinate_system_scope_extent_identifier_remark right_delimiter base_parametric_crs: base_parametric_crs_keyword left_delimiter base_crs_name wkt_separator parametric_datum opt_separator_identifier_list right_delimiter base_parametric_crs_keyword: T_BASEPARAMCRS // Derived temporal CRS derived_temporal_crs: temporal_crs_keyword left_delimiter crs_name wkt_separator base_temporal_crs wkt_separator deriving_conversion wkt_separator coordinate_system_scope_extent_identifier_remark right_delimiter base_temporal_crs: base_temporal_crs_keyword left_delimiter base_crs_name wkt_separator temporal_datum opt_separator_identifier_list right_delimiter base_temporal_crs_keyword: T_BASETIMECRS // Compound CRS compound_crs: compound_crs_keyword left_delimiter compound_crs_name wkt_separator single_crs_or_bound_crs wkt_separator single_crs_or_bound_crs opt_wkt_separator_single_crs_list_opt_separator_scope_extent_identifier_remark right_delimiter single_crs: geodetic_crs | derived_geodetic_crs | projected_crs | derived_projected_crs | vertical_crs | derived_vertical_crs | engineering_crs | derived_engineering_crs | parametric_crs | derived_parametric_crs | temporal_crs | derived_temporal_crs // PROJ extension single_crs_or_bound_crs: single_crs | bound_crs opt_wkt_separator_single_crs_list_opt_separator_scope_extent_identifier_remark: | wkt_separator single_crs_or_bound_crs opt_wkt_separator_single_crs_list_opt_separator_scope_extent_identifier_remark | wkt_separator no_opt_separator_scope_extent_identifier_remark compound_crs_keyword: T_COMPOUNDCRS compound_crs_name: quoted_latin_text // coordinate epoch and coordinate metadata metadata_coordinate_epoch: coordinate_epoch_keyword left_delimiter coordinate_epoch right_delimiter coordinate_epoch_keyword: T_EPOCH | T_COORDEPOCH coordinate_epoch: unsigned_integer | unsigned_integer period | unsigned_integer period unsigned_integer coordinate_metadata: coordinate_metadata_keyword left_delimiter coordinate_metadata_crs right_delimiter coordinate_metadata_crs: static_crs_coordinate_metadata | dynamic_crs_coordinate_metadata wkt_separator metadata_coordinate_epoch coordinate_metadata_keyword: T_COORDINATEMETADATA static_crs_coordinate_metadata: static_geodetic_crs | static_geographic_crs | projected_crs | static_vertical_crs | engineering_crs | parametric_crs | temporal_crs | derived_geodetic_crs | derived_projected_crs | derived_vertical_crs | derived_engineering_crs | derived_parametric_crs | derived_temporal_crs | compound_crs dynamic_crs_coordinate_metadata: dynamic_geodetic_crs | dynamic_geographic_crs | projected_crs | dynamic_vertical_crs | derived_geodetic_crs | derived_projected_crs | derived_vertical_crs // Coordinate operations coordinate_operation: operation_keyword left_delimiter operation_name coordinate_operation_next coordinate_operation_next: wkt_separator operation_version coordinate_operation_end | coordinate_operation_end coordinate_operation_end: wkt_separator source_crs wkt_separator target_crs wkt_separator operation_method opt_parameter_or_parameter_file_list_opt_interpolation_crs_opt_operation_accuracy_opt_separator_scope_extent_identifier_remark right_delimiter opt_parameter_or_parameter_file_list_opt_interpolation_crs_opt_operation_accuracy_opt_separator_scope_extent_identifier_remark: | wkt_separator operation_parameter opt_parameter_or_parameter_file_list_opt_interpolation_crs_opt_operation_accuracy_opt_separator_scope_extent_identifier_remark | wkt_separator operation_parameter_file opt_parameter_or_parameter_file_list_opt_interpolation_crs_opt_operation_accuracy_opt_separator_scope_extent_identifier_remark | wkt_separator interpolation_crs opt_separator_scope_extent_identifier_remark | wkt_separator interpolation_crs wkt_separator operation_accuracy opt_separator_scope_extent_identifier_remark | wkt_separator operation_accuracy opt_separator_scope_extent_identifier_remark | wkt_separator no_opt_separator_scope_extent_identifier_remark operation_keyword: T_COORDINATEOPERATION operation_name: quoted_latin_text operation_version: operation_version_keyword left_delimiter operation_version_text right_delimiter operation_version_keyword: T_VERSION operation_version_text: quoted_latin_text source_crs: source_crs_keyword left_delimiter crs right_delimiter source_crs_keyword: T_SOURCECRS target_crs: target_crs_keyword left_delimiter crs right_delimiter target_crs_keyword: T_TARGETCRS interpolation_crs: interpolation_crs_keyword left_delimiter crs right_delimiter interpolation_crs_keyword: T_INTERPOLATIONCRS operation_accuracy: operation_accuracy_keyword left_delimiter accuracy right_delimiter operation_accuracy_keyword: T_OPERATIONACCURACY // Point motion operation point_motion_operation: point_motion_keyword left_delimiter operation_name point_motion_operation_next point_motion_operation_next: wkt_separator operation_version point_motion_operation_end | point_motion_operation_end point_motion_operation_end: wkt_separator source_crs wkt_separator operation_method opt_parameter_or_parameter_file_list_opt_operation_accuracy_opt_separator_scope_extent_identifier_remark right_delimiter opt_parameter_or_parameter_file_list_opt_operation_accuracy_opt_separator_scope_extent_identifier_remark: | wkt_separator operation_parameter opt_parameter_or_parameter_file_list_opt_operation_accuracy_opt_separator_scope_extent_identifier_remark | wkt_separator operation_parameter_file opt_parameter_or_parameter_file_list_opt_operation_accuracy_opt_separator_scope_extent_identifier_remark | wkt_separator operation_accuracy opt_separator_scope_extent_identifier_remark | wkt_separator no_opt_separator_scope_extent_identifier_remark point_motion_keyword: T_POINTMOTIONOPERATION // Concatenated operation concatenated_operation: concatenated_operation_keyword left_delimiter operation_name concatenated_operation_next concatenated_operation_next: wkt_separator operation_version concatenated_operation_end | concatenated_operation_end concatenated_operation_end: wkt_separator source_crs wkt_separator target_crs wkt_separator step_keyword left_delimiter step right_delimiter wkt_separator step_keyword left_delimiter step right_delimiter opt_concatenated_operation_end right_delimiter step: coordinate_operation | point_motion_keyword | map_projection | deriving_conversion opt_concatenated_operation_end: | wkt_separator step_keyword left_delimiter step right_delimiter opt_concatenated_operation_end | wkt_separator operation_accuracy opt_separator_scope_extent_identifier_remark | wkt_separator no_opt_separator_scope_extent_identifier_remark concatenated_operation_keyword: T_CONCATENATEDOPERATION step_keyword: T_STEP // Bound CRS bound_crs: bound_crs_keyword left_delimiter source_crs wkt_separator target_crs wkt_separator abridged_coordinate_transformation opt_separator_scope_extent_identifier_remark right_delimiter bound_crs_keyword: T_BOUNDCRS abridged_coordinate_transformation: abridged_transformation_keyword left_delimiter operation_name abridged_coordinate_transformation_next abridged_coordinate_transformation_next: wkt_separator operation_version abridged_coordinate_transformation_end | abridged_coordinate_transformation_end abridged_coordinate_transformation_end: wkt_separator operation_method // At least one parameter required by WKT2. But relax that to allow things like METHOD["PROJ-based operation method: +proj=...."] // wkt_separator abridged_parameter_or_parameter_file opt_end_abridged_coordinate_transformation right_delimiter //abridged_parameter_or_parameter_file: abridged_transformation_parameter | operation_parameter_file opt_end_abridged_coordinate_transformation: | wkt_separator abridged_transformation_parameter opt_end_abridged_coordinate_transformation | wkt_separator operation_parameter_file opt_end_abridged_coordinate_transformation | wkt_separator no_opt_separator_scope_extent_identifier_remark abridged_transformation_keyword: T_ABRIDGEDTRANSFORMATION abridged_transformation_parameter: parameter_keyword left_delimiter parameter_name wkt_separator parameter_value opt_separator_identifier_list right_delimiter proj-8.2.1/src/4D_api.cpp000644 000765 000024 00000260131 14164067106 015541 0ustar00keversstaff000000 000000 /****************************************************************************** * Project: PROJ.4 * Purpose: Implement a (currently minimalistic) proj API based primarily * on the PJ_COORD 4D geodetic spatiotemporal data type. * * Author: Thomas Knudsen, thokn@sdfe.dk, 2016-06-09/2016-11-06 * ****************************************************************************** * Copyright (c) 2016, 2017 Thomas Knudsen/SDFE * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. *****************************************************************************/ #define FROM_PROJ_CPP #include #include #include #include #include #include #ifndef _MSC_VER #include #endif #include #include #include "proj.h" #include "proj_experimental.h" #include "proj_internal.h" #include #include "geodesic.h" #include "grids.hpp" #include "filemanager.hpp" #include "proj/common.hpp" #include "proj/coordinateoperation.hpp" #include "proj/internal/internal.hpp" #include "proj/internal/io_internal.hpp" using namespace NS_PROJ::internal; /* Initialize PJ_COORD struct */ PJ_COORD proj_coord (double x, double y, double z, double t) { PJ_COORD res; res.v[0] = x; res.v[1] = y; res.v[2] = z; res.v[3] = t; return res; } static PJ_DIRECTION opposite_direction(PJ_DIRECTION dir) { return static_cast(-dir); } /*****************************************************************************/ int proj_angular_input (PJ *P, enum PJ_DIRECTION dir) { /****************************************************************************** Returns 1 if the operator P expects angular input coordinates when operating in direction dir, 0 otherwise. dir: {PJ_FWD, PJ_INV} ******************************************************************************/ if (PJ_FWD==dir) return pj_left (P)==PJ_IO_UNITS_RADIANS; return pj_right (P)==PJ_IO_UNITS_RADIANS; } /*****************************************************************************/ int proj_angular_output (PJ *P, enum PJ_DIRECTION dir) { /****************************************************************************** Returns 1 if the operator P provides angular output coordinates when operating in direction dir, 0 otherwise. dir: {PJ_FWD, PJ_INV} ******************************************************************************/ return proj_angular_input (P, opposite_direction(dir)); } /*****************************************************************************/ int proj_degree_input (PJ *P, enum PJ_DIRECTION dir) { /****************************************************************************** Returns 1 if the operator P expects degree input coordinates when operating in direction dir, 0 otherwise. dir: {PJ_FWD, PJ_INV} ******************************************************************************/ if (PJ_FWD==dir) return pj_left (P)==PJ_IO_UNITS_DEGREES; return pj_right (P)==PJ_IO_UNITS_DEGREES; } /*****************************************************************************/ int proj_degree_output (PJ *P, enum PJ_DIRECTION dir) { /****************************************************************************** Returns 1 if the operator P provides degree output coordinates when operating in direction dir, 0 otherwise. dir: {PJ_FWD, PJ_INV} ******************************************************************************/ return proj_degree_input (P, opposite_direction(dir)); } /* Geodesic distance (in meter) + fwd and rev azimuth between two points on the ellipsoid */ PJ_COORD proj_geod (const PJ *P, PJ_COORD a, PJ_COORD b) { PJ_COORD c; if( !P->geod ) { return proj_coord_error(); } /* Note: the geodesic code takes arguments in degrees */ geod_inverse (P->geod, PJ_TODEG(a.lpz.phi), PJ_TODEG(a.lpz.lam), PJ_TODEG(b.lpz.phi), PJ_TODEG(b.lpz.lam), c.v, c.v+1, c.v+2 ); // cppcheck-suppress uninitvar return c; } /* Geodesic distance (in meter) between two points with angular 2D coordinates */ double proj_lp_dist (const PJ *P, PJ_COORD a, PJ_COORD b) { double s12, azi1, azi2; /* Note: the geodesic code takes arguments in degrees */ if( !P->geod ) { return HUGE_VAL; } geod_inverse (P->geod, PJ_TODEG(a.lpz.phi), PJ_TODEG(a.lpz.lam), PJ_TODEG(b.lpz.phi), PJ_TODEG(b.lpz.lam), &s12, &azi1, &azi2 ); return s12; } /* The geodesic distance AND the vertical offset */ double proj_lpz_dist (const PJ *P, PJ_COORD a, PJ_COORD b) { if (HUGE_VAL==a.lpz.lam || HUGE_VAL==b.lpz.lam) return HUGE_VAL; return hypot (proj_lp_dist (P, a, b), a.lpz.z - b.lpz.z); } /* Euclidean distance between two points with linear 2D coordinates */ double proj_xy_dist (PJ_COORD a, PJ_COORD b) { return hypot (a.xy.x - b.xy.x, a.xy.y - b.xy.y); } /* Euclidean distance between two points with linear 3D coordinates */ double proj_xyz_dist (PJ_COORD a, PJ_COORD b) { return hypot (proj_xy_dist (a, b), a.xyz.z - b.xyz.z); } /* Measure numerical deviation after n roundtrips fwd-inv (or inv-fwd) */ double proj_roundtrip (PJ *P, PJ_DIRECTION direction, int n, PJ_COORD *coord) { int i; PJ_COORD t, org; if (nullptr==P) return HUGE_VAL; if (n < 1) { proj_log_error(P, _("n should be >= 1")); proj_errno_set (P, PROJ_ERR_OTHER_API_MISUSE); return HUGE_VAL; } /* in the first half-step, we generate the output value */ org = *coord; *coord = proj_trans (P, direction, org); t = *coord; /* now we take n-1 full steps in inverse direction: We are */ /* out of phase due to the half step already taken */ for (i = 0; i < n - 1; i++) t = proj_trans (P, direction, proj_trans (P, opposite_direction(direction), t) ); /* finally, we take the last half-step */ t = proj_trans (P, opposite_direction(direction), t); /* checking for angular *input* since we do a roundtrip, and end where we begin */ if (proj_angular_input (P, direction)) return proj_lpz_dist (P, org, t); return proj_xyz_dist (org, t); } /**************************************************************************************/ int pj_get_suggested_operation(PJ_CONTEXT*, const std::vector& opList, const int iExcluded[2], PJ_DIRECTION direction, PJ_COORD coord) /**************************************************************************************/ { // Select the operations that match the area of use // and has the best accuracy. int iBest = -1; double bestAccuracy = std::numeric_limits::max(); const int nOperations = static_cast(opList.size()); for( int i = 0; i < nOperations; i++ ) { if( i == iExcluded[0] || i == iExcluded[1] ) { continue; } const auto &alt = opList[i]; bool spatialCriterionOK = false; if( direction == PJ_FWD ) { if( coord.xyzt.x >= alt.minxSrc && coord.xyzt.y >= alt.minySrc && coord.xyzt.x <= alt.maxxSrc && coord.xyzt.y <= alt.maxySrc) { spatialCriterionOK = true; } } else { if( coord.xyzt.x >= alt.minxDst && coord.xyzt.y >= alt.minyDst && coord.xyzt.x <= alt.maxxDst && coord.xyzt.y <= alt.maxyDst ) { spatialCriterionOK = true; } } if( spatialCriterionOK ) { // The offshore test is for the "Test bug 245 (use +datum=carthage)" // of testvarious. The long=10 lat=34 point belongs both to the // onshore and offshore Tunisia area of uses, but is slightly // onshore. So in a general way, prefer a onshore area to a // offshore one. if( iBest < 0 || (alt.accuracy >= 0 && (alt.accuracy < bestAccuracy || // If two operations have the same accuracy, use the one that // is contained within a larger one (alt.accuracy == bestAccuracy && alt.minxSrc > opList[iBest].minxSrc && alt.minySrc > opList[iBest].minySrc && alt.maxxSrc < opList[iBest].maxxSrc && alt.maxySrc < opList[iBest].maxySrc)) && !alt.isOffshore) ) { iBest = i; bestAccuracy = alt.accuracy; } } } return iBest; } /**************************************************************************************/ PJ_COORD proj_trans (PJ *P, PJ_DIRECTION direction, PJ_COORD coord) { /*************************************************************************************** Apply the transformation P to the coordinate coord, preferring the 4D interfaces if available. See also pj_approx_2D_trans and pj_approx_3D_trans in pj_internal.c, which work similarly, but prefers the 2D resp. 3D interfaces if available. ***************************************************************************************/ if (nullptr==P || direction == PJ_IDENT) return coord; if (P->inverted) direction = opposite_direction(direction); if( !P->alternativeCoordinateOperations.empty() ) { constexpr int N_MAX_RETRY = 2; int iExcluded[N_MAX_RETRY] = {-1, -1}; const int nOperations = static_cast( P->alternativeCoordinateOperations.size()); // We may need several attempts. For example the point at // lon=-111.5 lat=45.26 falls into the bounding box of the Canadian // ntv2_0.gsb grid, except that it is not in any of the subgrids, being // in the US. We thus need another retry that will select the conus // grid. for( int iRetry = 0; iRetry <= N_MAX_RETRY; iRetry++ ) { // Do a first pass and select the operations that match the area of use // and has the best accuracy. int iBest = pj_get_suggested_operation(P->ctx, P->alternativeCoordinateOperations, iExcluded, direction, coord); if( iBest < 0 ) { break; } if( iRetry > 0 ) { const int oldErrno = proj_errno_reset(P); if (proj_log_level(P->ctx, PJ_LOG_TELL) >= PJ_LOG_DEBUG) { pj_log(P->ctx, PJ_LOG_DEBUG, proj_context_errno_string(P->ctx, oldErrno)); } pj_log(P->ctx, PJ_LOG_DEBUG, "Did not result in valid result. " "Attempting a retry with another operation."); } const auto& alt = P->alternativeCoordinateOperations[iBest]; if( P->iCurCoordOp != iBest ) { if (proj_log_level(P->ctx, PJ_LOG_TELL) >= PJ_LOG_DEBUG) { std::string msg("Using coordinate operation "); msg += alt.name; pj_log(P->ctx, PJ_LOG_DEBUG, msg.c_str()); } P->iCurCoordOp = iBest; } PJ_COORD res = direction == PJ_FWD ? pj_fwd4d( coord, alt.pj ) : pj_inv4d( coord, alt.pj ); if( proj_errno(alt.pj) == PROJ_ERR_OTHER_NETWORK_ERROR ) { return proj_coord_error (); } if( res.xyzt.x != HUGE_VAL ) { return res; } if( iRetry == N_MAX_RETRY ) { break; } iExcluded[iRetry] = iBest; } // In case we did not find an operation whose area of use is compatible // with the input coordinate, then goes through again the list, and // use the first operation that does not require grids. NS_PROJ::io::DatabaseContextPtr dbContext; try { if( P->ctx->cpp_context ) { dbContext = P->ctx->cpp_context->getDatabaseContext().as_nullable(); } } catch( const std::exception& ) {} for( int i = 0; i < nOperations; i++ ) { const auto &alt = P->alternativeCoordinateOperations[i]; auto coordOperation = dynamic_cast< NS_PROJ::operation::CoordinateOperation*>(alt.pj->iso_obj.get()); if( coordOperation ) { if( coordOperation->gridsNeeded(dbContext, true).empty() ) { if( P->iCurCoordOp != i ) { if (proj_log_level(P->ctx, PJ_LOG_TELL) >= PJ_LOG_DEBUG) { std::string msg("Using coordinate operation "); msg += alt.name; msg += " as a fallback due to lack of more " "appropriate operations"; pj_log(P->ctx, PJ_LOG_DEBUG, msg.c_str()); } P->iCurCoordOp = i; } if( direction == PJ_FWD ) { return pj_fwd4d( coord, alt.pj ); } else { return pj_inv4d( coord, alt.pj ); } } } } proj_errno_set (P, PROJ_ERR_COORD_TRANSFM_NO_OPERATION); return proj_coord_error (); } if (direction == PJ_FWD) return pj_fwd4d (coord, P); else return pj_inv4d (coord, P); } /*****************************************************************************/ int proj_trans_array (PJ *P, PJ_DIRECTION direction, size_t n, PJ_COORD *coord) { /****************************************************************************** Batch transform an array of PJ_COORD. Performs transformation on all points, even if errors occur on some points. Individual points that fail to transform will have their components set to HUGE_VAL Returns 0 if all coordinates are transformed without error, otherwise returns a precise error number if all coordinates that fail to transform for the same reason, or a generic error code if they fail for different reasons. ******************************************************************************/ size_t i; int retErrno = 0; bool hasSetRetErrno = false; bool sameRetErrno = true; for (i = 0; i < n; i++) { proj_context_errno_set(P->ctx, 0); coord[i] = proj_trans (P, direction, coord[i]); int thisErrno = proj_errno(P); if( thisErrno != 0 ) { if( !hasSetRetErrno ) { retErrno = thisErrno; hasSetRetErrno = true; } else if( sameRetErrno && retErrno != thisErrno ) { sameRetErrno = false; retErrno = PROJ_ERR_COORD_TRANSFM; } } } proj_context_errno_set(P->ctx, retErrno); return retErrno; } /*************************************************************************************/ size_t proj_trans_generic ( PJ *P, PJ_DIRECTION direction, double *x, size_t sx, size_t nx, double *y, size_t sy, size_t ny, double *z, size_t sz, size_t nz, double *t, size_t st, size_t nt ) { /************************************************************************************** Transform a series of coordinates, where the individual coordinate dimension may be represented by an array that is either 1. fully populated 2. a null pointer and/or a length of zero, which will be treated as a fully populated array of zeroes 3. of length one, i.e. a constant, which will be treated as a fully populated array of that constant value The strides, sx, sy, sz, st, represent the step length, in bytes, between consecutive elements of the corresponding array. This makes it possible for proj_transform to handle transformation of a large class of application specific data structures, without necessarily understanding the data structure format, as in: typedef struct {double x, y; int quality_level; char surveyor_name[134];} XYQS; XYQS survey[345]; double height = 23.45; PJ *P = {...}; size_t stride = sizeof (XYQS); ... proj_transform ( P, PJ_INV, sizeof(XYQS), &(survey[0].x), stride, 345, (* We have 345 eastings *) &(survey[0].y), stride, 345, (* ...and 345 northings. *) &height, 1, (* The height is the constant 23.45 m *) 0, 0 (* and the time is the constant 0.00 s *) ); This is similar to the inner workings of the pj_transform function, but the stride functionality has been generalized to work for any size of basic unit, not just a fixed number of doubles. In most cases, the stride will be identical for x, y,z, and t, since they will typically be either individual arrays (stride = sizeof(double)), or strided views into an array of application specific data structures (stride = sizeof (...)). But in order to support cases where x, y, z, and t come from heterogeneous sources, individual strides, sx, sy, sz, st, are used. Caveat: Since proj_transform does its work *in place*, this means that even the supposedly constants (i.e. length 1 arrays) will return from the call in altered state. Hence, remember to reinitialize between repeated calls. Return value: Number of transformations completed. **************************************************************************************/ PJ_COORD coord = {{0,0,0,0}}; size_t i, nmin; double null_broadcast = 0; double invalid_time = HUGE_VAL; if (nullptr==P) return 0; if (P->inverted) direction = opposite_direction(direction); /* ignore lengths of null arrays */ if (nullptr==x) nx = 0; if (nullptr==y) ny = 0; if (nullptr==z) nz = 0; if (nullptr==t) nt = 0; /* and make the nullities point to some real world memory for broadcasting nulls */ if (0==nx) x = &null_broadcast; if (0==ny) y = &null_broadcast; if (0==nz) z = &null_broadcast; if (0==nt) t = &invalid_time; /* nothing to do? */ if (0==nx+ny+nz+nt) return 0; /* arrays of length 1 are constants, which we broadcast along the longer arrays */ /* so we need to find the length of the shortest non-unity array to figure out */ /* how many coordinate pairs we must transform */ nmin = (nx > 1)? nx: (ny > 1)? ny: (nz > 1)? nz: (nt > 1)? nt: 1; if ((nx > 1) && (nx < nmin)) nmin = nx; if ((ny > 1) && (ny < nmin)) nmin = ny; if ((nz > 1) && (nz < nmin)) nmin = nz; if ((nt > 1) && (nt < nmin)) nmin = nt; /* Check validity of direction flag */ switch (direction) { case PJ_FWD: case PJ_INV: break; case PJ_IDENT: return nmin; } /* Arrays of length==0 are broadcast as the constant 0 */ /* Arrays of length==1 are broadcast as their single value */ /* Arrays of length >1 are iterated over (for the first nmin values) */ /* The slightly convolved incremental indexing is used due */ /* to the stride, which may be any size supported by the platform */ for (i = 0; i < nmin; i++) { coord.xyzt.x = *x; coord.xyzt.y = *y; coord.xyzt.z = *z; coord.xyzt.t = *t; coord = proj_trans(P, direction, coord); /* in all full length cases, we overwrite the input with the output, */ /* and step on to the next element. */ /* The casts are somewhat funky, but they compile down to no-ops and */ /* they tell compilers and static analyzers that we know what we do */ if (nx > 1) { *x = coord.xyzt.x; x = (double *) ((void *) ( ((char *) x) + sx)); } if (ny > 1) { *y = coord.xyzt.y; y = (double *) ((void *) ( ((char *) y) + sy)); } if (nz > 1) { *z = coord.xyzt.z; z = (double *) ((void *) ( ((char *) z) + sz)); } if (nt > 1) { *t = coord.xyzt.t; t = (double *) ((void *) ( ((char *) t) + st)); } } /* Last time around, we update the length 1 cases with their transformed alter egos */ if (nx==1) *x = coord.xyzt.x; if (ny==1) *y = coord.xyzt.y; if (nz==1) *z = coord.xyzt.z; if (nt==1) *t = coord.xyzt.t; return i; } /*************************************************************************************/ PJ_COORD pj_geocentric_latitude (const PJ *P, PJ_DIRECTION direction, PJ_COORD coord) { /************************************************************************************** Convert geographical latitude to geocentric (or the other way round if direction = PJ_INV) The conversion involves a call to the tangent function, which goes through the roof at the poles, so very close (the last centimeter) to the poles no conversion takes place and the input latitude is copied directly to the output. Fortunately, the geocentric latitude converges to the geographical at the poles, so the difference is negligible. For the spherical case, the geographical latitude equals the geocentric, and consequently, the input is copied directly to the output. **************************************************************************************/ const double limit = M_HALFPI - 1e-9; PJ_COORD res = coord; if ((coord.lp.phi > limit) || (coord.lp.phi < -limit) || (P->es==0)) return res; if (direction==PJ_FWD) res.lp.phi = atan (P->one_es * tan (coord.lp.phi) ); else res.lp.phi = atan (P->rone_es * tan (coord.lp.phi) ); return res; } double proj_torad (double angle_in_degrees) { return PJ_TORAD (angle_in_degrees);} double proj_todeg (double angle_in_radians) { return PJ_TODEG (angle_in_radians);} double proj_dmstor(const char *is, char **rs) { return dmstor(is, rs); } char* proj_rtodms(char *s, double r, int pos, int neg) { return rtodms(s, r, pos, neg); } /*************************************************************************************/ static PJ* skip_prep_fin(PJ *P) { /************************************************************************************** Skip prepare and finalize function for the various "helper operations" added to P when in cs2cs compatibility mode. **************************************************************************************/ P->skip_fwd_prepare = 1; P->skip_fwd_finalize = 1; P->skip_inv_prepare = 1; P->skip_inv_finalize = 1; return P; } /*************************************************************************************/ static int cs2cs_emulation_setup (PJ *P) { /************************************************************************************** If any cs2cs style modifiers are given (axis=..., towgs84=..., ) create the 4D API equivalent operations, so the preparation and finalization steps in the pj_inv/pj_fwd invocators can emulate the behavior of pj_transform and the cs2cs app. Returns 1 on success, 0 on failure **************************************************************************************/ PJ *Q; paralist *p; int do_cart = 0; if (nullptr==P) return 0; /* Don't recurse when calling proj_create (which calls us back) */ if (pj_param_exists (P->params, "break_cs2cs_recursion")) return 1; /* Swap axes? */ p = pj_param_exists (P->params, "axis"); const bool disable_grid_presence_check = pj_param_exists ( P->params, "disable_grid_presence_check") != nullptr; /* Don't axisswap if data are already in "enu" order */ if (p && (0!=strcmp ("enu", p->param))) { char *def = static_cast(malloc (100+strlen(P->axis))); if (nullptr==def) return 0; sprintf (def, "break_cs2cs_recursion proj=axisswap axis=%s", P->axis); Q = pj_create_internal (P->ctx, def); free (def); if (nullptr==Q) return 0; P->axisswap = skip_prep_fin(Q); } /* Geoid grid(s) given? */ p = pj_param_exists (P->params, "geoidgrids"); if (!disable_grid_presence_check && p && strlen (p->param) > strlen ("geoidgrids=")) { char *gridnames = p->param + strlen ("geoidgrids="); char *def = static_cast(malloc (100+2*strlen(gridnames))); if (nullptr==def) return 0; sprintf (def, "break_cs2cs_recursion proj=vgridshift grids=%s", pj_double_quote_string_param_if_needed(gridnames).c_str()); Q = pj_create_internal (P->ctx, def); free (def); if (nullptr==Q) return 0; P->vgridshift = skip_prep_fin(Q); } /* Datum shift grid(s) given? */ p = pj_param_exists (P->params, "nadgrids"); if (!disable_grid_presence_check && p && strlen (p->param) > strlen ("nadgrids=")) { char *gridnames = p->param + strlen ("nadgrids="); char *def = static_cast(malloc (100+2*strlen(gridnames))); if (nullptr==def) return 0; sprintf (def, "break_cs2cs_recursion proj=hgridshift grids=%s", pj_double_quote_string_param_if_needed(gridnames).c_str()); Q = pj_create_internal (P->ctx, def); free (def); if (nullptr==Q) return 0; P->hgridshift = skip_prep_fin(Q); } /* We ignore helmert if we have grid shift */ p = P->hgridshift ? nullptr : pj_param_exists (P->params, "towgs84"); while (p) { char *def; char *s = p->param; double *d = P->datum_params; size_t n = strlen (s); /* We ignore null helmert shifts (common in auto-translated resource files, e.g. epsg) */ if (0==d[0] && 0==d[1] && 0==d[2] && 0==d[3] && 0==d[4] && 0==d[5] && 0==d[6]) { /* If the current ellipsoid is not WGS84, then make sure the */ /* change in ellipsoid is still done. */ if (!(fabs(P->a_orig - 6378137.0) < 1e-8 && fabs(P->es_orig - 0.0066943799901413) < 1e-15)) { do_cart = 1; } break; } if (n <= 8) /* 8==strlen ("towgs84=") */ return 0; def = static_cast(malloc (100+n)); if (nullptr==def) return 0; sprintf (def, "break_cs2cs_recursion proj=helmert exact %s convention=position_vector", s); Q = pj_create_internal (P->ctx, def); free(def); if (nullptr==Q) return 0; pj_inherit_ellipsoid_def (P, Q); P->helmert = skip_prep_fin (Q); break; } /* We also need cartesian/geographical transformations if we are working in */ /* geocentric/cartesian space or we need to do a Helmert transform. */ if (P->is_geocent || P->helmert || do_cart) { char def[150]; sprintf (def, "break_cs2cs_recursion proj=cart a=%40.20g es=%40.20g", P->a_orig, P->es_orig); { /* In case the current locale does not use dot but comma as decimal */ /* separator, replace it with dot, so that proj_atof() behaves */ /* correctly. */ /* TODO later: use C++ ostringstream with imbue(std::locale::classic()) */ /* to be locale unaware */ char* next_pos; for (next_pos = def; (next_pos = strchr (next_pos, ',')) != nullptr; next_pos++) { *next_pos = '.'; } } Q = pj_create_internal (P->ctx, def); if (nullptr==Q) return 0; P->cart = skip_prep_fin (Q); if (!P->is_geocent) { sprintf (def, "break_cs2cs_recursion proj=cart ellps=WGS84"); Q = pj_create_internal (P->ctx, def); if (nullptr==Q) return 0; P->cart_wgs84 = skip_prep_fin (Q); } } return 1; } /*************************************************************************************/ PJ *pj_create_internal (PJ_CONTEXT *ctx, const char *definition) { /*************************************************************************************/ /************************************************************************************** Create a new PJ object in the context ctx, using the given definition. If ctx==0, the default context is used, if definition==0, or invalid, a null-pointer is returned. The definition may use '+' as argument start indicator, as in "+proj=utm +zone=32", or leave it out, as in "proj=utm zone=32". It may even use free formatting "proj = utm; zone =32 ellps= GRS80". Note that the semicolon separator is allowed, but not required. **************************************************************************************/ char *args, **argv; size_t argc, n; if (nullptr==ctx) ctx = pj_get_default_ctx (); /* Make a copy that we can manipulate */ n = strlen (definition); args = (char *) malloc (n + 1); if (nullptr==args) { proj_context_errno_set(ctx, PROJ_ERR_OTHER /*ENOMEM*/); return nullptr; } strcpy (args, definition); argc = pj_trim_argc (args); if (argc==0) { free (args); proj_context_errno_set(ctx, PROJ_ERR_INVALID_OP_MISSING_ARG); return nullptr; } argv = pj_trim_argv (argc, args); if (!argv) { free(args); proj_context_errno_set(ctx, PROJ_ERR_OTHER /*ENOMEM*/); return nullptr; } PJ* P = pj_create_argv_internal (ctx, (int) argc, argv); free (argv); free (args); return P; } /*************************************************************************************/ PJ *proj_create_argv (PJ_CONTEXT *ctx, int argc, char **argv) { /************************************************************************************** Create a new PJ object in the context ctx, using the given definition argument array argv. If ctx==0, the default context is used, if definition==0, or invalid, a null-pointer is returned. The definition arguments may use '+' as argument start indicator, as in {"+proj=utm", "+zone=32"}, or leave it out, as in {"proj=utm", "zone=32"}. **************************************************************************************/ PJ *P; const char *c; if (nullptr==ctx) ctx = pj_get_default_ctx (); if (nullptr==argv) { proj_context_errno_set(ctx, PROJ_ERR_INVALID_OP_MISSING_ARG); return nullptr; } /* We assume that free format is used, and build a full proj_create compatible string */ c = pj_make_args (argc, argv); if (nullptr==c) { proj_context_errno_set(ctx, PROJ_ERR_INVALID_OP /* ENOMEM */); return nullptr; } P = proj_create (ctx, c); free ((char *) c); return P; } /*************************************************************************************/ PJ *pj_create_argv_internal (PJ_CONTEXT *ctx, int argc, char **argv) { /************************************************************************************** For use by pipeline init function. **************************************************************************************/ if (nullptr==ctx) ctx = pj_get_default_ctx (); if (nullptr==argv) { proj_context_errno_set(ctx, PROJ_ERR_INVALID_OP_MISSING_ARG); return nullptr; } /* ...and let pj_init_ctx do the hard work */ /* New interface: forbid init=epsg:XXXX syntax by default */ const int allow_init_epsg = proj_context_get_use_proj4_init_rules(ctx, FALSE); PJ* P = pj_init_ctx_with_allow_init_epsg (ctx, argc, argv, allow_init_epsg); /* Support cs2cs-style modifiers */ int ret = cs2cs_emulation_setup (P); if (0==ret) return proj_destroy (P); return P; } /** Create an area of use */ PJ_AREA * proj_area_create(void) { return static_cast(calloc(1, sizeof(PJ_AREA))); } /** Assign a bounding box to an area of use. */ void proj_area_set_bbox(PJ_AREA *area, double west_lon_degree, double south_lat_degree, double east_lon_degree, double north_lat_degree) { area->bbox_set = TRUE; area->west_lon_degree = west_lon_degree; area->south_lat_degree = south_lat_degree; area->east_lon_degree = east_lon_degree; area->north_lat_degree = north_lat_degree; } /** Free an area of use */ void proj_area_destroy(PJ_AREA* area) { free(area); } /************************************************************************/ /* proj_context_use_proj4_init_rules() */ /************************************************************************/ void proj_context_use_proj4_init_rules(PJ_CONTEXT *ctx, int enable) { if( ctx == nullptr ) { ctx = pj_get_default_ctx(); } ctx->use_proj4_init_rules = enable; } /************************************************************************/ /* EQUAL() */ /************************************************************************/ static int EQUAL(const char* a, const char* b) { #ifdef _MSC_VER return _stricmp(a, b) == 0; #else return strcasecmp(a, b) == 0; #endif } /************************************************************************/ /* proj_context_get_use_proj4_init_rules() */ /************************************************************************/ int proj_context_get_use_proj4_init_rules(PJ_CONTEXT *ctx, int from_legacy_code_path) { const char* val = getenv("PROJ_USE_PROJ4_INIT_RULES"); if( ctx == nullptr ) { ctx = pj_get_default_ctx(); } if( val ) { if( EQUAL(val, "yes") || EQUAL(val, "on") || EQUAL(val, "true") ) { return TRUE; } if( EQUAL(val, "no") || EQUAL(val, "off") || EQUAL(val, "false") ) { return FALSE; } pj_log(ctx, PJ_LOG_ERROR, "Invalid value for PROJ_USE_PROJ4_INIT_RULES"); } if( ctx->use_proj4_init_rules >= 0 ) { return ctx->use_proj4_init_rules; } return from_legacy_code_path; } /** Adds a " +type=crs" suffix to a PROJ string (if it is a PROJ string) */ std::string pj_add_type_crs_if_needed(const std::string& str) { std::string ret(str); if( (starts_with(str, "proj=") || starts_with(str, "+proj=") || starts_with(str, "+init=") || starts_with(str, "+title=")) && str.find("type=crs") == std::string::npos ) { ret += " +type=crs"; } return ret; } // --------------------------------------------------------------------------- static double simple_min(const double* data, const int arr_len) { double min_value = data[0]; for( int iii = 1; iii < arr_len; iii++ ) { if (data[iii] < min_value) min_value = data[iii]; } return min_value; } // --------------------------------------------------------------------------- static double simple_max(const double* data, const int arr_len) { double max_value = data[0]; for( int iii = 1; iii < arr_len; iii++ ) { if ((data[iii] > max_value || max_value == HUGE_VAL) && data[iii] != HUGE_VAL) max_value = data[iii]; } return max_value; } // --------------------------------------------------------------------------- static int _find_previous_index(const int iii, const double* data, const int arr_len) { // find index of nearest valid previous value if exists int prev_iii = iii - 1; if (prev_iii == -1) // handle wraparound prev_iii = arr_len - 1; while (data[prev_iii] == HUGE_VAL && prev_iii != iii) { prev_iii --; if (prev_iii == -1) // handle wraparound prev_iii = arr_len - 1; } return prev_iii; } // --------------------------------------------------------------------------- /****************************************************************************** Handles the case when longitude values cross the antimeridian when calculating the minimum. Note: The data array must be in a linear ring. Note: This requires a densified ring with at least 2 additional points per edge to correctly handle global extents. If only 1 additional point: | | |RL--x0--|RL-- | | -180 180|-180 If they are evenly spaced and it crosses the antimeridian: x0 - L = 180 R - x0 = -180 For example: Let R = -179.9, x0 = 0.1, L = -179.89 x0 - L = 0.1 - -179.9 = 180 R - x0 = -179.89 - 0.1 ~= -180 This is the same in the case when it didn't cross the antimeridian. If you have 2 additional points: | | |RL--x0--x1--|RL-- | | -180 180|-180 If they are evenly spaced and it crosses the antimeridian: x0 - L = 120 x1 - x0 = 120 R - x1 = -240 For example: Let R = -179.9, x0 = -59.9, x1 = 60.1 L = -179.89 x0 - L = 59.9 - -179.9 = 120 x1 - x0 = 60.1 - 59.9 = 120 R - x1 = -179.89 - 60.1 ~= -240 However, if they are evenly spaced and it didn't cross the antimeridian: x0 - L = 120 x1 - x0 = 120 R - x1 = 120 From this, we have a delta that is guaranteed to be significantly large enough to tell the difference reguarless of the direction the antimeridian was crossed. However, even though the spacing was even in the source projection, it isn't guaranteed in the target geographic projection. So, instead of 240, 200 is used as it significantly larger than 120 to be sure that the antimeridian was crossed but smalller than 240 to account for possible irregularities in distances when re-projecting. Also, 200 ensures latitudes are ignored for axis order handling. ******************************************************************************/ static double antimeridian_min(const double* data, const int arr_len) { double positive_min = HUGE_VAL; double min_value = HUGE_VAL; int crossed_meridian_count = 0; bool positive_meridian = false; for( int iii = 0; iii < arr_len; iii++ ) { if (data[iii] == HUGE_VAL) continue; int prev_iii = _find_previous_index(iii, data, arr_len); // check if crossed meridian double delta = data[prev_iii] - data[iii]; // 180 -> -180 if (delta >= 200 && delta != HUGE_VAL) { if (crossed_meridian_count == 0) positive_min = min_value; crossed_meridian_count ++; positive_meridian = false; // -180 -> 180 } else if (delta <= -200 && delta != HUGE_VAL) { if (crossed_meridian_count == 0) positive_min = data[iii]; crossed_meridian_count ++; positive_meridian = true; } // positive meridian side min if (positive_meridian && data[iii] < positive_min) positive_min = data[iii]; // track general min value if (data[iii] < min_value) min_value = data[iii]; } if (crossed_meridian_count == 2) return positive_min; else if (crossed_meridian_count == 4) // bounds extends beyond -180/180 return -180; return min_value; } // --------------------------------------------------------------------------- // Handles the case when longitude values cross the antimeridian // when calculating the minimum. // Note: The data array must be in a linear ring. // Note: This requires a densified ring with at least 2 additional // points per edge to correctly handle global extents. // See antimeridian_min docstring for reasoning. static double antimeridian_max(const double* data, const int arr_len) { double negative_max = -HUGE_VAL; double max_value = -HUGE_VAL; bool negative_meridian = false; int crossed_meridian_count = 0; for( int iii = 0; iii < arr_len; iii++ ) { if (data[iii] == HUGE_VAL) continue; int prev_iii = _find_previous_index(iii, data, arr_len); // check if crossed meridian double delta = data[prev_iii] - data[iii]; // 180 -> -180 if (delta >= 200 && delta != HUGE_VAL) { if (crossed_meridian_count == 0) negative_max = data[iii]; crossed_meridian_count ++; negative_meridian = true; // -180 -> 180 } else if (delta <= -200 && delta != HUGE_VAL){ if (crossed_meridian_count == 0) negative_max = max_value; negative_meridian = false; crossed_meridian_count++; } // negative meridian side max if (negative_meridian && (data[iii] > negative_max || negative_max == HUGE_VAL) && data[iii] != HUGE_VAL ) negative_max = data[iii]; // track general max value if ((data[iii] > max_value || max_value == HUGE_VAL) && data[iii] != HUGE_VAL) max_value = data[iii]; } if (crossed_meridian_count == 2) return negative_max; else if (crossed_meridian_count == 4) // bounds extends beyond -180/180 return 180; return max_value; } // --------------------------------------------------------------------------- // Check if the original projected bounds contains // the north pole. // This assumes that the destination CRS is geographic. static bool contains_north_pole( PJ* projobj, PJ_DIRECTION pj_direction, const double xmin, const double ymin, const double xmax, const double ymax, bool lon_lat_order ) { double pole_y = 90; double pole_x = 0; if (!lon_lat_order) { pole_y = 0; pole_x = 90; } proj_trans_generic( projobj, opposite_direction(pj_direction), &pole_x, sizeof(double), 1, &pole_y, sizeof(double), 1, nullptr, sizeof(double), 0, nullptr, sizeof(double), 0 ); if (xmin < pole_x && pole_x < xmax && ymax > pole_y && pole_y > ymin) return true; return false; } // --------------------------------------------------------------------------- // Check if the original projected bounds contains // the south pole. // This assumes that the destination CRS is geographic. static bool contains_south_pole( PJ* projobj, PJ_DIRECTION pj_direction, const double xmin, const double ymin, const double xmax, const double ymax, bool lon_lat_order ) { double pole_y = -90; double pole_x = 0; if (!lon_lat_order) { pole_y = 0; pole_x = -90; } proj_trans_generic( projobj, opposite_direction(pj_direction), &pole_x, sizeof(double), 1, &pole_y, sizeof(double), 1, nullptr, sizeof(double), 0, nullptr, sizeof(double), 0 ); if (xmin < pole_x && pole_x < xmax && ymax > pole_y && pole_y > ymin) return true; return false; } // --------------------------------------------------------------------------- // Check if the target CRS of the transformation // has the longitude latitude axis order. // This assumes that the destination CRS is geographic. static int target_crs_lon_lat_order( PJ_CONTEXT* transformer_ctx, PJ* transformer_pj, PJ_DIRECTION pj_direction ) { PJ* target_crs = nullptr; if (pj_direction == PJ_FWD) target_crs = proj_get_target_crs(transformer_ctx, transformer_pj); else if (pj_direction == PJ_INV) target_crs = proj_get_source_crs(transformer_ctx, transformer_pj); if (target_crs == nullptr) { proj_context_log_debug(transformer_ctx, "Unable to retrieve target CRS"); return -1; } PJ* coord_system_pj = proj_crs_get_coordinate_system( transformer_ctx, target_crs ); proj_destroy(target_crs); if (coord_system_pj == nullptr) { proj_context_log_debug(transformer_ctx, "Unable to get target CRS coordinate system."); return -1; } const char* abbrev = nullptr; int success = proj_cs_get_axis_info( transformer_ctx, coord_system_pj, 0, nullptr, &abbrev, nullptr, nullptr, nullptr, nullptr, nullptr ); proj_destroy(coord_system_pj); if (success != 1) return -1; return strcmp(abbrev, "lon") == 0 || strcmp(abbrev, "Lon") == 0; } // --------------------------------------------------------------------------- /** \brief Transform boundary, * * Transform boundary densifying the edges to account for nonlinear * transformations along these edges and extracting the outermost bounds. * * If the destination CRS is geographic, the first axis is longitude, * and xmax < xmin then the bounds crossed the antimeridian. * In this scenario there are two polygons, one on each side of the antimeridian. * The first polygon should be constructed with (xmin, ymin, 180, ymax) * and the second with (-180, ymin, xmax, ymax). * * If the destination CRS is geographic, the first axis is latitude, * and ymax < ymin then the bounds crossed the antimeridian. * In this scenario there are two polygons, one on each side of the antimeridian. * The first polygon should be constructed with (ymin, xmin, ymax, 180) * and the second with (ymin, -180, ymax, xmax). * * @param context The PJ_CONTEXT object. * @param P The PJ object representing the transformation. * @param direction The direction of the transformation. * @param xmin Minimum bounding coordinate of the first axis in source CRS * (target CRS if direction is inverse). * @param ymin Minimum bounding coordinate of the second axis in source CRS. * (target CRS if direction is inverse). * @param xmax Maximum bounding coordinate of the first axis in source CRS. * (target CRS if direction is inverse). * @param ymax Maximum bounding coordinate of the second axis in source CRS. * (target CRS if direction is inverse). * @param out_xmin Minimum bounding coordinate of the first axis in target CRS * (source CRS if direction is inverse). * @param out_ymin Minimum bounding coordinate of the second axis in target CRS. * (source CRS if direction is inverse). * @param out_xmax Maximum bounding coordinate of the first axis in target CRS. * (source CRS if direction is inverse). * @param out_ymax Maximum bounding coordinate of the second axis in target CRS. * (source CRS if direction is inverse). * @param densify_pts Recommended to use 21. This is the number of points * to use to densify the bounding polygon in the transformation. * @return an integer. 1 if successful. 0 if failures encountered. * @since 8.2 */ int proj_trans_bounds(PJ_CONTEXT* context, PJ *P, PJ_DIRECTION direction, const double xmin, const double ymin, const double xmax, const double ymax, double* out_xmin, double* out_ymin, double* out_xmax, double* out_ymax, const int densify_pts ) { *out_xmin = HUGE_VAL; *out_ymin = HUGE_VAL; *out_xmax = HUGE_VAL; *out_ymax = HUGE_VAL; if (P == nullptr) { proj_log_error(P, _("NULL P object not allowed.")); proj_errno_set (P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); return false; } if (densify_pts < 0 || densify_pts > 10000) { proj_log_error(P, _("densify_pts must be between 0-10000.")); proj_errno_set (P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); return false; } PJ_PROJ_INFO pj_info = proj_pj_info(P); if (pj_info.id == nullptr) { proj_log_error(P, _("NULL transformation not allowed,")); proj_errno_set (P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); return false; } if (strcmp(pj_info.id, "noop") == 0 || direction == PJ_IDENT) { *out_xmin = xmin; *out_xmax = xmax; *out_ymin = ymin; *out_ymax = ymax; return true; } bool degree_output = proj_degree_output(P, direction) != 0; bool degree_input = proj_degree_input(P, direction) != 0; if (degree_output && densify_pts < 2) { proj_log_error(P, _("densify_pts must be at least 2 if the output is geograpic.")); proj_errno_set (P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); return false; } int side_pts = densify_pts + 1; // add one because we are densifying const int boundary_len = side_pts * 4; std::vector x_boundary_array; std::vector y_boundary_array; try { x_boundary_array.resize(boundary_len); y_boundary_array.resize(boundary_len); } catch( const std::exception & e ) // memory allocation failure { proj_log_error(P, e.what()); proj_errno_set (P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); return false; } double delta_x = 0; double delta_y = 0; bool north_pole_in_bounds = false; bool south_pole_in_bounds = false; bool input_lon_lat_order = false; bool output_lon_lat_order = false; if (degree_input) { int in_order_lon_lat = target_crs_lon_lat_order( context, P, opposite_direction(direction) ); if (in_order_lon_lat == -1) return false; input_lon_lat_order = in_order_lon_lat != 0; } if (degree_output) { int out_order_lon_lat = target_crs_lon_lat_order(context, P, direction); if (out_order_lon_lat == -1) return false; output_lon_lat_order = out_order_lon_lat != 0; north_pole_in_bounds = contains_north_pole( P, direction, xmin, ymin, xmax, ymax, output_lon_lat_order ); south_pole_in_bounds = contains_south_pole( P, direction, xmin, ymin, xmax, ymax, output_lon_lat_order ); } if (degree_input && xmax < xmin) { if (!input_lon_lat_order) { proj_log_error(P, _("latitude max < latitude min.")); proj_errno_set (P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); return false; } // handle antimeridian delta_x = (xmax - xmin + 360.0) / side_pts; } else { delta_x = (xmax - xmin) / side_pts; } if (degree_input && ymax < ymin) { if (input_lon_lat_order) { proj_log_error(P, _("latitude max < latitude min.")); proj_errno_set (P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); return false; } // handle antimeridian delta_y = (ymax - ymin + 360.0) / side_pts; } else { delta_y = (ymax - ymin) / side_pts; } // build densified bounding box // Note: must be a linear ring for antimeridian logic for( int iii = 0; iii < side_pts; iii++ ) { // xmin boundary y_boundary_array[iii] = ymax - iii * delta_y; x_boundary_array[iii] = xmin; // ymin boundary y_boundary_array[iii + side_pts] = ymin; x_boundary_array[iii + side_pts] = xmin + iii * delta_x; // xmax boundary y_boundary_array[iii + side_pts * 2] = ymin + iii * delta_y; x_boundary_array[iii + side_pts * 2] = xmax; // ymax boundary y_boundary_array[iii + side_pts * 3] = ymax; x_boundary_array[iii + side_pts * 3] = xmax - iii * delta_x; } proj_trans_generic ( P, direction, &x_boundary_array[0], sizeof(double), boundary_len, &y_boundary_array[0], sizeof(double), boundary_len, nullptr, 0, 0, nullptr, 0, 0 ); if (!degree_output) { *out_xmin = simple_min(&x_boundary_array[0], boundary_len); *out_xmax = simple_max(&x_boundary_array[0], boundary_len); *out_ymin = simple_min(&y_boundary_array[0], boundary_len); *out_ymax = simple_max(&y_boundary_array[0], boundary_len); } else if (north_pole_in_bounds && output_lon_lat_order) { *out_xmin = -180; *out_ymin = simple_min(&y_boundary_array[0], boundary_len); *out_xmax = 180; *out_ymax = 90; } else if (north_pole_in_bounds) { *out_xmin = simple_min(&x_boundary_array[0], boundary_len); *out_ymin = -180; *out_xmax = 90; *out_ymax = 180; } else if (south_pole_in_bounds && output_lon_lat_order) { *out_xmin = -180; *out_ymin = -90; *out_xmax = 180; *out_ymax = simple_max(&y_boundary_array[0], boundary_len); } else if (south_pole_in_bounds) { *out_xmin = -90; *out_ymin = -180; *out_xmax = simple_max(&x_boundary_array[0], boundary_len); *out_ymax = 180; } else if (output_lon_lat_order) { *out_xmin = antimeridian_min(&x_boundary_array[0], boundary_len); *out_xmax = antimeridian_max(&x_boundary_array[0], boundary_len); *out_ymin = simple_min(&y_boundary_array[0], boundary_len); *out_ymax = simple_max(&y_boundary_array[0], boundary_len); } else { *out_xmin = simple_min(&x_boundary_array[0], boundary_len); *out_xmax = simple_max(&x_boundary_array[0], boundary_len); *out_ymin = antimeridian_min(&y_boundary_array[0], boundary_len); *out_ymax = antimeridian_max(&y_boundary_array[0], boundary_len); } return true; } /*****************************************************************************/ static void reproject_bbox(PJ* pjGeogToCrs, double west_lon, double south_lat, double east_lon, double north_lat, double& minx, double& miny, double& maxx, double& maxy) { /*****************************************************************************/ minx = -std::numeric_limits::max(); miny = -std::numeric_limits::max(); maxx = std::numeric_limits::max(); maxy = std::numeric_limits::max(); if( !(west_lon == -180.0 && east_lon == 180.0 && south_lat == -90.0 && north_lat == 90.0) ) { minx = -minx; miny = -miny; maxx = -maxx; maxy = -maxy; constexpr int N_STEPS = 20; constexpr int N_STEPS_P1 = N_STEPS+1; constexpr int XY_SIZE = N_STEPS_P1 * 4; std::vector x(XY_SIZE); std::vector y(XY_SIZE); const double step_lon = (east_lon - west_lon) / N_STEPS; const double step_lat = (north_lat - south_lat) / N_STEPS; for( int j = 0; j <= N_STEPS; j++ ) { x[j] = west_lon + j * step_lon; y[j] = south_lat; x[N_STEPS_P1+j] = x[j]; y[N_STEPS_P1+j] = north_lat; x[N_STEPS_P1*2+j] = west_lon; y[N_STEPS_P1*2+j] = south_lat + j * step_lat; x[N_STEPS_P1*3+j] = east_lon; y[N_STEPS_P1*3+j] = y[N_STEPS_P1*2+j]; } proj_trans_generic ( pjGeogToCrs, PJ_FWD, &x[0], sizeof(double), XY_SIZE, &y[0], sizeof(double), XY_SIZE, nullptr, 0, 0, nullptr, 0, 0); for( int j = 0; j < XY_SIZE; j++ ) { if( x[j] != HUGE_VAL && y[j] != HUGE_VAL ) { minx = std::min(minx, x[j]); miny = std::min(miny, y[j]); maxx = std::max(maxx, x[j]); maxy = std::max(maxy, y[j]); } } } } /*****************************************************************************/ static PJ* add_coord_op_to_list( int idxInOriginalList, PJ* op, double west_lon, double south_lat, double east_lon, double north_lat, PJ* pjGeogToSrc, PJ* pjGeogToDst, bool isOffshore, std::vector& altCoordOps) { /*****************************************************************************/ double minxSrc; double minySrc; double maxxSrc; double maxySrc; double minxDst; double minyDst; double maxxDst; double maxyDst; reproject_bbox(pjGeogToSrc, west_lon, south_lat, east_lon, north_lat, minxSrc, minySrc, maxxSrc, maxySrc); reproject_bbox(pjGeogToDst, west_lon, south_lat, east_lon, north_lat, minxDst, minyDst, maxxDst, maxyDst); if( minxSrc <= maxxSrc && minxDst <= maxxDst ) { const char* c_name = proj_get_name(op); std::string name(c_name ? c_name : ""); const double accuracy = proj_coordoperation_get_accuracy(op->ctx, op); altCoordOps.emplace_back(idxInOriginalList, minxSrc, minySrc, maxxSrc, maxySrc, minxDst, minyDst, maxxDst, maxyDst, op, name, accuracy, isOffshore); op = nullptr; } return op; } /*****************************************************************************/ static PJ* create_operation_to_geog_crs(PJ_CONTEXT* ctx, const PJ* crs) { /*****************************************************************************/ // Create a geographic 2D long-lat degrees CRS that is related to the // CRS auto geodetic_crs = proj_crs_get_geodetic_crs(ctx, crs); if( !geodetic_crs ) { proj_context_log_debug(ctx, "Cannot find geodetic CRS matching CRS"); return nullptr; } auto geodetic_crs_type = proj_get_type(geodetic_crs); if( geodetic_crs_type == PJ_TYPE_GEOCENTRIC_CRS || geodetic_crs_type == PJ_TYPE_GEOGRAPHIC_2D_CRS || geodetic_crs_type == PJ_TYPE_GEOGRAPHIC_3D_CRS ) { auto datum = proj_crs_get_datum_forced(ctx, geodetic_crs); assert( datum ); auto cs = proj_create_ellipsoidal_2D_cs( ctx, PJ_ELLPS2D_LONGITUDE_LATITUDE, nullptr, 0); auto ellps = proj_get_ellipsoid(ctx, datum); proj_destroy(datum); double semi_major_metre = 0; double inv_flattening = 0; proj_ellipsoid_get_parameters(ctx, ellps, &semi_major_metre, nullptr, nullptr, &inv_flattening); // It is critical to set the prime meridian to 0 auto temp = proj_create_geographic_crs( ctx, "unnamed crs", "unnamed datum", proj_get_name(ellps), semi_major_metre, inv_flattening, "Reference prime meridian", 0, nullptr, 0, cs); proj_destroy(ellps); proj_destroy(cs); proj_destroy(geodetic_crs); geodetic_crs = temp; geodetic_crs_type = proj_get_type(geodetic_crs); } if( geodetic_crs_type != PJ_TYPE_GEOGRAPHIC_2D_CRS ) { // Shouldn't happen proj_context_log_debug(ctx, "Cannot find geographic CRS matching CRS"); proj_destroy(geodetic_crs); return nullptr; } // Create the transformation from this geographic 2D CRS to the source CRS auto operation_ctx = proj_create_operation_factory_context(ctx, nullptr); proj_operation_factory_context_set_spatial_criterion( ctx, operation_ctx, PROJ_SPATIAL_CRITERION_PARTIAL_INTERSECTION); proj_operation_factory_context_set_grid_availability_use( ctx, operation_ctx, PROJ_GRID_AVAILABILITY_DISCARD_OPERATION_IF_MISSING_GRID); auto target_crs_2D = proj_crs_demote_to_2D(ctx, nullptr, crs); auto op_list_to_geodetic = proj_create_operations( ctx, geodetic_crs, target_crs_2D, operation_ctx); proj_destroy(target_crs_2D); proj_operation_factory_context_destroy(operation_ctx); proj_destroy(geodetic_crs); const int nOpCount = op_list_to_geodetic == nullptr ? 0 : proj_list_get_count(op_list_to_geodetic); if( nOpCount == 0 ) { proj_context_log_debug(ctx, "Cannot compute transformation from geographic CRS to CRS"); proj_list_destroy(op_list_to_geodetic); return nullptr; } PJ* opGeogToCrs = nullptr; // Use in priority operations *without* grids for(int i = 0; i < nOpCount; i++ ) { auto op = proj_list_get(ctx, op_list_to_geodetic, i); assert(op); if( proj_coordoperation_get_grid_used_count(ctx, op) == 0 ) { opGeogToCrs = op; break; } proj_destroy(op); } if( opGeogToCrs == nullptr ) { opGeogToCrs = proj_list_get(ctx, op_list_to_geodetic, 0); assert(opGeogToCrs); } proj_list_destroy(op_list_to_geodetic); return opGeogToCrs; } /*****************************************************************************/ PJ *proj_create_crs_to_crs (PJ_CONTEXT *ctx, const char *source_crs, const char *target_crs, PJ_AREA *area) { /****************************************************************************** Create a transformation pipeline between two known coordinate reference systems. See docs/source/development/reference/functions.rst ******************************************************************************/ if( !ctx ) { ctx = pj_get_default_ctx(); } PJ* src; PJ* dst; try { std::string source_crs_modified(pj_add_type_crs_if_needed(source_crs)); std::string target_crs_modified(pj_add_type_crs_if_needed(target_crs)); src = proj_create(ctx, source_crs_modified.c_str()); if( !src ) { proj_context_log_debug(ctx, "Cannot instantiate source_crs"); return nullptr; } dst = proj_create(ctx, target_crs_modified.c_str()); if( !dst ) { proj_context_log_debug(ctx, "Cannot instantiate target_crs"); proj_destroy(src); return nullptr; } } catch( const std::exception& ) { return nullptr; } auto ret = proj_create_crs_to_crs_from_pj(ctx, src, dst, area, nullptr); proj_destroy(src); proj_destroy(dst); return ret; } /*****************************************************************************/ std::vector pj_create_prepared_operations(PJ_CONTEXT *ctx, const PJ *source_crs, const PJ *target_crs, PJ_OBJ_LIST* op_list) /*****************************************************************************/ { auto pjGeogToSrc = create_operation_to_geog_crs(ctx, source_crs); if( !pjGeogToSrc ) { proj_context_log_debug(ctx, "Cannot create transformation from geographic CRS of source CRS to source CRS"); return {}; } auto pjGeogToDst = create_operation_to_geog_crs(ctx, target_crs); if( !pjGeogToDst ) { proj_context_log_debug(ctx, "Cannot create transformation from geographic CRS of target CRS to target CRS"); proj_destroy(pjGeogToSrc); return {}; } try { std::vector preparedOpList; // Iterate over source->target candidate transformations and reproject // their long-lat bounding box into the source CRS. const auto op_count = proj_list_get_count(op_list); for( int i = 0; i < op_count; i++ ) { auto op = proj_list_get(ctx, op_list, i); assert(op); double west_lon = 0.0; double south_lat = 0.0; double east_lon = 0.0; double north_lat = 0.0; const char* areaName = nullptr; if( proj_get_area_of_use(ctx, op, &west_lon, &south_lat, &east_lon, &north_lat, &areaName) ) { const bool isOffshore = areaName && strstr(areaName, "- offshore"); if( west_lon <= east_lon ) { op = add_coord_op_to_list(i, op, west_lon, south_lat, east_lon, north_lat, pjGeogToSrc, pjGeogToDst, isOffshore, preparedOpList); } else { auto op_clone = proj_clone(ctx, op); op = add_coord_op_to_list(i, op, west_lon, south_lat, 180, north_lat, pjGeogToSrc, pjGeogToDst, isOffshore, preparedOpList); op_clone = add_coord_op_to_list(i, op_clone, -180, south_lat, east_lon, north_lat, pjGeogToSrc, pjGeogToDst, isOffshore, preparedOpList); proj_destroy(op_clone); } } proj_destroy(op); } proj_destroy(pjGeogToSrc); proj_destroy(pjGeogToDst); return preparedOpList; } catch( const std::exception& ) { proj_destroy(pjGeogToSrc); proj_destroy(pjGeogToDst); return {}; } } // --------------------------------------------------------------------------- //! @cond Doxygen_Suppress static const char *getOptionValue(const char *option, const char *keyWithEqual) noexcept { if (ci_starts_with(option, keyWithEqual)) { return option + strlen(keyWithEqual); } return nullptr; } //! @endcond /*****************************************************************************/ PJ *proj_create_crs_to_crs_from_pj (PJ_CONTEXT *ctx, const PJ *source_crs, const PJ *target_crs, PJ_AREA *area, const char* const * options) { /****************************************************************************** Create a transformation pipeline between two known coordinate reference systems. See docs/source/development/reference/functions.rst ******************************************************************************/ if( !ctx ) { ctx = pj_get_default_ctx(); } const char* authority = nullptr; double accuracy = -1; bool allowBallparkTransformations = true; for (auto iter = options; iter && iter[0]; ++iter) { const char *value; if ((value = getOptionValue(*iter, "AUTHORITY="))) { authority = value; } else if ((value = getOptionValue(*iter, "ACCURACY="))) { accuracy = pj_atof(value); } else if ((value = getOptionValue(*iter, "ALLOW_BALLPARK="))) { if( ci_equal(value, "yes") ) allowBallparkTransformations = true; else if( ci_equal(value, "no") ) allowBallparkTransformations = false; else { ctx->logger(ctx->logger_app_data, PJ_LOG_ERROR, "Invalid value for ALLOW_BALLPARK option."); return nullptr; } } else { std::string msg("Unknown option :"); msg += *iter; ctx->logger(ctx->logger_app_data, PJ_LOG_ERROR, msg.c_str()); return nullptr; } } auto operation_ctx = proj_create_operation_factory_context(ctx, authority); if( !operation_ctx ) { return nullptr; } proj_operation_factory_context_set_allow_ballpark_transformations( ctx, operation_ctx, allowBallparkTransformations); if( accuracy >= 0 ) { proj_operation_factory_context_set_desired_accuracy(ctx, operation_ctx, accuracy); } if( area && area->bbox_set ) { proj_operation_factory_context_set_area_of_interest( ctx, operation_ctx, area->west_lon_degree, area->south_lat_degree, area->east_lon_degree, area->north_lat_degree); } proj_operation_factory_context_set_spatial_criterion( ctx, operation_ctx, PROJ_SPATIAL_CRITERION_PARTIAL_INTERSECTION); proj_operation_factory_context_set_grid_availability_use( ctx, operation_ctx, proj_context_is_network_enabled(ctx) ? PROJ_GRID_AVAILABILITY_KNOWN_AVAILABLE: PROJ_GRID_AVAILABILITY_DISCARD_OPERATION_IF_MISSING_GRID); auto op_list = proj_create_operations(ctx, source_crs, target_crs, operation_ctx); proj_operation_factory_context_destroy(operation_ctx); if( !op_list ) { return nullptr; } auto op_count = proj_list_get_count(op_list); if( op_count == 0 ) { proj_list_destroy(op_list); proj_context_log_debug(ctx, "No operation found matching criteria"); return nullptr; } PJ* P = proj_list_get(ctx, op_list, 0); assert(P); if( P == nullptr || op_count == 1 || (area && area->bbox_set) || proj_get_type(source_crs) == PJ_TYPE_GEOCENTRIC_CRS || proj_get_type(target_crs) == PJ_TYPE_GEOCENTRIC_CRS ) { proj_list_destroy(op_list); return P; } auto preparedOpList = pj_create_prepared_operations(ctx, source_crs, target_crs, op_list); proj_list_destroy(op_list); if( preparedOpList.empty() ) { proj_destroy(P); return nullptr; } // If there's finally juste a single result, return it directly if( preparedOpList.size() == 1 ) { auto retP = preparedOpList[0].pj; preparedOpList[0].pj = nullptr; proj_destroy(P); return retP; } P->alternativeCoordinateOperations = std::move(preparedOpList); // The returned P is rather dummy P->descr = "Set of coordinate operations"; P->iso_obj = nullptr; P->fwd = nullptr; P->inv = nullptr; P->fwd3d = nullptr; P->inv3d = nullptr; P->fwd4d = nullptr; P->inv4d = nullptr; return P; } /*****************************************************************************/ int proj_errno (const PJ *P) { /****************************************************************************** Read an error level from the context of a PJ. ******************************************************************************/ return proj_context_errno (pj_get_ctx ((PJ *) P)); } /*****************************************************************************/ int proj_context_errno (PJ_CONTEXT *ctx) { /****************************************************************************** Read an error directly from a context, without going through a PJ belonging to that context. ******************************************************************************/ if (nullptr==ctx) ctx = pj_get_default_ctx(); return ctx->last_errno; } /*****************************************************************************/ int proj_errno_set (const PJ *P, int err) { /****************************************************************************** Set context-errno, bubble it up to the thread local errno, return err ******************************************************************************/ /* Use proj_errno_reset to explicitly clear the error status */ if (0==err) return 0; /* For P==0 err goes to the default context */ proj_context_errno_set (pj_get_ctx ((PJ *) P), err); errno = err; return err; } /*****************************************************************************/ int proj_errno_restore (const PJ *P, int err) { /****************************************************************************** Use proj_errno_restore when the current function succeeds, but the error flag was set on entry, and stored/reset using proj_errno_reset in order to monitor for new errors. See usage example under proj_errno_reset () ******************************************************************************/ if (0==err) return 0; proj_errno_set (P, err); return 0; } /*****************************************************************************/ int proj_errno_reset (const PJ *P) { /****************************************************************************** Clears errno in the context and thread local levels through the low level pj_ctx interface. Returns the previous value of the errno, for convenient reset/restore operations: int foo (PJ *P) { // errno may be set on entry, but we need to reset it to be able to // check for errors from "do_something_with_P(P)" int last_errno = proj_errno_reset (P); // local failure if (0==P) return proj_errno_set (P, 42); // call to function that may fail do_something_with_P (P); // failure in do_something_with_P? - keep latest error status if (proj_errno(P)) return proj_errno (P); // success - restore previous error status, return 0 return proj_errno_restore (P, last_errno); } ******************************************************************************/ int last_errno; last_errno = proj_errno (P); proj_context_errno_set (pj_get_ctx ((PJ *) P), 0); errno = 0; return last_errno; } /* Create a new context based on the default context */ PJ_CONTEXT *proj_context_create (void) { return new (std::nothrow) pj_ctx(*pj_get_default_ctx()); } PJ_CONTEXT *proj_context_destroy (PJ_CONTEXT *ctx) { if (nullptr==ctx) return nullptr; /* Trying to free the default context is a no-op (since it is statically allocated) */ if (pj_get_default_ctx ()==ctx) return nullptr; delete ctx; return nullptr; } /*****************************************************************************/ static char *path_append (char *buf, const char *app, size_t *buf_size) { /****************************************************************************** Helper for proj_info() below. Append app to buf, separated by a semicolon. Also handle allocation of longer buffer if needed. Returns buffer and adjusts *buf_size through provided pointer arg. ******************************************************************************/ char *p; size_t len, applen = 0, buflen = 0; #ifdef _WIN32 const char *delim = ";"; #else const char *delim = ":"; #endif /* Nothing to do? */ if (nullptr == app) return buf; applen = strlen (app); if (0 == applen) return buf; /* Start checking whether buf is long enough */ if (nullptr != buf) buflen = strlen (buf); len = buflen+applen+strlen (delim) + 1; /* "pj_realloc", so to speak */ if (*buf_size < len) { p = static_cast(calloc (2 * len, sizeof (char))); if (nullptr==p) { free (buf); return nullptr; } *buf_size = 2 * len; if (buf != nullptr) strcpy (p, buf); free (buf); buf = p; } assert(buf); /* Only append a delimiter if something's already there */ if (0 != buflen) strcat (buf, delim); strcat (buf, app); return buf; } static const char *empty = {""}; static char version[64] = {""}; static PJ_INFO info = {0, 0, 0, nullptr, nullptr, nullptr, nullptr, 0}; /*****************************************************************************/ PJ_INFO proj_info (void) { /****************************************************************************** Basic info about the current instance of the PROJ.4 library. Returns PJ_INFO struct. ******************************************************************************/ size_t buf_size = 0; char *buf = nullptr; pj_acquire_lock (); info.major = PROJ_VERSION_MAJOR; info.minor = PROJ_VERSION_MINOR; info.patch = PROJ_VERSION_PATCH; /* This is a controlled environment, so no risk of sprintf buffer overflow. A normal version string is xx.yy.zz which is 8 characters long and there is room for 64 bytes in the version string. */ sprintf (version, "%d.%d.%d", info.major, info.minor, info.patch); info.version = version; info.release = pj_get_release (); /* build search path string */ auto ctx = pj_get_default_ctx(); if (ctx->search_paths.empty()) { const auto searchpaths = pj_get_default_searchpaths(ctx); for( const auto& path: searchpaths ) { buf = path_append(buf, path.c_str(), &buf_size); } } else { for (const auto &path : ctx->search_paths) { buf = path_append(buf, path.c_str(), &buf_size); } } free(const_cast(info.searchpath)); info.searchpath = buf ? buf : empty; info.paths = ctx->c_compat_paths; info.path_count = static_cast(ctx->search_paths.size()); pj_release_lock (); return info; } /*****************************************************************************/ PJ_PROJ_INFO proj_pj_info(PJ *P) { /****************************************************************************** Basic info about a particular instance of a projection object. Returns PJ_PROJ_INFO struct. ******************************************************************************/ PJ_PROJ_INFO pjinfo; char *def; memset(&pjinfo, 0, sizeof(PJ_PROJ_INFO)); pjinfo.accuracy = -1.0; if (nullptr==P) return pjinfo; /* coordinate operation description */ if( P->iCurCoordOp >= 0 ) { P = P->alternativeCoordinateOperations[P->iCurCoordOp].pj; } else if( !P->alternativeCoordinateOperations.empty() ) { pjinfo.id = "unknown"; pjinfo.description = "unavailable until proj_trans is called"; pjinfo.definition = "unavailable until proj_trans is called"; return pjinfo; } /* projection id */ if (pj_param(P->ctx, P->params, "tproj").i) pjinfo.id = pj_param(P->ctx, P->params, "sproj").s; if( P->iso_obj ) { pjinfo.description = P->iso_obj->nameStr().c_str(); } else { pjinfo.description = P->descr; } // accuracy if( P->iso_obj ) { auto conv = dynamic_cast(P->iso_obj.get()); if( conv ) { pjinfo.accuracy = 0.0; } else { auto op = dynamic_cast(P->iso_obj.get()); if( op ) { const auto& accuracies = op->coordinateOperationAccuracies(); if( !accuracies.empty() ) { try { pjinfo.accuracy = std::stod(accuracies[0]->value()); } catch ( const std::exception& ) {} } } } } /* projection definition */ if (P->def_full) def = P->def_full; else def = pj_get_def(P, 0); /* pj_get_def takes a non-const PJ pointer */ if (nullptr==def) pjinfo.definition = empty; else pjinfo.definition = pj_shrink (def); /* Make proj_destroy clean this up eventually */ P->def_full = def; pjinfo.has_inverse = pj_has_inverse(P); return pjinfo; } /*****************************************************************************/ PJ_GRID_INFO proj_grid_info(const char *gridname) { /****************************************************************************** Information about a named datum grid. Returns PJ_GRID_INFO struct. ******************************************************************************/ PJ_GRID_INFO grinfo; /*PJ_CONTEXT *ctx = proj_context_create(); */ PJ_CONTEXT *ctx = pj_get_default_ctx(); memset(&grinfo, 0, sizeof(PJ_GRID_INFO)); const auto fillGridInfo = [&grinfo, ctx, gridname] (const NS_PROJ::Grid& grid, const std::string& format) { const auto& extent = grid.extentAndRes(); /* name of grid */ strncpy (grinfo.gridname, gridname, sizeof(grinfo.gridname) - 1); /* full path of grid */ pj_find_file(ctx, gridname, grinfo.filename, sizeof(grinfo.filename) - 1); /* grid format */ strncpy (grinfo.format, format.c_str(), sizeof(grinfo.format) - 1); /* grid size */ grinfo.n_lon = grid.width(); grinfo.n_lat = grid.height(); /* cell size */ grinfo.cs_lon = extent.resX; grinfo.cs_lat = extent.resY; /* bounds of grid */ grinfo.lowerleft.lam = extent.west; grinfo.lowerleft.phi = extent.south; grinfo.upperright.lam = extent.east; grinfo.upperright.phi = extent.north; }; { const auto gridSet = NS_PROJ::VerticalShiftGridSet::open(ctx, gridname); if( gridSet ) { const auto& grids = gridSet->grids(); if( !grids.empty() ) { const auto& grid = grids.front(); fillGridInfo(*grid, gridSet->format()); return grinfo; } } } { const auto gridSet = NS_PROJ::HorizontalShiftGridSet::open(ctx, gridname); if( gridSet ) { const auto& grids = gridSet->grids(); if( !grids.empty() ) { const auto& grid = grids.front(); fillGridInfo(*grid, gridSet->format()); return grinfo; } } } strcpy(grinfo.format, "missing"); return grinfo; } /*****************************************************************************/ PJ_INIT_INFO proj_init_info(const char *initname){ /****************************************************************************** Information about a named init file. Maximum length of initname is 64. Returns PJ_INIT_INFO struct. If the init file is not found all members of the return struct are set to the empty string. If the init file is found, but the metadata is missing, the value is set to "Unknown". ******************************************************************************/ int file_found; char param[80], key[74]; paralist *start, *next; PJ_INIT_INFO ininfo; PJ_CONTEXT *ctx = pj_get_default_ctx(); memset(&ininfo, 0, sizeof(PJ_INIT_INFO)); file_found = pj_find_file(ctx, initname, ininfo.filename, sizeof(ininfo.filename)); if (!file_found || strlen(initname) > 64) { if( strcmp(initname, "epsg") == 0 || strcmp(initname, "EPSG") == 0 ) { const char* val; proj_context_errno_set( ctx, 0 ); strncpy (ininfo.name, initname, sizeof(ininfo.name) - 1); strcpy(ininfo.origin, "EPSG"); val = proj_context_get_database_metadata(ctx, "EPSG.VERSION"); if( val ) { strncpy(ininfo.version, val, sizeof(ininfo.version) - 1); } val = proj_context_get_database_metadata(ctx, "EPSG.DATE"); if( val ) { strncpy(ininfo.lastupdate, val, sizeof(ininfo.lastupdate) - 1); } return ininfo; } if( strcmp(initname, "IGNF") == 0 ) { const char* val; proj_context_errno_set( ctx, 0 ); strncpy (ininfo.name, initname, sizeof(ininfo.name) - 1); strcpy(ininfo.origin, "IGNF"); val = proj_context_get_database_metadata(ctx, "IGNF.VERSION"); if( val ) { strncpy(ininfo.version, val, sizeof(ininfo.version) - 1); } val = proj_context_get_database_metadata(ctx, "IGNF.DATE"); if( val ) { strncpy(ininfo.lastupdate, val, sizeof(ininfo.lastupdate) - 1); } return ininfo; } return ininfo; } /* The initial memset (0) makes strncpy safe here */ strncpy (ininfo.name, initname, sizeof(ininfo.name) - 1); strcpy(ininfo.origin, "Unknown"); strcpy(ininfo.version, "Unknown"); strcpy(ininfo.lastupdate, "Unknown"); strncpy (key, initname, 64); /* make room for ":metadata\0" at the end */ key[64] = 0; memcpy(key + strlen(key), ":metadata", 9 + 1); strcpy(param, "+init="); /* The +strlen(param) avoids a cppcheck false positive warning */ strncat(param + strlen(param), key, sizeof(param)-1-strlen(param)); start = pj_mkparam(param); pj_expand_init(ctx, start); if (pj_param(ctx, start, "tversion").i) strncpy(ininfo.version, pj_param(ctx, start, "sversion").s, sizeof(ininfo.version) - 1); if (pj_param(ctx, start, "torigin").i) strncpy(ininfo.origin, pj_param(ctx, start, "sorigin").s, sizeof(ininfo.origin) - 1); if (pj_param(ctx, start, "tlastupdate").i) strncpy(ininfo.lastupdate, pj_param(ctx, start, "slastupdate").s, sizeof(ininfo.lastupdate) - 1); for ( ; start; start = next) { next = start->next; free(start); } return ininfo; } /*****************************************************************************/ PJ_FACTORS proj_factors(PJ *P, PJ_COORD lp) { /****************************************************************************** Cartographic characteristics at point lp. Characteristics include meridian, parallel and areal scales, angular distortion, meridian/parallel, meridian convergence and scale error. returns PJ_FACTORS. If unsuccessful, error number is set and the struct returned contains NULL data. ******************************************************************************/ PJ_FACTORS factors = {0,0,0, 0,0,0, 0,0, 0,0,0,0}; struct FACTORS f; if (nullptr==P) return factors; const auto type = proj_get_type(P); if( type == PJ_TYPE_PROJECTED_CRS ) { // If it is a projected CRS, then compute the factors on the conversion // associated to it. We need to start from a temporary geographic CRS // using the same datum as the one of the projected CRS, and with // input coordinates being in longitude, latitude order in radian, // to be consistent with the expectations of the lp input parameter. auto ctx = P->ctx; auto geodetic_crs = proj_get_source_crs(ctx, P); assert(geodetic_crs); auto datum = proj_crs_get_datum(ctx, geodetic_crs); auto datum_ensemble = proj_crs_get_datum_ensemble(ctx, geodetic_crs); auto cs = proj_create_ellipsoidal_2D_cs( ctx, PJ_ELLPS2D_LONGITUDE_LATITUDE, "Radian", 1.0); auto temp = proj_create_geographic_crs_from_datum( ctx, "unnamed crs", datum ? datum : datum_ensemble, cs); proj_destroy(datum); proj_destroy(datum_ensemble); proj_destroy(cs); proj_destroy(geodetic_crs); auto newOp = proj_create_crs_to_crs_from_pj(ctx, temp, P, nullptr, nullptr); proj_destroy(temp); assert(newOp); auto ret = proj_factors(newOp, lp); proj_destroy(newOp); return ret; } if( type != PJ_TYPE_CONVERSION && type != PJ_TYPE_TRANSFORMATION && type != PJ_TYPE_CONCATENATED_OPERATION && type != PJ_TYPE_OTHER_COORDINATE_OPERATION ) { proj_log_error(P, _("Invalid type for P object")); proj_errno_set (P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); return factors; } if (pj_factors(lp.lp, P, 0.0, &f)) return factors; factors.meridional_scale = f.h; factors.parallel_scale = f.k; factors.areal_scale = f.s; factors.angular_distortion = f.omega; factors.meridian_parallel_angle = f.thetap; factors.meridian_convergence = f.conv; factors.tissot_semimajor = f.a; factors.tissot_semiminor = f.b; /* Raw derivatives, for completeness's sake */ factors.dx_dlam = f.der.x_l; factors.dx_dphi = f.der.x_p; factors.dy_dlam = f.der.y_l; factors.dy_dphi = f.der.y_p; return factors; } proj-8.2.1/src/inv.cpp000644 000765 000024 00000017413 14140020570 015224 0ustar00keversstaff000000 000000 /****************************************************************************** * Project: PROJ.4 * Purpose: Inverse operation invocation * Author: Thomas Knudsen, thokn@sdfe.dk, 2018-01-02 * Based on material from Gerald Evenden (original pj_inv) * and Piyush Agram (original pj_inv3d) * ****************************************************************************** * Copyright (c) 2000, Frank Warmerdam * Copyright (c) 2018, Thomas Knudsen / SDFE * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. *****************************************************************************/ #include #include #include "proj_internal.h" #include #define INPUT_UNITS P->right #define OUTPUT_UNITS P->left static void inv_prepare (PJ *P, PJ_COORD& coo) { if (coo.v[0] == HUGE_VAL || coo.v[1] == HUGE_VAL || coo.v[2] == HUGE_VAL) { proj_errno_set (P, PROJ_ERR_COORD_TRANSFM_OUTSIDE_PROJECTION_DOMAIN); coo = proj_coord_error (); return; } /* The helmert datum shift will choke unless it gets a sensible 4D coordinate */ if (HUGE_VAL==coo.v[2] && P->helmert) coo.v[2] = 0.0; if (HUGE_VAL==coo.v[3] && P->helmert) coo.v[3] = 0.0; if (P->axisswap) coo = proj_trans (P->axisswap, PJ_INV, coo); /* Handle remaining possible input types */ switch (INPUT_UNITS) { case PJ_IO_UNITS_WHATEVER: break; case PJ_IO_UNITS_DEGREES: break; /* de-scale and de-offset */ case PJ_IO_UNITS_CARTESIAN: coo.xyz.x *= P->to_meter; coo.xyz.y *= P->to_meter; coo.xyz.z *= P->to_meter; if (P->is_geocent) { coo = proj_trans (P->cart, PJ_INV, coo); } break; case PJ_IO_UNITS_PROJECTED: case PJ_IO_UNITS_CLASSIC: coo.xyz.x = P->to_meter * coo.xyz.x - P->x0; coo.xyz.y = P->to_meter * coo.xyz.y - P->y0; coo.xyz.z = P->vto_meter * coo.xyz.z - P->z0; if (INPUT_UNITS==PJ_IO_UNITS_PROJECTED) return; /* Classic proj.4 functions expect plane coordinates in units of the semimajor axis */ /* Multiplying by ra, rather than dividing by a because the CalCOFI projection */ /* stomps on a and hence (apparently) depends on this to roundtrip correctly */ /* (CalCOFI avoids further scaling by stomping - but a better solution is possible) */ coo.xyz.x *= P->ra; coo.xyz.y *= P->ra; break; case PJ_IO_UNITS_RADIANS: coo.lpz.z = P->vto_meter * coo.lpz.z - P->z0; break; } } static void inv_finalize (PJ *P, PJ_COORD& coo) { if (coo.xyz.x == HUGE_VAL) { proj_errno_set (P, PROJ_ERR_COORD_TRANSFM_OUTSIDE_PROJECTION_DOMAIN); coo = proj_coord_error (); } if (OUTPUT_UNITS==PJ_IO_UNITS_RADIANS) { /* Distance from central meridian, taking system zero meridian into account */ coo.lp.lam = coo.lp.lam + P->from_greenwich + P->lam0; /* adjust longitude to central meridian */ if (0==P->over) coo.lpz.lam = adjlon(coo.lpz.lam); if (P->vgridshift) coo = proj_trans (P->vgridshift, PJ_INV, coo); /* Go geometric from orthometric */ if (coo.lp.lam==HUGE_VAL) return; if (P->hgridshift) coo = proj_trans (P->hgridshift, PJ_FWD, coo); else if (P->helmert || (P->cart_wgs84 != nullptr && P->cart != nullptr)) { coo = proj_trans (P->cart, PJ_FWD, coo); /* Go cartesian in local frame */ if( P->helmert ) coo = proj_trans (P->helmert, PJ_FWD, coo); /* Step into WGS84 */ coo = proj_trans (P->cart_wgs84, PJ_INV, coo); /* Go back to angular using WGS84 ellps */ } if (coo.lp.lam==HUGE_VAL) return; /* If input latitude was geocentrical, convert back to geocentrical */ if (P->geoc) coo = pj_geocentric_latitude (P, PJ_FWD, coo); } } static inline PJ_COORD error_or_coord(PJ *P, PJ_COORD coord, int last_errno) { if (P->ctx->last_errno) return proj_coord_error(); P->ctx->last_errno = last_errno; return coord; } PJ_LP pj_inv(PJ_XY xy, PJ *P) { PJ_COORD coo = {{0,0,0,0}}; coo.xy = xy; const int last_errno = P->ctx->last_errno; P->ctx->last_errno = 0; if (!P->skip_inv_prepare) inv_prepare (P, coo); if (HUGE_VAL==coo.v[0]) return proj_coord_error ().lp; /* Do the transformation, using the lowest dimensional transformer available */ if (P->inv) { const auto lp = P->inv(coo.xy, P); coo.lp = lp; } else if (P->inv3d) { const auto lpz = P->inv3d (coo.xyz, P); coo.lpz = lpz; } else if (P->inv4d) coo = P->inv4d (coo, P); else { proj_errno_set (P, PROJ_ERR_OTHER_NO_INVERSE_OP); return proj_coord_error ().lp; } if (HUGE_VAL==coo.v[0]) return proj_coord_error ().lp; if (!P->skip_inv_finalize) inv_finalize (P, coo); return error_or_coord(P, coo, last_errno).lp; } PJ_LPZ pj_inv3d (PJ_XYZ xyz, PJ *P) { PJ_COORD coo = {{0,0,0,0}}; coo.xyz = xyz; const int last_errno = P->ctx->last_errno; P->ctx->last_errno = 0; if (!P->skip_inv_prepare) inv_prepare (P, coo); if (HUGE_VAL==coo.v[0]) return proj_coord_error ().lpz; /* Do the transformation, using the lowest dimensional transformer feasible */ if (P->inv3d) { const auto lpz = P->inv3d (coo.xyz, P); coo.lpz = lpz; } else if (P->inv4d) coo = P->inv4d (coo, P); else if (P->inv) { const auto lp = P->inv (coo.xy, P); coo.lp = lp; } else { proj_errno_set (P, PROJ_ERR_OTHER_NO_INVERSE_OP); return proj_coord_error ().lpz; } if (HUGE_VAL==coo.v[0]) return proj_coord_error ().lpz; if (!P->skip_inv_finalize) inv_finalize (P, coo); return error_or_coord(P, coo, last_errno).lpz; } PJ_COORD pj_inv4d (PJ_COORD coo, PJ *P) { const int last_errno = P->ctx->last_errno; P->ctx->last_errno = 0; if (!P->skip_inv_prepare) inv_prepare (P, coo); if (HUGE_VAL==coo.v[0]) return proj_coord_error (); /* Call the highest dimensional converter available */ if (P->inv4d) coo = P->inv4d (coo, P); else if (P->inv3d) { const auto lpz = P->inv3d (coo.xyz, P); coo.lpz = lpz; } else if (P->inv) { const auto lp = P->inv (coo.xy, P); coo.lp = lp; } else { proj_errno_set (P, PROJ_ERR_OTHER_NO_INVERSE_OP); return proj_coord_error (); } if (HUGE_VAL==coo.v[0]) return proj_coord_error (); if (!P->skip_inv_finalize) inv_finalize (P, coo); return error_or_coord(P, coo, last_errno); } proj-8.2.1/src/pipeline.cpp000644 000765 000024 00000060033 14164067106 016245 0ustar00keversstaff000000 000000 /******************************************************************************* Transformation pipeline manager Thomas Knudsen, 2016-05-20/2016-11-20 ******************************************************************************** Geodetic transformations are typically organized in a number of steps. For example, a datum shift could be carried out through these steps: 1. Convert (latitude, longitude, ellipsoidal height) to 3D geocentric cartesian coordinates (X, Y, Z) 2. Transform the (X, Y, Z) coordinates to the new datum, using a 7 parameter Helmert transformation. 3. Convert (X, Y, Z) back to (latitude, longitude, ellipsoidal height) If the height system used is orthometric, rather than ellipsoidal, another step is needed at each end of the process: 1. Add the local geoid undulation (N) to the orthometric height to obtain the ellipsoidal (i.e. geometric) height. 2. Convert (latitude, longitude, ellipsoidal height) to 3D geocentric cartesian coordinates (X, Y, Z) 3. Transform the (X, Y, Z) coordinates to the new datum, using a 7 parameter Helmert transformation. 4. Convert (X, Y, Z) back to (latitude, longitude, ellipsoidal height) 5. Subtract the local geoid undulation (N) from the ellipsoidal height to obtain the orthometric height. Additional steps can be added for e.g. change of vertical datum, so the list can grow fairly long. None of the steps are, however, particularly complex, and data flow is strictly from top to bottom. Hence, in principle, the first example above could be implemented using Unix pipelines: cat my_coordinates | geographic_to_xyz | helmert | xyz_to_geographic > my_transformed_coordinates in the grand tradition of Software Tools [1]. The proj pipeline driver implements a similar concept: Stringing together a number of steps, feeding the output of one step to the input of the next. It is a very powerful concept, that increases the range of relevance of the proj.4 system substantially. It is, however, not a particularly intrusive addition to the PROJ.4 code base: The implementation is by and large completed by adding an extra projection called "pipeline" (i.e. this file), which handles all business, and a small amount of added functionality in the pj_init code, implementing support for multilevel, embedded pipelines. Syntactically, the pipeline system introduces the "+step" keyword (which indicates the start of each transformation step), and reintroduces the +inv keyword (indicating that a given transformation step should run in reverse, i.e. forward, when the pipeline is executed in inverse direction, and vice versa). Hence, the first transformation example above, can be implemented as: +proj=pipeline +step proj=cart +step proj=helmert +step proj=cart +inv Where indicate the Helmert arguments: 3 translations (+x=..., +y=..., +z=...), 3 rotations (+rx=..., +ry=..., +rz=...) and a scale factor (+s=...). Following geodetic conventions, the rotations are given in arcseconds, and the scale factor is given as parts-per-million. [1] B. W. Kernighan & P. J. Plauger: Software tools. Reading, Massachusetts, Addison-Wesley, 1976, 338 pp. ******************************************************************************** Thomas Knudsen, thokn@sdfe.dk, 2016-05-20 ******************************************************************************** * Copyright (c) 2016, 2017, 2018 Thomas Knudsen / SDFE * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * ********************************************************************************/ #define PJ_LIB__ #include #include #include #include #include #include "geodesic.h" #include "proj.h" #include "proj_internal.h" PROJ_HEAD(pipeline, "Transformation pipeline manager"); PROJ_HEAD(pop, "Retrieve coordinate value from pipeline stack"); PROJ_HEAD(push, "Save coordinate value on pipeline stack"); /* Projection specific elements for the PJ object */ namespace { // anonymous namespace struct Step { PJ* pj = nullptr; bool omit_fwd = false; bool omit_inv = false; Step(PJ* pjIn, bool omitFwdIn, bool omitInvIn): pj(pjIn), omit_fwd(omitFwdIn), omit_inv(omitInvIn) {} Step(Step&& other): pj(std::move(other.pj)), omit_fwd(other.omit_fwd), omit_inv(other.omit_inv) { other.pj = nullptr; } Step(const Step&) = delete; Step& operator=(const Step&) = delete; ~Step() { proj_destroy(pj); } }; struct Pipeline { char **argv = nullptr; char **current_argv = nullptr; std::vector steps{}; std::stack stack[4]; }; struct PushPop { bool v1; bool v2; bool v3; bool v4; }; } // anonymous namespace static PJ_COORD pipeline_forward_4d (PJ_COORD point, PJ *P); static PJ_COORD pipeline_reverse_4d (PJ_COORD point, PJ *P); static PJ_XYZ pipeline_forward_3d (PJ_LPZ lpz, PJ *P); static PJ_LPZ pipeline_reverse_3d (PJ_XYZ xyz, PJ *P); static PJ_XY pipeline_forward (PJ_LP lp, PJ *P); static PJ_LP pipeline_reverse (PJ_XY xy, PJ *P); static void pipeline_reassign_context( PJ* P, PJ_CONTEXT* ctx ) { auto pipeline = static_cast(P->opaque); for( auto& step: pipeline->steps ) proj_assign_context(step.pj, ctx); } static PJ_COORD pipeline_forward_4d (PJ_COORD point, PJ *P) { auto pipeline = static_cast(P->opaque); for( auto& step: pipeline->steps ) { if( !step.omit_fwd ) { point = proj_trans (step.pj, PJ_FWD, point); if( point.xyzt.x == HUGE_VAL ) { break; } } } return point; } static PJ_COORD pipeline_reverse_4d (PJ_COORD point, PJ *P) { auto pipeline = static_cast(P->opaque); for( auto iterStep = pipeline->steps.rbegin(); iterStep != pipeline->steps.rend(); ++iterStep ) { const auto& step = *iterStep; if( !step.omit_inv ) { point = proj_trans (step.pj, PJ_INV, point); if( point.xyzt.x == HUGE_VAL ) { break; } } } return point; } static PJ_XYZ pipeline_forward_3d (PJ_LPZ lpz, PJ *P) { PJ_COORD point = {{0,0,0,0}}; point.lpz = lpz; auto pipeline = static_cast(P->opaque); for( auto& step: pipeline->steps ) { if( !step.omit_fwd ) { point = pj_approx_3D_trans (step.pj, PJ_FWD, point); if( point.xyzt.x == HUGE_VAL ) { break; } } } return point.xyz; } static PJ_LPZ pipeline_reverse_3d (PJ_XYZ xyz, PJ *P) { PJ_COORD point = {{0,0,0,0}}; point.xyz = xyz; auto pipeline = static_cast(P->opaque); for( auto iterStep = pipeline->steps.rbegin(); iterStep != pipeline->steps.rend(); ++iterStep ) { const auto& step = *iterStep; if( !step.omit_inv ) { point = proj_trans (step.pj, PJ_INV, point); if( point.xyzt.x == HUGE_VAL ) { break; } } } return point.lpz; } static PJ_XY pipeline_forward (PJ_LP lp, PJ *P) { PJ_COORD point = {{0,0,0,0}}; point.lp = lp; auto pipeline = static_cast(P->opaque); for( auto& step: pipeline->steps ) { if( !step.omit_fwd ) { point = pj_approx_2D_trans (step.pj, PJ_FWD, point); if( point.xyzt.x == HUGE_VAL ) { break; } } } return point.xy; } static PJ_LP pipeline_reverse (PJ_XY xy, PJ *P) { PJ_COORD point = {{0,0,0,0}}; point.xy = xy; auto pipeline = static_cast(P->opaque); for( auto iterStep = pipeline->steps.rbegin(); iterStep != pipeline->steps.rend(); ++iterStep ) { const auto& step = *iterStep; if( !step.omit_inv ) { point = pj_approx_2D_trans (step.pj, PJ_INV, point); if( point.xyzt.x == HUGE_VAL ) { break; } } } return point.lp; } static PJ *destructor (PJ *P, int errlev) { if (nullptr==P) return nullptr; if (nullptr==P->opaque) return pj_default_destructor (P, errlev); auto pipeline = static_cast(P->opaque); free (pipeline->argv); free (pipeline->current_argv); delete pipeline; P->opaque = nullptr; return pj_default_destructor(P, errlev); } /* count the number of args in pipeline definition, and mark all args as used */ static size_t argc_params (paralist *params) { size_t argc = 0; for (; params != nullptr; params = params->next) { argc++; params->used = 1; } return ++argc; /* one extra for the sentinel */ } /* Sentinel for argument list */ static const char *argv_sentinel = "step"; /* turn paralist into argc/argv style argument list */ static char **argv_params (paralist *params, size_t argc) { char **argv; size_t i = 0; argv = static_cast(calloc (argc, sizeof (char *))); if (nullptr==argv) return nullptr; for (; params != nullptr; params = params->next) argv[i++] = params->param; argv[i++] = const_cast(argv_sentinel); return argv; } /* Being the special operator that the pipeline is, we have to handle the */ /* ellipsoid differently than usual. In general, the pipeline operation does */ /* not need an ellipsoid, but in some cases it is beneficial nonetheless. */ /* Unfortunately we can't use the normal ellipsoid setter in pj_init, since */ /* it adds a +ellps parameter to the global args if nothing else is specified*/ /* This is problematic since that ellipsoid spec is then passed on to the */ /* pipeline children. This is rarely what we want, so here we implement our */ /* own logic instead. If an ellipsoid is set in the global args, it is used */ /* as the pipeline ellipsoid. Otherwise we use GRS80 parameters as default. */ /* At last we calculate the rest of the ellipsoid parameters and */ /* re-initialize P->geod. */ static void set_ellipsoid(PJ *P) { paralist *cur, *attachment; int err = proj_errno_reset (P); /* Break the linked list after the global args */ attachment = nullptr; for (cur = P->params; cur != nullptr; cur = cur->next) /* cur->next will always be non 0 given argv_sentinel presence, */ /* but this is far from being obvious for a static analyzer */ if (cur->next != nullptr && strcmp(argv_sentinel, cur->next->param) == 0) { attachment = cur->next; cur->next = nullptr; break; } /* Check if there's any ellipsoid specification in the global params. */ /* If not, use GRS80 as default */ if (0 != pj_ellipsoid (P)) { P->a = 6378137.0; P->f = 1.0 / 298.257222101; P->es = 2*P->f - P->f*P->f; /* reset an "unerror": In this special use case, the errno is */ /* not an error signal, but just a reply from pj_ellipsoid, */ /* telling us that "No - there was no ellipsoid definition in */ /* the PJ you provided". */ proj_errno_reset (P); } P->a_orig = P->a; P->es_orig = P->es; pj_calc_ellipsoid_params (P, P->a, P->es); geod_init(P->geod, P->a, P->es / (1 + sqrt(P->one_es))); /* Re-attach the dangling list */ /* Note: cur will always be non 0 given argv_sentinel presence, */ /* but this is far from being obvious for a static analyzer */ if( cur != nullptr ) cur->next = attachment; proj_errno_restore (P, err); } PJ *OPERATION(pipeline,0) { int i, nsteps = 0, argc; int i_pipeline = -1, i_first_step = -1, i_current_step; char **argv, **current_argv; if( P->ctx->pipelineInitRecursiongCounter == 5 ) { // Can happen for a string like: // proj=pipeline step "x="""," u=" proj=pipeline step ste=""[" u=" proj=pipeline step ste="[" u=" proj=pipeline step ste="[" u=" proj=pipeline step ste="[" u=" proj=pipeline step ste="[" u=" proj=pipeline step ste="[" u=" proj=pipeline step ste="[" u=" proj=pipeline step ste="[" u=" proj=pipeline p step ste="[" u=" proj=pipeline step ste="[" u=" proj=pipeline step ste="[" u=" proj=pipeline step ste="[" u=" proj=pipeline step ""x=""""""""""" // Probably an issue with the quoting handling code // But doesn't hurt to add an extra safety check proj_log_error (P, _("Pipeline: too deep recursion")); return destructor (P, PROJ_ERR_INVALID_OP_WRONG_SYNTAX); /* ERROR: nested pipelines */ } P->fwd4d = pipeline_forward_4d; P->inv4d = pipeline_reverse_4d; P->fwd3d = pipeline_forward_3d; P->inv3d = pipeline_reverse_3d; P->fwd = pipeline_forward; P->inv = pipeline_reverse; P->destructor = destructor; P->reassign_context = pipeline_reassign_context; /* Currently, the pipeline driver is a raw bit mover, enabling other operations */ /* to collaborate efficiently. All prep/fin stuff is done at the step levels. */ P->skip_fwd_prepare = 1; P->skip_fwd_finalize = 1; P->skip_inv_prepare = 1; P->skip_inv_finalize = 1; P->opaque = new (std::nothrow) Pipeline(); if (nullptr==P->opaque) return destructor(P, PROJ_ERR_INVALID_OP /* ENOMEM */); argc = (int)argc_params (P->params); auto pipeline = static_cast(P->opaque); pipeline->argv = argv = argv_params (P->params, argc); if (nullptr==argv) return destructor (P, PROJ_ERR_INVALID_OP /* ENOMEM */); pipeline->current_argv = current_argv = static_cast(calloc (argc, sizeof (char *))); if (nullptr==current_argv) return destructor (P, PROJ_ERR_OTHER /*ENOMEM*/); /* Do some syntactical sanity checking */ for (i = 0; i < argc && argv[i] != nullptr; i++) { if ( 0==strcmp (argv_sentinel, argv[i])) { if (-1==i_pipeline) { proj_log_error (P, _("Pipeline: +step before +proj=pipeline")); return destructor (P, PROJ_ERR_INVALID_OP_WRONG_SYNTAX); } if (0==nsteps) i_first_step = i; nsteps++; continue; } if (0==strcmp ("proj=pipeline", argv[i])) { if (-1 != i_pipeline) { proj_log_error (P, _("Pipeline: Nesting only allowed when child pipelines are wrapped in '+init's")); return destructor (P, PROJ_ERR_INVALID_OP_WRONG_SYNTAX); /* ERROR: nested pipelines */ } i_pipeline = i; } } nsteps--; /* Last instance of +step is just a sentinel */ if (-1==i_pipeline) return destructor (P, PROJ_ERR_INVALID_OP_WRONG_SYNTAX); /* ERROR: no pipeline def */ if (0==nsteps) return destructor (P, PROJ_ERR_INVALID_OP_WRONG_SYNTAX); /* ERROR: no pipeline def */ set_ellipsoid(P); /* Now loop over all steps, building a new set of arguments for each init */ i_current_step = i_first_step; for (i = 0; i < nsteps; i++) { int j; int current_argc = 0; int err; PJ *next_step = nullptr; /* Build a set of setup args for the current step */ proj_log_trace (P, "Pipeline: Building arg list for step no. %d", i); /* First add the step specific args */ for (j = i_current_step + 1; 0 != strcmp ("step", argv[j]); j++) current_argv[current_argc++] = argv[j]; i_current_step = j; /* Then add the global args */ for (j = i_pipeline + 1; 0 != strcmp ("step", argv[j]); j++) current_argv[current_argc++] = argv[j]; proj_log_trace (P, "Pipeline: init - %s, %d", current_argv[0], current_argc); for (j = 1; j < current_argc; j++) proj_log_trace (P, " %s", current_argv[j]); err = proj_errno_reset (P); P->ctx->pipelineInitRecursiongCounter ++; next_step = pj_create_argv_internal (P->ctx, current_argc, current_argv); P->ctx->pipelineInitRecursiongCounter --; proj_log_trace (P, "Pipeline: Step %d (%s) at %p", i, current_argv[0], next_step); if (nullptr==next_step) { /* The step init failed, but possibly without setting errno. If so, we say "malformed" */ int err_to_report = proj_errno(P); if (0==err_to_report) err_to_report = PROJ_ERR_INVALID_OP_WRONG_SYNTAX; proj_log_error (P, _("Pipeline: Bad step definition: %s (%s)"), current_argv[0], proj_context_errno_string (P->ctx, err_to_report)); return destructor (P, err_to_report); /* ERROR: bad pipeline def */ } next_step->parent = P; proj_errno_restore (P, err); /* Is this step inverted? */ for (j = 0; j < current_argc; j++) { if (0==strcmp("inv", current_argv[j])) { /* if +inv exists in both global and local args the forward operation should be used */ next_step->inverted = next_step->inverted == 0 ? 1 : 0; } } bool omit_fwd = pj_param(P->ctx, next_step->params, "bomit_fwd").i != 0; bool omit_inv = pj_param(P->ctx, next_step->params, "bomit_inv").i != 0; pipeline->steps.emplace_back(next_step, omit_fwd, omit_inv); proj_log_trace (P, "Pipeline at [%p]: step at [%p] (%s) done", P, next_step, current_argv[0]); } /* Require a forward path through the pipeline */ for( auto& step: pipeline->steps) { PJ *Q = step.pj; if ( ( Q->inverted && (Q->inv || Q->inv3d || Q->fwd4d) ) || (!Q->inverted && (Q->fwd || Q->fwd3d || Q->fwd4d) ) ) { continue; } else { proj_log_error (P, _("Pipeline: A forward operation couldn't be constructed")); return destructor (P, PROJ_ERR_INVALID_OP_WRONG_SYNTAX); } } /* determine if an inverse operation is possible */ for( auto& step: pipeline->steps) { PJ *Q = step.pj; if ( pj_has_inverse(Q) ) { continue; } else { P->inv = nullptr; P->inv3d = nullptr; P->inv4d = nullptr; break; } } /* Replace PJ_IO_UNITS_WHATEVER with input/output units of neighbouring steps where */ /* it make sense. It does in most cases but not always, for instance */ /* proj=pipeline step proj=unitconvert xy_in=deg xy_out=rad step ... */ /* where the left-hand side units of the first step shouldn't be changed to RADIANS */ /* as it will result in deg->rad conversions in cs2cs and other applications. */ for (i=nsteps-2; i>=0; --i) { auto pj = pipeline->steps[i].pj; if (pj_left(pj) == PJ_IO_UNITS_WHATEVER && pj_right(pj) == PJ_IO_UNITS_WHATEVER) { const auto right_pj = pipeline->steps[i+1].pj; const auto right_pj_left = pj_left(right_pj); const auto right_pj_right = pj_right(right_pj); if (right_pj_left != right_pj_right || right_pj_left != PJ_IO_UNITS_WHATEVER ) { pj->left = right_pj_left; pj->right = right_pj_left; } } } for (i=1; isteps[i].pj; if (pj_left(pj) == PJ_IO_UNITS_WHATEVER && pj_right(pj) == PJ_IO_UNITS_WHATEVER) { const auto left_pj = pipeline->steps[i-1].pj; const auto left_pj_left = pj_left(left_pj); const auto left_pj_right = pj_right(left_pj); if (left_pj_left != left_pj_right || left_pj_right != PJ_IO_UNITS_WHATEVER ) { pj->left = left_pj_right; pj->right = left_pj_right; } } } /* Check that units between each steps match each other, fail if they don't */ for (i = 0; i + 1 < nsteps; i++) { enum pj_io_units curr_step_output = pj_right (pipeline->steps[i].pj); enum pj_io_units next_step_input = pj_left (pipeline->steps[i+1].pj); if ( curr_step_output == PJ_IO_UNITS_WHATEVER || next_step_input == PJ_IO_UNITS_WHATEVER ) continue; if ( curr_step_output != next_step_input ) { proj_log_error (P, _("Pipeline: Mismatched units between step %d and %d"), i+1, i+2); return destructor (P, PROJ_ERR_INVALID_OP_WRONG_SYNTAX); } } proj_log_trace (P, "Pipeline: %d steps built. Determining i/o characteristics", nsteps); /* Determine forward input (= reverse output) data type */ P->left = pj_left (pipeline->steps.front().pj); /* Now, correspondingly determine forward output (= reverse input) data type */ P->right = pj_right (pipeline->steps.back().pj); return P; } static PJ_COORD push(PJ_COORD point, PJ *P) { if (P->parent == nullptr) return point; struct Pipeline *pipeline = static_cast(P->parent->opaque); struct PushPop *pushpop = static_cast(P->opaque); if (pushpop->v1) pipeline->stack[0].push(point.v[0]); if (pushpop->v2) pipeline->stack[1].push(point.v[1]); if (pushpop->v3) pipeline->stack[2].push(point.v[2]); if (pushpop->v4) pipeline->stack[3].push(point.v[3]); return point; } static PJ_COORD pop(PJ_COORD point, PJ *P) { if (P->parent == nullptr) return point; struct Pipeline *pipeline = static_cast(P->parent->opaque); struct PushPop *pushpop = static_cast(P->opaque); if (pushpop->v1 && !pipeline->stack[0].empty()) { point.v[0] = pipeline->stack[0].top(); pipeline->stack[0].pop(); } if (pushpop->v2 && !pipeline->stack[1].empty()) { point.v[1] = pipeline->stack[1].top(); pipeline->stack[1].pop(); } if (pushpop->v3 && !pipeline->stack[2].empty()) { point.v[2] = pipeline->stack[2].top(); pipeline->stack[2].pop(); } if (pushpop->v4 && !pipeline->stack[3].empty()) { point.v[3] = pipeline->stack[3].top(); pipeline->stack[3].pop(); } return point; } static PJ *setup_pushpop(PJ *P) { auto pushpop = static_cast(calloc (1, sizeof(struct PushPop))); P->opaque = pushpop; if (nullptr==P->opaque) return destructor(P, PROJ_ERR_OTHER /*ENOMEM*/); if (pj_param_exists(P->params, "v_1")) pushpop->v1 = true; if (pj_param_exists(P->params, "v_2")) pushpop->v2 = true; if (pj_param_exists(P->params, "v_3")) pushpop->v3 = true; if (pj_param_exists(P->params, "v_4")) pushpop->v4 = true; P->left = PJ_IO_UNITS_WHATEVER; P->right = PJ_IO_UNITS_WHATEVER; return P; } PJ *OPERATION(push, 0) { P->fwd4d = push; P->inv4d = pop; return setup_pushpop(P); } PJ *OPERATION(pop, 0) { P->inv4d = push; P->fwd4d = pop; return setup_pushpop(P); } proj-8.2.1/src/malloc.cpp000644 000765 000024 00000016642 14067153334 015717 0ustar00keversstaff000000 000000 /****************************************************************************** * Project: PROJ.4 * Purpose: Memory management for proj.4. * This version includes an implementation of generic destructors, * for memory deallocation for the large majority of PJ-objects * that do not allocate anything else than the PJ-object itself, * and its associated opaque object - i.e. no additional malloc'ed * memory inside the opaque object. * * Author: Gerald I. Evenden (Original proj.4 author), * Frank Warmerdam (2000) pj_malloc? * Thomas Knudsen (2016) - freeup/dealloc parts * ****************************************************************************** * Copyright (c) 2000, Frank Warmerdam * Copyright (c) 2016, Thomas Knudsen / SDFE * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. *****************************************************************************/ #ifndef FROM_PROJ_CPP #define FROM_PROJ_CPP #endif /* allocate and deallocate memory */ /* These routines are used so that applications can readily replace ** projection system memory allocation/deallocation call with custom ** application procedures. */ #include #include #include #include #include #include "proj/internal/io_internal.hpp" #include "proj.h" #include "proj_internal.h" #include "grids.hpp" #include "filemanager.hpp" using namespace NS_PROJ; /**********************************************************************/ char *pj_strdup(const char *str) /**********************************************************************/ { size_t len = strlen(str) + 1; char *dup = static_cast(malloc(len)); if (dup) memcpy(dup, str, len); return dup; } /*****************************************************************************/ void *free_params (PJ_CONTEXT *ctx, paralist *start, int errlev) { /***************************************************************************** Companion to pj_default_destructor (below). Deallocates a linked list of "+proj=xxx" initialization parameters. Also called from pj_init_ctx when encountering errors before the PJ proper is allocated. ******************************************************************************/ paralist *t, *n; for (t = start; t; t = n) { n = t->next; free(t); } proj_context_errno_set (ctx, errlev); return (void *) nullptr; } /************************************************************************/ /* proj_destroy() */ /* */ /* This is the application callable entry point for destroying */ /* a projection definition. It does work generic to all */ /* projection types, and then calls the projection specific */ /* free function, P->destructor(), to do local work. */ /* In most cases P->destructor()==pj_default_destructor. */ /************************************************************************/ PJ *proj_destroy(PJ *P) { if (nullptr==P || !P->destructor) return nullptr; /* free projection parameters - all the hard work is done by */ /* pj_default_destructor, which is supposed */ /* to be called as the last step of the local destructor */ /* pointed to by P->destructor. In most cases, */ /* pj_default_destructor actually *is* what is pointed to */ P->destructor (P, proj_errno(P)); return nullptr; } /*****************************************************************************/ // cppcheck-suppress uninitMemberVar PJconsts::PJconsts(): destructor(pj_default_destructor) {} /*****************************************************************************/ /*****************************************************************************/ PJ *pj_new() { /*****************************************************************************/ return new(std::nothrow) PJ(); } /*****************************************************************************/ PJ *pj_default_destructor (PJ *P, int errlev) { /* Destructor */ /***************************************************************************** Does memory deallocation for "plain" PJ objects, i.e. that vast majority of PJs where the opaque object does not contain any additionally allocated memory below the P->opaque level. ******************************************************************************/ /* Even if P==0, we set the errlev on pj_error and the default context */ /* Note that both, in the multithreaded case, may then contain undefined */ /* values. This is expected behavior. For MT have one ctx per thread */ if (0!=errlev) proj_context_errno_set (pj_get_ctx(P), errlev); if (nullptr==P) return nullptr; free(P->def_size); free(P->def_shape); free(P->def_spherification); free(P->def_ellps); delete static_cast(P->hgrids_legacy); delete static_cast(P->vgrids_legacy); /* We used to call free( P->catalog ), but this will leak */ /* memory. The safe way to clear catalog and grid is to call */ /* pj_gc_unloadall(pj_get_default_ctx()); and freeate_grids(); */ /* TODO: we should probably have a public pj_cleanup() method to do all */ /* that */ /* free the interface to Charles Karney's geodesic library */ free( P->geod ); /* free parameter list elements */ free_params (pj_get_ctx(P), P->params, errlev); free (P->def_full); /* free the cs2cs emulation elements */ proj_destroy (P->axisswap); proj_destroy (P->helmert); proj_destroy (P->cart); proj_destroy (P->cart_wgs84); proj_destroy (P->hgridshift); proj_destroy (P->vgridshift); free (static_cast(P->opaque)); delete P; return nullptr; } /*****************************************************************************/ void proj_cleanup() { /*****************************************************************************/ // Close the database context of the default PJ_CONTEXT auto cpp_context = pj_get_default_ctx()->cpp_context; if( cpp_context ) { cpp_context->closeDb(); } pj_clear_initcache(); FileManager::clearMemoryCache(); pj_clear_hgridshift_knowngrids_cache(); pj_clear_vgridshift_knowngrids_cache(); pj_clear_sqlite_cache(); } proj-8.2.1/src/projections/000755 000765 000024 00000000000 14164067215 016272 5ustar00keversstaff000000 000000 proj-8.2.1/src/wkt2_generated_parser.c000644 000765 000024 00000474214 14067153334 020374 0ustar00keversstaff000000 000000 /* A Bison parser, made by GNU Bison 3.5.1. */ /* Bison implementation for Yacc-like parsers in C Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Undocumented macros, especially those whose name start with YY_, are private implementation details. Do not rely on them. */ /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ #define YYBISON_VERSION "3.5.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 1 /* Push parsers. */ #define YYPUSH 0 /* Pull parsers. */ #define YYPULL 1 /* Substitute the variable and function names. */ #define yyparse pj_wkt2_parse #define yylex pj_wkt2_lex #define yyerror pj_wkt2_error #define yydebug pj_wkt2_debug #define yynerrs pj_wkt2_nerrs /* First part of user prologue. */ /****************************************************************************** * Project: PROJ * Purpose: WKT2 parser grammar * Author: Even Rouault, * ****************************************************************************** * Copyright (c) 2018 Even Rouault, * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. ****************************************************************************/ #include "wkt2_parser.h" # ifndef YY_CAST # ifdef __cplusplus # define YY_CAST(Type, Val) static_cast (Val) # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast (Val) # else # define YY_CAST(Type, Val) ((Type) (Val)) # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) # endif # endif # ifndef YY_NULLPTR # if defined __cplusplus # if 201103L <= __cplusplus # define YY_NULLPTR nullptr # else # define YY_NULLPTR 0 # endif # else # define YY_NULLPTR ((void*)0) # endif # endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 1 #endif /* Use api.header.include to #include this header instead of duplicating it here. */ #ifndef YY_PJ_WKT2_SRC_WKT2_GENERATED_PARSER_H_INCLUDED # define YY_PJ_WKT2_SRC_WKT2_GENERATED_PARSER_H_INCLUDED /* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif #if YYDEBUG extern int pj_wkt2_debug; #endif /* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE enum yytokentype { END = 0, T_PROJECTION = 258, T_DATUM = 259, T_SPHEROID = 260, T_PRIMEM = 261, T_UNIT = 262, T_AXIS = 263, T_PARAMETER = 264, T_GEODCRS = 265, T_LENGTHUNIT = 266, T_ANGLEUNIT = 267, T_SCALEUNIT = 268, T_TIMEUNIT = 269, T_ELLIPSOID = 270, T_CS = 271, T_ID = 272, T_PROJCRS = 273, T_BASEGEODCRS = 274, T_MERIDIAN = 275, T_BEARING = 276, T_ORDER = 277, T_ANCHOR = 278, T_CONVERSION = 279, T_METHOD = 280, T_REMARK = 281, T_GEOGCRS = 282, T_BASEGEOGCRS = 283, T_SCOPE = 284, T_AREA = 285, T_BBOX = 286, T_CITATION = 287, T_URI = 288, T_VERTCRS = 289, T_VDATUM = 290, T_GEOIDMODEL = 291, T_COMPOUNDCRS = 292, T_PARAMETERFILE = 293, T_COORDINATEOPERATION = 294, T_SOURCECRS = 295, T_TARGETCRS = 296, T_INTERPOLATIONCRS = 297, T_OPERATIONACCURACY = 298, T_CONCATENATEDOPERATION = 299, T_STEP = 300, T_BOUNDCRS = 301, T_ABRIDGEDTRANSFORMATION = 302, T_DERIVINGCONVERSION = 303, T_TDATUM = 304, T_CALENDAR = 305, T_TIMEORIGIN = 306, T_TIMECRS = 307, T_VERTICALEXTENT = 308, T_TIMEEXTENT = 309, T_USAGE = 310, T_DYNAMIC = 311, T_FRAMEEPOCH = 312, T_MODEL = 313, T_VELOCITYGRID = 314, T_ENSEMBLE = 315, T_MEMBER = 316, T_ENSEMBLEACCURACY = 317, T_DERIVEDPROJCRS = 318, T_BASEPROJCRS = 319, T_EDATUM = 320, T_ENGCRS = 321, T_PDATUM = 322, T_PARAMETRICCRS = 323, T_PARAMETRICUNIT = 324, T_BASEVERTCRS = 325, T_BASEENGCRS = 326, T_BASEPARAMCRS = 327, T_BASETIMECRS = 328, T_EPOCH = 329, T_COORDEPOCH = 330, T_COORDINATEMETADATA = 331, T_POINTMOTIONOPERATION = 332, T_VERSION = 333, T_GEODETICCRS = 334, T_GEODETICDATUM = 335, T_PROJECTEDCRS = 336, T_PRIMEMERIDIAN = 337, T_GEOGRAPHICCRS = 338, T_TRF = 339, T_VERTICALCRS = 340, T_VERTICALDATUM = 341, T_VRF = 342, T_TIMEDATUM = 343, T_TEMPORALQUANTITY = 344, T_ENGINEERINGDATUM = 345, T_ENGINEERINGCRS = 346, T_PARAMETRICDATUM = 347, T_AFFINE = 348, T_CARTESIAN = 349, T_CYLINDRICAL = 350, T_ELLIPSOIDAL = 351, T_LINEAR = 352, T_PARAMETRIC = 353, T_POLAR = 354, T_SPHERICAL = 355, T_VERTICAL = 356, T_TEMPORAL = 357, T_TEMPORALCOUNT = 358, T_TEMPORALMEASURE = 359, T_ORDINAL = 360, T_TEMPORALDATETIME = 361, T_NORTH = 362, T_NORTHNORTHEAST = 363, T_NORTHEAST = 364, T_EASTNORTHEAST = 365, T_EAST = 366, T_EASTSOUTHEAST = 367, T_SOUTHEAST = 368, T_SOUTHSOUTHEAST = 369, T_SOUTH = 370, T_SOUTHSOUTHWEST = 371, T_SOUTHWEST = 372, T_WESTSOUTHWEST = 373, T_WEST = 374, T_WESTNORTHWEST = 375, T_NORTHWEST = 376, T_NORTHNORTHWEST = 377, T_UP = 378, T_DOWN = 379, T_GEOCENTRICX = 380, T_GEOCENTRICY = 381, T_GEOCENTRICZ = 382, T_COLUMNPOSITIVE = 383, T_COLUMNNEGATIVE = 384, T_ROWPOSITIVE = 385, T_ROWNEGATIVE = 386, T_DISPLAYRIGHT = 387, T_DISPLAYLEFT = 388, T_DISPLAYUP = 389, T_DISPLAYDOWN = 390, T_FORWARD = 391, T_AFT = 392, T_PORT = 393, T_STARBOARD = 394, T_CLOCKWISE = 395, T_COUNTERCLOCKWISE = 396, T_TOWARDS = 397, T_AWAYFROM = 398, T_FUTURE = 399, T_PAST = 400, T_UNSPECIFIED = 401, T_STRING = 402, T_UNSIGNED_INTEGER_DIFFERENT_ONE_TWO_THREE = 403 }; #endif /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif int pj_wkt2_parse (pj_wkt2_parse_context *context); #endif /* !YY_PJ_WKT2_SRC_WKT2_GENERATED_PARSER_H_INCLUDED */ #ifdef short # undef short #endif /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure and (if available) are included so that the code can choose integer types of a good width. */ #ifndef __PTRDIFF_MAX__ # include /* INFRINGES ON USER NAME SPACE */ # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ # include /* INFRINGES ON USER NAME SPACE */ # define YY_STDINT_H # endif #endif /* Narrow types that promote to a signed type and that can represent a signed or unsigned integer of at least N bits. In tables they can save space and decrease cache pressure. Promoting to a signed type helps avoid bugs in integer arithmetic. */ #ifdef __INT_LEAST8_MAX__ typedef __INT_LEAST8_TYPE__ yytype_int8; #elif defined YY_STDINT_H typedef int_least8_t yytype_int8; #else typedef signed char yytype_int8; #endif #ifdef __INT_LEAST16_MAX__ typedef __INT_LEAST16_TYPE__ yytype_int16; #elif defined YY_STDINT_H typedef int_least16_t yytype_int16; #else typedef short yytype_int16; #endif #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ typedef __UINT_LEAST8_TYPE__ yytype_uint8; #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ && UINT_LEAST8_MAX <= INT_MAX) typedef uint_least8_t yytype_uint8; #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX typedef unsigned char yytype_uint8; #else typedef short yytype_uint8; #endif #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ typedef __UINT_LEAST16_TYPE__ yytype_uint16; #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ && UINT_LEAST16_MAX <= INT_MAX) typedef uint_least16_t yytype_uint16; #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX typedef unsigned short yytype_uint16; #else typedef int yytype_uint16; #endif #ifndef YYPTRDIFF_T # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ # define YYPTRDIFF_T __PTRDIFF_TYPE__ # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ # elif defined PTRDIFF_MAX # ifndef ptrdiff_t # include /* INFRINGES ON USER NAME SPACE */ # endif # define YYPTRDIFF_T ptrdiff_t # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX # else # define YYPTRDIFF_T long # define YYPTRDIFF_MAXIMUM LONG_MAX # endif #endif #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned # endif #endif #define YYSIZE_MAXIMUM \ YY_CAST (YYPTRDIFF_T, \ (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ ? YYPTRDIFF_MAXIMUM \ : YY_CAST (YYSIZE_T, -1))) #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) /* Stored state numbers (used for stacks). */ typedef yytype_int16 yy_state_t; /* State numbers in computations. */ typedef int yy_state_fast_t; #ifndef YY_ # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(Msgid) dgettext ("bison-runtime", Msgid) # endif # endif # ifndef YY_ # define YY_(Msgid) Msgid # endif #endif #ifndef YY_ATTRIBUTE_PURE # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) # else # define YY_ATTRIBUTE_PURE # endif #endif #ifndef YY_ATTRIBUTE_UNUSED # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) # else # define YY_ATTRIBUTE_UNUSED # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(E) ((void) (E)) #else # define YYUSE(E) /* empty */ #endif #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* Suppress an incorrect diagnostic about yylval being uninitialized. */ # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ _Pragma ("GCC diagnostic pop") #else # define YY_INITIAL_VALUE(Value) Value #endif #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN # define YY_IGNORE_MAYBE_UNINITIALIZED_END #endif #ifndef YY_INITIAL_VALUE # define YY_INITIAL_VALUE(Value) /* Nothing. */ #endif #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ # define YY_IGNORE_USELESS_CAST_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") # define YY_IGNORE_USELESS_CAST_END \ _Pragma ("GCC diagnostic pop") #endif #ifndef YY_IGNORE_USELESS_CAST_BEGIN # define YY_IGNORE_USELESS_CAST_BEGIN # define YY_IGNORE_USELESS_CAST_END #endif #define YY_ASSERT(E) ((void) (0 && (E))) #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR # include /* INFRINGES ON USER NAME SPACE */ # elif defined _AIX # define YYSTACK_ALLOC __alloca # elif defined _MSC_VER # include /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca # else # define YYSTACK_ALLOC alloca # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS # include /* INFRINGES ON USER NAME SPACE */ /* Use EXIT_SUCCESS as a witness for stdlib.h. */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's 'empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif # if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined EXIT_SUCCESS void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined EXIT_SUCCESS void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yy_state_t yyss_alloc; YYSTYPE yyvs_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) # define YYCOPY_NEEDED 1 /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYPTRDIFF_T yynewbytes; \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / YYSIZEOF (*yyptr); \ } \ while (0) #endif #if defined YYCOPY_NEEDED && YYCOPY_NEEDED /* Copy COUNT objects from SRC to DST. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(Dst, Src, Count) \ __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) # else # define YYCOPY(Dst, Src, Count) \ do \ { \ YYPTRDIFF_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ while (0) # endif # endif #endif /* !YYCOPY_NEEDED */ /* YYFINAL -- State number of the termination state. */ #define YYFINAL 106 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 2959 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 164 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 352 /* YYNRULES -- Number of rules. */ #define YYNRULES 693 /* YYNSTATES -- Number of states. */ #define YYNSTATES 1425 #define YYUNDEFTOK 2 #define YYMAXUTOK 403 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM as returned by yylex, with out-of-bounds checking. */ #define YYTRANSLATE(YYX) \ (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM as returned by yylex. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 160, 162, 2, 154, 163, 155, 149, 2, 2, 151, 152, 153, 2, 2, 2, 2, 2, 2, 156, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 150, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 157, 2, 2, 2, 2, 2, 158, 159, 2, 161, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148 }; #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_int16 yyrline[] = { 0, 207, 207, 207, 207, 207, 207, 207, 208, 208, 208, 209, 212, 212, 213, 213, 213, 214, 216, 216, 220, 224, 224, 226, 228, 230, 230, 232, 232, 234, 236, 238, 240, 242, 242, 244, 244, 246, 246, 246, 246, 248, 248, 252, 254, 258, 259, 260, 262, 262, 264, 266, 268, 270, 274, 275, 278, 279, 281, 283, 285, 288, 289, 290, 292, 294, 296, 296, 298, 301, 302, 304, 304, 309, 309, 311, 311, 313, 315, 317, 321, 322, 325, 326, 327, 329, 329, 330, 333, 334, 338, 339, 340, 344, 345, 346, 347, 349, 353, 355, 358, 360, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 398, 400, 402, 406, 411, 413, 415, 417, 419, 423, 428, 429, 431, 433, 435, 439, 443, 445, 445, 447, 447, 452, 457, 458, 459, 460, 461, 462, 463, 465, 467, 469, 469, 471, 471, 473, 475, 477, 479, 481, 483, 487, 489, 493, 493, 496, 499, 504, 504, 504, 504, 504, 507, 512, 512, 512, 512, 515, 519, 520, 522, 538, 542, 543, 545, 545, 547, 547, 553, 553, 555, 557, 564, 564, 564, 564, 566, 573, 574, 575, 576, 578, 585, 586, 587, 588, 590, 597, 604, 605, 606, 608, 610, 610, 610, 610, 610, 610, 610, 610, 610, 612, 612, 614, 614, 616, 616, 616, 618, 623, 629, 634, 637, 640, 641, 642, 643, 644, 645, 646, 647, 648, 651, 652, 653, 654, 655, 656, 657, 658, 661, 662, 663, 664, 665, 666, 667, 668, 671, 672, 675, 676, 677, 678, 683, 684, 685, 686, 687, 688, 689, 690, 691, 694, 695, 696, 697, 700, 701, 702, 703, 706, 707, 710, 711, 716, 717, 720, 721, 722, 723, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 763, 766, 768, 770, 772, 774, 776, 792, 792, 794, 802, 803, 805, 806, 808, 816, 817, 819, 821, 823, 828, 829, 831, 833, 835, 837, 839, 841, 843, 848, 852, 854, 857, 860, 861, 862, 864, 865, 867, 872, 873, 875, 875, 877, 881, 881, 881, 883, 883, 885, 893, 902, 910, 920, 921, 923, 925, 925, 927, 927, 930, 931, 935, 941, 942, 943, 945, 945, 947, 949, 951, 955, 960, 960, 962, 965, 966, 971, 972, 974, 979, 979, 979, 981, 983, 984, 985, 986, 988, 991, 993, 997, 1003, 1003, 1007, 1007, 1008, 1008, 1010, 1015, 1016, 1017, 1018, 1019, 1021, 1027, 1032, 1038, 1040, 1042, 1044, 1048, 1054, 1055, 1056, 1058, 1060, 1062, 1066, 1066, 1068, 1070, 1075, 1076, 1077, 1079, 1081, 1083, 1085, 1089, 1089, 1091, 1097, 1104, 1104, 1107, 1114, 1115, 1116, 1117, 1118, 1120, 1124, 1126, 1128, 1128, 1132, 1137, 1137, 1137, 1141, 1146, 1146, 1148, 1152, 1152, 1156, 1161, 1163, 1167, 1167, 1171, 1176, 1178, 1182, 1183, 1184, 1185, 1186, 1188, 1188, 1190, 1193, 1195, 1195, 1197, 1199, 1201, 1205, 1211, 1212, 1213, 1214, 1216, 1218, 1222, 1227, 1229, 1232, 1237, 1241, 1247, 1247, 1247, 1247, 1247, 1247, 1251, 1256, 1258, 1263, 1263, 1264, 1266, 1266, 1268, 1275, 1275, 1277, 1284, 1284, 1286, 1293, 1300, 1305, 1306, 1307, 1309, 1315, 1320, 1328, 1334, 1336, 1338, 1344, 1346, 1346, 1347, 1347, 1351, 1357, 1357, 1359, 1364, 1370, 1375, 1381, 1386, 1391, 1397, 1402, 1407, 1413, 1418, 1423, 1429, 1429, 1430, 1430, 1431, 1431, 1432, 1432, 1433, 1433, 1434, 1434, 1437, 1437, 1439, 1440, 1441, 1443, 1445, 1449, 1452, 1452, 1455, 1456, 1457, 1459, 1463, 1464, 1466, 1468, 1468, 1469, 1469, 1470, 1470, 1470, 1471, 1472, 1472, 1473, 1473, 1474, 1474, 1476, 1476, 1477, 1477, 1478, 1479, 1479, 1483, 1487, 1488, 1491, 1496, 1497, 1498, 1499, 1500, 1501, 1502, 1504, 1506, 1508, 1511, 1513, 1515, 1517, 1519, 1521, 1523, 1525, 1527, 1529, 1534, 1538, 1539, 1542, 1547, 1548, 1549, 1550, 1551, 1553, 1558, 1563, 1564, 1567, 1573, 1573, 1573, 1573, 1575, 1576, 1577, 1578, 1580, 1582, 1587, 1593, 1595, 1600, 1601, 1604, 1612, 1613, 1614, 1615, 1617, 1619 }; #endif #if YYDEBUG || YYERROR_VERBOSE || 1 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "\"end of string\"", "error", "$undefined", "\"PROJECTION\"", "\"DATUM\"", "\"SPHEROID\"", "\"PRIMEM\"", "\"UNIT\"", "\"AXIS\"", "\"PARAMETER\"", "\"GEODCRS\"", "\"LENGTHUNIT\"", "\"ANGLEUNIT\"", "\"SCALEUNIT\"", "\"TIMEUNIT\"", "\"ELLIPSOID\"", "\"CS\"", "\"ID\"", "\"PROJCRS\"", "\"BASEGEODCRS\"", "\"MERIDIAN\"", "\"BEARING\"", "\"ORDER\"", "\"ANCHOR\"", "\"CONVERSION\"", "\"METHOD\"", "\"REMARK\"", "\"GEOGCRS\"", "\"BASEGEOGCRS\"", "\"SCOPE\"", "\"AREA\"", "\"BBOX\"", "\"CITATION\"", "\"URI\"", "\"VERTCRS\"", "\"VDATUM\"", "\"GEOIDMODEL\"", "\"COMPOUNDCRS\"", "\"PARAMETERFILE\"", "\"COORDINATEOPERATION\"", "\"SOURCECRS\"", "\"TARGETCRS\"", "\"INTERPOLATIONCRS\"", "\"OPERATIONACCURACY\"", "\"CONCATENATEDOPERATION\"", "\"STEP\"", "\"BOUNDCRS\"", "\"ABRIDGEDTRANSFORMATION\"", "\"DERIVINGCONVERSION\"", "\"TDATUM\"", "\"CALENDAR\"", "\"TIMEORIGIN\"", "\"TIMECRS\"", "\"VERTICALEXTENT\"", "\"TIMEEXTENT\"", "\"USAGE\"", "\"DYNAMIC\"", "\"FRAMEEPOCH\"", "\"MODEL\"", "\"VELOCITYGRID\"", "\"ENSEMBLE\"", "\"MEMBER\"", "\"ENSEMBLEACCURACY\"", "\"DERIVEDPROJCRS\"", "\"BASEPROJCRS\"", "\"EDATUM\"", "\"ENGCRS\"", "\"PDATUM\"", "\"PARAMETRICCRS\"", "\"PARAMETRICUNIT\"", "\"BASEVERTCRS\"", "\"BASEENGCRS\"", "\"BASEPARAMCRS\"", "\"BASETIMECRS\"", "\"EPOCH\"", "\"COORDEPOCH\"", "\"COORDINATEMETADATA\"", "\"POINTMOTIONOPERATION\"", "\"VERSION\"", "\"GEODETICCRS\"", "\"GEODETICDATUM\"", "\"PROJECTEDCRS\"", "\"PRIMEMERIDIAN\"", "\"GEOGRAPHICCRS\"", "\"TRF\"", "\"VERTICALCRS\"", "\"VERTICALDATUM\"", "\"VRF\"", "\"TIMEDATUM\"", "\"TEMPORALQUANTITY\"", "\"ENGINEERINGDATUM\"", "\"ENGINEERINGCRS\"", "\"PARAMETRICDATUM\"", "\"affine\"", "\"Cartesian\"", "\"cylindrical\"", "\"ellipsoidal\"", "\"linear\"", "\"parametric\"", "\"polar\"", "\"spherical\"", "\"vertical\"", "\"temporal\"", "\"temporalCount\"", "\"temporalMeasure\"", "\"ordinal\"", "\"temporalDateTime\"", "\"north\"", "\"northNorthEast\"", "\"northEast\"", "\"eastNorthEast\"", "\"east\"", "\"eastSouthEast\"", "\"southEast\"", "\"southSouthEast\"", "\"south\"", "\"southSouthWest\"", "\"southWest\"", "\"westSouthWest\"", "\"west\"", "\"westNorthWest\"", "\"northWest\"", "\"northNorthWest\"", "\"up\"", "\"down\"", "\"geocentricX\"", "\"geocentricY\"", "\"geocentricZ\"", "\"columnPositive\"", "\"columnNegative\"", "\"rowPositive\"", "\"rowNegative\"", "\"displayRight\"", "\"displayLeft\"", "\"displayUp\"", "\"displayDown\"", "\"forward\"", "\"aft\"", "\"port\"", "\"starboard\"", "\"clockwise\"", "\"counterClockwise\"", "\"towards\"", "\"awayFrom\"", "\"future\"", "\"part\"", "\"unspecified\"", "\"string\"", "\"unsigned integer\"", "'.'", "'E'", "'1'", "'2'", "'3'", "'+'", "'-'", "':'", "'T'", "'Z'", "'['", "'('", "']'", "')'", "','", "$accept", "input", "datum", "crs", "period", "number", "signed_numeric_literal_with_sign", "signed_numeric_literal", "unsigned_numeric_literal", "opt_sign", "approximate_numeric_literal", "mantissa", "exponent", "signed_integer", "exact_numeric_literal", "opt_period_unsigned_integer", "unsigned_integer", "sign", "colon", "hyphen", "datetime", "opt_24_hour_clock", "year", "month", "day", "_24_hour_clock", "opt_colon_minute_colon_second_time_zone_designator", "opt_colon_second_time_zone_designator", "time_designator", "hour", "minute", "second_time_zone_designator", "seconds_integer", "seconds_fraction", "time_zone_designator", "utc_designator", "local_time_zone_designator", "opt_colon_minute", "left_delimiter", "right_delimiter", "wkt_separator", "quoted_latin_text", "quoted_unicode_text", "opt_separator_scope_extent_identifier_remark", "no_opt_separator_scope_extent_identifier_remark", "opt_identifier_list_remark", "scope_extent_opt_identifier_list_opt_remark", "scope_extent_opt_identifier_list_remark", "usage_list_opt_identifier_list_remark", "usage", "usage_keyword", "scope", "scope_keyword", "scope_text_description", "extent", "extent_opt_identifier_list_remark", "area_description", "area_description_keyword", "area_text_description", "geographic_bounding_box", "geographic_bounding_box_keyword", "lower_left_latitude", "lower_left_longitude", "upper_right_latitude", "upper_right_longitude", "vertical_extent", "opt_separator_length_unit", "vertical_extent_keyword", "vertical_extent_minimum_height", "vertical_extent_maximum_height", "temporal_extent", "temporal_extent_keyword", "temporal_extent_start", "temporal_extent_end", "identifier", "opt_version_authority_citation_uri", "identifier_keyword", "authority_name", "authority_unique_identifier", "version", "authority_citation", "citation_keyword", "citation", "id_uri", "uri_keyword", "uri", "remark", "remark_keyword", "unit", "spatial_unit", "angle_or_length_or_parametric_or_scale_unit", "angle_or_length_or_parametric_or_scale_unit_keyword", "angle_or_length_or_scale_unit", "angle_or_length_or_scale_unit_keyword", "angle_unit", "opt_separator_identifier_list", "length_unit", "time_unit", "opt_separator_conversion_factor_identifier_list", "angle_unit_keyword", "length_unit_keyword", "time_unit_keyword", "unit_name", "conversion_factor", "coordinate_system_scope_extent_identifier_remark", "spatial_cs_scope_extent_identifier_remark", "opt_separator_spatial_axis_list_opt_separator_cs_unit_scope_extent_identifier_remark", "wkt2015temporal_cs_scope_extent_identifier_remark", "opt_separator_cs_unit_scope_extent_identifier_remark", "temporalcountmeasure_cs_scope_extent_identifier_remark", "ordinaldatetime_cs_scope_extent_identifier_remark", "opt_separator_ordinaldatetime_axis_list_scope_extent_identifier_remark", "cs_keyword", "spatial_cs_type", "temporalcountmeasure_cs_type", "ordinaldatetime_cs_type", "dimension", "spatial_axis", "temporalcountmeasure_axis", "ordinaldatetime_axis", "axis_keyword", "axis_name_abbrev", "axis_direction_opt_axis_order_spatial_unit_identifier_list", "north_south_options_spatial_unit", "clockwise_counter_clockwise_options_spatial_unit", "axis_direction_except_n_s_cw_ccw_opt_axis_spatial_unit_identifier_list", "axis_direction_except_n_s_cw_ccw_opt_axis_spatial_unit_identifier_list_options", "axis_direction_opt_axis_order_identifier_list", "north_south_options", "clockwise_counter_clockwise_options", "axis_direction_except_n_s_cw_ccw_opt_axis_identifier_list", "axis_direction_except_n_s_cw_ccw_opt_axis_identifier_list_options", "opt_separator_axis_time_unit_identifier_list", "axis_direction_except_n_s_cw_ccw_opt_axis_time_unit_identifier_list_options", "axis_direction_except_n_s_cw_ccw", "meridian", "meridian_keyword", "bearing", "bearing_keyword", "axis_order", "axis_order_keyword", "cs_unit", "datum_ensemble", "geodetic_datum_ensemble_without_pm", "datum_ensemble_member_list_ellipsoid_accuracy_identifier_list", "opt_separator_datum_ensemble_identifier_list", "vertical_datum_ensemble", "datum_ensemble_member_list_accuracy_identifier_list", "datum_ensemble_keyword", "datum_ensemble_name", "datum_ensemble_member", "opt_datum_ensemble_member_identifier_list", "datum_ensemble_member_keyword", "datum_ensemble_member_name", "datum_ensemble_member_identifier", "datum_ensemble_accuracy", "datum_ensemble_accuracy_keyword", "accuracy", "datum_ensemble_identifier", "dynamic_crs", "dynamic_crs_keyword", "frame_reference_epoch", "frame_reference_epoch_keyword", "reference_epoch", "opt_separator_deformation_model_id", "deformation_model_id", "opt_separator_identifier", "deformation_model_id_keyword", "deformation_model_name", "geodetic_crs", "geographic_crs", "static_geodetic_crs", "dynamic_geodetic_crs", "static_geographic_crs", "dynamic_geographic_crs", "opt_prime_meridian_coordinate_system_scope_extent_identifier_remark", "crs_name", "geodetic_crs_keyword", "geographic_crs_keyword", "geodetic_reference_frame_or_geodetic_datum_ensemble_without_pm", "ellipsoid", "opt_separator_length_unit_identifier_list", "ellipsoid_keyword", "ellipsoid_name", "semi_major_axis", "inverse_flattening", "prime_meridian", "prime_meridian_keyword", "prime_meridian_name", "irm_longitude_opt_separator_identifier_list", "geodetic_reference_frame_with_opt_pm", "geodetic_reference_frame_without_pm", "geodetic_reference_frame_keyword", "datum_name", "opt_separator_datum_anchor_identifier_list", "datum_anchor", "datum_anchor_keyword", "datum_anchor_description", "projected_crs", "projected_crs_keyword", "base_geodetic_crs", "base_static_geodetic_crs", "opt_separator_pm_ellipsoidal_cs_unit_opt_separator_identifier_list", "base_dynamic_geodetic_crs", "base_static_geographic_crs", "base_dynamic_geographic_crs", "base_geodetic_crs_keyword", "base_geographic_crs_keyword", "base_crs_name", "ellipsoidal_cs_unit", "map_projection", "opt_separator_parameter_list_identifier_list", "map_projection_keyword", "map_projection_name", "map_projection_method", "map_projection_method_keyword", "map_projection_method_name", "map_projection_parameter", "opt_separator_param_unit_identifier_list", "parameter_keyword", "parameter_name", "parameter_value", "map_projection_parameter_unit", "vertical_crs", "static_vertical_crs", "dynamic_vertical_crs", "vertical_reference_frame_or_vertical_datum_ensemble", "vertical_cs_opt_geoid_model_id_scope_extent_identifier_remark", "opt_separator_cs_unit_opt_geoid_model_id_scope_extent_identifier_remark", "geoid_model_id", "geoid_model_keyword", "geoid_model_name", "vertical_crs_keyword", "vertical_reference_frame", "vertical_reference_frame_keyword", "engineering_crs", "engineering_crs_keyword", "engineering_datum", "engineering_datum_keyword", "parametric_crs", "parametric_crs_keyword", "parametric_datum", "parametric_datum_keyword", "temporal_crs", "temporal_crs_keyword", "temporal_datum", "opt_separator_temporal_datum_end", "temporal_datum_keyword", "temporal_origin", "temporal_origin_keyword", "temporal_origin_description", "calendar", "calendar_keyword", "calendar_identifier", "deriving_conversion", "opt_separator_parameter_or_parameter_file_identifier_list", "deriving_conversion_keyword", "deriving_conversion_name", "operation_method", "operation_method_keyword", "operation_method_name", "operation_parameter", "parameter_unit", "length_or_angle_or_scale_or_time_or_parametric_unit", "length_or_angle_or_scale_or_time_or_parametric_unit_keyword", "operation_parameter_file", "parameter_file_keyword", "parameter_file_name", "derived_geodetic_crs", "derived_geographic_crs", "derived_static_geod_crs", "base_static_geod_crs_or_base_static_geog_crs", "derived_dynamic_geod_crs", "base_dynamic_geod_crs_or_base_dynamic_geog_crs", "derived_static_geog_crs", "derived_dynamic_geog_crs", "base_static_geod_crs", "opt_separator_pm_opt_separator_identifier_list", "base_dynamic_geod_crs", "base_static_geog_crs", "base_dynamic_geog_crs", "derived_projected_crs", "derived_projected_crs_keyword", "derived_crs_name", "base_projected_crs", "base_projected_crs_keyword", "base_geodetic_geographic_crs", "derived_vertical_crs", "base_vertical_crs", "base_static_vertical_crs", "base_dynamic_vertical_crs", "base_vertical_crs_keyword", "derived_engineering_crs", "base_engineering_crs", "base_engineering_crs_keyword", "derived_parametric_crs", "base_parametric_crs", "base_parametric_crs_keyword", "derived_temporal_crs", "base_temporal_crs", "base_temporal_crs_keyword", "compound_crs", "single_crs", "single_crs_or_bound_crs", "opt_wkt_separator_single_crs_list_opt_separator_scope_extent_identifier_remark", "compound_crs_keyword", "compound_crs_name", "metadata_coordinate_epoch", "coordinate_epoch_keyword", "coordinate_epoch", "coordinate_metadata", "coordinate_metadata_crs", "coordinate_metadata_keyword", "static_crs_coordinate_metadata", "dynamic_crs_coordinate_metadata", "coordinate_operation", "coordinate_operation_next", "coordinate_operation_end", "opt_parameter_or_parameter_file_list_opt_interpolation_crs_opt_operation_accuracy_opt_separator_scope_extent_identifier_remark", "operation_keyword", "operation_name", "operation_version", "operation_version_keyword", "operation_version_text", "source_crs", "source_crs_keyword", "target_crs", "target_crs_keyword", "interpolation_crs", "interpolation_crs_keyword", "operation_accuracy", "operation_accuracy_keyword", "point_motion_operation", "point_motion_operation_next", "point_motion_operation_end", "opt_parameter_or_parameter_file_list_opt_operation_accuracy_opt_separator_scope_extent_identifier_remark", "point_motion_keyword", "concatenated_operation", "concatenated_operation_next", "concatenated_operation_end", "step", "opt_concatenated_operation_end", "concatenated_operation_keyword", "step_keyword", "bound_crs", "bound_crs_keyword", "abridged_coordinate_transformation", "abridged_coordinate_transformation_next", "abridged_coordinate_transformation_end", "opt_end_abridged_coordinate_transformation", "abridged_transformation_keyword", "abridged_transformation_parameter", YY_NULLPTR }; #endif # ifdef YYPRINT /* YYTOKNUM[NUM] -- (External) token number corresponding to the (internal) symbol number NUM (which must be that of a token). */ static const yytype_int16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 46, 69, 49, 50, 51, 43, 45, 58, 84, 90, 91, 40, 93, 41, 44 }; # endif #define YYPACT_NINF (-1212) #define yypact_value_is_default(Yyn) \ ((Yyn) == YYPACT_NINF) #define YYTABLE_NINF (-634) #define yytable_value_is_error(Yyn) \ 0 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ static const yytype_int16 yypact[] = { 1339, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, 94, -1212, -1212, -1212, -106, -1212, -1212, -1212, -106, -1212, -1212, -1212, -1212, -1212, -1212, -106, -106, -1212, -106, -1212, -14, -106, -1212, -106, -1212, -106, -1212, -1212, -1212, -106, -1212, -106, -1212, -106, -1212, -106, -1212, -106, -1212, -106, -1212, -106, -1212, -106, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -106, -1212, -1212, -1212, -1212, -1212, -1212, -106, -1212, -106, -1212, -106, -1212, -106, -1212, -106, -1212, -106, -1212, -1212, -1212, -35, -35, -35, -35, -35, -1212, 55, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, 1609, -35, -35, -35, 121, -1212, -1212, -14, -1212, -14, -1212, -14, -14, -1212, -14, -1212, -1212, -1212, -106, -1212, -14, -14, -1212, -14, -14, -14, -14, -14, -14, -14, -14, -14, -1212, -14, -1212, -14, -1212, -1212, -1212, -1212, 9, -1212, -1212, -1212, -1212, -1212, 16, 29, 75, -1212, -1212, -1212, -1212, 439, -1212, -14, -1212, -14, -14, -14, -1212, -14, -106, 1370, 193, 122, 122, 781, -35, 137, 364, 150, 519, 428, 439, 358, 439, 287, 439, 85, 241, 439, 235, 1635, -1212, -1212, -1212, 191, 99, -1212, -1212, 99, -1212, -1212, 99, -1212, -1212, 285, 1609, -1212, -1212, -1212, -1212, -1212, -1212, -1212, 491, -1212, -1212, -1212, -1212, 202, 219, 275, 781, -1212, -14, -1212, -14, -106, -1212, -1212, -1212, -1212, -106, -14, -106, -14, -1212, -106, -106, -14, -14, -1212, -1212, -1212, -1212, -14, -14, -14, -14, -1212, -14, -1212, -14, -14, -14, -1212, -1212, -1212, -1212, -106, -106, -1212, -1212, -14, -106, -1212, -1212, -106, -14, -14, -1212, -14, -1212, -1212, -106, -1212, -14, -14, -106, -1212, -1212, -14, -14, -106, -1212, -1212, -14, -14, -106, -1212, -1212, -14, -14, -106, -1212, -1212, -14, -14, -106, -14, -106, -1212, -1212, -14, -106, -1212, -14, -1212, -1212, -1212, -1212, -106, -1212, -14, -106, -14, -14, -14, -14, -14, -1212, -14, -106, 439, -1212, 371, 491, -1212, -1212, 163, 439, 283, 439, 439, -35, -35, 56, 357, 258, -35, -35, 408, 408, 56, 258, 408, 408, 781, 371, 439, 457, -35, -35, 316, 439, -35, -35, 82, 447, 408, -35, 476, -1212, 476, -35, 447, 408, -35, 447, 408, -35, 447, 408, -35, -1212, -1212, 586, 256, -1212, -35, 408, -35, 1635, 491, 121, -1212, -35, 285, 121, -1212, 504, 121, -1212, 285, 495, 1609, -1212, 491, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -14, -14, -106, -1212, -106, -1212, -1212, -14, -14, -106, -14, -1212, -1212, -1212, -14, -14, -14, -1212, -14, -106, -1212, -1212, -1212, -1212, -1212, -1212, -106, 439, -14, -1212, -14, -14, -1212, -14, -106, -14, -14, 439, -14, -14, -1212, -14, -14, 781, 439, -1212, -14, -14, -14, -1212, -14, -14, -106, -1212, -1212, -14, -14, -14, -106, 439, -14, -14, -14, -14, -1212, 439, 439, -14, -14, 439, -14, -14, 439, -14, -14, -1212, -1212, 182, -1212, 439, -14, -1212, 439, -14, -14, -14, 275, 439, -1212, 439, -14, -1212, -14, -106, -14, -1212, -14, -106, 439, -1212, 500, 518, -35, -35, -1212, -1212, 476, -1212, 1081, 502, 476, 439, 193, 258, 545, 439, 491, 1651, -1212, 447, 107, 107, 447, -35, 447, 258, -1212, 447, 447, 435, 439, 475, -1212, -1212, -1212, 447, 107, 107, -1212, -1212, -35, 439, 193, 447, 1611, -1212, 447, 393, -1212, -1212, -1212, -1212, 447, 197, -1212, 447, 299, -1212, 447, 95, -1212, -1212, 491, -1212, -1212, 491, -1212, -1212, -1212, 447, 364, 1549, 439, 491, -1212, -1212, 504, 1148, 439, -35, 526, 1416, 439, -35, -1212, -14, -1212, -1212, 439, -1212, 439, -1212, -14, -1212, 439, -14, -1212, -14, -1212, -14, 439, -1212, -1212, -1212, -106, -1212, 275, 439, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -14, -1212, -1212, -1212, -1212, -14, -14, -14, -1212, -14, -14, -14, -14, 439, -1212, -14, 439, 439, 439, 439, -1212, -1212, -14, -14, -106, -1212, -1212, -1212, -14, -106, 439, -14, -14, -14, -14, -1212, -14, -1212, -14, 439, -14, 439, -14, -14, 439, -14, 439, -14, 439, -14, 406, 425, -1212, 725, 439, -1212, -1212, -1212, -1212, -14, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -14, -106, -14, -106, -1212, -14, -106, -14, -106, -14, -106, -14, -106, -14, -1212, -106, -14, -1212, -1212, -14, -1212, -1212, -1212, -106, -14, -14, -106, -14, -106, -1212, -1212, -14, -1212, -106, -1212, -1212, -14, 518, -1212, -1212, -1212, -1212, -1212, -1212, 290, -1212, -35, 491, -1212, 503, 503, 503, 503, 56, 139, 439, 56, 439, -1212, 504, -1212, -1212, -1212, -1212, -1212, -1212, -35, -1212, -35, -1212, 56, 148, 439, 56, 439, 371, 555, -1212, 503, -1212, 82, 439, -1212, 439, -1212, 439, -1212, 439, -1212, 491, -1212, -1212, 491, 491, -1212, 429, -1212, -1212, -1212, -1212, 457, 242, 566, 662, -1212, -35, 900, -1212, -35, 131, -1212, 1081, 303, -1212, 1081, 452, -1212, 586, -1212, 462, -1212, 984, 439, -35, -1212, -1212, -35, -1212, 1081, 476, 439, 265, 98, -1212, -1212, -1212, -14, -1212, -14, -1212, -1212, -1212, -1212, -14, -14, -14, -14, -14, -14, -14, -1212, -14, -1212, -14, -1212, -14, -14, -14, -14, -1212, -14, -14, -1212, -14, -1212, -1212, -14, -14, -14, -14, -1212, -1212, -1212, -1212, -1212, 456, 429, -1212, 725, 491, -1212, -14, -1212, -14, -1212, -14, -1212, -14, -1212, -1212, 439, -14, -14, -14, -1212, 439, -14, -14, -1212, -14, -14, -1212, -14, -1212, -1212, -14, -1212, 439, -1212, -1212, -14, -14, -14, -106, -14, -1212, -14, -14, 439, -1212, -1212, -1212, -1212, -1212, -1212, 439, -14, -14, 439, 439, 439, 439, 439, 439, -1212, -1212, 439, 310, 439, 781, 781, 439, -1212, 475, -1212, -1212, 439, 1029, 439, 439, 439, -1212, -1212, 491, -1212, -1212, -1212, 439, -1212, 405, -1212, -1212, 131, -1212, 303, -1212, -1212, -1212, 303, -1212, -1212, 1081, -1212, 1081, 586, -1212, -1212, -1212, 1298, -1212, 1609, -1212, 371, -35, -1212, -14, 1383, 439, 504, -1212, -1212, -14, -14, -14, -14, -1212, -1212, -14, -14, -14, -1212, -1212, -14, -14, -1212, -14, -1212, -1212, -1212, -1212, -1212, -14, -1212, -106, -14, -1212, -14, -1212, -1212, -1212, 1041, -1212, 439, -14, -14, -14, -1212, -14, -14, -14, -14, -1212, -14, -1212, -14, -1212, -1212, 439, -14, 439, -14, -1212, -14, 526, -1212, -106, -14, -14, -1212, 618, 618, 618, 618, -1212, -1212, -1212, 439, 439, -1212, -1212, -35, -1212, 618, 877, -1212, -1212, 255, 577, 580, 303, -1212, -1212, -1212, -1212, 1081, 388, 439, -1212, -1212, -1212, 546, 439, -106, -35, -1212, -1212, -1212, -14, -106, -14, -106, -14, -14, -106, -1212, -1212, -14, -14, 550, 877, -1212, -14, -14, -1212, -14, -1212, -1212, -14, -1212, -14, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -14, -1212, -106, -1212, 265, -14, 1292, -1212, -35, 688, -1212, -35, -1212, 836, -1212, -35, 781, 1086, -1212, -1212, 577, 580, 580, -1212, 1081, 439, -35, 439, 371, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -106, -1212, -106, -14, -1212, -14, -1212, -14, -14, -14, -1212, -14, -14, -14, -1212, -1212, -14, -14, -106, -14, -1212, -1212, -1212, -1212, 439, -1212, -14, -14, -14, -35, -35, 1416, 1982, -1212, -1212, 1658, -1212, 2505, 439, 1448, -1212, -1212, -35, 580, -1212, 781, 439, 893, 439, 439, -14, -14, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -14, -14, -14, -14, -14, 439, -1212, -14, -14, -14, -14, -14, 439, -1212, -14, -1212, -14, -1212, -14, -1212, -14, -1212, -1212, -14, -106, -1212, -1212, 781, 439, 92, 439, 894, 894, 737, 737, -1212, 351, 485, 894, 569, 569, -1212, 333, -1212, 439, -1212, -1212, 265, -14, -1212, -1212, -14, -14, -1212, -14, -106, -1212, -1212, -14, -14, -1212, -14, -106, -14, -1212, -1212, -14, -14, -1212, -14, -106, -14, -1212, -14, -14, -1212, -14, -14, -1212, -14, -14, -1212, -14, -1212, -14, -14, -1212, -14, -1212, -14, -1212, 439, 439, -1212, -1212, 111, -1212, 491, -1212, -1212, 351, -1212, 1081, 571, -1212, -1212, -1212, 351, -1212, 1081, 571, -1212, -1212, -1212, 571, -1212, -1212, 333, -1212, -1212, -1212, 333, -1212, -1212, -1212, -1212, -14, -1212, -14, 439, -14, -14, -14, -14, -14, -14, 439, -14, -14, -14, -14, -1212, -1212, -1212, -1212, 571, -1212, 565, -1212, -1212, 571, -1212, -1212, -1212, -1212, -1212, -1212, -14, 439, -14, -1212, -1212, -1212 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. Performed when YYTABLE does not specify something else to do. Zero means the default is an error. */ static const yytype_int16 yydefact[] = { 0, 419, 406, 395, 405, 161, 431, 454, 397, 483, 486, 601, 645, 680, 683, 508, 501, 356, 560, 493, 490, 498, 496, 612, 667, 396, 421, 432, 398, 420, 484, 488, 487, 509, 494, 491, 499, 0, 4, 5, 2, 0, 13, 346, 347, 0, 584, 385, 383, 384, 386, 387, 0, 0, 3, 0, 12, 416, 0, 586, 0, 11, 0, 588, 468, 469, 0, 14, 0, 590, 0, 15, 0, 592, 0, 16, 0, 594, 0, 17, 0, 585, 541, 539, 540, 542, 543, 587, 0, 589, 591, 593, 595, 19, 18, 0, 7, 0, 8, 0, 9, 0, 10, 0, 6, 0, 1, 73, 74, 0, 0, 0, 0, 0, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 78, 162, 0, 357, 0, 394, 0, 0, 407, 0, 411, 412, 417, 0, 422, 0, 0, 455, 0, 0, 423, 0, 423, 0, 423, 0, 503, 561, 0, 602, 0, 613, 627, 614, 628, 615, 616, 630, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 0, 610, 0, 646, 0, 0, 0, 651, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 75, 76, 609, 0, 0, 634, 636, 0, 658, 660, 0, 668, 670, 0, 0, 40, 20, 37, 38, 39, 41, 42, 0, 163, 21, 22, 26, 0, 25, 35, 0, 164, 154, 361, 0, 0, 446, 447, 369, 400, 0, 0, 0, 0, 399, 0, 0, 0, 0, 545, 548, 546, 549, 0, 0, 0, 0, 408, 0, 413, 0, 423, 0, 433, 434, 435, 436, 0, 0, 458, 457, 451, 0, 573, 473, 0, 0, 0, 472, 0, 569, 570, 0, 428, 190, 424, 0, 485, 576, 0, 0, 0, 492, 579, 0, 0, 0, 497, 582, 0, 0, 0, 515, 511, 190, 190, 0, 190, 0, 502, 563, 0, 0, 596, 0, 597, 604, 605, 611, 0, 648, 0, 0, 0, 0, 0, 0, 0, 653, 0, 0, 0, 34, 27, 0, 33, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 425, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 507, 506, 0, 0, 504, 0, 0, 0, 0, 0, 0, 635, 0, 0, 0, 659, 0, 0, 669, 0, 0, 0, 650, 0, 29, 31, 28, 36, 168, 171, 165, 166, 155, 158, 0, 160, 0, 153, 365, 0, 351, 0, 0, 348, 353, 362, 359, 0, 0, 371, 375, 0, 223, 393, 204, 205, 206, 207, 0, 0, 0, 448, 0, 0, 522, 0, 0, 0, 0, 0, 0, 0, 409, 402, 190, 0, 0, 418, 0, 0, 0, 464, 190, 451, 0, 450, 459, 190, 0, 0, 0, 0, 0, 0, 190, 190, 429, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 512, 48, 513, 0, 190, 516, 0, 0, 0, 598, 606, 0, 649, 0, 0, 525, 662, 0, 0, 692, 80, 0, 0, 32, 0, 0, 0, 0, 350, 355, 0, 354, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 388, 0, 0, 0, 0, 0, 0, 0, 390, 0, 0, 0, 0, 0, 415, 24, 410, 0, 0, 0, 452, 453, 0, 0, 0, 0, 0, 470, 0, 0, 191, 426, 427, 489, 0, 0, 495, 0, 0, 500, 0, 0, 44, 58, 0, 45, 49, 0, 510, 505, 514, 0, 0, 0, 0, 607, 603, 647, 0, 0, 0, 0, 0, 0, 0, 0, 652, 156, 159, 169, 0, 172, 0, 367, 351, 366, 0, 351, 363, 359, 358, 0, 0, 380, 381, 376, 0, 368, 372, 0, 224, 225, 226, 227, 228, 229, 230, 231, 232, 0, 233, 234, 235, 236, 0, 0, 0, 392, 0, 553, 0, 553, 0, 523, 0, 0, 0, 0, 0, 199, 198, 190, 190, 0, 401, 197, 196, 190, 0, 0, 0, 438, 0, 438, 465, 0, 456, 0, 0, 0, 0, 0, 190, 0, 190, 0, 190, 0, 190, 48, 0, 59, 0, 0, 564, 565, 566, 567, 0, 174, 100, 133, 136, 144, 148, 98, 600, 82, 88, 89, 93, 0, 85, 0, 92, 85, 0, 85, 0, 85, 0, 85, 0, 85, 84, 0, 598, 583, 608, 638, 537, 657, 666, 0, 662, 662, 0, 80, 0, 661, 526, 378, 681, 0, 81, 682, 0, 0, 167, 170, 352, 364, 349, 360, 0, 389, 0, 373, 370, 0, 0, 0, 0, 0, 0, 0, 0, 0, 544, 0, 547, 391, 550, 551, 404, 403, 0, 414, 0, 430, 0, 0, 0, 0, 0, 27, 0, 471, 0, 568, 0, 0, 574, 0, 577, 0, 580, 0, 46, 0, 43, 68, 0, 0, 53, 71, 55, 66, 67, 559, 0, 0, 0, 0, 91, 0, 0, 117, 0, 0, 118, 0, 0, 119, 0, 0, 120, 0, 83, 0, 599, 0, 0, 0, 663, 664, 0, 665, 0, 0, 0, 0, 0, 684, 686, 157, 0, 382, 378, 374, 237, 238, 239, 190, 190, 190, 190, 553, 190, 190, 552, 553, 557, 518, 202, 0, 0, 438, 190, 449, 190, 190, 437, 438, 444, 466, 461, 0, 190, 190, 571, 575, 578, 581, 52, 48, 71, 60, 0, 0, 70, 190, 96, 85, 94, 0, 90, 85, 87, 101, 0, 85, 85, 85, 134, 0, 85, 85, 137, 0, 85, 145, 0, 149, 150, 0, 79, 0, 655, 644, 638, 638, 80, 0, 80, 637, 0, 0, 0, 379, 524, 674, 675, 672, 673, 0, 688, 0, 0, 0, 0, 0, 0, 0, 555, 554, 0, 0, 0, 0, 0, 0, 442, 0, 439, 441, 0, 0, 0, 0, 0, 47, 69, 0, 54, 57, 72, 0, 95, 0, 86, 99, 0, 121, 0, 122, 123, 132, 0, 124, 125, 0, 126, 0, 0, 173, 639, 640, 0, 641, 0, 643, 27, 0, 656, 0, 0, 0, 0, 685, 377, 0, 0, 0, 0, 556, 558, 190, 518, 518, 517, 203, 190, 190, 443, 190, 445, 188, 186, 185, 187, 190, 467, 0, 190, 460, 0, 572, 64, 56, 0, 562, 0, 102, 103, 104, 105, 85, 85, 85, 85, 138, 0, 146, 142, 151, 152, 0, 80, 0, 0, 538, 378, 0, 691, 0, 688, 688, 687, 0, 0, 0, 0, 521, 519, 520, 0, 0, 440, 462, 0, 463, 0, 0, 63, 97, 0, 0, 0, 0, 127, 128, 129, 130, 0, 0, 0, 147, 642, 654, 0, 0, 0, 0, 690, 689, 243, 214, 0, 209, 0, 80, 220, 0, 192, 189, 0, 475, 65, 0, 61, 106, 107, 108, 109, 110, 111, 85, 139, 0, 143, 141, 535, 530, 531, 532, 533, 534, 378, 528, 0, 536, 0, 0, 0, 213, 0, 0, 208, 0, 218, 0, 219, 0, 0, 0, 474, 62, 0, 0, 0, 131, 0, 0, 0, 0, 27, 183, 180, 179, 182, 200, 181, 201, 217, 345, 175, 177, 0, 176, 0, 215, 244, 0, 212, 209, 80, 0, 222, 220, 0, 190, 481, 479, 80, 80, 0, 112, 113, 114, 115, 140, 0, 527, 194, 676, 190, 0, 0, 0, 0, 211, 210, 0, 221, 0, 0, 0, 476, 478, 0, 0, 135, 0, 0, 0, 0, 0, 0, 194, 216, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 297, 246, 248, 250, 252, 0, 245, 270, 277, 279, 281, 283, 0, 276, 293, 184, 80, 482, 378, 116, 190, 529, 679, 80, 0, 671, 693, 0, 0, 0, 0, 0, 0, 0, 0, 240, 0, 0, 0, 0, 0, 242, 0, 477, 0, 195, 678, 0, 190, 193, 344, 190, 190, 298, 190, 0, 241, 340, 190, 190, 247, 190, 0, 190, 249, 342, 190, 190, 251, 190, 0, 190, 253, 190, 190, 271, 190, 190, 278, 190, 190, 280, 190, 282, 190, 190, 284, 190, 294, 190, 480, 0, 0, 299, 302, 0, 300, 0, 254, 261, 0, 258, 0, 0, 260, 262, 269, 0, 266, 0, 0, 268, 272, 275, 0, 273, 285, 0, 287, 288, 289, 0, 291, 292, 295, 296, 676, 178, 190, 0, 190, 190, 0, 190, 190, 190, 0, 190, 190, 190, 190, 677, 301, 343, 257, 0, 255, 0, 259, 265, 0, 263, 341, 267, 274, 286, 290, 190, 0, 190, 256, 339, 264 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { -1212, -1212, -1212, -222, -223, -191, -1212, 272, -194, 311, -1212, -1212, -1212, -1212, -1212, -1212, -196, -325, -656, -50, -728, -646, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -567, -230, -1212, -1212, -1212, -871, -1212, -1212, -218, 1195, 1389, -57, -54, -1212, -704, -480, -392, -1212, -1212, -148, -1212, -1212, -141, -1212, -1212, -1212, -134, -254, -1212, -1212, -803, -1212, -1212, -1212, -1212, -1212, -788, -1212, -1212, -1212, -1212, -251, -1212, -1212, -1212, 248, -1212, -1212, -1212, -1212, -1212, 194, -1212, -1212, -500, -1212, -1212, -708, -1212, -1212, -401, -1212, -1212, -1212, -1212, -550, 1538, -368, -1211, -499, -1212, -1212, -1212, -769, -915, -51, -1212, -449, -1212, -1212, -1212, -1212, -448, -342, 164, -1212, -1212, -118, -995, -321, -400, -976, -674, -1212, -913, -549, -1212, -1212, -1212, -1212, -551, -1212, -1212, -1212, -1212, -660, -547, -1212, -621, -1212, -755, -1212, -651, -1212, 755, -419, -197, 561, -421, 30, 5, -320, 132, -1212, -1212, -1212, 227, -1212, -79, -1212, -80, -1212, -1212, -1212, -1212, -1212, -1212, -833, -1212, -1212, -1212, -1212, 636, 638, 639, 641, -280, 1033, -1212, -1212, -75, 31, -1212, -1212, -1212, -1212, -1212, -108, -1212, -1212, -1212, -1212, 3, -1212, 413, -69, -1212, -1212, -1212, 646, -1212, -1212, -1212, -636, -1212, -1212, -1212, 581, 583, 136, -182, 4, 301, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -364, -814, -922, -1212, -1212, 654, 657, -1212, 220, -1212, -420, -1212, -1212, -1212, -185, -1212, 671, -1212, -161, -1212, 672, -1212, -189, -1212, 678, -1212, -173, -1212, -1212, 410, -1212, -1212, -1212, -1212, -1212, 436, -327, -1212, -1212, -377, -1212, -1212, -790, -1212, -1212, -1212, -786, -1212, -1212, 681, -1212, -1212, 622, -1212, 625, -1212, -1212, 225, -609, 230, 231, 237, 706, -1212, -1212, -1212, -1212, -1212, 709, -1212, -1212, -1212, -1212, 711, -1212, -1212, 713, -1212, -1212, 718, -1212, -1212, 719, -183, -351, 130, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, -1212, 864, -1212, 537, -235, -1212, -120, -214, -1212, -1212, -88, -1212, 104, -1212, -1212, -1212, -813, -1212, -1212, -1212, 549, -36, 887, -1212, -1212, 557, -1111, -488, -1212, -1007, 888, -1212, -1212, -1212, -34, -353, -1212, -1212 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { -1, 37, 38, 39, 235, 620, 237, 880, 238, 470, 239, 240, 419, 420, 241, 348, 242, 243, 894, 589, 503, 590, 504, 695, 890, 591, 809, 969, 592, 810, 893, 1034, 1035, 1114, 811, 812, 813, 895, 109, 215, 382, 456, 922, 609, 749, 819, 712, 713, 714, 715, 716, 717, 718, 905, 1037, 719, 720, 721, 910, 722, 723, 914, 1047, 1124, 1197, 724, 1091, 725, 917, 1049, 726, 727, 920, 1052, 489, 351, 41, 136, 245, 427, 428, 429, 615, 430, 431, 617, 729, 730, 1170, 1171, 1172, 1173, 1027, 1028, 874, 383, 667, 1174, 1219, 673, 668, 1175, 870, 1017, 448, 449, 1143, 450, 1140, 451, 452, 1147, 453, 649, 650, 651, 858, 1104, 1102, 1107, 1105, 1178, 1267, 1322, 1330, 1268, 1337, 1274, 1340, 1345, 1275, 1350, 1292, 1315, 1262, 1323, 1324, 1331, 1332, 1325, 1317, 1176, 42, 252, 353, 534, 44, 354, 253, 138, 247, 538, 248, 441, 624, 435, 436, 621, 619, 254, 255, 445, 446, 634, 542, 630, 845, 631, 853, 46, 47, 48, 49, 50, 51, 454, 140, 52, 53, 256, 437, 557, 55, 143, 271, 468, 455, 147, 273, 471, 56, 257, 58, 149, 203, 298, 299, 492, 59, 60, 275, 276, 787, 277, 278, 279, 258, 259, 457, 876, 936, 375, 62, 152, 284, 285, 482, 478, 963, 738, 680, 881, 1029, 63, 64, 65, 290, 486, 1151, 1190, 1191, 1280, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 210, 80, 318, 319, 506, 320, 321, 509, 937, 953, 461, 659, 941, 520, 746, 739, 1133, 1134, 1135, 740, 741, 1057, 81, 82, 83, 260, 84, 261, 85, 86, 262, 770, 263, 264, 265, 87, 88, 162, 324, 325, 703, 89, 292, 293, 294, 295, 90, 303, 304, 91, 308, 309, 92, 313, 314, 93, 94, 327, 599, 95, 164, 331, 332, 514, 96, 182, 97, 183, 184, 938, 218, 219, 837, 99, 186, 334, 335, 516, 336, 191, 342, 343, 927, 928, 742, 743, 100, 221, 222, 605, 939, 102, 224, 225, 940, 1221, 103, 748, 328, 105, 523, 848, 849, 1002, 524, 1062 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule whose number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int16 yytable[] = { 115, 236, 270, 57, 61, 344, 337, 146, 672, 339, 479, 187, 188, 532, 871, 531, 291, 307, 906, 347, 943, 421, 970, 929, 931, 697, 1160, 932, 613, 326, 45, 54, 434, 907, 519, 312, 911, 485, 842, 345, 1018, 808, 789, 302, 421, 190, 925, 772, 803, 349, 926, 1097, 512, 107, 108, 135, 137, 139, 139, 142, 1, 144, 148, 139, 151, 139, 148, 139, 148, 139, 148, 139, 148, 161, 163, 1055, 185, 185, 185, 192, 1314, 193, 1112, 194, 195, 464, 196, 205, 1103, 207, 1103, 1108, 198, 199, 106, 200, 201, 202, 204, 202, 206, 202, 208, 209, 918, 211, 1166, 212, 899, 5, 903, 1, 134, 903, 1312, 266, 903, 10, 711, 903, 267, 289, 903, 518, 737, 1166, 1, 216, 5, 217, 220, 223, 338, 226, 15, 340, 26, 145, 244, 189, 29, 249, 2, 272, 15, 144, 1390, 1180, 5, 114, 250, 422, 4, 282, 144, 670, 5, 704, 311, 425, 671, 189, 1013, 251, 1079, 5, 1014, 17, 31, 32, 1108, 1039, -629, 33, 467, 283, 333, 333, 251, -631, 1053, 1168, 17, 33, 708, 709, 1040, 26, 350, 1042, 352, 29, -632, 484, 525, 423, 424, 357, 1353, 359, 1168, 502, 26, 362, 363, 370, 29, 1115, 513, 364, 365, 366, 367, 1286, 368, 1061, 369, 202, 371, 626, 326, 145, 526, 994, 1096, 996, 734, 374, 485, 274, 145, 288, 378, 379, 1186, 380, 956, 968, -633, 1201, 891, 384, 961, 1152, 966, 386, 387, 731, 40, 682, 389, 390, 850, 948, 246, 392, 393, 951, 5, 5, 627, 1050, 19, 398, 144, 329, 330, 401, 704, 903, 403, 903, 661, 5, 447, 903, 560, 405, 1116, 408, 409, 411, 412, 414, 1138, 415, 707, 34, 2, 7, 600, 315, 316, 1117, 1119, 2, 426, 710, 4, 323, 1158, 440, 137, 1282, 12, 4, 1111, 316, 708, 709, 134, 228, 229, 459, 230, 231, 232, 233, 234, 476, 5, 338, 481, 137, 340, 476, 341, 5, 822, 704, 825, 491, 828, 5, 831, 493, 833, 587, 496, 588, 145, 499, 24, 505, 246, 433, 508, 633, 735, 1093, 5, 246, 346, 515, 21, 1312, 924, 709, 1162, 306, 443, 442, 1163, 1164, 1165, 1192, 21, 463, 5, -30, 527, 528, 807, 1312, 1310, 473, 903, 352, 533, 36, 536, 1326, 483, 249, 537, 539, 540, 1343, 541, 687, 1199, 36, 250, 694, 691, 664, 696, 868, 546, 665, 547, 548, 1145, 549, 733, 551, 552, 1285, 554, 555, 762, 556, 558, 693, 444, 326, 562, 563, 564, 689, 1167, 374, 755, 19, 229, 757, 569, 570, 10, 301, 573, 574, 531, 1223, 1224, 706, 707, 579, 580, 851, 582, 583, 664, 585, 586, 5, 665, 1306, 34, 251, 297, 296, 5, 596, 597, 598, 459, 317, 708, 709, 603, 532, 604, 447, 607, 421, 608, 653, 655, 5, 1182, 882, 654, 656, 1185, 614, 616, 1207, 704, 31, 32, 7, 670, 675, 677, 1213, 1214, 671, 676, 678, 751, 1181, 5, 5, 686, 652, 658, 458, 657, 1189, 660, 696, 5, 662, 663, 1319, 973, 1312, 474, 475, 975, 674, 517, 679, 978, 980, 981, 488, 521, 984, 985, 1059, 685, 987, 495, 233, 234, 498, 688, 518, 501, 690, 423, 154, 692, 156, 1316, 158, 511, 160, 1333, 1333, 522, 1338, 1342, 698, 1347, 1347, 1269, 1351, 1276, 424, 745, 1127, 10, 752, 185, 1128, 1129, 1130, 1131, -51, 533, 588, 433, 533, 854, 537, 807, 759, 908, 747, 670, 912, 1305, 251, 915, 671, 1162, 17, 587, 1308, 1163, 1164, 1165, 805, 5, 764, 5, 286, 1327, 1312, 765, 766, 767, 705, 768, 769, 771, 769, 213, 214, 774, 628, 629, 31, 32, 1393, 889, 921, 884, 696, 892, 588, 1397, 1132, 246, 433, 785, 786, 788, 786, 477, 790, 1401, 791, 1101, 793, 1402, 795, 708, 709, 490, 942, 709, 913, 502, 1060, 916, 228, 1167, 469, 230, 231, 232, 804, 815, 859, 860, 861, 1085, 1086, 1087, 1088, 855, 856, 857, 418, 816, 1169, 818, 864, 1179, 821, 971, 824, 1183, 827, 897, 830, 1188, 830, 421, 967, 598, 883, 900, 836, 875, 5, 1346, 1346, 604, 604, 901, 608, 1069, 1070, 704, 844, 991, 992, 706, 707, 847, 1162, 1101, 696, 892, 1163, 1164, 1165, 1166, 839, 840, 5, -59, 852, 1099, 1100, 807, -59, -59, -59, 704, 708, 709, 705, 706, 707, 1038, 612, 1125, 1041, 1225, 1290, 1043, 869, 1044, 869, 1156, 1206, 1045, 134, 228, 684, 1209, 230, 231, 232, 1284, 708, 709, 710, 1162, 1106, 1184, 1334, 1163, 1164, 1165, 1348, 1341, 807, 5, 43, 758, 1167, 1327, 1312, 1016, 1016, 287, 622, 933, 165, 904, 166, 167, 909, 168, 862, 1033, 1054, 866, 169, 1020, 1168, 919, 566, 280, 618, 281, 170, 679, 623, 171, 679, 872, 807, 683, 878, 1278, 502, 759, 1046, 844, 1048, 460, 462, 172, 173, 465, 466, 666, 769, 1167, 174, 507, 769, 175, 952, 1078, 954, 955, 786, 487, 268, 958, 896, 269, 786, 699, 494, 962, 791, 497, 700, 701, 500, 1118, 1120, 1121, 1122, 702, 176, 421, 510, 177, 696, 178, 830, 179, 974, 1101, 830, 728, 180, 181, 977, 979, 830, 728, 5, 983, 830, 728, 986, 830, 1420, 988, 835, 704, 989, 98, 705, 706, 707, 836, 836, 993, 406, 608, 228, 997, 998, 230, 231, 232, 233, 234, 805, 1113, 806, 1001, 1003, 410, 101, 104, 708, 709, 710, 1321, 1321, 1329, 1329, 413, 1336, 1123, 1321, 1403, 1162, 1193, 1194, 1195, 1163, 1164, 1165, 1004, 0, 5, 5, 0, 0, 1319, 0, 1312, 5, 696, 704, 0, 0, 705, 706, 707, 0, 704, 0, 0, 228, 229, 707, 230, 231, 232, 1051, 736, 0, 747, 0, 0, 0, 0, 1058, 1056, 0, 708, 709, 710, 1064, 1065, 1066, 1067, 708, 709, 1016, 952, 952, 0, 0, 0, 1392, 0, 1167, 1395, 1281, 1196, 0, 1396, 0, 0, 1399, 0, 0, 1077, 1400, 0, 0, 0, 0, 0, 1081, 1082, 1083, 0, 1084, 830, 830, 830, 0, 1089, 0, 1090, 476, 0, 0, 608, 0, 1095, 0, 844, 5, 0, 0, 1001, 1001, 1419, 0, 0, 0, 704, 1421, 0, 705, 706, 707, 0, 863, 0, 0, 0, 869, 735, 0, 1016, 228, 923, 736, 230, 231, 232, 233, 234, 0, 873, 806, 1022, 708, 709, 710, 1023, 1024, 1025, 0, 679, 1139, 5, 1142, 0, 608, 1146, 0, 0, 0, 1149, 1150, 0, 0, 0, 1153, 1154, 0, 1155, 0, 898, 830, 902, 1157, 0, 902, 0, 0, 902, 0, 0, 902, 844, 0, 902, 0, 0, 1161, 0, 0, 728, 0, 0, 1177, 0, 0, 1177, 0, 934, 1162, 1177, 1016, 0, 1163, 1164, 1165, 1166, 0, 0, 5, 0, 869, 0, 0, 0, 0, 0, 0, 704, 0, 0, 705, 706, 707, 0, 1204, 0, 1205, 1187, 1142, 608, 1208, 0, 1146, 1210, 0, 0, 0, 1212, 608, 0, 1216, 0, 0, 0, 708, 709, 710, 1218, 1220, 0, 141, 0, 0, 869, 869, 150, 0, 153, 0, 155, 1167, 157, 476, 159, 0, 0, 1279, 0, 1391, 0, 5, 1289, 1218, 0, 0, 0, 0, 0, 1394, 704, 1168, 0, 705, 706, 707, 1398, 0, 0, 0, 0, 0, 735, 0, 0, 228, 229, 736, 230, 231, 232, 233, 234, 0, 0, 806, 1012, 708, 709, 710, 0, 1291, 1293, 1294, 1295, 1296, 1026, 0, 1298, 1299, 1300, 1301, 1302, 0, 0, 1304, 0, 608, 0, 844, 0, 902, 0, 902, 608, 228, 229, 902, 230, 231, 232, 233, 234, 0, 0, 0, 110, 728, 0, 0, 0, 0, 0, 111, 112, 728, 113, 0, 0, 116, 0, 117, 0, 118, 0, 1357, 0, 119, 0, 120, 0, 121, 1362, 122, 1365, 123, 0, 124, 0, 125, 1369, 126, 1372, 0, 0, 0, 0, 1376, 0, 127, 1379, 0, 0, 0, 0, 1383, 128, 0, 129, 0, 130, 0, 131, 0, 132, 1162, 133, 0, 0, 1163, 1164, 1165, 1166, 0, 0, 5, 0, 0, 0, 0, 0, 5, 0, 0, 704, 0, 0, 705, 706, 707, 704, 0, 0, 705, 706, 707, 0, 1220, 902, 0, 0, 0, 1407, 1409, 0, 0, 1412, 736, 197, 1, 2, 708, 709, 710, 0, 3, 0, 708, 709, 710, 4, 0, 5, 6, 0, 0, 0, 1167, 0, 7, 0, 0, 8, 0, 0, 0, 0, 0, 0, 9, 10, 0, 11, 0, 12, 0, 0, 1168, 0, 13, 0, 14, 227, 728, 15, 0, 728, 16, 476, 0, 728, 0, 0, 0, 728, 17, 5, 0, 18, 0, 19, 20, 21, 22, 0, 704, 0, 0, 705, 706, 707, 23, 24, 0, 25, 26, 27, 735, 28, 29, 30, 31, 32, 33, 0, 34, 35, 36, 0, 5, 0, 0, 708, 709, 710, 0, 0, 0, 704, 355, 0, 705, 706, 707, 356, 0, 358, 0, 728, 360, 361, 0, 0, 0, 0, 0, 728, 0, 0, 0, 0, 5, 0, 0, 728, 708, 709, 710, 0, 0, 704, 372, 373, 705, 706, 707, 376, 0, 0, 377, 1187, 0, 0, 0, 0, 0, 381, 0, 0, 0, 385, 0, 0, 0, 0, 388, 0, 708, 709, 710, 391, 0, 0, 0, 0, 394, 0, 0, 0, 0, 397, 0, 400, 134, 228, 229, 402, 230, 231, 232, 233, 234, 0, 404, 0, 0, 407, 0, 0, 0, 0, 0, 0, 0, 416, 1313, 0, 1320, 1320, 1328, 1328, 0, 1335, 1339, 1320, 1344, 1344, 0, 1349, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 5, 6, 0, 0, 0, 0, 0, 0, 0, 704, 8, 0, 705, 706, 707, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 300, 0, 305, 14, 310, 0, 0, 322, 0, 16, 708, 709, 710, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 20, 0, 22, 0, 3, 0, 0, 0, 0, 529, 0, 530, 6, 25, 0, 27, 535, 28, 0, 30, 0, 8, 0, 0, 0, 35, 543, 0, 9, 0, 3, 11, 0, 544, 0, 0, 0, 0, 6, 0, 0, 550, 0, 0, 0, 0, 16, 8, 0, 0, 0, 0, 0, 0, 9, 0, 0, 18, 0, 567, 20, 0, 22, 0, 0, 571, 14, 0, 0, 0, 0, 0, 16, 25, 0, 27, 0, 28, 0, 30, 0, 0, 0, 18, 0, 35, 20, 0, 22, 635, 636, 637, 638, 639, 640, 641, 642, 643, 0, 25, 606, 27, 0, 28, 610, 30, 0, 0, 0, 0, 0, 35, 0, 0, 0, 0, 0, 0, 417, 0, 0, 0, 0, 0, 0, 432, 0, 438, 439, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 0, 472, 0, 0, 0, 0, 480, 1263, 1226, 1227, 1228, 1229, 1230, 1231, 1232, 1264, 1233, 1234, 1235, 1236, 1237, 1238, 1239, 1240, 1241, 1242, 1243, 1244, 1245, 1246, 1247, 1248, 1249, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1265, 1266, 1257, 1258, 1259, 1260, 1261, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 761, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 545, 0, 0, 0, 0, 0, 0, 0, 0, 0, 553, 0, 395, 396, 0, 399, 0, 561, 0, 0, 781, 0, 0, 0, 0, 783, 0, 0, 0, 0, 0, 0, 572, 0, 0, 0, 0, 0, 577, 578, 0, 0, 581, 0, 0, 584, 0, 0, 0, 0, 0, 0, 593, 0, 0, 595, 0, 0, 0, 0, 601, 0, 602, 0, 0, 0, 0, 0, 817, 0, 820, 611, 0, 823, 0, 826, 0, 829, 0, 832, 0, 0, 834, 0, 625, 0, 0, 0, 632, 0, 838, 0, 0, 841, 0, 843, 0, 0, 0, 0, 846, 0, 0, 669, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 681, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 732, 0, 0, 0, 0, 0, 744, 0, 0, 0, 750, 0, 0, 0, 0, 0, 753, 0, 754, 559, 0, 0, 756, 0, 0, 0, 0, 565, 760, 0, 0, 0, 568, 0, 0, 763, 0, 0, 0, 575, 576, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 594, 773, 0, 0, 775, 776, 777, 778, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 784, 0, 0, 0, 0, 0, 0, 0, 0, 792, 0, 794, 0, 0, 797, 0, 799, 0, 801, 0, 0, 0, 0, 0, 814, 0, 0, 1226, 1227, 1228, 1229, 1230, 1231, 1232, 0, 1233, 1234, 1235, 1236, 1237, 1238, 1239, 1240, 1241, 1242, 1243, 1244, 1245, 1246, 1247, 1248, 1249, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 0, 995, 1257, 1258, 1259, 1260, 1261, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 865, 0, 867, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 877, 0, 879, 0, 0, 0, 0, 0, 0, 885, 0, 886, 0, 887, 0, 888, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 779, 780, 0, 0, 0, 0, 782, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1075, 0, 796, 930, 798, 0, 800, 0, 802, 0, 0, 935, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1098, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1137, 0, 976, 0, 0, 0, 1141, 982, 1144, 0, 0, 1148, 0, 0, 0, 0, 0, 0, 0, 990, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 999, 0, 0, 0, 0, 0, 0, 1000, 1159, 0, 1005, 1006, 1007, 1008, 1009, 1010, 0, 0, 1011, 0, 1015, 0, 0, 1019, 0, 0, 0, 0, 1021, 0, 1030, 1031, 1032, 0, 0, 0, 0, 0, 0, 1036, 0, 0, 0, 0, 0, 0, 1202, 0, 1203, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1215, 0, 0, 0, 0, 1063, 0, 0, 0, 0, 944, 945, 946, 947, 0, 949, 950, 0, 0, 0, 0, 0, 0, 0, 0, 957, 0, 959, 960, 0, 0, 0, 0, 0, 0, 964, 965, 0, 0, 0, 1080, 0, 0, 0, 0, 0, 0, 0, 972, 0, 0, 0, 0, 0, 0, 1092, 0, 1094, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1109, 1110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1126, 1309, 0, 0, 0, 1136, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1359, 0, 0, 0, 0, 0, 0, 1364, 0, 0, 0, 0, 0, 0, 0, 1371, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1198, 0, 1200, 1068, 0, 0, 0, 0, 1071, 1072, 0, 1073, 0, 0, 0, 0, 0, 1074, 0, 0, 1076, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1217, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1277, 0, 0, 0, 0, 0, 0, 0, 1283, 0, 1287, 1288, 1270, 1226, 1227, 1228, 1229, 1230, 1231, 1232, 1271, 1233, 1234, 1235, 1236, 1237, 1238, 1239, 1240, 1241, 1242, 1243, 1244, 1245, 1246, 1247, 1248, 1249, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1272, 1273, 1257, 1258, 1259, 1260, 1261, 0, 0, 0, 0, 1297, 0, 0, 0, 0, 0, 0, 1303, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1311, 0, 1318, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1352, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1211, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1222, 0, 0, 1388, 1389, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1405, 0, 0, 0, 0, 0, 0, 1414, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1423, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1307, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1354, 0, 0, 1355, 1356, 0, 1358, 0, 0, 0, 1360, 1361, 0, 1363, 0, 1366, 0, 0, 1367, 1368, 0, 1370, 0, 1373, 0, 1374, 1375, 0, 1377, 1378, 0, 1380, 1381, 0, 1382, 0, 1384, 1385, 0, 1386, 0, 1387, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1404, 0, 1406, 1408, 0, 1410, 1411, 1413, 0, 1415, 1416, 1417, 1418, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1422, 0, 1424 }; static const yytype_int16 yycheck[] = { 57, 192, 196, 0, 0, 227, 220, 115, 558, 223, 374, 131, 132, 434, 783, 434, 201, 206, 821, 242, 853, 346, 893, 836, 838, 592, 1137, 841, 528, 212, 0, 0, 352, 821, 411, 208, 824, 379, 742, 235, 955, 697, 678, 204, 369, 133, 836, 656, 694, 243, 836, 1058, 403, 159, 160, 109, 110, 111, 112, 113, 4, 6, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 997, 130, 131, 132, 136, 1291, 138, 1077, 140, 141, 365, 143, 156, 1064, 158, 1066, 1067, 149, 150, 0, 152, 153, 154, 155, 156, 157, 158, 159, 160, 832, 162, 14, 164, 816, 17, 818, 4, 147, 821, 22, 195, 824, 35, 598, 827, 195, 201, 830, 25, 604, 14, 4, 184, 17, 186, 187, 188, 220, 190, 49, 223, 80, 82, 192, 40, 84, 19, 5, 197, 49, 6, 1357, 1142, 17, 163, 28, 347, 15, 3, 6, 7, 17, 26, 73, 350, 12, 40, 952, 56, 1035, 17, 952, 60, 86, 87, 1146, 974, 163, 88, 368, 25, 78, 78, 56, 163, 993, 89, 60, 88, 53, 54, 974, 80, 245, 977, 247, 84, 163, 378, 416, 32, 33, 254, 1309, 256, 89, 397, 80, 260, 261, 274, 84, 1078, 404, 266, 267, 268, 269, 1220, 271, 1001, 273, 274, 275, 539, 403, 82, 418, 927, 1057, 929, 603, 284, 570, 198, 82, 201, 289, 290, 1149, 292, 872, 893, 163, 1161, 807, 298, 878, 1114, 890, 302, 303, 598, 0, 569, 307, 308, 752, 862, 61, 312, 313, 866, 17, 17, 540, 989, 65, 320, 6, 74, 75, 324, 26, 977, 327, 979, 552, 17, 16, 983, 470, 334, 1081, 336, 337, 338, 339, 340, 1098, 342, 31, 90, 5, 24, 513, 50, 51, 1081, 1082, 5, 350, 55, 15, 64, 1133, 355, 356, 1218, 39, 15, 1075, 51, 53, 54, 147, 148, 149, 48, 151, 152, 153, 154, 155, 9, 17, 409, 376, 377, 412, 9, 41, 17, 720, 26, 722, 385, 724, 17, 726, 386, 728, 155, 389, 157, 82, 392, 77, 397, 61, 62, 400, 543, 38, 1053, 17, 61, 150, 407, 67, 22, 836, 54, 7, 72, 357, 356, 11, 12, 13, 1153, 67, 364, 17, 150, 427, 428, 697, 22, 1289, 371, 1084, 434, 435, 92, 437, 1294, 377, 19, 441, 442, 443, 1300, 445, 574, 1159, 92, 28, 589, 583, 7, 592, 774, 455, 11, 457, 458, 1106, 460, 600, 462, 463, 1220, 465, 466, 633, 468, 469, 586, 57, 598, 473, 474, 475, 580, 69, 478, 619, 65, 149, 622, 483, 484, 35, 71, 487, 488, 851, 1202, 1203, 30, 31, 494, 495, 759, 497, 498, 7, 500, 501, 17, 11, 1280, 90, 56, 202, 23, 17, 510, 511, 512, 48, 209, 53, 54, 517, 882, 519, 16, 521, 790, 523, 547, 548, 17, 1144, 791, 547, 548, 1148, 529, 530, 1181, 26, 86, 87, 24, 7, 563, 564, 1189, 1190, 12, 563, 564, 610, 1142, 17, 17, 574, 546, 550, 361, 549, 1150, 551, 697, 17, 554, 555, 20, 898, 22, 372, 373, 902, 562, 408, 567, 906, 907, 908, 381, 414, 911, 912, 1001, 573, 915, 388, 154, 155, 391, 579, 25, 394, 582, 32, 120, 585, 122, 1291, 124, 402, 126, 1295, 1296, 47, 1298, 1299, 596, 1301, 1302, 1208, 1304, 1210, 33, 606, 7, 35, 612, 610, 11, 12, 13, 14, 155, 619, 157, 62, 622, 762, 624, 893, 626, 821, 45, 7, 824, 1278, 56, 827, 12, 7, 60, 155, 1285, 11, 12, 13, 156, 17, 644, 17, 70, 21, 22, 649, 650, 651, 29, 653, 654, 655, 656, 161, 162, 659, 58, 59, 86, 87, 1362, 804, 147, 795, 807, 808, 157, 1369, 69, 61, 62, 675, 676, 677, 678, 374, 680, 1379, 682, 8, 684, 1383, 686, 53, 54, 384, 847, 54, 826, 832, 1001, 829, 148, 69, 369, 151, 152, 153, 695, 703, 765, 766, 767, 1042, 1043, 1044, 1045, 151, 152, 153, 346, 715, 1139, 717, 769, 1142, 720, 894, 722, 1146, 724, 816, 726, 1150, 728, 997, 891, 731, 793, 817, 734, 786, 17, 1301, 1302, 739, 740, 818, 742, 1013, 1014, 26, 746, 925, 926, 30, 31, 751, 7, 8, 893, 894, 11, 12, 13, 14, 739, 740, 17, 156, 761, 1061, 1062, 1035, 161, 162, 163, 26, 53, 54, 29, 30, 31, 974, 527, 1090, 974, 1204, 1224, 977, 781, 979, 783, 1122, 1180, 983, 147, 148, 571, 1184, 151, 152, 153, 1220, 53, 54, 55, 7, 1066, 1146, 1296, 11, 12, 13, 1302, 1299, 1078, 17, 0, 624, 69, 21, 22, 954, 955, 201, 536, 843, 129, 820, 129, 129, 823, 129, 768, 968, 995, 771, 129, 958, 89, 832, 478, 199, 533, 199, 129, 838, 537, 129, 841, 785, 1114, 570, 788, 1212, 989, 851, 986, 853, 988, 362, 363, 129, 129, 366, 367, 556, 862, 69, 129, 398, 866, 129, 868, 1035, 870, 871, 872, 380, 195, 875, 815, 195, 878, 597, 387, 881, 882, 390, 597, 597, 393, 1081, 1082, 1083, 1084, 597, 129, 1161, 401, 129, 1035, 129, 898, 129, 900, 8, 902, 598, 129, 129, 906, 907, 908, 604, 17, 911, 912, 608, 914, 915, 1409, 917, 731, 26, 920, 0, 29, 30, 31, 925, 926, 927, 334, 929, 148, 931, 932, 151, 152, 153, 154, 155, 156, 1078, 158, 941, 942, 337, 0, 0, 53, 54, 55, 1293, 1294, 1295, 1296, 339, 1298, 1089, 1300, 1388, 7, 1153, 1154, 1155, 11, 12, 13, 942, -1, 17, 17, -1, -1, 20, -1, 22, 17, 1114, 26, -1, -1, 29, 30, 31, -1, 26, -1, -1, 148, 149, 31, 151, 152, 153, 989, 43, -1, 45, -1, -1, -1, -1, 1000, 998, -1, 53, 54, 55, 1006, 1007, 1008, 1009, 53, 54, 1149, 1013, 1014, -1, -1, -1, 1362, -1, 69, 1365, 1216, 1157, -1, 1369, -1, -1, 1372, -1, -1, 1031, 1376, -1, -1, -1, -1, -1, 1038, 1039, 1040, -1, 1042, 1043, 1044, 1045, -1, 1047, -1, 1049, 9, -1, -1, 1053, -1, 1055, -1, 1057, 17, -1, -1, 1061, 1062, 1407, -1, -1, -1, 26, 1412, -1, 29, 30, 31, -1, 769, -1, -1, -1, 1075, 38, -1, 1218, 148, 42, 43, 151, 152, 153, 154, 155, -1, 786, 158, 7, 53, 54, 55, 11, 12, 13, -1, 1098, 1102, 17, 1104, -1, 1106, 1107, -1, -1, -1, 1111, 1112, -1, -1, -1, 1116, 1117, -1, 1119, -1, 816, 1122, 818, 1124, -1, 821, -1, -1, 824, -1, -1, 827, 1133, -1, 830, -1, -1, 1138, -1, -1, 836, -1, -1, 1141, -1, -1, 1144, -1, 844, 7, 1148, 1289, -1, 11, 12, 13, 14, -1, -1, 17, -1, 1159, -1, -1, -1, -1, -1, -1, 26, -1, -1, 29, 30, 31, -1, 1176, -1, 1178, 36, 1180, 1181, 1182, -1, 1184, 1185, -1, -1, -1, 1189, 1190, -1, 1192, -1, -1, -1, 53, 54, 55, 1199, 1200, -1, 112, -1, -1, 1202, 1203, 117, -1, 119, -1, 121, 69, 123, 9, 125, -1, -1, 1215, -1, 1359, -1, 17, 1223, 1224, -1, -1, -1, -1, -1, 1364, 26, 89, -1, 29, 30, 31, 1371, -1, -1, -1, -1, -1, 38, -1, -1, 148, 149, 43, 151, 152, 153, 154, 155, -1, -1, 158, 952, 53, 54, 55, -1, 1262, 1263, 1264, 1265, 1266, 962, -1, 1269, 1270, 1271, 1272, 1273, -1, -1, 1276, -1, 1278, -1, 1280, -1, 977, -1, 979, 1285, 148, 149, 983, 151, 152, 153, 154, 155, -1, -1, -1, 45, 993, -1, -1, -1, -1, -1, 52, 53, 1001, 55, -1, -1, 58, -1, 60, -1, 62, -1, 1316, -1, 66, -1, 68, -1, 70, 1323, 72, 1325, 74, -1, 76, -1, 78, 1331, 80, 1333, -1, -1, -1, -1, 1338, -1, 88, 1341, -1, -1, -1, -1, 1346, 95, -1, 97, -1, 99, -1, 101, -1, 103, 7, 105, -1, -1, 11, 12, 13, 14, -1, -1, 17, -1, -1, -1, -1, -1, 17, -1, -1, 26, -1, -1, 29, 30, 31, 26, -1, -1, 29, 30, 31, -1, 1388, 1084, -1, -1, -1, 1393, 1394, -1, -1, 1397, 43, 147, 4, 5, 53, 54, 55, -1, 10, -1, 53, 54, 55, 15, -1, 17, 18, -1, -1, -1, 69, -1, 24, -1, -1, 27, -1, -1, -1, -1, -1, -1, 34, 35, -1, 37, -1, 39, -1, -1, 89, -1, 44, -1, 46, 191, 1139, 49, -1, 1142, 52, 9, -1, 1146, -1, -1, -1, 1150, 60, 17, -1, 63, -1, 65, 66, 67, 68, -1, 26, -1, -1, 29, 30, 31, 76, 77, -1, 79, 80, 81, 38, 83, 84, 85, 86, 87, 88, -1, 90, 91, 92, -1, 17, -1, -1, 53, 54, 55, -1, -1, -1, 26, 248, -1, 29, 30, 31, 253, -1, 255, -1, 1204, 258, 259, -1, -1, -1, -1, -1, 1212, -1, -1, -1, -1, 17, -1, -1, 1220, 53, 54, 55, -1, -1, 26, 280, 281, 29, 30, 31, 285, -1, -1, 288, 36, -1, -1, -1, -1, -1, 295, -1, -1, -1, 299, -1, -1, -1, -1, 304, -1, 53, 54, 55, 309, -1, -1, -1, -1, 314, -1, -1, -1, -1, 319, -1, 321, 147, 148, 149, 325, 151, 152, 153, 154, 155, -1, 332, -1, -1, 335, -1, -1, -1, -1, -1, -1, -1, 343, 1291, -1, 1293, 1294, 1295, 1296, -1, 1298, 1299, 1300, 1301, 1302, -1, 1304, -1, -1, -1, -1, -1, -1, 10, -1, -1, -1, -1, -1, -1, 17, 18, -1, -1, -1, -1, -1, -1, -1, 26, 27, -1, 29, 30, 31, -1, -1, 34, -1, -1, -1, -1, -1, -1, -1, -1, 203, -1, 205, 46, 207, -1, -1, 210, -1, 52, 53, 54, 55, -1, -1, -1, -1, -1, -1, -1, 63, -1, -1, 66, -1, 68, -1, 10, -1, -1, -1, -1, 429, -1, 431, 18, 79, -1, 81, 436, 83, -1, 85, -1, 27, -1, -1, -1, 91, 446, -1, 34, -1, 10, 37, -1, 453, -1, -1, -1, -1, 18, -1, -1, 461, -1, -1, -1, -1, 52, 27, -1, -1, -1, -1, -1, -1, 34, -1, -1, 63, -1, 479, 66, -1, 68, -1, -1, 485, 46, -1, -1, -1, -1, -1, 52, 79, -1, 81, -1, 83, -1, 85, -1, -1, -1, 63, -1, 91, 66, -1, 68, 93, 94, 95, 96, 97, 98, 99, 100, 101, -1, 79, 520, 81, -1, 83, 524, 85, -1, -1, -1, -1, -1, 91, -1, -1, -1, -1, -1, -1, 344, -1, -1, -1, -1, -1, -1, 351, -1, 353, 354, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, -1, 370, -1, -1, -1, -1, 375, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 631, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 454, -1, -1, -1, -1, -1, -1, -1, -1, -1, 464, -1, 317, 318, -1, 320, -1, 471, -1, -1, 668, -1, -1, -1, -1, 673, -1, -1, -1, -1, -1, -1, 486, -1, -1, -1, -1, -1, 492, 493, -1, -1, 496, -1, -1, 499, -1, -1, -1, -1, -1, -1, 506, -1, -1, 509, -1, -1, -1, -1, 514, -1, 516, -1, -1, -1, -1, -1, 716, -1, 718, 525, -1, 721, -1, 723, -1, 725, -1, 727, -1, -1, 730, -1, 538, -1, -1, -1, 542, -1, 738, -1, -1, 741, -1, 743, -1, -1, -1, -1, 748, -1, -1, 557, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 568, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 599, -1, -1, -1, -1, -1, 605, -1, -1, -1, 609, -1, -1, -1, -1, -1, 615, -1, 617, 469, -1, -1, 621, -1, -1, -1, -1, 477, 627, -1, -1, -1, 482, -1, -1, 634, -1, -1, -1, 489, 490, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 507, 657, -1, -1, 660, 661, 662, 663, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 674, -1, -1, -1, -1, -1, -1, -1, -1, 683, -1, 685, -1, -1, 688, -1, 690, -1, 692, -1, -1, -1, -1, -1, 698, -1, -1, 108, 109, 110, 111, 112, 113, 114, -1, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, -1, 928, 142, 143, 144, 145, 146, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 770, -1, 772, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 787, -1, 789, -1, -1, -1, -1, -1, -1, 796, -1, 798, -1, 800, -1, 802, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 666, 667, -1, -1, -1, -1, 672, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1028, -1, 687, 837, 689, -1, 691, -1, 693, -1, -1, 845, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1060, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1097, -1, 905, -1, -1, -1, 1103, 910, 1105, -1, -1, 1108, -1, -1, -1, -1, -1, -1, -1, 922, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 933, -1, -1, -1, -1, -1, -1, 940, 1135, -1, 943, 944, 945, 946, 947, 948, -1, -1, 951, -1, 953, -1, -1, 956, -1, -1, -1, -1, 961, -1, 963, 964, 965, -1, -1, -1, -1, -1, -1, 972, -1, -1, -1, -1, -1, -1, 1173, -1, 1175, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1191, -1, -1, -1, -1, 1002, -1, -1, -1, -1, 858, 859, 860, 861, -1, 863, 864, -1, -1, -1, -1, -1, -1, -1, -1, 873, -1, 875, 876, -1, -1, -1, -1, -1, -1, 883, 884, -1, -1, -1, 1037, -1, -1, -1, -1, -1, -1, -1, 896, -1, -1, -1, -1, -1, -1, 1052, -1, 1054, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1071, 1072, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1091, 1286, -1, -1, -1, 1096, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1317, -1, -1, -1, -1, -1, -1, 1324, -1, -1, -1, -1, -1, -1, -1, 1332, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1158, -1, 1160, 1012, -1, -1, -1, -1, 1017, 1018, -1, 1020, -1, -1, -1, -1, -1, 1026, -1, -1, 1029, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1197, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1211, -1, -1, -1, -1, -1, -1, -1, 1219, -1, 1221, 1222, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, -1, -1, -1, -1, 1267, -1, -1, -1, -1, -1, -1, 1274, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1290, -1, 1292, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1306, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1186, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1201, -1, -1, 1353, 1354, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1391, -1, -1, -1, -1, -1, -1, 1398, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1420, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1282, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1310, -1, -1, 1313, 1314, -1, 1316, -1, -1, -1, 1320, 1321, -1, 1323, -1, 1325, -1, -1, 1328, 1329, -1, 1331, -1, 1333, -1, 1335, 1336, -1, 1338, 1339, -1, 1341, 1342, -1, 1344, -1, 1346, 1347, -1, 1349, -1, 1351, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1390, -1, 1392, 1393, -1, 1395, 1396, 1397, -1, 1399, 1400, 1401, 1402, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1419, -1, 1421 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_int16 yystos[] = { 0, 4, 5, 10, 15, 17, 18, 24, 27, 34, 35, 37, 39, 44, 46, 49, 52, 60, 63, 65, 66, 67, 68, 76, 77, 79, 80, 81, 83, 84, 85, 86, 87, 88, 90, 91, 92, 165, 166, 167, 238, 240, 306, 307, 310, 312, 333, 334, 335, 336, 337, 338, 341, 342, 344, 346, 354, 355, 356, 362, 363, 374, 376, 387, 388, 389, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 411, 432, 433, 434, 436, 438, 439, 445, 446, 451, 456, 459, 462, 465, 466, 469, 474, 476, 479, 483, 496, 500, 501, 506, 508, 509, 0, 159, 160, 202, 202, 202, 202, 202, 163, 204, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, 147, 205, 241, 205, 313, 205, 340, 340, 205, 347, 6, 82, 350, 351, 205, 357, 340, 205, 377, 340, 357, 340, 357, 340, 357, 340, 357, 205, 447, 205, 470, 335, 336, 337, 338, 362, 388, 389, 399, 403, 407, 432, 445, 451, 456, 459, 462, 465, 475, 477, 478, 205, 484, 484, 484, 40, 488, 489, 204, 204, 204, 204, 204, 202, 204, 204, 204, 204, 204, 358, 204, 358, 204, 358, 204, 204, 410, 204, 204, 161, 162, 203, 204, 204, 480, 481, 204, 497, 498, 204, 502, 503, 204, 202, 148, 149, 151, 152, 153, 154, 155, 168, 169, 170, 172, 174, 175, 178, 180, 181, 205, 242, 61, 314, 316, 19, 28, 56, 307, 312, 323, 324, 343, 355, 370, 371, 435, 437, 440, 442, 443, 444, 323, 343, 435, 437, 172, 348, 205, 352, 344, 364, 365, 367, 368, 369, 370, 371, 3, 25, 378, 379, 70, 310, 312, 323, 390, 397, 452, 453, 454, 455, 23, 238, 359, 360, 203, 71, 401, 457, 458, 203, 72, 405, 460, 461, 203, 73, 409, 463, 464, 50, 51, 238, 412, 413, 415, 416, 203, 64, 448, 449, 466, 467, 508, 74, 75, 471, 472, 78, 485, 486, 488, 485, 488, 485, 488, 41, 490, 491, 167, 180, 150, 168, 179, 172, 204, 239, 204, 308, 311, 202, 202, 204, 202, 204, 202, 202, 204, 204, 204, 204, 204, 204, 204, 204, 358, 204, 202, 202, 204, 375, 202, 202, 204, 204, 204, 202, 204, 259, 204, 202, 204, 204, 202, 204, 204, 202, 204, 204, 202, 259, 259, 202, 204, 259, 202, 204, 202, 204, 202, 204, 481, 202, 204, 204, 498, 204, 204, 503, 204, 204, 202, 203, 173, 176, 177, 181, 180, 32, 33, 169, 205, 243, 244, 245, 247, 248, 203, 62, 314, 319, 320, 344, 203, 203, 205, 317, 313, 355, 57, 325, 326, 16, 268, 269, 271, 273, 274, 276, 339, 350, 205, 372, 372, 48, 418, 420, 418, 355, 339, 418, 418, 172, 349, 171, 173, 353, 203, 374, 372, 372, 9, 238, 381, 383, 203, 205, 380, 313, 397, 276, 391, 418, 372, 238, 238, 205, 361, 268, 418, 372, 268, 418, 372, 268, 418, 372, 180, 184, 186, 205, 414, 412, 205, 417, 418, 372, 467, 180, 473, 205, 487, 490, 25, 422, 423, 490, 47, 510, 514, 167, 180, 204, 204, 202, 202, 308, 311, 204, 309, 202, 204, 204, 315, 204, 204, 204, 328, 202, 202, 203, 204, 204, 204, 204, 202, 204, 204, 203, 204, 204, 204, 345, 204, 259, 172, 203, 204, 204, 204, 259, 375, 202, 259, 204, 204, 202, 203, 204, 204, 259, 259, 203, 203, 204, 204, 203, 204, 204, 203, 204, 204, 155, 157, 183, 185, 189, 192, 203, 259, 203, 204, 204, 204, 468, 168, 203, 203, 204, 204, 499, 202, 204, 204, 207, 202, 203, 244, 247, 205, 246, 205, 249, 238, 322, 169, 321, 319, 238, 318, 203, 314, 339, 58, 59, 329, 331, 203, 180, 327, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 277, 278, 279, 268, 323, 343, 323, 343, 268, 205, 421, 268, 339, 268, 268, 7, 11, 238, 260, 264, 203, 7, 12, 258, 263, 268, 323, 343, 323, 343, 205, 384, 203, 314, 391, 277, 268, 323, 397, 268, 401, 268, 405, 268, 409, 180, 187, 180, 193, 268, 440, 442, 443, 444, 450, 26, 29, 30, 31, 53, 54, 55, 208, 210, 211, 212, 213, 214, 215, 216, 219, 220, 221, 223, 224, 229, 231, 234, 235, 238, 250, 251, 467, 203, 180, 422, 38, 43, 208, 383, 425, 429, 430, 494, 495, 203, 205, 424, 45, 507, 208, 203, 484, 204, 203, 203, 309, 203, 309, 315, 204, 203, 202, 168, 203, 204, 204, 204, 204, 204, 204, 441, 204, 441, 203, 204, 203, 203, 203, 203, 259, 259, 202, 259, 202, 203, 204, 204, 366, 204, 366, 204, 204, 203, 204, 203, 204, 259, 203, 259, 203, 259, 203, 259, 185, 183, 156, 158, 181, 182, 190, 193, 198, 199, 200, 203, 204, 204, 202, 204, 209, 202, 204, 209, 202, 204, 209, 202, 204, 209, 202, 204, 209, 202, 209, 202, 468, 204, 482, 202, 499, 499, 202, 207, 202, 204, 330, 202, 204, 511, 512, 247, 314, 205, 332, 180, 151, 152, 153, 280, 280, 280, 280, 355, 238, 350, 203, 355, 203, 422, 205, 266, 266, 355, 238, 258, 350, 373, 203, 355, 203, 171, 385, 314, 280, 397, 203, 203, 203, 203, 180, 188, 193, 180, 194, 182, 201, 374, 212, 238, 250, 215, 219, 238, 250, 205, 217, 223, 229, 234, 205, 222, 229, 234, 169, 225, 234, 169, 232, 184, 205, 236, 147, 206, 42, 208, 425, 429, 492, 493, 494, 203, 384, 384, 321, 238, 203, 374, 418, 479, 500, 504, 422, 485, 330, 259, 259, 259, 259, 441, 259, 259, 441, 204, 419, 204, 204, 366, 259, 204, 259, 259, 366, 204, 382, 259, 259, 185, 201, 182, 191, 198, 194, 259, 209, 204, 209, 203, 204, 209, 204, 209, 209, 203, 204, 209, 209, 204, 209, 204, 204, 203, 482, 482, 204, 207, 202, 207, 204, 204, 203, 203, 204, 513, 204, 512, 203, 203, 203, 203, 203, 203, 203, 238, 425, 429, 203, 172, 267, 267, 203, 373, 203, 7, 11, 12, 13, 238, 256, 257, 386, 203, 203, 203, 180, 195, 196, 203, 218, 220, 223, 229, 234, 229, 234, 234, 234, 169, 226, 169, 233, 184, 205, 237, 494, 167, 385, 205, 431, 204, 208, 383, 429, 515, 203, 204, 204, 204, 204, 259, 419, 419, 259, 259, 259, 259, 202, 259, 204, 168, 198, 203, 204, 204, 204, 204, 209, 209, 209, 209, 204, 204, 230, 203, 207, 203, 204, 330, 507, 202, 513, 513, 8, 282, 284, 281, 284, 282, 283, 284, 203, 203, 266, 281, 180, 197, 198, 223, 229, 234, 229, 234, 234, 234, 169, 227, 260, 203, 7, 11, 12, 13, 14, 69, 426, 427, 428, 203, 202, 384, 204, 272, 202, 204, 270, 202, 207, 204, 275, 202, 204, 204, 392, 198, 204, 204, 204, 209, 204, 330, 202, 504, 204, 7, 11, 12, 13, 14, 69, 89, 208, 252, 253, 254, 255, 261, 265, 305, 205, 285, 208, 281, 305, 285, 208, 283, 285, 267, 36, 208, 305, 393, 394, 229, 234, 234, 234, 169, 228, 203, 266, 203, 385, 202, 202, 204, 204, 270, 207, 204, 275, 204, 259, 204, 207, 207, 202, 204, 203, 204, 262, 204, 505, 259, 266, 266, 208, 108, 109, 110, 111, 112, 113, 114, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 142, 143, 144, 145, 146, 298, 107, 115, 140, 141, 286, 289, 298, 107, 115, 140, 141, 291, 294, 298, 203, 393, 205, 395, 234, 267, 203, 208, 494, 507, 203, 203, 204, 262, 204, 296, 204, 204, 204, 204, 203, 204, 204, 204, 204, 204, 203, 204, 207, 330, 259, 207, 202, 267, 203, 22, 238, 261, 297, 303, 304, 203, 20, 238, 253, 287, 299, 300, 303, 287, 21, 238, 253, 288, 301, 302, 303, 288, 238, 253, 290, 303, 238, 292, 299, 303, 287, 238, 293, 301, 303, 293, 238, 295, 303, 203, 504, 259, 259, 259, 204, 259, 202, 259, 259, 204, 259, 202, 204, 259, 259, 259, 204, 259, 202, 204, 259, 259, 259, 204, 259, 259, 204, 259, 259, 259, 204, 259, 259, 259, 259, 203, 203, 261, 180, 253, 303, 169, 253, 253, 303, 169, 253, 253, 303, 303, 505, 259, 203, 259, 204, 259, 204, 259, 259, 204, 259, 203, 259, 259, 259, 259, 253, 258, 253, 259, 203, 259 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_int16 yyr1[] = { 0, 164, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 166, 166, 166, 166, 166, 166, 167, 167, 168, 169, 169, 170, 171, 172, 172, 173, 173, 174, 175, 176, 177, 178, 178, 179, 179, 180, 180, 180, 180, 181, 181, 182, 183, 184, 184, 184, 185, 185, 186, 187, 188, 189, 190, 190, 191, 191, 192, 193, 194, 195, 195, 195, 196, 197, 198, 198, 199, 200, 200, 201, 201, 202, 202, 203, 203, 204, 205, 206, 207, 207, 208, 208, 208, 209, 209, 209, 210, 210, 211, 211, 211, 212, 212, 212, 212, 213, 214, 215, 216, 217, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 230, 231, 232, 233, 234, 235, 236, 236, 237, 237, 238, 239, 239, 239, 239, 239, 239, 239, 240, 241, 242, 242, 243, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 252, 253, 254, 255, 255, 255, 255, 255, 256, 257, 257, 257, 257, 258, 259, 259, 260, 261, 262, 262, 263, 263, 264, 264, 265, 265, 266, 267, 268, 268, 268, 268, 269, 270, 270, 270, 270, 271, 272, 272, 272, 272, 273, 274, 275, 275, 275, 276, 277, 277, 277, 277, 277, 277, 277, 277, 277, 278, 278, 279, 279, 280, 280, 280, 281, 282, 283, 284, 285, 286, 286, 286, 286, 286, 286, 286, 286, 286, 287, 287, 287, 287, 287, 287, 287, 287, 288, 288, 288, 288, 288, 288, 288, 288, 289, 289, 290, 290, 290, 290, 291, 291, 291, 291, 291, 291, 291, 291, 291, 292, 292, 292, 292, 293, 293, 293, 293, 294, 294, 295, 295, 296, 296, 297, 297, 297, 297, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 299, 300, 301, 302, 303, 304, 305, 306, 306, 307, 308, 308, 309, 309, 310, 311, 311, 312, 313, 314, 315, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 327, 327, 328, 328, 329, 330, 330, 331, 331, 332, 333, 333, 333, 334, 334, 335, 336, 337, 338, 339, 339, 340, 341, 341, 342, 342, 343, 343, 344, 345, 345, 345, 346, 346, 347, 348, 349, 350, 351, 351, 352, 353, 353, 354, 354, 355, 356, 356, 356, 357, 358, 358, 358, 358, 359, 360, 361, 362, 363, 363, 364, 364, 364, 364, 365, 366, 366, 366, 366, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 375, 375, 376, 377, 378, 379, 379, 380, 381, 382, 382, 382, 383, 384, 385, 386, 387, 387, 388, 389, 390, 390, 391, 392, 392, 392, 392, 392, 393, 394, 395, 396, 396, 397, 398, 398, 398, 399, 400, 400, 401, 402, 402, 403, 404, 405, 406, 406, 407, 408, 409, 410, 410, 410, 410, 410, 411, 411, 412, 413, 414, 414, 415, 416, 417, 418, 419, 419, 419, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 428, 428, 428, 428, 428, 429, 430, 431, 432, 432, 432, 433, 433, 434, 435, 435, 436, 437, 437, 438, 439, 440, 441, 441, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 450, 450, 450, 451, 452, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 466, 466, 466, 466, 466, 466, 466, 466, 466, 466, 466, 467, 467, 468, 468, 468, 469, 470, 471, 472, 472, 473, 473, 473, 474, 475, 475, 476, 477, 477, 477, 477, 477, 477, 477, 477, 477, 477, 477, 477, 477, 477, 478, 478, 478, 478, 478, 478, 478, 479, 480, 480, 481, 482, 482, 482, 482, 482, 482, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 497, 498, 499, 499, 499, 499, 499, 500, 501, 502, 502, 503, 504, 504, 504, 504, 505, 505, 505, 505, 506, 507, 508, 509, 510, 511, 511, 512, 513, 513, 513, 513, 514, 515 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ static const yytype_int8 yyr2[] = { 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 0, 1, 3, 1, 1, 2, 2, 2, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 6, 0, 1, 1, 1, 1, 3, 3, 1, 2, 1, 1, 1, 1, 3, 4, 2, 1, 1, 1, 1, 1, 3, 2, 0, 2, 1, 1, 1, 1, 1, 1, 1, 0, 2, 1, 2, 1, 0, 3, 2, 1, 1, 3, 2, 1, 1, 3, 4, 3, 6, 1, 4, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 5, 5, 5, 5, 7, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, 8, 4, 1, 1, 10, 1, 1, 1, 1, 1, 7, 0, 2, 1, 1, 1, 6, 1, 1, 1, 1, 1, 7, 0, 2, 4, 6, 2, 4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 4, 1, 1, 4, 1, 1, 1, 1, 7, 1, 1, 1, 1, 1, 7, 1, 1, 1, 1, 7, 0, 3, 7, 5, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 10, 0, 3, 3, 2, 10, 0, 2, 4, 2, 10, 10, 0, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 7, 6, 1, 1, 1, 1, 3, 1, 3, 1, 3, 1, 3, 2, 4, 6, 4, 2, 4, 2, 2, 2, 4, 6, 4, 2, 4, 2, 2, 1, 3, 2, 2, 4, 2, 1, 1, 3, 1, 3, 1, 3, 1, 3, 2, 4, 2, 2, 2, 4, 2, 2, 1, 3, 2, 2, 0, 2, 2, 2, 4, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 1, 4, 1, 4, 1, 1, 1, 1, 7, 5, 3, 0, 3, 7, 3, 3, 1, 1, 5, 0, 3, 1, 1, 1, 4, 1, 1, 1, 5, 1, 4, 1, 1, 2, 3, 0, 2, 5, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 8, 10, 8, 10, 3, 1, 1, 1, 1, 1, 1, 1, 1, 9, 0, 3, 3, 1, 1, 1, 1, 1, 6, 1, 1, 1, 4, 2, 1, 3, 7, 1, 1, 1, 1, 0, 2, 3, 5, 4, 1, 1, 10, 1, 1, 1, 1, 1, 1, 7, 0, 3, 5, 3, 3, 9, 7, 9, 1, 1, 1, 1, 7, 0, 3, 3, 1, 1, 5, 1, 1, 1, 7, 0, 3, 3, 1, 1, 1, 1, 1, 1, 8, 10, 1, 1, 10, 0, 3, 5, 3, 2, 5, 1, 1, 1, 1, 5, 1, 1, 1, 8, 1, 1, 5, 1, 1, 8, 1, 5, 1, 1, 8, 1, 5, 0, 3, 5, 3, 3, 1, 1, 4, 1, 1, 1, 4, 1, 1, 7, 0, 3, 3, 3, 1, 1, 5, 1, 1, 9, 1, 5, 1, 1, 1, 1, 1, 1, 7, 1, 1, 1, 1, 1, 1, 1, 10, 1, 1, 10, 1, 1, 10, 10, 7, 0, 3, 3, 9, 7, 9, 10, 1, 1, 9, 1, 1, 1, 1, 1, 10, 1, 1, 7, 9, 1, 10, 7, 1, 10, 7, 1, 10, 7, 1, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 3, 2, 1, 1, 4, 1, 1, 1, 2, 3, 4, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 3, 1, 8, 0, 3, 3, 3, 5, 3, 2, 1, 1, 4, 1, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 3, 1, 6, 0, 3, 3, 3, 2, 1, 4, 3, 1, 16, 1, 1, 1, 1, 0, 6, 3, 2, 1, 1, 9, 1, 4, 3, 1, 4, 0, 3, 3, 2, 1, 7 }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY) \ { \ yychar = (Token); \ yylval = (Value); \ YYPOPSTACK (yylen); \ yystate = *yyssp; \ goto yybackup; \ } \ else \ { \ yyerror (context, YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (0) /* Error token number */ #define YYTERROR 1 #define YYERRCODE 256 /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (0) /* This macro is provided for backward compatibility. */ #ifndef YY_LOCATION_PRINT # define YY_LOCATION_PRINT(File, Loc) ((void) 0) #endif # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Type, Value, context); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) /*-----------------------------------. | Print this symbol's value on YYO. | `-----------------------------------*/ static void yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, pj_wkt2_parse_context *context) { FILE *yyoutput = yyo; YYUSE (yyoutput); YYUSE (context); if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyo, yytoknum[yytype], *yyvaluep); # endif YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN YYUSE (yytype); YY_IGNORE_MAYBE_UNINITIALIZED_END } /*---------------------------. | Print this symbol on YYO. | `---------------------------*/ static void yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, pj_wkt2_parse_context *context) { YYFPRINTF (yyo, "%s %s (", yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); yy_symbol_value_print (yyo, yytype, yyvaluep, context); YYFPRINTF (yyo, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ static void yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) { int yybot = *yybottom; YYFPRINTF (stderr, " %d", yybot); } YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (0) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ static void yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule, pj_wkt2_parse_context *context) { int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yystos[+yyssp[yyi + 1 - yynrhs]], &yyvsp[(yyi + 1) - (yynrhs)] , context); YYFPRINTF (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyssp, yyvsp, Rule, context); \ } while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #if YYERROR_VERBOSE # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H # define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S))) # else /* Return the length of YYSTR. */ static YYPTRDIFF_T yystrlen (const char *yystr) { YYPTRDIFF_T yylen; for (yylen = 0; yystr && yystr[yylen]; yylen++) continue; return yylen; } # endif # endif # ifndef yystpcpy # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ static char * yystpcpy (char *yydest, const char *yysrc) { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif # ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYPTRDIFF_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { YYPTRDIFF_T yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; else goto append; append: default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (yyres) return (YYPTRDIFF_T)(yystpcpy (yyres, yystr) - yyres); else return yystrlen (yystr); } # endif /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message about the unexpected token YYTOKEN for the state stack whose top is YYSSP. Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is not large enough to hold the message. In that case, also set *YYMSG_ALLOC to the required number of bytes. Return 2 if the required number of bytes is too large to store. */ static int yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, yy_state_t *yyssp, int yytoken) { enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ const char *yyformat = YY_NULLPTR; /* Arguments of yyformat: reported tokens (one for the "unexpected", one per "expected"). */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Actual size of YYARG. */ int yycount = 0; /* Cumulated lengths of YYARG. */ YYPTRDIFF_T yysize = 0; /* There are many possibilities here to consider: - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't check for expected tokens because there are none. - The only way there can be no lookahead present (in yychar) is if this state is a consistent state with a default action. Thus, detecting the absence of a lookahead is sufficient to determine that there is no unexpected or expected token to report. In that case, just report a simple "syntax error". - Don't assume there isn't a lookahead just because this state is a consistent state with a default action. There might have been a previous inconsistent state, consistent state with a non-default action, or user semantic action that manipulated yychar. - Of course, the expected token list depends on states to have correct lookahead information, and it depends on the parser not to perform extra reductions after fetching a lookahead from the scanner and before detecting a syntax error. Thus, state merging (from LALR or IELR) and default reductions corrupt the expected token list. However, the list is correct for canonical LR with one exception: it will still contain any token that will not be accepted due to an error action in a later state. */ if (yytoken != YYEMPTY) { int yyn = yypact[+*yyssp]; YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); yysize = yysize0; yyarg[yycount++] = yytname[yytoken]; if (!yypact_value_is_default (yyn)) { /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. In other words, skip the first -YYN actions for this state because they are default actions. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yyx; for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR && !yytable_value_is_error (yytable[yyx + yyn])) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; break; } yyarg[yycount++] = yytname[yyx]; { YYPTRDIFF_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) yysize = yysize1; else return 2; } } } } switch (yycount) { # define YYCASE_(N, S) \ case N: \ yyformat = S; \ break default: /* Avoid compiler warnings. */ YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); # undef YYCASE_ } { /* Don't count the "%s"s in the final size, but reserve room for the terminator. */ YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1; if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) yysize = yysize1; else return 2; } if (*yymsg_alloc < yysize) { *yymsg_alloc = 2 * yysize; if (! (yysize <= *yymsg_alloc && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; return 1; } /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ { char *yyp = *yymsg; int yyi = 0; while ((*yyp = *yyformat) != '\0') if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyformat += 2; } else { ++yyp; ++yyformat; } } return 0; } #endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, pj_wkt2_parse_context *context) { YYUSE (yyvaluep); YYUSE (context); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN YYUSE (yytype); YY_IGNORE_MAYBE_UNINITIALIZED_END } /*----------. | yyparse. | `----------*/ int yyparse (pj_wkt2_parse_context *context) { /* The lookahead symbol. */ int yychar; /* The semantic value of the lookahead symbol. */ /* Default value used for initialization, for pacifying older GCCs or non-GCC compilers. */ YY_INITIAL_VALUE (static YYSTYPE yyval_default;) YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); /* Number of syntax errors so far. */ int yynerrs; yy_state_fast_t yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* The stacks and their tools: 'yyss': related to states. 'yyvs': related to semantic values. Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yy_state_t yyssa[YYINITDEPTH]; yy_state_t *yyss; yy_state_t *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs; YYSTYPE *yyvsp; YYPTRDIFF_T yystacksize; int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ int yytoken = 0; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf; #endif #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; yyssp = yyss = yyssa; yyvsp = yyvs = yyvsa; yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ goto yysetstate; /*------------------------------------------------------------. | yynewstate -- push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; /*--------------------------------------------------------------------. | yysetstate -- set current state (the top of the stack) to yystate. | `--------------------------------------------------------------------*/ yysetstate: YYDPRINTF ((stderr, "Entering state %d\n", yystate)); YY_ASSERT (0 <= yystate && yystate < YYNSTATES); YY_IGNORE_USELESS_CAST_BEGIN *yyssp = YY_CAST (yy_state_t, yystate); YY_IGNORE_USELESS_CAST_END if (yyss + yystacksize - 1 <= yyssp) #if !defined yyoverflow && !defined YYSTACK_RELOCATE goto yyexhaustedlab; #else { /* Get the current used size of the three stacks, in elements. */ YYPTRDIFF_T yysize = (YYPTRDIFF_T)(yyssp - yyss + 1); # if defined yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ yy_state_t *yyss1 = yyss; YYSTYPE *yyvs1 = yyvs; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * YYSIZEOF (*yyssp), &yyvs1, yysize * YYSIZEOF (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } # else /* defined YYSTACK_RELOCATE */ /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yy_state_t *yyss1 = yyss; union yyalloc *yyptr = YY_CAST (union yyalloc *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YY_IGNORE_USELESS_CAST_BEGIN YYDPRINTF ((stderr, "Stack size increased to %ld\n", YY_CAST (long, yystacksize))); YY_IGNORE_USELESS_CAST_END if (yyss + yystacksize - 1 <= yyssp) YYABORT; } #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ if (yystate == YYFINAL) YYACCEPT; goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yypact_value_is_default (yyn)) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = yylex (&yylval, context); } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yytable_value_is_error (yyn)) goto yyerrlab; yyn = -yyn; goto yyreduce; } /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); yystate = yyn; YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END /* Discard the shifted token. */ yychar = YYEMPTY; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: '$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; YY_REDUCE_PRINT (yyn); switch (yyn) { default: break; } /* User semantic actions sometimes alter yychar, and that requires that yytoken be updated with the new translation. We take the approach of translating immediately before every use of yytoken. One alternative is translating here after every semantic action, but that translation would be missed if the semantic action invokes YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an incorrect destructor might then be invoked immediately. In the case of YYERROR or YYBACKUP, subsequent parser actions might lead to an incorrect destructor call or verbose syntax error message before the lookahead is translated. */ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ { const int yylhs = yyr1[yyn] - YYNTOKENS; const int yyi = yypgoto[yylhs] + *yyssp; yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp ? yytable[yyi] : yydefgoto[yylhs]); } goto yynewstate; /*--------------------------------------. | yyerrlab -- here on detecting error. | `--------------------------------------*/ yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (context, YY_("syntax error")); #else # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ yyssp, yytoken) { char const *yymsgp = YY_("syntax error"); int yysyntax_error_status; yysyntax_error_status = YYSYNTAX_ERROR; if (yysyntax_error_status == 0) yymsgp = yymsg; else if (yysyntax_error_status == 1) { if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc))); if (!yymsg) { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; yysyntax_error_status = 2; } else { yysyntax_error_status = YYSYNTAX_ERROR; yymsgp = yymsg; } } yyerror (context, yymsgp); if (yysyntax_error_status == 2) goto yyexhaustedlab; } # undef YYSYNTAX_ERROR #endif } if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval, context); yychar = YYEMPTY; } } /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ #if 0 yyerrorlab: /* Pacify compilers when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (0) YYERROR; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ #endif yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (!yypact_value_is_default (yyn)) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yydestruct ("Error: popping", yystos[yystate], yyvsp, context); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (context, YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif /*-----------------------------------------------------. | yyreturn -- parsing is finished, return the result. | `-----------------------------------------------------*/ yyreturn: if (yychar != YYEMPTY) { /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ yytoken = YYTRANSLATE (yychar); yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval, context); } /* Do not reclaim the symbols of the rule whose action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[+*yyssp], yyvsp, context); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif #if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif return yyresult; } proj-8.2.1/src/bin_gie.cmake000644 000765 000024 00000000605 14140020570 016315 0ustar00keversstaff000000 000000 set(GIE_SRC apps/gie.cpp apps/proj_strtod.cpp apps/proj_strtod.h ) set(GIE_INCLUDE apps/optargpm.h) source_group("Source Files\\Bin" FILES ${GIE_SRC}) add_executable(gie ${GIE_SRC} ${GIE_INCLUDE}) target_link_libraries(gie PRIVATE ${PROJ_LIBRARIES}) target_compile_options(gie PRIVATE ${PROJ_CXX_WARN_FLAGS}) if(BUILD_GIE) install(TARGETS gie DESTINATION ${BINDIR}) endif() proj-8.2.1/src/dmstor.cpp000644 000765 000024 00000006357 14140020570 015745 0ustar00keversstaff000000 000000 /* Convert DMS string to radians */ #include #include #include #include #include "proj.h" #include "proj_internal.h" static double proj_strtod(char *nptr, char **endptr); /* following should be sufficient for all but the ridiculous */ #define MAX_WORK 64 static const char *sym = "NnEeSsWw"; static const double vm[] = { DEG_TO_RAD, .0002908882086657216, .0000048481368110953599 }; /* byte sequence for Degree Sign U+00B0 in UTF-8. */ static constexpr char DEG_SIGN1 = '\xc2'; static constexpr char DEG_SIGN2 = '\xb0'; double dmstor(const char *is, char **rs) { return dmstor_ctx( pj_get_default_ctx(), is, rs ); } double dmstor_ctx(PJ_CONTEXT *ctx, const char *is, char **rs) { int n, nl; char *s, work[MAX_WORK]; const char* p; double v, tv; if (rs) *rs = (char *)is; /* copy string into work space */ while (isspace(*is)) ++is; n = MAX_WORK; s = work; p = (char *)is; /* * Copy characters into work until we hit a non-printable character or run * out of space in the buffer. Make a special exception for the bytes of * the Degree Sign in UTF-8. * * It is possible that a really odd input (like lots of leading zeros) * could be truncated in copying into work. But ... */ while ((isgraph(*p) || *p == DEG_SIGN1 || *p == DEG_SIGN2) && --n) *s++ = *p++; *s = '\0'; int sign = *(s = work); if (sign == '+' || sign == '-') s++; else sign = '+'; v = 0.; for (nl = 0 ; nl < 3 ; nl = n + 1) { if (!(isdigit(*s) || *s == '.')) break; if ((tv = proj_strtod(s, &s)) == HUGE_VAL) return tv; int adv = 1; if (*s == 'D' || *s == 'd' || *s == DEG_SIGN2) { /* * Accept \xb0 as a single-byte degree symbol. This byte is the * degree symbol in various single-byte encodings: multiple ISO * 8859 parts, several Windows code pages and others. */ n = 0; } else if (*s == '\'') { n = 1; } else if (*s == '"') { n = 2; } else if (s[0] == DEG_SIGN1 && s[1] == DEG_SIGN2) { /* degree symbol in UTF-8 */ n = 0; adv = 2; } else if (*s == 'r' || *s == 'R') { if (nl) { proj_context_errno_set( ctx, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE ); return HUGE_VAL; } ++s; v = tv; n = 4; continue; } else { v += tv * vm[nl]; n = 4; continue; } if (n < nl) { proj_context_errno_set( ctx, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE ); return HUGE_VAL; } v += tv * vm[n]; s += adv; } /* postfix sign */ if (*s && (p = strchr(sym, *s))) { sign = (p - sym) >= 4 ? '-' : '+'; ++s; } if (sign == '-') v = -v; if (rs) /* return point of next char after valid string */ *rs = (char *)is + (s - work); return v; } static double proj_strtod(char *nptr, char **endptr) { char c, *cp = nptr; double result; /* * Scan for characters which cause problems with VC++ strtod() */ while ((c = *cp) != '\0') { if (c == 'd' || c == 'D') { /* * Found one, so NUL it out, call strtod(), * then restore it and return */ *cp = '\0'; result = strtod(nptr, endptr); *cp = c; return result; } ++cp; } /* no offending characters, just handle normally */ return pj_strtod(nptr, endptr); } proj-8.2.1/src/bin_projinfo.cmake000644 000765 000024 00000000742 14140020570 017401 0ustar00keversstaff000000 000000 set(PROJINFO_SRC apps/projinfo.cpp) source_group("Source Files\\Bin" FILES ${PROJINFO_SRC}) add_executable(binprojinfo ${PROJINFO_SRC}) set_target_properties(binprojinfo PROPERTIES OUTPUT_NAME projinfo) target_link_libraries(binprojinfo PRIVATE ${PROJ_LIBRARIES}) target_compile_options(binprojinfo PRIVATE ${PROJ_CXX_WARN_FLAGS}) install(TARGETS binprojinfo DESTINATION ${BINDIR}) if(CURL_ENABLED) target_compile_definitions(binprojinfo PRIVATE -DCURL_ENABLED) endif() proj-8.2.1/src/Makefile.am000644 000765 000024 00000022273 14162105274 015771 0ustar00keversstaff000000 000000 AM_CFLAGS = @C_WFLAGS@ EXTRA_PROGRAMS = multistresstest TESTS = geodtest check_PROGRAMS = geodtest AM_CPPFLAGS = -DPROJ_LIB=\"$(pkgdatadir)\" \ -DMUTEX_@MUTEX_SETTING@ -I$(top_srcdir)/include @SQLITE3_CFLAGS@ @TIFF_CFLAGS@ @TIFF_ENABLED_FLAGS@ @CURL_CFLAGS@ @CURL_ENABLED_FLAGS@ @PROJ_LIB_ENV_VAR_TRIED_LAST_FLAGS@ AM_CXXFLAGS = @CXX_WFLAGS@ @FLTO_FLAG@ include_HEADERS = proj.h proj_experimental.h proj_constants.h geodesic.h \ proj_symbol_rename.h EXTRA_DIST = bin_cct.cmake bin_gie.cmake bin_cs2cs.cmake \ bin_geod.cmake bin_proj.cmake bin_projinfo.cmake \ lib_proj.cmake \ check_md5sum.cmake \ generate_wkt_parser.cmake \ CMakeLists.txt \ bin_geodtest.cmake \ bin_projsync.cmake \ tests/geodtest.cpp \ wkt1_grammar.y wkt2_grammar.y apps/emess.h apps/utils.h \ apps/projsync.cpp proj_SOURCES = apps/proj.cpp apps/emess.cpp apps/utils.cpp invproj_SOURCES = $(proj_SOURCES) projinfo_SOURCES = apps/projinfo.cpp cs2cs_SOURCES = apps/cs2cs.cpp apps/emess.cpp apps/utils.cpp cct_SOURCES = apps/cct.cpp apps/proj_strtod.cpp apps/proj_strtod.h apps/optargpm.h geod_SOURCES = apps/geod.cpp apps/geod_set.cpp apps/geod_interface.cpp apps/geod_interface.h apps/emess.cpp invgeod_SOURCES = $(geod_SOURCES) if HAVE_CURL projsync_SOURCES = apps/projsync.cpp projsync_LDADD = libproj.la PROJSYNC_BIN = projsync endif bin_PROGRAMS = proj geod cs2cs gie cct projinfo $(PROJSYNC_BIN) noinst_PROGRAMS = invproj invgeod gie_SOURCES = apps/gie.cpp apps/proj_strtod.cpp apps/proj_strtod.h apps/optargpm.h multistresstest_SOURCES = tests/multistresstest.cpp geodtest_SOURCES = tests/geodtest.cpp cct_LDADD = libproj.la cs2cs_LDADD = libproj.la geod_LDADD = libproj.la invgeod_LDADD = $(geod_LDADD) proj_LDADD = libproj.la invproj_LDADD = $(proj_LDADD) projinfo_LDADD = libproj.la gie_LDADD = libproj.la multistresstest_LDADD = libproj.la @THREAD_LIB@ geodtest_LDADD = libproj.la lib_LTLIBRARIES = libproj.la libproj_la_LDFLAGS = -no-undefined -version-info 24:1:2 libproj_la_LIBADD = @SQLITE3_LIBS@ @TIFF_LIBS@ @CURL_LIBS@ libproj_la_SOURCES = \ pj_list.h proj_internal.h \ \ iso19111/static.cpp \ iso19111/util.cpp \ iso19111/metadata.cpp \ iso19111/common.cpp \ iso19111/crs.cpp \ iso19111/datum.cpp \ iso19111/coordinatesystem.cpp \ iso19111/operation/concatenatedoperation.cpp \ iso19111/operation/coordinateoperation_internal.hpp \ iso19111/operation/coordinateoperation_private.hpp \ iso19111/operation/coordinateoperationfactory.cpp \ iso19111/operation/conversion.cpp \ iso19111/operation/esriparammappings.hpp \ iso19111/operation/esriparammappings.cpp \ iso19111/operation/operationmethod_private.hpp \ iso19111/operation/oputils.hpp \ iso19111/operation/oputils.cpp \ iso19111/operation/parammappings.hpp \ iso19111/operation/parammappings.cpp \ iso19111/operation/projbasedoperation.cpp \ iso19111/operation/singleoperation.cpp \ iso19111/operation/transformation.cpp \ iso19111/operation/vectorofvaluesparams.hpp \ iso19111/operation/vectorofvaluesparams.cpp \ iso19111/io.cpp \ iso19111/internal.cpp \ iso19111/factory.cpp \ iso19111/c_api.cpp \ \ projections/aeqd.cpp \ projections/adams.cpp \ projections/gnom.cpp \ projections/laea.cpp \ projections/mod_ster.cpp \ projections/nsper.cpp \ projections/nzmg.cpp \ projections/ortho.cpp \ projections/stere.cpp \ projections/sterea.cpp \ projections/aea.cpp \ projections/bipc.cpp \ projections/bonne.cpp \ projections/eqdc.cpp \ projections/isea.cpp \ projections/ccon.cpp \ projections/imw_p.cpp \ projections/krovak.cpp \ projections/lcc.cpp \ projections/poly.cpp \ projections/rpoly.cpp \ projections/sconics.cpp \ projections/rouss.cpp \ projections/cass.cpp \ projections/cc.cpp \ projections/cea.cpp \ projections/eqc.cpp \ projections/gall.cpp \ projections/labrd.cpp \ projections/lsat.cpp \ projections/misrsom.cpp \ projections/merc.cpp \ projections/mill.cpp \ projections/ocea.cpp \ projections/omerc.cpp \ projections/somerc.cpp \ projections/tcc.cpp \ projections/tcea.cpp \ projections/times.cpp \ projections/tmerc.cpp \ projections/tobmerc.cpp \ projections/airy.cpp \ projections/aitoff.cpp \ projections/august.cpp \ projections/bacon.cpp \ projections/bertin1953.cpp \ projections/chamb.cpp \ projections/hammer.cpp \ projections/lagrng.cpp \ projections/larr.cpp \ projections/lask.cpp \ projections/latlong.cpp \ projections/nicol.cpp \ projections/ob_tran.cpp \ projections/oea.cpp \ projections/tpeqd.cpp \ projections/vandg.cpp \ projections/vandg2.cpp \ projections/vandg4.cpp \ projections/wag7.cpp \ projections/lcca.cpp \ projections/geos.cpp \ projections/boggs.cpp \ projections/collg.cpp \ projections/comill.cpp \ projections/crast.cpp \ projections/denoy.cpp \ projections/eck1.cpp \ projections/eck2.cpp \ projections/eck3.cpp \ projections/eck4.cpp \ projections/eck5.cpp \ projections/fahey.cpp \ projections/fouc_s.cpp \ projections/gins8.cpp \ projections/gstmerc.cpp \ projections/gn_sinu.cpp \ projections/goode.cpp \ projections/igh.cpp \ projections/igh_o.cpp \ projections/hatano.cpp \ projections/loxim.cpp \ projections/mbt_fps.cpp \ projections/mbtfpp.cpp \ projections/mbtfpq.cpp \ projections/moll.cpp \ projections/nell.cpp \ projections/nell_h.cpp \ projections/patterson.cpp \ projections/putp2.cpp \ projections/putp3.cpp \ projections/putp4p.cpp \ projections/putp5.cpp \ projections/putp6.cpp \ projections/qsc.cpp \ projections/robin.cpp \ projections/s2.cpp \ projections/sch.cpp \ projections/sts.cpp \ projections/urm5.cpp \ projections/urmfps.cpp \ projections/wag2.cpp \ projections/wag3.cpp \ projections/wink1.cpp \ projections/wink2.cpp \ projections/healpix.cpp \ projections/natearth.cpp \ projections/natearth2.cpp \ projections/calcofi.cpp \ projections/eqearth.cpp \ projections/col_urban.cpp \ \ conversions/axisswap.cpp \ conversions/cart.cpp \ conversions/geoc.cpp \ conversions/geocent.cpp \ conversions/noop.cpp \ conversions/topocentric.cpp \ conversions/set.cpp \ conversions/unitconvert.cpp \ \ transformations/affine.cpp \ transformations/deformation.cpp \ transformations/helmert.cpp \ transformations/hgridshift.cpp \ transformations/horner.cpp \ transformations/molodensky.cpp \ transformations/vgridshift.cpp \ transformations/xyzgridshift.cpp \ transformations/defmodel.cpp \ transformations/defmodel.hpp \ transformations/defmodel_exceptions.hpp \ transformations/defmodel_impl.hpp \ transformations/tinshift.cpp \ transformations/tinshift.hpp \ transformations/tinshift_exceptions.hpp \ transformations/tinshift_impl.hpp \ \ aasincos.cpp adjlon.cpp \ dmstor.cpp auth.cpp \ deriv.cpp ell_set.cpp ellps.cpp \ factors.cpp fwd.cpp init.cpp inv.cpp \ list.cpp malloc.cpp mlfn.cpp mlfn.hpp msfn.cpp proj_mdist.cpp \ param.cpp phi2.cpp pr_list.cpp \ qsfn.cpp strerrno.cpp \ tsfn.cpp units.cpp ctx.cpp log.cpp zpoly1.cpp rtodms.cpp \ release.cpp gauss.cpp \ generic_inverse.cpp \ quadtree.hpp \ \ datums.cpp datum_set.cpp \ mutex.cpp initcache.cpp geodesic.c \ strtod.cpp \ \ 4D_api.cpp pipeline.cpp \ internal.cpp \ wkt_parser.hpp wkt_parser.cpp \ wkt1_parser.h wkt1_parser.cpp \ wkt1_generated_parser.h wkt1_generated_parser.c \ wkt2_parser.h wkt2_parser.cpp \ wkt2_generated_parser.h wkt2_generated_parser.c \ \ proj_json_streaming_writer.hpp \ proj_json_streaming_writer.cpp \ \ tracing.cpp \ \ grids.hpp \ grids.cpp \ filemanager.hpp \ filemanager.cpp \ networkfilemanager.cpp \ sqlite3_utils.hpp \ sqlite3_utils.cpp # The sed hack is to please MSVC wkt1_parser: bison --no-lines -d -p pj_wkt1_ -o$(top_srcdir)/src/wkt1_generated_parser.c $(top_srcdir)/src/wkt1_grammar.y sed "s/\*yyssp = yystate/\*yyssp = (yytype_int16)yystate/" < $(top_srcdir)/src/wkt1_generated_parser.c | sed "s/yyerrorlab:/#if 0\nyyerrorlab:/" | sed "s/yyerrlab1:/#endif\nyyerrlab1:/" | sed "s/for (yylen = 0; yystr\[yylen\]; yylen++)/for (yylen = 0; yystr \&\& yystr\[yylen\]; yylen++)/" | sed "s/return yystpcpy (yyres, yystr) - yyres;/return (YYPTRDIFF_T)(yystpcpy (yyres, yystr) - yyres);/" | sed "s/YYPTRDIFF_T yysize = yyssp - yyss + 1;/YYPTRDIFF_T yysize = (YYPTRDIFF_T)(yyssp - yyss + 1);/" > $(top_srcdir)/src/wkt1_generated_parser.c.tmp mv $(top_srcdir)/src/wkt1_generated_parser.c.tmp $(top_srcdir)/src/wkt1_generated_parser.c wkt2_parser: bison --no-lines -d -p pj_wkt2_ -o$(top_srcdir)/src/wkt2_generated_parser.c $(top_srcdir)/src/wkt2_grammar.y sed "s/\*yyssp = yystate/\*yyssp = (yytype_int16)yystate/" < $(top_srcdir)/src/wkt2_generated_parser.c | sed "s/yyerrorlab:/#if 0\nyyerrorlab:/" | sed "s/yyerrlab1:/#endif\nyyerrlab1:/" | sed "s/for (yylen = 0; yystr\[yylen\]; yylen++)/for (yylen = 0; yystr \&\& yystr\[yylen\]; yylen++)/"| sed "s/return yystpcpy (yyres, yystr) - yyres;/return (YYPTRDIFF_T)(yystpcpy (yyres, yystr) - yyres);/" | sed "s/YYPTRDIFF_T yysize = yyssp - yyss + 1;/YYPTRDIFF_T yysize = (YYPTRDIFF_T)(yyssp - yyss + 1);/"> $(top_srcdir)/src/wkt2_generated_parser.c.tmp mv $(top_srcdir)/src/wkt2_generated_parser.c.tmp $(top_srcdir)/src/wkt2_generated_parser.c install-exec-local: install-binPROGRAMS rm -f $(DESTDIR)$(bindir)/invproj$(EXEEXT) (cd $(DESTDIR)$(bindir); ln -s proj$(EXEEXT) invproj$(EXEEXT)) rm -f $(DESTDIR)$(bindir)/invgeod$(EXEEXT) (cd $(DESTDIR)$(bindir); ln -s geod$(EXEEXT) invgeod$(EXEEXT)) proj-8.2.1/src/wkt1_parser.cpp000644 000765 000024 00000016016 13747523460 016712 0ustar00keversstaff000000 000000 /****************************************************************************** * Project: PROJ * Purpose: WKT1 parser grammar * Author: Even Rouault, * ****************************************************************************** * Copyright (c) 2013, Even Rouault * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. ****************************************************************************/ #ifndef FROM_PROJ_CPP #define FROM_PROJ_CPP #endif #include "proj/internal/internal.hpp" #include #include #include #include "wkt1_parser.h" #include "wkt_parser.hpp" using namespace NS_PROJ::internal; //! @cond Doxygen_Suppress // --------------------------------------------------------------------------- struct pj_wkt1_parse_context : public pj_wkt_parse_context {}; // --------------------------------------------------------------------------- void pj_wkt1_error(pj_wkt1_parse_context *context, const char *msg) { pj_wkt_error(context, msg); } // --------------------------------------------------------------------------- std::string pj_wkt1_parse(const std::string &wkt) { pj_wkt1_parse_context context; context.pszInput = wkt.c_str(); context.pszLastSuccess = wkt.c_str(); context.pszNext = wkt.c_str(); if (pj_wkt1_parse(&context) != 0) { return context.errorMsg; } return std::string(); } // --------------------------------------------------------------------------- typedef struct { const char *pszToken; int nTokenVal; } osr_cs_wkt_tokens; #define PAIR(X) \ { #X, T_##X } static const osr_cs_wkt_tokens tokens[] = { PAIR(PARAM_MT), PAIR(PARAMETER), PAIR(CONCAT_MT), PAIR(INVERSE_MT), PAIR(PASSTHROUGH_MT), PAIR(PROJCS), PAIR(PROJECTION), PAIR(GEOGCS), PAIR(DATUM), PAIR(SPHEROID), PAIR(PRIMEM), PAIR(UNIT), PAIR(GEOCCS), PAIR(AUTHORITY), PAIR(VERT_CS), PAIR(VERTCS), PAIR(VERT_DATUM), PAIR(VDATUM), PAIR(COMPD_CS), PAIR(AXIS), PAIR(TOWGS84), PAIR(FITTED_CS), PAIR(LOCAL_CS), PAIR(LOCAL_DATUM), PAIR(EXTENSION)}; // --------------------------------------------------------------------------- int pj_wkt1_lex(YYSTYPE * /*pNode */, pj_wkt1_parse_context *context) { size_t i; const char *pszInput = context->pszNext; /* -------------------------------------------------------------------- */ /* Skip white space. */ /* -------------------------------------------------------------------- */ while (*pszInput == ' ' || *pszInput == '\t' || *pszInput == 10 || *pszInput == 13) pszInput++; context->pszLastSuccess = pszInput; if (*pszInput == '\0') { context->pszNext = pszInput; return EOF; } /* -------------------------------------------------------------------- */ /* Recognize node names. */ /* -------------------------------------------------------------------- */ if (isalpha(*pszInput)) { for (i = 0; i < sizeof(tokens) / sizeof(tokens[0]); i++) { if (ci_starts_with(pszInput, tokens[i].pszToken) && !isalpha(pszInput[strlen(tokens[i].pszToken)])) { context->pszNext = pszInput + strlen(tokens[i].pszToken); return tokens[i].nTokenVal; } } } /* -------------------------------------------------------------------- */ /* Recognize double quoted strings. */ /* -------------------------------------------------------------------- */ if (*pszInput == '"') { pszInput++; while (*pszInput != '\0' && *pszInput != '"') pszInput++; if (*pszInput == '\0') { context->pszNext = pszInput; return EOF; } context->pszNext = pszInput + 1; return T_STRING; } /* -------------------------------------------------------------------- */ /* Recognize numerical values. */ /* -------------------------------------------------------------------- */ if (((*pszInput == '-' || *pszInput == '+') && pszInput[1] >= '0' && pszInput[1] <= '9') || (*pszInput >= '0' && *pszInput <= '9')) { if (*pszInput == '-' || *pszInput == '+') pszInput++; // collect non-decimal part of number while (*pszInput >= '0' && *pszInput <= '9') pszInput++; // collect decimal places. if (*pszInput == '.') { pszInput++; while (*pszInput >= '0' && *pszInput <= '9') pszInput++; } // collect exponent if (*pszInput == 'e' || *pszInput == 'E') { pszInput++; if (*pszInput == '-' || *pszInput == '+') pszInput++; while (*pszInput >= '0' && *pszInput <= '9') pszInput++; } context->pszNext = pszInput; return T_NUMBER; } /* -------------------------------------------------------------------- */ /* Recognize identifiers. */ /* -------------------------------------------------------------------- */ if ((*pszInput >= 'A' && *pszInput <= 'Z') || (*pszInput >= 'a' && *pszInput <= 'z')) { pszInput++; while ((*pszInput >= 'A' && *pszInput <= 'Z') || (*pszInput >= 'a' && *pszInput <= 'z')) pszInput++; context->pszNext = pszInput; return T_IDENTIFIER; } /* -------------------------------------------------------------------- */ /* Handle special tokens. */ /* -------------------------------------------------------------------- */ context->pszNext = pszInput + 1; return *pszInput; } //! @endcond proj-8.2.1/src/proj_experimental.h000644 000765 000024 00000112121 14140020570 017614 0ustar00keversstaff000000 000000 /****************************************************************************** * * Project: PROJ * Purpose: Experimental C API * Author: Even Rouault * ****************************************************************************** * Copyright (c) 2018, Even Rouault * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. ****************************************************************************/ #ifndef PROJ_EXPERIMENTAL_H #define PROJ_EXPERIMENTAL_H #ifdef __cplusplus extern "C" { #endif #include "proj.h" /** * \file proj_experimental.h * * Experimental C API. * * \warning * This API has been considered now to be experimental, and may change or * be removed in the future. It addresses for now the needs of the GDAL * project to be able to construct CRS objects in a programmatic way, piece * by piece, instead of whole conversion from PROJ string or WKT string. */ /* ------------------------------------------------------------------------- */ /* Binding in C of advanced methods from the C++ API */ /* */ /* Manual construction of CRS objects. */ /* ------------------------------------------------------------------------- */ /** * \defgroup advanced_cpp_binding Binding in C of advanced methods from the C++ API * @{ */ /** Type of unit of measure. */ typedef enum { /** Angular unit of measure */ PJ_UT_ANGULAR, /** Linear unit of measure */ PJ_UT_LINEAR, /** Scale unit of measure */ PJ_UT_SCALE, /** Time unit of measure */ PJ_UT_TIME, /** Parametric unit of measure */ PJ_UT_PARAMETRIC } PJ_UNIT_TYPE; /** Axis description. */ typedef struct { /** Axis name. */ char* name; /** Axis abbreviation. */ char* abbreviation; /** Axis direction. */ char* direction; /** Axis unit name. */ char* unit_name; /** Conversion factor to SI of the unit. */ double unit_conv_factor; /** Type of unit */ PJ_UNIT_TYPE unit_type; } PJ_AXIS_DESCRIPTION; PJ PROJ_DLL *proj_create_cs(PJ_CONTEXT *ctx, PJ_COORDINATE_SYSTEM_TYPE type, int axis_count, const PJ_AXIS_DESCRIPTION* axis); /** Type of Cartesian 2D coordinate system. */ typedef enum { /* Easting-Norting */ PJ_CART2D_EASTING_NORTHING, /* Northing-Easting */ PJ_CART2D_NORTHING_EASTING, /* North Pole Easting/SOUTH-Norting/SOUTH */ PJ_CART2D_NORTH_POLE_EASTING_SOUTH_NORTHING_SOUTH, /* South Pole Easting/NORTH-Norting/NORTH */ PJ_CART2D_SOUTH_POLE_EASTING_NORTH_NORTHING_NORTH, /* Westing-southing */ PJ_CART2D_WESTING_SOUTHING, } PJ_CARTESIAN_CS_2D_TYPE; PJ PROJ_DLL *proj_create_cartesian_2D_cs(PJ_CONTEXT *ctx, PJ_CARTESIAN_CS_2D_TYPE type, const char* unit_name, double unit_conv_factor); /** Type of Ellipsoidal 2D coordinate system. */ typedef enum { /* Longitude-Latitude */ PJ_ELLPS2D_LONGITUDE_LATITUDE, /* Latitude-Longitude */ PJ_ELLPS2D_LATITUDE_LONGITUDE, } PJ_ELLIPSOIDAL_CS_2D_TYPE; PJ PROJ_DLL *proj_create_ellipsoidal_2D_cs(PJ_CONTEXT *ctx, PJ_ELLIPSOIDAL_CS_2D_TYPE type, const char* unit_name, double unit_conv_factor); /** Type of Ellipsoidal 3D coordinate system. */ typedef enum { /* Longitude-Latitude-Height(up) */ PJ_ELLPS3D_LONGITUDE_LATITUDE_HEIGHT, /* Latitude-Longitude-Height(up) */ PJ_ELLPS3D_LATITUDE_LONGITUDE_HEIGHT, } PJ_ELLIPSOIDAL_CS_3D_TYPE; PJ PROJ_DLL *proj_create_ellipsoidal_3D_cs(PJ_CONTEXT *ctx, PJ_ELLIPSOIDAL_CS_3D_TYPE type, const char* horizontal_angular_unit_name, double horizontal_angular_unit_conv_factor, const char* vertical_linear_unit_name, double vertical_linear_unit_conv_factor); PJ_OBJ_LIST PROJ_DLL *proj_query_geodetic_crs_from_datum( PJ_CONTEXT *ctx, const char *crs_auth_name, const char *datum_auth_name, const char *datum_code, const char *crs_type); PJ PROJ_DLL *proj_create_geographic_crs( PJ_CONTEXT *ctx, const char *crs_name, const char *datum_name, const char *ellps_name, double semi_major_metre, double inv_flattening, const char *prime_meridian_name, double prime_meridian_offset, const char *pm_angular_units, double pm_units_conv, PJ* ellipsoidal_cs); PJ PROJ_DLL *proj_create_geographic_crs_from_datum( PJ_CONTEXT *ctx, const char *crs_name, PJ* datum_or_datum_ensemble, PJ* ellipsoidal_cs); PJ PROJ_DLL *proj_create_geocentric_crs( PJ_CONTEXT *ctx, const char *crs_name, const char *datum_name, const char *ellps_name, double semi_major_metre, double inv_flattening, const char *prime_meridian_name, double prime_meridian_offset, const char *angular_units, double angular_units_conv, const char *linear_units, double linear_units_conv); PJ PROJ_DLL *proj_create_geocentric_crs_from_datum( PJ_CONTEXT *ctx, const char *crs_name, const PJ* datum_or_datum_ensemble, const char *linear_units, double linear_units_conv); PJ PROJ_DLL *proj_create_derived_geographic_crs( PJ_CONTEXT *ctx, const char *crs_name, const PJ* base_geographic_crs, const PJ* conversion, const PJ* ellipsoidal_cs); int PROJ_DLL proj_is_derived_crs(PJ_CONTEXT *ctx, const PJ* crs); PJ PROJ_DLL *proj_alter_name(PJ_CONTEXT *ctx, const PJ* obj, const char* name); PJ PROJ_DLL *proj_alter_id(PJ_CONTEXT *ctx, const PJ* obj, const char* auth_name, const char* code); PJ PROJ_DLL *proj_crs_alter_geodetic_crs(PJ_CONTEXT *ctx, const PJ* obj, const PJ* new_geod_crs); PJ PROJ_DLL *proj_crs_alter_cs_angular_unit(PJ_CONTEXT *ctx, const PJ* obj, const char *angular_units, double angular_units_conv, const char *unit_auth_name, const char *unit_code); PJ PROJ_DLL *proj_crs_alter_cs_linear_unit(PJ_CONTEXT *ctx, const PJ* obj, const char *linear_units, double linear_units_conv, const char *unit_auth_name, const char *unit_code); PJ PROJ_DLL *proj_crs_alter_parameters_linear_unit( PJ_CONTEXT *ctx, const PJ* obj, const char *linear_units, double linear_units_conv, const char *unit_auth_name, const char *unit_code, int convert_to_new_unit); PJ PROJ_DLL *proj_crs_promote_to_3D(PJ_CONTEXT *ctx, const char* crs_3D_name, const PJ* crs_2D); PJ PROJ_DLL *proj_crs_create_projected_3D_crs_from_2D(PJ_CONTEXT *ctx, const char* crs_name, const PJ* projected_2D_crs, const PJ* geog_3D_crs); PJ PROJ_DLL *proj_crs_demote_to_2D(PJ_CONTEXT *ctx, const char* crs_2D_name, const PJ* crs_3D); PJ PROJ_DLL *proj_create_engineering_crs(PJ_CONTEXT *ctx, const char *crsName); PJ PROJ_DLL *proj_create_vertical_crs(PJ_CONTEXT *ctx, const char *crs_name, const char *datum_name, const char *linear_units, double linear_units_conv); PJ PROJ_DLL *proj_create_vertical_crs_ex(PJ_CONTEXT *ctx, const char *crs_name, const char *datum_name, const char *datum_auth_name, const char* datum_code, const char *linear_units, double linear_units_conv, const char* geoid_model_name, const char* geoid_model_auth_name, const char* geoid_model_code, const PJ* geoid_geog_crs, const char *const *options); PJ PROJ_DLL *proj_create_compound_crs(PJ_CONTEXT *ctx, const char *crs_name, PJ* horiz_crs, PJ* vert_crs); /** Description of a parameter value for a Conversion. */ typedef struct { /** Parameter name. */ const char* name; /** Parameter authority name. */ const char* auth_name; /** Parameter code. */ const char* code; /** Parameter value. */ double value; /** Name of unit in which parameter value is expressed. */ const char* unit_name; /** Conversion factor to SI of the unit. */ double unit_conv_factor; /** Type of unit */ PJ_UNIT_TYPE unit_type; } PJ_PARAM_DESCRIPTION; PJ PROJ_DLL *proj_create_conversion(PJ_CONTEXT *ctx, const char* name, const char* auth_name, const char* code, const char* method_name, const char* method_auth_name, const char* method_code, int param_count, const PJ_PARAM_DESCRIPTION* params); PJ PROJ_DLL *proj_create_transformation( PJ_CONTEXT *ctx, const char* name, const char* auth_name, const char* code, PJ* source_crs, PJ* target_crs, PJ* interpolation_crs, const char* method_name, const char* method_auth_name, const char* method_code, int param_count, const PJ_PARAM_DESCRIPTION* params, double accuracy); PJ PROJ_DLL *proj_convert_conversion_to_other_method(PJ_CONTEXT *ctx, const PJ *conversion, int new_method_epsg_code, const char *new_method_name); PJ PROJ_DLL *proj_create_projected_crs(PJ_CONTEXT *ctx, const char* crs_name, const PJ* geodetic_crs, const PJ* conversion, const PJ* coordinate_system); PJ PROJ_DLL *proj_crs_create_bound_crs(PJ_CONTEXT *ctx, const PJ *base_crs, const PJ *hub_crs, const PJ *transformation); PJ PROJ_DLL *proj_crs_create_bound_crs_to_WGS84(PJ_CONTEXT *ctx, const PJ *crs, const char *const *options); PJ PROJ_DLL *proj_crs_create_bound_vertical_crs(PJ_CONTEXT *ctx, const PJ* vert_crs, const PJ* hub_geographic_3D_crs, const char* grid_name); /* BEGIN: Generated by scripts/create_c_api_projections.py*/ PJ PROJ_DLL *proj_create_conversion_utm( PJ_CONTEXT *ctx, int zone, int north); PJ PROJ_DLL *proj_create_conversion_transverse_mercator( PJ_CONTEXT *ctx, double center_lat, double center_long, double scale, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_gauss_schreiber_transverse_mercator( PJ_CONTEXT *ctx, double center_lat, double center_long, double scale, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_transverse_mercator_south_oriented( PJ_CONTEXT *ctx, double center_lat, double center_long, double scale, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_two_point_equidistant( PJ_CONTEXT *ctx, double latitude_first_point, double longitude_first_point, double latitude_second_point, double longitude_secon_point, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_tunisia_mapping_grid( PJ_CONTEXT *ctx, double center_lat, double center_long, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_albers_equal_area( PJ_CONTEXT *ctx, double latitude_false_origin, double longitude_false_origin, double latitude_first_parallel, double latitude_second_parallel, double easting_false_origin, double northing_false_origin, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_lambert_conic_conformal_1sp( PJ_CONTEXT *ctx, double center_lat, double center_long, double scale, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_lambert_conic_conformal_2sp( PJ_CONTEXT *ctx, double latitude_false_origin, double longitude_false_origin, double latitude_first_parallel, double latitude_second_parallel, double easting_false_origin, double northing_false_origin, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_lambert_conic_conformal_2sp_michigan( PJ_CONTEXT *ctx, double latitude_false_origin, double longitude_false_origin, double latitude_first_parallel, double latitude_second_parallel, double easting_false_origin, double northing_false_origin, double ellipsoid_scaling_factor, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_lambert_conic_conformal_2sp_belgium( PJ_CONTEXT *ctx, double latitude_false_origin, double longitude_false_origin, double latitude_first_parallel, double latitude_second_parallel, double easting_false_origin, double northing_false_origin, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_azimuthal_equidistant( PJ_CONTEXT *ctx, double latitude_nat_origin, double longitude_nat_origin, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_guam_projection( PJ_CONTEXT *ctx, double latitude_nat_origin, double longitude_nat_origin, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_bonne( PJ_CONTEXT *ctx, double latitude_nat_origin, double longitude_nat_origin, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_lambert_cylindrical_equal_area_spherical( PJ_CONTEXT *ctx, double latitude_first_parallel, double longitude_nat_origin, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_lambert_cylindrical_equal_area( PJ_CONTEXT *ctx, double latitude_first_parallel, double longitude_nat_origin, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_cassini_soldner( PJ_CONTEXT *ctx, double center_lat, double center_long, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_equidistant_conic( PJ_CONTEXT *ctx, double center_lat, double center_long, double latitude_first_parallel, double latitude_second_parallel, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_eckert_i( PJ_CONTEXT *ctx, double center_long, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_eckert_ii( PJ_CONTEXT *ctx, double center_long, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_eckert_iii( PJ_CONTEXT *ctx, double center_long, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_eckert_iv( PJ_CONTEXT *ctx, double center_long, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_eckert_v( PJ_CONTEXT *ctx, double center_long, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_eckert_vi( PJ_CONTEXT *ctx, double center_long, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_equidistant_cylindrical( PJ_CONTEXT *ctx, double latitude_first_parallel, double longitude_nat_origin, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_equidistant_cylindrical_spherical( PJ_CONTEXT *ctx, double latitude_first_parallel, double longitude_nat_origin, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_gall( PJ_CONTEXT *ctx, double center_long, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_goode_homolosine( PJ_CONTEXT *ctx, double center_long, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_interrupted_goode_homolosine( PJ_CONTEXT *ctx, double center_long, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_geostationary_satellite_sweep_x( PJ_CONTEXT *ctx, double center_long, double height, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_geostationary_satellite_sweep_y( PJ_CONTEXT *ctx, double center_long, double height, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_gnomonic( PJ_CONTEXT *ctx, double center_lat, double center_long, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_hotine_oblique_mercator_variant_a( PJ_CONTEXT *ctx, double latitude_projection_centre, double longitude_projection_centre, double azimuth_initial_line, double angle_from_rectified_to_skrew_grid, double scale, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_hotine_oblique_mercator_variant_b( PJ_CONTEXT *ctx, double latitude_projection_centre, double longitude_projection_centre, double azimuth_initial_line, double angle_from_rectified_to_skrew_grid, double scale, double easting_projection_centre, double northing_projection_centre, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_hotine_oblique_mercator_two_point_natural_origin( PJ_CONTEXT *ctx, double latitude_projection_centre, double latitude_point1, double longitude_point1, double latitude_point2, double longitude_point2, double scale, double easting_projection_centre, double northing_projection_centre, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_laborde_oblique_mercator( PJ_CONTEXT *ctx, double latitude_projection_centre, double longitude_projection_centre, double azimuth_initial_line, double scale, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_international_map_world_polyconic( PJ_CONTEXT *ctx, double center_long, double latitude_first_parallel, double latitude_second_parallel, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_krovak_north_oriented( PJ_CONTEXT *ctx, double latitude_projection_centre, double longitude_of_origin, double colatitude_cone_axis, double latitude_pseudo_standard_parallel, double scale_factor_pseudo_standard_parallel, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_krovak( PJ_CONTEXT *ctx, double latitude_projection_centre, double longitude_of_origin, double colatitude_cone_axis, double latitude_pseudo_standard_parallel, double scale_factor_pseudo_standard_parallel, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_lambert_azimuthal_equal_area( PJ_CONTEXT *ctx, double latitude_nat_origin, double longitude_nat_origin, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_miller_cylindrical( PJ_CONTEXT *ctx, double center_long, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_mercator_variant_a( PJ_CONTEXT *ctx, double center_lat, double center_long, double scale, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_mercator_variant_b( PJ_CONTEXT *ctx, double latitude_first_parallel, double center_long, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_popular_visualisation_pseudo_mercator( PJ_CONTEXT *ctx, double center_lat, double center_long, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_mollweide( PJ_CONTEXT *ctx, double center_long, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_new_zealand_mapping_grid( PJ_CONTEXT *ctx, double center_lat, double center_long, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_oblique_stereographic( PJ_CONTEXT *ctx, double center_lat, double center_long, double scale, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_orthographic( PJ_CONTEXT *ctx, double center_lat, double center_long, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_american_polyconic( PJ_CONTEXT *ctx, double center_lat, double center_long, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_polar_stereographic_variant_a( PJ_CONTEXT *ctx, double center_lat, double center_long, double scale, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_polar_stereographic_variant_b( PJ_CONTEXT *ctx, double latitude_standard_parallel, double longitude_of_origin, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_robinson( PJ_CONTEXT *ctx, double center_long, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_sinusoidal( PJ_CONTEXT *ctx, double center_long, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_stereographic( PJ_CONTEXT *ctx, double center_lat, double center_long, double scale, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_van_der_grinten( PJ_CONTEXT *ctx, double center_long, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_wagner_i( PJ_CONTEXT *ctx, double center_long, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_wagner_ii( PJ_CONTEXT *ctx, double center_long, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_wagner_iii( PJ_CONTEXT *ctx, double latitude_true_scale, double center_long, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_wagner_iv( PJ_CONTEXT *ctx, double center_long, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_wagner_v( PJ_CONTEXT *ctx, double center_long, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_wagner_vi( PJ_CONTEXT *ctx, double center_long, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_wagner_vii( PJ_CONTEXT *ctx, double center_long, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_quadrilateralized_spherical_cube( PJ_CONTEXT *ctx, double center_lat, double center_long, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_spherical_cross_track_height( PJ_CONTEXT *ctx, double peg_point_lat, double peg_point_long, double peg_point_heading, double peg_point_height, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_equal_earth( PJ_CONTEXT *ctx, double center_long, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_vertical_perspective( PJ_CONTEXT *ctx, double topo_origin_lat, double topo_origin_long, double topo_origin_height, double view_point_height, double false_easting, double false_northing, const char* ang_unit_name, double ang_unit_conv_factor, const char* linear_unit_name, double linear_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_pole_rotation_grib_convention( PJ_CONTEXT *ctx, double south_pole_lat_in_unrotated_crs, double south_pole_long_in_unrotated_crs, double axis_rotation, const char* ang_unit_name, double ang_unit_conv_factor); PJ PROJ_DLL *proj_create_conversion_pole_rotation_netcdf_cf_convention( PJ_CONTEXT *ctx, double grid_north_pole_latitude, double grid_north_pole_longitude, double north_pole_grid_longitude, const char *ang_unit_name, double ang_unit_conv_factor); /* END: Generated by scripts/create_c_api_projections.py*/ /**@}*/ #ifdef __cplusplus } #endif #endif /* ndef PROJ_EXPERIMENTAL_H */ proj-8.2.1/src/networkfilemanager.cpp000644 000765 000024 00000261414 14140020570 020316 0ustar00keversstaff000000 000000 /****************************************************************************** * Project: PROJ * Purpose: Functionality related to network access and caching * Author: Even Rouault, * ****************************************************************************** * Copyright (c) 2019-2020, Even Rouault, * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. *****************************************************************************/ #ifndef FROM_PROJ_CPP #define FROM_PROJ_CPP #endif #define LRU11_DO_NOT_DEFINE_OUT_OF_CLASS_METHODS #include #include #include #include #include "filemanager.hpp" #include "proj.h" #include "proj/internal/internal.hpp" #include "proj/internal/lru_cache.hpp" #include "proj/internal/mutex.hpp" #include "proj_internal.h" #include "sqlite3_utils.hpp" #ifdef CURL_ENABLED #include #include // for sqlite3_snprintf #endif #include #ifdef _WIN32 #include #else #include #include #endif #if defined(_WIN32) #include #elif defined(__MACH__) && defined(__APPLE__) #include #elif defined(__FreeBSD__) #include #include #endif #include //! @cond Doxygen_Suppress #define STR_HELPER(x) #x #define STR(x) STR_HELPER(x) using namespace NS_PROJ::internal; NS_PROJ_START // --------------------------------------------------------------------------- static void sleep_ms(int ms) { #ifdef _WIN32 Sleep(ms); #else usleep(ms * 1000); #endif } // --------------------------------------------------------------------------- constexpr size_t DOWNLOAD_CHUNK_SIZE = 16 * 1024; constexpr int MAX_CHUNKS = 64; struct FileProperties { unsigned long long size = 0; time_t lastChecked = 0; std::string lastModified{}; std::string etag{}; }; class NetworkChunkCache { public: void insert(PJ_CONTEXT *ctx, const std::string &url, unsigned long long chunkIdx, std::vector &&data); std::shared_ptr> get(PJ_CONTEXT *ctx, const std::string &url, unsigned long long chunkIdx); std::shared_ptr> get(PJ_CONTEXT *ctx, const std::string &url, unsigned long long chunkIdx, FileProperties &props); void clearMemoryCache(); static void clearDiskChunkCache(PJ_CONTEXT *ctx); private: struct Key { std::string url; unsigned long long chunkIdx; Key(const std::string &urlIn, unsigned long long chunkIdxIn) : url(urlIn), chunkIdx(chunkIdxIn) {} bool operator==(const Key &other) const { return url == other.url && chunkIdx == other.chunkIdx; } }; struct KeyHasher { std::size_t operator()(const Key &k) const { return std::hash{}(k.url) ^ (std::hash{}(k.chunkIdx) << 1); } }; lru11::Cache< Key, std::shared_ptr>, NS_PROJ::mutex, std::unordered_map< Key, typename std::list>>>::iterator, KeyHasher>> cache_{MAX_CHUNKS}; }; // --------------------------------------------------------------------------- static NetworkChunkCache gNetworkChunkCache{}; // --------------------------------------------------------------------------- class NetworkFilePropertiesCache { public: void insert(PJ_CONTEXT *ctx, const std::string &url, FileProperties &props); bool tryGet(PJ_CONTEXT *ctx, const std::string &url, FileProperties &props); void clearMemoryCache(); private: lru11::Cache cache_{}; }; // --------------------------------------------------------------------------- static NetworkFilePropertiesCache gNetworkFileProperties{}; // --------------------------------------------------------------------------- class DiskChunkCache { PJ_CONTEXT *ctx_ = nullptr; std::string path_{}; sqlite3 *hDB_ = nullptr; std::string thisNamePtr_{}; std::unique_ptr vfs_{}; explicit DiskChunkCache(PJ_CONTEXT *ctx, const std::string &path); bool initialize(); void commitAndClose(); bool createDBStructure(); bool checkConsistency(); bool get_links(sqlite3_int64 chunk_id, sqlite3_int64 &link_id, sqlite3_int64 &prev, sqlite3_int64 &next, sqlite3_int64 &head, sqlite3_int64 &tail); bool update_links_of_prev_and_next_links(sqlite3_int64 prev, sqlite3_int64 next); bool update_linked_chunks(sqlite3_int64 link_id, sqlite3_int64 prev, sqlite3_int64 next); bool update_linked_chunks_head_tail(sqlite3_int64 head, sqlite3_int64 tail); DiskChunkCache(const DiskChunkCache &) = delete; DiskChunkCache &operator=(const DiskChunkCache &) = delete; public: static std::unique_ptr open(PJ_CONTEXT *ctx); ~DiskChunkCache(); sqlite3 *handle() { return hDB_; } std::unique_ptr prepare(const char *sql); bool move_to_head(sqlite3_int64 chunk_id); bool move_to_tail(sqlite3_int64 chunk_id); void closeAndUnlink(); }; // --------------------------------------------------------------------------- static bool pj_context_get_grid_cache_is_enabled(PJ_CONTEXT *ctx) { pj_load_ini(ctx); return ctx->gridChunkCache.enabled; } // --------------------------------------------------------------------------- static long long pj_context_get_grid_cache_max_size(PJ_CONTEXT *ctx) { pj_load_ini(ctx); return ctx->gridChunkCache.max_size; } // --------------------------------------------------------------------------- static int pj_context_get_grid_cache_ttl(PJ_CONTEXT *ctx) { pj_load_ini(ctx); return ctx->gridChunkCache.ttl; } // --------------------------------------------------------------------------- std::unique_ptr DiskChunkCache::open(PJ_CONTEXT *ctx) { if (!pj_context_get_grid_cache_is_enabled(ctx)) { return nullptr; } const auto cachePath = pj_context_get_grid_cache_filename(ctx); if (cachePath.empty()) { return nullptr; } auto diskCache = std::unique_ptr(new DiskChunkCache(ctx, cachePath)); if (!diskCache->initialize()) diskCache.reset(); return diskCache; } // --------------------------------------------------------------------------- DiskChunkCache::DiskChunkCache(PJ_CONTEXT *ctx, const std::string &path) : ctx_(ctx), path_(path) {} // --------------------------------------------------------------------------- bool DiskChunkCache::initialize() { std::string vfsName; if (ctx_->custom_sqlite3_vfs_name.empty()) { vfs_ = SQLite3VFS::create(true, false, false); if (vfs_ == nullptr) { return false; } vfsName = vfs_->name(); } else { vfsName = ctx_->custom_sqlite3_vfs_name; } sqlite3_open_v2(path_.c_str(), &hDB_, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, vfsName.c_str()); if (!hDB_) { pj_log(ctx_, PJ_LOG_ERROR, "Cannot open %s", path_.c_str()); return false; } // Cannot run more than 30 times / a bit more than one second. for (int i = 0;; i++) { int ret = sqlite3_exec(hDB_, "BEGIN EXCLUSIVE", nullptr, nullptr, nullptr); if (ret == SQLITE_OK) { break; } if (ret != SQLITE_BUSY) { pj_log(ctx_, PJ_LOG_ERROR, "%s", sqlite3_errmsg(hDB_)); sqlite3_close(hDB_); hDB_ = nullptr; return false; } const char *max_iters = getenv("PROJ_LOCK_MAX_ITERS"); if (i >= (max_iters && max_iters[0] ? atoi(max_iters) : 30)) { // A bit more than 1 second pj_log(ctx_, PJ_LOG_ERROR, "Cannot take exclusive lock on %s", path_.c_str()); sqlite3_close(hDB_); hDB_ = nullptr; return false; } pj_log(ctx_, PJ_LOG_TRACE, "Lock taken on cache. Waiting a bit..."); // Retry every 5 ms for 50 ms, then every 10 ms for 100 ms, then // every 100 ms sleep_ms(i < 10 ? 5 : i < 20 ? 10 : 100); } char **pasResult = nullptr; int nRows = 0; int nCols = 0; sqlite3_get_table(hDB_, "SELECT 1 FROM sqlite_master WHERE name = 'properties'", &pasResult, &nRows, &nCols, nullptr); sqlite3_free_table(pasResult); if (nRows == 0) { if (!createDBStructure()) { sqlite3_close(hDB_); hDB_ = nullptr; return false; } } if (getenv("PROJ_CHECK_CACHE_CONSISTENCY")) { checkConsistency(); } return true; } // --------------------------------------------------------------------------- static const char *cache_db_structure_sql = "CREATE TABLE properties(" " url TEXT PRIMARY KEY NOT NULL," " lastChecked TIMESTAMP NOT NULL," " fileSize INTEGER NOT NULL," " lastModified TEXT," " etag TEXT" ");" "CREATE TABLE downloaded_file_properties(" " url TEXT PRIMARY KEY NOT NULL," " lastChecked TIMESTAMP NOT NULL," " fileSize INTEGER NOT NULL," " lastModified TEXT," " etag TEXT" ");" "CREATE TABLE chunk_data(" " id INTEGER PRIMARY KEY AUTOINCREMENT CHECK (id > 0)," " data BLOB NOT NULL" ");" "CREATE TABLE chunks(" " id INTEGER PRIMARY KEY AUTOINCREMENT CHECK (id > 0)," " url TEXT NOT NULL," " offset INTEGER NOT NULL," " data_id INTEGER NOT NULL," " data_size INTEGER NOT NULL," " CONSTRAINT fk_chunks_url FOREIGN KEY (url) REFERENCES properties(url)," " CONSTRAINT fk_chunks_data FOREIGN KEY (data_id) REFERENCES chunk_data(id)" ");" "CREATE INDEX idx_chunks ON chunks(url, offset);" "CREATE TABLE linked_chunks(" " id INTEGER PRIMARY KEY AUTOINCREMENT CHECK (id > 0)," " chunk_id INTEGER NOT NULL," " prev INTEGER," " next INTEGER," " CONSTRAINT fk_links_chunkid FOREIGN KEY (chunk_id) REFERENCES chunks(id)," " CONSTRAINT fk_links_prev FOREIGN KEY (prev) REFERENCES linked_chunks(id)," " CONSTRAINT fk_links_next FOREIGN KEY (next) REFERENCES linked_chunks(id)" ");" "CREATE INDEX idx_linked_chunks_chunk_id ON linked_chunks(chunk_id);" "CREATE TABLE linked_chunks_head_tail(" " head INTEGER," " tail INTEGER," " CONSTRAINT lht_head FOREIGN KEY (head) REFERENCES linked_chunks(id)," " CONSTRAINT lht_tail FOREIGN KEY (tail) REFERENCES linked_chunks(id)" ");" "INSERT INTO linked_chunks_head_tail VALUES (NULL, NULL);"; bool DiskChunkCache::createDBStructure() { pj_log(ctx_, PJ_LOG_TRACE, "Creating cache DB structure"); if (sqlite3_exec(hDB_, cache_db_structure_sql, nullptr, nullptr, nullptr) != SQLITE_OK) { pj_log(ctx_, PJ_LOG_ERROR, "%s", sqlite3_errmsg(hDB_)); return false; } return true; } // --------------------------------------------------------------------------- // Used by checkConsistency() and insert() #define INVALIDATED_SQL_LITERAL "'invalidated'" bool DiskChunkCache::checkConsistency() { auto stmt = prepare("SELECT * FROM chunk_data WHERE id NOT IN (SELECT " "data_id FROM chunks)"); if (!stmt) { return false; } if (stmt->execute() != SQLITE_DONE) { fprintf(stderr, "Rows in chunk_data not referenced by chunks.\n"); return false; } stmt = prepare("SELECT * FROM chunks WHERE id NOT IN (SELECT chunk_id FROM " "linked_chunks)"); if (!stmt) { return false; } if (stmt->execute() != SQLITE_DONE) { fprintf(stderr, "Rows in chunks not referenced by linked_chunks.\n"); return false; } stmt = prepare("SELECT * FROM chunks WHERE url <> " INVALIDATED_SQL_LITERAL " AND url " "NOT IN (SELECT url FROM properties)"); if (!stmt) { return false; } if (stmt->execute() != SQLITE_DONE) { fprintf(stderr, "url values in chunks not referenced by properties.\n"); return false; } stmt = prepare("SELECT head, tail FROM linked_chunks_head_tail"); if (!stmt) { return false; } if (stmt->execute() != SQLITE_ROW) { fprintf(stderr, "linked_chunks_head_tail empty.\n"); return false; } const auto head = stmt->getInt64(); const auto tail = stmt->getInt64(); if (stmt->execute() != SQLITE_DONE) { fprintf(stderr, "linked_chunks_head_tail has more than one row.\n"); return false; } stmt = prepare("SELECT COUNT(*) FROM linked_chunks"); if (!stmt) { return false; } if (stmt->execute() != SQLITE_ROW) { fprintf(stderr, "linked_chunks_head_tail empty.\n"); return false; } const auto count_linked_chunks = stmt->getInt64(); if (head) { auto id = head; std::set visitedIds; stmt = prepare("SELECT next FROM linked_chunks WHERE id = ?"); if (!stmt) { return false; } while (true) { visitedIds.insert(id); stmt->reset(); stmt->bindInt64(id); if (stmt->execute() != SQLITE_ROW) { fprintf(stderr, "cannot find linked_chunks.id = %d.\n", static_cast(id)); return false; } auto next = stmt->getInt64(); if (next == 0) { if (id != tail) { fprintf(stderr, "last item when following next is not tail.\n"); return false; } break; } if (visitedIds.find(next) != visitedIds.end()) { fprintf(stderr, "found cycle on linked_chunks.next = %d.\n", static_cast(next)); return false; } id = next; } if (visitedIds.size() != static_cast(count_linked_chunks)) { fprintf(stderr, "ghost items in linked_chunks when following next.\n"); return false; } } else if (count_linked_chunks) { fprintf(stderr, "linked_chunks_head_tail.head = NULL but linked_chunks " "not empty.\n"); return false; } if (tail) { auto id = tail; std::set visitedIds; stmt = prepare("SELECT prev FROM linked_chunks WHERE id = ?"); if (!stmt) { return false; } while (true) { visitedIds.insert(id); stmt->reset(); stmt->bindInt64(id); if (stmt->execute() != SQLITE_ROW) { fprintf(stderr, "cannot find linked_chunks.id = %d.\n", static_cast(id)); return false; } auto prev = stmt->getInt64(); if (prev == 0) { if (id != head) { fprintf(stderr, "last item when following prev is not head.\n"); return false; } break; } if (visitedIds.find(prev) != visitedIds.end()) { fprintf(stderr, "found cycle on linked_chunks.prev = %d.\n", static_cast(prev)); return false; } id = prev; } if (visitedIds.size() != static_cast(count_linked_chunks)) { fprintf(stderr, "ghost items in linked_chunks when following prev.\n"); return false; } } else if (count_linked_chunks) { fprintf(stderr, "linked_chunks_head_tail.tail = NULL but linked_chunks " "not empty.\n"); return false; } fprintf(stderr, "check ok\n"); return true; } // --------------------------------------------------------------------------- void DiskChunkCache::commitAndClose() { if (hDB_) { if (sqlite3_exec(hDB_, "COMMIT", nullptr, nullptr, nullptr) != SQLITE_OK) { pj_log(ctx_, PJ_LOG_ERROR, "%s", sqlite3_errmsg(hDB_)); } sqlite3_close(hDB_); hDB_ = nullptr; } } // --------------------------------------------------------------------------- DiskChunkCache::~DiskChunkCache() { commitAndClose(); } // --------------------------------------------------------------------------- void DiskChunkCache::closeAndUnlink() { commitAndClose(); if (vfs_) { vfs_->raw()->xDelete(vfs_->raw(), path_.c_str(), 0); } } // --------------------------------------------------------------------------- std::unique_ptr DiskChunkCache::prepare(const char *sql) { sqlite3_stmt *hStmt = nullptr; sqlite3_prepare_v2(hDB_, sql, -1, &hStmt, nullptr); if (!hStmt) { pj_log(ctx_, PJ_LOG_ERROR, "%s", sqlite3_errmsg(hDB_)); return nullptr; } return std::unique_ptr(new SQLiteStatement(hStmt)); } // --------------------------------------------------------------------------- bool DiskChunkCache::get_links(sqlite3_int64 chunk_id, sqlite3_int64 &link_id, sqlite3_int64 &prev, sqlite3_int64 &next, sqlite3_int64 &head, sqlite3_int64 &tail) { auto stmt = prepare("SELECT id, prev, next FROM linked_chunks WHERE chunk_id = ?"); if (!stmt) return false; stmt->bindInt64(chunk_id); { const auto ret = stmt->execute(); if (ret != SQLITE_ROW) { pj_log(ctx_, PJ_LOG_ERROR, "%s", sqlite3_errmsg(hDB_)); return false; } } link_id = stmt->getInt64(); prev = stmt->getInt64(); next = stmt->getInt64(); stmt = prepare("SELECT head, tail FROM linked_chunks_head_tail"); { const auto ret = stmt->execute(); if (ret != SQLITE_ROW) { pj_log(ctx_, PJ_LOG_ERROR, "%s", sqlite3_errmsg(hDB_)); return false; } } head = stmt->getInt64(); tail = stmt->getInt64(); return true; } // --------------------------------------------------------------------------- bool DiskChunkCache::update_links_of_prev_and_next_links(sqlite3_int64 prev, sqlite3_int64 next) { if (prev) { auto stmt = prepare("UPDATE linked_chunks SET next = ? WHERE id = ?"); if (!stmt) return false; if (next) stmt->bindInt64(next); else stmt->bindNull(); stmt->bindInt64(prev); const auto ret = stmt->execute(); if (ret != SQLITE_DONE) { pj_log(ctx_, PJ_LOG_ERROR, "%s", sqlite3_errmsg(hDB_)); return false; } } if (next) { auto stmt = prepare("UPDATE linked_chunks SET prev = ? WHERE id = ?"); if (!stmt) return false; if (prev) stmt->bindInt64(prev); else stmt->bindNull(); stmt->bindInt64(next); const auto ret = stmt->execute(); if (ret != SQLITE_DONE) { pj_log(ctx_, PJ_LOG_ERROR, "%s", sqlite3_errmsg(hDB_)); return false; } } return true; } // --------------------------------------------------------------------------- bool DiskChunkCache::update_linked_chunks(sqlite3_int64 link_id, sqlite3_int64 prev, sqlite3_int64 next) { auto stmt = prepare("UPDATE linked_chunks SET prev = ?, next = ? WHERE id = ?"); if (!stmt) return false; if (prev) stmt->bindInt64(prev); else stmt->bindNull(); if (next) stmt->bindInt64(next); else stmt->bindNull(); stmt->bindInt64(link_id); const auto ret = stmt->execute(); if (ret != SQLITE_DONE) { pj_log(ctx_, PJ_LOG_ERROR, "%s", sqlite3_errmsg(hDB_)); return false; } return true; } // --------------------------------------------------------------------------- bool DiskChunkCache::update_linked_chunks_head_tail(sqlite3_int64 head, sqlite3_int64 tail) { auto stmt = prepare("UPDATE linked_chunks_head_tail SET head = ?, tail = ?"); if (!stmt) return false; if (head) stmt->bindInt64(head); else stmt->bindNull(); // shouldn't happen normally if (tail) stmt->bindInt64(tail); else stmt->bindNull(); // shouldn't happen normally const auto ret = stmt->execute(); if (ret != SQLITE_DONE) { pj_log(ctx_, PJ_LOG_ERROR, "%s", sqlite3_errmsg(hDB_)); return false; } return true; } // --------------------------------------------------------------------------- bool DiskChunkCache::move_to_head(sqlite3_int64 chunk_id) { sqlite3_int64 link_id = 0; sqlite3_int64 prev = 0; sqlite3_int64 next = 0; sqlite3_int64 head = 0; sqlite3_int64 tail = 0; if (!get_links(chunk_id, link_id, prev, next, head, tail)) { return false; } if (link_id == head) { return true; } if (!update_links_of_prev_and_next_links(prev, next)) { return false; } if (head) { auto stmt = prepare("UPDATE linked_chunks SET prev = ? WHERE id = ?"); if (!stmt) return false; stmt->bindInt64(link_id); stmt->bindInt64(head); const auto ret = stmt->execute(); if (ret != SQLITE_DONE) { pj_log(ctx_, PJ_LOG_ERROR, "%s", sqlite3_errmsg(hDB_)); return false; } } return update_linked_chunks(link_id, 0, head) && update_linked_chunks_head_tail(link_id, (link_id == tail) ? prev : tail); } // --------------------------------------------------------------------------- bool DiskChunkCache::move_to_tail(sqlite3_int64 chunk_id) { sqlite3_int64 link_id = 0; sqlite3_int64 prev = 0; sqlite3_int64 next = 0; sqlite3_int64 head = 0; sqlite3_int64 tail = 0; if (!get_links(chunk_id, link_id, prev, next, head, tail)) { return false; } if (link_id == tail) { return true; } if (!update_links_of_prev_and_next_links(prev, next)) { return false; } if (tail) { auto stmt = prepare("UPDATE linked_chunks SET next = ? WHERE id = ?"); if (!stmt) return false; stmt->bindInt64(link_id); stmt->bindInt64(tail); const auto ret = stmt->execute(); if (ret != SQLITE_DONE) { pj_log(ctx_, PJ_LOG_ERROR, "%s", sqlite3_errmsg(hDB_)); return false; } } return update_linked_chunks(link_id, tail, 0) && update_linked_chunks_head_tail((link_id == head) ? next : head, link_id); } // --------------------------------------------------------------------------- void NetworkChunkCache::insert(PJ_CONTEXT *ctx, const std::string &url, unsigned long long chunkIdx, std::vector &&data) { auto dataPtr(std::make_shared>(std::move(data))); cache_.insert(Key(url, chunkIdx), dataPtr); auto diskCache = DiskChunkCache::open(ctx); if (!diskCache) return; auto hDB = diskCache->handle(); // Always insert DOWNLOAD_CHUNK_SIZE bytes to avoid fragmentation std::vector blob(*dataPtr); assert(blob.size() <= DOWNLOAD_CHUNK_SIZE); blob.resize(DOWNLOAD_CHUNK_SIZE); // Check if there is an existing entry for that URL and offset auto stmt = diskCache->prepare( "SELECT id, data_id FROM chunks WHERE url = ? AND offset = ?"); if (!stmt) return; stmt->bindText(url.c_str()); stmt->bindInt64(chunkIdx * DOWNLOAD_CHUNK_SIZE); const auto mainRet = stmt->execute(); if (mainRet == SQLITE_ROW) { const auto chunk_id = stmt->getInt64(); const auto data_id = stmt->getInt64(); stmt = diskCache->prepare("UPDATE chunk_data SET data = ? WHERE id = ?"); if (!stmt) return; stmt->bindBlob(blob.data(), blob.size()); stmt->bindInt64(data_id); { const auto ret = stmt->execute(); if (ret != SQLITE_DONE) { pj_log(ctx, PJ_LOG_ERROR, "%s", sqlite3_errmsg(hDB)); return; } } diskCache->move_to_head(chunk_id); return; } else if (mainRet != SQLITE_DONE) { pj_log(ctx, PJ_LOG_ERROR, "%s", sqlite3_errmsg(hDB)); return; } // Lambda to recycle an existing entry that was either invalidated, or // least recently used. const auto reuseExistingEntry = [ctx, &blob, &diskCache, hDB, &url, chunkIdx, &dataPtr](std::unique_ptr &stmtIn) { const auto chunk_id = stmtIn->getInt64(); const auto data_id = stmtIn->getInt64(); if (data_id <= 0) { pj_log(ctx, PJ_LOG_ERROR, "data_id <= 0"); return; } auto l_stmt = diskCache->prepare( "UPDATE chunk_data SET data = ? WHERE id = ?"); if (!l_stmt) return; l_stmt->bindBlob(blob.data(), blob.size()); l_stmt->bindInt64(data_id); { const auto ret2 = l_stmt->execute(); if (ret2 != SQLITE_DONE) { pj_log(ctx, PJ_LOG_ERROR, "%s", sqlite3_errmsg(hDB)); return; } } l_stmt = diskCache->prepare("UPDATE chunks SET url = ?, " "offset = ?, data_size = ?, data_id = ? " "WHERE id = ?"); if (!l_stmt) return; l_stmt->bindText(url.c_str()); l_stmt->bindInt64(chunkIdx * DOWNLOAD_CHUNK_SIZE); l_stmt->bindInt64(dataPtr->size()); l_stmt->bindInt64(data_id); l_stmt->bindInt64(chunk_id); { const auto ret2 = l_stmt->execute(); if (ret2 != SQLITE_DONE) { pj_log(ctx, PJ_LOG_ERROR, "%s", sqlite3_errmsg(hDB)); return; } } diskCache->move_to_head(chunk_id); }; // Find if there is an invalidated chunk we can reuse stmt = diskCache->prepare( "SELECT id, data_id FROM chunks " "WHERE id = (SELECT tail FROM linked_chunks_head_tail) AND " "url = " INVALIDATED_SQL_LITERAL); if (!stmt) return; { const auto ret = stmt->execute(); if (ret == SQLITE_ROW) { reuseExistingEntry(stmt); return; } else if (ret != SQLITE_DONE) { pj_log(ctx, PJ_LOG_ERROR, "%s", sqlite3_errmsg(hDB)); return; } } // Check if we have not reached the max size of the cache stmt = diskCache->prepare("SELECT COUNT(*) FROM chunks"); if (!stmt) return; { const auto ret = stmt->execute(); if (ret != SQLITE_ROW) { pj_log(ctx, PJ_LOG_ERROR, "%s", sqlite3_errmsg(hDB)); return; } } const auto max_size = pj_context_get_grid_cache_max_size(ctx); if (max_size > 0 && static_cast(stmt->getInt64() * DOWNLOAD_CHUNK_SIZE) >= max_size) { stmt = diskCache->prepare( "SELECT id, data_id FROM chunks " "WHERE id = (SELECT tail FROM linked_chunks_head_tail)"); if (!stmt) return; const auto ret = stmt->execute(); if (ret != SQLITE_ROW) { pj_log(ctx, PJ_LOG_ERROR, "%s", sqlite3_errmsg(hDB)); return; } reuseExistingEntry(stmt); return; } // Otherwise just append a new entry stmt = diskCache->prepare("INSERT INTO chunk_data(data) VALUES (?)"); if (!stmt) return; stmt->bindBlob(blob.data(), blob.size()); { const auto ret = stmt->execute(); if (ret != SQLITE_DONE) { pj_log(ctx, PJ_LOG_ERROR, "%s", sqlite3_errmsg(hDB)); return; } } const auto chunk_data_id = sqlite3_last_insert_rowid(hDB); stmt = diskCache->prepare("INSERT INTO chunks(url, offset, data_id, " "data_size) VALUES (?,?,?,?)"); if (!stmt) return; stmt->bindText(url.c_str()); stmt->bindInt64(chunkIdx * DOWNLOAD_CHUNK_SIZE); stmt->bindInt64(chunk_data_id); stmt->bindInt64(dataPtr->size()); { const auto ret = stmt->execute(); if (ret != SQLITE_DONE) { pj_log(ctx, PJ_LOG_ERROR, "%s", sqlite3_errmsg(hDB)); return; } } const auto chunk_id = sqlite3_last_insert_rowid(hDB); stmt = diskCache->prepare( "INSERT INTO linked_chunks(chunk_id, prev, next) VALUES (?,NULL,NULL)"); if (!stmt) return; stmt->bindInt64(chunk_id); if (stmt->execute() != SQLITE_DONE) { pj_log(ctx, PJ_LOG_ERROR, "%s", sqlite3_errmsg(hDB)); return; } stmt = diskCache->prepare("SELECT head FROM linked_chunks_head_tail"); if (!stmt) return; if (stmt->execute() != SQLITE_ROW) { pj_log(ctx, PJ_LOG_ERROR, "%s", sqlite3_errmsg(hDB)); return; } if (stmt->getInt64() == 0) { stmt = diskCache->prepare( "UPDATE linked_chunks_head_tail SET head = ?, tail = ?"); if (!stmt) return; stmt->bindInt64(chunk_id); stmt->bindInt64(chunk_id); if (stmt->execute() != SQLITE_DONE) { pj_log(ctx, PJ_LOG_ERROR, "%s", sqlite3_errmsg(hDB)); return; } } diskCache->move_to_head(chunk_id); } // --------------------------------------------------------------------------- std::shared_ptr> NetworkChunkCache::get(PJ_CONTEXT *ctx, const std::string &url, unsigned long long chunkIdx) { std::shared_ptr> ret; if (cache_.tryGet(Key(url, chunkIdx), ret)) { return ret; } auto diskCache = DiskChunkCache::open(ctx); if (!diskCache) return ret; auto hDB = diskCache->handle(); auto stmt = diskCache->prepare( "SELECT chunks.id, chunks.data_size, chunk_data.data FROM chunks " "JOIN chunk_data ON chunks.id = chunk_data.id " "WHERE chunks.url = ? AND chunks.offset = ?"); if (!stmt) return ret; stmt->bindText(url.c_str()); stmt->bindInt64(chunkIdx * DOWNLOAD_CHUNK_SIZE); const auto mainRet = stmt->execute(); if (mainRet == SQLITE_ROW) { const auto chunk_id = stmt->getInt64(); const auto data_size = stmt->getInt64(); int blob_size = 0; const void *blob = stmt->getBlob(blob_size); if (blob_size < data_size) { pj_log(ctx, PJ_LOG_ERROR, "blob_size=%d < data_size for chunk_id=%d", blob_size, static_cast(chunk_id)); return ret; } if (data_size > static_cast(DOWNLOAD_CHUNK_SIZE)) { pj_log(ctx, PJ_LOG_ERROR, "data_size > DOWNLOAD_CHUNK_SIZE"); return ret; } ret.reset(new std::vector()); ret->assign(reinterpret_cast(blob), reinterpret_cast(blob) + static_cast(data_size)); cache_.insert(Key(url, chunkIdx), ret); if (!diskCache->move_to_head(chunk_id)) return ret; } else if (mainRet != SQLITE_DONE) { pj_log(ctx, PJ_LOG_ERROR, "%s", sqlite3_errmsg(hDB)); } return ret; } // --------------------------------------------------------------------------- std::shared_ptr> NetworkChunkCache::get(PJ_CONTEXT *ctx, const std::string &url, unsigned long long chunkIdx, FileProperties &props) { if (!gNetworkFileProperties.tryGet(ctx, url, props)) { return nullptr; } return get(ctx, url, chunkIdx); } // --------------------------------------------------------------------------- void NetworkChunkCache::clearMemoryCache() { cache_.clear(); } // --------------------------------------------------------------------------- void NetworkChunkCache::clearDiskChunkCache(PJ_CONTEXT *ctx) { auto diskCache = DiskChunkCache::open(ctx); if (!diskCache) return; diskCache->closeAndUnlink(); } // --------------------------------------------------------------------------- void NetworkFilePropertiesCache::insert(PJ_CONTEXT *ctx, const std::string &url, FileProperties &props) { time(&props.lastChecked); cache_.insert(url, props); auto diskCache = DiskChunkCache::open(ctx); if (!diskCache) return; auto hDB = diskCache->handle(); auto stmt = diskCache->prepare("SELECT fileSize, lastModified, etag " "FROM properties WHERE url = ?"); if (!stmt) return; stmt->bindText(url.c_str()); if (stmt->execute() == SQLITE_ROW) { FileProperties cachedProps; cachedProps.size = stmt->getInt64(); const char *lastModified = stmt->getText(); cachedProps.lastModified = lastModified ? lastModified : std::string(); const char *etag = stmt->getText(); cachedProps.etag = etag ? etag : std::string(); if (props.size != cachedProps.size || props.lastModified != cachedProps.lastModified || props.etag != cachedProps.etag) { // If cached properties don't match recent fresh ones, invalidate // cached chunks stmt = diskCache->prepare("SELECT id FROM chunks WHERE url = ?"); if (!stmt) return; stmt->bindText(url.c_str()); std::vector ids; while (stmt->execute() == SQLITE_ROW) { ids.emplace_back(stmt->getInt64()); stmt->resetResIndex(); } for (const auto id : ids) { diskCache->move_to_tail(id); } stmt = diskCache->prepare( "UPDATE chunks SET url = " INVALIDATED_SQL_LITERAL ", " "offset = -1, data_size = 0 WHERE url = ?"); if (!stmt) return; stmt->bindText(url.c_str()); if (stmt->execute() != SQLITE_DONE) { pj_log(ctx, PJ_LOG_ERROR, "%s", sqlite3_errmsg(hDB)); return; } } stmt = diskCache->prepare("UPDATE properties SET lastChecked = ?, " "fileSize = ?, lastModified = ?, etag = ? " "WHERE url = ?"); if (!stmt) return; stmt->bindInt64(props.lastChecked); stmt->bindInt64(props.size); if (props.lastModified.empty()) stmt->bindNull(); else stmt->bindText(props.lastModified.c_str()); if (props.etag.empty()) stmt->bindNull(); else stmt->bindText(props.etag.c_str()); stmt->bindText(url.c_str()); if (stmt->execute() != SQLITE_DONE) { pj_log(ctx, PJ_LOG_ERROR, "%s", sqlite3_errmsg(hDB)); return; } } else { stmt = diskCache->prepare("INSERT INTO properties (url, lastChecked, " "fileSize, lastModified, etag) VALUES " "(?,?,?,?,?)"); if (!stmt) return; stmt->bindText(url.c_str()); stmt->bindInt64(props.lastChecked); stmt->bindInt64(props.size); if (props.lastModified.empty()) stmt->bindNull(); else stmt->bindText(props.lastModified.c_str()); if (props.etag.empty()) stmt->bindNull(); else stmt->bindText(props.etag.c_str()); if (stmt->execute() != SQLITE_DONE) { pj_log(ctx, PJ_LOG_ERROR, "%s", sqlite3_errmsg(hDB)); return; } } } // --------------------------------------------------------------------------- bool NetworkFilePropertiesCache::tryGet(PJ_CONTEXT *ctx, const std::string &url, FileProperties &props) { if (cache_.tryGet(url, props)) { return true; } auto diskCache = DiskChunkCache::open(ctx); if (!diskCache) return false; auto stmt = diskCache->prepare("SELECT lastChecked, fileSize, lastModified, etag " "FROM properties WHERE url = ?"); if (!stmt) return false; stmt->bindText(url.c_str()); if (stmt->execute() != SQLITE_ROW) { return false; } props.lastChecked = static_cast(stmt->getInt64()); props.size = stmt->getInt64(); const char *lastModified = stmt->getText(); props.lastModified = lastModified ? lastModified : std::string(); const char *etag = stmt->getText(); props.etag = etag ? etag : std::string(); const auto ttl = pj_context_get_grid_cache_ttl(ctx); if (ttl > 0) { time_t curTime; time(&curTime); if (curTime > props.lastChecked + ttl) { props = FileProperties(); return false; } } cache_.insert(url, props); return true; } // --------------------------------------------------------------------------- void NetworkFilePropertiesCache::clearMemoryCache() { cache_.clear(); } // --------------------------------------------------------------------------- class NetworkFile : public File { PJ_CONTEXT *m_ctx; std::string m_url; PROJ_NETWORK_HANDLE *m_handle; unsigned long long m_pos = 0; size_t m_nBlocksToDownload = 1; unsigned long long m_lastDownloadedOffset; FileProperties m_props; proj_network_close_cbk_type m_closeCbk; bool m_hasChanged = false; NetworkFile(const NetworkFile &) = delete; NetworkFile &operator=(const NetworkFile &) = delete; protected: NetworkFile(PJ_CONTEXT *ctx, const std::string &url, PROJ_NETWORK_HANDLE *handle, unsigned long long lastDownloadOffset, const FileProperties &props) : File(url), m_ctx(ctx), m_url(url), m_handle(handle), m_lastDownloadedOffset(lastDownloadOffset), m_props(props), m_closeCbk(ctx->networking.close) {} public: ~NetworkFile() override; size_t read(void *buffer, size_t sizeBytes) override; size_t write(const void *, size_t) override { return 0; } bool seek(unsigned long long offset, int whence) override; unsigned long long tell() override; void reassign_context(PJ_CONTEXT *ctx) override; bool hasChanged() const override { return m_hasChanged; } static std::unique_ptr open(PJ_CONTEXT *ctx, const char *filename); static bool get_props_from_headers(PJ_CONTEXT *ctx, PROJ_NETWORK_HANDLE *handle, FileProperties &props); }; // --------------------------------------------------------------------------- bool NetworkFile::get_props_from_headers(PJ_CONTEXT *ctx, PROJ_NETWORK_HANDLE *handle, FileProperties &props) { const char *contentRange = ctx->networking.get_header_value( ctx, handle, "Content-Range", ctx->networking.user_data); if (contentRange) { const char *slash = strchr(contentRange, '/'); if (slash) { props.size = std::stoull(slash + 1); const char *lastModified = ctx->networking.get_header_value( ctx, handle, "Last-Modified", ctx->networking.user_data); if (lastModified) props.lastModified = lastModified; const char *etag = ctx->networking.get_header_value( ctx, handle, "ETag", ctx->networking.user_data); if (etag) props.etag = etag; return true; } } return false; } // --------------------------------------------------------------------------- std::unique_ptr NetworkFile::open(PJ_CONTEXT *ctx, const char *filename) { FileProperties props; if (gNetworkChunkCache.get(ctx, filename, 0, props)) { return std::unique_ptr(new NetworkFile( ctx, filename, nullptr, std::numeric_limits::max(), props)); } else { std::vector buffer(DOWNLOAD_CHUNK_SIZE); size_t size_read = 0; std::string errorBuffer; errorBuffer.resize(1024); auto handle = ctx->networking.open( ctx, filename, 0, buffer.size(), &buffer[0], &size_read, errorBuffer.size(), &errorBuffer[0], ctx->networking.user_data); buffer.resize(size_read); if (!handle) { errorBuffer.resize(strlen(errorBuffer.data())); pj_log(ctx, PJ_LOG_ERROR, "Cannot open %s: %s", filename, errorBuffer.c_str()); proj_context_errno_set(ctx, PROJ_ERR_OTHER_NETWORK_ERROR); } bool ok = false; if (handle) { if (get_props_from_headers(ctx, handle, props)) { ok = true; gNetworkFileProperties.insert(ctx, filename, props); gNetworkChunkCache.insert(ctx, filename, 0, std::move(buffer)); } } return std::unique_ptr( ok ? new NetworkFile(ctx, filename, handle, size_read, props) : nullptr); } } // --------------------------------------------------------------------------- std::unique_ptr pj_network_file_open(PJ_CONTEXT *ctx, const char *filename) { return NetworkFile::open(ctx, filename); } // --------------------------------------------------------------------------- size_t NetworkFile::read(void *buffer, size_t sizeBytes) { if (sizeBytes == 0) return 0; auto iterOffset = m_pos; while (sizeBytes) { const auto chunkIdxToDownload = iterOffset / DOWNLOAD_CHUNK_SIZE; const auto offsetToDownload = chunkIdxToDownload * DOWNLOAD_CHUNK_SIZE; std::vector region; auto pChunk = gNetworkChunkCache.get(m_ctx, m_url, chunkIdxToDownload); if (pChunk != nullptr) { region = *pChunk; } else { if (offsetToDownload == m_lastDownloadedOffset) { // In case of consecutive reads (of small size), we use a // heuristic that we will read the file sequentially, so // we double the requested size to decrease the number of // client/server roundtrips. if (m_nBlocksToDownload < 100) m_nBlocksToDownload *= 2; } else { // Random reads. Cancel the above heuristics. m_nBlocksToDownload = 1; } // Ensure that we will request at least the number of blocks // to satisfy the remaining buffer size to read. const auto endOffsetToDownload = ((iterOffset + sizeBytes + DOWNLOAD_CHUNK_SIZE - 1) / DOWNLOAD_CHUNK_SIZE) * DOWNLOAD_CHUNK_SIZE; const auto nMinBlocksToDownload = static_cast( (endOffsetToDownload - offsetToDownload) / DOWNLOAD_CHUNK_SIZE); if (m_nBlocksToDownload < nMinBlocksToDownload) m_nBlocksToDownload = nMinBlocksToDownload; // Avoid reading already cached data. // Note: this might get evicted if concurrent reads are done, but // this should not cause bugs. Just missed optimization. for (size_t i = 1; i < m_nBlocksToDownload; i++) { if (gNetworkChunkCache.get(m_ctx, m_url, chunkIdxToDownload + i) != nullptr) { m_nBlocksToDownload = i; break; } } if (m_nBlocksToDownload > MAX_CHUNKS) m_nBlocksToDownload = MAX_CHUNKS; region.resize(m_nBlocksToDownload * DOWNLOAD_CHUNK_SIZE); size_t nRead = 0; std::string errorBuffer; errorBuffer.resize(1024); if (!m_handle) { m_handle = m_ctx->networking.open( m_ctx, m_url.c_str(), offsetToDownload, m_nBlocksToDownload * DOWNLOAD_CHUNK_SIZE, ®ion[0], &nRead, errorBuffer.size(), &errorBuffer[0], m_ctx->networking.user_data); if (!m_handle) { proj_context_errno_set(m_ctx, PROJ_ERR_OTHER_NETWORK_ERROR); return 0; } } else { nRead = m_ctx->networking.read_range( m_ctx, m_handle, offsetToDownload, m_nBlocksToDownload * DOWNLOAD_CHUNK_SIZE, ®ion[0], errorBuffer.size(), &errorBuffer[0], m_ctx->networking.user_data); } if (nRead == 0) { errorBuffer.resize(strlen(errorBuffer.data())); if (!errorBuffer.empty()) { pj_log(m_ctx, PJ_LOG_ERROR, "Cannot read in %s: %s", m_url.c_str(), errorBuffer.c_str()); } proj_context_errno_set(m_ctx, PROJ_ERR_OTHER_NETWORK_ERROR); return 0; } if (!m_hasChanged) { FileProperties props; if (get_props_from_headers(m_ctx, m_handle, props)) { if (props.size != m_props.size || props.lastModified != m_props.lastModified || props.etag != m_props.etag) { gNetworkFileProperties.insert(m_ctx, m_url, props); gNetworkChunkCache.clearMemoryCache(); m_hasChanged = true; } } } region.resize(nRead); m_lastDownloadedOffset = offsetToDownload + nRead; const auto nChunks = (region.size() + DOWNLOAD_CHUNK_SIZE - 1) / DOWNLOAD_CHUNK_SIZE; for (size_t i = 0; i < nChunks; i++) { std::vector chunk( region.data() + i * DOWNLOAD_CHUNK_SIZE, region.data() + std::min((i + 1) * DOWNLOAD_CHUNK_SIZE, region.size())); gNetworkChunkCache.insert(m_ctx, m_url, chunkIdxToDownload + i, std::move(chunk)); } } const size_t nToCopy = static_cast( std::min(static_cast(sizeBytes), region.size() - (iterOffset - offsetToDownload))); memcpy(buffer, region.data() + iterOffset - offsetToDownload, nToCopy); buffer = static_cast(buffer) + nToCopy; iterOffset += nToCopy; sizeBytes -= nToCopy; if (region.size() < static_cast(DOWNLOAD_CHUNK_SIZE) && sizeBytes != 0) { break; } } size_t nRead = static_cast(iterOffset - m_pos); m_pos = iterOffset; return nRead; } // --------------------------------------------------------------------------- bool NetworkFile::seek(unsigned long long offset, int whence) { if (whence == SEEK_SET) { m_pos = offset; } else if (whence == SEEK_CUR) { m_pos += offset; } else { if (offset != 0) return false; m_pos = m_props.size; } return true; } // --------------------------------------------------------------------------- unsigned long long NetworkFile::tell() { return m_pos; } // --------------------------------------------------------------------------- NetworkFile::~NetworkFile() { if (m_handle) { m_ctx->networking.close(m_ctx, m_handle, m_ctx->networking.user_data); } } // --------------------------------------------------------------------------- void NetworkFile::reassign_context(PJ_CONTEXT *ctx) { m_ctx = ctx; if (m_closeCbk != m_ctx->networking.close) { pj_log(m_ctx, PJ_LOG_ERROR, "Networking close callback has changed following context " "reassignment ! This is highly suspicious"); } } // --------------------------------------------------------------------------- #ifdef CURL_ENABLED struct CurlFileHandle { std::string m_url; CURL *m_handle; std::string m_headers{}; std::string m_lastval{}; std::string m_useragent{}; char m_szCurlErrBuf[CURL_ERROR_SIZE + 1] = {}; CurlFileHandle(const CurlFileHandle &) = delete; CurlFileHandle &operator=(const CurlFileHandle &) = delete; explicit CurlFileHandle(PJ_CONTEXT *ctx, const char *url, CURL *handle, const char *ca_bundle_path); ~CurlFileHandle(); static PROJ_NETWORK_HANDLE * open(PJ_CONTEXT *, const char *url, unsigned long long offset, size_t size_to_read, void *buffer, size_t *out_size_read, size_t error_string_max_size, char *out_error_string, void *); }; // --------------------------------------------------------------------------- static std::string GetExecutableName() { #if defined(__linux) std::string path; path.resize(1024); const auto ret = readlink("/proc/self/exe", &path[0], path.size()); if (ret > 0) { path.resize(ret); const auto pos = path.rfind('/'); if (pos != std::string::npos) { path = path.substr(pos + 1); } return path; } #elif defined(_WIN32) std::string path; path.resize(1024); if (GetModuleFileNameA(nullptr, &path[0], static_cast(path.size()))) { path.resize(strlen(path.c_str())); const auto pos = path.rfind('\\'); if (pos != std::string::npos) { path = path.substr(pos + 1); } return path; } #elif defined(__MACH__) && defined(__APPLE__) std::string path; path.resize(1024); uint32_t size = static_cast(path.size()); if (_NSGetExecutablePath(&path[0], &size) == 0) { path.resize(strlen(path.c_str())); const auto pos = path.rfind('/'); if (pos != std::string::npos) { path = path.substr(pos + 1); } return path; } #elif defined(__FreeBSD__) int mib[4]; mib[0] = CTL_KERN; mib[1] = KERN_PROC; mib[2] = KERN_PROC_PATHNAME; mib[3] = -1; std::string path; path.resize(1024); size_t size = path.size(); if (sysctl(mib, 4, &path[0], &size, nullptr, 0) == 0) { path.resize(strlen(path.c_str())); const auto pos = path.rfind('/'); if (pos != std::string::npos) { path = path.substr(pos + 1); } return path; } #endif return std::string(); } // --------------------------------------------------------------------------- static void checkRet(PJ_CONTEXT *ctx, CURLcode code, int line) { if (code != CURLE_OK) { pj_log(ctx, PJ_LOG_ERROR, "curl_easy_setopt at line %d failed", line); } } #define CHECK_RET(ctx, code) checkRet(ctx, code, __LINE__) // --------------------------------------------------------------------------- CurlFileHandle::CurlFileHandle(PJ_CONTEXT *ctx, const char *url, CURL *handle, const char *ca_bundle_path) : m_url(url), m_handle(handle) { CHECK_RET(ctx, curl_easy_setopt(handle, CURLOPT_URL, m_url.c_str())); if (getenv("PROJ_CURL_VERBOSE")) CHECK_RET(ctx, curl_easy_setopt(handle, CURLOPT_VERBOSE, 1)); // CURLOPT_SUPPRESS_CONNECT_HEADERS is defined in curl 7.54.0 or newer. #if LIBCURL_VERSION_NUM >= 0x073600 CHECK_RET(ctx, curl_easy_setopt(handle, CURLOPT_SUPPRESS_CONNECT_HEADERS, 1L)); #endif // Enable following redirections. Requires libcurl 7.10.1 at least. CHECK_RET(ctx, curl_easy_setopt(handle, CURLOPT_FOLLOWLOCATION, 1)); CHECK_RET(ctx, curl_easy_setopt(handle, CURLOPT_MAXREDIRS, 10)); if (getenv("PROJ_UNSAFE_SSL")) { CHECK_RET(ctx, curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 0L)); CHECK_RET(ctx, curl_easy_setopt(handle, CURLOPT_SSL_VERIFYHOST, 0L)); } // Custom path to SSL certificates. if (ca_bundle_path == nullptr) { ca_bundle_path = getenv("PROJ_CURL_CA_BUNDLE"); } if (ca_bundle_path == nullptr) { // Name of environment variable used by the curl binary ca_bundle_path = getenv("CURL_CA_BUNDLE"); } if (ca_bundle_path == nullptr) { // Name of environment variable used by the curl binary (tested // after CURL_CA_BUNDLE ca_bundle_path = getenv("SSL_CERT_FILE"); } if (ca_bundle_path != nullptr) { CHECK_RET(ctx, curl_easy_setopt(handle, CURLOPT_CAINFO, ca_bundle_path)); } CHECK_RET(ctx, curl_easy_setopt(handle, CURLOPT_ERRORBUFFER, m_szCurlErrBuf)); if (getenv("PROJ_NO_USERAGENT") == nullptr) { m_useragent = "PROJ " STR(PROJ_VERSION_MAJOR) "." STR( PROJ_VERSION_MINOR) "." STR(PROJ_VERSION_PATCH); const auto exeName = GetExecutableName(); if (!exeName.empty()) { m_useragent = exeName + " using " + m_useragent; } CHECK_RET(ctx, curl_easy_setopt(handle, CURLOPT_USERAGENT, m_useragent.data())); } } // --------------------------------------------------------------------------- CurlFileHandle::~CurlFileHandle() { curl_easy_cleanup(m_handle); } // --------------------------------------------------------------------------- static size_t pj_curl_write_func(void *buffer, size_t count, size_t nmemb, void *req) { const size_t nSize = count * nmemb; auto pStr = static_cast(req); if (pStr->size() + nSize > pStr->capacity()) { // to avoid servers not honouring Range to cause excessive memory // allocation return 0; } pStr->append(static_cast(buffer), nSize); return nmemb; } // --------------------------------------------------------------------------- static double GetNewRetryDelay(int response_code, double dfOldDelay, const char *pszErrBuf, const char *pszCurlError) { if (response_code == 429 || response_code == 500 || (response_code >= 502 && response_code <= 504) || // S3 sends some client timeout errors as 400 Client Error (response_code == 400 && pszErrBuf && strstr(pszErrBuf, "RequestTimeout")) || (pszCurlError && strstr(pszCurlError, "Connection timed out"))) { // Use an exponential backoff factor of 2 plus some random jitter // We don't care about cryptographic quality randomness, hence: // coverity[dont_call] return dfOldDelay * (2 + rand() * 0.5 / RAND_MAX); } else { return 0; } } // --------------------------------------------------------------------------- constexpr double MIN_RETRY_DELAY_MS = 500; constexpr double MAX_RETRY_DELAY_MS = 60000; PROJ_NETWORK_HANDLE *CurlFileHandle::open(PJ_CONTEXT *ctx, const char *url, unsigned long long offset, size_t size_to_read, void *buffer, size_t *out_size_read, size_t error_string_max_size, char *out_error_string, void *) { CURL *hCurlHandle = curl_easy_init(); if (!hCurlHandle) return nullptr; auto file = std::unique_ptr(new CurlFileHandle( ctx, url, hCurlHandle, ctx->ca_bundle_path.empty() ? nullptr : ctx->ca_bundle_path.c_str())); double oldDelay = MIN_RETRY_DELAY_MS; std::string headers; std::string body; char szBuffer[128]; sqlite3_snprintf(sizeof(szBuffer), szBuffer, "%llu-%llu", offset, offset + size_to_read - 1); while (true) { CHECK_RET(ctx, curl_easy_setopt(hCurlHandle, CURLOPT_RANGE, szBuffer)); headers.clear(); headers.reserve(16 * 1024); CHECK_RET(ctx, curl_easy_setopt(hCurlHandle, CURLOPT_HEADERDATA, &headers)); CHECK_RET(ctx, curl_easy_setopt(hCurlHandle, CURLOPT_HEADERFUNCTION, pj_curl_write_func)); body.clear(); body.reserve(size_to_read); CHECK_RET(ctx, curl_easy_setopt(hCurlHandle, CURLOPT_WRITEDATA, &body)); CHECK_RET(ctx, curl_easy_setopt(hCurlHandle, CURLOPT_WRITEFUNCTION, pj_curl_write_func)); file->m_szCurlErrBuf[0] = '\0'; curl_easy_perform(hCurlHandle); long response_code = 0; curl_easy_getinfo(hCurlHandle, CURLINFO_HTTP_CODE, &response_code); CHECK_RET(ctx, curl_easy_setopt(hCurlHandle, CURLOPT_HEADERDATA, nullptr)); CHECK_RET(ctx, curl_easy_setopt(hCurlHandle, CURLOPT_HEADERFUNCTION, nullptr)); CHECK_RET(ctx, curl_easy_setopt(hCurlHandle, CURLOPT_WRITEDATA, nullptr)); CHECK_RET( ctx, curl_easy_setopt(hCurlHandle, CURLOPT_WRITEFUNCTION, nullptr)); if (response_code == 0 || response_code >= 300) { const double delay = GetNewRetryDelay(static_cast(response_code), oldDelay, body.c_str(), file->m_szCurlErrBuf); if (delay != 0 && delay < MAX_RETRY_DELAY_MS) { pj_log(ctx, PJ_LOG_TRACE, "Got a HTTP %ld error. Retrying in %d ms", response_code, static_cast(delay)); sleep_ms(static_cast(delay)); oldDelay = delay; } else { if (out_error_string) { if (file->m_szCurlErrBuf[0]) { snprintf(out_error_string, error_string_max_size, "%s", file->m_szCurlErrBuf); } else { snprintf(out_error_string, error_string_max_size, "HTTP error %ld: %s", response_code, body.c_str()); } } return nullptr; } } else { break; } } if (out_error_string && error_string_max_size) { out_error_string[0] = '\0'; } if (!body.empty()) { memcpy(buffer, body.data(), std::min(size_to_read, body.size())); } *out_size_read = std::min(size_to_read, body.size()); file->m_headers = std::move(headers); return reinterpret_cast(file.release()); } // --------------------------------------------------------------------------- static void pj_curl_close(PJ_CONTEXT *, PROJ_NETWORK_HANDLE *handle, void * /*user_data*/) { delete reinterpret_cast(handle); } // --------------------------------------------------------------------------- static size_t pj_curl_read_range(PJ_CONTEXT *ctx, PROJ_NETWORK_HANDLE *raw_handle, unsigned long long offset, size_t size_to_read, void *buffer, size_t error_string_max_size, char *out_error_string, void *) { auto handle = reinterpret_cast(raw_handle); auto hCurlHandle = handle->m_handle; double oldDelay = MIN_RETRY_DELAY_MS; std::string headers; std::string body; char szBuffer[128]; sqlite3_snprintf(sizeof(szBuffer), szBuffer, "%llu-%llu", offset, offset + size_to_read - 1); while (true) { CHECK_RET(ctx, curl_easy_setopt(hCurlHandle, CURLOPT_RANGE, szBuffer)); headers.clear(); headers.reserve(16 * 1024); CHECK_RET(ctx, curl_easy_setopt(hCurlHandle, CURLOPT_HEADERDATA, &headers)); CHECK_RET(ctx, curl_easy_setopt(hCurlHandle, CURLOPT_HEADERFUNCTION, pj_curl_write_func)); body.clear(); body.reserve(size_to_read); CHECK_RET(ctx, curl_easy_setopt(hCurlHandle, CURLOPT_WRITEDATA, &body)); CHECK_RET(ctx, curl_easy_setopt(hCurlHandle, CURLOPT_WRITEFUNCTION, pj_curl_write_func)); handle->m_szCurlErrBuf[0] = '\0'; curl_easy_perform(hCurlHandle); long response_code = 0; curl_easy_getinfo(hCurlHandle, CURLINFO_HTTP_CODE, &response_code); CHECK_RET(ctx, curl_easy_setopt(hCurlHandle, CURLOPT_WRITEDATA, nullptr)); CHECK_RET( ctx, curl_easy_setopt(hCurlHandle, CURLOPT_WRITEFUNCTION, nullptr)); if (response_code == 0 || response_code >= 300) { const double delay = GetNewRetryDelay(static_cast(response_code), oldDelay, body.c_str(), handle->m_szCurlErrBuf); if (delay != 0 && delay < MAX_RETRY_DELAY_MS) { pj_log(ctx, PJ_LOG_TRACE, "Got a HTTP %ld error. Retrying in %d ms", response_code, static_cast(delay)); sleep_ms(static_cast(delay)); oldDelay = delay; } else { if (out_error_string) { if (handle->m_szCurlErrBuf[0]) { snprintf(out_error_string, error_string_max_size, "%s", handle->m_szCurlErrBuf); } else { snprintf(out_error_string, error_string_max_size, "HTTP error %ld: %s", response_code, body.c_str()); } } return 0; } } else { break; } } if (out_error_string && error_string_max_size) { out_error_string[0] = '\0'; } if (!body.empty()) { memcpy(buffer, body.data(), std::min(size_to_read, body.size())); } handle->m_headers = std::move(headers); return std::min(size_to_read, body.size()); } // --------------------------------------------------------------------------- static const char *pj_curl_get_header_value(PJ_CONTEXT *, PROJ_NETWORK_HANDLE *raw_handle, const char *header_name, void *) { auto handle = reinterpret_cast(raw_handle); auto pos = ci_find(handle->m_headers, header_name); if (pos == std::string::npos) return nullptr; pos += strlen(header_name); const char *c_str = handle->m_headers.c_str(); if (c_str[pos] == ':') pos++; while (c_str[pos] == ' ') pos++; auto posEnd = pos; while (c_str[posEnd] != '\r' && c_str[posEnd] != '\n' && c_str[posEnd] != '\0') posEnd++; handle->m_lastval = handle->m_headers.substr(pos, posEnd - pos); return handle->m_lastval.c_str(); } #else // --------------------------------------------------------------------------- static PROJ_NETWORK_HANDLE * no_op_network_open(PJ_CONTEXT *, const char * /* url */, unsigned long long, /* offset */ size_t, /* size to read */ void *, /* buffer to update with bytes read*/ size_t *, /* output: size actually read */ size_t error_string_max_size, char *out_error_string, void * /*user_data*/) { if (out_error_string) { snprintf(out_error_string, error_string_max_size, "%s", "Network functionality not available"); } return nullptr; } // --------------------------------------------------------------------------- static void no_op_network_close(PJ_CONTEXT *, PROJ_NETWORK_HANDLE *, void * /*user_data*/) {} #endif // --------------------------------------------------------------------------- void FileManager::fillDefaultNetworkInterface(PJ_CONTEXT *ctx) { #ifdef CURL_ENABLED ctx->networking.open = CurlFileHandle::open; ctx->networking.close = pj_curl_close; ctx->networking.read_range = pj_curl_read_range; ctx->networking.get_header_value = pj_curl_get_header_value; #else ctx->networking.open = no_op_network_open; ctx->networking.close = no_op_network_close; #endif } // --------------------------------------------------------------------------- void FileManager::clearMemoryCache() { gNetworkChunkCache.clearMemoryCache(); gNetworkFileProperties.clearMemoryCache(); } NS_PROJ_END //! @endcond // --------------------------------------------------------------------------- #ifdef WIN32 static const char dir_chars[] = "/\\"; #else static const char dir_chars[] = "/"; #endif static bool is_tilde_slash(const char *name) { return *name == '~' && strchr(dir_chars, name[1]); } static bool is_rel_or_absolute_filename(const char *name) { return strchr(dir_chars, *name) || (*name == '.' && strchr(dir_chars, name[1])) || (!strncmp(name, "..", 2) && strchr(dir_chars, name[2])) || (name[0] != '\0' && name[1] == ':' && strchr(dir_chars, name[2])); } static std::string build_url(PJ_CONTEXT *ctx, const char *name) { if (!is_tilde_slash(name) && !is_rel_or_absolute_filename(name) && !starts_with(name, "http://") && !starts_with(name, "https://")) { std::string remote_file(proj_context_get_url_endpoint(ctx)); if (!remote_file.empty()) { if (remote_file.back() != '/') { remote_file += '/'; } remote_file += name; } return remote_file; } return name; } // --------------------------------------------------------------------------- /** Define a custom set of callbacks for network access. * * All callbacks should be provided (non NULL pointers). * * @param ctx PROJ context, or NULL * @param open_cbk Callback to open a remote file given its URL * @param close_cbk Callback to close a remote file. * @param get_header_value_cbk Callback to get HTTP headers * @param read_range_cbk Callback to read a range of bytes inside a remote file. * @param user_data Arbitrary pointer provided by the user, and passed to the * above callbacks. May be NULL. * @return TRUE in case of success. * @since 7.0 */ int proj_context_set_network_callbacks( PJ_CONTEXT *ctx, proj_network_open_cbk_type open_cbk, proj_network_close_cbk_type close_cbk, proj_network_get_header_value_cbk_type get_header_value_cbk, proj_network_read_range_type read_range_cbk, void *user_data) { if (ctx == nullptr) { ctx = pj_get_default_ctx(); } if (!open_cbk || !close_cbk || !get_header_value_cbk || !read_range_cbk) { return false; } ctx->networking.open = open_cbk; ctx->networking.close = close_cbk; ctx->networking.get_header_value = get_header_value_cbk; ctx->networking.read_range = read_range_cbk; ctx->networking.user_data = user_data; return true; } // --------------------------------------------------------------------------- /** Enable or disable network access. * * This overrides the default endpoint in the PROJ configuration file or with * the PROJ_NETWORK environment variable. * * @param ctx PROJ context, or NULL * @param enable TRUE if network access is allowed. * @return TRUE if network access is possible. That is either libcurl is * available, or an alternate interface has been set. * @since 7.0 */ int proj_context_set_enable_network(PJ_CONTEXT *ctx, int enable) { if (ctx == nullptr) { ctx = pj_get_default_ctx(); } // Load ini file, now so as to override its network settings pj_load_ini(ctx); ctx->networking.enabled_env_variable_checked = true; ctx->networking.enabled = enable != FALSE; #ifdef CURL_ENABLED return ctx->networking.enabled; #else return ctx->networking.enabled && ctx->networking.open != NS_PROJ::no_op_network_open; #endif } // --------------------------------------------------------------------------- /** Return if network access is enabled. * * @param ctx PROJ context, or NULL * @return TRUE if network access has been enabled * @since 7.0 */ int proj_context_is_network_enabled(PJ_CONTEXT *ctx) { if (ctx == nullptr) { ctx = pj_get_default_ctx(); } if (ctx->networking.enabled_env_variable_checked) { return ctx->networking.enabled; } const char *enabled = getenv("PROJ_NETWORK"); if (enabled && enabled[0] != '\0') { ctx->networking.enabled = ci_equal(enabled, "ON") || ci_equal(enabled, "YES") || ci_equal(enabled, "TRUE"); } pj_load_ini(ctx); ctx->networking.enabled_env_variable_checked = true; return ctx->networking.enabled; } //! @endcond // --------------------------------------------------------------------------- /** Define the URL endpoint to query for remote grids. * * This overrides the default endpoint in the PROJ configuration file or with * the PROJ_NETWORK_ENDPOINT environment variable. * * @param ctx PROJ context, or NULL * @param url Endpoint URL. Must NOT be NULL. * @since 7.0 */ void proj_context_set_url_endpoint(PJ_CONTEXT *ctx, const char *url) { if (ctx == nullptr) { ctx = pj_get_default_ctx(); } // Load ini file, now so as to override its network settings pj_load_ini(ctx); ctx->endpoint = url; } // --------------------------------------------------------------------------- /** Enable or disable the local cache of grid chunks * * This overrides the setting in the PROJ configuration file. * * @param ctx PROJ context, or NULL * @param enabled TRUE if the cache is enabled. * @since 7.0 */ void proj_grid_cache_set_enable(PJ_CONTEXT *ctx, int enabled) { if (ctx == nullptr) { ctx = pj_get_default_ctx(); } // Load ini file, now so as to override its settings pj_load_ini(ctx); ctx->gridChunkCache.enabled = enabled != FALSE; } // --------------------------------------------------------------------------- /** Override, for the considered context, the path and file of the local * cache of grid chunks. * * @param ctx PROJ context, or NULL * @param fullname Full name to the cache (encoded in UTF-8). If set to NULL, * caching will be disabled. * @since 7.0 */ void proj_grid_cache_set_filename(PJ_CONTEXT *ctx, const char *fullname) { if (ctx == nullptr) { ctx = pj_get_default_ctx(); } // Load ini file, now so as to override its settings pj_load_ini(ctx); ctx->gridChunkCache.filename = fullname ? fullname : std::string(); } // --------------------------------------------------------------------------- /** Override, for the considered context, the maximum size of the local * cache of grid chunks. * * @param ctx PROJ context, or NULL * @param max_size_MB Maximum size, in mega-bytes (1024*1024 bytes), or * negative value to set unlimited size. * @since 7.0 */ void proj_grid_cache_set_max_size(PJ_CONTEXT *ctx, int max_size_MB) { if (ctx == nullptr) { ctx = pj_get_default_ctx(); } // Load ini file, now so as to override its settings pj_load_ini(ctx); ctx->gridChunkCache.max_size = max_size_MB < 0 ? -1 : static_cast(max_size_MB) * 1024 * 1024; if (max_size_MB == 0) { // For debug purposes only const char *env_var = getenv("PROJ_GRID_CACHE_MAX_SIZE_BYTES"); if (env_var && env_var[0] != '\0') { ctx->gridChunkCache.max_size = atoi(env_var); } } } // --------------------------------------------------------------------------- /** Override, for the considered context, the time-to-live delay for * re-checking if the cached properties of files are still up-to-date. * * @param ctx PROJ context, or NULL * @param ttl_seconds Delay in seconds. Use negative value for no expiration. * @since 7.0 */ void proj_grid_cache_set_ttl(PJ_CONTEXT *ctx, int ttl_seconds) { if (ctx == nullptr) { ctx = pj_get_default_ctx(); } // Load ini file, now so as to override its settings pj_load_ini(ctx); ctx->gridChunkCache.ttl = ttl_seconds; } // --------------------------------------------------------------------------- /** Clear the local cache of grid chunks. * * @param ctx PROJ context, or NULL * @since 7.0 */ void proj_grid_cache_clear(PJ_CONTEXT *ctx) { if (ctx == nullptr) { ctx = pj_get_default_ctx(); } NS_PROJ::gNetworkChunkCache.clearDiskChunkCache(ctx); } // --------------------------------------------------------------------------- /** Return if a file must be downloaded or is already available in the * PROJ user-writable directory. * * The file will be determinted to have to be downloaded if it does not exist * yet in the user-writable directory, or if it is determined that a more recent * version exists. To determine if a more recent version exists, PROJ will * use the "downloaded_file_properties" table of its grid cache database. * Consequently files manually placed in the user-writable * directory without using this function would be considered as * non-existing/obsolete and would be unconditionally downloaded again. * * This function can only be used if networking is enabled, and either * the default curl network API or a custom one have been installed. * * @param ctx PROJ context, or NULL * @param url_or_filename URL or filename (without directory component) * @param ignore_ttl_setting If set to FALSE, PROJ will only check the * recentness of an already downloaded file, if * the delay between the last time it has been * verified and the current time exceeds the TTL * setting. This can save network accesses. * If set to TRUE, PROJ will unconditionally * check from the server the recentness of the file. * @return TRUE if the file must be downloaded with proj_download_file() * @since 7.0 */ int proj_is_download_needed(PJ_CONTEXT *ctx, const char *url_or_filename, int ignore_ttl_setting) { if (ctx == nullptr) { ctx = pj_get_default_ctx(); } if (!proj_context_is_network_enabled(ctx)) { pj_log(ctx, PJ_LOG_ERROR, "Networking capabilities are not enabled"); return false; } const auto url(build_url(ctx, url_or_filename)); const char *filename = strrchr(url.c_str(), '/'); if (filename == nullptr) return false; const auto localFilename( std::string(proj_context_get_user_writable_directory(ctx, false)) + filename); auto f = NS_PROJ::FileManager::open(ctx, localFilename.c_str(), NS_PROJ::FileAccess::READ_ONLY); if (!f) { return true; } f.reset(); auto diskCache = NS_PROJ::DiskChunkCache::open(ctx); if (!diskCache) return false; auto stmt = diskCache->prepare("SELECT lastChecked, fileSize, lastModified, etag " "FROM downloaded_file_properties WHERE url = ?"); if (!stmt) return true; stmt->bindText(url.c_str()); if (stmt->execute() != SQLITE_ROW) { return true; } NS_PROJ::FileProperties cachedProps; cachedProps.lastChecked = static_cast(stmt->getInt64()); cachedProps.size = stmt->getInt64(); const char *lastModified = stmt->getText(); cachedProps.lastModified = lastModified ? lastModified : std::string(); const char *etag = stmt->getText(); cachedProps.etag = etag ? etag : std::string(); if (!ignore_ttl_setting) { const auto ttl = NS_PROJ::pj_context_get_grid_cache_ttl(ctx); if (ttl > 0) { time_t curTime; time(&curTime); if (curTime > cachedProps.lastChecked + ttl) { unsigned char dummy; size_t size_read = 0; std::string errorBuffer; errorBuffer.resize(1024); auto handle = ctx->networking.open( ctx, url.c_str(), 0, 1, &dummy, &size_read, errorBuffer.size(), &errorBuffer[0], ctx->networking.user_data); if (!handle) { errorBuffer.resize(strlen(errorBuffer.data())); pj_log(ctx, PJ_LOG_ERROR, "Cannot open %s: %s", url.c_str(), errorBuffer.c_str()); return false; } NS_PROJ::FileProperties props; if (!NS_PROJ::NetworkFile::get_props_from_headers(ctx, handle, props)) { ctx->networking.close(ctx, handle, ctx->networking.user_data); return false; } ctx->networking.close(ctx, handle, ctx->networking.user_data); if (props.size != cachedProps.size || props.lastModified != cachedProps.lastModified || props.etag != cachedProps.etag) { return true; } stmt = diskCache->prepare( "UPDATE downloaded_file_properties SET lastChecked = ? " "WHERE url = ?"); if (!stmt) return false; stmt->bindInt64(curTime); stmt->bindText(url.c_str()); if (stmt->execute() != SQLITE_DONE) { auto hDB = diskCache->handle(); pj_log(ctx, PJ_LOG_ERROR, "%s", sqlite3_errmsg(hDB)); return false; } } } } return false; } // --------------------------------------------------------------------------- /** Download a file in the PROJ user-writable directory. * * The file will only be downloaded if it does not exist yet in the * user-writable directory, or if it is determined that a more recent * version exists. To determine if a more recent version exists, PROJ will * use the "downloaded_file_properties" table of its grid cache database. * Consequently files manually placed in the user-writable * directory without using this function would be considered as * non-existing/obsolete and would be unconditionally downloaded again. * * This function can only be used if networking is enabled, and either * the default curl network API or a custom one have been installed. * * @param ctx PROJ context, or NULL * @param url_or_filename URL or filename (without directory component) * @param ignore_ttl_setting If set to FALSE, PROJ will only check the * recentness of an already downloaded file, if * the delay between the last time it has been * verified and the current time exceeds the TTL * setting. This can save network accesses. * If set to TRUE, PROJ will unconditionally * check from the server the recentness of the file. * @param progress_cbk Progress callback, or NULL. * The passed percentage is in the [0, 1] range. * The progress callback must return TRUE * if download must be continued. * @param user_data User data to provide to the progress callback, or NULL * @return TRUE if the download was successful (or not needed) * @since 7.0 */ int proj_download_file(PJ_CONTEXT *ctx, const char *url_or_filename, int ignore_ttl_setting, int (*progress_cbk)(PJ_CONTEXT *, double pct, void *user_data), void *user_data) { if (ctx == nullptr) { ctx = pj_get_default_ctx(); } if (!proj_context_is_network_enabled(ctx)) { pj_log(ctx, PJ_LOG_ERROR, "Networking capabilities are not enabled"); return false; } if (!proj_is_download_needed(ctx, url_or_filename, ignore_ttl_setting)) { return true; } const auto url(build_url(ctx, url_or_filename)); const char *filename = strrchr(url.c_str(), '/'); if (filename == nullptr) return false; const auto localFilename( std::string(proj_context_get_user_writable_directory(ctx, true)) + filename); #ifdef _WIN32 const int nPID = GetCurrentProcessId(); #else const int nPID = getpid(); #endif char szUniqueSuffix[128]; snprintf(szUniqueSuffix, sizeof(szUniqueSuffix), "%d_%p", nPID, &url); const auto localFilenameTmp(localFilename + szUniqueSuffix); auto f = NS_PROJ::FileManager::open(ctx, localFilenameTmp.c_str(), NS_PROJ::FileAccess::CREATE); if (!f) { pj_log(ctx, PJ_LOG_ERROR, "Cannot create %s", localFilenameTmp.c_str()); return false; } constexpr size_t FULL_FILE_CHUNK_SIZE = 1024 * 1024; std::vector buffer(FULL_FILE_CHUNK_SIZE); // For testing purposes only const char *env_var_PROJ_FULL_FILE_CHUNK_SIZE = getenv("PROJ_FULL_FILE_CHUNK_SIZE"); if (env_var_PROJ_FULL_FILE_CHUNK_SIZE && env_var_PROJ_FULL_FILE_CHUNK_SIZE[0] != '\0') { buffer.resize(atoi(env_var_PROJ_FULL_FILE_CHUNK_SIZE)); } size_t size_read = 0; std::string errorBuffer; errorBuffer.resize(1024); auto handle = ctx->networking.open( ctx, url.c_str(), 0, buffer.size(), &buffer[0], &size_read, errorBuffer.size(), &errorBuffer[0], ctx->networking.user_data); if (!handle) { errorBuffer.resize(strlen(errorBuffer.data())); pj_log(ctx, PJ_LOG_ERROR, "Cannot open %s: %s", url.c_str(), errorBuffer.c_str()); f.reset(); NS_PROJ::FileManager::unlink(ctx, localFilenameTmp.c_str()); return false; } time_t curTime; time(&curTime); NS_PROJ::FileProperties props; if (!NS_PROJ::NetworkFile::get_props_from_headers(ctx, handle, props)) { ctx->networking.close(ctx, handle, ctx->networking.user_data); f.reset(); NS_PROJ::FileManager::unlink(ctx, localFilenameTmp.c_str()); return false; } if (size_read == 0) { pj_log(ctx, PJ_LOG_ERROR, "Did not get as many bytes as expected"); ctx->networking.close(ctx, handle, ctx->networking.user_data); f.reset(); NS_PROJ::FileManager::unlink(ctx, localFilenameTmp.c_str()); return false; } if (f->write(buffer.data(), size_read) != size_read) { pj_log(ctx, PJ_LOG_ERROR, "Write error"); ctx->networking.close(ctx, handle, ctx->networking.user_data); f.reset(); NS_PROJ::FileManager::unlink(ctx, localFilenameTmp.c_str()); return false; } unsigned long long totalDownloaded = size_read; while (totalDownloaded < props.size) { if (totalDownloaded + buffer.size() > props.size) { buffer.resize(static_cast(props.size - totalDownloaded)); } errorBuffer.resize(1024); size_read = ctx->networking.read_range( ctx, handle, totalDownloaded, buffer.size(), &buffer[0], errorBuffer.size(), &errorBuffer[0], ctx->networking.user_data); if (size_read < buffer.size()) { pj_log(ctx, PJ_LOG_ERROR, "Did not get as many bytes as expected"); ctx->networking.close(ctx, handle, ctx->networking.user_data); f.reset(); NS_PROJ::FileManager::unlink(ctx, localFilenameTmp.c_str()); return false; } if (f->write(buffer.data(), size_read) != size_read) { pj_log(ctx, PJ_LOG_ERROR, "Write error"); ctx->networking.close(ctx, handle, ctx->networking.user_data); f.reset(); NS_PROJ::FileManager::unlink(ctx, localFilenameTmp.c_str()); return false; } totalDownloaded += size_read; if (progress_cbk && !progress_cbk(ctx, double(totalDownloaded) / props.size, user_data)) { ctx->networking.close(ctx, handle, ctx->networking.user_data); f.reset(); NS_PROJ::FileManager::unlink(ctx, localFilenameTmp.c_str()); return false; } } ctx->networking.close(ctx, handle, ctx->networking.user_data); f.reset(); NS_PROJ::FileManager::unlink(ctx, localFilename.c_str()); if (!NS_PROJ::FileManager::rename(ctx, localFilenameTmp.c_str(), localFilename.c_str())) { pj_log(ctx, PJ_LOG_ERROR, "Cannot rename %s to %s", localFilenameTmp.c_str(), localFilename.c_str()); return false; } auto diskCache = NS_PROJ::DiskChunkCache::open(ctx); if (!diskCache) return false; auto stmt = diskCache->prepare("SELECT lastChecked, fileSize, lastModified, etag " "FROM downloaded_file_properties WHERE url = ?"); if (!stmt) return false; stmt->bindText(url.c_str()); props.lastChecked = curTime; auto hDB = diskCache->handle(); if (stmt->execute() == SQLITE_ROW) { stmt = diskCache->prepare( "UPDATE downloaded_file_properties SET lastChecked = ?, " "fileSize = ?, lastModified = ?, etag = ? " "WHERE url = ?"); if (!stmt) return false; stmt->bindInt64(props.lastChecked); stmt->bindInt64(props.size); if (props.lastModified.empty()) stmt->bindNull(); else stmt->bindText(props.lastModified.c_str()); if (props.etag.empty()) stmt->bindNull(); else stmt->bindText(props.etag.c_str()); stmt->bindText(url.c_str()); if (stmt->execute() != SQLITE_DONE) { pj_log(ctx, PJ_LOG_ERROR, "%s", sqlite3_errmsg(hDB)); return false; } } else { stmt = diskCache->prepare( "INSERT INTO downloaded_file_properties (url, lastChecked, " "fileSize, lastModified, etag) VALUES " "(?,?,?,?,?)"); if (!stmt) return false; stmt->bindText(url.c_str()); stmt->bindInt64(props.lastChecked); stmt->bindInt64(props.size); if (props.lastModified.empty()) stmt->bindNull(); else stmt->bindText(props.lastModified.c_str()); if (props.etag.empty()) stmt->bindNull(); else stmt->bindText(props.etag.c_str()); if (stmt->execute() != SQLITE_DONE) { pj_log(ctx, PJ_LOG_ERROR, "%s", sqlite3_errmsg(hDB)); return false; } } return true; } // --------------------------------------------------------------------------- //! @cond Doxygen_Suppress // --------------------------------------------------------------------------- std::string pj_context_get_grid_cache_filename(PJ_CONTEXT *ctx) { pj_load_ini(ctx); if (!ctx->gridChunkCache.filename.empty()) { return ctx->gridChunkCache.filename; } const std::string path(proj_context_get_user_writable_directory(ctx, true)); ctx->gridChunkCache.filename = path + "/cache.db"; return ctx->gridChunkCache.filename; } //! @endcond proj-8.2.1/src/grids.hpp000644 000765 000024 00000024134 14111601677 015556 0ustar00keversstaff000000 000000 /****************************************************************************** * Project: PROJ * Purpose: Grid management * Author: Even Rouault, * ****************************************************************************** * Copyright (c) 2019, Even Rouault, * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. *****************************************************************************/ #ifndef GRIDS_HPP_INCLUDED #define GRIDS_HPP_INCLUDED #include #include #include "proj.h" #include "proj/util.hpp" NS_PROJ_START struct ExtentAndRes { bool isGeographic; // whether extent and resolutions are in a geographic or // projected CRS double west; // in radian for geographic, in CRS units otherwise double south; // in radian for geographic, in CRS units otherwise double east; // in radian for geographic, in CRS units otherwise double north; // in radian for geographic, in CRS units otherwise double resX; // in radian for geographic, in CRS units otherwise double resY; // in radian for geographic, in CRS units otherwise double invResX; // = 1 / resX; double invResY; // = 1 / resY; void computeInvRes(); bool fullWorldLongitude() const; bool contains(const ExtentAndRes &other) const; bool intersects(const ExtentAndRes &other) const; }; // --------------------------------------------------------------------------- class PROJ_GCC_DLL Grid { protected: std::string m_name; int m_width; int m_height; ExtentAndRes m_extent; Grid(const std::string &nameIn, int widthIn, int heightIn, const ExtentAndRes &extentIn); public: PROJ_FOR_TEST virtual ~Grid(); PROJ_FOR_TEST int width() const { return m_width; } PROJ_FOR_TEST int height() const { return m_height; } PROJ_FOR_TEST const ExtentAndRes &extentAndRes() const { return m_extent; } PROJ_FOR_TEST const std::string &name() const { return m_name; } PROJ_FOR_TEST virtual bool isNullGrid() const { return false; } PROJ_FOR_TEST virtual bool hasChanged() const = 0; }; // --------------------------------------------------------------------------- class PROJ_GCC_DLL VerticalShiftGrid : public Grid { protected: std::vector> m_children{}; public: PROJ_FOR_TEST VerticalShiftGrid(const std::string &nameIn, int widthIn, int heightIn, const ExtentAndRes &extentIn); PROJ_FOR_TEST ~VerticalShiftGrid() override; PROJ_FOR_TEST const VerticalShiftGrid *gridAt(double lon, double lat) const; PROJ_FOR_TEST virtual bool isNodata(float /*val*/, double /* multiplier */) const = 0; // x = 0 is western-most column, y = 0 is southern-most line PROJ_FOR_TEST virtual bool valueAt(int x, int y, float &out) const = 0; PROJ_FOR_TEST virtual void reassign_context(PJ_CONTEXT *ctx) = 0; }; // --------------------------------------------------------------------------- class PROJ_GCC_DLL VerticalShiftGridSet { protected: std::string m_name{}; std::string m_format{}; std::vector> m_grids{}; VerticalShiftGridSet(); public: PROJ_FOR_TEST virtual ~VerticalShiftGridSet(); PROJ_FOR_TEST static std::unique_ptr open(PJ_CONTEXT *ctx, const std::string &filename); PROJ_FOR_TEST const std::string &name() const { return m_name; } PROJ_FOR_TEST const std::string &format() const { return m_format; } PROJ_FOR_TEST const std::vector> & grids() const { return m_grids; } PROJ_FOR_TEST const VerticalShiftGrid *gridAt(double lon, double lat) const; PROJ_FOR_TEST virtual void reassign_context(PJ_CONTEXT *ctx); PROJ_FOR_TEST virtual bool reopen(PJ_CONTEXT *ctx); }; // --------------------------------------------------------------------------- class PROJ_GCC_DLL HorizontalShiftGrid : public Grid { protected: std::vector> m_children{}; public: PROJ_FOR_TEST HorizontalShiftGrid(const std::string &nameIn, int widthIn, int heightIn, const ExtentAndRes &extentIn); PROJ_FOR_TEST ~HorizontalShiftGrid() override; PROJ_FOR_TEST const HorizontalShiftGrid *gridAt(double lon, double lat) const; // x = 0 is western-most column, y = 0 is southern-most line PROJ_FOR_TEST virtual bool valueAt(int x, int y, bool compensateNTConvention, float &lonShift, float &latShift) const = 0; PROJ_FOR_TEST virtual void reassign_context(PJ_CONTEXT *ctx) = 0; }; // --------------------------------------------------------------------------- class PROJ_GCC_DLL HorizontalShiftGridSet { protected: std::string m_name{}; std::string m_format{}; std::vector> m_grids{}; HorizontalShiftGridSet(); public: PROJ_FOR_TEST virtual ~HorizontalShiftGridSet(); PROJ_FOR_TEST static std::unique_ptr open(PJ_CONTEXT *ctx, const std::string &filename); PROJ_FOR_TEST const std::string &name() const { return m_name; } PROJ_FOR_TEST const std::string &format() const { return m_format; } PROJ_FOR_TEST const std::vector> & grids() const { return m_grids; } PROJ_FOR_TEST const HorizontalShiftGrid *gridAt(double lon, double lat) const; PROJ_FOR_TEST virtual void reassign_context(PJ_CONTEXT *ctx); PROJ_FOR_TEST virtual bool reopen(PJ_CONTEXT *ctx); }; // --------------------------------------------------------------------------- class PROJ_GCC_DLL GenericShiftGrid : public Grid { protected: std::vector> m_children{}; public: PROJ_FOR_TEST GenericShiftGrid(const std::string &nameIn, int widthIn, int heightIn, const ExtentAndRes &extentIn); PROJ_FOR_TEST ~GenericShiftGrid() override; PROJ_FOR_TEST const GenericShiftGrid *gridAt(double x, double y) const; PROJ_FOR_TEST virtual std::string unit(int sample) const = 0; PROJ_FOR_TEST virtual std::string description(int sample) const = 0; PROJ_FOR_TEST virtual std::string metadataItem(const std::string &key, int sample = -1) const = 0; PROJ_FOR_TEST virtual int samplesPerPixel() const = 0; // x = 0 is western-most column, y = 0 is southern-most line PROJ_FOR_TEST virtual bool valueAt(int x, int y, int sample, float &out) const = 0; PROJ_FOR_TEST virtual void reassign_context(PJ_CONTEXT *ctx) = 0; }; // --------------------------------------------------------------------------- class PROJ_GCC_DLL GenericShiftGridSet { protected: std::string m_name{}; std::string m_format{}; std::vector> m_grids{}; GenericShiftGridSet(); public: PROJ_FOR_TEST virtual ~GenericShiftGridSet(); PROJ_FOR_TEST static std::unique_ptr open(PJ_CONTEXT *ctx, const std::string &filename); PROJ_FOR_TEST const std::string &name() const { return m_name; } PROJ_FOR_TEST const std::string &format() const { return m_format; } PROJ_FOR_TEST const std::vector> & grids() const { return m_grids; } PROJ_FOR_TEST const GenericShiftGrid *gridAt(double x, double y) const; PROJ_FOR_TEST virtual void reassign_context(PJ_CONTEXT *ctx); PROJ_FOR_TEST virtual bool reopen(PJ_CONTEXT *ctx); }; // --------------------------------------------------------------------------- typedef std::vector> ListOfHGrids; typedef std::vector> ListOfVGrids; typedef std::vector> ListOfGenericGrids; ListOfVGrids pj_vgrid_init(PJ *P, const char *grids); ListOfHGrids pj_hgrid_init(PJ *P, const char *grids); ListOfGenericGrids pj_generic_grid_init(PJ *P, const char *grids); PJ_LP pj_hgrid_value(PJ *P, const ListOfHGrids &grids, PJ_LP lp); double pj_vgrid_value(PJ *P, const ListOfVGrids &, PJ_LP lp, double vmultiplier); PJ_LP pj_hgrid_apply(PJ_CONTEXT *ctx, const ListOfHGrids &grids, PJ_LP lp, PJ_DIRECTION direction); const GenericShiftGrid *pj_find_generic_grid(const ListOfGenericGrids &grids, const PJ_LP &input, GenericShiftGridSet *&gridSetOut); bool pj_bilinear_interpolation_three_samples( PJ_CONTEXT *ctx, const GenericShiftGrid *grid, const PJ_LP &lp, int idx1, int idx2, int idx3, double &v1, double &v2, double &v3, bool &must_retry); NS_PROJ_END #endif // GRIDS_HPP_INCLUDED proj-8.2.1/src/msfn.cpp000644 000765 000024 00000000322 13437770506 015405 0ustar00keversstaff000000 000000 /* determine constant small m */ #include #include "proj.h" #include "proj_internal.h" double pj_msfn(double sinphi, double cosphi, double es) { return (cosphi / sqrt (1. - es * sinphi * sinphi)); } proj-8.2.1/src/proj_symbol_rename.h000644 000765 000024 00000054104 14140020570 017761 0ustar00keversstaff000000 000000 /* This is a generated file by create_proj_symbol_rename.sh. *DO NOT EDIT MANUALLY !* */ #ifndef PROJ_SYMBOL_RENAME_H #define PROJ_SYMBOL_RENAME_H #define geod_direct internal_geod_direct #define geod_directline internal_geod_directline #define geod_gendirect internal_geod_gendirect #define geod_gendirectline internal_geod_gendirectline #define geod_geninverse internal_geod_geninverse #define geod_genposition internal_geod_genposition #define geod_gensetdistance internal_geod_gensetdistance #define geod_init internal_geod_init #define geod_inverse internal_geod_inverse #define geod_inverseline internal_geod_inverseline #define geod_lineinit internal_geod_lineinit #define geod_polygon_addedge internal_geod_polygon_addedge #define geod_polygon_addpoint internal_geod_polygon_addpoint #define geod_polygonarea internal_geod_polygonarea #define geod_polygon_clear internal_geod_polygon_clear #define geod_polygon_compute internal_geod_polygon_compute #define geod_polygon_init internal_geod_polygon_init #define geod_polygon_testedge internal_geod_polygon_testedge #define geod_polygon_testpoint internal_geod_polygon_testpoint #define geod_position internal_geod_position #define geod_setdistance internal_geod_setdistance #define proj_alter_id internal_proj_alter_id #define proj_alter_name internal_proj_alter_name #define proj_angular_input internal_proj_angular_input #define proj_angular_output internal_proj_angular_output #define proj_area_create internal_proj_area_create #define proj_area_destroy internal_proj_area_destroy #define proj_area_set_bbox internal_proj_area_set_bbox #define proj_as_projjson internal_proj_as_projjson #define proj_as_proj_string internal_proj_as_proj_string #define proj_assign_context internal_proj_assign_context #define proj_as_wkt internal_proj_as_wkt #define proj_celestial_body_list_destroy internal_proj_celestial_body_list_destroy #define proj_cleanup internal_proj_cleanup #define proj_clone internal_proj_clone #define proj_concatoperation_get_step internal_proj_concatoperation_get_step #define proj_concatoperation_get_step_count internal_proj_concatoperation_get_step_count #define proj_context_clone internal_proj_context_clone #define proj_context_create internal_proj_context_create #define proj_context_destroy internal_proj_context_destroy #define proj_context_errno internal_proj_context_errno #define proj_context_errno_string internal_proj_context_errno_string #define proj_context_get_database_metadata internal_proj_context_get_database_metadata #define proj_context_get_database_path internal_proj_context_get_database_path #define proj_context_get_database_structure internal_proj_context_get_database_structure #define proj_context_get_url_endpoint internal_proj_context_get_url_endpoint #define proj_context_get_use_proj4_init_rules internal_proj_context_get_use_proj4_init_rules #define proj_context_get_user_writable_directory internal_proj_context_get_user_writable_directory #define proj_context_guess_wkt_dialect internal_proj_context_guess_wkt_dialect #define proj_context_is_network_enabled internal_proj_context_is_network_enabled #define proj_context_set_autoclose_database internal_proj_context_set_autoclose_database #define proj_context_set_ca_bundle_path internal_proj_context_set_ca_bundle_path #define proj_context_set_database_path internal_proj_context_set_database_path #define proj_context_set_enable_network internal_proj_context_set_enable_network #define proj_context_set_fileapi internal_proj_context_set_fileapi #define proj_context_set_file_finder internal_proj_context_set_file_finder #define proj_context_set_network_callbacks internal_proj_context_set_network_callbacks #define proj_context_set_search_paths internal_proj_context_set_search_paths #define proj_context_set_sqlite3_vfs_name internal_proj_context_set_sqlite3_vfs_name #define proj_context_set_url_endpoint internal_proj_context_set_url_endpoint #define proj_context_use_proj4_init_rules internal_proj_context_use_proj4_init_rules #define proj_convert_conversion_to_other_method internal_proj_convert_conversion_to_other_method #define proj_coord internal_proj_coord #define proj_coordoperation_create_inverse internal_proj_coordoperation_create_inverse #define proj_coordoperation_get_accuracy internal_proj_coordoperation_get_accuracy #define proj_coordoperation_get_grid_used internal_proj_coordoperation_get_grid_used #define proj_coordoperation_get_grid_used_count internal_proj_coordoperation_get_grid_used_count #define proj_coordoperation_get_method_info internal_proj_coordoperation_get_method_info #define proj_coordoperation_get_param internal_proj_coordoperation_get_param #define proj_coordoperation_get_param_count internal_proj_coordoperation_get_param_count #define proj_coordoperation_get_param_index internal_proj_coordoperation_get_param_index #define proj_coordoperation_get_towgs84_values internal_proj_coordoperation_get_towgs84_values #define proj_coordoperation_has_ballpark_transformation internal_proj_coordoperation_has_ballpark_transformation #define proj_coordoperation_is_instantiable internal_proj_coordoperation_is_instantiable #define proj_create internal_proj_create #define proj_create_argv internal_proj_create_argv #define proj_create_cartesian_2D_cs internal_proj_create_cartesian_2D_cs #define proj_create_compound_crs internal_proj_create_compound_crs #define proj_create_conversion internal_proj_create_conversion #define proj_create_conversion_albers_equal_area internal_proj_create_conversion_albers_equal_area #define proj_create_conversion_american_polyconic internal_proj_create_conversion_american_polyconic #define proj_create_conversion_azimuthal_equidistant internal_proj_create_conversion_azimuthal_equidistant #define proj_create_conversion_bonne internal_proj_create_conversion_bonne #define proj_create_conversion_cassini_soldner internal_proj_create_conversion_cassini_soldner #define proj_create_conversion_eckert_i internal_proj_create_conversion_eckert_i #define proj_create_conversion_eckert_ii internal_proj_create_conversion_eckert_ii #define proj_create_conversion_eckert_iii internal_proj_create_conversion_eckert_iii #define proj_create_conversion_eckert_iv internal_proj_create_conversion_eckert_iv #define proj_create_conversion_eckert_v internal_proj_create_conversion_eckert_v #define proj_create_conversion_eckert_vi internal_proj_create_conversion_eckert_vi #define proj_create_conversion_equal_earth internal_proj_create_conversion_equal_earth #define proj_create_conversion_equidistant_conic internal_proj_create_conversion_equidistant_conic #define proj_create_conversion_equidistant_cylindrical internal_proj_create_conversion_equidistant_cylindrical #define proj_create_conversion_equidistant_cylindrical_spherical internal_proj_create_conversion_equidistant_cylindrical_spherical #define proj_create_conversion_gall internal_proj_create_conversion_gall #define proj_create_conversion_gauss_schreiber_transverse_mercator internal_proj_create_conversion_gauss_schreiber_transverse_mercator #define proj_create_conversion_geostationary_satellite_sweep_x internal_proj_create_conversion_geostationary_satellite_sweep_x #define proj_create_conversion_geostationary_satellite_sweep_y internal_proj_create_conversion_geostationary_satellite_sweep_y #define proj_create_conversion_gnomonic internal_proj_create_conversion_gnomonic #define proj_create_conversion_goode_homolosine internal_proj_create_conversion_goode_homolosine #define proj_create_conversion_guam_projection internal_proj_create_conversion_guam_projection #define proj_create_conversion_hotine_oblique_mercator_two_point_natural_origin internal_proj_create_conversion_hotine_oblique_mercator_two_point_natural_origin #define proj_create_conversion_hotine_oblique_mercator_variant_a internal_proj_create_conversion_hotine_oblique_mercator_variant_a #define proj_create_conversion_hotine_oblique_mercator_variant_b internal_proj_create_conversion_hotine_oblique_mercator_variant_b #define proj_create_conversion_international_map_world_polyconic internal_proj_create_conversion_international_map_world_polyconic #define proj_create_conversion_interrupted_goode_homolosine internal_proj_create_conversion_interrupted_goode_homolosine #define proj_create_conversion_krovak internal_proj_create_conversion_krovak #define proj_create_conversion_krovak_north_oriented internal_proj_create_conversion_krovak_north_oriented #define proj_create_conversion_laborde_oblique_mercator internal_proj_create_conversion_laborde_oblique_mercator #define proj_create_conversion_lambert_azimuthal_equal_area internal_proj_create_conversion_lambert_azimuthal_equal_area #define proj_create_conversion_lambert_conic_conformal_1sp internal_proj_create_conversion_lambert_conic_conformal_1sp #define proj_create_conversion_lambert_conic_conformal_2sp internal_proj_create_conversion_lambert_conic_conformal_2sp #define proj_create_conversion_lambert_conic_conformal_2sp_belgium internal_proj_create_conversion_lambert_conic_conformal_2sp_belgium #define proj_create_conversion_lambert_conic_conformal_2sp_michigan internal_proj_create_conversion_lambert_conic_conformal_2sp_michigan #define proj_create_conversion_lambert_cylindrical_equal_area internal_proj_create_conversion_lambert_cylindrical_equal_area #define proj_create_conversion_lambert_cylindrical_equal_area_spherical internal_proj_create_conversion_lambert_cylindrical_equal_area_spherical #define proj_create_conversion_mercator_variant_a internal_proj_create_conversion_mercator_variant_a #define proj_create_conversion_mercator_variant_b internal_proj_create_conversion_mercator_variant_b #define proj_create_conversion_miller_cylindrical internal_proj_create_conversion_miller_cylindrical #define proj_create_conversion_mollweide internal_proj_create_conversion_mollweide #define proj_create_conversion_new_zealand_mapping_grid internal_proj_create_conversion_new_zealand_mapping_grid #define proj_create_conversion_oblique_stereographic internal_proj_create_conversion_oblique_stereographic #define proj_create_conversion_orthographic internal_proj_create_conversion_orthographic #define proj_create_conversion_polar_stereographic_variant_a internal_proj_create_conversion_polar_stereographic_variant_a #define proj_create_conversion_polar_stereographic_variant_b internal_proj_create_conversion_polar_stereographic_variant_b #define proj_create_conversion_pole_rotation_grib_convention internal_proj_create_conversion_pole_rotation_grib_convention #define proj_create_conversion_pole_rotation_netcdf_cf_convention internal_proj_create_conversion_pole_rotation_netcdf_cf_convention #define proj_create_conversion_popular_visualisation_pseudo_mercator internal_proj_create_conversion_popular_visualisation_pseudo_mercator #define proj_create_conversion_quadrilateralized_spherical_cube internal_proj_create_conversion_quadrilateralized_spherical_cube #define proj_create_conversion_robinson internal_proj_create_conversion_robinson #define proj_create_conversion_sinusoidal internal_proj_create_conversion_sinusoidal #define proj_create_conversion_spherical_cross_track_height internal_proj_create_conversion_spherical_cross_track_height #define proj_create_conversion_stereographic internal_proj_create_conversion_stereographic #define proj_create_conversion_transverse_mercator internal_proj_create_conversion_transverse_mercator #define proj_create_conversion_transverse_mercator_south_oriented internal_proj_create_conversion_transverse_mercator_south_oriented #define proj_create_conversion_tunisia_mapping_grid internal_proj_create_conversion_tunisia_mapping_grid #define proj_create_conversion_two_point_equidistant internal_proj_create_conversion_two_point_equidistant #define proj_create_conversion_utm internal_proj_create_conversion_utm #define proj_create_conversion_van_der_grinten internal_proj_create_conversion_van_der_grinten #define proj_create_conversion_vertical_perspective internal_proj_create_conversion_vertical_perspective #define proj_create_conversion_wagner_i internal_proj_create_conversion_wagner_i #define proj_create_conversion_wagner_ii internal_proj_create_conversion_wagner_ii #define proj_create_conversion_wagner_iii internal_proj_create_conversion_wagner_iii #define proj_create_conversion_wagner_iv internal_proj_create_conversion_wagner_iv #define proj_create_conversion_wagner_v internal_proj_create_conversion_wagner_v #define proj_create_conversion_wagner_vi internal_proj_create_conversion_wagner_vi #define proj_create_conversion_wagner_vii internal_proj_create_conversion_wagner_vii #define proj_create_crs_to_crs internal_proj_create_crs_to_crs #define proj_create_crs_to_crs_from_pj internal_proj_create_crs_to_crs_from_pj #define proj_create_cs internal_proj_create_cs #define proj_create_derived_geographic_crs internal_proj_create_derived_geographic_crs #define proj_create_ellipsoidal_2D_cs internal_proj_create_ellipsoidal_2D_cs #define proj_create_ellipsoidal_3D_cs internal_proj_create_ellipsoidal_3D_cs #define proj_create_engineering_crs internal_proj_create_engineering_crs #define proj_create_from_database internal_proj_create_from_database #define proj_create_from_name internal_proj_create_from_name #define proj_create_from_wkt internal_proj_create_from_wkt #define proj_create_geocentric_crs internal_proj_create_geocentric_crs #define proj_create_geocentric_crs_from_datum internal_proj_create_geocentric_crs_from_datum #define proj_create_geographic_crs internal_proj_create_geographic_crs #define proj_create_geographic_crs_from_datum internal_proj_create_geographic_crs_from_datum #define proj_create_operation_factory_context internal_proj_create_operation_factory_context #define proj_create_operations internal_proj_create_operations #define proj_create_projected_crs internal_proj_create_projected_crs #define proj_create_transformation internal_proj_create_transformation #define proj_create_vertical_crs internal_proj_create_vertical_crs #define proj_create_vertical_crs_ex internal_proj_create_vertical_crs_ex #define proj_crs_alter_cs_angular_unit internal_proj_crs_alter_cs_angular_unit #define proj_crs_alter_cs_linear_unit internal_proj_crs_alter_cs_linear_unit #define proj_crs_alter_geodetic_crs internal_proj_crs_alter_geodetic_crs #define proj_crs_alter_parameters_linear_unit internal_proj_crs_alter_parameters_linear_unit #define proj_crs_create_bound_crs internal_proj_crs_create_bound_crs #define proj_crs_create_bound_crs_to_WGS84 internal_proj_crs_create_bound_crs_to_WGS84 #define proj_crs_create_bound_vertical_crs internal_proj_crs_create_bound_vertical_crs #define proj_crs_create_projected_3D_crs_from_2D internal_proj_crs_create_projected_3D_crs_from_2D #define proj_crs_demote_to_2D internal_proj_crs_demote_to_2D #define proj_crs_get_coordinate_system internal_proj_crs_get_coordinate_system #define proj_crs_get_coordoperation internal_proj_crs_get_coordoperation #define proj_crs_get_datum internal_proj_crs_get_datum #define proj_crs_get_datum_ensemble internal_proj_crs_get_datum_ensemble #define proj_crs_get_datum_forced internal_proj_crs_get_datum_forced #define proj_crs_get_geodetic_crs internal_proj_crs_get_geodetic_crs #define proj_crs_get_horizontal_datum internal_proj_crs_get_horizontal_datum #define proj_crs_get_sub_crs internal_proj_crs_get_sub_crs #define proj_crs_info_list_destroy internal_proj_crs_info_list_destroy #define proj_crs_is_derived internal_proj_crs_is_derived #define proj_crs_promote_to_3D internal_proj_crs_promote_to_3D #define proj_cs_get_axis_count internal_proj_cs_get_axis_count #define proj_cs_get_axis_info internal_proj_cs_get_axis_info #define proj_cs_get_type internal_proj_cs_get_type #define proj_datum_ensemble_get_accuracy internal_proj_datum_ensemble_get_accuracy #define proj_datum_ensemble_get_member internal_proj_datum_ensemble_get_member #define proj_datum_ensemble_get_member_count internal_proj_datum_ensemble_get_member_count #define proj_degree_input internal_proj_degree_input #define proj_degree_output internal_proj_degree_output #define proj_destroy internal_proj_destroy #define proj_dmstor internal_proj_dmstor #define proj_download_file internal_proj_download_file #define proj_dynamic_datum_get_frame_reference_epoch internal_proj_dynamic_datum_get_frame_reference_epoch #define proj_ellipsoid_get_parameters internal_proj_ellipsoid_get_parameters #define proj_errno internal_proj_errno #define proj_errno_reset internal_proj_errno_reset #define proj_errno_restore internal_proj_errno_restore #define proj_errno_set internal_proj_errno_set #define proj_errno_string internal_proj_errno_string #define proj_factors internal_proj_factors #define proj_geod internal_proj_geod #define proj_get_area_of_use internal_proj_get_area_of_use #define proj_get_authorities_from_database internal_proj_get_authorities_from_database #define proj_get_celestial_body_list_from_database internal_proj_get_celestial_body_list_from_database #define proj_get_celestial_body_name internal_proj_get_celestial_body_name #define proj_get_codes_from_database internal_proj_get_codes_from_database #define proj_get_crs_info_list_from_database internal_proj_get_crs_info_list_from_database #define proj_get_crs_list_parameters_create internal_proj_get_crs_list_parameters_create #define proj_get_crs_list_parameters_destroy internal_proj_get_crs_list_parameters_destroy #define proj_get_ellipsoid internal_proj_get_ellipsoid #define proj_get_geoid_models_from_database internal_proj_get_geoid_models_from_database #define proj_get_id_auth_name internal_proj_get_id_auth_name #define proj_get_id_code internal_proj_get_id_code #define proj_get_insert_statements internal_proj_get_insert_statements #define proj_get_name internal_proj_get_name #define proj_get_non_deprecated internal_proj_get_non_deprecated #define proj_get_prime_meridian internal_proj_get_prime_meridian #define proj_get_remarks internal_proj_get_remarks #define proj_get_scope internal_proj_get_scope #define proj_get_source_crs internal_proj_get_source_crs #define proj_get_suggested_operation internal_proj_get_suggested_operation #define proj_get_target_crs internal_proj_get_target_crs #define proj_get_type internal_proj_get_type #define proj_get_units_from_database internal_proj_get_units_from_database #define proj_grid_cache_clear internal_proj_grid_cache_clear #define proj_grid_cache_set_enable internal_proj_grid_cache_set_enable #define proj_grid_cache_set_filename internal_proj_grid_cache_set_filename #define proj_grid_cache_set_max_size internal_proj_grid_cache_set_max_size #define proj_grid_cache_set_ttl internal_proj_grid_cache_set_ttl #define proj_grid_get_info_from_database internal_proj_grid_get_info_from_database #define proj_grid_info internal_proj_grid_info #define proj_identify internal_proj_identify #define proj_info internal_proj_info #define proj_init_info internal_proj_init_info #define proj_insert_object_session_create internal_proj_insert_object_session_create #define proj_insert_object_session_destroy internal_proj_insert_object_session_destroy #define proj_int_list_destroy internal_proj_int_list_destroy #define proj_is_crs internal_proj_is_crs #define proj_is_deprecated internal_proj_is_deprecated #define proj_is_derived_crs internal_proj_is_derived_crs #define proj_is_download_needed internal_proj_is_download_needed #define proj_is_equivalent_to internal_proj_is_equivalent_to #define proj_is_equivalent_to_with_ctx internal_proj_is_equivalent_to_with_ctx #define proj_list_angular_units internal_proj_list_angular_units #define proj_list_destroy internal_proj_list_destroy #define proj_list_ellps internal_proj_list_ellps #define proj_list_get internal_proj_list_get #define proj_list_get_count internal_proj_list_get_count #define proj_list_operations internal_proj_list_operations #define proj_list_prime_meridians internal_proj_list_prime_meridians #define proj_list_units internal_proj_list_units #define proj_log_func internal_proj_log_func #define proj_log_level internal_proj_log_level #define proj_lp_dist internal_proj_lp_dist #define proj_lpz_dist internal_proj_lpz_dist #define proj_normalize_for_visualization internal_proj_normalize_for_visualization #define proj_operation_factory_context_destroy internal_proj_operation_factory_context_destroy #define proj_operation_factory_context_set_allow_ballpark_transformations internal_proj_operation_factory_context_set_allow_ballpark_transformations #define proj_operation_factory_context_set_allowed_intermediate_crs internal_proj_operation_factory_context_set_allowed_intermediate_crs #define proj_operation_factory_context_set_allow_use_intermediate_crs internal_proj_operation_factory_context_set_allow_use_intermediate_crs #define proj_operation_factory_context_set_area_of_interest internal_proj_operation_factory_context_set_area_of_interest #define proj_operation_factory_context_set_crs_extent_use internal_proj_operation_factory_context_set_crs_extent_use #define proj_operation_factory_context_set_desired_accuracy internal_proj_operation_factory_context_set_desired_accuracy #define proj_operation_factory_context_set_discard_superseded internal_proj_operation_factory_context_set_discard_superseded #define proj_operation_factory_context_set_grid_availability_use internal_proj_operation_factory_context_set_grid_availability_use #define proj_operation_factory_context_set_spatial_criterion internal_proj_operation_factory_context_set_spatial_criterion #define proj_operation_factory_context_set_use_proj_alternative_grid_names internal_proj_operation_factory_context_set_use_proj_alternative_grid_names #define proj_pj_info internal_proj_pj_info #define proj_prime_meridian_get_parameters internal_proj_prime_meridian_get_parameters #define proj_query_geodetic_crs_from_datum internal_proj_query_geodetic_crs_from_datum #define proj_roundtrip internal_proj_roundtrip #define proj_rtodms internal_proj_rtodms #define proj_string_destroy internal_proj_string_destroy #define proj_string_list_destroy internal_proj_string_list_destroy #define proj_suggests_code_for internal_proj_suggests_code_for #define proj_todeg internal_proj_todeg #define proj_torad internal_proj_torad #define proj_trans internal_proj_trans #define proj_trans_array internal_proj_trans_array #define proj_trans_generic internal_proj_trans_generic #define proj_unit_list_destroy internal_proj_unit_list_destroy #define proj_uom_get_info_from_database internal_proj_uom_get_info_from_database #define proj_xy_dist internal_proj_xy_dist #define proj_xyz_dist internal_proj_xyz_dist #define pj_release internal_pj_release #endif /* PROJ_SYMBOL_RENAME_H */ proj-8.2.1/src/geodesic.c000644 000765 000024 00000213133 14067153334 015664 0ustar00keversstaff000000 000000 /** * \file geodesic.c * \brief Implementation of the geodesic routines in C * * For the full documentation see geodesic.h. **********************************************************************/ /** @cond SKIP */ /* * This is a C implementation of the geodesic algorithms described in * * C. F. F. Karney, * Algorithms for geodesics, * J. Geodesy 87, 43--55 (2013); * https://doi.org/10.1007/s00190-012-0578-z * Addenda: https://geographiclib.sourceforge.io/geod-addenda.html * * See the comments in geodesic.h for documentation. * * Copyright (c) Charles Karney (2012-2021) and licensed * under the MIT/X11 License. For more information, see * https://geographiclib.sourceforge.io/ */ #include "geodesic.h" #include #include #include #if !defined(__cplusplus) #define nullptr 0 #endif #define GEOGRAPHICLIB_GEODESIC_ORDER 6 #define nA1 GEOGRAPHICLIB_GEODESIC_ORDER #define nC1 GEOGRAPHICLIB_GEODESIC_ORDER #define nC1p GEOGRAPHICLIB_GEODESIC_ORDER #define nA2 GEOGRAPHICLIB_GEODESIC_ORDER #define nC2 GEOGRAPHICLIB_GEODESIC_ORDER #define nA3 GEOGRAPHICLIB_GEODESIC_ORDER #define nA3x nA3 #define nC3 GEOGRAPHICLIB_GEODESIC_ORDER #define nC3x ((nC3 * (nC3 - 1)) / 2) #define nC4 GEOGRAPHICLIB_GEODESIC_ORDER #define nC4x ((nC4 * (nC4 + 1)) / 2) #define nC (GEOGRAPHICLIB_GEODESIC_ORDER + 1) typedef double real; typedef int boolx; static unsigned init = 0; static const int FALSE = 0; static const int TRUE = 1; static unsigned digits, maxit1, maxit2; static real epsilon, realmin, pi, degree, NaN, tiny, tol0, tol1, tol2, tolb, xthresh; static void Init(void) { if (!init) { digits = DBL_MANT_DIG; epsilon = DBL_EPSILON; realmin = DBL_MIN; #if defined(M_PI) pi = M_PI; #else pi = atan2(0.0, -1.0); #endif maxit1 = 20; maxit2 = maxit1 + digits + 10; tiny = sqrt(realmin); tol0 = epsilon; /* Increase multiplier in defn of tol1 from 100 to 200 to fix inverse case * 52.784459512564 0 -52.784459512563990912 179.634407464943777557 * which otherwise failed for Visual Studio 10 (Release and Debug) */ tol1 = 200 * tol0; tol2 = sqrt(tol0); /* Check on bisection interval */ tolb = tol0 * tol2; xthresh = 1000 * tol2; degree = pi/180; NaN = nan("0"); init = 1; } } enum captype { CAP_NONE = 0U, CAP_C1 = 1U<<0, CAP_C1p = 1U<<1, CAP_C2 = 1U<<2, CAP_C3 = 1U<<3, CAP_C4 = 1U<<4, CAP_ALL = 0x1FU, OUT_ALL = 0x7F80U }; static real sq(real x) { return x * x; } static real sumx(real u, real v, real* t) { volatile real s = u + v; volatile real up = s - v; volatile real vpp = s - up; up -= u; vpp -= v; if (t) *t = -(up + vpp); /* error-free sum: * u + v = s + t * = round(u + v) + t */ return s; } static real polyval(int N, const real p[], real x) { real y = N < 0 ? 0 : *p++; while (--N >= 0) y = y * x + *p++; return y; } /* mimic C++ std::min and std::max */ static real minx(real a, real b) { return (b < a) ? b : a; } static real maxx(real a, real b) { return (a < b) ? b : a; } static void swapx(real* x, real* y) { real t = *x; *x = *y; *y = t; } static void norm2(real* sinx, real* cosx) { #if defined(_MSC_VER) && defined(_M_IX86) /* hypot for Visual Studio (A=win32) fails monotonicity, e.g., with * x = 0.6102683302836215 * y1 = 0.7906090004346522 * y2 = y1 + 1e-16 * the test * hypot(x, y2) >= hypot(x, y1) * fails. See also * https://bugs.python.org/issue43088 */ real r = sqrt(*sinx * *sinx + *cosx * *cosx); #else real r = hypot(*sinx, *cosx); #endif *sinx /= r; *cosx /= r; } static real AngNormalize(real x) { x = remainder(x, (real)(360)); return x != -180 ? x : 180; } static real LatFix(real x) { return fabs(x) > 90 ? NaN : x; } static real AngDiff(real x, real y, real* e) { real t, d = AngNormalize(sumx(AngNormalize(-x), AngNormalize(y), &t)); /* Here y - x = d + t (mod 360), exactly, where d is in (-180,180] and * abs(t) <= eps (eps = 2^-45 for doubles). The only case where the * addition of t takes the result outside the range (-180,180] is d = 180 * and t > 0. The case, d = -180 + eps, t = -eps, can't happen, since * sum would have returned the exact result in such a case (i.e., given t * = 0). */ return sumx(d == 180 && t > 0 ? -180 : d, t, e); } static real AngRound(real x) { const real z = 1/(real)(16); volatile real y; if (x == 0) return 0; y = fabs(x); /* The compiler mustn't "simplify" z - (z - y) to y */ y = y < z ? z - (z - y) : y; return x < 0 ? -y : y; } static void sincosdx(real x, real* sinx, real* cosx) { /* In order to minimize round-off errors, this function exactly reduces * the argument to the range [-45, 45] before converting it to radians. */ real r, s, c; int q = 0; r = remquo(x, (real)(90), &q); /* now abs(r) <= 45 */ r *= degree; /* Possibly could call the gnu extension sincos */ s = sin(r); c = cos(r); switch ((unsigned)q & 3U) { case 0U: *sinx = s; *cosx = c; break; case 1U: *sinx = c; *cosx = -s; break; case 2U: *sinx = -s; *cosx = -c; break; default: *sinx = -c; *cosx = s; break; /* case 3U */ } if (x != 0) { *sinx += (real)(0); *cosx += (real)(0); } } static real atan2dx(real y, real x) { /* In order to minimize round-off errors, this function rearranges the * arguments so that result of atan2 is in the range [-pi/4, pi/4] before * converting it to degrees and mapping the result to the correct * quadrant. */ int q = 0; real ang; if (fabs(y) > fabs(x)) { swapx(&x, &y); q = 2; } if (x < 0) { x = -x; ++q; } /* here x >= 0 and x >= abs(y), so angle is in [-pi/4, pi/4] */ ang = atan2(y, x) / degree; switch (q) { /* Note that atan2d(-0.0, 1.0) will return -0. However, we expect that * atan2d will not be called with y = -0. If need be, include * * case 0: ang = 0 + ang; break; */ case 1: ang = (y >= 0 ? 180 : -180) - ang; break; case 2: ang = 90 - ang; break; case 3: ang = -90 + ang; break; default: break; } return ang; } static void A3coeff(struct geod_geodesic* g); static void C3coeff(struct geod_geodesic* g); static void C4coeff(struct geod_geodesic* g); static real SinCosSeries(boolx sinp, real sinx, real cosx, const real c[], int n); static void Lengths(const struct geod_geodesic* g, real eps, real sig12, real ssig1, real csig1, real dn1, real ssig2, real csig2, real dn2, real cbet1, real cbet2, real* ps12b, real* pm12b, real* pm0, real* pM12, real* pM21, /* Scratch area of the right size */ real Ca[]); static real Astroid(real x, real y); static real InverseStart(const struct geod_geodesic* g, real sbet1, real cbet1, real dn1, real sbet2, real cbet2, real dn2, real lam12, real slam12, real clam12, real* psalp1, real* pcalp1, /* Only updated if return val >= 0 */ real* psalp2, real* pcalp2, /* Only updated for short lines */ real* pdnm, /* Scratch area of the right size */ real Ca[]); static real Lambda12(const struct geod_geodesic* g, real sbet1, real cbet1, real dn1, real sbet2, real cbet2, real dn2, real salp1, real calp1, real slam120, real clam120, real* psalp2, real* pcalp2, real* psig12, real* pssig1, real* pcsig1, real* pssig2, real* pcsig2, real* peps, real* pdomg12, boolx diffp, real* pdlam12, /* Scratch area of the right size */ real Ca[]); static real A3f(const struct geod_geodesic* g, real eps); static void C3f(const struct geod_geodesic* g, real eps, real c[]); static void C4f(const struct geod_geodesic* g, real eps, real c[]); static real A1m1f(real eps); static void C1f(real eps, real c[]); static void C1pf(real eps, real c[]); static real A2m1f(real eps); static void C2f(real eps, real c[]); static int transit(real lon1, real lon2); static int transitdirect(real lon1, real lon2); static void accini(real s[]); static void acccopy(const real s[], real t[]); static void accadd(real s[], real y); static real accsum(const real s[], real y); static void accneg(real s[]); static void accrem(real s[], real y); static real areareduceA(real area[], real area0, int crossings, boolx reverse, boolx sign); static real areareduceB(real area, real area0, int crossings, boolx reverse, boolx sign); void geod_init(struct geod_geodesic* g, real a, real f) { if (!init) Init(); g->a = a; g->f = f; g->f1 = 1 - g->f; g->e2 = g->f * (2 - g->f); g->ep2 = g->e2 / sq(g->f1); /* e2 / (1 - e2) */ g->n = g->f / ( 2 - g->f); g->b = g->a * g->f1; g->c2 = (sq(g->a) + sq(g->b) * (g->e2 == 0 ? 1 : (g->e2 > 0 ? atanh(sqrt(g->e2)) : atan(sqrt(-g->e2))) / sqrt(fabs(g->e2))))/2; /* authalic radius squared */ /* The sig12 threshold for "really short". Using the auxiliary sphere * solution with dnm computed at (bet1 + bet2) / 2, the relative error in the * azimuth consistency check is sig12^2 * abs(f) * min(1, 1-f/2) / 2. (Error * measured for 1/100 < b/a < 100 and abs(f) >= 1/1000. For a given f and * sig12, the max error occurs for lines near the pole. If the old rule for * computing dnm = (dn1 + dn2)/2 is used, then the error increases by a * factor of 2.) Setting this equal to epsilon gives sig12 = etol2. Here * 0.1 is a safety factor (error decreased by 100) and max(0.001, abs(f)) * stops etol2 getting too large in the nearly spherical case. */ g->etol2 = 0.1 * tol2 / sqrt( maxx((real)(0.001), fabs(g->f)) * minx((real)(1), 1 - g->f/2) / 2 ); A3coeff(g); C3coeff(g); C4coeff(g); } static void geod_lineinit_int(struct geod_geodesicline* l, const struct geod_geodesic* g, real lat1, real lon1, real azi1, real salp1, real calp1, unsigned caps) { real cbet1, sbet1, eps; l->a = g->a; l->f = g->f; l->b = g->b; l->c2 = g->c2; l->f1 = g->f1; /* If caps is 0 assume the standard direct calculation */ l->caps = (caps ? caps : GEOD_DISTANCE_IN | GEOD_LONGITUDE) | /* always allow latitude and azimuth and unrolling of longitude */ GEOD_LATITUDE | GEOD_AZIMUTH | GEOD_LONG_UNROLL; l->lat1 = LatFix(lat1); l->lon1 = lon1; l->azi1 = azi1; l->salp1 = salp1; l->calp1 = calp1; sincosdx(AngRound(l->lat1), &sbet1, &cbet1); sbet1 *= l->f1; /* Ensure cbet1 = +epsilon at poles */ norm2(&sbet1, &cbet1); cbet1 = maxx(tiny, cbet1); l->dn1 = sqrt(1 + g->ep2 * sq(sbet1)); /* Evaluate alp0 from sin(alp1) * cos(bet1) = sin(alp0), */ l->salp0 = l->salp1 * cbet1; /* alp0 in [0, pi/2 - |bet1|] */ /* Alt: calp0 = hypot(sbet1, calp1 * cbet1). The following * is slightly better (consider the case salp1 = 0). */ l->calp0 = hypot(l->calp1, l->salp1 * sbet1); /* Evaluate sig with tan(bet1) = tan(sig1) * cos(alp1). * sig = 0 is nearest northward crossing of equator. * With bet1 = 0, alp1 = pi/2, we have sig1 = 0 (equatorial line). * With bet1 = pi/2, alp1 = -pi, sig1 = pi/2 * With bet1 = -pi/2, alp1 = 0 , sig1 = -pi/2 * Evaluate omg1 with tan(omg1) = sin(alp0) * tan(sig1). * With alp0 in (0, pi/2], quadrants for sig and omg coincide. * No atan2(0,0) ambiguity at poles since cbet1 = +epsilon. * With alp0 = 0, omg1 = 0 for alp1 = 0, omg1 = pi for alp1 = pi. */ l->ssig1 = sbet1; l->somg1 = l->salp0 * sbet1; l->csig1 = l->comg1 = sbet1 != 0 || l->calp1 != 0 ? cbet1 * l->calp1 : 1; norm2(&l->ssig1, &l->csig1); /* sig1 in (-pi, pi] */ /* norm2(somg1, comg1); -- don't need to normalize! */ l->k2 = sq(l->calp0) * g->ep2; eps = l->k2 / (2 * (1 + sqrt(1 + l->k2)) + l->k2); if (l->caps & CAP_C1) { real s, c; l->A1m1 = A1m1f(eps); C1f(eps, l->C1a); l->B11 = SinCosSeries(TRUE, l->ssig1, l->csig1, l->C1a, nC1); s = sin(l->B11); c = cos(l->B11); /* tau1 = sig1 + B11 */ l->stau1 = l->ssig1 * c + l->csig1 * s; l->ctau1 = l->csig1 * c - l->ssig1 * s; /* Not necessary because C1pa reverts C1a * B11 = -SinCosSeries(TRUE, stau1, ctau1, C1pa, nC1p); */ } if (l->caps & CAP_C1p) C1pf(eps, l->C1pa); if (l->caps & CAP_C2) { l->A2m1 = A2m1f(eps); C2f(eps, l->C2a); l->B21 = SinCosSeries(TRUE, l->ssig1, l->csig1, l->C2a, nC2); } if (l->caps & CAP_C3) { C3f(g, eps, l->C3a); l->A3c = -l->f * l->salp0 * A3f(g, eps); l->B31 = SinCosSeries(TRUE, l->ssig1, l->csig1, l->C3a, nC3-1); } if (l->caps & CAP_C4) { C4f(g, eps, l->C4a); /* Multiplier = a^2 * e^2 * cos(alpha0) * sin(alpha0) */ l->A4 = sq(l->a) * l->calp0 * l->salp0 * g->e2; l->B41 = SinCosSeries(FALSE, l->ssig1, l->csig1, l->C4a, nC4); } l->a13 = l->s13 = NaN; } void geod_lineinit(struct geod_geodesicline* l, const struct geod_geodesic* g, real lat1, real lon1, real azi1, unsigned caps) { real salp1, calp1; azi1 = AngNormalize(azi1); /* Guard against underflow in salp0 */ sincosdx(AngRound(azi1), &salp1, &calp1); geod_lineinit_int(l, g, lat1, lon1, azi1, salp1, calp1, caps); } void geod_gendirectline(struct geod_geodesicline* l, const struct geod_geodesic* g, real lat1, real lon1, real azi1, unsigned flags, real s12_a12, unsigned caps) { geod_lineinit(l, g, lat1, lon1, azi1, caps); geod_gensetdistance(l, flags, s12_a12); } void geod_directline(struct geod_geodesicline* l, const struct geod_geodesic* g, real lat1, real lon1, real azi1, real s12, unsigned caps) { geod_gendirectline(l, g, lat1, lon1, azi1, GEOD_NOFLAGS, s12, caps); } real geod_genposition(const struct geod_geodesicline* l, unsigned flags, real s12_a12, real* plat2, real* plon2, real* pazi2, real* ps12, real* pm12, real* pM12, real* pM21, real* pS12) { real lat2 = 0, lon2 = 0, azi2 = 0, s12 = 0, m12 = 0, M12 = 0, M21 = 0, S12 = 0; /* Avoid warning about uninitialized B12. */ real sig12, ssig12, csig12, B12 = 0, AB1 = 0; real omg12, lam12, lon12; real ssig2, csig2, sbet2, cbet2, somg2, comg2, salp2, calp2, dn2; unsigned outmask = (plat2 ? GEOD_LATITUDE : GEOD_NONE) | (plon2 ? GEOD_LONGITUDE : GEOD_NONE) | (pazi2 ? GEOD_AZIMUTH : GEOD_NONE) | (ps12 ? GEOD_DISTANCE : GEOD_NONE) | (pm12 ? GEOD_REDUCEDLENGTH : GEOD_NONE) | (pM12 || pM21 ? GEOD_GEODESICSCALE : GEOD_NONE) | (pS12 ? GEOD_AREA : GEOD_NONE); outmask &= l->caps & OUT_ALL; if (!( (flags & GEOD_ARCMODE || (l->caps & (GEOD_DISTANCE_IN & OUT_ALL))) )) /* Impossible distance calculation requested */ return NaN; if (flags & GEOD_ARCMODE) { /* Interpret s12_a12 as spherical arc length */ sig12 = s12_a12 * degree; sincosdx(s12_a12, &ssig12, &csig12); } else { /* Interpret s12_a12 as distance */ real tau12 = s12_a12 / (l->b * (1 + l->A1m1)), s = sin(tau12), c = cos(tau12); /* tau2 = tau1 + tau12 */ B12 = - SinCosSeries(TRUE, l->stau1 * c + l->ctau1 * s, l->ctau1 * c - l->stau1 * s, l->C1pa, nC1p); sig12 = tau12 - (B12 - l->B11); ssig12 = sin(sig12); csig12 = cos(sig12); if (fabs(l->f) > 0.01) { /* Reverted distance series is inaccurate for |f| > 1/100, so correct * sig12 with 1 Newton iteration. The following table shows the * approximate maximum error for a = WGS_a() and various f relative to * GeodesicExact. * erri = the error in the inverse solution (nm) * errd = the error in the direct solution (series only) (nm) * errda = the error in the direct solution (series + 1 Newton) (nm) * * f erri errd errda * -1/5 12e6 1.2e9 69e6 * -1/10 123e3 12e6 765e3 * -1/20 1110 108e3 7155 * -1/50 18.63 200.9 27.12 * -1/100 18.63 23.78 23.37 * -1/150 18.63 21.05 20.26 * 1/150 22.35 24.73 25.83 * 1/100 22.35 25.03 25.31 * 1/50 29.80 231.9 30.44 * 1/20 5376 146e3 10e3 * 1/10 829e3 22e6 1.5e6 * 1/5 157e6 3.8e9 280e6 */ real serr; ssig2 = l->ssig1 * csig12 + l->csig1 * ssig12; csig2 = l->csig1 * csig12 - l->ssig1 * ssig12; B12 = SinCosSeries(TRUE, ssig2, csig2, l->C1a, nC1); serr = (1 + l->A1m1) * (sig12 + (B12 - l->B11)) - s12_a12 / l->b; sig12 = sig12 - serr / sqrt(1 + l->k2 * sq(ssig2)); ssig12 = sin(sig12); csig12 = cos(sig12); /* Update B12 below */ } } /* sig2 = sig1 + sig12 */ ssig2 = l->ssig1 * csig12 + l->csig1 * ssig12; csig2 = l->csig1 * csig12 - l->ssig1 * ssig12; dn2 = sqrt(1 + l->k2 * sq(ssig2)); if (outmask & (GEOD_DISTANCE | GEOD_REDUCEDLENGTH | GEOD_GEODESICSCALE)) { if (flags & GEOD_ARCMODE || fabs(l->f) > 0.01) B12 = SinCosSeries(TRUE, ssig2, csig2, l->C1a, nC1); AB1 = (1 + l->A1m1) * (B12 - l->B11); } /* sin(bet2) = cos(alp0) * sin(sig2) */ sbet2 = l->calp0 * ssig2; /* Alt: cbet2 = hypot(csig2, salp0 * ssig2); */ cbet2 = hypot(l->salp0, l->calp0 * csig2); if (cbet2 == 0) /* I.e., salp0 = 0, csig2 = 0. Break the degeneracy in this case */ cbet2 = csig2 = tiny; /* tan(alp0) = cos(sig2)*tan(alp2) */ salp2 = l->salp0; calp2 = l->calp0 * csig2; /* No need to normalize */ if (outmask & GEOD_DISTANCE) s12 = (flags & GEOD_ARCMODE) ? l->b * ((1 + l->A1m1) * sig12 + AB1) : s12_a12; if (outmask & GEOD_LONGITUDE) { real E = copysign(1, l->salp0); /* east or west going? */ /* tan(omg2) = sin(alp0) * tan(sig2) */ somg2 = l->salp0 * ssig2; comg2 = csig2; /* No need to normalize */ /* omg12 = omg2 - omg1 */ omg12 = (flags & GEOD_LONG_UNROLL) ? E * (sig12 - (atan2( ssig2, csig2) - atan2( l->ssig1, l->csig1)) + (atan2(E * somg2, comg2) - atan2(E * l->somg1, l->comg1))) : atan2(somg2 * l->comg1 - comg2 * l->somg1, comg2 * l->comg1 + somg2 * l->somg1); lam12 = omg12 + l->A3c * ( sig12 + (SinCosSeries(TRUE, ssig2, csig2, l->C3a, nC3-1) - l->B31)); lon12 = lam12 / degree; lon2 = (flags & GEOD_LONG_UNROLL) ? l->lon1 + lon12 : AngNormalize(AngNormalize(l->lon1) + AngNormalize(lon12)); } if (outmask & GEOD_LATITUDE) lat2 = atan2dx(sbet2, l->f1 * cbet2); if (outmask & GEOD_AZIMUTH) azi2 = atan2dx(salp2, calp2); if (outmask & (GEOD_REDUCEDLENGTH | GEOD_GEODESICSCALE)) { real B22 = SinCosSeries(TRUE, ssig2, csig2, l->C2a, nC2), AB2 = (1 + l->A2m1) * (B22 - l->B21), J12 = (l->A1m1 - l->A2m1) * sig12 + (AB1 - AB2); if (outmask & GEOD_REDUCEDLENGTH) /* Add parens around (csig1 * ssig2) and (ssig1 * csig2) to ensure * accurate cancellation in the case of coincident points. */ m12 = l->b * ((dn2 * (l->csig1 * ssig2) - l->dn1 * (l->ssig1 * csig2)) - l->csig1 * csig2 * J12); if (outmask & GEOD_GEODESICSCALE) { real t = l->k2 * (ssig2 - l->ssig1) * (ssig2 + l->ssig1) / (l->dn1 + dn2); M12 = csig12 + (t * ssig2 - csig2 * J12) * l->ssig1 / l->dn1; M21 = csig12 - (t * l->ssig1 - l->csig1 * J12) * ssig2 / dn2; } } if (outmask & GEOD_AREA) { real B42 = SinCosSeries(FALSE, ssig2, csig2, l->C4a, nC4); real salp12, calp12; if (l->calp0 == 0 || l->salp0 == 0) { /* alp12 = alp2 - alp1, used in atan2 so no need to normalize */ salp12 = salp2 * l->calp1 - calp2 * l->salp1; calp12 = calp2 * l->calp1 + salp2 * l->salp1; } else { /* tan(alp) = tan(alp0) * sec(sig) * tan(alp2-alp1) = (tan(alp2) -tan(alp1)) / (tan(alp2)*tan(alp1)+1) * = calp0 * salp0 * (csig1-csig2) / (salp0^2 + calp0^2 * csig1*csig2) * If csig12 > 0, write * csig1 - csig2 = ssig12 * (csig1 * ssig12 / (1 + csig12) + ssig1) * else * csig1 - csig2 = csig1 * (1 - csig12) + ssig12 * ssig1 * No need to normalize */ salp12 = l->calp0 * l->salp0 * (csig12 <= 0 ? l->csig1 * (1 - csig12) + ssig12 * l->ssig1 : ssig12 * (l->csig1 * ssig12 / (1 + csig12) + l->ssig1)); calp12 = sq(l->salp0) + sq(l->calp0) * l->csig1 * csig2; } S12 = l->c2 * atan2(salp12, calp12) + l->A4 * (B42 - l->B41); } /* In the pattern * * if ((outmask & GEOD_XX) && pYY) * *pYY = YY; * * the second check "&& pYY" is redundant. It's there to make the CLang * static analyzer happy. */ if ((outmask & GEOD_LATITUDE) && plat2) *plat2 = lat2; if ((outmask & GEOD_LONGITUDE) && plon2) *plon2 = lon2; if ((outmask & GEOD_AZIMUTH) && pazi2) *pazi2 = azi2; if ((outmask & GEOD_DISTANCE) && ps12) *ps12 = s12; if ((outmask & GEOD_REDUCEDLENGTH) && pm12) *pm12 = m12; if (outmask & GEOD_GEODESICSCALE) { if (pM12) *pM12 = M12; if (pM21) *pM21 = M21; } if ((outmask & GEOD_AREA) && pS12) *pS12 = S12; return (flags & GEOD_ARCMODE) ? s12_a12 : sig12 / degree; } void geod_setdistance(struct geod_geodesicline* l, real s13) { l->s13 = s13; l->a13 = geod_genposition(l, GEOD_NOFLAGS, l->s13, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr); } static void geod_setarc(struct geod_geodesicline* l, real a13) { l->a13 = a13; l->s13 = NaN; geod_genposition(l, GEOD_ARCMODE, l->a13, nullptr, nullptr, nullptr, &l->s13, nullptr, nullptr, nullptr, nullptr); } void geod_gensetdistance(struct geod_geodesicline* l, unsigned flags, real s13_a13) { (flags & GEOD_ARCMODE) ? geod_setarc(l, s13_a13) : geod_setdistance(l, s13_a13); } void geod_position(const struct geod_geodesicline* l, real s12, real* plat2, real* plon2, real* pazi2) { geod_genposition(l, FALSE, s12, plat2, plon2, pazi2, nullptr, nullptr, nullptr, nullptr, nullptr); } real geod_gendirect(const struct geod_geodesic* g, real lat1, real lon1, real azi1, unsigned flags, real s12_a12, real* plat2, real* plon2, real* pazi2, real* ps12, real* pm12, real* pM12, real* pM21, real* pS12) { struct geod_geodesicline l; unsigned outmask = (plat2 ? GEOD_LATITUDE : GEOD_NONE) | (plon2 ? GEOD_LONGITUDE : GEOD_NONE) | (pazi2 ? GEOD_AZIMUTH : GEOD_NONE) | (ps12 ? GEOD_DISTANCE : GEOD_NONE) | (pm12 ? GEOD_REDUCEDLENGTH : GEOD_NONE) | (pM12 || pM21 ? GEOD_GEODESICSCALE : GEOD_NONE) | (pS12 ? GEOD_AREA : GEOD_NONE); geod_lineinit(&l, g, lat1, lon1, azi1, /* Automatically supply GEOD_DISTANCE_IN if necessary */ outmask | ((flags & GEOD_ARCMODE) ? GEOD_NONE : GEOD_DISTANCE_IN)); return geod_genposition(&l, flags, s12_a12, plat2, plon2, pazi2, ps12, pm12, pM12, pM21, pS12); } void geod_direct(const struct geod_geodesic* g, real lat1, real lon1, real azi1, real s12, real* plat2, real* plon2, real* pazi2) { geod_gendirect(g, lat1, lon1, azi1, GEOD_NOFLAGS, s12, plat2, plon2, pazi2, nullptr, nullptr, nullptr, nullptr, nullptr); } static real geod_geninverse_int(const struct geod_geodesic* g, real lat1, real lon1, real lat2, real lon2, real* ps12, real* psalp1, real* pcalp1, real* psalp2, real* pcalp2, real* pm12, real* pM12, real* pM21, real* pS12) { real s12 = 0, m12 = 0, M12 = 0, M21 = 0, S12 = 0; real lon12, lon12s; int latsign, lonsign, swapp; real sbet1, cbet1, sbet2, cbet2, s12x = 0, m12x = 0; real dn1, dn2, lam12, slam12, clam12; real a12 = 0, sig12, calp1 = 0, salp1 = 0, calp2 = 0, salp2 = 0; real Ca[nC]; boolx meridian; /* somg12 > 1 marks that it needs to be calculated */ real omg12 = 0, somg12 = 2, comg12 = 0; unsigned outmask = (ps12 ? GEOD_DISTANCE : GEOD_NONE) | (pm12 ? GEOD_REDUCEDLENGTH : GEOD_NONE) | (pM12 || pM21 ? GEOD_GEODESICSCALE : GEOD_NONE) | (pS12 ? GEOD_AREA : GEOD_NONE); outmask &= OUT_ALL; /* Compute longitude difference (AngDiff does this carefully). Result is * in [-180, 180] but -180 is only for west-going geodesics. 180 is for * east-going and meridional geodesics. */ lon12 = AngDiff(lon1, lon2, &lon12s); /* Make longitude difference positive. */ lonsign = lon12 >= 0 ? 1 : -1; /* If very close to being on the same half-meridian, then make it so. */ lon12 = lonsign * AngRound(lon12); lon12s = AngRound((180 - lon12) - lonsign * lon12s); lam12 = lon12 * degree; if (lon12 > 90) { sincosdx(lon12s, &slam12, &clam12); clam12 = -clam12; } else sincosdx(lon12, &slam12, &clam12); /* If really close to the equator, treat as on equator. */ lat1 = AngRound(LatFix(lat1)); lat2 = AngRound(LatFix(lat2)); /* Swap points so that point with higher (abs) latitude is point 1 * If one latitude is a nan, then it becomes lat1. */ swapp = fabs(lat1) < fabs(lat2) ? -1 : 1; if (swapp < 0) { lonsign *= -1; swapx(&lat1, &lat2); } /* Make lat1 <= 0 */ latsign = lat1 < 0 ? 1 : -1; lat1 *= latsign; lat2 *= latsign; /* Now we have * * 0 <= lon12 <= 180 * -90 <= lat1 <= 0 * lat1 <= lat2 <= -lat1 * * longsign, swapp, latsign register the transformation to bring the * coordinates to this canonical form. In all cases, 1 means no change was * made. We make these transformations so that there are few cases to * check, e.g., on verifying quadrants in atan2. In addition, this * enforces some symmetries in the results returned. */ sincosdx(lat1, &sbet1, &cbet1); sbet1 *= g->f1; /* Ensure cbet1 = +epsilon at poles */ norm2(&sbet1, &cbet1); cbet1 = maxx(tiny, cbet1); sincosdx(lat2, &sbet2, &cbet2); sbet2 *= g->f1; /* Ensure cbet2 = +epsilon at poles */ norm2(&sbet2, &cbet2); cbet2 = maxx(tiny, cbet2); /* If cbet1 < -sbet1, then cbet2 - cbet1 is a sensitive measure of the * |bet1| - |bet2|. Alternatively (cbet1 >= -sbet1), abs(sbet2) + sbet1 is * a better measure. This logic is used in assigning calp2 in Lambda12. * Sometimes these quantities vanish and in that case we force bet2 = +/- * bet1 exactly. An example where is is necessary is the inverse problem * 48.522876735459 0 -48.52287673545898293 179.599720456223079643 * which failed with Visual Studio 10 (Release and Debug) */ if (cbet1 < -sbet1) { if (cbet2 == cbet1) sbet2 = sbet2 < 0 ? sbet1 : -sbet1; } else { if (fabs(sbet2) == -sbet1) cbet2 = cbet1; } dn1 = sqrt(1 + g->ep2 * sq(sbet1)); dn2 = sqrt(1 + g->ep2 * sq(sbet2)); meridian = lat1 == -90 || slam12 == 0; if (meridian) { /* Endpoints are on a single full meridian, so the geodesic might lie on * a meridian. */ real ssig1, csig1, ssig2, csig2; calp1 = clam12; salp1 = slam12; /* Head to the target longitude */ calp2 = 1; salp2 = 0; /* At the target we're heading north */ /* tan(bet) = tan(sig) * cos(alp) */ ssig1 = sbet1; csig1 = calp1 * cbet1; ssig2 = sbet2; csig2 = calp2 * cbet2; /* sig12 = sig2 - sig1 */ sig12 = atan2(maxx((real)(0), csig1 * ssig2 - ssig1 * csig2), csig1 * csig2 + ssig1 * ssig2); Lengths(g, g->n, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, &s12x, &m12x, nullptr, (outmask & GEOD_GEODESICSCALE) ? &M12 : nullptr, (outmask & GEOD_GEODESICSCALE) ? &M21 : nullptr, Ca); /* Add the check for sig12 since zero length geodesics might yield m12 < * 0. Test case was * * echo 20.001 0 20.001 0 | GeodSolve -i * * In fact, we will have sig12 > pi/2 for meridional geodesic which is * not a shortest path. */ if (sig12 < 1 || m12x >= 0) { /* Need at least 2, to handle 90 0 90 180 */ if (sig12 < 3 * tiny || // Prevent negative s12 or m12 for short lines (sig12 < tol0 && (s12x < 0 || m12x < 0))) sig12 = m12x = s12x = 0; m12x *= g->b; s12x *= g->b; a12 = sig12 / degree; } else /* m12 < 0, i.e., prolate and too close to anti-podal */ meridian = FALSE; } if (!meridian && sbet1 == 0 && /* and sbet2 == 0 */ /* Mimic the way Lambda12 works with calp1 = 0 */ (g->f <= 0 || lon12s >= g->f * 180)) { /* Geodesic runs along equator */ calp1 = calp2 = 0; salp1 = salp2 = 1; s12x = g->a * lam12; sig12 = omg12 = lam12 / g->f1; m12x = g->b * sin(sig12); if (outmask & GEOD_GEODESICSCALE) M12 = M21 = cos(sig12); a12 = lon12 / g->f1; } else if (!meridian) { /* Now point1 and point2 belong within a hemisphere bounded by a * meridian and geodesic is neither meridional or equatorial. */ /* Figure a starting point for Newton's method */ real dnm = 0; sig12 = InverseStart(g, sbet1, cbet1, dn1, sbet2, cbet2, dn2, lam12, slam12, clam12, &salp1, &calp1, &salp2, &calp2, &dnm, Ca); if (sig12 >= 0) { /* Short lines (InverseStart sets salp2, calp2, dnm) */ s12x = sig12 * g->b * dnm; m12x = sq(dnm) * g->b * sin(sig12 / dnm); if (outmask & GEOD_GEODESICSCALE) M12 = M21 = cos(sig12 / dnm); a12 = sig12 / degree; omg12 = lam12 / (g->f1 * dnm); } else { /* Newton's method. This is a straightforward solution of f(alp1) = * lambda12(alp1) - lam12 = 0 with one wrinkle. f(alp) has exactly one * root in the interval (0, pi) and its derivative is positive at the * root. Thus f(alp) is positive for alp > alp1 and negative for alp < * alp1. During the course of the iteration, a range (alp1a, alp1b) is * maintained which brackets the root and with each evaluation of * f(alp) the range is shrunk, if possible. Newton's method is * restarted whenever the derivative of f is negative (because the new * value of alp1 is then further from the solution) or if the new * estimate of alp1 lies outside (0,pi); in this case, the new starting * guess is taken to be (alp1a + alp1b) / 2. */ real ssig1 = 0, csig1 = 0, ssig2 = 0, csig2 = 0, eps = 0, domg12 = 0; unsigned numit = 0; /* Bracketing range */ real salp1a = tiny, calp1a = 1, salp1b = tiny, calp1b = -1; boolx tripn = FALSE; boolx tripb = FALSE; for (; numit < maxit2; ++numit) { /* the WGS84 test set: mean = 1.47, sd = 1.25, max = 16 * WGS84 and random input: mean = 2.85, sd = 0.60 */ real dv = 0, v = Lambda12(g, sbet1, cbet1, dn1, sbet2, cbet2, dn2, salp1, calp1, slam12, clam12, &salp2, &calp2, &sig12, &ssig1, &csig1, &ssig2, &csig2, &eps, &domg12, numit < maxit1, &dv, Ca); /* Reversed test to allow escape with NaNs */ if (tripb || !(fabs(v) >= (tripn ? 8 : 1) * tol0)) break; /* Update bracketing values */ if (v > 0 && (numit > maxit1 || calp1/salp1 > calp1b/salp1b)) { salp1b = salp1; calp1b = calp1; } else if (v < 0 && (numit > maxit1 || calp1/salp1 < calp1a/salp1a)) { salp1a = salp1; calp1a = calp1; } if (numit < maxit1 && dv > 0) { real dalp1 = -v/dv; real sdalp1 = sin(dalp1), cdalp1 = cos(dalp1), nsalp1 = salp1 * cdalp1 + calp1 * sdalp1; if (nsalp1 > 0 && fabs(dalp1) < pi) { calp1 = calp1 * cdalp1 - salp1 * sdalp1; salp1 = nsalp1; norm2(&salp1, &calp1); /* In some regimes we don't get quadratic convergence because * slope -> 0. So use convergence conditions based on epsilon * instead of sqrt(epsilon). */ tripn = fabs(v) <= 16 * tol0; continue; } } /* Either dv was not positive or updated value was outside legal * range. Use the midpoint of the bracket as the next estimate. * This mechanism is not needed for the WGS84 ellipsoid, but it does * catch problems with more eccentric ellipsoids. Its efficacy is * such for the WGS84 test set with the starting guess set to alp1 = * 90deg: * the WGS84 test set: mean = 5.21, sd = 3.93, max = 24 * WGS84 and random input: mean = 4.74, sd = 0.99 */ salp1 = (salp1a + salp1b)/2; calp1 = (calp1a + calp1b)/2; norm2(&salp1, &calp1); tripn = FALSE; tripb = (fabs(salp1a - salp1) + (calp1a - calp1) < tolb || fabs(salp1 - salp1b) + (calp1 - calp1b) < tolb); } Lengths(g, eps, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, &s12x, &m12x, nullptr, (outmask & GEOD_GEODESICSCALE) ? &M12 : nullptr, (outmask & GEOD_GEODESICSCALE) ? &M21 : nullptr, Ca); m12x *= g->b; s12x *= g->b; a12 = sig12 / degree; if (outmask & GEOD_AREA) { /* omg12 = lam12 - domg12 */ real sdomg12 = sin(domg12), cdomg12 = cos(domg12); somg12 = slam12 * cdomg12 - clam12 * sdomg12; comg12 = clam12 * cdomg12 + slam12 * sdomg12; } } } if (outmask & GEOD_DISTANCE) s12 = 0 + s12x; /* Convert -0 to 0 */ if (outmask & GEOD_REDUCEDLENGTH) m12 = 0 + m12x; /* Convert -0 to 0 */ if (outmask & GEOD_AREA) { real /* From Lambda12: sin(alp1) * cos(bet1) = sin(alp0) */ salp0 = salp1 * cbet1, calp0 = hypot(calp1, salp1 * sbet1); /* calp0 > 0 */ real alp12; if (calp0 != 0 && salp0 != 0) { real /* From Lambda12: tan(bet) = tan(sig) * cos(alp) */ ssig1 = sbet1, csig1 = calp1 * cbet1, ssig2 = sbet2, csig2 = calp2 * cbet2, k2 = sq(calp0) * g->ep2, eps = k2 / (2 * (1 + sqrt(1 + k2)) + k2), /* Multiplier = a^2 * e^2 * cos(alpha0) * sin(alpha0). */ A4 = sq(g->a) * calp0 * salp0 * g->e2; real B41, B42; norm2(&ssig1, &csig1); norm2(&ssig2, &csig2); C4f(g, eps, Ca); B41 = SinCosSeries(FALSE, ssig1, csig1, Ca, nC4); B42 = SinCosSeries(FALSE, ssig2, csig2, Ca, nC4); S12 = A4 * (B42 - B41); } else /* Avoid problems with indeterminate sig1, sig2 on equator */ S12 = 0; if (!meridian && somg12 > 1) { somg12 = sin(omg12); comg12 = cos(omg12); } if (!meridian && /* omg12 < 3/4 * pi */ comg12 > -(real)(0.7071) && /* Long difference not too big */ sbet2 - sbet1 < (real)(1.75)) { /* Lat difference not too big */ /* Use tan(Gamma/2) = tan(omg12/2) * * (tan(bet1/2)+tan(bet2/2))/(1+tan(bet1/2)*tan(bet2/2)) * with tan(x/2) = sin(x)/(1+cos(x)) */ real domg12 = 1 + comg12, dbet1 = 1 + cbet1, dbet2 = 1 + cbet2; alp12 = 2 * atan2( somg12 * ( sbet1 * dbet2 + sbet2 * dbet1 ), domg12 * ( sbet1 * sbet2 + dbet1 * dbet2 ) ); } else { /* alp12 = alp2 - alp1, used in atan2 so no need to normalize */ real salp12 = salp2 * calp1 - calp2 * salp1, calp12 = calp2 * calp1 + salp2 * salp1; /* The right thing appears to happen if alp1 = +/-180 and alp2 = 0, viz * salp12 = -0 and alp12 = -180. However this depends on the sign * being attached to 0 correctly. The following ensures the correct * behavior. */ if (salp12 == 0 && calp12 < 0) { salp12 = tiny * calp1; calp12 = -1; } alp12 = atan2(salp12, calp12); } S12 += g->c2 * alp12; S12 *= swapp * lonsign * latsign; /* Convert -0 to 0 */ S12 += 0; } /* Convert calp, salp to azimuth accounting for lonsign, swapp, latsign. */ if (swapp < 0) { swapx(&salp1, &salp2); swapx(&calp1, &calp2); if (outmask & GEOD_GEODESICSCALE) swapx(&M12, &M21); } salp1 *= swapp * lonsign; calp1 *= swapp * latsign; salp2 *= swapp * lonsign; calp2 *= swapp * latsign; if (psalp1) *psalp1 = salp1; if (pcalp1) *pcalp1 = calp1; if (psalp2) *psalp2 = salp2; if (pcalp2) *pcalp2 = calp2; if (outmask & GEOD_DISTANCE) *ps12 = s12; if (outmask & GEOD_REDUCEDLENGTH) *pm12 = m12; if (outmask & GEOD_GEODESICSCALE) { if (pM12) *pM12 = M12; if (pM21) *pM21 = M21; } if (outmask & GEOD_AREA) *pS12 = S12; /* Returned value in [0, 180] */ return a12; } real geod_geninverse(const struct geod_geodesic* g, real lat1, real lon1, real lat2, real lon2, real* ps12, real* pazi1, real* pazi2, real* pm12, real* pM12, real* pM21, real* pS12) { real salp1, calp1, salp2, calp2, a12 = geod_geninverse_int(g, lat1, lon1, lat2, lon2, ps12, &salp1, &calp1, &salp2, &calp2, pm12, pM12, pM21, pS12); if (pazi1) *pazi1 = atan2dx(salp1, calp1); if (pazi2) *pazi2 = atan2dx(salp2, calp2); return a12; } void geod_inverseline(struct geod_geodesicline* l, const struct geod_geodesic* g, real lat1, real lon1, real lat2, real lon2, unsigned caps) { real salp1, calp1, a12 = geod_geninverse_int(g, lat1, lon1, lat2, lon2, nullptr, &salp1, &calp1, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr), azi1 = atan2dx(salp1, calp1); caps = caps ? caps : GEOD_DISTANCE_IN | GEOD_LONGITUDE; /* Ensure that a12 can be converted to a distance */ if (caps & (OUT_ALL & GEOD_DISTANCE_IN)) caps |= GEOD_DISTANCE; geod_lineinit_int(l, g, lat1, lon1, azi1, salp1, calp1, caps); geod_setarc(l, a12); } void geod_inverse(const struct geod_geodesic* g, real lat1, real lon1, real lat2, real lon2, real* ps12, real* pazi1, real* pazi2) { geod_geninverse(g, lat1, lon1, lat2, lon2, ps12, pazi1, pazi2, nullptr, nullptr, nullptr, nullptr); } real SinCosSeries(boolx sinp, real sinx, real cosx, const real c[], int n) { /* Evaluate * y = sinp ? sum(c[i] * sin( 2*i * x), i, 1, n) : * sum(c[i] * cos((2*i+1) * x), i, 0, n-1) * using Clenshaw summation. N.B. c[0] is unused for sin series * Approx operation count = (n + 5) mult and (2 * n + 2) add */ real ar, y0, y1; c += (n + sinp); /* Point to one beyond last element */ ar = 2 * (cosx - sinx) * (cosx + sinx); /* 2 * cos(2 * x) */ y0 = (n & 1) ? *--c : 0; y1 = 0; /* accumulators for sum */ /* Now n is even */ n /= 2; while (n--) { /* Unroll loop x 2, so accumulators return to their original role */ y1 = ar * y0 - y1 + *--c; y0 = ar * y1 - y0 + *--c; } return sinp ? 2 * sinx * cosx * y0 /* sin(2 * x) * y0 */ : cosx * (y0 - y1); /* cos(x) * (y0 - y1) */ } void Lengths(const struct geod_geodesic* g, real eps, real sig12, real ssig1, real csig1, real dn1, real ssig2, real csig2, real dn2, real cbet1, real cbet2, real* ps12b, real* pm12b, real* pm0, real* pM12, real* pM21, /* Scratch area of the right size */ real Ca[]) { real m0 = 0, J12 = 0, A1 = 0, A2 = 0; real Cb[nC]; /* Return m12b = (reduced length)/b; also calculate s12b = distance/b, * and m0 = coefficient of secular term in expression for reduced length. */ boolx redlp = pm12b || pm0 || pM12 || pM21; if (ps12b || redlp) { A1 = A1m1f(eps); C1f(eps, Ca); if (redlp) { A2 = A2m1f(eps); C2f(eps, Cb); m0 = A1 - A2; A2 = 1 + A2; } A1 = 1 + A1; } if (ps12b) { real B1 = SinCosSeries(TRUE, ssig2, csig2, Ca, nC1) - SinCosSeries(TRUE, ssig1, csig1, Ca, nC1); /* Missing a factor of b */ *ps12b = A1 * (sig12 + B1); if (redlp) { real B2 = SinCosSeries(TRUE, ssig2, csig2, Cb, nC2) - SinCosSeries(TRUE, ssig1, csig1, Cb, nC2); J12 = m0 * sig12 + (A1 * B1 - A2 * B2); } } else if (redlp) { /* Assume here that nC1 >= nC2 */ int l; for (l = 1; l <= nC2; ++l) Cb[l] = A1 * Ca[l] - A2 * Cb[l]; J12 = m0 * sig12 + (SinCosSeries(TRUE, ssig2, csig2, Cb, nC2) - SinCosSeries(TRUE, ssig1, csig1, Cb, nC2)); } if (pm0) *pm0 = m0; if (pm12b) /* Missing a factor of b. * Add parens around (csig1 * ssig2) and (ssig1 * csig2) to ensure * accurate cancellation in the case of coincident points. */ *pm12b = dn2 * (csig1 * ssig2) - dn1 * (ssig1 * csig2) - csig1 * csig2 * J12; if (pM12 || pM21) { real csig12 = csig1 * csig2 + ssig1 * ssig2; real t = g->ep2 * (cbet1 - cbet2) * (cbet1 + cbet2) / (dn1 + dn2); if (pM12) *pM12 = csig12 + (t * ssig2 - csig2 * J12) * ssig1 / dn1; if (pM21) *pM21 = csig12 - (t * ssig1 - csig1 * J12) * ssig2 / dn2; } } real Astroid(real x, real y) { /* Solve k^4+2*k^3-(x^2+y^2-1)*k^2-2*y^2*k-y^2 = 0 for positive root k. * This solution is adapted from Geocentric::Reverse. */ real k; real p = sq(x), q = sq(y), r = (p + q - 1) / 6; if ( !(q == 0 && r <= 0) ) { real /* Avoid possible division by zero when r = 0 by multiplying equations * for s and t by r^3 and r, resp. */ S = p * q / 4, /* S = r^3 * s */ r2 = sq(r), r3 = r * r2, /* The discriminant of the quadratic equation for T3. This is zero on * the evolute curve p^(1/3)+q^(1/3) = 1 */ disc = S * (S + 2 * r3); real u = r; real v, uv, w; if (disc >= 0) { real T3 = S + r3, T; /* Pick the sign on the sqrt to maximize abs(T3). This minimizes loss * of precision due to cancellation. The result is unchanged because * of the way the T is used in definition of u. */ T3 += T3 < 0 ? -sqrt(disc) : sqrt(disc); /* T3 = (r * t)^3 */ /* N.B. cbrt always returns the real root. cbrt(-8) = -2. */ T = cbrt(T3); /* T = r * t */ /* T can be zero; but then r2 / T -> 0. */ u += T + (T != 0 ? r2 / T : 0); } else { /* T is complex, but the way u is defined the result is real. */ real ang = atan2(sqrt(-disc), -(S + r3)); /* There are three possible cube roots. We choose the root which * avoids cancellation. Note that disc < 0 implies that r < 0. */ u += 2 * r * cos(ang / 3); } v = sqrt(sq(u) + q); /* guaranteed positive */ /* Avoid loss of accuracy when u < 0. */ uv = u < 0 ? q / (v - u) : u + v; /* u+v, guaranteed positive */ w = (uv - q) / (2 * v); /* positive? */ /* Rearrange expression for k to avoid loss of accuracy due to * subtraction. Division by 0 not possible because uv > 0, w >= 0. */ k = uv / (sqrt(uv + sq(w)) + w); /* guaranteed positive */ } else { /* q == 0 && r <= 0 */ /* y = 0 with |x| <= 1. Handle this case directly. * for y small, positive root is k = abs(y)/sqrt(1-x^2) */ k = 0; } return k; } real InverseStart(const struct geod_geodesic* g, real sbet1, real cbet1, real dn1, real sbet2, real cbet2, real dn2, real lam12, real slam12, real clam12, real* psalp1, real* pcalp1, /* Only updated if return val >= 0 */ real* psalp2, real* pcalp2, /* Only updated for short lines */ real* pdnm, /* Scratch area of the right size */ real Ca[]) { real salp1 = 0, calp1 = 0, salp2 = 0, calp2 = 0, dnm = 0; /* Return a starting point for Newton's method in salp1 and calp1 (function * value is -1). If Newton's method doesn't need to be used, return also * salp2 and calp2 and function value is sig12. */ real sig12 = -1, /* Return value */ /* bet12 = bet2 - bet1 in [0, pi); bet12a = bet2 + bet1 in (-pi, 0] */ sbet12 = sbet2 * cbet1 - cbet2 * sbet1, cbet12 = cbet2 * cbet1 + sbet2 * sbet1; real sbet12a; boolx shortline = cbet12 >= 0 && sbet12 < (real)(0.5) && cbet2 * lam12 < (real)(0.5); real somg12, comg12, ssig12, csig12; sbet12a = sbet2 * cbet1 + cbet2 * sbet1; if (shortline) { real sbetm2 = sq(sbet1 + sbet2), omg12; /* sin((bet1+bet2)/2)^2 * = (sbet1 + sbet2)^2 / ((sbet1 + sbet2)^2 + (cbet1 + cbet2)^2) */ sbetm2 /= sbetm2 + sq(cbet1 + cbet2); dnm = sqrt(1 + g->ep2 * sbetm2); omg12 = lam12 / (g->f1 * dnm); somg12 = sin(omg12); comg12 = cos(omg12); } else { somg12 = slam12; comg12 = clam12; } salp1 = cbet2 * somg12; calp1 = comg12 >= 0 ? sbet12 + cbet2 * sbet1 * sq(somg12) / (1 + comg12) : sbet12a - cbet2 * sbet1 * sq(somg12) / (1 - comg12); ssig12 = hypot(salp1, calp1); csig12 = sbet1 * sbet2 + cbet1 * cbet2 * comg12; if (shortline && ssig12 < g->etol2) { /* really short lines */ salp2 = cbet1 * somg12; calp2 = sbet12 - cbet1 * sbet2 * (comg12 >= 0 ? sq(somg12) / (1 + comg12) : 1 - comg12); norm2(&salp2, &calp2); /* Set return value */ sig12 = atan2(ssig12, csig12); } else if (fabs(g->n) > (real)(0.1) || /* No astroid calc if too eccentric */ csig12 >= 0 || ssig12 >= 6 * fabs(g->n) * pi * sq(cbet1)) { /* Nothing to do, zeroth order spherical approximation is OK */ } else { /* Scale lam12 and bet2 to x, y coordinate system where antipodal point * is at origin and singular point is at y = 0, x = -1. */ real y, lamscale, betscale; /* Volatile declaration needed to fix inverse case * 56.320923501171 0 -56.320923501171 179.664747671772880215 * which otherwise fails with g++ 4.4.4 x86 -O3 */ volatile real x; real lam12x = atan2(-slam12, -clam12); /* lam12 - pi */ if (g->f >= 0) { /* In fact f == 0 does not get here */ /* x = dlong, y = dlat */ { real k2 = sq(sbet1) * g->ep2, eps = k2 / (2 * (1 + sqrt(1 + k2)) + k2); lamscale = g->f * cbet1 * A3f(g, eps) * pi; } betscale = lamscale * cbet1; x = lam12x / lamscale; y = sbet12a / betscale; } else { /* f < 0 */ /* x = dlat, y = dlong */ real cbet12a = cbet2 * cbet1 - sbet2 * sbet1, bet12a = atan2(sbet12a, cbet12a); real m12b, m0; /* In the case of lon12 = 180, this repeats a calculation made in * Inverse. */ Lengths(g, g->n, pi + bet12a, sbet1, -cbet1, dn1, sbet2, cbet2, dn2, cbet1, cbet2, nullptr, &m12b, &m0, nullptr, nullptr, Ca); x = -1 + m12b / (cbet1 * cbet2 * m0 * pi); betscale = x < -(real)(0.01) ? sbet12a / x : -g->f * sq(cbet1) * pi; lamscale = betscale / cbet1; y = lam12x / lamscale; } if (y > -tol1 && x > -1 - xthresh) { /* strip near cut */ if (g->f >= 0) { salp1 = minx((real)(1), -(real)(x)); calp1 = - sqrt(1 - sq(salp1)); } else { calp1 = maxx((real)(x > -tol1 ? 0 : -1), (real)(x)); salp1 = sqrt(1 - sq(calp1)); } } else { /* Estimate alp1, by solving the astroid problem. * * Could estimate alpha1 = theta + pi/2, directly, i.e., * calp1 = y/k; salp1 = -x/(1+k); for f >= 0 * calp1 = x/(1+k); salp1 = -y/k; for f < 0 (need to check) * * However, it's better to estimate omg12 from astroid and use * spherical formula to compute alp1. This reduces the mean number of * Newton iterations for astroid cases from 2.24 (min 0, max 6) to 2.12 * (min 0 max 5). The changes in the number of iterations are as * follows: * * change percent * 1 5 * 0 78 * -1 16 * -2 0.6 * -3 0.04 * -4 0.002 * * The histogram of iterations is (m = number of iterations estimating * alp1 directly, n = number of iterations estimating via omg12, total * number of trials = 148605): * * iter m n * 0 148 186 * 1 13046 13845 * 2 93315 102225 * 3 36189 32341 * 4 5396 7 * 5 455 1 * 6 56 0 * * Because omg12 is near pi, estimate work with omg12a = pi - omg12 */ real k = Astroid(x, y); real omg12a = lamscale * ( g->f >= 0 ? -x * k/(1 + k) : -y * (1 + k)/k ); somg12 = sin(omg12a); comg12 = -cos(omg12a); /* Update spherical estimate of alp1 using omg12 instead of lam12 */ salp1 = cbet2 * somg12; calp1 = sbet12a - cbet2 * sbet1 * sq(somg12) / (1 - comg12); } } /* Sanity check on starting guess. Backwards check allows NaN through. */ if (!(salp1 <= 0)) norm2(&salp1, &calp1); else { salp1 = 1; calp1 = 0; } *psalp1 = salp1; *pcalp1 = calp1; if (shortline) *pdnm = dnm; if (sig12 >= 0) { *psalp2 = salp2; *pcalp2 = calp2; } return sig12; } real Lambda12(const struct geod_geodesic* g, real sbet1, real cbet1, real dn1, real sbet2, real cbet2, real dn2, real salp1, real calp1, real slam120, real clam120, real* psalp2, real* pcalp2, real* psig12, real* pssig1, real* pcsig1, real* pssig2, real* pcsig2, real* peps, real* pdomg12, boolx diffp, real* pdlam12, /* Scratch area of the right size */ real Ca[]) { real salp2 = 0, calp2 = 0, sig12 = 0, ssig1 = 0, csig1 = 0, ssig2 = 0, csig2 = 0, eps = 0, domg12 = 0, dlam12 = 0; real salp0, calp0; real somg1, comg1, somg2, comg2, somg12, comg12, lam12; real B312, eta, k2; if (sbet1 == 0 && calp1 == 0) /* Break degeneracy of equatorial line. This case has already been * handled. */ calp1 = -tiny; /* sin(alp1) * cos(bet1) = sin(alp0) */ salp0 = salp1 * cbet1; calp0 = hypot(calp1, salp1 * sbet1); /* calp0 > 0 */ /* tan(bet1) = tan(sig1) * cos(alp1) * tan(omg1) = sin(alp0) * tan(sig1) = tan(omg1)=tan(alp1)*sin(bet1) */ ssig1 = sbet1; somg1 = salp0 * sbet1; csig1 = comg1 = calp1 * cbet1; norm2(&ssig1, &csig1); /* norm2(&somg1, &comg1); -- don't need to normalize! */ /* Enforce symmetries in the case abs(bet2) = -bet1. Need to be careful * about this case, since this can yield singularities in the Newton * iteration. * sin(alp2) * cos(bet2) = sin(alp0) */ salp2 = cbet2 != cbet1 ? salp0 / cbet2 : salp1; /* calp2 = sqrt(1 - sq(salp2)) * = sqrt(sq(calp0) - sq(sbet2)) / cbet2 * and subst for calp0 and rearrange to give (choose positive sqrt * to give alp2 in [0, pi/2]). */ calp2 = cbet2 != cbet1 || fabs(sbet2) != -sbet1 ? sqrt(sq(calp1 * cbet1) + (cbet1 < -sbet1 ? (cbet2 - cbet1) * (cbet1 + cbet2) : (sbet1 - sbet2) * (sbet1 + sbet2))) / cbet2 : fabs(calp1); /* tan(bet2) = tan(sig2) * cos(alp2) * tan(omg2) = sin(alp0) * tan(sig2). */ ssig2 = sbet2; somg2 = salp0 * sbet2; csig2 = comg2 = calp2 * cbet2; norm2(&ssig2, &csig2); /* norm2(&somg2, &comg2); -- don't need to normalize! */ /* sig12 = sig2 - sig1, limit to [0, pi] */ sig12 = atan2(maxx((real)(0), csig1 * ssig2 - ssig1 * csig2), csig1 * csig2 + ssig1 * ssig2); /* omg12 = omg2 - omg1, limit to [0, pi] */ somg12 = maxx((real)(0), comg1 * somg2 - somg1 * comg2); comg12 = comg1 * comg2 + somg1 * somg2; /* eta = omg12 - lam120 */ eta = atan2(somg12 * clam120 - comg12 * slam120, comg12 * clam120 + somg12 * slam120); k2 = sq(calp0) * g->ep2; eps = k2 / (2 * (1 + sqrt(1 + k2)) + k2); C3f(g, eps, Ca); B312 = (SinCosSeries(TRUE, ssig2, csig2, Ca, nC3-1) - SinCosSeries(TRUE, ssig1, csig1, Ca, nC3-1)); domg12 = -g->f * A3f(g, eps) * salp0 * (sig12 + B312); lam12 = eta + domg12; if (diffp) { if (calp2 == 0) dlam12 = - 2 * g->f1 * dn1 / sbet1; else { Lengths(g, eps, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, nullptr, &dlam12, nullptr, nullptr, nullptr, Ca); dlam12 *= g->f1 / (calp2 * cbet2); } } *psalp2 = salp2; *pcalp2 = calp2; *psig12 = sig12; *pssig1 = ssig1; *pcsig1 = csig1; *pssig2 = ssig2; *pcsig2 = csig2; *peps = eps; *pdomg12 = domg12; if (diffp) *pdlam12 = dlam12; return lam12; } real A3f(const struct geod_geodesic* g, real eps) { /* Evaluate A3 */ return polyval(nA3 - 1, g->A3x, eps); } void C3f(const struct geod_geodesic* g, real eps, real c[]) { /* Evaluate C3 coeffs * Elements c[1] through c[nC3 - 1] are set */ real mult = 1; int o = 0, l; for (l = 1; l < nC3; ++l) { /* l is index of C3[l] */ int m = nC3 - l - 1; /* order of polynomial in eps */ mult *= eps; c[l] = mult * polyval(m, g->C3x + o, eps); o += m + 1; } } void C4f(const struct geod_geodesic* g, real eps, real c[]) { /* Evaluate C4 coeffs * Elements c[0] through c[nC4 - 1] are set */ real mult = 1; int o = 0, l; for (l = 0; l < nC4; ++l) { /* l is index of C4[l] */ int m = nC4 - l - 1; /* order of polynomial in eps */ c[l] = mult * polyval(m, g->C4x + o, eps); o += m + 1; mult *= eps; } } /* The scale factor A1-1 = mean value of (d/dsigma)I1 - 1 */ real A1m1f(real eps) { static const real coeff[] = { /* (1-eps)*A1-1, polynomial in eps2 of order 3 */ 1, 4, 64, 0, 256, }; int m = nA1/2; real t = polyval(m, coeff, sq(eps)) / coeff[m + 1]; return (t + eps) / (1 - eps); } /* The coefficients C1[l] in the Fourier expansion of B1 */ void C1f(real eps, real c[]) { static const real coeff[] = { /* C1[1]/eps^1, polynomial in eps2 of order 2 */ -1, 6, -16, 32, /* C1[2]/eps^2, polynomial in eps2 of order 2 */ -9, 64, -128, 2048, /* C1[3]/eps^3, polynomial in eps2 of order 1 */ 9, -16, 768, /* C1[4]/eps^4, polynomial in eps2 of order 1 */ 3, -5, 512, /* C1[5]/eps^5, polynomial in eps2 of order 0 */ -7, 1280, /* C1[6]/eps^6, polynomial in eps2 of order 0 */ -7, 2048, }; real eps2 = sq(eps), d = eps; int o = 0, l; for (l = 1; l <= nC1; ++l) { /* l is index of C1p[l] */ int m = (nC1 - l) / 2; /* order of polynomial in eps^2 */ c[l] = d * polyval(m, coeff + o, eps2) / coeff[o + m + 1]; o += m + 2; d *= eps; } } /* The coefficients C1p[l] in the Fourier expansion of B1p */ void C1pf(real eps, real c[]) { static const real coeff[] = { /* C1p[1]/eps^1, polynomial in eps2 of order 2 */ 205, -432, 768, 1536, /* C1p[2]/eps^2, polynomial in eps2 of order 2 */ 4005, -4736, 3840, 12288, /* C1p[3]/eps^3, polynomial in eps2 of order 1 */ -225, 116, 384, /* C1p[4]/eps^4, polynomial in eps2 of order 1 */ -7173, 2695, 7680, /* C1p[5]/eps^5, polynomial in eps2 of order 0 */ 3467, 7680, /* C1p[6]/eps^6, polynomial in eps2 of order 0 */ 38081, 61440, }; real eps2 = sq(eps), d = eps; int o = 0, l; for (l = 1; l <= nC1p; ++l) { /* l is index of C1p[l] */ int m = (nC1p - l) / 2; /* order of polynomial in eps^2 */ c[l] = d * polyval(m, coeff + o, eps2) / coeff[o + m + 1]; o += m + 2; d *= eps; } } /* The scale factor A2-1 = mean value of (d/dsigma)I2 - 1 */ real A2m1f(real eps) { static const real coeff[] = { /* (eps+1)*A2-1, polynomial in eps2 of order 3 */ -11, -28, -192, 0, 256, }; int m = nA2/2; real t = polyval(m, coeff, sq(eps)) / coeff[m + 1]; return (t - eps) / (1 + eps); } /* The coefficients C2[l] in the Fourier expansion of B2 */ void C2f(real eps, real c[]) { static const real coeff[] = { /* C2[1]/eps^1, polynomial in eps2 of order 2 */ 1, 2, 16, 32, /* C2[2]/eps^2, polynomial in eps2 of order 2 */ 35, 64, 384, 2048, /* C2[3]/eps^3, polynomial in eps2 of order 1 */ 15, 80, 768, /* C2[4]/eps^4, polynomial in eps2 of order 1 */ 7, 35, 512, /* C2[5]/eps^5, polynomial in eps2 of order 0 */ 63, 1280, /* C2[6]/eps^6, polynomial in eps2 of order 0 */ 77, 2048, }; real eps2 = sq(eps), d = eps; int o = 0, l; for (l = 1; l <= nC2; ++l) { /* l is index of C2[l] */ int m = (nC2 - l) / 2; /* order of polynomial in eps^2 */ c[l] = d * polyval(m, coeff + o, eps2) / coeff[o + m + 1]; o += m + 2; d *= eps; } } /* The scale factor A3 = mean value of (d/dsigma)I3 */ void A3coeff(struct geod_geodesic* g) { static const real coeff[] = { /* A3, coeff of eps^5, polynomial in n of order 0 */ -3, 128, /* A3, coeff of eps^4, polynomial in n of order 1 */ -2, -3, 64, /* A3, coeff of eps^3, polynomial in n of order 2 */ -1, -3, -1, 16, /* A3, coeff of eps^2, polynomial in n of order 2 */ 3, -1, -2, 8, /* A3, coeff of eps^1, polynomial in n of order 1 */ 1, -1, 2, /* A3, coeff of eps^0, polynomial in n of order 0 */ 1, 1, }; int o = 0, k = 0, j; for (j = nA3 - 1; j >= 0; --j) { /* coeff of eps^j */ int m = nA3 - j - 1 < j ? nA3 - j - 1 : j; /* order of polynomial in n */ g->A3x[k++] = polyval(m, coeff + o, g->n) / coeff[o + m + 1]; o += m + 2; } } /* The coefficients C3[l] in the Fourier expansion of B3 */ void C3coeff(struct geod_geodesic* g) { static const real coeff[] = { /* C3[1], coeff of eps^5, polynomial in n of order 0 */ 3, 128, /* C3[1], coeff of eps^4, polynomial in n of order 1 */ 2, 5, 128, /* C3[1], coeff of eps^3, polynomial in n of order 2 */ -1, 3, 3, 64, /* C3[1], coeff of eps^2, polynomial in n of order 2 */ -1, 0, 1, 8, /* C3[1], coeff of eps^1, polynomial in n of order 1 */ -1, 1, 4, /* C3[2], coeff of eps^5, polynomial in n of order 0 */ 5, 256, /* C3[2], coeff of eps^4, polynomial in n of order 1 */ 1, 3, 128, /* C3[2], coeff of eps^3, polynomial in n of order 2 */ -3, -2, 3, 64, /* C3[2], coeff of eps^2, polynomial in n of order 2 */ 1, -3, 2, 32, /* C3[3], coeff of eps^5, polynomial in n of order 0 */ 7, 512, /* C3[3], coeff of eps^4, polynomial in n of order 1 */ -10, 9, 384, /* C3[3], coeff of eps^3, polynomial in n of order 2 */ 5, -9, 5, 192, /* C3[4], coeff of eps^5, polynomial in n of order 0 */ 7, 512, /* C3[4], coeff of eps^4, polynomial in n of order 1 */ -14, 7, 512, /* C3[5], coeff of eps^5, polynomial in n of order 0 */ 21, 2560, }; int o = 0, k = 0, l, j; for (l = 1; l < nC3; ++l) { /* l is index of C3[l] */ for (j = nC3 - 1; j >= l; --j) { /* coeff of eps^j */ int m = nC3 - j - 1 < j ? nC3 - j - 1 : j; /* order of polynomial in n */ g->C3x[k++] = polyval(m, coeff + o, g->n) / coeff[o + m + 1]; o += m + 2; } } } /* The coefficients C4[l] in the Fourier expansion of I4 */ void C4coeff(struct geod_geodesic* g) { static const real coeff[] = { /* C4[0], coeff of eps^5, polynomial in n of order 0 */ 97, 15015, /* C4[0], coeff of eps^4, polynomial in n of order 1 */ 1088, 156, 45045, /* C4[0], coeff of eps^3, polynomial in n of order 2 */ -224, -4784, 1573, 45045, /* C4[0], coeff of eps^2, polynomial in n of order 3 */ -10656, 14144, -4576, -858, 45045, /* C4[0], coeff of eps^1, polynomial in n of order 4 */ 64, 624, -4576, 6864, -3003, 15015, /* C4[0], coeff of eps^0, polynomial in n of order 5 */ 100, 208, 572, 3432, -12012, 30030, 45045, /* C4[1], coeff of eps^5, polynomial in n of order 0 */ 1, 9009, /* C4[1], coeff of eps^4, polynomial in n of order 1 */ -2944, 468, 135135, /* C4[1], coeff of eps^3, polynomial in n of order 2 */ 5792, 1040, -1287, 135135, /* C4[1], coeff of eps^2, polynomial in n of order 3 */ 5952, -11648, 9152, -2574, 135135, /* C4[1], coeff of eps^1, polynomial in n of order 4 */ -64, -624, 4576, -6864, 3003, 135135, /* C4[2], coeff of eps^5, polynomial in n of order 0 */ 8, 10725, /* C4[2], coeff of eps^4, polynomial in n of order 1 */ 1856, -936, 225225, /* C4[2], coeff of eps^3, polynomial in n of order 2 */ -8448, 4992, -1144, 225225, /* C4[2], coeff of eps^2, polynomial in n of order 3 */ -1440, 4160, -4576, 1716, 225225, /* C4[3], coeff of eps^5, polynomial in n of order 0 */ -136, 63063, /* C4[3], coeff of eps^4, polynomial in n of order 1 */ 1024, -208, 105105, /* C4[3], coeff of eps^3, polynomial in n of order 2 */ 3584, -3328, 1144, 315315, /* C4[4], coeff of eps^5, polynomial in n of order 0 */ -128, 135135, /* C4[4], coeff of eps^4, polynomial in n of order 1 */ -2560, 832, 405405, /* C4[5], coeff of eps^5, polynomial in n of order 0 */ 128, 99099, }; int o = 0, k = 0, l, j; for (l = 0; l < nC4; ++l) { /* l is index of C4[l] */ for (j = nC4 - 1; j >= l; --j) { /* coeff of eps^j */ int m = nC4 - j - 1; /* order of polynomial in n */ g->C4x[k++] = polyval(m, coeff + o, g->n) / coeff[o + m + 1]; o += m + 2; } } } int transit(real lon1, real lon2) { real lon12; /* Return 1 or -1 if crossing prime meridian in east or west direction. * Otherwise return zero. */ /* Compute lon12 the same way as Geodesic::Inverse. */ lon1 = AngNormalize(lon1); lon2 = AngNormalize(lon2); lon12 = AngDiff(lon1, lon2, nullptr); return lon1 <= 0 && lon2 > 0 && lon12 > 0 ? 1 : (lon2 <= 0 && lon1 > 0 && lon12 < 0 ? -1 : 0); } int transitdirect(real lon1, real lon2) { /* Compute exactly the parity of int(ceil(lon2 / 360)) - int(ceil(lon1 / 360)) */ lon1 = remainder(lon1, (real)(720)); lon2 = remainder(lon2, (real)(720)); return ( (lon2 <= 0 && lon2 > -360 ? 1 : 0) - (lon1 <= 0 && lon1 > -360 ? 1 : 0) ); } void accini(real s[]) { /* Initialize an accumulator; this is an array with two elements. */ s[0] = s[1] = 0; } void acccopy(const real s[], real t[]) { /* Copy an accumulator; t = s. */ t[0] = s[0]; t[1] = s[1]; } void accadd(real s[], real y) { /* Add y to an accumulator. */ real u, z = sumx(y, s[1], &u); s[0] = sumx(z, s[0], &s[1]); if (s[0] == 0) s[0] = u; else s[1] = s[1] + u; } real accsum(const real s[], real y) { /* Return accumulator + y (but don't add to accumulator). */ real t[2]; acccopy(s, t); accadd(t, y); return t[0]; } void accneg(real s[]) { /* Negate an accumulator. */ s[0] = -s[0]; s[1] = -s[1]; } void accrem(real s[], real y) { /* Reduce to [-y/2, y/2]. */ s[0] = remainder(s[0], y); accadd(s, (real)(0)); } void geod_polygon_init(struct geod_polygon* p, boolx polylinep) { p->polyline = (polylinep != 0); geod_polygon_clear(p); } void geod_polygon_clear(struct geod_polygon* p) { p->lat0 = p->lon0 = p->lat = p->lon = NaN; accini(p->P); accini(p->A); p->num = p->crossings = 0; } void geod_polygon_addpoint(const struct geod_geodesic* g, struct geod_polygon* p, real lat, real lon) { lon = AngNormalize(lon); if (p->num == 0) { p->lat0 = p->lat = lat; p->lon0 = p->lon = lon; } else { real s12, S12 = 0; /* Initialize S12 to stop Visual Studio warning */ geod_geninverse(g, p->lat, p->lon, lat, lon, &s12, nullptr, nullptr, nullptr, nullptr, nullptr, p->polyline ? nullptr : &S12); accadd(p->P, s12); if (!p->polyline) { accadd(p->A, S12); p->crossings += transit(p->lon, lon); } p->lat = lat; p->lon = lon; } ++p->num; } void geod_polygon_addedge(const struct geod_geodesic* g, struct geod_polygon* p, real azi, real s) { if (p->num) { /* Do nothing is num is zero */ /* Initialize S12 to stop Visual Studio warning. Initialization of lat and * lon is to make CLang static analyzer happy. */ real lat = 0, lon = 0, S12 = 0; geod_gendirect(g, p->lat, p->lon, azi, GEOD_LONG_UNROLL, s, &lat, &lon, nullptr, nullptr, nullptr, nullptr, nullptr, p->polyline ? nullptr : &S12); accadd(p->P, s); if (!p->polyline) { accadd(p->A, S12); p->crossings += transitdirect(p->lon, lon); } p->lat = lat; p->lon = lon; ++p->num; } } unsigned geod_polygon_compute(const struct geod_geodesic* g, const struct geod_polygon* p, boolx reverse, boolx sign, real* pA, real* pP) { real s12, S12, t[2]; if (p->num < 2) { if (pP) *pP = 0; if (!p->polyline && pA) *pA = 0; return p->num; } if (p->polyline) { if (pP) *pP = p->P[0]; return p->num; } geod_geninverse(g, p->lat, p->lon, p->lat0, p->lon0, &s12, nullptr, nullptr, nullptr, nullptr, nullptr, &S12); if (pP) *pP = accsum(p->P, s12); acccopy(p->A, t); accadd(t, S12); if (pA) *pA = areareduceA(t, 4 * pi * g->c2, p->crossings + transit(p->lon, p->lon0), reverse, sign); return p->num; } unsigned geod_polygon_testpoint(const struct geod_geodesic* g, const struct geod_polygon* p, real lat, real lon, boolx reverse, boolx sign, real* pA, real* pP) { real perimeter, tempsum; int crossings, i; unsigned num = p->num + 1; if (num == 1) { if (pP) *pP = 0; if (!p->polyline && pA) *pA = 0; return num; } perimeter = p->P[0]; tempsum = p->polyline ? 0 : p->A[0]; crossings = p->crossings; for (i = 0; i < (p->polyline ? 1 : 2); ++i) { real s12, S12 = 0; /* Initialize S12 to stop Visual Studio warning */ geod_geninverse(g, i == 0 ? p->lat : lat, i == 0 ? p->lon : lon, i != 0 ? p->lat0 : lat, i != 0 ? p->lon0 : lon, &s12, nullptr, nullptr, nullptr, nullptr, nullptr, p->polyline ? nullptr : &S12); perimeter += s12; if (!p->polyline) { tempsum += S12; crossings += transit(i == 0 ? p->lon : lon, i != 0 ? p->lon0 : lon); } } if (pP) *pP = perimeter; if (p->polyline) return num; if (pA) *pA = areareduceB(tempsum, 4 * pi * g->c2, crossings, reverse, sign); return num; } unsigned geod_polygon_testedge(const struct geod_geodesic* g, const struct geod_polygon* p, real azi, real s, boolx reverse, boolx sign, real* pA, real* pP) { real perimeter, tempsum; int crossings; unsigned num = p->num + 1; if (num == 1) { /* we don't have a starting point! */ if (pP) *pP = NaN; if (!p->polyline && pA) *pA = NaN; return 0; } perimeter = p->P[0] + s; if (p->polyline) { if (pP) *pP = perimeter; return num; } tempsum = p->A[0]; crossings = p->crossings; { /* Initialization of lat, lon, and S12 is to make CLang static analyzer * happy. */ real lat = 0, lon = 0, s12, S12 = 0; geod_gendirect(g, p->lat, p->lon, azi, GEOD_LONG_UNROLL, s, &lat, &lon, nullptr, nullptr, nullptr, nullptr, nullptr, &S12); tempsum += S12; crossings += transitdirect(p->lon, lon); geod_geninverse(g, lat, lon, p->lat0, p->lon0, &s12, nullptr, nullptr, nullptr, nullptr, nullptr, &S12); perimeter += s12; tempsum += S12; crossings += transit(lon, p->lon0); } if (pP) *pP = perimeter; if (pA) *pA = areareduceB(tempsum, 4 * pi * g->c2, crossings, reverse, sign); return num; } void geod_polygonarea(const struct geod_geodesic* g, real lats[], real lons[], int n, real* pA, real* pP) { int i; struct geod_polygon p; geod_polygon_init(&p, FALSE); for (i = 0; i < n; ++i) geod_polygon_addpoint(g, &p, lats[i], lons[i]); geod_polygon_compute(g, &p, FALSE, TRUE, pA, pP); } real areareduceA(real area[], real area0, int crossings, boolx reverse, boolx sign) { accrem(area, area0); if (crossings & 1) accadd(area, (area[0] < 0 ? 1 : -1) * area0/2); /* area is with the clockwise sense. If !reverse convert to * counter-clockwise convention. */ if (!reverse) accneg(area); /* If sign put area in (-area0/2, area0/2], else put area in [0, area0) */ if (sign) { if (area[0] > area0/2) accadd(area, -area0); else if (area[0] <= -area0/2) accadd(area, +area0); } else { if (area[0] >= area0) accadd(area, -area0); else if (area[0] < 0) accadd(area, +area0); } return 0 + area[0]; } real areareduceB(real area, real area0, int crossings, boolx reverse, boolx sign) { area = remainder(area, area0); if (crossings & 1) area += (area < 0 ? 1 : -1) * area0/2; /* area is with the clockwise sense. If !reverse convert to * counter-clockwise convention. */ if (!reverse) area *= -1; /* If sign put area in (-area0/2, area0/2], else put area in [0, area0) */ if (sign) { if (area > area0/2) area -= area0; else if (area <= -area0/2) area += area0; } else { if (area >= area0) area -= area0; else if (area < 0) area += area0; } return 0 + area; } /** @endcond */ proj-8.2.1/src/param.cpp000644 000765 000024 00000016633 14164067106 015547 0ustar00keversstaff000000 000000 /* put parameters in linked list and retrieve */ #include #include #include #include #include #include "proj.h" #include "proj_internal.h" static void unquote_string(char* param_str) { size_t len = strlen(param_str); // Remove leading and terminating spaces after equal sign const char* equal = strstr(param_str, "=\""); if( equal && equal - param_str + 1 > 2 && param_str[len-1] == '"' ) { size_t dst = equal + 1 - param_str; size_t src = dst + 1; for( ; param_str[src]; dst++, src++) { if( param_str[src] == '"' ) { if( param_str[src+1] == '"' ) { src++; } else { break; } } param_str[dst] = param_str[src]; } param_str[dst] = '\0'; } } /* create parameter list entry */ paralist *pj_mkparam(const char *str) { paralist *newitem; if((newitem = (paralist *)malloc(sizeof(paralist) + strlen(str))) != nullptr) { newitem->used = 0; newitem->next = nullptr; if (*str == '+') ++str; (void)strcpy(newitem->param, str); unquote_string(newitem->param); } return newitem; } /* As pj_mkparam, but payload ends at first whitespace, rather than at end of */ paralist *pj_mkparam_ws (const char *str, const char **next_str) { paralist *newitem; size_t len = 0; if (nullptr==str) return nullptr; /* Find start and length of string */ while (isspace (*str)) str++; if (*str == '+') str++; bool in_string = false; for( ; str[len] != '\0'; len++ ) { if( in_string ) { if( str[len] == '"' && str[len+1] == '"' ) { len++; } else if( str[len] == '"' ) { in_string = false; } } else if( str[len] == '=' && str[len+1] == '"' ) { in_string = true; } else if( isspace(str[len]) ) { break; } } if( next_str ) *next_str = str + len; /* Use calloc to automagically 0-terminate the copy */ newitem = (paralist *) calloc (1, sizeof(paralist) + len + 1); if (nullptr==newitem) return nullptr; memcpy(newitem->param, str, len); unquote_string(newitem->param); newitem->used = 0; newitem->next = nullptr; return newitem; } /**************************************************************************************/ paralist *pj_param_exists (paralist *list, const char *parameter) { /*************************************************************************************** Determine whether a given parameter exists in a paralist. If it does, return a pointer to the corresponding list element - otherwise return 0. In support of the pipeline syntax, the search is terminated once a "+step" list element is reached, in which case a 0 is returned, unless the parameter searched for is actually "step", in which case a pointer to the "step" list element is returned. This function is equivalent to the pj_param (...) call with the "opt" argument set to the parameter name preceeeded by a 't'. But by using this one, one avoids writing the code allocating memory for a new copy of parameter name, and prepending the t (for compile time known names, this is obviously not an issue). ***************************************************************************************/ paralist *next = list; const char *c = strchr (parameter, '='); size_t len = strlen (parameter); if (c) len = c - parameter; if (list==nullptr) return nullptr; for (next = list; next; next = next->next) { if (0==strncmp (parameter, next->param, len) && (next->param[len]=='=' || next->param[len]==0)) { next->used = 1; return next; } if (0==strcmp (parameter, "step")) return nullptr; } return nullptr; } /************************************************************************/ /* pj_param() */ /* */ /* Test for presence or get parameter value. The first */ /* character in `opt' is a parameter type which can take the */ /* values: */ /* */ /* `t' - test for presence, return TRUE/FALSE in PROJVALUE.i */ /* `i' - integer value returned in PROJVALUE.i */ /* `d' - simple valued real input returned in PROJVALUE.f */ /* `r' - degrees (DMS translation applied), returned as */ /* radians in PROJVALUE.f */ /* `s' - string returned in PROJVALUE.s */ /* `b' - test for t/T/f/F, return in PROJVALUE.i */ /* */ /* Search is terminated when "step" is found, in which case */ /* 0 is returned, unless "step" was the target searched for. */ /* */ /************************************************************************/ PROJVALUE pj_param (PJ_CONTEXT *ctx, paralist *pl, const char *opt) { int type; unsigned l; PROJVALUE value = {0}; if ( ctx == nullptr ) ctx = pj_get_default_ctx(); type = *opt++; if (nullptr==strchr ("tbirds", type)) { fprintf(stderr, "invalid request to pj_param, fatal\n"); exit(1); } pl = pj_param_exists (pl, opt); if (type == 't') { value.i = pl != nullptr; return value; } /* Not found */ if (nullptr==pl) { /* Return value after the switch, so that the return path is */ /* taken in all cases */ switch (type) { case 'b': case 'i': value.i = 0; break; case 'd': case 'r': value.f = 0.; break; case 's': value.s = nullptr; break; } return value; } /* Found parameter - now find its value */ pl->used |= 1; l = (int) strlen(opt); opt = pl->param + l; if (*opt == '=') ++opt; switch (type) { case 'i': /* integer input */ value.i = atoi(opt); for( const char* ptr = opt; *ptr != '\0'; ++ptr ) { if( !(*ptr >= '0' && *ptr <= '9') ) { proj_context_errno_set (ctx, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); value.i = 0; } } break; case 'd': /* simple real input */ value.f = pj_atof(opt); break; case 'r': /* degrees input */ value.f = dmstor_ctx(ctx, opt, nullptr); break; case 's': /* char string */ value.s = (char *) opt; break; case 'b': /* boolean */ switch (*opt) { case 'F': case 'f': value.i = 0; break; case '\0': case 'T': case 't': value.i = 1; break; default: proj_context_errno_set (ctx, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); value.i = 0; break; } break; } return value; } proj-8.2.1/src/bin_projsync.cmake000644 000765 000024 00000000614 14140020570 017420 0ustar00keversstaff000000 000000 set(PROJSYNC_SRC apps/projsync.cpp) source_group("Source Files\\Bin" FILES ${PROJSYNC_SRC}) add_executable(bin_projsync ${PROJSYNC_SRC}) set_target_properties(bin_projsync PROPERTIES OUTPUT_NAME projsync) target_link_libraries(bin_projsync PRIVATE ${PROJ_LIBRARIES}) target_compile_options(bin_projsync PRIVATE ${PROJ_CXX_WARN_FLAGS}) install(TARGETS bin_projsync DESTINATION ${BINDIR}) proj-8.2.1/src/proj_json_streaming_writer.cpp000644 000765 000024 00000016327 13612256475 022125 0ustar00keversstaff000000 000000 /****************************************************************************** * * Project: CPL - Common Portability Library * Purpose: JSon streaming writer * Author: Even Rouault, even.rouault at spatialys.com * ****************************************************************************** * Copyright (c) 2019, Even Rouault * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. ****************************************************************************/ /*! @cond Doxygen_Suppress */ #include #include #include "proj_json_streaming_writer.hpp" #include #include #include #include #define CPLAssert(x) do {} while(0) #define CPLIsNan std::isnan #define CPLIsInf std::isinf #define CPL_FRMT_GIB "%lld" #define CPL_FRMT_GUIB "%llu" typedef std::uint64_t GUIntBig; static std::string CPLSPrintf(const char* fmt, ...) { std::string res; res.resize(256); va_list list; va_start(list, fmt); sqlite3_vsnprintf(256, &res[0], fmt, list); va_end(list); res.resize(strlen(&res[0])); return res; } NS_PROJ_START CPLJSonStreamingWriter::CPLJSonStreamingWriter( SerializationFuncType pfnSerializationFunc, void* pUserData): m_pfnSerializationFunc(pfnSerializationFunc), m_pUserData(pUserData) {} CPLJSonStreamingWriter::~CPLJSonStreamingWriter() { CPLAssert( m_nLevel == 0 ); CPLAssert( m_states.empty() ); } void CPLJSonStreamingWriter::Print(const std::string& text) { if( m_pfnSerializationFunc ) { m_pfnSerializationFunc(text.c_str(), m_pUserData); } else { m_osStr += text; } } void CPLJSonStreamingWriter::SetIndentationSize(int nSpaces) { CPLAssert( m_nLevel == 0 ); m_osIndent.clear(); m_osIndent.resize(nSpaces, ' '); } void CPLJSonStreamingWriter::IncIndent() { m_nLevel ++; if( m_bPretty ) m_osIndentAcc += m_osIndent; } void CPLJSonStreamingWriter::DecIndent() { CPLAssert(m_nLevel > 0); m_nLevel --; if( m_bPretty ) m_osIndentAcc.resize(m_osIndentAcc.size() - m_osIndent.size()); } std::string CPLJSonStreamingWriter::FormatString(const std::string& str) { std::string ret; ret += '"'; for( char ch: str ) { switch(ch) { case '"' : ret += "\\\""; break; case '\\': ret += "\\\\"; break; case '\b': ret += "\\b"; break; case '\f': ret += "\\f"; break; case '\n': ret += "\\n"; break; case '\r': ret += "\\r"; break; case '\t': ret += "\\t"; break; default: if( static_cast(ch) < ' ' ) ret += CPLSPrintf("\\u%04X", ch); else ret += ch; break; } } ret += '"'; return ret; } void CPLJSonStreamingWriter::EmitCommaIfNeeded() { if( m_bWaitForValue ) { m_bWaitForValue = false; } else if( !m_states.empty() ) { if( !m_states.back().bFirstChild ) { Print(","); if( m_bPretty && !m_bNewLineEnabled ) Print(" "); } if( m_bPretty && m_bNewLineEnabled ) { Print("\n"); Print(m_osIndentAcc); } m_states.back().bFirstChild = false; } } void CPLJSonStreamingWriter::StartObj() { EmitCommaIfNeeded(); Print("{"); IncIndent(); m_states.emplace_back(State(true)); } void CPLJSonStreamingWriter::EndObj() { CPLAssert(!m_bWaitForValue); CPLAssert( !m_states.empty() ); CPLAssert( m_states.back().bIsObj ); DecIndent(); if( !m_states.back().bFirstChild ) { if( m_bPretty && m_bNewLineEnabled ) { Print("\n"); Print(m_osIndentAcc); } } m_states.pop_back(); Print("}"); } void CPLJSonStreamingWriter::StartArray() { EmitCommaIfNeeded(); Print("["); IncIndent(); m_states.emplace_back(State(false)); } void CPLJSonStreamingWriter::EndArray() { CPLAssert( !m_states.empty() ); CPLAssert( !m_states.back().bIsObj ); DecIndent(); if( !m_states.back().bFirstChild ) { if( m_bPretty && m_bNewLineEnabled ) { Print("\n"); Print(m_osIndentAcc); } } m_states.pop_back(); Print("]"); } void CPLJSonStreamingWriter::AddObjKey(const std::string& key) { CPLAssert( !m_states.empty() ); CPLAssert( m_states.back().bIsObj ); CPLAssert(!m_bWaitForValue); EmitCommaIfNeeded(); Print(FormatString(key)); Print(m_bPretty ? ": " : ":"); m_bWaitForValue = true; } void CPLJSonStreamingWriter::Add(bool bVal) { EmitCommaIfNeeded(); Print(bVal ? "true" : "false"); } void CPLJSonStreamingWriter::Add(const std::string& str) { EmitCommaIfNeeded(); Print(FormatString(str)); } void CPLJSonStreamingWriter::Add(const char* pszStr) { EmitCommaIfNeeded(); Print(FormatString(pszStr)); } void CPLJSonStreamingWriter::Add(GIntBig nVal) { EmitCommaIfNeeded(); Print(CPLSPrintf(CPL_FRMT_GIB, nVal)); } void CPLJSonStreamingWriter::Add(GUInt64 nVal) { EmitCommaIfNeeded(); Print(CPLSPrintf(CPL_FRMT_GUIB, static_cast(nVal))); } void CPLJSonStreamingWriter::Add(float fVal, int nPrecision) { EmitCommaIfNeeded(); if( CPLIsNan(fVal) ) { Print("\"NaN\""); } else if( CPLIsInf(fVal) ) { Print( fVal > 0 ? "\"Infinity\"" : "\"-Infinity\"" ); } else { char szFormatting[10]; snprintf(szFormatting, sizeof(szFormatting), "%%.%dg", nPrecision); Print(CPLSPrintf(szFormatting, fVal)); } } void CPLJSonStreamingWriter::Add(double dfVal, int nPrecision) { EmitCommaIfNeeded(); if( CPLIsNan(dfVal) ) { Print("\"NaN\""); } else if( CPLIsInf(dfVal) ) { Print( dfVal > 0 ? "\"Infinity\"" : "\"-Infinity\"" ); } else { char szFormatting[10]; snprintf(szFormatting, sizeof(szFormatting), "%%.%dg", nPrecision); Print(CPLSPrintf(szFormatting, dfVal)); } } void CPLJSonStreamingWriter::AddNull() { EmitCommaIfNeeded(); Print("null"); } NS_PROJ_END /*! @endcond */ proj-8.2.1/src/mlfn.cpp000644 000765 000024 00000002557 14017154140 015373 0ustar00keversstaff000000 000000 #include #include "proj.h" #include "proj_internal.h" #include "mlfn.hpp" /* meridional distance for ellipsoid and inverse ** 8th degree - accurate to < 1e-5 meters when used in conjunction ** with typical major axis values. ** Inverse determines phi to EPS (1e-11) radians, about 1e-6 seconds. */ #define C00 1. #define C02 .25 #define C04 .046875 #define C06 .01953125 #define C08 .01068115234375 #define C22 .75 #define C44 .46875 #define C46 .01302083333333333333 #define C48 .00712076822916666666 #define C66 .36458333333333333333 #define C68 .00569661458333333333 #define C88 .3076171875 #define EN_SIZE 5 double *pj_enfn(double es) { double t, *en; en = (double *) malloc(EN_SIZE * sizeof (double)); if (nullptr==en) return nullptr; en[0] = C00 - es * (C02 + es * (C04 + es * (C06 + es * C08))); en[1] = es * (C22 - es * (C04 + es * (C06 + es * C08))); en[2] = (t = es * es) * (C44 - es * (C46 + es * C48)); en[3] = (t *= es) * (C66 - es * C68); en[4] = t * es * C88; return en; } double pj_mlfn(double phi, double sphi, double cphi, const double *en) { return inline_pj_mlfn(phi, sphi, cphi, en); } double pj_inv_mlfn(PJ_CONTEXT *ctx, double arg, double es, const double *en) { double sinphi_ignored; double cosphi_ignored; return inline_pj_inv_mlfn(ctx, arg, es, en, &sinphi_ignored, &cosphi_ignored); } proj-8.2.1/src/filemanager.hpp000644 000765 000024 00000007475 13747523460 016740 0ustar00keversstaff000000 000000 /****************************************************************************** * Project: PROJ * Purpose: File manager * Author: Even Rouault, * ****************************************************************************** * Copyright (c) 2019, Even Rouault, * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. *****************************************************************************/ #ifndef FILEMANAGER_HPP_INCLUDED #define FILEMANAGER_HPP_INCLUDED #include #include #include #include "proj.h" #include "proj/util.hpp" //! @cond Doxygen_Suppress NS_PROJ_START class File; enum class FileAccess { READ_ONLY, // "rb" READ_UPDATE, // "r+b" CREATE, // "w+b" }; class FileManager { private: FileManager() = delete; public: // "Low-level" interface. static PROJ_DLL std::unique_ptr open(PJ_CONTEXT *ctx, const char *filename, FileAccess access); static PROJ_DLL bool exists(PJ_CONTEXT *ctx, const char *filename); static bool mkdir(PJ_CONTEXT *ctx, const char *filename); static bool unlink(PJ_CONTEXT *ctx, const char *filename); static bool rename(PJ_CONTEXT *ctx, const char *oldPath, const char *newPath); static std::string getProjLibEnvVar(PJ_CONTEXT *ctx); // "High-level" interface, honoring PROJ_LIB and the like. static std::unique_ptr open_resource_file(PJ_CONTEXT *ctx, const char *name); static void fillDefaultNetworkInterface(PJ_CONTEXT *ctx); static void clearMemoryCache(); }; // --------------------------------------------------------------------------- class File { protected: std::string name_; std::string readLineBuffer_{}; bool eofReadLine_ = false; explicit File(const std::string &filename); public: virtual PROJ_DLL ~File(); virtual size_t read(void *buffer, size_t sizeBytes) = 0; virtual size_t write(const void *buffer, size_t sizeBytes) = 0; virtual bool seek(unsigned long long offset, int whence = SEEK_SET) = 0; virtual unsigned long long tell() = 0; virtual void reassign_context(PJ_CONTEXT *ctx) = 0; virtual bool hasChanged() const = 0; std::string PROJ_DLL read_line(size_t maxLen, bool &maxLenReached, bool &eofReached); const std::string &name() const { return name_; } }; // --------------------------------------------------------------------------- std::unique_ptr pj_network_file_open(PJ_CONTEXT *ctx, const char *filename); NS_PROJ_END // Exported for projsync std::vector PROJ_DLL pj_get_default_searchpaths(PJ_CONTEXT *ctx); //! @endcond Doxygen_Suppress #endif // FILEMANAGER_HPP_INCLUDED proj-8.2.1/src/list.cpp000644 000765 000024 00000001542 13437770506 015422 0ustar00keversstaff000000 000000 /* Projection System: default list of projections ** Use local definition of PJ_LIST_H for subset. */ #include "proj.h" #define USE_PJ_LIST_H 1 #include "proj_internal.h" /* Generate prototypes for projection functions */ #define PROJ_HEAD(id, name) extern "C" struct PJconsts *pj_##id(struct PJconsts*); #include "pj_list.h" #undef PROJ_HEAD /* Generate extern declarations for description strings */ #define PROJ_HEAD(id, name) extern "C" const char * const pj_s_##id; #include "pj_list.h" #undef PROJ_HEAD /* Generate the null-terminated list of projection functions with associated mnemonics and descriptions */ #define PROJ_HEAD(id, name) {#id, pj_##id, &pj_s_##id}, const struct PJ_LIST pj_list[] = { #include "pj_list.h" {nullptr, nullptr, nullptr}, }; #undef PROJ_HEAD const PJ_OPERATIONS *proj_list_operations(void) { return pj_list; } proj-8.2.1/src/internal.cpp000644 000765 000024 00000031635 14164067106 016262 0ustar00keversstaff000000 000000 /****************************************************************************** * Project: PROJ.4 * Purpose: This is primarily material originating from pj_obs_api.c * (now proj_4D_api.c), that does not fit into the API * category. Hence this pile of tubings and fittings for * PROJ.4 internal plumbing. * * Author: Thomas Knudsen, thokn@sdfe.dk, 2017-07-05 * ****************************************************************************** * Copyright (c) 2016, 2017, 2018, Thomas Knudsen/SDFE * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. *****************************************************************************/ #define FROM_PROJ_CPP #include #include #include #include #include #include #include #include "geodesic.h" #include "proj_internal.h" #include "proj/internal/internal.hpp" using namespace NS_PROJ::internal; enum pj_io_units pj_left (PJ *P) { enum pj_io_units u = P->inverted? P->right: P->left; if (u==PJ_IO_UNITS_CLASSIC) return PJ_IO_UNITS_PROJECTED; return u; } enum pj_io_units pj_right (PJ *P) { enum pj_io_units u = P->inverted? P->left: P->right; if (u==PJ_IO_UNITS_CLASSIC) return PJ_IO_UNITS_PROJECTED; return u; } /* Work around non-constness of MSVC HUGE_VAL by providing functions rather than constants */ PJ_COORD proj_coord_error (void) { PJ_COORD c; c.v[0] = c.v[1] = c.v[2] = c.v[3] = HUGE_VAL; return c; } /**************************************************************************************/ PJ_COORD pj_approx_2D_trans (PJ *P, PJ_DIRECTION direction, PJ_COORD coo) { /*************************************************************************************** Behave mostly as proj_trans, but attempt to use 2D interfaces only. Used in gie.c, to enforce testing 2D code, and by PJ_pipeline.c to implement chained calls starting out with a call to its 2D interface. ***************************************************************************************/ if (nullptr==P) return coo; if (P->inverted) direction = static_cast(-direction); switch (direction) { case PJ_FWD: { const auto xy = pj_fwd (coo.lp, P); coo.xy = xy; return coo; } case PJ_INV: { const auto lp = pj_inv (coo.xy, P); coo.lp = lp; return coo; } case PJ_IDENT: break; } return coo; } /**************************************************************************************/ PJ_COORD pj_approx_3D_trans (PJ *P, PJ_DIRECTION direction, PJ_COORD coo) { /*************************************************************************************** Companion to pj_approx_2D_trans. Behave mostly as proj_trans, but attempt to use 3D interfaces only. Used in gie.c, to enforce testing 3D code, and by PJ_pipeline.c to implement chained calls starting out with a call to its 3D interface. ***************************************************************************************/ if (nullptr==P) return coo; if (P->inverted) direction = static_cast(-direction); switch (direction) { case PJ_FWD: { const auto xyz = pj_fwd3d (coo.lpz, P); coo.xyz = xyz; return coo; } case PJ_INV: { const auto lpz = pj_inv3d (coo.xyz, P); coo.lpz = lpz; return coo; } case PJ_IDENT: break; } return coo; } /**************************************************************************************/ int pj_has_inverse(PJ *P) { /*************************************************************************************** Check if a a PJ has an inverse. ***************************************************************************************/ return ( (P->inverted && (P->fwd || P->fwd3d || P->fwd4d) ) || ( P->inv || P->inv3d || P->inv4d) ); } /* Move P to a new context - or to the default context if 0 is specified */ void proj_context_set (PJ *P, PJ_CONTEXT *ctx) { if (nullptr==ctx) ctx = pj_get_default_ctx (); proj_assign_context (P, ctx); } void proj_context_inherit (PJ *parent, PJ *child) { if (nullptr==parent) proj_assign_context (child, pj_get_default_ctx()); else proj_assign_context (child, pj_get_ctx(parent)); } /*****************************************************************************/ char *pj_chomp (char *c) { /****************************************************************************** Strip pre- and postfix whitespace. Inline comments (indicated by '#') are considered whitespace. ******************************************************************************/ size_t i, n; char *comment; char *start = c; if (nullptr==c) return nullptr; comment = strchr (c, '#'); if (comment) *comment = 0; n = strlen (c); if (0==n) return c; /* Eliminate postfix whitespace */ for (i = n - 1; (i > 0) && (isspace (c[i]) || ';'==c[i]); i--) c[i] = 0; /* Find start of non-whitespace */ while (0 != *start && (';'==*start || isspace (*start))) start++; n = strlen (start); if (0==n) { c[0] = 0; return c; } memmove (c, start, n + 1); return c; } /*****************************************************************************/ char *pj_shrink (char *c) { /****************************************************************************** Collapse repeated whitespace. Remove '+' and ';'. Make ',' and '=' greedy, consuming their surrounding whitespace. ******************************************************************************/ size_t i, j, n; /* Flag showing that a whitespace (ws) has been written after last non-ws */ bool ws = false; if (nullptr==c) return nullptr; pj_chomp (c); n = strlen (c); if (n==0) return c; /* First collapse repeated whitespace (including +/;) */ i = 0; bool in_string = false; for (j = 0; j < n; j++) { if( in_string ) { if( c[j] == '"' && c[j+1] == '"' ) { c[i++] = c[j]; j++; } else if( c[j] == '"' ) { in_string = false; } c[i++] = c[j]; continue; } /* Eliminate prefix '+', only if preceded by whitespace */ /* (i.e. keep it in 1.23e+08) */ if ((i > 0) && ('+'==c[j]) && ws) c[j] = ' '; if ((i==0) && ('+'==c[j])) c[j] = ' '; // Detect a string beginning after '=' if( c[j] == '"' && i > 0 && c[i-1] == '=' ) { in_string = true; ws = false; c[i++] = c[j]; continue; } if (isspace (c[j]) || ';'==c[j]) { if (false==ws && (i > 0)) c[i++] = ' '; ws = true; continue; } else { ws = false; c[i++] = c[j]; } } c[i] = 0; n = strlen(c); /* Then make ',' and '=' greedy */ i = 0; for (j = 0; j < n; j++) { if (i==0) { c[i++] = c[j]; continue; } /* Skip space before '='/',' */ if ('='==c[j] || ','==c[j]) { if (c[i - 1]==' ') c[i - 1] = c[j]; else c[i++] = c[j]; continue; } if (' '==c[j] && ('='==c[i - 1] || ','==c[i - 1]) ) continue; c[i++] = c[j]; } c[i] = 0; return c; } /*****************************************************************************/ size_t pj_trim_argc (char *args) { /****************************************************************************** Trim all unnecessary whitespace (and non-essential syntactic tokens) from the argument string, args, and count its number of elements. ******************************************************************************/ size_t i, m, n; pj_shrink (args); n = strlen (args); if (n==0) return 0; bool in_string = false; for (i = m = 0; i < n; i++) { if (in_string ) { if( args[i] == '"' && args[i+1] == '"' ) { i++; } else if( args[i] == '"' ) { in_string = false; } } else if (args[i] == '=' && args[i+1] == '"' ) { i++; in_string = true; } else if (' '==args[i]) { args[i] = 0; m++; } } return m + 1; } /*****************************************************************************/ char **pj_trim_argv (size_t argc, char *args) { /****************************************************************************** Create an argv-style array from elements placed in the argument string, args. args is a trimmed string as returned by pj_trim_argc(), and argc is the number of trimmed strings found (i.e. the return value of pj_trim_args()). Hence, int argc = pj_trim_argc (args); char **argv = pj_trim_argv (argc, args); will produce a classic style (argc, argv) pair from a string of whitespace separated args. No new memory is allocated for storing the individual args (they stay in the args string), but for the pointers to the args a new array is allocated and returned. It is the duty of the caller to free this array. ******************************************************************************/ if (nullptr==args) return nullptr; if (0==argc) return nullptr; /* turn the input string into an array of strings */ char** argv = (char **) calloc (argc, sizeof (char *)); if (nullptr==argv) return nullptr; for(size_t i = 0, j = 0; j < argc; j++) { argv[j] = args + i; char* str = argv[j]; size_t nLen = strlen(str); i += nLen + 1; } return argv; } /*****************************************************************************/ std::string pj_double_quote_string_param_if_needed(const std::string& str) { /*****************************************************************************/ if( str.find(' ') == std::string::npos ) { return str; } return '"' + replaceAll(str, "\"", "\"\"") + '"'; } /*****************************************************************************/ char *pj_make_args (size_t argc, char **argv) { /****************************************************************************** pj_make_args is the inverse of the pj_trim_argc/pj_trim_argv combo: It converts free format command line input to something proj_create can consume. Allocates, and returns, an array of char, large enough to hold a whitespace separated copy of the args in argv. It is the duty of the caller to free this array. ******************************************************************************/ try { std::string s; for( size_t i = 0; i < argc; i++ ) { const char* equal = strchr(argv[i], '='); if( equal ) { s += std::string(argv[i], equal - argv[i] + 1); s += pj_double_quote_string_param_if_needed(equal + 1); } else { s += argv[i]; } s += ' '; } char* p = pj_strdup(s.c_str()); return pj_shrink (p); } catch( const std::exception& ) { return nullptr; } } /*****************************************************************************/ void proj_context_errno_set (PJ_CONTEXT *ctx, int err) { /****************************************************************************** Raise an error directly on a context, without going through a PJ belonging to that context. ******************************************************************************/ if (nullptr==ctx) ctx = pj_get_default_ctx(); ctx->last_errno = err; if( err == 0 ) return; errno = err; } proj-8.2.1/src/wkt1_grammar.y000644 000765 000024 00000020161 13751504466 016526 0ustar00keversstaff000000 000000 %{ /****************************************************************************** * Project: PROJ * Purpose: WKT1 parser grammar * Author: Even Rouault, * ****************************************************************************** * Copyright (c) 2013-2018 Even Rouault, * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. ****************************************************************************/ #include "wkt1_parser.h" %} %define api.pure /* if the next %define is commented out, Bison 2.4 should be sufficient */ /* but will produce less prettier error messages */ %define parse.error verbose %require "3.0" %parse-param {pj_wkt1_parse_context *context} %lex-param {pj_wkt1_parse_context *context} %token T_PARAM_MT "PARAM_MT" %token T_CONCAT_MT "CONCAT_MT" %token T_INVERSE_MT "INVERSE_MT" %token T_PASSTHROUGH_MT "PASSTHROUGH_MT" %token T_PROJCS "PROJCS" %token T_PROJECTION "PROJECTION" %token T_GEOGCS "GEOGCS" %token T_DATUM "DATUM" %token T_SPHEROID "SPHEROID" %token T_PRIMEM "PRIMEM" %token T_UNIT "UNIT" %token T_GEOCCS "GEOCCS" %token T_AUTHORITY "AUTHORITY" %token T_VERT_CS "VERT_CS" // ESRI variation %token T_VERTCS "VERTCS" %token T_VERT_DATUM "VERT_DATUM" // ESRI variation %token T_VDATUM "VDATUM" %token T_COMPD_CS "COMPD_CS" %token T_AXIS "AXIS" %token T_TOWGS84 "TOWGS84" %token T_FITTED_CS "FITTED_CS" %token T_LOCAL_CS "LOCAL_CS" %token T_LOCAL_DATUM "LOCAL_DATUM" %token T_PARAMETER "PARAMETER" %token T_EXTENSION "EXTENSION" %token T_STRING "string" %token T_NUMBER "number" %token T_IDENTIFIER "identifier" %token END 0 "end of string" %% input: coordinate_system /* Derived from BNF grammar in OGC 01-009 OpenGIS Implementation */ /* Coordinate Transformation Services Revision 1.00 */ /* with the following additions : */ /* - accept an EXTENSION node at the end of GEOGCS, GEOCCS, PROJCS, COMPD_CS, VERT_DATUM */ /* - accept 3 parameters in TOWGS84 */ /* - accept LOCAL_CS["foo"] */ /* 7.1 Math Transform WKT */ begin_node: '[' | '(' begin_node_name: begin_node T_STRING end_node: ']' | ')' math_transform: param_mt | concat_mt | inv_mt | passthrough_mt param_mt: T_PARAM_MT begin_node_name opt_parameter_list end_node parameter: T_PARAMETER begin_node_name ',' T_NUMBER end_node opt_parameter_list: | ',' parameter opt_parameter_list concat_mt: T_CONCAT_MT begin_node math_transform opt_math_transform_list end_node opt_math_transform_list: | ',' math_transform opt_math_transform_list inv_mt: T_INVERSE_MT begin_node math_transform end_node passthrough_mt: T_PASSTHROUGH_MT begin_node integer ',' math_transform end_node /* FIXME */ integer: T_NUMBER /* 7.2 Coordinate System WKT */ coordinate_system: horz_cs_with_opt_esri_vertcs | geocentric_cs | vert_cs | compd_cs | fitted_cs | local_cs horz_cs_with_opt_esri_vertcs: horz_cs | horz_cs ',' esri_vert_cs horz_cs: geographic_cs | projected_cs /* opt_extension is an extension of the CT spec */ projected_cs: T_PROJCS begin_node_name ',' geographic_cs ',' projection ',' opt_parameter_list_linear_unit opt_twin_axis_extension_authority end_node opt_parameter_list_linear_unit: linear_unit | parameter_list_linear_unit parameter_list_linear_unit: parameter ',' parameter_list_linear_unit | parameter ',' linear_unit opt_twin_axis_extension_authority: | ',' twin_axis opt_extension_authority | ',' extension opt_authority | ',' authority opt_authority: | ',' authority extension: T_EXTENSION begin_node_name ',' T_STRING end_node projection: T_PROJECTION begin_node_name opt_authority end_node geographic_cs: T_GEOGCS begin_node_name',' datum ',' prime_meridian ',' angular_unit opt_twin_axis_extension_authority end_node datum: T_DATUM begin_node_name ',' spheroid opt_towgs84_authority_extension end_node opt_towgs84_authority_extension: | ',' towgs84 opt_extension_authority | ',' extension opt_authority | ',' authority spheroid: T_SPHEROID begin_node_name ',' semi_major_axis ',' inverse_flattening opt_authority end_node semi_major_axis: T_NUMBER inverse_flattening: T_NUMBER prime_meridian: T_PRIMEM begin_node_name ',' longitude opt_authority end_node longitude: T_NUMBER angular_unit: unit linear_unit: unit unit: T_UNIT begin_node_name ',' conversion_factor opt_authority end_node conversion_factor: T_NUMBER geocentric_cs: T_GEOCCS begin_node_name ',' datum ',' prime_meridian ',' linear_unit opt_three_axis_extension_authority end_node opt_three_axis_extension_authority: | ',' three_axis opt_extension_authority | ',' extension opt_authority | ',' authority three_axis: axis ',' axis ',' axis authority: T_AUTHORITY begin_node_name ',' T_STRING end_node vert_cs: T_VERT_CS begin_node_name ',' vert_datum ',' linear_unit opt_axis_authority end_node | esri_vert_cs esri_vert_cs: T_VERTCS begin_node_name ',' vdatum_or_datum ',' opt_parameter_list_linear_unit end_node opt_axis_authority: | ',' axis opt_authority | ',' authority vert_datum: T_VERT_DATUM begin_node_name ',' datum_type opt_extension_authority end_node vdatum_or_datum: vdatum | datum vdatum: T_VDATUM begin_node_name end_node opt_extension_authority: | ',' extension opt_authority | ',' authority datum_type: T_NUMBER compd_cs: T_COMPD_CS begin_node_name ',' head_cs ',' tail_cs opt_extension_authority end_node head_cs: horz_cs // Accepting a geographic CRS as part of the second CRS of a COMPD_CS is horrible // but found in LAS WKT tail_cs: geographic_cs | vert_cs twin_axis: axis ',' axis axis: T_AXIS begin_node_name ',' T_IDENTIFIER end_node /* Extension of the CT spec */ /* | T_AXIS '[' T_STRING ',' T_STRING ']'*/ towgs84: T_TOWGS84 begin_node towgs84_parameters end_node towgs84_parameters: seven_parameters /* Extension of the CT spec */ | three_parameters three_parameters: dx ',' dy ',' dz seven_parameters: dx ',' dy ',' dz ',' ex ',' ey ',' ez ',' ppm dx: T_NUMBER dy: T_NUMBER dz: T_NUMBER ex: T_NUMBER ey: T_NUMBER ez: T_NUMBER ppm: T_NUMBER fitted_cs: T_FITTED_CS begin_node_name ',' to_base ',' base_cs end_node to_base: math_transform base_cs: coordinate_system local_cs: T_LOCAL_CS begin_node_name ',' local_datum ',' unit ',' axis opt_axis_list_authority end_node /* Extension of the CT spec: accept only name */ | T_LOCAL_CS begin_node_name end_node opt_axis_list_authority: | ',' authority | ',' axis opt_axis_list_authority local_datum: T_LOCAL_DATUM begin_node_name ',' datum_type opt_authority end_node proj-8.2.1/src/sqlite3_utils.cpp000644 000765 000024 00000016777 14067153334 017265 0ustar00keversstaff000000 000000 /****************************************************************************** * Project: PROJ * Purpose: SQLite3 related utilities * Author: Even Rouault, * ****************************************************************************** * Copyright (c) 2019, Even Rouault, * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. *****************************************************************************/ #ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Weffc++" #endif #include "sqlite3_utils.hpp" #ifdef __GNUC__ #pragma GCC diagnostic pop #endif #include #include #include // std::ostringstream NS_PROJ_START // --------------------------------------------------------------------------- SQLite3VFS::SQLite3VFS(pj_sqlite3_vfs *vfs) : vfs_(vfs) {} // --------------------------------------------------------------------------- SQLite3VFS::~SQLite3VFS() { if (vfs_) { sqlite3_vfs_unregister(vfs_); delete vfs_; } } // --------------------------------------------------------------------------- const char *SQLite3VFS::name() const { return vfs_->namePtr.c_str(); } // --------------------------------------------------------------------------- typedef int (*ClosePtr)(sqlite3_file *); // --------------------------------------------------------------------------- static int VFSClose(sqlite3_file *file) { sqlite3_vfs *defaultVFS = sqlite3_vfs_find(nullptr); assert(defaultVFS); ClosePtr defaultClosePtr; std::memcpy(&defaultClosePtr, reinterpret_cast(file) + defaultVFS->szOsFile, sizeof(ClosePtr)); void *methods = const_cast(file->pMethods); int ret = defaultClosePtr(file); std::free(methods); return ret; } // --------------------------------------------------------------------------- static int VSFNoOpLockUnlockSync(sqlite3_file *, int) { return SQLITE_OK; } // --------------------------------------------------------------------------- static int VFSCustomOpen(sqlite3_vfs *vfs, const char *name, sqlite3_file *file, int flags, int *outFlags) { auto realVFS = static_cast(vfs); sqlite3_vfs *defaultVFS = static_cast(vfs->pAppData); int ret = defaultVFS->xOpen(defaultVFS, name, file, flags, outFlags); if (ret == SQLITE_OK) { ClosePtr defaultClosePtr = file->pMethods->xClose; assert(defaultClosePtr); sqlite3_io_methods *methods = static_cast( std::malloc(sizeof(sqlite3_io_methods))); if (!methods) { file->pMethods->xClose(file); return SQLITE_NOMEM; } memcpy(methods, file->pMethods, sizeof(sqlite3_io_methods)); methods->xClose = VFSClose; if (realVFS->fakeSync) { // Disable xSync because it can be significantly slow and we don't // need // that level of data integrity guarantee for the cache. methods->xSync = VSFNoOpLockUnlockSync; } if (realVFS->fakeLock) { methods->xLock = VSFNoOpLockUnlockSync; methods->xUnlock = VSFNoOpLockUnlockSync; } file->pMethods = methods; // Save original xClose pointer at end of file structure std::memcpy(reinterpret_cast(file) + defaultVFS->szOsFile, &defaultClosePtr, sizeof(ClosePtr)); } return ret; } // --------------------------------------------------------------------------- static int VFSCustomAccess(sqlite3_vfs *vfs, const char *zName, int flags, int *pResOut) { sqlite3_vfs *defaultVFS = static_cast(vfs->pAppData); // Do not bother stat'ing for journal or wal files if (std::strstr(zName, "-journal") || std::strstr(zName, "-wal")) { *pResOut = false; return SQLITE_OK; } return defaultVFS->xAccess(defaultVFS, zName, flags, pResOut); } // --------------------------------------------------------------------------- // SQLite3 logging infrastructure static void projSqlite3LogCallback(void *, int iErrCode, const char *zMsg) { fprintf(stderr, "SQLite3 message: (code %d) %s\n", iErrCode, zMsg); } std::unique_ptr SQLite3VFS::create(bool fakeSync, bool fakeLock, bool skipStatJournalAndWAL) { // Install SQLite3 logger if PROJ_LOG_SQLITE3 env var is defined struct InstallSqliteLogger { InstallSqliteLogger() { if (getenv("PROJ_LOG_SQLITE3") != nullptr) { sqlite3_config(SQLITE_CONFIG_LOG, projSqlite3LogCallback, nullptr); } } }; static InstallSqliteLogger installSqliteLogger; // Call to sqlite3_initialize() is normally not needed, except for // people building SQLite3 with -DSQLITE_OMIT_AUTOINIT sqlite3_initialize(); sqlite3_vfs *defaultVFS = sqlite3_vfs_find(nullptr); assert(defaultVFS); auto vfs = new pj_sqlite3_vfs(); vfs->fakeSync = fakeSync; vfs->fakeLock = fakeLock; auto vfsUnique = std::unique_ptr(new SQLite3VFS(vfs)); std::ostringstream buffer; buffer << vfs; vfs->namePtr = buffer.str(); vfs->iVersion = 1; vfs->szOsFile = defaultVFS->szOsFile + sizeof(ClosePtr); vfs->mxPathname = defaultVFS->mxPathname; vfs->zName = vfs->namePtr.c_str(); vfs->pAppData = defaultVFS; vfs->xOpen = VFSCustomOpen; vfs->xDelete = defaultVFS->xDelete; vfs->xAccess = skipStatJournalAndWAL ? VFSCustomAccess : defaultVFS->xAccess; vfs->xFullPathname = defaultVFS->xFullPathname; vfs->xDlOpen = defaultVFS->xDlOpen; vfs->xDlError = defaultVFS->xDlError; vfs->xDlSym = defaultVFS->xDlSym; vfs->xDlClose = defaultVFS->xDlClose; vfs->xRandomness = defaultVFS->xRandomness; vfs->xSleep = defaultVFS->xSleep; vfs->xCurrentTime = defaultVFS->xCurrentTime; vfs->xGetLastError = defaultVFS->xGetLastError; vfs->xCurrentTimeInt64 = defaultVFS->xCurrentTimeInt64; if (sqlite3_vfs_register(vfs, false) == SQLITE_OK) { return vfsUnique; } delete vfsUnique->vfs_; vfsUnique->vfs_ = nullptr; return nullptr; } // --------------------------------------------------------------------------- SQLiteStatement::SQLiteStatement(sqlite3_stmt *hStmtIn) : hStmt(hStmtIn) {} // --------------------------------------------------------------------------- NS_PROJ_END proj-8.2.1/src/ctx.cpp000644 000765 000024 00000016352 14067153334 015244 0ustar00keversstaff000000 000000 /****************************************************************************** * Project: PROJ.4 * Purpose: Implementation of the PJ_CONTEXT thread context object. * Author: Frank Warmerdam, warmerdam@pobox.com * ****************************************************************************** * Copyright (c) 2010, Frank Warmerdam * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. *****************************************************************************/ #ifndef FROM_PROJ_CPP #define FROM_PROJ_CPP #endif #include #include #include #include #include "proj_experimental.h" #include "proj_internal.h" #include "filemanager.hpp" #include "proj/internal/io_internal.hpp" /************************************************************************/ /* pj_get_ctx() */ /************************************************************************/ PJ_CONTEXT* pj_get_ctx( PJ *pj ) { if (nullptr==pj) return pj_get_default_ctx (); if (nullptr==pj->ctx) return pj_get_default_ctx (); return pj->ctx; } /************************************************************************/ /* proj_assign_context() */ /************************************************************************/ /** \brief Re-assign a context to a PJ* object. * * This may be useful if the PJ* has been created with a context that is * thread-specific, and is later used in another thread. In that case, * the user may want to assign another thread-specific context to the * object. */ void proj_assign_context( PJ* pj, PJ_CONTEXT *ctx ) { if (pj==nullptr) return; pj->ctx = ctx; if( pj->reassign_context ) { pj->reassign_context(pj, ctx); } for( const auto &alt: pj->alternativeCoordinateOperations ) { proj_assign_context(alt.pj, ctx); } } /************************************************************************/ /* createDefault() */ /************************************************************************/ pj_ctx pj_ctx::createDefault() { pj_ctx ctx; ctx.debug_level = PJ_LOG_ERROR; ctx.logger = pj_stderr_logger; NS_PROJ::FileManager::fillDefaultNetworkInterface(&ctx); const char* projDebug = getenv("PROJ_DEBUG"); if( projDebug != nullptr ) { const int debugLevel = atoi(projDebug); if( debugLevel >= -PJ_LOG_TRACE ) ctx.debug_level = debugLevel; else ctx.debug_level = PJ_LOG_TRACE; } return ctx; } /**************************************************************************/ /* get_cpp_context() */ /**************************************************************************/ projCppContext* pj_ctx::get_cpp_context() { if (cpp_context == nullptr) { cpp_context = new projCppContext(this); } return cpp_context; } /************************************************************************/ /* set_search_paths() */ /************************************************************************/ void pj_ctx::set_search_paths(const std::vector& search_paths_in ) { search_paths = search_paths_in; delete[] c_compat_paths; c_compat_paths = nullptr; if( !search_paths.empty() ) { c_compat_paths = new const char*[search_paths.size()]; for( size_t i = 0; i < search_paths.size(); ++i ) { c_compat_paths[i] = search_paths[i].c_str(); } } } /**************************************************************************/ /* set_ca_bundle_path() */ /**************************************************************************/ void pj_ctx::set_ca_bundle_path(const std::string& ca_bundle_path_in) { ca_bundle_path = ca_bundle_path_in; } /************************************************************************/ /* pj_ctx(const pj_ctx& other) */ /************************************************************************/ pj_ctx::pj_ctx(const pj_ctx& other) : debug_level(other.debug_level), logger(other.logger), logger_app_data(other.logger_app_data), cpp_context(other.cpp_context ? other.cpp_context->clone(this) : nullptr), use_proj4_init_rules(other.use_proj4_init_rules), epsg_file_exists(other.epsg_file_exists), ca_bundle_path(other.ca_bundle_path), env_var_proj_lib(other.env_var_proj_lib), file_finder(other.file_finder), file_finder_user_data(other.file_finder_user_data), custom_sqlite3_vfs_name(other.custom_sqlite3_vfs_name), user_writable_directory(other.user_writable_directory), // BEGIN ini file settings iniFileLoaded(other.iniFileLoaded), endpoint(other.endpoint), networking(other.networking), gridChunkCache(other.gridChunkCache), defaultTmercAlgo(other.defaultTmercAlgo) // END ini file settings { set_search_paths(other.search_paths); } /************************************************************************/ /* pj_get_default_ctx() */ /************************************************************************/ PJ_CONTEXT* pj_get_default_ctx() { // C++11 rules guarantee a thread-safe instantiation. static pj_ctx default_context(pj_ctx::createDefault()); return &default_context; } /************************************************************************/ /* ~pj_ctx() */ /************************************************************************/ pj_ctx::~pj_ctx() { delete[] c_compat_paths; proj_context_delete_cpp_context(cpp_context); } /************************************************************************/ /* proj_context_clone() */ /* Create a new context based on a custom context */ /************************************************************************/ PJ_CONTEXT* proj_context_clone (PJ_CONTEXT *ctx) { if (nullptr==ctx) return proj_context_create(); return new (std::nothrow) pj_ctx(*ctx); } proj-8.2.1/src/deriv.cpp000644 000765 000024 00000002343 13437770506 015560 0ustar00keversstaff000000 000000 /* dervative of (*P->fwd) projection */ #define PJ_LIB__ #include #include "proj.h" #include "proj_internal.h" int pj_deriv(PJ_LP lp, double h, const PJ *P, struct DERIVS *der) { PJ_XY t; /* get rid of constness until we can do it for real */ PJ *Q = (PJ *) P; if (nullptr==Q->fwd) return 1; lp.lam += h; lp.phi += h; if (fabs(lp.phi) > M_HALFPI) return 1; h += h; t = (*Q->fwd)(lp, Q); if (t.x == HUGE_VAL) return 1; der->x_l = t.x; der->y_p = t.y; der->x_p = t.x; der->y_l = t.y; lp.phi -= h; if (fabs(lp.phi) > M_HALFPI) return 1; t = (*Q->fwd)(lp, Q); if (t.x == HUGE_VAL) return 1; der->x_l += t.x; der->y_p -= t.y; der->x_p -= t.x; der->y_l += t.y; lp.lam -= h; t = (*Q->fwd)(lp, Q); if (t.x == HUGE_VAL) return 1; der->x_l -= t.x; der->y_p -= t.y; der->x_p -= t.x; der->y_l -= t.y; lp.phi += h; t = (*Q->fwd)(lp, Q); if (t.x == HUGE_VAL) return 1; der->x_l -= t.x; der->y_p += t.y; der->x_p += t.x; der->y_l -= t.y; h += h; der->x_l /= h; der->y_p /= h; der->x_p /= h; der->y_l /= h; return 0; } proj-8.2.1/src/proj_internal.h000644 000765 000024 00000103431 14164067106 016753 0ustar00keversstaff000000 000000 /****************************************************************************** * Project: PROJ.4 * Purpose: Internal plumbing for the PROJ.4 library. * * Author: Thomas Knudsen, * ****************************************************************************** * Copyright (c) 2016, 2017, Thomas Knudsen / SDFE * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO COORD SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. *****************************************************************************/ #ifndef PROJ_INTERNAL_H #define PROJ_INTERNAL_H #ifndef __cplusplus #error "proj_internal.h can only be included from a C++ file" #endif #ifdef _MSC_VER # ifndef _CRT_SECURE_NO_DEPRECATE # define _CRT_SECURE_NO_DEPRECATE # endif # ifndef _CRT_NONSTDC_NO_DEPRECATE # define _CRT_NONSTDC_NO_DEPRECATE # endif /* enable predefined math constants M_* for MS Visual Studio workaround */ # ifndef _USE_MATH_DEFINES # define _USE_MATH_DEFINES # endif #endif /* standard inclusions */ #include #include #include #include #include #include #include "proj/common.hpp" #include "proj/coordinateoperation.hpp" #include #include #include "proj.h" #ifdef PROJ_RENAME_SYMBOLS #include "proj_symbol_rename.h" #endif #define STATIC_ASSERT(COND) ((void)sizeof(char[(COND) ? 1 : -1])) #ifndef PJ_TODEG #define PJ_TODEG(rad) ((rad)*180.0/M_PI) #endif #ifndef PJ_TORAD #define PJ_TORAD(deg) ((deg)*M_PI/180.0) #endif /* Maximum latitudinal overshoot accepted */ #define PJ_EPS_LAT 1e-12 #define C_NAMESPACE extern "C" #define C_NAMESPACE_VAR extern "C" #ifndef NULL # define NULL 0 #endif #ifndef FALSE # define FALSE 0 #endif #ifndef TRUE # define TRUE 1 #endif #ifndef MAX # define MIN(a,b) ((ab) ? a : b) #endif #ifndef ABS # define ABS(x) ((x<0) ? (-1*(x)) : x) #endif #if INT_MAX == 2147483647 typedef int pj_int32; #elif LONG_MAX == 2147483647 typedef long pj_int32; #else #warning It seems no 32-bit integer type is available #endif /* maximum path/filename */ #ifndef MAX_PATH_FILENAME #define MAX_PATH_FILENAME 1024 #endif /* If we still haven't got M_PI*, we rely on our own defines. * For example, this is necessary when compiling with gcc and * the -ansi flag. */ #ifndef M_PI #define M_PI 3.14159265358979323846 #define M_PI_2 1.57079632679489661923 #define M_PI_4 0.78539816339744830962 #define M_2_PI 0.63661977236758134308 #endif /* M_SQRT2 might be missing */ #ifndef M_SQRT2 #define M_SQRT2 1.41421356237309504880 #endif /* some more useful math constants and aliases */ #define M_FORTPI M_PI_4 /* pi/4 */ #define M_HALFPI M_PI_2 /* pi/2 */ #define M_PI_HALFPI 4.71238898038468985769 /* 1.5*pi */ #define M_TWOPI 6.28318530717958647693 /* 2*pi */ #define M_TWO_D_PI M_2_PI /* 2/pi */ #define M_TWOPI_HALFPI 7.85398163397448309616 /* 2.5*pi */ /* maximum tag id length for +init and default files */ #ifndef ID_TAG_MAX #define ID_TAG_MAX 50 #endif /* Use WIN32 as a standard windows 32 bit declaration */ #if defined(_WIN32) && !defined(WIN32) # define WIN32 #endif #if defined(_WINDOWS) && !defined(WIN32) # define WIN32 #endif /* directory delimiter for DOS support */ #ifdef WIN32 #define DIR_CHAR '\\' #else #define DIR_CHAR '/' #endif enum pj_io_units { PJ_IO_UNITS_WHATEVER = 0, /* Doesn't matter (or depends on pipeline neighbours) */ PJ_IO_UNITS_CLASSIC = 1, /* Scaled meters (right), projected system */ PJ_IO_UNITS_PROJECTED = 2, /* Meters, projected system */ PJ_IO_UNITS_CARTESIAN = 3, /* Meters, 3D cartesian system */ PJ_IO_UNITS_RADIANS = 4, /* Radians */ PJ_IO_UNITS_DEGREES = 5, /* Degrees */ }; enum pj_io_units pj_left (PJ *P); enum pj_io_units pj_right (PJ *P); PJ_COORD PROJ_DLL proj_coord_error (void); void proj_context_errno_set (PJ_CONTEXT *ctx, int err); void PROJ_DLL proj_context_set (PJ *P, PJ_CONTEXT *ctx); void proj_context_inherit (PJ *parent, PJ *child); struct projCppContext; /* not sure why we need to export it, but mingw needs it */ void PROJ_DLL proj_context_delete_cpp_context(struct projCppContext* cppContext); PJ_COORD pj_fwd4d (PJ_COORD coo, PJ *P); PJ_COORD pj_inv4d (PJ_COORD coo, PJ *P); PJ_COORD PROJ_DLL pj_approx_2D_trans (PJ *P, PJ_DIRECTION direction, PJ_COORD coo); PJ_COORD PROJ_DLL pj_approx_3D_trans (PJ *P, PJ_DIRECTION direction, PJ_COORD coo); /* Provision for gettext translatable strings */ #define _(str) (str) void PROJ_DLL proj_log_error (const PJ *P, const char *fmt, ...); void proj_log_debug (PJ *P, const char *fmt, ...); void proj_log_trace (PJ *P, const char *fmt, ...); void proj_context_log_debug (PJ_CONTEXT *ctx, const char *fmt, ...); int pj_ellipsoid (PJ *); void pj_inherit_ellipsoid_def (const PJ *src, PJ *dst); int pj_calc_ellipsoid_params (PJ *P, double a, double es); /* Geographical to geocentric latitude - another of the "simple, but useful" */ PJ_COORD pj_geocentric_latitude (const PJ *P, PJ_DIRECTION direction, PJ_COORD coord); char PROJ_DLL *pj_chomp (char *c); char PROJ_DLL *pj_shrink (char *c); size_t pj_trim_argc (char *args); char **pj_trim_argv (size_t argc, char *args); char *pj_make_args (size_t argc, char **argv); typedef struct { double r, i; } COMPLEX; /* Forward declarations and typedefs for stuff needed inside the PJ object */ struct PJconsts; union PJ_COORD; struct geod_geodesic; struct ARG_list; struct PJ_REGION_S; typedef struct PJ_REGION_S PJ_Region; typedef struct ARG_list paralist; /* parameter list */ #ifndef PROJ_H typedef struct PJconsts PJ; /* the PJ object herself */ typedef union PJ_COORD PJ_COORD; #endif struct PJ_REGION_S { double ll_long; /* lower left corner coordinates (radians) */ double ll_lat; double ur_long; /* upper right corner coordinates (radians) */ double ur_lat; }; struct PJ_AREA { int bbox_set; double west_lon_degree; double south_lat_degree; double east_lon_degree; double north_lat_degree; }; /***************************************************************************** Some function types that are especially useful when working with PJs ****************************************************************************** PJ_CONSTRUCTOR: A function taking a pointer-to-PJ as arg, and returning a pointer-to-PJ. Historically called twice: First with a 0 argument, to allocate memory, second with the first return value as argument, for actual setup. PJ_DESTRUCTOR: A function taking a pointer-to-PJ and an integer as args, then first handling the deallocation of the PJ, afterwards handing the integer over to the error reporting subsystem, and finally returning a null pointer in support of the "return free (P)" (aka "get the hell out of here") idiom. PJ_OPERATOR: A function taking a PJ_COORD and a pointer-to-PJ as args, applying the PJ to the PJ_COORD, and returning the resulting PJ_COORD. *****************************************************************************/ typedef PJ *(* PJ_CONSTRUCTOR) (PJ *); typedef PJ *(* PJ_DESTRUCTOR) (PJ *, int); typedef PJ_COORD (* PJ_OPERATOR) (PJ_COORD, PJ *); /****************************************************************************/ /* datum_type values */ #define PJD_UNKNOWN 0 #define PJD_3PARAM 1 #define PJD_7PARAM 2 #define PJD_GRIDSHIFT 3 #define PJD_WGS84 4 /* WGS84 (or anything considered equivalent) */ struct PJCoordOperation { int idxInOriginalList; double minxSrc = 0.0; double minySrc = 0.0; double maxxSrc = 0.0; double maxySrc = 0.0; double minxDst = 0.0; double minyDst = 0.0; double maxxDst = 0.0; double maxyDst = 0.0; PJ* pj = nullptr; std::string name{}; double accuracy = -1.0; bool isOffshore = false; PJCoordOperation(int idxInOriginalListIn, double minxSrcIn, double minySrcIn, double maxxSrcIn, double maxySrcIn, double minxDstIn, double minyDstIn, double maxxDstIn, double maxyDstIn, PJ* pjIn, const std::string& nameIn, double accuracyIn, bool isOffshoreIn): idxInOriginalList(idxInOriginalListIn), minxSrc(minxSrcIn), minySrc(minySrcIn), maxxSrc(maxxSrcIn), maxySrc(maxySrcIn), minxDst(minxDstIn), minyDst(minyDstIn), maxxDst(maxxDstIn), maxyDst(maxyDstIn), pj(pjIn), name(nameIn), accuracy(accuracyIn), isOffshore(isOffshoreIn) { } PJCoordOperation(const PJCoordOperation&) = delete; PJCoordOperation(PJ_CONTEXT* ctx, const PJCoordOperation& other): idxInOriginalList(other.idxInOriginalList), minxSrc(other.minxSrc), minySrc(other.minySrc), maxxSrc(other.maxxSrc), maxySrc(other.maxySrc), minxDst(other.minxDst), minyDst(other.minyDst), maxxDst(other.maxxDst), maxyDst(other.maxyDst), pj(proj_clone(ctx, other.pj)), name(std::move(other.name)), accuracy(other.accuracy), isOffshore(other.isOffshore) { } PJCoordOperation(PJCoordOperation&& other): idxInOriginalList(other.idxInOriginalList), minxSrc(other.minxSrc), minySrc(other.minySrc), maxxSrc(other.maxxSrc), maxySrc(other.maxySrc), minxDst(other.minxDst), minyDst(other.minyDst), maxxDst(other.maxxDst), maxyDst(other.maxyDst), name(std::move(other.name)), accuracy(other.accuracy), isOffshore(other.isOffshore) { pj = other.pj; other.pj = nullptr; } PJCoordOperation& operator=(const PJCoordOperation&) = delete; bool operator == (const PJCoordOperation& other) const { return idxInOriginalList == other.idxInOriginalList && minxSrc == other.minxSrc && minySrc == other.minySrc && maxxSrc == other.maxxSrc && maxySrc == other.maxySrc && minxDst == other.minxDst && minyDst == other.minyDst && maxxDst == other.maxxDst && maxyDst == other.maxyDst && name == other.name && proj_is_equivalent_to(pj, other.pj, PJ_COMP_STRICT) && accuracy == other.accuracy && isOffshore == other.isOffshore; } bool operator != (const PJCoordOperation& other) const { return !(operator==(other)); } ~PJCoordOperation() { proj_destroy(pj); } }; enum class TMercAlgo { AUTO, // Poder/Engsager if far from central meridian, otherwise Evenden/Snyder EVENDEN_SNYDER, PODER_ENGSAGER, }; /* base projection data structure */ struct PJconsts { /************************************************************************************* G E N E R A L P A R A M E T E R S T R U C T ************************************************************************************** TODO: Need some description here - especially about the thread context... This is the struct behind the PJ typedef **************************************************************************************/ PJ_CONTEXT *ctx = nullptr; const char *short_name = nullptr; /* From pj_list.h */ const char *descr = nullptr; /* From pj_list.h or individual PJ_*.c file */ paralist *params = nullptr; /* Parameter list */ char *def_full = nullptr; /* Full textual definition (usually 0 - set by proj_pj_info) */ PJconsts *parent = nullptr; /* Parent PJ of pipeline steps - nullptr if not a pipeline step */ /* For debugging / logging purposes */ char *def_size = nullptr; /* Shape and size parameters extracted from params */ char *def_shape = nullptr; char *def_spherification = nullptr; char *def_ellps = nullptr; struct geod_geodesic *geod = nullptr; /* For geodesic computations */ void *opaque = nullptr; /* Projection specific parameters, Defined in PJ_*.c */ int inverted = 0; /* Tell high level API functions to swap inv/fwd */ /************************************************************************************* F U N C T I O N P O I N T E R S ************************************************************************************** For projection xxx, these are pointers to functions in the corresponding PJ_xxx.c file. pj_init() delegates the setup of these to pj_projection_specific_setup_xxx(), a name which is currently hidden behind the magic curtain of the PROJECTION macro. **************************************************************************************/ PJ_XY (*fwd)(PJ_LP, PJ *) = nullptr; PJ_LP (*inv)(PJ_XY, PJ *) = nullptr; PJ_XYZ (*fwd3d)(PJ_LPZ, PJ *) = nullptr; PJ_LPZ (*inv3d)(PJ_XYZ, PJ *) = nullptr; PJ_OPERATOR fwd4d = nullptr; PJ_OPERATOR inv4d = nullptr; PJ_DESTRUCTOR destructor = nullptr; void (*reassign_context)(PJ*, PJ_CONTEXT*) = nullptr; /************************************************************************************* E L L I P S O I D P A R A M E T E R S ************************************************************************************** Despite YAGNI, we add a large number of ellipsoidal shape parameters, which are not yet set up in pj_init. They are, however, inexpensive to compute, compared to the overall time taken for setting up the complex PJ object (cf. e.g. https://en.wikipedia.org/wiki/Angular_eccentricity). But during single point projections it will often be a useful thing to have these readily available without having to recompute at every pj_fwd / pj_inv call. With this wide selection, we should be ready for quite a number of geodetic algorithms, without having to incur further ABI breakage. **************************************************************************************/ /* The linear parameters */ double a = 0.0; /* semimajor axis (radius if eccentricity==0) */ double b = 0.0; /* semiminor axis */ double ra = 0.0; /* 1/a */ double rb = 0.0; /* 1/b */ /* The eccentricities */ double alpha = 0.0; /* angular eccentricity */ double e = 0.0; /* first eccentricity */ double es = 0.0; /* first eccentricity squared */ double e2 = 0.0; /* second eccentricity */ double e2s = 0.0; /* second eccentricity squared */ double e3 = 0.0; /* third eccentricity */ double e3s = 0.0; /* third eccentricity squared */ double one_es = 0.0; /* 1 - e^2 */ double rone_es = 0.0; /* 1/one_es */ /* The flattenings */ double f = 0.0; /* first flattening */ double f2 = 0.0; /* second flattening */ double n = 0.0; /* third flattening */ double rf = 0.0; /* 1/f */ double rf2 = 0.0; /* 1/f2 */ double rn = 0.0; /* 1/n */ /* This one's for GRS80 */ double J = 0.0; /* "Dynamic form factor" */ double es_orig = 0.0; /* es and a before any +proj related adjustment */ double a_orig = 0.0; /************************************************************************************* C O O R D I N A T E H A N D L I N G **************************************************************************************/ int over = 0; /* Over-range flag */ int geoc = 0; /* Geocentric latitude flag */ int is_latlong = 0; /* proj=latlong ... not really a projection at all */ int is_geocent = 0; /* proj=geocent ... not really a projection at all */ int need_ellps = 0; /* 0 for operations that are purely cartesian */ int skip_fwd_prepare = 0; int skip_fwd_finalize = 0; int skip_inv_prepare = 0; int skip_inv_finalize = 0; enum pj_io_units left = PJ_IO_UNITS_WHATEVER; /* Flags for input/output coordinate types */ enum pj_io_units right = PJ_IO_UNITS_WHATEVER; /* These PJs are used for implementing cs2cs style coordinate handling in the 4D API */ PJ *axisswap = nullptr; PJ *cart = nullptr; PJ *cart_wgs84 = nullptr; PJ *helmert = nullptr; PJ *hgridshift = nullptr; PJ *vgridshift = nullptr; /************************************************************************************* C A R T O G R A P H I C O F F S E T S **************************************************************************************/ double lam0 = 0.0; /* central meridian */ double phi0 = 0.0; /* central parallel */ double x0 = 0.0; /* false easting */ double y0 = 0.0; /* false northing */ double z0 = 0.0; /* height origin */ double t0 = 0.0; /* time origin */ /************************************************************************************* S C A L I N G **************************************************************************************/ double k0 = 0.0; /* General scaling factor - e.g. the 0.9996 of UTM */ double to_meter = 0.0, fr_meter = 0.0; /* Plane coordinate scaling. Internal unit [m] */ double vto_meter = 0.0, vfr_meter = 0.0; /* Vertical scaling. Internal unit [m] */ /************************************************************************************* D A T U M S A N D H E I G H T S Y S T E M S ************************************************************************************** It may be possible, and meaningful, to move the list parts of this up to the PJ_CONTEXT level. **************************************************************************************/ int datum_type = PJD_UNKNOWN; /* PJD_UNKNOWN/3PARAM/7PARAM/GRIDSHIFT/WGS84 */ double datum_params[7] = {0,0,0,0,0,0,0}; /* Parameters for 3PARAM and 7PARAM */ int has_geoid_vgrids = 0; /* used by legacy transform.cpp */ void* hgrids_legacy = nullptr; /* used by legacy transform.cpp. Is a pointer to a ListOfHGrids* */ void* vgrids_legacy = nullptr; /* used by legacy transform.cpp. Is a pointer to a ListOfVGrids* */ double from_greenwich = 0.0; /* prime meridian offset (in radians) */ double long_wrap_center = 0.0; /* 0.0 for -180 to 180, actually in radians*/ int is_long_wrap_set = 0; char axis[4] = {0,0,0,0}; /* Axis order, pj_transform/pj_adjust_axis */ /************************************************************************************* ISO-19111 interface **************************************************************************************/ NS_PROJ::common::IdentifiedObjectPtr iso_obj{}; // cached results mutable std::string lastWKT{}; mutable std::string lastPROJString{}; mutable std::string lastJSONString{}; mutable bool gridsNeededAsked = false; mutable std::vector gridsNeeded{}; // cache pj_get_type() result to help for repeated calls to proj_factors() mutable PJ_TYPE type = PJ_TYPE_UNKNOWN; /************************************************************************************* proj_create_crs_to_crs() alternative coordinate operations **************************************************************************************/ std::vector alternativeCoordinateOperations{}; int iCurCoordOp = -1; /************************************************************************************* E N D O F G E N E R A L P A R A M E T E R S T R U C T **************************************************************************************/ PJconsts(); PJconsts(const PJconsts &) = delete; PJconsts &operator=(const PJconsts &) = delete; }; /* Parameter list (a copy of the +proj=... etc. parameters) */ struct ARG_list { paralist *next; char used; #if (defined(__GNUC__) && __GNUC__ >= 8) || (defined(__clang__) && __clang_major__ >= 9) char param[]; /* variable-length member */ /* Safer to use [] for gcc 8. See https://github.com/OSGeo/proj.4/pull/1087 */ /* and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86914 */ #else char param[1]; /* variable-length member */ #endif }; typedef union { double f; int i; char *s; } PROJVALUE; struct PJ_DATUMS { const char *id; /* datum keyword */ const char *defn; /* ie. "to_wgs84=..." */ const char *ellipse_id; /* ie from ellipse table */ const char *comments; /* EPSG code, etc */ }; struct DERIVS { double x_l, x_p; /* derivatives of x for lambda-phi */ double y_l, y_p; /* derivatives of y for lambda-phi */ }; struct FACTORS { struct DERIVS der; double h, k; /* meridional, parallel scales */ double omega, thetap; /* angular distortion, theta prime */ double conv; /* convergence */ double s; /* areal scale factor */ double a, b; /* max-min scale error */ int code; /* always 0 */ }; // Legacy struct projFileAPI_t; struct projCppContext; struct projNetworkCallbacksAndData { bool enabled = false; bool enabled_env_variable_checked = false; // whereas we have checked PROJ_NETWORK env variable proj_network_open_cbk_type open = nullptr; proj_network_close_cbk_type close = nullptr; proj_network_get_header_value_cbk_type get_header_value = nullptr; proj_network_read_range_type read_range = nullptr; void* user_data = nullptr; }; struct projGridChunkCache { bool enabled = true; std::string filename{}; long long max_size = 300 * 1024 * 1024; int ttl = 86400; // 1 day }; struct projFileApiCallbackAndData { PROJ_FILE_HANDLE* (*open_cbk)(PJ_CONTEXT *ctx, const char *filename, PROJ_OPEN_ACCESS access, void* user_data) = nullptr; size_t (*read_cbk)(PJ_CONTEXT *ctx, PROJ_FILE_HANDLE*, void* buffer, size_t size, void* user_data) = nullptr; size_t (*write_cbk)(PJ_CONTEXT *ctx, PROJ_FILE_HANDLE*, const void* buffer, size_t size, void* user_data) = nullptr; int (*seek_cbk)(PJ_CONTEXT *ctx, PROJ_FILE_HANDLE*, long long offset, int whence, void* user_data) = nullptr; unsigned long long (*tell_cbk)(PJ_CONTEXT *ctx, PROJ_FILE_HANDLE*, void* user_data) = nullptr; void (*close_cbk)(PJ_CONTEXT *ctx, PROJ_FILE_HANDLE*, void* user_data) = nullptr; int (*exists_cbk)(PJ_CONTEXT *ctx, const char *filename, void* user_data) = nullptr; int (*mkdir_cbk)(PJ_CONTEXT *ctx, const char *filename, void* user_data) = nullptr; int (*unlink_cbk)(PJ_CONTEXT *ctx, const char *filename, void* user_data) = nullptr; int (*rename_cbk)(PJ_CONTEXT *ctx, const char *oldPath, const char *newPath, void* user_data) = nullptr; void* user_data = nullptr; }; /* proj thread context */ struct pj_ctx{ std::string lastFullErrorMessage{}; // used by proj_context_errno_string int last_errno = 0; int debug_level = PJ_LOG_ERROR; void (*logger)(void *, int, const char *) = nullptr; void *logger_app_data = nullptr; struct projCppContext* cpp_context = nullptr; /* internal context for C++ code */ int use_proj4_init_rules = -1; /* -1 = unknown, 0 = no, 1 = yes */ int epsg_file_exists = -1; /* -1 = unknown, 0 = no, 1 = yes */ std::string ca_bundle_path{}; std::string env_var_proj_lib{}; // content of PROJ_LIB environment variable. Use Filemanager::getProjLibEnvVar() to access std::vector search_paths{}; const char **c_compat_paths = nullptr; // same, but for projinfo usage const char* (*file_finder_legacy) (const char*) = nullptr; // Only for proj_api compat. To remove once it is removed const char* (*file_finder) (PJ_CONTEXT *, const char*, void* user_data) = nullptr; void* file_finder_user_data = nullptr; bool defer_grid_opening = false; // set transiently by pj_obj_create() projFileApiCallbackAndData fileApi{}; std::string custom_sqlite3_vfs_name{}; std::string user_writable_directory{}; // BEGIN ini file settings bool iniFileLoaded = false; std::string endpoint{}; projNetworkCallbacksAndData networking{}; projGridChunkCache gridChunkCache{}; TMercAlgo defaultTmercAlgo = TMercAlgo::PODER_ENGSAGER; // can be overridden by content of proj.ini // END ini file settings int projStringParserCreateFromPROJStringRecursionCounter = 0; // to avoid potential infinite recursion in PROJStringParser::createFromPROJString() int pipelineInitRecursiongCounter = 0; // to avoid potential infinite recursion in pipeline.cpp pj_ctx() = default; pj_ctx(const pj_ctx&); ~pj_ctx(); pj_ctx& operator= (const pj_ctx&) = delete; projCppContext* get_cpp_context(); void set_search_paths(const std::vector& search_paths_in); void set_ca_bundle_path(const std::string& ca_bundle_path_in); static pj_ctx createDefault(); }; /* Generate pj_list external or make list from include file */ #ifndef PJ_DATUMS__ C_NAMESPACE_VAR struct PJ_DATUMS pj_datums[]; #endif #ifdef PJ_LIB__ #define PROJ_HEAD(name, desc) static const char des_##name [] = desc #define OPERATION(name, NEED_ELLPS) \ \ pj_projection_specific_setup_##name (PJ *P); \ C_NAMESPACE PJ *pj_##name (PJ *P); \ \ C_NAMESPACE_VAR const char * const pj_s_##name = des_##name; \ \ C_NAMESPACE PJ *pj_##name (PJ *P) { \ if (P) \ return pj_projection_specific_setup_##name (P); \ P = pj_new(); \ if (nullptr==P) \ return nullptr; \ P->short_name = #name; \ P->descr = des_##name; \ P->need_ellps = NEED_ELLPS; \ P->left = PJ_IO_UNITS_RADIANS; \ P->right = PJ_IO_UNITS_CLASSIC; \ return P; \ } \ \ PJ *pj_projection_specific_setup_##name (PJ *P) /* In ISO19000 lingo, an operation is either a conversion or a transformation */ #define CONVERSION(name, need_ellps) OPERATION (name, need_ellps) #define TRANSFORMATION(name, need_ellps) OPERATION (name, need_ellps) /* In PROJ.4 a projection is a conversion taking angular input and giving scaled linear output */ #define PROJECTION(name) CONVERSION (name, 1) #endif /* def PJ_LIB__ */ /* procedure prototypes */ double PROJ_DLL dmstor(const char *, char **); double dmstor_ctx(PJ_CONTEXT *ctx, const char *, char **); void PROJ_DLL set_rtodms(int, int); char PROJ_DLL *rtodms(char *, double, int, int); double PROJ_DLL adjlon(double); double aacos(PJ_CONTEXT *,double); double aasin(PJ_CONTEXT *,double); double asqrt(double); double aatan2(double, double); PROJVALUE PROJ_DLL pj_param(PJ_CONTEXT *ctx, paralist *, const char *); paralist PROJ_DLL *pj_param_exists (paralist *list, const char *parameter); paralist PROJ_DLL *pj_mkparam(const char *); paralist *pj_mkparam_ws (const char *str, const char **next_str); int PROJ_DLL pj_ell_set(PJ_CONTEXT *ctx, paralist *, double *, double *); int pj_datum_set(PJ_CONTEXT *,paralist *, PJ *); int pj_angular_units_set(paralist *, PJ *); paralist *pj_clone_paralist( const paralist* ); paralist *pj_search_initcache( const char *filekey ); void pj_insert_initcache( const char *filekey, const paralist *list); paralist *pj_expand_init(PJ_CONTEXT *ctx, paralist *init); void *free_params (PJ_CONTEXT *ctx, paralist *start, int errlev); double *pj_enfn(double); double pj_mlfn(double, double, double, const double *); double pj_inv_mlfn(PJ_CONTEXT *, double, double, const double *); double pj_qsfn(double, double, double); double pj_tsfn(double, double, double); double pj_msfn(double, double, double); double PROJ_DLL pj_phi2(PJ_CONTEXT *, const double, const double); double pj_sinhpsi2tanphi(PJ_CONTEXT *, const double, const double); double pj_qsfn_(double, PJ *); double *pj_authset(double); double pj_authlat(double, double *); COMPLEX pj_zpoly1(COMPLEX, const COMPLEX *, int); COMPLEX pj_zpolyd1(COMPLEX, const COMPLEX *, int, COMPLEX *); int pj_deriv(PJ_LP, double, const PJ *, struct DERIVS *); int pj_factors(PJ_LP, const PJ *, double, struct FACTORS *); void *proj_mdist_ini(double); double proj_mdist(double, double, double, const void *); double proj_inv_mdist(PJ_CONTEXT *ctx, double, const void *); void *pj_gauss_ini(double, double, double *,double *); PJ_LP pj_gauss(PJ_CONTEXT *, PJ_LP, const void *); PJ_LP pj_inv_gauss(PJ_CONTEXT *, PJ_LP, const void *); struct PJ_DATUMS PROJ_DLL *pj_get_datums_ref( void ); PJ *pj_new(void); PJ *pj_default_destructor (PJ *P, int errlev); double PROJ_DLL pj_atof( const char* nptr ); double pj_strtod( const char *nptr, char **endptr ); void pj_freeup_plain (PJ *P); PJ* pj_init_ctx_with_allow_init_epsg( PJ_CONTEXT *ctx, int argc, char **argv, int allow_init_epsg ); std::string PROJ_DLL pj_add_type_crs_if_needed(const std::string& str); std::string pj_double_quote_string_param_if_needed(const std::string& str); PJ *pj_create_internal (PJ_CONTEXT *ctx, const char *definition); PJ *pj_create_argv_internal (PJ_CONTEXT *ctx, int argc, char **argv); // For use by projinfo void pj_load_ini(PJ_CONTEXT* ctx); // Exported for testing purposes only std::string PROJ_DLL pj_context_get_grid_cache_filename(PJ_CONTEXT *ctx); // For use by projsync void PROJ_DLL pj_context_set_user_writable_directory(PJ_CONTEXT* ctx, const std::string& path); std::string PROJ_DLL pj_get_relative_share_proj(PJ_CONTEXT *ctx); std::vector pj_create_prepared_operations(PJ_CONTEXT *ctx, const PJ *source_crs, const PJ *target_crs, PJ_OBJ_LIST* op_list); int pj_get_suggested_operation(PJ_CONTEXT *ctx, const std::vector& opList, const int iExcluded[2], PJ_DIRECTION direction, PJ_COORD coord); const PJ_UNITS *pj_list_linear_units(); const PJ_UNITS *pj_list_angular_units(); void pj_clear_hgridshift_knowngrids_cache(); void pj_clear_vgridshift_knowngrids_cache(); void pj_clear_sqlite_cache(); PJ_LP pj_generic_inverse_2d(PJ_XY xy, PJ *P, PJ_LP lpInitial); /*****************************************************************************/ /* */ /* proj_api.h */ /* */ /* The rest of this header file includes what used to be "proj_api.h" */ /* */ /*****************************************************************************/ /* pj_init() and similar functions can be used with a non-C locale */ /* Can be detected too at runtime if the symbol pj_atof exists */ #define PJ_LOCALE_SAFE 1 #define RAD_TO_DEG 57.295779513082321 #define DEG_TO_RAD .017453292519943296 extern char const PROJ_DLL pj_release[]; /* global release id string */ /* procedure prototypes */ PJ_CONTEXT PROJ_DLL *pj_get_default_ctx(void); PJ_CONTEXT *pj_get_ctx( PJ *); PJ_XY PROJ_DLL pj_fwd(PJ_LP, PJ *); PJ_LP PROJ_DLL pj_inv(PJ_XY, PJ *); PJ_XYZ pj_fwd3d(PJ_LPZ, PJ *); PJ_LPZ pj_inv3d(PJ_XYZ, PJ *); void pj_clear_initcache(void); void PROJ_DLL pj_pr_list(PJ *); /* used by proj.cpp */ char *pj_get_def(PJ *, int); int pj_has_inverse(PJ *); char *pj_strdup(const char *str); const char PROJ_DLL *pj_get_release(void); void pj_acquire_lock(void); void pj_release_lock(void); void pj_cleanup_lock(void); bool pj_log_active( PJ_CONTEXT *ctx, int level ); void pj_log( PJ_CONTEXT * ctx, int level, const char *fmt, ... ); void pj_stderr_logger( void *, int, const char * ); int pj_find_file(PJ_CONTEXT * ctx, const char *short_filename, char* out_full_filename, size_t out_full_filename_size); #endif /* ndef PROJ_INTERNAL_H */ proj-8.2.1/src/init.cpp000644 000765 000024 00000065121 14164067106 015406 0ustar00keversstaff000000 000000 /****************************************************************************** * Project: PROJ.4 * Purpose: Initialize projection object from string definition. Includes * pj_init(), and pj_init_plus() function. * Author: Gerald Evenden, Frank Warmerdam * ****************************************************************************** * Copyright (c) 1995, Gerald Evenden * Copyright (c) 2002, Frank Warmerdam * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. *****************************************************************************/ #define PJ_LIB__ #include #include #include #include #include #include "geodesic.h" #include "proj.h" #include "proj_internal.h" #include "filemanager.hpp" #include /**************************************************************************************/ static paralist *string_to_paralist (PJ_CONTEXT *ctx, char *definition) { /*************************************************************************************** Convert a string (presumably originating from get_init_string) to a paralist. ***************************************************************************************/ const char *c = definition; paralist *first = nullptr, *last = nullptr; while (*c) { /* Keep a handle to the start of the list, so we have something to return */ auto param = pj_mkparam_ws (c, &c); if (nullptr==param) { free_params (ctx, first, PROJ_ERR_OTHER /*ENOMEM*/); return nullptr; } if (nullptr==last) { first = param; } else { last->next = param; } last = param; } return first; } /**************************************************************************************/ static char *get_init_string (PJ_CONTEXT *ctx, const char *name) { /*************************************************************************************** Read a section of an init file. Return its contents as a plain character string. It is the duty of the caller to free the memory allocated for the string. ***************************************************************************************/ #define MAX_LINE_LENGTH 1000 size_t current_buffer_size = 5 * (MAX_LINE_LENGTH + 1); char *fname, *section; const char *key; char *buffer = nullptr; size_t n; fname = static_cast(malloc (MAX_PATH_FILENAME+ID_TAG_MAX+3)); if (nullptr==fname) { return nullptr; } /* Support "init=file:section", "+init=file:section", and "file:section" format */ key = strstr (name, "init="); if (nullptr==key) key = name; else key += 5; if (MAX_PATH_FILENAME + ID_TAG_MAX + 2 < strlen (key)) { free (fname); return nullptr; } memmove (fname, key, strlen (key) + 1); /* Locate the name of the section we search for */ section = strrchr(fname, ':'); if (nullptr==section) { pj_log(ctx, PJ_LOG_ERROR, _("Missing colon in +init")); proj_context_errno_set (ctx, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); free (fname); return nullptr; } *section = 0; section++; n = strlen (section); pj_log (ctx, PJ_LOG_TRACE, "get_init_string: searching for section [%s] in init file [%s]", section, fname); auto file = NS_PROJ::FileManager::open_resource_file(ctx, fname); if (nullptr==file) { pj_log(ctx, PJ_LOG_ERROR, _("Cannot open %s"), fname); proj_context_errno_set (ctx, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); free (fname); return nullptr; } /* Search for section in init file */ std::string line; for (;;) { bool eofReached = false; bool maxLenReached = false; line = file->read_line(MAX_LINE_LENGTH, maxLenReached, eofReached); /* End of file? */ if (maxLenReached || eofReached) { pj_log(ctx, PJ_LOG_ERROR, _("Invalid content for %s"), fname); proj_context_errno_set (ctx, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); free (fname); return nullptr; } /* At start of right section? */ pj_chomp (&line[0]); if ('<'!=line[0]) continue; if (strlen (line.c_str()) < n + 2) continue; if (line[n + 1] != '>') continue; if (0==strncmp (line.data() + 1, section, n)) break; } /* We're at the first line of the right section - copy line to buffer */ buffer = static_cast(malloc (current_buffer_size)); if (nullptr==buffer) { free (fname); return nullptr; } /* Skip the "
" indicator, and copy the rest of the line over */ strcpy (buffer, line.data() + strlen (section) + 2); /* Copy the remaining lines of the section to buffer */ for (;;) { char *end_i_cator; size_t next_length, buffer_length; /* Did the section end somewhere in the most recently read line? */ end_i_cator = strchr (buffer, '<'); if (end_i_cator) { *end_i_cator = 0; break; } bool eofReached = false; bool maxLenReached = false; line = file->read_line(MAX_LINE_LENGTH, maxLenReached, eofReached); /* End of file? - done! */ if (maxLenReached || eofReached) break; /* Otherwise, handle the line. It MAY be the start of the next section, */ /* but that will be handled at the start of next trip through the loop */ buffer_length = strlen (buffer); pj_chomp (&line[0]); /* Remove '#' style comments */ next_length = strlen (line.data()) + buffer_length + 2; if (next_length > current_buffer_size) { char *b = static_cast(malloc (2 * current_buffer_size)); if (nullptr==b) { free (buffer); buffer = nullptr; break; } strcpy (b, buffer); current_buffer_size *= 2; free (buffer); buffer = b; } buffer[buffer_length] = ' '; strcpy (buffer + buffer_length + 1, line.data()); } free (fname); if (nullptr==buffer) return nullptr; pj_shrink (buffer); pj_log (ctx, PJ_LOG_TRACE, "key=%s, value: [%s]", key, buffer); return buffer; } /************************************************************************/ static paralist *get_init(PJ_CONTEXT *ctx, const char *key, int allow_init_epsg) { /************************************************************************* Expand key from buffer or (if not in buffer) from init file *************************************************************************/ const char *xkey; char *definition = nullptr; paralist *init_items = nullptr; if( !ctx ) { ctx = pj_get_default_ctx(); } /* support "init=file:section", "+init=file:section", and "file:section" format */ xkey = strstr (key, "init="); if (nullptr==xkey) xkey = key; else xkey += 5; pj_log (ctx, PJ_LOG_TRACE, "get_init: searching cache for key: [%s]", xkey); /* Is file/key pair already in cache? */ init_items = pj_search_initcache (xkey); if (init_items) return init_items; if( (strncmp(xkey, "epsg:", 5) == 0 || strncmp(xkey, "IGNF:", 5) == 0) ) { char unused[256]; char initname[5]; int exists; strncpy(initname, xkey, 4); initname[4] = 0; if( strncmp(xkey, "epsg:", 5) == 0 ) { exists = ctx->epsg_file_exists; if( exists < 0 ) { exists = pj_find_file(ctx, initname, unused, sizeof(unused)); ctx->epsg_file_exists = exists; } } else { exists = pj_find_file(ctx, initname, unused, sizeof(unused)); } if( !exists ) { char szInitStr[7 + 64]; PJ* src; const char* proj_string; proj_context_errno_set( ctx, 0 ); if( !allow_init_epsg ) { pj_log (ctx, PJ_LOG_TRACE, "%s expansion disallowed", xkey); return nullptr; } if( strlen(xkey) > 64 ) { return nullptr; } strcpy(szInitStr, "+init="); strcat(szInitStr, xkey); auto old_proj4_init_rules = ctx->use_proj4_init_rules; ctx->use_proj4_init_rules = true; src = proj_create(ctx, szInitStr); ctx->use_proj4_init_rules = old_proj4_init_rules; if( !src ) { return nullptr; } proj_string = proj_as_proj_string(ctx, src, PJ_PROJ_4, nullptr); if( !proj_string ) { proj_destroy(src); return nullptr; } definition = (char*)calloc(1, strlen(proj_string)+1); if( definition ) { strcpy(definition, proj_string); } proj_destroy(src); } } if( !definition ) { /* If not, we must read it from file */ pj_log (ctx, PJ_LOG_TRACE, "get_init: searching on in init files for [%s]", xkey); definition = get_init_string (ctx, xkey); } if (nullptr==definition) return nullptr; init_items = string_to_paralist (ctx, definition); if (init_items) pj_log (ctx, PJ_LOG_TRACE, "get_init: got [%s], paralist[0,1]: [%s,%s]", definition, init_items->param, init_items->next ? init_items->next->param : "(empty)"); free (definition); if (nullptr==init_items) return nullptr; /* We found it in file - now insert into the cache, before returning */ pj_insert_initcache (xkey, init_items); return init_items; } static void append_default_ellipsoid_to_paralist (paralist *start) { if (nullptr==start) return; /* Set defaults, unless inhibited (either explicitly through a "no_defs" token */ /* or implicitly, because we are initializing a pipeline) */ if (pj_param_exists (start, "no_defs")) return; auto proj = pj_param_exists (start, "proj"); if (nullptr==proj) return; if (strlen (proj->param) < 6) return; if (0==strcmp ("pipeline", proj->param + 5)) return; /* Don't default ellipse if datum, ellps or any ellipsoid information is set */ if (pj_param_exists (start, "datum")) return; if (pj_param_exists (start, "ellps")) return; if (pj_param_exists (start, "a")) return; if (pj_param_exists (start, "b")) return; if (pj_param_exists (start, "rf")) return; if (pj_param_exists (start, "f")) return; if (pj_param_exists (start, "e")) return; if (pj_param_exists (start, "es")) return; /* Locate end of start-list */ paralist *last = nullptr; for (last = start; last->next; last = last->next); /* If we're here, it's OK to append the current default item */ last->next = pj_mkparam("ellps=GRS80"); } /*****************************************************************************/ static paralist *pj_expand_init_internal(PJ_CONTEXT *ctx, paralist *init, int allow_init_epsg) { /****************************************************************************** Append expansion of to the paralist . The expansion is appended, rather than inserted at 's place, since may contain overrides to the expansion. These must take precedence, and hence come first in the expanded list. Consider e.g. the key 'foo:bar' which (hypothetically) expands to 'proj=utm zone=32 ellps=GRS80', i.e. a UTM projection on the GRS80 ellipsoid. The expression 'init=foo:bar ellps=intl' will then expand to: 'init=foo:bar ellps=intl proj=utm zone=32 ellps=GRS80', where 'ellps=intl' precedes 'ellps=GRS80', and hence takes precedence, turning the expansion into an UTM projection on the Hayford ellipsoid. Note that 'init=foo:bar' stays in the list. It is ignored after expansion. ******************************************************************************/ paralist *last; paralist *expn; /* Nowhere to start? */ if (nullptr==init) return nullptr; expn = get_init(ctx, init->param, allow_init_epsg); /* Nothing in expansion? */ if (nullptr==expn) return nullptr; /* Locate the end of the list */ for (last = init; last && last->next; last = last->next); /* Then append and return */ last->next = expn; return init; } paralist *pj_expand_init(PJ_CONTEXT *ctx, paralist *init) { return pj_expand_init_internal(ctx, init, TRUE); } /************************************************************************/ /* pj_init() */ /* */ /* Main entry point for initialing a PJ projections */ /* definition. Note that the projection specific function is */ /* called to do the initial allocation so it can be created */ /* large enough to hold projection specific parameters. */ /************************************************************************/ static PJ_CONSTRUCTOR locate_constructor (const char *name) { int i; const char *s; const PJ_OPERATIONS *operations; operations = proj_list_operations(); for (i = 0; (s = operations[i].id) && strcmp(name, s) ; ++i) ; if (nullptr==s) return nullptr; return (PJ_CONSTRUCTOR) operations[i].proj; } PJ * pj_init_ctx_with_allow_init_epsg(PJ_CONTEXT *ctx, int argc, char **argv, int allow_init_epsg) { const char *s; char *name; PJ_CONSTRUCTOR proj; paralist *curr, *init, *start; int i; int err; PJ *PIN = nullptr; int n_pipelines = 0; int n_inits = 0; const PJ_UNITS *units; const PJ_PRIME_MERIDIANS *prime_meridians; if (nullptr==ctx) ctx = pj_get_default_ctx (); ctx->last_errno = 0; if (argc <= 0) { pj_log(ctx, PJ_LOG_ERROR, _("No arguments")); proj_context_errno_set (ctx, PROJ_ERR_INVALID_OP_MISSING_ARG); return nullptr; } /* count occurrences of pipelines and inits */ for (i = 0; i < argc; ++i) { if (!strcmp (argv[i], "+proj=pipeline") || !strcmp(argv[i], "proj=pipeline") ) n_pipelines++; if (!strncmp (argv[i], "+init=", 6) || !strncmp(argv[i], "init=", 5)) n_inits++; } /* can't have nested pipelines directly */ if (n_pipelines > 1) { pj_log(ctx, PJ_LOG_ERROR, _("Nested pipelines are not supported")); proj_context_errno_set (ctx, PROJ_ERR_INVALID_OP_WRONG_SYNTAX); return nullptr; } /* don't allow more than one +init in non-pipeline operations */ if (n_pipelines == 0 && n_inits > 1) { pj_log(ctx, PJ_LOG_ERROR, _("Too many inits")); proj_context_errno_set (ctx, PROJ_ERR_INVALID_OP_WRONG_SYNTAX); return nullptr; } /* put arguments into internal linked list */ start = curr = pj_mkparam(argv[0]); if (!curr) { free_params (ctx, start, PROJ_ERR_OTHER /*ENOMEM*/); return nullptr; } for (i = 1; i < argc; ++i) { curr->next = pj_mkparam(argv[i]); if (!curr->next) { free_params (ctx, start, PROJ_ERR_OTHER /*ENOMEM*/); return nullptr; } curr = curr->next; } /* Only expand '+init's in non-pipeline operations. '+init's in pipelines are */ /* expanded in the individual pipeline steps during pipeline initialization. */ /* Potentially this leads to many nested pipelines, which shouldn't be a */ /* problem when '+init's are expanded as late as possible. */ init = pj_param_exists (start, "init"); if (init && n_pipelines == 0) { init = pj_expand_init_internal (ctx, init, allow_init_epsg); if (!init) { free_params (ctx, start, PROJ_ERR_INVALID_OP_WRONG_SYNTAX); return nullptr; } } if (ctx->last_errno) { free_params (ctx, start, ctx->last_errno); return nullptr; } /* Find projection selection */ curr = pj_param_exists (start, "proj"); if (nullptr==curr) { pj_log(ctx, PJ_LOG_ERROR, _("Missing proj")); free_params (ctx, start, PROJ_ERR_INVALID_OP_MISSING_ARG); return nullptr; } name = curr->param; if (strlen (name) < 6) { pj_log(ctx, PJ_LOG_ERROR, _("Invalid value for proj")); free_params (ctx, start, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); return nullptr; } name += 5; proj = locate_constructor (name); if (nullptr==proj) { pj_log(ctx, PJ_LOG_ERROR, _("Unknown projection")); free_params (ctx, start, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); return nullptr; } append_default_ellipsoid_to_paralist (start); /* Allocate projection structure */ PIN = proj(nullptr); if (nullptr==PIN) { free_params (ctx, start, PROJ_ERR_OTHER /*ENOMEM*/); return nullptr; } PIN->ctx = ctx; PIN->params = start; PIN->is_latlong = 0; PIN->is_geocent = 0; PIN->is_long_wrap_set = 0; PIN->long_wrap_center = 0.0; strcpy( PIN->axis, "enu" ); /* Set datum parameters. Similarly to +init parameters we want to expand */ /* +datum parameters as late as possible when dealing with pipelines. */ /* otherwise only the first occurrence of +datum will be expanded and that */ if (n_pipelines == 0) { if (pj_datum_set(ctx, start, PIN)) return pj_default_destructor (PIN, proj_errno(PIN)); } err = pj_ellipsoid (PIN); if (err) { /* Didn't get an ellps, but doesn't need one: Get a free WGS84 */ if (PIN->need_ellps) { pj_log (ctx, PJ_LOG_ERROR, _("pj_init_ctx: Must specify ellipsoid or sphere")); return pj_default_destructor (PIN, proj_errno(PIN)); } else { if (PIN->a == 0) proj_errno_reset (PIN); PIN->f = 1.0/298.257223563; PIN->a = 6378137.0; PIN->es = PIN->f*(2-PIN->f); } } PIN->a_orig = PIN->a; PIN->es_orig = PIN->es; if (pj_calc_ellipsoid_params (PIN, PIN->a, PIN->es)) return pj_default_destructor (PIN, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); /* Now that we have ellipse information check for WGS84 datum */ if( PIN->datum_type == PJD_3PARAM && PIN->datum_params[0] == 0.0 && PIN->datum_params[1] == 0.0 && PIN->datum_params[2] == 0.0 && PIN->a == 6378137.0 && ABS(PIN->es - 0.006694379990) < 0.000000000050 )/*WGS84/GRS80*/ { PIN->datum_type = PJD_WGS84; } /* Set PIN->geoc coordinate system */ PIN->geoc = (PIN->es != 0.0 && pj_param(ctx, start, "bgeoc").i); /* Over-ranging flag */ PIN->over = pj_param(ctx, start, "bover").i; /* Vertical datum geoid grids */ PIN->has_geoid_vgrids = pj_param(ctx, start, "tgeoidgrids").i; if( PIN->has_geoid_vgrids ) /* we need to mark it as used. */ pj_param(ctx, start, "sgeoidgrids"); /* Longitude center for wrapping */ PIN->is_long_wrap_set = pj_param(ctx, start, "tlon_wrap").i; if (PIN->is_long_wrap_set) { PIN->long_wrap_center = pj_param(ctx, start, "rlon_wrap").f; /* Don't accept excessive values otherwise we might perform badly */ /* when correcting longitudes around it */ /* The test is written this way to error on long_wrap_center "=" NaN */ if( !(fabs(PIN->long_wrap_center) < 10 * M_TWOPI) ) { proj_log_error(PIN, _("Invalid value for lon_wrap")); return pj_default_destructor (PIN, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); } } /* Axis orientation */ if( (pj_param(ctx, start,"saxis").s) != nullptr ) { const char *axis_legal = "ewnsud"; const char *axis_arg = pj_param(ctx, start,"saxis").s; if( strlen(axis_arg) != 3 ) { proj_log_error(PIN, _("Invalid value for axis")); return pj_default_destructor (PIN, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); } if( strchr( axis_legal, axis_arg[0] ) == nullptr || strchr( axis_legal, axis_arg[1] ) == nullptr || strchr( axis_legal, axis_arg[2] ) == nullptr) { proj_log_error(PIN, _("Invalid value for axis")); return pj_default_destructor (PIN, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); } /* TODO: it would be nice to validate we don't have on axis repeated */ strcpy( PIN->axis, axis_arg ); } /* Central meridian */ PIN->lam0=pj_param(ctx, start, "rlon_0").f; /* Central latitude */ PIN->phi0 = pj_param(ctx, start, "rlat_0").f; if( fabs(PIN->phi0) > M_HALFPI ) { proj_log_error(PIN, _("Invalid value for lat_0: |lat_0| should be <= 90°")); return pj_default_destructor (PIN, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); } /* False easting and northing */ PIN->x0 = pj_param(ctx, start, "dx_0").f; PIN->y0 = pj_param(ctx, start, "dy_0").f; PIN->z0 = pj_param(ctx, start, "dz_0").f; PIN->t0 = pj_param(ctx, start, "dt_0").f; /* General scaling factor */ if (pj_param(ctx, start, "tk_0").i) PIN->k0 = pj_param(ctx, start, "dk_0").f; else if (pj_param(ctx, start, "tk").i) PIN->k0 = pj_param(ctx, start, "dk").f; else PIN->k0 = 1.; if (PIN->k0 <= 0.) { proj_log_error(PIN, _("Invalid value for k/k_0: it should be > 0")); return pj_default_destructor (PIN, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); } /* Set units */ units = pj_list_linear_units(); s = nullptr; if ((name = pj_param(ctx, start, "sunits").s) != nullptr) { for (i = 0; (s = units[i].id) && strcmp(name, s) ; ++i) ; if (!s) { proj_log_error(PIN, _("Invalid value for units")); return pj_default_destructor (PIN, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); } s = units[i].to_meter; } if (s || (s = pj_param(ctx, start, "sto_meter").s)) { char* end_ptr = const_cast(s); PIN->to_meter = pj_strtod(s, &end_ptr); s = end_ptr; if (*s == '/') { /* ratio number */ ++s; double denom = pj_strtod(s, nullptr); if (denom == 0.0) { proj_log_error(PIN, _("Invalid value for to_meter donominator")); return pj_default_destructor (PIN, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); } PIN->to_meter /= denom; } if (PIN->to_meter <= 0.0) { proj_log_error(PIN, _("Invalid value for to_meter")); return pj_default_destructor (PIN, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); } PIN->fr_meter = 1 / PIN->to_meter; } else PIN->to_meter = PIN->fr_meter = 1.; /* Set vertical units */ s = nullptr; if ((name = pj_param(ctx, start, "svunits").s) != nullptr) { for (i = 0; (s = units[i].id) && strcmp(name, s) ; ++i) ; if (!s) { proj_log_error(PIN, _("Invalid value for vunits")); return pj_default_destructor (PIN, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); } s = units[i].to_meter; } if (s || (s = pj_param(ctx, start, "svto_meter").s)) { char* end_ptr = const_cast(s); PIN->vto_meter = pj_strtod(s, &end_ptr); s = end_ptr; if (*s == '/') { /* ratio number */ ++s; double denom = pj_strtod(s, nullptr); if (denom == 0.0) { proj_log_error(PIN, _("Invalid value for vto_meter donominator")); return pj_default_destructor (PIN, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); } PIN->vto_meter /= denom; } if (PIN->vto_meter <= 0.0) { proj_log_error(PIN, _("Invalid value for vto_meter")); return pj_default_destructor (PIN, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); } PIN->vfr_meter = 1. / PIN->vto_meter; } else { PIN->vto_meter = PIN->to_meter; PIN->vfr_meter = PIN->fr_meter; } /* Prime meridian */ prime_meridians = proj_list_prime_meridians(); s = nullptr; if ((name = pj_param(ctx, start, "spm").s) != nullptr) { const char *value = nullptr; char *next_str = nullptr; for (i = 0; prime_meridians[i].id != nullptr; ++i ) { if( strcmp(name,prime_meridians[i].id) == 0 ) { value = prime_meridians[i].defn; break; } } if( value == nullptr && (dmstor_ctx(ctx,name,&next_str) != 0.0 || *name == '0') && *next_str == '\0' ) value = name; if (!value) { proj_log_error(PIN, _("Invalid value for pm")); return pj_default_destructor (PIN, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); } PIN->from_greenwich = dmstor_ctx(ctx,value,nullptr); } else PIN->from_greenwich = 0.0; /* Private object for the geodesic functions */ PIN->geod = static_cast(calloc (1, sizeof (struct geod_geodesic))); if (nullptr==PIN->geod) return pj_default_destructor (PIN, PROJ_ERR_OTHER /*ENOMEM*/); geod_init(PIN->geod, PIN->a, (1 - sqrt (1 - PIN->es))); /* Projection specific initialization */ err = proj_errno_reset (PIN); PIN = proj(PIN); if (proj_errno (PIN)) { proj_destroy(PIN); return nullptr; } proj_errno_restore (PIN, err); return PIN; } proj-8.2.1/src/wkt1_parser.h000644 000765 000024 00000004056 13437770506 016361 0ustar00keversstaff000000 000000 /****************************************************************************** * Project: PROJ * Purpose: WKT1 parser grammar * Author: Even Rouault, * ****************************************************************************** * Copyright (c) 2013, Even Rouault * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. ****************************************************************************/ #ifndef PJ_WKT1_PARSER_H_INCLUDED #define PJ_WKT1_PARSER_H_INCLUDED #ifndef DOXYGEN_SKIP #ifdef __cplusplus extern "C" { #endif typedef struct pj_wkt1_parse_context pj_wkt1_parse_context; #include "wkt1_generated_parser.h" void pj_wkt1_error( pj_wkt1_parse_context *context, const char *msg ); int pj_wkt1_lex(YYSTYPE* pNode, pj_wkt1_parse_context *context); int pj_wkt1_parse(pj_wkt1_parse_context *context); #ifdef __cplusplus } std::string pj_wkt1_parse(const std::string& wkt); #endif #endif /* #ifndef DOXYGEN_SKIP */ #endif /* PJ_WKT1_PARSER_H_INCLUDED */ proj-8.2.1/src/rtodms.cpp000644 000765 000024 00000003722 13437770506 015761 0ustar00keversstaff000000 000000 /* Convert radian argument to DMS ascii format */ #include #include #include #include #include "proj.h" #include "proj_internal.h" /* ** RES is fractional second figures ** RES60 = 60 * RES ** CONV = 180 * 3600 * RES / PI (radians to RES seconds) */ static double RES = 1000., RES60 = 60000., CONV = 206264806.24709635516; static char format[50] = "%dd%d'%.3f\"%c"; static int dolong = 0; void set_rtodms(int fract, int con_w) { int i; if (fract >= 0 && fract < 9 ) { RES = 1.; /* following not very elegant, but used infrequently */ for (i = 0; i < fract; ++i) RES *= 10.; RES60 = RES * 60.; CONV = 180. * 3600. * RES / M_PI; if (! con_w) (void)sprintf(format,"%%dd%%d'%%.%df\"%%c", fract); else (void)sprintf(format,"%%dd%%02d'%%0%d.%df\"%%c", fract+2+(fract?1:0), fract); dolong = con_w; } } char * rtodms(char *s, double r, int pos, int neg) { int deg, min, sign; char *ss = s; double sec; if (r < 0) { r = -r; if (!pos) { *ss++ = '-'; sign = 0; } else sign = neg; } else sign = pos; r = floor(r * CONV + .5); sec = fmod(r / RES, 60.); r = floor(r / RES60); min = (int)fmod(r, 60.); r = floor(r / 60.); deg = (int)r; if (dolong) (void)sprintf(ss,format,deg,min,sec,sign); else if (sec != 0.0) { char *p, *q; /* double prime + pos/neg suffix (if included) + NUL */ size_t suffix_len = sign ? 3 : 2; (void)sprintf(ss,format,deg,min,sec,sign); /* Replace potential decimal comma by decimal point for non C locale */ for( p = ss; *p != '\0'; ++p ) { if( *p == ',' ) { *p = '.'; break; } } for (q = p = ss + strlen(ss) - suffix_len; *p == '0'; --p) ; if (*p != '.') ++p; if (++q != p) (void)memmove(p, q, suffix_len); } else if (min) (void)sprintf(ss,"%dd%d'%c",deg,min,sign); else (void)sprintf(ss,"%dd%c",deg, sign); return s; } proj-8.2.1/src/proj_config.h.in000644 000765 000024 00000004411 14164067214 017007 0ustar00keversstaff000000 000000 /* src/proj_config.h.in. Generated from configure.ac by autoheader. */ /* define if the compiler supports basic C++11 syntax */ #undef HAVE_CXX11 /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define to 1 if the compiler supports -Wzero-as-null-pointer-constant */ #undef HAVE_GCC_WARNING_ZERO_AS_NULL_POINTER_CONSTANT /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `dl' library (-ldl). */ #undef HAVE_LIBDL /* Define to 1 if you have the `m' library (-lm). */ #undef HAVE_LIBM /* Define to 1 if you have the `pthread' library (-lpthread). */ #undef HAVE_LIBPTHREAD /* Define to 1 if you have localeconv */ #undef HAVE_LOCALECONV /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define if your pthreads implementation have PTHREAD_MUTEX_RECURSIVE */ #undef HAVE_PTHREAD_MUTEX_RECURSIVE /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strerror' function. */ #undef HAVE_STRERROR /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to the sub-directory where libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION proj-8.2.1/src/wkt1_generated_parser.h000644 000765 000024 00000005503 14067153334 020367 0ustar00keversstaff000000 000000 /* A Bison parser, made by GNU Bison 3.5.1. */ /* Bison interface for Yacc-like parsers in C Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* Undocumented macros, especially those whose name start with YY_, are private implementation details. Do not rely on them. */ #ifndef YY_PJ_WKT1_SRC_WKT1_GENERATED_PARSER_H_INCLUDED # define YY_PJ_WKT1_SRC_WKT1_GENERATED_PARSER_H_INCLUDED /* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif #if YYDEBUG extern int pj_wkt1_debug; #endif /* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE enum yytokentype { END = 0, T_PARAM_MT = 258, T_CONCAT_MT = 259, T_INVERSE_MT = 260, T_PASSTHROUGH_MT = 261, T_PROJCS = 262, T_PROJECTION = 263, T_GEOGCS = 264, T_DATUM = 265, T_SPHEROID = 266, T_PRIMEM = 267, T_UNIT = 268, T_GEOCCS = 269, T_AUTHORITY = 270, T_VERT_CS = 271, T_VERTCS = 272, T_VERT_DATUM = 273, T_VDATUM = 274, T_COMPD_CS = 275, T_AXIS = 276, T_TOWGS84 = 277, T_FITTED_CS = 278, T_LOCAL_CS = 279, T_LOCAL_DATUM = 280, T_PARAMETER = 281, T_EXTENSION = 282, T_STRING = 283, T_NUMBER = 284, T_IDENTIFIER = 285 }; #endif /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif int pj_wkt1_parse (pj_wkt1_parse_context *context); #endif /* !YY_PJ_WKT1_SRC_WKT1_GENERATED_PARSER_H_INCLUDED */ proj-8.2.1/src/wkt2_generated_parser.h000644 000765 000024 00000013150 14067153334 020365 0ustar00keversstaff000000 000000 /* A Bison parser, made by GNU Bison 3.5.1. */ /* Bison interface for Yacc-like parsers in C Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* Undocumented macros, especially those whose name start with YY_, are private implementation details. Do not rely on them. */ #ifndef YY_PJ_WKT2_SRC_WKT2_GENERATED_PARSER_H_INCLUDED # define YY_PJ_WKT2_SRC_WKT2_GENERATED_PARSER_H_INCLUDED /* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif #if YYDEBUG extern int pj_wkt2_debug; #endif /* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE enum yytokentype { END = 0, T_PROJECTION = 258, T_DATUM = 259, T_SPHEROID = 260, T_PRIMEM = 261, T_UNIT = 262, T_AXIS = 263, T_PARAMETER = 264, T_GEODCRS = 265, T_LENGTHUNIT = 266, T_ANGLEUNIT = 267, T_SCALEUNIT = 268, T_TIMEUNIT = 269, T_ELLIPSOID = 270, T_CS = 271, T_ID = 272, T_PROJCRS = 273, T_BASEGEODCRS = 274, T_MERIDIAN = 275, T_BEARING = 276, T_ORDER = 277, T_ANCHOR = 278, T_CONVERSION = 279, T_METHOD = 280, T_REMARK = 281, T_GEOGCRS = 282, T_BASEGEOGCRS = 283, T_SCOPE = 284, T_AREA = 285, T_BBOX = 286, T_CITATION = 287, T_URI = 288, T_VERTCRS = 289, T_VDATUM = 290, T_GEOIDMODEL = 291, T_COMPOUNDCRS = 292, T_PARAMETERFILE = 293, T_COORDINATEOPERATION = 294, T_SOURCECRS = 295, T_TARGETCRS = 296, T_INTERPOLATIONCRS = 297, T_OPERATIONACCURACY = 298, T_CONCATENATEDOPERATION = 299, T_STEP = 300, T_BOUNDCRS = 301, T_ABRIDGEDTRANSFORMATION = 302, T_DERIVINGCONVERSION = 303, T_TDATUM = 304, T_CALENDAR = 305, T_TIMEORIGIN = 306, T_TIMECRS = 307, T_VERTICALEXTENT = 308, T_TIMEEXTENT = 309, T_USAGE = 310, T_DYNAMIC = 311, T_FRAMEEPOCH = 312, T_MODEL = 313, T_VELOCITYGRID = 314, T_ENSEMBLE = 315, T_MEMBER = 316, T_ENSEMBLEACCURACY = 317, T_DERIVEDPROJCRS = 318, T_BASEPROJCRS = 319, T_EDATUM = 320, T_ENGCRS = 321, T_PDATUM = 322, T_PARAMETRICCRS = 323, T_PARAMETRICUNIT = 324, T_BASEVERTCRS = 325, T_BASEENGCRS = 326, T_BASEPARAMCRS = 327, T_BASETIMECRS = 328, T_EPOCH = 329, T_COORDEPOCH = 330, T_COORDINATEMETADATA = 331, T_POINTMOTIONOPERATION = 332, T_VERSION = 333, T_GEODETICCRS = 334, T_GEODETICDATUM = 335, T_PROJECTEDCRS = 336, T_PRIMEMERIDIAN = 337, T_GEOGRAPHICCRS = 338, T_TRF = 339, T_VERTICALCRS = 340, T_VERTICALDATUM = 341, T_VRF = 342, T_TIMEDATUM = 343, T_TEMPORALQUANTITY = 344, T_ENGINEERINGDATUM = 345, T_ENGINEERINGCRS = 346, T_PARAMETRICDATUM = 347, T_AFFINE = 348, T_CARTESIAN = 349, T_CYLINDRICAL = 350, T_ELLIPSOIDAL = 351, T_LINEAR = 352, T_PARAMETRIC = 353, T_POLAR = 354, T_SPHERICAL = 355, T_VERTICAL = 356, T_TEMPORAL = 357, T_TEMPORALCOUNT = 358, T_TEMPORALMEASURE = 359, T_ORDINAL = 360, T_TEMPORALDATETIME = 361, T_NORTH = 362, T_NORTHNORTHEAST = 363, T_NORTHEAST = 364, T_EASTNORTHEAST = 365, T_EAST = 366, T_EASTSOUTHEAST = 367, T_SOUTHEAST = 368, T_SOUTHSOUTHEAST = 369, T_SOUTH = 370, T_SOUTHSOUTHWEST = 371, T_SOUTHWEST = 372, T_WESTSOUTHWEST = 373, T_WEST = 374, T_WESTNORTHWEST = 375, T_NORTHWEST = 376, T_NORTHNORTHWEST = 377, T_UP = 378, T_DOWN = 379, T_GEOCENTRICX = 380, T_GEOCENTRICY = 381, T_GEOCENTRICZ = 382, T_COLUMNPOSITIVE = 383, T_COLUMNNEGATIVE = 384, T_ROWPOSITIVE = 385, T_ROWNEGATIVE = 386, T_DISPLAYRIGHT = 387, T_DISPLAYLEFT = 388, T_DISPLAYUP = 389, T_DISPLAYDOWN = 390, T_FORWARD = 391, T_AFT = 392, T_PORT = 393, T_STARBOARD = 394, T_CLOCKWISE = 395, T_COUNTERCLOCKWISE = 396, T_TOWARDS = 397, T_AWAYFROM = 398, T_FUTURE = 399, T_PAST = 400, T_UNSPECIFIED = 401, T_STRING = 402, T_UNSIGNED_INTEGER_DIFFERENT_ONE_TWO_THREE = 403 }; #endif /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif int pj_wkt2_parse (pj_wkt2_parse_context *context); #endif /* !YY_PJ_WKT2_SRC_WKT2_GENERATED_PARSER_H_INCLUDED */ proj-8.2.1/src/generic_inverse.cpp000644 000765 000024 00000011167 14042216156 017607 0ustar00keversstaff000000 000000 /****************************************************************************** * * Project: PROJ * Purpose: Generic method to compute inverse projection from forward method * Author: Even Rouault * ****************************************************************************** * Copyright (c) 2018, Even Rouault * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. ****************************************************************************/ #include "proj_internal.h" #include #include /** Compute (lam, phi) corresponding to input (xy.x, xy.y) for projection P. * * Uses Newton-Raphson method, extended to 2D variables, that is using * inversion of the Jacobian 2D matrix of partial derivatives. The derivatives * are estimated numerically from the P->fwd method evaluated at close points. * * Note: thresholds used have been verified to work with adams_ws2 and wink2 * * Starts with initial guess provided by user in lpInitial */ PJ_LP pj_generic_inverse_2d(PJ_XY xy, PJ *P, PJ_LP lpInitial) { PJ_LP lp = lpInitial; double deriv_lam_X = 0; double deriv_lam_Y = 0; double deriv_phi_X = 0; double deriv_phi_Y = 0; for (int i = 0; i < 15; i++) { PJ_XY xyApprox = P->fwd(lp, P); const double deltaX = xyApprox.x - xy.x; const double deltaY = xyApprox.y - xy.y; if (fabs(deltaX) < 1e-10 && fabs(deltaY) < 1e-10) { return lp; } if (i == 0 || fabs(deltaX) > 1e-6 || fabs(deltaY) > 1e-6) { // Compute Jacobian matrix (only if we aren't close to the final // result to speed things a bit) PJ_LP lp2; PJ_XY xy2; const double dLam = lp.lam > 0 ? -1e-6 : 1e-6; lp2.lam = lp.lam + dLam; lp2.phi = lp.phi; xy2 = P->fwd(lp2, P); const double deriv_X_lam = (xy2.x - xyApprox.x) / dLam; const double deriv_Y_lam = (xy2.y - xyApprox.y) / dLam; const double dPhi = lp.phi > 0 ? -1e-6 : 1e-6; lp2.lam = lp.lam; lp2.phi = lp.phi + dPhi; xy2 = P->fwd(lp2, P); const double deriv_X_phi = (xy2.x - xyApprox.x) / dPhi; const double deriv_Y_phi = (xy2.y - xyApprox.y) / dPhi; // Inverse of Jacobian matrix const double det = deriv_X_lam * deriv_Y_phi - deriv_X_phi * deriv_Y_lam; if (det != 0) { deriv_lam_X = deriv_Y_phi / det; deriv_lam_Y = -deriv_X_phi / det; deriv_phi_X = -deriv_Y_lam / det; deriv_phi_Y = deriv_X_lam / det; } } if (xy.x != 0) { // Limit the amplitude of correction to avoid overshoots due to // bad initial guess const double delta_lam = std::max( std::min(deltaX * deriv_lam_X + deltaY * deriv_lam_Y, 0.3), -0.3); lp.lam -= delta_lam; if (lp.lam < -M_PI) lp.lam = -M_PI; else if (lp.lam > M_PI) lp.lam = M_PI; } if (xy.y != 0) { const double delta_phi = std::max( std::min(deltaX * deriv_phi_X + deltaY * deriv_phi_Y, 0.3), -0.3); lp.phi -= delta_phi; if (lp.phi < -M_HALFPI) lp.phi = -M_HALFPI; else if (lp.phi > M_HALFPI) lp.phi = M_HALFPI; } } proj_context_errno_set(P->ctx, PROJ_ERR_COORD_TRANSFM_OUTSIDE_PROJECTION_DOMAIN); return lp; } proj-8.2.1/src/initcache.cpp000644 000765 000024 00000013600 14067153334 016366 0ustar00keversstaff000000 000000 /****************************************************************************** * Project: PROJ.4 * Purpose: init file definition cache. * Author: Frank Warmerdam, warmerdam@pobox.com * ****************************************************************************** * Copyright (c) 2009, Frank Warmerdam * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. *****************************************************************************/ #include #include #include "proj.h" #include "proj_internal.h" static int cache_count = 0; static int cache_alloc = 0; static char **cache_key = nullptr; static paralist **cache_paralist = nullptr; /************************************************************************/ /* pj_clone_paralist() */ /* */ /* Allocate a copy of a parameter list. */ /************************************************************************/ paralist *pj_clone_paralist( const paralist *list) { paralist *list_copy = nullptr, *next_copy = nullptr; for( ; list != nullptr; list = list->next ) { paralist *newitem = (paralist *) malloc(sizeof(paralist) + strlen(list->param)); assert(newitem); newitem->used = 0; newitem->next = nullptr; strcpy( newitem->param, list->param ); if( next_copy ) next_copy->next = newitem; else list_copy = newitem; next_copy = newitem; } return list_copy; } /************************************************************************/ /* pj_clear_initcache() */ /* */ /* Clear out all memory held in the init file cache. */ /************************************************************************/ void pj_clear_initcache() { if( cache_alloc > 0 ) { int i; pj_acquire_lock(); for( i = 0; i < cache_count; i++ ) { paralist *n, *t = cache_paralist[i]; free( cache_key[i] ); /* free parameter list elements */ for (; t != nullptr; t = n) { n = t->next; free(t); } } free( cache_key ); free( cache_paralist ); cache_count = 0; cache_alloc= 0; cache_key = nullptr; cache_paralist = nullptr; pj_release_lock(); } } /************************************************************************/ /* pj_search_initcache() */ /* */ /* Search for a matching definition in the init cache. */ /************************************************************************/ paralist *pj_search_initcache( const char *filekey ) { int i; paralist *result = nullptr; pj_acquire_lock(); for( i = 0; result == nullptr && i < cache_count; i++) { if( strcmp(filekey,cache_key[i]) == 0 ) { result = pj_clone_paralist( cache_paralist[i] ); } } pj_release_lock(); return result; } /************************************************************************/ /* pj_insert_initcache() */ /* */ /* Insert a paralist definition in the init file cache. */ /************************************************************************/ void pj_insert_initcache( const char *filekey, const paralist *list ) { pj_acquire_lock(); /* ** Grow list if required. */ if( cache_count == cache_alloc ) { char **cache_key_new; paralist **cache_paralist_new; cache_alloc = cache_alloc * 2 + 15; cache_key_new = (char **) malloc(sizeof(char*) * cache_alloc); assert(cache_key_new); if( cache_key && cache_count ) { memcpy( cache_key_new, cache_key, sizeof(char*) * cache_count); } free( cache_key ); cache_key = cache_key_new; cache_paralist_new = (paralist **) malloc(sizeof(paralist*) * cache_alloc); assert(cache_paralist_new); if( cache_paralist && cache_count ) { memcpy( cache_paralist_new, cache_paralist, sizeof(paralist*) * cache_count ); } free( cache_paralist ); cache_paralist = cache_paralist_new; } /* ** Duplicate the filekey and paralist, and insert in cache. */ cache_key[cache_count] = (char *) malloc(strlen(filekey)+1); assert(cache_key[cache_count]); strcpy( cache_key[cache_count], filekey ); cache_paralist[cache_count] = pj_clone_paralist( list ); cache_count++; pj_release_lock(); } proj-8.2.1/src/apps/000755 000765 000024 00000000000 14164067215 014676 5ustar00keversstaff000000 000000 proj-8.2.1/src/Makefile.in000644 000765 000024 00000355773 14164067170 016024 0ustar00keversstaff000000 000000 # Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ EXTRA_PROGRAMS = multistresstest$(EXEEXT) TESTS = geodtest$(EXEEXT) check_PROGRAMS = geodtest$(EXEEXT) bin_PROGRAMS = proj$(EXEEXT) geod$(EXEEXT) cs2cs$(EXEEXT) gie$(EXEEXT) \ cct$(EXEEXT) projinfo$(EXEEXT) $(am__EXEEXT_1) noinst_PROGRAMS = invproj$(EXEEXT) invgeod$(EXEEXT) subdir = src ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(include_HEADERS) \ $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = proj_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @HAVE_CURL_TRUE@am__EXEEXT_1 = projsync$(EXEEXT) am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libdir)" \ "$(DESTDIR)$(includedir)" PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } LTLIBRARIES = $(lib_LTLIBRARIES) libproj_la_DEPENDENCIES = am__dirstamp = $(am__leading_dot)dirstamp am_libproj_la_OBJECTS = iso19111/static.lo iso19111/util.lo \ iso19111/metadata.lo iso19111/common.lo iso19111/crs.lo \ iso19111/datum.lo iso19111/coordinatesystem.lo \ iso19111/operation/concatenatedoperation.lo \ iso19111/operation/coordinateoperationfactory.lo \ iso19111/operation/conversion.lo \ iso19111/operation/esriparammappings.lo \ iso19111/operation/oputils.lo \ iso19111/operation/parammappings.lo \ iso19111/operation/projbasedoperation.lo \ iso19111/operation/singleoperation.lo \ iso19111/operation/transformation.lo \ iso19111/operation/vectorofvaluesparams.lo iso19111/io.lo \ iso19111/internal.lo iso19111/factory.lo iso19111/c_api.lo \ projections/aeqd.lo projections/adams.lo projections/gnom.lo \ projections/laea.lo projections/mod_ster.lo \ projections/nsper.lo projections/nzmg.lo projections/ortho.lo \ projections/stere.lo projections/sterea.lo projections/aea.lo \ projections/bipc.lo projections/bonne.lo projections/eqdc.lo \ projections/isea.lo projections/ccon.lo projections/imw_p.lo \ projections/krovak.lo projections/lcc.lo projections/poly.lo \ projections/rpoly.lo projections/sconics.lo \ projections/rouss.lo projections/cass.lo projections/cc.lo \ projections/cea.lo projections/eqc.lo projections/gall.lo \ projections/labrd.lo projections/lsat.lo \ projections/misrsom.lo projections/merc.lo projections/mill.lo \ projections/ocea.lo projections/omerc.lo projections/somerc.lo \ projections/tcc.lo projections/tcea.lo projections/times.lo \ projections/tmerc.lo projections/tobmerc.lo \ projections/airy.lo projections/aitoff.lo \ projections/august.lo projections/bacon.lo \ projections/bertin1953.lo projections/chamb.lo \ projections/hammer.lo projections/lagrng.lo \ projections/larr.lo projections/lask.lo projections/latlong.lo \ projections/nicol.lo projections/ob_tran.lo projections/oea.lo \ projections/tpeqd.lo projections/vandg.lo \ projections/vandg2.lo projections/vandg4.lo \ projections/wag7.lo projections/lcca.lo projections/geos.lo \ projections/boggs.lo projections/collg.lo \ projections/comill.lo projections/crast.lo \ projections/denoy.lo projections/eck1.lo projections/eck2.lo \ projections/eck3.lo projections/eck4.lo projections/eck5.lo \ projections/fahey.lo projections/fouc_s.lo \ projections/gins8.lo projections/gstmerc.lo \ projections/gn_sinu.lo projections/goode.lo projections/igh.lo \ projections/igh_o.lo projections/hatano.lo \ projections/loxim.lo projections/mbt_fps.lo \ projections/mbtfpp.lo projections/mbtfpq.lo \ projections/moll.lo projections/nell.lo projections/nell_h.lo \ projections/patterson.lo projections/putp2.lo \ projections/putp3.lo projections/putp4p.lo \ projections/putp5.lo projections/putp6.lo projections/qsc.lo \ projections/robin.lo projections/s2.lo projections/sch.lo \ projections/sts.lo projections/urm5.lo projections/urmfps.lo \ projections/wag2.lo projections/wag3.lo projections/wink1.lo \ projections/wink2.lo projections/healpix.lo \ projections/natearth.lo projections/natearth2.lo \ projections/calcofi.lo projections/eqearth.lo \ projections/col_urban.lo conversions/axisswap.lo \ conversions/cart.lo conversions/geoc.lo conversions/geocent.lo \ conversions/noop.lo conversions/topocentric.lo \ conversions/set.lo conversions/unitconvert.lo \ transformations/affine.lo transformations/deformation.lo \ transformations/helmert.lo transformations/hgridshift.lo \ transformations/horner.lo transformations/molodensky.lo \ transformations/vgridshift.lo transformations/xyzgridshift.lo \ transformations/defmodel.lo transformations/tinshift.lo \ aasincos.lo adjlon.lo dmstor.lo auth.lo deriv.lo ell_set.lo \ ellps.lo factors.lo fwd.lo init.lo inv.lo list.lo malloc.lo \ mlfn.lo msfn.lo proj_mdist.lo param.lo phi2.lo pr_list.lo \ qsfn.lo strerrno.lo tsfn.lo units.lo ctx.lo log.lo zpoly1.lo \ rtodms.lo release.lo gauss.lo generic_inverse.lo datums.lo \ datum_set.lo mutex.lo initcache.lo geodesic.lo strtod.lo \ 4D_api.lo pipeline.lo internal.lo wkt_parser.lo wkt1_parser.lo \ wkt1_generated_parser.lo wkt2_parser.lo \ wkt2_generated_parser.lo proj_json_streaming_writer.lo \ tracing.lo grids.lo filemanager.lo networkfilemanager.lo \ sqlite3_utils.lo libproj_la_OBJECTS = $(am_libproj_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libproj_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(libproj_la_LDFLAGS) $(LDFLAGS) -o $@ am_cct_OBJECTS = apps/cct.$(OBJEXT) apps/proj_strtod.$(OBJEXT) cct_OBJECTS = $(am_cct_OBJECTS) cct_DEPENDENCIES = libproj.la am_cs2cs_OBJECTS = apps/cs2cs.$(OBJEXT) apps/emess.$(OBJEXT) \ apps/utils.$(OBJEXT) cs2cs_OBJECTS = $(am_cs2cs_OBJECTS) cs2cs_DEPENDENCIES = libproj.la am_geod_OBJECTS = apps/geod.$(OBJEXT) apps/geod_set.$(OBJEXT) \ apps/geod_interface.$(OBJEXT) apps/emess.$(OBJEXT) geod_OBJECTS = $(am_geod_OBJECTS) geod_DEPENDENCIES = libproj.la am_geodtest_OBJECTS = tests/geodtest.$(OBJEXT) geodtest_OBJECTS = $(am_geodtest_OBJECTS) geodtest_DEPENDENCIES = libproj.la am_gie_OBJECTS = apps/gie.$(OBJEXT) apps/proj_strtod.$(OBJEXT) gie_OBJECTS = $(am_gie_OBJECTS) gie_DEPENDENCIES = libproj.la am__objects_1 = apps/geod.$(OBJEXT) apps/geod_set.$(OBJEXT) \ apps/geod_interface.$(OBJEXT) apps/emess.$(OBJEXT) am_invgeod_OBJECTS = $(am__objects_1) invgeod_OBJECTS = $(am_invgeod_OBJECTS) invgeod_DEPENDENCIES = $(geod_LDADD) am__objects_2 = apps/proj.$(OBJEXT) apps/emess.$(OBJEXT) \ apps/utils.$(OBJEXT) am_invproj_OBJECTS = $(am__objects_2) invproj_OBJECTS = $(am_invproj_OBJECTS) invproj_DEPENDENCIES = $(proj_LDADD) am_multistresstest_OBJECTS = tests/multistresstest.$(OBJEXT) multistresstest_OBJECTS = $(am_multistresstest_OBJECTS) multistresstest_DEPENDENCIES = libproj.la am_proj_OBJECTS = apps/proj.$(OBJEXT) apps/emess.$(OBJEXT) \ apps/utils.$(OBJEXT) proj_OBJECTS = $(am_proj_OBJECTS) proj_DEPENDENCIES = libproj.la am_projinfo_OBJECTS = apps/projinfo.$(OBJEXT) projinfo_OBJECTS = $(am_projinfo_OBJECTS) projinfo_DEPENDENCIES = libproj.la am__projsync_SOURCES_DIST = apps/projsync.cpp @HAVE_CURL_TRUE@am_projsync_OBJECTS = apps/projsync.$(OBJEXT) projsync_OBJECTS = $(am_projsync_OBJECTS) @HAVE_CURL_TRUE@projsync_DEPENDENCIES = libproj.la AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/4D_api.Plo ./$(DEPDIR)/aasincos.Plo \ ./$(DEPDIR)/adjlon.Plo ./$(DEPDIR)/auth.Plo \ ./$(DEPDIR)/ctx.Plo ./$(DEPDIR)/datum_set.Plo \ ./$(DEPDIR)/datums.Plo ./$(DEPDIR)/deriv.Plo \ ./$(DEPDIR)/dmstor.Plo ./$(DEPDIR)/ell_set.Plo \ ./$(DEPDIR)/ellps.Plo ./$(DEPDIR)/factors.Plo \ ./$(DEPDIR)/filemanager.Plo ./$(DEPDIR)/fwd.Plo \ ./$(DEPDIR)/gauss.Plo ./$(DEPDIR)/generic_inverse.Plo \ ./$(DEPDIR)/geodesic.Plo ./$(DEPDIR)/grids.Plo \ ./$(DEPDIR)/init.Plo ./$(DEPDIR)/initcache.Plo \ ./$(DEPDIR)/internal.Plo ./$(DEPDIR)/inv.Plo \ ./$(DEPDIR)/list.Plo ./$(DEPDIR)/log.Plo \ ./$(DEPDIR)/malloc.Plo ./$(DEPDIR)/mlfn.Plo \ ./$(DEPDIR)/msfn.Plo ./$(DEPDIR)/mutex.Plo \ ./$(DEPDIR)/networkfilemanager.Plo ./$(DEPDIR)/param.Plo \ ./$(DEPDIR)/phi2.Plo ./$(DEPDIR)/pipeline.Plo \ ./$(DEPDIR)/pr_list.Plo \ ./$(DEPDIR)/proj_json_streaming_writer.Plo \ ./$(DEPDIR)/proj_mdist.Plo ./$(DEPDIR)/qsfn.Plo \ ./$(DEPDIR)/release.Plo ./$(DEPDIR)/rtodms.Plo \ ./$(DEPDIR)/sqlite3_utils.Plo ./$(DEPDIR)/strerrno.Plo \ ./$(DEPDIR)/strtod.Plo ./$(DEPDIR)/tracing.Plo \ ./$(DEPDIR)/tsfn.Plo ./$(DEPDIR)/units.Plo \ ./$(DEPDIR)/wkt1_generated_parser.Plo \ ./$(DEPDIR)/wkt1_parser.Plo \ ./$(DEPDIR)/wkt2_generated_parser.Plo \ ./$(DEPDIR)/wkt2_parser.Plo ./$(DEPDIR)/wkt_parser.Plo \ ./$(DEPDIR)/zpoly1.Plo apps/$(DEPDIR)/cct.Po \ apps/$(DEPDIR)/cs2cs.Po apps/$(DEPDIR)/emess.Po \ apps/$(DEPDIR)/geod.Po apps/$(DEPDIR)/geod_interface.Po \ apps/$(DEPDIR)/geod_set.Po apps/$(DEPDIR)/gie.Po \ apps/$(DEPDIR)/proj.Po apps/$(DEPDIR)/proj_strtod.Po \ apps/$(DEPDIR)/projinfo.Po apps/$(DEPDIR)/projsync.Po \ apps/$(DEPDIR)/utils.Po conversions/$(DEPDIR)/axisswap.Plo \ conversions/$(DEPDIR)/cart.Plo conversions/$(DEPDIR)/geoc.Plo \ conversions/$(DEPDIR)/geocent.Plo \ conversions/$(DEPDIR)/noop.Plo conversions/$(DEPDIR)/set.Plo \ conversions/$(DEPDIR)/topocentric.Plo \ conversions/$(DEPDIR)/unitconvert.Plo \ iso19111/$(DEPDIR)/c_api.Plo iso19111/$(DEPDIR)/common.Plo \ iso19111/$(DEPDIR)/coordinatesystem.Plo \ iso19111/$(DEPDIR)/crs.Plo iso19111/$(DEPDIR)/datum.Plo \ iso19111/$(DEPDIR)/factory.Plo iso19111/$(DEPDIR)/internal.Plo \ iso19111/$(DEPDIR)/io.Plo iso19111/$(DEPDIR)/metadata.Plo \ iso19111/$(DEPDIR)/static.Plo iso19111/$(DEPDIR)/util.Plo \ iso19111/operation/$(DEPDIR)/concatenatedoperation.Plo \ iso19111/operation/$(DEPDIR)/conversion.Plo \ iso19111/operation/$(DEPDIR)/coordinateoperationfactory.Plo \ iso19111/operation/$(DEPDIR)/esriparammappings.Plo \ iso19111/operation/$(DEPDIR)/oputils.Plo \ iso19111/operation/$(DEPDIR)/parammappings.Plo \ iso19111/operation/$(DEPDIR)/projbasedoperation.Plo \ iso19111/operation/$(DEPDIR)/singleoperation.Plo \ iso19111/operation/$(DEPDIR)/transformation.Plo \ iso19111/operation/$(DEPDIR)/vectorofvaluesparams.Plo \ projections/$(DEPDIR)/adams.Plo projections/$(DEPDIR)/aea.Plo \ projections/$(DEPDIR)/aeqd.Plo projections/$(DEPDIR)/airy.Plo \ projections/$(DEPDIR)/aitoff.Plo \ projections/$(DEPDIR)/august.Plo \ projections/$(DEPDIR)/bacon.Plo \ projections/$(DEPDIR)/bertin1953.Plo \ projections/$(DEPDIR)/bipc.Plo projections/$(DEPDIR)/boggs.Plo \ projections/$(DEPDIR)/bonne.Plo \ projections/$(DEPDIR)/calcofi.Plo \ projections/$(DEPDIR)/cass.Plo projections/$(DEPDIR)/cc.Plo \ projections/$(DEPDIR)/ccon.Plo projections/$(DEPDIR)/cea.Plo \ projections/$(DEPDIR)/chamb.Plo \ projections/$(DEPDIR)/col_urban.Plo \ projections/$(DEPDIR)/collg.Plo \ projections/$(DEPDIR)/comill.Plo \ projections/$(DEPDIR)/crast.Plo \ projections/$(DEPDIR)/denoy.Plo projections/$(DEPDIR)/eck1.Plo \ projections/$(DEPDIR)/eck2.Plo projections/$(DEPDIR)/eck3.Plo \ projections/$(DEPDIR)/eck4.Plo projections/$(DEPDIR)/eck5.Plo \ projections/$(DEPDIR)/eqc.Plo projections/$(DEPDIR)/eqdc.Plo \ projections/$(DEPDIR)/eqearth.Plo \ projections/$(DEPDIR)/fahey.Plo \ projections/$(DEPDIR)/fouc_s.Plo \ projections/$(DEPDIR)/gall.Plo projections/$(DEPDIR)/geos.Plo \ projections/$(DEPDIR)/gins8.Plo \ projections/$(DEPDIR)/gn_sinu.Plo \ projections/$(DEPDIR)/gnom.Plo projections/$(DEPDIR)/goode.Plo \ projections/$(DEPDIR)/gstmerc.Plo \ projections/$(DEPDIR)/hammer.Plo \ projections/$(DEPDIR)/hatano.Plo \ projections/$(DEPDIR)/healpix.Plo \ projections/$(DEPDIR)/igh.Plo projections/$(DEPDIR)/igh_o.Plo \ projections/$(DEPDIR)/imw_p.Plo projections/$(DEPDIR)/isea.Plo \ projections/$(DEPDIR)/krovak.Plo \ projections/$(DEPDIR)/labrd.Plo projections/$(DEPDIR)/laea.Plo \ projections/$(DEPDIR)/lagrng.Plo \ projections/$(DEPDIR)/larr.Plo projections/$(DEPDIR)/lask.Plo \ projections/$(DEPDIR)/latlong.Plo \ projections/$(DEPDIR)/lcc.Plo projections/$(DEPDIR)/lcca.Plo \ projections/$(DEPDIR)/loxim.Plo projections/$(DEPDIR)/lsat.Plo \ projections/$(DEPDIR)/mbt_fps.Plo \ projections/$(DEPDIR)/mbtfpp.Plo \ projections/$(DEPDIR)/mbtfpq.Plo \ projections/$(DEPDIR)/merc.Plo projections/$(DEPDIR)/mill.Plo \ projections/$(DEPDIR)/misrsom.Plo \ projections/$(DEPDIR)/mod_ster.Plo \ projections/$(DEPDIR)/moll.Plo \ projections/$(DEPDIR)/natearth.Plo \ projections/$(DEPDIR)/natearth2.Plo \ projections/$(DEPDIR)/nell.Plo \ projections/$(DEPDIR)/nell_h.Plo \ projections/$(DEPDIR)/nicol.Plo \ projections/$(DEPDIR)/nsper.Plo projections/$(DEPDIR)/nzmg.Plo \ projections/$(DEPDIR)/ob_tran.Plo \ projections/$(DEPDIR)/ocea.Plo projections/$(DEPDIR)/oea.Plo \ projections/$(DEPDIR)/omerc.Plo \ projections/$(DEPDIR)/ortho.Plo \ projections/$(DEPDIR)/patterson.Plo \ projections/$(DEPDIR)/poly.Plo projections/$(DEPDIR)/putp2.Plo \ projections/$(DEPDIR)/putp3.Plo \ projections/$(DEPDIR)/putp4p.Plo \ projections/$(DEPDIR)/putp5.Plo \ projections/$(DEPDIR)/putp6.Plo projections/$(DEPDIR)/qsc.Plo \ projections/$(DEPDIR)/robin.Plo \ projections/$(DEPDIR)/rouss.Plo \ projections/$(DEPDIR)/rpoly.Plo projections/$(DEPDIR)/s2.Plo \ projections/$(DEPDIR)/sch.Plo \ projections/$(DEPDIR)/sconics.Plo \ projections/$(DEPDIR)/somerc.Plo \ projections/$(DEPDIR)/stere.Plo \ projections/$(DEPDIR)/sterea.Plo projections/$(DEPDIR)/sts.Plo \ projections/$(DEPDIR)/tcc.Plo projections/$(DEPDIR)/tcea.Plo \ projections/$(DEPDIR)/times.Plo \ projections/$(DEPDIR)/tmerc.Plo \ projections/$(DEPDIR)/tobmerc.Plo \ projections/$(DEPDIR)/tpeqd.Plo projections/$(DEPDIR)/urm5.Plo \ projections/$(DEPDIR)/urmfps.Plo \ projections/$(DEPDIR)/vandg.Plo \ projections/$(DEPDIR)/vandg2.Plo \ projections/$(DEPDIR)/vandg4.Plo \ projections/$(DEPDIR)/wag2.Plo projections/$(DEPDIR)/wag3.Plo \ projections/$(DEPDIR)/wag7.Plo projections/$(DEPDIR)/wink1.Plo \ projections/$(DEPDIR)/wink2.Plo tests/$(DEPDIR)/geodtest.Po \ tests/$(DEPDIR)/multistresstest.Po \ transformations/$(DEPDIR)/affine.Plo \ transformations/$(DEPDIR)/defmodel.Plo \ transformations/$(DEPDIR)/deformation.Plo \ transformations/$(DEPDIR)/helmert.Plo \ transformations/$(DEPDIR)/hgridshift.Plo \ transformations/$(DEPDIR)/horner.Plo \ transformations/$(DEPDIR)/molodensky.Plo \ transformations/$(DEPDIR)/tinshift.Plo \ transformations/$(DEPDIR)/vgridshift.Plo \ transformations/$(DEPDIR)/xyzgridshift.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) am__v_CXX_0 = @echo " CXX " $@; am__v_CXX_1 = CXXLD = $(CXX) CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) am__v_CXXLD_0 = @echo " CXXLD " $@; am__v_CXXLD_1 = SOURCES = $(libproj_la_SOURCES) $(cct_SOURCES) $(cs2cs_SOURCES) \ $(geod_SOURCES) $(geodtest_SOURCES) $(gie_SOURCES) \ $(invgeod_SOURCES) $(invproj_SOURCES) \ $(multistresstest_SOURCES) $(proj_SOURCES) $(projinfo_SOURCES) \ $(projsync_SOURCES) DIST_SOURCES = $(libproj_la_SOURCES) $(cct_SOURCES) $(cs2cs_SOURCES) \ $(geod_SOURCES) $(geodtest_SOURCES) $(gie_SOURCES) \ $(invgeod_SOURCES) $(invproj_SOURCES) \ $(multistresstest_SOURCES) $(proj_SOURCES) $(projinfo_SOURCES) \ $(am__projsync_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(include_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ $(LISP)proj_config.h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no am__tty_colors = { \ $(am__tty_colors_dummy); \ if test "X$(AM_COLOR_TESTS)" = Xno; then \ am__color_tests=no; \ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ am__color_tests=yes; \ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ am__color_tests=yes; \ fi; \ if test $$am__color_tests = yes; then \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ mgn=''; \ brg=''; \ std=''; \ fi; \ } am__recheck_rx = ^[ ]*:recheck:[ ]* am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* # A command that, given a newline-separated list of test names on the # standard input, print the name of the tests that are to be re-run # upon "make recheck". am__list_recheck_tests = $(AWK) '{ \ recheck = 1; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ { \ if ((getline line2 < ($$0 ".log")) < 0) \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ { \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ { \ break; \ } \ }; \ if (recheck) \ print $$0; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # A command that, given a newline-separated list of test names on the # standard input, create the global log from their .trs and .log files. am__create_global_log = $(AWK) ' \ function fatal(msg) \ { \ print "fatal: making $@: " msg | "cat >&2"; \ exit 1; \ } \ function rst_section(header) \ { \ print header; \ len = length(header); \ for (i = 1; i <= len; i = i + 1) \ printf "="; \ printf "\n\n"; \ } \ { \ copy_in_global_log = 1; \ global_test_result = "RUN"; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".trs"); \ if (line ~ /$(am__global_test_result_rx)/) \ { \ sub("$(am__global_test_result_rx)", "", line); \ sub("[ ]*$$", "", line); \ global_test_result = line; \ } \ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ copy_in_global_log = 0; \ }; \ if (copy_in_global_log) \ { \ rst_section(global_test_result ": " $$0); \ while ((rc = (getline line < ($$0 ".log"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".log"); \ print line; \ }; \ printf "\n"; \ }; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # Restructured Text title. am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } # Solaris 10 'make', and several other traditional 'make' implementations, # pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it # by disabling -e (using the XSI extension "set +e") if it's set. am__sh_e_setup = case $$- in *e*) set +e;; esac # Default flags passed to test drivers. am__common_driver_flags = \ --color-tests "$$am__color_tests" \ --enable-hard-errors "$$am__enable_hard_errors" \ --expect-failure "$$am__expect_failure" # To be inserted before the command running the test. Creates the # directory for the log if needed. Stores in $dir the directory # containing $f, in $tst the test, in $log the log. Executes the # developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and # passes TESTS_ENVIRONMENT. Set up options for the wrapper that # will run the test scripts (or their associated LOG_COMPILER, if # thy have one). am__check_pre = \ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ $(am__tty_colors); \ srcdir=$(srcdir); export srcdir; \ case "$@" in \ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ *) am__odir=.;; \ esac; \ test "x$$am__odir" = x"." || test -d "$$am__odir" \ || $(MKDIR_P) "$$am__odir" || exit $$?; \ if test -f "./$$f"; then dir=./; \ elif test -f "$$f"; then dir=; \ else dir="$(srcdir)/"; fi; \ tst=$$dir$$f; log='$@'; \ if test -n '$(DISABLE_HARD_ERRORS)'; then \ am__enable_hard_errors=no; \ else \ am__enable_hard_errors=yes; \ fi; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ am__expect_failure=yes;; \ *) \ am__expect_failure=no;; \ esac; \ $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) # A shell command to get the names of the tests scripts with any registered # extension removed (i.e., equivalently, the names of the test logs, with # the '.log' extension removed). The result is saved in the shell variable # '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, # we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", # since that might cause problem with VPATH rewrites for suffix-less tests. # See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck TEST_SUITE_LOG = test-suite.log TEST_EXTENSIONS = @EXEEXT@ .test LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) am__set_b = \ case '$@' in \ */*) \ case '$*' in \ */*) b='$*';; \ *) b=`echo '$@' | sed 's/\.log$$//'`; \ esac;; \ *) \ b='$*';; \ esac am__test_logs1 = $(TESTS:=.log) am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) TEST_LOGS = $(am__test_logs2:.test.log=.log) TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ $(TEST_LOG_FLAGS) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/proj_config.h.in \ $(top_srcdir)/depcomp $(top_srcdir)/test-driver DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURL_CFLAGS = @CURL_CFLAGS@ CURL_ENABLED_FLAGS = @CURL_ENABLED_FLAGS@ CURL_LIBS = @CURL_LIBS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CXX_WFLAGS = @CXX_WFLAGS@ CYGPATH_W = @CYGPATH_W@ C_WFLAGS = @C_WFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ EXTRA_LIBS = @EXTRA_LIBS@ FGREP = @FGREP@ FLTO_FLAG = @FLTO_FLAG@ GREP = @GREP@ GTEST_CFLAGS = @GTEST_CFLAGS@ GTEST_LIBS = @GTEST_LIBS@ HAVE_CXX11 = @HAVE_CXX11@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBCURL_CONFIG = @LIBCURL_CONFIG@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MUTEX_SETTING = @MUTEX_SETTING@ NM = @NM@ NMEDIT = @NMEDIT@ NO_ZERO_AS_NULL_POINTER_CONSTANT_FLAG = @NO_ZERO_AS_NULL_POINTER_CONSTANT_FLAG@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PROJ_LIB_ENV_VAR_TRIED_LAST_FLAGS = @PROJ_LIB_ENV_VAR_TRIED_LAST_FLAGS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ SQLITE3_CHECK = @SQLITE3_CHECK@ SQLITE3_LIBS = @SQLITE3_LIBS@ STRIP = @STRIP@ THREAD_LIB = @THREAD_LIB@ TIFF_CFLAGS = @TIFF_CFLAGS@ TIFF_ENABLED_FLAGS = @TIFF_ENABLED_FLAGS@ TIFF_LIBS = @TIFF_LIBS@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CFLAGS = @C_WFLAGS@ AM_CPPFLAGS = -DPROJ_LIB=\"$(pkgdatadir)\" \ -DMUTEX_@MUTEX_SETTING@ -I$(top_srcdir)/include @SQLITE3_CFLAGS@ @TIFF_CFLAGS@ @TIFF_ENABLED_FLAGS@ @CURL_CFLAGS@ @CURL_ENABLED_FLAGS@ @PROJ_LIB_ENV_VAR_TRIED_LAST_FLAGS@ AM_CXXFLAGS = @CXX_WFLAGS@ @FLTO_FLAG@ include_HEADERS = proj.h proj_experimental.h proj_constants.h geodesic.h \ proj_symbol_rename.h EXTRA_DIST = bin_cct.cmake bin_gie.cmake bin_cs2cs.cmake \ bin_geod.cmake bin_proj.cmake bin_projinfo.cmake \ lib_proj.cmake \ check_md5sum.cmake \ generate_wkt_parser.cmake \ CMakeLists.txt \ bin_geodtest.cmake \ bin_projsync.cmake \ tests/geodtest.cpp \ wkt1_grammar.y wkt2_grammar.y apps/emess.h apps/utils.h \ apps/projsync.cpp proj_SOURCES = apps/proj.cpp apps/emess.cpp apps/utils.cpp invproj_SOURCES = $(proj_SOURCES) projinfo_SOURCES = apps/projinfo.cpp cs2cs_SOURCES = apps/cs2cs.cpp apps/emess.cpp apps/utils.cpp cct_SOURCES = apps/cct.cpp apps/proj_strtod.cpp apps/proj_strtod.h apps/optargpm.h geod_SOURCES = apps/geod.cpp apps/geod_set.cpp apps/geod_interface.cpp apps/geod_interface.h apps/emess.cpp invgeod_SOURCES = $(geod_SOURCES) @HAVE_CURL_TRUE@projsync_SOURCES = apps/projsync.cpp @HAVE_CURL_TRUE@projsync_LDADD = libproj.la @HAVE_CURL_TRUE@PROJSYNC_BIN = projsync gie_SOURCES = apps/gie.cpp apps/proj_strtod.cpp apps/proj_strtod.h apps/optargpm.h multistresstest_SOURCES = tests/multistresstest.cpp geodtest_SOURCES = tests/geodtest.cpp cct_LDADD = libproj.la cs2cs_LDADD = libproj.la geod_LDADD = libproj.la invgeod_LDADD = $(geod_LDADD) proj_LDADD = libproj.la invproj_LDADD = $(proj_LDADD) projinfo_LDADD = libproj.la gie_LDADD = libproj.la multistresstest_LDADD = libproj.la @THREAD_LIB@ geodtest_LDADD = libproj.la lib_LTLIBRARIES = libproj.la libproj_la_LDFLAGS = -no-undefined -version-info 24:1:2 libproj_la_LIBADD = @SQLITE3_LIBS@ @TIFF_LIBS@ @CURL_LIBS@ libproj_la_SOURCES = \ pj_list.h proj_internal.h \ \ iso19111/static.cpp \ iso19111/util.cpp \ iso19111/metadata.cpp \ iso19111/common.cpp \ iso19111/crs.cpp \ iso19111/datum.cpp \ iso19111/coordinatesystem.cpp \ iso19111/operation/concatenatedoperation.cpp \ iso19111/operation/coordinateoperation_internal.hpp \ iso19111/operation/coordinateoperation_private.hpp \ iso19111/operation/coordinateoperationfactory.cpp \ iso19111/operation/conversion.cpp \ iso19111/operation/esriparammappings.hpp \ iso19111/operation/esriparammappings.cpp \ iso19111/operation/operationmethod_private.hpp \ iso19111/operation/oputils.hpp \ iso19111/operation/oputils.cpp \ iso19111/operation/parammappings.hpp \ iso19111/operation/parammappings.cpp \ iso19111/operation/projbasedoperation.cpp \ iso19111/operation/singleoperation.cpp \ iso19111/operation/transformation.cpp \ iso19111/operation/vectorofvaluesparams.hpp \ iso19111/operation/vectorofvaluesparams.cpp \ iso19111/io.cpp \ iso19111/internal.cpp \ iso19111/factory.cpp \ iso19111/c_api.cpp \ \ projections/aeqd.cpp \ projections/adams.cpp \ projections/gnom.cpp \ projections/laea.cpp \ projections/mod_ster.cpp \ projections/nsper.cpp \ projections/nzmg.cpp \ projections/ortho.cpp \ projections/stere.cpp \ projections/sterea.cpp \ projections/aea.cpp \ projections/bipc.cpp \ projections/bonne.cpp \ projections/eqdc.cpp \ projections/isea.cpp \ projections/ccon.cpp \ projections/imw_p.cpp \ projections/krovak.cpp \ projections/lcc.cpp \ projections/poly.cpp \ projections/rpoly.cpp \ projections/sconics.cpp \ projections/rouss.cpp \ projections/cass.cpp \ projections/cc.cpp \ projections/cea.cpp \ projections/eqc.cpp \ projections/gall.cpp \ projections/labrd.cpp \ projections/lsat.cpp \ projections/misrsom.cpp \ projections/merc.cpp \ projections/mill.cpp \ projections/ocea.cpp \ projections/omerc.cpp \ projections/somerc.cpp \ projections/tcc.cpp \ projections/tcea.cpp \ projections/times.cpp \ projections/tmerc.cpp \ projections/tobmerc.cpp \ projections/airy.cpp \ projections/aitoff.cpp \ projections/august.cpp \ projections/bacon.cpp \ projections/bertin1953.cpp \ projections/chamb.cpp \ projections/hammer.cpp \ projections/lagrng.cpp \ projections/larr.cpp \ projections/lask.cpp \ projections/latlong.cpp \ projections/nicol.cpp \ projections/ob_tran.cpp \ projections/oea.cpp \ projections/tpeqd.cpp \ projections/vandg.cpp \ projections/vandg2.cpp \ projections/vandg4.cpp \ projections/wag7.cpp \ projections/lcca.cpp \ projections/geos.cpp \ projections/boggs.cpp \ projections/collg.cpp \ projections/comill.cpp \ projections/crast.cpp \ projections/denoy.cpp \ projections/eck1.cpp \ projections/eck2.cpp \ projections/eck3.cpp \ projections/eck4.cpp \ projections/eck5.cpp \ projections/fahey.cpp \ projections/fouc_s.cpp \ projections/gins8.cpp \ projections/gstmerc.cpp \ projections/gn_sinu.cpp \ projections/goode.cpp \ projections/igh.cpp \ projections/igh_o.cpp \ projections/hatano.cpp \ projections/loxim.cpp \ projections/mbt_fps.cpp \ projections/mbtfpp.cpp \ projections/mbtfpq.cpp \ projections/moll.cpp \ projections/nell.cpp \ projections/nell_h.cpp \ projections/patterson.cpp \ projections/putp2.cpp \ projections/putp3.cpp \ projections/putp4p.cpp \ projections/putp5.cpp \ projections/putp6.cpp \ projections/qsc.cpp \ projections/robin.cpp \ projections/s2.cpp \ projections/sch.cpp \ projections/sts.cpp \ projections/urm5.cpp \ projections/urmfps.cpp \ projections/wag2.cpp \ projections/wag3.cpp \ projections/wink1.cpp \ projections/wink2.cpp \ projections/healpix.cpp \ projections/natearth.cpp \ projections/natearth2.cpp \ projections/calcofi.cpp \ projections/eqearth.cpp \ projections/col_urban.cpp \ \ conversions/axisswap.cpp \ conversions/cart.cpp \ conversions/geoc.cpp \ conversions/geocent.cpp \ conversions/noop.cpp \ conversions/topocentric.cpp \ conversions/set.cpp \ conversions/unitconvert.cpp \ \ transformations/affine.cpp \ transformations/deformation.cpp \ transformations/helmert.cpp \ transformations/hgridshift.cpp \ transformations/horner.cpp \ transformations/molodensky.cpp \ transformations/vgridshift.cpp \ transformations/xyzgridshift.cpp \ transformations/defmodel.cpp \ transformations/defmodel.hpp \ transformations/defmodel_exceptions.hpp \ transformations/defmodel_impl.hpp \ transformations/tinshift.cpp \ transformations/tinshift.hpp \ transformations/tinshift_exceptions.hpp \ transformations/tinshift_impl.hpp \ \ aasincos.cpp adjlon.cpp \ dmstor.cpp auth.cpp \ deriv.cpp ell_set.cpp ellps.cpp \ factors.cpp fwd.cpp init.cpp inv.cpp \ list.cpp malloc.cpp mlfn.cpp mlfn.hpp msfn.cpp proj_mdist.cpp \ param.cpp phi2.cpp pr_list.cpp \ qsfn.cpp strerrno.cpp \ tsfn.cpp units.cpp ctx.cpp log.cpp zpoly1.cpp rtodms.cpp \ release.cpp gauss.cpp \ generic_inverse.cpp \ quadtree.hpp \ \ datums.cpp datum_set.cpp \ mutex.cpp initcache.cpp geodesic.c \ strtod.cpp \ \ 4D_api.cpp pipeline.cpp \ internal.cpp \ wkt_parser.hpp wkt_parser.cpp \ wkt1_parser.h wkt1_parser.cpp \ wkt1_generated_parser.h wkt1_generated_parser.c \ wkt2_parser.h wkt2_parser.cpp \ wkt2_generated_parser.h wkt2_generated_parser.c \ \ proj_json_streaming_writer.hpp \ proj_json_streaming_writer.cpp \ \ tracing.cpp \ \ grids.hpp \ grids.cpp \ filemanager.hpp \ filemanager.cpp \ networkfilemanager.cpp \ sqlite3_utils.hpp \ sqlite3_utils.cpp all: proj_config.h $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .c .cpp .lo .log .o .obj .test .test$(EXEEXT) .trs $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): proj_config.h: stamp-h1 @test -f $@ || rm -f stamp-h1 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 stamp-h1: $(srcdir)/proj_config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status src/proj_config.h $(srcdir)/proj_config.h.in: $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f proj_config.h stamp-h1 install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ || test -f $$p1 \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } iso19111/$(am__dirstamp): @$(MKDIR_P) iso19111 @: > iso19111/$(am__dirstamp) iso19111/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) iso19111/$(DEPDIR) @: > iso19111/$(DEPDIR)/$(am__dirstamp) iso19111/static.lo: iso19111/$(am__dirstamp) \ iso19111/$(DEPDIR)/$(am__dirstamp) iso19111/util.lo: iso19111/$(am__dirstamp) \ iso19111/$(DEPDIR)/$(am__dirstamp) iso19111/metadata.lo: iso19111/$(am__dirstamp) \ iso19111/$(DEPDIR)/$(am__dirstamp) iso19111/common.lo: iso19111/$(am__dirstamp) \ iso19111/$(DEPDIR)/$(am__dirstamp) iso19111/crs.lo: iso19111/$(am__dirstamp) \ iso19111/$(DEPDIR)/$(am__dirstamp) iso19111/datum.lo: iso19111/$(am__dirstamp) \ iso19111/$(DEPDIR)/$(am__dirstamp) iso19111/coordinatesystem.lo: iso19111/$(am__dirstamp) \ iso19111/$(DEPDIR)/$(am__dirstamp) iso19111/operation/$(am__dirstamp): @$(MKDIR_P) iso19111/operation @: > iso19111/operation/$(am__dirstamp) iso19111/operation/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) iso19111/operation/$(DEPDIR) @: > iso19111/operation/$(DEPDIR)/$(am__dirstamp) iso19111/operation/concatenatedoperation.lo: \ iso19111/operation/$(am__dirstamp) \ iso19111/operation/$(DEPDIR)/$(am__dirstamp) iso19111/operation/coordinateoperationfactory.lo: \ iso19111/operation/$(am__dirstamp) \ iso19111/operation/$(DEPDIR)/$(am__dirstamp) iso19111/operation/conversion.lo: iso19111/operation/$(am__dirstamp) \ iso19111/operation/$(DEPDIR)/$(am__dirstamp) iso19111/operation/esriparammappings.lo: \ iso19111/operation/$(am__dirstamp) \ iso19111/operation/$(DEPDIR)/$(am__dirstamp) iso19111/operation/oputils.lo: iso19111/operation/$(am__dirstamp) \ iso19111/operation/$(DEPDIR)/$(am__dirstamp) iso19111/operation/parammappings.lo: \ iso19111/operation/$(am__dirstamp) \ iso19111/operation/$(DEPDIR)/$(am__dirstamp) iso19111/operation/projbasedoperation.lo: \ iso19111/operation/$(am__dirstamp) \ iso19111/operation/$(DEPDIR)/$(am__dirstamp) iso19111/operation/singleoperation.lo: \ iso19111/operation/$(am__dirstamp) \ iso19111/operation/$(DEPDIR)/$(am__dirstamp) iso19111/operation/transformation.lo: \ iso19111/operation/$(am__dirstamp) \ iso19111/operation/$(DEPDIR)/$(am__dirstamp) iso19111/operation/vectorofvaluesparams.lo: \ iso19111/operation/$(am__dirstamp) \ iso19111/operation/$(DEPDIR)/$(am__dirstamp) iso19111/io.lo: iso19111/$(am__dirstamp) \ iso19111/$(DEPDIR)/$(am__dirstamp) iso19111/internal.lo: iso19111/$(am__dirstamp) \ iso19111/$(DEPDIR)/$(am__dirstamp) iso19111/factory.lo: iso19111/$(am__dirstamp) \ iso19111/$(DEPDIR)/$(am__dirstamp) iso19111/c_api.lo: iso19111/$(am__dirstamp) \ iso19111/$(DEPDIR)/$(am__dirstamp) projections/$(am__dirstamp): @$(MKDIR_P) projections @: > projections/$(am__dirstamp) projections/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) projections/$(DEPDIR) @: > projections/$(DEPDIR)/$(am__dirstamp) projections/aeqd.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/adams.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/gnom.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/laea.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/mod_ster.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/nsper.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/nzmg.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/ortho.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/stere.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/sterea.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/aea.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/bipc.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/bonne.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/eqdc.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/isea.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/ccon.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/imw_p.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/krovak.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/lcc.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/poly.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/rpoly.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/sconics.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/rouss.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/cass.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/cc.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/cea.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/eqc.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/gall.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/labrd.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/lsat.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/misrsom.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/merc.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/mill.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/ocea.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/omerc.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/somerc.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/tcc.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/tcea.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/times.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/tmerc.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/tobmerc.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/airy.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/aitoff.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/august.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/bacon.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/bertin1953.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/chamb.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/hammer.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/lagrng.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/larr.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/lask.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/latlong.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/nicol.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/ob_tran.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/oea.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/tpeqd.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/vandg.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/vandg2.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/vandg4.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/wag7.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/lcca.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/geos.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/boggs.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/collg.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/comill.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/crast.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/denoy.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/eck1.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/eck2.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/eck3.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/eck4.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/eck5.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/fahey.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/fouc_s.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/gins8.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/gstmerc.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/gn_sinu.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/goode.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/igh.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/igh_o.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/hatano.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/loxim.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/mbt_fps.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/mbtfpp.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/mbtfpq.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/moll.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/nell.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/nell_h.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/patterson.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/putp2.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/putp3.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/putp4p.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/putp5.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/putp6.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/qsc.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/robin.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/s2.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/sch.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/sts.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/urm5.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/urmfps.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/wag2.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/wag3.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/wink1.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/wink2.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/healpix.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/natearth.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/natearth2.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/calcofi.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/eqearth.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) projections/col_urban.lo: projections/$(am__dirstamp) \ projections/$(DEPDIR)/$(am__dirstamp) conversions/$(am__dirstamp): @$(MKDIR_P) conversions @: > conversions/$(am__dirstamp) conversions/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) conversions/$(DEPDIR) @: > conversions/$(DEPDIR)/$(am__dirstamp) conversions/axisswap.lo: conversions/$(am__dirstamp) \ conversions/$(DEPDIR)/$(am__dirstamp) conversions/cart.lo: conversions/$(am__dirstamp) \ conversions/$(DEPDIR)/$(am__dirstamp) conversions/geoc.lo: conversions/$(am__dirstamp) \ conversions/$(DEPDIR)/$(am__dirstamp) conversions/geocent.lo: conversions/$(am__dirstamp) \ conversions/$(DEPDIR)/$(am__dirstamp) conversions/noop.lo: conversions/$(am__dirstamp) \ conversions/$(DEPDIR)/$(am__dirstamp) conversions/topocentric.lo: conversions/$(am__dirstamp) \ conversions/$(DEPDIR)/$(am__dirstamp) conversions/set.lo: conversions/$(am__dirstamp) \ conversions/$(DEPDIR)/$(am__dirstamp) conversions/unitconvert.lo: conversions/$(am__dirstamp) \ conversions/$(DEPDIR)/$(am__dirstamp) transformations/$(am__dirstamp): @$(MKDIR_P) transformations @: > transformations/$(am__dirstamp) transformations/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) transformations/$(DEPDIR) @: > transformations/$(DEPDIR)/$(am__dirstamp) transformations/affine.lo: transformations/$(am__dirstamp) \ transformations/$(DEPDIR)/$(am__dirstamp) transformations/deformation.lo: transformations/$(am__dirstamp) \ transformations/$(DEPDIR)/$(am__dirstamp) transformations/helmert.lo: transformations/$(am__dirstamp) \ transformations/$(DEPDIR)/$(am__dirstamp) transformations/hgridshift.lo: transformations/$(am__dirstamp) \ transformations/$(DEPDIR)/$(am__dirstamp) transformations/horner.lo: transformations/$(am__dirstamp) \ transformations/$(DEPDIR)/$(am__dirstamp) transformations/molodensky.lo: transformations/$(am__dirstamp) \ transformations/$(DEPDIR)/$(am__dirstamp) transformations/vgridshift.lo: transformations/$(am__dirstamp) \ transformations/$(DEPDIR)/$(am__dirstamp) transformations/xyzgridshift.lo: transformations/$(am__dirstamp) \ transformations/$(DEPDIR)/$(am__dirstamp) transformations/defmodel.lo: transformations/$(am__dirstamp) \ transformations/$(DEPDIR)/$(am__dirstamp) transformations/tinshift.lo: transformations/$(am__dirstamp) \ transformations/$(DEPDIR)/$(am__dirstamp) libproj.la: $(libproj_la_OBJECTS) $(libproj_la_DEPENDENCIES) $(EXTRA_libproj_la_DEPENDENCIES) $(AM_V_CXXLD)$(libproj_la_LINK) -rpath $(libdir) $(libproj_la_OBJECTS) $(libproj_la_LIBADD) $(LIBS) apps/$(am__dirstamp): @$(MKDIR_P) apps @: > apps/$(am__dirstamp) apps/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) apps/$(DEPDIR) @: > apps/$(DEPDIR)/$(am__dirstamp) apps/cct.$(OBJEXT): apps/$(am__dirstamp) \ apps/$(DEPDIR)/$(am__dirstamp) apps/proj_strtod.$(OBJEXT): apps/$(am__dirstamp) \ apps/$(DEPDIR)/$(am__dirstamp) cct$(EXEEXT): $(cct_OBJECTS) $(cct_DEPENDENCIES) $(EXTRA_cct_DEPENDENCIES) @rm -f cct$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(cct_OBJECTS) $(cct_LDADD) $(LIBS) apps/cs2cs.$(OBJEXT): apps/$(am__dirstamp) \ apps/$(DEPDIR)/$(am__dirstamp) apps/emess.$(OBJEXT): apps/$(am__dirstamp) \ apps/$(DEPDIR)/$(am__dirstamp) apps/utils.$(OBJEXT): apps/$(am__dirstamp) \ apps/$(DEPDIR)/$(am__dirstamp) cs2cs$(EXEEXT): $(cs2cs_OBJECTS) $(cs2cs_DEPENDENCIES) $(EXTRA_cs2cs_DEPENDENCIES) @rm -f cs2cs$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(cs2cs_OBJECTS) $(cs2cs_LDADD) $(LIBS) apps/geod.$(OBJEXT): apps/$(am__dirstamp) \ apps/$(DEPDIR)/$(am__dirstamp) apps/geod_set.$(OBJEXT): apps/$(am__dirstamp) \ apps/$(DEPDIR)/$(am__dirstamp) apps/geod_interface.$(OBJEXT): apps/$(am__dirstamp) \ apps/$(DEPDIR)/$(am__dirstamp) geod$(EXEEXT): $(geod_OBJECTS) $(geod_DEPENDENCIES) $(EXTRA_geod_DEPENDENCIES) @rm -f geod$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(geod_OBJECTS) $(geod_LDADD) $(LIBS) tests/$(am__dirstamp): @$(MKDIR_P) tests @: > tests/$(am__dirstamp) tests/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) tests/$(DEPDIR) @: > tests/$(DEPDIR)/$(am__dirstamp) tests/geodtest.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) geodtest$(EXEEXT): $(geodtest_OBJECTS) $(geodtest_DEPENDENCIES) $(EXTRA_geodtest_DEPENDENCIES) @rm -f geodtest$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(geodtest_OBJECTS) $(geodtest_LDADD) $(LIBS) apps/gie.$(OBJEXT): apps/$(am__dirstamp) \ apps/$(DEPDIR)/$(am__dirstamp) gie$(EXEEXT): $(gie_OBJECTS) $(gie_DEPENDENCIES) $(EXTRA_gie_DEPENDENCIES) @rm -f gie$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(gie_OBJECTS) $(gie_LDADD) $(LIBS) invgeod$(EXEEXT): $(invgeod_OBJECTS) $(invgeod_DEPENDENCIES) $(EXTRA_invgeod_DEPENDENCIES) @rm -f invgeod$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(invgeod_OBJECTS) $(invgeod_LDADD) $(LIBS) apps/proj.$(OBJEXT): apps/$(am__dirstamp) \ apps/$(DEPDIR)/$(am__dirstamp) invproj$(EXEEXT): $(invproj_OBJECTS) $(invproj_DEPENDENCIES) $(EXTRA_invproj_DEPENDENCIES) @rm -f invproj$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(invproj_OBJECTS) $(invproj_LDADD) $(LIBS) tests/multistresstest.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) multistresstest$(EXEEXT): $(multistresstest_OBJECTS) $(multistresstest_DEPENDENCIES) $(EXTRA_multistresstest_DEPENDENCIES) @rm -f multistresstest$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(multistresstest_OBJECTS) $(multistresstest_LDADD) $(LIBS) proj$(EXEEXT): $(proj_OBJECTS) $(proj_DEPENDENCIES) $(EXTRA_proj_DEPENDENCIES) @rm -f proj$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(proj_OBJECTS) $(proj_LDADD) $(LIBS) apps/projinfo.$(OBJEXT): apps/$(am__dirstamp) \ apps/$(DEPDIR)/$(am__dirstamp) projinfo$(EXEEXT): $(projinfo_OBJECTS) $(projinfo_DEPENDENCIES) $(EXTRA_projinfo_DEPENDENCIES) @rm -f projinfo$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(projinfo_OBJECTS) $(projinfo_LDADD) $(LIBS) apps/projsync.$(OBJEXT): apps/$(am__dirstamp) \ apps/$(DEPDIR)/$(am__dirstamp) projsync$(EXEEXT): $(projsync_OBJECTS) $(projsync_DEPENDENCIES) $(EXTRA_projsync_DEPENDENCIES) @rm -f projsync$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(projsync_OBJECTS) $(projsync_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) -rm -f apps/*.$(OBJEXT) -rm -f conversions/*.$(OBJEXT) -rm -f conversions/*.lo -rm -f iso19111/*.$(OBJEXT) -rm -f iso19111/*.lo -rm -f iso19111/operation/*.$(OBJEXT) -rm -f iso19111/operation/*.lo -rm -f projections/*.$(OBJEXT) -rm -f projections/*.lo -rm -f tests/*.$(OBJEXT) -rm -f transformations/*.$(OBJEXT) -rm -f transformations/*.lo distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/4D_api.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aasincos.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/adjlon.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auth.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ctx.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/datum_set.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/datums.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/deriv.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmstor.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ell_set.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ellps.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/factors.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filemanager.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fwd.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gauss.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/generic_inverse.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/geodesic.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grids.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/init.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/initcache.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/internal.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inv.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/malloc.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mlfn.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msfn.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mutex.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/networkfilemanager.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/param.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/phi2.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pipeline.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pr_list.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proj_json_streaming_writer.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proj_mdist.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qsfn.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/release.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtodms.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sqlite3_utils.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strerrno.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strtod.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tracing.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsfn.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/units.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wkt1_generated_parser.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wkt1_parser.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wkt2_generated_parser.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wkt2_parser.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wkt_parser.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zpoly1.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@apps/$(DEPDIR)/cct.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@apps/$(DEPDIR)/cs2cs.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@apps/$(DEPDIR)/emess.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@apps/$(DEPDIR)/geod.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@apps/$(DEPDIR)/geod_interface.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@apps/$(DEPDIR)/geod_set.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@apps/$(DEPDIR)/gie.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@apps/$(DEPDIR)/proj.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@apps/$(DEPDIR)/proj_strtod.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@apps/$(DEPDIR)/projinfo.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@apps/$(DEPDIR)/projsync.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@apps/$(DEPDIR)/utils.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@conversions/$(DEPDIR)/axisswap.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@conversions/$(DEPDIR)/cart.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@conversions/$(DEPDIR)/geoc.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@conversions/$(DEPDIR)/geocent.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@conversions/$(DEPDIR)/noop.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@conversions/$(DEPDIR)/set.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@conversions/$(DEPDIR)/topocentric.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@conversions/$(DEPDIR)/unitconvert.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@iso19111/$(DEPDIR)/c_api.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@iso19111/$(DEPDIR)/common.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@iso19111/$(DEPDIR)/coordinatesystem.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@iso19111/$(DEPDIR)/crs.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@iso19111/$(DEPDIR)/datum.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@iso19111/$(DEPDIR)/factory.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@iso19111/$(DEPDIR)/internal.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@iso19111/$(DEPDIR)/io.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@iso19111/$(DEPDIR)/metadata.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@iso19111/$(DEPDIR)/static.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@iso19111/$(DEPDIR)/util.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@iso19111/operation/$(DEPDIR)/concatenatedoperation.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@iso19111/operation/$(DEPDIR)/conversion.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@iso19111/operation/$(DEPDIR)/coordinateoperationfactory.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@iso19111/operation/$(DEPDIR)/esriparammappings.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@iso19111/operation/$(DEPDIR)/oputils.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@iso19111/operation/$(DEPDIR)/parammappings.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@iso19111/operation/$(DEPDIR)/projbasedoperation.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@iso19111/operation/$(DEPDIR)/singleoperation.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@iso19111/operation/$(DEPDIR)/transformation.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@iso19111/operation/$(DEPDIR)/vectorofvaluesparams.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/adams.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/aea.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/aeqd.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/airy.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/aitoff.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/august.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/bacon.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/bertin1953.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/bipc.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/boggs.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/bonne.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/calcofi.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/cass.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/cc.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/ccon.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/cea.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/chamb.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/col_urban.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/collg.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/comill.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/crast.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/denoy.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/eck1.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/eck2.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/eck3.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/eck4.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/eck5.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/eqc.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/eqdc.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/eqearth.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/fahey.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/fouc_s.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/gall.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/geos.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/gins8.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/gn_sinu.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/gnom.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/goode.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/gstmerc.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/hammer.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/hatano.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/healpix.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/igh.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/igh_o.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/imw_p.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/isea.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/krovak.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/labrd.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/laea.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/lagrng.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/larr.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/lask.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/latlong.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/lcc.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/lcca.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/loxim.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/lsat.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/mbt_fps.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/mbtfpp.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/mbtfpq.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/merc.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/mill.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/misrsom.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/mod_ster.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/moll.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/natearth.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/natearth2.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/nell.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/nell_h.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/nicol.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/nsper.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/nzmg.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/ob_tran.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/ocea.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/oea.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/omerc.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/ortho.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/patterson.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/poly.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/putp2.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/putp3.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/putp4p.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/putp5.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/putp6.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/qsc.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/robin.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/rouss.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/rpoly.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/s2.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/sch.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/sconics.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/somerc.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/stere.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/sterea.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/sts.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/tcc.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/tcea.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/times.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/tmerc.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/tobmerc.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/tpeqd.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/urm5.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/urmfps.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/vandg.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/vandg2.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/vandg4.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/wag2.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/wag3.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/wag7.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/wink1.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@projections/$(DEPDIR)/wink2.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/geodtest.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/multistresstest.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@transformations/$(DEPDIR)/affine.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@transformations/$(DEPDIR)/defmodel.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@transformations/$(DEPDIR)/deformation.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@transformations/$(DEPDIR)/helmert.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@transformations/$(DEPDIR)/hgridshift.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@transformations/$(DEPDIR)/horner.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@transformations/$(DEPDIR)/molodensky.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@transformations/$(DEPDIR)/tinshift.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@transformations/$(DEPDIR)/vgridshift.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@transformations/$(DEPDIR)/xyzgridshift.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< .cpp.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cpp.lo: @am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs -rm -rf conversions/.libs conversions/_libs -rm -rf iso19111/.libs iso19111/_libs -rm -rf iso19111/operation/.libs iso19111/operation/_libs -rm -rf projections/.libs projections/_libs -rm -rf transformations/.libs transformations/_libs install-includeHEADERS: $(include_HEADERS) @$(NORMAL_INSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ done uninstall-includeHEADERS: @$(NORMAL_UNINSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags # Recover from deleted '.trs' file; this should ensure that # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create # both 'foo.log' and 'foo.trs'. Break the recipe in two subshells # to avoid problems with "make -n". .log.trs: rm -f $< $@ $(MAKE) $(AM_MAKEFLAGS) $< # Leading 'am--fnord' is there to ensure the list of targets does not # expand to empty, as could happen e.g. with make check TESTS=''. am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) am--force-recheck: @: $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ redo_bases=`for i in $$bases; do \ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ done`; \ if test -n "$$redo_bases"; then \ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ if $(am__make_dryrun); then :; else \ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ fi; \ if test -n "$$am__remaking_logs"; then \ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ "recursion detected" >&2; \ elif test -n "$$redo_logs"; then \ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ fi; \ if $(am__make_dryrun); then :; else \ st=0; \ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ for i in $$redo_bases; do \ test -f $$i.trs && test -r $$i.trs \ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ test -f $$i.log && test -r $$i.log \ || { echo "$$errmsg $$i.log" >&2; st=1; }; \ done; \ test $$st -eq 0 || exit 1; \ fi @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ ws='[ ]'; \ results=`for b in $$bases; do echo $$b.trs; done`; \ test -n "$$results" || results=/dev/null; \ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ if test `expr $$fail + $$xpass + $$error` -eq 0; then \ success=true; \ else \ success=false; \ fi; \ br='==================='; br=$$br$$br$$br$$br; \ result_count () \ { \ if test x"$$1" = x"--maybe-color"; then \ maybe_colorize=yes; \ elif test x"$$1" = x"--no-color"; then \ maybe_colorize=no; \ else \ echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ shift; \ desc=$$1 count=$$2; \ if test $$maybe_colorize = yes && test $$count -gt 0; then \ color_start=$$3 color_end=$$std; \ else \ color_start= color_end=; \ fi; \ echo "$${color_start}# $$desc $$count$${color_end}"; \ }; \ create_testsuite_report () \ { \ result_count $$1 "TOTAL:" $$all "$$brg"; \ result_count $$1 "PASS: " $$pass "$$grn"; \ result_count $$1 "SKIP: " $$skip "$$blu"; \ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ result_count $$1 "FAIL: " $$fail "$$red"; \ result_count $$1 "XPASS:" $$xpass "$$red"; \ result_count $$1 "ERROR:" $$error "$$mgn"; \ }; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ create_testsuite_report --no-color; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ for b in $$bases; do echo $$b; done \ | $(am__create_global_log); \ } >$(TEST_SUITE_LOG).tmp || exit 1; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ if $$success; then \ col="$$grn"; \ else \ col="$$red"; \ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ if $$success; then :; else \ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ if test -n "$(PACKAGE_BUGREPORT)"; then \ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ fi; \ echo "$$col$$br$$std"; \ fi; \ $$success || exit 1 check-TESTS: $(check_PROGRAMS) @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ log_list=`for i in $$bases; do echo $$i.log; done`; \ trs_list=`for i in $$bases; do echo $$i.trs; done`; \ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ exit $$?; recheck: all $(check_PROGRAMS) @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ bases=`for i in $$bases; do echo $$i; done \ | $(am__list_recheck_tests)` || exit 1; \ log_list=`for i in $$bases; do echo $$i.log; done`; \ log_list=`echo $$log_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ am__force_recheck=am--force-recheck \ TEST_LOGS="$$log_list"; \ exit $$? geodtest.log: geodtest$(EXEEXT) @p='geodtest$(EXEEXT)'; \ b='geodtest'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) .test.log: @p='$<'; \ $(am__set_b); \ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) @am__EXEEXT_TRUE@.test$(EXEEXT).log: @am__EXEEXT_TRUE@ @p='$<'; \ @am__EXEEXT_TRUE@ $(am__set_b); \ @am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile $(PROGRAMS) $(LTLIBRARIES) $(HEADERS) proj_config.h install-binPROGRAMS: install-libLTLIBRARIES installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -rm -f apps/$(DEPDIR)/$(am__dirstamp) -rm -f apps/$(am__dirstamp) -rm -f conversions/$(DEPDIR)/$(am__dirstamp) -rm -f conversions/$(am__dirstamp) -rm -f iso19111/$(DEPDIR)/$(am__dirstamp) -rm -f iso19111/$(am__dirstamp) -rm -f iso19111/operation/$(DEPDIR)/$(am__dirstamp) -rm -f iso19111/operation/$(am__dirstamp) -rm -f projections/$(DEPDIR)/$(am__dirstamp) -rm -f projections/$(am__dirstamp) -rm -f tests/$(DEPDIR)/$(am__dirstamp) -rm -f tests/$(am__dirstamp) -rm -f transformations/$(DEPDIR)/$(am__dirstamp) -rm -f transformations/$(am__dirstamp) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \ clean-libLTLIBRARIES clean-libtool clean-noinstPROGRAMS \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/4D_api.Plo -rm -f ./$(DEPDIR)/aasincos.Plo -rm -f ./$(DEPDIR)/adjlon.Plo -rm -f ./$(DEPDIR)/auth.Plo -rm -f ./$(DEPDIR)/ctx.Plo -rm -f ./$(DEPDIR)/datum_set.Plo -rm -f ./$(DEPDIR)/datums.Plo -rm -f ./$(DEPDIR)/deriv.Plo -rm -f ./$(DEPDIR)/dmstor.Plo -rm -f ./$(DEPDIR)/ell_set.Plo -rm -f ./$(DEPDIR)/ellps.Plo -rm -f ./$(DEPDIR)/factors.Plo -rm -f ./$(DEPDIR)/filemanager.Plo -rm -f ./$(DEPDIR)/fwd.Plo -rm -f ./$(DEPDIR)/gauss.Plo -rm -f ./$(DEPDIR)/generic_inverse.Plo -rm -f ./$(DEPDIR)/geodesic.Plo -rm -f ./$(DEPDIR)/grids.Plo -rm -f ./$(DEPDIR)/init.Plo -rm -f ./$(DEPDIR)/initcache.Plo -rm -f ./$(DEPDIR)/internal.Plo -rm -f ./$(DEPDIR)/inv.Plo -rm -f ./$(DEPDIR)/list.Plo -rm -f ./$(DEPDIR)/log.Plo -rm -f ./$(DEPDIR)/malloc.Plo -rm -f ./$(DEPDIR)/mlfn.Plo -rm -f ./$(DEPDIR)/msfn.Plo -rm -f ./$(DEPDIR)/mutex.Plo -rm -f ./$(DEPDIR)/networkfilemanager.Plo -rm -f ./$(DEPDIR)/param.Plo -rm -f ./$(DEPDIR)/phi2.Plo -rm -f ./$(DEPDIR)/pipeline.Plo -rm -f ./$(DEPDIR)/pr_list.Plo -rm -f ./$(DEPDIR)/proj_json_streaming_writer.Plo -rm -f ./$(DEPDIR)/proj_mdist.Plo -rm -f ./$(DEPDIR)/qsfn.Plo -rm -f ./$(DEPDIR)/release.Plo -rm -f ./$(DEPDIR)/rtodms.Plo -rm -f ./$(DEPDIR)/sqlite3_utils.Plo -rm -f ./$(DEPDIR)/strerrno.Plo -rm -f ./$(DEPDIR)/strtod.Plo -rm -f ./$(DEPDIR)/tracing.Plo -rm -f ./$(DEPDIR)/tsfn.Plo -rm -f ./$(DEPDIR)/units.Plo -rm -f ./$(DEPDIR)/wkt1_generated_parser.Plo -rm -f ./$(DEPDIR)/wkt1_parser.Plo -rm -f ./$(DEPDIR)/wkt2_generated_parser.Plo -rm -f ./$(DEPDIR)/wkt2_parser.Plo -rm -f ./$(DEPDIR)/wkt_parser.Plo -rm -f ./$(DEPDIR)/zpoly1.Plo -rm -f apps/$(DEPDIR)/cct.Po -rm -f apps/$(DEPDIR)/cs2cs.Po -rm -f apps/$(DEPDIR)/emess.Po -rm -f apps/$(DEPDIR)/geod.Po -rm -f apps/$(DEPDIR)/geod_interface.Po -rm -f apps/$(DEPDIR)/geod_set.Po -rm -f apps/$(DEPDIR)/gie.Po -rm -f apps/$(DEPDIR)/proj.Po -rm -f apps/$(DEPDIR)/proj_strtod.Po -rm -f apps/$(DEPDIR)/projinfo.Po -rm -f apps/$(DEPDIR)/projsync.Po -rm -f apps/$(DEPDIR)/utils.Po -rm -f conversions/$(DEPDIR)/axisswap.Plo -rm -f conversions/$(DEPDIR)/cart.Plo -rm -f conversions/$(DEPDIR)/geoc.Plo -rm -f conversions/$(DEPDIR)/geocent.Plo -rm -f conversions/$(DEPDIR)/noop.Plo -rm -f conversions/$(DEPDIR)/set.Plo -rm -f conversions/$(DEPDIR)/topocentric.Plo -rm -f conversions/$(DEPDIR)/unitconvert.Plo -rm -f iso19111/$(DEPDIR)/c_api.Plo -rm -f iso19111/$(DEPDIR)/common.Plo -rm -f iso19111/$(DEPDIR)/coordinatesystem.Plo -rm -f iso19111/$(DEPDIR)/crs.Plo -rm -f iso19111/$(DEPDIR)/datum.Plo -rm -f iso19111/$(DEPDIR)/factory.Plo -rm -f iso19111/$(DEPDIR)/internal.Plo -rm -f iso19111/$(DEPDIR)/io.Plo -rm -f iso19111/$(DEPDIR)/metadata.Plo -rm -f iso19111/$(DEPDIR)/static.Plo -rm -f iso19111/$(DEPDIR)/util.Plo -rm -f iso19111/operation/$(DEPDIR)/concatenatedoperation.Plo -rm -f iso19111/operation/$(DEPDIR)/conversion.Plo -rm -f iso19111/operation/$(DEPDIR)/coordinateoperationfactory.Plo -rm -f iso19111/operation/$(DEPDIR)/esriparammappings.Plo -rm -f iso19111/operation/$(DEPDIR)/oputils.Plo -rm -f iso19111/operation/$(DEPDIR)/parammappings.Plo -rm -f iso19111/operation/$(DEPDIR)/projbasedoperation.Plo -rm -f iso19111/operation/$(DEPDIR)/singleoperation.Plo -rm -f iso19111/operation/$(DEPDIR)/transformation.Plo -rm -f iso19111/operation/$(DEPDIR)/vectorofvaluesparams.Plo -rm -f projections/$(DEPDIR)/adams.Plo -rm -f projections/$(DEPDIR)/aea.Plo -rm -f projections/$(DEPDIR)/aeqd.Plo -rm -f projections/$(DEPDIR)/airy.Plo -rm -f projections/$(DEPDIR)/aitoff.Plo -rm -f projections/$(DEPDIR)/august.Plo -rm -f projections/$(DEPDIR)/bacon.Plo -rm -f projections/$(DEPDIR)/bertin1953.Plo -rm -f projections/$(DEPDIR)/bipc.Plo -rm -f projections/$(DEPDIR)/boggs.Plo -rm -f projections/$(DEPDIR)/bonne.Plo -rm -f projections/$(DEPDIR)/calcofi.Plo -rm -f projections/$(DEPDIR)/cass.Plo -rm -f projections/$(DEPDIR)/cc.Plo -rm -f projections/$(DEPDIR)/ccon.Plo -rm -f projections/$(DEPDIR)/cea.Plo -rm -f projections/$(DEPDIR)/chamb.Plo -rm -f projections/$(DEPDIR)/col_urban.Plo -rm -f projections/$(DEPDIR)/collg.Plo -rm -f projections/$(DEPDIR)/comill.Plo -rm -f projections/$(DEPDIR)/crast.Plo -rm -f projections/$(DEPDIR)/denoy.Plo -rm -f projections/$(DEPDIR)/eck1.Plo -rm -f projections/$(DEPDIR)/eck2.Plo -rm -f projections/$(DEPDIR)/eck3.Plo -rm -f projections/$(DEPDIR)/eck4.Plo -rm -f projections/$(DEPDIR)/eck5.Plo -rm -f projections/$(DEPDIR)/eqc.Plo -rm -f projections/$(DEPDIR)/eqdc.Plo -rm -f projections/$(DEPDIR)/eqearth.Plo -rm -f projections/$(DEPDIR)/fahey.Plo -rm -f projections/$(DEPDIR)/fouc_s.Plo -rm -f projections/$(DEPDIR)/gall.Plo -rm -f projections/$(DEPDIR)/geos.Plo -rm -f projections/$(DEPDIR)/gins8.Plo -rm -f projections/$(DEPDIR)/gn_sinu.Plo -rm -f projections/$(DEPDIR)/gnom.Plo -rm -f projections/$(DEPDIR)/goode.Plo -rm -f projections/$(DEPDIR)/gstmerc.Plo -rm -f projections/$(DEPDIR)/hammer.Plo -rm -f projections/$(DEPDIR)/hatano.Plo -rm -f projections/$(DEPDIR)/healpix.Plo -rm -f projections/$(DEPDIR)/igh.Plo -rm -f projections/$(DEPDIR)/igh_o.Plo -rm -f projections/$(DEPDIR)/imw_p.Plo -rm -f projections/$(DEPDIR)/isea.Plo -rm -f projections/$(DEPDIR)/krovak.Plo -rm -f projections/$(DEPDIR)/labrd.Plo -rm -f projections/$(DEPDIR)/laea.Plo -rm -f projections/$(DEPDIR)/lagrng.Plo -rm -f projections/$(DEPDIR)/larr.Plo -rm -f projections/$(DEPDIR)/lask.Plo -rm -f projections/$(DEPDIR)/latlong.Plo -rm -f projections/$(DEPDIR)/lcc.Plo -rm -f projections/$(DEPDIR)/lcca.Plo -rm -f projections/$(DEPDIR)/loxim.Plo -rm -f projections/$(DEPDIR)/lsat.Plo -rm -f projections/$(DEPDIR)/mbt_fps.Plo -rm -f projections/$(DEPDIR)/mbtfpp.Plo -rm -f projections/$(DEPDIR)/mbtfpq.Plo -rm -f projections/$(DEPDIR)/merc.Plo -rm -f projections/$(DEPDIR)/mill.Plo -rm -f projections/$(DEPDIR)/misrsom.Plo -rm -f projections/$(DEPDIR)/mod_ster.Plo -rm -f projections/$(DEPDIR)/moll.Plo -rm -f projections/$(DEPDIR)/natearth.Plo -rm -f projections/$(DEPDIR)/natearth2.Plo -rm -f projections/$(DEPDIR)/nell.Plo -rm -f projections/$(DEPDIR)/nell_h.Plo -rm -f projections/$(DEPDIR)/nicol.Plo -rm -f projections/$(DEPDIR)/nsper.Plo -rm -f projections/$(DEPDIR)/nzmg.Plo -rm -f projections/$(DEPDIR)/ob_tran.Plo -rm -f projections/$(DEPDIR)/ocea.Plo -rm -f projections/$(DEPDIR)/oea.Plo -rm -f projections/$(DEPDIR)/omerc.Plo -rm -f projections/$(DEPDIR)/ortho.Plo -rm -f projections/$(DEPDIR)/patterson.Plo -rm -f projections/$(DEPDIR)/poly.Plo -rm -f projections/$(DEPDIR)/putp2.Plo -rm -f projections/$(DEPDIR)/putp3.Plo -rm -f projections/$(DEPDIR)/putp4p.Plo -rm -f projections/$(DEPDIR)/putp5.Plo -rm -f projections/$(DEPDIR)/putp6.Plo -rm -f projections/$(DEPDIR)/qsc.Plo -rm -f projections/$(DEPDIR)/robin.Plo -rm -f projections/$(DEPDIR)/rouss.Plo -rm -f projections/$(DEPDIR)/rpoly.Plo -rm -f projections/$(DEPDIR)/s2.Plo -rm -f projections/$(DEPDIR)/sch.Plo -rm -f projections/$(DEPDIR)/sconics.Plo -rm -f projections/$(DEPDIR)/somerc.Plo -rm -f projections/$(DEPDIR)/stere.Plo -rm -f projections/$(DEPDIR)/sterea.Plo -rm -f projections/$(DEPDIR)/sts.Plo -rm -f projections/$(DEPDIR)/tcc.Plo -rm -f projections/$(DEPDIR)/tcea.Plo -rm -f projections/$(DEPDIR)/times.Plo -rm -f projections/$(DEPDIR)/tmerc.Plo -rm -f projections/$(DEPDIR)/tobmerc.Plo -rm -f projections/$(DEPDIR)/tpeqd.Plo -rm -f projections/$(DEPDIR)/urm5.Plo -rm -f projections/$(DEPDIR)/urmfps.Plo -rm -f projections/$(DEPDIR)/vandg.Plo -rm -f projections/$(DEPDIR)/vandg2.Plo -rm -f projections/$(DEPDIR)/vandg4.Plo -rm -f projections/$(DEPDIR)/wag2.Plo -rm -f projections/$(DEPDIR)/wag3.Plo -rm -f projections/$(DEPDIR)/wag7.Plo -rm -f projections/$(DEPDIR)/wink1.Plo -rm -f projections/$(DEPDIR)/wink2.Plo -rm -f tests/$(DEPDIR)/geodtest.Po -rm -f tests/$(DEPDIR)/multistresstest.Po -rm -f transformations/$(DEPDIR)/affine.Plo -rm -f transformations/$(DEPDIR)/defmodel.Plo -rm -f transformations/$(DEPDIR)/deformation.Plo -rm -f transformations/$(DEPDIR)/helmert.Plo -rm -f transformations/$(DEPDIR)/hgridshift.Plo -rm -f transformations/$(DEPDIR)/horner.Plo -rm -f transformations/$(DEPDIR)/molodensky.Plo -rm -f transformations/$(DEPDIR)/tinshift.Plo -rm -f transformations/$(DEPDIR)/vgridshift.Plo -rm -f transformations/$(DEPDIR)/xyzgridshift.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-includeHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-exec-local \ install-libLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/4D_api.Plo -rm -f ./$(DEPDIR)/aasincos.Plo -rm -f ./$(DEPDIR)/adjlon.Plo -rm -f ./$(DEPDIR)/auth.Plo -rm -f ./$(DEPDIR)/ctx.Plo -rm -f ./$(DEPDIR)/datum_set.Plo -rm -f ./$(DEPDIR)/datums.Plo -rm -f ./$(DEPDIR)/deriv.Plo -rm -f ./$(DEPDIR)/dmstor.Plo -rm -f ./$(DEPDIR)/ell_set.Plo -rm -f ./$(DEPDIR)/ellps.Plo -rm -f ./$(DEPDIR)/factors.Plo -rm -f ./$(DEPDIR)/filemanager.Plo -rm -f ./$(DEPDIR)/fwd.Plo -rm -f ./$(DEPDIR)/gauss.Plo -rm -f ./$(DEPDIR)/generic_inverse.Plo -rm -f ./$(DEPDIR)/geodesic.Plo -rm -f ./$(DEPDIR)/grids.Plo -rm -f ./$(DEPDIR)/init.Plo -rm -f ./$(DEPDIR)/initcache.Plo -rm -f ./$(DEPDIR)/internal.Plo -rm -f ./$(DEPDIR)/inv.Plo -rm -f ./$(DEPDIR)/list.Plo -rm -f ./$(DEPDIR)/log.Plo -rm -f ./$(DEPDIR)/malloc.Plo -rm -f ./$(DEPDIR)/mlfn.Plo -rm -f ./$(DEPDIR)/msfn.Plo -rm -f ./$(DEPDIR)/mutex.Plo -rm -f ./$(DEPDIR)/networkfilemanager.Plo -rm -f ./$(DEPDIR)/param.Plo -rm -f ./$(DEPDIR)/phi2.Plo -rm -f ./$(DEPDIR)/pipeline.Plo -rm -f ./$(DEPDIR)/pr_list.Plo -rm -f ./$(DEPDIR)/proj_json_streaming_writer.Plo -rm -f ./$(DEPDIR)/proj_mdist.Plo -rm -f ./$(DEPDIR)/qsfn.Plo -rm -f ./$(DEPDIR)/release.Plo -rm -f ./$(DEPDIR)/rtodms.Plo -rm -f ./$(DEPDIR)/sqlite3_utils.Plo -rm -f ./$(DEPDIR)/strerrno.Plo -rm -f ./$(DEPDIR)/strtod.Plo -rm -f ./$(DEPDIR)/tracing.Plo -rm -f ./$(DEPDIR)/tsfn.Plo -rm -f ./$(DEPDIR)/units.Plo -rm -f ./$(DEPDIR)/wkt1_generated_parser.Plo -rm -f ./$(DEPDIR)/wkt1_parser.Plo -rm -f ./$(DEPDIR)/wkt2_generated_parser.Plo -rm -f ./$(DEPDIR)/wkt2_parser.Plo -rm -f ./$(DEPDIR)/wkt_parser.Plo -rm -f ./$(DEPDIR)/zpoly1.Plo -rm -f apps/$(DEPDIR)/cct.Po -rm -f apps/$(DEPDIR)/cs2cs.Po -rm -f apps/$(DEPDIR)/emess.Po -rm -f apps/$(DEPDIR)/geod.Po -rm -f apps/$(DEPDIR)/geod_interface.Po -rm -f apps/$(DEPDIR)/geod_set.Po -rm -f apps/$(DEPDIR)/gie.Po -rm -f apps/$(DEPDIR)/proj.Po -rm -f apps/$(DEPDIR)/proj_strtod.Po -rm -f apps/$(DEPDIR)/projinfo.Po -rm -f apps/$(DEPDIR)/projsync.Po -rm -f apps/$(DEPDIR)/utils.Po -rm -f conversions/$(DEPDIR)/axisswap.Plo -rm -f conversions/$(DEPDIR)/cart.Plo -rm -f conversions/$(DEPDIR)/geoc.Plo -rm -f conversions/$(DEPDIR)/geocent.Plo -rm -f conversions/$(DEPDIR)/noop.Plo -rm -f conversions/$(DEPDIR)/set.Plo -rm -f conversions/$(DEPDIR)/topocentric.Plo -rm -f conversions/$(DEPDIR)/unitconvert.Plo -rm -f iso19111/$(DEPDIR)/c_api.Plo -rm -f iso19111/$(DEPDIR)/common.Plo -rm -f iso19111/$(DEPDIR)/coordinatesystem.Plo -rm -f iso19111/$(DEPDIR)/crs.Plo -rm -f iso19111/$(DEPDIR)/datum.Plo -rm -f iso19111/$(DEPDIR)/factory.Plo -rm -f iso19111/$(DEPDIR)/internal.Plo -rm -f iso19111/$(DEPDIR)/io.Plo -rm -f iso19111/$(DEPDIR)/metadata.Plo -rm -f iso19111/$(DEPDIR)/static.Plo -rm -f iso19111/$(DEPDIR)/util.Plo -rm -f iso19111/operation/$(DEPDIR)/concatenatedoperation.Plo -rm -f iso19111/operation/$(DEPDIR)/conversion.Plo -rm -f iso19111/operation/$(DEPDIR)/coordinateoperationfactory.Plo -rm -f iso19111/operation/$(DEPDIR)/esriparammappings.Plo -rm -f iso19111/operation/$(DEPDIR)/oputils.Plo -rm -f iso19111/operation/$(DEPDIR)/parammappings.Plo -rm -f iso19111/operation/$(DEPDIR)/projbasedoperation.Plo -rm -f iso19111/operation/$(DEPDIR)/singleoperation.Plo -rm -f iso19111/operation/$(DEPDIR)/transformation.Plo -rm -f iso19111/operation/$(DEPDIR)/vectorofvaluesparams.Plo -rm -f projections/$(DEPDIR)/adams.Plo -rm -f projections/$(DEPDIR)/aea.Plo -rm -f projections/$(DEPDIR)/aeqd.Plo -rm -f projections/$(DEPDIR)/airy.Plo -rm -f projections/$(DEPDIR)/aitoff.Plo -rm -f projections/$(DEPDIR)/august.Plo -rm -f projections/$(DEPDIR)/bacon.Plo -rm -f projections/$(DEPDIR)/bertin1953.Plo -rm -f projections/$(DEPDIR)/bipc.Plo -rm -f projections/$(DEPDIR)/boggs.Plo -rm -f projections/$(DEPDIR)/bonne.Plo -rm -f projections/$(DEPDIR)/calcofi.Plo -rm -f projections/$(DEPDIR)/cass.Plo -rm -f projections/$(DEPDIR)/cc.Plo -rm -f projections/$(DEPDIR)/ccon.Plo -rm -f projections/$(DEPDIR)/cea.Plo -rm -f projections/$(DEPDIR)/chamb.Plo -rm -f projections/$(DEPDIR)/col_urban.Plo -rm -f projections/$(DEPDIR)/collg.Plo -rm -f projections/$(DEPDIR)/comill.Plo -rm -f projections/$(DEPDIR)/crast.Plo -rm -f projections/$(DEPDIR)/denoy.Plo -rm -f projections/$(DEPDIR)/eck1.Plo -rm -f projections/$(DEPDIR)/eck2.Plo -rm -f projections/$(DEPDIR)/eck3.Plo -rm -f projections/$(DEPDIR)/eck4.Plo -rm -f projections/$(DEPDIR)/eck5.Plo -rm -f projections/$(DEPDIR)/eqc.Plo -rm -f projections/$(DEPDIR)/eqdc.Plo -rm -f projections/$(DEPDIR)/eqearth.Plo -rm -f projections/$(DEPDIR)/fahey.Plo -rm -f projections/$(DEPDIR)/fouc_s.Plo -rm -f projections/$(DEPDIR)/gall.Plo -rm -f projections/$(DEPDIR)/geos.Plo -rm -f projections/$(DEPDIR)/gins8.Plo -rm -f projections/$(DEPDIR)/gn_sinu.Plo -rm -f projections/$(DEPDIR)/gnom.Plo -rm -f projections/$(DEPDIR)/goode.Plo -rm -f projections/$(DEPDIR)/gstmerc.Plo -rm -f projections/$(DEPDIR)/hammer.Plo -rm -f projections/$(DEPDIR)/hatano.Plo -rm -f projections/$(DEPDIR)/healpix.Plo -rm -f projections/$(DEPDIR)/igh.Plo -rm -f projections/$(DEPDIR)/igh_o.Plo -rm -f projections/$(DEPDIR)/imw_p.Plo -rm -f projections/$(DEPDIR)/isea.Plo -rm -f projections/$(DEPDIR)/krovak.Plo -rm -f projections/$(DEPDIR)/labrd.Plo -rm -f projections/$(DEPDIR)/laea.Plo -rm -f projections/$(DEPDIR)/lagrng.Plo -rm -f projections/$(DEPDIR)/larr.Plo -rm -f projections/$(DEPDIR)/lask.Plo -rm -f projections/$(DEPDIR)/latlong.Plo -rm -f projections/$(DEPDIR)/lcc.Plo -rm -f projections/$(DEPDIR)/lcca.Plo -rm -f projections/$(DEPDIR)/loxim.Plo -rm -f projections/$(DEPDIR)/lsat.Plo -rm -f projections/$(DEPDIR)/mbt_fps.Plo -rm -f projections/$(DEPDIR)/mbtfpp.Plo -rm -f projections/$(DEPDIR)/mbtfpq.Plo -rm -f projections/$(DEPDIR)/merc.Plo -rm -f projections/$(DEPDIR)/mill.Plo -rm -f projections/$(DEPDIR)/misrsom.Plo -rm -f projections/$(DEPDIR)/mod_ster.Plo -rm -f projections/$(DEPDIR)/moll.Plo -rm -f projections/$(DEPDIR)/natearth.Plo -rm -f projections/$(DEPDIR)/natearth2.Plo -rm -f projections/$(DEPDIR)/nell.Plo -rm -f projections/$(DEPDIR)/nell_h.Plo -rm -f projections/$(DEPDIR)/nicol.Plo -rm -f projections/$(DEPDIR)/nsper.Plo -rm -f projections/$(DEPDIR)/nzmg.Plo -rm -f projections/$(DEPDIR)/ob_tran.Plo -rm -f projections/$(DEPDIR)/ocea.Plo -rm -f projections/$(DEPDIR)/oea.Plo -rm -f projections/$(DEPDIR)/omerc.Plo -rm -f projections/$(DEPDIR)/ortho.Plo -rm -f projections/$(DEPDIR)/patterson.Plo -rm -f projections/$(DEPDIR)/poly.Plo -rm -f projections/$(DEPDIR)/putp2.Plo -rm -f projections/$(DEPDIR)/putp3.Plo -rm -f projections/$(DEPDIR)/putp4p.Plo -rm -f projections/$(DEPDIR)/putp5.Plo -rm -f projections/$(DEPDIR)/putp6.Plo -rm -f projections/$(DEPDIR)/qsc.Plo -rm -f projections/$(DEPDIR)/robin.Plo -rm -f projections/$(DEPDIR)/rouss.Plo -rm -f projections/$(DEPDIR)/rpoly.Plo -rm -f projections/$(DEPDIR)/s2.Plo -rm -f projections/$(DEPDIR)/sch.Plo -rm -f projections/$(DEPDIR)/sconics.Plo -rm -f projections/$(DEPDIR)/somerc.Plo -rm -f projections/$(DEPDIR)/stere.Plo -rm -f projections/$(DEPDIR)/sterea.Plo -rm -f projections/$(DEPDIR)/sts.Plo -rm -f projections/$(DEPDIR)/tcc.Plo -rm -f projections/$(DEPDIR)/tcea.Plo -rm -f projections/$(DEPDIR)/times.Plo -rm -f projections/$(DEPDIR)/tmerc.Plo -rm -f projections/$(DEPDIR)/tobmerc.Plo -rm -f projections/$(DEPDIR)/tpeqd.Plo -rm -f projections/$(DEPDIR)/urm5.Plo -rm -f projections/$(DEPDIR)/urmfps.Plo -rm -f projections/$(DEPDIR)/vandg.Plo -rm -f projections/$(DEPDIR)/vandg2.Plo -rm -f projections/$(DEPDIR)/vandg4.Plo -rm -f projections/$(DEPDIR)/wag2.Plo -rm -f projections/$(DEPDIR)/wag3.Plo -rm -f projections/$(DEPDIR)/wag7.Plo -rm -f projections/$(DEPDIR)/wink1.Plo -rm -f projections/$(DEPDIR)/wink2.Plo -rm -f tests/$(DEPDIR)/geodtest.Po -rm -f tests/$(DEPDIR)/multistresstest.Po -rm -f transformations/$(DEPDIR)/affine.Plo -rm -f transformations/$(DEPDIR)/defmodel.Plo -rm -f transformations/$(DEPDIR)/deformation.Plo -rm -f transformations/$(DEPDIR)/helmert.Plo -rm -f transformations/$(DEPDIR)/hgridshift.Plo -rm -f transformations/$(DEPDIR)/horner.Plo -rm -f transformations/$(DEPDIR)/molodensky.Plo -rm -f transformations/$(DEPDIR)/tinshift.Plo -rm -f transformations/$(DEPDIR)/vgridshift.Plo -rm -f transformations/$(DEPDIR)/xyzgridshift.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-includeHEADERS \ uninstall-libLTLIBRARIES .MAKE: all check-am install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \ check-am clean clean-binPROGRAMS clean-checkPROGRAMS \ clean-generic clean-libLTLIBRARIES clean-libtool \ clean-noinstPROGRAMS cscopelist-am ctags ctags-am distclean \ distclean-compile distclean-generic distclean-hdr \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-exec-local install-html \ install-html-am install-includeHEADERS install-info \ install-info-am install-libLTLIBRARIES install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ recheck tags tags-am uninstall uninstall-am \ uninstall-binPROGRAMS uninstall-includeHEADERS \ uninstall-libLTLIBRARIES .PRECIOUS: Makefile # The sed hack is to please MSVC wkt1_parser: bison --no-lines -d -p pj_wkt1_ -o$(top_srcdir)/src/wkt1_generated_parser.c $(top_srcdir)/src/wkt1_grammar.y sed "s/\*yyssp = yystate/\*yyssp = (yytype_int16)yystate/" < $(top_srcdir)/src/wkt1_generated_parser.c | sed "s/yyerrorlab:/#if 0\nyyerrorlab:/" | sed "s/yyerrlab1:/#endif\nyyerrlab1:/" | sed "s/for (yylen = 0; yystr\[yylen\]; yylen++)/for (yylen = 0; yystr \&\& yystr\[yylen\]; yylen++)/" | sed "s/return yystpcpy (yyres, yystr) - yyres;/return (YYPTRDIFF_T)(yystpcpy (yyres, yystr) - yyres);/" | sed "s/YYPTRDIFF_T yysize = yyssp - yyss + 1;/YYPTRDIFF_T yysize = (YYPTRDIFF_T)(yyssp - yyss + 1);/" > $(top_srcdir)/src/wkt1_generated_parser.c.tmp mv $(top_srcdir)/src/wkt1_generated_parser.c.tmp $(top_srcdir)/src/wkt1_generated_parser.c wkt2_parser: bison --no-lines -d -p pj_wkt2_ -o$(top_srcdir)/src/wkt2_generated_parser.c $(top_srcdir)/src/wkt2_grammar.y sed "s/\*yyssp = yystate/\*yyssp = (yytype_int16)yystate/" < $(top_srcdir)/src/wkt2_generated_parser.c | sed "s/yyerrorlab:/#if 0\nyyerrorlab:/" | sed "s/yyerrlab1:/#endif\nyyerrlab1:/" | sed "s/for (yylen = 0; yystr\[yylen\]; yylen++)/for (yylen = 0; yystr \&\& yystr\[yylen\]; yylen++)/"| sed "s/return yystpcpy (yyres, yystr) - yyres;/return (YYPTRDIFF_T)(yystpcpy (yyres, yystr) - yyres);/" | sed "s/YYPTRDIFF_T yysize = yyssp - yyss + 1;/YYPTRDIFF_T yysize = (YYPTRDIFF_T)(yyssp - yyss + 1);/"> $(top_srcdir)/src/wkt2_generated_parser.c.tmp mv $(top_srcdir)/src/wkt2_generated_parser.c.tmp $(top_srcdir)/src/wkt2_generated_parser.c install-exec-local: install-binPROGRAMS rm -f $(DESTDIR)$(bindir)/invproj$(EXEEXT) (cd $(DESTDIR)$(bindir); ln -s proj$(EXEEXT) invproj$(EXEEXT)) rm -f $(DESTDIR)$(bindir)/invgeod$(EXEEXT) (cd $(DESTDIR)$(bindir); ln -s geod$(EXEEXT) invgeod$(EXEEXT)) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: proj-8.2.1/src/wkt_parser.hpp000644 000765 000024 00000004051 13437770506 016633 0ustar00keversstaff000000 000000 /****************************************************************************** * Project: PROJ * Purpose: WKT parser common routines * Author: Even Rouault, * ****************************************************************************** * Copyright (c) 2018 Even Rouault, * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. ****************************************************************************/ #ifndef PJ_WKT_PARSER_H_INCLUDED #define PJ_WKT_PARSER_H_INCLUDED //! @cond Doxygen_Suppress #include struct pj_wkt_parse_context { const char *pszInput = nullptr; const char *pszLastSuccess = nullptr; const char *pszNext = nullptr; std::string errorMsg{}; pj_wkt_parse_context() = default; pj_wkt_parse_context(const pj_wkt_parse_context &) = delete; pj_wkt_parse_context &operator=(const pj_wkt_parse_context &) = delete; }; void pj_wkt_error(pj_wkt_parse_context *context, const char *msg); //! @endcond #endif // PJ_WKT_PARSER_H_INCLUDED proj-8.2.1/src/bin_geod.cmake000644 000765 000024 00000002363 14140020570 016472 0ustar00keversstaff000000 000000 set(GEOD_SRC apps/geod.cpp apps/geod_set.cpp apps/geod_interface.cpp apps/emess.cpp ) set(GEOD_INCLUDE apps/geod_interface.h) source_group("Source Files\\Bin" FILES ${GEOD_SRC} ${GEOD_INCLUDE}) add_executable(geod ${GEOD_SRC} ${GEOD_INCLUDE}) target_link_libraries(geod PRIVATE ${PROJ_LIBRARIES}) target_compile_options(geod PRIVATE ${PROJ_CXX_WARN_FLAGS}) install(TARGETS geod DESTINATION ${BINDIR}) # invgeod target: symlink or copy of geod executable if(UNIX) set(link_target "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/invgeod${CMAKE_EXECUTABLE_SUFFIX}") set(link_source "geod${CMAKE_EXECUTABLE_SUFFIX}") add_custom_command( OUTPUT ${link_target} COMMAND ${CMAKE_COMMAND} -E create_symlink ${link_source} ${link_target} WORKING_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" DEPENDS geod COMMENT "Generating invgeod" VERBATIM ) add_custom_target(invgeod ALL DEPENDS ${link_target}) install(FILES ${link_target} DESTINATION ${BINDIR}) else() add_executable(invgeod ${GEOD_SRC} ${GEOD_INCLUDE}) target_link_libraries(invgeod PRIVATE ${PROJ_LIBRARIES}) target_compile_options(invgeod PRIVATE ${PROJ_CXX_WARN_FLAGS}) install(TARGETS invgeod DESTINATION ${BINDIR}) endif() proj-8.2.1/src/lib_proj.cmake000644 000765 000024 00000033647 14140020570 016535 0ustar00keversstaff000000 000000 message(STATUS "Configuring proj library:") ############################################## ### SWITCH BETWEEN STATIC OR SHARED LIBRARY### ############################################## # default config is shared, except static on Windows set(BUILD_SHARED_LIBS_DEFAULT ON) if(WIN32) set(BUILD_SHARED_LIBS_DEFAULT OFF) endif() option(BUILD_SHARED_LIBS "Build PROJ library shared." ${BUILD_SHARED_LIBS_DEFAULT}) option(USE_THREAD "Build libproj with thread/mutex support " ON) if(NOT USE_THREAD) add_definitions(-DMUTEX_stub) endif() find_package(Threads QUIET) if(USE_THREAD AND Threads_FOUND AND CMAKE_USE_WIN32_THREADS_INIT) add_definitions(-DMUTEX_win32) elseif(USE_THREAD AND Threads_FOUND AND CMAKE_USE_PTHREADS_INIT) add_definitions(-DMUTEX_pthread) elseif(USE_THREAD AND NOT Threads_FOUND) message(FATAL_ERROR "No thread library found and thread/mutex support is " "required by USE_THREAD option") endif() option(ENABLE_IPO "Build library with interprocedural optimization (if available)." OFF) if(ENABLE_IPO) cmake_policy(SET CMP0069 NEW) include(CheckIPOSupported) check_ipo_supported(RESULT ENABLE_IPO) endif() print_variable(ENABLE_IPO) ############################################## ### library source list and include_list ### ############################################## set(SRC_LIBPROJ_PROJECTIONS projections/aeqd.cpp projections/adams.cpp projections/gnom.cpp projections/laea.cpp projections/mod_ster.cpp projections/nsper.cpp projections/nzmg.cpp projections/ortho.cpp projections/stere.cpp projections/sterea.cpp projections/aea.cpp projections/bipc.cpp projections/bonne.cpp projections/eqdc.cpp projections/isea.cpp projections/ccon.cpp projections/imw_p.cpp projections/krovak.cpp projections/lcc.cpp projections/poly.cpp projections/rpoly.cpp projections/sconics.cpp projections/rouss.cpp projections/cass.cpp projections/cc.cpp projections/cea.cpp projections/eqc.cpp projections/gall.cpp projections/labrd.cpp projections/lsat.cpp projections/misrsom.cpp projections/merc.cpp projections/mill.cpp projections/ocea.cpp projections/omerc.cpp projections/somerc.cpp projections/tcc.cpp projections/tcea.cpp projections/times.cpp projections/tmerc.cpp projections/tobmerc.cpp projections/airy.cpp projections/aitoff.cpp projections/august.cpp projections/bacon.cpp projections/bertin1953.cpp projections/chamb.cpp projections/hammer.cpp projections/lagrng.cpp projections/larr.cpp projections/lask.cpp projections/latlong.cpp projections/nicol.cpp projections/ob_tran.cpp projections/oea.cpp projections/tpeqd.cpp projections/vandg.cpp projections/vandg2.cpp projections/vandg4.cpp projections/wag7.cpp projections/lcca.cpp projections/geos.cpp projections/boggs.cpp projections/collg.cpp projections/comill.cpp projections/crast.cpp projections/denoy.cpp projections/eck1.cpp projections/eck2.cpp projections/eck3.cpp projections/eck4.cpp projections/eck5.cpp projections/fahey.cpp projections/fouc_s.cpp projections/gins8.cpp projections/gstmerc.cpp projections/gn_sinu.cpp projections/goode.cpp projections/igh.cpp projections/igh_o.cpp projections/hatano.cpp projections/loxim.cpp projections/mbt_fps.cpp projections/mbtfpp.cpp projections/mbtfpq.cpp projections/moll.cpp projections/nell.cpp projections/nell_h.cpp projections/patterson.cpp projections/putp2.cpp projections/putp3.cpp projections/putp4p.cpp projections/putp5.cpp projections/putp6.cpp projections/qsc.cpp projections/robin.cpp projections/s2.cpp projections/sch.cpp projections/sts.cpp projections/urm5.cpp projections/urmfps.cpp projections/wag2.cpp projections/wag3.cpp projections/wink1.cpp projections/wink2.cpp projections/healpix.cpp projections/natearth.cpp projections/natearth2.cpp projections/calcofi.cpp projections/eqearth.cpp projections/col_urban.cpp ) set(SRC_LIBPROJ_CONVERSIONS conversions/axisswap.cpp conversions/cart.cpp conversions/geoc.cpp conversions/geocent.cpp conversions/noop.cpp conversions/topocentric.cpp conversions/set.cpp conversions/unitconvert.cpp ) set(SRC_LIBPROJ_TRANSFORMATIONS transformations/affine.cpp transformations/deformation.cpp transformations/helmert.cpp transformations/hgridshift.cpp transformations/horner.cpp transformations/molodensky.cpp transformations/vgridshift.cpp transformations/xyzgridshift.cpp transformations/defmodel.cpp transformations/tinshift.cpp ) set(SRC_LIBPROJ_ISO19111 iso19111/static.cpp iso19111/util.cpp iso19111/metadata.cpp iso19111/common.cpp iso19111/crs.cpp iso19111/datum.cpp iso19111/coordinatesystem.cpp iso19111/io.cpp iso19111/internal.cpp iso19111/factory.cpp iso19111/c_api.cpp iso19111/operation/concatenatedoperation.cpp iso19111/operation/coordinateoperationfactory.cpp iso19111/operation/conversion.cpp iso19111/operation/esriparammappings.cpp iso19111/operation/oputils.cpp iso19111/operation/parammappings.cpp iso19111/operation/projbasedoperation.cpp iso19111/operation/singleoperation.cpp iso19111/operation/transformation.cpp iso19111/operation/vectorofvaluesparams.cpp ) set(SRC_LIBPROJ_CORE 4D_api.cpp aasincos.cpp adjlon.cpp auth.cpp ctx.cpp datum_set.cpp datums.cpp deriv.cpp dmstor.cpp ell_set.cpp ellps.cpp factors.cpp fwd.cpp gauss.cpp generic_inverse.cpp geodesic.c init.cpp initcache.cpp internal.cpp inv.cpp list.cpp log.cpp malloc.cpp mlfn.cpp msfn.cpp mutex.cpp param.cpp phi2.cpp pipeline.cpp pj_list.h pr_list.cpp proj_internal.h proj_mdist.cpp qsfn.cpp release.cpp rtodms.cpp strerrno.cpp strtod.cpp tsfn.cpp units.cpp wkt1_generated_parser.c wkt1_generated_parser.h wkt1_parser.cpp wkt1_parser.h wkt2_generated_parser.c wkt2_generated_parser.h wkt2_parser.cpp wkt2_parser.h wkt_parser.cpp wkt_parser.hpp zpoly1.cpp proj_json_streaming_writer.hpp proj_json_streaming_writer.cpp tracing.cpp grids.hpp grids.cpp filemanager.hpp filemanager.cpp networkfilemanager.cpp sqlite3_utils.hpp sqlite3_utils.cpp ${CMAKE_CURRENT_BINARY_DIR}/proj_config.h ) set(HEADERS_LIBPROJ proj.h proj_experimental.h proj_constants.h proj_symbol_rename.h geodesic.h ) # Group source files for IDE source explorers (e.g. Visual Studio) source_group("Header Files" FILES ${HEADERS_LIBPROJ}) source_group("Source Files\\Core" FILES ${SRC_LIBPROJ_CORE}) source_group("Source Files\\Conversions" FILES ${SRC_LIBPROJ_CONVERSIONS}) source_group("Source Files\\Projections" FILES ${SRC_LIBPROJ_PROJECTIONS}) source_group("Source Files\\Transformations" FILES ${SRC_LIBPROJ_TRANSFORMATIONS}) source_group("Source Files\\ISO19111" FILES ${SRC_LIBPROJ_ISO19111}) include_directories(${PROJ_SOURCE_DIR}/include) include_directories(${CMAKE_CURRENT_BINARY_DIR}) source_group("CMake Files" FILES CMakeLists.txt) # Embed PROJ_LIB data files location add_definitions(-DPROJ_LIB="${CMAKE_INSTALL_PREFIX}/${DATADIR}") ########################################################### # targets to refresh wkt1_parser.cpp and wkt2_parser.cpp ########################################################### # Those targets need to be run manually each time wkt1_grammar.y / wkt2_grammar.y # is modified. # We could of course run them automatically, but that would make building # PROJ harder. # This target checks that wkt1_grammar.y md5sum has not changed # If it has, then it should be updated and the generate_wkt1_parser target # should be manually run add_custom_target(check_wkt1_grammar_md5 ALL COMMAND ${CMAKE_COMMAND} "-DIN_FILE=wkt1_grammar.y" "-DTARGET=generate_wkt1_parser" "-DEXPECTED_MD5SUM=3a1720c3fa1b759719e33dd558603efb" -P "${CMAKE_CURRENT_SOURCE_DIR}/check_md5sum.cmake" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/wkt1_grammar.y" VERBATIM) add_custom_target(generate_wkt1_parser COMMAND ${CMAKE_COMMAND} "-DPREFIX=pj_wkt1_" "-DIN_FILE=wkt1_grammar.y" "-DOUT_FILE=wkt1_generated_parser.c" -P "${CMAKE_CURRENT_SOURCE_DIR}/generate_wkt_parser.cmake" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" VERBATIM) # This target checks that wkt2_grammar.y md5sum has not changed # If it has, then it should be updated and the generate_wkt2_parser target # should be manually run add_custom_target(check_wkt2_grammar_md5 ALL COMMAND ${CMAKE_COMMAND} "-DIN_FILE=wkt2_grammar.y" "-DTARGET=generate_wkt2_parser" "-DEXPECTED_MD5SUM=1691b7d213073d5a1b49db2e080bc96e" -P "${CMAKE_CURRENT_SOURCE_DIR}/check_md5sum.cmake" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/wkt2_grammar.y" VERBATIM) add_custom_target(generate_wkt2_parser COMMAND ${CMAKE_COMMAND} "-DPREFIX=pj_wkt2_" "-DIN_FILE=wkt2_grammar.y" "-DOUT_FILE=wkt2_generated_parser.c" -P "${CMAKE_CURRENT_SOURCE_DIR}/generate_wkt_parser.cmake" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" VERBATIM) ################################################# ## targets: libproj and proj_config.h ################################################# set(ALL_LIBPROJ_SOURCES ${SRC_LIBPROJ_CORE} ${SRC_LIBPROJ_CONVERSIONS} ${SRC_LIBPROJ_PROJECTIONS} ${SRC_LIBPROJ_TRANSFORMATIONS} ${SRC_LIBPROJ_ISO19111} ) set(ALL_LIBPROJ_HEADERS ${HEADERS_LIBPROJ}) # Configuration for the core target "proj" proj_target_output_name(proj PROJ_CORE_TARGET_OUTPUT_NAME) add_library(proj ${ALL_LIBPROJ_SOURCES} ${ALL_LIBPROJ_HEADERS} ${PROJ_RESOURCES} ) add_library(PROJ::proj ALIAS proj) target_compile_options(proj PRIVATE $<$:${PROJ_C_WARN_FLAGS}> PRIVATE $<$:${PROJ_CXX_WARN_FLAGS}> ) if(MSVC OR MINGW) target_compile_definitions(proj PRIVATE -DNOMINMAX) endif() # Tell Intel compiler to do arithmetic accurately. This is needed to stop the # compiler from ignoring parentheses in expressions like (a + b) + c and from # simplifying 0.0 + x to x (which is wrong if x = -0.0). if("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel") if(MSVC) set(FP_PRECISE "/fp:precise") else() set(FP_PRECISE "-fp-model precise") endif() # Apply to source files that require this option set_source_files_properties( geodesic.c PROPERTIES COMPILE_FLAGS ${FP_PRECISE}) endif() if(ENABLE_IPO) set_property(TARGET proj PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) endif() target_include_directories(proj INTERFACE $ $ $) if(WIN32) set_target_properties(proj PROPERTIES VERSION "${${PROJECT_NAME}_BUILD_VERSION}" OUTPUT_NAME "${PROJ_CORE_TARGET_OUTPUT_NAME}" ARCHIVE_OUTPUT_NAME proj CLEAN_DIRECT_OUTPUT 1) elseif(BUILD_FRAMEWORKS_AND_BUNDLE) set_target_properties(proj PROPERTIES VERSION "${${PROJECT_NAME}_BUILD_VERSION}" INSTALL_NAME_DIR ${PROJ_INSTALL_NAME_DIR} CLEAN_DIRECT_OUTPUT 1) else() set_target_properties(proj PROPERTIES VERSION "${${PROJECT_NAME}_BUILD_VERSION}" SOVERSION "${${PROJECT_NAME}_API_VERSION}" CLEAN_DIRECT_OUTPUT 1) endif() set_target_properties(proj PROPERTIES LINKER_LANGUAGE CXX) ############################################## # Link properties ############################################## set(PROJ_LIBRARIES proj) # hack, required for test/unit set(PROJ_LIBRARIES ${PROJ_LIBRARIES} PARENT_SCOPE) if(UNIX) find_library(M_LIB m) if(M_LIB) target_link_libraries(proj PRIVATE -lm) endif() find_library(DL_LIB dl) if(DL_LIB) target_link_libraries(proj PRIVATE -ldl) endif() endif() if(USE_THREAD AND Threads_FOUND AND CMAKE_USE_PTHREADS_INIT) target_link_libraries(proj PRIVATE ${CMAKE_THREAD_LIBS_INIT}) endif() target_include_directories(proj PRIVATE ${SQLITE3_INCLUDE_DIR}) target_link_libraries(proj PRIVATE ${SQLITE3_LIBRARY}) if(NLOHMANN_JSON STREQUAL "external") target_compile_definitions(proj PRIVATE EXTERNAL_NLOHMANN_JSON) target_link_libraries(proj PRIVATE $) endif() if(TIFF_ENABLED) target_compile_definitions(proj PRIVATE -DTIFF_ENABLED) target_include_directories(proj PRIVATE ${TIFF_INCLUDE_DIR}) target_link_libraries(proj PRIVATE ${TIFF_LIBRARY}) endif() if(CURL_ENABLED) target_compile_definitions(proj PRIVATE -DCURL_ENABLED) target_include_directories(proj PRIVATE ${CURL_INCLUDE_DIR}) target_link_libraries(proj PRIVATE ${CURL_LIBRARY} $<$:ws2_32> $<$:wldap32> $<$:advapi32> $<$:crypt32> $<$:normaliz>) endif() if(BUILD_SHARED_LIBS) if(MSVC) target_compile_definitions(proj PRIVATE PROJ_MSVC_DLL_EXPORT=1) endif() else() target_compile_definitions(proj PUBLIC PROJ_DLL=) endif() ############################################## # install ############################################## install(TARGETS proj EXPORT targets RUNTIME DESTINATION ${BINDIR} LIBRARY DESTINATION ${LIBDIR} ARCHIVE DESTINATION ${LIBDIR} FRAMEWORK DESTINATION ${FRAMEWORKDIR}) if(NOT BUILD_FRAMEWORKS_AND_BUNDLE) install(FILES ${ALL_LIBPROJ_HEADERS} DESTINATION ${INCLUDEDIR}) endif() ############################################## # Core configuration summary ############################################## print_variable(PROJ_CORE_TARGET_OUTPUT_NAME) print_variable(BUILD_SHARED_LIBS) print_variable(PROJ_LIBRARIES) proj-8.2.1/src/fwd.cpp000644 000765 000024 00000021277 14140020570 015213 0ustar00keversstaff000000 000000 /****************************************************************************** * Project: PROJ.4 * Purpose: Forward operation invocation * Author: Thomas Knudsen, thokn@sdfe.dk, 2018-01-02 * Based on material from Gerald Evenden (original pj_fwd) * and Piyush Agram (original pj_fwd3d) * ****************************************************************************** * Copyright (c) 2000, Frank Warmerdam * Copyright (c) 2018, Thomas Knudsen / SDFE * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. *****************************************************************************/ #include #include #include "proj_internal.h" #include #define INPUT_UNITS P->left #define OUTPUT_UNITS P->right static void fwd_prepare (PJ *P, PJ_COORD& coo) { if (HUGE_VAL==coo.v[0] || HUGE_VAL==coo.v[1] || HUGE_VAL==coo.v[2]) { coo = proj_coord_error (); return; } /* The helmert datum shift will choke unless it gets a sensible 4D coordinate */ if (HUGE_VAL==coo.v[2] && P->helmert) coo.v[2] = 0.0; if (HUGE_VAL==coo.v[3] && P->helmert) coo.v[3] = 0.0; /* Check validity of angular input coordinates */ if (INPUT_UNITS==PJ_IO_UNITS_RADIANS) { double t; /* check for latitude or longitude over-range */ t = (coo.lp.phi < 0 ? -coo.lp.phi : coo.lp.phi) - M_HALFPI; if (t > PJ_EPS_LAT) { proj_log_error(P, _("Invalid latitude")); proj_errno_set (P, PROJ_ERR_COORD_TRANSFM_INVALID_COORD); coo = proj_coord_error (); return; } if (coo.lp.lam > 10 || coo.lp.lam < -10) { proj_log_error(P, _("Invalid longitude")); proj_errno_set (P, PROJ_ERR_COORD_TRANSFM_INVALID_COORD); coo = proj_coord_error (); return; } /* Clamp latitude to -90..90 degree range */ if (coo.lp.phi > M_HALFPI) coo.lp.phi = M_HALFPI; if (coo.lp.phi < -M_HALFPI) coo.lp.phi = -M_HALFPI; /* If input latitude is geocentrical, convert to geographical */ if (P->geoc) coo = pj_geocentric_latitude (P, PJ_INV, coo); /* Ensure longitude is in the -pi:pi range */ if (0==P->over) coo.lp.lam = adjlon(coo.lp.lam); if (P->hgridshift) coo = proj_trans (P->hgridshift, PJ_INV, coo); else if (P->helmert || (P->cart_wgs84 != nullptr && P->cart != nullptr)) { coo = proj_trans (P->cart_wgs84, PJ_FWD, coo); /* Go cartesian in WGS84 frame */ if( P->helmert ) coo = proj_trans (P->helmert, PJ_INV, coo); /* Step into local frame */ coo = proj_trans (P->cart, PJ_INV, coo); /* Go back to angular using local ellps */ } if (coo.lp.lam==HUGE_VAL) return; if (P->vgridshift) coo = proj_trans (P->vgridshift, PJ_FWD, coo); /* Go orthometric from geometric */ /* Distance from central meridian, taking system zero meridian into account */ coo.lp.lam = (coo.lp.lam - P->from_greenwich) - P->lam0; /* Ensure longitude is in the -pi:pi range */ if (0==P->over) coo.lp.lam = adjlon(coo.lp.lam); return; } /* We do not support gridshifts on cartesian input */ if (INPUT_UNITS==PJ_IO_UNITS_CARTESIAN && P->helmert) coo = proj_trans (P->helmert, PJ_INV, coo); return; } static void fwd_finalize (PJ *P, PJ_COORD& coo) { switch (OUTPUT_UNITS) { /* Handle false eastings/northings and non-metric linear units */ case PJ_IO_UNITS_CARTESIAN: if (P->is_geocent) { coo = proj_trans (P->cart, PJ_FWD, coo); } coo.xyz.x *= P->fr_meter; coo.xyz.y *= P->fr_meter; coo.xyz.z *= P->fr_meter; break; /* Classic proj.4 functions return plane coordinates in units of the semimajor axis */ case PJ_IO_UNITS_CLASSIC: coo.xy.x *= P->a; coo.xy.y *= P->a; /* Falls through */ /* (<-- GCC warning silencer) */ /* to continue processing in common with PJ_IO_UNITS_PROJECTED */ case PJ_IO_UNITS_PROJECTED: coo.xyz.x = P->fr_meter * (coo.xyz.x + P->x0); coo.xyz.y = P->fr_meter * (coo.xyz.y + P->y0); coo.xyz.z = P->vfr_meter * (coo.xyz.z + P->z0); break; case PJ_IO_UNITS_WHATEVER: break; case PJ_IO_UNITS_DEGREES: break; case PJ_IO_UNITS_RADIANS: coo.lpz.z = P->vfr_meter * (coo.lpz.z + P->z0); if( P->is_long_wrap_set ) { if( coo.lpz.lam != HUGE_VAL ) { coo.lpz.lam = P->long_wrap_center + adjlon(coo.lpz.lam - P->long_wrap_center); } } break; } if (P->axisswap) coo = proj_trans (P->axisswap, PJ_FWD, coo); } static inline PJ_COORD error_or_coord(PJ *P, PJ_COORD coord, int last_errno) { if (P->ctx->last_errno) return proj_coord_error(); P->ctx->last_errno = last_errno; return coord; } PJ_XY pj_fwd(PJ_LP lp, PJ *P) { PJ_COORD coo = {{0,0,0,0}}; coo.lp = lp; const int last_errno = P->ctx->last_errno; P->ctx->last_errno = 0; if (!P->skip_fwd_prepare) fwd_prepare (P, coo); if (HUGE_VAL==coo.v[0] || HUGE_VAL==coo.v[1]) return proj_coord_error ().xy; /* Do the transformation, using the lowest dimensional transformer available */ if (P->fwd) { const auto xy = P->fwd(coo.lp, P); coo.xy = xy; } else if (P->fwd3d) { const auto xyz = P->fwd3d (coo.lpz, P); coo.xyz = xyz; } else if (P->fwd4d) coo = P->fwd4d (coo, P); else { proj_errno_set (P, PROJ_ERR_OTHER_NO_INVERSE_OP); return proj_coord_error ().xy; } if (HUGE_VAL==coo.v[0]) return proj_coord_error ().xy; if (!P->skip_fwd_finalize) fwd_finalize (P, coo); return error_or_coord(P, coo, last_errno).xy; } PJ_XYZ pj_fwd3d(PJ_LPZ lpz, PJ *P) { PJ_COORD coo = {{0,0,0,0}}; coo.lpz = lpz; const int last_errno = P->ctx->last_errno; P->ctx->last_errno = 0; if (!P->skip_fwd_prepare) fwd_prepare (P, coo); if (HUGE_VAL==coo.v[0]) return proj_coord_error ().xyz; /* Do the transformation, using the lowest dimensional transformer feasible */ if (P->fwd3d) { const auto xyz = P->fwd3d(coo.lpz, P); coo.xyz = xyz; } else if (P->fwd4d) coo = P->fwd4d (coo, P); else if (P->fwd) { const auto xy = P->fwd (coo.lp, P); coo.xy = xy; } else { proj_errno_set (P, PROJ_ERR_OTHER_NO_INVERSE_OP); return proj_coord_error ().xyz; } if (HUGE_VAL==coo.v[0]) return proj_coord_error ().xyz; if (!P->skip_fwd_finalize) fwd_finalize (P, coo); return error_or_coord(P, coo, last_errno).xyz; } PJ_COORD pj_fwd4d (PJ_COORD coo, PJ *P) { const int last_errno = P->ctx->last_errno; P->ctx->last_errno = 0; if (!P->skip_fwd_prepare) fwd_prepare (P, coo); if (HUGE_VAL==coo.v[0]) return proj_coord_error (); /* Call the highest dimensional converter available */ if (P->fwd4d) coo = P->fwd4d (coo, P); else if (P->fwd3d) { const auto xyz = P->fwd3d (coo.lpz, P); coo.xyz = xyz; } else if (P->fwd) { const auto xy = P->fwd (coo.lp, P); coo.xy = xy; } else { proj_errno_set (P, PROJ_ERR_OTHER_NO_INVERSE_OP); return proj_coord_error (); } if (HUGE_VAL==coo.v[0]) return proj_coord_error (); if (!P->skip_fwd_finalize) fwd_finalize (P, coo); return error_or_coord(P, coo, last_errno); } proj-8.2.1/src/bin_proj.cmake000644 000765 000024 00000002324 14140020570 016523 0ustar00keversstaff000000 000000 set(PROJ_SRC apps/proj.cpp apps/emess.cpp apps/utils.cpp ) source_group("Source Files\\Bin" FILES ${PROJ_SRC}) add_executable(binproj ${PROJ_SRC}) set_target_properties(binproj PROPERTIES RUNTIME_OUTPUT_NAME proj) target_link_libraries(binproj PRIVATE ${PROJ_LIBRARIES}) target_compile_options(binproj PRIVATE ${PROJ_CXX_WARN_FLAGS}) install(TARGETS binproj DESTINATION ${BINDIR}) # invproj target: symlink or copy of proj executable if(UNIX) set(link_target "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/invproj${CMAKE_EXECUTABLE_SUFFIX}") set(link_source "proj${CMAKE_EXECUTABLE_SUFFIX}") add_custom_command( OUTPUT ${link_target} COMMAND ${CMAKE_COMMAND} -E create_symlink ${link_source} ${link_target} WORKING_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" DEPENDS binproj COMMENT "Generating invproj" VERBATIM ) add_custom_target(invproj ALL DEPENDS ${link_target}) install(FILES ${link_target} DESTINATION ${BINDIR}) else() add_executable(invproj ${PROJ_SRC}) target_link_libraries(invproj PRIVATE ${PROJ_LIBRARIES}) target_compile_options(invproj PRIVATE ${PROJ_CXX_WARN_FLAGS}) install(TARGETS invproj DESTINATION ${BINDIR}) endif() proj-8.2.1/src/qsfn.cpp000644 000765 000024 00000001055 13437770506 015415 0ustar00keversstaff000000 000000 /* determine small q */ #include #include "proj.h" #include "proj_internal.h" # define EPSILON 1.0e-7 double pj_qsfn(double sinphi, double e, double one_es) { double con, div1, div2; if (e >= EPSILON) { con = e * sinphi; div1 = 1.0 - con * con; div2 = 1.0 + con; /* avoid zero division, fail gracefully */ if (div1 == 0.0 || div2 == 0.0) return HUGE_VAL; return (one_es * (sinphi / div1 - (.5 / e) * log ((1. - con) / div2 ))); } else return (sinphi + sinphi); } proj-8.2.1/src/auth.cpp000644 000765 000024 00000001616 14017154140 015373 0ustar00keversstaff000000 000000 /* determine latitude from authalic latitude */ #include #include #include "proj.h" #include "proj_internal.h" # define P00 .33333333333333333333 /* 1 / 3 */ # define P01 .17222222222222222222 /* 31 / 180 */ # define P02 .10257936507936507937 /* 517 / 5040 */ # define P10 .06388888888888888888 /* 23 / 360 */ # define P11 .06640211640211640212 /* 251 / 3780 */ # define P20 .01677689594356261023 /* 761 / 45360 */ #define APA_SIZE 3 double * pj_authset(double es) { double t, *APA; if ((APA = (double *)malloc(APA_SIZE * sizeof(double))) != nullptr) { APA[0] = es * P00; t = es * es; APA[0] += t * P01; APA[1] = t * P10; t *= es; APA[0] += t * P02; APA[1] += t * P11; APA[2] = t * P20; } return APA; } double pj_authlat(double beta, double *APA) { double t = beta+beta; return(beta + APA[0] * sin(t) + APA[1] * sin(t+t) + APA[2] * sin(t+t+t)); } proj-8.2.1/src/generate_wkt_parser.cmake000644 000765 000024 00000001700 14140020570 020751 0ustar00keversstaff000000 000000 message("Generating ${OUT_FILE}") execute_process(COMMAND "bison" "--no-lines" "-d" "-p" "${PREFIX}" "-o${OUT_FILE}" "${IN_FILE}" RESULT_VARIABLE STATUS) if(STATUS AND NOT STATUS EQUAL 0) message(FATAL_ERROR "bison failed") endif() # Post processing of the generated file # All those replacements are to please MSVC file(READ ${OUT_FILE} CONTENTS) string(REPLACE "yyerrorlab:" "#if 0\nyyerrorlab:" CONTENTS "${CONTENTS}") string(REPLACE "yyerrlab1:" "#endif\nyyerrlab1:" CONTENTS "${CONTENTS}") string(REPLACE "for (yylen = 0; yystr[yylen]; yylen++)" "for (yylen = 0; yystr && yystr[yylen]; yylen++)" CONTENTS "${CONTENTS}") string(REPLACE "return yystpcpy (yyres, yystr) - yyres;" "return (YYPTRDIFF_T)(yystpcpy (yyres, yystr) - yyres);" CONTENTS "${CONTENTS}") string(REPLACE "YYPTRDIFF_T yysize = yyssp - yyss + 1;" "YYPTRDIFF_T yysize = (YYPTRDIFF_T)(yyssp - yyss + 1);" CONTENTS "${CONTENTS}") file(WRITE "${OUT_FILE}" "${CONTENTS}") proj-8.2.1/src/datum_set.cpp000644 000765 000024 00000014616 14017154140 016423 0ustar00keversstaff000000 000000 /****************************************************************************** * Project: PROJ.4 * Purpose: Apply datum definition to PJ structure from initialization string. * Author: Frank Warmerdam, warmerda@home.com * ****************************************************************************** * Copyright (c) 2000, Frank Warmerdam * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. *****************************************************************************/ #include #include "proj.h" #include "proj_internal.h" /* SEC_TO_RAD = Pi/180/3600 */ #define SEC_TO_RAD 4.84813681109535993589914102357e-6 /************************************************************************/ /* pj_datum_set() */ /************************************************************************/ int pj_datum_set(PJ_CONTEXT *ctx, paralist *pl, PJ *projdef) { const char *name, *towgs84, *nadgrids; projdef->datum_type = PJD_UNKNOWN; /* -------------------------------------------------------------------- */ /* Is there a datum definition in the parameters list? If so, */ /* add the defining values to the parameter list. Note that */ /* this will append the ellipse definition as well as the */ /* towgs84= and related parameters. It should also be pointed */ /* out that the addition is permanent rather than temporary */ /* like most other keyword expansion so that the ellipse */ /* definition will last into the pj_ell_set() function called */ /* after this one. */ /* -------------------------------------------------------------------- */ if( (name = pj_param(ctx, pl,"sdatum").s) != nullptr ) { paralist *curr; const char *s; int i; /* find the end of the list, so we can add to it */ for (curr = pl; curr && curr->next ; curr = curr->next) {} /* cannot happen in practice, but makes static analyzers happy */ if( !curr ) return -1; /* find the datum definition */ for (i = 0; (s = pj_datums[i].id) && strcmp(name, s) ; ++i) {} if (!s) { pj_log (ctx, PJ_LOG_ERROR, _("Unknown value for datum")); proj_context_errno_set(ctx, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); return 1; } if( pj_datums[i].ellipse_id && strlen(pj_datums[i].ellipse_id) > 0 ) { char entry[100]; strcpy( entry, "ellps=" ); strncpy( entry + strlen(entry), pj_datums[i].ellipse_id, sizeof(entry) - 1 - strlen(entry) ); entry[ sizeof(entry) - 1 ] = '\0'; auto param = pj_mkparam(entry); if (nullptr == param) { proj_context_errno_set(ctx, PROJ_ERR_OTHER /*ENOMEM*/); return 1; } curr->next = param; curr = param; } if( pj_datums[i].defn && strlen(pj_datums[i].defn) > 0 ) { auto param = pj_mkparam(pj_datums[i].defn); if (nullptr == param) { proj_context_errno_set(ctx, PROJ_ERR_OTHER /*ENOMEM*/); return 1; } curr->next = param; /* curr = param; */ } } /* -------------------------------------------------------------------- */ /* Check for nadgrids parameter. */ /* -------------------------------------------------------------------- */ nadgrids = pj_param(ctx, pl,"snadgrids").s; if( nadgrids != nullptr ) { /* We don't actually save the value separately. It will continue to exist int he param list for use in pj_apply_gridshift.c */ projdef->datum_type = PJD_GRIDSHIFT; } /* -------------------------------------------------------------------- */ /* Check for towgs84 parameter. */ /* -------------------------------------------------------------------- */ else if( (towgs84 = pj_param(ctx, pl,"stowgs84").s) != nullptr ) { int parm_count = 0; const char *s; memset( projdef->datum_params, 0, sizeof(double) * 7); /* parse out the parameters */ for( s = towgs84; *s != '\0' && parm_count < 7; ) { projdef->datum_params[parm_count++] = pj_atof(s); while( *s != '\0' && *s != ',' ) s++; if( *s == ',' ) s++; } if( projdef->datum_params[3] != 0.0 || projdef->datum_params[4] != 0.0 || projdef->datum_params[5] != 0.0 || projdef->datum_params[6] != 0.0 ) { projdef->datum_type = PJD_7PARAM; /* transform from arc seconds to radians */ projdef->datum_params[3] *= SEC_TO_RAD; projdef->datum_params[4] *= SEC_TO_RAD; projdef->datum_params[5] *= SEC_TO_RAD; /* transform from parts per million to scaling factor */ projdef->datum_params[6] = (projdef->datum_params[6]/1000000.0) + 1; } else projdef->datum_type = PJD_3PARAM; /* Note that pj_init() will later switch datum_type to PJD_WGS84 if shifts are all zero, and ellipsoid is WGS84 or GRS80 */ } return 0; } proj-8.2.1/src/apps/geod_set.cpp000644 000765 000024 00000005035 14017154140 017165 0ustar00keversstaff000000 000000 #define _IN_GEOD_SET #include #include #include #include "proj.h" #include "proj_internal.h" #include "geod_interface.h" #include "emess.h" void geod_set(int argc, char **argv) { paralist *start = nullptr, *curr; double es; char *name; /* put arguments into internal linked list */ if (argc <= 0) emess(1, "no arguments in initialization list"); start = curr = pj_mkparam(argv[0]); if (!curr) emess(1, "memory allocation failed"); for (int i = 1; curr != nullptr && i < argc; ++i) { curr->next = pj_mkparam(argv[i]); if (!curr->next) emess(1, "memory allocation failed"); curr = curr->next; } /* set elliptical parameters */ if (pj_ell_set(pj_get_default_ctx(),start, &geod_a, &es)) emess(1,"ellipse setup failure"); /* set units */ if ((name = pj_param(nullptr,start, "sunits").s) != nullptr) { bool unit_found = false; auto units = proj_get_units_from_database(nullptr, nullptr, "linear", false, nullptr); for( int i = 0; units && units[i]; i++ ) { if( units[i]->proj_short_name && strcmp(units[i]->proj_short_name, name) == 0 ) { unit_found = true; to_meter = units[i]->conv_factor; fr_meter = 1 / to_meter; } } proj_unit_list_destroy(units); if( !unit_found ) emess(1,"%s unknown unit conversion id", name); } else to_meter = fr_meter = 1; geod_f = es/(1 + sqrt(1 - es)); geod_ini(); /* check if line or arc mode */ if (pj_param(nullptr,start, "tlat_1").i) { double del_S; phi1 = pj_param(nullptr,start, "rlat_1").f; lam1 = pj_param(nullptr,start, "rlon_1").f; if (pj_param(nullptr,start, "tlat_2").i) { phi2 = pj_param(nullptr,start, "rlat_2").f; lam2 = pj_param(nullptr,start, "rlon_2").f; geod_inv(); geod_pre(); } else if ((geod_S = pj_param(nullptr,start, "dS").f) != 0.) { al12 = pj_param(nullptr,start, "rA").f; geod_pre(); geod_for(); } else emess(1,"incomplete geodesic/arc info"); if ((n_alpha = pj_param(nullptr,start, "in_A").i) > 0) { if ((del_alpha = pj_param(nullptr,start, "rdel_A").f) == 0.0) emess(1,"del azimuth == 0"); } else if ((del_S = fabs(pj_param(nullptr,start, "ddel_S").f)) != 0.) { n_S = (int)(geod_S / del_S + .5); } else if ((n_S = pj_param(nullptr,start, "in_S").i) <= 0) emess(1,"no interval divisor selected"); } /* free up linked list */ for ( ; start; start = curr) { curr = start->next; free(start); } } proj-8.2.1/src/apps/geod.cpp000644 000765 000024 00000016732 14140020570 016314 0ustar00keversstaff000000 000000 /* <<<< Geodesic filter program >>>> */ #include "proj.h" # include "proj_internal.h" # include "geod_interface.h" # include "emess.h" # include # include # include # define MAXLINE 200 # define MAX_PARGS 50 # define TAB putchar('\t') static int fullout = 0, /* output full set of geodesic values */ tag = '#', /* beginning of line tag character */ pos_azi = 0, /* output azimuths as positive values */ inverse = 0; /* != 0 then inverse geodesic */ static const char *oform = nullptr; /* output format for decimal degrees */ static const char *osform = "%.3f"; /* output format for S */ static char pline[50]; /* work string */ static const char *usage = "%s\nusage: %s [-afFIlptwW [args]] [+opt[=arg] ...] [file ...]\n"; static void printLL(double p, double l) { if (oform) { (void)printf(oform, p * RAD_TO_DEG); TAB; (void)printf(oform, l * RAD_TO_DEG); } else { (void)fputs(rtodms(pline, p, 'N', 'S'),stdout); TAB; (void)fputs(rtodms(pline, l, 'E', 'W'),stdout); } } static void do_arc(void) { double az; printLL(phi2, lam2); putchar('\n'); for (az = al12; n_alpha--; ) { al12 = az = adjlon(az + del_alpha); geod_pre(); geod_for(); printLL(phi2, lam2); putchar('\n'); } } static void /* generate intermediate geodesic coordinates */ do_geod(void) { double phil, laml, del_S; phil = phi2; laml = lam2; printLL(phi1, lam1); putchar('\n'); for ( geod_S = del_S = geod_S / n_S; --n_S; geod_S += del_S) { geod_for(); printLL(phi2, lam2); putchar('\n'); } printLL(phil, laml); putchar('\n'); } static void /* file processing function */ process(FILE *fid) { char line[MAXLINE+3], *s; for (;;) { ++emess_dat.File_line; if (!(s = fgets(line, MAXLINE, fid))) break; if (!strchr(s, '\n')) { /* overlong line */ int c; strcat(s, "\n"); /* gobble up to newline */ while ((c = fgetc(fid)) != EOF && c != '\n') ; } if (*s == tag) { fputs(line, stdout); continue; } phi1 = dmstor(s, &s); lam1 = dmstor(s, &s); if (inverse) { phi2 = dmstor(s, &s); lam2 = dmstor(s, &s); geod_inv(); } else { al12 = dmstor(s, &s); geod_S = strtod(s, &s) * to_meter; geod_pre(); geod_for(); } if (!*s && (s > line)) --s; /* assumed we gobbled \n */ if (pos_azi) { if (al12 < 0.) al12 += M_TWOPI; if (al21 < 0.) al21 += M_TWOPI; } if (fullout) { printLL(phi1, lam1); TAB; printLL(phi2, lam2); TAB; if (oform) { (void)printf(oform, al12 * RAD_TO_DEG); TAB; (void)printf(oform, al21 * RAD_TO_DEG); TAB; (void)printf(osform, geod_S * fr_meter); } else { (void)fputs(rtodms(pline, al12, 0, 0), stdout); TAB; (void)fputs(rtodms(pline, al21, 0, 0), stdout); TAB; (void)printf(osform, geod_S * fr_meter); } } else if (inverse) if (oform) { (void)printf(oform, al12 * RAD_TO_DEG); TAB; (void)printf(oform, al21 * RAD_TO_DEG); TAB; (void)printf(osform, geod_S * fr_meter); } else { (void)fputs(rtodms(pline, al12, 0, 0), stdout); TAB; (void)fputs(rtodms(pline, al21, 0, 0), stdout); TAB; (void)printf(osform, geod_S * fr_meter); } else { printLL(phi2, lam2); TAB; if (oform) (void)printf(oform, al21 * RAD_TO_DEG); else (void)fputs(rtodms(pline, al21, 0, 0), stdout); } (void)fputs(s, stdout); fflush(stdout); } } static char *pargv[MAX_PARGS]; static int pargc = 0; int main(int argc, char **argv) { char *arg, **eargv = argv; FILE *fid; static int eargc = 0, c; if ((emess_dat.Prog_name = strrchr(*argv,'/')) != nullptr) ++emess_dat.Prog_name; else emess_dat.Prog_name = *argv; inverse = strncmp(emess_dat.Prog_name, "inv", 3) == 0 || strncmp(emess_dat.Prog_name, "lt-inv", 6) == 0; // older libtool have a lt- prefix if (argc <= 1 ) { (void)fprintf(stderr, usage, pj_get_release(), emess_dat.Prog_name); exit (0); } /* process run line arguments */ while (--argc > 0) { /* collect run line arguments */ if(**++argv == '-') for(arg = *argv;;) { switch(*++arg) { case '\0': /* position of "stdin" */ if (arg[-1] == '-') eargv[eargc++] = const_cast("-"); break; case 'a': /* output full set of values */ fullout = 1; continue; case 'I': /* alt. inverse spec. */ inverse = 1; continue; case 't': /* set col. one char */ if (arg[1]) tag = *++arg; else emess(1,"missing -t col. 1 tag"); continue; case 'W': /* specify seconds precision */ case 'w': /* -W for constant field width */ if ((c = arg[1]) && isdigit(c)) { set_rtodms(c - '0', *arg == 'W'); ++arg; } else emess(1,"-W argument missing or non-digit"); continue; case 'f': /* alternate output format degrees or xy */ if (--argc <= 0) noargument: emess(1,"missing argument for -%c",*arg); oform = *++argv; continue; case 'F': /* alternate output format degrees or xy */ if (--argc <= 0) goto noargument; osform = *++argv; continue; case 'l': if (!arg[1] || arg[1] == 'e') { /* list of ellipsoids */ const struct PJ_ELLPS *le; for (le=proj_list_ellps(); le->id ; ++le) (void)printf("%9s %-16s %-16s %s\n", le->id, le->major, le->ell, le->name); } else if (arg[1] == 'u') { /* list of units */ auto units = proj_get_units_from_database(nullptr, nullptr, "linear", false, nullptr); for( int i = 0; units && units[i]; i++ ) { if( units[i]->proj_short_name ) { (void)printf("%12s %-20.15g %s\n", units[i]->proj_short_name, units[i]->conv_factor, units[i]->name); } } proj_unit_list_destroy(units); } else emess(1,"invalid list option: l%c",arg[1]); exit( 0 ); case 'p': /* output azimuths as positive */ pos_azi = 1; continue; default: emess(1, "invalid option: -%c",*arg); break; } break; } else if (**argv == '+') /* + argument */ if (pargc < MAX_PARGS) pargv[pargc++] = *argv + 1; else emess(1,"overflowed + argument table"); else /* assumed to be input file name(s) */ eargv[eargc++] = *argv; } /* done with parameter and control input */ geod_set(pargc, pargv); /* setup projection */ if ((n_alpha || n_S) && eargc) emess(1,"files specified for arc/geodesic mode"); if (n_alpha) do_arc(); else if (n_S) do_geod(); else { /* process input file list */ if (eargc == 0) /* if no specific files force sysin */ eargv[eargc++] = const_cast("-"); for ( ; eargc-- ; ++eargv) { if (**eargv == '-') { fid = stdin; emess_dat.File_name = const_cast(""); } else { if ((fid = fopen(*eargv, "r")) == nullptr) { emess(-2, *eargv, "input file"); continue; } emess_dat.File_name = *eargv; } emess_dat.File_line = 0; process(fid); (void)fclose(fid); emess_dat.File_name = (char *)nullptr; } } exit(0); /* normal completion */ } proj-8.2.1/src/apps/utils.h000644 000765 000024 00000003074 13612256475 016220 0ustar00keversstaff000000 000000 /****************************************************************************** * * Project: PROJ * Purpose: Utilities for command line arguments * Author: Even Rouault * ****************************************************************************** * Copyright (c) 2019, Even Rouault * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. ****************************************************************************/ bool validate_form_string_for_numbers(const char* formatString); proj-8.2.1/src/apps/utils.cpp000644 000765 000024 00000004777 13612256475 016566 0ustar00keversstaff000000 000000 /****************************************************************************** * * Project: PROJ * Purpose: Utilities for command line arguments * Author: Even Rouault * ****************************************************************************** * Copyright (c) 2019, Even Rouault * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. ****************************************************************************/ #include "utils.h" #include bool validate_form_string_for_numbers(const char* formatString) { /* Only accepts '%[+]?[number]?[.]?[number]?[e|E|f|F|g|G]' */ bool valid = true; if( formatString[0] != '%' ) valid = false; else { auto oformLen = strlen(formatString); for( int i = 1; i < static_cast(oformLen) - 1; i++ ) { if( !(formatString[i] == '.' || formatString[i] == '+' || (formatString[i] >= '0' && formatString[i] <= '9')) ) { valid = false; break; } } if( valid ) { valid = formatString[oformLen-1] == 'e' || formatString[oformLen-1] == 'E' || formatString[oformLen-1] == 'f' || formatString[oformLen-1] == 'F' || formatString[oformLen-1] == 'g' || formatString[oformLen-1] == 'G'; } } return valid; } proj-8.2.1/src/apps/cs2cs.cpp000644 000765 000024 00000075710 14140020570 016414 0ustar00keversstaff000000 000000 /****************************************************************************** * Project: PROJ.4 * Purpose: Mainline program sort of like ``proj'' for converting between * two coordinate systems. * Author: Frank Warmerdam, warmerda@home.com * ****************************************************************************** * Copyright (c) 2000, Frank Warmerdam * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. *****************************************************************************/ #define FROM_PROJ_CPP #include #include #include #include #include #include #include #include #include #include #include #include #include #include // PROJ include order is sensitive // clang-format off #include "proj.h" #include "proj_experimental.h" #include "proj_internal.h" #include "emess.h" #include "utils.h" // clang-format on #define MAX_LINE 1000 static PJ *transformation = nullptr; static bool srcIsLongLat = false; static double srcToRadians = 0.0; static bool destIsLongLat = false; static double destToRadians = 0.0; static bool destIsLatLong = false; static int reversein = 0, /* != 0 reverse input arguments */ reverseout = 0, /* != 0 reverse output arguments */ echoin = 0, /* echo input data to output line */ tag = '#'; /* beginning of line tag character */ static const char *oform = nullptr; /* output format for x-y or decimal degrees */ static char oform_buffer[16]; /* buffer for oform when using -d */ static const char *oterr = "*\t*"; /* output line for unprojectable input */ static const char *usage = "%s\nusage: %s [-dDeEfIlrstvwW [args]]\n" " [[--area name_or_code] | [--bbox west_long,south_lat,east_long,north_lat]]\n" " [--authority {name}] [--accuracy {accuracy}] [--no-ballpark]\n" " [+opt[=arg] ...] [+to +opt[=arg] ...] [file ...]\n"; static double (*informat)(const char *, char **); /* input data deformatter function */ using namespace NS_PROJ::io; using namespace NS_PROJ::metadata; using namespace NS_PROJ::util; using namespace NS_PROJ::internal; /************************************************************************/ /* process() */ /* */ /* File processing function. */ /************************************************************************/ static void process(FILE *fid) { char line[MAX_LINE + 3], *s, pline[40]; PJ_UV data; for (;;) { double z; ++emess_dat.File_line; if (!(s = fgets(line, MAX_LINE, fid))) break; if (!strchr(s, '\n')) { /* overlong line */ int c; (void)strcat(s, "\n"); /* gobble up to newline */ while ((c = fgetc(fid)) != EOF && c != '\n') ; } if (*s == tag) { fputs(line, stdout); continue; } if (reversein) { data.v = (*informat)(s, &s); data.u = (*informat)(s, &s); } else { data.u = (*informat)(s, &s); data.v = (*informat)(s, &s); } z = strtod(s, &s); /* To avoid breaking existing tests, we read what is a possible t */ /* component of the input and rewind the s-pointer so that the final */ /* output has consistent behavior, with or without t values. */ /* This is a bit of a hack, in most cases 4D coordinates will be */ /* written to STDOUT (except when using -E) but the output format */ /* specified with -f is not respected for the t component, rather it */ /* is forward verbatim from the input. */ char *before_time = s; double t = strtod(s, &s); if( s == before_time ) t = HUGE_VAL; s = before_time; if (data.v == HUGE_VAL) data.u = HUGE_VAL; if (!*s && (s > line)) --s; /* assumed we gobbled \n */ if (echoin) { char temp; temp = *s; *s = '\0'; (void)fputs(line, stdout); *s = temp; putchar('\t'); } if (data.u != HUGE_VAL) { if (srcIsLongLat) { /* dmstor gives values to radians. Convert now to the SRS unit */ data.u /= srcToRadians; data.v /= srcToRadians; } PJ_COORD coord; coord.xyzt.x = data.u; coord.xyzt.y = data.v; coord.xyzt.z = z; coord.xyzt.t = t; coord = proj_trans(transformation, PJ_FWD, coord); data.u = coord.xyz.x; data.v = coord.xyz.y; z = coord.xyz.z; } if (data.u == HUGE_VAL) /* error output */ fputs(oterr, stdout); else if (destIsLongLat && !oform) { /*ascii DMS output */ // rtodms() expect radians: convert from the output SRS unit data.u *= destToRadians; data.v *= destToRadians; if (destIsLatLong) { if (reverseout) { fputs(rtodms(pline, data.v, 'E', 'W'), stdout); putchar('\t'); fputs(rtodms(pline, data.u, 'N', 'S'), stdout); } else { fputs(rtodms(pline, data.u, 'N', 'S'), stdout); putchar('\t'); fputs(rtodms(pline, data.v, 'E', 'W'), stdout); } } else if (reverseout) { fputs(rtodms(pline, data.v, 'N', 'S'), stdout); putchar('\t'); fputs(rtodms(pline, data.u, 'E', 'W'), stdout); } else { fputs(rtodms(pline, data.u, 'E', 'W'), stdout); putchar('\t'); fputs(rtodms(pline, data.v, 'N', 'S'), stdout); } } else { /* x-y or decimal degree ascii output */ if (destIsLongLat) { data.v *= destToRadians * RAD_TO_DEG; data.u *= destToRadians * RAD_TO_DEG; } if (reverseout) { printf(oform, data.v); putchar('\t'); printf(oform, data.u); } else { printf(oform, data.u); putchar('\t'); printf(oform, data.v); } } putchar(' '); if (oform != nullptr) printf(oform, z); else printf("%.3f", z); if (s) printf("%s", s); else printf("\n"); fflush(stdout); } } /************************************************************************/ /* instantiate_crs() */ /************************************************************************/ static PJ *instantiate_crs(const std::string &definition, bool &isLongLatCS, double &toRadians, bool &isLatFirst) { PJ *crs = proj_create(nullptr, pj_add_type_crs_if_needed(definition).c_str()); if (!crs) { return nullptr; } isLongLatCS = false; toRadians = 0.0; isLatFirst = false; auto type = proj_get_type(crs); if (type == PJ_TYPE_BOUND_CRS) { auto base = proj_get_source_crs(nullptr, crs); proj_destroy(crs); crs = base; type = proj_get_type(crs); } if (type == PJ_TYPE_GEOGRAPHIC_2D_CRS || type == PJ_TYPE_GEOGRAPHIC_3D_CRS || type == PJ_TYPE_GEODETIC_CRS) { auto cs = proj_crs_get_coordinate_system(nullptr, crs); assert(cs); const char *axisName = ""; proj_cs_get_axis_info(nullptr, cs, 0, &axisName, // name, nullptr, // abbrev nullptr, // direction &toRadians, nullptr, // unit name nullptr, // unit authority nullptr // unit code ); isLatFirst = NS_PROJ::internal::ci_find(std::string(axisName), "latitude") != std::string::npos; isLongLatCS = isLatFirst || NS_PROJ::internal::ci_find(std::string(axisName), "longitude") != std::string::npos; proj_destroy(cs); } return crs; } /************************************************************************/ /* get_geog_crs_proj_string_from_proj_crs() */ /************************************************************************/ static std::string get_geog_crs_proj_string_from_proj_crs(PJ *src, double &toRadians, bool &isLatFirst) { auto srcType = proj_get_type(src); if (srcType != PJ_TYPE_PROJECTED_CRS) { return std::string(); } auto base = proj_get_source_crs(nullptr, src); assert(base); auto baseType = proj_get_type(base); if (baseType != PJ_TYPE_GEOGRAPHIC_2D_CRS && baseType != PJ_TYPE_GEOGRAPHIC_3D_CRS) { proj_destroy(base); return std::string(); } auto cs = proj_crs_get_coordinate_system(nullptr, base); assert(cs); const char *axisName = ""; proj_cs_get_axis_info(nullptr, cs, 0, &axisName, // name, nullptr, // abbrev nullptr, // direction &toRadians, nullptr, // unit name nullptr, // unit authority nullptr // unit code ); isLatFirst = NS_PROJ::internal::ci_find(std::string(axisName), "latitude") != std::string::npos; proj_destroy(cs); auto retCStr = proj_as_proj_string(nullptr, base, PJ_PROJ_5, nullptr); std::string ret(retCStr ? retCStr : ""); proj_destroy(base); return ret; } /************************************************************************/ /* main() */ /************************************************************************/ int main(int argc, char **argv) { char *arg; char **eargv = argv; std::string fromStr; std::string toStr; FILE *fid; int eargc = 0, mon = 0; int have_to_flag = 0, inverse = 0; int use_env_locale = 0; /* This is just to check that pj_init() is locale-safe */ /* Used by nad/testvarious */ if (getenv("PROJ_USE_ENV_LOCALE") != nullptr) use_env_locale = 1; /* Enable compatibility mode for init=epsg:XXXX by default */ if (getenv("PROJ_USE_PROJ4_INIT_RULES") == nullptr) { proj_context_use_proj4_init_rules(nullptr, true); } if ((emess_dat.Prog_name = strrchr(*argv, DIR_CHAR)) != nullptr) ++emess_dat.Prog_name; else emess_dat.Prog_name = *argv; inverse = !strncmp(emess_dat.Prog_name, "inv", 3); if (argc <= 1) { (void)fprintf(stderr, usage, pj_get_release(), emess_dat.Prog_name); exit(0); } // First pass to check if we have "cs2cs [-bla]* []" syntax bool isProj4StyleSyntax = false; for (int i = 1; i < argc; i++) { if (argv[i][0] == '+') { isProj4StyleSyntax = true; break; } } ExtentPtr bboxFilter; std::string area; const char* authority = nullptr; double accuracy = -1; bool allowBallpark = true; /* process run line arguments */ while (--argc > 0) { /* collect run line arguments */ ++argv; if (strcmp(*argv, "--area") == 0 ) { ++argv; --argc; if( argc == 0 ) { emess(1, "missing argument for --area"); std::exit(1); } area = *argv; } else if (strcmp(*argv, "--bbox") == 0) { ++argv; --argc; if( argc == 0 ) { emess(1, "missing argument for --bbox"); std::exit(1); } auto bboxStr(*argv); auto bbox(split(bboxStr, ',')); if (bbox.size() != 4) { std::cerr << "Incorrect number of values for option --bbox: " << bboxStr << std::endl; std::exit(1); } try { bboxFilter = Extent::createFromBBOX( c_locale_stod(bbox[0]), c_locale_stod(bbox[1]), c_locale_stod(bbox[2]), c_locale_stod(bbox[3])) .as_nullable(); } catch (const std::exception &e) { std::cerr << "Invalid value for option --bbox: " << bboxStr << ", " << e.what() << std::endl; std::exit(1); } } else if (strcmp(*argv, "--accuracy") == 0 ) { ++argv; --argc; if( argc == 0 ) { emess(1, "missing argument for --accuracy"); std::exit(1); } try { accuracy = c_locale_stod(*argv); } catch (const std::exception &e) { std::cerr << "Invalid value for option --accuracy: " << e.what() << std::endl; std::exit(1); } } else if (strcmp(*argv, "--authority") == 0 ) { ++argv; --argc; if( argc == 0 ) { emess(1, "missing argument for --authority"); std::exit(1); } authority = *argv; } else if (strcmp(*argv, "--no-ballpark") == 0 ) { allowBallpark = false; } else if (**argv == '-') { for (arg = *argv;;) { switch (*++arg) { case '\0': /* position of "stdin" */ if (arg[-1] == '-') eargv[eargc++] = const_cast("-"); break; case 'v': /* monitor dump of initialization */ mon = 1; continue; case 'I': /* alt. method to spec inverse */ inverse = 1; continue; case 'E': /* echo ascii input to ascii output */ echoin = 1; continue; case 't': /* set col. one char */ if (arg[1]) tag = *++arg; else emess(1, "missing -t col. 1 tag"); continue; case 'l': /* list projections, ellipses or units */ if (!arg[1] || arg[1] == 'p' || arg[1] == 'P') { /* list projections */ const struct PJ_LIST *lp; int do_long = arg[1] == 'P', c; const char *str; for (lp = proj_list_operations(); lp->id; ++lp) { (void)printf("%s : ", lp->id); if (do_long) /* possibly multiline description */ (void)puts(*lp->descr); else { /* first line, only */ str = *lp->descr; while ((c = *str++) && c != '\n') putchar(c); putchar('\n'); } } } else if (arg[1] == '=') { /* list projection 'descr' */ const struct PJ_LIST *lp; arg += 2; for (lp = proj_list_operations(); lp->id; ++lp) if (!strcmp(lp->id, arg)) { (void)printf("%9s : %s\n", lp->id, *lp->descr); break; } } else if (arg[1] == 'e') { /* list ellipses */ const struct PJ_ELLPS *le; for (le = proj_list_ellps(); le->id; ++le) (void)printf("%9s %-16s %-16s %s\n", le->id, le->major, le->ell, le->name); } else if (arg[1] == 'u') { /* list units */ auto units = proj_get_units_from_database(nullptr, nullptr, "linear", false, nullptr); for( int i = 0; units && units[i]; i++ ) { if( units[i]->proj_short_name ) { (void)printf("%12s %-20.15g %s\n", units[i]->proj_short_name, units[i]->conv_factor, units[i]->name); } } proj_unit_list_destroy(units); } else if (arg[1] == 'm') { /* list prime meridians */ const struct PJ_PRIME_MERIDIANS *lpm; for (lpm = proj_list_prime_meridians(); lpm->id; ++lpm) (void)printf("%12s %-30s\n", lpm->id, lpm->defn); } else emess(1, "invalid list option: l%c", arg[1]); exit(0); /* cppcheck-suppress duplicateBreak */ continue; /* artificial */ case 'e': /* error line alternative */ if (--argc <= 0) noargument: emess(1, "missing argument for -%c", *arg); oterr = *++argv; continue; case 'W': /* specify seconds precision */ case 'w': /* -W for constant field width */ { char c = arg[1]; if (c != 0 && isdigit(c)) { set_rtodms(c - '0', *arg == 'W'); ++arg; } else emess(1, "-W argument missing or non-digit"); continue; } case 'f': /* alternate output format degrees or xy */ if (--argc <= 0) goto noargument; oform = *++argv; continue; case 'r': /* reverse input */ reversein = 1; continue; case 's': /* reverse output */ reverseout = 1; continue; case 'D': /* set debug level */ { if (--argc <= 0) goto noargument; int log_level = atoi(*++argv); if (log_level <= 0) { proj_log_level(pj_get_default_ctx(), PJ_LOG_NONE); } else if (log_level == 1) { proj_log_level(pj_get_default_ctx(), PJ_LOG_ERROR); } else if (log_level == 2) { proj_log_level(pj_get_default_ctx(), PJ_LOG_DEBUG); } else if (log_level == 3) { proj_log_level(pj_get_default_ctx(), PJ_LOG_TRACE); } else { proj_log_level(pj_get_default_ctx(), PJ_LOG_TELL); } continue; } case 'd': if (--argc <= 0) goto noargument; sprintf(oform_buffer, "%%.%df", atoi(*++argv)); oform = oform_buffer; break; default: emess(1, "invalid option: -%c", *arg); break; } break; } } else if (!isProj4StyleSyntax) { if (fromStr.empty()) fromStr = *argv; else if( toStr.empty() ) toStr = *argv; else { /* assumed to be input file name(s) */ eargv[eargc++] = *argv; } } else if (strcmp(*argv, "+to") == 0) { have_to_flag = 1; } else if (**argv == '+') { /* + argument */ if (have_to_flag) { if (!toStr.empty()) toStr += ' '; toStr += *argv; } else { if (!fromStr.empty()) fromStr += ' '; fromStr += *argv; } } else if (!have_to_flag) { fromStr = *argv; } else if (toStr.empty()) { toStr = *argv; } else /* assumed to be input file name(s) */ eargv[eargc++] = *argv; } if (eargc == 0) /* if no specific files force sysin */ eargv[eargc++] = const_cast("-"); if( oform ) { if( !validate_form_string_for_numbers(oform) ) { emess(3, "invalid format string"); exit(0); } } if (bboxFilter && !area.empty()) { std::cerr << "ERROR: --bbox and --area are exclusive" << std::endl; std::exit(1); } PJ_AREA* pj_area = nullptr; if (!area.empty()) { DatabaseContextPtr dbContext; try { dbContext = DatabaseContext::create().as_nullable(); } catch (const std::exception &e) { std::cerr << "ERROR: Cannot create database connection: " << e.what() << std::endl; std::exit(1); } // Process area of use try { if (area.find(' ') == std::string::npos && area.find(':') != std::string::npos) { auto tokens = split(area, ':'); if (tokens.size() == 2) { const std::string &areaAuth = tokens[0]; const std::string &areaCode = tokens[1]; bboxFilter = AuthorityFactory::create( NN_NO_CHECK(dbContext), areaAuth) ->createExtent(areaCode) .as_nullable(); } } if (!bboxFilter) { auto authFactory = AuthorityFactory::create( NN_NO_CHECK(dbContext), std::string()); auto res = authFactory->listAreaOfUseFromName(area, false); if (res.size() == 1) { bboxFilter = AuthorityFactory::create(NN_NO_CHECK(dbContext), res.front().first) ->createExtent(res.front().second) .as_nullable(); } else { res = authFactory->listAreaOfUseFromName(area, true); if (res.size() == 1) { bboxFilter = AuthorityFactory::create(NN_NO_CHECK(dbContext), res.front().first) ->createExtent(res.front().second) .as_nullable(); } else if (res.empty()) { std::cerr << "No area of use matching provided name" << std::endl; std::exit(1); } else { std::cerr << "Several candidates area of use " "matching provided name :" << std::endl; for (const auto &candidate : res) { auto obj = AuthorityFactory::create( NN_NO_CHECK(dbContext), candidate.first) ->createExtent(candidate.second); std::cerr << " " << candidate.first << ":" << candidate.second << " : " << *obj->description() << std::endl; } std::exit(1); } } } } catch (const std::exception &e) { std::cerr << "Area of use retrieval failed: " << e.what() << std::endl; std::exit(1); } } if (bboxFilter) { auto geogElts = bboxFilter->geographicElements(); if (geogElts.size() == 1) { auto bbox = std::dynamic_pointer_cast( geogElts[0].as_nullable()); if (bbox) { pj_area = proj_area_create(); proj_area_set_bbox(pj_area, bbox->westBoundLongitude(), bbox->southBoundLatitude(), bbox->eastBoundLongitude(), bbox->northBoundLatitude()); } } } /* * If the user has requested inverse, then just reverse the * coordinate systems. */ if (inverse) { std::swap(fromStr, toStr); } if (use_env_locale) { /* Set locale from environment */ setlocale(LC_ALL, ""); } if (fromStr.empty() && toStr.empty()) { emess(3, "missing source and target coordinate systems"); } proj_context_use_proj4_init_rules(nullptr, proj_context_get_use_proj4_init_rules(nullptr, TRUE)); PJ *src = nullptr; if (!fromStr.empty()) { bool ignored; src = instantiate_crs(fromStr, srcIsLongLat, srcToRadians, ignored); if (!src) { emess(3, "cannot instantiate source coordinate system"); } } PJ *dst = nullptr; if (!toStr.empty()) { dst = instantiate_crs(toStr, destIsLongLat, destToRadians, destIsLatLong); if (!dst) { emess(3, "cannot instantiate target coordinate system"); } } if (toStr.empty()) { assert(src); toStr = get_geog_crs_proj_string_from_proj_crs(src, destToRadians, destIsLatLong); if (toStr.empty()) { emess(3, "missing target CRS and source CRS is not a projected CRS"); } destIsLongLat = true; } else if (fromStr.empty()) { assert(dst); bool ignored; fromStr = get_geog_crs_proj_string_from_proj_crs(dst, srcToRadians, ignored); if (fromStr.empty()) { emess(3, "missing source CRS and target CRS is not a projected CRS"); } srcIsLongLat = true; } proj_destroy(src); proj_destroy(dst); src = proj_create(nullptr, pj_add_type_crs_if_needed(fromStr).c_str()); dst = proj_create(nullptr, pj_add_type_crs_if_needed(toStr).c_str()); if( proj_get_type(src) == PJ_TYPE_COMPOUND_CRS || proj_get_type(dst) == PJ_TYPE_COMPOUND_CRS ) { auto src3D = proj_crs_promote_to_3D(nullptr, nullptr, src); if( src3D ) { proj_destroy(src); src = src3D; } auto dst3D = proj_crs_promote_to_3D(nullptr, nullptr, dst); if( dst3D ) { proj_destroy(dst); dst = dst3D; } } std::string authorityOption; /* keep this variable in this outer scope ! */ std::string accuracyOption; /* keep this variable in this outer scope ! */ std::vector options; if( authority ) { authorityOption = "AUTHORITY="; authorityOption += authority; options.push_back(authorityOption.data()); } if( accuracy >= 0 ) { accuracyOption = "ACCURACY="; accuracyOption += toString(accuracy); options.push_back(accuracyOption.data()); } if( !allowBallpark ) { options.push_back("ALLOW_BALLPARK=NO"); } options.push_back(nullptr); transformation = proj_create_crs_to_crs_from_pj(nullptr, src, dst, pj_area, options.data()); proj_destroy(src); proj_destroy(dst); proj_area_destroy(pj_area); if (!transformation) { emess(3, "cannot initialize transformation\ncause: %s", proj_errno_string(proj_context_errno(nullptr))); } if (use_env_locale) { /* Restore C locale to avoid issues in parsing/outputting numbers*/ setlocale(LC_ALL, "C"); } if (mon) { printf("%c ---- From Coordinate System ----\n", tag); printf("%s\n", fromStr.c_str()); printf("%c ---- To Coordinate System ----\n", tag); printf("%s\n", toStr.c_str()); } /* set input formatting control */ if (!srcIsLongLat) informat = strtod; else { informat = dmstor; } if (!destIsLongLat && !oform) oform = "%.2f"; /* process input file list */ for (; eargc--; ++eargv) { if (**eargv == '-') { fid = stdin; emess_dat.File_name = const_cast(""); } else { if ((fid = fopen(*eargv, "rt")) == nullptr) { emess(-2, *eargv, "input file"); continue; } emess_dat.File_name = *eargv; } emess_dat.File_line = 0; process(fid); fclose(fid); emess_dat.File_name = nullptr; } proj_destroy(transformation); proj_cleanup(); exit(0); /* normal completion */ } proj-8.2.1/src/apps/proj_strtod.h000644 000765 000024 00000000200 13437770506 017416 0ustar00keversstaff000000 000000 /* Internal header for proj_strtod.c */ double proj_strtod(const char *str, char **endptr); double proj_atof(const char *str); proj-8.2.1/src/apps/projsync.cpp000644 000765 000024 00000062407 14067153334 017262 0ustar00keversstaff000000 000000 /****************************************************************************** * Project: PROJ * Purpose: Downloader tool * Author: Even Rouault, * ****************************************************************************** * Copyright (c) 2020, Even Rouault, * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. *****************************************************************************/ //! @cond Doxygen_Suppress #define FROM_PROJ_CPP #include #include #include #include #include #include "filemanager.hpp" #include "proj.h" #include "proj_internal.h" #include "proj/internal/include_nlohmann_json.hpp" #include "proj/internal/internal.hpp" using json = nlohmann::json; using namespace NS_PROJ::internal; // --------------------------------------------------------------------------- namespace { class ParsingException : public std::exception { std::string msg_; public: explicit ParsingException(const char *msg) : msg_(msg) {} const char *what() const noexcept override { return msg_.c_str(); } }; } // namespace // --------------------------------------------------------------------------- static void usage() { std::cerr << "usage: projsync " << std::endl; std::cerr << " [--endpoint URL]" << std::endl; std::cerr << " [--local-geojson-file FILENAME]" << std::endl; std::cerr << " ([--user-writable-directory] | " "[--system-directory] | [--target-dir DIRNAME])" << std::endl; std::cerr << " [--bbox west_long,south_lat,east_long,north_lat]" << std::endl; std::cerr << " [--spatial-test contains|intersects]" << std::endl; std::cerr << " [--source-id ID] [--area-of-use NAME]" << std::endl; std::cerr << " [--file NAME]" << std::endl; std::cerr << " [--all] [--exclude-world-coverage]" << std::endl; std::cerr << " [--quiet | --verbose] [--dry-run] [--list-files]" << std::endl; std::cerr << " [--no-version-filtering]" << std::endl; std::exit(1); } // --------------------------------------------------------------------------- static std::vector get_bbox(const json &j) { std::vector res; if (j.size() == 2 && j[0].is_number() && j[1].is_number()) { res.push_back(j[0].get()); res.push_back(j[1].get()); res.push_back(j[0].get()); res.push_back(j[1].get()); } else { for (const auto &obj : j) { if (obj.is_array()) { const auto subres = get_bbox(obj); if (subres.size() == 4) { if (res.empty()) { res = subres; } else { res[0] = std::min(res[0], subres[0]); res[1] = std::min(res[1], subres[1]); res[2] = std::max(res[2], subres[2]); res[3] = std::max(res[3], subres[3]); } } } } } return res; } // --------------------------------------------------------------------------- int main(int argc, char *argv[]) { auto ctx = pj_get_default_ctx(); std::string targetDir; std::string endpoint(proj_context_get_url_endpoint(ctx)); const std::string geojsonFile("files.geojson"); std::string queriedSourceId; std::string queriedAreaOfUse; bool listFiles = false; bool dryRun = false; bool hasQueriedBbox = false; double queried_west = 0.0; double queried_south = 0.0; double queried_east = 0.0; double queried_north = 0.0; bool intersects = true; bool quiet = false; bool verbose = false; bool includeWorldCoverage = true; bool queryAll = false; std::string queriedFilename; std::string files_geojson_local; bool versionFiltering = true; for (int i = 1; i < argc; i++) { std::string arg(argv[i]); if (arg == "--endpoint" && i + 1 < argc) { i++; endpoint = argv[i]; } else if (arg == "--user-writable-directory") { // do nothing } else if (arg == "--system-directory") { targetDir = pj_get_relative_share_proj(ctx); #ifdef PROJ_LIB if (targetDir.empty()) { targetDir = PROJ_LIB; } #endif } else if (arg == "--target-dir" && i + 1 < argc) { i++; targetDir = argv[i]; } else if (arg == "--local-geojson-file" && i + 1 < argc) { i++; files_geojson_local = argv[i]; } else if (arg == "--list-files") { listFiles = true; } else if (arg == "--source-id" && i + 1 < argc) { i++; queriedSourceId = argv[i]; } else if (arg == "--area-of-use" && i + 1 < argc) { i++; queriedAreaOfUse = argv[i]; } else if (arg == "--file" && i + 1 < argc) { i++; queriedFilename = argv[i]; } else if (arg == "--bbox" && i + 1 < argc) { i++; auto bboxStr(argv[i]); auto bbox(split(bboxStr, ',')); if (bbox.size() != 4) { std::cerr << "Incorrect number of values for option --bbox: " << bboxStr << std::endl; usage(); } try { queried_west = c_locale_stod(bbox[0]); queried_south = c_locale_stod(bbox[1]); queried_east = c_locale_stod(bbox[2]); queried_north = c_locale_stod(bbox[3]); } catch (const std::exception &e) { std::cerr << "Invalid value for option --bbox: " << bboxStr << ", " << e.what() << std::endl; usage(); } if (queried_west > 180 && queried_east > queried_west) { queried_west -= 360; queried_east -= 360; } else if (queried_west < -180 && queried_east > queried_west) { queried_west += 360; queried_east += 360; } else if (fabs(queried_west) < 180 && fabs(queried_east) < 180 && queried_east < queried_west) { queried_east += 360; } hasQueriedBbox = true; } else if (arg == "--spatial-test" && i + 1 < argc) { i++; const std::string value(argv[i]); if (ci_equal(value, "contains")) { intersects = false; } else if (ci_equal(value, "intersects")) { intersects = true; } else { std::cerr << "Unrecognized value for option --spatial-test: " << value << std::endl; usage(); } } else if (arg == "--dry-run") { dryRun = true; } else if (arg == "--exclude-world-coverage") { includeWorldCoverage = false; } else if (arg == "--all") { queryAll = true; } else if (arg == "--no-version-filtering") { versionFiltering = false; } else if (arg == "-q" || arg == "--quiet") { quiet = true; } else if (arg == "--verbose") { verbose = true; } else { usage(); } } if (!listFiles && queriedFilename.empty() && queriedSourceId.empty() && queriedAreaOfUse.empty() && !hasQueriedBbox && !queryAll) { std::cerr << "At least one of --list-files, --file, --source-id, " "--area-of-use, --bbox or --all must be specified." << std::endl << std::endl; usage(); } if (targetDir.empty()) { targetDir = proj_context_get_user_writable_directory(ctx, true); } else { if (targetDir.back() == '/') { targetDir.resize(targetDir.size() - 1); } // This is used by projsync() to determine where to write files. pj_context_set_user_writable_directory(ctx, targetDir); } if (!endpoint.empty() && endpoint.back() == '/') { endpoint.resize(endpoint.size() - 1); } if (!quiet && !listFiles) { std::cout << "Downloading from " << endpoint << " into " << targetDir << std::endl; } proj_context_set_enable_network(ctx, true); if (files_geojson_local.empty()) { const std::string files_geojson_url(endpoint + '/' + geojsonFile); if (!proj_download_file(ctx, files_geojson_url.c_str(), false, nullptr, nullptr)) { std::cerr << "Cannot download " << geojsonFile << std::endl; std::exit(1); } files_geojson_local = targetDir + '/' + geojsonFile; } auto file = NS_PROJ::FileManager::open(ctx, files_geojson_local.c_str(), NS_PROJ::FileAccess::READ_ONLY); if (!file) { std::cerr << "Cannot open " << files_geojson_local << std::endl; std::exit(1); } std::string text; while (true) { bool maxLenReached = false; bool eofReached = false; text += file->read_line(1000000, maxLenReached, eofReached); if (maxLenReached) { std::cerr << "Error while parsing " << geojsonFile << " : too long line" << std::endl; std::exit(1); } if (eofReached) break; } file.reset(); if (listFiles) { std::cout << "filename,source_id,area_of_use,file_size" << std::endl; } std::string proj_data_version_str; int proj_data_version_major = 0; int proj_data_version_minor = 0; { const char *proj_data_version = proj_context_get_database_metadata(ctx, "PROJ_DATA.VERSION"); if (proj_data_version) { proj_data_version_str = proj_data_version; const auto tokens = split(proj_data_version, '.'); if (tokens.size() >= 2) { proj_data_version_major = atoi(tokens[0].c_str()); proj_data_version_minor = atoi(tokens[1].c_str()); } } } try { const auto j = json::parse(text); bool foundMatchSourceIdCriterion = false; std::set source_ids; bool foundMatchAreaOfUseCriterion = false; std::set areas_of_use; bool foundMatchFileCriterion = false; std::set files; if (!j.is_object() || !j.contains("features")) { throw ParsingException("no features member"); } std::vector to_download; unsigned long long total_size_to_download = 0; const auto features = j["features"]; for (const auto &feat : features) { if (!feat.is_object()) { continue; } if (!feat.contains("properties")) { continue; } const auto properties = feat["properties"]; if (!properties.is_object()) { continue; } if (!properties.contains("name")) { continue; } const auto j_name = properties["name"]; if (!j_name.is_string()) { continue; } const auto name(j_name.get()); if (versionFiltering && proj_data_version_major > 0 && properties.contains("version_added")) { const auto j_version_added = properties["version_added"]; if (j_version_added.is_string()) { const auto version_added( j_version_added.get()); const auto tokens = split(version_added, '.'); if (tokens.size() >= 2) { int version_major = atoi(tokens[0].c_str()); int version_minor = atoi(tokens[1].c_str()); if (proj_data_version_major < version_major || (proj_data_version_major == version_major && proj_data_version_minor < version_minor)) { // File only useful for a later PROJ version if (verbose) { std::cout << "Skipping " << name << " as it is only useful starting " "with PROJ-data " << version_added << " and we are targetting " << proj_data_version_str << std::endl; } continue; } } } } if (versionFiltering && proj_data_version_major > 0 && properties.contains("version_removed")) { const auto j_version_removed = properties["version_removed"]; if (j_version_removed.is_string()) { const auto version_removed( j_version_removed.get()); const auto tokens = split(version_removed, '.'); if (tokens.size() >= 2) { int version_major = atoi(tokens[0].c_str()); int version_minor = atoi(tokens[1].c_str()); if (proj_data_version_major > version_major || (proj_data_version_major == version_major && proj_data_version_minor >= version_minor)) { // File only useful for a previous PROJ version if (verbose) { std::cout << "Skipping " << name << " as it is no longer useful " "starting with PROJ-data " << version_removed << " and we are targetting " << proj_data_version_str << std::endl; } continue; } } } } files.insert(name); if (!properties.contains("source_id")) { continue; } const auto j_source_id = properties["source_id"]; if (!j_source_id.is_string()) { continue; } const auto source_id(j_source_id.get()); source_ids.insert(source_id); std::string area_of_use; if (properties.contains("area_of_use")) { const auto j_area_of_use = properties["area_of_use"]; if (j_area_of_use.is_string()) { area_of_use = j_area_of_use.get(); areas_of_use.insert(area_of_use); } } unsigned long long file_size = 0; if (properties.contains("file_size")) { const auto j_file_size = properties["file_size"]; if (j_file_size.type() == json::value_t::number_unsigned) { file_size = j_file_size.get(); } } const bool matchSourceId = queryAll || queriedSourceId.empty() || source_id.find(queriedSourceId) != std::string::npos; if (!queriedSourceId.empty() && source_id.find(queriedSourceId) != std::string::npos) { foundMatchSourceIdCriterion = true; } const bool matchAreaOfUse = queryAll || queriedAreaOfUse.empty() || area_of_use.find(queriedAreaOfUse) != std::string::npos; if (!queriedAreaOfUse.empty() && area_of_use.find(queriedAreaOfUse) != std::string::npos) { foundMatchAreaOfUseCriterion = true; } const bool matchFile = queryAll || queriedFilename.empty() || name.find(queriedFilename) != std::string::npos; if (!queriedFilename.empty() && name.find(queriedFilename) != std::string::npos) { foundMatchFileCriterion = true; } bool matchBbox = true; if (queryAll || hasQueriedBbox) { matchBbox = false; do { if (!feat.contains("geometry")) { if (queryAll) { matchBbox = true; } break; } const auto j_geometry = feat["geometry"]; if (!j_geometry.is_object()) { if (queryAll) { matchBbox = true; } break; } if (!j_geometry.contains("coordinates")) { break; } const auto j_coordinates = j_geometry["coordinates"]; if (!j_coordinates.is_array()) { break; } if (!j_geometry.contains("type")) { break; } const auto j_geometry_type = j_geometry["type"]; if (!j_geometry_type.is_string()) { break; } const auto geometry_type( j_geometry_type.get()); std::vector grid_bbox; if (geometry_type == "MultiPolygon") { std::vector> grid_bboxes; bool foundMinus180 = false; bool foundPlus180 = false; for (const auto &obj : j_coordinates) { if (obj.is_array()) { const auto tmp = get_bbox(obj); if (tmp.size() == 4) { if (tmp[0] == -180) foundMinus180 = true; else if (tmp[2] == 180) foundPlus180 = true; grid_bboxes.push_back(tmp); } } } for (auto &bbox : grid_bboxes) { if (foundMinus180 && foundPlus180 && bbox[0] == -180) { bbox[0] = 180; bbox[2] += 360; } if (grid_bbox.empty()) { grid_bbox = bbox; } else { grid_bbox[0] = std::min(grid_bbox[0], bbox[0]); grid_bbox[1] = std::min(grid_bbox[1], bbox[1]); grid_bbox[2] = std::max(grid_bbox[2], bbox[2]); grid_bbox[3] = std::max(grid_bbox[3], bbox[3]); } } } else { grid_bbox = get_bbox(j_coordinates); } if (grid_bbox.size() != 4) { break; } double grid_w = grid_bbox[0]; const double grid_s = grid_bbox[1]; double grid_e = grid_bbox[2]; const double grid_n = grid_bbox[3]; if (grid_e - grid_w > 359 && grid_n - grid_s > 179) { if (!includeWorldCoverage) { break; } grid_w = -std::numeric_limits::max(); grid_e = std::numeric_limits::max(); } else if (grid_e > 180 && queried_west < -180) { grid_w -= 360; grid_e -= 360; } if (queryAll) { matchBbox = true; break; } if (intersects) { if (queried_west < grid_e && grid_w < queried_east && queried_south < grid_n && grid_s < queried_north) { matchBbox = true; } } else { if (grid_w >= queried_west && grid_s >= queried_south && grid_e <= queried_east && grid_n <= queried_north) { matchBbox = true; } } } while (false); } if (matchFile && matchSourceId && matchAreaOfUse && matchBbox) { if (listFiles) { std::cout << name << "," << area_of_use << "," << source_id << "," << file_size << std::endl; continue; } const std::string resource_url(endpoint + '/' + name); if (proj_is_download_needed(ctx, resource_url.c_str(), false)) { total_size_to_download += file_size; to_download.push_back(resource_url); } else { if (!quiet) { std::cout << resource_url << " already downloaded." << std::endl; } } } } if (!quiet && !listFiles && total_size_to_download > 0) { if (total_size_to_download > 1024 * 1024) std::cout << "Total size to download: " << total_size_to_download / (1024 * 1024) << " MB" << std::endl; else std::cout << "Total to download: " << total_size_to_download << " bytes" << std::endl; } for (size_t i = 0; i < to_download.size(); ++i) { const auto &url = to_download[i]; if (!quiet) { if (dryRun) { std::cout << "Would download "; } else { std::cout << "Downloading "; } std::cout << url << "... (" << i + 1 << " / " << to_download.size() << ")" << std::endl; } if (!dryRun && !proj_download_file(ctx, url.c_str(), false, nullptr, nullptr)) { std::cerr << "Cannot download " << url << std::endl; std::exit(1); } } if (!queriedSourceId.empty() && !foundMatchSourceIdCriterion) { std::cerr << "Warning: '" << queriedSourceId << "' is a unknown value for --source-id." << std::endl; std::cerr << "Known values are:" << std::endl; for (const auto &v : source_ids) { std::cerr << " " << v << std::endl; } std::exit(1); } if (!queriedAreaOfUse.empty() && !foundMatchAreaOfUseCriterion) { std::cerr << "Warning: '" << queriedAreaOfUse << "' is a unknown value for --area-of-use." << std::endl; std::cerr << "Known values are:" << std::endl; for (const auto &v : areas_of_use) { std::cerr << " " << v << std::endl; } std::exit(1); } if (!queriedFilename.empty() && !foundMatchFileCriterion) { std::cerr << "Warning: '" << queriedFilename << "' is a unknown value for --file." << std::endl; std::cerr << "Known values are:" << std::endl; for (const auto &v : files) { std::cerr << " " << v << std::endl; } std::exit(1); } } catch (const std::exception &e) { std::cerr << "Error: " << e.what() << std::endl; std::exit(1); } return 0; } //! @endcond proj-8.2.1/src/apps/cct.cpp000644 000765 000024 00000046360 14067153334 016164 0ustar00keversstaff000000 000000 /*********************************************************************** The cct 4D Transformation program ************************************************************************ cct is a 4D equivalent to the "proj" projection program. cct is an acronym meaning "Coordinate Conversion and Transformation". The acronym refers to definitions given in the OGC 08-015r2/ISO-19111 standard "Geographical Information -- Spatial Referencing by Coordinates", which defines two different classes of coordinate operations: *Coordinate Conversions*, which are coordinate operations where input and output datum are identical (e.g. conversion from geographical to cartesian coordinates) and *Coordinate Transformations*, which are coordinate operations where input and output datums differ (e.g. change of reference frame). cct, however, also refers to Carl Christian Tscherning (1942--2014), professor of Geodesy at the University of Copenhagen, mentor and advisor for a generation of Danish geodesists, colleague and collaborator for two generations of global geodesists, Secretary General for the International Association of Geodesy, IAG (1995--2007), fellow of the American Geophysical Union (1991), recipient of the IAG Levallois Medal (2007), the European Geosciences Union Vening Meinesz Medal (2008), and of numerous other honours. cct, or Christian, as he was known to most of us, was recognized for his good mood, his sharp wit, his tireless work, and his great commitment to the development of geodesy - both through his scientific contributions, comprising more than 250 publications, and by his mentoring and teaching of the next generations of geodesists. As Christian was an avid Fortran programmer, and a keen Unix connoisseur, he would have enjoyed to know that his initials would be used to name a modest Unix style transformation filter, hinting at the tireless aspect of his personality, which was certainly one of the reasons he accomplished so much, and meant so much to so many people. Hence, in honour of cct (the geodesist) this is cct (the program). ************************************************************************ Thomas Knudsen, thokn@sdfe.dk, 2016-05-25/2017-10-26 ************************************************************************ * Copyright (c) 2016, 2017 Thomas Knudsen * Copyright (c) 2017, SDFE * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. ***********************************************************************/ #include #include #include #include #include #include #include // std::ifstream #include #include "proj.h" #include "proj_internal.h" #include "proj_strtod.h" #include "optargpm.h" static void logger(void *data, int level, const char *msg); static void print(PJ_LOG_LEVEL log_level, const char *fmt, ...); /* Prototypes from functions in this file */ char *column (char *buf, int n); PJ_COORD parse_input_line (char *buf, int *columns, double fixed_height, double fixed_time); static const char usage[] = { "--------------------------------------------------------------------------------\n" "Usage: %s [-options]... [+operator_specs]... infile...\n" "--------------------------------------------------------------------------------\n" "Options:\n" "--------------------------------------------------------------------------------\n" " -c x,y,z,t Specify input columns for (up to) 4 input parameters.\n" " Defaults to 1,2,3,4\n" " -d n Specify number of decimals in output.\n" " -I Do the inverse transformation\n" " -o /path/to/file Specify output file name\n" " -t value Provide a fixed t value for all input data (e.g. -t 0)\n" " -z value Provide a fixed z value for all input data (e.g. -z 0)\n" " -s n Skip n first lines of a infile\n" " -v Verbose: Provide non-essential informational output.\n" " Repeat -v for more verbosity (e.g. -vv)\n" "--------------------------------------------------------------------------------\n" "Long Options:\n" "--------------------------------------------------------------------------------\n" " --output Alias for -o\n" " --columns Alias for -c\n" " --decimals Alias for -d\n" " --height Alias for -z\n" " --time Alias for -t\n" " --verbose Alias for -v\n" " --inverse Alias for -I\n" " --skip-lines Alias for -s\n" " --help Alias for -h\n" " --version Print version number\n" "--------------------------------------------------------------------------------\n" "Operator Specs:\n" "--------------------------------------------------------------------------------\n" "The operator specs describe the action to be performed by cct, e.g:\n" "\n" " +proj=utm +ellps=GRS80 +zone=32\n" "\n" "instructs cct to convert input data to Universal Transverse Mercator, zone 32\n" "coordinates, based on the GRS80 ellipsoid.\n" "\n" "Hence, the command\n" "\n" " echo 12 55 | cct -z0 -t0 +proj=utm +zone=32 +ellps=GRS80\n" "\n" "Should give results comparable to the classic proj command\n" "\n" " echo 12 55 | proj +proj=utm +zone=32 +ellps=GRS80\n" "--------------------------------------------------------------------------------\n" "Examples:\n" "--------------------------------------------------------------------------------\n" "1. convert geographical input to UTM zone 32 on the GRS80 ellipsoid:\n" " cct +proj=utm +ellps=GRS80 +zone=32\n" "2. roundtrip accuracy check for the case above:\n" " cct +proj=pipeline +proj=utm +ellps=GRS80 +zone=32 +step +step +inv\n" "3. as (1) but specify input columns for longitude, latitude, height and time:\n" " cct -c 5,2,1,4 +proj=utm +ellps=GRS80 +zone=32\n" "4. as (1) but specify fixed height and time, hence needing only 2 cols in input:\n" " cct -t 0 -z 0 +proj=utm +ellps=GRS80 +zone=32\n" "--------------------------------------------------------------------------------\n" }; static void logger(void *data, int level, const char *msg) { FILE *stream; int log_tell = proj_log_level(PJ_DEFAULT_CTX, PJ_LOG_TELL); stream = (FILE *) data; /* if we use PJ_LOG_NONE we always want to print stuff to stream */ if (level == PJ_LOG_NONE) { fprintf(stream, "%s\n", msg); return; } /* otherwise only print if log level set by user is high enough or error */ if (level <= log_tell || level == PJ_LOG_ERROR) fprintf(stderr, "%s\n", msg); } FILE *fout; static void print(PJ_LOG_LEVEL log_level, const char *fmt, ...) { va_list args; char *msg_buf; va_start( args, fmt ); msg_buf = (char *) malloc(100000); if( msg_buf == nullptr ) { va_end( args ); return; } vsprintf( msg_buf, fmt, args ); logger((void *) fout, log_level, msg_buf); va_end( args ); free( msg_buf ); } int main(int argc, char **argv) { PJ *P = nullptr; PJ_COORD point; PJ_PROJ_INFO info; OPTARGS *o; char blank_comment[] = ""; char whitespace[] = " "; char *comment; char *comment_delimiter; char *buf; int i, nfields = 4, skip_lines = 0, verbose; double fixed_z = HUGE_VAL, fixed_time = HUGE_VAL; int decimals_angles = 10; int decimals_distances = 4; int columns_xyzt[] = {1, 2, 3, 4}; const char *longflags[] = {"v=verbose", "h=help", "I=inverse", "version", nullptr}; const char *longkeys[] = { "o=output", "c=columns", "d=decimals", "z=height", "t=time", "s=skip-lines", nullptr}; fout = stdout; /* coverity[tainted_data] */ o = opt_parse (argc, argv, "hvI", "cdozts", longflags, longkeys); if (nullptr==o) return 0; if (opt_given (o, "h") || argc==1) { printf (usage, o->progname); return 0; } PJ_DIRECTION direction = opt_given (o, "I")? PJ_INV: PJ_FWD; verbose = MIN(opt_given (o, "v"), 3); /* log level can't be larger than 3 */ if( verbose > 0 ) { proj_log_level (PJ_DEFAULT_CTX, static_cast(verbose)); } proj_log_func (PJ_DEFAULT_CTX, (void *) fout, logger); if (opt_given (o, "version")) { print (PJ_LOG_NONE, "%s: %s", o->progname, pj_get_release ()); return 0; } if (opt_given (o, "o")) fout = fopen (opt_arg (o, "output"), "wt"); if (nullptr==fout) { print (PJ_LOG_ERROR, "%s: Cannot open '%s' for output", o->progname, opt_arg (o, "output")); free (o); return 1; } print (PJ_LOG_TRACE, "%s: Running in very verbose mode", o->progname); if (opt_given (o, "z")) { fixed_z = proj_atof (opt_arg (o, "z")); nfields--; } if (opt_given (o, "t")) { fixed_time = proj_atof (opt_arg (o, "t")); nfields--; } if (opt_given (o, "d")) { int dec = atoi (opt_arg (o, "d")); decimals_angles = dec; decimals_distances = dec; } if (opt_given (o, "s")) { skip_lines = atoi (opt_arg(o, "s")); } if (opt_given (o, "c")) { int ncols; /* reset column numbers to ease comment output later on */ for (i=0; i<4; i++) columns_xyzt[i] = 0; /* cppcheck-suppress invalidscanf */ ncols = sscanf (opt_arg (o, "c"), "%d,%d,%d,%d", columns_xyzt, columns_xyzt+1, columns_xyzt+2, columns_xyzt+3); if (ncols != nfields) { print (PJ_LOG_ERROR, "%s: Too few input columns given: '%s'", o->progname, opt_arg (o, "c")); free (o); if (stdout != fout) fclose (fout); return 1; } } /* Setup transformation */ if (o-> pargc == 0 && o->fargc > 0) { std::string input(o->fargv[0]); if (!input.empty() && input[0] == '@') { std::ifstream fs; auto filename = input.substr(1); fs.open(filename, std::fstream::in | std::fstream::binary); if (!fs.is_open()) { std::cerr << "cannot open " << filename << std::endl; std::exit(1); } input.clear(); while (!fs.eof()) { char buffer[256]; fs.read(buffer, sizeof(buffer)); input.append(buffer, static_cast(fs.gcount())); if (input.size() > 100 * 1000) { fs.close(); std::cerr << "too big file " << filename << std::endl; std::exit(1); } } fs.close(); } /* Assume we got a auth:code combination */ auto n = input.find(":"); if (n > 0) { std::string auth = input.substr(0,n); std::string code = input.substr(n+1, input.length()); // Check that the authority matches one of the known ones auto authorityList = proj_get_authorities_from_database(nullptr); if( authorityList ) { for( auto iter = authorityList; *iter; iter++ ) { if( *iter == auth ) { P = proj_create_from_database( nullptr, auth.c_str(), code.c_str(), PJ_CATEGORY_COORDINATE_OPERATION, 0, nullptr); break; } } proj_string_list_destroy(authorityList); } } if( P == nullptr ) { /* if we didn't get a auth:code combo we try to see if the input matches */ /* anything else */ P = proj_create(nullptr, input.c_str()); } /* If instantiating operation without +-options optargpm thinks the input is */ /* a file, hence we move all o->fargv entries one place closer to the start */ /* of the array. This effectively overwrites the input and only leaves a list */ /* of files in o->fargv. */ o->fargc = o->fargc-1; for (int j=0; j < o->fargc; j++) { o->fargv[j] = o->fargv[j+1]; } } else { P = proj_create_argv (nullptr, o->pargc, o->pargv); } if (nullptr==P) { print (PJ_LOG_ERROR, "%s: Bad transformation arguments - (%s)\n '%s -h' for help", o->progname, proj_errno_string (proj_errno(P)), o->progname); free (o); if (stdout != fout) fclose (fout); return 1; } info = proj_pj_info (P); print (PJ_LOG_TRACE, "Final: %s argc=%d pargc=%d", info.definition, argc, o->pargc); if (direction== PJ_INV) { /* fail if an inverse operation is not available */ if (!info.has_inverse) { print (PJ_LOG_ERROR, "Inverse operation not available"); if (stdout != fout) fclose (fout); return 1; } /* We have no API call for inverting an operation, so we brute force it. */ P->inverted = !(P->inverted); } direction = PJ_FWD; /* Allocate input buffer */ buf = static_cast(calloc (1, 10000)); if (nullptr==buf) { print (PJ_LOG_ERROR, "%s: Out of memory", o->progname); proj_destroy (P); free (o); if (stdout != fout) fclose (fout); return 1; } /* Loop over all records of all input files */ while (opt_input_loop (o, optargs_file_format_text)) { int err; void *ret = fgets (buf, 10000, o->input); char *c = column (buf, 1); opt_eof_handler (o); if (nullptr==ret) { print (PJ_LOG_ERROR, "Read error in record %d", (int) o->record_index); continue; } point = parse_input_line (buf, columns_xyzt, fixed_z, fixed_time); if (skip_lines > 0) { skip_lines--; continue; } /* if it's a comment or blank line, we reflect it */ if (c && ((*c=='\0') || (*c=='#'))) { fprintf (fout, "%s", buf); continue; } if (HUGE_VAL==point.xyzt.x) { /* otherwise, it must be a syntax error */ print (PJ_LOG_NONE, "# Record %d UNREADABLE: %s", (int) o->record_index, buf); print (PJ_LOG_ERROR, "%s: Could not parse file '%s' line %d", o->progname, opt_filename (o), opt_record (o)); continue; } if (proj_angular_input (P, direction)) { point.lpzt.lam = proj_torad (point.lpzt.lam); point.lpzt.phi = proj_torad (point.lpzt.phi); } err = proj_errno_reset (P); /* coverity[returned_value] */ point = proj_trans (P, direction, point); if (HUGE_VAL==point.xyzt.x) { /* transformation error */ print (PJ_LOG_NONE, "# Record %d TRANSFORMATION ERROR: %s (%s)", (int) o->record_index, buf, proj_errno_string (proj_errno(P))); proj_errno_restore (P, err); continue; } proj_errno_restore (P, err); /* handle comment string */ comment = column(buf, nfields+1); if (opt_given(o, "c")) { /* what number is the last coordinate column in the input data? */ int colmax = 0; for (i=0; i<4; i++) colmax = MAX(colmax, columns_xyzt[i]); comment = column(buf, colmax+1); } /* remove the line feed from comment, as logger() above, invoked by print() below (output), will add one */ size_t len = strlen(comment); if (len >= 1) comment[len - 1] = '\0'; comment_delimiter = *comment ? whitespace : blank_comment; /* Time to print the result */ /* use same arguments to printf format string for both radians and degrees; convert radians to degrees before printing */ if (proj_angular_output (P, direction) || proj_degree_output (P, direction)) { if (proj_angular_output (P, direction)) { point.lpzt.lam = proj_todeg (point.lpzt.lam); point.lpzt.phi = proj_todeg (point.lpzt.phi); } print (PJ_LOG_NONE, "%14.*f %14.*f %12.*f %12.4f%s%s", decimals_angles, point.xyzt.x, decimals_angles, point.xyzt.y, decimals_distances, point.xyzt.z, point.xyzt.t, comment_delimiter, comment ); } else print (PJ_LOG_NONE, "%13.*f %13.*f %12.*f %12.4f%s%s", decimals_distances, point.xyzt.x, decimals_distances, point.xyzt.y, decimals_distances, point.xyzt.z, point.xyzt.t, comment_delimiter, comment ); if( fout == stdout ) fflush(stdout); } proj_destroy(P); if (stdout != fout) fclose (fout); free (o); free (buf); return 0; } /* return a pointer to the n'th column of buf */ char *column (char *buf, int n) { int i; if (n <= 0) return buf; for (i = 0; i < n; i++) { while (isspace(*buf)) buf++; if (i == n - 1) break; while ((0 != *buf) && !isspace(*buf)) buf++; } return buf; } /* column to double */ static double cold (char *args, int col) { char *endp; char *target; double d; target = column (args, col); d = proj_strtod (target, &endp); if (endp==target) return HUGE_VAL; return d; } PJ_COORD parse_input_line (char *buf, int *columns, double fixed_height, double fixed_time) { PJ_COORD err = proj_coord (HUGE_VAL, HUGE_VAL, HUGE_VAL, HUGE_VAL); PJ_COORD result = err; int prev_errno = errno; errno = 0; result.xyzt.z = fixed_height; result.xyzt.t = fixed_time; result.xyzt.x = cold (buf, columns[0]); result.xyzt.y = cold (buf, columns[1]); if (result.xyzt.z==HUGE_VAL) result.xyzt.z = cold (buf, columns[2]); if (result.xyzt.t==HUGE_VAL) result.xyzt.t = cold (buf, columns[3]); if (0!=errno) return err; errno = prev_errno; return result; } proj-8.2.1/src/apps/emess.h000644 000765 000024 00000001003 13612256475 016162 0ustar00keversstaff000000 000000 /* Error message processing header file */ #ifndef EMESS_H #define EMESS_H struct EMESS { char *File_name, /* input file name */ *Prog_name; /* name of program */ int File_line; /* approximate line read where error occurred */ }; #ifdef EMESS_ROUTINE /* use type */ /* for emess procedure */ struct EMESS emess_dat = { nullptr, nullptr, 0 }; #else /* for for calling procedures */ extern struct EMESS emess_dat; #endif /* use type */ void emess(int, const char *, ...); #endif /* end EMESS_H */ proj-8.2.1/src/apps/optargpm.h000644 000765 000024 00000052325 14067153334 016707 0ustar00keversstaff000000 000000 /*********************************************************************** OPTARGPM - a header-only library for decoding PROJ.4 style command line options Thomas Knudsen, 2017-09-10 ************************************************************************ For PROJ.4 command line programs, we have a somewhat complex option decoding situation, since we have to navigate in a cocktail of classic single letter style options, prefixed by "-", GNU style long options prefixed by "--", transformation specification elements prefixed by "+", and input file names prefixed by "" (i.e. nothing). Hence, classic getopt.h style decoding does not cut the mustard, so this is an attempt to catch up and chop the ketchup. Since optargpm (for "optarg plus minus") does not belong, in any obvious way, in any systems development library, it is provided as a "header only" library. While this is conventional in C++, it is frowned at in plain C. But frown away - "header only" has its places, and this is one of them. By convention, we expect a command line to consist of the following elements: [short ("-")/long ("--") options} [operator ("+") specs] [operands/input files] or less verbose: [options] [operator specs] [operands] or less abstract: proj -I --output=foo +proj=utm +zone=32 +ellps=GRS80 bar baz... Where Operator is proj Options are -I --output=foo Operator specs are +proj=utm +zone=32 +ellps=GRS80 Operands are bar baz While neither claiming to save the world, nor to hint at the "shape of jazz to come", at least optargpm has shown useful in constructing cs2cs style transformation filters. Supporting a wide range of option syntax, the getoptpm API is somewhat quirky, but also compact, consisting of one data type, 3(+2) functions, and one enumeration: OPTARGS Housekeeping data type. An instance of OPTARGS is conventionally called o or opt opt_parse (opt, argc, argv ...): The work horse: Define supported options; Split (argc, argv) into groups (options, op specs, operands); Parse option arguments. opt_given (o, option): The number of times